1 |
commit: a435a0a68c5f50f33231d974dc564c153c825d1f |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 3 12:18:47 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 3 12:18:47 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=a435a0a6 |
7 |
|
8 |
Linux patch 4.17.12 |
9 |
|
10 |
0000_README | 4 + |
11 |
1011_linux-4.17.12.patch | 11595 +++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 11599 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index a0836f2..6e0bb48 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -87,6 +87,10 @@ Patch: 1010_linux-4.17.11.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.17.11 |
21 |
|
22 |
+Patch: 1011_linux-4.17.12.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.17.12 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1011_linux-4.17.12.patch b/1011_linux-4.17.12.patch |
31 |
new file mode 100644 |
32 |
index 0000000..9dd5854 |
33 |
--- /dev/null |
34 |
+++ b/1011_linux-4.17.12.patch |
35 |
@@ -0,0 +1,11595 @@ |
36 |
+diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.txt b/Documentation/devicetree/bindings/net/dsa/qca8k.txt |
37 |
+index 9c67ee4890d7..bbcb255c3150 100644 |
38 |
+--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt |
39 |
++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt |
40 |
+@@ -2,7 +2,10 @@ |
41 |
+ |
42 |
+ Required properties: |
43 |
+ |
44 |
+-- compatible: should be "qca,qca8337" |
45 |
++- compatible: should be one of: |
46 |
++ "qca,qca8334" |
47 |
++ "qca,qca8337" |
48 |
++ |
49 |
+ - #size-cells: must be 0 |
50 |
+ - #address-cells: must be 1 |
51 |
+ |
52 |
+@@ -14,6 +17,20 @@ port and PHY id, each subnode describing a port needs to have a valid phandle |
53 |
+ referencing the internal PHY connected to it. The CPU port of this switch is |
54 |
+ always port 0. |
55 |
+ |
56 |
++A CPU port node has the following optional node: |
57 |
++ |
58 |
++- fixed-link : Fixed-link subnode describing a link to a non-MDIO |
59 |
++ managed entity. See |
60 |
++ Documentation/devicetree/bindings/net/fixed-link.txt |
61 |
++ for details. |
62 |
++ |
63 |
++For QCA8K the 'fixed-link' sub-node supports only the following properties: |
64 |
++ |
65 |
++- 'speed' (integer, mandatory), to indicate the link speed. Accepted |
66 |
++ values are 10, 100 and 1000 |
67 |
++- 'full-duplex' (boolean, optional), to indicate that full duplex is |
68 |
++ used. When absent, half duplex is assumed. |
69 |
++ |
70 |
+ Example: |
71 |
+ |
72 |
+ |
73 |
+@@ -53,6 +70,10 @@ Example: |
74 |
+ label = "cpu"; |
75 |
+ ethernet = <&gmac1>; |
76 |
+ phy-mode = "rgmii"; |
77 |
++ fixed-link { |
78 |
++ speed = 1000; |
79 |
++ full-duplex; |
80 |
++ }; |
81 |
+ }; |
82 |
+ |
83 |
+ port@1 { |
84 |
+diff --git a/Documentation/devicetree/bindings/net/meson-dwmac.txt b/Documentation/devicetree/bindings/net/meson-dwmac.txt |
85 |
+index 61cada22ae6c..1321bb194ed9 100644 |
86 |
+--- a/Documentation/devicetree/bindings/net/meson-dwmac.txt |
87 |
++++ b/Documentation/devicetree/bindings/net/meson-dwmac.txt |
88 |
+@@ -11,6 +11,7 @@ Required properties on all platforms: |
89 |
+ - "amlogic,meson8b-dwmac" |
90 |
+ - "amlogic,meson8m2-dwmac" |
91 |
+ - "amlogic,meson-gxbb-dwmac" |
92 |
++ - "amlogic,meson-axg-dwmac" |
93 |
+ Additionally "snps,dwmac" and any applicable more |
94 |
+ detailed version number described in net/stmmac.txt |
95 |
+ should be used. |
96 |
+diff --git a/Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt |
97 |
+index 2c12f9789116..54ecb8ab7788 100644 |
98 |
+--- a/Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt |
99 |
++++ b/Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt |
100 |
+@@ -3,8 +3,10 @@ |
101 |
+ Required properties for the root node: |
102 |
+ - compatible: one of "amlogic,meson8-cbus-pinctrl" |
103 |
+ "amlogic,meson8b-cbus-pinctrl" |
104 |
++ "amlogic,meson8m2-cbus-pinctrl" |
105 |
+ "amlogic,meson8-aobus-pinctrl" |
106 |
+ "amlogic,meson8b-aobus-pinctrl" |
107 |
++ "amlogic,meson8m2-aobus-pinctrl" |
108 |
+ "amlogic,meson-gxbb-periphs-pinctrl" |
109 |
+ "amlogic,meson-gxbb-aobus-pinctrl" |
110 |
+ "amlogic,meson-gxl-periphs-pinctrl" |
111 |
+diff --git a/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt b/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt |
112 |
+index 74b2f03c1515..fa56697a1ba6 100644 |
113 |
+--- a/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt |
114 |
++++ b/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt |
115 |
+@@ -7,6 +7,7 @@ Required properties: |
116 |
+ - "renesas,r7s72100-wdt" (RZ/A1) |
117 |
+ - "renesas,r8a7795-wdt" (R-Car H3) |
118 |
+ - "renesas,r8a7796-wdt" (R-Car M3-W) |
119 |
++ - "renesas,r8a77965-wdt" (R-Car M3-N) |
120 |
+ - "renesas,r8a77970-wdt" (R-Car V3M) |
121 |
+ - "renesas,r8a77995-wdt" (R-Car D3) |
122 |
+ |
123 |
+diff --git a/Documentation/vfio-mediated-device.txt b/Documentation/vfio-mediated-device.txt |
124 |
+index 1b3950346532..c3f69bcaf96e 100644 |
125 |
+--- a/Documentation/vfio-mediated-device.txt |
126 |
++++ b/Documentation/vfio-mediated-device.txt |
127 |
+@@ -145,6 +145,11 @@ The functions in the mdev_parent_ops structure are as follows: |
128 |
+ * create: allocate basic resources in a driver for a mediated device |
129 |
+ * remove: free resources in a driver when a mediated device is destroyed |
130 |
+ |
131 |
++(Note that mdev-core provides no implicit serialization of create/remove |
132 |
++callbacks per mdev parent device, per mdev type, or any other categorization. |
133 |
++Vendor drivers are expected to be fully asynchronous in this respect or |
134 |
++provide their own internal resource protection.) |
135 |
++ |
136 |
+ The callbacks in the mdev_parent_ops structure are as follows: |
137 |
+ |
138 |
+ * open: open callback of mediated device |
139 |
+diff --git a/Makefile b/Makefile |
140 |
+index e2664c641109..790e8faf0ddc 100644 |
141 |
+--- a/Makefile |
142 |
++++ b/Makefile |
143 |
+@@ -1,7 +1,7 @@ |
144 |
+ # SPDX-License-Identifier: GPL-2.0 |
145 |
+ VERSION = 4 |
146 |
+ PATCHLEVEL = 17 |
147 |
+-SUBLEVEL = 11 |
148 |
++SUBLEVEL = 12 |
149 |
+ EXTRAVERSION = |
150 |
+ NAME = Merciless Moray |
151 |
+ |
152 |
+diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi |
153 |
+index 42ea246e71cb..fec1241b858f 100644 |
154 |
+--- a/arch/arm/boot/dts/emev2.dtsi |
155 |
++++ b/arch/arm/boot/dts/emev2.dtsi |
156 |
+@@ -31,13 +31,13 @@ |
157 |
+ #address-cells = <1>; |
158 |
+ #size-cells = <0>; |
159 |
+ |
160 |
+- cpu@0 { |
161 |
++ cpu0: cpu@0 { |
162 |
+ device_type = "cpu"; |
163 |
+ compatible = "arm,cortex-a9"; |
164 |
+ reg = <0>; |
165 |
+ clock-frequency = <533000000>; |
166 |
+ }; |
167 |
+- cpu@1 { |
168 |
++ cpu1: cpu@1 { |
169 |
+ device_type = "cpu"; |
170 |
+ compatible = "arm,cortex-a9"; |
171 |
+ reg = <1>; |
172 |
+@@ -57,6 +57,7 @@ |
173 |
+ compatible = "arm,cortex-a9-pmu"; |
174 |
+ interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>, |
175 |
+ <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>; |
176 |
++ interrupt-affinity = <&cpu0>, <&cpu1>; |
177 |
+ }; |
178 |
+ |
179 |
+ clocks@e0110000 { |
180 |
+diff --git a/arch/arm/boot/dts/imx53-ppd.dts b/arch/arm/boot/dts/imx53-ppd.dts |
181 |
+index d5628af2e301..563451167e7f 100644 |
182 |
+--- a/arch/arm/boot/dts/imx53-ppd.dts |
183 |
++++ b/arch/arm/boot/dts/imx53-ppd.dts |
184 |
+@@ -559,8 +559,6 @@ |
185 |
+ status = "okay"; |
186 |
+ |
187 |
+ port@2 { |
188 |
+- reg = <2>; |
189 |
+- |
190 |
+ lvds0_out: endpoint { |
191 |
+ remote-endpoint = <&panel_in_lvds0>; |
192 |
+ }; |
193 |
+diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi |
194 |
+index 3d65c0192f69..ab4fc5b99ad3 100644 |
195 |
+--- a/arch/arm/boot/dts/imx53.dtsi |
196 |
++++ b/arch/arm/boot/dts/imx53.dtsi |
197 |
+@@ -488,6 +488,10 @@ |
198 |
+ remote-endpoint = <&ipu_di0_lvds0>; |
199 |
+ }; |
200 |
+ }; |
201 |
++ |
202 |
++ port@2 { |
203 |
++ reg = <2>; |
204 |
++ }; |
205 |
+ }; |
206 |
+ |
207 |
+ lvds-channel@1 { |
208 |
+@@ -503,6 +507,10 @@ |
209 |
+ remote-endpoint = <&ipu_di1_lvds1>; |
210 |
+ }; |
211 |
+ }; |
212 |
++ |
213 |
++ port@2 { |
214 |
++ reg = <2>; |
215 |
++ }; |
216 |
+ }; |
217 |
+ }; |
218 |
+ |
219 |
+diff --git a/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi |
220 |
+index a32089132263..855dc6f9df75 100644 |
221 |
+--- a/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi |
222 |
++++ b/arch/arm/boot/dts/imx6qdl-wandboard-revb1.dtsi |
223 |
+@@ -17,7 +17,6 @@ |
224 |
+ imx6qdl-wandboard { |
225 |
+ pinctrl_hog: hoggrp { |
226 |
+ fsl,pins = < |
227 |
+- MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* GPIO_0_CLKO */ |
228 |
+ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* uSDHC1 CD */ |
229 |
+ MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000 /* uSDHC3 CD */ |
230 |
+ MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x0f0b0 /* WL_REF_ON */ |
231 |
+diff --git a/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi |
232 |
+index 8d893a78cdf0..49a0a557e62e 100644 |
233 |
+--- a/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi |
234 |
++++ b/arch/arm/boot/dts/imx6qdl-wandboard-revc1.dtsi |
235 |
+@@ -17,7 +17,6 @@ |
236 |
+ imx6qdl-wandboard { |
237 |
+ pinctrl_hog: hoggrp { |
238 |
+ fsl,pins = < |
239 |
+- MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 /* GPIO_0_CLKO */ |
240 |
+ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* uSDHC1 CD */ |
241 |
+ MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000 /* uSDHC3 CD */ |
242 |
+ MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00 0x0f0b0 /* WIFI_ON (reset, active low) */ |
243 |
+diff --git a/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi |
244 |
+index 3a8a4952d45e..69d9c8661439 100644 |
245 |
+--- a/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi |
246 |
++++ b/arch/arm/boot/dts/imx6qdl-wandboard-revd1.dtsi |
247 |
+@@ -147,7 +147,6 @@ |
248 |
+ imx6qdl-wandboard { |
249 |
+ pinctrl_hog: hoggrp { |
250 |
+ fsl,pins = < |
251 |
+- MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 |
252 |
+ MX6QDL_PAD_EIM_D22__USB_OTG_PWR 0x80000000 /* USB Power Enable */ |
253 |
+ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* USDHC1 CD */ |
254 |
+ MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000 /* uSDHC3 CD */ |
255 |
+diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi |
256 |
+index ed96d7b5feab..6b0a86fa72d3 100644 |
257 |
+--- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi |
258 |
++++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi |
259 |
+@@ -83,6 +83,8 @@ |
260 |
+ status = "okay"; |
261 |
+ |
262 |
+ codec: sgtl5000@a { |
263 |
++ pinctrl-names = "default"; |
264 |
++ pinctrl-0 = <&pinctrl_mclk>; |
265 |
+ compatible = "fsl,sgtl5000"; |
266 |
+ reg = <0x0a>; |
267 |
+ clocks = <&clks IMX6QDL_CLK_CKO>; |
268 |
+@@ -142,6 +144,12 @@ |
269 |
+ >; |
270 |
+ }; |
271 |
+ |
272 |
++ pinctrl_mclk: mclkgrp { |
273 |
++ fsl,pins = < |
274 |
++ MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 |
275 |
++ >; |
276 |
++ }; |
277 |
++ |
278 |
+ pinctrl_spdif: spdifgrp { |
279 |
+ fsl,pins = < |
280 |
+ MX6QDL_PAD_ENET_RXD0__SPDIF_OUT 0x1b0b0 |
281 |
+diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi |
282 |
+index 914a7c2a584f..b0c20544df20 100644 |
283 |
+--- a/arch/arm/boot/dts/sh73a0.dtsi |
284 |
++++ b/arch/arm/boot/dts/sh73a0.dtsi |
285 |
+@@ -22,7 +22,7 @@ |
286 |
+ #address-cells = <1>; |
287 |
+ #size-cells = <0>; |
288 |
+ |
289 |
+- cpu@0 { |
290 |
++ cpu0: cpu@0 { |
291 |
+ device_type = "cpu"; |
292 |
+ compatible = "arm,cortex-a9"; |
293 |
+ reg = <0>; |
294 |
+@@ -31,7 +31,7 @@ |
295 |
+ power-domains = <&pd_a2sl>; |
296 |
+ next-level-cache = <&L2>; |
297 |
+ }; |
298 |
+- cpu@1 { |
299 |
++ cpu1: cpu@1 { |
300 |
+ device_type = "cpu"; |
301 |
+ compatible = "arm,cortex-a9"; |
302 |
+ reg = <1>; |
303 |
+@@ -91,6 +91,7 @@ |
304 |
+ compatible = "arm,cortex-a9-pmu"; |
305 |
+ interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>, |
306 |
+ <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; |
307 |
++ interrupt-affinity = <&cpu0>, <&cpu1>; |
308 |
+ }; |
309 |
+ |
310 |
+ cmt1: timer@e6138000 { |
311 |
+diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi b/arch/arm/boot/dts/stih407-pinctrl.dtsi |
312 |
+index 53c6888d1fc0..e393519fb84c 100644 |
313 |
+--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi |
314 |
++++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi |
315 |
+@@ -52,7 +52,7 @@ |
316 |
+ st,syscfg = <&syscfg_sbc>; |
317 |
+ reg = <0x0961f080 0x4>; |
318 |
+ reg-names = "irqmux"; |
319 |
+- interrupts = <GIC_SPI 188 IRQ_TYPE_NONE>; |
320 |
++ interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; |
321 |
+ interrupt-names = "irqmux"; |
322 |
+ ranges = <0 0x09610000 0x6000>; |
323 |
+ |
324 |
+@@ -376,7 +376,7 @@ |
325 |
+ st,syscfg = <&syscfg_front>; |
326 |
+ reg = <0x0920f080 0x4>; |
327 |
+ reg-names = "irqmux"; |
328 |
+- interrupts = <GIC_SPI 189 IRQ_TYPE_NONE>; |
329 |
++ interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>; |
330 |
+ interrupt-names = "irqmux"; |
331 |
+ ranges = <0 0x09200000 0x10000>; |
332 |
+ |
333 |
+@@ -936,7 +936,7 @@ |
334 |
+ st,syscfg = <&syscfg_front>; |
335 |
+ reg = <0x0921f080 0x4>; |
336 |
+ reg-names = "irqmux"; |
337 |
+- interrupts = <GIC_SPI 190 IRQ_TYPE_NONE>; |
338 |
++ interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>; |
339 |
+ interrupt-names = "irqmux"; |
340 |
+ ranges = <0 0x09210000 0x10000>; |
341 |
+ |
342 |
+@@ -969,7 +969,7 @@ |
343 |
+ st,syscfg = <&syscfg_rear>; |
344 |
+ reg = <0x0922f080 0x4>; |
345 |
+ reg-names = "irqmux"; |
346 |
+- interrupts = <GIC_SPI 191 IRQ_TYPE_NONE>; |
347 |
++ interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>; |
348 |
+ interrupt-names = "irqmux"; |
349 |
+ ranges = <0 0x09220000 0x6000>; |
350 |
+ |
351 |
+@@ -1164,7 +1164,7 @@ |
352 |
+ st,syscfg = <&syscfg_flash>; |
353 |
+ reg = <0x0923f080 0x4>; |
354 |
+ reg-names = "irqmux"; |
355 |
+- interrupts = <GIC_SPI 192 IRQ_TYPE_NONE>; |
356 |
++ interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>; |
357 |
+ interrupt-names = "irqmux"; |
358 |
+ ranges = <0 0x09230000 0x3000>; |
359 |
+ |
360 |
+diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi |
361 |
+index 3313005ee15c..888548ea9b5c 100644 |
362 |
+--- a/arch/arm/boot/dts/stih410.dtsi |
363 |
++++ b/arch/arm/boot/dts/stih410.dtsi |
364 |
+@@ -43,7 +43,7 @@ |
365 |
+ ohci0: usb@9a03c00 { |
366 |
+ compatible = "st,st-ohci-300x"; |
367 |
+ reg = <0x9a03c00 0x100>; |
368 |
+- interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; |
369 |
++ interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; |
370 |
+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
371 |
+ <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; |
372 |
+ resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
373 |
+@@ -58,7 +58,7 @@ |
374 |
+ ehci0: usb@9a03e00 { |
375 |
+ compatible = "st,st-ehci-300x"; |
376 |
+ reg = <0x9a03e00 0x100>; |
377 |
+- interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; |
378 |
++ interrupts = <GIC_SPI 151 IRQ_TYPE_LEVEL_HIGH>; |
379 |
+ pinctrl-names = "default"; |
380 |
+ pinctrl-0 = <&pinctrl_usb0>; |
381 |
+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
382 |
+@@ -75,7 +75,7 @@ |
383 |
+ ohci1: usb@9a83c00 { |
384 |
+ compatible = "st,st-ohci-300x"; |
385 |
+ reg = <0x9a83c00 0x100>; |
386 |
+- interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; |
387 |
++ interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>; |
388 |
+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
389 |
+ <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; |
390 |
+ resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
391 |
+@@ -90,7 +90,7 @@ |
392 |
+ ehci1: usb@9a83e00 { |
393 |
+ compatible = "st,st-ehci-300x"; |
394 |
+ reg = <0x9a83e00 0x100>; |
395 |
+- interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; |
396 |
++ interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>; |
397 |
+ pinctrl-names = "default"; |
398 |
+ pinctrl-0 = <&pinctrl_usb1>; |
399 |
+ clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
400 |
+@@ -202,7 +202,7 @@ |
401 |
+ reg = <0x8d04000 0x1000>; |
402 |
+ reg-names = "hdmi-reg"; |
403 |
+ #sound-dai-cells = <0>; |
404 |
+- interrupts = <GIC_SPI 106 IRQ_TYPE_NONE>; |
405 |
++ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; |
406 |
+ interrupt-names = "irq"; |
407 |
+ clock-names = "pix", |
408 |
+ "tmds", |
409 |
+@@ -254,7 +254,7 @@ |
410 |
+ bdisp0:bdisp@9f10000 { |
411 |
+ compatible = "st,stih407-bdisp"; |
412 |
+ reg = <0x9f10000 0x1000>; |
413 |
+- interrupts = <GIC_SPI 38 IRQ_TYPE_NONE>; |
414 |
++ interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>; |
415 |
+ clock-names = "bdisp"; |
416 |
+ clocks = <&clk_s_c0_flexgen CLK_IC_BDISP_0>; |
417 |
+ }; |
418 |
+@@ -263,8 +263,8 @@ |
419 |
+ compatible = "st,st-hva"; |
420 |
+ reg = <0x8c85000 0x400>, <0x6000000 0x40000>; |
421 |
+ reg-names = "hva_registers", "hva_esram"; |
422 |
+- interrupts = <GIC_SPI 58 IRQ_TYPE_NONE>, |
423 |
+- <GIC_SPI 59 IRQ_TYPE_NONE>; |
424 |
++ interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>, |
425 |
++ <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; |
426 |
+ clock-names = "clk_hva"; |
427 |
+ clocks = <&clk_s_c0_flexgen CLK_HVA>; |
428 |
+ }; |
429 |
+@@ -292,7 +292,7 @@ |
430 |
+ reg = <0x94a087c 0x64>; |
431 |
+ clocks = <&clk_sysin>; |
432 |
+ clock-names = "cec-clk"; |
433 |
+- interrupts = <GIC_SPI 140 IRQ_TYPE_NONE>; |
434 |
++ interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; |
435 |
+ interrupt-names = "cec-irq"; |
436 |
+ pinctrl-names = "default"; |
437 |
+ pinctrl-0 = <&pinctrl_cec0_default>; |
438 |
+diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c |
439 |
+index 5539fba892ce..ba2c10d1db4a 100644 |
440 |
+--- a/arch/arm/net/bpf_jit_32.c |
441 |
++++ b/arch/arm/net/bpf_jit_32.c |
442 |
+@@ -708,7 +708,7 @@ static inline void emit_a32_arsh_r64(const u8 dst[], const u8 src[], bool dstk, |
443 |
+ } |
444 |
+ |
445 |
+ /* dst = dst >> src */ |
446 |
+-static inline void emit_a32_lsr_r64(const u8 dst[], const u8 src[], bool dstk, |
447 |
++static inline void emit_a32_rsh_r64(const u8 dst[], const u8 src[], bool dstk, |
448 |
+ bool sstk, struct jit_ctx *ctx) { |
449 |
+ const u8 *tmp = bpf2a32[TMP_REG_1]; |
450 |
+ const u8 *tmp2 = bpf2a32[TMP_REG_2]; |
451 |
+@@ -724,7 +724,7 @@ static inline void emit_a32_lsr_r64(const u8 dst[], const u8 src[], bool dstk, |
452 |
+ emit(ARM_LDR_I(rm, ARM_SP, STACK_VAR(dst_hi)), ctx); |
453 |
+ } |
454 |
+ |
455 |
+- /* Do LSH operation */ |
456 |
++ /* Do RSH operation */ |
457 |
+ emit(ARM_RSB_I(ARM_IP, rt, 32), ctx); |
458 |
+ emit(ARM_SUBS_I(tmp2[0], rt, 32), ctx); |
459 |
+ emit(ARM_MOV_SR(ARM_LR, rd, SRTYPE_LSR, rt), ctx); |
460 |
+@@ -774,7 +774,7 @@ static inline void emit_a32_lsh_i64(const u8 dst[], bool dstk, |
461 |
+ } |
462 |
+ |
463 |
+ /* dst = dst >> val */ |
464 |
+-static inline void emit_a32_lsr_i64(const u8 dst[], bool dstk, |
465 |
++static inline void emit_a32_rsh_i64(const u8 dst[], bool dstk, |
466 |
+ const u32 val, struct jit_ctx *ctx) { |
467 |
+ const u8 *tmp = bpf2a32[TMP_REG_1]; |
468 |
+ const u8 *tmp2 = bpf2a32[TMP_REG_2]; |
469 |
+@@ -1330,7 +1330,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) |
470 |
+ case BPF_ALU64 | BPF_RSH | BPF_K: |
471 |
+ if (unlikely(imm > 63)) |
472 |
+ return -EINVAL; |
473 |
+- emit_a32_lsr_i64(dst, dstk, imm, ctx); |
474 |
++ emit_a32_rsh_i64(dst, dstk, imm, ctx); |
475 |
+ break; |
476 |
+ /* dst = dst << src */ |
477 |
+ case BPF_ALU64 | BPF_LSH | BPF_X: |
478 |
+@@ -1338,7 +1338,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) |
479 |
+ break; |
480 |
+ /* dst = dst >> src */ |
481 |
+ case BPF_ALU64 | BPF_RSH | BPF_X: |
482 |
+- emit_a32_lsr_r64(dst, src, dstk, sstk, ctx); |
483 |
++ emit_a32_rsh_r64(dst, src, dstk, sstk, ctx); |
484 |
+ break; |
485 |
+ /* dst = dst >> src (signed) */ |
486 |
+ case BPF_ALU64 | BPF_ARSH | BPF_X: |
487 |
+diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi |
488 |
+index 2a7f36abd2dd..326ee6b59aaa 100644 |
489 |
+--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi |
490 |
++++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi |
491 |
+@@ -93,20 +93,12 @@ |
492 |
+ regulator-always-on; |
493 |
+ }; |
494 |
+ |
495 |
+- rsnd_ak4613: sound { |
496 |
+- compatible = "simple-audio-card"; |
497 |
++ sound_card: sound { |
498 |
++ compatible = "audio-graph-card"; |
499 |
+ |
500 |
+- simple-audio-card,format = "left_j"; |
501 |
+- simple-audio-card,bitclock-master = <&sndcpu>; |
502 |
+- simple-audio-card,frame-master = <&sndcpu>; |
503 |
++ label = "rcar-sound"; |
504 |
+ |
505 |
+- sndcpu: simple-audio-card,cpu { |
506 |
+- sound-dai = <&rcar_sound>; |
507 |
+- }; |
508 |
+- |
509 |
+- sndcodec: simple-audio-card,codec { |
510 |
+- sound-dai = <&ak4613>; |
511 |
+- }; |
512 |
++ dais = <&rsnd_port0>; |
513 |
+ }; |
514 |
+ |
515 |
+ vbus0_usb2: regulator-vbus0-usb2 { |
516 |
+@@ -322,6 +314,12 @@ |
517 |
+ asahi-kasei,out4-single-end; |
518 |
+ asahi-kasei,out5-single-end; |
519 |
+ asahi-kasei,out6-single-end; |
520 |
++ |
521 |
++ port { |
522 |
++ ak4613_endpoint: endpoint { |
523 |
++ remote-endpoint = <&rsnd_endpoint0>; |
524 |
++ }; |
525 |
++ }; |
526 |
+ }; |
527 |
+ |
528 |
+ cs2000: clk_multiplier@4f { |
529 |
+@@ -581,10 +579,18 @@ |
530 |
+ <&audio_clk_c>, |
531 |
+ <&cpg CPG_CORE CPG_AUDIO_CLK_I>; |
532 |
+ |
533 |
+- rcar_sound,dai { |
534 |
+- dai0 { |
535 |
+- playback = <&ssi0 &src0 &dvc0>; |
536 |
+- capture = <&ssi1 &src1 &dvc1>; |
537 |
++ ports { |
538 |
++ rsnd_port0: port@0 { |
539 |
++ rsnd_endpoint0: endpoint { |
540 |
++ remote-endpoint = <&ak4613_endpoint>; |
541 |
++ |
542 |
++ dai-format = "left_j"; |
543 |
++ bitclock-master = <&rsnd_endpoint0>; |
544 |
++ frame-master = <&rsnd_endpoint0>; |
545 |
++ |
546 |
++ playback = <&ssi0 &src0 &dvc0>; |
547 |
++ capture = <&ssi1 &src1 &dvc1>; |
548 |
++ }; |
549 |
+ }; |
550 |
+ }; |
551 |
+ }; |
552 |
+diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig |
553 |
+index fe005df02ed3..13ec8815a91b 100644 |
554 |
+--- a/arch/arm64/configs/defconfig |
555 |
++++ b/arch/arm64/configs/defconfig |
556 |
+@@ -333,6 +333,8 @@ CONFIG_GPIO_XGENE_SB=y |
557 |
+ CONFIG_GPIO_PCA953X=y |
558 |
+ CONFIG_GPIO_PCA953X_IRQ=y |
559 |
+ CONFIG_GPIO_MAX77620=y |
560 |
++CONFIG_POWER_AVS=y |
561 |
++CONFIG_ROCKCHIP_IODOMAIN=y |
562 |
+ CONFIG_POWER_RESET_MSM=y |
563 |
+ CONFIG_POWER_RESET_XGENE=y |
564 |
+ CONFIG_POWER_RESET_SYSCON=y |
565 |
+diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h |
566 |
+index 4f5fd2a36e6e..3b0938281541 100644 |
567 |
+--- a/arch/arm64/include/asm/cmpxchg.h |
568 |
++++ b/arch/arm64/include/asm/cmpxchg.h |
569 |
+@@ -204,7 +204,9 @@ static inline void __cmpwait_case_##name(volatile void *ptr, \ |
570 |
+ unsigned long tmp; \ |
571 |
+ \ |
572 |
+ asm volatile( \ |
573 |
+- " ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ |
574 |
++ " sevl\n" \ |
575 |
++ " wfe\n" \ |
576 |
++ " ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ |
577 |
+ " eor %" #w "[tmp], %" #w "[tmp], %" #w "[val]\n" \ |
578 |
+ " cbnz %" #w "[tmp], 1f\n" \ |
579 |
+ " wfe\n" \ |
580 |
+diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c |
581 |
+index 1b18b4722420..86d9f9d303b0 100644 |
582 |
+--- a/arch/arm64/mm/init.c |
583 |
++++ b/arch/arm64/mm/init.c |
584 |
+@@ -611,11 +611,13 @@ void __init mem_init(void) |
585 |
+ BUILD_BUG_ON(TASK_SIZE_32 > TASK_SIZE_64); |
586 |
+ #endif |
587 |
+ |
588 |
++#ifdef CONFIG_SPARSEMEM_VMEMMAP |
589 |
+ /* |
590 |
+ * Make sure we chose the upper bound of sizeof(struct page) |
591 |
+- * correctly. |
592 |
++ * correctly when sizing the VMEMMAP array. |
593 |
+ */ |
594 |
+ BUILD_BUG_ON(sizeof(struct page) > (1 << STRUCT_PAGE_MAX_SHIFT)); |
595 |
++#endif |
596 |
+ |
597 |
+ if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) { |
598 |
+ extern int sysctl_overcommit_memory; |
599 |
+diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile |
600 |
+index fd46385a4c97..600e5a198bd2 100644 |
601 |
+--- a/arch/microblaze/boot/Makefile |
602 |
++++ b/arch/microblaze/boot/Makefile |
603 |
+@@ -22,17 +22,19 @@ $(obj)/linux.bin.gz: $(obj)/linux.bin FORCE |
604 |
+ quiet_cmd_cp = CP $< $@$2 |
605 |
+ cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false) |
606 |
+ |
607 |
+-quiet_cmd_strip = STRIP $@ |
608 |
++quiet_cmd_strip = STRIP $< $@$2 |
609 |
+ cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \ |
610 |
+- -K _fdt_start vmlinux -o $@ |
611 |
++ -K _fdt_start $< -o $@$2 |
612 |
+ |
613 |
+ UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR) |
614 |
++UIMAGE_IN = $@ |
615 |
++UIMAGE_OUT = $@.ub |
616 |
+ |
617 |
+ $(obj)/simpleImage.%: vmlinux FORCE |
618 |
+ $(call if_changed,cp,.unstrip) |
619 |
+ $(call if_changed,objcopy) |
620 |
+ $(call if_changed,uimage) |
621 |
+- $(call if_changed,strip) |
622 |
+- @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
623 |
++ $(call if_changed,strip,.strip) |
624 |
++ @echo 'Kernel: $(UIMAGE_OUT) is ready' ' (#'`cat .version`')' |
625 |
+ |
626 |
+ clean-files += simpleImage.*.unstrip linux.bin.ub |
627 |
+diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h |
628 |
+index c7c63959ba91..e582d2c88092 100644 |
629 |
+--- a/arch/powerpc/include/asm/barrier.h |
630 |
++++ b/arch/powerpc/include/asm/barrier.h |
631 |
+@@ -76,6 +76,21 @@ do { \ |
632 |
+ ___p1; \ |
633 |
+ }) |
634 |
+ |
635 |
++#ifdef CONFIG_PPC_BOOK3S_64 |
636 |
++/* |
637 |
++ * Prevent execution of subsequent instructions until preceding branches have |
638 |
++ * been fully resolved and are no longer executing speculatively. |
639 |
++ */ |
640 |
++#define barrier_nospec_asm ori 31,31,0 |
641 |
++ |
642 |
++// This also acts as a compiler barrier due to the memory clobber. |
643 |
++#define barrier_nospec() asm (stringify_in_c(barrier_nospec_asm) ::: "memory") |
644 |
++ |
645 |
++#else /* !CONFIG_PPC_BOOK3S_64 */ |
646 |
++#define barrier_nospec_asm |
647 |
++#define barrier_nospec() |
648 |
++#endif |
649 |
++ |
650 |
+ #include <asm-generic/barrier.h> |
651 |
+ |
652 |
+ #endif /* _ASM_POWERPC_BARRIER_H */ |
653 |
+diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h |
654 |
+index c1d257aa4c2d..66298461b640 100644 |
655 |
+--- a/arch/powerpc/include/asm/cache.h |
656 |
++++ b/arch/powerpc/include/asm/cache.h |
657 |
+@@ -9,11 +9,14 @@ |
658 |
+ #if defined(CONFIG_PPC_8xx) || defined(CONFIG_403GCX) |
659 |
+ #define L1_CACHE_SHIFT 4 |
660 |
+ #define MAX_COPY_PREFETCH 1 |
661 |
++#define IFETCH_ALIGN_SHIFT 2 |
662 |
+ #elif defined(CONFIG_PPC_E500MC) |
663 |
+ #define L1_CACHE_SHIFT 6 |
664 |
+ #define MAX_COPY_PREFETCH 4 |
665 |
++#define IFETCH_ALIGN_SHIFT 3 |
666 |
+ #elif defined(CONFIG_PPC32) |
667 |
+ #define MAX_COPY_PREFETCH 4 |
668 |
++#define IFETCH_ALIGN_SHIFT 3 /* 603 fetches 2 insn at a time */ |
669 |
+ #if defined(CONFIG_PPC_47x) |
670 |
+ #define L1_CACHE_SHIFT 7 |
671 |
+ #else |
672 |
+diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h |
673 |
+index 0409c80c32c0..18ef59a9886d 100644 |
674 |
+--- a/arch/powerpc/include/asm/pkeys.h |
675 |
++++ b/arch/powerpc/include/asm/pkeys.h |
676 |
+@@ -26,6 +26,8 @@ extern u32 initial_allocation_mask; /* bits set for reserved keys */ |
677 |
+ # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 |
678 |
+ # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 |
679 |
+ # define VM_PKEY_BIT4 VM_HIGH_ARCH_4 |
680 |
++#elif !defined(VM_PKEY_BIT4) |
681 |
++# define VM_PKEY_BIT4 VM_HIGH_ARCH_4 |
682 |
+ #endif |
683 |
+ |
684 |
+ #define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \ |
685 |
+diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c |
686 |
+index b8a329f04814..e03c437a4d06 100644 |
687 |
+--- a/arch/powerpc/kernel/eeh_driver.c |
688 |
++++ b/arch/powerpc/kernel/eeh_driver.c |
689 |
+@@ -458,9 +458,11 @@ static void *eeh_add_virt_device(void *data, void *userdata) |
690 |
+ |
691 |
+ driver = eeh_pcid_get(dev); |
692 |
+ if (driver) { |
693 |
+- eeh_pcid_put(dev); |
694 |
+- if (driver->err_handler) |
695 |
++ if (driver->err_handler) { |
696 |
++ eeh_pcid_put(dev); |
697 |
+ return NULL; |
698 |
++ } |
699 |
++ eeh_pcid_put(dev); |
700 |
+ } |
701 |
+ |
702 |
+ #ifdef CONFIG_PCI_IOV |
703 |
+@@ -497,17 +499,19 @@ static void *eeh_rmv_device(void *data, void *userdata) |
704 |
+ if (eeh_dev_removed(edev)) |
705 |
+ return NULL; |
706 |
+ |
707 |
+- driver = eeh_pcid_get(dev); |
708 |
+- if (driver) { |
709 |
+- eeh_pcid_put(dev); |
710 |
+- if (removed && |
711 |
+- eeh_pe_passed(edev->pe)) |
712 |
+- return NULL; |
713 |
+- if (removed && |
714 |
+- driver->err_handler && |
715 |
+- driver->err_handler->error_detected && |
716 |
+- driver->err_handler->slot_reset) |
717 |
++ if (removed) { |
718 |
++ if (eeh_pe_passed(edev->pe)) |
719 |
+ return NULL; |
720 |
++ driver = eeh_pcid_get(dev); |
721 |
++ if (driver) { |
722 |
++ if (driver->err_handler && |
723 |
++ driver->err_handler->error_detected && |
724 |
++ driver->err_handler->slot_reset) { |
725 |
++ eeh_pcid_put(dev); |
726 |
++ return NULL; |
727 |
++ } |
728 |
++ eeh_pcid_put(dev); |
729 |
++ } |
730 |
+ } |
731 |
+ |
732 |
+ /* Remove it from PCI subsystem */ |
733 |
+diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S |
734 |
+index d8670a37d70c..6cab07e76732 100644 |
735 |
+--- a/arch/powerpc/kernel/head_8xx.S |
736 |
++++ b/arch/powerpc/kernel/head_8xx.S |
737 |
+@@ -913,7 +913,7 @@ start_here: |
738 |
+ tovirt(r6,r6) |
739 |
+ lis r5, abatron_pteptrs@h |
740 |
+ ori r5, r5, abatron_pteptrs@l |
741 |
+- stw r5, 0xf0(r0) /* Must match your Abatron config file */ |
742 |
++ stw r5, 0xf0(0) /* Must match your Abatron config file */ |
743 |
+ tophys(r5,r5) |
744 |
+ stw r6, 0(r5) |
745 |
+ |
746 |
+diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c |
747 |
+index 85ad2f78b889..51cba7d7a4fd 100644 |
748 |
+--- a/arch/powerpc/kernel/pci_32.c |
749 |
++++ b/arch/powerpc/kernel/pci_32.c |
750 |
+@@ -11,6 +11,7 @@ |
751 |
+ #include <linux/sched.h> |
752 |
+ #include <linux/errno.h> |
753 |
+ #include <linux/bootmem.h> |
754 |
++#include <linux/syscalls.h> |
755 |
+ #include <linux/irq.h> |
756 |
+ #include <linux/list.h> |
757 |
+ #include <linux/of.h> |
758 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
759 |
+index f9d6befb55a6..67f9c157bcc0 100644 |
760 |
+--- a/arch/powerpc/kernel/prom_init.c |
761 |
++++ b/arch/powerpc/kernel/prom_init.c |
762 |
+@@ -334,6 +334,7 @@ static void __init prom_print_dec(unsigned long val) |
763 |
+ call_prom("write", 3, 1, prom.stdout, buf+i, size); |
764 |
+ } |
765 |
+ |
766 |
++__printf(1, 2) |
767 |
+ static void __init prom_printf(const char *format, ...) |
768 |
+ { |
769 |
+ const char *p, *q, *s; |
770 |
+@@ -1160,7 +1161,7 @@ static void __init prom_send_capabilities(void) |
771 |
+ */ |
772 |
+ |
773 |
+ cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); |
774 |
+- prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n", |
775 |
++ prom_printf("Max number of cores passed to firmware: %u (NR_CPUS = %d)\n", |
776 |
+ cores, NR_CPUS); |
777 |
+ |
778 |
+ ibm_architecture_vec.vec5.max_cpus = cpu_to_be32(cores); |
779 |
+@@ -1242,7 +1243,7 @@ static unsigned long __init alloc_up(unsigned long size, unsigned long align) |
780 |
+ |
781 |
+ if (align) |
782 |
+ base = _ALIGN_UP(base, align); |
783 |
+- prom_debug("alloc_up(%x, %x)\n", size, align); |
784 |
++ prom_debug("%s(%lx, %lx)\n", __func__, size, align); |
785 |
+ if (ram_top == 0) |
786 |
+ prom_panic("alloc_up() called with mem not initialized\n"); |
787 |
+ |
788 |
+@@ -1253,7 +1254,7 @@ static unsigned long __init alloc_up(unsigned long size, unsigned long align) |
789 |
+ |
790 |
+ for(; (base + size) <= alloc_top; |
791 |
+ base = _ALIGN_UP(base + 0x100000, align)) { |
792 |
+- prom_debug(" trying: 0x%x\n\r", base); |
793 |
++ prom_debug(" trying: 0x%lx\n\r", base); |
794 |
+ addr = (unsigned long)prom_claim(base, size, 0); |
795 |
+ if (addr != PROM_ERROR && addr != 0) |
796 |
+ break; |
797 |
+@@ -1265,12 +1266,12 @@ static unsigned long __init alloc_up(unsigned long size, unsigned long align) |
798 |
+ return 0; |
799 |
+ alloc_bottom = addr + size; |
800 |
+ |
801 |
+- prom_debug(" -> %x\n", addr); |
802 |
+- prom_debug(" alloc_bottom : %x\n", alloc_bottom); |
803 |
+- prom_debug(" alloc_top : %x\n", alloc_top); |
804 |
+- prom_debug(" alloc_top_hi : %x\n", alloc_top_high); |
805 |
+- prom_debug(" rmo_top : %x\n", rmo_top); |
806 |
+- prom_debug(" ram_top : %x\n", ram_top); |
807 |
++ prom_debug(" -> %lx\n", addr); |
808 |
++ prom_debug(" alloc_bottom : %lx\n", alloc_bottom); |
809 |
++ prom_debug(" alloc_top : %lx\n", alloc_top); |
810 |
++ prom_debug(" alloc_top_hi : %lx\n", alloc_top_high); |
811 |
++ prom_debug(" rmo_top : %lx\n", rmo_top); |
812 |
++ prom_debug(" ram_top : %lx\n", ram_top); |
813 |
+ |
814 |
+ return addr; |
815 |
+ } |
816 |
+@@ -1285,7 +1286,7 @@ static unsigned long __init alloc_down(unsigned long size, unsigned long align, |
817 |
+ { |
818 |
+ unsigned long base, addr = 0; |
819 |
+ |
820 |
+- prom_debug("alloc_down(%x, %x, %s)\n", size, align, |
821 |
++ prom_debug("%s(%lx, %lx, %s)\n", __func__, size, align, |
822 |
+ highmem ? "(high)" : "(low)"); |
823 |
+ if (ram_top == 0) |
824 |
+ prom_panic("alloc_down() called with mem not initialized\n"); |
825 |
+@@ -1313,7 +1314,7 @@ static unsigned long __init alloc_down(unsigned long size, unsigned long align, |
826 |
+ base = _ALIGN_DOWN(alloc_top - size, align); |
827 |
+ for (; base > alloc_bottom; |
828 |
+ base = _ALIGN_DOWN(base - 0x100000, align)) { |
829 |
+- prom_debug(" trying: 0x%x\n\r", base); |
830 |
++ prom_debug(" trying: 0x%lx\n\r", base); |
831 |
+ addr = (unsigned long)prom_claim(base, size, 0); |
832 |
+ if (addr != PROM_ERROR && addr != 0) |
833 |
+ break; |
834 |
+@@ -1324,12 +1325,12 @@ static unsigned long __init alloc_down(unsigned long size, unsigned long align, |
835 |
+ alloc_top = addr; |
836 |
+ |
837 |
+ bail: |
838 |
+- prom_debug(" -> %x\n", addr); |
839 |
+- prom_debug(" alloc_bottom : %x\n", alloc_bottom); |
840 |
+- prom_debug(" alloc_top : %x\n", alloc_top); |
841 |
+- prom_debug(" alloc_top_hi : %x\n", alloc_top_high); |
842 |
+- prom_debug(" rmo_top : %x\n", rmo_top); |
843 |
+- prom_debug(" ram_top : %x\n", ram_top); |
844 |
++ prom_debug(" -> %lx\n", addr); |
845 |
++ prom_debug(" alloc_bottom : %lx\n", alloc_bottom); |
846 |
++ prom_debug(" alloc_top : %lx\n", alloc_top); |
847 |
++ prom_debug(" alloc_top_hi : %lx\n", alloc_top_high); |
848 |
++ prom_debug(" rmo_top : %lx\n", rmo_top); |
849 |
++ prom_debug(" ram_top : %lx\n", ram_top); |
850 |
+ |
851 |
+ return addr; |
852 |
+ } |
853 |
+@@ -1455,7 +1456,7 @@ static void __init prom_init_mem(void) |
854 |
+ |
855 |
+ if (size == 0) |
856 |
+ continue; |
857 |
+- prom_debug(" %x %x\n", base, size); |
858 |
++ prom_debug(" %lx %lx\n", base, size); |
859 |
+ if (base == 0 && (of_platform & PLATFORM_LPAR)) |
860 |
+ rmo_top = size; |
861 |
+ if ((base + size) > ram_top) |
862 |
+@@ -1475,12 +1476,12 @@ static void __init prom_init_mem(void) |
863 |
+ |
864 |
+ if (prom_memory_limit) { |
865 |
+ if (prom_memory_limit <= alloc_bottom) { |
866 |
+- prom_printf("Ignoring mem=%x <= alloc_bottom.\n", |
867 |
+- prom_memory_limit); |
868 |
++ prom_printf("Ignoring mem=%lx <= alloc_bottom.\n", |
869 |
++ prom_memory_limit); |
870 |
+ prom_memory_limit = 0; |
871 |
+ } else if (prom_memory_limit >= ram_top) { |
872 |
+- prom_printf("Ignoring mem=%x >= ram_top.\n", |
873 |
+- prom_memory_limit); |
874 |
++ prom_printf("Ignoring mem=%lx >= ram_top.\n", |
875 |
++ prom_memory_limit); |
876 |
+ prom_memory_limit = 0; |
877 |
+ } else { |
878 |
+ ram_top = prom_memory_limit; |
879 |
+@@ -1512,12 +1513,13 @@ static void __init prom_init_mem(void) |
880 |
+ alloc_bottom = PAGE_ALIGN(prom_initrd_end); |
881 |
+ |
882 |
+ prom_printf("memory layout at init:\n"); |
883 |
+- prom_printf(" memory_limit : %x (16 MB aligned)\n", prom_memory_limit); |
884 |
+- prom_printf(" alloc_bottom : %x\n", alloc_bottom); |
885 |
+- prom_printf(" alloc_top : %x\n", alloc_top); |
886 |
+- prom_printf(" alloc_top_hi : %x\n", alloc_top_high); |
887 |
+- prom_printf(" rmo_top : %x\n", rmo_top); |
888 |
+- prom_printf(" ram_top : %x\n", ram_top); |
889 |
++ prom_printf(" memory_limit : %lx (16 MB aligned)\n", |
890 |
++ prom_memory_limit); |
891 |
++ prom_printf(" alloc_bottom : %lx\n", alloc_bottom); |
892 |
++ prom_printf(" alloc_top : %lx\n", alloc_top); |
893 |
++ prom_printf(" alloc_top_hi : %lx\n", alloc_top_high); |
894 |
++ prom_printf(" rmo_top : %lx\n", rmo_top); |
895 |
++ prom_printf(" ram_top : %lx\n", ram_top); |
896 |
+ } |
897 |
+ |
898 |
+ static void __init prom_close_stdin(void) |
899 |
+@@ -1578,7 +1580,7 @@ static void __init prom_instantiate_opal(void) |
900 |
+ return; |
901 |
+ } |
902 |
+ |
903 |
+- prom_printf("instantiating opal at 0x%x...", base); |
904 |
++ prom_printf("instantiating opal at 0x%llx...", base); |
905 |
+ |
906 |
+ if (call_prom_ret("call-method", 4, 3, rets, |
907 |
+ ADDR("load-opal-runtime"), |
908 |
+@@ -1594,10 +1596,10 @@ static void __init prom_instantiate_opal(void) |
909 |
+ |
910 |
+ reserve_mem(base, size); |
911 |
+ |
912 |
+- prom_debug("opal base = 0x%x\n", base); |
913 |
+- prom_debug("opal align = 0x%x\n", align); |
914 |
+- prom_debug("opal entry = 0x%x\n", entry); |
915 |
+- prom_debug("opal size = 0x%x\n", (long)size); |
916 |
++ prom_debug("opal base = 0x%llx\n", base); |
917 |
++ prom_debug("opal align = 0x%llx\n", align); |
918 |
++ prom_debug("opal entry = 0x%llx\n", entry); |
919 |
++ prom_debug("opal size = 0x%llx\n", size); |
920 |
+ |
921 |
+ prom_setprop(opal_node, "/ibm,opal", "opal-base-address", |
922 |
+ &base, sizeof(base)); |
923 |
+@@ -1674,7 +1676,7 @@ static void __init prom_instantiate_rtas(void) |
924 |
+ |
925 |
+ prom_debug("rtas base = 0x%x\n", base); |
926 |
+ prom_debug("rtas entry = 0x%x\n", entry); |
927 |
+- prom_debug("rtas size = 0x%x\n", (long)size); |
928 |
++ prom_debug("rtas size = 0x%x\n", size); |
929 |
+ |
930 |
+ prom_debug("prom_instantiate_rtas: end...\n"); |
931 |
+ } |
932 |
+@@ -1732,7 +1734,7 @@ static void __init prom_instantiate_sml(void) |
933 |
+ if (base == 0) |
934 |
+ prom_panic("Could not allocate memory for sml\n"); |
935 |
+ |
936 |
+- prom_printf("instantiating sml at 0x%x...", base); |
937 |
++ prom_printf("instantiating sml at 0x%llx...", base); |
938 |
+ |
939 |
+ memset((void *)base, 0, size); |
940 |
+ |
941 |
+@@ -1751,8 +1753,8 @@ static void __init prom_instantiate_sml(void) |
942 |
+ prom_setprop(ibmvtpm_node, "/vdevice/vtpm", "linux,sml-size", |
943 |
+ &size, sizeof(size)); |
944 |
+ |
945 |
+- prom_debug("sml base = 0x%x\n", base); |
946 |
+- prom_debug("sml size = 0x%x\n", (long)size); |
947 |
++ prom_debug("sml base = 0x%llx\n", base); |
948 |
++ prom_debug("sml size = 0x%x\n", size); |
949 |
+ |
950 |
+ prom_debug("prom_instantiate_sml: end...\n"); |
951 |
+ } |
952 |
+@@ -1845,7 +1847,7 @@ static void __init prom_initialize_tce_table(void) |
953 |
+ |
954 |
+ prom_debug("TCE table: %s\n", path); |
955 |
+ prom_debug("\tnode = 0x%x\n", node); |
956 |
+- prom_debug("\tbase = 0x%x\n", base); |
957 |
++ prom_debug("\tbase = 0x%llx\n", base); |
958 |
+ prom_debug("\tsize = 0x%x\n", minsize); |
959 |
+ |
960 |
+ /* Initialize the table to have a one-to-one mapping |
961 |
+@@ -1932,12 +1934,12 @@ static void __init prom_hold_cpus(void) |
962 |
+ } |
963 |
+ |
964 |
+ prom_debug("prom_hold_cpus: start...\n"); |
965 |
+- prom_debug(" 1) spinloop = 0x%x\n", (unsigned long)spinloop); |
966 |
+- prom_debug(" 1) *spinloop = 0x%x\n", *spinloop); |
967 |
+- prom_debug(" 1) acknowledge = 0x%x\n", |
968 |
++ prom_debug(" 1) spinloop = 0x%lx\n", (unsigned long)spinloop); |
969 |
++ prom_debug(" 1) *spinloop = 0x%lx\n", *spinloop); |
970 |
++ prom_debug(" 1) acknowledge = 0x%lx\n", |
971 |
+ (unsigned long)acknowledge); |
972 |
+- prom_debug(" 1) *acknowledge = 0x%x\n", *acknowledge); |
973 |
+- prom_debug(" 1) secondary_hold = 0x%x\n", secondary_hold); |
974 |
++ prom_debug(" 1) *acknowledge = 0x%lx\n", *acknowledge); |
975 |
++ prom_debug(" 1) secondary_hold = 0x%lx\n", secondary_hold); |
976 |
+ |
977 |
+ /* Set the common spinloop variable, so all of the secondary cpus |
978 |
+ * will block when they are awakened from their OF spinloop. |
979 |
+@@ -1965,7 +1967,7 @@ static void __init prom_hold_cpus(void) |
980 |
+ prom_getprop(node, "reg", ®, sizeof(reg)); |
981 |
+ cpu_no = be32_to_cpu(reg); |
982 |
+ |
983 |
+- prom_debug("cpu hw idx = %lu\n", cpu_no); |
984 |
++ prom_debug("cpu hw idx = %u\n", cpu_no); |
985 |
+ |
986 |
+ /* Init the acknowledge var which will be reset by |
987 |
+ * the secondary cpu when it awakens from its OF |
988 |
+@@ -1975,7 +1977,7 @@ static void __init prom_hold_cpus(void) |
989 |
+ |
990 |
+ if (cpu_no != prom.cpu) { |
991 |
+ /* Primary Thread of non-boot cpu or any thread */ |
992 |
+- prom_printf("starting cpu hw idx %lu... ", cpu_no); |
993 |
++ prom_printf("starting cpu hw idx %u... ", cpu_no); |
994 |
+ call_prom("start-cpu", 3, 0, node, |
995 |
+ secondary_hold, cpu_no); |
996 |
+ |
997 |
+@@ -1986,11 +1988,11 @@ static void __init prom_hold_cpus(void) |
998 |
+ if (*acknowledge == cpu_no) |
999 |
+ prom_printf("done\n"); |
1000 |
+ else |
1001 |
+- prom_printf("failed: %x\n", *acknowledge); |
1002 |
++ prom_printf("failed: %lx\n", *acknowledge); |
1003 |
+ } |
1004 |
+ #ifdef CONFIG_SMP |
1005 |
+ else |
1006 |
+- prom_printf("boot cpu hw idx %lu\n", cpu_no); |
1007 |
++ prom_printf("boot cpu hw idx %u\n", cpu_no); |
1008 |
+ #endif /* CONFIG_SMP */ |
1009 |
+ } |
1010 |
+ |
1011 |
+@@ -2268,7 +2270,7 @@ static void __init *make_room(unsigned long *mem_start, unsigned long *mem_end, |
1012 |
+ while ((*mem_start + needed) > *mem_end) { |
1013 |
+ unsigned long room, chunk; |
1014 |
+ |
1015 |
+- prom_debug("Chunk exhausted, claiming more at %x...\n", |
1016 |
++ prom_debug("Chunk exhausted, claiming more at %lx...\n", |
1017 |
+ alloc_bottom); |
1018 |
+ room = alloc_top - alloc_bottom; |
1019 |
+ if (room > DEVTREE_CHUNK_SIZE) |
1020 |
+@@ -2494,7 +2496,7 @@ static void __init flatten_device_tree(void) |
1021 |
+ room = alloc_top - alloc_bottom - 0x4000; |
1022 |
+ if (room > DEVTREE_CHUNK_SIZE) |
1023 |
+ room = DEVTREE_CHUNK_SIZE; |
1024 |
+- prom_debug("starting device tree allocs at %x\n", alloc_bottom); |
1025 |
++ prom_debug("starting device tree allocs at %lx\n", alloc_bottom); |
1026 |
+ |
1027 |
+ /* Now try to claim that */ |
1028 |
+ mem_start = (unsigned long)alloc_up(room, PAGE_SIZE); |
1029 |
+@@ -2557,7 +2559,7 @@ static void __init flatten_device_tree(void) |
1030 |
+ int i; |
1031 |
+ prom_printf("reserved memory map:\n"); |
1032 |
+ for (i = 0; i < mem_reserve_cnt; i++) |
1033 |
+- prom_printf(" %x - %x\n", |
1034 |
++ prom_printf(" %llx - %llx\n", |
1035 |
+ be64_to_cpu(mem_reserve_map[i].base), |
1036 |
+ be64_to_cpu(mem_reserve_map[i].size)); |
1037 |
+ } |
1038 |
+@@ -2567,9 +2569,9 @@ static void __init flatten_device_tree(void) |
1039 |
+ */ |
1040 |
+ mem_reserve_cnt = MEM_RESERVE_MAP_SIZE; |
1041 |
+ |
1042 |
+- prom_printf("Device tree strings 0x%x -> 0x%x\n", |
1043 |
++ prom_printf("Device tree strings 0x%lx -> 0x%lx\n", |
1044 |
+ dt_string_start, dt_string_end); |
1045 |
+- prom_printf("Device tree struct 0x%x -> 0x%x\n", |
1046 |
++ prom_printf("Device tree struct 0x%lx -> 0x%lx\n", |
1047 |
+ dt_struct_start, dt_struct_end); |
1048 |
+ } |
1049 |
+ |
1050 |
+@@ -3001,7 +3003,7 @@ static void __init prom_find_boot_cpu(void) |
1051 |
+ prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval)); |
1052 |
+ prom.cpu = be32_to_cpu(rval); |
1053 |
+ |
1054 |
+- prom_debug("Booting CPU hw index = %lu\n", prom.cpu); |
1055 |
++ prom_debug("Booting CPU hw index = %d\n", prom.cpu); |
1056 |
+ } |
1057 |
+ |
1058 |
+ static void __init prom_check_initrd(unsigned long r3, unsigned long r4) |
1059 |
+@@ -3023,8 +3025,8 @@ static void __init prom_check_initrd(unsigned long r3, unsigned long r4) |
1060 |
+ reserve_mem(prom_initrd_start, |
1061 |
+ prom_initrd_end - prom_initrd_start); |
1062 |
+ |
1063 |
+- prom_debug("initrd_start=0x%x\n", prom_initrd_start); |
1064 |
+- prom_debug("initrd_end=0x%x\n", prom_initrd_end); |
1065 |
++ prom_debug("initrd_start=0x%lx\n", prom_initrd_start); |
1066 |
++ prom_debug("initrd_end=0x%lx\n", prom_initrd_end); |
1067 |
+ } |
1068 |
+ #endif /* CONFIG_BLK_DEV_INITRD */ |
1069 |
+ } |
1070 |
+@@ -3277,7 +3279,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, |
1071 |
+ /* Don't print anything after quiesce under OPAL, it crashes OFW */ |
1072 |
+ if (of_platform != PLATFORM_OPAL) { |
1073 |
+ prom_printf("Booting Linux via __start() @ 0x%lx ...\n", kbase); |
1074 |
+- prom_debug("->dt_header_start=0x%x\n", hdr); |
1075 |
++ prom_debug("->dt_header_start=0x%lx\n", hdr); |
1076 |
+ } |
1077 |
+ |
1078 |
+ #ifdef CONFIG_PPC32 |
1079 |
+diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S |
1080 |
+index a787776822d8..0378def28d41 100644 |
1081 |
+--- a/arch/powerpc/lib/string.S |
1082 |
++++ b/arch/powerpc/lib/string.S |
1083 |
+@@ -12,6 +12,7 @@ |
1084 |
+ #include <asm/errno.h> |
1085 |
+ #include <asm/ppc_asm.h> |
1086 |
+ #include <asm/export.h> |
1087 |
++#include <asm/cache.h> |
1088 |
+ |
1089 |
+ .text |
1090 |
+ |
1091 |
+@@ -23,7 +24,7 @@ _GLOBAL(strncpy) |
1092 |
+ mtctr r5 |
1093 |
+ addi r6,r3,-1 |
1094 |
+ addi r4,r4,-1 |
1095 |
+- .balign 16 |
1096 |
++ .balign IFETCH_ALIGN_BYTES |
1097 |
+ 1: lbzu r0,1(r4) |
1098 |
+ cmpwi 0,r0,0 |
1099 |
+ stbu r0,1(r6) |
1100 |
+@@ -43,7 +44,7 @@ _GLOBAL(strncmp) |
1101 |
+ mtctr r5 |
1102 |
+ addi r5,r3,-1 |
1103 |
+ addi r4,r4,-1 |
1104 |
+- .balign 16 |
1105 |
++ .balign IFETCH_ALIGN_BYTES |
1106 |
+ 1: lbzu r3,1(r5) |
1107 |
+ cmpwi 1,r3,0 |
1108 |
+ lbzu r0,1(r4) |
1109 |
+@@ -77,7 +78,7 @@ _GLOBAL(memchr) |
1110 |
+ beq- 2f |
1111 |
+ mtctr r5 |
1112 |
+ addi r3,r3,-1 |
1113 |
+- .balign 16 |
1114 |
++ .balign IFETCH_ALIGN_BYTES |
1115 |
+ 1: lbzu r0,1(r3) |
1116 |
+ cmpw 0,r0,r4 |
1117 |
+ bdnzf 2,1b |
1118 |
+diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c |
1119 |
+index 66577cc66dc9..2f4b33b24b3b 100644 |
1120 |
+--- a/arch/powerpc/mm/slb.c |
1121 |
++++ b/arch/powerpc/mm/slb.c |
1122 |
+@@ -63,14 +63,14 @@ static inline void slb_shadow_update(unsigned long ea, int ssize, |
1123 |
+ * updating it. No write barriers are needed here, provided |
1124 |
+ * we only update the current CPU's SLB shadow buffer. |
1125 |
+ */ |
1126 |
+- p->save_area[index].esid = 0; |
1127 |
+- p->save_area[index].vsid = cpu_to_be64(mk_vsid_data(ea, ssize, flags)); |
1128 |
+- p->save_area[index].esid = cpu_to_be64(mk_esid_data(ea, ssize, index)); |
1129 |
++ WRITE_ONCE(p->save_area[index].esid, 0); |
1130 |
++ WRITE_ONCE(p->save_area[index].vsid, cpu_to_be64(mk_vsid_data(ea, ssize, flags))); |
1131 |
++ WRITE_ONCE(p->save_area[index].esid, cpu_to_be64(mk_esid_data(ea, ssize, index))); |
1132 |
+ } |
1133 |
+ |
1134 |
+ static inline void slb_shadow_clear(enum slb_index index) |
1135 |
+ { |
1136 |
+- get_slb_shadow()->save_area[index].esid = 0; |
1137 |
++ WRITE_ONCE(get_slb_shadow()->save_area[index].esid, 0); |
1138 |
+ } |
1139 |
+ |
1140 |
+ static inline void create_shadowed_slbe(unsigned long ea, int ssize, |
1141 |
+diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c |
1142 |
+index 0ef3d9580e98..5299013bd9c9 100644 |
1143 |
+--- a/arch/powerpc/net/bpf_jit_comp64.c |
1144 |
++++ b/arch/powerpc/net/bpf_jit_comp64.c |
1145 |
+@@ -202,25 +202,37 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx) |
1146 |
+ |
1147 |
+ static void bpf_jit_emit_func_call(u32 *image, struct codegen_context *ctx, u64 func) |
1148 |
+ { |
1149 |
++ unsigned int i, ctx_idx = ctx->idx; |
1150 |
++ |
1151 |
++ /* Load function address into r12 */ |
1152 |
++ PPC_LI64(12, func); |
1153 |
++ |
1154 |
++ /* For bpf-to-bpf function calls, the callee's address is unknown |
1155 |
++ * until the last extra pass. As seen above, we use PPC_LI64() to |
1156 |
++ * load the callee's address, but this may optimize the number of |
1157 |
++ * instructions required based on the nature of the address. |
1158 |
++ * |
1159 |
++ * Since we don't want the number of instructions emitted to change, |
1160 |
++ * we pad the optimized PPC_LI64() call with NOPs to guarantee that |
1161 |
++ * we always have a five-instruction sequence, which is the maximum |
1162 |
++ * that PPC_LI64() can emit. |
1163 |
++ */ |
1164 |
++ for (i = ctx->idx - ctx_idx; i < 5; i++) |
1165 |
++ PPC_NOP(); |
1166 |
++ |
1167 |
+ #ifdef PPC64_ELF_ABI_v1 |
1168 |
+- /* func points to the function descriptor */ |
1169 |
+- PPC_LI64(b2p[TMP_REG_2], func); |
1170 |
+- /* Load actual entry point from function descriptor */ |
1171 |
+- PPC_BPF_LL(b2p[TMP_REG_1], b2p[TMP_REG_2], 0); |
1172 |
+- /* ... and move it to LR */ |
1173 |
+- PPC_MTLR(b2p[TMP_REG_1]); |
1174 |
+ /* |
1175 |
+ * Load TOC from function descriptor at offset 8. |
1176 |
+ * We can clobber r2 since we get called through a |
1177 |
+ * function pointer (so caller will save/restore r2) |
1178 |
+ * and since we don't use a TOC ourself. |
1179 |
+ */ |
1180 |
+- PPC_BPF_LL(2, b2p[TMP_REG_2], 8); |
1181 |
+-#else |
1182 |
+- /* We can clobber r12 */ |
1183 |
+- PPC_FUNC_ADDR(12, func); |
1184 |
+- PPC_MTLR(12); |
1185 |
++ PPC_BPF_LL(2, 12, 8); |
1186 |
++ /* Load actual entry point from function descriptor */ |
1187 |
++ PPC_BPF_LL(12, 12, 0); |
1188 |
+ #endif |
1189 |
++ |
1190 |
++ PPC_MTLR(12); |
1191 |
+ PPC_BLRL(); |
1192 |
+ } |
1193 |
+ |
1194 |
+diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c |
1195 |
+index 03d115aaa191..acde7bbe0716 100644 |
1196 |
+--- a/arch/powerpc/platforms/chrp/time.c |
1197 |
++++ b/arch/powerpc/platforms/chrp/time.c |
1198 |
+@@ -28,6 +28,8 @@ |
1199 |
+ #include <asm/sections.h> |
1200 |
+ #include <asm/time.h> |
1201 |
+ |
1202 |
++#include <platforms/chrp/chrp.h> |
1203 |
++ |
1204 |
+ extern spinlock_t rtc_lock; |
1205 |
+ |
1206 |
+ #define NVRAM_AS0 0x74 |
1207 |
+@@ -63,7 +65,7 @@ long __init chrp_time_init(void) |
1208 |
+ return 0; |
1209 |
+ } |
1210 |
+ |
1211 |
+-int chrp_cmos_clock_read(int addr) |
1212 |
++static int chrp_cmos_clock_read(int addr) |
1213 |
+ { |
1214 |
+ if (nvram_as1 != 0) |
1215 |
+ outb(addr>>8, nvram_as1); |
1216 |
+@@ -71,7 +73,7 @@ int chrp_cmos_clock_read(int addr) |
1217 |
+ return (inb(nvram_data)); |
1218 |
+ } |
1219 |
+ |
1220 |
+-void chrp_cmos_clock_write(unsigned long val, int addr) |
1221 |
++static void chrp_cmos_clock_write(unsigned long val, int addr) |
1222 |
+ { |
1223 |
+ if (nvram_as1 != 0) |
1224 |
+ outb(addr>>8, nvram_as1); |
1225 |
+diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
1226 |
+index 89c54de88b7a..bf4a125faec6 100644 |
1227 |
+--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
1228 |
++++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
1229 |
+@@ -35,6 +35,8 @@ |
1230 |
+ */ |
1231 |
+ #define HW_BROADWAY_ICR 0x00 |
1232 |
+ #define HW_BROADWAY_IMR 0x04 |
1233 |
++#define HW_STARLET_ICR 0x08 |
1234 |
++#define HW_STARLET_IMR 0x0c |
1235 |
+ |
1236 |
+ |
1237 |
+ /* |
1238 |
+@@ -74,6 +76,9 @@ static void hlwd_pic_unmask(struct irq_data *d) |
1239 |
+ void __iomem *io_base = irq_data_get_irq_chip_data(d); |
1240 |
+ |
1241 |
+ setbits32(io_base + HW_BROADWAY_IMR, 1 << irq); |
1242 |
++ |
1243 |
++ /* Make sure the ARM (aka. Starlet) doesn't handle this interrupt. */ |
1244 |
++ clrbits32(io_base + HW_STARLET_IMR, 1 << irq); |
1245 |
+ } |
1246 |
+ |
1247 |
+ |
1248 |
+diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c |
1249 |
+index c3c9bbb3573a..ba0964c17620 100644 |
1250 |
+--- a/arch/powerpc/platforms/powermac/bootx_init.c |
1251 |
++++ b/arch/powerpc/platforms/powermac/bootx_init.c |
1252 |
+@@ -468,7 +468,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4) |
1253 |
+ boot_infos_t *bi = (boot_infos_t *) r4; |
1254 |
+ unsigned long hdr; |
1255 |
+ unsigned long space; |
1256 |
+- unsigned long ptr, x; |
1257 |
++ unsigned long ptr; |
1258 |
+ char *model; |
1259 |
+ unsigned long offset = reloc_offset(); |
1260 |
+ |
1261 |
+@@ -562,6 +562,8 @@ void __init bootx_init(unsigned long r3, unsigned long r4) |
1262 |
+ * MMU switched OFF, so this should not be useful anymore. |
1263 |
+ */ |
1264 |
+ if (bi->version < 4) { |
1265 |
++ unsigned long x __maybe_unused; |
1266 |
++ |
1267 |
+ bootx_printf("Touching pages...\n"); |
1268 |
+ |
1269 |
+ /* |
1270 |
+diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c |
1271 |
+index ab668cb72263..8b2eab1340f4 100644 |
1272 |
+--- a/arch/powerpc/platforms/powermac/setup.c |
1273 |
++++ b/arch/powerpc/platforms/powermac/setup.c |
1274 |
+@@ -352,6 +352,7 @@ static int pmac_late_init(void) |
1275 |
+ } |
1276 |
+ machine_late_initcall(powermac, pmac_late_init); |
1277 |
+ |
1278 |
++void note_bootable_part(dev_t dev, int part, int goodness); |
1279 |
+ /* |
1280 |
+ * This is __ref because we check for "initializing" before |
1281 |
+ * touching any of the __init sensitive things and "initializing" |
1282 |
+diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h |
1283 |
+index f58d17e9dd65..de023a9a88ca 100644 |
1284 |
+--- a/arch/s390/include/asm/cpu_mf.h |
1285 |
++++ b/arch/s390/include/asm/cpu_mf.h |
1286 |
+@@ -113,7 +113,7 @@ struct hws_basic_entry { |
1287 |
+ |
1288 |
+ struct hws_diag_entry { |
1289 |
+ unsigned int def:16; /* 0-15 Data Entry Format */ |
1290 |
+- unsigned int R:14; /* 16-19 and 20-30 reserved */ |
1291 |
++ unsigned int R:15; /* 16-19 and 20-30 reserved */ |
1292 |
+ unsigned int I:1; /* 31 entry valid or invalid */ |
1293 |
+ u8 data[]; /* Machine-dependent sample data */ |
1294 |
+ } __packed; |
1295 |
+@@ -129,7 +129,9 @@ struct hws_trailer_entry { |
1296 |
+ unsigned int f:1; /* 0 - Block Full Indicator */ |
1297 |
+ unsigned int a:1; /* 1 - Alert request control */ |
1298 |
+ unsigned int t:1; /* 2 - Timestamp format */ |
1299 |
+- unsigned long long:61; /* 3 - 63: Reserved */ |
1300 |
++ unsigned int :29; /* 3 - 31: Reserved */ |
1301 |
++ unsigned int bsdes:16; /* 32-47: size of basic SDE */ |
1302 |
++ unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */ |
1303 |
+ }; |
1304 |
+ unsigned long long flags; /* 0 - 63: All indicators */ |
1305 |
+ }; |
1306 |
+diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c |
1307 |
+index 271dfc260e82..3d7d0046cf49 100644 |
1308 |
+--- a/arch/sh/boards/mach-migor/setup.c |
1309 |
++++ b/arch/sh/boards/mach-migor/setup.c |
1310 |
+@@ -359,7 +359,7 @@ static struct gpiod_lookup_table ov7725_gpios = { |
1311 |
+ static struct gpiod_lookup_table tw9910_gpios = { |
1312 |
+ .dev_id = "0-0045", |
1313 |
+ .table = { |
1314 |
+- GPIO_LOOKUP("sh7722_pfc", GPIO_PTT2, "pdn", GPIO_ACTIVE_HIGH), |
1315 |
++ GPIO_LOOKUP("sh7722_pfc", GPIO_PTT2, "pdn", GPIO_ACTIVE_LOW), |
1316 |
+ GPIO_LOOKUP("sh7722_pfc", GPIO_PTT3, "rstb", GPIO_ACTIVE_LOW), |
1317 |
+ }, |
1318 |
+ }; |
1319 |
+diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c |
1320 |
+index a7956fc7ca1d..3b0f93eb3cc0 100644 |
1321 |
+--- a/arch/x86/events/intel/uncore.c |
1322 |
++++ b/arch/x86/events/intel/uncore.c |
1323 |
+@@ -218,7 +218,7 @@ void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *e |
1324 |
+ u64 prev_count, new_count, delta; |
1325 |
+ int shift; |
1326 |
+ |
1327 |
+- if (event->hw.idx >= UNCORE_PMC_IDX_FIXED) |
1328 |
++ if (event->hw.idx == UNCORE_PMC_IDX_FIXED) |
1329 |
+ shift = 64 - uncore_fixed_ctr_bits(box); |
1330 |
+ else |
1331 |
+ shift = 64 - uncore_perf_ctr_bits(box); |
1332 |
+diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c |
1333 |
+index 93e7a8397cde..173e2674be6e 100644 |
1334 |
+--- a/arch/x86/events/intel/uncore_nhmex.c |
1335 |
++++ b/arch/x86/events/intel/uncore_nhmex.c |
1336 |
+@@ -246,7 +246,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p |
1337 |
+ { |
1338 |
+ struct hw_perf_event *hwc = &event->hw; |
1339 |
+ |
1340 |
+- if (hwc->idx >= UNCORE_PMC_IDX_FIXED) |
1341 |
++ if (hwc->idx == UNCORE_PMC_IDX_FIXED) |
1342 |
+ wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0); |
1343 |
+ else if (box->pmu->type->event_mask & NHMEX_PMON_CTL_EN_BIT0) |
1344 |
+ wrmsrl(hwc->config_base, hwc->config | NHMEX_PMON_CTL_EN_BIT22); |
1345 |
+diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c |
1346 |
+index 77e201301528..08286269fd24 100644 |
1347 |
+--- a/arch/x86/kernel/cpu/microcode/core.c |
1348 |
++++ b/arch/x86/kernel/cpu/microcode/core.c |
1349 |
+@@ -70,7 +70,7 @@ static DEFINE_MUTEX(microcode_mutex); |
1350 |
+ /* |
1351 |
+ * Serialize late loading so that CPUs get updated one-by-one. |
1352 |
+ */ |
1353 |
+-static DEFINE_SPINLOCK(update_lock); |
1354 |
++static DEFINE_RAW_SPINLOCK(update_lock); |
1355 |
+ |
1356 |
+ struct ucode_cpu_info ucode_cpu_info[NR_CPUS]; |
1357 |
+ |
1358 |
+@@ -560,9 +560,9 @@ static int __reload_late(void *info) |
1359 |
+ if (__wait_for_cpus(&late_cpus_in, NSEC_PER_SEC)) |
1360 |
+ return -1; |
1361 |
+ |
1362 |
+- spin_lock(&update_lock); |
1363 |
++ raw_spin_lock(&update_lock); |
1364 |
+ apply_microcode_local(&err); |
1365 |
+- spin_unlock(&update_lock); |
1366 |
++ raw_spin_unlock(&update_lock); |
1367 |
+ |
1368 |
+ /* siblings return UCODE_OK because their engine got updated already */ |
1369 |
+ if (err > UCODE_NFOUND) { |
1370 |
+diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c |
1371 |
+index 8494dbae41b9..030c6bb240d9 100644 |
1372 |
+--- a/arch/x86/kvm/mmu.c |
1373 |
++++ b/arch/x86/kvm/mmu.c |
1374 |
+@@ -891,7 +891,7 @@ static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache, |
1375 |
+ if (cache->nobjs >= min) |
1376 |
+ return 0; |
1377 |
+ while (cache->nobjs < ARRAY_SIZE(cache->objects)) { |
1378 |
+- page = (void *)__get_free_page(GFP_KERNEL); |
1379 |
++ page = (void *)__get_free_page(GFP_KERNEL_ACCOUNT); |
1380 |
+ if (!page) |
1381 |
+ return -ENOMEM; |
1382 |
+ cache->objects[cache->nobjs++] = page; |
1383 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
1384 |
+index 26110c202b19..ace53c2934dc 100644 |
1385 |
+--- a/arch/x86/kvm/svm.c |
1386 |
++++ b/arch/x86/kvm/svm.c |
1387 |
+@@ -1768,7 +1768,10 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr, |
1388 |
+ unsigned long npages, npinned, size; |
1389 |
+ unsigned long locked, lock_limit; |
1390 |
+ struct page **pages; |
1391 |
+- int first, last; |
1392 |
++ unsigned long first, last; |
1393 |
++ |
1394 |
++ if (ulen == 0 || uaddr + ulen < uaddr) |
1395 |
++ return NULL; |
1396 |
+ |
1397 |
+ /* Calculate number of pages. */ |
1398 |
+ first = (uaddr & PAGE_MASK) >> PAGE_SHIFT; |
1399 |
+@@ -6947,6 +6950,9 @@ static int svm_register_enc_region(struct kvm *kvm, |
1400 |
+ if (!sev_guest(kvm)) |
1401 |
+ return -ENOTTY; |
1402 |
+ |
1403 |
++ if (range->addr > ULONG_MAX || range->size > ULONG_MAX) |
1404 |
++ return -EINVAL; |
1405 |
++ |
1406 |
+ region = kzalloc(sizeof(*region), GFP_KERNEL); |
1407 |
+ if (!region) |
1408 |
+ return -ENOMEM; |
1409 |
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
1410 |
+index 771ae9730ac6..1f0951d36424 100644 |
1411 |
+--- a/block/bfq-iosched.c |
1412 |
++++ b/block/bfq-iosched.c |
1413 |
+@@ -1898,7 +1898,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, |
1414 |
+ |
1415 |
+ if (!RB_EMPTY_NODE(&rq->rb_node)) |
1416 |
+ goto end; |
1417 |
+- spin_lock_irq(&bfqq->bfqd->lock); |
1418 |
+ |
1419 |
+ /* |
1420 |
+ * If next and rq belong to the same bfq_queue and next is older |
1421 |
+@@ -1923,7 +1922,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, |
1422 |
+ bfq_remove_request(q, next); |
1423 |
+ bfqg_stats_update_io_remove(bfqq_group(bfqq), next->cmd_flags); |
1424 |
+ |
1425 |
+- spin_unlock_irq(&bfqq->bfqd->lock); |
1426 |
+ end: |
1427 |
+ bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); |
1428 |
+ } |
1429 |
+diff --git a/block/bio.c b/block/bio.c |
1430 |
+index 53e0f0a1ed94..9f7fa24d8b15 100644 |
1431 |
+--- a/block/bio.c |
1432 |
++++ b/block/bio.c |
1433 |
+@@ -881,16 +881,16 @@ EXPORT_SYMBOL(bio_add_page); |
1434 |
+ */ |
1435 |
+ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) |
1436 |
+ { |
1437 |
+- unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt; |
1438 |
++ unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt, idx; |
1439 |
+ struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt; |
1440 |
+ struct page **pages = (struct page **)bv; |
1441 |
+- size_t offset, diff; |
1442 |
++ size_t offset; |
1443 |
+ ssize_t size; |
1444 |
+ |
1445 |
+ size = iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset); |
1446 |
+ if (unlikely(size <= 0)) |
1447 |
+ return size ? size : -EFAULT; |
1448 |
+- nr_pages = (size + offset + PAGE_SIZE - 1) / PAGE_SIZE; |
1449 |
++ idx = nr_pages = (size + offset + PAGE_SIZE - 1) / PAGE_SIZE; |
1450 |
+ |
1451 |
+ /* |
1452 |
+ * Deep magic below: We need to walk the pinned pages backwards |
1453 |
+@@ -903,17 +903,15 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) |
1454 |
+ bio->bi_iter.bi_size += size; |
1455 |
+ bio->bi_vcnt += nr_pages; |
1456 |
+ |
1457 |
+- diff = (nr_pages * PAGE_SIZE - offset) - size; |
1458 |
+- while (nr_pages--) { |
1459 |
+- bv[nr_pages].bv_page = pages[nr_pages]; |
1460 |
+- bv[nr_pages].bv_len = PAGE_SIZE; |
1461 |
+- bv[nr_pages].bv_offset = 0; |
1462 |
++ while (idx--) { |
1463 |
++ bv[idx].bv_page = pages[idx]; |
1464 |
++ bv[idx].bv_len = PAGE_SIZE; |
1465 |
++ bv[idx].bv_offset = 0; |
1466 |
+ } |
1467 |
+ |
1468 |
+ bv[0].bv_offset += offset; |
1469 |
+ bv[0].bv_len -= offset; |
1470 |
+- if (diff) |
1471 |
+- bv[bio->bi_vcnt - 1].bv_len -= diff; |
1472 |
++ bv[nr_pages - 1].bv_len -= nr_pages * PAGE_SIZE - offset - size; |
1473 |
+ |
1474 |
+ iov_iter_advance(iter, size); |
1475 |
+ return 0; |
1476 |
+@@ -1808,6 +1806,7 @@ struct bio *bio_split(struct bio *bio, int sectors, |
1477 |
+ bio_integrity_trim(split); |
1478 |
+ |
1479 |
+ bio_advance(bio, split->bi_iter.bi_size); |
1480 |
++ bio->bi_iter.bi_done = 0; |
1481 |
+ |
1482 |
+ if (bio_flagged(bio, BIO_TRACE_COMPLETION)) |
1483 |
+ bio_set_flag(split, BIO_TRACE_COMPLETION); |
1484 |
+diff --git a/crypto/authenc.c b/crypto/authenc.c |
1485 |
+index d3d6d72fe649..4fa8d40d947b 100644 |
1486 |
+--- a/crypto/authenc.c |
1487 |
++++ b/crypto/authenc.c |
1488 |
+@@ -108,6 +108,7 @@ static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key, |
1489 |
+ CRYPTO_TFM_RES_MASK); |
1490 |
+ |
1491 |
+ out: |
1492 |
++ memzero_explicit(&keys, sizeof(keys)); |
1493 |
+ return err; |
1494 |
+ |
1495 |
+ badkey: |
1496 |
+diff --git a/crypto/authencesn.c b/crypto/authencesn.c |
1497 |
+index 15f91ddd7f0e..50b804747e20 100644 |
1498 |
+--- a/crypto/authencesn.c |
1499 |
++++ b/crypto/authencesn.c |
1500 |
+@@ -90,6 +90,7 @@ static int crypto_authenc_esn_setkey(struct crypto_aead *authenc_esn, const u8 * |
1501 |
+ CRYPTO_TFM_RES_MASK); |
1502 |
+ |
1503 |
+ out: |
1504 |
++ memzero_explicit(&keys, sizeof(keys)); |
1505 |
+ return err; |
1506 |
+ |
1507 |
+ badkey: |
1508 |
+diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c |
1509 |
+index eb091375c873..9706613eecf9 100644 |
1510 |
+--- a/drivers/acpi/acpi_lpss.c |
1511 |
++++ b/drivers/acpi/acpi_lpss.c |
1512 |
+@@ -70,6 +70,10 @@ ACPI_MODULE_NAME("acpi_lpss"); |
1513 |
+ #define LPSS_SAVE_CTX BIT(4) |
1514 |
+ #define LPSS_NO_D3_DELAY BIT(5) |
1515 |
+ |
1516 |
++/* Crystal Cove PMIC shares same ACPI ID between different platforms */ |
1517 |
++#define BYT_CRC_HRV 2 |
1518 |
++#define CHT_CRC_HRV 3 |
1519 |
++ |
1520 |
+ struct lpss_private_data; |
1521 |
+ |
1522 |
+ struct lpss_device_desc { |
1523 |
+@@ -163,7 +167,7 @@ static void byt_pwm_setup(struct lpss_private_data *pdata) |
1524 |
+ if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1")) |
1525 |
+ return; |
1526 |
+ |
1527 |
+- if (!acpi_dev_present("INT33FD", NULL, -1)) |
1528 |
++ if (!acpi_dev_present("INT33FD", NULL, BYT_CRC_HRV)) |
1529 |
+ pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup)); |
1530 |
+ } |
1531 |
+ |
1532 |
+@@ -875,6 +879,7 @@ static void acpi_lpss_dismiss(struct device *dev) |
1533 |
+ #define LPSS_GPIODEF0_DMA_LLP BIT(13) |
1534 |
+ |
1535 |
+ static DEFINE_MUTEX(lpss_iosf_mutex); |
1536 |
++static bool lpss_iosf_d3_entered; |
1537 |
+ |
1538 |
+ static void lpss_iosf_enter_d3_state(void) |
1539 |
+ { |
1540 |
+@@ -917,6 +922,9 @@ static void lpss_iosf_enter_d3_state(void) |
1541 |
+ |
1542 |
+ iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, |
1543 |
+ LPSS_IOSF_GPIODEF0, value1, mask1); |
1544 |
++ |
1545 |
++ lpss_iosf_d3_entered = true; |
1546 |
++ |
1547 |
+ exit: |
1548 |
+ mutex_unlock(&lpss_iosf_mutex); |
1549 |
+ } |
1550 |
+@@ -931,6 +939,11 @@ static void lpss_iosf_exit_d3_state(void) |
1551 |
+ |
1552 |
+ mutex_lock(&lpss_iosf_mutex); |
1553 |
+ |
1554 |
++ if (!lpss_iosf_d3_entered) |
1555 |
++ goto exit; |
1556 |
++ |
1557 |
++ lpss_iosf_d3_entered = false; |
1558 |
++ |
1559 |
+ iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, |
1560 |
+ LPSS_IOSF_GPIODEF0, value1, mask1); |
1561 |
+ |
1562 |
+@@ -940,13 +953,13 @@ static void lpss_iosf_exit_d3_state(void) |
1563 |
+ iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE, |
1564 |
+ LPSS_IOSF_PMCSR, value2, mask2); |
1565 |
+ |
1566 |
++exit: |
1567 |
+ mutex_unlock(&lpss_iosf_mutex); |
1568 |
+ } |
1569 |
+ |
1570 |
+-static int acpi_lpss_suspend(struct device *dev, bool runtime) |
1571 |
++static int acpi_lpss_suspend(struct device *dev, bool wakeup) |
1572 |
+ { |
1573 |
+ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
1574 |
+- bool wakeup = runtime || device_may_wakeup(dev); |
1575 |
+ int ret; |
1576 |
+ |
1577 |
+ if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
1578 |
+@@ -959,14 +972,14 @@ static int acpi_lpss_suspend(struct device *dev, bool runtime) |
1579 |
+ * wrong status for devices being about to be powered off. See |
1580 |
+ * lpss_iosf_enter_d3_state() for further information. |
1581 |
+ */ |
1582 |
+- if ((runtime || !pm_suspend_via_firmware()) && |
1583 |
++ if (acpi_target_system_state() == ACPI_STATE_S0 && |
1584 |
+ lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) |
1585 |
+ lpss_iosf_enter_d3_state(); |
1586 |
+ |
1587 |
+ return ret; |
1588 |
+ } |
1589 |
+ |
1590 |
+-static int acpi_lpss_resume(struct device *dev, bool runtime) |
1591 |
++static int acpi_lpss_resume(struct device *dev) |
1592 |
+ { |
1593 |
+ struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
1594 |
+ int ret; |
1595 |
+@@ -975,8 +988,7 @@ static int acpi_lpss_resume(struct device *dev, bool runtime) |
1596 |
+ * This call is kept first to be in symmetry with |
1597 |
+ * acpi_lpss_runtime_suspend() one. |
1598 |
+ */ |
1599 |
+- if ((runtime || !pm_resume_via_firmware()) && |
1600 |
+- lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) |
1601 |
++ if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) |
1602 |
+ lpss_iosf_exit_d3_state(); |
1603 |
+ |
1604 |
+ ret = acpi_dev_resume(dev); |
1605 |
+@@ -1000,12 +1012,12 @@ static int acpi_lpss_suspend_late(struct device *dev) |
1606 |
+ return 0; |
1607 |
+ |
1608 |
+ ret = pm_generic_suspend_late(dev); |
1609 |
+- return ret ? ret : acpi_lpss_suspend(dev, false); |
1610 |
++ return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev)); |
1611 |
+ } |
1612 |
+ |
1613 |
+ static int acpi_lpss_resume_early(struct device *dev) |
1614 |
+ { |
1615 |
+- int ret = acpi_lpss_resume(dev, false); |
1616 |
++ int ret = acpi_lpss_resume(dev); |
1617 |
+ |
1618 |
+ return ret ? ret : pm_generic_resume_early(dev); |
1619 |
+ } |
1620 |
+@@ -1020,7 +1032,7 @@ static int acpi_lpss_runtime_suspend(struct device *dev) |
1621 |
+ |
1622 |
+ static int acpi_lpss_runtime_resume(struct device *dev) |
1623 |
+ { |
1624 |
+- int ret = acpi_lpss_resume(dev, true); |
1625 |
++ int ret = acpi_lpss_resume(dev); |
1626 |
+ |
1627 |
+ return ret ? ret : pm_generic_runtime_resume(dev); |
1628 |
+ } |
1629 |
+diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c |
1630 |
+index ee840be150b5..44f35ab3347d 100644 |
1631 |
+--- a/drivers/acpi/acpica/psloop.c |
1632 |
++++ b/drivers/acpi/acpica/psloop.c |
1633 |
+@@ -709,15 +709,20 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) |
1634 |
+ } else |
1635 |
+ if ((walk_state-> |
1636 |
+ parse_flags & ACPI_PARSE_MODULE_LEVEL) |
1637 |
++ && status != AE_CTRL_TRANSFER |
1638 |
+ && ACPI_FAILURE(status)) { |
1639 |
+ /* |
1640 |
+- * ACPI_PARSE_MODULE_LEVEL means that we are loading a table by |
1641 |
+- * executing it as a control method. However, if we encounter |
1642 |
+- * an error while loading the table, we need to keep trying to |
1643 |
+- * load the table rather than aborting the table load. Set the |
1644 |
+- * status to AE_OK to proceed with the table load. If we get a |
1645 |
+- * failure at this point, it means that the dispatcher got an |
1646 |
+- * error while processing Op (most likely an AML operand error. |
1647 |
++ * ACPI_PARSE_MODULE_LEVEL flag means that we are currently |
1648 |
++ * loading a table by executing it as a control method. |
1649 |
++ * However, if we encounter an error while loading the table, |
1650 |
++ * we need to keep trying to load the table rather than |
1651 |
++ * aborting the table load (setting the status to AE_OK |
1652 |
++ * continues the table load). If we get a failure at this |
1653 |
++ * point, it means that the dispatcher got an error while |
1654 |
++ * processing Op (most likely an AML operand error) or a |
1655 |
++ * control method was called from module level and the |
1656 |
++ * dispatcher returned AE_CTRL_TRANSFER. In the latter case, |
1657 |
++ * leave the status alone, there's nothing wrong with it. |
1658 |
+ */ |
1659 |
+ status = AE_OK; |
1660 |
+ } |
1661 |
+diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c |
1662 |
+index 0da18bde6a16..dd946b62fedd 100644 |
1663 |
+--- a/drivers/acpi/pci_root.c |
1664 |
++++ b/drivers/acpi/pci_root.c |
1665 |
+@@ -472,9 +472,11 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) |
1666 |
+ } |
1667 |
+ |
1668 |
+ control = OSC_PCI_EXPRESS_CAPABILITY_CONTROL |
1669 |
+- | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |
1670 |
+ | OSC_PCI_EXPRESS_PME_CONTROL; |
1671 |
+ |
1672 |
++ if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)) |
1673 |
++ control |= OSC_PCI_EXPRESS_NATIVE_HP_CONTROL; |
1674 |
++ |
1675 |
+ if (pci_aer_available()) { |
1676 |
+ if (aer_acpi_firmware_first()) |
1677 |
+ dev_info(&device->dev, |
1678 |
+diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c |
1679 |
+index 513b260bcff1..f5942d09854c 100644 |
1680 |
+--- a/drivers/ata/libata-eh.c |
1681 |
++++ b/drivers/ata/libata-eh.c |
1682 |
+@@ -2218,12 +2218,16 @@ static void ata_eh_link_autopsy(struct ata_link *link) |
1683 |
+ if (qc->err_mask & ~AC_ERR_OTHER) |
1684 |
+ qc->err_mask &= ~AC_ERR_OTHER; |
1685 |
+ |
1686 |
+- /* SENSE_VALID trumps dev/unknown error and revalidation */ |
1687 |
++ /* |
1688 |
++ * SENSE_VALID trumps dev/unknown error and revalidation. Upper |
1689 |
++ * layers will determine whether the command is worth retrying |
1690 |
++ * based on the sense data and device class/type. Otherwise, |
1691 |
++ * determine directly if the command is worth retrying using its |
1692 |
++ * error mask and flags. |
1693 |
++ */ |
1694 |
+ if (qc->flags & ATA_QCFLAG_SENSE_VALID) |
1695 |
+ qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
1696 |
+- |
1697 |
+- /* determine whether the command is worth retrying */ |
1698 |
+- if (ata_eh_worth_retry(qc)) |
1699 |
++ else if (ata_eh_worth_retry(qc)) |
1700 |
+ qc->flags |= ATA_QCFLAG_RETRY; |
1701 |
+ |
1702 |
+ /* accumulate error info */ |
1703 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
1704 |
+index b937cc1e2c07..836756a5c35c 100644 |
1705 |
+--- a/drivers/bluetooth/btusb.c |
1706 |
++++ b/drivers/bluetooth/btusb.c |
1707 |
+@@ -276,6 +276,7 @@ static const struct usb_device_id blacklist_table[] = { |
1708 |
+ { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME }, |
1709 |
+ { USB_DEVICE(0x04ca, 0x3015), .driver_info = BTUSB_QCA_ROME }, |
1710 |
+ { USB_DEVICE(0x04ca, 0x3016), .driver_info = BTUSB_QCA_ROME }, |
1711 |
++ { USB_DEVICE(0x04ca, 0x301a), .driver_info = BTUSB_QCA_ROME }, |
1712 |
+ |
1713 |
+ /* Broadcom BCM2035 */ |
1714 |
+ { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 }, |
1715 |
+@@ -371,6 +372,9 @@ static const struct usb_device_id blacklist_table[] = { |
1716 |
+ /* Additional Realtek 8723BU Bluetooth devices */ |
1717 |
+ { USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK }, |
1718 |
+ |
1719 |
++ /* Additional Realtek 8723DE Bluetooth devices */ |
1720 |
++ { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK }, |
1721 |
++ |
1722 |
+ /* Additional Realtek 8821AE Bluetooth devices */ |
1723 |
+ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK }, |
1724 |
+ { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK }, |
1725 |
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c |
1726 |
+index 330e9b29e145..8b017e84db53 100644 |
1727 |
+--- a/drivers/bluetooth/hci_qca.c |
1728 |
++++ b/drivers/bluetooth/hci_qca.c |
1729 |
+@@ -880,7 +880,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) |
1730 |
+ */ |
1731 |
+ set_current_state(TASK_UNINTERRUPTIBLE); |
1732 |
+ schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS)); |
1733 |
+- set_current_state(TASK_INTERRUPTIBLE); |
1734 |
++ set_current_state(TASK_RUNNING); |
1735 |
+ |
1736 |
+ return 0; |
1737 |
+ } |
1738 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
1739 |
+index cd888d4ee605..bd449ad52442 100644 |
1740 |
+--- a/drivers/char/random.c |
1741 |
++++ b/drivers/char/random.c |
1742 |
+@@ -1895,14 +1895,22 @@ static int |
1743 |
+ write_pool(struct entropy_store *r, const char __user *buffer, size_t count) |
1744 |
+ { |
1745 |
+ size_t bytes; |
1746 |
+- __u32 buf[16]; |
1747 |
++ __u32 t, buf[16]; |
1748 |
+ const char __user *p = buffer; |
1749 |
+ |
1750 |
+ while (count > 0) { |
1751 |
++ int b, i = 0; |
1752 |
++ |
1753 |
+ bytes = min(count, sizeof(buf)); |
1754 |
+ if (copy_from_user(&buf, p, bytes)) |
1755 |
+ return -EFAULT; |
1756 |
+ |
1757 |
++ for (b = bytes ; b > 0 ; b -= sizeof(__u32), i++) { |
1758 |
++ if (!arch_get_random_int(&t)) |
1759 |
++ break; |
1760 |
++ buf[i] ^= t; |
1761 |
++ } |
1762 |
++ |
1763 |
+ count -= bytes; |
1764 |
+ p += bytes; |
1765 |
+ |
1766 |
+diff --git a/drivers/clk/clk-si544.c b/drivers/clk/clk-si544.c |
1767 |
+index 1c96a9f6c022..1e2a3b8f9454 100644 |
1768 |
+--- a/drivers/clk/clk-si544.c |
1769 |
++++ b/drivers/clk/clk-si544.c |
1770 |
+@@ -207,6 +207,7 @@ static int si544_calc_muldiv(struct clk_si544_muldiv *settings, |
1771 |
+ |
1772 |
+ /* And the fractional bits using the remainder */ |
1773 |
+ vco = (u64)tmp << 32; |
1774 |
++ vco += FXO / 2; /* Round to nearest multiple */ |
1775 |
+ do_div(vco, FXO); |
1776 |
+ settings->fb_div_frac = vco; |
1777 |
+ |
1778 |
+diff --git a/drivers/clk/ingenic/jz4770-cgu.c b/drivers/clk/ingenic/jz4770-cgu.c |
1779 |
+index c78d369b9403..992bb2e146d6 100644 |
1780 |
+--- a/drivers/clk/ingenic/jz4770-cgu.c |
1781 |
++++ b/drivers/clk/ingenic/jz4770-cgu.c |
1782 |
+@@ -194,9 +194,10 @@ static const struct ingenic_cgu_clk_info jz4770_cgu_clocks[] = { |
1783 |
+ .div = { CGU_REG_CPCCR, 16, 1, 4, 22, -1, -1 }, |
1784 |
+ }, |
1785 |
+ [JZ4770_CLK_C1CLK] = { |
1786 |
+- "c1clk", CGU_CLK_DIV, |
1787 |
++ "c1clk", CGU_CLK_DIV | CGU_CLK_GATE, |
1788 |
+ .parents = { JZ4770_CLK_PLL0, }, |
1789 |
+ .div = { CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1 }, |
1790 |
++ .gate = { CGU_REG_OPCR, 31, true }, // disable CCLK stop on idle |
1791 |
+ }, |
1792 |
+ [JZ4770_CLK_PCLK] = { |
1793 |
+ "pclk", CGU_CLK_DIV, |
1794 |
+diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c |
1795 |
+index 11d6419788c2..4d614d7615a4 100644 |
1796 |
+--- a/drivers/edac/altera_edac.c |
1797 |
++++ b/drivers/edac/altera_edac.c |
1798 |
+@@ -1106,7 +1106,7 @@ static void *ocram_alloc_mem(size_t size, void **other) |
1799 |
+ |
1800 |
+ static void ocram_free_mem(void *p, size_t size, void *other) |
1801 |
+ { |
1802 |
+- gen_pool_free((struct gen_pool *)other, (u32)p, size); |
1803 |
++ gen_pool_free((struct gen_pool *)other, (unsigned long)p, size); |
1804 |
+ } |
1805 |
+ |
1806 |
+ static const struct edac_device_prv_data ocramecc_data = { |
1807 |
+diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c |
1808 |
+index 761d8279abca..b2864bdfb30e 100644 |
1809 |
+--- a/drivers/gpio/gpio-uniphier.c |
1810 |
++++ b/drivers/gpio/gpio-uniphier.c |
1811 |
+@@ -181,7 +181,11 @@ static int uniphier_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) |
1812 |
+ fwspec.fwnode = of_node_to_fwnode(chip->parent->of_node); |
1813 |
+ fwspec.param_count = 2; |
1814 |
+ fwspec.param[0] = offset - UNIPHIER_GPIO_IRQ_OFFSET; |
1815 |
+- fwspec.param[1] = IRQ_TYPE_NONE; |
1816 |
++ /* |
1817 |
++ * IRQ_TYPE_NONE is rejected by the parent irq domain. Set LEVEL_HIGH |
1818 |
++ * temporarily. Anyway, ->irq_set_type() will override it later. |
1819 |
++ */ |
1820 |
++ fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH; |
1821 |
+ |
1822 |
+ return irq_create_fwspec_mapping(&fwspec); |
1823 |
+ } |
1824 |
+diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c |
1825 |
+index 586d15137c03..d4411c8becf7 100644 |
1826 |
+--- a/drivers/gpio/gpiolib-of.c |
1827 |
++++ b/drivers/gpio/gpiolib-of.c |
1828 |
+@@ -64,7 +64,8 @@ static void of_gpio_flags_quirks(struct device_node *np, |
1829 |
+ * Note that active low is the default. |
1830 |
+ */ |
1831 |
+ if (IS_ENABLED(CONFIG_REGULATOR) && |
1832 |
+- (of_device_is_compatible(np, "reg-fixed-voltage") || |
1833 |
++ (of_device_is_compatible(np, "regulator-fixed") || |
1834 |
++ of_device_is_compatible(np, "reg-fixed-voltage") || |
1835 |
+ of_device_is_compatible(np, "regulator-gpio"))) { |
1836 |
+ /* |
1837 |
+ * The regulator GPIO handles are specified such that the |
1838 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c |
1839 |
+index bd67f4cb8e6c..3b3ee737657c 100644 |
1840 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c |
1841 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c |
1842 |
+@@ -316,7 +316,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr) |
1843 |
+ unsigned long end = addr + amdgpu_bo_size(bo) - 1; |
1844 |
+ struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); |
1845 |
+ struct amdgpu_mn *rmn; |
1846 |
+- struct amdgpu_mn_node *node = NULL; |
1847 |
++ struct amdgpu_mn_node *node = NULL, *new_node; |
1848 |
+ struct list_head bos; |
1849 |
+ struct interval_tree_node *it; |
1850 |
+ |
1851 |
+@@ -324,6 +324,10 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr) |
1852 |
+ if (IS_ERR(rmn)) |
1853 |
+ return PTR_ERR(rmn); |
1854 |
+ |
1855 |
++ new_node = kmalloc(sizeof(*new_node), GFP_KERNEL); |
1856 |
++ if (!new_node) |
1857 |
++ return -ENOMEM; |
1858 |
++ |
1859 |
+ INIT_LIST_HEAD(&bos); |
1860 |
+ |
1861 |
+ down_write(&rmn->lock); |
1862 |
+@@ -337,13 +341,10 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr) |
1863 |
+ list_splice(&node->bos, &bos); |
1864 |
+ } |
1865 |
+ |
1866 |
+- if (!node) { |
1867 |
+- node = kmalloc(sizeof(struct amdgpu_mn_node), GFP_KERNEL); |
1868 |
+- if (!node) { |
1869 |
+- up_write(&rmn->lock); |
1870 |
+- return -ENOMEM; |
1871 |
+- } |
1872 |
+- } |
1873 |
++ if (!node) |
1874 |
++ node = new_node; |
1875 |
++ else |
1876 |
++ kfree(new_node); |
1877 |
+ |
1878 |
+ bo->mn = rmn; |
1879 |
+ |
1880 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
1881 |
+index b52f26e7db98..d1c4beb79ee6 100644 |
1882 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
1883 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
1884 |
+@@ -689,8 +689,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, |
1885 |
+ return -EINVAL; |
1886 |
+ |
1887 |
+ /* A shared bo cannot be migrated to VRAM */ |
1888 |
+- if (bo->prime_shared_count && (domain == AMDGPU_GEM_DOMAIN_VRAM)) |
1889 |
+- return -EINVAL; |
1890 |
++ if (bo->prime_shared_count) { |
1891 |
++ if (domain & AMDGPU_GEM_DOMAIN_GTT) |
1892 |
++ domain = AMDGPU_GEM_DOMAIN_GTT; |
1893 |
++ else |
1894 |
++ return -EINVAL; |
1895 |
++ } |
1896 |
+ |
1897 |
+ if (bo->pin_count) { |
1898 |
+ uint32_t mem_type = bo->tbo.mem.mem_type; |
1899 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
1900 |
+index 79afffa00772..8dafb10b7832 100644 |
1901 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
1902 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
1903 |
+@@ -4037,7 +4037,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, |
1904 |
+ } |
1905 |
+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
1906 |
+ |
1907 |
+- if (!pflip_needed) { |
1908 |
++ if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) { |
1909 |
+ WARN_ON(!dm_new_plane_state->dc_state); |
1910 |
+ |
1911 |
+ plane_states_constructed[planes_count] = dm_new_plane_state->dc_state; |
1912 |
+@@ -4783,7 +4783,8 @@ static int dm_update_planes_state(struct dc *dc, |
1913 |
+ |
1914 |
+ /* Remove any changed/removed planes */ |
1915 |
+ if (!enable) { |
1916 |
+- if (pflip_needed) |
1917 |
++ if (pflip_needed && |
1918 |
++ plane->type != DRM_PLANE_TYPE_OVERLAY) |
1919 |
+ continue; |
1920 |
+ |
1921 |
+ if (!old_plane_crtc) |
1922 |
+@@ -4830,7 +4831,8 @@ static int dm_update_planes_state(struct dc *dc, |
1923 |
+ if (!dm_new_crtc_state->stream) |
1924 |
+ continue; |
1925 |
+ |
1926 |
+- if (pflip_needed) |
1927 |
++ if (pflip_needed && |
1928 |
++ plane->type != DRM_PLANE_TYPE_OVERLAY) |
1929 |
+ continue; |
1930 |
+ |
1931 |
+ WARN_ON(dm_new_plane_state->dc_state); |
1932 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c |
1933 |
+index 4be21bf54749..a910f01838ab 100644 |
1934 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c |
1935 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c |
1936 |
+@@ -555,6 +555,9 @@ static inline int dm_irq_state(struct amdgpu_device *adev, |
1937 |
+ return 0; |
1938 |
+ } |
1939 |
+ |
1940 |
++ if (acrtc->otg_inst == -1) |
1941 |
++ return 0; |
1942 |
++ |
1943 |
+ irq_source = dal_irq_type + acrtc->otg_inst; |
1944 |
+ |
1945 |
+ st = (state == AMDGPU_IRQ_STATE_ENABLE); |
1946 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
1947 |
+index d0575999f172..09c93f6ebb10 100644 |
1948 |
+--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
1949 |
++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
1950 |
+@@ -279,7 +279,9 @@ dce110_set_input_transfer_func(struct pipe_ctx *pipe_ctx, |
1951 |
+ build_prescale_params(&prescale_params, plane_state); |
1952 |
+ ipp->funcs->ipp_program_prescale(ipp, &prescale_params); |
1953 |
+ |
1954 |
+- if (plane_state->gamma_correction && dce_use_lut(plane_state->format)) |
1955 |
++ if (plane_state->gamma_correction && |
1956 |
++ !plane_state->gamma_correction->is_identity && |
1957 |
++ dce_use_lut(plane_state->format)) |
1958 |
+ ipp->funcs->ipp_program_input_lut(ipp, plane_state->gamma_correction); |
1959 |
+ |
1960 |
+ if (tf == NULL) { |
1961 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
1962 |
+index 18b5b2ff47fe..df2dce8b8e39 100644 |
1963 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
1964 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c |
1965 |
+@@ -3715,14 +3715,17 @@ static int smu7_trim_dpm_states(struct pp_hwmgr *hwmgr, |
1966 |
+ static int smu7_generate_dpm_level_enable_mask( |
1967 |
+ struct pp_hwmgr *hwmgr, const void *input) |
1968 |
+ { |
1969 |
+- int result; |
1970 |
++ int result = 0; |
1971 |
+ const struct phm_set_power_state_input *states = |
1972 |
+ (const struct phm_set_power_state_input *)input; |
1973 |
+ struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
1974 |
+ const struct smu7_power_state *smu7_ps = |
1975 |
+ cast_const_phw_smu7_power_state(states->pnew_state); |
1976 |
+ |
1977 |
+- result = smu7_trim_dpm_states(hwmgr, smu7_ps); |
1978 |
++ /*skip the trim if od is enabled*/ |
1979 |
++ if (!hwmgr->od_enabled) |
1980 |
++ result = smu7_trim_dpm_states(hwmgr, smu7_ps); |
1981 |
++ |
1982 |
+ if (result) |
1983 |
+ return result; |
1984 |
+ |
1985 |
+diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c |
1986 |
+index c825c76edc1d..d09ee6864ac7 100644 |
1987 |
+--- a/drivers/gpu/drm/drm_atomic.c |
1988 |
++++ b/drivers/gpu/drm/drm_atomic.c |
1989 |
+@@ -1429,7 +1429,9 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, |
1990 |
+ { |
1991 |
+ struct drm_plane *plane = plane_state->plane; |
1992 |
+ struct drm_crtc_state *crtc_state; |
1993 |
+- |
1994 |
++ /* Nothing to do for same crtc*/ |
1995 |
++ if (plane_state->crtc == crtc) |
1996 |
++ return 0; |
1997 |
+ if (plane_state->crtc) { |
1998 |
+ crtc_state = drm_atomic_get_crtc_state(plane_state->state, |
1999 |
+ plane_state->crtc); |
2000 |
+diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c |
2001 |
+index c35654591c12..3448e8e44c35 100644 |
2002 |
+--- a/drivers/gpu/drm/drm_atomic_helper.c |
2003 |
++++ b/drivers/gpu/drm/drm_atomic_helper.c |
2004 |
+@@ -2881,31 +2881,9 @@ commit: |
2005 |
+ return 0; |
2006 |
+ } |
2007 |
+ |
2008 |
+-/** |
2009 |
+- * drm_atomic_helper_disable_all - disable all currently active outputs |
2010 |
+- * @dev: DRM device |
2011 |
+- * @ctx: lock acquisition context |
2012 |
+- * |
2013 |
+- * Loops through all connectors, finding those that aren't turned off and then |
2014 |
+- * turns them off by setting their DPMS mode to OFF and deactivating the CRTC |
2015 |
+- * that they are connected to. |
2016 |
+- * |
2017 |
+- * This is used for example in suspend/resume to disable all currently active |
2018 |
+- * functions when suspending. If you just want to shut down everything at e.g. |
2019 |
+- * driver unload, look at drm_atomic_helper_shutdown(). |
2020 |
+- * |
2021 |
+- * Note that if callers haven't already acquired all modeset locks this might |
2022 |
+- * return -EDEADLK, which must be handled by calling drm_modeset_backoff(). |
2023 |
+- * |
2024 |
+- * Returns: |
2025 |
+- * 0 on success or a negative error code on failure. |
2026 |
+- * |
2027 |
+- * See also: |
2028 |
+- * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and |
2029 |
+- * drm_atomic_helper_shutdown(). |
2030 |
+- */ |
2031 |
+-int drm_atomic_helper_disable_all(struct drm_device *dev, |
2032 |
+- struct drm_modeset_acquire_ctx *ctx) |
2033 |
++static int __drm_atomic_helper_disable_all(struct drm_device *dev, |
2034 |
++ struct drm_modeset_acquire_ctx *ctx, |
2035 |
++ bool clean_old_fbs) |
2036 |
+ { |
2037 |
+ struct drm_atomic_state *state; |
2038 |
+ struct drm_connector_state *conn_state; |
2039 |
+@@ -2957,8 +2935,11 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, |
2040 |
+ goto free; |
2041 |
+ |
2042 |
+ drm_atomic_set_fb_for_plane(plane_state, NULL); |
2043 |
+- plane_mask |= BIT(drm_plane_index(plane)); |
2044 |
+- plane->old_fb = plane->fb; |
2045 |
++ |
2046 |
++ if (clean_old_fbs) { |
2047 |
++ plane->old_fb = plane->fb; |
2048 |
++ plane_mask |= BIT(drm_plane_index(plane)); |
2049 |
++ } |
2050 |
+ } |
2051 |
+ |
2052 |
+ ret = drm_atomic_commit(state); |
2053 |
+@@ -2969,6 +2950,34 @@ free: |
2054 |
+ return ret; |
2055 |
+ } |
2056 |
+ |
2057 |
++/** |
2058 |
++ * drm_atomic_helper_disable_all - disable all currently active outputs |
2059 |
++ * @dev: DRM device |
2060 |
++ * @ctx: lock acquisition context |
2061 |
++ * |
2062 |
++ * Loops through all connectors, finding those that aren't turned off and then |
2063 |
++ * turns them off by setting their DPMS mode to OFF and deactivating the CRTC |
2064 |
++ * that they are connected to. |
2065 |
++ * |
2066 |
++ * This is used for example in suspend/resume to disable all currently active |
2067 |
++ * functions when suspending. If you just want to shut down everything at e.g. |
2068 |
++ * driver unload, look at drm_atomic_helper_shutdown(). |
2069 |
++ * |
2070 |
++ * Note that if callers haven't already acquired all modeset locks this might |
2071 |
++ * return -EDEADLK, which must be handled by calling drm_modeset_backoff(). |
2072 |
++ * |
2073 |
++ * Returns: |
2074 |
++ * 0 on success or a negative error code on failure. |
2075 |
++ * |
2076 |
++ * See also: |
2077 |
++ * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and |
2078 |
++ * drm_atomic_helper_shutdown(). |
2079 |
++ */ |
2080 |
++int drm_atomic_helper_disable_all(struct drm_device *dev, |
2081 |
++ struct drm_modeset_acquire_ctx *ctx) |
2082 |
++{ |
2083 |
++ return __drm_atomic_helper_disable_all(dev, ctx, false); |
2084 |
++} |
2085 |
+ EXPORT_SYMBOL(drm_atomic_helper_disable_all); |
2086 |
+ |
2087 |
+ /** |
2088 |
+@@ -2991,7 +3000,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev) |
2089 |
+ while (1) { |
2090 |
+ ret = drm_modeset_lock_all_ctx(dev, &ctx); |
2091 |
+ if (!ret) |
2092 |
+- ret = drm_atomic_helper_disable_all(dev, &ctx); |
2093 |
++ ret = __drm_atomic_helper_disable_all(dev, &ctx, true); |
2094 |
+ |
2095 |
+ if (ret != -EDEADLK) |
2096 |
+ break; |
2097 |
+@@ -3095,16 +3104,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, |
2098 |
+ struct drm_connector_state *new_conn_state; |
2099 |
+ struct drm_crtc *crtc; |
2100 |
+ struct drm_crtc_state *new_crtc_state; |
2101 |
+- unsigned plane_mask = 0; |
2102 |
+- struct drm_device *dev = state->dev; |
2103 |
+- int ret; |
2104 |
+ |
2105 |
+ state->acquire_ctx = ctx; |
2106 |
+ |
2107 |
+- for_each_new_plane_in_state(state, plane, new_plane_state, i) { |
2108 |
+- plane_mask |= BIT(drm_plane_index(plane)); |
2109 |
++ for_each_new_plane_in_state(state, plane, new_plane_state, i) |
2110 |
+ state->planes[i].old_state = plane->state; |
2111 |
+- } |
2112 |
+ |
2113 |
+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) |
2114 |
+ state->crtcs[i].old_state = crtc->state; |
2115 |
+@@ -3112,11 +3116,7 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, |
2116 |
+ for_each_new_connector_in_state(state, connector, new_conn_state, i) |
2117 |
+ state->connectors[i].old_state = connector->state; |
2118 |
+ |
2119 |
+- ret = drm_atomic_commit(state); |
2120 |
+- if (plane_mask) |
2121 |
+- drm_atomic_clean_old_fb(dev, plane_mask, ret); |
2122 |
+- |
2123 |
+- return ret; |
2124 |
++ return drm_atomic_commit(state); |
2125 |
+ } |
2126 |
+ EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state); |
2127 |
+ |
2128 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
2129 |
+index 6fac4129e6a2..658830620ca3 100644 |
2130 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
2131 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
2132 |
+@@ -2941,12 +2941,14 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m, |
2133 |
+ } |
2134 |
+ } |
2135 |
+ |
2136 |
++#define DP_PAYLOAD_TABLE_SIZE 64 |
2137 |
++ |
2138 |
+ static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr, |
2139 |
+ char *buf) |
2140 |
+ { |
2141 |
+ int i; |
2142 |
+ |
2143 |
+- for (i = 0; i < 64; i += 16) { |
2144 |
++ for (i = 0; i < DP_PAYLOAD_TABLE_SIZE; i += 16) { |
2145 |
+ if (drm_dp_dpcd_read(mgr->aux, |
2146 |
+ DP_PAYLOAD_TABLE_UPDATE_STATUS + i, |
2147 |
+ &buf[i], 16) != 16) |
2148 |
+@@ -3015,7 +3017,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, |
2149 |
+ |
2150 |
+ mutex_lock(&mgr->lock); |
2151 |
+ if (mgr->mst_primary) { |
2152 |
+- u8 buf[64]; |
2153 |
++ u8 buf[DP_PAYLOAD_TABLE_SIZE]; |
2154 |
+ int ret; |
2155 |
+ |
2156 |
+ ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE); |
2157 |
+@@ -3033,8 +3035,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, |
2158 |
+ seq_printf(m, " revision: hw: %x.%x sw: %x.%x\n", |
2159 |
+ buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]); |
2160 |
+ if (dump_dp_payload_table(mgr, buf)) |
2161 |
+- seq_printf(m, "payload table: %*ph\n", 63, buf); |
2162 |
+- |
2163 |
++ seq_printf(m, "payload table: %*ph\n", DP_PAYLOAD_TABLE_SIZE, buf); |
2164 |
+ } |
2165 |
+ |
2166 |
+ mutex_unlock(&mgr->lock); |
2167 |
+diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h |
2168 |
+index e8e4ea14b12b..e05e5399af2d 100644 |
2169 |
+--- a/drivers/gpu/drm/gma500/psb_intel_drv.h |
2170 |
++++ b/drivers/gpu/drm/gma500/psb_intel_drv.h |
2171 |
+@@ -255,7 +255,7 @@ extern int intelfb_remove(struct drm_device *dev, |
2172 |
+ extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder, |
2173 |
+ const struct drm_display_mode *mode, |
2174 |
+ struct drm_display_mode *adjusted_mode); |
2175 |
+-extern int psb_intel_lvds_mode_valid(struct drm_connector *connector, |
2176 |
++extern enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector, |
2177 |
+ struct drm_display_mode *mode); |
2178 |
+ extern int psb_intel_lvds_set_property(struct drm_connector *connector, |
2179 |
+ struct drm_property *property, |
2180 |
+diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c |
2181 |
+index be3eefec5152..8baf6325c6e4 100644 |
2182 |
+--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c |
2183 |
++++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c |
2184 |
+@@ -343,7 +343,7 @@ static void psb_intel_lvds_restore(struct drm_connector *connector) |
2185 |
+ } |
2186 |
+ } |
2187 |
+ |
2188 |
+-int psb_intel_lvds_mode_valid(struct drm_connector *connector, |
2189 |
++enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector, |
2190 |
+ struct drm_display_mode *mode) |
2191 |
+ { |
2192 |
+ struct drm_psb_private *dev_priv = connector->dev->dev_private; |
2193 |
+diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h |
2194 |
+index ce18b6cf6e68..e3ce2f448020 100644 |
2195 |
+--- a/drivers/gpu/drm/i915/i915_drv.h |
2196 |
++++ b/drivers/gpu/drm/i915/i915_drv.h |
2197 |
+@@ -804,6 +804,7 @@ enum intel_sbi_destination { |
2198 |
+ #define QUIRK_BACKLIGHT_PRESENT (1<<3) |
2199 |
+ #define QUIRK_PIN_SWIZZLED_PAGES (1<<5) |
2200 |
+ #define QUIRK_INCREASE_T12_DELAY (1<<6) |
2201 |
++#define QUIRK_INCREASE_DDI_DISABLED_TIME (1<<7) |
2202 |
+ |
2203 |
+ struct intel_fbdev; |
2204 |
+ struct intel_fbc_work; |
2205 |
+diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
2206 |
+index 1d14ebc7480d..b752f6221731 100644 |
2207 |
+--- a/drivers/gpu/drm/i915/intel_ddi.c |
2208 |
++++ b/drivers/gpu/drm/i915/intel_ddi.c |
2209 |
+@@ -1605,15 +1605,24 @@ void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state) |
2210 |
+ I915_WRITE(TRANS_DDI_FUNC_CTL(cpu_transcoder), temp); |
2211 |
+ } |
2212 |
+ |
2213 |
+-void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv, |
2214 |
+- enum transcoder cpu_transcoder) |
2215 |
++void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state) |
2216 |
+ { |
2217 |
++ struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); |
2218 |
++ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
2219 |
++ enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; |
2220 |
+ i915_reg_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder); |
2221 |
+ uint32_t val = I915_READ(reg); |
2222 |
+ |
2223 |
+ val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_PORT_MASK | TRANS_DDI_DP_VC_PAYLOAD_ALLOC); |
2224 |
+ val |= TRANS_DDI_PORT_NONE; |
2225 |
+ I915_WRITE(reg, val); |
2226 |
++ |
2227 |
++ if (dev_priv->quirks & QUIRK_INCREASE_DDI_DISABLED_TIME && |
2228 |
++ intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) { |
2229 |
++ DRM_DEBUG_KMS("Quirk Increase DDI disabled time\n"); |
2230 |
++ /* Quirk time at 100ms for reliable operation */ |
2231 |
++ msleep(100); |
2232 |
++ } |
2233 |
+ } |
2234 |
+ |
2235 |
+ int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, |
2236 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
2237 |
+index 84011e08adc3..f943c1049c0b 100644 |
2238 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
2239 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
2240 |
+@@ -5685,7 +5685,7 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state, |
2241 |
+ intel_ddi_set_vc_payload_alloc(intel_crtc->config, false); |
2242 |
+ |
2243 |
+ if (!transcoder_is_dsi(cpu_transcoder)) |
2244 |
+- intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); |
2245 |
++ intel_ddi_disable_transcoder_func(old_crtc_state); |
2246 |
+ |
2247 |
+ if (INTEL_GEN(dev_priv) >= 9) |
2248 |
+ skylake_scaler_disable(intel_crtc); |
2249 |
+@@ -14388,6 +14388,18 @@ static void quirk_increase_t12_delay(struct drm_device *dev) |
2250 |
+ DRM_INFO("Applying T12 delay quirk\n"); |
2251 |
+ } |
2252 |
+ |
2253 |
++/* |
2254 |
++ * GeminiLake NUC HDMI outputs require additional off time |
2255 |
++ * this allows the onboard retimer to correctly sync to signal |
2256 |
++ */ |
2257 |
++static void quirk_increase_ddi_disabled_time(struct drm_device *dev) |
2258 |
++{ |
2259 |
++ struct drm_i915_private *dev_priv = to_i915(dev); |
2260 |
++ |
2261 |
++ dev_priv->quirks |= QUIRK_INCREASE_DDI_DISABLED_TIME; |
2262 |
++ DRM_INFO("Applying Increase DDI Disabled quirk\n"); |
2263 |
++} |
2264 |
++ |
2265 |
+ struct intel_quirk { |
2266 |
+ int device; |
2267 |
+ int subsystem_vendor; |
2268 |
+@@ -14474,6 +14486,13 @@ static struct intel_quirk intel_quirks[] = { |
2269 |
+ |
2270 |
+ /* Toshiba Satellite P50-C-18C */ |
2271 |
+ { 0x191B, 0x1179, 0xF840, quirk_increase_t12_delay }, |
2272 |
++ |
2273 |
++ /* GeminiLake NUC */ |
2274 |
++ { 0x3185, 0x8086, 0x2072, quirk_increase_ddi_disabled_time }, |
2275 |
++ { 0x3184, 0x8086, 0x2072, quirk_increase_ddi_disabled_time }, |
2276 |
++ /* ASRock ITX*/ |
2277 |
++ { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, |
2278 |
++ { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, |
2279 |
+ }; |
2280 |
+ |
2281 |
+ static void intel_init_quirks(struct drm_device *dev) |
2282 |
+diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
2283 |
+index a80fbad9be0f..04d2774fe0ac 100644 |
2284 |
+--- a/drivers/gpu/drm/i915/intel_drv.h |
2285 |
++++ b/drivers/gpu/drm/i915/intel_drv.h |
2286 |
+@@ -1368,8 +1368,7 @@ void hsw_fdi_link_train(struct intel_crtc *crtc, |
2287 |
+ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port); |
2288 |
+ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe); |
2289 |
+ void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state); |
2290 |
+-void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv, |
2291 |
+- enum transcoder cpu_transcoder); |
2292 |
++void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state); |
2293 |
+ void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state); |
2294 |
+ void intel_ddi_disable_pipe_clock(const struct intel_crtc_state *crtc_state); |
2295 |
+ struct intel_encoder * |
2296 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c |
2297 |
+index 10e84f6ca2b7..e0664d28802b 100644 |
2298 |
+--- a/drivers/gpu/drm/nouveau/nouveau_dma.c |
2299 |
++++ b/drivers/gpu/drm/nouveau/nouveau_dma.c |
2300 |
+@@ -80,18 +80,10 @@ READ_GET(struct nouveau_channel *chan, uint64_t *prev_get, int *timeout) |
2301 |
+ } |
2302 |
+ |
2303 |
+ void |
2304 |
+-nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo, |
2305 |
+- int delta, int length) |
2306 |
++nv50_dma_push(struct nouveau_channel *chan, u64 offset, int length) |
2307 |
+ { |
2308 |
+- struct nouveau_cli *cli = (void *)chan->user.client; |
2309 |
+ struct nouveau_bo *pb = chan->push.buffer; |
2310 |
+- struct nouveau_vma *vma; |
2311 |
+ int ip = (chan->dma.ib_put * 2) + chan->dma.ib_base; |
2312 |
+- u64 offset; |
2313 |
+- |
2314 |
+- vma = nouveau_vma_find(bo, &cli->vmm); |
2315 |
+- BUG_ON(!vma); |
2316 |
+- offset = vma->addr + delta; |
2317 |
+ |
2318 |
+ BUG_ON(chan->dma.ib_free < 1); |
2319 |
+ |
2320 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h |
2321 |
+index 74e10b14a7da..89c87111bbbd 100644 |
2322 |
+--- a/drivers/gpu/drm/nouveau/nouveau_dma.h |
2323 |
++++ b/drivers/gpu/drm/nouveau/nouveau_dma.h |
2324 |
+@@ -31,8 +31,7 @@ |
2325 |
+ #include "nouveau_chan.h" |
2326 |
+ |
2327 |
+ int nouveau_dma_wait(struct nouveau_channel *, int slots, int size); |
2328 |
+-void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *, |
2329 |
+- int delta, int length); |
2330 |
++void nv50_dma_push(struct nouveau_channel *, u64 addr, int length); |
2331 |
+ |
2332 |
+ /* |
2333 |
+ * There's a hw race condition where you can't jump to your PUT offset, |
2334 |
+@@ -151,7 +150,7 @@ FIRE_RING(struct nouveau_channel *chan) |
2335 |
+ chan->accel_done = true; |
2336 |
+ |
2337 |
+ if (chan->dma.ib_max) { |
2338 |
+- nv50_dma_push(chan, chan->push.buffer, chan->dma.put << 2, |
2339 |
++ nv50_dma_push(chan, chan->push.addr + (chan->dma.put << 2), |
2340 |
+ (chan->dma.cur - chan->dma.put) << 2); |
2341 |
+ } else { |
2342 |
+ WRITE_PUT(chan->dma.cur); |
2343 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
2344 |
+index 591d9c29ede7..f8e67ab5c598 100644 |
2345 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
2346 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
2347 |
+@@ -116,24 +116,22 @@ nouveau_name(struct drm_device *dev) |
2348 |
+ } |
2349 |
+ |
2350 |
+ static inline bool |
2351 |
+-nouveau_cli_work_ready(struct dma_fence *fence, bool wait) |
2352 |
++nouveau_cli_work_ready(struct dma_fence *fence) |
2353 |
+ { |
2354 |
+- if (!dma_fence_is_signaled(fence)) { |
2355 |
+- if (!wait) |
2356 |
+- return false; |
2357 |
+- WARN_ON(dma_fence_wait_timeout(fence, false, 2 * HZ) <= 0); |
2358 |
+- } |
2359 |
++ if (!dma_fence_is_signaled(fence)) |
2360 |
++ return false; |
2361 |
+ dma_fence_put(fence); |
2362 |
+ return true; |
2363 |
+ } |
2364 |
+ |
2365 |
+ static void |
2366 |
+-nouveau_cli_work_flush(struct nouveau_cli *cli, bool wait) |
2367 |
++nouveau_cli_work(struct work_struct *w) |
2368 |
+ { |
2369 |
++ struct nouveau_cli *cli = container_of(w, typeof(*cli), work); |
2370 |
+ struct nouveau_cli_work *work, *wtmp; |
2371 |
+ mutex_lock(&cli->lock); |
2372 |
+ list_for_each_entry_safe(work, wtmp, &cli->worker, head) { |
2373 |
+- if (!work->fence || nouveau_cli_work_ready(work->fence, wait)) { |
2374 |
++ if (!work->fence || nouveau_cli_work_ready(work->fence)) { |
2375 |
+ list_del(&work->head); |
2376 |
+ work->func(work); |
2377 |
+ } |
2378 |
+@@ -161,17 +159,17 @@ nouveau_cli_work_queue(struct nouveau_cli *cli, struct dma_fence *fence, |
2379 |
+ mutex_unlock(&cli->lock); |
2380 |
+ } |
2381 |
+ |
2382 |
+-static void |
2383 |
+-nouveau_cli_work(struct work_struct *w) |
2384 |
+-{ |
2385 |
+- struct nouveau_cli *cli = container_of(w, typeof(*cli), work); |
2386 |
+- nouveau_cli_work_flush(cli, false); |
2387 |
+-} |
2388 |
+- |
2389 |
+ static void |
2390 |
+ nouveau_cli_fini(struct nouveau_cli *cli) |
2391 |
+ { |
2392 |
+- nouveau_cli_work_flush(cli, true); |
2393 |
++ /* All our channels are dead now, which means all the fences they |
2394 |
++ * own are signalled, and all callback functions have been called. |
2395 |
++ * |
2396 |
++ * So, after flushing the workqueue, there should be nothing left. |
2397 |
++ */ |
2398 |
++ flush_work(&cli->work); |
2399 |
++ WARN_ON(!list_empty(&cli->worker)); |
2400 |
++ |
2401 |
+ usif_client_fini(cli); |
2402 |
+ nouveau_vmm_fini(&cli->vmm); |
2403 |
+ nvif_mmu_fini(&cli->mmu); |
2404 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c |
2405 |
+index e72a7e37eb0a..707e02c80f18 100644 |
2406 |
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c |
2407 |
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c |
2408 |
+@@ -432,7 +432,20 @@ retry: |
2409 |
+ } |
2410 |
+ } |
2411 |
+ |
2412 |
+- b->user_priv = (uint64_t)(unsigned long)nvbo; |
2413 |
++ if (cli->vmm.vmm.object.oclass >= NVIF_CLASS_VMM_NV50) { |
2414 |
++ struct nouveau_vmm *vmm = &cli->vmm; |
2415 |
++ struct nouveau_vma *vma = nouveau_vma_find(nvbo, vmm); |
2416 |
++ if (!vma) { |
2417 |
++ NV_PRINTK(err, cli, "vma not found!\n"); |
2418 |
++ ret = -EINVAL; |
2419 |
++ break; |
2420 |
++ } |
2421 |
++ |
2422 |
++ b->user_priv = (uint64_t)(unsigned long)vma; |
2423 |
++ } else { |
2424 |
++ b->user_priv = (uint64_t)(unsigned long)nvbo; |
2425 |
++ } |
2426 |
++ |
2427 |
+ nvbo->reserved_by = file_priv; |
2428 |
+ nvbo->pbbo_index = i; |
2429 |
+ if ((b->valid_domains & NOUVEAU_GEM_DOMAIN_VRAM) && |
2430 |
+@@ -763,10 +776,10 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, |
2431 |
+ } |
2432 |
+ |
2433 |
+ for (i = 0; i < req->nr_push; i++) { |
2434 |
+- struct nouveau_bo *nvbo = (void *)(unsigned long) |
2435 |
++ struct nouveau_vma *vma = (void *)(unsigned long) |
2436 |
+ bo[push[i].bo_index].user_priv; |
2437 |
+ |
2438 |
+- nv50_dma_push(chan, nvbo, push[i].offset, |
2439 |
++ nv50_dma_push(chan, vma->addr + push[i].offset, |
2440 |
+ push[i].length); |
2441 |
+ } |
2442 |
+ } else |
2443 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c |
2444 |
+index 84bd703dd897..8305cb67cbfc 100644 |
2445 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c |
2446 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c |
2447 |
+@@ -155,10 +155,10 @@ gk104_fifo_runlist_commit(struct gk104_fifo *fifo, int runl) |
2448 |
+ (target << 28)); |
2449 |
+ nvkm_wr32(device, 0x002274, (runl << 20) | nr); |
2450 |
+ |
2451 |
+- if (wait_event_timeout(fifo->runlist[runl].wait, |
2452 |
+- !(nvkm_rd32(device, 0x002284 + (runl * 0x08)) |
2453 |
+- & 0x00100000), |
2454 |
+- msecs_to_jiffies(2000)) == 0) |
2455 |
++ if (nvkm_msec(device, 2000, |
2456 |
++ if (!(nvkm_rd32(device, 0x002284 + (runl * 0x08)) & 0x00100000)) |
2457 |
++ break; |
2458 |
++ ) < 0) |
2459 |
+ nvkm_error(subdev, "runlist %d update timeout\n", runl); |
2460 |
+ unlock: |
2461 |
+ mutex_unlock(&subdev->mutex); |
2462 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
2463 |
+index df9469a8fdb1..2aea2bdff99b 100644 |
2464 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
2465 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
2466 |
+@@ -852,7 +852,7 @@ static int radeon_lvds_get_modes(struct drm_connector *connector) |
2467 |
+ return ret; |
2468 |
+ } |
2469 |
+ |
2470 |
+-static int radeon_lvds_mode_valid(struct drm_connector *connector, |
2471 |
++static enum drm_mode_status radeon_lvds_mode_valid(struct drm_connector *connector, |
2472 |
+ struct drm_display_mode *mode) |
2473 |
+ { |
2474 |
+ struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
2475 |
+@@ -1012,7 +1012,7 @@ static int radeon_vga_get_modes(struct drm_connector *connector) |
2476 |
+ return ret; |
2477 |
+ } |
2478 |
+ |
2479 |
+-static int radeon_vga_mode_valid(struct drm_connector *connector, |
2480 |
++static enum drm_mode_status radeon_vga_mode_valid(struct drm_connector *connector, |
2481 |
+ struct drm_display_mode *mode) |
2482 |
+ { |
2483 |
+ struct drm_device *dev = connector->dev; |
2484 |
+@@ -1156,7 +1156,7 @@ static int radeon_tv_get_modes(struct drm_connector *connector) |
2485 |
+ return 1; |
2486 |
+ } |
2487 |
+ |
2488 |
+-static int radeon_tv_mode_valid(struct drm_connector *connector, |
2489 |
++static enum drm_mode_status radeon_tv_mode_valid(struct drm_connector *connector, |
2490 |
+ struct drm_display_mode *mode) |
2491 |
+ { |
2492 |
+ if ((mode->hdisplay > 1024) || (mode->vdisplay > 768)) |
2493 |
+@@ -1498,7 +1498,7 @@ static void radeon_dvi_force(struct drm_connector *connector) |
2494 |
+ radeon_connector->use_digital = true; |
2495 |
+ } |
2496 |
+ |
2497 |
+-static int radeon_dvi_mode_valid(struct drm_connector *connector, |
2498 |
++static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connector, |
2499 |
+ struct drm_display_mode *mode) |
2500 |
+ { |
2501 |
+ struct drm_device *dev = connector->dev; |
2502 |
+@@ -1800,7 +1800,7 @@ out: |
2503 |
+ return ret; |
2504 |
+ } |
2505 |
+ |
2506 |
+-static int radeon_dp_mode_valid(struct drm_connector *connector, |
2507 |
++static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connector, |
2508 |
+ struct drm_display_mode *mode) |
2509 |
+ { |
2510 |
+ struct drm_device *dev = connector->dev; |
2511 |
+diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c |
2512 |
+index 3e8bf79bea58..0259cfe894d6 100644 |
2513 |
+--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c |
2514 |
++++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c |
2515 |
+@@ -358,6 +358,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, |
2516 |
+ analogix_dp_unbind(dp->adp); |
2517 |
+ rockchip_drm_psr_unregister(&dp->encoder); |
2518 |
+ dp->encoder.funcs->destroy(&dp->encoder); |
2519 |
++ |
2520 |
++ dp->adp = ERR_PTR(-ENODEV); |
2521 |
+ } |
2522 |
+ |
2523 |
+ static const struct component_ops rockchip_dp_component_ops = { |
2524 |
+@@ -381,6 +383,7 @@ static int rockchip_dp_probe(struct platform_device *pdev) |
2525 |
+ return -ENOMEM; |
2526 |
+ |
2527 |
+ dp->dev = dev; |
2528 |
++ dp->adp = ERR_PTR(-ENODEV); |
2529 |
+ dp->plat_data.panel = panel; |
2530 |
+ |
2531 |
+ ret = rockchip_dp_of_probe(dp); |
2532 |
+@@ -404,6 +407,9 @@ static int rockchip_dp_suspend(struct device *dev) |
2533 |
+ { |
2534 |
+ struct rockchip_dp_device *dp = dev_get_drvdata(dev); |
2535 |
+ |
2536 |
++ if (IS_ERR(dp->adp)) |
2537 |
++ return 0; |
2538 |
++ |
2539 |
+ return analogix_dp_suspend(dp->adp); |
2540 |
+ } |
2541 |
+ |
2542 |
+@@ -411,6 +417,9 @@ static int rockchip_dp_resume(struct device *dev) |
2543 |
+ { |
2544 |
+ struct rockchip_dp_device *dp = dev_get_drvdata(dev); |
2545 |
+ |
2546 |
++ if (IS_ERR(dp->adp)) |
2547 |
++ return 0; |
2548 |
++ |
2549 |
+ return analogix_dp_resume(dp->adp); |
2550 |
+ } |
2551 |
+ #endif |
2552 |
+diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c |
2553 |
+index 1a3277e483d5..16e80308c6db 100644 |
2554 |
+--- a/drivers/gpu/drm/stm/ltdc.c |
2555 |
++++ b/drivers/gpu/drm/stm/ltdc.c |
2556 |
+@@ -392,9 +392,6 @@ static void ltdc_crtc_update_clut(struct drm_crtc *crtc) |
2557 |
+ u32 val; |
2558 |
+ int i; |
2559 |
+ |
2560 |
+- if (!crtc || !crtc->state) |
2561 |
+- return; |
2562 |
+- |
2563 |
+ if (!crtc->state->color_mgmt_changed || !crtc->state->gamma_lut) |
2564 |
+ return; |
2565 |
+ |
2566 |
+diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c |
2567 |
+index 03db71173f5d..f1d5f76e9c33 100644 |
2568 |
+--- a/drivers/gpu/host1x/dev.c |
2569 |
++++ b/drivers/gpu/host1x/dev.c |
2570 |
+@@ -223,10 +223,14 @@ static int host1x_probe(struct platform_device *pdev) |
2571 |
+ struct iommu_domain_geometry *geometry; |
2572 |
+ unsigned long order; |
2573 |
+ |
2574 |
++ err = iova_cache_get(); |
2575 |
++ if (err < 0) |
2576 |
++ goto put_group; |
2577 |
++ |
2578 |
+ host->domain = iommu_domain_alloc(&platform_bus_type); |
2579 |
+ if (!host->domain) { |
2580 |
+ err = -ENOMEM; |
2581 |
+- goto put_group; |
2582 |
++ goto put_cache; |
2583 |
+ } |
2584 |
+ |
2585 |
+ err = iommu_attach_group(host->domain, host->group); |
2586 |
+@@ -234,6 +238,7 @@ static int host1x_probe(struct platform_device *pdev) |
2587 |
+ if (err == -ENODEV) { |
2588 |
+ iommu_domain_free(host->domain); |
2589 |
+ host->domain = NULL; |
2590 |
++ iova_cache_put(); |
2591 |
+ iommu_group_put(host->group); |
2592 |
+ host->group = NULL; |
2593 |
+ goto skip_iommu; |
2594 |
+@@ -308,6 +313,9 @@ fail_detach_device: |
2595 |
+ fail_free_domain: |
2596 |
+ if (host->domain) |
2597 |
+ iommu_domain_free(host->domain); |
2598 |
++put_cache: |
2599 |
++ if (host->group) |
2600 |
++ iova_cache_put(); |
2601 |
+ put_group: |
2602 |
+ iommu_group_put(host->group); |
2603 |
+ |
2604 |
+@@ -328,6 +336,7 @@ static int host1x_remove(struct platform_device *pdev) |
2605 |
+ put_iova_domain(&host->iova); |
2606 |
+ iommu_detach_group(host->domain, host->group); |
2607 |
+ iommu_domain_free(host->domain); |
2608 |
++ iova_cache_put(); |
2609 |
+ iommu_group_put(host->group); |
2610 |
+ } |
2611 |
+ |
2612 |
+diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c |
2613 |
+index febb21ee190e..584b10d3fc3d 100644 |
2614 |
+--- a/drivers/hid/hid-plantronics.c |
2615 |
++++ b/drivers/hid/hid-plantronics.c |
2616 |
+@@ -2,7 +2,7 @@ |
2617 |
+ * Plantronics USB HID Driver |
2618 |
+ * |
2619 |
+ * Copyright (c) 2014 JD Cole <jd.cole@×××××××××××.com> |
2620 |
+- * Copyright (c) 2015 Terry Junge <terry.junge@×××××××××××.com> |
2621 |
++ * Copyright (c) 2015-2018 Terry Junge <terry.junge@×××××××××××.com> |
2622 |
+ */ |
2623 |
+ |
2624 |
+ /* |
2625 |
+@@ -48,6 +48,10 @@ static int plantronics_input_mapping(struct hid_device *hdev, |
2626 |
+ unsigned short mapped_key; |
2627 |
+ unsigned long plt_type = (unsigned long)hid_get_drvdata(hdev); |
2628 |
+ |
2629 |
++ /* special case for PTT products */ |
2630 |
++ if (field->application == HID_GD_JOYSTICK) |
2631 |
++ goto defaulted; |
2632 |
++ |
2633 |
+ /* handle volume up/down mapping */ |
2634 |
+ /* non-standard types or multi-HID interfaces - plt_type is PID */ |
2635 |
+ if (!(plt_type & HID_USAGE_PAGE)) { |
2636 |
+diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c |
2637 |
+index a92377285034..8cc2b71c680b 100644 |
2638 |
+--- a/drivers/hid/i2c-hid/i2c-hid.c |
2639 |
++++ b/drivers/hid/i2c-hid/i2c-hid.c |
2640 |
+@@ -1054,6 +1054,14 @@ static int i2c_hid_probe(struct i2c_client *client, |
2641 |
+ pm_runtime_enable(&client->dev); |
2642 |
+ device_enable_async_suspend(&client->dev); |
2643 |
+ |
2644 |
++ /* Make sure there is something at this address */ |
2645 |
++ ret = i2c_smbus_read_byte(client); |
2646 |
++ if (ret < 0) { |
2647 |
++ dev_dbg(&client->dev, "nothing at this address: %d\n", ret); |
2648 |
++ ret = -ENXIO; |
2649 |
++ goto err_pm; |
2650 |
++ } |
2651 |
++ |
2652 |
+ ret = i2c_hid_fetch_hid_descriptor(ihid); |
2653 |
+ if (ret < 0) |
2654 |
+ goto err_pm; |
2655 |
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c |
2656 |
+index c6915b835396..21d4efa74de2 100644 |
2657 |
+--- a/drivers/i2c/busses/i2c-rcar.c |
2658 |
++++ b/drivers/i2c/busses/i2c-rcar.c |
2659 |
+@@ -32,6 +32,7 @@ |
2660 |
+ #include <linux/of_device.h> |
2661 |
+ #include <linux/platform_device.h> |
2662 |
+ #include <linux/pm_runtime.h> |
2663 |
++#include <linux/reset.h> |
2664 |
+ #include <linux/slab.h> |
2665 |
+ |
2666 |
+ /* register offsets */ |
2667 |
+@@ -111,8 +112,9 @@ |
2668 |
+ #define ID_ARBLOST (1 << 3) |
2669 |
+ #define ID_NACK (1 << 4) |
2670 |
+ /* persistent flags */ |
2671 |
++#define ID_P_NO_RXDMA (1 << 30) /* HW forbids RXDMA sometimes */ |
2672 |
+ #define ID_P_PM_BLOCKED (1 << 31) |
2673 |
+-#define ID_P_MASK ID_P_PM_BLOCKED |
2674 |
++#define ID_P_MASK (ID_P_PM_BLOCKED | ID_P_NO_RXDMA) |
2675 |
+ |
2676 |
+ enum rcar_i2c_type { |
2677 |
+ I2C_RCAR_GEN1, |
2678 |
+@@ -141,6 +143,8 @@ struct rcar_i2c_priv { |
2679 |
+ struct dma_chan *dma_rx; |
2680 |
+ struct scatterlist sg; |
2681 |
+ enum dma_data_direction dma_direction; |
2682 |
++ |
2683 |
++ struct reset_control *rstc; |
2684 |
+ }; |
2685 |
+ |
2686 |
+ #define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent) |
2687 |
+@@ -370,6 +374,11 @@ static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv) |
2688 |
+ dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg), |
2689 |
+ sg_dma_len(&priv->sg), priv->dma_direction); |
2690 |
+ |
2691 |
++ /* Gen3 can only do one RXDMA per transfer and we just completed it */ |
2692 |
++ if (priv->devtype == I2C_RCAR_GEN3 && |
2693 |
++ priv->dma_direction == DMA_FROM_DEVICE) |
2694 |
++ priv->flags |= ID_P_NO_RXDMA; |
2695 |
++ |
2696 |
+ priv->dma_direction = DMA_NONE; |
2697 |
+ } |
2698 |
+ |
2699 |
+@@ -407,8 +416,9 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) |
2700 |
+ unsigned char *buf; |
2701 |
+ int len; |
2702 |
+ |
2703 |
+- /* Do not use DMA if it's not available or for messages < 8 bytes */ |
2704 |
+- if (IS_ERR(chan) || msg->len < 8 || !(msg->flags & I2C_M_DMA_SAFE)) |
2705 |
++ /* Do various checks to see if DMA is feasible at all */ |
2706 |
++ if (IS_ERR(chan) || msg->len < 8 || !(msg->flags & I2C_M_DMA_SAFE) || |
2707 |
++ (read && priv->flags & ID_P_NO_RXDMA)) |
2708 |
+ return; |
2709 |
+ |
2710 |
+ if (read) { |
2711 |
+@@ -737,6 +747,25 @@ static void rcar_i2c_release_dma(struct rcar_i2c_priv *priv) |
2712 |
+ } |
2713 |
+ } |
2714 |
+ |
2715 |
++/* I2C is a special case, we need to poll the status of a reset */ |
2716 |
++static int rcar_i2c_do_reset(struct rcar_i2c_priv *priv) |
2717 |
++{ |
2718 |
++ int i, ret; |
2719 |
++ |
2720 |
++ ret = reset_control_reset(priv->rstc); |
2721 |
++ if (ret) |
2722 |
++ return ret; |
2723 |
++ |
2724 |
++ for (i = 0; i < LOOP_TIMEOUT; i++) { |
2725 |
++ ret = reset_control_status(priv->rstc); |
2726 |
++ if (ret == 0) |
2727 |
++ return 0; |
2728 |
++ udelay(1); |
2729 |
++ } |
2730 |
++ |
2731 |
++ return -ETIMEDOUT; |
2732 |
++} |
2733 |
++ |
2734 |
+ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, |
2735 |
+ struct i2c_msg *msgs, |
2736 |
+ int num) |
2737 |
+@@ -748,6 +777,16 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, |
2738 |
+ |
2739 |
+ pm_runtime_get_sync(dev); |
2740 |
+ |
2741 |
++ /* Gen3 needs a reset before allowing RXDMA once */ |
2742 |
++ if (priv->devtype == I2C_RCAR_GEN3) { |
2743 |
++ priv->flags |= ID_P_NO_RXDMA; |
2744 |
++ if (!IS_ERR(priv->rstc)) { |
2745 |
++ ret = rcar_i2c_do_reset(priv); |
2746 |
++ if (ret == 0) |
2747 |
++ priv->flags &= ~ID_P_NO_RXDMA; |
2748 |
++ } |
2749 |
++ } |
2750 |
++ |
2751 |
+ rcar_i2c_init(priv); |
2752 |
+ |
2753 |
+ ret = rcar_i2c_bus_barrier(priv); |
2754 |
+@@ -918,6 +957,15 @@ static int rcar_i2c_probe(struct platform_device *pdev) |
2755 |
+ if (ret < 0) |
2756 |
+ goto out_pm_put; |
2757 |
+ |
2758 |
++ if (priv->devtype == I2C_RCAR_GEN3) { |
2759 |
++ priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); |
2760 |
++ if (!IS_ERR(priv->rstc)) { |
2761 |
++ ret = reset_control_status(priv->rstc); |
2762 |
++ if (ret < 0) |
2763 |
++ priv->rstc = ERR_PTR(-ENOTSUPP); |
2764 |
++ } |
2765 |
++ } |
2766 |
++ |
2767 |
+ /* Stay always active when multi-master to keep arbitration working */ |
2768 |
+ if (of_property_read_bool(dev->of_node, "multi-master")) |
2769 |
+ priv->flags |= ID_P_PM_BLOCKED; |
2770 |
+diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c |
2771 |
+index b28452a55a08..55a224e8e798 100644 |
2772 |
+--- a/drivers/infiniband/core/mad.c |
2773 |
++++ b/drivers/infiniband/core/mad.c |
2774 |
+@@ -1557,7 +1557,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, |
2775 |
+ mad_reg_req->oui, 3)) { |
2776 |
+ method = &(*vendor_table)->vendor_class[ |
2777 |
+ vclass]->method_table[i]; |
2778 |
+- BUG_ON(!*method); |
2779 |
++ if (!*method) |
2780 |
++ goto error3; |
2781 |
+ goto check_in_use; |
2782 |
+ } |
2783 |
+ } |
2784 |
+@@ -1567,10 +1568,12 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, |
2785 |
+ vclass]->oui[i])) { |
2786 |
+ method = &(*vendor_table)->vendor_class[ |
2787 |
+ vclass]->method_table[i]; |
2788 |
+- BUG_ON(*method); |
2789 |
+ /* Allocate method table for this OUI */ |
2790 |
+- if ((ret = allocate_method_table(method))) |
2791 |
+- goto error3; |
2792 |
++ if (!*method) { |
2793 |
++ ret = allocate_method_table(method); |
2794 |
++ if (ret) |
2795 |
++ goto error3; |
2796 |
++ } |
2797 |
+ memcpy((*vendor_table)->vendor_class[vclass]->oui[i], |
2798 |
+ mad_reg_req->oui, 3); |
2799 |
+ goto check_in_use; |
2800 |
+diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c |
2801 |
+index eab43b17e9cf..ec8fb289621f 100644 |
2802 |
+--- a/drivers/infiniband/core/ucma.c |
2803 |
++++ b/drivers/infiniband/core/ucma.c |
2804 |
+@@ -235,7 +235,7 @@ static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx) |
2805 |
+ return NULL; |
2806 |
+ |
2807 |
+ mutex_lock(&mut); |
2808 |
+- mc->id = idr_alloc(&multicast_idr, mc, 0, 0, GFP_KERNEL); |
2809 |
++ mc->id = idr_alloc(&multicast_idr, NULL, 0, 0, GFP_KERNEL); |
2810 |
+ mutex_unlock(&mut); |
2811 |
+ if (mc->id < 0) |
2812 |
+ goto error; |
2813 |
+@@ -1421,6 +1421,10 @@ static ssize_t ucma_process_join(struct ucma_file *file, |
2814 |
+ goto err3; |
2815 |
+ } |
2816 |
+ |
2817 |
++ mutex_lock(&mut); |
2818 |
++ idr_replace(&multicast_idr, mc, mc->id); |
2819 |
++ mutex_unlock(&mut); |
2820 |
++ |
2821 |
+ mutex_unlock(&file->mut); |
2822 |
+ ucma_put_ctx(ctx); |
2823 |
+ return 0; |
2824 |
+diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
2825 |
+index 21a887c9523b..7a300e3eb0c2 100644 |
2826 |
+--- a/drivers/infiniband/core/uverbs_cmd.c |
2827 |
++++ b/drivers/infiniband/core/uverbs_cmd.c |
2828 |
+@@ -3478,6 +3478,11 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file, |
2829 |
+ goto err_uobj; |
2830 |
+ } |
2831 |
+ |
2832 |
++ if (qp->qp_type != IB_QPT_UD && qp->qp_type != IB_QPT_RAW_PACKET) { |
2833 |
++ err = -EINVAL; |
2834 |
++ goto err_put; |
2835 |
++ } |
2836 |
++ |
2837 |
+ flow_attr = kzalloc(sizeof(*flow_attr) + cmd.flow_attr.num_of_specs * |
2838 |
+ sizeof(union ib_flow_spec), GFP_KERNEL); |
2839 |
+ if (!flow_attr) { |
2840 |
+diff --git a/drivers/infiniband/sw/rdmavt/Kconfig b/drivers/infiniband/sw/rdmavt/Kconfig |
2841 |
+index 2b5513da7e83..98e798007f75 100644 |
2842 |
+--- a/drivers/infiniband/sw/rdmavt/Kconfig |
2843 |
++++ b/drivers/infiniband/sw/rdmavt/Kconfig |
2844 |
+@@ -1,6 +1,6 @@ |
2845 |
+ config INFINIBAND_RDMAVT |
2846 |
+ tristate "RDMA verbs transport library" |
2847 |
+- depends on 64BIT |
2848 |
++ depends on 64BIT && ARCH_DMA_ADDR_T_64BIT |
2849 |
+ depends on PCI |
2850 |
+ select DMA_VIRT_OPS |
2851 |
+ ---help--- |
2852 |
+diff --git a/drivers/infiniband/sw/rxe/Kconfig b/drivers/infiniband/sw/rxe/Kconfig |
2853 |
+index bad4a576d7cf..67ae960ab523 100644 |
2854 |
+--- a/drivers/infiniband/sw/rxe/Kconfig |
2855 |
++++ b/drivers/infiniband/sw/rxe/Kconfig |
2856 |
+@@ -1,6 +1,7 @@ |
2857 |
+ config RDMA_RXE |
2858 |
+ tristate "Software RDMA over Ethernet (RoCE) driver" |
2859 |
+ depends on INET && PCI && INFINIBAND |
2860 |
++ depends on !64BIT || ARCH_DMA_ADDR_T_64BIT |
2861 |
+ select NET_UDP_TUNNEL |
2862 |
+ select CRYPTO_CRC32 |
2863 |
+ select DMA_VIRT_OPS |
2864 |
+diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c |
2865 |
+index 37f954b704a6..f8f3aac944ea 100644 |
2866 |
+--- a/drivers/input/mouse/elan_i2c_core.c |
2867 |
++++ b/drivers/input/mouse/elan_i2c_core.c |
2868 |
+@@ -1264,6 +1264,8 @@ static const struct acpi_device_id elan_acpi_id[] = { |
2869 |
+ { "ELAN0611", 0 }, |
2870 |
+ { "ELAN0612", 0 }, |
2871 |
+ { "ELAN0618", 0 }, |
2872 |
++ { "ELAN061D", 0 }, |
2873 |
++ { "ELAN0622", 0 }, |
2874 |
+ { "ELAN1000", 0 }, |
2875 |
+ { } |
2876 |
+ }; |
2877 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
2878 |
+index b353d494ad40..136f6e7bf797 100644 |
2879 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
2880 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
2881 |
+@@ -527,6 +527,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { |
2882 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"), |
2883 |
+ }, |
2884 |
+ }, |
2885 |
++ { |
2886 |
++ /* Lenovo LaVie Z */ |
2887 |
++ .matches = { |
2888 |
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
2889 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"), |
2890 |
++ }, |
2891 |
++ }, |
2892 |
+ { } |
2893 |
+ }; |
2894 |
+ |
2895 |
+diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c |
2896 |
+index 57e3d900f19e..1ec3bfe56693 100644 |
2897 |
+--- a/drivers/irqchip/irq-ls-scfg-msi.c |
2898 |
++++ b/drivers/irqchip/irq-ls-scfg-msi.c |
2899 |
+@@ -21,6 +21,7 @@ |
2900 |
+ #include <linux/of_pci.h> |
2901 |
+ #include <linux/of_platform.h> |
2902 |
+ #include <linux/spinlock.h> |
2903 |
++#include <linux/dma-iommu.h> |
2904 |
+ |
2905 |
+ #define MSI_IRQS_PER_MSIR 32 |
2906 |
+ #define MSI_MSIR_OFFSET 4 |
2907 |
+@@ -94,6 +95,8 @@ static void ls_scfg_msi_compose_msg(struct irq_data *data, struct msi_msg *msg) |
2908 |
+ |
2909 |
+ if (msi_affinity_flag) |
2910 |
+ msg->data |= cpumask_first(data->common->affinity); |
2911 |
++ |
2912 |
++ iommu_dma_map_msi_msg(data->irq, msg); |
2913 |
+ } |
2914 |
+ |
2915 |
+ static int ls_scfg_msi_set_affinity(struct irq_data *irq_data, |
2916 |
+diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c |
2917 |
+index 94d5d97c9d8a..8c371423b111 100644 |
2918 |
+--- a/drivers/lightnvm/pblk-core.c |
2919 |
++++ b/drivers/lightnvm/pblk-core.c |
2920 |
+@@ -278,7 +278,9 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type) |
2921 |
+ return; |
2922 |
+ } |
2923 |
+ |
2924 |
+- nvm_dev_dma_free(dev->parent, rqd->meta_list, rqd->dma_meta_list); |
2925 |
++ if (rqd->meta_list) |
2926 |
++ nvm_dev_dma_free(dev->parent, rqd->meta_list, |
2927 |
++ rqd->dma_meta_list); |
2928 |
+ mempool_free(rqd, pool); |
2929 |
+ } |
2930 |
+ |
2931 |
+@@ -316,7 +318,7 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags, |
2932 |
+ |
2933 |
+ return 0; |
2934 |
+ err: |
2935 |
+- pblk_bio_free_pages(pblk, bio, 0, i - 1); |
2936 |
++ pblk_bio_free_pages(pblk, bio, (bio->bi_vcnt - i), i); |
2937 |
+ return -1; |
2938 |
+ } |
2939 |
+ |
2940 |
+diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c |
2941 |
+index 52fdd85dbc97..58946ffebe81 100644 |
2942 |
+--- a/drivers/lightnvm/pblk-rb.c |
2943 |
++++ b/drivers/lightnvm/pblk-rb.c |
2944 |
+@@ -142,10 +142,9 @@ static void clean_wctx(struct pblk_w_ctx *w_ctx) |
2945 |
+ { |
2946 |
+ int flags; |
2947 |
+ |
2948 |
+-try: |
2949 |
+ flags = READ_ONCE(w_ctx->flags); |
2950 |
+- if (!(flags & PBLK_SUBMITTED_ENTRY)) |
2951 |
+- goto try; |
2952 |
++ WARN_ONCE(!(flags & PBLK_SUBMITTED_ENTRY), |
2953 |
++ "pblk: overwriting unsubmitted data\n"); |
2954 |
+ |
2955 |
+ /* Release flags on context. Protect from writes and reads */ |
2956 |
+ smp_store_release(&w_ctx->flags, PBLK_WRITABLE_ENTRY); |
2957 |
+diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c |
2958 |
+index 9eee10f69df0..d528617c637b 100644 |
2959 |
+--- a/drivers/lightnvm/pblk-read.c |
2960 |
++++ b/drivers/lightnvm/pblk-read.c |
2961 |
+@@ -219,7 +219,7 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd, |
2962 |
+ new_bio = bio_alloc(GFP_KERNEL, nr_holes); |
2963 |
+ |
2964 |
+ if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes)) |
2965 |
+- goto err; |
2966 |
++ goto err_add_pages; |
2967 |
+ |
2968 |
+ if (nr_holes != new_bio->bi_vcnt) { |
2969 |
+ pr_err("pblk: malformed bio\n"); |
2970 |
+@@ -310,10 +310,10 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd, |
2971 |
+ return NVM_IO_OK; |
2972 |
+ |
2973 |
+ err: |
2974 |
+- pr_err("pblk: failed to perform partial read\n"); |
2975 |
+- |
2976 |
+ /* Free allocated pages in new bio */ |
2977 |
+- pblk_bio_free_pages(pblk, bio, 0, new_bio->bi_vcnt); |
2978 |
++ pblk_bio_free_pages(pblk, new_bio, 0, new_bio->bi_vcnt); |
2979 |
++err_add_pages: |
2980 |
++ pr_err("pblk: failed to perform partial read\n"); |
2981 |
+ __pblk_end_io_read(pblk, rqd, false); |
2982 |
+ return NVM_IO_ERR; |
2983 |
+ } |
2984 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
2985 |
+index bac480d75d1d..df9eb1a04f26 100644 |
2986 |
+--- a/drivers/md/md.c |
2987 |
++++ b/drivers/md/md.c |
2988 |
+@@ -6525,6 +6525,9 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev) |
2989 |
+ char b[BDEVNAME_SIZE]; |
2990 |
+ struct md_rdev *rdev; |
2991 |
+ |
2992 |
++ if (!mddev->pers) |
2993 |
++ return -ENODEV; |
2994 |
++ |
2995 |
+ rdev = find_rdev(mddev, dev); |
2996 |
+ if (!rdev) |
2997 |
+ return -ENXIO; |
2998 |
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
2999 |
+index e9e3308cb0a7..4445179aa4c8 100644 |
3000 |
+--- a/drivers/md/raid1.c |
3001 |
++++ b/drivers/md/raid1.c |
3002 |
+@@ -2474,6 +2474,8 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio) |
3003 |
+ fix_read_error(conf, r1_bio->read_disk, |
3004 |
+ r1_bio->sector, r1_bio->sectors); |
3005 |
+ unfreeze_array(conf); |
3006 |
++ } else if (mddev->ro == 0 && test_bit(FailFast, &rdev->flags)) { |
3007 |
++ md_error(mddev, rdev); |
3008 |
+ } else { |
3009 |
+ r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED; |
3010 |
+ } |
3011 |
+diff --git a/drivers/media/cec/cec-pin-error-inj.c b/drivers/media/cec/cec-pin-error-inj.c |
3012 |
+index aaa899a175ce..c0088d3b8e3d 100644 |
3013 |
+--- a/drivers/media/cec/cec-pin-error-inj.c |
3014 |
++++ b/drivers/media/cec/cec-pin-error-inj.c |
3015 |
+@@ -81,10 +81,9 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) |
3016 |
+ u64 *error; |
3017 |
+ u8 *args; |
3018 |
+ bool has_op; |
3019 |
+- u32 op; |
3020 |
++ u8 op; |
3021 |
+ u8 mode; |
3022 |
+ u8 pos; |
3023 |
+- u8 v; |
3024 |
+ |
3025 |
+ p = skip_spaces(p); |
3026 |
+ token = strsep(&p, delims); |
3027 |
+@@ -146,12 +145,18 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) |
3028 |
+ comma = strchr(token, ','); |
3029 |
+ if (comma) |
3030 |
+ *comma++ = '\0'; |
3031 |
+- if (!strcmp(token, "any")) |
3032 |
+- op = CEC_ERROR_INJ_OP_ANY; |
3033 |
+- else if (!kstrtou8(token, 0, &v)) |
3034 |
+- op = v; |
3035 |
+- else |
3036 |
++ if (!strcmp(token, "any")) { |
3037 |
++ has_op = false; |
3038 |
++ error = pin->error_inj + CEC_ERROR_INJ_OP_ANY; |
3039 |
++ args = pin->error_inj_args[CEC_ERROR_INJ_OP_ANY]; |
3040 |
++ } else if (!kstrtou8(token, 0, &op)) { |
3041 |
++ has_op = true; |
3042 |
++ error = pin->error_inj + op; |
3043 |
++ args = pin->error_inj_args[op]; |
3044 |
++ } else { |
3045 |
+ return false; |
3046 |
++ } |
3047 |
++ |
3048 |
+ mode = CEC_ERROR_INJ_MODE_ONCE; |
3049 |
+ if (comma) { |
3050 |
+ if (!strcmp(comma, "off")) |
3051 |
+@@ -166,10 +171,6 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) |
3052 |
+ return false; |
3053 |
+ } |
3054 |
+ |
3055 |
+- error = pin->error_inj + op; |
3056 |
+- args = pin->error_inj_args[op]; |
3057 |
+- has_op = op <= 0xff; |
3058 |
+- |
3059 |
+ token = strsep(&p, delims); |
3060 |
+ if (p) { |
3061 |
+ p = skip_spaces(p); |
3062 |
+@@ -203,16 +204,18 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) |
3063 |
+ mode_mask = CEC_ERROR_INJ_MODE_MASK << mode_offset; |
3064 |
+ arg_idx = cec_error_inj_cmds[i].arg_idx; |
3065 |
+ |
3066 |
+- if (mode_offset == CEC_ERROR_INJ_RX_ARB_LOST_OFFSET || |
3067 |
+- mode_offset == CEC_ERROR_INJ_TX_ADD_BYTES_OFFSET) |
3068 |
+- is_bit_pos = false; |
3069 |
+- |
3070 |
+ if (mode_offset == CEC_ERROR_INJ_RX_ARB_LOST_OFFSET) { |
3071 |
+ if (has_op) |
3072 |
+ return false; |
3073 |
+ if (!has_pos) |
3074 |
+ pos = 0x0f; |
3075 |
++ is_bit_pos = false; |
3076 |
++ } else if (mode_offset == CEC_ERROR_INJ_TX_ADD_BYTES_OFFSET) { |
3077 |
++ if (!has_pos || !pos) |
3078 |
++ return false; |
3079 |
++ is_bit_pos = false; |
3080 |
+ } |
3081 |
++ |
3082 |
+ if (arg_idx >= 0 && is_bit_pos) { |
3083 |
+ if (!has_pos || pos >= 160) |
3084 |
+ return false; |
3085 |
+diff --git a/drivers/media/common/siano/smsendian.c b/drivers/media/common/siano/smsendian.c |
3086 |
+index bfe831c10b1c..b95a631f23f9 100644 |
3087 |
+--- a/drivers/media/common/siano/smsendian.c |
3088 |
++++ b/drivers/media/common/siano/smsendian.c |
3089 |
+@@ -35,7 +35,7 @@ void smsendian_handle_tx_message(void *buffer) |
3090 |
+ switch (msg->x_msg_header.msg_type) { |
3091 |
+ case MSG_SMS_DATA_DOWNLOAD_REQ: |
3092 |
+ { |
3093 |
+- msg->msg_data[0] = le32_to_cpu(msg->msg_data[0]); |
3094 |
++ msg->msg_data[0] = le32_to_cpu((__force __le32)(msg->msg_data[0])); |
3095 |
+ break; |
3096 |
+ } |
3097 |
+ |
3098 |
+@@ -44,7 +44,7 @@ void smsendian_handle_tx_message(void *buffer) |
3099 |
+ sizeof(struct sms_msg_hdr))/4; |
3100 |
+ |
3101 |
+ for (i = 0; i < msg_words; i++) |
3102 |
+- msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]); |
3103 |
++ msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]); |
3104 |
+ |
3105 |
+ break; |
3106 |
+ } |
3107 |
+@@ -64,7 +64,7 @@ void smsendian_handle_rx_message(void *buffer) |
3108 |
+ { |
3109 |
+ struct sms_version_res *ver = |
3110 |
+ (struct sms_version_res *) msg; |
3111 |
+- ver->chip_model = le16_to_cpu(ver->chip_model); |
3112 |
++ ver->chip_model = le16_to_cpu((__force __le16)ver->chip_model); |
3113 |
+ break; |
3114 |
+ } |
3115 |
+ |
3116 |
+@@ -81,7 +81,7 @@ void smsendian_handle_rx_message(void *buffer) |
3117 |
+ sizeof(struct sms_msg_hdr))/4; |
3118 |
+ |
3119 |
+ for (i = 0; i < msg_words; i++) |
3120 |
+- msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]); |
3121 |
++ msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]); |
3122 |
+ |
3123 |
+ break; |
3124 |
+ } |
3125 |
+@@ -95,9 +95,9 @@ void smsendian_handle_message_header(void *msg) |
3126 |
+ #ifdef __BIG_ENDIAN |
3127 |
+ struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg; |
3128 |
+ |
3129 |
+- phdr->msg_type = le16_to_cpu(phdr->msg_type); |
3130 |
+- phdr->msg_length = le16_to_cpu(phdr->msg_length); |
3131 |
+- phdr->msg_flags = le16_to_cpu(phdr->msg_flags); |
3132 |
++ phdr->msg_type = le16_to_cpu((__force __le16)phdr->msg_type); |
3133 |
++ phdr->msg_length = le16_to_cpu((__force __le16)phdr->msg_length); |
3134 |
++ phdr->msg_flags = le16_to_cpu((__force __le16)phdr->msg_flags); |
3135 |
+ #endif /* __BIG_ENDIAN */ |
3136 |
+ } |
3137 |
+ EXPORT_SYMBOL_GPL(smsendian_handle_message_header); |
3138 |
+diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c |
3139 |
+index d3f7bb33a54d..f32ec7342ef0 100644 |
3140 |
+--- a/drivers/media/common/videobuf2/videobuf2-core.c |
3141 |
++++ b/drivers/media/common/videobuf2/videobuf2-core.c |
3142 |
+@@ -916,9 +916,12 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) |
3143 |
+ dprintk(4, "done processing on buffer %d, state: %d\n", |
3144 |
+ vb->index, state); |
3145 |
+ |
3146 |
+- /* sync buffers */ |
3147 |
+- for (plane = 0; plane < vb->num_planes; ++plane) |
3148 |
+- call_void_memop(vb, finish, vb->planes[plane].mem_priv); |
3149 |
++ if (state != VB2_BUF_STATE_QUEUED && |
3150 |
++ state != VB2_BUF_STATE_REQUEUEING) { |
3151 |
++ /* sync buffers */ |
3152 |
++ for (plane = 0; plane < vb->num_planes; ++plane) |
3153 |
++ call_void_memop(vb, finish, vb->planes[plane].mem_priv); |
3154 |
++ } |
3155 |
+ |
3156 |
+ spin_lock_irqsave(&q->done_lock, flags); |
3157 |
+ if (state == VB2_BUF_STATE_QUEUED || |
3158 |
+diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c |
3159 |
+index 3b7ace395ee6..e1f8208581aa 100644 |
3160 |
+--- a/drivers/media/i2c/smiapp/smiapp-core.c |
3161 |
++++ b/drivers/media/i2c/smiapp/smiapp-core.c |
3162 |
+@@ -1001,7 +1001,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor, |
3163 |
+ if (rval) |
3164 |
+ goto out; |
3165 |
+ |
3166 |
+- for (i = 0; i < 1000; i++) { |
3167 |
++ for (i = 1000; i > 0; i--) { |
3168 |
+ rval = smiapp_read( |
3169 |
+ sensor, |
3170 |
+ SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS, &s); |
3171 |
+@@ -1012,11 +1012,10 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor, |
3172 |
+ if (s & SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY) |
3173 |
+ break; |
3174 |
+ |
3175 |
+- if (--i == 0) { |
3176 |
+- rval = -ETIMEDOUT; |
3177 |
+- goto out; |
3178 |
+- } |
3179 |
+- |
3180 |
++ } |
3181 |
++ if (!i) { |
3182 |
++ rval = -ETIMEDOUT; |
3183 |
++ goto out; |
3184 |
+ } |
3185 |
+ |
3186 |
+ for (i = 0; i < SMIAPP_NVM_PAGE_SIZE; i++) { |
3187 |
+diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c |
3188 |
+index 35e81f7c0d2f..ae59c3177555 100644 |
3189 |
+--- a/drivers/media/media-device.c |
3190 |
++++ b/drivers/media/media-device.c |
3191 |
+@@ -54,9 +54,10 @@ static int media_device_close(struct file *filp) |
3192 |
+ return 0; |
3193 |
+ } |
3194 |
+ |
3195 |
+-static int media_device_get_info(struct media_device *dev, |
3196 |
+- struct media_device_info *info) |
3197 |
++static long media_device_get_info(struct media_device *dev, void *arg) |
3198 |
+ { |
3199 |
++ struct media_device_info *info = arg; |
3200 |
++ |
3201 |
+ memset(info, 0, sizeof(*info)); |
3202 |
+ |
3203 |
+ if (dev->driver_name[0]) |
3204 |
+@@ -93,9 +94,9 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id) |
3205 |
+ return NULL; |
3206 |
+ } |
3207 |
+ |
3208 |
+-static long media_device_enum_entities(struct media_device *mdev, |
3209 |
+- struct media_entity_desc *entd) |
3210 |
++static long media_device_enum_entities(struct media_device *mdev, void *arg) |
3211 |
+ { |
3212 |
++ struct media_entity_desc *entd = arg; |
3213 |
+ struct media_entity *ent; |
3214 |
+ |
3215 |
+ ent = find_entity(mdev, entd->id); |
3216 |
+@@ -146,9 +147,9 @@ static void media_device_kpad_to_upad(const struct media_pad *kpad, |
3217 |
+ upad->flags = kpad->flags; |
3218 |
+ } |
3219 |
+ |
3220 |
+-static long media_device_enum_links(struct media_device *mdev, |
3221 |
+- struct media_links_enum *links) |
3222 |
++static long media_device_enum_links(struct media_device *mdev, void *arg) |
3223 |
+ { |
3224 |
++ struct media_links_enum *links = arg; |
3225 |
+ struct media_entity *entity; |
3226 |
+ |
3227 |
+ entity = find_entity(mdev, links->entity); |
3228 |
+@@ -195,9 +196,9 @@ static long media_device_enum_links(struct media_device *mdev, |
3229 |
+ return 0; |
3230 |
+ } |
3231 |
+ |
3232 |
+-static long media_device_setup_link(struct media_device *mdev, |
3233 |
+- struct media_link_desc *linkd) |
3234 |
++static long media_device_setup_link(struct media_device *mdev, void *arg) |
3235 |
+ { |
3236 |
++ struct media_link_desc *linkd = arg; |
3237 |
+ struct media_link *link = NULL; |
3238 |
+ struct media_entity *source; |
3239 |
+ struct media_entity *sink; |
3240 |
+@@ -225,9 +226,9 @@ static long media_device_setup_link(struct media_device *mdev, |
3241 |
+ return __media_entity_setup_link(link, linkd->flags); |
3242 |
+ } |
3243 |
+ |
3244 |
+-static long media_device_get_topology(struct media_device *mdev, |
3245 |
+- struct media_v2_topology *topo) |
3246 |
++static long media_device_get_topology(struct media_device *mdev, void *arg) |
3247 |
+ { |
3248 |
++ struct media_v2_topology *topo = arg; |
3249 |
+ struct media_entity *entity; |
3250 |
+ struct media_interface *intf; |
3251 |
+ struct media_pad *pad; |
3252 |
+diff --git a/drivers/media/pci/saa7164/saa7164-fw.c b/drivers/media/pci/saa7164/saa7164-fw.c |
3253 |
+index ef4906406ebf..a50461861133 100644 |
3254 |
+--- a/drivers/media/pci/saa7164/saa7164-fw.c |
3255 |
++++ b/drivers/media/pci/saa7164/saa7164-fw.c |
3256 |
+@@ -426,7 +426,8 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev) |
3257 |
+ __func__, fw->size); |
3258 |
+ |
3259 |
+ if (fw->size != fwlength) { |
3260 |
+- printk(KERN_ERR "xc5000: firmware incorrect size\n"); |
3261 |
++ printk(KERN_ERR "saa7164: firmware incorrect size %zu != %u\n", |
3262 |
++ fw->size, fwlength); |
3263 |
+ ret = -ENOMEM; |
3264 |
+ goto out; |
3265 |
+ } |
3266 |
+diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c |
3267 |
+index c3fafa97b2d0..0ea8dd44026c 100644 |
3268 |
+--- a/drivers/media/pci/tw686x/tw686x-video.c |
3269 |
++++ b/drivers/media/pci/tw686x/tw686x-video.c |
3270 |
+@@ -1228,7 +1228,8 @@ int tw686x_video_init(struct tw686x_dev *dev) |
3271 |
+ vc->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
3272 |
+ vc->vidq.min_buffers_needed = 2; |
3273 |
+ vc->vidq.lock = &vc->vb_mutex; |
3274 |
+- vc->vidq.gfp_flags = GFP_DMA32; |
3275 |
++ vc->vidq.gfp_flags = dev->dma_mode != TW686X_DMA_MODE_MEMCPY ? |
3276 |
++ GFP_DMA32 : 0; |
3277 |
+ vc->vidq.dev = &dev->pci_dev->dev; |
3278 |
+ |
3279 |
+ err = vb2_queue_init(&vc->vidq); |
3280 |
+diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c |
3281 |
+index 8eb000e3d8fd..f2db5128d786 100644 |
3282 |
+--- a/drivers/media/platform/omap3isp/isp.c |
3283 |
++++ b/drivers/media/platform/omap3isp/isp.c |
3284 |
+@@ -1945,6 +1945,7 @@ error_csi2: |
3285 |
+ |
3286 |
+ static void isp_detach_iommu(struct isp_device *isp) |
3287 |
+ { |
3288 |
++ arm_iommu_detach_device(isp->dev); |
3289 |
+ arm_iommu_release_mapping(isp->mapping); |
3290 |
+ isp->mapping = NULL; |
3291 |
+ } |
3292 |
+@@ -1961,8 +1962,7 @@ static int isp_attach_iommu(struct isp_device *isp) |
3293 |
+ mapping = arm_iommu_create_mapping(&platform_bus_type, SZ_1G, SZ_2G); |
3294 |
+ if (IS_ERR(mapping)) { |
3295 |
+ dev_err(isp->dev, "failed to create ARM IOMMU mapping\n"); |
3296 |
+- ret = PTR_ERR(mapping); |
3297 |
+- goto error; |
3298 |
++ return PTR_ERR(mapping); |
3299 |
+ } |
3300 |
+ |
3301 |
+ isp->mapping = mapping; |
3302 |
+@@ -1977,7 +1977,8 @@ static int isp_attach_iommu(struct isp_device *isp) |
3303 |
+ return 0; |
3304 |
+ |
3305 |
+ error: |
3306 |
+- isp_detach_iommu(isp); |
3307 |
++ arm_iommu_release_mapping(isp->mapping); |
3308 |
++ isp->mapping = NULL; |
3309 |
+ return ret; |
3310 |
+ } |
3311 |
+ |
3312 |
+diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c |
3313 |
+index f6092ae45912..8b44a849ab41 100644 |
3314 |
+--- a/drivers/media/platform/rcar_jpu.c |
3315 |
++++ b/drivers/media/platform/rcar_jpu.c |
3316 |
+@@ -1280,7 +1280,7 @@ static int jpu_open(struct file *file) |
3317 |
+ /* ...issue software reset */ |
3318 |
+ ret = jpu_reset(jpu); |
3319 |
+ if (ret) |
3320 |
+- goto device_prepare_rollback; |
3321 |
++ goto jpu_reset_rollback; |
3322 |
+ } |
3323 |
+ |
3324 |
+ jpu->ref_count++; |
3325 |
+@@ -1288,6 +1288,8 @@ static int jpu_open(struct file *file) |
3326 |
+ mutex_unlock(&jpu->mutex); |
3327 |
+ return 0; |
3328 |
+ |
3329 |
++jpu_reset_rollback: |
3330 |
++ clk_disable_unprepare(jpu->clk); |
3331 |
+ device_prepare_rollback: |
3332 |
+ mutex_unlock(&jpu->mutex); |
3333 |
+ v4l_prepare_rollback: |
3334 |
+diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c |
3335 |
+index 6599dba5ab84..dec1b3572e9b 100644 |
3336 |
+--- a/drivers/media/platform/renesas-ceu.c |
3337 |
++++ b/drivers/media/platform/renesas-ceu.c |
3338 |
+@@ -777,8 +777,15 @@ static int ceu_try_fmt(struct ceu_device *ceudev, struct v4l2_format *v4l2_fmt) |
3339 |
+ const struct ceu_fmt *ceu_fmt; |
3340 |
+ int ret; |
3341 |
+ |
3342 |
++ /* |
3343 |
++ * Set format on sensor sub device: bus format used to produce memory |
3344 |
++ * format is selected at initialization time. |
3345 |
++ */ |
3346 |
+ struct v4l2_subdev_format sd_format = { |
3347 |
+- .which = V4L2_SUBDEV_FORMAT_TRY, |
3348 |
++ .which = V4L2_SUBDEV_FORMAT_TRY, |
3349 |
++ .format = { |
3350 |
++ .code = ceu_sd->mbus_fmt.mbus_code, |
3351 |
++ }, |
3352 |
+ }; |
3353 |
+ |
3354 |
+ switch (pix->pixelformat) { |
3355 |
+@@ -800,10 +807,6 @@ static int ceu_try_fmt(struct ceu_device *ceudev, struct v4l2_format *v4l2_fmt) |
3356 |
+ v4l_bound_align_image(&pix->width, 2, CEU_MAX_WIDTH, 4, |
3357 |
+ &pix->height, 4, CEU_MAX_HEIGHT, 4, 0); |
3358 |
+ |
3359 |
+- /* |
3360 |
+- * Set format on sensor sub device: bus format used to produce memory |
3361 |
+- * format is selected at initialization time. |
3362 |
+- */ |
3363 |
+ v4l2_fill_mbus_format_mplane(&sd_format.format, pix); |
3364 |
+ ret = v4l2_subdev_call(v4l2_sd, pad, set_fmt, &pad_cfg, &sd_format); |
3365 |
+ if (ret) |
3366 |
+@@ -827,8 +830,15 @@ static int ceu_set_fmt(struct ceu_device *ceudev, struct v4l2_format *v4l2_fmt) |
3367 |
+ struct v4l2_subdev *v4l2_sd = ceu_sd->v4l2_sd; |
3368 |
+ int ret; |
3369 |
+ |
3370 |
++ /* |
3371 |
++ * Set format on sensor sub device: bus format used to produce memory |
3372 |
++ * format is selected at initialization time. |
3373 |
++ */ |
3374 |
+ struct v4l2_subdev_format format = { |
3375 |
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE, |
3376 |
++ .format = { |
3377 |
++ .code = ceu_sd->mbus_fmt.mbus_code, |
3378 |
++ }, |
3379 |
+ }; |
3380 |
+ |
3381 |
+ ret = ceu_try_fmt(ceudev, v4l2_fmt); |
3382 |
+diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c |
3383 |
+index 41709b24b28f..f6d1fc3e5e1d 100644 |
3384 |
+--- a/drivers/media/radio/si470x/radio-si470x-i2c.c |
3385 |
++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c |
3386 |
+@@ -91,7 +91,7 @@ MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*"); |
3387 |
+ */ |
3388 |
+ int si470x_get_register(struct si470x_device *radio, int regnr) |
3389 |
+ { |
3390 |
+- u16 buf[READ_REG_NUM]; |
3391 |
++ __be16 buf[READ_REG_NUM]; |
3392 |
+ struct i2c_msg msgs[1] = { |
3393 |
+ { |
3394 |
+ .addr = radio->client->addr, |
3395 |
+@@ -116,7 +116,7 @@ int si470x_get_register(struct si470x_device *radio, int regnr) |
3396 |
+ int si470x_set_register(struct si470x_device *radio, int regnr) |
3397 |
+ { |
3398 |
+ int i; |
3399 |
+- u16 buf[WRITE_REG_NUM]; |
3400 |
++ __be16 buf[WRITE_REG_NUM]; |
3401 |
+ struct i2c_msg msgs[1] = { |
3402 |
+ { |
3403 |
+ .addr = radio->client->addr, |
3404 |
+@@ -146,7 +146,7 @@ int si470x_set_register(struct si470x_device *radio, int regnr) |
3405 |
+ static int si470x_get_all_registers(struct si470x_device *radio) |
3406 |
+ { |
3407 |
+ int i; |
3408 |
+- u16 buf[READ_REG_NUM]; |
3409 |
++ __be16 buf[READ_REG_NUM]; |
3410 |
+ struct i2c_msg msgs[1] = { |
3411 |
+ { |
3412 |
+ .addr = radio->client->addr, |
3413 |
+diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c |
3414 |
+index 5478fe08f9d3..d94f1c190f62 100644 |
3415 |
+--- a/drivers/media/rc/ir-mce_kbd-decoder.c |
3416 |
++++ b/drivers/media/rc/ir-mce_kbd-decoder.c |
3417 |
+@@ -324,11 +324,13 @@ again: |
3418 |
+ scancode = data->body & 0xffff; |
3419 |
+ dev_dbg(&dev->dev, "keyboard data 0x%08x\n", |
3420 |
+ data->body); |
3421 |
+- if (dev->timeout) |
3422 |
+- delay = usecs_to_jiffies(dev->timeout / 1000); |
3423 |
+- else |
3424 |
+- delay = msecs_to_jiffies(100); |
3425 |
+- mod_timer(&data->rx_timeout, jiffies + delay); |
3426 |
++ if (scancode) { |
3427 |
++ delay = nsecs_to_jiffies(dev->timeout) + |
3428 |
++ msecs_to_jiffies(100); |
3429 |
++ mod_timer(&data->rx_timeout, jiffies + delay); |
3430 |
++ } else { |
3431 |
++ del_timer(&data->rx_timeout); |
3432 |
++ } |
3433 |
+ /* Pass data to keyboard buffer parser */ |
3434 |
+ ir_mce_kbd_process_keyboard_data(dev, scancode); |
3435 |
+ lsc.rc_proto = RC_PROTO_MCIR2_KBD; |
3436 |
+diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c |
3437 |
+index 3f493e0b0716..5f2f61f000fc 100644 |
3438 |
+--- a/drivers/media/usb/em28xx/em28xx-dvb.c |
3439 |
++++ b/drivers/media/usb/em28xx/em28xx-dvb.c |
3440 |
+@@ -199,6 +199,7 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb) |
3441 |
+ int rc; |
3442 |
+ struct em28xx_i2c_bus *i2c_bus = dvb->adapter.priv; |
3443 |
+ struct em28xx *dev = i2c_bus->dev; |
3444 |
++ struct usb_device *udev = interface_to_usbdev(dev->intf); |
3445 |
+ int dvb_max_packet_size, packet_multiplier, dvb_alt; |
3446 |
+ |
3447 |
+ if (dev->dvb_xfer_bulk) { |
3448 |
+@@ -217,6 +218,7 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb) |
3449 |
+ dvb_alt = dev->dvb_alt_isoc; |
3450 |
+ } |
3451 |
+ |
3452 |
++ usb_set_interface(udev, dev->ifnum, dvb_alt); |
3453 |
+ rc = em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); |
3454 |
+ if (rc < 0) |
3455 |
+ return rc; |
3456 |
+@@ -1392,7 +1394,7 @@ static int em28174_dvb_init_hauppauge_wintv_dualhd_01595(struct em28xx *dev) |
3457 |
+ |
3458 |
+ dvb->i2c_client_tuner = dvb_module_probe("si2157", NULL, |
3459 |
+ adapter, |
3460 |
+- 0x60, &si2157_config); |
3461 |
++ addr, &si2157_config); |
3462 |
+ if (!dvb->i2c_client_tuner) { |
3463 |
+ dvb_module_release(dvb->i2c_client_demod); |
3464 |
+ return -ENODEV; |
3465 |
+diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c |
3466 |
+index a4803ac192bb..1d49a8dd4a37 100644 |
3467 |
+--- a/drivers/memory/tegra/mc.c |
3468 |
++++ b/drivers/memory/tegra/mc.c |
3469 |
+@@ -20,14 +20,6 @@ |
3470 |
+ #include "mc.h" |
3471 |
+ |
3472 |
+ #define MC_INTSTATUS 0x000 |
3473 |
+-#define MC_INT_DECERR_MTS (1 << 16) |
3474 |
+-#define MC_INT_SECERR_SEC (1 << 13) |
3475 |
+-#define MC_INT_DECERR_VPR (1 << 12) |
3476 |
+-#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11) |
3477 |
+-#define MC_INT_INVALID_SMMU_PAGE (1 << 10) |
3478 |
+-#define MC_INT_ARBITRATION_EMEM (1 << 9) |
3479 |
+-#define MC_INT_SECURITY_VIOLATION (1 << 8) |
3480 |
+-#define MC_INT_DECERR_EMEM (1 << 6) |
3481 |
+ |
3482 |
+ #define MC_INTMASK 0x004 |
3483 |
+ |
3484 |
+@@ -248,12 +240,13 @@ static const char *const error_names[8] = { |
3485 |
+ static irqreturn_t tegra_mc_irq(int irq, void *data) |
3486 |
+ { |
3487 |
+ struct tegra_mc *mc = data; |
3488 |
+- unsigned long status, mask; |
3489 |
++ unsigned long status; |
3490 |
+ unsigned int bit; |
3491 |
+ |
3492 |
+ /* mask all interrupts to avoid flooding */ |
3493 |
+- status = mc_readl(mc, MC_INTSTATUS); |
3494 |
+- mask = mc_readl(mc, MC_INTMASK); |
3495 |
++ status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask; |
3496 |
++ if (!status) |
3497 |
++ return IRQ_NONE; |
3498 |
+ |
3499 |
+ for_each_set_bit(bit, &status, 32) { |
3500 |
+ const char *error = status_names[bit] ?: "unknown"; |
3501 |
+@@ -346,7 +339,6 @@ static int tegra_mc_probe(struct platform_device *pdev) |
3502 |
+ const struct of_device_id *match; |
3503 |
+ struct resource *res; |
3504 |
+ struct tegra_mc *mc; |
3505 |
+- u32 value; |
3506 |
+ int err; |
3507 |
+ |
3508 |
+ match = of_match_node(tegra_mc_of_match, pdev->dev.of_node); |
3509 |
+@@ -414,11 +406,7 @@ static int tegra_mc_probe(struct platform_device *pdev) |
3510 |
+ |
3511 |
+ WARN(!mc->soc->client_id_mask, "Missing client ID mask for this SoC\n"); |
3512 |
+ |
3513 |
+- value = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | |
3514 |
+- MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE | |
3515 |
+- MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM; |
3516 |
+- |
3517 |
+- mc_writel(mc, value, MC_INTMASK); |
3518 |
++ mc_writel(mc, mc->soc->intmask, MC_INTMASK); |
3519 |
+ |
3520 |
+ return 0; |
3521 |
+ } |
3522 |
+diff --git a/drivers/memory/tegra/mc.h b/drivers/memory/tegra/mc.h |
3523 |
+index ddb16676c3af..24e020b4609b 100644 |
3524 |
+--- a/drivers/memory/tegra/mc.h |
3525 |
++++ b/drivers/memory/tegra/mc.h |
3526 |
+@@ -14,6 +14,15 @@ |
3527 |
+ |
3528 |
+ #include <soc/tegra/mc.h> |
3529 |
+ |
3530 |
++#define MC_INT_DECERR_MTS (1 << 16) |
3531 |
++#define MC_INT_SECERR_SEC (1 << 13) |
3532 |
++#define MC_INT_DECERR_VPR (1 << 12) |
3533 |
++#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11) |
3534 |
++#define MC_INT_INVALID_SMMU_PAGE (1 << 10) |
3535 |
++#define MC_INT_ARBITRATION_EMEM (1 << 9) |
3536 |
++#define MC_INT_SECURITY_VIOLATION (1 << 8) |
3537 |
++#define MC_INT_DECERR_EMEM (1 << 6) |
3538 |
++ |
3539 |
+ static inline u32 mc_readl(struct tegra_mc *mc, unsigned long offset) |
3540 |
+ { |
3541 |
+ return readl(mc->regs + offset); |
3542 |
+diff --git a/drivers/memory/tegra/tegra114.c b/drivers/memory/tegra/tegra114.c |
3543 |
+index b20e6e3e208e..7560b2f558a7 100644 |
3544 |
+--- a/drivers/memory/tegra/tegra114.c |
3545 |
++++ b/drivers/memory/tegra/tegra114.c |
3546 |
+@@ -945,4 +945,6 @@ const struct tegra_mc_soc tegra114_mc_soc = { |
3547 |
+ .atom_size = 32, |
3548 |
+ .client_id_mask = 0x7f, |
3549 |
+ .smmu = &tegra114_smmu_soc, |
3550 |
++ .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION | |
3551 |
++ MC_INT_DECERR_EMEM, |
3552 |
+ }; |
3553 |
+diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c |
3554 |
+index 8b6360eabb8a..bd16555cca0f 100644 |
3555 |
+--- a/drivers/memory/tegra/tegra124.c |
3556 |
++++ b/drivers/memory/tegra/tegra124.c |
3557 |
+@@ -1035,6 +1035,9 @@ const struct tegra_mc_soc tegra124_mc_soc = { |
3558 |
+ .smmu = &tegra124_smmu_soc, |
3559 |
+ .emem_regs = tegra124_mc_emem_regs, |
3560 |
+ .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs), |
3561 |
++ .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | |
3562 |
++ MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE | |
3563 |
++ MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, |
3564 |
+ }; |
3565 |
+ #endif /* CONFIG_ARCH_TEGRA_124_SOC */ |
3566 |
+ |
3567 |
+@@ -1059,5 +1062,8 @@ const struct tegra_mc_soc tegra132_mc_soc = { |
3568 |
+ .atom_size = 32, |
3569 |
+ .client_id_mask = 0x7f, |
3570 |
+ .smmu = &tegra132_smmu_soc, |
3571 |
++ .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | |
3572 |
++ MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE | |
3573 |
++ MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, |
3574 |
+ }; |
3575 |
+ #endif /* CONFIG_ARCH_TEGRA_132_SOC */ |
3576 |
+diff --git a/drivers/memory/tegra/tegra210.c b/drivers/memory/tegra/tegra210.c |
3577 |
+index d398bcd3fc57..3b8d0100088c 100644 |
3578 |
+--- a/drivers/memory/tegra/tegra210.c |
3579 |
++++ b/drivers/memory/tegra/tegra210.c |
3580 |
+@@ -1092,4 +1092,7 @@ const struct tegra_mc_soc tegra210_mc_soc = { |
3581 |
+ .atom_size = 64, |
3582 |
+ .client_id_mask = 0xff, |
3583 |
+ .smmu = &tegra210_smmu_soc, |
3584 |
++ .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | |
3585 |
++ MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE | |
3586 |
++ MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, |
3587 |
+ }; |
3588 |
+diff --git a/drivers/memory/tegra/tegra30.c b/drivers/memory/tegra/tegra30.c |
3589 |
+index d756c837f23e..d2ba50ed0490 100644 |
3590 |
+--- a/drivers/memory/tegra/tegra30.c |
3591 |
++++ b/drivers/memory/tegra/tegra30.c |
3592 |
+@@ -967,4 +967,6 @@ const struct tegra_mc_soc tegra30_mc_soc = { |
3593 |
+ .atom_size = 16, |
3594 |
+ .client_id_mask = 0x7f, |
3595 |
+ .smmu = &tegra30_smmu_soc, |
3596 |
++ .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION | |
3597 |
++ MC_INT_DECERR_EMEM, |
3598 |
+ }; |
3599 |
+diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c |
3600 |
+index d61024141e2b..74780f2964a1 100644 |
3601 |
+--- a/drivers/mfd/cros_ec.c |
3602 |
++++ b/drivers/mfd/cros_ec.c |
3603 |
+@@ -112,7 +112,11 @@ int cros_ec_register(struct cros_ec_device *ec_dev) |
3604 |
+ |
3605 |
+ mutex_init(&ec_dev->lock); |
3606 |
+ |
3607 |
+- cros_ec_query_all(ec_dev); |
3608 |
++ err = cros_ec_query_all(ec_dev); |
3609 |
++ if (err) { |
3610 |
++ dev_err(dev, "Cannot identify the EC: error %d\n", err); |
3611 |
++ return err; |
3612 |
++ } |
3613 |
+ |
3614 |
+ if (ec_dev->irq) { |
3615 |
+ err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread, |
3616 |
+diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c |
3617 |
+index 13ef162cf066..a8b9fee4d62a 100644 |
3618 |
+--- a/drivers/mmc/core/pwrseq_simple.c |
3619 |
++++ b/drivers/mmc/core/pwrseq_simple.c |
3620 |
+@@ -40,14 +40,18 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, |
3621 |
+ struct gpio_descs *reset_gpios = pwrseq->reset_gpios; |
3622 |
+ |
3623 |
+ if (!IS_ERR(reset_gpios)) { |
3624 |
+- int i; |
3625 |
+- int values[reset_gpios->ndescs]; |
3626 |
++ int i, *values; |
3627 |
++ int nvalues = reset_gpios->ndescs; |
3628 |
+ |
3629 |
+- for (i = 0; i < reset_gpios->ndescs; i++) |
3630 |
++ values = kmalloc_array(nvalues, sizeof(int), GFP_KERNEL); |
3631 |
++ if (!values) |
3632 |
++ return; |
3633 |
++ |
3634 |
++ for (i = 0; i < nvalues; i++) |
3635 |
+ values[i] = value; |
3636 |
+ |
3637 |
+- gpiod_set_array_value_cansleep( |
3638 |
+- reset_gpios->ndescs, reset_gpios->desc, values); |
3639 |
++ gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc, values); |
3640 |
++ kfree(values); |
3641 |
+ } |
3642 |
+ } |
3643 |
+ |
3644 |
+diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c |
3645 |
+index 3ee8f57fd612..80dc2fd6576c 100644 |
3646 |
+--- a/drivers/mmc/host/dw_mmc.c |
3647 |
++++ b/drivers/mmc/host/dw_mmc.c |
3648 |
+@@ -1231,6 +1231,8 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) |
3649 |
+ if (host->state == STATE_WAITING_CMD11_DONE) |
3650 |
+ sdmmc_cmd_bits |= SDMMC_CMD_VOLT_SWITCH; |
3651 |
+ |
3652 |
++ slot->mmc->actual_clock = 0; |
3653 |
++ |
3654 |
+ if (!clock) { |
3655 |
+ mci_writel(host, CLKENA, 0); |
3656 |
+ mci_send_cmd(slot, sdmmc_cmd_bits, 0); |
3657 |
+@@ -1289,6 +1291,8 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) |
3658 |
+ |
3659 |
+ /* keep the last clock value that was requested from core */ |
3660 |
+ slot->__clk_old = clock; |
3661 |
++ slot->mmc->actual_clock = div ? ((host->bus_hz / div) >> 1) : |
3662 |
++ host->bus_hz; |
3663 |
+ } |
3664 |
+ |
3665 |
+ host->current_speed = clock; |
3666 |
+diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c |
3667 |
+index 1456abd5eeb9..e7e43f2ae224 100644 |
3668 |
+--- a/drivers/mmc/host/sdhci-omap.c |
3669 |
++++ b/drivers/mmc/host/sdhci-omap.c |
3670 |
+@@ -916,10 +916,6 @@ static int sdhci_omap_probe(struct platform_device *pdev) |
3671 |
+ goto err_put_sync; |
3672 |
+ } |
3673 |
+ |
3674 |
+- ret = sdhci_omap_config_iodelay_pinctrl_state(omap_host); |
3675 |
+- if (ret) |
3676 |
+- goto err_put_sync; |
3677 |
+- |
3678 |
+ host->mmc_host_ops.get_ro = mmc_gpio_get_ro; |
3679 |
+ host->mmc_host_ops.start_signal_voltage_switch = |
3680 |
+ sdhci_omap_start_signal_voltage_switch; |
3681 |
+@@ -930,12 +926,23 @@ static int sdhci_omap_probe(struct platform_device *pdev) |
3682 |
+ sdhci_read_caps(host); |
3683 |
+ host->caps |= SDHCI_CAN_DO_ADMA2; |
3684 |
+ |
3685 |
+- ret = sdhci_add_host(host); |
3686 |
++ ret = sdhci_setup_host(host); |
3687 |
+ if (ret) |
3688 |
+ goto err_put_sync; |
3689 |
+ |
3690 |
++ ret = sdhci_omap_config_iodelay_pinctrl_state(omap_host); |
3691 |
++ if (ret) |
3692 |
++ goto err_cleanup_host; |
3693 |
++ |
3694 |
++ ret = __sdhci_add_host(host); |
3695 |
++ if (ret) |
3696 |
++ goto err_cleanup_host; |
3697 |
++ |
3698 |
+ return 0; |
3699 |
+ |
3700 |
++err_cleanup_host: |
3701 |
++ sdhci_cleanup_host(host); |
3702 |
++ |
3703 |
+ err_put_sync: |
3704 |
+ pm_runtime_put_sync(dev); |
3705 |
+ |
3706 |
+diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c |
3707 |
+index 61aae0224078..98aac1f2e9ae 100644 |
3708 |
+--- a/drivers/mtd/nand/raw/fsl_ifc_nand.c |
3709 |
++++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c |
3710 |
+@@ -342,9 +342,16 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command, |
3711 |
+ |
3712 |
+ case NAND_CMD_READID: |
3713 |
+ case NAND_CMD_PARAM: { |
3714 |
++ /* |
3715 |
++ * For READID, read 8 bytes that are currently used. |
3716 |
++ * For PARAM, read all 3 copies of 256-bytes pages. |
3717 |
++ */ |
3718 |
++ int len = 8; |
3719 |
+ int timing = IFC_FIR_OP_RB; |
3720 |
+- if (command == NAND_CMD_PARAM) |
3721 |
++ if (command == NAND_CMD_PARAM) { |
3722 |
+ timing = IFC_FIR_OP_RBCD; |
3723 |
++ len = 256 * 3; |
3724 |
++ } |
3725 |
+ |
3726 |
+ ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | |
3727 |
+ (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) | |
3728 |
+@@ -354,12 +361,8 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command, |
3729 |
+ &ifc->ifc_nand.nand_fcr0); |
3730 |
+ ifc_out32(column, &ifc->ifc_nand.row3); |
3731 |
+ |
3732 |
+- /* |
3733 |
+- * although currently it's 8 bytes for READID, we always read |
3734 |
+- * the maximum 256 bytes(for PARAM) |
3735 |
+- */ |
3736 |
+- ifc_out32(256, &ifc->ifc_nand.nand_fbcr); |
3737 |
+- ifc_nand_ctrl->read_bytes = 256; |
3738 |
++ ifc_out32(len, &ifc->ifc_nand.nand_fbcr); |
3739 |
++ ifc_nand_ctrl->read_bytes = len; |
3740 |
+ |
3741 |
+ set_addr(mtd, 0, 0, 0); |
3742 |
+ fsl_ifc_run_command(mtd); |
3743 |
+diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c |
3744 |
+index 600d5ad1fbde..18f51d5ac846 100644 |
3745 |
+--- a/drivers/net/dsa/qca8k.c |
3746 |
++++ b/drivers/net/dsa/qca8k.c |
3747 |
+@@ -473,7 +473,7 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) |
3748 |
+ static void |
3749 |
+ qca8k_port_set_status(struct qca8k_priv *priv, int port, int enable) |
3750 |
+ { |
3751 |
+- u32 mask = QCA8K_PORT_STATUS_TXMAC; |
3752 |
++ u32 mask = QCA8K_PORT_STATUS_TXMAC | QCA8K_PORT_STATUS_RXMAC; |
3753 |
+ |
3754 |
+ /* Port 0 and 6 have no internal PHY */ |
3755 |
+ if ((port > 0) && (port < 6)) |
3756 |
+@@ -490,6 +490,7 @@ qca8k_setup(struct dsa_switch *ds) |
3757 |
+ { |
3758 |
+ struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; |
3759 |
+ int ret, i, phy_mode = -1; |
3760 |
++ u32 mask; |
3761 |
+ |
3762 |
+ /* Make sure that port 0 is the cpu port */ |
3763 |
+ if (!dsa_is_cpu_port(ds, 0)) { |
3764 |
+@@ -515,7 +516,10 @@ qca8k_setup(struct dsa_switch *ds) |
3765 |
+ if (ret < 0) |
3766 |
+ return ret; |
3767 |
+ |
3768 |
+- /* Enable CPU Port */ |
3769 |
++ /* Enable CPU Port, force it to maximum bandwidth and full-duplex */ |
3770 |
++ mask = QCA8K_PORT_STATUS_SPEED_1000 | QCA8K_PORT_STATUS_TXFLOW | |
3771 |
++ QCA8K_PORT_STATUS_RXFLOW | QCA8K_PORT_STATUS_DUPLEX; |
3772 |
++ qca8k_write(priv, QCA8K_REG_PORT_STATUS(QCA8K_CPU_PORT), mask); |
3773 |
+ qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, |
3774 |
+ QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); |
3775 |
+ qca8k_port_set_status(priv, QCA8K_CPU_PORT, 1); |
3776 |
+@@ -583,6 +587,47 @@ qca8k_setup(struct dsa_switch *ds) |
3777 |
+ return 0; |
3778 |
+ } |
3779 |
+ |
3780 |
++static void |
3781 |
++qca8k_adjust_link(struct dsa_switch *ds, int port, struct phy_device *phy) |
3782 |
++{ |
3783 |
++ struct qca8k_priv *priv = ds->priv; |
3784 |
++ u32 reg; |
3785 |
++ |
3786 |
++ /* Force fixed-link setting for CPU port, skip others. */ |
3787 |
++ if (!phy_is_pseudo_fixed_link(phy)) |
3788 |
++ return; |
3789 |
++ |
3790 |
++ /* Set port speed */ |
3791 |
++ switch (phy->speed) { |
3792 |
++ case 10: |
3793 |
++ reg = QCA8K_PORT_STATUS_SPEED_10; |
3794 |
++ break; |
3795 |
++ case 100: |
3796 |
++ reg = QCA8K_PORT_STATUS_SPEED_100; |
3797 |
++ break; |
3798 |
++ case 1000: |
3799 |
++ reg = QCA8K_PORT_STATUS_SPEED_1000; |
3800 |
++ break; |
3801 |
++ default: |
3802 |
++ dev_dbg(priv->dev, "port%d link speed %dMbps not supported.\n", |
3803 |
++ port, phy->speed); |
3804 |
++ return; |
3805 |
++ } |
3806 |
++ |
3807 |
++ /* Set duplex mode */ |
3808 |
++ if (phy->duplex == DUPLEX_FULL) |
3809 |
++ reg |= QCA8K_PORT_STATUS_DUPLEX; |
3810 |
++ |
3811 |
++ /* Force flow control */ |
3812 |
++ if (dsa_is_cpu_port(ds, port)) |
3813 |
++ reg |= QCA8K_PORT_STATUS_RXFLOW | QCA8K_PORT_STATUS_TXFLOW; |
3814 |
++ |
3815 |
++ /* Force link down before changing MAC options */ |
3816 |
++ qca8k_port_set_status(priv, port, 0); |
3817 |
++ qca8k_write(priv, QCA8K_REG_PORT_STATUS(port), reg); |
3818 |
++ qca8k_port_set_status(priv, port, 1); |
3819 |
++} |
3820 |
++ |
3821 |
+ static int |
3822 |
+ qca8k_phy_read(struct dsa_switch *ds, int phy, int regnum) |
3823 |
+ { |
3824 |
+@@ -831,6 +876,7 @@ qca8k_get_tag_protocol(struct dsa_switch *ds, int port) |
3825 |
+ static const struct dsa_switch_ops qca8k_switch_ops = { |
3826 |
+ .get_tag_protocol = qca8k_get_tag_protocol, |
3827 |
+ .setup = qca8k_setup, |
3828 |
++ .adjust_link = qca8k_adjust_link, |
3829 |
+ .get_strings = qca8k_get_strings, |
3830 |
+ .phy_read = qca8k_phy_read, |
3831 |
+ .phy_write = qca8k_phy_write, |
3832 |
+@@ -862,6 +908,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) |
3833 |
+ return -ENOMEM; |
3834 |
+ |
3835 |
+ priv->bus = mdiodev->bus; |
3836 |
++ priv->dev = &mdiodev->dev; |
3837 |
+ |
3838 |
+ /* read the switches ID register */ |
3839 |
+ id = qca8k_read(priv, QCA8K_REG_MASK_CTRL); |
3840 |
+@@ -933,6 +980,7 @@ static SIMPLE_DEV_PM_OPS(qca8k_pm_ops, |
3841 |
+ qca8k_suspend, qca8k_resume); |
3842 |
+ |
3843 |
+ static const struct of_device_id qca8k_of_match[] = { |
3844 |
++ { .compatible = "qca,qca8334" }, |
3845 |
+ { .compatible = "qca,qca8337" }, |
3846 |
+ { /* sentinel */ }, |
3847 |
+ }; |
3848 |
+diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h |
3849 |
+index 1cf8a920d4ff..613fe5c50236 100644 |
3850 |
+--- a/drivers/net/dsa/qca8k.h |
3851 |
++++ b/drivers/net/dsa/qca8k.h |
3852 |
+@@ -51,8 +51,10 @@ |
3853 |
+ #define QCA8K_GOL_MAC_ADDR0 0x60 |
3854 |
+ #define QCA8K_GOL_MAC_ADDR1 0x64 |
3855 |
+ #define QCA8K_REG_PORT_STATUS(_i) (0x07c + (_i) * 4) |
3856 |
+-#define QCA8K_PORT_STATUS_SPEED GENMASK(2, 0) |
3857 |
+-#define QCA8K_PORT_STATUS_SPEED_S 0 |
3858 |
++#define QCA8K_PORT_STATUS_SPEED GENMASK(1, 0) |
3859 |
++#define QCA8K_PORT_STATUS_SPEED_10 0 |
3860 |
++#define QCA8K_PORT_STATUS_SPEED_100 0x1 |
3861 |
++#define QCA8K_PORT_STATUS_SPEED_1000 0x2 |
3862 |
+ #define QCA8K_PORT_STATUS_TXMAC BIT(2) |
3863 |
+ #define QCA8K_PORT_STATUS_RXMAC BIT(3) |
3864 |
+ #define QCA8K_PORT_STATUS_TXFLOW BIT(4) |
3865 |
+@@ -165,6 +167,7 @@ struct qca8k_priv { |
3866 |
+ struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; |
3867 |
+ struct dsa_switch *ds; |
3868 |
+ struct mutex reg_mutex; |
3869 |
++ struct device *dev; |
3870 |
+ }; |
3871 |
+ |
3872 |
+ struct qca8k_mib_desc { |
3873 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c |
3874 |
+index 1b9d3130af4d..17f12c18d225 100644 |
3875 |
+--- a/drivers/net/ethernet/amazon/ena/ena_com.c |
3876 |
++++ b/drivers/net/ethernet/amazon/ena/ena_com.c |
3877 |
+@@ -333,6 +333,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev, |
3878 |
+ |
3879 |
+ memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr)); |
3880 |
+ |
3881 |
++ io_sq->dma_addr_bits = ena_dev->dma_addr_bits; |
3882 |
+ io_sq->desc_entry_size = |
3883 |
+ (io_sq->direction == ENA_COM_IO_QUEUE_DIRECTION_TX) ? |
3884 |
+ sizeof(struct ena_eth_io_tx_desc) : |
3885 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |
3886 |
+index 1b45cd73a258..119777986ea4 100644 |
3887 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |
3888 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c |
3889 |
+@@ -1128,14 +1128,14 @@ static void xgbe_phy_adjust_link(struct xgbe_prv_data *pdata) |
3890 |
+ |
3891 |
+ if (pdata->tx_pause != pdata->phy.tx_pause) { |
3892 |
+ new_state = 1; |
3893 |
+- pdata->hw_if.config_tx_flow_control(pdata); |
3894 |
+ pdata->tx_pause = pdata->phy.tx_pause; |
3895 |
++ pdata->hw_if.config_tx_flow_control(pdata); |
3896 |
+ } |
3897 |
+ |
3898 |
+ if (pdata->rx_pause != pdata->phy.rx_pause) { |
3899 |
+ new_state = 1; |
3900 |
+- pdata->hw_if.config_rx_flow_control(pdata); |
3901 |
+ pdata->rx_pause = pdata->phy.rx_pause; |
3902 |
++ pdata->hw_if.config_rx_flow_control(pdata); |
3903 |
+ } |
3904 |
+ |
3905 |
+ /* Speed support */ |
3906 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
3907 |
+index f83769d8047b..401e58939795 100644 |
3908 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
3909 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
3910 |
+@@ -6457,6 +6457,9 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state) |
3911 |
+ } |
3912 |
+ mutex_unlock(&bp->hwrm_cmd_lock); |
3913 |
+ |
3914 |
++ if (!BNXT_SINGLE_PF(bp)) |
3915 |
++ return 0; |
3916 |
++ |
3917 |
+ diff = link_info->support_auto_speeds ^ link_info->advertising; |
3918 |
+ if ((link_info->support_auto_speeds | diff) != |
3919 |
+ link_info->support_auto_speeds) { |
3920 |
+@@ -8614,8 +8617,8 @@ static int bnxt_init_mac_addr(struct bnxt *bp) |
3921 |
+ memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN); |
3922 |
+ } else { |
3923 |
+ eth_hw_addr_random(bp->dev); |
3924 |
+- rc = bnxt_approve_mac(bp, bp->dev->dev_addr); |
3925 |
+ } |
3926 |
++ rc = bnxt_approve_mac(bp, bp->dev->dev_addr); |
3927 |
+ #endif |
3928 |
+ } |
3929 |
+ return rc; |
3930 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c |
3931 |
+index f952963d594e..e1f025b2a6bc 100644 |
3932 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c |
3933 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c |
3934 |
+@@ -914,7 +914,8 @@ static int bnxt_vf_configure_mac(struct bnxt *bp, struct bnxt_vf_info *vf) |
3935 |
+ if (req->enables & cpu_to_le32(FUNC_VF_CFG_REQ_ENABLES_DFLT_MAC_ADDR)) { |
3936 |
+ if (is_valid_ether_addr(req->dflt_mac_addr) && |
3937 |
+ ((vf->flags & BNXT_VF_TRUST) || |
3938 |
+- (!is_valid_ether_addr(vf->mac_addr)))) { |
3939 |
++ !is_valid_ether_addr(vf->mac_addr) || |
3940 |
++ ether_addr_equal(req->dflt_mac_addr, vf->mac_addr))) { |
3941 |
+ ether_addr_copy(vf->vf_mac_addr, req->dflt_mac_addr); |
3942 |
+ return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); |
3943 |
+ } |
3944 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
3945 |
+index 005283c7cdfe..72c83496e01f 100644 |
3946 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
3947 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
3948 |
+@@ -3066,6 +3066,7 @@ static void cxgb_del_udp_tunnel(struct net_device *netdev, |
3949 |
+ |
3950 |
+ adapter->geneve_port = 0; |
3951 |
+ t4_write_reg(adapter, MPS_RX_GENEVE_TYPE_A, 0); |
3952 |
++ break; |
3953 |
+ default: |
3954 |
+ return; |
3955 |
+ } |
3956 |
+@@ -3151,6 +3152,7 @@ static void cxgb_add_udp_tunnel(struct net_device *netdev, |
3957 |
+ |
3958 |
+ t4_write_reg(adapter, MPS_RX_GENEVE_TYPE_A, |
3959 |
+ GENEVE_V(be16_to_cpu(ti->port)) | GENEVE_EN_F); |
3960 |
++ break; |
3961 |
+ default: |
3962 |
+ return; |
3963 |
+ } |
3964 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c |
3965 |
+index 02145f2de820..618eec654bd3 100644 |
3966 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c |
3967 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c |
3968 |
+@@ -283,3 +283,4 @@ EXPORT_SYMBOL(hnae3_unregister_ae_dev); |
3969 |
+ MODULE_AUTHOR("Huawei Tech. Co., Ltd."); |
3970 |
+ MODULE_LICENSE("GPL"); |
3971 |
+ MODULE_DESCRIPTION("HNAE3(Hisilicon Network Acceleration Engine) Framework"); |
3972 |
++MODULE_VERSION(HNAE3_MOD_VERSION); |
3973 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h |
3974 |
+index 37ec1b3286c6..67ed70fc3f0a 100644 |
3975 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h |
3976 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h |
3977 |
+@@ -36,6 +36,8 @@ |
3978 |
+ #include <linux/pci.h> |
3979 |
+ #include <linux/types.h> |
3980 |
+ |
3981 |
++#define HNAE3_MOD_VERSION "1.0" |
3982 |
++ |
3983 |
+ /* Device IDs */ |
3984 |
+ #define HNAE3_DEV_ID_GE 0xA220 |
3985 |
+ #define HNAE3_DEV_ID_25GE 0xA221 |
3986 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
3987 |
+index 8c55965a66ac..c23ba15d5e8f 100644 |
3988 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
3989 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
3990 |
+@@ -1836,6 +1836,7 @@ static void hns3_replace_buffer(struct hns3_enet_ring *ring, int i, |
3991 |
+ hns3_unmap_buffer(ring, &ring->desc_cb[i]); |
3992 |
+ ring->desc_cb[i] = *res_cb; |
3993 |
+ ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma); |
3994 |
++ ring->desc[i].rx.bd_base_info = 0; |
3995 |
+ } |
3996 |
+ |
3997 |
+ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i) |
3998 |
+@@ -1843,6 +1844,7 @@ static void hns3_reuse_buffer(struct hns3_enet_ring *ring, int i) |
3999 |
+ ring->desc_cb[i].reuse_flag = 0; |
4000 |
+ ring->desc[i].addr = cpu_to_le64(ring->desc_cb[i].dma |
4001 |
+ + ring->desc_cb[i].page_offset); |
4002 |
++ ring->desc[i].rx.bd_base_info = 0; |
4003 |
+ } |
4004 |
+ |
4005 |
+ static void hns3_nic_reclaim_one_desc(struct hns3_enet_ring *ring, int *bytes, |
4006 |
+@@ -3600,6 +3602,8 @@ static int __init hns3_init_module(void) |
4007 |
+ |
4008 |
+ client.ops = &client_ops; |
4009 |
+ |
4010 |
++ INIT_LIST_HEAD(&client.node); |
4011 |
++ |
4012 |
+ ret = hnae3_register_client(&client); |
4013 |
+ if (ret) |
4014 |
+ return ret; |
4015 |
+@@ -3627,3 +3631,4 @@ MODULE_DESCRIPTION("HNS3: Hisilicon Ethernet Driver"); |
4016 |
+ MODULE_AUTHOR("Huawei Tech. Co., Ltd."); |
4017 |
+ MODULE_LICENSE("GPL"); |
4018 |
+ MODULE_ALIAS("pci:hns-nic"); |
4019 |
++MODULE_VERSION(HNS3_MOD_VERSION); |
4020 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h |
4021 |
+index 98cdbd3a1163..5b40f5a53761 100644 |
4022 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h |
4023 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h |
4024 |
+@@ -14,6 +14,8 @@ |
4025 |
+ |
4026 |
+ #include "hnae3.h" |
4027 |
+ |
4028 |
++#define HNS3_MOD_VERSION "1.0" |
4029 |
++ |
4030 |
+ extern const char hns3_driver_version[]; |
4031 |
+ |
4032 |
+ enum hns3_nic_state { |
4033 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
4034 |
+index 2066dd734444..553eaa476b19 100644 |
4035 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
4036 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
4037 |
+@@ -1459,8 +1459,11 @@ static int hclge_alloc_vport(struct hclge_dev *hdev) |
4038 |
+ /* We need to alloc a vport for main NIC of PF */ |
4039 |
+ num_vport = hdev->num_vmdq_vport + hdev->num_req_vfs + 1; |
4040 |
+ |
4041 |
+- if (hdev->num_tqps < num_vport) |
4042 |
+- num_vport = hdev->num_tqps; |
4043 |
++ if (hdev->num_tqps < num_vport) { |
4044 |
++ dev_err(&hdev->pdev->dev, "tqps(%d) is less than vports(%d)", |
4045 |
++ hdev->num_tqps, num_vport); |
4046 |
++ return -EINVAL; |
4047 |
++ } |
4048 |
+ |
4049 |
+ /* Alloc the same number of TQPs for every vport */ |
4050 |
+ tqp_per_vport = hdev->num_tqps / num_vport; |
4051 |
+@@ -3783,13 +3786,11 @@ static int hclge_ae_start(struct hnae3_handle *handle) |
4052 |
+ hclge_cfg_mac_mode(hdev, true); |
4053 |
+ clear_bit(HCLGE_STATE_DOWN, &hdev->state); |
4054 |
+ mod_timer(&hdev->service_timer, jiffies + HZ); |
4055 |
++ hdev->hw.mac.link = 0; |
4056 |
+ |
4057 |
+ /* reset tqp stats */ |
4058 |
+ hclge_reset_tqp_stats(handle); |
4059 |
+ |
4060 |
+- if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state)) |
4061 |
+- return 0; |
4062 |
+- |
4063 |
+ ret = hclge_mac_start_phy(hdev); |
4064 |
+ if (ret) |
4065 |
+ return ret; |
4066 |
+@@ -3805,9 +3806,12 @@ static void hclge_ae_stop(struct hnae3_handle *handle) |
4067 |
+ |
4068 |
+ del_timer_sync(&hdev->service_timer); |
4069 |
+ cancel_work_sync(&hdev->service_task); |
4070 |
++ clear_bit(HCLGE_STATE_SERVICE_SCHED, &hdev->state); |
4071 |
+ |
4072 |
+- if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state)) |
4073 |
++ if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state)) { |
4074 |
++ hclge_mac_stop_phy(hdev); |
4075 |
+ return; |
4076 |
++ } |
4077 |
+ |
4078 |
+ for (i = 0; i < vport->alloc_tqps; i++) |
4079 |
+ hclge_tqp_enable(hdev, i, 0, false); |
4080 |
+@@ -3819,7 +3823,6 @@ static void hclge_ae_stop(struct hnae3_handle *handle) |
4081 |
+ |
4082 |
+ /* reset tqp stats */ |
4083 |
+ hclge_reset_tqp_stats(handle); |
4084 |
+- hclge_update_link_status(hdev); |
4085 |
+ } |
4086 |
+ |
4087 |
+ static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport, |
4088 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |
4089 |
+index 0f4157e71282..7c88b65353cc 100644 |
4090 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |
4091 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |
4092 |
+@@ -15,7 +15,7 @@ |
4093 |
+ #include "hclge_cmd.h" |
4094 |
+ #include "hnae3.h" |
4095 |
+ |
4096 |
+-#define HCLGE_MOD_VERSION "v1.0" |
4097 |
++#define HCLGE_MOD_VERSION "1.0" |
4098 |
+ #define HCLGE_DRIVER_NAME "hclge" |
4099 |
+ |
4100 |
+ #define HCLGE_INVALID_VPORT 0xffff |
4101 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
4102 |
+index 2b8426412cc9..7a6510314657 100644 |
4103 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
4104 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
4105 |
+@@ -1323,6 +1323,7 @@ static void hclgevf_ae_stop(struct hnae3_handle *handle) |
4106 |
+ hclgevf_reset_tqp_stats(handle); |
4107 |
+ del_timer_sync(&hdev->service_timer); |
4108 |
+ cancel_work_sync(&hdev->service_task); |
4109 |
++ clear_bit(HCLGEVF_STATE_SERVICE_SCHED, &hdev->state); |
4110 |
+ hclgevf_update_link_status(hdev, 0); |
4111 |
+ } |
4112 |
+ |
4113 |
+@@ -1441,6 +1442,8 @@ static int hclgevf_misc_irq_init(struct hclgevf_dev *hdev) |
4114 |
+ return ret; |
4115 |
+ } |
4116 |
+ |
4117 |
++ hclgevf_clear_event_cause(hdev, 0); |
4118 |
++ |
4119 |
+ /* enable misc. vector(vector 0) */ |
4120 |
+ hclgevf_enable_vector(&hdev->misc_vector, true); |
4121 |
+ |
4122 |
+@@ -1451,6 +1454,7 @@ static void hclgevf_misc_irq_uninit(struct hclgevf_dev *hdev) |
4123 |
+ { |
4124 |
+ /* disable misc vector(vector 0) */ |
4125 |
+ hclgevf_enable_vector(&hdev->misc_vector, false); |
4126 |
++ synchronize_irq(hdev->misc_vector.vector_irq); |
4127 |
+ free_irq(hdev->misc_vector.vector_irq, hdev); |
4128 |
+ hclgevf_free_vector(hdev, 0); |
4129 |
+ } |
4130 |
+@@ -1489,10 +1493,12 @@ static int hclgevf_init_instance(struct hclgevf_dev *hdev, |
4131 |
+ return ret; |
4132 |
+ break; |
4133 |
+ case HNAE3_CLIENT_ROCE: |
4134 |
+- hdev->roce_client = client; |
4135 |
+- hdev->roce.client = client; |
4136 |
++ if (hnae3_dev_roce_supported(hdev)) { |
4137 |
++ hdev->roce_client = client; |
4138 |
++ hdev->roce.client = client; |
4139 |
++ } |
4140 |
+ |
4141 |
+- if (hdev->roce_client && hnae3_dev_roce_supported(hdev)) { |
4142 |
++ if (hdev->roce_client && hdev->nic_client) { |
4143 |
+ ret = hclgevf_init_roce_base_info(hdev); |
4144 |
+ if (ret) |
4145 |
+ return ret; |
4146 |
+@@ -1625,6 +1631,10 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) |
4147 |
+ |
4148 |
+ hclgevf_state_init(hdev); |
4149 |
+ |
4150 |
++ ret = hclgevf_cmd_init(hdev); |
4151 |
++ if (ret) |
4152 |
++ goto err_cmd_init; |
4153 |
++ |
4154 |
+ ret = hclgevf_misc_irq_init(hdev); |
4155 |
+ if (ret) { |
4156 |
+ dev_err(&pdev->dev, "failed(%d) to init Misc IRQ(vector0)\n", |
4157 |
+@@ -1632,10 +1642,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) |
4158 |
+ goto err_misc_irq_init; |
4159 |
+ } |
4160 |
+ |
4161 |
+- ret = hclgevf_cmd_init(hdev); |
4162 |
+- if (ret) |
4163 |
+- goto err_cmd_init; |
4164 |
+- |
4165 |
+ ret = hclgevf_configure(hdev); |
4166 |
+ if (ret) { |
4167 |
+ dev_err(&pdev->dev, "failed(%d) to fetch configuration\n", ret); |
4168 |
+@@ -1683,10 +1689,10 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) |
4169 |
+ return 0; |
4170 |
+ |
4171 |
+ err_config: |
4172 |
+- hclgevf_cmd_uninit(hdev); |
4173 |
+-err_cmd_init: |
4174 |
+ hclgevf_misc_irq_uninit(hdev); |
4175 |
+ err_misc_irq_init: |
4176 |
++ hclgevf_cmd_uninit(hdev); |
4177 |
++err_cmd_init: |
4178 |
+ hclgevf_state_uninit(hdev); |
4179 |
+ hclgevf_uninit_msi(hdev); |
4180 |
+ err_irq_init: |
4181 |
+@@ -1696,9 +1702,9 @@ err_irq_init: |
4182 |
+ |
4183 |
+ static void hclgevf_uninit_hdev(struct hclgevf_dev *hdev) |
4184 |
+ { |
4185 |
+- hclgevf_cmd_uninit(hdev); |
4186 |
+- hclgevf_misc_irq_uninit(hdev); |
4187 |
+ hclgevf_state_uninit(hdev); |
4188 |
++ hclgevf_misc_irq_uninit(hdev); |
4189 |
++ hclgevf_cmd_uninit(hdev); |
4190 |
+ hclgevf_uninit_msi(hdev); |
4191 |
+ hclgevf_pci_uninit(hdev); |
4192 |
+ } |
4193 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h |
4194 |
+index a477a7c36bbd..9763e742e6fb 100644 |
4195 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h |
4196 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h |
4197 |
+@@ -9,7 +9,7 @@ |
4198 |
+ #include "hclgevf_cmd.h" |
4199 |
+ #include "hnae3.h" |
4200 |
+ |
4201 |
+-#define HCLGEVF_MOD_VERSION "v1.0" |
4202 |
++#define HCLGEVF_MOD_VERSION "1.0" |
4203 |
+ #define HCLGEVF_DRIVER_NAME "hclgevf" |
4204 |
+ |
4205 |
+ #define HCLGEVF_ROCEE_VECTOR_NUM 0 |
4206 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
4207 |
+index ec4a9759a6f2..3afb1f3b6f91 100644 |
4208 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
4209 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
4210 |
+@@ -3546,15 +3546,12 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca) |
4211 |
+ } |
4212 |
+ break; |
4213 |
+ case e1000_pch_spt: |
4214 |
+- if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) { |
4215 |
+- /* Stable 24MHz frequency */ |
4216 |
+- incperiod = INCPERIOD_24MHZ; |
4217 |
+- incvalue = INCVALUE_24MHZ; |
4218 |
+- shift = INCVALUE_SHIFT_24MHZ; |
4219 |
+- adapter->cc.shift = shift; |
4220 |
+- break; |
4221 |
+- } |
4222 |
+- return -EINVAL; |
4223 |
++ /* Stable 24MHz frequency */ |
4224 |
++ incperiod = INCPERIOD_24MHZ; |
4225 |
++ incvalue = INCVALUE_24MHZ; |
4226 |
++ shift = INCVALUE_SHIFT_24MHZ; |
4227 |
++ adapter->cc.shift = shift; |
4228 |
++ break; |
4229 |
+ case e1000_pch_cnp: |
4230 |
+ if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) { |
4231 |
+ /* Stable 24MHz frequency */ |
4232 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h |
4233 |
+index a44139c1de80..12ba0b9f238b 100644 |
4234 |
+--- a/drivers/net/ethernet/intel/i40e/i40e.h |
4235 |
++++ b/drivers/net/ethernet/intel/i40e/i40e.h |
4236 |
+@@ -608,7 +608,7 @@ struct i40e_pf { |
4237 |
+ unsigned long ptp_tx_start; |
4238 |
+ struct hwtstamp_config tstamp_config; |
4239 |
+ struct mutex tmreg_lock; /* Used to protect the SYSTIME registers. */ |
4240 |
+- u64 ptp_base_adj; |
4241 |
++ u32 ptp_adj_mult; |
4242 |
+ u32 tx_hwtstamp_timeouts; |
4243 |
+ u32 tx_hwtstamp_skipped; |
4244 |
+ u32 rx_hwtstamp_cleared; |
4245 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
4246 |
+index b974482ff630..c5e3d5f406ec 100644 |
4247 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
4248 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c |
4249 |
+@@ -977,7 +977,9 @@ static int i40e_set_link_ksettings(struct net_device *netdev, |
4250 |
+ ethtool_link_ksettings_test_link_mode(ks, advertising, |
4251 |
+ 10000baseCR_Full) || |
4252 |
+ ethtool_link_ksettings_test_link_mode(ks, advertising, |
4253 |
+- 10000baseSR_Full)) |
4254 |
++ 10000baseSR_Full) || |
4255 |
++ ethtool_link_ksettings_test_link_mode(ks, advertising, |
4256 |
++ 10000baseLR_Full)) |
4257 |
+ config.link_speed |= I40E_LINK_SPEED_10GB; |
4258 |
+ if (ethtool_link_ksettings_test_link_mode(ks, advertising, |
4259 |
+ 20000baseKR2_Full)) |
4260 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c |
4261 |
+index 5b47dd1f75a5..1a8e0cad787f 100644 |
4262 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c |
4263 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c |
4264 |
+@@ -40,9 +40,9 @@ |
4265 |
+ * At 1Gb link, the period is multiplied by 20. (32ns) |
4266 |
+ * 1588 functionality is not supported at 100Mbps. |
4267 |
+ */ |
4268 |
+-#define I40E_PTP_40GB_INCVAL 0x0199999999ULL |
4269 |
+-#define I40E_PTP_10GB_INCVAL 0x0333333333ULL |
4270 |
+-#define I40E_PTP_1GB_INCVAL 0x2000000000ULL |
4271 |
++#define I40E_PTP_40GB_INCVAL 0x0199999999ULL |
4272 |
++#define I40E_PTP_10GB_INCVAL_MULT 2 |
4273 |
++#define I40E_PTP_1GB_INCVAL_MULT 20 |
4274 |
+ |
4275 |
+ #define I40E_PRTTSYN_CTL1_TSYNTYPE_V1 BIT(I40E_PRTTSYN_CTL1_TSYNTYPE_SHIFT) |
4276 |
+ #define I40E_PRTTSYN_CTL1_TSYNTYPE_V2 (2 << \ |
4277 |
+@@ -130,17 +130,24 @@ static int i40e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) |
4278 |
+ ppb = -ppb; |
4279 |
+ } |
4280 |
+ |
4281 |
+- smp_mb(); /* Force any pending update before accessing. */ |
4282 |
+- adj = READ_ONCE(pf->ptp_base_adj); |
4283 |
+- |
4284 |
+- freq = adj; |
4285 |
++ freq = I40E_PTP_40GB_INCVAL; |
4286 |
+ freq *= ppb; |
4287 |
+ diff = div_u64(freq, 1000000000ULL); |
4288 |
+ |
4289 |
+ if (neg_adj) |
4290 |
+- adj -= diff; |
4291 |
++ adj = I40E_PTP_40GB_INCVAL - diff; |
4292 |
+ else |
4293 |
+- adj += diff; |
4294 |
++ adj = I40E_PTP_40GB_INCVAL + diff; |
4295 |
++ |
4296 |
++ /* At some link speeds, the base incval is so large that directly |
4297 |
++ * multiplying by ppb would result in arithmetic overflow even when |
4298 |
++ * using a u64. Avoid this by instead calculating the new incval |
4299 |
++ * always in terms of the 40GbE clock rate and then multiplying by the |
4300 |
++ * link speed factor afterwards. This does result in slightly lower |
4301 |
++ * precision at lower link speeds, but it is fairly minor. |
4302 |
++ */ |
4303 |
++ smp_mb(); /* Force any pending update before accessing. */ |
4304 |
++ adj *= READ_ONCE(pf->ptp_adj_mult); |
4305 |
+ |
4306 |
+ wr32(hw, I40E_PRTTSYN_INC_L, adj & 0xFFFFFFFF); |
4307 |
+ wr32(hw, I40E_PRTTSYN_INC_H, adj >> 32); |
4308 |
+@@ -338,6 +345,8 @@ void i40e_ptp_rx_hang(struct i40e_pf *pf) |
4309 |
+ **/ |
4310 |
+ void i40e_ptp_tx_hang(struct i40e_pf *pf) |
4311 |
+ { |
4312 |
++ struct sk_buff *skb; |
4313 |
++ |
4314 |
+ if (!(pf->flags & I40E_FLAG_PTP) || !pf->ptp_tx) |
4315 |
+ return; |
4316 |
+ |
4317 |
+@@ -350,9 +359,12 @@ void i40e_ptp_tx_hang(struct i40e_pf *pf) |
4318 |
+ * within a second it is reasonable to assume that we never will. |
4319 |
+ */ |
4320 |
+ if (time_is_before_jiffies(pf->ptp_tx_start + HZ)) { |
4321 |
+- dev_kfree_skb_any(pf->ptp_tx_skb); |
4322 |
++ skb = pf->ptp_tx_skb; |
4323 |
+ pf->ptp_tx_skb = NULL; |
4324 |
+ clear_bit_unlock(__I40E_PTP_TX_IN_PROGRESS, pf->state); |
4325 |
++ |
4326 |
++ /* Free the skb after we clear the bitlock */ |
4327 |
++ dev_kfree_skb_any(skb); |
4328 |
+ pf->tx_hwtstamp_timeouts++; |
4329 |
+ } |
4330 |
+ } |
4331 |
+@@ -462,6 +474,7 @@ void i40e_ptp_set_increment(struct i40e_pf *pf) |
4332 |
+ struct i40e_link_status *hw_link_info; |
4333 |
+ struct i40e_hw *hw = &pf->hw; |
4334 |
+ u64 incval; |
4335 |
++ u32 mult; |
4336 |
+ |
4337 |
+ hw_link_info = &hw->phy.link_info; |
4338 |
+ |
4339 |
+@@ -469,10 +482,10 @@ void i40e_ptp_set_increment(struct i40e_pf *pf) |
4340 |
+ |
4341 |
+ switch (hw_link_info->link_speed) { |
4342 |
+ case I40E_LINK_SPEED_10GB: |
4343 |
+- incval = I40E_PTP_10GB_INCVAL; |
4344 |
++ mult = I40E_PTP_10GB_INCVAL_MULT; |
4345 |
+ break; |
4346 |
+ case I40E_LINK_SPEED_1GB: |
4347 |
+- incval = I40E_PTP_1GB_INCVAL; |
4348 |
++ mult = I40E_PTP_1GB_INCVAL_MULT; |
4349 |
+ break; |
4350 |
+ case I40E_LINK_SPEED_100MB: |
4351 |
+ { |
4352 |
+@@ -483,15 +496,20 @@ void i40e_ptp_set_increment(struct i40e_pf *pf) |
4353 |
+ "1588 functionality is not supported at 100 Mbps. Stopping the PHC.\n"); |
4354 |
+ warn_once++; |
4355 |
+ } |
4356 |
+- incval = 0; |
4357 |
++ mult = 0; |
4358 |
+ break; |
4359 |
+ } |
4360 |
+ case I40E_LINK_SPEED_40GB: |
4361 |
+ default: |
4362 |
+- incval = I40E_PTP_40GB_INCVAL; |
4363 |
++ mult = 1; |
4364 |
+ break; |
4365 |
+ } |
4366 |
+ |
4367 |
++ /* The increment value is calculated by taking the base 40GbE incvalue |
4368 |
++ * and multiplying it by a factor based on the link speed. |
4369 |
++ */ |
4370 |
++ incval = I40E_PTP_40GB_INCVAL * mult; |
4371 |
++ |
4372 |
+ /* Write the new increment value into the increment register. The |
4373 |
+ * hardware will not update the clock until both registers have been |
4374 |
+ * written. |
4375 |
+@@ -500,7 +518,7 @@ void i40e_ptp_set_increment(struct i40e_pf *pf) |
4376 |
+ wr32(hw, I40E_PRTTSYN_INC_H, incval >> 32); |
4377 |
+ |
4378 |
+ /* Update the base adjustement value. */ |
4379 |
+- WRITE_ONCE(pf->ptp_base_adj, incval); |
4380 |
++ WRITE_ONCE(pf->ptp_adj_mult, mult); |
4381 |
+ smp_mb(); /* Force the above update. */ |
4382 |
+ } |
4383 |
+ |
4384 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
4385 |
+index cce7ada89255..9afee130c2aa 100644 |
4386 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
4387 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
4388 |
+@@ -8763,12 +8763,17 @@ static void igb_rar_set_index(struct igb_adapter *adapter, u32 index) |
4389 |
+ if (is_valid_ether_addr(addr)) |
4390 |
+ rar_high |= E1000_RAH_AV; |
4391 |
+ |
4392 |
+- if (hw->mac.type == e1000_82575) |
4393 |
++ switch (hw->mac.type) { |
4394 |
++ case e1000_82575: |
4395 |
++ case e1000_i210: |
4396 |
+ rar_high |= E1000_RAH_POOL_1 * |
4397 |
+ adapter->mac_table[index].queue; |
4398 |
+- else |
4399 |
++ break; |
4400 |
++ default: |
4401 |
+ rar_high |= E1000_RAH_POOL_1 << |
4402 |
+ adapter->mac_table[index].queue; |
4403 |
++ break; |
4404 |
++ } |
4405 |
+ } |
4406 |
+ |
4407 |
+ wr32(E1000_RAL(index), rar_low); |
4408 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c |
4409 |
+index ed4cbe94c355..4da10b44b7d3 100644 |
4410 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c |
4411 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c |
4412 |
+@@ -618,6 +618,14 @@ static bool ixgbe_set_sriov_queues(struct ixgbe_adapter *adapter) |
4413 |
+ } |
4414 |
+ |
4415 |
+ #endif |
4416 |
++ /* To support macvlan offload we have to use num_tc to |
4417 |
++ * restrict the queues that can be used by the device. |
4418 |
++ * By doing this we can avoid reporting a false number of |
4419 |
++ * queues. |
4420 |
++ */ |
4421 |
++ if (vmdq_i > 1) |
4422 |
++ netdev_set_num_tc(adapter->netdev, 1); |
4423 |
++ |
4424 |
+ /* populate TC0 for use by pool 0 */ |
4425 |
+ netdev_set_tc_queue(adapter->netdev, 0, |
4426 |
+ adapter->num_rx_queues_per_pool, 0); |
4427 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
4428 |
+index a820a6cd831a..d91a5a59c71a 100644 |
4429 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
4430 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
4431 |
+@@ -8875,14 +8875,6 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) |
4432 |
+ } else { |
4433 |
+ netdev_reset_tc(dev); |
4434 |
+ |
4435 |
+- /* To support macvlan offload we have to use num_tc to |
4436 |
+- * restrict the queues that can be used by the device. |
4437 |
+- * By doing this we can avoid reporting a false number of |
4438 |
+- * queues. |
4439 |
+- */ |
4440 |
+- if (!tc && adapter->num_rx_pools > 1) |
4441 |
+- netdev_set_num_tc(dev, 1); |
4442 |
+- |
4443 |
+ if (adapter->hw.mac.type == ixgbe_mac_82598EB) |
4444 |
+ adapter->hw.fc.requested_mode = adapter->last_lfc_mode; |
4445 |
+ |
4446 |
+diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |
4447 |
+index 850f8af95e49..043b695d2a61 100644 |
4448 |
+--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |
4449 |
++++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |
4450 |
+@@ -4187,6 +4187,7 @@ static int ixgbevf_set_mac(struct net_device *netdev, void *p) |
4451 |
+ return -EPERM; |
4452 |
+ |
4453 |
+ ether_addr_copy(hw->mac.addr, addr->sa_data); |
4454 |
++ ether_addr_copy(hw->mac.perm_addr, addr->sa_data); |
4455 |
+ ether_addr_copy(netdev->dev_addr, addr->sa_data); |
4456 |
+ |
4457 |
+ return 0; |
4458 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c |
4459 |
+index 6f410235987c..3bc5690d8376 100644 |
4460 |
+--- a/drivers/net/ethernet/marvell/mvpp2.c |
4461 |
++++ b/drivers/net/ethernet/marvell/mvpp2.c |
4462 |
+@@ -2109,6 +2109,9 @@ static void mvpp2_prs_dsa_tag_set(struct mvpp2 *priv, int port, bool add, |
4463 |
+ mvpp2_prs_sram_ai_update(&pe, 0, |
4464 |
+ MVPP2_PRS_SRAM_AI_MASK); |
4465 |
+ |
4466 |
++ /* Set result info bits to 'single vlan' */ |
4467 |
++ mvpp2_prs_sram_ri_update(&pe, MVPP2_PRS_RI_VLAN_SINGLE, |
4468 |
++ MVPP2_PRS_RI_VLAN_MASK); |
4469 |
+ /* If packet is tagged continue check vid filtering */ |
4470 |
+ mvpp2_prs_sram_next_lu_set(&pe, MVPP2_PRS_LU_VID); |
4471 |
+ } else { |
4472 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
4473 |
+index 1904c0323d39..692855183187 100644 |
4474 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
4475 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c |
4476 |
+@@ -5882,24 +5882,24 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event, |
4477 |
+ switch (info->family) { |
4478 |
+ case AF_INET: |
4479 |
+ if (!fib4_rule_default(rule) && !rule->l3mdev) |
4480 |
+- err = -1; |
4481 |
++ err = -EOPNOTSUPP; |
4482 |
+ break; |
4483 |
+ case AF_INET6: |
4484 |
+ if (!fib6_rule_default(rule) && !rule->l3mdev) |
4485 |
+- err = -1; |
4486 |
++ err = -EOPNOTSUPP; |
4487 |
+ break; |
4488 |
+ case RTNL_FAMILY_IPMR: |
4489 |
+ if (!ipmr_rule_default(rule) && !rule->l3mdev) |
4490 |
+- err = -1; |
4491 |
++ err = -EOPNOTSUPP; |
4492 |
+ break; |
4493 |
+ case RTNL_FAMILY_IP6MR: |
4494 |
+ if (!ip6mr_rule_default(rule) && !rule->l3mdev) |
4495 |
+- err = -1; |
4496 |
++ err = -EOPNOTSUPP; |
4497 |
+ break; |
4498 |
+ } |
4499 |
+ |
4500 |
+ if (err < 0) |
4501 |
+- NL_SET_ERR_MSG_MOD(extack, "FIB rules not supported. Aborting offload"); |
4502 |
++ NL_SET_ERR_MSG_MOD(extack, "FIB rules not supported"); |
4503 |
+ |
4504 |
+ return err; |
4505 |
+ } |
4506 |
+@@ -5926,8 +5926,8 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb, |
4507 |
+ case FIB_EVENT_RULE_DEL: |
4508 |
+ err = mlxsw_sp_router_fib_rule_event(event, info, |
4509 |
+ router->mlxsw_sp); |
4510 |
+- if (!err) |
4511 |
+- return NOTIFY_DONE; |
4512 |
++ if (!err || info->extack) |
4513 |
++ return notifier_from_errno(err); |
4514 |
+ } |
4515 |
+ |
4516 |
+ fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC); |
4517 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
4518 |
+index 4ed01182a82c..0ae2da9d08c7 100644 |
4519 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
4520 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
4521 |
+@@ -1013,8 +1013,10 @@ mlxsw_sp_port_vlan_bridge_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan, |
4522 |
+ int err; |
4523 |
+ |
4524 |
+ /* No need to continue if only VLAN flags were changed */ |
4525 |
+- if (mlxsw_sp_port_vlan->bridge_port) |
4526 |
++ if (mlxsw_sp_port_vlan->bridge_port) { |
4527 |
++ mlxsw_sp_port_vlan_put(mlxsw_sp_port_vlan); |
4528 |
+ return 0; |
4529 |
++ } |
4530 |
+ |
4531 |
+ err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port); |
4532 |
+ if (err) |
4533 |
+diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c |
4534 |
+index 59fbf74dcada..dd963cd255f0 100644 |
4535 |
+--- a/drivers/net/ethernet/socionext/netsec.c |
4536 |
++++ b/drivers/net/ethernet/socionext/netsec.c |
4537 |
+@@ -1057,7 +1057,8 @@ static int netsec_netdev_load_microcode(struct netsec_priv *priv) |
4538 |
+ return 0; |
4539 |
+ } |
4540 |
+ |
4541 |
+-static int netsec_reset_hardware(struct netsec_priv *priv) |
4542 |
++static int netsec_reset_hardware(struct netsec_priv *priv, |
4543 |
++ bool load_ucode) |
4544 |
+ { |
4545 |
+ u32 value; |
4546 |
+ int err; |
4547 |
+@@ -1102,11 +1103,14 @@ static int netsec_reset_hardware(struct netsec_priv *priv) |
4548 |
+ netsec_write(priv, NETSEC_REG_NRM_RX_CONFIG, |
4549 |
+ 1 << NETSEC_REG_DESC_ENDIAN); |
4550 |
+ |
4551 |
+- err = netsec_netdev_load_microcode(priv); |
4552 |
+- if (err) { |
4553 |
+- netif_err(priv, probe, priv->ndev, |
4554 |
+- "%s: failed to load microcode (%d)\n", __func__, err); |
4555 |
+- return err; |
4556 |
++ if (load_ucode) { |
4557 |
++ err = netsec_netdev_load_microcode(priv); |
4558 |
++ if (err) { |
4559 |
++ netif_err(priv, probe, priv->ndev, |
4560 |
++ "%s: failed to load microcode (%d)\n", |
4561 |
++ __func__, err); |
4562 |
++ return err; |
4563 |
++ } |
4564 |
+ } |
4565 |
+ |
4566 |
+ /* start DMA engines */ |
4567 |
+@@ -1328,6 +1332,7 @@ err1: |
4568 |
+ |
4569 |
+ static int netsec_netdev_stop(struct net_device *ndev) |
4570 |
+ { |
4571 |
++ int ret; |
4572 |
+ struct netsec_priv *priv = netdev_priv(ndev); |
4573 |
+ |
4574 |
+ netif_stop_queue(priv->ndev); |
4575 |
+@@ -1343,12 +1348,14 @@ static int netsec_netdev_stop(struct net_device *ndev) |
4576 |
+ netsec_uninit_pkt_dring(priv, NETSEC_RING_TX); |
4577 |
+ netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); |
4578 |
+ |
4579 |
++ ret = netsec_reset_hardware(priv, false); |
4580 |
++ |
4581 |
+ phy_stop(ndev->phydev); |
4582 |
+ phy_disconnect(ndev->phydev); |
4583 |
+ |
4584 |
+ pm_runtime_put_sync(priv->dev); |
4585 |
+ |
4586 |
+- return 0; |
4587 |
++ return ret; |
4588 |
+ } |
4589 |
+ |
4590 |
+ static int netsec_netdev_init(struct net_device *ndev) |
4591 |
+@@ -1364,7 +1371,7 @@ static int netsec_netdev_init(struct net_device *ndev) |
4592 |
+ if (ret) |
4593 |
+ goto err1; |
4594 |
+ |
4595 |
+- ret = netsec_reset_hardware(priv); |
4596 |
++ ret = netsec_reset_hardware(priv, true); |
4597 |
+ if (ret) |
4598 |
+ goto err2; |
4599 |
+ |
4600 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
4601 |
+index 1e1cc5256eca..57491da89140 100644 |
4602 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
4603 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
4604 |
+@@ -51,7 +51,7 @@ |
4605 |
+ #include <linux/of_mdio.h> |
4606 |
+ #include "dwmac1000.h" |
4607 |
+ |
4608 |
+-#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x) |
4609 |
++#define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES) |
4610 |
+ #define TSO_MAX_BUFF_SIZE (SZ_16K - 1) |
4611 |
+ |
4612 |
+ /* Module parameters */ |
4613 |
+diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c |
4614 |
+index 18013645e76c..0c1adad7415d 100644 |
4615 |
+--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c |
4616 |
++++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c |
4617 |
+@@ -177,12 +177,18 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave) |
4618 |
+ } |
4619 |
+ |
4620 |
+ dev = bus_find_device(&platform_bus_type, NULL, node, match); |
4621 |
+- of_node_put(node); |
4622 |
++ if (!dev) { |
4623 |
++ dev_err(dev, "unable to find platform device for %pOF\n", node); |
4624 |
++ goto out; |
4625 |
++ } |
4626 |
++ |
4627 |
+ priv = dev_get_drvdata(dev); |
4628 |
+ |
4629 |
+ priv->cpsw_phy_sel(priv, phy_mode, slave); |
4630 |
+ |
4631 |
+ put_device(dev); |
4632 |
++out: |
4633 |
++ of_node_put(node); |
4634 |
+ } |
4635 |
+ EXPORT_SYMBOL_GPL(cpsw_phy_sel); |
4636 |
+ |
4637 |
+diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h |
4638 |
+index eaeee3201e8f..37096bf29033 100644 |
4639 |
+--- a/drivers/net/hyperv/hyperv_net.h |
4640 |
++++ b/drivers/net/hyperv/hyperv_net.h |
4641 |
+@@ -738,6 +738,8 @@ struct net_device_context { |
4642 |
+ struct hv_device *device_ctx; |
4643 |
+ /* netvsc_device */ |
4644 |
+ struct netvsc_device __rcu *nvdev; |
4645 |
++ /* list of netvsc net_devices */ |
4646 |
++ struct list_head list; |
4647 |
+ /* reconfigure work */ |
4648 |
+ struct delayed_work dwork; |
4649 |
+ /* last reconfig time */ |
4650 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
4651 |
+index 82c3c8e200f0..adc176943d94 100644 |
4652 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
4653 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
4654 |
+@@ -69,6 +69,8 @@ static int debug = -1; |
4655 |
+ module_param(debug, int, 0444); |
4656 |
+ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
4657 |
+ |
4658 |
++static LIST_HEAD(netvsc_dev_list); |
4659 |
++ |
4660 |
+ static void netvsc_change_rx_flags(struct net_device *net, int change) |
4661 |
+ { |
4662 |
+ struct net_device_context *ndev_ctx = netdev_priv(net); |
4663 |
+@@ -1779,13 +1781,10 @@ out_unlock: |
4664 |
+ |
4665 |
+ static struct net_device *get_netvsc_bymac(const u8 *mac) |
4666 |
+ { |
4667 |
+- struct net_device *dev; |
4668 |
+- |
4669 |
+- ASSERT_RTNL(); |
4670 |
++ struct net_device_context *ndev_ctx; |
4671 |
+ |
4672 |
+- for_each_netdev(&init_net, dev) { |
4673 |
+- if (dev->netdev_ops != &device_ops) |
4674 |
+- continue; /* not a netvsc device */ |
4675 |
++ list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { |
4676 |
++ struct net_device *dev = hv_get_drvdata(ndev_ctx->device_ctx); |
4677 |
+ |
4678 |
+ if (ether_addr_equal(mac, dev->perm_addr)) |
4679 |
+ return dev; |
4680 |
+@@ -1796,25 +1795,18 @@ static struct net_device *get_netvsc_bymac(const u8 *mac) |
4681 |
+ |
4682 |
+ static struct net_device *get_netvsc_byref(struct net_device *vf_netdev) |
4683 |
+ { |
4684 |
++ struct net_device_context *net_device_ctx; |
4685 |
+ struct net_device *dev; |
4686 |
+ |
4687 |
+- ASSERT_RTNL(); |
4688 |
+- |
4689 |
+- for_each_netdev(&init_net, dev) { |
4690 |
+- struct net_device_context *net_device_ctx; |
4691 |
++ dev = netdev_master_upper_dev_get(vf_netdev); |
4692 |
++ if (!dev || dev->netdev_ops != &device_ops) |
4693 |
++ return NULL; /* not a netvsc device */ |
4694 |
+ |
4695 |
+- if (dev->netdev_ops != &device_ops) |
4696 |
+- continue; /* not a netvsc device */ |
4697 |
++ net_device_ctx = netdev_priv(dev); |
4698 |
++ if (!rtnl_dereference(net_device_ctx->nvdev)) |
4699 |
++ return NULL; /* device is removed */ |
4700 |
+ |
4701 |
+- net_device_ctx = netdev_priv(dev); |
4702 |
+- if (!rtnl_dereference(net_device_ctx->nvdev)) |
4703 |
+- continue; /* device is removed */ |
4704 |
+- |
4705 |
+- if (rtnl_dereference(net_device_ctx->vf_netdev) == vf_netdev) |
4706 |
+- return dev; /* a match */ |
4707 |
+- } |
4708 |
+- |
4709 |
+- return NULL; |
4710 |
++ return dev; |
4711 |
+ } |
4712 |
+ |
4713 |
+ /* Called when VF is injecting data into network stack. |
4714 |
+@@ -2094,15 +2086,19 @@ static int netvsc_probe(struct hv_device *dev, |
4715 |
+ else |
4716 |
+ net->max_mtu = ETH_DATA_LEN; |
4717 |
+ |
4718 |
+- ret = register_netdev(net); |
4719 |
++ rtnl_lock(); |
4720 |
++ ret = register_netdevice(net); |
4721 |
+ if (ret != 0) { |
4722 |
+ pr_err("Unable to register netdev.\n"); |
4723 |
+ goto register_failed; |
4724 |
+ } |
4725 |
+ |
4726 |
+- return ret; |
4727 |
++ list_add(&net_device_ctx->list, &netvsc_dev_list); |
4728 |
++ rtnl_unlock(); |
4729 |
++ return 0; |
4730 |
+ |
4731 |
+ register_failed: |
4732 |
++ rtnl_unlock(); |
4733 |
+ rndis_filter_device_remove(dev, nvdev); |
4734 |
+ rndis_failed: |
4735 |
+ free_percpu(net_device_ctx->vf_stats); |
4736 |
+@@ -2148,6 +2144,7 @@ static int netvsc_remove(struct hv_device *dev) |
4737 |
+ rndis_filter_device_remove(dev, nvdev); |
4738 |
+ |
4739 |
+ unregister_netdevice(net); |
4740 |
++ list_del(&ndev_ctx->list); |
4741 |
+ |
4742 |
+ rtnl_unlock(); |
4743 |
+ rcu_read_unlock(); |
4744 |
+diff --git a/drivers/net/netdevsim/devlink.c b/drivers/net/netdevsim/devlink.c |
4745 |
+index bef7db5d129a..82f0e2663e1a 100644 |
4746 |
+--- a/drivers/net/netdevsim/devlink.c |
4747 |
++++ b/drivers/net/netdevsim/devlink.c |
4748 |
+@@ -206,6 +206,7 @@ void nsim_devlink_teardown(struct netdevsim *ns) |
4749 |
+ struct net *net = nsim_to_net(ns); |
4750 |
+ bool *reg_devlink = net_generic(net, nsim_devlink_id); |
4751 |
+ |
4752 |
++ devlink_resources_unregister(ns->devlink, NULL); |
4753 |
+ devlink_unregister(ns->devlink); |
4754 |
+ devlink_free(ns->devlink); |
4755 |
+ ns->devlink = NULL; |
4756 |
+diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c |
4757 |
+index 0831b7142df7..0c5b68e7da51 100644 |
4758 |
+--- a/drivers/net/phy/mdio-mux-bcm-iproc.c |
4759 |
++++ b/drivers/net/phy/mdio-mux-bcm-iproc.c |
4760 |
+@@ -218,7 +218,7 @@ out: |
4761 |
+ |
4762 |
+ static int mdio_mux_iproc_remove(struct platform_device *pdev) |
4763 |
+ { |
4764 |
+- struct iproc_mdiomux_desc *md = dev_get_platdata(&pdev->dev); |
4765 |
++ struct iproc_mdiomux_desc *md = platform_get_drvdata(pdev); |
4766 |
+ |
4767 |
+ mdio_mux_uninit(md->mux_handle); |
4768 |
+ mdiobus_unregister(md->mii_bus); |
4769 |
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c |
4770 |
+index c582b2d7546c..18ee7546e4a8 100644 |
4771 |
+--- a/drivers/net/phy/phylink.c |
4772 |
++++ b/drivers/net/phy/phylink.c |
4773 |
+@@ -612,6 +612,8 @@ void phylink_destroy(struct phylink *pl) |
4774 |
+ { |
4775 |
+ if (pl->sfp_bus) |
4776 |
+ sfp_unregister_upstream(pl->sfp_bus); |
4777 |
++ if (!IS_ERR(pl->link_gpio)) |
4778 |
++ gpiod_put(pl->link_gpio); |
4779 |
+ |
4780 |
+ cancel_work_sync(&pl->resolve); |
4781 |
+ kfree(pl); |
4782 |
+diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c |
4783 |
+index fd6c23f69c2f..d437f4f5ed52 100644 |
4784 |
+--- a/drivers/net/phy/sfp-bus.c |
4785 |
++++ b/drivers/net/phy/sfp-bus.c |
4786 |
+@@ -132,6 +132,13 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, |
4787 |
+ br_max = br_nom + br_nom * id->ext.br_min / 100; |
4788 |
+ br_min = br_nom - br_nom * id->ext.br_min / 100; |
4789 |
+ } |
4790 |
++ |
4791 |
++ /* When using passive cables, in case neither BR,min nor BR,max |
4792 |
++ * are specified, set br_min to 0 as the nominal value is then |
4793 |
++ * used as the maximum. |
4794 |
++ */ |
4795 |
++ if (br_min == br_max && id->base.sfp_ct_passive) |
4796 |
++ br_min = 0; |
4797 |
+ } |
4798 |
+ |
4799 |
+ /* Set ethtool support from the compliance fields. */ |
4800 |
+diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
4801 |
+index 8a76c1e5de8d..838df4c2b17f 100644 |
4802 |
+--- a/drivers/net/usb/lan78xx.c |
4803 |
++++ b/drivers/net/usb/lan78xx.c |
4804 |
+@@ -1216,6 +1216,8 @@ static int lan78xx_link_reset(struct lan78xx_net *dev) |
4805 |
+ mod_timer(&dev->stat_monitor, |
4806 |
+ jiffies + STAT_UPDATE_TIMER); |
4807 |
+ } |
4808 |
++ |
4809 |
++ tasklet_schedule(&dev->bh); |
4810 |
+ } |
4811 |
+ |
4812 |
+ return ret; |
4813 |
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
4814 |
+index 11a3915e92e9..6bdf01ed07ab 100644 |
4815 |
+--- a/drivers/net/virtio_net.c |
4816 |
++++ b/drivers/net/virtio_net.c |
4817 |
+@@ -551,7 +551,8 @@ static struct sk_buff *receive_small(struct net_device *dev, |
4818 |
+ struct receive_queue *rq, |
4819 |
+ void *buf, void *ctx, |
4820 |
+ unsigned int len, |
4821 |
+- unsigned int *xdp_xmit) |
4822 |
++ unsigned int *xdp_xmit, |
4823 |
++ unsigned int *rbytes) |
4824 |
+ { |
4825 |
+ struct sk_buff *skb; |
4826 |
+ struct bpf_prog *xdp_prog; |
4827 |
+@@ -567,6 +568,7 @@ static struct sk_buff *receive_small(struct net_device *dev, |
4828 |
+ int err; |
4829 |
+ |
4830 |
+ len -= vi->hdr_len; |
4831 |
++ *rbytes += len; |
4832 |
+ |
4833 |
+ rcu_read_lock(); |
4834 |
+ xdp_prog = rcu_dereference(rq->xdp_prog); |
4835 |
+@@ -666,11 +668,13 @@ static struct sk_buff *receive_big(struct net_device *dev, |
4836 |
+ struct virtnet_info *vi, |
4837 |
+ struct receive_queue *rq, |
4838 |
+ void *buf, |
4839 |
+- unsigned int len) |
4840 |
++ unsigned int len, |
4841 |
++ unsigned int *rbytes) |
4842 |
+ { |
4843 |
+ struct page *page = buf; |
4844 |
+ struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE); |
4845 |
+ |
4846 |
++ *rbytes += len - vi->hdr_len; |
4847 |
+ if (unlikely(!skb)) |
4848 |
+ goto err; |
4849 |
+ |
4850 |
+@@ -688,7 +692,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, |
4851 |
+ void *buf, |
4852 |
+ void *ctx, |
4853 |
+ unsigned int len, |
4854 |
+- unsigned int *xdp_xmit) |
4855 |
++ unsigned int *xdp_xmit, |
4856 |
++ unsigned int *rbytes) |
4857 |
+ { |
4858 |
+ struct virtio_net_hdr_mrg_rxbuf *hdr = buf; |
4859 |
+ u16 num_buf = virtio16_to_cpu(vi->vdev, hdr->num_buffers); |
4860 |
+@@ -702,6 +707,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, |
4861 |
+ int err; |
4862 |
+ |
4863 |
+ head_skb = NULL; |
4864 |
++ *rbytes += len - vi->hdr_len; |
4865 |
+ |
4866 |
+ rcu_read_lock(); |
4867 |
+ xdp_prog = rcu_dereference(rq->xdp_prog); |
4868 |
+@@ -831,6 +837,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, |
4869 |
+ goto err_buf; |
4870 |
+ } |
4871 |
+ |
4872 |
++ *rbytes += len; |
4873 |
+ page = virt_to_head_page(buf); |
4874 |
+ |
4875 |
+ truesize = mergeable_ctx_to_truesize(ctx); |
4876 |
+@@ -886,6 +893,7 @@ err_skb: |
4877 |
+ dev->stats.rx_length_errors++; |
4878 |
+ break; |
4879 |
+ } |
4880 |
++ *rbytes += len; |
4881 |
+ page = virt_to_head_page(buf); |
4882 |
+ put_page(page); |
4883 |
+ } |
4884 |
+@@ -896,14 +904,13 @@ xdp_xmit: |
4885 |
+ return NULL; |
4886 |
+ } |
4887 |
+ |
4888 |
+-static int receive_buf(struct virtnet_info *vi, struct receive_queue *rq, |
4889 |
+- void *buf, unsigned int len, void **ctx, |
4890 |
+- unsigned int *xdp_xmit) |
4891 |
++static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, |
4892 |
++ void *buf, unsigned int len, void **ctx, |
4893 |
++ unsigned int *xdp_xmit, unsigned int *rbytes) |
4894 |
+ { |
4895 |
+ struct net_device *dev = vi->dev; |
4896 |
+ struct sk_buff *skb; |
4897 |
+ struct virtio_net_hdr_mrg_rxbuf *hdr; |
4898 |
+- int ret; |
4899 |
+ |
4900 |
+ if (unlikely(len < vi->hdr_len + ETH_HLEN)) { |
4901 |
+ pr_debug("%s: short packet %i\n", dev->name, len); |
4902 |
+@@ -915,23 +922,22 @@ static int receive_buf(struct virtnet_info *vi, struct receive_queue *rq, |
4903 |
+ } else { |
4904 |
+ put_page(virt_to_head_page(buf)); |
4905 |
+ } |
4906 |
+- return 0; |
4907 |
++ return; |
4908 |
+ } |
4909 |
+ |
4910 |
+ if (vi->mergeable_rx_bufs) |
4911 |
+- skb = receive_mergeable(dev, vi, rq, buf, ctx, len, xdp_xmit); |
4912 |
++ skb = receive_mergeable(dev, vi, rq, buf, ctx, len, xdp_xmit, |
4913 |
++ rbytes); |
4914 |
+ else if (vi->big_packets) |
4915 |
+- skb = receive_big(dev, vi, rq, buf, len); |
4916 |
++ skb = receive_big(dev, vi, rq, buf, len, rbytes); |
4917 |
+ else |
4918 |
+- skb = receive_small(dev, vi, rq, buf, ctx, len, xdp_xmit); |
4919 |
++ skb = receive_small(dev, vi, rq, buf, ctx, len, xdp_xmit, rbytes); |
4920 |
+ |
4921 |
+ if (unlikely(!skb)) |
4922 |
+- return 0; |
4923 |
++ return; |
4924 |
+ |
4925 |
+ hdr = skb_vnet_hdr(skb); |
4926 |
+ |
4927 |
+- ret = skb->len; |
4928 |
+- |
4929 |
+ if (hdr->hdr.flags & VIRTIO_NET_HDR_F_DATA_VALID) |
4930 |
+ skb->ip_summed = CHECKSUM_UNNECESSARY; |
4931 |
+ |
4932 |
+@@ -948,12 +954,11 @@ static int receive_buf(struct virtnet_info *vi, struct receive_queue *rq, |
4933 |
+ ntohs(skb->protocol), skb->len, skb->pkt_type); |
4934 |
+ |
4935 |
+ napi_gro_receive(&rq->napi, skb); |
4936 |
+- return ret; |
4937 |
++ return; |
4938 |
+ |
4939 |
+ frame_err: |
4940 |
+ dev->stats.rx_frame_errors++; |
4941 |
+ dev_kfree_skb(skb); |
4942 |
+- return 0; |
4943 |
+ } |
4944 |
+ |
4945 |
+ /* Unlike mergeable buffers, all buffers are allocated to the |
4946 |
+@@ -1203,13 +1208,13 @@ static int virtnet_receive(struct receive_queue *rq, int budget, |
4947 |
+ |
4948 |
+ while (received < budget && |
4949 |
+ (buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx))) { |
4950 |
+- bytes += receive_buf(vi, rq, buf, len, ctx, xdp_xmit); |
4951 |
++ receive_buf(vi, rq, buf, len, ctx, xdp_xmit, &bytes); |
4952 |
+ received++; |
4953 |
+ } |
4954 |
+ } else { |
4955 |
+ while (received < budget && |
4956 |
+ (buf = virtqueue_get_buf(rq->vq, &len)) != NULL) { |
4957 |
+- bytes += receive_buf(vi, rq, buf, len, NULL, xdp_xmit); |
4958 |
++ receive_buf(vi, rq, buf, len, NULL, xdp_xmit, &bytes); |
4959 |
+ received++; |
4960 |
+ } |
4961 |
+ } |
4962 |
+diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c |
4963 |
+index 8a3020dbd4cf..50b52a9e9648 100644 |
4964 |
+--- a/drivers/net/wireless/ath/ath10k/core.c |
4965 |
++++ b/drivers/net/wireless/ath/ath10k/core.c |
4966 |
+@@ -1253,14 +1253,61 @@ out: |
4967 |
+ return ret; |
4968 |
+ } |
4969 |
+ |
4970 |
++static int ath10k_core_search_bd(struct ath10k *ar, |
4971 |
++ const char *boardname, |
4972 |
++ const u8 *data, |
4973 |
++ size_t len) |
4974 |
++{ |
4975 |
++ size_t ie_len; |
4976 |
++ struct ath10k_fw_ie *hdr; |
4977 |
++ int ret = -ENOENT, ie_id; |
4978 |
++ |
4979 |
++ while (len > sizeof(struct ath10k_fw_ie)) { |
4980 |
++ hdr = (struct ath10k_fw_ie *)data; |
4981 |
++ ie_id = le32_to_cpu(hdr->id); |
4982 |
++ ie_len = le32_to_cpu(hdr->len); |
4983 |
++ |
4984 |
++ len -= sizeof(*hdr); |
4985 |
++ data = hdr->data; |
4986 |
++ |
4987 |
++ if (len < ALIGN(ie_len, 4)) { |
4988 |
++ ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", |
4989 |
++ ie_id, ie_len, len); |
4990 |
++ return -EINVAL; |
4991 |
++ } |
4992 |
++ |
4993 |
++ switch (ie_id) { |
4994 |
++ case ATH10K_BD_IE_BOARD: |
4995 |
++ ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, |
4996 |
++ boardname); |
4997 |
++ if (ret == -ENOENT) |
4998 |
++ /* no match found, continue */ |
4999 |
++ break; |
5000 |
++ |
5001 |
++ /* either found or error, so stop searching */ |
5002 |
++ goto out; |
5003 |
++ } |
5004 |
++ |
5005 |
++ /* jump over the padding */ |
5006 |
++ ie_len = ALIGN(ie_len, 4); |
5007 |
++ |
5008 |
++ len -= ie_len; |
5009 |
++ data += ie_len; |
5010 |
++ } |
5011 |
++ |
5012 |
++out: |
5013 |
++ /* return result of parse_bd_ie_board() or -ENOENT */ |
5014 |
++ return ret; |
5015 |
++} |
5016 |
++ |
5017 |
+ static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, |
5018 |
+ const char *boardname, |
5019 |
++ const char *fallback_boardname, |
5020 |
+ const char *filename) |
5021 |
+ { |
5022 |
+- size_t len, magic_len, ie_len; |
5023 |
+- struct ath10k_fw_ie *hdr; |
5024 |
++ size_t len, magic_len; |
5025 |
+ const u8 *data; |
5026 |
+- int ret, ie_id; |
5027 |
++ int ret; |
5028 |
+ |
5029 |
+ ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, |
5030 |
+ ar->hw_params.fw.dir, |
5031 |
+@@ -1298,69 +1345,23 @@ static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, |
5032 |
+ data += magic_len; |
5033 |
+ len -= magic_len; |
5034 |
+ |
5035 |
+- while (len > sizeof(struct ath10k_fw_ie)) { |
5036 |
+- hdr = (struct ath10k_fw_ie *)data; |
5037 |
+- ie_id = le32_to_cpu(hdr->id); |
5038 |
+- ie_len = le32_to_cpu(hdr->len); |
5039 |
+- |
5040 |
+- len -= sizeof(*hdr); |
5041 |
+- data = hdr->data; |
5042 |
+- |
5043 |
+- if (len < ALIGN(ie_len, 4)) { |
5044 |
+- ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", |
5045 |
+- ie_id, ie_len, len); |
5046 |
+- ret = -EINVAL; |
5047 |
+- goto err; |
5048 |
+- } |
5049 |
++ /* attempt to find boardname in the IE list */ |
5050 |
++ ret = ath10k_core_search_bd(ar, boardname, data, len); |
5051 |
+ |
5052 |
+- switch (ie_id) { |
5053 |
+- case ATH10K_BD_IE_BOARD: |
5054 |
+- ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, |
5055 |
+- boardname); |
5056 |
+- if (ret == -ENOENT && ar->id.bdf_ext[0] != '\0') { |
5057 |
+- /* try default bdf if variant was not found */ |
5058 |
+- char *s, *v = ",variant="; |
5059 |
+- char boardname2[100]; |
5060 |
+- |
5061 |
+- strlcpy(boardname2, boardname, |
5062 |
+- sizeof(boardname2)); |
5063 |
+- |
5064 |
+- s = strstr(boardname2, v); |
5065 |
+- if (s) |
5066 |
+- *s = '\0'; /* strip ",variant=%s" */ |
5067 |
++ /* if we didn't find it and have a fallback name, try that */ |
5068 |
++ if (ret == -ENOENT && fallback_boardname) |
5069 |
++ ret = ath10k_core_search_bd(ar, fallback_boardname, data, len); |
5070 |
+ |
5071 |
+- ret = ath10k_core_parse_bd_ie_board(ar, data, |
5072 |
+- ie_len, |
5073 |
+- boardname2); |
5074 |
+- } |
5075 |
+- |
5076 |
+- if (ret == -ENOENT) |
5077 |
+- /* no match found, continue */ |
5078 |
+- break; |
5079 |
+- else if (ret) |
5080 |
+- /* there was an error, bail out */ |
5081 |
+- goto err; |
5082 |
+- |
5083 |
+- /* board data found */ |
5084 |
+- goto out; |
5085 |
+- } |
5086 |
+- |
5087 |
+- /* jump over the padding */ |
5088 |
+- ie_len = ALIGN(ie_len, 4); |
5089 |
+- |
5090 |
+- len -= ie_len; |
5091 |
+- data += ie_len; |
5092 |
+- } |
5093 |
+- |
5094 |
+-out: |
5095 |
+- if (!ar->normal_mode_fw.board_data || !ar->normal_mode_fw.board_len) { |
5096 |
++ if (ret == -ENOENT) { |
5097 |
+ ath10k_err(ar, |
5098 |
+ "failed to fetch board data for %s from %s/%s\n", |
5099 |
+ boardname, ar->hw_params.fw.dir, filename); |
5100 |
+ ret = -ENODATA; |
5101 |
+- goto err; |
5102 |
+ } |
5103 |
+ |
5104 |
++ if (ret) |
5105 |
++ goto err; |
5106 |
++ |
5107 |
+ return 0; |
5108 |
+ |
5109 |
+ err: |
5110 |
+@@ -1369,12 +1370,12 @@ err: |
5111 |
+ } |
5112 |
+ |
5113 |
+ static int ath10k_core_create_board_name(struct ath10k *ar, char *name, |
5114 |
+- size_t name_len) |
5115 |
++ size_t name_len, bool with_variant) |
5116 |
+ { |
5117 |
+ /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ |
5118 |
+ char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; |
5119 |
+ |
5120 |
+- if (ar->id.bdf_ext[0] != '\0') |
5121 |
++ if (with_variant && ar->id.bdf_ext[0] != '\0') |
5122 |
+ scnprintf(variant, sizeof(variant), ",variant=%s", |
5123 |
+ ar->id.bdf_ext); |
5124 |
+ |
5125 |
+@@ -1400,17 +1401,26 @@ out: |
5126 |
+ |
5127 |
+ static int ath10k_core_fetch_board_file(struct ath10k *ar) |
5128 |
+ { |
5129 |
+- char boardname[100]; |
5130 |
++ char boardname[100], fallback_boardname[100]; |
5131 |
+ int ret; |
5132 |
+ |
5133 |
+- ret = ath10k_core_create_board_name(ar, boardname, sizeof(boardname)); |
5134 |
++ ret = ath10k_core_create_board_name(ar, boardname, |
5135 |
++ sizeof(boardname), true); |
5136 |
+ if (ret) { |
5137 |
+ ath10k_err(ar, "failed to create board name: %d", ret); |
5138 |
+ return ret; |
5139 |
+ } |
5140 |
+ |
5141 |
++ ret = ath10k_core_create_board_name(ar, fallback_boardname, |
5142 |
++ sizeof(boardname), false); |
5143 |
++ if (ret) { |
5144 |
++ ath10k_err(ar, "failed to create fallback board name: %d", ret); |
5145 |
++ return ret; |
5146 |
++ } |
5147 |
++ |
5148 |
+ ar->bd_api = 2; |
5149 |
+ ret = ath10k_core_fetch_board_data_api_n(ar, boardname, |
5150 |
++ fallback_boardname, |
5151 |
+ ATH10K_BOARD_API2_FILE); |
5152 |
+ if (!ret) |
5153 |
+ goto success; |
5154 |
+diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c |
5155 |
+index bac832ce1873..442a6f37e45e 100644 |
5156 |
+--- a/drivers/net/wireless/ath/ath10k/debug.c |
5157 |
++++ b/drivers/net/wireless/ath/ath10k/debug.c |
5158 |
+@@ -1519,7 +1519,13 @@ static void ath10k_tpc_stats_print(struct ath10k_tpc_stats *tpc_stats, |
5159 |
+ *len += scnprintf(buf + *len, buf_len - *len, |
5160 |
+ "********************************\n"); |
5161 |
+ *len += scnprintf(buf + *len, buf_len - *len, |
5162 |
+- "No. Preamble Rate_code tpc_value1 tpc_value2 tpc_value3\n"); |
5163 |
++ "No. Preamble Rate_code "); |
5164 |
++ |
5165 |
++ for (i = 0; i < WMI_TPC_TX_N_CHAIN; i++) |
5166 |
++ *len += scnprintf(buf + *len, buf_len - *len, |
5167 |
++ "tpc_value%d ", i); |
5168 |
++ |
5169 |
++ *len += scnprintf(buf + *len, buf_len - *len, "\n"); |
5170 |
+ |
5171 |
+ for (i = 0; i < tpc_stats->rate_max; i++) { |
5172 |
+ *len += scnprintf(buf + *len, buf_len - *len, |
5173 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c |
5174 |
+index c5e1ca5945db..fcc5aa9f3357 100644 |
5175 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.c |
5176 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.c |
5177 |
+@@ -4479,6 +4479,12 @@ void ath10k_wmi_event_pdev_tpc_config(struct ath10k *ar, struct sk_buff *skb) |
5178 |
+ |
5179 |
+ num_tx_chain = __le32_to_cpu(ev->num_tx_chain); |
5180 |
+ |
5181 |
++ if (num_tx_chain > WMI_TPC_TX_N_CHAIN) { |
5182 |
++ ath10k_warn(ar, "number of tx chain is %d greater than TPC configured tx chain %d\n", |
5183 |
++ num_tx_chain, WMI_TPC_TX_N_CHAIN); |
5184 |
++ return; |
5185 |
++ } |
5186 |
++ |
5187 |
+ ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table, |
5188 |
+ num_tx_chain); |
5189 |
+ |
5190 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h |
5191 |
+index 6fbc84c29521..7fde22ea2ffa 100644 |
5192 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.h |
5193 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.h |
5194 |
+@@ -4008,9 +4008,9 @@ struct wmi_pdev_get_tpc_config_cmd { |
5195 |
+ } __packed; |
5196 |
+ |
5197 |
+ #define WMI_TPC_CONFIG_PARAM 1 |
5198 |
+-#define WMI_TPC_RATE_MAX 160 |
5199 |
+ #define WMI_TPC_FINAL_RATE_MAX 240 |
5200 |
+ #define WMI_TPC_TX_N_CHAIN 4 |
5201 |
++#define WMI_TPC_RATE_MAX (WMI_TPC_TX_N_CHAIN * 65) |
5202 |
+ #define WMI_TPC_PREAM_TABLE_MAX 10 |
5203 |
+ #define WMI_TPC_FLAG 3 |
5204 |
+ #define WMI_TPC_BUF_SIZE 10 |
5205 |
+diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h |
5206 |
+index 5d80be213fac..869f276cc1d8 100644 |
5207 |
+--- a/drivers/net/wireless/ath/regd.h |
5208 |
++++ b/drivers/net/wireless/ath/regd.h |
5209 |
+@@ -68,12 +68,14 @@ enum CountryCode { |
5210 |
+ CTRY_AUSTRALIA = 36, |
5211 |
+ CTRY_AUSTRIA = 40, |
5212 |
+ CTRY_AZERBAIJAN = 31, |
5213 |
++ CTRY_BAHAMAS = 44, |
5214 |
+ CTRY_BAHRAIN = 48, |
5215 |
+ CTRY_BANGLADESH = 50, |
5216 |
+ CTRY_BARBADOS = 52, |
5217 |
+ CTRY_BELARUS = 112, |
5218 |
+ CTRY_BELGIUM = 56, |
5219 |
+ CTRY_BELIZE = 84, |
5220 |
++ CTRY_BERMUDA = 60, |
5221 |
+ CTRY_BOLIVIA = 68, |
5222 |
+ CTRY_BOSNIA_HERZ = 70, |
5223 |
+ CTRY_BRAZIL = 76, |
5224 |
+@@ -159,6 +161,7 @@ enum CountryCode { |
5225 |
+ CTRY_ROMANIA = 642, |
5226 |
+ CTRY_RUSSIA = 643, |
5227 |
+ CTRY_SAUDI_ARABIA = 682, |
5228 |
++ CTRY_SERBIA = 688, |
5229 |
+ CTRY_SERBIA_MONTENEGRO = 891, |
5230 |
+ CTRY_SINGAPORE = 702, |
5231 |
+ CTRY_SLOVAKIA = 703, |
5232 |
+@@ -170,11 +173,13 @@ enum CountryCode { |
5233 |
+ CTRY_SWITZERLAND = 756, |
5234 |
+ CTRY_SYRIA = 760, |
5235 |
+ CTRY_TAIWAN = 158, |
5236 |
++ CTRY_TANZANIA = 834, |
5237 |
+ CTRY_THAILAND = 764, |
5238 |
+ CTRY_TRINIDAD_Y_TOBAGO = 780, |
5239 |
+ CTRY_TUNISIA = 788, |
5240 |
+ CTRY_TURKEY = 792, |
5241 |
+ CTRY_UAE = 784, |
5242 |
++ CTRY_UGANDA = 800, |
5243 |
+ CTRY_UKRAINE = 804, |
5244 |
+ CTRY_UNITED_KINGDOM = 826, |
5245 |
+ CTRY_UNITED_STATES = 840, |
5246 |
+diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h |
5247 |
+index bdd2b4d61f2f..15bbd1e0d912 100644 |
5248 |
+--- a/drivers/net/wireless/ath/regd_common.h |
5249 |
++++ b/drivers/net/wireless/ath/regd_common.h |
5250 |
+@@ -35,6 +35,7 @@ enum EnumRd { |
5251 |
+ FRANCE_RES = 0x31, |
5252 |
+ FCC3_FCCA = 0x3A, |
5253 |
+ FCC3_WORLD = 0x3B, |
5254 |
++ FCC3_ETSIC = 0x3F, |
5255 |
+ |
5256 |
+ ETSI1_WORLD = 0x37, |
5257 |
+ ETSI3_ETSIA = 0x32, |
5258 |
+@@ -44,6 +45,7 @@ enum EnumRd { |
5259 |
+ ETSI4_ETSIC = 0x38, |
5260 |
+ ETSI5_WORLD = 0x39, |
5261 |
+ ETSI6_WORLD = 0x34, |
5262 |
++ ETSI8_WORLD = 0x3D, |
5263 |
+ ETSI_RESERVED = 0x33, |
5264 |
+ |
5265 |
+ MKK1_MKKA = 0x40, |
5266 |
+@@ -59,6 +61,7 @@ enum EnumRd { |
5267 |
+ MKK1_MKKA1 = 0x4A, |
5268 |
+ MKK1_MKKA2 = 0x4B, |
5269 |
+ MKK1_MKKC = 0x4C, |
5270 |
++ APL2_FCCA = 0x4D, |
5271 |
+ |
5272 |
+ APL3_FCCA = 0x50, |
5273 |
+ APL1_WORLD = 0x52, |
5274 |
+@@ -67,6 +70,7 @@ enum EnumRd { |
5275 |
+ APL1_ETSIC = 0x55, |
5276 |
+ APL2_ETSIC = 0x56, |
5277 |
+ APL5_WORLD = 0x58, |
5278 |
++ APL13_WORLD = 0x5A, |
5279 |
+ APL6_WORLD = 0x5B, |
5280 |
+ APL7_FCCA = 0x5C, |
5281 |
+ APL8_WORLD = 0x5D, |
5282 |
+@@ -168,6 +172,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = { |
5283 |
+ {FCC2_ETSIC, CTL_FCC, CTL_ETSI}, |
5284 |
+ {FCC3_FCCA, CTL_FCC, CTL_FCC}, |
5285 |
+ {FCC3_WORLD, CTL_FCC, CTL_ETSI}, |
5286 |
++ {FCC3_ETSIC, CTL_FCC, CTL_ETSI}, |
5287 |
+ {FCC4_FCCA, CTL_FCC, CTL_FCC}, |
5288 |
+ {FCC5_FCCA, CTL_FCC, CTL_FCC}, |
5289 |
+ {FCC6_FCCA, CTL_FCC, CTL_FCC}, |
5290 |
+@@ -179,6 +184,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = { |
5291 |
+ {ETSI4_WORLD, CTL_ETSI, CTL_ETSI}, |
5292 |
+ {ETSI5_WORLD, CTL_ETSI, CTL_ETSI}, |
5293 |
+ {ETSI6_WORLD, CTL_ETSI, CTL_ETSI}, |
5294 |
++ {ETSI8_WORLD, CTL_ETSI, CTL_ETSI}, |
5295 |
+ |
5296 |
+ /* XXX: For ETSI3_ETSIA, Was NO_CTL meant for the 2 GHz band ? */ |
5297 |
+ {ETSI3_ETSIA, CTL_ETSI, CTL_ETSI}, |
5298 |
+@@ -188,9 +194,11 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = { |
5299 |
+ {FCC1_FCCA, CTL_FCC, CTL_FCC}, |
5300 |
+ {APL1_WORLD, CTL_FCC, CTL_ETSI}, |
5301 |
+ {APL2_WORLD, CTL_FCC, CTL_ETSI}, |
5302 |
++ {APL2_FCCA, CTL_FCC, CTL_FCC}, |
5303 |
+ {APL3_WORLD, CTL_FCC, CTL_ETSI}, |
5304 |
+ {APL4_WORLD, CTL_FCC, CTL_ETSI}, |
5305 |
+ {APL5_WORLD, CTL_FCC, CTL_ETSI}, |
5306 |
++ {APL13_WORLD, CTL_ETSI, CTL_ETSI}, |
5307 |
+ {APL6_WORLD, CTL_ETSI, CTL_ETSI}, |
5308 |
+ {APL8_WORLD, CTL_ETSI, CTL_ETSI}, |
5309 |
+ {APL9_WORLD, CTL_ETSI, CTL_ETSI}, |
5310 |
+@@ -298,6 +306,7 @@ static struct country_code_to_enum_rd allCountries[] = { |
5311 |
+ {CTRY_AUSTRALIA2, FCC6_WORLD, "AU"}, |
5312 |
+ {CTRY_AUSTRIA, ETSI1_WORLD, "AT"}, |
5313 |
+ {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ"}, |
5314 |
++ {CTRY_BAHAMAS, FCC3_WORLD, "BS"}, |
5315 |
+ {CTRY_BAHRAIN, APL6_WORLD, "BH"}, |
5316 |
+ {CTRY_BANGLADESH, NULL1_WORLD, "BD"}, |
5317 |
+ {CTRY_BARBADOS, FCC2_WORLD, "BB"}, |
5318 |
+@@ -305,6 +314,7 @@ static struct country_code_to_enum_rd allCountries[] = { |
5319 |
+ {CTRY_BELGIUM, ETSI1_WORLD, "BE"}, |
5320 |
+ {CTRY_BELGIUM2, ETSI4_WORLD, "BL"}, |
5321 |
+ {CTRY_BELIZE, APL1_ETSIC, "BZ"}, |
5322 |
++ {CTRY_BERMUDA, FCC3_FCCA, "BM"}, |
5323 |
+ {CTRY_BOLIVIA, APL1_ETSIC, "BO"}, |
5324 |
+ {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA"}, |
5325 |
+ {CTRY_BRAZIL, FCC3_WORLD, "BR"}, |
5326 |
+@@ -444,6 +454,7 @@ static struct country_code_to_enum_rd allCountries[] = { |
5327 |
+ {CTRY_ROMANIA, NULL1_WORLD, "RO"}, |
5328 |
+ {CTRY_RUSSIA, NULL1_WORLD, "RU"}, |
5329 |
+ {CTRY_SAUDI_ARABIA, NULL1_WORLD, "SA"}, |
5330 |
++ {CTRY_SERBIA, ETSI1_WORLD, "RS"}, |
5331 |
+ {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS"}, |
5332 |
+ {CTRY_SINGAPORE, APL6_WORLD, "SG"}, |
5333 |
+ {CTRY_SLOVAKIA, ETSI1_WORLD, "SK"}, |
5334 |
+@@ -455,10 +466,12 @@ static struct country_code_to_enum_rd allCountries[] = { |
5335 |
+ {CTRY_SWITZERLAND, ETSI1_WORLD, "CH"}, |
5336 |
+ {CTRY_SYRIA, NULL1_WORLD, "SY"}, |
5337 |
+ {CTRY_TAIWAN, APL3_FCCA, "TW"}, |
5338 |
++ {CTRY_TANZANIA, APL1_WORLD, "TZ"}, |
5339 |
+ {CTRY_THAILAND, FCC3_WORLD, "TH"}, |
5340 |
+ {CTRY_TRINIDAD_Y_TOBAGO, FCC3_WORLD, "TT"}, |
5341 |
+ {CTRY_TUNISIA, ETSI3_WORLD, "TN"}, |
5342 |
+ {CTRY_TURKEY, ETSI3_WORLD, "TR"}, |
5343 |
++ {CTRY_UGANDA, FCC3_WORLD, "UG"}, |
5344 |
+ {CTRY_UKRAINE, NULL1_WORLD, "UA"}, |
5345 |
+ {CTRY_UAE, NULL1_WORLD, "AE"}, |
5346 |
+ {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, |
5347 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c |
5348 |
+index 0b68240ec7b4..a1915411c280 100644 |
5349 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c |
5350 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c |
5351 |
+@@ -963,6 +963,7 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = { |
5352 |
+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43340), |
5353 |
+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341), |
5354 |
+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362), |
5355 |
++ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43364), |
5356 |
+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339), |
5357 |
+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339), |
5358 |
+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430), |
5359 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5360 |
+index 90f8c89ea59c..2f7b9421410f 100644 |
5361 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5362 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
5363 |
+@@ -2652,7 +2652,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, |
5364 |
+ |
5365 |
+ mutex_lock(&mvm->mutex); |
5366 |
+ /* track whether or not the station is associated */ |
5367 |
+- mvm_sta->associated = new_state >= IEEE80211_STA_ASSOC; |
5368 |
++ mvm_sta->sta_state = new_state; |
5369 |
+ |
5370 |
+ if (old_state == IEEE80211_STA_NOTEXIST && |
5371 |
+ new_state == IEEE80211_STA_NONE) { |
5372 |
+@@ -2704,8 +2704,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, |
5373 |
+ iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); |
5374 |
+ } |
5375 |
+ |
5376 |
+- iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, |
5377 |
+- true); |
5378 |
++ iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band); |
5379 |
+ ret = iwl_mvm_update_sta(mvm, vif, sta); |
5380 |
+ } else if (old_state == IEEE80211_STA_ASSOC && |
5381 |
+ new_state == IEEE80211_STA_AUTHORIZED) { |
5382 |
+@@ -2721,8 +2720,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, |
5383 |
+ /* enable beacon filtering */ |
5384 |
+ WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); |
5385 |
+ |
5386 |
+- iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, |
5387 |
+- false); |
5388 |
++ iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band); |
5389 |
+ |
5390 |
+ ret = 0; |
5391 |
+ } else if (old_state == IEEE80211_STA_AUTHORIZED && |
5392 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
5393 |
+index 5d776ec1840f..36f27981165c 100644 |
5394 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
5395 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c |
5396 |
+@@ -3,6 +3,7 @@ |
5397 |
+ * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
5398 |
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
5399 |
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
5400 |
++ * Copyright(c) 2018 Intel Corporation |
5401 |
+ * |
5402 |
+ * This program is free software; you can redistribute it and/or modify it |
5403 |
+ * under the terms of version 2 of the GNU General Public License as |
5404 |
+@@ -13,10 +14,6 @@ |
5405 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
5406 |
+ * more details. |
5407 |
+ * |
5408 |
+- * You should have received a copy of the GNU General Public License along with |
5409 |
+- * this program; if not, write to the Free Software Foundation, Inc., |
5410 |
+- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
5411 |
+- * |
5412 |
+ * The full GNU General Public License is included in this distribution in the |
5413 |
+ * file called LICENSE. |
5414 |
+ * |
5415 |
+@@ -651,9 +648,10 @@ static void rs_tl_turn_on_agg(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, |
5416 |
+ } |
5417 |
+ |
5418 |
+ tid_data = &mvmsta->tid_data[tid]; |
5419 |
+- if ((tid_data->state == IWL_AGG_OFF) && |
5420 |
++ if (mvmsta->sta_state >= IEEE80211_STA_AUTHORIZED && |
5421 |
++ tid_data->state == IWL_AGG_OFF && |
5422 |
+ (lq_sta->tx_agg_tid_en & BIT(tid)) && |
5423 |
+- (tid_data->tx_count_last >= IWL_MVM_RS_AGG_START_THRESHOLD)) { |
5424 |
++ tid_data->tx_count_last >= IWL_MVM_RS_AGG_START_THRESHOLD) { |
5425 |
+ IWL_DEBUG_RATE(mvm, "try to aggregate tid %d\n", tid); |
5426 |
+ if (rs_tl_turn_on_agg_for_tid(mvm, lq_sta, tid, sta) == 0) |
5427 |
+ tid_data->state = IWL_AGG_QUEUED; |
5428 |
+@@ -1257,7 +1255,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5429 |
+ (unsigned long)(lq_sta->last_tx + |
5430 |
+ (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) { |
5431 |
+ IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); |
5432 |
+- iwl_mvm_rs_rate_init(mvm, sta, info->band, false); |
5433 |
++ iwl_mvm_rs_rate_init(mvm, sta, info->band); |
5434 |
+ return; |
5435 |
+ } |
5436 |
+ lq_sta->last_tx = jiffies; |
5437 |
+@@ -2684,9 +2682,9 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm, |
5438 |
+ struct ieee80211_sta *sta, |
5439 |
+ struct iwl_lq_sta *lq_sta, |
5440 |
+ enum nl80211_band band, |
5441 |
+- struct rs_rate *rate, |
5442 |
+- bool init) |
5443 |
++ struct rs_rate *rate) |
5444 |
+ { |
5445 |
++ struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
5446 |
+ int i, nentries; |
5447 |
+ unsigned long active_rate; |
5448 |
+ s8 best_rssi = S8_MIN; |
5449 |
+@@ -2748,7 +2746,8 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm, |
5450 |
+ * bandwidth rate, and after authorization, when the phy context |
5451 |
+ * is already up-to-date, re-init rs with the correct bw. |
5452 |
+ */ |
5453 |
+- u32 bw = init ? RATE_MCS_CHAN_WIDTH_20 : rs_bw_from_sta_bw(sta); |
5454 |
++ u32 bw = mvmsta->sta_state < IEEE80211_STA_AUTHORIZED ? |
5455 |
++ RATE_MCS_CHAN_WIDTH_20 : rs_bw_from_sta_bw(sta); |
5456 |
+ |
5457 |
+ switch (bw) { |
5458 |
+ case RATE_MCS_CHAN_WIDTH_40: |
5459 |
+@@ -2833,9 +2832,9 @@ void rs_update_last_rssi(struct iwl_mvm *mvm, |
5460 |
+ static void rs_initialize_lq(struct iwl_mvm *mvm, |
5461 |
+ struct ieee80211_sta *sta, |
5462 |
+ struct iwl_lq_sta *lq_sta, |
5463 |
+- enum nl80211_band band, |
5464 |
+- bool init) |
5465 |
++ enum nl80211_band band) |
5466 |
+ { |
5467 |
++ struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
5468 |
+ struct iwl_scale_tbl_info *tbl; |
5469 |
+ struct rs_rate *rate; |
5470 |
+ u8 active_tbl = 0; |
5471 |
+@@ -2851,7 +2850,7 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, |
5472 |
+ tbl = &(lq_sta->lq_info[active_tbl]); |
5473 |
+ rate = &tbl->rate; |
5474 |
+ |
5475 |
+- rs_get_initial_rate(mvm, sta, lq_sta, band, rate, init); |
5476 |
++ rs_get_initial_rate(mvm, sta, lq_sta, band, rate); |
5477 |
+ rs_init_optimal_rate(mvm, sta, lq_sta); |
5478 |
+ |
5479 |
+ WARN_ONCE(rate->ant != ANT_A && rate->ant != ANT_B, |
5480 |
+@@ -2864,7 +2863,8 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, |
5481 |
+ rs_set_expected_tpt_table(lq_sta, tbl); |
5482 |
+ rs_fill_lq_cmd(mvm, sta, lq_sta, rate); |
5483 |
+ /* TODO restore station should remember the lq cmd */ |
5484 |
+- iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, init); |
5485 |
++ iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, |
5486 |
++ mvmsta->sta_state < IEEE80211_STA_AUTHORIZED); |
5487 |
+ } |
5488 |
+ |
5489 |
+ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta, |
5490 |
+@@ -3117,7 +3117,7 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) |
5491 |
+ * Called after adding a new station to initialize rate scaling |
5492 |
+ */ |
5493 |
+ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5494 |
+- enum nl80211_band band, bool init) |
5495 |
++ enum nl80211_band band) |
5496 |
+ { |
5497 |
+ int i, j; |
5498 |
+ struct ieee80211_hw *hw = mvm->hw; |
5499 |
+@@ -3196,7 +3196,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5500 |
+ #ifdef CONFIG_IWLWIFI_DEBUGFS |
5501 |
+ iwl_mvm_reset_frame_stats(mvm); |
5502 |
+ #endif |
5503 |
+- rs_initialize_lq(mvm, sta, lq_sta, band, init); |
5504 |
++ rs_initialize_lq(mvm, sta, lq_sta, band); |
5505 |
+ } |
5506 |
+ |
5507 |
+ static void rs_drv_rate_update(void *mvm_r, |
5508 |
+@@ -3216,7 +3216,7 @@ static void rs_drv_rate_update(void *mvm_r, |
5509 |
+ for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) |
5510 |
+ ieee80211_stop_tx_ba_session(sta, tid); |
5511 |
+ |
5512 |
+- iwl_mvm_rs_rate_init(mvm, sta, sband->band, false); |
5513 |
++ iwl_mvm_rs_rate_init(mvm, sta, sband->band); |
5514 |
+ } |
5515 |
+ |
5516 |
+ #ifdef CONFIG_MAC80211_DEBUGFS |
5517 |
+@@ -4062,12 +4062,12 @@ static const struct rate_control_ops rs_mvm_ops_drv = { |
5518 |
+ }; |
5519 |
+ |
5520 |
+ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5521 |
+- enum nl80211_band band, bool init) |
5522 |
++ enum nl80211_band band) |
5523 |
+ { |
5524 |
+ if (iwl_mvm_has_tlc_offload(mvm)) |
5525 |
+ rs_fw_rate_init(mvm, sta, band); |
5526 |
+ else |
5527 |
+- rs_drv_rate_init(mvm, sta, band, init); |
5528 |
++ rs_drv_rate_init(mvm, sta, band); |
5529 |
+ } |
5530 |
+ |
5531 |
+ int iwl_mvm_rate_control_register(void) |
5532 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h |
5533 |
+index fb18cb8c233d..f9b272236021 100644 |
5534 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.h |
5535 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.h |
5536 |
+@@ -3,6 +3,7 @@ |
5537 |
+ * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. |
5538 |
+ * Copyright(c) 2015 Intel Mobile Communications GmbH |
5539 |
+ * Copyright(c) 2017 Intel Deutschland GmbH |
5540 |
++ * Copyright(c) 2018 Intel Corporation |
5541 |
+ * |
5542 |
+ * This program is free software; you can redistribute it and/or modify it |
5543 |
+ * under the terms of version 2 of the GNU General Public License as |
5544 |
+@@ -13,10 +14,6 @@ |
5545 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
5546 |
+ * more details. |
5547 |
+ * |
5548 |
+- * You should have received a copy of the GNU General Public License along with |
5549 |
+- * this program; if not, write to the Free Software Foundation, Inc., |
5550 |
+- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
5551 |
+- * |
5552 |
+ * The full GNU General Public License is included in this distribution in the |
5553 |
+ * file called LICENSE. |
5554 |
+ * |
5555 |
+@@ -410,7 +407,7 @@ struct iwl_lq_sta { |
5556 |
+ |
5557 |
+ /* Initialize station's rate scaling information after adding station */ |
5558 |
+ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5559 |
+- enum nl80211_band band, bool init); |
5560 |
++ enum nl80211_band band); |
5561 |
+ |
5562 |
+ /* Notify RS about Tx status */ |
5563 |
+ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5564 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
5565 |
+index 80067eb9ea05..fdc8ba319c1f 100644 |
5566 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
5567 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c |
5568 |
+@@ -214,7 +214,7 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
5569 |
+ cpu_to_le32(agg_size << STA_FLG_MAX_AGG_SIZE_SHIFT); |
5570 |
+ add_sta_cmd.station_flags |= |
5571 |
+ cpu_to_le32(mpdu_dens << STA_FLG_AGG_MPDU_DENS_SHIFT); |
5572 |
+- if (mvm_sta->associated) |
5573 |
++ if (mvm_sta->sta_state >= IEEE80211_STA_ASSOC) |
5574 |
+ add_sta_cmd.assoc_id = cpu_to_le16(sta->aid); |
5575 |
+ |
5576 |
+ if (sta->wme) { |
5577 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h |
5578 |
+index 5ffd6adbc383..d0fa0be31b0d 100644 |
5579 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h |
5580 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h |
5581 |
+@@ -8,6 +8,7 @@ |
5582 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
5583 |
+ * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
5584 |
+ * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
5585 |
++ * Copyright(c) 2018 Intel Corporation |
5586 |
+ * |
5587 |
+ * This program is free software; you can redistribute it and/or modify |
5588 |
+ * it under the terms of version 2 of the GNU General Public License as |
5589 |
+@@ -18,11 +19,6 @@ |
5590 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5591 |
+ * General Public License for more details. |
5592 |
+ * |
5593 |
+- * You should have received a copy of the GNU General Public License |
5594 |
+- * along with this program; if not, write to the Free Software |
5595 |
+- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
5596 |
+- * USA |
5597 |
+- * |
5598 |
+ * The full GNU General Public License is included in this distribution |
5599 |
+ * in the file called COPYING. |
5600 |
+ * |
5601 |
+@@ -35,6 +31,7 @@ |
5602 |
+ * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
5603 |
+ * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
5604 |
+ * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
5605 |
++ * Copyright(c) 2018 Intel Corporation |
5606 |
+ * All rights reserved. |
5607 |
+ * |
5608 |
+ * Redistribution and use in source and binary forms, with or without |
5609 |
+@@ -376,6 +373,7 @@ struct iwl_mvm_rxq_dup_data { |
5610 |
+ * tid. |
5611 |
+ * @max_agg_bufsize: the maximal size of the AGG buffer for this station |
5612 |
+ * @sta_type: station type |
5613 |
++ * @sta_state: station state according to enum %ieee80211_sta_state |
5614 |
+ * @bt_reduced_txpower: is reduced tx power enabled for this station |
5615 |
+ * @next_status_eosp: the next reclaimed packet is a PS-Poll response and |
5616 |
+ * we need to signal the EOSP |
5617 |
+@@ -414,6 +412,7 @@ struct iwl_mvm_sta { |
5618 |
+ u16 tid_disable_agg; |
5619 |
+ u8 max_agg_bufsize; |
5620 |
+ enum iwl_sta_type sta_type; |
5621 |
++ enum ieee80211_sta_state sta_state; |
5622 |
+ bool bt_reduced_txpower; |
5623 |
+ bool next_status_eosp; |
5624 |
+ spinlock_t lock; |
5625 |
+@@ -438,7 +437,6 @@ struct iwl_mvm_sta { |
5626 |
+ bool disable_tx; |
5627 |
+ bool tlc_amsdu; |
5628 |
+ bool sleeping; |
5629 |
+- bool associated; |
5630 |
+ u8 agg_tids; |
5631 |
+ u8 sleep_tx_count; |
5632 |
+ u8 avg_energy; |
5633 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
5634 |
+index f25ce3a1ea50..d57f2a08ca88 100644 |
5635 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
5636 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
5637 |
+@@ -901,6 +901,8 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans) |
5638 |
+ } |
5639 |
+ def_rxq = trans_pcie->rxq; |
5640 |
+ |
5641 |
++ cancel_work_sync(&rba->rx_alloc); |
5642 |
++ |
5643 |
+ spin_lock(&rba->lock); |
5644 |
+ atomic_set(&rba->req_pending, 0); |
5645 |
+ atomic_set(&rba->req_ready, 0); |
5646 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c |
5647 |
+index 4bc244801636..26ca670584c0 100644 |
5648 |
+--- a/drivers/net/wireless/marvell/mwifiex/usb.c |
5649 |
++++ b/drivers/net/wireless/marvell/mwifiex/usb.c |
5650 |
+@@ -644,6 +644,9 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) |
5651 |
+ MWIFIEX_FUNC_SHUTDOWN); |
5652 |
+ } |
5653 |
+ |
5654 |
++ if (adapter->workqueue) |
5655 |
++ flush_workqueue(adapter->workqueue); |
5656 |
++ |
5657 |
+ mwifiex_usb_free(card); |
5658 |
+ |
5659 |
+ mwifiex_dbg(adapter, FATAL, |
5660 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c |
5661 |
+index 0cd68ffc2c74..51ccf10f4413 100644 |
5662 |
+--- a/drivers/net/wireless/marvell/mwifiex/util.c |
5663 |
++++ b/drivers/net/wireless/marvell/mwifiex/util.c |
5664 |
+@@ -708,12 +708,14 @@ void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr, |
5665 |
+ s8 nflr) |
5666 |
+ { |
5667 |
+ struct mwifiex_histogram_data *phist_data = priv->hist_data; |
5668 |
++ s8 nf = -nflr; |
5669 |
++ s8 rssi = snr - nflr; |
5670 |
+ |
5671 |
+ atomic_inc(&phist_data->num_samples); |
5672 |
+ atomic_inc(&phist_data->rx_rate[rx_rate]); |
5673 |
+- atomic_inc(&phist_data->snr[snr]); |
5674 |
+- atomic_inc(&phist_data->noise_flr[128 + nflr]); |
5675 |
+- atomic_inc(&phist_data->sig_str[nflr - snr]); |
5676 |
++ atomic_inc(&phist_data->snr[snr + 128]); |
5677 |
++ atomic_inc(&phist_data->noise_flr[nf + 128]); |
5678 |
++ atomic_inc(&phist_data->sig_str[rssi + 128]); |
5679 |
+ } |
5680 |
+ |
5681 |
+ /* function to reset histogram data during init/reset */ |
5682 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c |
5683 |
+index 934c331d995e..1932414e5088 100644 |
5684 |
+--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c |
5685 |
++++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c |
5686 |
+@@ -482,7 +482,10 @@ void mt76x2_set_tx_ackto(struct mt76x2_dev *dev) |
5687 |
+ { |
5688 |
+ u8 ackto, sifs, slottime = dev->slottime; |
5689 |
+ |
5690 |
++ /* As defined by IEEE 802.11-2007 17.3.8.6 */ |
5691 |
+ slottime += 3 * dev->coverage_class; |
5692 |
++ mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, |
5693 |
++ MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); |
5694 |
+ |
5695 |
+ sifs = mt76_get_field(dev, MT_XIFS_TIME_CFG, |
5696 |
+ MT_XIFS_TIME_CFG_OFDM_SIFS); |
5697 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c |
5698 |
+index 73c127f92613..f66b6ff92ae0 100644 |
5699 |
+--- a/drivers/net/wireless/mediatek/mt76/mt76x2_main.c |
5700 |
++++ b/drivers/net/wireless/mediatek/mt76/mt76x2_main.c |
5701 |
+@@ -247,8 +247,7 @@ mt76x2_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
5702 |
+ int slottime = info->use_short_slot ? 9 : 20; |
5703 |
+ |
5704 |
+ dev->slottime = slottime; |
5705 |
+- mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, |
5706 |
+- MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); |
5707 |
++ mt76x2_set_tx_ackto(dev); |
5708 |
+ } |
5709 |
+ |
5710 |
+ mutex_unlock(&dev->mutex); |
5711 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c |
5712 |
+index fcc37eb7ce0b..6b4fa7be573e 100644 |
5713 |
+--- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c |
5714 |
++++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c |
5715 |
+@@ -492,8 +492,10 @@ mt76x2_phy_update_channel_gain(struct mt76x2_dev *dev) |
5716 |
+ u8 gain_delta; |
5717 |
+ int low_gain; |
5718 |
+ |
5719 |
+- dev->cal.avg_rssi[0] = (dev->cal.avg_rssi[0] * 15) / 16 + (rssi0 << 8); |
5720 |
+- dev->cal.avg_rssi[1] = (dev->cal.avg_rssi[1] * 15) / 16 + (rssi1 << 8); |
5721 |
++ dev->cal.avg_rssi[0] = (dev->cal.avg_rssi[0] * 15) / 16 + |
5722 |
++ (rssi0 << 8) / 16; |
5723 |
++ dev->cal.avg_rssi[1] = (dev->cal.avg_rssi[1] * 15) / 16 + |
5724 |
++ (rssi1 << 8) / 16; |
5725 |
+ dev->cal.avg_rssi_all = (dev->cal.avg_rssi[0] + |
5726 |
+ dev->cal.avg_rssi[1]) / 512; |
5727 |
+ |
5728 |
+diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c |
5729 |
+index 4eef69bd8a9e..6aca794cf998 100644 |
5730 |
+--- a/drivers/net/wireless/mediatek/mt76/tx.c |
5731 |
++++ b/drivers/net/wireless/mediatek/mt76/tx.c |
5732 |
+@@ -422,12 +422,14 @@ void mt76_txq_schedule(struct mt76_dev *dev, struct mt76_queue *hwq) |
5733 |
+ { |
5734 |
+ int len; |
5735 |
+ |
5736 |
++ rcu_read_lock(); |
5737 |
+ do { |
5738 |
+ if (hwq->swq_queued >= 4 || list_empty(&hwq->swq)) |
5739 |
+ break; |
5740 |
+ |
5741 |
+ len = mt76_txq_schedule_list(dev, hwq); |
5742 |
+ } while (len > 0); |
5743 |
++ rcu_read_unlock(); |
5744 |
+ } |
5745 |
+ EXPORT_SYMBOL_GPL(mt76_txq_schedule); |
5746 |
+ |
5747 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c |
5748 |
+index 0398bece5782..a5f0306a7e29 100644 |
5749 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c |
5750 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c |
5751 |
+@@ -651,28 +651,35 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, |
5752 |
+ { |
5753 |
+ struct qtnf_wmac *mac = wiphy_priv(wiphy); |
5754 |
+ struct qtnf_vif *vif; |
5755 |
+- int ret; |
5756 |
++ int ret = 0; |
5757 |
+ |
5758 |
+ vif = qtnf_mac_get_base_vif(mac); |
5759 |
+ if (!vif) { |
5760 |
+ pr_err("MAC%u: primary VIF is not configured\n", mac->macid); |
5761 |
+- return -EFAULT; |
5762 |
++ ret = -EFAULT; |
5763 |
++ goto out; |
5764 |
+ } |
5765 |
+ |
5766 |
+- if (vif->wdev.iftype != NL80211_IFTYPE_STATION) |
5767 |
+- return -EOPNOTSUPP; |
5768 |
++ if (vif->wdev.iftype != NL80211_IFTYPE_STATION) { |
5769 |
++ ret = -EOPNOTSUPP; |
5770 |
++ goto out; |
5771 |
++ } |
5772 |
+ |
5773 |
+ if (vif->sta_state == QTNF_STA_DISCONNECTED) |
5774 |
+- return 0; |
5775 |
++ goto out; |
5776 |
+ |
5777 |
+ ret = qtnf_cmd_send_disconnect(vif, reason_code); |
5778 |
+ if (ret) { |
5779 |
+ pr_err("VIF%u.%u: failed to disconnect\n", mac->macid, |
5780 |
+ vif->vifid); |
5781 |
+- return ret; |
5782 |
++ goto out; |
5783 |
+ } |
5784 |
+ |
5785 |
+- return 0; |
5786 |
++out: |
5787 |
++ if (vif->sta_state == QTNF_STA_CONNECTING) |
5788 |
++ vif->sta_state = QTNF_STA_DISCONNECTED; |
5789 |
++ |
5790 |
++ return ret; |
5791 |
+ } |
5792 |
+ |
5793 |
+ static int |
5794 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c |
5795 |
+index bcd415f96412..77ee6439ec6e 100644 |
5796 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/event.c |
5797 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/event.c |
5798 |
+@@ -198,11 +198,9 @@ qtnf_event_handle_bss_leave(struct qtnf_vif *vif, |
5799 |
+ return -EPROTO; |
5800 |
+ } |
5801 |
+ |
5802 |
+- if (vif->sta_state != QTNF_STA_CONNECTED) { |
5803 |
+- pr_err("VIF%u.%u: BSS_LEAVE event when STA is not connected\n", |
5804 |
+- vif->mac->macid, vif->vifid); |
5805 |
+- return -EPROTO; |
5806 |
+- } |
5807 |
++ if (vif->sta_state != QTNF_STA_CONNECTED) |
5808 |
++ pr_warn("VIF%u.%u: BSS_LEAVE event when STA is not connected\n", |
5809 |
++ vif->mac->macid, vif->vifid); |
5810 |
+ |
5811 |
+ pr_debug("VIF%u.%u: disconnected\n", vif->mac->macid, vif->vifid); |
5812 |
+ |
5813 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c |
5814 |
+index f117904d9120..6c1e139bb8f7 100644 |
5815 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c |
5816 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c |
5817 |
+@@ -1185,6 +1185,10 @@ static void qtnf_fw_work_handler(struct work_struct *work) |
5818 |
+ if (qtnf_poll_state(&priv->bda->bda_ep_state, QTN_EP_FW_LOADRDY, |
5819 |
+ QTN_FW_DL_TIMEOUT_MS)) { |
5820 |
+ pr_err("card is not ready\n"); |
5821 |
++ |
5822 |
++ if (!flashboot) |
5823 |
++ release_firmware(fw); |
5824 |
++ |
5825 |
+ goto fw_load_fail; |
5826 |
+ } |
5827 |
+ |
5828 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c |
5829 |
+index de608ae365a4..5425726d509b 100644 |
5830 |
+--- a/drivers/net/wireless/rsi/rsi_91x_hal.c |
5831 |
++++ b/drivers/net/wireless/rsi/rsi_91x_hal.c |
5832 |
+@@ -616,28 +616,32 @@ static int bl_write_header(struct rsi_hw *adapter, u8 *flash_content, |
5833 |
+ u32 content_size) |
5834 |
+ { |
5835 |
+ struct rsi_host_intf_ops *hif_ops = adapter->host_intf_ops; |
5836 |
+- struct bl_header bl_hdr; |
5837 |
++ struct bl_header *bl_hdr; |
5838 |
+ u32 write_addr, write_len; |
5839 |
+ int status; |
5840 |
+ |
5841 |
+- bl_hdr.flags = 0; |
5842 |
+- bl_hdr.image_no = cpu_to_le32(adapter->priv->coex_mode); |
5843 |
+- bl_hdr.check_sum = cpu_to_le32( |
5844 |
+- *(u32 *)&flash_content[CHECK_SUM_OFFSET]); |
5845 |
+- bl_hdr.flash_start_address = cpu_to_le32( |
5846 |
+- *(u32 *)&flash_content[ADDR_OFFSET]); |
5847 |
+- bl_hdr.flash_len = cpu_to_le32(*(u32 *)&flash_content[LEN_OFFSET]); |
5848 |
++ bl_hdr = kzalloc(sizeof(*bl_hdr), GFP_KERNEL); |
5849 |
++ if (!bl_hdr) |
5850 |
++ return -ENOMEM; |
5851 |
++ |
5852 |
++ bl_hdr->flags = 0; |
5853 |
++ bl_hdr->image_no = cpu_to_le32(adapter->priv->coex_mode); |
5854 |
++ bl_hdr->check_sum = |
5855 |
++ cpu_to_le32(*(u32 *)&flash_content[CHECK_SUM_OFFSET]); |
5856 |
++ bl_hdr->flash_start_address = |
5857 |
++ cpu_to_le32(*(u32 *)&flash_content[ADDR_OFFSET]); |
5858 |
++ bl_hdr->flash_len = cpu_to_le32(*(u32 *)&flash_content[LEN_OFFSET]); |
5859 |
+ write_len = sizeof(struct bl_header); |
5860 |
+ |
5861 |
+ if (adapter->rsi_host_intf == RSI_HOST_INTF_USB) { |
5862 |
+ write_addr = PING_BUFFER_ADDRESS; |
5863 |
+ status = hif_ops->write_reg_multiple(adapter, write_addr, |
5864 |
+- (u8 *)&bl_hdr, write_len); |
5865 |
++ (u8 *)bl_hdr, write_len); |
5866 |
+ if (status < 0) { |
5867 |
+ rsi_dbg(ERR_ZONE, |
5868 |
+ "%s: Failed to load Version/CRC structure\n", |
5869 |
+ __func__); |
5870 |
+- return status; |
5871 |
++ goto fail; |
5872 |
+ } |
5873 |
+ } else { |
5874 |
+ write_addr = PING_BUFFER_ADDRESS >> 16; |
5875 |
+@@ -646,20 +650,23 @@ static int bl_write_header(struct rsi_hw *adapter, u8 *flash_content, |
5876 |
+ rsi_dbg(ERR_ZONE, |
5877 |
+ "%s: Unable to set ms word to common reg\n", |
5878 |
+ __func__); |
5879 |
+- return status; |
5880 |
++ goto fail; |
5881 |
+ } |
5882 |
+ write_addr = RSI_SD_REQUEST_MASTER | |
5883 |
+ (PING_BUFFER_ADDRESS & 0xFFFF); |
5884 |
+ status = hif_ops->write_reg_multiple(adapter, write_addr, |
5885 |
+- (u8 *)&bl_hdr, write_len); |
5886 |
++ (u8 *)bl_hdr, write_len); |
5887 |
+ if (status < 0) { |
5888 |
+ rsi_dbg(ERR_ZONE, |
5889 |
+ "%s: Failed to load Version/CRC structure\n", |
5890 |
+ __func__); |
5891 |
+- return status; |
5892 |
++ goto fail; |
5893 |
+ } |
5894 |
+ } |
5895 |
+- return 0; |
5896 |
++ status = 0; |
5897 |
++fail: |
5898 |
++ kfree(bl_hdr); |
5899 |
++ return status; |
5900 |
+ } |
5901 |
+ |
5902 |
+ static u32 read_flash_capacity(struct rsi_hw *adapter) |
5903 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5904 |
+index 32f5cb46fd4f..8f83303365c8 100644 |
5905 |
+--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5906 |
++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5907 |
+@@ -1788,10 +1788,15 @@ int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan) |
5908 |
+ struct rsi_common *common = adapter->priv; |
5909 |
+ u16 triggers = 0; |
5910 |
+ u16 rx_filter_word = 0; |
5911 |
+- struct ieee80211_bss_conf *bss = &adapter->vifs[0]->bss_conf; |
5912 |
++ struct ieee80211_bss_conf *bss = NULL; |
5913 |
+ |
5914 |
+ rsi_dbg(INFO_ZONE, "Config WoWLAN to device\n"); |
5915 |
+ |
5916 |
++ if (!adapter->vifs[0]) |
5917 |
++ return -EINVAL; |
5918 |
++ |
5919 |
++ bss = &adapter->vifs[0]->bss_conf; |
5920 |
++ |
5921 |
+ if (WARN_ON(!wowlan)) { |
5922 |
+ rsi_dbg(ERR_ZONE, "WoW triggers not enabled\n"); |
5923 |
+ return -EINVAL; |
5924 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c |
5925 |
+index d76e69c0beaa..ffea376260eb 100644 |
5926 |
+--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c |
5927 |
++++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c |
5928 |
+@@ -170,7 +170,6 @@ static void rsi_reset_card(struct sdio_func *pfunction) |
5929 |
+ int err; |
5930 |
+ struct mmc_card *card = pfunction->card; |
5931 |
+ struct mmc_host *host = card->host; |
5932 |
+- s32 bit = (fls(host->ocr_avail) - 1); |
5933 |
+ u8 cmd52_resp; |
5934 |
+ u32 clock, resp, i; |
5935 |
+ u16 rca; |
5936 |
+@@ -190,7 +189,6 @@ static void rsi_reset_card(struct sdio_func *pfunction) |
5937 |
+ msleep(20); |
5938 |
+ |
5939 |
+ /* Initialize the SDIO card */ |
5940 |
+- host->ios.vdd = bit; |
5941 |
+ host->ios.chip_select = MMC_CS_DONTCARE; |
5942 |
+ host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; |
5943 |
+ host->ios.power_mode = MMC_POWER_UP; |
5944 |
+@@ -1042,17 +1040,21 @@ static void ulp_read_write(struct rsi_hw *adapter, u16 addr, u32 data, |
5945 |
+ /*This function resets and re-initializes the chip.*/ |
5946 |
+ static void rsi_reset_chip(struct rsi_hw *adapter) |
5947 |
+ { |
5948 |
+- __le32 data; |
5949 |
++ u8 *data; |
5950 |
+ u8 sdio_interrupt_status = 0; |
5951 |
+ u8 request = 1; |
5952 |
+ int ret; |
5953 |
+ |
5954 |
++ data = kzalloc(sizeof(u32), GFP_KERNEL); |
5955 |
++ if (!data) |
5956 |
++ return; |
5957 |
++ |
5958 |
+ rsi_dbg(INFO_ZONE, "Writing disable to wakeup register\n"); |
5959 |
+ ret = rsi_sdio_write_register(adapter, 0, SDIO_WAKEUP_REG, &request); |
5960 |
+ if (ret < 0) { |
5961 |
+ rsi_dbg(ERR_ZONE, |
5962 |
+ "%s: Failed to write SDIO wakeup register\n", __func__); |
5963 |
+- return; |
5964 |
++ goto err; |
5965 |
+ } |
5966 |
+ msleep(20); |
5967 |
+ ret = rsi_sdio_read_register(adapter, RSI_FN1_INT_REGISTER, |
5968 |
+@@ -1060,7 +1062,7 @@ static void rsi_reset_chip(struct rsi_hw *adapter) |
5969 |
+ if (ret < 0) { |
5970 |
+ rsi_dbg(ERR_ZONE, "%s: Failed to Read Intr Status Register\n", |
5971 |
+ __func__); |
5972 |
+- return; |
5973 |
++ goto err; |
5974 |
+ } |
5975 |
+ rsi_dbg(INFO_ZONE, "%s: Intr Status Register value = %d\n", |
5976 |
+ __func__, sdio_interrupt_status); |
5977 |
+@@ -1070,17 +1072,17 @@ static void rsi_reset_chip(struct rsi_hw *adapter) |
5978 |
+ rsi_dbg(ERR_ZONE, |
5979 |
+ "%s: Unable to set ms word to common reg\n", |
5980 |
+ __func__); |
5981 |
+- return; |
5982 |
++ goto err; |
5983 |
+ } |
5984 |
+ |
5985 |
+- data = TA_HOLD_THREAD_VALUE; |
5986 |
++ put_unaligned_le32(TA_HOLD_THREAD_VALUE, data); |
5987 |
+ if (rsi_sdio_write_register_multiple(adapter, TA_HOLD_THREAD_REG | |
5988 |
+ RSI_SD_REQUEST_MASTER, |
5989 |
+- (u8 *)&data, 4)) { |
5990 |
++ data, 4)) { |
5991 |
+ rsi_dbg(ERR_ZONE, |
5992 |
+ "%s: Unable to hold Thread-Arch processor threads\n", |
5993 |
+ __func__); |
5994 |
+- return; |
5995 |
++ goto err; |
5996 |
+ } |
5997 |
+ |
5998 |
+ /* This msleep will ensure Thread-Arch processor to go to hold |
5999 |
+@@ -1101,6 +1103,9 @@ static void rsi_reset_chip(struct rsi_hw *adapter) |
6000 |
+ * read write operations to complete for chip reset. |
6001 |
+ */ |
6002 |
+ msleep(500); |
6003 |
++err: |
6004 |
++ kfree(data); |
6005 |
++ return; |
6006 |
+ } |
6007 |
+ |
6008 |
+ /** |
6009 |
+diff --git a/drivers/net/wireless/rsi/rsi_sdio.h b/drivers/net/wireless/rsi/rsi_sdio.h |
6010 |
+index ead8e7c4df3a..353dbdf31e75 100644 |
6011 |
+--- a/drivers/net/wireless/rsi/rsi_sdio.h |
6012 |
++++ b/drivers/net/wireless/rsi/rsi_sdio.h |
6013 |
+@@ -87,7 +87,7 @@ enum sdio_interrupt_type { |
6014 |
+ #define TA_SOFT_RST_CLR 0 |
6015 |
+ #define TA_SOFT_RST_SET BIT(0) |
6016 |
+ #define TA_PC_ZERO 0 |
6017 |
+-#define TA_HOLD_THREAD_VALUE cpu_to_le32(0xF) |
6018 |
++#define TA_HOLD_THREAD_VALUE 0xF |
6019 |
+ #define TA_RELEASE_THREAD_VALUE cpu_to_le32(0xF) |
6020 |
+ #define TA_BASE_ADDR 0x2200 |
6021 |
+ #define MISC_CFG_BASE_ADDR 0x4105 |
6022 |
+diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c |
6023 |
+index 1f727babbea0..5de8305a6fd6 100644 |
6024 |
+--- a/drivers/net/wireless/ti/wlcore/sdio.c |
6025 |
++++ b/drivers/net/wireless/ti/wlcore/sdio.c |
6026 |
+@@ -406,6 +406,11 @@ static int wl1271_suspend(struct device *dev) |
6027 |
+ mmc_pm_flag_t sdio_flags; |
6028 |
+ int ret = 0; |
6029 |
+ |
6030 |
++ if (!wl) { |
6031 |
++ dev_err(dev, "no wilink module was probed\n"); |
6032 |
++ goto out; |
6033 |
++ } |
6034 |
++ |
6035 |
+ dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n", |
6036 |
+ wl->wow_enabled); |
6037 |
+ |
6038 |
+diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
6039 |
+index 1d5082d30187..42e93cb4eca7 100644 |
6040 |
+--- a/drivers/net/xen-netfront.c |
6041 |
++++ b/drivers/net/xen-netfront.c |
6042 |
+@@ -87,6 +87,7 @@ struct netfront_cb { |
6043 |
+ /* IRQ name is queue name with "-tx" or "-rx" appended */ |
6044 |
+ #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) |
6045 |
+ |
6046 |
++static DECLARE_WAIT_QUEUE_HEAD(module_load_q); |
6047 |
+ static DECLARE_WAIT_QUEUE_HEAD(module_unload_q); |
6048 |
+ |
6049 |
+ struct netfront_stats { |
6050 |
+@@ -239,7 +240,7 @@ static void rx_refill_timeout(struct timer_list *t) |
6051 |
+ static int netfront_tx_slot_available(struct netfront_queue *queue) |
6052 |
+ { |
6053 |
+ return (queue->tx.req_prod_pvt - queue->tx.rsp_cons) < |
6054 |
+- (NET_TX_RING_SIZE - MAX_SKB_FRAGS - 2); |
6055 |
++ (NET_TX_RING_SIZE - XEN_NETIF_NR_SLOTS_MIN - 1); |
6056 |
+ } |
6057 |
+ |
6058 |
+ static void xennet_maybe_wake_tx(struct netfront_queue *queue) |
6059 |
+@@ -790,7 +791,7 @@ static int xennet_get_responses(struct netfront_queue *queue, |
6060 |
+ RING_IDX cons = queue->rx.rsp_cons; |
6061 |
+ struct sk_buff *skb = xennet_get_rx_skb(queue, cons); |
6062 |
+ grant_ref_t ref = xennet_get_rx_ref(queue, cons); |
6063 |
+- int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD); |
6064 |
++ int max = XEN_NETIF_NR_SLOTS_MIN + (rx->status <= RX_COPY_THRESHOLD); |
6065 |
+ int slots = 1; |
6066 |
+ int err = 0; |
6067 |
+ unsigned long ret; |
6068 |
+@@ -1330,6 +1331,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) |
6069 |
+ netif_carrier_off(netdev); |
6070 |
+ |
6071 |
+ xenbus_switch_state(dev, XenbusStateInitialising); |
6072 |
++ wait_event(module_load_q, |
6073 |
++ xenbus_read_driver_state(dev->otherend) != |
6074 |
++ XenbusStateClosed && |
6075 |
++ xenbus_read_driver_state(dev->otherend) != |
6076 |
++ XenbusStateUnknown); |
6077 |
+ return netdev; |
6078 |
+ |
6079 |
+ exit: |
6080 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
6081 |
+index 5dbb0f0c02ef..0483c33a3567 100644 |
6082 |
+--- a/drivers/nvme/host/pci.c |
6083 |
++++ b/drivers/nvme/host/pci.c |
6084 |
+@@ -2679,19 +2679,15 @@ static pci_ers_result_t nvme_slot_reset(struct pci_dev *pdev) |
6085 |
+ |
6086 |
+ dev_info(dev->ctrl.device, "restart after slot reset\n"); |
6087 |
+ pci_restore_state(pdev); |
6088 |
+- nvme_reset_ctrl_sync(&dev->ctrl); |
6089 |
+- |
6090 |
+- switch (dev->ctrl.state) { |
6091 |
+- case NVME_CTRL_LIVE: |
6092 |
+- case NVME_CTRL_ADMIN_ONLY: |
6093 |
+- return PCI_ERS_RESULT_RECOVERED; |
6094 |
+- default: |
6095 |
+- return PCI_ERS_RESULT_DISCONNECT; |
6096 |
+- } |
6097 |
++ nvme_reset_ctrl(&dev->ctrl); |
6098 |
++ return PCI_ERS_RESULT_RECOVERED; |
6099 |
+ } |
6100 |
+ |
6101 |
+ static void nvme_error_resume(struct pci_dev *pdev) |
6102 |
+ { |
6103 |
++ struct nvme_dev *dev = pci_get_drvdata(pdev); |
6104 |
++ |
6105 |
++ flush_work(&dev->ctrl.reset_work); |
6106 |
+ pci_cleanup_aer_uncorrect_error_status(pdev); |
6107 |
+ } |
6108 |
+ |
6109 |
+@@ -2735,6 +2731,8 @@ static const struct pci_device_id nvme_id_table[] = { |
6110 |
+ .driver_data = NVME_QUIRK_LIGHTNVM, }, |
6111 |
+ { PCI_DEVICE(0x1d1d, 0x2807), /* CNEX WL */ |
6112 |
+ .driver_data = NVME_QUIRK_LIGHTNVM, }, |
6113 |
++ { PCI_DEVICE(0x1d1d, 0x2601), /* CNEX Granby */ |
6114 |
++ .driver_data = NVME_QUIRK_LIGHTNVM, }, |
6115 |
+ { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
6116 |
+ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, |
6117 |
+ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, |
6118 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
6119 |
+index 1eb4438a8763..2181299ce8f5 100644 |
6120 |
+--- a/drivers/nvme/host/rdma.c |
6121 |
++++ b/drivers/nvme/host/rdma.c |
6122 |
+@@ -778,7 +778,7 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, |
6123 |
+ if (error) { |
6124 |
+ dev_err(ctrl->ctrl.device, |
6125 |
+ "prop_get NVME_REG_CAP failed\n"); |
6126 |
+- goto out_cleanup_queue; |
6127 |
++ goto out_stop_queue; |
6128 |
+ } |
6129 |
+ |
6130 |
+ ctrl->ctrl.sqsize = |
6131 |
+@@ -786,23 +786,25 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, |
6132 |
+ |
6133 |
+ error = nvme_enable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap); |
6134 |
+ if (error) |
6135 |
+- goto out_cleanup_queue; |
6136 |
++ goto out_stop_queue; |
6137 |
+ |
6138 |
+ ctrl->ctrl.max_hw_sectors = |
6139 |
+ (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9); |
6140 |
+ |
6141 |
+ error = nvme_init_identify(&ctrl->ctrl); |
6142 |
+ if (error) |
6143 |
+- goto out_cleanup_queue; |
6144 |
++ goto out_stop_queue; |
6145 |
+ |
6146 |
+ error = nvme_rdma_alloc_qe(ctrl->queues[0].device->dev, |
6147 |
+ &ctrl->async_event_sqe, sizeof(struct nvme_command), |
6148 |
+ DMA_TO_DEVICE); |
6149 |
+ if (error) |
6150 |
+- goto out_cleanup_queue; |
6151 |
++ goto out_stop_queue; |
6152 |
+ |
6153 |
+ return 0; |
6154 |
+ |
6155 |
++out_stop_queue: |
6156 |
++ nvme_rdma_stop_queue(&ctrl->queues[0]); |
6157 |
+ out_cleanup_queue: |
6158 |
+ if (new) |
6159 |
+ blk_cleanup_queue(ctrl->ctrl.admin_q); |
6160 |
+diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c |
6161 |
+index 33ee8d3145f8..9fb28e076c26 100644 |
6162 |
+--- a/drivers/nvme/target/fc.c |
6163 |
++++ b/drivers/nvme/target/fc.c |
6164 |
+@@ -58,8 +58,8 @@ struct nvmet_fc_ls_iod { |
6165 |
+ struct work_struct work; |
6166 |
+ } __aligned(sizeof(unsigned long long)); |
6167 |
+ |
6168 |
++/* desired maximum for a single sequence - if sg list allows it */ |
6169 |
+ #define NVMET_FC_MAX_SEQ_LENGTH (256 * 1024) |
6170 |
+-#define NVMET_FC_MAX_XFR_SGENTS (NVMET_FC_MAX_SEQ_LENGTH / PAGE_SIZE) |
6171 |
+ |
6172 |
+ enum nvmet_fcp_datadir { |
6173 |
+ NVMET_FCP_NODATA, |
6174 |
+@@ -74,6 +74,7 @@ struct nvmet_fc_fcp_iod { |
6175 |
+ struct nvme_fc_cmd_iu cmdiubuf; |
6176 |
+ struct nvme_fc_ersp_iu rspiubuf; |
6177 |
+ dma_addr_t rspdma; |
6178 |
++ struct scatterlist *next_sg; |
6179 |
+ struct scatterlist *data_sg; |
6180 |
+ int data_sg_cnt; |
6181 |
+ u32 offset; |
6182 |
+@@ -1025,8 +1026,7 @@ nvmet_fc_register_targetport(struct nvmet_fc_port_info *pinfo, |
6183 |
+ INIT_LIST_HEAD(&newrec->assoc_list); |
6184 |
+ kref_init(&newrec->ref); |
6185 |
+ ida_init(&newrec->assoc_cnt); |
6186 |
+- newrec->max_sg_cnt = min_t(u32, NVMET_FC_MAX_XFR_SGENTS, |
6187 |
+- template->max_sgl_segments); |
6188 |
++ newrec->max_sg_cnt = template->max_sgl_segments; |
6189 |
+ |
6190 |
+ ret = nvmet_fc_alloc_ls_iodlist(newrec); |
6191 |
+ if (ret) { |
6192 |
+@@ -1722,6 +1722,7 @@ nvmet_fc_alloc_tgt_pgs(struct nvmet_fc_fcp_iod *fod) |
6193 |
+ ((fod->io_dir == NVMET_FCP_WRITE) ? |
6194 |
+ DMA_FROM_DEVICE : DMA_TO_DEVICE)); |
6195 |
+ /* note: write from initiator perspective */ |
6196 |
++ fod->next_sg = fod->data_sg; |
6197 |
+ |
6198 |
+ return 0; |
6199 |
+ |
6200 |
+@@ -1866,24 +1867,49 @@ nvmet_fc_transfer_fcp_data(struct nvmet_fc_tgtport *tgtport, |
6201 |
+ struct nvmet_fc_fcp_iod *fod, u8 op) |
6202 |
+ { |
6203 |
+ struct nvmefc_tgt_fcp_req *fcpreq = fod->fcpreq; |
6204 |
++ struct scatterlist *sg = fod->next_sg; |
6205 |
+ unsigned long flags; |
6206 |
+- u32 tlen; |
6207 |
++ u32 remaininglen = fod->req.transfer_len - fod->offset; |
6208 |
++ u32 tlen = 0; |
6209 |
+ int ret; |
6210 |
+ |
6211 |
+ fcpreq->op = op; |
6212 |
+ fcpreq->offset = fod->offset; |
6213 |
+ fcpreq->timeout = NVME_FC_TGTOP_TIMEOUT_SEC; |
6214 |
+ |
6215 |
+- tlen = min_t(u32, tgtport->max_sg_cnt * PAGE_SIZE, |
6216 |
+- (fod->req.transfer_len - fod->offset)); |
6217 |
++ /* |
6218 |
++ * for next sequence: |
6219 |
++ * break at a sg element boundary |
6220 |
++ * attempt to keep sequence length capped at |
6221 |
++ * NVMET_FC_MAX_SEQ_LENGTH but allow sequence to |
6222 |
++ * be longer if a single sg element is larger |
6223 |
++ * than that amount. This is done to avoid creating |
6224 |
++ * a new sg list to use for the tgtport api. |
6225 |
++ */ |
6226 |
++ fcpreq->sg = sg; |
6227 |
++ fcpreq->sg_cnt = 0; |
6228 |
++ while (tlen < remaininglen && |
6229 |
++ fcpreq->sg_cnt < tgtport->max_sg_cnt && |
6230 |
++ tlen + sg_dma_len(sg) < NVMET_FC_MAX_SEQ_LENGTH) { |
6231 |
++ fcpreq->sg_cnt++; |
6232 |
++ tlen += sg_dma_len(sg); |
6233 |
++ sg = sg_next(sg); |
6234 |
++ } |
6235 |
++ if (tlen < remaininglen && fcpreq->sg_cnt == 0) { |
6236 |
++ fcpreq->sg_cnt++; |
6237 |
++ tlen += min_t(u32, sg_dma_len(sg), remaininglen); |
6238 |
++ sg = sg_next(sg); |
6239 |
++ } |
6240 |
++ if (tlen < remaininglen) |
6241 |
++ fod->next_sg = sg; |
6242 |
++ else |
6243 |
++ fod->next_sg = NULL; |
6244 |
++ |
6245 |
+ fcpreq->transfer_length = tlen; |
6246 |
+ fcpreq->transferred_length = 0; |
6247 |
+ fcpreq->fcp_error = 0; |
6248 |
+ fcpreq->rsplen = 0; |
6249 |
+ |
6250 |
+- fcpreq->sg = &fod->data_sg[fod->offset / PAGE_SIZE]; |
6251 |
+- fcpreq->sg_cnt = DIV_ROUND_UP(tlen, PAGE_SIZE); |
6252 |
+- |
6253 |
+ /* |
6254 |
+ * If the last READDATA request: check if LLDD supports |
6255 |
+ * combined xfr with response. |
6256 |
+diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c |
6257 |
+index b05aa8e81303..1e28597138c8 100644 |
6258 |
+--- a/drivers/nvmem/core.c |
6259 |
++++ b/drivers/nvmem/core.c |
6260 |
+@@ -1107,6 +1107,8 @@ static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, |
6261 |
+ |
6262 |
+ /* setup the first byte with lsb bits from nvmem */ |
6263 |
+ rc = nvmem_reg_read(nvmem, cell->offset, &v, 1); |
6264 |
++ if (rc) |
6265 |
++ goto err; |
6266 |
+ *b++ |= GENMASK(bit_offset - 1, 0) & v; |
6267 |
+ |
6268 |
+ /* setup rest of the byte if any */ |
6269 |
+@@ -1125,11 +1127,16 @@ static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, |
6270 |
+ /* setup the last byte with msb bits from nvmem */ |
6271 |
+ rc = nvmem_reg_read(nvmem, |
6272 |
+ cell->offset + cell->bytes - 1, &v, 1); |
6273 |
++ if (rc) |
6274 |
++ goto err; |
6275 |
+ *p |= GENMASK(7, (nbits + bit_offset) % BITS_PER_BYTE) & v; |
6276 |
+ |
6277 |
+ } |
6278 |
+ |
6279 |
+ return buf; |
6280 |
++err: |
6281 |
++ kfree(buf); |
6282 |
++ return ERR_PTR(rc); |
6283 |
+ } |
6284 |
+ |
6285 |
+ /** |
6286 |
+diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c |
6287 |
+index 366d93af051d..788a200fb2dc 100644 |
6288 |
+--- a/drivers/pci/pci-sysfs.c |
6289 |
++++ b/drivers/pci/pci-sysfs.c |
6290 |
+@@ -288,13 +288,16 @@ static ssize_t enable_store(struct device *dev, struct device_attribute *attr, |
6291 |
+ if (!capable(CAP_SYS_ADMIN)) |
6292 |
+ return -EPERM; |
6293 |
+ |
6294 |
+- if (!val) { |
6295 |
+- if (pci_is_enabled(pdev)) |
6296 |
+- pci_disable_device(pdev); |
6297 |
+- else |
6298 |
+- result = -EIO; |
6299 |
+- } else |
6300 |
++ device_lock(dev); |
6301 |
++ if (dev->driver) |
6302 |
++ result = -EBUSY; |
6303 |
++ else if (val) |
6304 |
+ result = pci_enable_device(pdev); |
6305 |
++ else if (pci_is_enabled(pdev)) |
6306 |
++ pci_disable_device(pdev); |
6307 |
++ else |
6308 |
++ result = -EIO; |
6309 |
++ device_unlock(dev); |
6310 |
+ |
6311 |
+ return result < 0 ? result : count; |
6312 |
+ } |
6313 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
6314 |
+index f76eb7704f64..c687c817b47d 100644 |
6315 |
+--- a/drivers/pci/pcie/aspm.c |
6316 |
++++ b/drivers/pci/pcie/aspm.c |
6317 |
+@@ -400,6 +400,15 @@ static void pcie_get_aspm_reg(struct pci_dev *pdev, |
6318 |
+ info->l1ss_cap = 0; |
6319 |
+ return; |
6320 |
+ } |
6321 |
++ |
6322 |
++ /* |
6323 |
++ * If we don't have LTR for the entire path from the Root Complex |
6324 |
++ * to this device, we can't use ASPM L1.2 because it relies on the |
6325 |
++ * LTR_L1.2_THRESHOLD. See PCIe r4.0, secs 5.5.4, 6.18. |
6326 |
++ */ |
6327 |
++ if (!pdev->ltr_path) |
6328 |
++ info->l1ss_cap &= ~PCI_L1SS_CAP_ASPM_L1_2; |
6329 |
++ |
6330 |
+ pci_read_config_dword(pdev, info->l1ss_cap_ptr + PCI_L1SS_CTL1, |
6331 |
+ &info->l1ss_ctl1); |
6332 |
+ pci_read_config_dword(pdev, info->l1ss_cap_ptr + PCI_L1SS_CTL2, |
6333 |
+diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c |
6334 |
+index 8c57d607e603..74562dbacbf1 100644 |
6335 |
+--- a/drivers/pci/pcie/dpc.c |
6336 |
++++ b/drivers/pci/pcie/dpc.c |
6337 |
+@@ -113,7 +113,7 @@ static void dpc_work(struct work_struct *work) |
6338 |
+ } |
6339 |
+ |
6340 |
+ pci_write_config_word(pdev, cap + PCI_EXP_DPC_STATUS, |
6341 |
+- PCI_EXP_DPC_STATUS_TRIGGER | PCI_EXP_DPC_STATUS_INTERRUPT); |
6342 |
++ PCI_EXP_DPC_STATUS_TRIGGER); |
6343 |
+ |
6344 |
+ pci_read_config_word(pdev, cap + PCI_EXP_DPC_CTL, &ctl); |
6345 |
+ pci_write_config_word(pdev, cap + PCI_EXP_DPC_CTL, |
6346 |
+@@ -223,6 +223,9 @@ static irqreturn_t dpc_irq(int irq, void *context) |
6347 |
+ if (dpc->rp_extensions && reason == 3 && ext_reason == 0) |
6348 |
+ dpc_process_rp_pio_error(dpc); |
6349 |
+ |
6350 |
++ pci_write_config_word(pdev, cap + PCI_EXP_DPC_STATUS, |
6351 |
++ PCI_EXP_DPC_STATUS_INTERRUPT); |
6352 |
++ |
6353 |
+ schedule_work(&dpc->work); |
6354 |
+ |
6355 |
+ return IRQ_HANDLED; |
6356 |
+diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
6357 |
+index 73ac02796ba9..d21686ad3ce5 100644 |
6358 |
+--- a/drivers/pci/probe.c |
6359 |
++++ b/drivers/pci/probe.c |
6360 |
+@@ -526,12 +526,14 @@ static void devm_pci_release_host_bridge_dev(struct device *dev) |
6361 |
+ |
6362 |
+ if (bridge->release_fn) |
6363 |
+ bridge->release_fn(bridge); |
6364 |
++ |
6365 |
++ pci_free_resource_list(&bridge->windows); |
6366 |
+ } |
6367 |
+ |
6368 |
+ static void pci_release_host_bridge_dev(struct device *dev) |
6369 |
+ { |
6370 |
+ devm_pci_release_host_bridge_dev(dev); |
6371 |
+- pci_free_host_bridge(to_pci_host_bridge(dev)); |
6372 |
++ kfree(to_pci_host_bridge(dev)); |
6373 |
+ } |
6374 |
+ |
6375 |
+ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) |
6376 |
+diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c |
6377 |
+index 383b2d3dcbc6..687ae8e674db 100644 |
6378 |
+--- a/drivers/perf/arm-cci.c |
6379 |
++++ b/drivers/perf/arm-cci.c |
6380 |
+@@ -120,9 +120,9 @@ enum cci_models { |
6381 |
+ |
6382 |
+ static void pmu_write_counters(struct cci_pmu *cci_pmu, |
6383 |
+ unsigned long *mask); |
6384 |
+-static ssize_t cci_pmu_format_show(struct device *dev, |
6385 |
++static ssize_t __maybe_unused cci_pmu_format_show(struct device *dev, |
6386 |
+ struct device_attribute *attr, char *buf); |
6387 |
+-static ssize_t cci_pmu_event_show(struct device *dev, |
6388 |
++static ssize_t __maybe_unused cci_pmu_event_show(struct device *dev, |
6389 |
+ struct device_attribute *attr, char *buf); |
6390 |
+ |
6391 |
+ #define CCI_EXT_ATTR_ENTRY(_name, _func, _config) \ |
6392 |
+@@ -1466,7 +1466,7 @@ static int cci_pmu_offline_cpu(unsigned int cpu) |
6393 |
+ return 0; |
6394 |
+ } |
6395 |
+ |
6396 |
+-static struct cci_pmu_model cci_pmu_models[] = { |
6397 |
++static __maybe_unused struct cci_pmu_model cci_pmu_models[] = { |
6398 |
+ #ifdef CONFIG_ARM_CCI400_PMU |
6399 |
+ [CCI400_R0] = { |
6400 |
+ .name = "CCI_400", |
6401 |
+diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c |
6402 |
+index 65b7e4042ece..07771e28f572 100644 |
6403 |
+--- a/drivers/perf/arm-ccn.c |
6404 |
++++ b/drivers/perf/arm-ccn.c |
6405 |
+@@ -736,7 +736,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) |
6406 |
+ ccn = pmu_to_arm_ccn(event->pmu); |
6407 |
+ |
6408 |
+ if (hw->sample_period) { |
6409 |
+- dev_warn(ccn->dev, "Sampling not supported!\n"); |
6410 |
++ dev_dbg(ccn->dev, "Sampling not supported!\n"); |
6411 |
+ return -EOPNOTSUPP; |
6412 |
+ } |
6413 |
+ |
6414 |
+@@ -744,12 +744,12 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) |
6415 |
+ event->attr.exclude_kernel || event->attr.exclude_hv || |
6416 |
+ event->attr.exclude_idle || event->attr.exclude_host || |
6417 |
+ event->attr.exclude_guest) { |
6418 |
+- dev_warn(ccn->dev, "Can't exclude execution levels!\n"); |
6419 |
++ dev_dbg(ccn->dev, "Can't exclude execution levels!\n"); |
6420 |
+ return -EINVAL; |
6421 |
+ } |
6422 |
+ |
6423 |
+ if (event->cpu < 0) { |
6424 |
+- dev_warn(ccn->dev, "Can't provide per-task data!\n"); |
6425 |
++ dev_dbg(ccn->dev, "Can't provide per-task data!\n"); |
6426 |
+ return -EOPNOTSUPP; |
6427 |
+ } |
6428 |
+ /* |
6429 |
+@@ -771,13 +771,13 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) |
6430 |
+ switch (type) { |
6431 |
+ case CCN_TYPE_MN: |
6432 |
+ if (node_xp != ccn->mn_id) { |
6433 |
+- dev_warn(ccn->dev, "Invalid MN ID %d!\n", node_xp); |
6434 |
++ dev_dbg(ccn->dev, "Invalid MN ID %d!\n", node_xp); |
6435 |
+ return -EINVAL; |
6436 |
+ } |
6437 |
+ break; |
6438 |
+ case CCN_TYPE_XP: |
6439 |
+ if (node_xp >= ccn->num_xps) { |
6440 |
+- dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp); |
6441 |
++ dev_dbg(ccn->dev, "Invalid XP ID %d!\n", node_xp); |
6442 |
+ return -EINVAL; |
6443 |
+ } |
6444 |
+ break; |
6445 |
+@@ -785,11 +785,11 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) |
6446 |
+ break; |
6447 |
+ default: |
6448 |
+ if (node_xp >= ccn->num_nodes) { |
6449 |
+- dev_warn(ccn->dev, "Invalid node ID %d!\n", node_xp); |
6450 |
++ dev_dbg(ccn->dev, "Invalid node ID %d!\n", node_xp); |
6451 |
+ return -EINVAL; |
6452 |
+ } |
6453 |
+ if (!arm_ccn_pmu_type_eq(type, ccn->node[node_xp].type)) { |
6454 |
+- dev_warn(ccn->dev, "Invalid type 0x%x for node %d!\n", |
6455 |
++ dev_dbg(ccn->dev, "Invalid type 0x%x for node %d!\n", |
6456 |
+ type, node_xp); |
6457 |
+ return -EINVAL; |
6458 |
+ } |
6459 |
+@@ -808,19 +808,19 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) |
6460 |
+ if (event_id != e->event) |
6461 |
+ continue; |
6462 |
+ if (e->num_ports && port >= e->num_ports) { |
6463 |
+- dev_warn(ccn->dev, "Invalid port %d for node/XP %d!\n", |
6464 |
++ dev_dbg(ccn->dev, "Invalid port %d for node/XP %d!\n", |
6465 |
+ port, node_xp); |
6466 |
+ return -EINVAL; |
6467 |
+ } |
6468 |
+ if (e->num_vcs && vc >= e->num_vcs) { |
6469 |
+- dev_warn(ccn->dev, "Invalid vc %d for node/XP %d!\n", |
6470 |
++ dev_dbg(ccn->dev, "Invalid vc %d for node/XP %d!\n", |
6471 |
+ vc, node_xp); |
6472 |
+ return -EINVAL; |
6473 |
+ } |
6474 |
+ valid = 1; |
6475 |
+ } |
6476 |
+ if (!valid) { |
6477 |
+- dev_warn(ccn->dev, "Invalid event 0x%x for node/XP %d!\n", |
6478 |
++ dev_dbg(ccn->dev, "Invalid event 0x%x for node/XP %d!\n", |
6479 |
+ event_id, node_xp); |
6480 |
+ return -EINVAL; |
6481 |
+ } |
6482 |
+diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c |
6483 |
+index 4b57a13758a4..bafb3d40545e 100644 |
6484 |
+--- a/drivers/pinctrl/pinctrl-at91-pio4.c |
6485 |
++++ b/drivers/pinctrl/pinctrl-at91-pio4.c |
6486 |
+@@ -576,8 +576,10 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, |
6487 |
+ for_each_child_of_node(np_config, np) { |
6488 |
+ ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map, |
6489 |
+ &reserved_maps, num_maps); |
6490 |
+- if (ret < 0) |
6491 |
++ if (ret < 0) { |
6492 |
++ of_node_put(np); |
6493 |
+ break; |
6494 |
++ } |
6495 |
+ } |
6496 |
+ } |
6497 |
+ |
6498 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c |
6499 |
+index ad80a17c9990..ace2bfbf1bee 100644 |
6500 |
+--- a/drivers/pinctrl/qcom/pinctrl-msm.c |
6501 |
++++ b/drivers/pinctrl/qcom/pinctrl-msm.c |
6502 |
+@@ -890,11 +890,24 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) |
6503 |
+ return ret; |
6504 |
+ } |
6505 |
+ |
6506 |
+- ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio); |
6507 |
+- if (ret) { |
6508 |
+- dev_err(pctrl->dev, "Failed to add pin range\n"); |
6509 |
+- gpiochip_remove(&pctrl->chip); |
6510 |
+- return ret; |
6511 |
++ /* |
6512 |
++ * For DeviceTree-supported systems, the gpio core checks the |
6513 |
++ * pinctrl's device node for the "gpio-ranges" property. |
6514 |
++ * If it is present, it takes care of adding the pin ranges |
6515 |
++ * for the driver. In this case the driver can skip ahead. |
6516 |
++ * |
6517 |
++ * In order to remain compatible with older, existing DeviceTree |
6518 |
++ * files which don't set the "gpio-ranges" property or systems that |
6519 |
++ * utilize ACPI the driver has to call gpiochip_add_pin_range(). |
6520 |
++ */ |
6521 |
++ if (!of_property_read_bool(pctrl->dev->of_node, "gpio-ranges")) { |
6522 |
++ ret = gpiochip_add_pin_range(&pctrl->chip, |
6523 |
++ dev_name(pctrl->dev), 0, 0, chip->ngpio); |
6524 |
++ if (ret) { |
6525 |
++ dev_err(pctrl->dev, "Failed to add pin range\n"); |
6526 |
++ gpiochip_remove(&pctrl->chip); |
6527 |
++ return ret; |
6528 |
++ } |
6529 |
+ } |
6530 |
+ |
6531 |
+ ret = gpiochip_irqchip_add(chip, |
6532 |
+diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c |
6533 |
+index 33fb2a20458a..9dc282ed5a9e 100644 |
6534 |
+--- a/drivers/platform/x86/dell-smbios-base.c |
6535 |
++++ b/drivers/platform/x86/dell-smbios-base.c |
6536 |
+@@ -555,11 +555,10 @@ static void free_group(struct platform_device *pdev) |
6537 |
+ |
6538 |
+ static int __init dell_smbios_init(void) |
6539 |
+ { |
6540 |
+- const struct dmi_device *valid; |
6541 |
+ int ret, wmi, smm; |
6542 |
+ |
6543 |
+- valid = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL); |
6544 |
+- if (!valid) { |
6545 |
++ if (!dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "Dell System", NULL) && |
6546 |
++ !dmi_find_device(DMI_DEV_TYPE_OEM_STRING, "www.dell.com", NULL)) { |
6547 |
+ pr_err("Unable to run on non-Dell system\n"); |
6548 |
+ return -ENODEV; |
6549 |
+ } |
6550 |
+diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c |
6551 |
+index f541b80f1b54..bd910fe123d9 100644 |
6552 |
+--- a/drivers/regulator/cpcap-regulator.c |
6553 |
++++ b/drivers/regulator/cpcap-regulator.c |
6554 |
+@@ -222,7 +222,7 @@ static unsigned int cpcap_map_mode(unsigned int mode) |
6555 |
+ case CPCAP_BIT_AUDIO_LOW_PWR: |
6556 |
+ return REGULATOR_MODE_STANDBY; |
6557 |
+ default: |
6558 |
+- return -EINVAL; |
6559 |
++ return REGULATOR_MODE_INVALID; |
6560 |
+ } |
6561 |
+ } |
6562 |
+ |
6563 |
+diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h |
6564 |
+index abfd56e8c78a..24fde1e08f3a 100644 |
6565 |
+--- a/drivers/regulator/internal.h |
6566 |
++++ b/drivers/regulator/internal.h |
6567 |
+@@ -56,14 +56,19 @@ static inline struct regulator_dev *dev_to_rdev(struct device *dev) |
6568 |
+ return container_of(dev, struct regulator_dev, dev); |
6569 |
+ } |
6570 |
+ |
6571 |
+-struct regulator_dev *of_find_regulator_by_node(struct device_node *np); |
6572 |
+- |
6573 |
+ #ifdef CONFIG_OF |
6574 |
++struct regulator_dev *of_find_regulator_by_node(struct device_node *np); |
6575 |
+ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, |
6576 |
+ const struct regulator_desc *desc, |
6577 |
+ struct regulator_config *config, |
6578 |
+ struct device_node **node); |
6579 |
+ #else |
6580 |
++static inline struct regulator_dev * |
6581 |
++of_find_regulator_by_node(struct device_node *np) |
6582 |
++{ |
6583 |
++ return NULL; |
6584 |
++} |
6585 |
++ |
6586 |
+ static inline struct regulator_init_data * |
6587 |
+ regulator_of_get_init_data(struct device *dev, |
6588 |
+ const struct regulator_desc *desc, |
6589 |
+diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c |
6590 |
+index f47264fa1940..0d3f73eacb99 100644 |
6591 |
+--- a/drivers/regulator/of_regulator.c |
6592 |
++++ b/drivers/regulator/of_regulator.c |
6593 |
+@@ -31,6 +31,7 @@ static void of_get_regulation_constraints(struct device_node *np, |
6594 |
+ struct regulation_constraints *constraints = &(*init_data)->constraints; |
6595 |
+ struct regulator_state *suspend_state; |
6596 |
+ struct device_node *suspend_np; |
6597 |
++ unsigned int mode; |
6598 |
+ int ret, i; |
6599 |
+ u32 pval; |
6600 |
+ |
6601 |
+@@ -124,11 +125,11 @@ static void of_get_regulation_constraints(struct device_node *np, |
6602 |
+ |
6603 |
+ if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) { |
6604 |
+ if (desc && desc->of_map_mode) { |
6605 |
+- ret = desc->of_map_mode(pval); |
6606 |
+- if (ret == -EINVAL) |
6607 |
++ mode = desc->of_map_mode(pval); |
6608 |
++ if (mode == REGULATOR_MODE_INVALID) |
6609 |
+ pr_err("%s: invalid mode %u\n", np->name, pval); |
6610 |
+ else |
6611 |
+- constraints->initial_mode = ret; |
6612 |
++ constraints->initial_mode = mode; |
6613 |
+ } else { |
6614 |
+ pr_warn("%s: mapping for mode %d not defined\n", |
6615 |
+ np->name, pval); |
6616 |
+@@ -163,12 +164,12 @@ static void of_get_regulation_constraints(struct device_node *np, |
6617 |
+ if (!of_property_read_u32(suspend_np, "regulator-mode", |
6618 |
+ &pval)) { |
6619 |
+ if (desc && desc->of_map_mode) { |
6620 |
+- ret = desc->of_map_mode(pval); |
6621 |
+- if (ret == -EINVAL) |
6622 |
++ mode = desc->of_map_mode(pval); |
6623 |
++ if (mode == REGULATOR_MODE_INVALID) |
6624 |
+ pr_err("%s: invalid mode %u\n", |
6625 |
+ np->name, pval); |
6626 |
+ else |
6627 |
+- suspend_state->mode = ret; |
6628 |
++ suspend_state->mode = mode; |
6629 |
+ } else { |
6630 |
+ pr_warn("%s: mapping for mode %d not defined\n", |
6631 |
+ np->name, pval); |
6632 |
+diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c |
6633 |
+index 63922a2167e5..659e516455be 100644 |
6634 |
+--- a/drivers/regulator/pfuze100-regulator.c |
6635 |
++++ b/drivers/regulator/pfuze100-regulator.c |
6636 |
+@@ -158,6 +158,7 @@ static const struct regulator_ops pfuze100_sw_regulator_ops = { |
6637 |
+ static const struct regulator_ops pfuze100_swb_regulator_ops = { |
6638 |
+ .enable = regulator_enable_regmap, |
6639 |
+ .disable = regulator_disable_regmap, |
6640 |
++ .is_enabled = regulator_is_enabled_regmap, |
6641 |
+ .list_voltage = regulator_list_voltage_table, |
6642 |
+ .map_voltage = regulator_map_voltage_ascend, |
6643 |
+ .set_voltage_sel = regulator_set_voltage_sel_regmap, |
6644 |
+diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c |
6645 |
+index a4456db5849d..884c7505ed91 100644 |
6646 |
+--- a/drivers/regulator/twl-regulator.c |
6647 |
++++ b/drivers/regulator/twl-regulator.c |
6648 |
+@@ -274,7 +274,7 @@ static inline unsigned int twl4030reg_map_mode(unsigned int mode) |
6649 |
+ case RES_STATE_SLEEP: |
6650 |
+ return REGULATOR_MODE_STANDBY; |
6651 |
+ default: |
6652 |
+- return -EINVAL; |
6653 |
++ return REGULATOR_MODE_INVALID; |
6654 |
+ } |
6655 |
+ } |
6656 |
+ |
6657 |
+diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c |
6658 |
+index 7cbdc9228dd5..6d4012dd6922 100644 |
6659 |
+--- a/drivers/rtc/interface.c |
6660 |
++++ b/drivers/rtc/interface.c |
6661 |
+@@ -441,6 +441,11 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) |
6662 |
+ { |
6663 |
+ int err; |
6664 |
+ |
6665 |
++ if (!rtc->ops) |
6666 |
++ return -ENODEV; |
6667 |
++ else if (!rtc->ops->set_alarm) |
6668 |
++ return -EINVAL; |
6669 |
++ |
6670 |
+ err = rtc_valid_tm(&alarm->time); |
6671 |
+ if (err != 0) |
6672 |
+ return err; |
6673 |
+diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c |
6674 |
+index d7785ae0a2b4..1144fe07503e 100644 |
6675 |
+--- a/drivers/rtc/rtc-tps6586x.c |
6676 |
++++ b/drivers/rtc/rtc-tps6586x.c |
6677 |
+@@ -276,14 +276,15 @@ static int tps6586x_rtc_probe(struct platform_device *pdev) |
6678 |
+ device_init_wakeup(&pdev->dev, 1); |
6679 |
+ |
6680 |
+ platform_set_drvdata(pdev, rtc); |
6681 |
+- rtc->rtc = devm_rtc_device_register(&pdev->dev, dev_name(&pdev->dev), |
6682 |
+- &tps6586x_rtc_ops, THIS_MODULE); |
6683 |
++ rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
6684 |
+ if (IS_ERR(rtc->rtc)) { |
6685 |
+ ret = PTR_ERR(rtc->rtc); |
6686 |
+- dev_err(&pdev->dev, "RTC device register: ret %d\n", ret); |
6687 |
++ dev_err(&pdev->dev, "RTC allocate device: ret %d\n", ret); |
6688 |
+ goto fail_rtc_register; |
6689 |
+ } |
6690 |
+ |
6691 |
++ rtc->rtc->ops = &tps6586x_rtc_ops; |
6692 |
++ |
6693 |
+ ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, |
6694 |
+ tps6586x_rtc_irq, |
6695 |
+ IRQF_ONESHOT, |
6696 |
+@@ -294,6 +295,13 @@ static int tps6586x_rtc_probe(struct platform_device *pdev) |
6697 |
+ goto fail_rtc_register; |
6698 |
+ } |
6699 |
+ disable_irq(rtc->irq); |
6700 |
++ |
6701 |
++ ret = rtc_register_device(rtc->rtc); |
6702 |
++ if (ret) { |
6703 |
++ dev_err(&pdev->dev, "RTC device register: ret %d\n", ret); |
6704 |
++ goto fail_rtc_register; |
6705 |
++ } |
6706 |
++ |
6707 |
+ return 0; |
6708 |
+ |
6709 |
+ fail_rtc_register: |
6710 |
+diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c |
6711 |
+index d0244d7979fc..a56b526db89a 100644 |
6712 |
+--- a/drivers/rtc/rtc-tps65910.c |
6713 |
++++ b/drivers/rtc/rtc-tps65910.c |
6714 |
+@@ -380,6 +380,10 @@ static int tps65910_rtc_probe(struct platform_device *pdev) |
6715 |
+ if (!tps_rtc) |
6716 |
+ return -ENOMEM; |
6717 |
+ |
6718 |
++ tps_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
6719 |
++ if (IS_ERR(tps_rtc->rtc)) |
6720 |
++ return PTR_ERR(tps_rtc->rtc); |
6721 |
++ |
6722 |
+ /* Clear pending interrupts */ |
6723 |
+ ret = regmap_read(tps65910->regmap, TPS65910_RTC_STATUS, &rtc_reg); |
6724 |
+ if (ret < 0) |
6725 |
+@@ -421,10 +425,10 @@ static int tps65910_rtc_probe(struct platform_device *pdev) |
6726 |
+ tps_rtc->irq = irq; |
6727 |
+ device_set_wakeup_capable(&pdev->dev, 1); |
6728 |
+ |
6729 |
+- tps_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
6730 |
+- &tps65910_rtc_ops, THIS_MODULE); |
6731 |
+- if (IS_ERR(tps_rtc->rtc)) { |
6732 |
+- ret = PTR_ERR(tps_rtc->rtc); |
6733 |
++ tps_rtc->rtc->ops = &tps65910_rtc_ops; |
6734 |
++ |
6735 |
++ ret = rtc_register_device(tps_rtc->rtc); |
6736 |
++ if (ret) { |
6737 |
+ dev_err(&pdev->dev, "RTC device register: err %d\n", ret); |
6738 |
+ return ret; |
6739 |
+ } |
6740 |
+diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c |
6741 |
+index 7ce22967fd16..7ed010714f29 100644 |
6742 |
+--- a/drivers/rtc/rtc-vr41xx.c |
6743 |
++++ b/drivers/rtc/rtc-vr41xx.c |
6744 |
+@@ -292,13 +292,14 @@ static int rtc_probe(struct platform_device *pdev) |
6745 |
+ goto err_rtc1_iounmap; |
6746 |
+ } |
6747 |
+ |
6748 |
+- rtc = devm_rtc_device_register(&pdev->dev, rtc_name, &vr41xx_rtc_ops, |
6749 |
+- THIS_MODULE); |
6750 |
++ rtc = devm_rtc_allocate_device(&pdev->dev); |
6751 |
+ if (IS_ERR(rtc)) { |
6752 |
+ retval = PTR_ERR(rtc); |
6753 |
+ goto err_iounmap_all; |
6754 |
+ } |
6755 |
+ |
6756 |
++ rtc->ops = &vr41xx_rtc_ops; |
6757 |
++ |
6758 |
+ rtc->max_user_freq = MAX_PERIODIC_RATE; |
6759 |
+ |
6760 |
+ spin_lock_irq(&rtc_lock); |
6761 |
+@@ -340,6 +341,10 @@ static int rtc_probe(struct platform_device *pdev) |
6762 |
+ |
6763 |
+ dev_info(&pdev->dev, "Real Time Clock of NEC VR4100 series\n"); |
6764 |
+ |
6765 |
++ retval = rtc_register_device(rtc); |
6766 |
++ if (retval) |
6767 |
++ goto err_iounmap_all; |
6768 |
++ |
6769 |
+ return 0; |
6770 |
+ |
6771 |
+ err_iounmap_all: |
6772 |
+diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c |
6773 |
+index b415ba42ca73..599447032e50 100644 |
6774 |
+--- a/drivers/s390/scsi/zfcp_dbf.c |
6775 |
++++ b/drivers/s390/scsi/zfcp_dbf.c |
6776 |
+@@ -285,6 +285,8 @@ void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter, |
6777 |
+ struct list_head *entry; |
6778 |
+ unsigned long flags; |
6779 |
+ |
6780 |
++ lockdep_assert_held(&adapter->erp_lock); |
6781 |
++ |
6782 |
+ if (unlikely(!debug_level_enabled(dbf->rec, level))) |
6783 |
+ return; |
6784 |
+ |
6785 |
+diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c |
6786 |
+index b42c9c479d4b..99ba4a770406 100644 |
6787 |
+--- a/drivers/scsi/3w-9xxx.c |
6788 |
++++ b/drivers/scsi/3w-9xxx.c |
6789 |
+@@ -882,6 +882,11 @@ static int twa_chrdev_open(struct inode *inode, struct file *file) |
6790 |
+ unsigned int minor_number; |
6791 |
+ int retval = TW_IOCTL_ERROR_OS_ENODEV; |
6792 |
+ |
6793 |
++ if (!capable(CAP_SYS_ADMIN)) { |
6794 |
++ retval = -EACCES; |
6795 |
++ goto out; |
6796 |
++ } |
6797 |
++ |
6798 |
+ minor_number = iminor(inode); |
6799 |
+ if (minor_number >= twa_device_extension_count) |
6800 |
+ goto out; |
6801 |
+diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c |
6802 |
+index 33261b690774..f6179e3d6953 100644 |
6803 |
+--- a/drivers/scsi/3w-xxxx.c |
6804 |
++++ b/drivers/scsi/3w-xxxx.c |
6805 |
+@@ -1033,6 +1033,9 @@ static int tw_chrdev_open(struct inode *inode, struct file *file) |
6806 |
+ |
6807 |
+ dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n"); |
6808 |
+ |
6809 |
++ if (!capable(CAP_SYS_ADMIN)) |
6810 |
++ return -EACCES; |
6811 |
++ |
6812 |
+ minor_number = iminor(inode); |
6813 |
+ if (minor_number >= tw_device_extension_count) |
6814 |
+ return -ENODEV; |
6815 |
+diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c |
6816 |
+index d8fe7ab870b8..f97f44b4b706 100644 |
6817 |
+--- a/drivers/scsi/cxlflash/main.c |
6818 |
++++ b/drivers/scsi/cxlflash/main.c |
6819 |
+@@ -946,9 +946,9 @@ static void cxlflash_remove(struct pci_dev *pdev) |
6820 |
+ return; |
6821 |
+ } |
6822 |
+ |
6823 |
+- /* If a Task Management Function is active, wait for it to complete |
6824 |
+- * before continuing with remove. |
6825 |
+- */ |
6826 |
++ /* Yield to running recovery threads before continuing with remove */ |
6827 |
++ wait_event(cfg->reset_waitq, cfg->state != STATE_RESET && |
6828 |
++ cfg->state != STATE_PROBING); |
6829 |
+ spin_lock_irqsave(&cfg->tmf_slock, lock_flags); |
6830 |
+ if (cfg->tmf_active) |
6831 |
+ wait_event_interruptible_lock_irq(cfg->tmf_waitq, |
6832 |
+@@ -1303,7 +1303,10 @@ static void afu_err_intr_init(struct afu *afu) |
6833 |
+ for (i = 0; i < afu->num_hwqs; i++) { |
6834 |
+ hwq = get_hwq(afu, i); |
6835 |
+ |
6836 |
+- writeq_be(SISL_MSI_SYNC_ERROR, &hwq->host_map->ctx_ctrl); |
6837 |
++ reg = readq_be(&hwq->host_map->ctx_ctrl); |
6838 |
++ WARN_ON((reg & SISL_CTX_CTRL_LISN_MASK) != 0); |
6839 |
++ reg |= SISL_MSI_SYNC_ERROR; |
6840 |
++ writeq_be(reg, &hwq->host_map->ctx_ctrl); |
6841 |
+ writeq_be(SISL_ISTATUS_MASK, &hwq->host_map->intr_mask); |
6842 |
+ } |
6843 |
+ } |
6844 |
+diff --git a/drivers/scsi/cxlflash/sislite.h b/drivers/scsi/cxlflash/sislite.h |
6845 |
+index bedf1ce2f33c..d8940f1ae219 100644 |
6846 |
+--- a/drivers/scsi/cxlflash/sislite.h |
6847 |
++++ b/drivers/scsi/cxlflash/sislite.h |
6848 |
+@@ -284,6 +284,7 @@ struct sisl_host_map { |
6849 |
+ __be64 cmd_room; |
6850 |
+ __be64 ctx_ctrl; /* least significant byte or b56:63 is LISN# */ |
6851 |
+ #define SISL_CTX_CTRL_UNMAP_SECTOR 0x8000000000000000ULL /* b0 */ |
6852 |
++#define SISL_CTX_CTRL_LISN_MASK (0xFFULL) |
6853 |
+ __be64 mbox_w; /* restricted use */ |
6854 |
+ __be64 sq_start; /* Submission Queue (R/W): write sequence and */ |
6855 |
+ __be64 sq_end; /* inclusion semantics are the same as RRQ */ |
6856 |
+diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
6857 |
+index 6f3e5ba6b472..3d3aa47bab69 100644 |
6858 |
+--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
6859 |
++++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
6860 |
+@@ -348,10 +348,11 @@ struct hisi_sas_err_record_v3 { |
6861 |
+ #define DIR_TO_DEVICE 2 |
6862 |
+ #define DIR_RESERVED 3 |
6863 |
+ |
6864 |
+-#define CMD_IS_UNCONSTRAINT(cmd) \ |
6865 |
+- ((cmd == ATA_CMD_READ_LOG_EXT) || \ |
6866 |
+- (cmd == ATA_CMD_READ_LOG_DMA_EXT) || \ |
6867 |
+- (cmd == ATA_CMD_DEV_RESET)) |
6868 |
++#define FIS_CMD_IS_UNCONSTRAINED(fis) \ |
6869 |
++ ((fis.command == ATA_CMD_READ_LOG_EXT) || \ |
6870 |
++ (fis.command == ATA_CMD_READ_LOG_DMA_EXT) || \ |
6871 |
++ ((fis.command == ATA_CMD_DEV_RESET) && \ |
6872 |
++ ((fis.control & ATA_SRST) != 0))) |
6873 |
+ |
6874 |
+ static u32 hisi_sas_read32(struct hisi_hba *hisi_hba, u32 off) |
6875 |
+ { |
6876 |
+@@ -1046,7 +1047,7 @@ static int prep_ata_v3_hw(struct hisi_hba *hisi_hba, |
6877 |
+ << CMD_HDR_FRAME_TYPE_OFF; |
6878 |
+ dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF; |
6879 |
+ |
6880 |
+- if (CMD_IS_UNCONSTRAINT(task->ata_task.fis.command)) |
6881 |
++ if (FIS_CMD_IS_UNCONSTRAINED(task->ata_task.fis)) |
6882 |
+ dw1 |= 1 << CMD_HDR_UNCON_CMD_OFF; |
6883 |
+ |
6884 |
+ hdr->dw1 = cpu_to_le32(dw1); |
6885 |
+diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c |
6886 |
+index 7195cff51d4c..9b6f5d024dba 100644 |
6887 |
+--- a/drivers/scsi/megaraid.c |
6888 |
++++ b/drivers/scsi/megaraid.c |
6889 |
+@@ -4199,6 +4199,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) |
6890 |
+ int irq, i, j; |
6891 |
+ int error = -ENODEV; |
6892 |
+ |
6893 |
++ if (hba_count >= MAX_CONTROLLERS) |
6894 |
++ goto out; |
6895 |
++ |
6896 |
+ if (pci_enable_device(pdev)) |
6897 |
+ goto out; |
6898 |
+ pci_set_master(pdev); |
6899 |
+diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
6900 |
+index f4d988dd1e9d..35497abb0e81 100644 |
6901 |
+--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c |
6902 |
++++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c |
6903 |
+@@ -2981,6 +2981,9 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, |
6904 |
+ pRAID_Context->timeout_value = cpu_to_le16(os_timeout_value); |
6905 |
+ pRAID_Context->virtual_disk_tgt_id = cpu_to_le16(device_id); |
6906 |
+ } else { |
6907 |
++ if (os_timeout_value) |
6908 |
++ os_timeout_value++; |
6909 |
++ |
6910 |
+ /* system pd Fast Path */ |
6911 |
+ io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; |
6912 |
+ timeout_limit = (scmd->device->type == TYPE_DISK) ? |
6913 |
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c |
6914 |
+index 284ccb566b19..5015b8fbbfc5 100644 |
6915 |
+--- a/drivers/scsi/qedf/qedf_main.c |
6916 |
++++ b/drivers/scsi/qedf/qedf_main.c |
6917 |
+@@ -1647,6 +1647,15 @@ static int qedf_vport_destroy(struct fc_vport *vport) |
6918 |
+ struct Scsi_Host *shost = vport_to_shost(vport); |
6919 |
+ struct fc_lport *n_port = shost_priv(shost); |
6920 |
+ struct fc_lport *vn_port = vport->dd_data; |
6921 |
++ struct qedf_ctx *qedf = lport_priv(vn_port); |
6922 |
++ |
6923 |
++ if (!qedf) { |
6924 |
++ QEDF_ERR(NULL, "qedf is NULL.\n"); |
6925 |
++ goto out; |
6926 |
++ } |
6927 |
++ |
6928 |
++ /* Set unloading bit on vport qedf_ctx to prevent more I/O */ |
6929 |
++ set_bit(QEDF_UNLOADING, &qedf->flags); |
6930 |
+ |
6931 |
+ mutex_lock(&n_port->lp_mutex); |
6932 |
+ list_del(&vn_port->list); |
6933 |
+@@ -1673,6 +1682,7 @@ static int qedf_vport_destroy(struct fc_vport *vport) |
6934 |
+ if (vn_port->host) |
6935 |
+ scsi_host_put(vn_port->host); |
6936 |
+ |
6937 |
++out: |
6938 |
+ return 0; |
6939 |
+ } |
6940 |
+ |
6941 |
+diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c |
6942 |
+index 188f30572aa1..5a58cbf3a75d 100644 |
6943 |
+--- a/drivers/scsi/scsi_dh.c |
6944 |
++++ b/drivers/scsi/scsi_dh.c |
6945 |
+@@ -58,7 +58,10 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { |
6946 |
+ {"IBM", "3526", "rdac", }, |
6947 |
+ {"IBM", "3542", "rdac", }, |
6948 |
+ {"IBM", "3552", "rdac", }, |
6949 |
+- {"SGI", "TP9", "rdac", }, |
6950 |
++ {"SGI", "TP9300", "rdac", }, |
6951 |
++ {"SGI", "TP9400", "rdac", }, |
6952 |
++ {"SGI", "TP9500", "rdac", }, |
6953 |
++ {"SGI", "TP9700", "rdac", }, |
6954 |
+ {"SGI", "IS", "rdac", }, |
6955 |
+ {"STK", "OPENstorage", "rdac", }, |
6956 |
+ {"STK", "FLEXLINE 380", "rdac", }, |
6957 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
6958 |
+index 00e79057f870..15c394d95445 100644 |
6959 |
+--- a/drivers/scsi/ufs/ufshcd.c |
6960 |
++++ b/drivers/scsi/ufs/ufshcd.c |
6961 |
+@@ -4969,6 +4969,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work) |
6962 |
+ hba = container_of(work, struct ufs_hba, eeh_work); |
6963 |
+ |
6964 |
+ pm_runtime_get_sync(hba->dev); |
6965 |
++ scsi_block_requests(hba->host); |
6966 |
+ err = ufshcd_get_ee_status(hba, &status); |
6967 |
+ if (err) { |
6968 |
+ dev_err(hba->dev, "%s: failed to get exception status %d\n", |
6969 |
+@@ -4982,6 +4983,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work) |
6970 |
+ ufshcd_bkops_exception_event_handler(hba); |
6971 |
+ |
6972 |
+ out: |
6973 |
++ scsi_unblock_requests(hba->host); |
6974 |
+ pm_runtime_put_sync(hba->dev); |
6975 |
+ return; |
6976 |
+ } |
6977 |
+@@ -6799,9 +6801,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, |
6978 |
+ if (list_empty(head)) |
6979 |
+ goto out; |
6980 |
+ |
6981 |
+- ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE); |
6982 |
+- if (ret) |
6983 |
+- return ret; |
6984 |
++ /* |
6985 |
++ * vendor specific setup_clocks ops may depend on clocks managed by |
6986 |
++ * this standard driver hence call the vendor specific setup_clocks |
6987 |
++ * before disabling the clocks managed here. |
6988 |
++ */ |
6989 |
++ if (!on) { |
6990 |
++ ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE); |
6991 |
++ if (ret) |
6992 |
++ return ret; |
6993 |
++ } |
6994 |
+ |
6995 |
+ list_for_each_entry(clki, head, list) { |
6996 |
+ if (!IS_ERR_OR_NULL(clki->clk)) { |
6997 |
+@@ -6825,9 +6834,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, |
6998 |
+ } |
6999 |
+ } |
7000 |
+ |
7001 |
+- ret = ufshcd_vops_setup_clocks(hba, on, POST_CHANGE); |
7002 |
+- if (ret) |
7003 |
+- return ret; |
7004 |
++ /* |
7005 |
++ * vendor specific setup_clocks ops may depend on clocks managed by |
7006 |
++ * this standard driver hence call the vendor specific setup_clocks |
7007 |
++ * after enabling the clocks managed here. |
7008 |
++ */ |
7009 |
++ if (on) { |
7010 |
++ ret = ufshcd_vops_setup_clocks(hba, on, POST_CHANGE); |
7011 |
++ if (ret) |
7012 |
++ return ret; |
7013 |
++ } |
7014 |
+ |
7015 |
+ out: |
7016 |
+ if (ret) { |
7017 |
+diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c |
7018 |
+index afc7ecc3c187..f4e3bd40c72e 100644 |
7019 |
+--- a/drivers/soc/imx/gpcv2.c |
7020 |
++++ b/drivers/soc/imx/gpcv2.c |
7021 |
+@@ -155,7 +155,7 @@ static int imx7_gpc_pu_pgc_sw_pdn_req(struct generic_pm_domain *genpd) |
7022 |
+ return imx7_gpc_pu_pgc_sw_pxx_req(genpd, false); |
7023 |
+ } |
7024 |
+ |
7025 |
+-static struct imx7_pgc_domain imx7_pgc_domains[] = { |
7026 |
++static const struct imx7_pgc_domain imx7_pgc_domains[] = { |
7027 |
+ [IMX7_POWER_DOMAIN_MIPI_PHY] = { |
7028 |
+ .genpd = { |
7029 |
+ .name = "mipi-phy", |
7030 |
+@@ -321,11 +321,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev) |
7031 |
+ continue; |
7032 |
+ } |
7033 |
+ |
7034 |
+- domain = &imx7_pgc_domains[domain_index]; |
7035 |
+- domain->regmap = regmap; |
7036 |
+- domain->genpd.power_on = imx7_gpc_pu_pgc_sw_pup_req; |
7037 |
+- domain->genpd.power_off = imx7_gpc_pu_pgc_sw_pdn_req; |
7038 |
+- |
7039 |
+ pd_pdev = platform_device_alloc("imx7-pgc-domain", |
7040 |
+ domain_index); |
7041 |
+ if (!pd_pdev) { |
7042 |
+@@ -334,7 +329,20 @@ static int imx_gpcv2_probe(struct platform_device *pdev) |
7043 |
+ return -ENOMEM; |
7044 |
+ } |
7045 |
+ |
7046 |
+- pd_pdev->dev.platform_data = domain; |
7047 |
++ ret = platform_device_add_data(pd_pdev, |
7048 |
++ &imx7_pgc_domains[domain_index], |
7049 |
++ sizeof(imx7_pgc_domains[domain_index])); |
7050 |
++ if (ret) { |
7051 |
++ platform_device_put(pd_pdev); |
7052 |
++ of_node_put(np); |
7053 |
++ return ret; |
7054 |
++ } |
7055 |
++ |
7056 |
++ domain = pd_pdev->dev.platform_data; |
7057 |
++ domain->regmap = regmap; |
7058 |
++ domain->genpd.power_on = imx7_gpc_pu_pgc_sw_pup_req; |
7059 |
++ domain->genpd.power_off = imx7_gpc_pu_pgc_sw_pdn_req; |
7060 |
++ |
7061 |
+ pd_pdev->dev.parent = dev; |
7062 |
+ pd_pdev->dev.of_node = np; |
7063 |
+ |
7064 |
+diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c |
7065 |
+index 321982277697..938ca41c56cd 100644 |
7066 |
+--- a/drivers/soc/qcom/qmi_interface.c |
7067 |
++++ b/drivers/soc/qcom/qmi_interface.c |
7068 |
+@@ -639,10 +639,11 @@ int qmi_handle_init(struct qmi_handle *qmi, size_t recv_buf_size, |
7069 |
+ if (ops) |
7070 |
+ qmi->ops = *ops; |
7071 |
+ |
7072 |
++ /* Make room for the header */ |
7073 |
++ recv_buf_size += sizeof(struct qmi_header); |
7074 |
++ /* Must also be sufficient to hold a control packet */ |
7075 |
+ if (recv_buf_size < sizeof(struct qrtr_ctrl_pkt)) |
7076 |
+ recv_buf_size = sizeof(struct qrtr_ctrl_pkt); |
7077 |
+- else |
7078 |
+- recv_buf_size += sizeof(struct qmi_header); |
7079 |
+ |
7080 |
+ qmi->recv_buf_size = recv_buf_size; |
7081 |
+ qmi->recv_buf = kzalloc(recv_buf_size, GFP_KERNEL); |
7082 |
+diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c |
7083 |
+index 0b94d62fad2b..493865977e3d 100644 |
7084 |
+--- a/drivers/soc/qcom/smem.c |
7085 |
++++ b/drivers/soc/qcom/smem.c |
7086 |
+@@ -362,13 +362,8 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, |
7087 |
+ cached = phdr_to_last_cached_entry(phdr); |
7088 |
+ |
7089 |
+ while (hdr < end) { |
7090 |
+- if (hdr->canary != SMEM_PRIVATE_CANARY) { |
7091 |
+- dev_err(smem->dev, |
7092 |
+- "Found invalid canary in hosts %d:%d partition\n", |
7093 |
+- phdr->host0, phdr->host1); |
7094 |
+- return -EINVAL; |
7095 |
+- } |
7096 |
+- |
7097 |
++ if (hdr->canary != SMEM_PRIVATE_CANARY) |
7098 |
++ goto bad_canary; |
7099 |
+ if (le16_to_cpu(hdr->item) == item) |
7100 |
+ return -EEXIST; |
7101 |
+ |
7102 |
+@@ -397,6 +392,11 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, |
7103 |
+ le32_add_cpu(&phdr->offset_free_uncached, alloc_size); |
7104 |
+ |
7105 |
+ return 0; |
7106 |
++bad_canary: |
7107 |
++ dev_err(smem->dev, "Found invalid canary in hosts %hu:%hu partition\n", |
7108 |
++ le16_to_cpu(phdr->host0), le16_to_cpu(phdr->host1)); |
7109 |
++ |
7110 |
++ return -EINVAL; |
7111 |
+ } |
7112 |
+ |
7113 |
+ static int qcom_smem_alloc_global(struct qcom_smem *smem, |
7114 |
+@@ -560,8 +560,8 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, |
7115 |
+ return ERR_PTR(-ENOENT); |
7116 |
+ |
7117 |
+ invalid_canary: |
7118 |
+- dev_err(smem->dev, "Found invalid canary in hosts %d:%d partition\n", |
7119 |
+- phdr->host0, phdr->host1); |
7120 |
++ dev_err(smem->dev, "Found invalid canary in hosts %hu:%hu partition\n", |
7121 |
++ le16_to_cpu(phdr->host0), le16_to_cpu(phdr->host1)); |
7122 |
+ |
7123 |
+ return ERR_PTR(-EINVAL); |
7124 |
+ } |
7125 |
+@@ -695,9 +695,10 @@ static u32 qcom_smem_get_item_count(struct qcom_smem *smem) |
7126 |
+ static int qcom_smem_set_global_partition(struct qcom_smem *smem) |
7127 |
+ { |
7128 |
+ struct smem_partition_header *header; |
7129 |
+- struct smem_ptable_entry *entry = NULL; |
7130 |
++ struct smem_ptable_entry *entry; |
7131 |
+ struct smem_ptable *ptable; |
7132 |
+ u32 host0, host1, size; |
7133 |
++ bool found = false; |
7134 |
+ int i; |
7135 |
+ |
7136 |
+ ptable = qcom_smem_get_ptable(smem); |
7137 |
+@@ -709,11 +710,13 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) |
7138 |
+ host0 = le16_to_cpu(entry->host0); |
7139 |
+ host1 = le16_to_cpu(entry->host1); |
7140 |
+ |
7141 |
+- if (host0 == SMEM_GLOBAL_HOST && host0 == host1) |
7142 |
++ if (host0 == SMEM_GLOBAL_HOST && host0 == host1) { |
7143 |
++ found = true; |
7144 |
+ break; |
7145 |
++ } |
7146 |
+ } |
7147 |
+ |
7148 |
+- if (!entry) { |
7149 |
++ if (!found) { |
7150 |
+ dev_err(smem->dev, "Missing entry for global partition\n"); |
7151 |
+ return -EINVAL; |
7152 |
+ } |
7153 |
+diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c |
7154 |
+index d9fcdb592b39..3e3d12ce4587 100644 |
7155 |
+--- a/drivers/soc/tegra/pmc.c |
7156 |
++++ b/drivers/soc/tegra/pmc.c |
7157 |
+@@ -559,22 +559,28 @@ EXPORT_SYMBOL(tegra_powergate_remove_clamping); |
7158 |
+ int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, |
7159 |
+ struct reset_control *rst) |
7160 |
+ { |
7161 |
+- struct tegra_powergate pg; |
7162 |
++ struct tegra_powergate *pg; |
7163 |
+ int err; |
7164 |
+ |
7165 |
+ if (!tegra_powergate_is_available(id)) |
7166 |
+ return -EINVAL; |
7167 |
+ |
7168 |
+- pg.id = id; |
7169 |
+- pg.clks = &clk; |
7170 |
+- pg.num_clks = 1; |
7171 |
+- pg.reset = rst; |
7172 |
+- pg.pmc = pmc; |
7173 |
++ pg = kzalloc(sizeof(*pg), GFP_KERNEL); |
7174 |
++ if (!pg) |
7175 |
++ return -ENOMEM; |
7176 |
+ |
7177 |
+- err = tegra_powergate_power_up(&pg, false); |
7178 |
++ pg->id = id; |
7179 |
++ pg->clks = &clk; |
7180 |
++ pg->num_clks = 1; |
7181 |
++ pg->reset = rst; |
7182 |
++ pg->pmc = pmc; |
7183 |
++ |
7184 |
++ err = tegra_powergate_power_up(pg, false); |
7185 |
+ if (err) |
7186 |
+ pr_err("failed to turn on partition %d: %d\n", id, err); |
7187 |
+ |
7188 |
++ kfree(pg); |
7189 |
++ |
7190 |
+ return err; |
7191 |
+ } |
7192 |
+ EXPORT_SYMBOL(tegra_powergate_sequence_power_up); |
7193 |
+diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c |
7194 |
+index 5c82910e3480..7fe4488ace57 100644 |
7195 |
+--- a/drivers/spi/spi-meson-spicc.c |
7196 |
++++ b/drivers/spi/spi-meson-spicc.c |
7197 |
+@@ -574,10 +574,15 @@ static int meson_spicc_probe(struct platform_device *pdev) |
7198 |
+ master->max_speed_hz = rate >> 2; |
7199 |
+ |
7200 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
7201 |
+- if (!ret) |
7202 |
+- return 0; |
7203 |
++ if (ret) { |
7204 |
++ dev_err(&pdev->dev, "spi master registration failed\n"); |
7205 |
++ goto out_clk; |
7206 |
++ } |
7207 |
+ |
7208 |
+- dev_err(&pdev->dev, "spi master registration failed\n"); |
7209 |
++ return 0; |
7210 |
++ |
7211 |
++out_clk: |
7212 |
++ clk_disable_unprepare(spicc->core); |
7213 |
+ |
7214 |
+ out_master: |
7215 |
+ spi_master_put(master); |
7216 |
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c |
7217 |
+index baa3a9fa2638..92e57e35418b 100644 |
7218 |
+--- a/drivers/spi/spi-s3c64xx.c |
7219 |
++++ b/drivers/spi/spi-s3c64xx.c |
7220 |
+@@ -1260,8 +1260,6 @@ static int s3c64xx_spi_resume(struct device *dev) |
7221 |
+ if (ret < 0) |
7222 |
+ return ret; |
7223 |
+ |
7224 |
+- s3c64xx_spi_hwinit(sdd, sdd->port_id); |
7225 |
+- |
7226 |
+ return spi_master_resume(master); |
7227 |
+ } |
7228 |
+ #endif /* CONFIG_PM_SLEEP */ |
7229 |
+@@ -1299,6 +1297,8 @@ static int s3c64xx_spi_runtime_resume(struct device *dev) |
7230 |
+ if (ret != 0) |
7231 |
+ goto err_disable_src_clk; |
7232 |
+ |
7233 |
++ s3c64xx_spi_hwinit(sdd, sdd->port_id); |
7234 |
++ |
7235 |
+ return 0; |
7236 |
+ |
7237 |
+ err_disable_src_clk: |
7238 |
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c |
7239 |
+index 8171eedbfc90..c75641b9df79 100644 |
7240 |
+--- a/drivers/spi/spi-sh-msiof.c |
7241 |
++++ b/drivers/spi/spi-sh-msiof.c |
7242 |
+@@ -564,14 +564,16 @@ static int sh_msiof_spi_setup(struct spi_device *spi) |
7243 |
+ |
7244 |
+ /* Configure native chip select mode/polarity early */ |
7245 |
+ clr = MDR1_SYNCMD_MASK; |
7246 |
+- set = MDR1_TRMD | TMDR1_PCON | MDR1_SYNCMD_SPI; |
7247 |
++ set = MDR1_SYNCMD_SPI; |
7248 |
+ if (spi->mode & SPI_CS_HIGH) |
7249 |
+ clr |= BIT(MDR1_SYNCAC_SHIFT); |
7250 |
+ else |
7251 |
+ set |= BIT(MDR1_SYNCAC_SHIFT); |
7252 |
+ pm_runtime_get_sync(&p->pdev->dev); |
7253 |
+ tmp = sh_msiof_read(p, TMDR1) & ~clr; |
7254 |
+- sh_msiof_write(p, TMDR1, tmp | set); |
7255 |
++ sh_msiof_write(p, TMDR1, tmp | set | MDR1_TRMD | TMDR1_PCON); |
7256 |
++ tmp = sh_msiof_read(p, RMDR1) & ~clr; |
7257 |
++ sh_msiof_write(p, RMDR1, tmp | set); |
7258 |
+ pm_runtime_put(&p->pdev->dev); |
7259 |
+ p->native_cs_high = spi->mode & SPI_CS_HIGH; |
7260 |
+ p->native_cs_inited = true; |
7261 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
7262 |
+index 7b213faa0a2b..91e76c776037 100644 |
7263 |
+--- a/drivers/spi/spi.c |
7264 |
++++ b/drivers/spi/spi.c |
7265 |
+@@ -1222,6 +1222,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) |
7266 |
+ if (!was_busy && ctlr->auto_runtime_pm) { |
7267 |
+ ret = pm_runtime_get_sync(ctlr->dev.parent); |
7268 |
+ if (ret < 0) { |
7269 |
++ pm_runtime_put_noidle(ctlr->dev.parent); |
7270 |
+ dev_err(&ctlr->dev, "Failed to power device: %d\n", |
7271 |
+ ret); |
7272 |
+ mutex_unlock(&ctlr->io_mutex); |
7273 |
+diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c |
7274 |
+index b8f55a11ee1c..7391bba405ae 100644 |
7275 |
+--- a/drivers/staging/ks7010/ks7010_sdio.c |
7276 |
++++ b/drivers/staging/ks7010/ks7010_sdio.c |
7277 |
+@@ -657,8 +657,11 @@ static int ks7010_upload_firmware(struct ks_sdio_card *card) |
7278 |
+ |
7279 |
+ /* Firmware running ? */ |
7280 |
+ ret = ks7010_sdio_readb(priv, GCR_A, &byte); |
7281 |
++ if (ret) |
7282 |
++ goto release_host_and_free; |
7283 |
+ if (byte == GCR_A_RUN) { |
7284 |
+ netdev_dbg(priv->net_dev, "MAC firmware running ...\n"); |
7285 |
++ ret = -EBUSY; |
7286 |
+ goto release_host_and_free; |
7287 |
+ } |
7288 |
+ |
7289 |
+diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c |
7290 |
+index 7ae2955c4db6..355c81651a65 100644 |
7291 |
+--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c |
7292 |
++++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c |
7293 |
+@@ -1702,7 +1702,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, |
7294 |
+ return 0; |
7295 |
+ } |
7296 |
+ spin_unlock(&fps->fps_lock); |
7297 |
+- rc = -EBUSY; |
7298 |
++ rc = -EAGAIN; |
7299 |
+ } |
7300 |
+ |
7301 |
+ spin_lock(&fps->fps_lock); |
7302 |
+diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |
7303 |
+index 6690a6cd4e34..5828ee96d74c 100644 |
7304 |
+--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |
7305 |
++++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |
7306 |
+@@ -48,7 +48,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, |
7307 |
+ __u64 dstcookie); |
7308 |
+ static void kiblnd_queue_tx_locked(struct kib_tx *tx, struct kib_conn *conn); |
7309 |
+ static void kiblnd_queue_tx(struct kib_tx *tx, struct kib_conn *conn); |
7310 |
+-static void kiblnd_unmap_tx(struct lnet_ni *ni, struct kib_tx *tx); |
7311 |
++static void kiblnd_unmap_tx(struct kib_tx *tx); |
7312 |
+ static void kiblnd_check_sends_locked(struct kib_conn *conn); |
7313 |
+ |
7314 |
+ static void |
7315 |
+@@ -66,7 +66,7 @@ kiblnd_tx_done(struct lnet_ni *ni, struct kib_tx *tx) |
7316 |
+ LASSERT(!tx->tx_waiting); /* mustn't be awaiting peer response */ |
7317 |
+ LASSERT(tx->tx_pool); |
7318 |
+ |
7319 |
+- kiblnd_unmap_tx(ni, tx); |
7320 |
++ kiblnd_unmap_tx(tx); |
7321 |
+ |
7322 |
+ /* tx may have up to 2 lnet msgs to finalise */ |
7323 |
+ lntmsg[0] = tx->tx_lntmsg[0]; tx->tx_lntmsg[0] = NULL; |
7324 |
+@@ -591,13 +591,9 @@ kiblnd_fmr_map_tx(struct kib_net *net, struct kib_tx *tx, struct kib_rdma_desc * |
7325 |
+ return 0; |
7326 |
+ } |
7327 |
+ |
7328 |
+-static void kiblnd_unmap_tx(struct lnet_ni *ni, struct kib_tx *tx) |
7329 |
++static void kiblnd_unmap_tx(struct kib_tx *tx) |
7330 |
+ { |
7331 |
+- struct kib_net *net = ni->ni_data; |
7332 |
+- |
7333 |
+- LASSERT(net); |
7334 |
+- |
7335 |
+- if (net->ibn_fmr_ps) |
7336 |
++ if (tx->fmr.fmr_pfmr || tx->fmr.fmr_frd) |
7337 |
+ kiblnd_fmr_pool_unmap(&tx->fmr, tx->tx_status); |
7338 |
+ |
7339 |
+ if (tx->tx_nfrags) { |
7340 |
+@@ -1290,11 +1286,6 @@ kiblnd_connect_peer(struct kib_peer *peer) |
7341 |
+ goto failed2; |
7342 |
+ } |
7343 |
+ |
7344 |
+- LASSERT(cmid->device); |
7345 |
+- CDEBUG(D_NET, "%s: connection bound to %s:%pI4h:%s\n", |
7346 |
+- libcfs_nid2str(peer->ibp_nid), dev->ibd_ifname, |
7347 |
+- &dev->ibd_ifip, cmid->device->name); |
7348 |
+- |
7349 |
+ return; |
7350 |
+ |
7351 |
+ failed2: |
7352 |
+@@ -2996,8 +2987,19 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) |
7353 |
+ } else { |
7354 |
+ rc = rdma_resolve_route( |
7355 |
+ cmid, *kiblnd_tunables.kib_timeout * 1000); |
7356 |
+- if (!rc) |
7357 |
++ if (!rc) { |
7358 |
++ struct kib_net *net = peer->ibp_ni->ni_data; |
7359 |
++ struct kib_dev *dev = net->ibn_dev; |
7360 |
++ |
7361 |
++ CDEBUG(D_NET, "%s: connection bound to "\ |
7362 |
++ "%s:%pI4h:%s\n", |
7363 |
++ libcfs_nid2str(peer->ibp_nid), |
7364 |
++ dev->ibd_ifname, |
7365 |
++ &dev->ibd_ifip, cmid->device->name); |
7366 |
++ |
7367 |
+ return 0; |
7368 |
++ } |
7369 |
++ |
7370 |
+ /* Can't initiate route resolution */ |
7371 |
+ CERROR("Can't resolve route for %s: %d\n", |
7372 |
+ libcfs_nid2str(peer->ibp_nid), rc); |
7373 |
+diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |
7374 |
+index 95bea351d21d..59d6259f2c14 100644 |
7375 |
+--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |
7376 |
++++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |
7377 |
+@@ -1565,8 +1565,10 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, |
7378 |
+ return ERR_CAST(res); |
7379 |
+ |
7380 |
+ lock = ldlm_lock_new(res); |
7381 |
+- if (!lock) |
7382 |
++ if (!lock) { |
7383 |
++ ldlm_resource_putref(res); |
7384 |
+ return ERR_PTR(-ENOMEM); |
7385 |
++ } |
7386 |
+ |
7387 |
+ lock->l_req_mode = mode; |
7388 |
+ lock->l_ast_data = data; |
7389 |
+@@ -1609,6 +1611,8 @@ out: |
7390 |
+ return ERR_PTR(rc); |
7391 |
+ } |
7392 |
+ |
7393 |
++ |
7394 |
++ |
7395 |
+ /** |
7396 |
+ * Enqueue (request) a lock. |
7397 |
+ * On the client this is called from ldlm_cli_enqueue_fini |
7398 |
+diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c |
7399 |
+index 2d78432963dc..5caccfef9c62 100644 |
7400 |
+--- a/drivers/staging/lustre/lustre/llite/xattr.c |
7401 |
++++ b/drivers/staging/lustre/lustre/llite/xattr.c |
7402 |
+@@ -94,7 +94,11 @@ ll_xattr_set_common(const struct xattr_handler *handler, |
7403 |
+ __u64 valid; |
7404 |
+ int rc; |
7405 |
+ |
7406 |
+- if (flags == XATTR_REPLACE) { |
7407 |
++ /* When setxattr() is called with a size of 0 the value is |
7408 |
++ * unconditionally replaced by "". When removexattr() is |
7409 |
++ * called we get a NULL value and XATTR_REPLACE for flags. |
7410 |
++ */ |
7411 |
++ if (!value && flags == XATTR_REPLACE) { |
7412 |
+ ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1); |
7413 |
+ valid = OBD_MD_FLXATTRRM; |
7414 |
+ } else { |
7415 |
+diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c |
7416 |
+index c0849299d592..bba3d1745908 100644 |
7417 |
+--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c |
7418 |
++++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c |
7419 |
+@@ -397,14 +397,13 @@ static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg, |
7420 |
+ { |
7421 |
+ struct i2c_client *client = v4l2_get_subdevdata(sd); |
7422 |
+ struct ov2680_device *dev = to_ov2680_sensor(sd); |
7423 |
+- u16 vts,hts; |
7424 |
++ u16 vts; |
7425 |
+ int ret,exp_val; |
7426 |
+ |
7427 |
+ dev_dbg(&client->dev, |
7428 |
+ "+++++++__ov2680_set_exposure coarse_itg %d, gain %d, digitgain %d++\n", |
7429 |
+ coarse_itg, gain, digitgain); |
7430 |
+ |
7431 |
+- hts = ov2680_res[dev->fmt_idx].pixels_per_line; |
7432 |
+ vts = ov2680_res[dev->fmt_idx].lines_per_frame; |
7433 |
+ |
7434 |
+ /* group hold */ |
7435 |
+@@ -1185,7 +1184,8 @@ static int ov2680_detect(struct i2c_client *client) |
7436 |
+ OV2680_SC_CMMN_SUB_ID, &high); |
7437 |
+ revision = (u8) high & 0x0f; |
7438 |
+ |
7439 |
+- dev_info(&client->dev, "sensor_revision id = 0x%x\n", id); |
7440 |
++ dev_info(&client->dev, "sensor_revision id = 0x%x, rev= %d\n", |
7441 |
++ id, revision); |
7442 |
+ |
7443 |
+ return 0; |
7444 |
+ } |
7445 |
+diff --git a/drivers/staging/media/atomisp/i2c/gc2235.h b/drivers/staging/media/atomisp/i2c/gc2235.h |
7446 |
+index 0e805bcfa4d8..54bf7812b27a 100644 |
7447 |
+--- a/drivers/staging/media/atomisp/i2c/gc2235.h |
7448 |
++++ b/drivers/staging/media/atomisp/i2c/gc2235.h |
7449 |
+@@ -33,6 +33,11 @@ |
7450 |
+ |
7451 |
+ #include "../include/linux/atomisp_platform.h" |
7452 |
+ |
7453 |
++/* |
7454 |
++ * FIXME: non-preview resolutions are currently broken |
7455 |
++ */ |
7456 |
++#define ENABLE_NON_PREVIEW 0 |
7457 |
++ |
7458 |
+ /* Defines for register writes and register array processing */ |
7459 |
+ #define I2C_MSG_LENGTH 0x2 |
7460 |
+ #define I2C_RETRY_COUNT 5 |
7461 |
+@@ -284,6 +289,7 @@ static struct gc2235_reg const gc2235_init_settings[] = { |
7462 |
+ /* |
7463 |
+ * Register settings for various resolution |
7464 |
+ */ |
7465 |
++#if ENABLE_NON_PREVIEW |
7466 |
+ static struct gc2235_reg const gc2235_1296_736_30fps[] = { |
7467 |
+ { GC2235_8BIT, 0x8b, 0xa0 }, |
7468 |
+ { GC2235_8BIT, 0x8c, 0x02 }, |
7469 |
+@@ -387,6 +393,7 @@ static struct gc2235_reg const gc2235_960_640_30fps[] = { |
7470 |
+ { GC2235_8BIT, 0xfe, 0x00 }, /* switch to P0 */ |
7471 |
+ { GC2235_TOK_TERM, 0, 0 } |
7472 |
+ }; |
7473 |
++#endif |
7474 |
+ |
7475 |
+ static struct gc2235_reg const gc2235_1600_900_30fps[] = { |
7476 |
+ { GC2235_8BIT, 0x8b, 0xa0 }, |
7477 |
+@@ -578,7 +585,7 @@ static struct gc2235_resolution gc2235_res_preview[] = { |
7478 |
+ * Disable non-preview configurations until the configuration selection is |
7479 |
+ * improved. |
7480 |
+ */ |
7481 |
+-#if 0 |
7482 |
++#if ENABLE_NON_PREVIEW |
7483 |
+ static struct gc2235_resolution gc2235_res_still[] = { |
7484 |
+ { |
7485 |
+ .desc = "gc2235_1600_900_30fps", |
7486 |
+diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h |
7487 |
+index cb38e6e79409..58d6be07d986 100644 |
7488 |
+--- a/drivers/staging/media/atomisp/i2c/ov2680.h |
7489 |
++++ b/drivers/staging/media/atomisp/i2c/ov2680.h |
7490 |
+@@ -295,6 +295,7 @@ struct ov2680_format { |
7491 |
+ }; |
7492 |
+ |
7493 |
+ |
7494 |
++#if 0 /* None of the definitions below are used currently */ |
7495 |
+ /* |
7496 |
+ * 176x144 30fps VBlanking 1lane 10Bit (binning) |
7497 |
+ */ |
7498 |
+@@ -513,7 +514,6 @@ struct ov2680_format { |
7499 |
+ {OV2680_8BIT, 0x5081, 0x41}, |
7500 |
+ {OV2680_TOK_TERM, 0, 0} |
7501 |
+ }; |
7502 |
+- |
7503 |
+ /* |
7504 |
+ * 800x600 30fps VBlanking 1lane 10Bit (binning) |
7505 |
+ */ |
7506 |
+@@ -685,6 +685,7 @@ struct ov2680_format { |
7507 |
+ // {OV2680_8BIT, 0x5090, 0x0c}, |
7508 |
+ {OV2680_TOK_TERM, 0, 0} |
7509 |
+ }; |
7510 |
++#endif |
7511 |
+ |
7512 |
+ /* |
7513 |
+ *1616x916 30fps VBlanking 1lane 10bit |
7514 |
+@@ -734,6 +735,7 @@ struct ov2680_format { |
7515 |
+ /* |
7516 |
+ * 1612x1212 30fps VBlanking 1lane 10Bit |
7517 |
+ */ |
7518 |
++#if 0 |
7519 |
+ static struct ov2680_reg const ov2680_1616x1082_30fps[] = { |
7520 |
+ {OV2680_8BIT, 0x3086, 0x00}, |
7521 |
+ {OV2680_8BIT, 0x3501, 0x48}, |
7522 |
+@@ -773,6 +775,7 @@ struct ov2680_format { |
7523 |
+ {OV2680_8BIT, 0x5081, 0x41}, |
7524 |
+ {OV2680_TOK_TERM, 0, 0} |
7525 |
+ }; |
7526 |
++#endif |
7527 |
+ /* |
7528 |
+ * 1616x1216 30fps VBlanking 1lane 10Bit |
7529 |
+ */ |
7530 |
+diff --git a/drivers/staging/media/atomisp/i2c/ov2722.h b/drivers/staging/media/atomisp/i2c/ov2722.h |
7531 |
+index 757b37613ccc..d99188a5c9d0 100644 |
7532 |
+--- a/drivers/staging/media/atomisp/i2c/ov2722.h |
7533 |
++++ b/drivers/staging/media/atomisp/i2c/ov2722.h |
7534 |
+@@ -254,6 +254,7 @@ struct ov2722_write_ctrl { |
7535 |
+ /* |
7536 |
+ * Register settings for various resolution |
7537 |
+ */ |
7538 |
++#if 0 |
7539 |
+ static struct ov2722_reg const ov2722_QVGA_30fps[] = { |
7540 |
+ {OV2722_8BIT, 0x3718, 0x10}, |
7541 |
+ {OV2722_8BIT, 0x3702, 0x0c}, |
7542 |
+@@ -581,6 +582,7 @@ static struct ov2722_reg const ov2722_VGA_30fps[] = { |
7543 |
+ {OV2722_8BIT, 0x3509, 0x10}, |
7544 |
+ {OV2722_TOK_TERM, 0, 0}, |
7545 |
+ }; |
7546 |
++#endif |
7547 |
+ |
7548 |
+ static struct ov2722_reg const ov2722_1632_1092_30fps[] = { |
7549 |
+ {OV2722_8BIT, 0x3021, 0x03}, /* For stand wait for |
7550 |
+@@ -784,6 +786,7 @@ static struct ov2722_reg const ov2722_1452_1092_30fps[] = { |
7551 |
+ {OV2722_8BIT, 0x3509, 0x00}, |
7552 |
+ {OV2722_TOK_TERM, 0, 0} |
7553 |
+ }; |
7554 |
++#if 0 |
7555 |
+ static struct ov2722_reg const ov2722_1M3_30fps[] = { |
7556 |
+ {OV2722_8BIT, 0x3718, 0x10}, |
7557 |
+ {OV2722_8BIT, 0x3702, 0x24}, |
7558 |
+@@ -890,6 +893,7 @@ static struct ov2722_reg const ov2722_1M3_30fps[] = { |
7559 |
+ {OV2722_8BIT, 0x3509, 0x10}, |
7560 |
+ {OV2722_TOK_TERM, 0, 0}, |
7561 |
+ }; |
7562 |
++#endif |
7563 |
+ |
7564 |
+ static struct ov2722_reg const ov2722_1080p_30fps[] = { |
7565 |
+ {OV2722_8BIT, 0x3021, 0x03}, /* For stand wait for a whole |
7566 |
+@@ -996,6 +1000,7 @@ static struct ov2722_reg const ov2722_1080p_30fps[] = { |
7567 |
+ {OV2722_TOK_TERM, 0, 0} |
7568 |
+ }; |
7569 |
+ |
7570 |
++#if 0 /* Currently unused */ |
7571 |
+ static struct ov2722_reg const ov2722_720p_30fps[] = { |
7572 |
+ {OV2722_8BIT, 0x3021, 0x03}, |
7573 |
+ {OV2722_8BIT, 0x3718, 0x10}, |
7574 |
+@@ -1095,6 +1100,7 @@ static struct ov2722_reg const ov2722_720p_30fps[] = { |
7575 |
+ {OV2722_8BIT, 0x3509, 0x00}, |
7576 |
+ {OV2722_TOK_TERM, 0, 0}, |
7577 |
+ }; |
7578 |
++#endif |
7579 |
+ |
7580 |
+ static struct ov2722_resolution ov2722_res_preview[] = { |
7581 |
+ { |
7582 |
+diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h |
7583 |
+index 9058a82455a6..bba99406785e 100644 |
7584 |
+--- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h |
7585 |
++++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h |
7586 |
+@@ -31,6 +31,12 @@ |
7587 |
+ |
7588 |
+ #include "../../include/linux/atomisp_platform.h" |
7589 |
+ |
7590 |
++/* |
7591 |
++ * FIXME: non-preview resolutions are currently broken |
7592 |
++ */ |
7593 |
++#define ENABLE_NON_PREVIEW 0 |
7594 |
++ |
7595 |
++ |
7596 |
+ #define OV5693_POWER_UP_RETRY_NUM 5 |
7597 |
+ |
7598 |
+ /* Defines for register writes and register array processing */ |
7599 |
+@@ -503,6 +509,7 @@ static struct ov5693_reg const ov5693_global_setting[] = { |
7600 |
+ {OV5693_TOK_TERM, 0, 0} |
7601 |
+ }; |
7602 |
+ |
7603 |
++#if ENABLE_NON_PREVIEW |
7604 |
+ /* |
7605 |
+ * 654x496 30fps 17ms VBlanking 2lane 10Bit (Scaling) |
7606 |
+ */ |
7607 |
+@@ -695,6 +702,7 @@ static struct ov5693_reg const ov5693_736x496[] = { |
7608 |
+ {OV5693_8BIT, 0x0100, 0x01}, |
7609 |
+ {OV5693_TOK_TERM, 0, 0} |
7610 |
+ }; |
7611 |
++#endif |
7612 |
+ |
7613 |
+ /* |
7614 |
+ static struct ov5693_reg const ov5693_736x496[] = { |
7615 |
+@@ -727,6 +735,7 @@ static struct ov5693_reg const ov5693_736x496[] = { |
7616 |
+ /* |
7617 |
+ * 976x556 30fps 8.8ms VBlanking 2lane 10Bit (Scaling) |
7618 |
+ */ |
7619 |
++#if ENABLE_NON_PREVIEW |
7620 |
+ static struct ov5693_reg const ov5693_976x556[] = { |
7621 |
+ {OV5693_8BIT, 0x3501, 0x7b}, |
7622 |
+ {OV5693_8BIT, 0x3502, 0x00}, |
7623 |
+@@ -819,6 +828,7 @@ static struct ov5693_reg const ov5693_1636p_30fps[] = { |
7624 |
+ {OV5693_8BIT, 0x0100, 0x01}, |
7625 |
+ {OV5693_TOK_TERM, 0, 0} |
7626 |
+ }; |
7627 |
++#endif |
7628 |
+ |
7629 |
+ static struct ov5693_reg const ov5693_1616x1216_30fps[] = { |
7630 |
+ {OV5693_8BIT, 0x3501, 0x7b}, |
7631 |
+@@ -859,6 +869,7 @@ static struct ov5693_reg const ov5693_1616x1216_30fps[] = { |
7632 |
+ /* |
7633 |
+ * 1940x1096 30fps 8.8ms VBlanking 2lane 10bit (Scaling) |
7634 |
+ */ |
7635 |
++#if ENABLE_NON_PREVIEW |
7636 |
+ static struct ov5693_reg const ov5693_1940x1096[] = { |
7637 |
+ {OV5693_8BIT, 0x3501, 0x7b}, |
7638 |
+ {OV5693_8BIT, 0x3502, 0x00}, |
7639 |
+@@ -916,6 +927,7 @@ static struct ov5693_reg const ov5693_2592x1456_30fps[] = { |
7640 |
+ {OV5693_8BIT, 0x5002, 0x00}, |
7641 |
+ {OV5693_TOK_TERM, 0, 0} |
7642 |
+ }; |
7643 |
++#endif |
7644 |
+ |
7645 |
+ static struct ov5693_reg const ov5693_2576x1456_30fps[] = { |
7646 |
+ {OV5693_8BIT, 0x3501, 0x7b}, |
7647 |
+@@ -951,6 +963,7 @@ static struct ov5693_reg const ov5693_2576x1456_30fps[] = { |
7648 |
+ /* |
7649 |
+ * 2592x1944 30fps 0.6ms VBlanking 2lane 10Bit |
7650 |
+ */ |
7651 |
++#if ENABLE_NON_PREVIEW |
7652 |
+ static struct ov5693_reg const ov5693_2592x1944_30fps[] = { |
7653 |
+ {OV5693_8BIT, 0x3501, 0x7b}, |
7654 |
+ {OV5693_8BIT, 0x3502, 0x00}, |
7655 |
+@@ -977,6 +990,7 @@ static struct ov5693_reg const ov5693_2592x1944_30fps[] = { |
7656 |
+ {OV5693_8BIT, 0x0100, 0x01}, |
7657 |
+ {OV5693_TOK_TERM, 0, 0} |
7658 |
+ }; |
7659 |
++#endif |
7660 |
+ |
7661 |
+ /* |
7662 |
+ * 11:9 Full FOV Output, expected FOV Res: 2346x1920 |
7663 |
+@@ -985,6 +999,7 @@ static struct ov5693_reg const ov5693_2592x1944_30fps[] = { |
7664 |
+ * |
7665 |
+ * WA: Left Offset: 8, Hor scal: 64 |
7666 |
+ */ |
7667 |
++#if ENABLE_NON_PREVIEW |
7668 |
+ static struct ov5693_reg const ov5693_1424x1168_30fps[] = { |
7669 |
+ {OV5693_8BIT, 0x3501, 0x3b}, /* long exposure[15:8] */ |
7670 |
+ {OV5693_8BIT, 0x3502, 0x80}, /* long exposure[7:0] */ |
7671 |
+@@ -1019,6 +1034,7 @@ static struct ov5693_reg const ov5693_1424x1168_30fps[] = { |
7672 |
+ {OV5693_8BIT, 0x0100, 0x01}, |
7673 |
+ {OV5693_TOK_TERM, 0, 0} |
7674 |
+ }; |
7675 |
++#endif |
7676 |
+ |
7677 |
+ /* |
7678 |
+ * 3:2 Full FOV Output, expected FOV Res: 2560x1706 |
7679 |
+@@ -1151,7 +1167,7 @@ static struct ov5693_resolution ov5693_res_preview[] = { |
7680 |
+ * Disable non-preview configurations until the configuration selection is |
7681 |
+ * improved. |
7682 |
+ */ |
7683 |
+-#if 0 |
7684 |
++#if ENABLE_NON_PREVIEW |
7685 |
+ struct ov5693_resolution ov5693_res_still[] = { |
7686 |
+ { |
7687 |
+ .desc = "ov5693_736x496_30fps", |
7688 |
+diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c |
7689 |
+index 44c21813a06e..2d008590e26e 100644 |
7690 |
+--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c |
7691 |
++++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c |
7692 |
+@@ -77,7 +77,7 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, |
7693 |
+ get_user(kp->flags, &up->flags)) |
7694 |
+ return -EFAULT; |
7695 |
+ |
7696 |
+- kp->base = compat_ptr(tmp); |
7697 |
++ kp->base = (void __force *)compat_ptr(tmp); |
7698 |
+ get_v4l2_pix_format((struct v4l2_pix_format *)&kp->fmt, &up->fmt); |
7699 |
+ return 0; |
7700 |
+ } |
7701 |
+@@ -228,10 +228,10 @@ static int get_atomisp_dvs_6axis_config32(struct atomisp_dvs_6axis_config *kp, |
7702 |
+ get_user(ycoords_uv, &up->ycoords_uv)) |
7703 |
+ return -EFAULT; |
7704 |
+ |
7705 |
+- kp->xcoords_y = compat_ptr(xcoords_y); |
7706 |
+- kp->ycoords_y = compat_ptr(ycoords_y); |
7707 |
+- kp->xcoords_uv = compat_ptr(xcoords_uv); |
7708 |
+- kp->ycoords_uv = compat_ptr(ycoords_uv); |
7709 |
++ kp->xcoords_y = (void __force *)compat_ptr(xcoords_y); |
7710 |
++ kp->ycoords_y = (void __force *)compat_ptr(ycoords_y); |
7711 |
++ kp->xcoords_uv = (void __force *)compat_ptr(xcoords_uv); |
7712 |
++ kp->ycoords_uv = (void __force *)compat_ptr(ycoords_uv); |
7713 |
+ return 0; |
7714 |
+ } |
7715 |
+ |
7716 |
+@@ -292,7 +292,7 @@ static int get_atomisp_metadata_stat32(struct atomisp_metadata *kp, |
7717 |
+ return -EFAULT; |
7718 |
+ |
7719 |
+ kp->data = compat_ptr(data); |
7720 |
+- kp->effective_width = compat_ptr(effective_width); |
7721 |
++ kp->effective_width = (void __force *)compat_ptr(effective_width); |
7722 |
+ return 0; |
7723 |
+ } |
7724 |
+ |
7725 |
+@@ -356,7 +356,7 @@ static int get_atomisp_metadata_by_type_stat32( |
7726 |
+ return -EFAULT; |
7727 |
+ |
7728 |
+ kp->data = compat_ptr(data); |
7729 |
+- kp->effective_width = compat_ptr(effective_width); |
7730 |
++ kp->effective_width = (void __force *)compat_ptr(effective_width); |
7731 |
+ return 0; |
7732 |
+ } |
7733 |
+ |
7734 |
+@@ -433,7 +433,7 @@ static int get_atomisp_overlay32(struct atomisp_overlay *kp, |
7735 |
+ get_user(kp->overlay_start_x, &up->overlay_start_y)) |
7736 |
+ return -EFAULT; |
7737 |
+ |
7738 |
+- kp->frame = compat_ptr(frame); |
7739 |
++ kp->frame = (void __force *)compat_ptr(frame); |
7740 |
+ return 0; |
7741 |
+ } |
7742 |
+ |
7743 |
+@@ -477,7 +477,7 @@ static int get_atomisp_calibration_group32( |
7744 |
+ get_user(calb_grp_values, &up->calb_grp_values)) |
7745 |
+ return -EFAULT; |
7746 |
+ |
7747 |
+- kp->calb_grp_values = compat_ptr(calb_grp_values); |
7748 |
++ kp->calb_grp_values = (void __force *)compat_ptr(calb_grp_values); |
7749 |
+ return 0; |
7750 |
+ } |
7751 |
+ |
7752 |
+@@ -699,8 +699,8 @@ static int get_atomisp_parameters32(struct atomisp_parameters *kp, |
7753 |
+ return -EFAULT; |
7754 |
+ |
7755 |
+ while (n >= 0) { |
7756 |
+- compat_uptr_t *src = (compat_uptr_t *)up + n; |
7757 |
+- uintptr_t *dst = (uintptr_t *)kp + n; |
7758 |
++ compat_uptr_t __user *src = ((compat_uptr_t __user *)up) + n; |
7759 |
++ uintptr_t *dst = ((uintptr_t *)kp) + n; |
7760 |
+ |
7761 |
+ if (get_user((*dst), src)) |
7762 |
+ return -EFAULT; |
7763 |
+@@ -747,12 +747,12 @@ static int get_atomisp_parameters32(struct atomisp_parameters *kp, |
7764 |
+ #endif |
7765 |
+ return -EFAULT; |
7766 |
+ |
7767 |
+- kp->shading_table = user_ptr + offset; |
7768 |
++ kp->shading_table = (void __force *)user_ptr + offset; |
7769 |
+ offset = sizeof(struct atomisp_shading_table); |
7770 |
+ if (!kp->shading_table) |
7771 |
+ return -EFAULT; |
7772 |
+ |
7773 |
+- if (copy_to_user(kp->shading_table, |
7774 |
++ if (copy_to_user((void __user *)kp->shading_table, |
7775 |
+ &karg.shading_table, |
7776 |
+ sizeof(struct atomisp_shading_table))) |
7777 |
+ return -EFAULT; |
7778 |
+@@ -773,13 +773,14 @@ static int get_atomisp_parameters32(struct atomisp_parameters *kp, |
7779 |
+ #endif |
7780 |
+ return -EFAULT; |
7781 |
+ |
7782 |
+- kp->morph_table = user_ptr + offset; |
7783 |
++ kp->morph_table = (void __force *)user_ptr + offset; |
7784 |
+ offset += sizeof(struct atomisp_morph_table); |
7785 |
+ if (!kp->morph_table) |
7786 |
+ return -EFAULT; |
7787 |
+ |
7788 |
+- if (copy_to_user(kp->morph_table, &karg.morph_table, |
7789 |
+- sizeof(struct atomisp_morph_table))) |
7790 |
++ if (copy_to_user((void __user *)kp->morph_table, |
7791 |
++ &karg.morph_table, |
7792 |
++ sizeof(struct atomisp_morph_table))) |
7793 |
+ return -EFAULT; |
7794 |
+ } |
7795 |
+ |
7796 |
+@@ -798,13 +799,14 @@ static int get_atomisp_parameters32(struct atomisp_parameters *kp, |
7797 |
+ #endif |
7798 |
+ return -EFAULT; |
7799 |
+ |
7800 |
+- kp->dvs2_coefs = user_ptr + offset; |
7801 |
++ kp->dvs2_coefs = (void __force *)user_ptr + offset; |
7802 |
+ offset += sizeof(struct atomisp_dis_coefficients); |
7803 |
+ if (!kp->dvs2_coefs) |
7804 |
+ return -EFAULT; |
7805 |
+ |
7806 |
+- if (copy_to_user(kp->dvs2_coefs, &karg.dvs2_coefs, |
7807 |
+- sizeof(struct atomisp_dis_coefficients))) |
7808 |
++ if (copy_to_user((void __user *)kp->dvs2_coefs, |
7809 |
++ &karg.dvs2_coefs, |
7810 |
++ sizeof(struct atomisp_dis_coefficients))) |
7811 |
+ return -EFAULT; |
7812 |
+ } |
7813 |
+ /* handle dvs 6axis configuration */ |
7814 |
+@@ -822,13 +824,14 @@ static int get_atomisp_parameters32(struct atomisp_parameters *kp, |
7815 |
+ #endif |
7816 |
+ return -EFAULT; |
7817 |
+ |
7818 |
+- kp->dvs_6axis_config = user_ptr + offset; |
7819 |
++ kp->dvs_6axis_config = (void __force *)user_ptr + offset; |
7820 |
+ offset += sizeof(struct atomisp_dvs_6axis_config); |
7821 |
+ if (!kp->dvs_6axis_config) |
7822 |
+ return -EFAULT; |
7823 |
+ |
7824 |
+- if (copy_to_user(kp->dvs_6axis_config, &karg.dvs_6axis_config, |
7825 |
+- sizeof(struct atomisp_dvs_6axis_config))) |
7826 |
++ if (copy_to_user((void __user *)kp->dvs_6axis_config, |
7827 |
++ &karg.dvs_6axis_config, |
7828 |
++ sizeof(struct atomisp_dvs_6axis_config))) |
7829 |
+ return -EFAULT; |
7830 |
+ } |
7831 |
+ } |
7832 |
+@@ -887,7 +890,7 @@ static int get_atomisp_sensor_ae_bracketing_lut( |
7833 |
+ get_user(lut, &up->lut)) |
7834 |
+ return -EFAULT; |
7835 |
+ |
7836 |
+- kp->lut = compat_ptr(lut); |
7837 |
++ kp->lut = (void __force *)compat_ptr(lut); |
7838 |
+ return 0; |
7839 |
+ } |
7840 |
+ |
7841 |
+diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c |
7842 |
+index 4d7fce8731fe..dfa8e4db2239 100644 |
7843 |
+--- a/drivers/staging/most/cdev/cdev.c |
7844 |
++++ b/drivers/staging/most/cdev/cdev.c |
7845 |
+@@ -18,6 +18,8 @@ |
7846 |
+ #include <linux/idr.h> |
7847 |
+ #include "most/core.h" |
7848 |
+ |
7849 |
++#define CHRDEV_REGION_SIZE 50 |
7850 |
++ |
7851 |
+ static struct cdev_component { |
7852 |
+ dev_t devno; |
7853 |
+ struct ida minor_id; |
7854 |
+@@ -513,7 +515,7 @@ static int __init mod_init(void) |
7855 |
+ spin_lock_init(&ch_list_lock); |
7856 |
+ ida_init(&comp.minor_id); |
7857 |
+ |
7858 |
+- err = alloc_chrdev_region(&comp.devno, 0, 50, "cdev"); |
7859 |
++ err = alloc_chrdev_region(&comp.devno, 0, CHRDEV_REGION_SIZE, "cdev"); |
7860 |
+ if (err < 0) |
7861 |
+ goto dest_ida; |
7862 |
+ comp.major = MAJOR(comp.devno); |
7863 |
+@@ -523,7 +525,7 @@ static int __init mod_init(void) |
7864 |
+ return 0; |
7865 |
+ |
7866 |
+ free_cdev: |
7867 |
+- unregister_chrdev_region(comp.devno, 1); |
7868 |
++ unregister_chrdev_region(comp.devno, CHRDEV_REGION_SIZE); |
7869 |
+ dest_ida: |
7870 |
+ ida_destroy(&comp.minor_id); |
7871 |
+ class_destroy(comp.class); |
7872 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
7873 |
+index 5d28fff46557..80f6168f06f6 100644 |
7874 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
7875 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
7876 |
+@@ -601,6 +601,7 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) |
7877 |
+ } |
7878 |
+ |
7879 |
+ if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) { |
7880 |
++ up(&state->slot_available_event); |
7881 |
+ pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos); |
7882 |
+ return NULL; |
7883 |
+ } |
7884 |
+diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c |
7885 |
+index ac83f721db24..d60069b5dc98 100644 |
7886 |
+--- a/drivers/thermal/samsung/exynos_tmu.c |
7887 |
++++ b/drivers/thermal/samsung/exynos_tmu.c |
7888 |
+@@ -598,6 +598,7 @@ static int exynos5433_tmu_initialize(struct platform_device *pdev) |
7889 |
+ threshold_code = temp_to_code(data, temp); |
7890 |
+ |
7891 |
+ rising_threshold = readl(data->base + rising_reg_offset); |
7892 |
++ rising_threshold &= ~(0xff << j * 8); |
7893 |
+ rising_threshold |= (threshold_code << j * 8); |
7894 |
+ writel(rising_threshold, data->base + rising_reg_offset); |
7895 |
+ |
7896 |
+diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c |
7897 |
+index 2ed07ca6389e..9645c0062a90 100644 |
7898 |
+--- a/drivers/tty/hvc/hvc_opal.c |
7899 |
++++ b/drivers/tty/hvc/hvc_opal.c |
7900 |
+@@ -318,7 +318,6 @@ static void udbg_init_opal_common(void) |
7901 |
+ udbg_putc = udbg_opal_putc; |
7902 |
+ udbg_getc = udbg_opal_getc; |
7903 |
+ udbg_getc_poll = udbg_opal_getc_poll; |
7904 |
+- tb_ticks_per_usec = 0x200; /* Make udelay not suck */ |
7905 |
+ } |
7906 |
+ |
7907 |
+ void __init hvc_opal_init_early(void) |
7908 |
+diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
7909 |
+index 6c7151edd715..b0e2c4847a5d 100644 |
7910 |
+--- a/drivers/tty/pty.c |
7911 |
++++ b/drivers/tty/pty.c |
7912 |
+@@ -110,16 +110,19 @@ static void pty_unthrottle(struct tty_struct *tty) |
7913 |
+ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
7914 |
+ { |
7915 |
+ struct tty_struct *to = tty->link; |
7916 |
++ unsigned long flags; |
7917 |
+ |
7918 |
+ if (tty->stopped) |
7919 |
+ return 0; |
7920 |
+ |
7921 |
+ if (c > 0) { |
7922 |
++ spin_lock_irqsave(&to->port->lock, flags); |
7923 |
+ /* Stuff the data into the input queue of the other end */ |
7924 |
+ c = tty_insert_flip_string(to->port, buf, c); |
7925 |
+ /* And shovel */ |
7926 |
+ if (c) |
7927 |
+ tty_flip_buffer_push(to->port); |
7928 |
++ spin_unlock_irqrestore(&to->port->lock, flags); |
7929 |
+ } |
7930 |
+ return c; |
7931 |
+ } |
7932 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
7933 |
+index 40c2d9878190..c75c1532ca73 100644 |
7934 |
+--- a/drivers/usb/core/hub.c |
7935 |
++++ b/drivers/usb/core/hub.c |
7936 |
+@@ -3380,6 +3380,10 @@ static int wait_for_connected(struct usb_device *udev, |
7937 |
+ while (delay_ms < 2000) { |
7938 |
+ if (status || *portstatus & USB_PORT_STAT_CONNECTION) |
7939 |
+ break; |
7940 |
++ if (!port_is_power_on(hub, *portstatus)) { |
7941 |
++ status = -ENODEV; |
7942 |
++ break; |
7943 |
++ } |
7944 |
+ msleep(20); |
7945 |
+ delay_ms += 20; |
7946 |
+ status = hub_port_status(hub, *port1, portstatus, portchange); |
7947 |
+diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c |
7948 |
+index 126991046eb7..0212f0ee8aea 100644 |
7949 |
+--- a/drivers/vfio/mdev/mdev_core.c |
7950 |
++++ b/drivers/vfio/mdev/mdev_core.c |
7951 |
+@@ -66,34 +66,6 @@ uuid_le mdev_uuid(struct mdev_device *mdev) |
7952 |
+ } |
7953 |
+ EXPORT_SYMBOL(mdev_uuid); |
7954 |
+ |
7955 |
+-static int _find_mdev_device(struct device *dev, void *data) |
7956 |
+-{ |
7957 |
+- struct mdev_device *mdev; |
7958 |
+- |
7959 |
+- if (!dev_is_mdev(dev)) |
7960 |
+- return 0; |
7961 |
+- |
7962 |
+- mdev = to_mdev_device(dev); |
7963 |
+- |
7964 |
+- if (uuid_le_cmp(mdev->uuid, *(uuid_le *)data) == 0) |
7965 |
+- return 1; |
7966 |
+- |
7967 |
+- return 0; |
7968 |
+-} |
7969 |
+- |
7970 |
+-static bool mdev_device_exist(struct mdev_parent *parent, uuid_le uuid) |
7971 |
+-{ |
7972 |
+- struct device *dev; |
7973 |
+- |
7974 |
+- dev = device_find_child(parent->dev, &uuid, _find_mdev_device); |
7975 |
+- if (dev) { |
7976 |
+- put_device(dev); |
7977 |
+- return true; |
7978 |
+- } |
7979 |
+- |
7980 |
+- return false; |
7981 |
+-} |
7982 |
+- |
7983 |
+ /* Should be called holding parent_list_lock */ |
7984 |
+ static struct mdev_parent *__find_parent_device(struct device *dev) |
7985 |
+ { |
7986 |
+@@ -221,7 +193,6 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) |
7987 |
+ } |
7988 |
+ |
7989 |
+ kref_init(&parent->ref); |
7990 |
+- mutex_init(&parent->lock); |
7991 |
+ |
7992 |
+ parent->dev = dev; |
7993 |
+ parent->ops = ops; |
7994 |
+@@ -297,6 +268,10 @@ static void mdev_device_release(struct device *dev) |
7995 |
+ { |
7996 |
+ struct mdev_device *mdev = to_mdev_device(dev); |
7997 |
+ |
7998 |
++ mutex_lock(&mdev_list_lock); |
7999 |
++ list_del(&mdev->next); |
8000 |
++ mutex_unlock(&mdev_list_lock); |
8001 |
++ |
8002 |
+ dev_dbg(&mdev->dev, "MDEV: destroying\n"); |
8003 |
+ kfree(mdev); |
8004 |
+ } |
8005 |
+@@ -304,7 +279,7 @@ static void mdev_device_release(struct device *dev) |
8006 |
+ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) |
8007 |
+ { |
8008 |
+ int ret; |
8009 |
+- struct mdev_device *mdev; |
8010 |
++ struct mdev_device *mdev, *tmp; |
8011 |
+ struct mdev_parent *parent; |
8012 |
+ struct mdev_type *type = to_mdev_type(kobj); |
8013 |
+ |
8014 |
+@@ -312,21 +287,28 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) |
8015 |
+ if (!parent) |
8016 |
+ return -EINVAL; |
8017 |
+ |
8018 |
+- mutex_lock(&parent->lock); |
8019 |
++ mutex_lock(&mdev_list_lock); |
8020 |
+ |
8021 |
+ /* Check for duplicate */ |
8022 |
+- if (mdev_device_exist(parent, uuid)) { |
8023 |
+- ret = -EEXIST; |
8024 |
+- goto create_err; |
8025 |
++ list_for_each_entry(tmp, &mdev_list, next) { |
8026 |
++ if (!uuid_le_cmp(tmp->uuid, uuid)) { |
8027 |
++ mutex_unlock(&mdev_list_lock); |
8028 |
++ ret = -EEXIST; |
8029 |
++ goto mdev_fail; |
8030 |
++ } |
8031 |
+ } |
8032 |
+ |
8033 |
+ mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); |
8034 |
+ if (!mdev) { |
8035 |
++ mutex_unlock(&mdev_list_lock); |
8036 |
+ ret = -ENOMEM; |
8037 |
+- goto create_err; |
8038 |
++ goto mdev_fail; |
8039 |
+ } |
8040 |
+ |
8041 |
+ memcpy(&mdev->uuid, &uuid, sizeof(uuid_le)); |
8042 |
++ list_add(&mdev->next, &mdev_list); |
8043 |
++ mutex_unlock(&mdev_list_lock); |
8044 |
++ |
8045 |
+ mdev->parent = parent; |
8046 |
+ kref_init(&mdev->ref); |
8047 |
+ |
8048 |
+@@ -338,35 +320,28 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) |
8049 |
+ ret = device_register(&mdev->dev); |
8050 |
+ if (ret) { |
8051 |
+ put_device(&mdev->dev); |
8052 |
+- goto create_err; |
8053 |
++ goto mdev_fail; |
8054 |
+ } |
8055 |
+ |
8056 |
+ ret = mdev_device_create_ops(kobj, mdev); |
8057 |
+ if (ret) |
8058 |
+- goto create_failed; |
8059 |
++ goto create_fail; |
8060 |
+ |
8061 |
+ ret = mdev_create_sysfs_files(&mdev->dev, type); |
8062 |
+ if (ret) { |
8063 |
+ mdev_device_remove_ops(mdev, true); |
8064 |
+- goto create_failed; |
8065 |
++ goto create_fail; |
8066 |
+ } |
8067 |
+ |
8068 |
+ mdev->type_kobj = kobj; |
8069 |
++ mdev->active = true; |
8070 |
+ dev_dbg(&mdev->dev, "MDEV: created\n"); |
8071 |
+ |
8072 |
+- mutex_unlock(&parent->lock); |
8073 |
+- |
8074 |
+- mutex_lock(&mdev_list_lock); |
8075 |
+- list_add(&mdev->next, &mdev_list); |
8076 |
+- mutex_unlock(&mdev_list_lock); |
8077 |
+- |
8078 |
+- return ret; |
8079 |
++ return 0; |
8080 |
+ |
8081 |
+-create_failed: |
8082 |
++create_fail: |
8083 |
+ device_unregister(&mdev->dev); |
8084 |
+- |
8085 |
+-create_err: |
8086 |
+- mutex_unlock(&parent->lock); |
8087 |
++mdev_fail: |
8088 |
+ mdev_put_parent(parent); |
8089 |
+ return ret; |
8090 |
+ } |
8091 |
+@@ -377,44 +352,39 @@ int mdev_device_remove(struct device *dev, bool force_remove) |
8092 |
+ struct mdev_parent *parent; |
8093 |
+ struct mdev_type *type; |
8094 |
+ int ret; |
8095 |
+- bool found = false; |
8096 |
+ |
8097 |
+ mdev = to_mdev_device(dev); |
8098 |
+ |
8099 |
+ mutex_lock(&mdev_list_lock); |
8100 |
+ list_for_each_entry(tmp, &mdev_list, next) { |
8101 |
+- if (tmp == mdev) { |
8102 |
+- found = true; |
8103 |
++ if (tmp == mdev) |
8104 |
+ break; |
8105 |
+- } |
8106 |
+ } |
8107 |
+ |
8108 |
+- if (found) |
8109 |
+- list_del(&mdev->next); |
8110 |
++ if (tmp != mdev) { |
8111 |
++ mutex_unlock(&mdev_list_lock); |
8112 |
++ return -ENODEV; |
8113 |
++ } |
8114 |
+ |
8115 |
+- mutex_unlock(&mdev_list_lock); |
8116 |
++ if (!mdev->active) { |
8117 |
++ mutex_unlock(&mdev_list_lock); |
8118 |
++ return -EAGAIN; |
8119 |
++ } |
8120 |
+ |
8121 |
+- if (!found) |
8122 |
+- return -ENODEV; |
8123 |
++ mdev->active = false; |
8124 |
++ mutex_unlock(&mdev_list_lock); |
8125 |
+ |
8126 |
+ type = to_mdev_type(mdev->type_kobj); |
8127 |
+ parent = mdev->parent; |
8128 |
+- mutex_lock(&parent->lock); |
8129 |
+ |
8130 |
+ ret = mdev_device_remove_ops(mdev, force_remove); |
8131 |
+ if (ret) { |
8132 |
+- mutex_unlock(&parent->lock); |
8133 |
+- |
8134 |
+- mutex_lock(&mdev_list_lock); |
8135 |
+- list_add(&mdev->next, &mdev_list); |
8136 |
+- mutex_unlock(&mdev_list_lock); |
8137 |
+- |
8138 |
++ mdev->active = true; |
8139 |
+ return ret; |
8140 |
+ } |
8141 |
+ |
8142 |
+ mdev_remove_sysfs_files(dev, type); |
8143 |
+ device_unregister(dev); |
8144 |
+- mutex_unlock(&parent->lock); |
8145 |
+ mdev_put_parent(parent); |
8146 |
+ |
8147 |
+ return 0; |
8148 |
+diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h |
8149 |
+index a9cefd70a705..b5819b7d7ef7 100644 |
8150 |
+--- a/drivers/vfio/mdev/mdev_private.h |
8151 |
++++ b/drivers/vfio/mdev/mdev_private.h |
8152 |
+@@ -20,7 +20,6 @@ struct mdev_parent { |
8153 |
+ struct device *dev; |
8154 |
+ const struct mdev_parent_ops *ops; |
8155 |
+ struct kref ref; |
8156 |
+- struct mutex lock; |
8157 |
+ struct list_head next; |
8158 |
+ struct kset *mdev_types_kset; |
8159 |
+ struct list_head type_list; |
8160 |
+@@ -34,6 +33,7 @@ struct mdev_device { |
8161 |
+ struct kref ref; |
8162 |
+ struct list_head next; |
8163 |
+ struct kobject *type_kobj; |
8164 |
++ bool active; |
8165 |
+ }; |
8166 |
+ |
8167 |
+ #define to_mdev_device(dev) container_of(dev, struct mdev_device, dev) |
8168 |
+diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c |
8169 |
+index 4c27f4be3c3d..aa9e792110e3 100644 |
8170 |
+--- a/drivers/vfio/platform/vfio_platform_common.c |
8171 |
++++ b/drivers/vfio/platform/vfio_platform_common.c |
8172 |
+@@ -681,18 +681,23 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, |
8173 |
+ group = vfio_iommu_group_get(dev); |
8174 |
+ if (!group) { |
8175 |
+ pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); |
8176 |
+- return -EINVAL; |
8177 |
++ ret = -EINVAL; |
8178 |
++ goto put_reset; |
8179 |
+ } |
8180 |
+ |
8181 |
+ ret = vfio_add_group_dev(dev, &vfio_platform_ops, vdev); |
8182 |
+- if (ret) { |
8183 |
+- vfio_iommu_group_put(group, dev); |
8184 |
+- return ret; |
8185 |
+- } |
8186 |
++ if (ret) |
8187 |
++ goto put_iommu; |
8188 |
+ |
8189 |
+ mutex_init(&vdev->igate); |
8190 |
+ |
8191 |
+ return 0; |
8192 |
++ |
8193 |
++put_iommu: |
8194 |
++ vfio_iommu_group_put(group, dev); |
8195 |
++put_reset: |
8196 |
++ vfio_platform_put_reset(vdev); |
8197 |
++ return ret; |
8198 |
+ } |
8199 |
+ EXPORT_SYMBOL_GPL(vfio_platform_probe_common); |
8200 |
+ |
8201 |
+diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c |
8202 |
+index 0586ad5eb590..3e5b17710a4f 100644 |
8203 |
+--- a/drivers/vfio/vfio_iommu_type1.c |
8204 |
++++ b/drivers/vfio/vfio_iommu_type1.c |
8205 |
+@@ -83,6 +83,7 @@ struct vfio_dma { |
8206 |
+ size_t size; /* Map size (bytes) */ |
8207 |
+ int prot; /* IOMMU_READ/WRITE */ |
8208 |
+ bool iommu_mapped; |
8209 |
++ bool lock_cap; /* capable(CAP_IPC_LOCK) */ |
8210 |
+ struct task_struct *task; |
8211 |
+ struct rb_root pfn_list; /* Ex-user pinned pfn list */ |
8212 |
+ }; |
8213 |
+@@ -253,29 +254,25 @@ static int vfio_iova_put_vfio_pfn(struct vfio_dma *dma, struct vfio_pfn *vpfn) |
8214 |
+ return ret; |
8215 |
+ } |
8216 |
+ |
8217 |
+-static int vfio_lock_acct(struct task_struct *task, long npage, bool *lock_cap) |
8218 |
++static int vfio_lock_acct(struct vfio_dma *dma, long npage, bool async) |
8219 |
+ { |
8220 |
+ struct mm_struct *mm; |
8221 |
+- bool is_current; |
8222 |
+ int ret; |
8223 |
+ |
8224 |
+ if (!npage) |
8225 |
+ return 0; |
8226 |
+ |
8227 |
+- is_current = (task->mm == current->mm); |
8228 |
+- |
8229 |
+- mm = is_current ? task->mm : get_task_mm(task); |
8230 |
++ mm = async ? get_task_mm(dma->task) : dma->task->mm; |
8231 |
+ if (!mm) |
8232 |
+ return -ESRCH; /* process exited */ |
8233 |
+ |
8234 |
+ ret = down_write_killable(&mm->mmap_sem); |
8235 |
+ if (!ret) { |
8236 |
+ if (npage > 0) { |
8237 |
+- if (lock_cap ? !*lock_cap : |
8238 |
+- !has_capability(task, CAP_IPC_LOCK)) { |
8239 |
++ if (!dma->lock_cap) { |
8240 |
+ unsigned long limit; |
8241 |
+ |
8242 |
+- limit = task_rlimit(task, |
8243 |
++ limit = task_rlimit(dma->task, |
8244 |
+ RLIMIT_MEMLOCK) >> PAGE_SHIFT; |
8245 |
+ |
8246 |
+ if (mm->locked_vm + npage > limit) |
8247 |
+@@ -289,7 +286,7 @@ static int vfio_lock_acct(struct task_struct *task, long npage, bool *lock_cap) |
8248 |
+ up_write(&mm->mmap_sem); |
8249 |
+ } |
8250 |
+ |
8251 |
+- if (!is_current) |
8252 |
++ if (async) |
8253 |
+ mmput(mm); |
8254 |
+ |
8255 |
+ return ret; |
8256 |
+@@ -398,7 +395,7 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, |
8257 |
+ */ |
8258 |
+ static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr, |
8259 |
+ long npage, unsigned long *pfn_base, |
8260 |
+- bool lock_cap, unsigned long limit) |
8261 |
++ unsigned long limit) |
8262 |
+ { |
8263 |
+ unsigned long pfn = 0; |
8264 |
+ long ret, pinned = 0, lock_acct = 0; |
8265 |
+@@ -421,7 +418,7 @@ static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr, |
8266 |
+ * pages are already counted against the user. |
8267 |
+ */ |
8268 |
+ if (!rsvd && !vfio_find_vpfn(dma, iova)) { |
8269 |
+- if (!lock_cap && current->mm->locked_vm + 1 > limit) { |
8270 |
++ if (!dma->lock_cap && current->mm->locked_vm + 1 > limit) { |
8271 |
+ put_pfn(*pfn_base, dma->prot); |
8272 |
+ pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n", __func__, |
8273 |
+ limit << PAGE_SHIFT); |
8274 |
+@@ -447,7 +444,7 @@ static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr, |
8275 |
+ } |
8276 |
+ |
8277 |
+ if (!rsvd && !vfio_find_vpfn(dma, iova)) { |
8278 |
+- if (!lock_cap && |
8279 |
++ if (!dma->lock_cap && |
8280 |
+ current->mm->locked_vm + lock_acct + 1 > limit) { |
8281 |
+ put_pfn(pfn, dma->prot); |
8282 |
+ pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n", |
8283 |
+@@ -460,7 +457,7 @@ static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr, |
8284 |
+ } |
8285 |
+ |
8286 |
+ out: |
8287 |
+- ret = vfio_lock_acct(current, lock_acct, &lock_cap); |
8288 |
++ ret = vfio_lock_acct(dma, lock_acct, false); |
8289 |
+ |
8290 |
+ unpin_out: |
8291 |
+ if (ret) { |
8292 |
+@@ -491,7 +488,7 @@ static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova, |
8293 |
+ } |
8294 |
+ |
8295 |
+ if (do_accounting) |
8296 |
+- vfio_lock_acct(dma->task, locked - unlocked, NULL); |
8297 |
++ vfio_lock_acct(dma, locked - unlocked, true); |
8298 |
+ |
8299 |
+ return unlocked; |
8300 |
+ } |
8301 |
+@@ -508,7 +505,7 @@ static int vfio_pin_page_external(struct vfio_dma *dma, unsigned long vaddr, |
8302 |
+ |
8303 |
+ ret = vaddr_get_pfn(mm, vaddr, dma->prot, pfn_base); |
8304 |
+ if (!ret && do_accounting && !is_invalid_reserved_pfn(*pfn_base)) { |
8305 |
+- ret = vfio_lock_acct(dma->task, 1, NULL); |
8306 |
++ ret = vfio_lock_acct(dma, 1, true); |
8307 |
+ if (ret) { |
8308 |
+ put_pfn(*pfn_base, dma->prot); |
8309 |
+ if (ret == -ENOMEM) |
8310 |
+@@ -535,7 +532,7 @@ static int vfio_unpin_page_external(struct vfio_dma *dma, dma_addr_t iova, |
8311 |
+ unlocked = vfio_iova_put_vfio_pfn(dma, vpfn); |
8312 |
+ |
8313 |
+ if (do_accounting) |
8314 |
+- vfio_lock_acct(dma->task, -unlocked, NULL); |
8315 |
++ vfio_lock_acct(dma, -unlocked, true); |
8316 |
+ |
8317 |
+ return unlocked; |
8318 |
+ } |
8319 |
+@@ -827,7 +824,7 @@ static long vfio_unmap_unpin(struct vfio_iommu *iommu, struct vfio_dma *dma, |
8320 |
+ unlocked += vfio_sync_unpin(dma, domain, &unmapped_region_list); |
8321 |
+ |
8322 |
+ if (do_accounting) { |
8323 |
+- vfio_lock_acct(dma->task, -unlocked, NULL); |
8324 |
++ vfio_lock_acct(dma, -unlocked, true); |
8325 |
+ return 0; |
8326 |
+ } |
8327 |
+ return unlocked; |
8328 |
+@@ -1042,14 +1039,12 @@ static int vfio_pin_map_dma(struct vfio_iommu *iommu, struct vfio_dma *dma, |
8329 |
+ size_t size = map_size; |
8330 |
+ long npage; |
8331 |
+ unsigned long pfn, limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; |
8332 |
+- bool lock_cap = capable(CAP_IPC_LOCK); |
8333 |
+ int ret = 0; |
8334 |
+ |
8335 |
+ while (size) { |
8336 |
+ /* Pin a contiguous chunk of memory */ |
8337 |
+ npage = vfio_pin_pages_remote(dma, vaddr + dma->size, |
8338 |
+- size >> PAGE_SHIFT, &pfn, |
8339 |
+- lock_cap, limit); |
8340 |
++ size >> PAGE_SHIFT, &pfn, limit); |
8341 |
+ if (npage <= 0) { |
8342 |
+ WARN_ON(!npage); |
8343 |
+ ret = (int)npage; |
8344 |
+@@ -1124,8 +1119,36 @@ static int vfio_dma_do_map(struct vfio_iommu *iommu, |
8345 |
+ dma->iova = iova; |
8346 |
+ dma->vaddr = vaddr; |
8347 |
+ dma->prot = prot; |
8348 |
+- get_task_struct(current); |
8349 |
+- dma->task = current; |
8350 |
++ |
8351 |
++ /* |
8352 |
++ * We need to be able to both add to a task's locked memory and test |
8353 |
++ * against the locked memory limit and we need to be able to do both |
8354 |
++ * outside of this call path as pinning can be asynchronous via the |
8355 |
++ * external interfaces for mdev devices. RLIMIT_MEMLOCK requires a |
8356 |
++ * task_struct and VM locked pages requires an mm_struct, however |
8357 |
++ * holding an indefinite mm reference is not recommended, therefore we |
8358 |
++ * only hold a reference to a task. We could hold a reference to |
8359 |
++ * current, however QEMU uses this call path through vCPU threads, |
8360 |
++ * which can be killed resulting in a NULL mm and failure in the unmap |
8361 |
++ * path when called via a different thread. Avoid this problem by |
8362 |
++ * using the group_leader as threads within the same group require |
8363 |
++ * both CLONE_THREAD and CLONE_VM and will therefore use the same |
8364 |
++ * mm_struct. |
8365 |
++ * |
8366 |
++ * Previously we also used the task for testing CAP_IPC_LOCK at the |
8367 |
++ * time of pinning and accounting, however has_capability() makes use |
8368 |
++ * of real_cred, a copy-on-write field, so we can't guarantee that it |
8369 |
++ * matches group_leader, or in fact that it might not change by the |
8370 |
++ * time it's evaluated. If a process were to call MAP_DMA with |
8371 |
++ * CAP_IPC_LOCK but later drop it, it doesn't make sense that they |
8372 |
++ * possibly see different results for an iommu_mapped vfio_dma vs |
8373 |
++ * externally mapped. Therefore track CAP_IPC_LOCK in vfio_dma at the |
8374 |
++ * time of calling MAP_DMA. |
8375 |
++ */ |
8376 |
++ get_task_struct(current->group_leader); |
8377 |
++ dma->task = current->group_leader; |
8378 |
++ dma->lock_cap = capable(CAP_IPC_LOCK); |
8379 |
++ |
8380 |
+ dma->pfn_list = RB_ROOT; |
8381 |
+ |
8382 |
+ /* Insert zero-sized and grow as we map chunks of it */ |
8383 |
+@@ -1160,7 +1183,6 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu, |
8384 |
+ struct vfio_domain *d; |
8385 |
+ struct rb_node *n; |
8386 |
+ unsigned long limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; |
8387 |
+- bool lock_cap = capable(CAP_IPC_LOCK); |
8388 |
+ int ret; |
8389 |
+ |
8390 |
+ /* Arbitrarily pick the first domain in the list for lookups */ |
8391 |
+@@ -1207,8 +1229,7 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu, |
8392 |
+ |
8393 |
+ npage = vfio_pin_pages_remote(dma, vaddr, |
8394 |
+ n >> PAGE_SHIFT, |
8395 |
+- &pfn, lock_cap, |
8396 |
+- limit); |
8397 |
++ &pfn, limit); |
8398 |
+ if (npage <= 0) { |
8399 |
+ WARN_ON(!npage); |
8400 |
+ ret = (int)npage; |
8401 |
+@@ -1485,7 +1506,7 @@ static void vfio_iommu_unmap_unpin_reaccount(struct vfio_iommu *iommu) |
8402 |
+ if (!is_invalid_reserved_pfn(vpfn->pfn)) |
8403 |
+ locked++; |
8404 |
+ } |
8405 |
+- vfio_lock_acct(dma->task, locked - unlocked, NULL); |
8406 |
++ vfio_lock_acct(dma, locked - unlocked, true); |
8407 |
+ } |
8408 |
+ } |
8409 |
+ |
8410 |
+diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c |
8411 |
+index 1c2289ddd555..0fa7d2bd0e48 100644 |
8412 |
+--- a/drivers/video/backlight/pwm_bl.c |
8413 |
++++ b/drivers/video/backlight/pwm_bl.c |
8414 |
+@@ -301,14 +301,14 @@ static int pwm_backlight_probe(struct platform_device *pdev) |
8415 |
+ |
8416 |
+ /* |
8417 |
+ * If the GPIO is not known to be already configured as output, that |
8418 |
+- * is, if gpiod_get_direction returns either GPIOF_DIR_IN or -EINVAL, |
8419 |
+- * change the direction to output and set the GPIO as active. |
8420 |
++ * is, if gpiod_get_direction returns either 1 or -EINVAL, change the |
8421 |
++ * direction to output and set the GPIO as active. |
8422 |
+ * Do not force the GPIO to active when it was already output as it |
8423 |
+ * could cause backlight flickering or we would enable the backlight too |
8424 |
+ * early. Leave the decision of the initial backlight state for later. |
8425 |
+ */ |
8426 |
+ if (pb->enable_gpio && |
8427 |
+- gpiod_get_direction(pb->enable_gpio) != GPIOF_DIR_OUT) |
8428 |
++ gpiod_get_direction(pb->enable_gpio) != 0) |
8429 |
+ gpiod_direction_output(pb->enable_gpio, 1); |
8430 |
+ |
8431 |
+ pb->power_supply = devm_regulator_get(&pdev->dev, "power"); |
8432 |
+diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c |
8433 |
+index b17ac1bb1f28..87fb9ab603fa 100644 |
8434 |
+--- a/drivers/watchdog/da9063_wdt.c |
8435 |
++++ b/drivers/watchdog/da9063_wdt.c |
8436 |
+@@ -99,10 +99,23 @@ static int da9063_wdt_set_timeout(struct watchdog_device *wdd, |
8437 |
+ { |
8438 |
+ struct da9063 *da9063 = watchdog_get_drvdata(wdd); |
8439 |
+ unsigned int selector; |
8440 |
+- int ret; |
8441 |
++ int ret = 0; |
8442 |
+ |
8443 |
+ selector = da9063_wdt_timeout_to_sel(timeout); |
8444 |
+- ret = _da9063_wdt_set_timeout(da9063, selector); |
8445 |
++ |
8446 |
++ /* |
8447 |
++ * There are two cases when a set_timeout() will be called: |
8448 |
++ * 1. The watchdog is off and someone wants to set the timeout for the |
8449 |
++ * further use. |
8450 |
++ * 2. The watchdog is already running and a new timeout value should be |
8451 |
++ * set. |
8452 |
++ * |
8453 |
++ * The watchdog can't store a timeout value not equal zero without |
8454 |
++ * enabling the watchdog, so the timeout must be buffered by the driver. |
8455 |
++ */ |
8456 |
++ if (watchdog_active(wdd)) |
8457 |
++ ret = _da9063_wdt_set_timeout(da9063, selector); |
8458 |
++ |
8459 |
+ if (ret) |
8460 |
+ dev_err(da9063->dev, "Failed to set watchdog timeout (err = %d)\n", |
8461 |
+ ret); |
8462 |
+diff --git a/fs/block_dev.c b/fs/block_dev.c |
8463 |
+index 7ec920e27065..9bfece2e3c88 100644 |
8464 |
+--- a/fs/block_dev.c |
8465 |
++++ b/fs/block_dev.c |
8466 |
+@@ -219,7 +219,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, |
8467 |
+ |
8468 |
+ ret = bio_iov_iter_get_pages(&bio, iter); |
8469 |
+ if (unlikely(ret)) |
8470 |
+- return ret; |
8471 |
++ goto out; |
8472 |
+ ret = bio.bi_iter.bi_size; |
8473 |
+ |
8474 |
+ if (iov_iter_rw(iter) == READ) { |
8475 |
+@@ -248,12 +248,13 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, |
8476 |
+ put_page(bvec->bv_page); |
8477 |
+ } |
8478 |
+ |
8479 |
+- if (vecs != inline_vecs) |
8480 |
+- kfree(vecs); |
8481 |
+- |
8482 |
+ if (unlikely(bio.bi_status)) |
8483 |
+ ret = blk_status_to_errno(bio.bi_status); |
8484 |
+ |
8485 |
++out: |
8486 |
++ if (vecs != inline_vecs) |
8487 |
++ kfree(vecs); |
8488 |
++ |
8489 |
+ bio_uninit(&bio); |
8490 |
+ |
8491 |
+ return ret; |
8492 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
8493 |
+index b54a55497216..bd400cf2756f 100644 |
8494 |
+--- a/fs/btrfs/inode.c |
8495 |
++++ b/fs/btrfs/inode.c |
8496 |
+@@ -3160,6 +3160,9 @@ out: |
8497 |
+ /* once for the tree */ |
8498 |
+ btrfs_put_ordered_extent(ordered_extent); |
8499 |
+ |
8500 |
++ /* Try to release some metadata so we don't get an OOM but don't wait */ |
8501 |
++ btrfs_btree_balance_dirty_nodelay(fs_info); |
8502 |
++ |
8503 |
+ return ret; |
8504 |
+ } |
8505 |
+ |
8506 |
+@@ -4668,7 +4671,10 @@ delete: |
8507 |
+ extent_num_bytes, 0, |
8508 |
+ btrfs_header_owner(leaf), |
8509 |
+ ino, extent_offset); |
8510 |
+- BUG_ON(ret); |
8511 |
++ if (ret) { |
8512 |
++ btrfs_abort_transaction(trans, ret); |
8513 |
++ break; |
8514 |
++ } |
8515 |
+ if (btrfs_should_throttle_delayed_refs(trans, fs_info)) |
8516 |
+ btrfs_async_run_delayed_refs(fs_info, |
8517 |
+ trans->delayed_ref_updates * 2, |
8518 |
+@@ -5423,13 +5429,18 @@ void btrfs_evict_inode(struct inode *inode) |
8519 |
+ trans->block_rsv = rsv; |
8520 |
+ |
8521 |
+ ret = btrfs_truncate_inode_items(trans, root, inode, 0, 0); |
8522 |
+- if (ret != -ENOSPC && ret != -EAGAIN) |
8523 |
++ if (ret) { |
8524 |
++ trans->block_rsv = &fs_info->trans_block_rsv; |
8525 |
++ btrfs_end_transaction(trans); |
8526 |
++ btrfs_btree_balance_dirty(fs_info); |
8527 |
++ if (ret != -ENOSPC && ret != -EAGAIN) { |
8528 |
++ btrfs_orphan_del(NULL, BTRFS_I(inode)); |
8529 |
++ btrfs_free_block_rsv(fs_info, rsv); |
8530 |
++ goto no_delete; |
8531 |
++ } |
8532 |
++ } else { |
8533 |
+ break; |
8534 |
+- |
8535 |
+- trans->block_rsv = &fs_info->trans_block_rsv; |
8536 |
+- btrfs_end_transaction(trans); |
8537 |
+- trans = NULL; |
8538 |
+- btrfs_btree_balance_dirty(fs_info); |
8539 |
++ } |
8540 |
+ } |
8541 |
+ |
8542 |
+ btrfs_free_block_rsv(fs_info, rsv); |
8543 |
+@@ -5438,12 +5449,8 @@ void btrfs_evict_inode(struct inode *inode) |
8544 |
+ * Errors here aren't a big deal, it just means we leave orphan items |
8545 |
+ * in the tree. They will be cleaned up on the next mount. |
8546 |
+ */ |
8547 |
+- if (ret == 0) { |
8548 |
+- trans->block_rsv = root->orphan_block_rsv; |
8549 |
+- btrfs_orphan_del(trans, BTRFS_I(inode)); |
8550 |
+- } else { |
8551 |
+- btrfs_orphan_del(NULL, BTRFS_I(inode)); |
8552 |
+- } |
8553 |
++ trans->block_rsv = root->orphan_block_rsv; |
8554 |
++ btrfs_orphan_del(trans, BTRFS_I(inode)); |
8555 |
+ |
8556 |
+ trans->block_rsv = &fs_info->trans_block_rsv; |
8557 |
+ if (!(root == fs_info->tree_root || |
8558 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
8559 |
+index 9fb758d5077a..d0aba20e0843 100644 |
8560 |
+--- a/fs/btrfs/qgroup.c |
8561 |
++++ b/fs/btrfs/qgroup.c |
8562 |
+@@ -2579,6 +2579,21 @@ out: |
8563 |
+ spin_unlock(&fs_info->qgroup_lock); |
8564 |
+ } |
8565 |
+ |
8566 |
++/* |
8567 |
++ * Check if the leaf is the last leaf. Which means all node pointers |
8568 |
++ * are at their last position. |
8569 |
++ */ |
8570 |
++static bool is_last_leaf(struct btrfs_path *path) |
8571 |
++{ |
8572 |
++ int i; |
8573 |
++ |
8574 |
++ for (i = 1; i < BTRFS_MAX_LEVEL && path->nodes[i]; i++) { |
8575 |
++ if (path->slots[i] != btrfs_header_nritems(path->nodes[i]) - 1) |
8576 |
++ return false; |
8577 |
++ } |
8578 |
++ return true; |
8579 |
++} |
8580 |
++ |
8581 |
+ /* |
8582 |
+ * returns < 0 on error, 0 when more leafs are to be scanned. |
8583 |
+ * returns 1 when done. |
8584 |
+@@ -2592,6 +2607,7 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path, |
8585 |
+ struct ulist *roots = NULL; |
8586 |
+ struct seq_list tree_mod_seq_elem = SEQ_LIST_INIT(tree_mod_seq_elem); |
8587 |
+ u64 num_bytes; |
8588 |
++ bool done; |
8589 |
+ int slot; |
8590 |
+ int ret; |
8591 |
+ |
8592 |
+@@ -2620,6 +2636,7 @@ qgroup_rescan_leaf(struct btrfs_fs_info *fs_info, struct btrfs_path *path, |
8593 |
+ mutex_unlock(&fs_info->qgroup_rescan_lock); |
8594 |
+ return ret; |
8595 |
+ } |
8596 |
++ done = is_last_leaf(path); |
8597 |
+ |
8598 |
+ btrfs_item_key_to_cpu(path->nodes[0], &found, |
8599 |
+ btrfs_header_nritems(path->nodes[0]) - 1); |
8600 |
+@@ -2666,6 +2683,8 @@ out: |
8601 |
+ } |
8602 |
+ btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem); |
8603 |
+ |
8604 |
++ if (done && !ret) |
8605 |
++ ret = 1; |
8606 |
+ return ret; |
8607 |
+ } |
8608 |
+ |
8609 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
8610 |
+index 8f23a94dab77..2009cea65d89 100644 |
8611 |
+--- a/fs/btrfs/tree-log.c |
8612 |
++++ b/fs/btrfs/tree-log.c |
8613 |
+@@ -3116,8 +3116,11 @@ out_wake_log_root: |
8614 |
+ mutex_unlock(&log_root_tree->log_mutex); |
8615 |
+ |
8616 |
+ /* |
8617 |
+- * The barrier before waitqueue_active is implied by mutex_unlock |
8618 |
++ * The barrier before waitqueue_active is needed so all the updates |
8619 |
++ * above are seen by the woken threads. It might not be necessary, but |
8620 |
++ * proving that seems to be hard. |
8621 |
+ */ |
8622 |
++ smp_mb(); |
8623 |
+ if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) |
8624 |
+ wake_up(&log_root_tree->log_commit_wait[index2]); |
8625 |
+ out: |
8626 |
+@@ -3128,8 +3131,11 @@ out: |
8627 |
+ mutex_unlock(&root->log_mutex); |
8628 |
+ |
8629 |
+ /* |
8630 |
+- * The barrier before waitqueue_active is implied by mutex_unlock |
8631 |
++ * The barrier before waitqueue_active is needed so all the updates |
8632 |
++ * above are seen by the woken threads. It might not be necessary, but |
8633 |
++ * proving that seems to be hard. |
8634 |
+ */ |
8635 |
++ smp_mb(); |
8636 |
+ if (waitqueue_active(&root->log_commit_wait[index1])) |
8637 |
+ wake_up(&root->log_commit_wait[index1]); |
8638 |
+ return ret; |
8639 |
+diff --git a/fs/ceph/super.c b/fs/ceph/super.c |
8640 |
+index b33082e6878f..6f9b4cfbc33d 100644 |
8641 |
+--- a/fs/ceph/super.c |
8642 |
++++ b/fs/ceph/super.c |
8643 |
+@@ -45,7 +45,7 @@ static void ceph_put_super(struct super_block *s) |
8644 |
+ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) |
8645 |
+ { |
8646 |
+ struct ceph_fs_client *fsc = ceph_inode_to_client(d_inode(dentry)); |
8647 |
+- struct ceph_monmap *monmap = fsc->client->monc.monmap; |
8648 |
++ struct ceph_mon_client *monc = &fsc->client->monc; |
8649 |
+ struct ceph_statfs st; |
8650 |
+ u64 fsid; |
8651 |
+ int err; |
8652 |
+@@ -58,7 +58,7 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) |
8653 |
+ } |
8654 |
+ |
8655 |
+ dout("statfs\n"); |
8656 |
+- err = ceph_monc_do_statfs(&fsc->client->monc, data_pool, &st); |
8657 |
++ err = ceph_monc_do_statfs(monc, data_pool, &st); |
8658 |
+ if (err < 0) |
8659 |
+ return err; |
8660 |
+ |
8661 |
+@@ -94,8 +94,11 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) |
8662 |
+ buf->f_namelen = NAME_MAX; |
8663 |
+ |
8664 |
+ /* Must convert the fsid, for consistent values across arches */ |
8665 |
+- fsid = le64_to_cpu(*(__le64 *)(&monmap->fsid)) ^ |
8666 |
+- le64_to_cpu(*((__le64 *)&monmap->fsid + 1)); |
8667 |
++ mutex_lock(&monc->mutex); |
8668 |
++ fsid = le64_to_cpu(*(__le64 *)(&monc->monmap->fsid)) ^ |
8669 |
++ le64_to_cpu(*((__le64 *)&monc->monmap->fsid + 1)); |
8670 |
++ mutex_unlock(&monc->mutex); |
8671 |
++ |
8672 |
+ buf->f_fsid.val[0] = fsid & 0xffffffff; |
8673 |
+ buf->f_fsid.val[1] = fsid >> 32; |
8674 |
+ |
8675 |
+@@ -268,7 +271,7 @@ static int parse_fsopt_token(char *c, void *private) |
8676 |
+ case Opt_rasize: |
8677 |
+ if (intval < 0) |
8678 |
+ return -EINVAL; |
8679 |
+- fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE); |
8680 |
++ fsopt->rasize = ALIGN(intval, PAGE_SIZE); |
8681 |
+ break; |
8682 |
+ case Opt_caps_wanted_delay_min: |
8683 |
+ if (intval < 1) |
8684 |
+diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c |
8685 |
+index ce654526c0fb..984e190f9b89 100644 |
8686 |
+--- a/fs/crypto/crypto.c |
8687 |
++++ b/fs/crypto/crypto.c |
8688 |
+@@ -427,8 +427,17 @@ fail: |
8689 |
+ */ |
8690 |
+ static int __init fscrypt_init(void) |
8691 |
+ { |
8692 |
++ /* |
8693 |
++ * Use an unbound workqueue to allow bios to be decrypted in parallel |
8694 |
++ * even when they happen to complete on the same CPU. This sacrifices |
8695 |
++ * locality, but it's worthwhile since decryption is CPU-intensive. |
8696 |
++ * |
8697 |
++ * Also use a high-priority workqueue to prioritize decryption work, |
8698 |
++ * which blocks reads from completing, over regular application tasks. |
8699 |
++ */ |
8700 |
+ fscrypt_read_workqueue = alloc_workqueue("fscrypt_read_queue", |
8701 |
+- WQ_HIGHPRI, 0); |
8702 |
++ WQ_UNBOUND | WQ_HIGHPRI, |
8703 |
++ num_online_cpus()); |
8704 |
+ if (!fscrypt_read_workqueue) |
8705 |
+ goto fail; |
8706 |
+ |
8707 |
+diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c |
8708 |
+index f8b5635f0396..e4eab3a38e7c 100644 |
8709 |
+--- a/fs/ext4/balloc.c |
8710 |
++++ b/fs/ext4/balloc.c |
8711 |
+@@ -379,6 +379,8 @@ static int ext4_validate_block_bitmap(struct super_block *sb, |
8712 |
+ return -EFSCORRUPTED; |
8713 |
+ |
8714 |
+ ext4_lock_group(sb, block_group); |
8715 |
++ if (buffer_verified(bh)) |
8716 |
++ goto verified; |
8717 |
+ if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group, |
8718 |
+ desc, bh))) { |
8719 |
+ ext4_unlock_group(sb, block_group); |
8720 |
+@@ -401,6 +403,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb, |
8721 |
+ return -EFSCORRUPTED; |
8722 |
+ } |
8723 |
+ set_buffer_verified(bh); |
8724 |
++verified: |
8725 |
+ ext4_unlock_group(sb, block_group); |
8726 |
+ return 0; |
8727 |
+ } |
8728 |
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
8729 |
+index 478b8f21c814..257388a8032b 100644 |
8730 |
+--- a/fs/ext4/ialloc.c |
8731 |
++++ b/fs/ext4/ialloc.c |
8732 |
+@@ -91,6 +91,8 @@ static int ext4_validate_inode_bitmap(struct super_block *sb, |
8733 |
+ return -EFSCORRUPTED; |
8734 |
+ |
8735 |
+ ext4_lock_group(sb, block_group); |
8736 |
++ if (buffer_verified(bh)) |
8737 |
++ goto verified; |
8738 |
+ blk = ext4_inode_bitmap(sb, desc); |
8739 |
+ if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh, |
8740 |
+ EXT4_INODES_PER_GROUP(sb) / 8)) { |
8741 |
+@@ -108,6 +110,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb, |
8742 |
+ return -EFSBADCRC; |
8743 |
+ } |
8744 |
+ set_buffer_verified(bh); |
8745 |
++verified: |
8746 |
+ ext4_unlock_group(sb, block_group); |
8747 |
+ return 0; |
8748 |
+ } |
8749 |
+@@ -1392,7 +1395,10 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, |
8750 |
+ ext4_itable_unused_count(sb, gdp)), |
8751 |
+ sbi->s_inodes_per_block); |
8752 |
+ |
8753 |
+- if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) { |
8754 |
++ if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group) || |
8755 |
++ ((group == 0) && ((EXT4_INODES_PER_GROUP(sb) - |
8756 |
++ ext4_itable_unused_count(sb, gdp)) < |
8757 |
++ EXT4_FIRST_INO(sb)))) { |
8758 |
+ ext4_error(sb, "Something is wrong with group %u: " |
8759 |
+ "used itable blocks: %d; " |
8760 |
+ "itable unused count: %u", |
8761 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
8762 |
+index 851bc552d849..716adc635506 100644 |
8763 |
+--- a/fs/ext4/inline.c |
8764 |
++++ b/fs/ext4/inline.c |
8765 |
+@@ -682,6 +682,10 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, |
8766 |
+ goto convert; |
8767 |
+ } |
8768 |
+ |
8769 |
++ ret = ext4_journal_get_write_access(handle, iloc.bh); |
8770 |
++ if (ret) |
8771 |
++ goto out; |
8772 |
++ |
8773 |
+ flags |= AOP_FLAG_NOFS; |
8774 |
+ |
8775 |
+ page = grab_cache_page_write_begin(mapping, 0, flags); |
8776 |
+@@ -710,7 +714,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, |
8777 |
+ out_up_read: |
8778 |
+ up_read(&EXT4_I(inode)->xattr_sem); |
8779 |
+ out: |
8780 |
+- if (handle) |
8781 |
++ if (handle && (ret != 1)) |
8782 |
+ ext4_journal_stop(handle); |
8783 |
+ brelse(iloc.bh); |
8784 |
+ return ret; |
8785 |
+@@ -752,6 +756,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, |
8786 |
+ |
8787 |
+ ext4_write_unlock_xattr(inode, &no_expand); |
8788 |
+ brelse(iloc.bh); |
8789 |
++ mark_inode_dirty(inode); |
8790 |
+ out: |
8791 |
+ return copied; |
8792 |
+ } |
8793 |
+@@ -898,7 +903,6 @@ retry_journal: |
8794 |
+ goto out; |
8795 |
+ } |
8796 |
+ |
8797 |
+- |
8798 |
+ page = grab_cache_page_write_begin(mapping, 0, flags); |
8799 |
+ if (!page) { |
8800 |
+ ret = -ENOMEM; |
8801 |
+@@ -916,6 +920,9 @@ retry_journal: |
8802 |
+ if (ret < 0) |
8803 |
+ goto out_release_page; |
8804 |
+ } |
8805 |
++ ret = ext4_journal_get_write_access(handle, iloc.bh); |
8806 |
++ if (ret) |
8807 |
++ goto out_release_page; |
8808 |
+ |
8809 |
+ up_read(&EXT4_I(inode)->xattr_sem); |
8810 |
+ *pagep = page; |
8811 |
+@@ -936,7 +943,6 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, |
8812 |
+ unsigned len, unsigned copied, |
8813 |
+ struct page *page) |
8814 |
+ { |
8815 |
+- int i_size_changed = 0; |
8816 |
+ int ret; |
8817 |
+ |
8818 |
+ ret = ext4_write_inline_data_end(inode, pos, len, copied, page); |
8819 |
+@@ -954,10 +960,8 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, |
8820 |
+ * But it's important to update i_size while still holding page lock: |
8821 |
+ * page writeout could otherwise come in and zero beyond i_size. |
8822 |
+ */ |
8823 |
+- if (pos+copied > inode->i_size) { |
8824 |
++ if (pos+copied > inode->i_size) |
8825 |
+ i_size_write(inode, pos+copied); |
8826 |
+- i_size_changed = 1; |
8827 |
+- } |
8828 |
+ unlock_page(page); |
8829 |
+ put_page(page); |
8830 |
+ |
8831 |
+@@ -967,8 +971,7 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, |
8832 |
+ * ordering of page lock and transaction start for journaling |
8833 |
+ * filesystems. |
8834 |
+ */ |
8835 |
+- if (i_size_changed) |
8836 |
+- mark_inode_dirty(inode); |
8837 |
++ mark_inode_dirty(inode); |
8838 |
+ |
8839 |
+ return copied; |
8840 |
+ } |
8841 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
8842 |
+index 06b963d2fc36..afb22e01f009 100644 |
8843 |
+--- a/fs/ext4/inode.c |
8844 |
++++ b/fs/ext4/inode.c |
8845 |
+@@ -1389,9 +1389,10 @@ static int ext4_write_end(struct file *file, |
8846 |
+ loff_t old_size = inode->i_size; |
8847 |
+ int ret = 0, ret2; |
8848 |
+ int i_size_changed = 0; |
8849 |
++ int inline_data = ext4_has_inline_data(inode); |
8850 |
+ |
8851 |
+ trace_ext4_write_end(inode, pos, len, copied); |
8852 |
+- if (ext4_has_inline_data(inode)) { |
8853 |
++ if (inline_data) { |
8854 |
+ ret = ext4_write_inline_data_end(inode, pos, len, |
8855 |
+ copied, page); |
8856 |
+ if (ret < 0) { |
8857 |
+@@ -1419,7 +1420,7 @@ static int ext4_write_end(struct file *file, |
8858 |
+ * ordering of page lock and transaction start for journaling |
8859 |
+ * filesystems. |
8860 |
+ */ |
8861 |
+- if (i_size_changed) |
8862 |
++ if (i_size_changed || inline_data) |
8863 |
+ ext4_mark_inode_dirty(handle, inode); |
8864 |
+ |
8865 |
+ if (pos + len > inode->i_size && ext4_can_truncate(inode)) |
8866 |
+@@ -1493,6 +1494,7 @@ static int ext4_journalled_write_end(struct file *file, |
8867 |
+ int partial = 0; |
8868 |
+ unsigned from, to; |
8869 |
+ int size_changed = 0; |
8870 |
++ int inline_data = ext4_has_inline_data(inode); |
8871 |
+ |
8872 |
+ trace_ext4_journalled_write_end(inode, pos, len, copied); |
8873 |
+ from = pos & (PAGE_SIZE - 1); |
8874 |
+@@ -1500,7 +1502,7 @@ static int ext4_journalled_write_end(struct file *file, |
8875 |
+ |
8876 |
+ BUG_ON(!ext4_handle_valid(handle)); |
8877 |
+ |
8878 |
+- if (ext4_has_inline_data(inode)) { |
8879 |
++ if (inline_data) { |
8880 |
+ ret = ext4_write_inline_data_end(inode, pos, len, |
8881 |
+ copied, page); |
8882 |
+ if (ret < 0) { |
8883 |
+@@ -1531,7 +1533,7 @@ static int ext4_journalled_write_end(struct file *file, |
8884 |
+ if (old_size < pos) |
8885 |
+ pagecache_isize_extended(inode, old_size, pos); |
8886 |
+ |
8887 |
+- if (size_changed) { |
8888 |
++ if (size_changed || inline_data) { |
8889 |
+ ret2 = ext4_mark_inode_dirty(handle, inode); |
8890 |
+ if (!ret) |
8891 |
+ ret = ret2; |
8892 |
+@@ -2028,11 +2030,7 @@ static int __ext4_journalled_writepage(struct page *page, |
8893 |
+ } |
8894 |
+ |
8895 |
+ if (inline_data) { |
8896 |
+- BUFFER_TRACE(inode_bh, "get write access"); |
8897 |
+- ret = ext4_journal_get_write_access(handle, inode_bh); |
8898 |
+- |
8899 |
+- err = ext4_handle_dirty_metadata(handle, inode, inode_bh); |
8900 |
+- |
8901 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
8902 |
+ } else { |
8903 |
+ ret = ext4_walk_page_buffers(handle, page_bufs, 0, len, NULL, |
8904 |
+ do_journal_get_write_access); |
8905 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
8906 |
+index 74a6d884ede4..d20cf383f2c1 100644 |
8907 |
+--- a/fs/ext4/super.c |
8908 |
++++ b/fs/ext4/super.c |
8909 |
+@@ -2307,7 +2307,7 @@ static int ext4_check_descriptors(struct super_block *sb, |
8910 |
+ struct ext4_sb_info *sbi = EXT4_SB(sb); |
8911 |
+ ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); |
8912 |
+ ext4_fsblk_t last_block; |
8913 |
+- ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0) + 1; |
8914 |
++ ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0); |
8915 |
+ ext4_fsblk_t block_bitmap; |
8916 |
+ ext4_fsblk_t inode_bitmap; |
8917 |
+ ext4_fsblk_t inode_table; |
8918 |
+@@ -3106,14 +3106,8 @@ static ext4_group_t ext4_has_uninit_itable(struct super_block *sb) |
8919 |
+ if (!gdp) |
8920 |
+ continue; |
8921 |
+ |
8922 |
+- if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)) |
8923 |
+- continue; |
8924 |
+- if (group != 0) |
8925 |
++ if (!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))) |
8926 |
+ break; |
8927 |
+- ext4_error(sb, "Inode table for bg 0 marked as " |
8928 |
+- "needing zeroing"); |
8929 |
+- if (sb_rdonly(sb)) |
8930 |
+- return ngroups; |
8931 |
+ } |
8932 |
+ |
8933 |
+ return group; |
8934 |
+@@ -4050,14 +4044,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
8935 |
+ goto failed_mount2; |
8936 |
+ } |
8937 |
+ } |
8938 |
++ sbi->s_gdb_count = db_count; |
8939 |
+ if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { |
8940 |
+ ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); |
8941 |
+ ret = -EFSCORRUPTED; |
8942 |
+ goto failed_mount2; |
8943 |
+ } |
8944 |
+ |
8945 |
+- sbi->s_gdb_count = db_count; |
8946 |
+- |
8947 |
+ timer_setup(&sbi->s_err_report, print_daily_error_info, 0); |
8948 |
+ |
8949 |
+ /* Register extent status tree shrinker */ |
8950 |
+diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
8951 |
+index 02237d4d91f5..a9fec79dc3dd 100644 |
8952 |
+--- a/fs/f2fs/data.c |
8953 |
++++ b/fs/f2fs/data.c |
8954 |
+@@ -1745,6 +1745,12 @@ static int __write_data_page(struct page *page, bool *submitted, |
8955 |
+ /* we should bypass data pages to proceed the kworkder jobs */ |
8956 |
+ if (unlikely(f2fs_cp_error(sbi))) { |
8957 |
+ mapping_set_error(page->mapping, -EIO); |
8958 |
++ /* |
8959 |
++ * don't drop any dirty dentry pages for keeping lastest |
8960 |
++ * directory structure. |
8961 |
++ */ |
8962 |
++ if (S_ISDIR(inode->i_mode)) |
8963 |
++ goto redirty_out; |
8964 |
+ goto out; |
8965 |
+ } |
8966 |
+ |
8967 |
+@@ -1842,7 +1848,13 @@ out: |
8968 |
+ |
8969 |
+ redirty_out: |
8970 |
+ redirty_page_for_writepage(wbc, page); |
8971 |
+- if (!err) |
8972 |
++ /* |
8973 |
++ * pageout() in MM traslates EAGAIN, so calls handle_write_error() |
8974 |
++ * -> mapping_set_error() -> set_bit(AS_EIO, ...). |
8975 |
++ * file_write_and_wait_range() will see EIO error, which is critical |
8976 |
++ * to return value of fsync() followed by atomic_write failure to user. |
8977 |
++ */ |
8978 |
++ if (!err || wbc->for_reclaim) |
8979 |
+ return AOP_WRITEPAGE_ACTIVATE; |
8980 |
+ unlock_page(page); |
8981 |
+ return err; |
8982 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
8983 |
+index 20149b8771d9..f6cd5850be75 100644 |
8984 |
+--- a/fs/f2fs/f2fs.h |
8985 |
++++ b/fs/f2fs/f2fs.h |
8986 |
+@@ -1602,7 +1602,7 @@ static inline bool f2fs_has_xattr_block(unsigned int ofs) |
8987 |
+ } |
8988 |
+ |
8989 |
+ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi, |
8990 |
+- struct inode *inode) |
8991 |
++ struct inode *inode, bool cap) |
8992 |
+ { |
8993 |
+ if (!inode) |
8994 |
+ return true; |
8995 |
+@@ -1615,7 +1615,7 @@ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi, |
8996 |
+ if (!gid_eq(F2FS_OPTION(sbi).s_resgid, GLOBAL_ROOT_GID) && |
8997 |
+ in_group_p(F2FS_OPTION(sbi).s_resgid)) |
8998 |
+ return true; |
8999 |
+- if (capable(CAP_SYS_RESOURCE)) |
9000 |
++ if (cap && capable(CAP_SYS_RESOURCE)) |
9001 |
+ return true; |
9002 |
+ return false; |
9003 |
+ } |
9004 |
+@@ -1650,7 +1650,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, |
9005 |
+ avail_user_block_count = sbi->user_block_count - |
9006 |
+ sbi->current_reserved_blocks; |
9007 |
+ |
9008 |
+- if (!__allow_reserved_blocks(sbi, inode)) |
9009 |
++ if (!__allow_reserved_blocks(sbi, inode, true)) |
9010 |
+ avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks; |
9011 |
+ |
9012 |
+ if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) { |
9013 |
+@@ -1857,7 +1857,7 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi, |
9014 |
+ valid_block_count = sbi->total_valid_block_count + |
9015 |
+ sbi->current_reserved_blocks + 1; |
9016 |
+ |
9017 |
+- if (!__allow_reserved_blocks(sbi, inode)) |
9018 |
++ if (!__allow_reserved_blocks(sbi, inode, false)) |
9019 |
+ valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks; |
9020 |
+ |
9021 |
+ if (unlikely(valid_block_count > sbi->user_block_count)) { |
9022 |
+diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
9023 |
+index 6b94f19b3fa8..04c95812e5c9 100644 |
9024 |
+--- a/fs/f2fs/file.c |
9025 |
++++ b/fs/f2fs/file.c |
9026 |
+@@ -1670,6 +1670,8 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) |
9027 |
+ |
9028 |
+ inode_lock(inode); |
9029 |
+ |
9030 |
++ down_write(&F2FS_I(inode)->dio_rwsem[WRITE]); |
9031 |
++ |
9032 |
+ if (f2fs_is_atomic_file(inode)) |
9033 |
+ goto out; |
9034 |
+ |
9035 |
+@@ -1699,6 +1701,7 @@ inc_stat: |
9036 |
+ stat_inc_atomic_write(inode); |
9037 |
+ stat_update_max_atomic_write(inode); |
9038 |
+ out: |
9039 |
++ up_write(&F2FS_I(inode)->dio_rwsem[WRITE]); |
9040 |
+ inode_unlock(inode); |
9041 |
+ mnt_drop_write_file(filp); |
9042 |
+ return ret; |
9043 |
+@@ -1851,9 +1854,11 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) |
9044 |
+ if (get_user(in, (__u32 __user *)arg)) |
9045 |
+ return -EFAULT; |
9046 |
+ |
9047 |
+- ret = mnt_want_write_file(filp); |
9048 |
+- if (ret) |
9049 |
+- return ret; |
9050 |
++ if (in != F2FS_GOING_DOWN_FULLSYNC) { |
9051 |
++ ret = mnt_want_write_file(filp); |
9052 |
++ if (ret) |
9053 |
++ return ret; |
9054 |
++ } |
9055 |
+ |
9056 |
+ switch (in) { |
9057 |
+ case F2FS_GOING_DOWN_FULLSYNC: |
9058 |
+@@ -1894,7 +1899,8 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) |
9059 |
+ |
9060 |
+ f2fs_update_time(sbi, REQ_TIME); |
9061 |
+ out: |
9062 |
+- mnt_drop_write_file(filp); |
9063 |
++ if (in != F2FS_GOING_DOWN_FULLSYNC) |
9064 |
++ mnt_drop_write_file(filp); |
9065 |
+ return ret; |
9066 |
+ } |
9067 |
+ |
9068 |
+@@ -2568,7 +2574,9 @@ static int f2fs_ioc_setproject(struct file *filp, __u32 projid) |
9069 |
+ } |
9070 |
+ f2fs_put_page(ipage, 1); |
9071 |
+ |
9072 |
+- dquot_initialize(inode); |
9073 |
++ err = dquot_initialize(inode); |
9074 |
++ if (err) |
9075 |
++ goto out_unlock; |
9076 |
+ |
9077 |
+ transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); |
9078 |
+ if (!IS_ERR(transfer_to[PRJQUOTA])) { |
9079 |
+@@ -2924,6 +2932,8 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |
9080 |
+ iov_iter_count(from)) || |
9081 |
+ f2fs_has_inline_data(inode) || |
9082 |
+ f2fs_force_buffered_io(inode, WRITE)) { |
9083 |
++ clear_inode_flag(inode, |
9084 |
++ FI_NO_PREALLOC); |
9085 |
+ inode_unlock(inode); |
9086 |
+ return -EAGAIN; |
9087 |
+ } |
9088 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
9089 |
+index 9327411fd93b..6aecdd5b97d0 100644 |
9090 |
+--- a/fs/f2fs/gc.c |
9091 |
++++ b/fs/f2fs/gc.c |
9092 |
+@@ -778,9 +778,14 @@ retry: |
9093 |
+ set_cold_data(page); |
9094 |
+ |
9095 |
+ err = do_write_data_page(&fio); |
9096 |
+- if (err == -ENOMEM && is_dirty) { |
9097 |
+- congestion_wait(BLK_RW_ASYNC, HZ/50); |
9098 |
+- goto retry; |
9099 |
++ if (err) { |
9100 |
++ clear_cold_data(page); |
9101 |
++ if (err == -ENOMEM) { |
9102 |
++ congestion_wait(BLK_RW_ASYNC, HZ/50); |
9103 |
++ goto retry; |
9104 |
++ } |
9105 |
++ if (is_dirty) |
9106 |
++ set_page_dirty(page); |
9107 |
+ } |
9108 |
+ } |
9109 |
+ out: |
9110 |
+diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c |
9111 |
+index cffaf842f4e7..c06489634655 100644 |
9112 |
+--- a/fs/f2fs/segment.c |
9113 |
++++ b/fs/f2fs/segment.c |
9114 |
+@@ -230,6 +230,8 @@ static int __revoke_inmem_pages(struct inode *inode, |
9115 |
+ |
9116 |
+ lock_page(page); |
9117 |
+ |
9118 |
++ f2fs_wait_on_page_writeback(page, DATA, true); |
9119 |
++ |
9120 |
+ if (recover) { |
9121 |
+ struct dnode_of_data dn; |
9122 |
+ struct node_info ni; |
9123 |
+@@ -478,6 +480,9 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) |
9124 |
+ |
9125 |
+ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi) |
9126 |
+ { |
9127 |
++ if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) |
9128 |
++ return; |
9129 |
++ |
9130 |
+ /* try to shrink extent cache when there is no enough memory */ |
9131 |
+ if (!available_free_memory(sbi, EXTENT_CACHE)) |
9132 |
+ f2fs_shrink_extent_tree(sbi, EXTENT_CACHE_SHRINK_NUMBER); |
9133 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
9134 |
+index 42d564c5ccd0..cad77fbb1f14 100644 |
9135 |
+--- a/fs/f2fs/super.c |
9136 |
++++ b/fs/f2fs/super.c |
9137 |
+@@ -3063,6 +3063,12 @@ static int __init init_f2fs_fs(void) |
9138 |
+ { |
9139 |
+ int err; |
9140 |
+ |
9141 |
++ if (PAGE_SIZE != F2FS_BLKSIZE) { |
9142 |
++ printk("F2FS not supported on PAGE_SIZE(%lu) != %d\n", |
9143 |
++ PAGE_SIZE, F2FS_BLKSIZE); |
9144 |
++ return -EINVAL; |
9145 |
++ } |
9146 |
++ |
9147 |
+ f2fs_build_trace_ios(); |
9148 |
+ |
9149 |
+ err = init_inodecache(); |
9150 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
9151 |
+index bd15d0b57626..6e70445213e7 100644 |
9152 |
+--- a/fs/nfs/inode.c |
9153 |
++++ b/fs/nfs/inode.c |
9154 |
+@@ -1629,7 +1629,8 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
9155 |
+ nfs_fattr_set_barrier(fattr); |
9156 |
+ status = nfs_post_op_update_inode_locked(inode, fattr, |
9157 |
+ NFS_INO_INVALID_CHANGE |
9158 |
+- | NFS_INO_INVALID_CTIME); |
9159 |
++ | NFS_INO_INVALID_CTIME |
9160 |
++ | NFS_INO_REVAL_FORCED); |
9161 |
+ spin_unlock(&inode->i_lock); |
9162 |
+ |
9163 |
+ return status; |
9164 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
9165 |
+index 409acdda70dd..2d94eb9cd386 100644 |
9166 |
+--- a/fs/nfs/nfs4proc.c |
9167 |
++++ b/fs/nfs/nfs4proc.c |
9168 |
+@@ -746,6 +746,13 @@ static int nfs41_sequence_process(struct rpc_task *task, |
9169 |
+ slot->slot_nr, |
9170 |
+ slot->seq_nr); |
9171 |
+ goto out_retry; |
9172 |
++ case -NFS4ERR_RETRY_UNCACHED_REP: |
9173 |
++ case -NFS4ERR_SEQ_FALSE_RETRY: |
9174 |
++ /* |
9175 |
++ * The server thinks we tried to replay a request. |
9176 |
++ * Retry the call after bumping the sequence ID. |
9177 |
++ */ |
9178 |
++ goto retry_new_seq; |
9179 |
+ case -NFS4ERR_BADSLOT: |
9180 |
+ /* |
9181 |
+ * The slot id we used was probably retired. Try again |
9182 |
+@@ -770,10 +777,6 @@ static int nfs41_sequence_process(struct rpc_task *task, |
9183 |
+ goto retry_nowait; |
9184 |
+ } |
9185 |
+ goto session_recover; |
9186 |
+- case -NFS4ERR_SEQ_FALSE_RETRY: |
9187 |
+- if (interrupted) |
9188 |
+- goto retry_new_seq; |
9189 |
+- goto session_recover; |
9190 |
+ default: |
9191 |
+ /* Just update the slot sequence no. */ |
9192 |
+ slot->seq_done = 1; |
9193 |
+@@ -2804,7 +2807,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, |
9194 |
+ if (ret != 0) |
9195 |
+ goto out; |
9196 |
+ |
9197 |
+- state = nfs4_opendata_to_nfs4_state(opendata); |
9198 |
++ state = _nfs4_opendata_to_nfs4_state(opendata); |
9199 |
+ ret = PTR_ERR(state); |
9200 |
+ if (IS_ERR(state)) |
9201 |
+ goto out; |
9202 |
+@@ -2840,6 +2843,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, |
9203 |
+ nfs4_schedule_stateid_recovery(server, state); |
9204 |
+ } |
9205 |
+ out: |
9206 |
++ nfs4_sequence_free_slot(&opendata->o_res.seq_res); |
9207 |
+ return ret; |
9208 |
+ } |
9209 |
+ |
9210 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
9211 |
+index ee723aa153a3..b35d55e4851a 100644 |
9212 |
+--- a/fs/nfs/pnfs.c |
9213 |
++++ b/fs/nfs/pnfs.c |
9214 |
+@@ -1144,7 +1144,7 @@ _pnfs_return_layout(struct inode *ino) |
9215 |
+ LIST_HEAD(tmp_list); |
9216 |
+ nfs4_stateid stateid; |
9217 |
+ int status = 0; |
9218 |
+- bool send; |
9219 |
++ bool send, valid_layout; |
9220 |
+ |
9221 |
+ dprintk("NFS: %s for inode %lu\n", __func__, ino->i_ino); |
9222 |
+ |
9223 |
+@@ -1165,6 +1165,7 @@ _pnfs_return_layout(struct inode *ino) |
9224 |
+ goto out_put_layout_hdr; |
9225 |
+ spin_lock(&ino->i_lock); |
9226 |
+ } |
9227 |
++ valid_layout = pnfs_layout_is_valid(lo); |
9228 |
+ pnfs_clear_layoutcommit(ino, &tmp_list); |
9229 |
+ pnfs_mark_matching_lsegs_invalid(lo, &tmp_list, NULL, 0); |
9230 |
+ |
9231 |
+@@ -1178,7 +1179,8 @@ _pnfs_return_layout(struct inode *ino) |
9232 |
+ } |
9233 |
+ |
9234 |
+ /* Don't send a LAYOUTRETURN if list was initially empty */ |
9235 |
+- if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) { |
9236 |
++ if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) || |
9237 |
++ !valid_layout) { |
9238 |
+ spin_unlock(&ino->i_lock); |
9239 |
+ dprintk("NFS: %s no layout segments to return\n", __func__); |
9240 |
+ goto out_put_layout_hdr; |
9241 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
9242 |
+index fc74d6f46bd5..3b40d1b57613 100644 |
9243 |
+--- a/fs/nfsd/nfs4state.c |
9244 |
++++ b/fs/nfsd/nfs4state.c |
9245 |
+@@ -4378,8 +4378,11 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, |
9246 |
+ spin_unlock(&state_lock); |
9247 |
+ |
9248 |
+ if (status) |
9249 |
+- destroy_unhashed_deleg(dp); |
9250 |
++ goto out_unlock; |
9251 |
++ |
9252 |
+ return dp; |
9253 |
++out_unlock: |
9254 |
++ vfs_setlease(fp->fi_deleg_file, F_UNLCK, NULL, (void **)&dp); |
9255 |
+ out_clnt_odstate: |
9256 |
+ put_clnt_odstate(dp->dl_clnt_odstate); |
9257 |
+ out_stid: |
9258 |
+diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c |
9259 |
+index cfe535c286c3..59d471025949 100644 |
9260 |
+--- a/fs/nfsd/nfs4xdr.c |
9261 |
++++ b/fs/nfsd/nfs4xdr.c |
9262 |
+@@ -1585,6 +1585,8 @@ nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp, |
9263 |
+ gdev->gd_maxcount = be32_to_cpup(p++); |
9264 |
+ num = be32_to_cpup(p++); |
9265 |
+ if (num) { |
9266 |
++ if (num > 1000) |
9267 |
++ goto xdr_error; |
9268 |
+ READ_BUF(4 * num); |
9269 |
+ gdev->gd_notify_types = be32_to_cpup(p++); |
9270 |
+ for (i = 1; i < num; i++) { |
9271 |
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c |
9272 |
+index b0abfe02beab..308d64e72515 100644 |
9273 |
+--- a/fs/proc/task_mmu.c |
9274 |
++++ b/fs/proc/task_mmu.c |
9275 |
+@@ -673,13 +673,13 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) |
9276 |
+ [ilog2(VM_MERGEABLE)] = "mg", |
9277 |
+ [ilog2(VM_UFFD_MISSING)]= "um", |
9278 |
+ [ilog2(VM_UFFD_WP)] = "uw", |
9279 |
+-#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS |
9280 |
++#ifdef CONFIG_ARCH_HAS_PKEYS |
9281 |
+ /* These come out via ProtectionKey: */ |
9282 |
+ [ilog2(VM_PKEY_BIT0)] = "", |
9283 |
+ [ilog2(VM_PKEY_BIT1)] = "", |
9284 |
+ [ilog2(VM_PKEY_BIT2)] = "", |
9285 |
+ [ilog2(VM_PKEY_BIT3)] = "", |
9286 |
+-#endif |
9287 |
++#endif /* CONFIG_ARCH_HAS_PKEYS */ |
9288 |
+ }; |
9289 |
+ size_t i; |
9290 |
+ |
9291 |
+@@ -1259,8 +1259,9 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, |
9292 |
+ if (pte_swp_soft_dirty(pte)) |
9293 |
+ flags |= PM_SOFT_DIRTY; |
9294 |
+ entry = pte_to_swp_entry(pte); |
9295 |
+- frame = swp_type(entry) | |
9296 |
+- (swp_offset(entry) << MAX_SWAPFILES_SHIFT); |
9297 |
++ if (pm->show_pfn) |
9298 |
++ frame = swp_type(entry) | |
9299 |
++ (swp_offset(entry) << MAX_SWAPFILES_SHIFT); |
9300 |
+ flags |= PM_SWAP; |
9301 |
+ if (is_migration_entry(entry)) |
9302 |
+ page = migration_entry_to_page(entry); |
9303 |
+@@ -1311,11 +1312,14 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, |
9304 |
+ #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION |
9305 |
+ else if (is_swap_pmd(pmd)) { |
9306 |
+ swp_entry_t entry = pmd_to_swp_entry(pmd); |
9307 |
+- unsigned long offset = swp_offset(entry); |
9308 |
++ unsigned long offset; |
9309 |
+ |
9310 |
+- offset += (addr & ~PMD_MASK) >> PAGE_SHIFT; |
9311 |
+- frame = swp_type(entry) | |
9312 |
+- (offset << MAX_SWAPFILES_SHIFT); |
9313 |
++ if (pm->show_pfn) { |
9314 |
++ offset = swp_offset(entry) + |
9315 |
++ ((addr & ~PMD_MASK) >> PAGE_SHIFT); |
9316 |
++ frame = swp_type(entry) | |
9317 |
++ (offset << MAX_SWAPFILES_SHIFT); |
9318 |
++ } |
9319 |
+ flags |= PM_SWAP; |
9320 |
+ if (pmd_swp_soft_dirty(pmd)) |
9321 |
+ flags |= PM_SOFT_DIRTY; |
9322 |
+@@ -1333,10 +1337,12 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, |
9323 |
+ err = add_to_pagemap(addr, &pme, pm); |
9324 |
+ if (err) |
9325 |
+ break; |
9326 |
+- if (pm->show_pfn && (flags & PM_PRESENT)) |
9327 |
+- frame++; |
9328 |
+- else if (flags & PM_SWAP) |
9329 |
+- frame += (1 << MAX_SWAPFILES_SHIFT); |
9330 |
++ if (pm->show_pfn) { |
9331 |
++ if (flags & PM_PRESENT) |
9332 |
++ frame++; |
9333 |
++ else if (flags & PM_SWAP) |
9334 |
++ frame += (1 << MAX_SWAPFILES_SHIFT); |
9335 |
++ } |
9336 |
+ } |
9337 |
+ spin_unlock(ptl); |
9338 |
+ return err; |
9339 |
+diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c |
9340 |
+index 23813c078cc9..0839efa720b3 100644 |
9341 |
+--- a/fs/squashfs/cache.c |
9342 |
++++ b/fs/squashfs/cache.c |
9343 |
+@@ -350,6 +350,9 @@ int squashfs_read_metadata(struct super_block *sb, void *buffer, |
9344 |
+ |
9345 |
+ TRACE("Entered squashfs_read_metadata [%llx:%x]\n", *block, *offset); |
9346 |
+ |
9347 |
++ if (unlikely(length < 0)) |
9348 |
++ return -EIO; |
9349 |
++ |
9350 |
+ while (length) { |
9351 |
+ entry = squashfs_cache_get(sb, msblk->block_cache, *block, 0); |
9352 |
+ if (entry->error) { |
9353 |
+diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c |
9354 |
+index 13d80947bf9e..fcff2e0487fe 100644 |
9355 |
+--- a/fs/squashfs/file.c |
9356 |
++++ b/fs/squashfs/file.c |
9357 |
+@@ -194,7 +194,11 @@ static long long read_indexes(struct super_block *sb, int n, |
9358 |
+ } |
9359 |
+ |
9360 |
+ for (i = 0; i < blocks; i++) { |
9361 |
+- int size = le32_to_cpu(blist[i]); |
9362 |
++ int size = squashfs_block_size(blist[i]); |
9363 |
++ if (size < 0) { |
9364 |
++ err = size; |
9365 |
++ goto failure; |
9366 |
++ } |
9367 |
+ block += SQUASHFS_COMPRESSED_SIZE_BLOCK(size); |
9368 |
+ } |
9369 |
+ n -= blocks; |
9370 |
+@@ -367,7 +371,7 @@ static int read_blocklist(struct inode *inode, int index, u64 *block) |
9371 |
+ sizeof(size)); |
9372 |
+ if (res < 0) |
9373 |
+ return res; |
9374 |
+- return le32_to_cpu(size); |
9375 |
++ return squashfs_block_size(size); |
9376 |
+ } |
9377 |
+ |
9378 |
+ /* Copy data into page cache */ |
9379 |
+diff --git a/fs/squashfs/fragment.c b/fs/squashfs/fragment.c |
9380 |
+index 0ed6edbc5c71..86ad9a4b8c36 100644 |
9381 |
+--- a/fs/squashfs/fragment.c |
9382 |
++++ b/fs/squashfs/fragment.c |
9383 |
+@@ -61,9 +61,7 @@ int squashfs_frag_lookup(struct super_block *sb, unsigned int fragment, |
9384 |
+ return size; |
9385 |
+ |
9386 |
+ *fragment_block = le64_to_cpu(fragment_entry.start_block); |
9387 |
+- size = le32_to_cpu(fragment_entry.size); |
9388 |
+- |
9389 |
+- return size; |
9390 |
++ return squashfs_block_size(fragment_entry.size); |
9391 |
+ } |
9392 |
+ |
9393 |
+ |
9394 |
+diff --git a/fs/squashfs/squashfs_fs.h b/fs/squashfs/squashfs_fs.h |
9395 |
+index 24d12fd14177..4e6853f084d0 100644 |
9396 |
+--- a/fs/squashfs/squashfs_fs.h |
9397 |
++++ b/fs/squashfs/squashfs_fs.h |
9398 |
+@@ -129,6 +129,12 @@ |
9399 |
+ |
9400 |
+ #define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK)) |
9401 |
+ |
9402 |
++static inline int squashfs_block_size(__le32 raw) |
9403 |
++{ |
9404 |
++ u32 size = le32_to_cpu(raw); |
9405 |
++ return (size >> 25) ? -EIO : size; |
9406 |
++} |
9407 |
++ |
9408 |
+ /* |
9409 |
+ * Inode number ops. Inodes consist of a compressed block number, and an |
9410 |
+ * uncompressed offset within that block |
9411 |
+diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h |
9412 |
+index 62903bae0221..0bac0c7d0dec 100644 |
9413 |
+--- a/include/drm/drm_dp_helper.h |
9414 |
++++ b/include/drm/drm_dp_helper.h |
9415 |
+@@ -478,6 +478,7 @@ |
9416 |
+ # define DP_PSR_FRAME_CAPTURE (1 << 3) |
9417 |
+ # define DP_PSR_SELECTIVE_UPDATE (1 << 4) |
9418 |
+ # define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS (1 << 5) |
9419 |
++# define DP_PSR_ENABLE_PSR2 (1 << 6) /* eDP 1.4a */ |
9420 |
+ |
9421 |
+ #define DP_ADAPTER_CTRL 0x1a0 |
9422 |
+ # define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0) |
9423 |
+diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h |
9424 |
+index 5e335b6203f4..31c865d1842e 100644 |
9425 |
+--- a/include/linux/delayacct.h |
9426 |
++++ b/include/linux/delayacct.h |
9427 |
+@@ -29,7 +29,7 @@ |
9428 |
+ |
9429 |
+ #ifdef CONFIG_TASK_DELAY_ACCT |
9430 |
+ struct task_delay_info { |
9431 |
+- spinlock_t lock; |
9432 |
++ raw_spinlock_t lock; |
9433 |
+ unsigned int flags; /* Private per-task flags */ |
9434 |
+ |
9435 |
+ /* For each stat XXX, add following, aligned appropriately |
9436 |
+@@ -124,7 +124,7 @@ static inline void delayacct_blkio_start(void) |
9437 |
+ |
9438 |
+ static inline void delayacct_blkio_end(struct task_struct *p) |
9439 |
+ { |
9440 |
+- if (current->delays) |
9441 |
++ if (p->delays) |
9442 |
+ __delayacct_blkio_end(p); |
9443 |
+ delayacct_clear_flag(DELAYACCT_PF_BLKIO); |
9444 |
+ } |
9445 |
+diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h |
9446 |
+index 92f20832fd28..e8ca5e654277 100644 |
9447 |
+--- a/include/linux/dma-iommu.h |
9448 |
++++ b/include/linux/dma-iommu.h |
9449 |
+@@ -17,6 +17,7 @@ |
9450 |
+ #define __DMA_IOMMU_H |
9451 |
+ |
9452 |
+ #ifdef __KERNEL__ |
9453 |
++#include <linux/types.h> |
9454 |
+ #include <asm/errno.h> |
9455 |
+ |
9456 |
+ #ifdef CONFIG_IOMMU_DMA |
9457 |
+diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h |
9458 |
+index d99b71bc2c66..091690119144 100644 |
9459 |
+--- a/include/linux/memcontrol.h |
9460 |
++++ b/include/linux/memcontrol.h |
9461 |
+@@ -158,6 +158,15 @@ enum memcg_kmem_state { |
9462 |
+ KMEM_ONLINE, |
9463 |
+ }; |
9464 |
+ |
9465 |
++#if defined(CONFIG_SMP) |
9466 |
++struct memcg_padding { |
9467 |
++ char x[0]; |
9468 |
++} ____cacheline_internodealigned_in_smp; |
9469 |
++#define MEMCG_PADDING(name) struct memcg_padding name; |
9470 |
++#else |
9471 |
++#define MEMCG_PADDING(name) |
9472 |
++#endif |
9473 |
++ |
9474 |
+ /* |
9475 |
+ * The memory controller data structure. The memory controller controls both |
9476 |
+ * page cache and RSS per cgroup. We would eventually like to provide |
9477 |
+@@ -205,7 +214,6 @@ struct mem_cgroup { |
9478 |
+ int oom_kill_disable; |
9479 |
+ |
9480 |
+ /* memory.events */ |
9481 |
+- atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; |
9482 |
+ struct cgroup_file events_file; |
9483 |
+ |
9484 |
+ /* protect arrays of thresholds */ |
9485 |
+@@ -225,19 +233,26 @@ struct mem_cgroup { |
9486 |
+ * mem_cgroup ? And what type of charges should we move ? |
9487 |
+ */ |
9488 |
+ unsigned long move_charge_at_immigrate; |
9489 |
++ /* taken only while moving_account > 0 */ |
9490 |
++ spinlock_t move_lock; |
9491 |
++ unsigned long move_lock_flags; |
9492 |
++ |
9493 |
++ MEMCG_PADDING(_pad1_); |
9494 |
++ |
9495 |
+ /* |
9496 |
+ * set > 0 if pages under this cgroup are moving to other cgroup. |
9497 |
+ */ |
9498 |
+ atomic_t moving_account; |
9499 |
+- /* taken only while moving_account > 0 */ |
9500 |
+- spinlock_t move_lock; |
9501 |
+ struct task_struct *move_lock_task; |
9502 |
+- unsigned long move_lock_flags; |
9503 |
+ |
9504 |
+ /* memory.stat */ |
9505 |
+ struct mem_cgroup_stat_cpu __percpu *stat_cpu; |
9506 |
++ |
9507 |
++ MEMCG_PADDING(_pad2_); |
9508 |
++ |
9509 |
+ atomic_long_t stat[MEMCG_NR_STAT]; |
9510 |
+ atomic_long_t events[NR_VM_EVENT_ITEMS]; |
9511 |
++ atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; |
9512 |
+ |
9513 |
+ unsigned long socket_pressure; |
9514 |
+ |
9515 |
+diff --git a/include/linux/mm.h b/include/linux/mm.h |
9516 |
+index d14261d6b213..edab43d2bec8 100644 |
9517 |
+--- a/include/linux/mm.h |
9518 |
++++ b/include/linux/mm.h |
9519 |
+@@ -228,15 +228,16 @@ extern unsigned int kobjsize(const void *objp); |
9520 |
+ #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) |
9521 |
+ #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ |
9522 |
+ |
9523 |
+-#if defined(CONFIG_X86) |
9524 |
+-# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ |
9525 |
+-#if defined (CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) |
9526 |
++#ifdef CONFIG_ARCH_HAS_PKEYS |
9527 |
+ # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0 |
9528 |
+ # define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */ |
9529 |
+ # define VM_PKEY_BIT1 VM_HIGH_ARCH_1 |
9530 |
+ # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 |
9531 |
+ # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 |
9532 |
+-#endif |
9533 |
++#endif /* CONFIG_ARCH_HAS_PKEYS */ |
9534 |
++ |
9535 |
++#if defined(CONFIG_X86) |
9536 |
++# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ |
9537 |
+ #elif defined(CONFIG_PPC) |
9538 |
+ # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ |
9539 |
+ #elif defined(CONFIG_PARISC) |
9540 |
+diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h |
9541 |
+index cdd66a5fbd5e..0a7abe8a407f 100644 |
9542 |
+--- a/include/linux/mmc/sdio_ids.h |
9543 |
++++ b/include/linux/mmc/sdio_ids.h |
9544 |
+@@ -35,6 +35,7 @@ |
9545 |
+ #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 |
9546 |
+ #define SDIO_DEVICE_ID_BROADCOM_4339 0x4339 |
9547 |
+ #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 |
9548 |
++#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4 |
9549 |
+ #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6 |
9550 |
+ #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345 |
9551 |
+ #define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf |
9552 |
+diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h |
9553 |
+index bfb3531fd88a..7ad8ddf9ca8a 100644 |
9554 |
+--- a/include/linux/netfilter/ipset/ip_set_timeout.h |
9555 |
++++ b/include/linux/netfilter/ipset/ip_set_timeout.h |
9556 |
+@@ -65,8 +65,14 @@ ip_set_timeout_set(unsigned long *timeout, u32 value) |
9557 |
+ static inline u32 |
9558 |
+ ip_set_timeout_get(const unsigned long *timeout) |
9559 |
+ { |
9560 |
+- return *timeout == IPSET_ELEM_PERMANENT ? 0 : |
9561 |
+- jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC; |
9562 |
++ u32 t; |
9563 |
++ |
9564 |
++ if (*timeout == IPSET_ELEM_PERMANENT) |
9565 |
++ return 0; |
9566 |
++ |
9567 |
++ t = jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC; |
9568 |
++ /* Zero value in userspace means no timeout */ |
9569 |
++ return t == 0 ? 1 : t; |
9570 |
+ } |
9571 |
+ |
9572 |
+ #endif /* __KERNEL__ */ |
9573 |
+diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h |
9574 |
+index df176d7c2b87..25602afd4844 100644 |
9575 |
+--- a/include/linux/regulator/consumer.h |
9576 |
++++ b/include/linux/regulator/consumer.h |
9577 |
+@@ -80,6 +80,7 @@ struct regmap; |
9578 |
+ * These modes can be OR'ed together to make up a mask of valid register modes. |
9579 |
+ */ |
9580 |
+ |
9581 |
++#define REGULATOR_MODE_INVALID 0x0 |
9582 |
+ #define REGULATOR_MODE_FAST 0x1 |
9583 |
+ #define REGULATOR_MODE_NORMAL 0x2 |
9584 |
+ #define REGULATOR_MODE_IDLE 0x4 |
9585 |
+diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h |
9586 |
+index b4c9fda9d833..3361cc8eb635 100644 |
9587 |
+--- a/include/linux/serial_core.h |
9588 |
++++ b/include/linux/serial_core.h |
9589 |
+@@ -348,7 +348,8 @@ struct earlycon_device { |
9590 |
+ }; |
9591 |
+ |
9592 |
+ struct earlycon_id { |
9593 |
+- char name[16]; |
9594 |
++ char name[15]; |
9595 |
++ char name_term; /* In case compiler didn't '\0' term name */ |
9596 |
+ char compatible[128]; |
9597 |
+ int (*setup)(struct earlycon_device *, const char *options); |
9598 |
+ }; |
9599 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
9600 |
+index 9cf770150539..5ccc4ec646cb 100644 |
9601 |
+--- a/include/net/tcp.h |
9602 |
++++ b/include/net/tcp.h |
9603 |
+@@ -342,7 +342,7 @@ ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, |
9604 |
+ struct pipe_inode_info *pipe, size_t len, |
9605 |
+ unsigned int flags); |
9606 |
+ |
9607 |
+-void tcp_enter_quickack_mode(struct sock *sk); |
9608 |
++void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks); |
9609 |
+ static inline void tcp_dec_quickack_mode(struct sock *sk, |
9610 |
+ const unsigned int pkts) |
9611 |
+ { |
9612 |
+diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h |
9613 |
+index 233bae954970..be6e49124c6d 100644 |
9614 |
+--- a/include/soc/tegra/mc.h |
9615 |
++++ b/include/soc/tegra/mc.h |
9616 |
+@@ -108,6 +108,8 @@ struct tegra_mc_soc { |
9617 |
+ u8 client_id_mask; |
9618 |
+ |
9619 |
+ const struct tegra_smmu_soc *smmu; |
9620 |
++ |
9621 |
++ u32 intmask; |
9622 |
+ }; |
9623 |
+ |
9624 |
+ struct tegra_mc { |
9625 |
+diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h |
9626 |
+index 69c37ecbff7e..f3c4b46e39d8 100644 |
9627 |
+--- a/include/uapi/sound/asoc.h |
9628 |
++++ b/include/uapi/sound/asoc.h |
9629 |
+@@ -139,6 +139,11 @@ |
9630 |
+ #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) |
9631 |
+ #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) |
9632 |
+ |
9633 |
++/* DAI clock gating */ |
9634 |
++#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 |
9635 |
++#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 |
9636 |
++#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 |
9637 |
++ |
9638 |
+ /* DAI physical PCM data formats. |
9639 |
+ * Add new formats to the end of the list. |
9640 |
+ */ |
9641 |
+@@ -160,6 +165,18 @@ |
9642 |
+ #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) |
9643 |
+ #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) |
9644 |
+ |
9645 |
++/* DAI topology BCLK parameter |
9646 |
++ * For the backwards capability, by default codec is bclk master |
9647 |
++ */ |
9648 |
++#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ |
9649 |
++#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ |
9650 |
++ |
9651 |
++/* DAI topology FSYNC parameter |
9652 |
++ * For the backwards capability, by default codec is fsync master |
9653 |
++ */ |
9654 |
++#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ |
9655 |
++#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ |
9656 |
++ |
9657 |
+ /* |
9658 |
+ * Block Header. |
9659 |
+ * This header precedes all object and object arrays below. |
9660 |
+@@ -312,11 +329,11 @@ struct snd_soc_tplg_hw_config { |
9661 |
+ __le32 size; /* in bytes of this structure */ |
9662 |
+ __le32 id; /* unique ID - - used to match */ |
9663 |
+ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ |
9664 |
+- __u8 clock_gated; /* 1 if clock can be gated to save power */ |
9665 |
++ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ |
9666 |
+ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ |
9667 |
+ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ |
9668 |
+- __u8 bclk_master; /* 1 for master of BCLK, 0 for slave */ |
9669 |
+- __u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */ |
9670 |
++ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ |
9671 |
++ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ |
9672 |
+ __u8 mclk_direction; /* 0 for input, 1 for output */ |
9673 |
+ __le16 reserved; /* for 32bit alignment */ |
9674 |
+ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ |
9675 |
+diff --git a/ipc/msg.c b/ipc/msg.c |
9676 |
+index 56fd1c73eedc..574f76c9a2ff 100644 |
9677 |
+--- a/ipc/msg.c |
9678 |
++++ b/ipc/msg.c |
9679 |
+@@ -758,7 +758,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg, |
9680 |
+ WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG)); |
9681 |
+ } else { |
9682 |
+ ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk)); |
9683 |
+- msq->q_rtime = get_seconds(); |
9684 |
++ msq->q_rtime = ktime_get_real_seconds(); |
9685 |
+ |
9686 |
+ wake_q_add(wake_q, msr->r_tsk); |
9687 |
+ WRITE_ONCE(msr->r_msg, msg); |
9688 |
+@@ -859,7 +859,7 @@ static long do_msgsnd(int msqid, long mtype, void __user *mtext, |
9689 |
+ } |
9690 |
+ |
9691 |
+ ipc_update_pid(&msq->q_lspid, task_tgid(current)); |
9692 |
+- msq->q_stime = get_seconds(); |
9693 |
++ msq->q_stime = ktime_get_real_seconds(); |
9694 |
+ |
9695 |
+ if (!pipelined_send(msq, msg, &wake_q)) { |
9696 |
+ /* no one is waiting for this message, enqueue it */ |
9697 |
+@@ -1087,7 +1087,7 @@ static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, in |
9698 |
+ |
9699 |
+ list_del(&msg->m_list); |
9700 |
+ msq->q_qnum--; |
9701 |
+- msq->q_rtime = get_seconds(); |
9702 |
++ msq->q_rtime = ktime_get_real_seconds(); |
9703 |
+ ipc_update_pid(&msq->q_lrpid, task_tgid(current)); |
9704 |
+ msq->q_cbytes -= msg->m_ts; |
9705 |
+ atomic_sub(msg->m_ts, &ns->msg_bytes); |
9706 |
+diff --git a/ipc/sem.c b/ipc/sem.c |
9707 |
+index 06be75d9217a..c6a8a971769d 100644 |
9708 |
+--- a/ipc/sem.c |
9709 |
++++ b/ipc/sem.c |
9710 |
+@@ -104,7 +104,7 @@ struct sem { |
9711 |
+ /* that alter the semaphore */ |
9712 |
+ struct list_head pending_const; /* pending single-sop operations */ |
9713 |
+ /* that do not alter the semaphore*/ |
9714 |
+- time_t sem_otime; /* candidate for sem_otime */ |
9715 |
++ time64_t sem_otime; /* candidate for sem_otime */ |
9716 |
+ } ____cacheline_aligned_in_smp; |
9717 |
+ |
9718 |
+ /* One sem_array data structure for each set of semaphores in the system. */ |
9719 |
+@@ -984,10 +984,10 @@ again: |
9720 |
+ static void set_semotime(struct sem_array *sma, struct sembuf *sops) |
9721 |
+ { |
9722 |
+ if (sops == NULL) { |
9723 |
+- sma->sems[0].sem_otime = get_seconds(); |
9724 |
++ sma->sems[0].sem_otime = ktime_get_real_seconds(); |
9725 |
+ } else { |
9726 |
+ sma->sems[sops[0].sem_num].sem_otime = |
9727 |
+- get_seconds(); |
9728 |
++ ktime_get_real_seconds(); |
9729 |
+ } |
9730 |
+ } |
9731 |
+ |
9732 |
+diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c |
9733 |
+index d7a807e81451..a0c5a3ec6e60 100644 |
9734 |
+--- a/kernel/auditfilter.c |
9735 |
++++ b/kernel/auditfilter.c |
9736 |
+@@ -426,7 +426,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f) |
9737 |
+ return -EINVAL; |
9738 |
+ break; |
9739 |
+ case AUDIT_EXE: |
9740 |
+- if (f->op != Audit_equal) |
9741 |
++ if (f->op != Audit_not_equal && f->op != Audit_equal) |
9742 |
+ return -EINVAL; |
9743 |
+ if (entry->rule.listnr != AUDIT_FILTER_EXIT) |
9744 |
+ return -EINVAL; |
9745 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
9746 |
+index 4e0a4ac803db..479c031ec54c 100644 |
9747 |
+--- a/kernel/auditsc.c |
9748 |
++++ b/kernel/auditsc.c |
9749 |
+@@ -471,6 +471,8 @@ static int audit_filter_rules(struct task_struct *tsk, |
9750 |
+ break; |
9751 |
+ case AUDIT_EXE: |
9752 |
+ result = audit_exe_compare(tsk, rule->exe); |
9753 |
++ if (f->op == Audit_not_equal) |
9754 |
++ result = !result; |
9755 |
+ break; |
9756 |
+ case AUDIT_UID: |
9757 |
+ result = audit_uid_comparator(cred->uid, f->op, f->uid); |
9758 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
9759 |
+index 74fa60b4b438..4ed4613ed362 100644 |
9760 |
+--- a/kernel/bpf/syscall.c |
9761 |
++++ b/kernel/bpf/syscall.c |
9762 |
+@@ -1946,13 +1946,44 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, |
9763 |
+ * for offload. |
9764 |
+ */ |
9765 |
+ ulen = info.jited_prog_len; |
9766 |
+- info.jited_prog_len = prog->jited_len; |
9767 |
++ if (prog->aux->func_cnt) { |
9768 |
++ u32 i; |
9769 |
++ |
9770 |
++ info.jited_prog_len = 0; |
9771 |
++ for (i = 0; i < prog->aux->func_cnt; i++) |
9772 |
++ info.jited_prog_len += prog->aux->func[i]->jited_len; |
9773 |
++ } else { |
9774 |
++ info.jited_prog_len = prog->jited_len; |
9775 |
++ } |
9776 |
++ |
9777 |
+ if (info.jited_prog_len && ulen) { |
9778 |
+ if (bpf_dump_raw_ok()) { |
9779 |
+ uinsns = u64_to_user_ptr(info.jited_prog_insns); |
9780 |
+ ulen = min_t(u32, info.jited_prog_len, ulen); |
9781 |
+- if (copy_to_user(uinsns, prog->bpf_func, ulen)) |
9782 |
+- return -EFAULT; |
9783 |
++ |
9784 |
++ /* for multi-function programs, copy the JITed |
9785 |
++ * instructions for all the functions |
9786 |
++ */ |
9787 |
++ if (prog->aux->func_cnt) { |
9788 |
++ u32 len, free, i; |
9789 |
++ u8 *img; |
9790 |
++ |
9791 |
++ free = ulen; |
9792 |
++ for (i = 0; i < prog->aux->func_cnt; i++) { |
9793 |
++ len = prog->aux->func[i]->jited_len; |
9794 |
++ len = min_t(u32, len, free); |
9795 |
++ img = (u8 *) prog->aux->func[i]->bpf_func; |
9796 |
++ if (copy_to_user(uinsns, img, len)) |
9797 |
++ return -EFAULT; |
9798 |
++ uinsns += len; |
9799 |
++ free -= len; |
9800 |
++ if (!free) |
9801 |
++ break; |
9802 |
++ } |
9803 |
++ } else { |
9804 |
++ if (copy_to_user(uinsns, prog->bpf_func, ulen)) |
9805 |
++ return -EFAULT; |
9806 |
++ } |
9807 |
+ } else { |
9808 |
+ info.jited_prog_insns = 0; |
9809 |
+ } |
9810 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
9811 |
+index 1b586f31cbfd..23d187ec33ea 100644 |
9812 |
+--- a/kernel/bpf/verifier.c |
9813 |
++++ b/kernel/bpf/verifier.c |
9814 |
+@@ -5065,7 +5065,7 @@ static int replace_map_fd_with_map_ptr(struct bpf_verifier_env *env) |
9815 |
+ /* hold the map. If the program is rejected by verifier, |
9816 |
+ * the map will be released by release_maps() or it |
9817 |
+ * will be used by the valid program until it's unloaded |
9818 |
+- * and all maps are released in free_bpf_prog_info() |
9819 |
++ * and all maps are released in free_used_maps() |
9820 |
+ */ |
9821 |
+ map = bpf_map_inc(map, false); |
9822 |
+ if (IS_ERR(map)) { |
9823 |
+@@ -5856,7 +5856,7 @@ skip_full_check: |
9824 |
+ err_release_maps: |
9825 |
+ if (!env->prog->aux->used_maps) |
9826 |
+ /* if we didn't copy map pointers into bpf_prog_info, release |
9827 |
+- * them now. Otherwise free_bpf_prog_info() will release them. |
9828 |
++ * them now. Otherwise free_used_maps() will release them. |
9829 |
+ */ |
9830 |
+ release_maps(env); |
9831 |
+ *prog = env->prog; |
9832 |
+diff --git a/kernel/delayacct.c b/kernel/delayacct.c |
9833 |
+index e2764d767f18..ca8ac2824f0b 100644 |
9834 |
+--- a/kernel/delayacct.c |
9835 |
++++ b/kernel/delayacct.c |
9836 |
+@@ -44,23 +44,24 @@ void __delayacct_tsk_init(struct task_struct *tsk) |
9837 |
+ { |
9838 |
+ tsk->delays = kmem_cache_zalloc(delayacct_cache, GFP_KERNEL); |
9839 |
+ if (tsk->delays) |
9840 |
+- spin_lock_init(&tsk->delays->lock); |
9841 |
++ raw_spin_lock_init(&tsk->delays->lock); |
9842 |
+ } |
9843 |
+ |
9844 |
+ /* |
9845 |
+ * Finish delay accounting for a statistic using its timestamps (@start), |
9846 |
+ * accumalator (@total) and @count |
9847 |
+ */ |
9848 |
+-static void delayacct_end(spinlock_t *lock, u64 *start, u64 *total, u32 *count) |
9849 |
++static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, |
9850 |
++ u32 *count) |
9851 |
+ { |
9852 |
+ s64 ns = ktime_get_ns() - *start; |
9853 |
+ unsigned long flags; |
9854 |
+ |
9855 |
+ if (ns > 0) { |
9856 |
+- spin_lock_irqsave(lock, flags); |
9857 |
++ raw_spin_lock_irqsave(lock, flags); |
9858 |
+ *total += ns; |
9859 |
+ (*count)++; |
9860 |
+- spin_unlock_irqrestore(lock, flags); |
9861 |
++ raw_spin_unlock_irqrestore(lock, flags); |
9862 |
+ } |
9863 |
+ } |
9864 |
+ |
9865 |
+@@ -127,7 +128,7 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) |
9866 |
+ |
9867 |
+ /* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */ |
9868 |
+ |
9869 |
+- spin_lock_irqsave(&tsk->delays->lock, flags); |
9870 |
++ raw_spin_lock_irqsave(&tsk->delays->lock, flags); |
9871 |
+ tmp = d->blkio_delay_total + tsk->delays->blkio_delay; |
9872 |
+ d->blkio_delay_total = (tmp < d->blkio_delay_total) ? 0 : tmp; |
9873 |
+ tmp = d->swapin_delay_total + tsk->delays->swapin_delay; |
9874 |
+@@ -137,7 +138,7 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) |
9875 |
+ d->blkio_count += tsk->delays->blkio_count; |
9876 |
+ d->swapin_count += tsk->delays->swapin_count; |
9877 |
+ d->freepages_count += tsk->delays->freepages_count; |
9878 |
+- spin_unlock_irqrestore(&tsk->delays->lock, flags); |
9879 |
++ raw_spin_unlock_irqrestore(&tsk->delays->lock, flags); |
9880 |
+ |
9881 |
+ return 0; |
9882 |
+ } |
9883 |
+@@ -147,10 +148,10 @@ __u64 __delayacct_blkio_ticks(struct task_struct *tsk) |
9884 |
+ __u64 ret; |
9885 |
+ unsigned long flags; |
9886 |
+ |
9887 |
+- spin_lock_irqsave(&tsk->delays->lock, flags); |
9888 |
++ raw_spin_lock_irqsave(&tsk->delays->lock, flags); |
9889 |
+ ret = nsec_to_clock_t(tsk->delays->blkio_delay + |
9890 |
+ tsk->delays->swapin_delay); |
9891 |
+- spin_unlock_irqrestore(&tsk->delays->lock, flags); |
9892 |
++ raw_spin_unlock_irqrestore(&tsk->delays->lock, flags); |
9893 |
+ return ret; |
9894 |
+ } |
9895 |
+ |
9896 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
9897 |
+index a5d21c42acfc..5ad558e6f8fe 100644 |
9898 |
+--- a/kernel/fork.c |
9899 |
++++ b/kernel/fork.c |
9900 |
+@@ -440,6 +440,14 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, |
9901 |
+ continue; |
9902 |
+ } |
9903 |
+ charge = 0; |
9904 |
++ /* |
9905 |
++ * Don't duplicate many vmas if we've been oom-killed (for |
9906 |
++ * example) |
9907 |
++ */ |
9908 |
++ if (fatal_signal_pending(current)) { |
9909 |
++ retval = -EINTR; |
9910 |
++ goto out; |
9911 |
++ } |
9912 |
+ if (mpnt->vm_flags & VM_ACCOUNT) { |
9913 |
+ unsigned long len = vma_pages(mpnt); |
9914 |
+ |
9915 |
+diff --git a/kernel/hung_task.c b/kernel/hung_task.c |
9916 |
+index 751593ed7c0b..32b479468e4d 100644 |
9917 |
+--- a/kernel/hung_task.c |
9918 |
++++ b/kernel/hung_task.c |
9919 |
+@@ -44,6 +44,7 @@ int __read_mostly sysctl_hung_task_warnings = 10; |
9920 |
+ |
9921 |
+ static int __read_mostly did_panic; |
9922 |
+ static bool hung_task_show_lock; |
9923 |
++static bool hung_task_call_panic; |
9924 |
+ |
9925 |
+ static struct task_struct *watchdog_task; |
9926 |
+ |
9927 |
+@@ -127,10 +128,8 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) |
9928 |
+ touch_nmi_watchdog(); |
9929 |
+ |
9930 |
+ if (sysctl_hung_task_panic) { |
9931 |
+- if (hung_task_show_lock) |
9932 |
+- debug_show_all_locks(); |
9933 |
+- trigger_all_cpu_backtrace(); |
9934 |
+- panic("hung_task: blocked tasks"); |
9935 |
++ hung_task_show_lock = true; |
9936 |
++ hung_task_call_panic = true; |
9937 |
+ } |
9938 |
+ } |
9939 |
+ |
9940 |
+@@ -193,6 +192,10 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout) |
9941 |
+ rcu_read_unlock(); |
9942 |
+ if (hung_task_show_lock) |
9943 |
+ debug_show_all_locks(); |
9944 |
++ if (hung_task_call_panic) { |
9945 |
++ trigger_all_cpu_backtrace(); |
9946 |
++ panic("hung_task: blocked tasks"); |
9947 |
++ } |
9948 |
+ } |
9949 |
+ |
9950 |
+ static long hung_timeout_jiffies(unsigned long last_checked, |
9951 |
+diff --git a/kernel/kcov.c b/kernel/kcov.c |
9952 |
+index 2c16f1ab5e10..5be9a60a959f 100644 |
9953 |
+--- a/kernel/kcov.c |
9954 |
++++ b/kernel/kcov.c |
9955 |
+@@ -241,7 +241,8 @@ static void kcov_put(struct kcov *kcov) |
9956 |
+ |
9957 |
+ void kcov_task_init(struct task_struct *t) |
9958 |
+ { |
9959 |
+- t->kcov_mode = KCOV_MODE_DISABLED; |
9960 |
++ WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED); |
9961 |
++ barrier(); |
9962 |
+ t->kcov_size = 0; |
9963 |
+ t->kcov_area = NULL; |
9964 |
+ t->kcov = NULL; |
9965 |
+diff --git a/kernel/kthread.c b/kernel/kthread.c |
9966 |
+index 481951bf091d..1a481ae12dec 100644 |
9967 |
+--- a/kernel/kthread.c |
9968 |
++++ b/kernel/kthread.c |
9969 |
+@@ -319,8 +319,14 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data), |
9970 |
+ task = create->result; |
9971 |
+ if (!IS_ERR(task)) { |
9972 |
+ static const struct sched_param param = { .sched_priority = 0 }; |
9973 |
++ char name[TASK_COMM_LEN]; |
9974 |
+ |
9975 |
+- vsnprintf(task->comm, sizeof(task->comm), namefmt, args); |
9976 |
++ /* |
9977 |
++ * task is already visible to other tasks, so updating |
9978 |
++ * COMM must be protected. |
9979 |
++ */ |
9980 |
++ vsnprintf(name, sizeof(name), namefmt, args); |
9981 |
++ set_task_comm(task, name); |
9982 |
+ /* |
9983 |
+ * root may have changed our (kthreadd's) priority or CPU mask. |
9984 |
+ * The kernel thread should not inherit these properties. |
9985 |
+diff --git a/kernel/memremap.c b/kernel/memremap.c |
9986 |
+index 895e6b76b25e..1a63739f48e8 100644 |
9987 |
+--- a/kernel/memremap.c |
9988 |
++++ b/kernel/memremap.c |
9989 |
+@@ -348,10 +348,27 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) |
9990 |
+ unsigned long pfn, pgoff, order; |
9991 |
+ pgprot_t pgprot = PAGE_KERNEL; |
9992 |
+ int error, nid, is_ram; |
9993 |
++ struct dev_pagemap *conflict_pgmap; |
9994 |
+ |
9995 |
+ align_start = res->start & ~(SECTION_SIZE - 1); |
9996 |
+ align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE) |
9997 |
+ - align_start; |
9998 |
++ align_end = align_start + align_size - 1; |
9999 |
++ |
10000 |
++ conflict_pgmap = get_dev_pagemap(PHYS_PFN(align_start), NULL); |
10001 |
++ if (conflict_pgmap) { |
10002 |
++ dev_WARN(dev, "Conflicting mapping in same section\n"); |
10003 |
++ put_dev_pagemap(conflict_pgmap); |
10004 |
++ return ERR_PTR(-ENOMEM); |
10005 |
++ } |
10006 |
++ |
10007 |
++ conflict_pgmap = get_dev_pagemap(PHYS_PFN(align_end), NULL); |
10008 |
++ if (conflict_pgmap) { |
10009 |
++ dev_WARN(dev, "Conflicting mapping in same section\n"); |
10010 |
++ put_dev_pagemap(conflict_pgmap); |
10011 |
++ return ERR_PTR(-ENOMEM); |
10012 |
++ } |
10013 |
++ |
10014 |
+ is_ram = region_intersects(align_start, align_size, |
10015 |
+ IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE); |
10016 |
+ |
10017 |
+@@ -371,7 +388,6 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) |
10018 |
+ |
10019 |
+ mutex_lock(&pgmap_lock); |
10020 |
+ error = 0; |
10021 |
+- align_end = align_start + align_size - 1; |
10022 |
+ |
10023 |
+ foreach_order_pgoff(res, order, pgoff) { |
10024 |
+ error = __radix_tree_insert(&pgmap_radix, |
10025 |
+diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c |
10026 |
+index 4c10be0f4843..34238a7d48f6 100644 |
10027 |
+--- a/kernel/power/suspend.c |
10028 |
++++ b/kernel/power/suspend.c |
10029 |
+@@ -60,7 +60,7 @@ static const struct platform_s2idle_ops *s2idle_ops; |
10030 |
+ static DECLARE_WAIT_QUEUE_HEAD(s2idle_wait_head); |
10031 |
+ |
10032 |
+ enum s2idle_states __read_mostly s2idle_state; |
10033 |
+-static DEFINE_SPINLOCK(s2idle_lock); |
10034 |
++static DEFINE_RAW_SPINLOCK(s2idle_lock); |
10035 |
+ |
10036 |
+ void s2idle_set_ops(const struct platform_s2idle_ops *ops) |
10037 |
+ { |
10038 |
+@@ -78,12 +78,12 @@ static void s2idle_enter(void) |
10039 |
+ { |
10040 |
+ trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE, true); |
10041 |
+ |
10042 |
+- spin_lock_irq(&s2idle_lock); |
10043 |
++ raw_spin_lock_irq(&s2idle_lock); |
10044 |
+ if (pm_wakeup_pending()) |
10045 |
+ goto out; |
10046 |
+ |
10047 |
+ s2idle_state = S2IDLE_STATE_ENTER; |
10048 |
+- spin_unlock_irq(&s2idle_lock); |
10049 |
++ raw_spin_unlock_irq(&s2idle_lock); |
10050 |
+ |
10051 |
+ get_online_cpus(); |
10052 |
+ cpuidle_resume(); |
10053 |
+@@ -97,11 +97,11 @@ static void s2idle_enter(void) |
10054 |
+ cpuidle_pause(); |
10055 |
+ put_online_cpus(); |
10056 |
+ |
10057 |
+- spin_lock_irq(&s2idle_lock); |
10058 |
++ raw_spin_lock_irq(&s2idle_lock); |
10059 |
+ |
10060 |
+ out: |
10061 |
+ s2idle_state = S2IDLE_STATE_NONE; |
10062 |
+- spin_unlock_irq(&s2idle_lock); |
10063 |
++ raw_spin_unlock_irq(&s2idle_lock); |
10064 |
+ |
10065 |
+ trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE, false); |
10066 |
+ } |
10067 |
+@@ -156,12 +156,12 @@ void s2idle_wake(void) |
10068 |
+ { |
10069 |
+ unsigned long flags; |
10070 |
+ |
10071 |
+- spin_lock_irqsave(&s2idle_lock, flags); |
10072 |
++ raw_spin_lock_irqsave(&s2idle_lock, flags); |
10073 |
+ if (s2idle_state > S2IDLE_STATE_NONE) { |
10074 |
+ s2idle_state = S2IDLE_STATE_WAKE; |
10075 |
+ wake_up(&s2idle_wait_head); |
10076 |
+ } |
10077 |
+- spin_unlock_irqrestore(&s2idle_lock, flags); |
10078 |
++ raw_spin_unlock_irqrestore(&s2idle_lock, flags); |
10079 |
+ } |
10080 |
+ EXPORT_SYMBOL_GPL(s2idle_wake); |
10081 |
+ |
10082 |
+diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c |
10083 |
+index 449d67edfa4b..d7d091309054 100644 |
10084 |
+--- a/kernel/printk/printk_safe.c |
10085 |
++++ b/kernel/printk/printk_safe.c |
10086 |
+@@ -281,7 +281,7 @@ void printk_safe_flush_on_panic(void) |
10087 |
+ * Make sure that we could access the main ring buffer. |
10088 |
+ * Do not risk a double release when more CPUs are up. |
10089 |
+ */ |
10090 |
+- if (in_nmi() && raw_spin_is_locked(&logbuf_lock)) { |
10091 |
++ if (raw_spin_is_locked(&logbuf_lock)) { |
10092 |
+ if (num_online_cpus() > 1) |
10093 |
+ return; |
10094 |
+ |
10095 |
+diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c |
10096 |
+index e13df951aca7..28592b62b1d5 100644 |
10097 |
+--- a/kernel/sched/cpufreq_schedutil.c |
10098 |
++++ b/kernel/sched/cpufreq_schedutil.c |
10099 |
+@@ -183,22 +183,21 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu) |
10100 |
+ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) |
10101 |
+ { |
10102 |
+ struct rq *rq = cpu_rq(sg_cpu->cpu); |
10103 |
+- unsigned long util; |
10104 |
+ |
10105 |
+- if (rq->rt.rt_nr_running) { |
10106 |
+- util = sg_cpu->max; |
10107 |
+- } else { |
10108 |
+- util = sg_cpu->util_dl; |
10109 |
+- if (rq->cfs.h_nr_running) |
10110 |
+- util += sg_cpu->util_cfs; |
10111 |
+- } |
10112 |
++ if (rq->rt.rt_nr_running) |
10113 |
++ return sg_cpu->max; |
10114 |
+ |
10115 |
+ /* |
10116 |
++ * Utilization required by DEADLINE must always be granted while, for |
10117 |
++ * FAIR, we use blocked utilization of IDLE CPUs as a mechanism to |
10118 |
++ * gracefully reduce the frequency when no tasks show up for longer |
10119 |
++ * periods of time. |
10120 |
++ * |
10121 |
+ * Ideally we would like to set util_dl as min/guaranteed freq and |
10122 |
+ * util_cfs + util_dl as requested freq. However, cpufreq is not yet |
10123 |
+ * ready for such an interface. So, we only do the latter for now. |
10124 |
+ */ |
10125 |
+- return min(util, sg_cpu->max); |
10126 |
++ return min(sg_cpu->max, (sg_cpu->util_dl + sg_cpu->util_cfs)); |
10127 |
+ } |
10128 |
+ |
10129 |
+ static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags) |
10130 |
+diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c |
10131 |
+index 2f6fa95de2d8..1ff523dae6e2 100644 |
10132 |
+--- a/kernel/stop_machine.c |
10133 |
++++ b/kernel/stop_machine.c |
10134 |
+@@ -37,7 +37,7 @@ struct cpu_stop_done { |
10135 |
+ struct cpu_stopper { |
10136 |
+ struct task_struct *thread; |
10137 |
+ |
10138 |
+- spinlock_t lock; |
10139 |
++ raw_spinlock_t lock; |
10140 |
+ bool enabled; /* is this stopper enabled? */ |
10141 |
+ struct list_head works; /* list of pending works */ |
10142 |
+ |
10143 |
+@@ -81,13 +81,13 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work) |
10144 |
+ unsigned long flags; |
10145 |
+ bool enabled; |
10146 |
+ |
10147 |
+- spin_lock_irqsave(&stopper->lock, flags); |
10148 |
++ raw_spin_lock_irqsave(&stopper->lock, flags); |
10149 |
+ enabled = stopper->enabled; |
10150 |
+ if (enabled) |
10151 |
+ __cpu_stop_queue_work(stopper, work, &wakeq); |
10152 |
+ else if (work->done) |
10153 |
+ cpu_stop_signal_done(work->done); |
10154 |
+- spin_unlock_irqrestore(&stopper->lock, flags); |
10155 |
++ raw_spin_unlock_irqrestore(&stopper->lock, flags); |
10156 |
+ |
10157 |
+ wake_up_q(&wakeq); |
10158 |
+ |
10159 |
+@@ -237,8 +237,8 @@ static int cpu_stop_queue_two_works(int cpu1, struct cpu_stop_work *work1, |
10160 |
+ DEFINE_WAKE_Q(wakeq); |
10161 |
+ int err; |
10162 |
+ retry: |
10163 |
+- spin_lock_irq(&stopper1->lock); |
10164 |
+- spin_lock_nested(&stopper2->lock, SINGLE_DEPTH_NESTING); |
10165 |
++ raw_spin_lock_irq(&stopper1->lock); |
10166 |
++ raw_spin_lock_nested(&stopper2->lock, SINGLE_DEPTH_NESTING); |
10167 |
+ |
10168 |
+ err = -ENOENT; |
10169 |
+ if (!stopper1->enabled || !stopper2->enabled) |
10170 |
+@@ -261,8 +261,8 @@ retry: |
10171 |
+ __cpu_stop_queue_work(stopper1, work1, &wakeq); |
10172 |
+ __cpu_stop_queue_work(stopper2, work2, &wakeq); |
10173 |
+ unlock: |
10174 |
+- spin_unlock(&stopper2->lock); |
10175 |
+- spin_unlock_irq(&stopper1->lock); |
10176 |
++ raw_spin_unlock(&stopper2->lock); |
10177 |
++ raw_spin_unlock_irq(&stopper1->lock); |
10178 |
+ |
10179 |
+ if (unlikely(err == -EDEADLK)) { |
10180 |
+ while (stop_cpus_in_progress) |
10181 |
+@@ -461,9 +461,9 @@ static int cpu_stop_should_run(unsigned int cpu) |
10182 |
+ unsigned long flags; |
10183 |
+ int run; |
10184 |
+ |
10185 |
+- spin_lock_irqsave(&stopper->lock, flags); |
10186 |
++ raw_spin_lock_irqsave(&stopper->lock, flags); |
10187 |
+ run = !list_empty(&stopper->works); |
10188 |
+- spin_unlock_irqrestore(&stopper->lock, flags); |
10189 |
++ raw_spin_unlock_irqrestore(&stopper->lock, flags); |
10190 |
+ return run; |
10191 |
+ } |
10192 |
+ |
10193 |
+@@ -474,13 +474,13 @@ static void cpu_stopper_thread(unsigned int cpu) |
10194 |
+ |
10195 |
+ repeat: |
10196 |
+ work = NULL; |
10197 |
+- spin_lock_irq(&stopper->lock); |
10198 |
++ raw_spin_lock_irq(&stopper->lock); |
10199 |
+ if (!list_empty(&stopper->works)) { |
10200 |
+ work = list_first_entry(&stopper->works, |
10201 |
+ struct cpu_stop_work, list); |
10202 |
+ list_del_init(&work->list); |
10203 |
+ } |
10204 |
+- spin_unlock_irq(&stopper->lock); |
10205 |
++ raw_spin_unlock_irq(&stopper->lock); |
10206 |
+ |
10207 |
+ if (work) { |
10208 |
+ cpu_stop_fn_t fn = work->fn; |
10209 |
+@@ -554,7 +554,7 @@ static int __init cpu_stop_init(void) |
10210 |
+ for_each_possible_cpu(cpu) { |
10211 |
+ struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu); |
10212 |
+ |
10213 |
+- spin_lock_init(&stopper->lock); |
10214 |
++ raw_spin_lock_init(&stopper->lock); |
10215 |
+ INIT_LIST_HEAD(&stopper->works); |
10216 |
+ } |
10217 |
+ |
10218 |
+diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c |
10219 |
+index 84f37420fcf5..e0ff8f94f237 100644 |
10220 |
+--- a/kernel/time/clocksource.c |
10221 |
++++ b/kernel/time/clocksource.c |
10222 |
+@@ -453,8 +453,8 @@ static inline int __clocksource_watchdog_kthread(void) { return 0; } |
10223 |
+ static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } |
10224 |
+ void clocksource_mark_unstable(struct clocksource *cs) { } |
10225 |
+ |
10226 |
+-static void inline clocksource_watchdog_lock(unsigned long *flags) { } |
10227 |
+-static void inline clocksource_watchdog_unlock(unsigned long *flags) { } |
10228 |
++static inline void clocksource_watchdog_lock(unsigned long *flags) { } |
10229 |
++static inline void clocksource_watchdog_unlock(unsigned long *flags) { } |
10230 |
+ |
10231 |
+ #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ |
10232 |
+ |
10233 |
+diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c |
10234 |
+index 8b5bdcf64871..f14a547f6303 100644 |
10235 |
+--- a/kernel/trace/trace_events_trigger.c |
10236 |
++++ b/kernel/trace/trace_events_trigger.c |
10237 |
+@@ -681,6 +681,8 @@ event_trigger_callback(struct event_command *cmd_ops, |
10238 |
+ goto out_free; |
10239 |
+ |
10240 |
+ out_reg: |
10241 |
++ /* Up the trigger_data count to make sure reg doesn't free it on failure */ |
10242 |
++ event_trigger_init(trigger_ops, trigger_data); |
10243 |
+ ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file); |
10244 |
+ /* |
10245 |
+ * The above returns on success the # of functions enabled, |
10246 |
+@@ -688,11 +690,13 @@ event_trigger_callback(struct event_command *cmd_ops, |
10247 |
+ * Consider no functions a failure too. |
10248 |
+ */ |
10249 |
+ if (!ret) { |
10250 |
++ cmd_ops->unreg(glob, trigger_ops, trigger_data, file); |
10251 |
+ ret = -ENOENT; |
10252 |
+- goto out_free; |
10253 |
+- } else if (ret < 0) |
10254 |
+- goto out_free; |
10255 |
+- ret = 0; |
10256 |
++ } else if (ret > 0) |
10257 |
++ ret = 0; |
10258 |
++ |
10259 |
++ /* Down the counter of trigger_data or free it if not used anymore */ |
10260 |
++ event_trigger_free(trigger_ops, trigger_data); |
10261 |
+ out: |
10262 |
+ return ret; |
10263 |
+ |
10264 |
+@@ -1418,6 +1422,9 @@ int event_enable_trigger_func(struct event_command *cmd_ops, |
10265 |
+ goto out; |
10266 |
+ } |
10267 |
+ |
10268 |
++ /* Up the trigger_data count to make sure nothing frees it on failure */ |
10269 |
++ event_trigger_init(trigger_ops, trigger_data); |
10270 |
++ |
10271 |
+ if (trigger) { |
10272 |
+ number = strsep(&trigger, ":"); |
10273 |
+ |
10274 |
+@@ -1468,6 +1475,7 @@ int event_enable_trigger_func(struct event_command *cmd_ops, |
10275 |
+ goto out_disable; |
10276 |
+ /* Just return zero, not the number of enabled functions */ |
10277 |
+ ret = 0; |
10278 |
++ event_trigger_free(trigger_ops, trigger_data); |
10279 |
+ out: |
10280 |
+ return ret; |
10281 |
+ |
10282 |
+@@ -1478,7 +1486,7 @@ int event_enable_trigger_func(struct event_command *cmd_ops, |
10283 |
+ out_free: |
10284 |
+ if (cmd_ops->set_filter) |
10285 |
+ cmd_ops->set_filter(NULL, trigger_data, NULL); |
10286 |
+- kfree(trigger_data); |
10287 |
++ event_trigger_free(trigger_ops, trigger_data); |
10288 |
+ kfree(enable_data); |
10289 |
+ goto out; |
10290 |
+ } |
10291 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
10292 |
+index eebc7c92f6d0..dd88cc0af065 100644 |
10293 |
+--- a/kernel/trace/trace_kprobe.c |
10294 |
++++ b/kernel/trace/trace_kprobe.c |
10295 |
+@@ -400,11 +400,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event, |
10296 |
+ static int |
10297 |
+ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) |
10298 |
+ { |
10299 |
++ struct event_file_link *link = NULL; |
10300 |
+ int ret = 0; |
10301 |
+ |
10302 |
+ if (file) { |
10303 |
+- struct event_file_link *link; |
10304 |
+- |
10305 |
+ link = kmalloc(sizeof(*link), GFP_KERNEL); |
10306 |
+ if (!link) { |
10307 |
+ ret = -ENOMEM; |
10308 |
+@@ -424,6 +423,18 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) |
10309 |
+ else |
10310 |
+ ret = enable_kprobe(&tk->rp.kp); |
10311 |
+ } |
10312 |
++ |
10313 |
++ if (ret) { |
10314 |
++ if (file) { |
10315 |
++ /* Notice the if is true on not WARN() */ |
10316 |
++ if (!WARN_ON_ONCE(!link)) |
10317 |
++ list_del_rcu(&link->list); |
10318 |
++ kfree(link); |
10319 |
++ tk->tp.flags &= ~TP_FLAG_TRACE; |
10320 |
++ } else { |
10321 |
++ tk->tp.flags &= ~TP_FLAG_PROFILE; |
10322 |
++ } |
10323 |
++ } |
10324 |
+ out: |
10325 |
+ return ret; |
10326 |
+ } |
10327 |
+diff --git a/lib/dma-direct.c b/lib/dma-direct.c |
10328 |
+index bbfb229aa067..970d39155618 100644 |
10329 |
+--- a/lib/dma-direct.c |
10330 |
++++ b/lib/dma-direct.c |
10331 |
+@@ -84,6 +84,13 @@ again: |
10332 |
+ __free_pages(page, page_order); |
10333 |
+ page = NULL; |
10334 |
+ |
10335 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA32) && |
10336 |
++ dev->coherent_dma_mask < DMA_BIT_MASK(64) && |
10337 |
++ !(gfp & (GFP_DMA32 | GFP_DMA))) { |
10338 |
++ gfp |= GFP_DMA32; |
10339 |
++ goto again; |
10340 |
++ } |
10341 |
++ |
10342 |
+ if (IS_ENABLED(CONFIG_ZONE_DMA) && |
10343 |
+ dev->coherent_dma_mask < DMA_BIT_MASK(32) && |
10344 |
+ !(gfp & GFP_DMA)) { |
10345 |
+diff --git a/mm/slub.c b/mm/slub.c |
10346 |
+index 613c8dc2f409..067db0ff7496 100644 |
10347 |
+--- a/mm/slub.c |
10348 |
++++ b/mm/slub.c |
10349 |
+@@ -711,7 +711,7 @@ void object_err(struct kmem_cache *s, struct page *page, |
10350 |
+ print_trailer(s, page, object); |
10351 |
+ } |
10352 |
+ |
10353 |
+-static void slab_err(struct kmem_cache *s, struct page *page, |
10354 |
++static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page, |
10355 |
+ const char *fmt, ...) |
10356 |
+ { |
10357 |
+ va_list args; |
10358 |
+diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
10359 |
+index ebff729cc956..9ff21a12ea00 100644 |
10360 |
+--- a/mm/vmalloc.c |
10361 |
++++ b/mm/vmalloc.c |
10362 |
+@@ -1519,7 +1519,7 @@ static void __vunmap(const void *addr, int deallocate_pages) |
10363 |
+ addr)) |
10364 |
+ return; |
10365 |
+ |
10366 |
+- area = remove_vm_area(addr); |
10367 |
++ area = find_vmap_area((unsigned long)addr)->vm; |
10368 |
+ if (unlikely(!area)) { |
10369 |
+ WARN(1, KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n", |
10370 |
+ addr); |
10371 |
+@@ -1529,6 +1529,7 @@ static void __vunmap(const void *addr, int deallocate_pages) |
10372 |
+ debug_check_no_locks_freed(addr, get_vm_area_size(area)); |
10373 |
+ debug_check_no_obj_freed(addr, get_vm_area_size(area)); |
10374 |
+ |
10375 |
++ remove_vm_area(addr); |
10376 |
+ if (deallocate_pages) { |
10377 |
+ int i; |
10378 |
+ |
10379 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
10380 |
+index 2af787e8b130..1ccc2a2ac2e9 100644 |
10381 |
+--- a/net/core/dev.c |
10382 |
++++ b/net/core/dev.c |
10383 |
+@@ -7113,16 +7113,19 @@ int dev_change_tx_queue_len(struct net_device *dev, unsigned long new_len) |
10384 |
+ dev->tx_queue_len = new_len; |
10385 |
+ res = call_netdevice_notifiers(NETDEV_CHANGE_TX_QUEUE_LEN, dev); |
10386 |
+ res = notifier_to_errno(res); |
10387 |
+- if (res) { |
10388 |
+- netdev_err(dev, |
10389 |
+- "refused to change device tx_queue_len\n"); |
10390 |
+- dev->tx_queue_len = orig_len; |
10391 |
+- return res; |
10392 |
+- } |
10393 |
+- return dev_qdisc_change_tx_queue_len(dev); |
10394 |
++ if (res) |
10395 |
++ goto err_rollback; |
10396 |
++ res = dev_qdisc_change_tx_queue_len(dev); |
10397 |
++ if (res) |
10398 |
++ goto err_rollback; |
10399 |
+ } |
10400 |
+ |
10401 |
+ return 0; |
10402 |
++ |
10403 |
++err_rollback: |
10404 |
++ netdev_err(dev, "refused to change device tx_queue_len\n"); |
10405 |
++ dev->tx_queue_len = orig_len; |
10406 |
++ return res; |
10407 |
+ } |
10408 |
+ |
10409 |
+ /** |
10410 |
+diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
10411 |
+index 511d6748ea5f..6901349f07d7 100644 |
10412 |
+--- a/net/ipv4/fib_frontend.c |
10413 |
++++ b/net/ipv4/fib_frontend.c |
10414 |
+@@ -292,19 +292,19 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) |
10415 |
+ return ip_hdr(skb)->daddr; |
10416 |
+ |
10417 |
+ in_dev = __in_dev_get_rcu(dev); |
10418 |
+- BUG_ON(!in_dev); |
10419 |
+ |
10420 |
+ net = dev_net(dev); |
10421 |
+ |
10422 |
+ scope = RT_SCOPE_UNIVERSE; |
10423 |
+ if (!ipv4_is_zeronet(ip_hdr(skb)->saddr)) { |
10424 |
++ bool vmark = in_dev && IN_DEV_SRC_VMARK(in_dev); |
10425 |
+ struct flowi4 fl4 = { |
10426 |
+ .flowi4_iif = LOOPBACK_IFINDEX, |
10427 |
+ .flowi4_oif = l3mdev_master_ifindex_rcu(dev), |
10428 |
+ .daddr = ip_hdr(skb)->saddr, |
10429 |
+ .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), |
10430 |
+ .flowi4_scope = scope, |
10431 |
+- .flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0, |
10432 |
++ .flowi4_mark = vmark ? skb->mark : 0, |
10433 |
+ }; |
10434 |
+ if (!fib_lookup(net, &fl4, &res, 0)) |
10435 |
+ return FIB_RES_PREFSRC(net, res); |
10436 |
+diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c |
10437 |
+index 43f620feb1c4..13722462d99b 100644 |
10438 |
+--- a/net/ipv4/ipconfig.c |
10439 |
++++ b/net/ipv4/ipconfig.c |
10440 |
+@@ -748,6 +748,11 @@ static void __init ic_bootp_init_ext(u8 *e) |
10441 |
+ */ |
10442 |
+ static inline void __init ic_bootp_init(void) |
10443 |
+ { |
10444 |
++ /* Re-initialise all name servers to NONE, in case any were set via the |
10445 |
++ * "ip=" or "nfsaddrs=" kernel command line parameters: any IP addresses |
10446 |
++ * specified there will already have been decoded but are no longer |
10447 |
++ * needed |
10448 |
++ */ |
10449 |
+ ic_nameservers_predef(); |
10450 |
+ |
10451 |
+ dev_add_pack(&bootp_packet_type); |
10452 |
+@@ -1368,6 +1373,13 @@ static int __init ip_auto_config(void) |
10453 |
+ int err; |
10454 |
+ unsigned int i; |
10455 |
+ |
10456 |
++ /* Initialise all name servers to NONE (but only if the "ip=" or |
10457 |
++ * "nfsaddrs=" kernel command line parameters weren't decoded, otherwise |
10458 |
++ * we'll overwrite the IP addresses specified there) |
10459 |
++ */ |
10460 |
++ if (ic_set_manually == 0) |
10461 |
++ ic_nameservers_predef(); |
10462 |
++ |
10463 |
+ #ifdef CONFIG_PROC_FS |
10464 |
+ proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops); |
10465 |
+ #endif /* CONFIG_PROC_FS */ |
10466 |
+@@ -1588,6 +1600,7 @@ static int __init ip_auto_config_setup(char *addrs) |
10467 |
+ return 1; |
10468 |
+ } |
10469 |
+ |
10470 |
++ /* Initialise all name servers to NONE */ |
10471 |
+ ic_nameservers_predef(); |
10472 |
+ |
10473 |
+ /* Parse string for static IP assignment. */ |
10474 |
+diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c |
10475 |
+index 58e2f479ffb4..4bfff3c87e8e 100644 |
10476 |
+--- a/net/ipv4/tcp_bbr.c |
10477 |
++++ b/net/ipv4/tcp_bbr.c |
10478 |
+@@ -354,6 +354,10 @@ static u32 bbr_target_cwnd(struct sock *sk, u32 bw, int gain) |
10479 |
+ /* Reduce delayed ACKs by rounding up cwnd to the next even number. */ |
10480 |
+ cwnd = (cwnd + 1) & ~1U; |
10481 |
+ |
10482 |
++ /* Ensure gain cycling gets inflight above BDP even for small BDPs. */ |
10483 |
++ if (bbr->mode == BBR_PROBE_BW && gain > BBR_UNIT) |
10484 |
++ cwnd += 2; |
10485 |
++ |
10486 |
+ return cwnd; |
10487 |
+ } |
10488 |
+ |
10489 |
+diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c |
10490 |
+index c78fb53988a1..1a9b88c8cf72 100644 |
10491 |
+--- a/net/ipv4/tcp_dctcp.c |
10492 |
++++ b/net/ipv4/tcp_dctcp.c |
10493 |
+@@ -138,7 +138,7 @@ static void dctcp_ce_state_0_to_1(struct sock *sk) |
10494 |
+ */ |
10495 |
+ if (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) |
10496 |
+ __tcp_send_ack(sk, ca->prior_rcv_nxt); |
10497 |
+- tcp_enter_quickack_mode(sk); |
10498 |
++ tcp_enter_quickack_mode(sk, 1); |
10499 |
+ } |
10500 |
+ |
10501 |
+ ca->prior_rcv_nxt = tp->rcv_nxt; |
10502 |
+@@ -159,7 +159,7 @@ static void dctcp_ce_state_1_to_0(struct sock *sk) |
10503 |
+ */ |
10504 |
+ if (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) |
10505 |
+ __tcp_send_ack(sk, ca->prior_rcv_nxt); |
10506 |
+- tcp_enter_quickack_mode(sk); |
10507 |
++ tcp_enter_quickack_mode(sk, 1); |
10508 |
+ } |
10509 |
+ |
10510 |
+ ca->prior_rcv_nxt = tp->rcv_nxt; |
10511 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
10512 |
+index 0f5e9510c3fa..4f115830f6a8 100644 |
10513 |
+--- a/net/ipv4/tcp_input.c |
10514 |
++++ b/net/ipv4/tcp_input.c |
10515 |
+@@ -184,21 +184,23 @@ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb) |
10516 |
+ } |
10517 |
+ } |
10518 |
+ |
10519 |
+-static void tcp_incr_quickack(struct sock *sk) |
10520 |
++static void tcp_incr_quickack(struct sock *sk, unsigned int max_quickacks) |
10521 |
+ { |
10522 |
+ struct inet_connection_sock *icsk = inet_csk(sk); |
10523 |
+ unsigned int quickacks = tcp_sk(sk)->rcv_wnd / (2 * icsk->icsk_ack.rcv_mss); |
10524 |
+ |
10525 |
+ if (quickacks == 0) |
10526 |
+ quickacks = 2; |
10527 |
++ quickacks = min(quickacks, max_quickacks); |
10528 |
+ if (quickacks > icsk->icsk_ack.quick) |
10529 |
+- icsk->icsk_ack.quick = min(quickacks, TCP_MAX_QUICKACKS); |
10530 |
++ icsk->icsk_ack.quick = quickacks; |
10531 |
+ } |
10532 |
+ |
10533 |
+-void tcp_enter_quickack_mode(struct sock *sk) |
10534 |
++void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks) |
10535 |
+ { |
10536 |
+ struct inet_connection_sock *icsk = inet_csk(sk); |
10537 |
+- tcp_incr_quickack(sk); |
10538 |
++ |
10539 |
++ tcp_incr_quickack(sk, max_quickacks); |
10540 |
+ icsk->icsk_ack.pingpong = 0; |
10541 |
+ icsk->icsk_ack.ato = TCP_ATO_MIN; |
10542 |
+ } |
10543 |
+@@ -225,8 +227,15 @@ static void tcp_ecn_queue_cwr(struct tcp_sock *tp) |
10544 |
+ |
10545 |
+ static void tcp_ecn_accept_cwr(struct tcp_sock *tp, const struct sk_buff *skb) |
10546 |
+ { |
10547 |
+- if (tcp_hdr(skb)->cwr) |
10548 |
++ if (tcp_hdr(skb)->cwr) { |
10549 |
+ tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
10550 |
++ |
10551 |
++ /* If the sender is telling us it has entered CWR, then its |
10552 |
++ * cwnd may be very low (even just 1 packet), so we should ACK |
10553 |
++ * immediately. |
10554 |
++ */ |
10555 |
++ tcp_enter_quickack_mode((struct sock *)tp, 2); |
10556 |
++ } |
10557 |
+ } |
10558 |
+ |
10559 |
+ static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp) |
10560 |
+@@ -234,8 +243,10 @@ static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp) |
10561 |
+ tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
10562 |
+ } |
10563 |
+ |
10564 |
+-static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) |
10565 |
++static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) |
10566 |
+ { |
10567 |
++ struct tcp_sock *tp = tcp_sk(sk); |
10568 |
++ |
10569 |
+ switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) { |
10570 |
+ case INET_ECN_NOT_ECT: |
10571 |
+ /* Funny extension: if ECT is not set on a segment, |
10572 |
+@@ -243,31 +254,31 @@ static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) |
10573 |
+ * it is probably a retransmit. |
10574 |
+ */ |
10575 |
+ if (tp->ecn_flags & TCP_ECN_SEEN) |
10576 |
+- tcp_enter_quickack_mode((struct sock *)tp); |
10577 |
++ tcp_enter_quickack_mode(sk, 2); |
10578 |
+ break; |
10579 |
+ case INET_ECN_CE: |
10580 |
+- if (tcp_ca_needs_ecn((struct sock *)tp)) |
10581 |
+- tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_IS_CE); |
10582 |
++ if (tcp_ca_needs_ecn(sk)) |
10583 |
++ tcp_ca_event(sk, CA_EVENT_ECN_IS_CE); |
10584 |
+ |
10585 |
+ if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) { |
10586 |
+ /* Better not delay acks, sender can have a very low cwnd */ |
10587 |
+- tcp_enter_quickack_mode((struct sock *)tp); |
10588 |
++ tcp_enter_quickack_mode(sk, 2); |
10589 |
+ tp->ecn_flags |= TCP_ECN_DEMAND_CWR; |
10590 |
+ } |
10591 |
+ tp->ecn_flags |= TCP_ECN_SEEN; |
10592 |
+ break; |
10593 |
+ default: |
10594 |
+- if (tcp_ca_needs_ecn((struct sock *)tp)) |
10595 |
+- tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_NO_CE); |
10596 |
++ if (tcp_ca_needs_ecn(sk)) |
10597 |
++ tcp_ca_event(sk, CA_EVENT_ECN_NO_CE); |
10598 |
+ tp->ecn_flags |= TCP_ECN_SEEN; |
10599 |
+ break; |
10600 |
+ } |
10601 |
+ } |
10602 |
+ |
10603 |
+-static void tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) |
10604 |
++static void tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) |
10605 |
+ { |
10606 |
+- if (tp->ecn_flags & TCP_ECN_OK) |
10607 |
+- __tcp_ecn_check_ce(tp, skb); |
10608 |
++ if (tcp_sk(sk)->ecn_flags & TCP_ECN_OK) |
10609 |
++ __tcp_ecn_check_ce(sk, skb); |
10610 |
+ } |
10611 |
+ |
10612 |
+ static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th) |
10613 |
+@@ -666,7 +677,7 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb) |
10614 |
+ /* The _first_ data packet received, initialize |
10615 |
+ * delayed ACK engine. |
10616 |
+ */ |
10617 |
+- tcp_incr_quickack(sk); |
10618 |
++ tcp_incr_quickack(sk, TCP_MAX_QUICKACKS); |
10619 |
+ icsk->icsk_ack.ato = TCP_ATO_MIN; |
10620 |
+ } else { |
10621 |
+ int m = now - icsk->icsk_ack.lrcvtime; |
10622 |
+@@ -682,13 +693,13 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb) |
10623 |
+ /* Too long gap. Apparently sender failed to |
10624 |
+ * restart window, so that we send ACKs quickly. |
10625 |
+ */ |
10626 |
+- tcp_incr_quickack(sk); |
10627 |
++ tcp_incr_quickack(sk, TCP_MAX_QUICKACKS); |
10628 |
+ sk_mem_reclaim(sk); |
10629 |
+ } |
10630 |
+ } |
10631 |
+ icsk->icsk_ack.lrcvtime = now; |
10632 |
+ |
10633 |
+- tcp_ecn_check_ce(tp, skb); |
10634 |
++ tcp_ecn_check_ce(sk, skb); |
10635 |
+ |
10636 |
+ if (skb->len >= 128) |
10637 |
+ tcp_grow_window(sk, skb); |
10638 |
+@@ -4136,7 +4147,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb) |
10639 |
+ if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && |
10640 |
+ before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) { |
10641 |
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST); |
10642 |
+- tcp_enter_quickack_mode(sk); |
10643 |
++ tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS); |
10644 |
+ |
10645 |
+ if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { |
10646 |
+ u32 end_seq = TCP_SKB_CB(skb)->end_seq; |
10647 |
+@@ -4404,7 +4415,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) |
10648 |
+ u32 seq, end_seq; |
10649 |
+ bool fragstolen; |
10650 |
+ |
10651 |
+- tcp_ecn_check_ce(tp, skb); |
10652 |
++ tcp_ecn_check_ce(sk, skb); |
10653 |
+ |
10654 |
+ if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { |
10655 |
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP); |
10656 |
+@@ -4667,7 +4678,7 @@ queue_and_out: |
10657 |
+ tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq); |
10658 |
+ |
10659 |
+ out_of_window: |
10660 |
+- tcp_enter_quickack_mode(sk); |
10661 |
++ tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS); |
10662 |
+ inet_csk_schedule_ack(sk); |
10663 |
+ drop: |
10664 |
+ tcp_drop(sk, skb); |
10665 |
+@@ -4678,8 +4689,6 @@ drop: |
10666 |
+ if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt + tcp_receive_window(tp))) |
10667 |
+ goto out_of_window; |
10668 |
+ |
10669 |
+- tcp_enter_quickack_mode(sk); |
10670 |
+- |
10671 |
+ if (before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) { |
10672 |
+ /* Partial packet, seq < rcv_next < end_seq */ |
10673 |
+ SOCK_DEBUG(sk, "partial packet: rcv_next %X seq %X - %X\n", |
10674 |
+@@ -5746,7 +5755,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, |
10675 |
+ * to stand against the temptation 8) --ANK |
10676 |
+ */ |
10677 |
+ inet_csk_schedule_ack(sk); |
10678 |
+- tcp_enter_quickack_mode(sk); |
10679 |
++ tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS); |
10680 |
+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, |
10681 |
+ TCP_DELACK_MAX, TCP_RTO_MAX); |
10682 |
+ |
10683 |
+diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h |
10684 |
+index bbad940c0137..8a33dac4e805 100644 |
10685 |
+--- a/net/netfilter/ipset/ip_set_hash_gen.h |
10686 |
++++ b/net/netfilter/ipset/ip_set_hash_gen.h |
10687 |
+@@ -1234,7 +1234,10 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set, |
10688 |
+ pr_debug("Create set %s with family %s\n", |
10689 |
+ set->name, set->family == NFPROTO_IPV4 ? "inet" : "inet6"); |
10690 |
+ |
10691 |
+-#ifndef IP_SET_PROTO_UNDEF |
10692 |
++#ifdef IP_SET_PROTO_UNDEF |
10693 |
++ if (set->family != NFPROTO_UNSPEC) |
10694 |
++ return -IPSET_ERR_INVALID_FAMILY; |
10695 |
++#else |
10696 |
+ if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
10697 |
+ return -IPSET_ERR_INVALID_FAMILY; |
10698 |
+ #endif |
10699 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
10700 |
+index 501e48a7965b..8d8dfe417014 100644 |
10701 |
+--- a/net/netfilter/nf_tables_api.c |
10702 |
++++ b/net/netfilter/nf_tables_api.c |
10703 |
+@@ -2728,12 +2728,13 @@ static struct nft_set *nf_tables_set_lookup_byid(const struct net *net, |
10704 |
+ u32 id = ntohl(nla_get_be32(nla)); |
10705 |
+ |
10706 |
+ list_for_each_entry(trans, &net->nft.commit_list, list) { |
10707 |
+- struct nft_set *set = nft_trans_set(trans); |
10708 |
++ if (trans->msg_type == NFT_MSG_NEWSET) { |
10709 |
++ struct nft_set *set = nft_trans_set(trans); |
10710 |
+ |
10711 |
+- if (trans->msg_type == NFT_MSG_NEWSET && |
10712 |
+- id == nft_trans_set_id(trans) && |
10713 |
+- nft_active_genmask(set, genmask)) |
10714 |
+- return set; |
10715 |
++ if (id == nft_trans_set_id(trans) && |
10716 |
++ nft_active_genmask(set, genmask)) |
10717 |
++ return set; |
10718 |
++ } |
10719 |
+ } |
10720 |
+ return ERR_PTR(-ENOENT); |
10721 |
+ } |
10722 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
10723 |
+index 2e2dd88fc79f..890f22f90344 100644 |
10724 |
+--- a/net/netlink/af_netlink.c |
10725 |
++++ b/net/netlink/af_netlink.c |
10726 |
+@@ -1009,6 +1009,11 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, |
10727 |
+ return err; |
10728 |
+ } |
10729 |
+ |
10730 |
++ if (nlk->ngroups == 0) |
10731 |
++ groups = 0; |
10732 |
++ else |
10733 |
++ groups &= (1ULL << nlk->ngroups) - 1; |
10734 |
++ |
10735 |
+ bound = nlk->bound; |
10736 |
+ if (bound) { |
10737 |
+ /* Ensure nlk->portid is up-to-date. */ |
10738 |
+diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c |
10739 |
+index 48332a6ed738..d152e48ea371 100644 |
10740 |
+--- a/net/rds/ib_frmr.c |
10741 |
++++ b/net/rds/ib_frmr.c |
10742 |
+@@ -344,6 +344,11 @@ struct rds_ib_mr *rds_ib_reg_frmr(struct rds_ib_device *rds_ibdev, |
10743 |
+ struct rds_ib_frmr *frmr; |
10744 |
+ int ret; |
10745 |
+ |
10746 |
++ if (!ic) { |
10747 |
++ /* TODO: Add FRWR support for RDS_GET_MR using proxy qp*/ |
10748 |
++ return ERR_PTR(-EOPNOTSUPP); |
10749 |
++ } |
10750 |
++ |
10751 |
+ do { |
10752 |
+ if (ibmr) |
10753 |
+ rds_ib_free_frmr(ibmr, true); |
10754 |
+diff --git a/net/rds/ib_mr.h b/net/rds/ib_mr.h |
10755 |
+index 0ea4ab017a8c..655f01d427fe 100644 |
10756 |
+--- a/net/rds/ib_mr.h |
10757 |
++++ b/net/rds/ib_mr.h |
10758 |
+@@ -115,7 +115,8 @@ void rds_ib_get_mr_info(struct rds_ib_device *rds_ibdev, |
10759 |
+ struct rds_info_rdma_connection *iinfo); |
10760 |
+ void rds_ib_destroy_mr_pool(struct rds_ib_mr_pool *); |
10761 |
+ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, |
10762 |
+- struct rds_sock *rs, u32 *key_ret); |
10763 |
++ struct rds_sock *rs, u32 *key_ret, |
10764 |
++ struct rds_connection *conn); |
10765 |
+ void rds_ib_sync_mr(void *trans_private, int dir); |
10766 |
+ void rds_ib_free_mr(void *trans_private, int invalidate); |
10767 |
+ void rds_ib_flush_mrs(void); |
10768 |
+diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c |
10769 |
+index e678699268a2..2e49a40a5e11 100644 |
10770 |
+--- a/net/rds/ib_rdma.c |
10771 |
++++ b/net/rds/ib_rdma.c |
10772 |
+@@ -537,11 +537,12 @@ void rds_ib_flush_mrs(void) |
10773 |
+ } |
10774 |
+ |
10775 |
+ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, |
10776 |
+- struct rds_sock *rs, u32 *key_ret) |
10777 |
++ struct rds_sock *rs, u32 *key_ret, |
10778 |
++ struct rds_connection *conn) |
10779 |
+ { |
10780 |
+ struct rds_ib_device *rds_ibdev; |
10781 |
+ struct rds_ib_mr *ibmr = NULL; |
10782 |
+- struct rds_ib_connection *ic = rs->rs_conn->c_transport_data; |
10783 |
++ struct rds_ib_connection *ic = NULL; |
10784 |
+ int ret; |
10785 |
+ |
10786 |
+ rds_ibdev = rds_ib_get_device(rs->rs_bound_addr); |
10787 |
+@@ -550,6 +551,9 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, |
10788 |
+ goto out; |
10789 |
+ } |
10790 |
+ |
10791 |
++ if (conn) |
10792 |
++ ic = conn->c_transport_data; |
10793 |
++ |
10794 |
+ if (!rds_ibdev->mr_8k_pool || !rds_ibdev->mr_1m_pool) { |
10795 |
+ ret = -ENODEV; |
10796 |
+ goto out; |
10797 |
+@@ -559,17 +563,18 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, |
10798 |
+ ibmr = rds_ib_reg_frmr(rds_ibdev, ic, sg, nents, key_ret); |
10799 |
+ else |
10800 |
+ ibmr = rds_ib_reg_fmr(rds_ibdev, sg, nents, key_ret); |
10801 |
+- if (ibmr) |
10802 |
+- rds_ibdev = NULL; |
10803 |
+- |
10804 |
+- out: |
10805 |
+- if (!ibmr) |
10806 |
++ if (IS_ERR(ibmr)) { |
10807 |
++ ret = PTR_ERR(ibmr); |
10808 |
+ pr_warn("RDS/IB: rds_ib_get_mr failed (errno=%d)\n", ret); |
10809 |
++ } else { |
10810 |
++ return ibmr; |
10811 |
++ } |
10812 |
+ |
10813 |
++ out: |
10814 |
+ if (rds_ibdev) |
10815 |
+ rds_ib_dev_put(rds_ibdev); |
10816 |
+ |
10817 |
+- return ibmr; |
10818 |
++ return ERR_PTR(ret); |
10819 |
+ } |
10820 |
+ |
10821 |
+ void rds_ib_destroy_mr_pool(struct rds_ib_mr_pool *pool) |
10822 |
+diff --git a/net/rds/rdma.c b/net/rds/rdma.c |
10823 |
+index 634cfcb7bba6..80920e47f2c7 100644 |
10824 |
+--- a/net/rds/rdma.c |
10825 |
++++ b/net/rds/rdma.c |
10826 |
+@@ -170,7 +170,8 @@ static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages, |
10827 |
+ } |
10828 |
+ |
10829 |
+ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args, |
10830 |
+- u64 *cookie_ret, struct rds_mr **mr_ret) |
10831 |
++ u64 *cookie_ret, struct rds_mr **mr_ret, |
10832 |
++ struct rds_conn_path *cp) |
10833 |
+ { |
10834 |
+ struct rds_mr *mr = NULL, *found; |
10835 |
+ unsigned int nr_pages; |
10836 |
+@@ -269,7 +270,8 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args, |
10837 |
+ * Note that dma_map() implies that pending writes are |
10838 |
+ * flushed to RAM, so no dma_sync is needed here. */ |
10839 |
+ trans_private = rs->rs_transport->get_mr(sg, nents, rs, |
10840 |
+- &mr->r_key); |
10841 |
++ &mr->r_key, |
10842 |
++ cp ? cp->cp_conn : NULL); |
10843 |
+ |
10844 |
+ if (IS_ERR(trans_private)) { |
10845 |
+ for (i = 0 ; i < nents; i++) |
10846 |
+@@ -330,7 +332,7 @@ int rds_get_mr(struct rds_sock *rs, char __user *optval, int optlen) |
10847 |
+ sizeof(struct rds_get_mr_args))) |
10848 |
+ return -EFAULT; |
10849 |
+ |
10850 |
+- return __rds_rdma_map(rs, &args, NULL, NULL); |
10851 |
++ return __rds_rdma_map(rs, &args, NULL, NULL, NULL); |
10852 |
+ } |
10853 |
+ |
10854 |
+ int rds_get_mr_for_dest(struct rds_sock *rs, char __user *optval, int optlen) |
10855 |
+@@ -354,7 +356,7 @@ int rds_get_mr_for_dest(struct rds_sock *rs, char __user *optval, int optlen) |
10856 |
+ new_args.cookie_addr = args.cookie_addr; |
10857 |
+ new_args.flags = args.flags; |
10858 |
+ |
10859 |
+- return __rds_rdma_map(rs, &new_args, NULL, NULL); |
10860 |
++ return __rds_rdma_map(rs, &new_args, NULL, NULL, NULL); |
10861 |
+ } |
10862 |
+ |
10863 |
+ /* |
10864 |
+@@ -782,7 +784,8 @@ int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm, |
10865 |
+ rm->m_rdma_cookie != 0) |
10866 |
+ return -EINVAL; |
10867 |
+ |
10868 |
+- return __rds_rdma_map(rs, CMSG_DATA(cmsg), &rm->m_rdma_cookie, &rm->rdma.op_rdma_mr); |
10869 |
++ return __rds_rdma_map(rs, CMSG_DATA(cmsg), &rm->m_rdma_cookie, |
10870 |
++ &rm->rdma.op_rdma_mr, rm->m_conn_path); |
10871 |
+ } |
10872 |
+ |
10873 |
+ /* |
10874 |
+diff --git a/net/rds/rds.h b/net/rds/rds.h |
10875 |
+index f2272fb8cd45..60b3b787fbdb 100644 |
10876 |
+--- a/net/rds/rds.h |
10877 |
++++ b/net/rds/rds.h |
10878 |
+@@ -464,6 +464,8 @@ struct rds_message { |
10879 |
+ struct scatterlist *op_sg; |
10880 |
+ } data; |
10881 |
+ }; |
10882 |
++ |
10883 |
++ struct rds_conn_path *m_conn_path; |
10884 |
+ }; |
10885 |
+ |
10886 |
+ /* |
10887 |
+@@ -544,7 +546,8 @@ struct rds_transport { |
10888 |
+ unsigned int avail); |
10889 |
+ void (*exit)(void); |
10890 |
+ void *(*get_mr)(struct scatterlist *sg, unsigned long nr_sg, |
10891 |
+- struct rds_sock *rs, u32 *key_ret); |
10892 |
++ struct rds_sock *rs, u32 *key_ret, |
10893 |
++ struct rds_connection *conn); |
10894 |
+ void (*sync_mr)(void *trans_private, int direction); |
10895 |
+ void (*free_mr)(void *trans_private, int invalidate); |
10896 |
+ void (*flush_mrs)(void); |
10897 |
+diff --git a/net/rds/send.c b/net/rds/send.c |
10898 |
+index 94c7f74909be..59f17a2335f4 100644 |
10899 |
+--- a/net/rds/send.c |
10900 |
++++ b/net/rds/send.c |
10901 |
+@@ -1169,6 +1169,13 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) |
10902 |
+ rs->rs_conn = conn; |
10903 |
+ } |
10904 |
+ |
10905 |
++ if (conn->c_trans->t_mp_capable) |
10906 |
++ cpath = &conn->c_path[rds_send_mprds_hash(rs, conn)]; |
10907 |
++ else |
10908 |
++ cpath = &conn->c_path[0]; |
10909 |
++ |
10910 |
++ rm->m_conn_path = cpath; |
10911 |
++ |
10912 |
+ /* Parse any control messages the user may have included. */ |
10913 |
+ ret = rds_cmsg_send(rs, rm, msg, &allocated_mr); |
10914 |
+ if (ret) { |
10915 |
+@@ -1192,11 +1199,6 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) |
10916 |
+ goto out; |
10917 |
+ } |
10918 |
+ |
10919 |
+- if (conn->c_trans->t_mp_capable) |
10920 |
+- cpath = &conn->c_path[rds_send_mprds_hash(rs, conn)]; |
10921 |
+- else |
10922 |
+- cpath = &conn->c_path[0]; |
10923 |
+- |
10924 |
+ if (rds_destroy_pending(conn)) { |
10925 |
+ ret = -EAGAIN; |
10926 |
+ goto out; |
10927 |
+diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c |
10928 |
+index 1350f1be8037..8229a52c2acd 100644 |
10929 |
+--- a/net/rxrpc/conn_event.c |
10930 |
++++ b/net/rxrpc/conn_event.c |
10931 |
+@@ -70,7 +70,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, |
10932 |
+ iov[2].iov_len = sizeof(ack_info); |
10933 |
+ |
10934 |
+ pkt.whdr.epoch = htonl(conn->proto.epoch); |
10935 |
+- pkt.whdr.cid = htonl(conn->proto.cid); |
10936 |
++ pkt.whdr.cid = htonl(conn->proto.cid | channel); |
10937 |
+ pkt.whdr.callNumber = htonl(call_id); |
10938 |
+ pkt.whdr.seq = 0; |
10939 |
+ pkt.whdr.type = chan->last_type; |
10940 |
+diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c |
10941 |
+index 74d0bd7e76d7..1309b5509ef2 100644 |
10942 |
+--- a/security/integrity/ima/ima_main.c |
10943 |
++++ b/security/integrity/ima/ima_main.c |
10944 |
+@@ -449,6 +449,7 @@ int ima_read_file(struct file *file, enum kernel_read_file_id read_id) |
10945 |
+ |
10946 |
+ static int read_idmap[READING_MAX_ID] = { |
10947 |
+ [READING_FIRMWARE] = FIRMWARE_CHECK, |
10948 |
++ [READING_FIRMWARE_PREALLOC_BUFFER] = FIRMWARE_CHECK, |
10949 |
+ [READING_MODULE] = MODULE_CHECK, |
10950 |
+ [READING_KEXEC_IMAGE] = KEXEC_KERNEL_CHECK, |
10951 |
+ [READING_KEXEC_INITRAMFS] = KEXEC_INITRAMFS_CHECK, |
10952 |
+diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c |
10953 |
+index cefe613ef7b7..a68c7554f30f 100644 |
10954 |
+--- a/sound/pci/emu10k1/emupcm.c |
10955 |
++++ b/sound/pci/emu10k1/emupcm.c |
10956 |
+@@ -1858,7 +1858,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device) |
10957 |
+ if (!kctl) |
10958 |
+ return -ENOMEM; |
10959 |
+ kctl->id.device = device; |
10960 |
+- snd_ctl_add(emu->card, kctl); |
10961 |
++ err = snd_ctl_add(emu->card, kctl); |
10962 |
++ if (err < 0) |
10963 |
++ return err; |
10964 |
+ |
10965 |
+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); |
10966 |
+ |
10967 |
+diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c |
10968 |
+index 5865f3b90b34..dbc7d8d0e1c4 100644 |
10969 |
+--- a/sound/pci/emu10k1/memory.c |
10970 |
++++ b/sound/pci/emu10k1/memory.c |
10971 |
+@@ -248,13 +248,13 @@ __found_pages: |
10972 |
+ static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr) |
10973 |
+ { |
10974 |
+ if (addr & ~emu->dma_mask) { |
10975 |
+- dev_err(emu->card->dev, |
10976 |
++ dev_err_ratelimited(emu->card->dev, |
10977 |
+ "max memory size is 0x%lx (addr = 0x%lx)!!\n", |
10978 |
+ emu->dma_mask, (unsigned long)addr); |
10979 |
+ return 0; |
10980 |
+ } |
10981 |
+ if (addr & (EMUPAGESIZE-1)) { |
10982 |
+- dev_err(emu->card->dev, "page is not aligned\n"); |
10983 |
++ dev_err_ratelimited(emu->card->dev, "page is not aligned\n"); |
10984 |
+ return 0; |
10985 |
+ } |
10986 |
+ return 1; |
10987 |
+@@ -345,7 +345,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst |
10988 |
+ else |
10989 |
+ addr = snd_pcm_sgbuf_get_addr(substream, ofs); |
10990 |
+ if (! is_valid_page(emu, addr)) { |
10991 |
+- dev_err(emu->card->dev, |
10992 |
++ dev_err_ratelimited(emu->card->dev, |
10993 |
+ "emu: failure page = %d\n", idx); |
10994 |
+ mutex_unlock(&hdr->block_mutex); |
10995 |
+ return NULL; |
10996 |
+diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c |
10997 |
+index 73a67bc3586b..e3fb9c61017c 100644 |
10998 |
+--- a/sound/pci/fm801.c |
10999 |
++++ b/sound/pci/fm801.c |
11000 |
+@@ -1068,11 +1068,19 @@ static int snd_fm801_mixer(struct fm801 *chip) |
11001 |
+ if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0) |
11002 |
+ return err; |
11003 |
+ } |
11004 |
+- for (i = 0; i < FM801_CONTROLS; i++) |
11005 |
+- snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls[i], chip)); |
11006 |
++ for (i = 0; i < FM801_CONTROLS; i++) { |
11007 |
++ err = snd_ctl_add(chip->card, |
11008 |
++ snd_ctl_new1(&snd_fm801_controls[i], chip)); |
11009 |
++ if (err < 0) |
11010 |
++ return err; |
11011 |
++ } |
11012 |
+ if (chip->multichannel) { |
11013 |
+- for (i = 0; i < FM801_CONTROLS_MULTI; i++) |
11014 |
+- snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); |
11015 |
++ for (i = 0; i < FM801_CONTROLS_MULTI; i++) { |
11016 |
++ err = snd_ctl_add(chip->card, |
11017 |
++ snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); |
11018 |
++ if (err < 0) |
11019 |
++ return err; |
11020 |
++ } |
11021 |
+ } |
11022 |
+ return 0; |
11023 |
+ } |
11024 |
+diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
11025 |
+index 768ea8651993..84261ef02c93 100644 |
11026 |
+--- a/sound/pci/hda/patch_ca0132.c |
11027 |
++++ b/sound/pci/hda/patch_ca0132.c |
11028 |
+@@ -39,6 +39,10 @@ |
11029 |
+ /* Enable this to see controls for tuning purpose. */ |
11030 |
+ /*#define ENABLE_TUNING_CONTROLS*/ |
11031 |
+ |
11032 |
++#ifdef ENABLE_TUNING_CONTROLS |
11033 |
++#include <sound/tlv.h> |
11034 |
++#endif |
11035 |
++ |
11036 |
+ #define FLOAT_ZERO 0x00000000 |
11037 |
+ #define FLOAT_ONE 0x3f800000 |
11038 |
+ #define FLOAT_TWO 0x40000000 |
11039 |
+@@ -3068,8 +3072,8 @@ static int equalizer_ctl_put(struct snd_kcontrol *kcontrol, |
11040 |
+ return 1; |
11041 |
+ } |
11042 |
+ |
11043 |
+-static const DECLARE_TLV_DB_SCALE(voice_focus_db_scale, 2000, 100, 0); |
11044 |
+-static const DECLARE_TLV_DB_SCALE(eq_db_scale, -2400, 100, 0); |
11045 |
++static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(voice_focus_db_scale, 2000, 100, 0); |
11046 |
++static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0); |
11047 |
+ |
11048 |
+ static int add_tuning_control(struct hda_codec *codec, |
11049 |
+ hda_nid_t pnid, hda_nid_t nid, |
11050 |
+diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c |
11051 |
+index 89df2d9f63d7..1544166631e3 100644 |
11052 |
+--- a/sound/soc/fsl/fsl_ssi.c |
11053 |
++++ b/sound/soc/fsl/fsl_ssi.c |
11054 |
+@@ -385,8 +385,7 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) |
11055 |
+ { |
11056 |
+ struct fsl_ssi *ssi = dev_id; |
11057 |
+ struct regmap *regs = ssi->regs; |
11058 |
+- __be32 sisr; |
11059 |
+- __be32 sisr2; |
11060 |
++ u32 sisr, sisr2; |
11061 |
+ |
11062 |
+ regmap_read(regs, REG_SSI_SISR, &sisr); |
11063 |
+ |
11064 |
+diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c |
11065 |
+index 82402688bd8e..948505f74229 100644 |
11066 |
+--- a/sound/soc/soc-compress.c |
11067 |
++++ b/sound/soc/soc-compress.c |
11068 |
+@@ -33,7 +33,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream) |
11069 |
+ struct snd_soc_component *component; |
11070 |
+ struct snd_soc_rtdcom_list *rtdcom; |
11071 |
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
11072 |
+- int ret = 0, __ret; |
11073 |
++ int ret; |
11074 |
+ |
11075 |
+ mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); |
11076 |
+ |
11077 |
+@@ -68,16 +68,15 @@ static int soc_compr_open(struct snd_compr_stream *cstream) |
11078 |
+ !component->driver->compr_ops->open) |
11079 |
+ continue; |
11080 |
+ |
11081 |
+- __ret = component->driver->compr_ops->open(cstream); |
11082 |
+- if (__ret < 0) { |
11083 |
++ ret = component->driver->compr_ops->open(cstream); |
11084 |
++ if (ret < 0) { |
11085 |
+ dev_err(component->dev, |
11086 |
+ "Compress ASoC: can't open platform %s: %d\n", |
11087 |
+- component->name, __ret); |
11088 |
+- ret = __ret; |
11089 |
++ component->name, ret); |
11090 |
++ goto machine_err; |
11091 |
+ } |
11092 |
+ } |
11093 |
+- if (ret < 0) |
11094 |
+- goto machine_err; |
11095 |
++ component = NULL; |
11096 |
+ |
11097 |
+ if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->startup) { |
11098 |
+ ret = rtd->dai_link->compr_ops->startup(cstream); |
11099 |
+@@ -97,17 +96,20 @@ static int soc_compr_open(struct snd_compr_stream *cstream) |
11100 |
+ |
11101 |
+ machine_err: |
11102 |
+ for_each_rtdcom(rtd, rtdcom) { |
11103 |
+- component = rtdcom->component; |
11104 |
++ struct snd_soc_component *err_comp = rtdcom->component; |
11105 |
++ |
11106 |
++ if (err_comp == component) |
11107 |
++ break; |
11108 |
+ |
11109 |
+ /* ignore duplication for now */ |
11110 |
+- if (platform && (component == &platform->component)) |
11111 |
++ if (platform && (err_comp == &platform->component)) |
11112 |
+ continue; |
11113 |
+ |
11114 |
+- if (!component->driver->compr_ops || |
11115 |
+- !component->driver->compr_ops->free) |
11116 |
++ if (!err_comp->driver->compr_ops || |
11117 |
++ !err_comp->driver->compr_ops->free) |
11118 |
+ continue; |
11119 |
+ |
11120 |
+- component->driver->compr_ops->free(cstream); |
11121 |
++ err_comp->driver->compr_ops->free(cstream); |
11122 |
+ } |
11123 |
+ |
11124 |
+ if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) |
11125 |
+@@ -132,7 +134,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) |
11126 |
+ struct snd_soc_dpcm *dpcm; |
11127 |
+ struct snd_soc_dapm_widget_list *list; |
11128 |
+ int stream; |
11129 |
+- int ret = 0, __ret; |
11130 |
++ int ret; |
11131 |
+ |
11132 |
+ if (cstream->direction == SND_COMPRESS_PLAYBACK) |
11133 |
+ stream = SNDRV_PCM_STREAM_PLAYBACK; |
11134 |
+@@ -172,16 +174,15 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) |
11135 |
+ !component->driver->compr_ops->open) |
11136 |
+ continue; |
11137 |
+ |
11138 |
+- __ret = component->driver->compr_ops->open(cstream); |
11139 |
+- if (__ret < 0) { |
11140 |
++ ret = component->driver->compr_ops->open(cstream); |
11141 |
++ if (ret < 0) { |
11142 |
+ dev_err(component->dev, |
11143 |
+ "Compress ASoC: can't open platform %s: %d\n", |
11144 |
+- component->name, __ret); |
11145 |
+- ret = __ret; |
11146 |
++ component->name, ret); |
11147 |
++ goto machine_err; |
11148 |
+ } |
11149 |
+ } |
11150 |
+- if (ret < 0) |
11151 |
+- goto machine_err; |
11152 |
++ component = NULL; |
11153 |
+ |
11154 |
+ if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->startup) { |
11155 |
+ ret = fe->dai_link->compr_ops->startup(cstream); |
11156 |
+@@ -236,17 +237,20 @@ fe_err: |
11157 |
+ fe->dai_link->compr_ops->shutdown(cstream); |
11158 |
+ machine_err: |
11159 |
+ for_each_rtdcom(fe, rtdcom) { |
11160 |
+- component = rtdcom->component; |
11161 |
++ struct snd_soc_component *err_comp = rtdcom->component; |
11162 |
++ |
11163 |
++ if (err_comp == component) |
11164 |
++ break; |
11165 |
+ |
11166 |
+ /* ignore duplication for now */ |
11167 |
+- if (platform && (component == &platform->component)) |
11168 |
++ if (platform && (err_comp == &platform->component)) |
11169 |
+ continue; |
11170 |
+ |
11171 |
+- if (!component->driver->compr_ops || |
11172 |
+- !component->driver->compr_ops->free) |
11173 |
++ if (!err_comp->driver->compr_ops || |
11174 |
++ !err_comp->driver->compr_ops->free) |
11175 |
+ continue; |
11176 |
+ |
11177 |
+- component->driver->compr_ops->free(cstream); |
11178 |
++ err_comp->driver->compr_ops->free(cstream); |
11179 |
+ } |
11180 |
+ |
11181 |
+ if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) |
11182 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
11183 |
+index 68d9dc930096..d800b99ba5cc 100644 |
11184 |
+--- a/sound/soc/soc-pcm.c |
11185 |
++++ b/sound/soc/soc-pcm.c |
11186 |
+@@ -1965,8 +1965,10 @@ int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) |
11187 |
+ continue; |
11188 |
+ |
11189 |
+ if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && |
11190 |
+- (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) |
11191 |
+- continue; |
11192 |
++ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { |
11193 |
++ soc_pcm_hw_free(be_substream); |
11194 |
++ be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; |
11195 |
++ } |
11196 |
+ |
11197 |
+ dev_dbg(be->dev, "ASoC: close BE %s\n", |
11198 |
+ be->dai_link->name); |
11199 |
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c |
11200 |
+index 986b8b2f90fb..f1b4e3099513 100644 |
11201 |
+--- a/sound/soc/soc-topology.c |
11202 |
++++ b/sound/soc/soc-topology.c |
11203 |
+@@ -2006,6 +2006,13 @@ static void set_link_hw_format(struct snd_soc_dai_link *link, |
11204 |
+ |
11205 |
+ link->dai_fmt = hw_config->fmt & SND_SOC_DAIFMT_FORMAT_MASK; |
11206 |
+ |
11207 |
++ /* clock gating */ |
11208 |
++ if (hw_config->clock_gated == SND_SOC_TPLG_DAI_CLK_GATE_GATED) |
11209 |
++ link->dai_fmt |= SND_SOC_DAIFMT_GATED; |
11210 |
++ else if (hw_config->clock_gated == |
11211 |
++ SND_SOC_TPLG_DAI_CLK_GATE_CONT) |
11212 |
++ link->dai_fmt |= SND_SOC_DAIFMT_CONT; |
11213 |
++ |
11214 |
+ /* clock signal polarity */ |
11215 |
+ invert_bclk = hw_config->invert_bclk; |
11216 |
+ invert_fsync = hw_config->invert_fsync; |
11217 |
+@@ -2019,13 +2026,15 @@ static void set_link_hw_format(struct snd_soc_dai_link *link, |
11218 |
+ link->dai_fmt |= SND_SOC_DAIFMT_IB_IF; |
11219 |
+ |
11220 |
+ /* clock masters */ |
11221 |
+- bclk_master = hw_config->bclk_master; |
11222 |
+- fsync_master = hw_config->fsync_master; |
11223 |
+- if (!bclk_master && !fsync_master) |
11224 |
++ bclk_master = (hw_config->bclk_master == |
11225 |
++ SND_SOC_TPLG_BCLK_CM); |
11226 |
++ fsync_master = (hw_config->fsync_master == |
11227 |
++ SND_SOC_TPLG_FSYNC_CM); |
11228 |
++ if (bclk_master && fsync_master) |
11229 |
+ link->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; |
11230 |
+- else if (bclk_master && !fsync_master) |
11231 |
+- link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFM; |
11232 |
+ else if (!bclk_master && fsync_master) |
11233 |
++ link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFM; |
11234 |
++ else if (bclk_master && !fsync_master) |
11235 |
+ link->dai_fmt |= SND_SOC_DAIFMT_CBM_CFS; |
11236 |
+ else |
11237 |
+ link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; |
11238 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
11239 |
+index 3cbfae6604f9..d8a46d46bcd2 100644 |
11240 |
+--- a/sound/usb/pcm.c |
11241 |
++++ b/sound/usb/pcm.c |
11242 |
+@@ -1311,7 +1311,7 @@ static void retire_capture_urb(struct snd_usb_substream *subs, |
11243 |
+ if (bytes % (runtime->sample_bits >> 3) != 0) { |
11244 |
+ int oldbytes = bytes; |
11245 |
+ bytes = frames * stride; |
11246 |
+- dev_warn(&subs->dev->dev, |
11247 |
++ dev_warn_ratelimited(&subs->dev->dev, |
11248 |
+ "Corrected urb data len. %d->%d\n", |
11249 |
+ oldbytes, bytes); |
11250 |
+ } |
11251 |
+diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y |
11252 |
+index e37608a87dba..155d2570274f 100644 |
11253 |
+--- a/tools/perf/util/parse-events.y |
11254 |
++++ b/tools/perf/util/parse-events.y |
11255 |
+@@ -73,6 +73,7 @@ static void inc_group_count(struct list_head *list, |
11256 |
+ %type <num> value_sym |
11257 |
+ %type <head> event_config |
11258 |
+ %type <head> opt_event_config |
11259 |
++%type <head> opt_pmu_config |
11260 |
+ %type <term> event_term |
11261 |
+ %type <head> event_pmu |
11262 |
+ %type <head> event_legacy_symbol |
11263 |
+@@ -224,7 +225,7 @@ event_def: event_pmu | |
11264 |
+ event_bpf_file |
11265 |
+ |
11266 |
+ event_pmu: |
11267 |
+-PE_NAME opt_event_config |
11268 |
++PE_NAME opt_pmu_config |
11269 |
+ { |
11270 |
+ struct list_head *list, *orig_terms, *terms; |
11271 |
+ |
11272 |
+@@ -496,6 +497,17 @@ opt_event_config: |
11273 |
+ $$ = NULL; |
11274 |
+ } |
11275 |
+ |
11276 |
++opt_pmu_config: |
11277 |
++'/' event_config '/' |
11278 |
++{ |
11279 |
++ $$ = $2; |
11280 |
++} |
11281 |
++| |
11282 |
++'/' '/' |
11283 |
++{ |
11284 |
++ $$ = NULL; |
11285 |
++} |
11286 |
++ |
11287 |
+ start_terms: event_config |
11288 |
+ { |
11289 |
+ struct parse_events_state *parse_state = _parse_state; |
11290 |
+diff --git a/tools/testing/selftests/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile |
11291 |
+index 5c7d7001ad37..129880fb42d3 100644 |
11292 |
+--- a/tools/testing/selftests/filesystems/Makefile |
11293 |
++++ b/tools/testing/selftests/filesystems/Makefile |
11294 |
+@@ -1,5 +1,6 @@ |
11295 |
+ # SPDX-License-Identifier: GPL-2.0 |
11296 |
+ |
11297 |
++CFLAGS += -I../../../../usr/include/ |
11298 |
+ TEST_GEN_PROGS := devpts_pts |
11299 |
+ TEST_GEN_PROGS_EXTENDED := dnotify_test |
11300 |
+ |
11301 |
+diff --git a/tools/testing/selftests/filesystems/devpts_pts.c b/tools/testing/selftests/filesystems/devpts_pts.c |
11302 |
+index b9055e974289..a425840dc30c 100644 |
11303 |
+--- a/tools/testing/selftests/filesystems/devpts_pts.c |
11304 |
++++ b/tools/testing/selftests/filesystems/devpts_pts.c |
11305 |
+@@ -8,9 +8,10 @@ |
11306 |
+ #include <stdlib.h> |
11307 |
+ #include <string.h> |
11308 |
+ #include <unistd.h> |
11309 |
+-#include <sys/ioctl.h> |
11310 |
++#include <asm/ioctls.h> |
11311 |
+ #include <sys/mount.h> |
11312 |
+ #include <sys/wait.h> |
11313 |
++#include "../kselftest.h" |
11314 |
+ |
11315 |
+ static bool terminal_dup2(int duplicate, int original) |
11316 |
+ { |
11317 |
+@@ -125,10 +126,12 @@ static int do_tiocgptpeer(char *ptmx, char *expected_procfd_contents) |
11318 |
+ if (errno == EINVAL) { |
11319 |
+ fprintf(stderr, "TIOCGPTPEER is not supported. " |
11320 |
+ "Skipping test.\n"); |
11321 |
+- fret = EXIT_SUCCESS; |
11322 |
++ fret = KSFT_SKIP; |
11323 |
++ } else { |
11324 |
++ fprintf(stderr, |
11325 |
++ "Failed to perform TIOCGPTPEER ioctl\n"); |
11326 |
++ fret = EXIT_FAILURE; |
11327 |
+ } |
11328 |
+- |
11329 |
+- fprintf(stderr, "Failed to perform TIOCGPTPEER ioctl\n"); |
11330 |
+ goto do_cleanup; |
11331 |
+ } |
11332 |
+ |
11333 |
+@@ -281,7 +284,7 @@ int main(int argc, char *argv[]) |
11334 |
+ if (!isatty(STDIN_FILENO)) { |
11335 |
+ fprintf(stderr, "Standard input file desciptor is not attached " |
11336 |
+ "to a terminal. Skipping test\n"); |
11337 |
+- exit(EXIT_FAILURE); |
11338 |
++ exit(KSFT_SKIP); |
11339 |
+ } |
11340 |
+ |
11341 |
+ ret = unshare(CLONE_NEWNS); |
11342 |
+diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh |
11343 |
+index c670359becc6..928978804342 100755 |
11344 |
+--- a/tools/testing/selftests/intel_pstate/run.sh |
11345 |
++++ b/tools/testing/selftests/intel_pstate/run.sh |
11346 |
+@@ -30,9 +30,12 @@ |
11347 |
+ |
11348 |
+ EVALUATE_ONLY=0 |
11349 |
+ |
11350 |
++# Kselftest framework requirement - SKIP code is 4. |
11351 |
++ksft_skip=4 |
11352 |
++ |
11353 |
+ if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then |
11354 |
+ echo "$0 # Skipped: Test can only run on x86 architectures." |
11355 |
+- exit 0 |
11356 |
++ exit $ksft_skip |
11357 |
+ fi |
11358 |
+ |
11359 |
+ max_cpus=$(($(nproc)-1)) |
11360 |
+@@ -48,11 +51,12 @@ function run_test () { |
11361 |
+ |
11362 |
+ echo "sleeping for 5 seconds" |
11363 |
+ sleep 5 |
11364 |
+- num_freqs=$(cat /proc/cpuinfo | grep MHz | sort -u | wc -l) |
11365 |
+- if [ $num_freqs -le 2 ]; then |
11366 |
+- cat /proc/cpuinfo | grep MHz | sort -u | tail -1 > /tmp/result.$1 |
11367 |
++ grep MHz /proc/cpuinfo | sort -u > /tmp/result.freqs |
11368 |
++ num_freqs=$(wc -l /tmp/result.freqs | awk ' { print $1 } ') |
11369 |
++ if [ $num_freqs -ge 2 ]; then |
11370 |
++ tail -n 1 /tmp/result.freqs > /tmp/result.$1 |
11371 |
+ else |
11372 |
+- cat /proc/cpuinfo | grep MHz | sort -u > /tmp/result.$1 |
11373 |
++ cp /tmp/result.freqs /tmp/result.$1 |
11374 |
+ fi |
11375 |
+ ./msr 0 >> /tmp/result.$1 |
11376 |
+ |
11377 |
+@@ -82,21 +86,20 @@ _max_freq=$(cpupower frequency-info -l | tail -1 | awk ' { print $2 } ') |
11378 |
+ max_freq=$(($_max_freq / 1000)) |
11379 |
+ |
11380 |
+ |
11381 |
+-for freq in `seq $max_freq -100 $min_freq` |
11382 |
++[ $EVALUATE_ONLY -eq 0 ] && for freq in `seq $max_freq -100 $min_freq` |
11383 |
+ do |
11384 |
+ echo "Setting maximum frequency to $freq" |
11385 |
+ cpupower frequency-set -g powersave --max=${freq}MHz >& /dev/null |
11386 |
+- [ $EVALUATE_ONLY -eq 0 ] && run_test $freq |
11387 |
++ run_test $freq |
11388 |
+ done |
11389 |
+ |
11390 |
+-echo "==============================================================================" |
11391 |
++[ $EVALUATE_ONLY -eq 0 ] && cpupower frequency-set -g powersave --max=${max_freq}MHz >& /dev/null |
11392 |
+ |
11393 |
++echo "==============================================================================" |
11394 |
+ echo "The marketing frequency of the cpu is $mkt_freq MHz" |
11395 |
+ echo "The maximum frequency of the cpu is $max_freq MHz" |
11396 |
+ echo "The minimum frequency of the cpu is $min_freq MHz" |
11397 |
+ |
11398 |
+-cpupower frequency-set -g powersave --max=${max_freq}MHz >& /dev/null |
11399 |
+- |
11400 |
+ # make a pretty table |
11401 |
+ echo "Target Actual Difference MSR(0x199) max_perf_pct" |
11402 |
+ for freq in `seq $max_freq -100 $min_freq` |
11403 |
+@@ -104,10 +107,6 @@ do |
11404 |
+ result_freq=$(cat /tmp/result.${freq} | grep "cpu MHz" | awk ' { print $4 } ' | awk -F "." ' { print $1 } ') |
11405 |
+ msr=$(cat /tmp/result.${freq} | grep "msr" | awk ' { print $3 } ') |
11406 |
+ max_perf_pct=$(cat /tmp/result.${freq} | grep "max_perf_pct" | awk ' { print $2 } ' ) |
11407 |
+- if [ $result_freq -eq $freq ]; then |
11408 |
+- echo " $freq $result_freq 0 $msr $(($max_perf_pct*3300))" |
11409 |
+- else |
11410 |
+- echo " $freq $result_freq $(($result_freq-$freq)) $msr $(($max_perf_pct*$max_freq))" |
11411 |
+- fi |
11412 |
++ echo " $freq $result_freq $(($result_freq-$freq)) $msr $(($max_perf_pct*$max_freq))" |
11413 |
+ done |
11414 |
+ exit 0 |
11415 |
+diff --git a/tools/testing/selftests/kvm/lib/assert.c b/tools/testing/selftests/kvm/lib/assert.c |
11416 |
+index c9f5b7d4ce38..cd01144d27c8 100644 |
11417 |
+--- a/tools/testing/selftests/kvm/lib/assert.c |
11418 |
++++ b/tools/testing/selftests/kvm/lib/assert.c |
11419 |
+@@ -13,6 +13,8 @@ |
11420 |
+ #include <execinfo.h> |
11421 |
+ #include <sys/syscall.h> |
11422 |
+ |
11423 |
++#include "../../kselftest.h" |
11424 |
++ |
11425 |
+ /* Dumps the current stack trace to stderr. */ |
11426 |
+ static void __attribute__((noinline)) test_dump_stack(void); |
11427 |
+ static void test_dump_stack(void) |
11428 |
+@@ -70,8 +72,9 @@ test_assert(bool exp, const char *exp_str, |
11429 |
+ |
11430 |
+ fprintf(stderr, "==== Test Assertion Failure ====\n" |
11431 |
+ " %s:%u: %s\n" |
11432 |
+- " pid=%d tid=%d\n", |
11433 |
+- file, line, exp_str, getpid(), gettid()); |
11434 |
++ " pid=%d tid=%d - %s\n", |
11435 |
++ file, line, exp_str, getpid(), gettid(), |
11436 |
++ strerror(errno)); |
11437 |
+ test_dump_stack(); |
11438 |
+ if (fmt) { |
11439 |
+ fputs(" ", stderr); |
11440 |
+@@ -80,6 +83,8 @@ test_assert(bool exp, const char *exp_str, |
11441 |
+ } |
11442 |
+ va_end(ap); |
11443 |
+ |
11444 |
++ if (errno == EACCES) |
11445 |
++ ksft_exit_skip("Access denied - Exiting.\n"); |
11446 |
+ exit(254); |
11447 |
+ } |
11448 |
+ |
11449 |
+diff --git a/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c b/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c |
11450 |
+index aaa633263b2c..d7cb7944a42e 100644 |
11451 |
+--- a/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c |
11452 |
++++ b/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c |
11453 |
+@@ -28,6 +28,8 @@ |
11454 |
+ #include <string.h> |
11455 |
+ #include <sys/ioctl.h> |
11456 |
+ |
11457 |
++#include "../kselftest.h" |
11458 |
++ |
11459 |
+ #ifndef MSR_IA32_TSC_ADJUST |
11460 |
+ #define MSR_IA32_TSC_ADJUST 0x3b |
11461 |
+ #endif |
11462 |
+diff --git a/tools/testing/selftests/memfd/run_tests.sh b/tools/testing/selftests/memfd/run_tests.sh |
11463 |
+index c2d41ed81b24..2013f195e623 100755 |
11464 |
+--- a/tools/testing/selftests/memfd/run_tests.sh |
11465 |
++++ b/tools/testing/selftests/memfd/run_tests.sh |
11466 |
+@@ -1,6 +1,9 @@ |
11467 |
+ #!/bin/bash |
11468 |
+ # please run as root |
11469 |
+ |
11470 |
++# Kselftest framework requirement - SKIP code is 4. |
11471 |
++ksft_skip=4 |
11472 |
++ |
11473 |
+ # |
11474 |
+ # Normal tests requiring no special resources |
11475 |
+ # |
11476 |
+@@ -29,12 +32,13 @@ if [ -n "$freepgs" ] && [ $freepgs -lt $hpages_test ]; then |
11477 |
+ nr_hugepgs=`cat /proc/sys/vm/nr_hugepages` |
11478 |
+ hpages_needed=`expr $hpages_test - $freepgs` |
11479 |
+ |
11480 |
++ if [ $UID != 0 ]; then |
11481 |
++ echo "Please run memfd with hugetlbfs test as root" |
11482 |
++ exit $ksft_skip |
11483 |
++ fi |
11484 |
++ |
11485 |
+ echo 3 > /proc/sys/vm/drop_caches |
11486 |
+ echo $(( $hpages_needed + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages |
11487 |
+- if [ $? -ne 0 ]; then |
11488 |
+- echo "Please run this test as root" |
11489 |
+- exit 1 |
11490 |
+- fi |
11491 |
+ while read name size unit; do |
11492 |
+ if [ "$name" = "HugePages_Free:" ]; then |
11493 |
+ freepgs=$size |
11494 |
+@@ -53,7 +57,7 @@ if [ $freepgs -lt $hpages_test ]; then |
11495 |
+ fi |
11496 |
+ printf "Not enough huge pages available (%d < %d)\n" \ |
11497 |
+ $freepgs $needpgs |
11498 |
+- exit 1 |
11499 |
++ exit $ksft_skip |
11500 |
+ fi |
11501 |
+ |
11502 |
+ # |
11503 |
+diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c |
11504 |
+index c9c81614a66a..4204359c9fee 100644 |
11505 |
+--- a/tools/usb/usbip/libsrc/vhci_driver.c |
11506 |
++++ b/tools/usb/usbip/libsrc/vhci_driver.c |
11507 |
+@@ -135,11 +135,11 @@ static int refresh_imported_device_list(void) |
11508 |
+ return 0; |
11509 |
+ } |
11510 |
+ |
11511 |
+-static int get_nports(void) |
11512 |
++static int get_nports(struct udev_device *hc_device) |
11513 |
+ { |
11514 |
+ const char *attr_nports; |
11515 |
+ |
11516 |
+- attr_nports = udev_device_get_sysattr_value(vhci_driver->hc_device, "nports"); |
11517 |
++ attr_nports = udev_device_get_sysattr_value(hc_device, "nports"); |
11518 |
+ if (!attr_nports) { |
11519 |
+ err("udev_device_get_sysattr_value nports failed"); |
11520 |
+ return -1; |
11521 |
+@@ -242,35 +242,41 @@ static int read_record(int rhport, char *host, unsigned long host_len, |
11522 |
+ |
11523 |
+ int usbip_vhci_driver_open(void) |
11524 |
+ { |
11525 |
++ int nports; |
11526 |
++ struct udev_device *hc_device; |
11527 |
++ |
11528 |
+ udev_context = udev_new(); |
11529 |
+ if (!udev_context) { |
11530 |
+ err("udev_new failed"); |
11531 |
+ return -1; |
11532 |
+ } |
11533 |
+ |
11534 |
+- vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver)); |
11535 |
+- |
11536 |
+ /* will be freed in usbip_driver_close() */ |
11537 |
+- vhci_driver->hc_device = |
11538 |
++ hc_device = |
11539 |
+ udev_device_new_from_subsystem_sysname(udev_context, |
11540 |
+ USBIP_VHCI_BUS_TYPE, |
11541 |
+ USBIP_VHCI_DEVICE_NAME); |
11542 |
+- if (!vhci_driver->hc_device) { |
11543 |
++ if (!hc_device) { |
11544 |
+ err("udev_device_new_from_subsystem_sysname failed"); |
11545 |
+ goto err; |
11546 |
+ } |
11547 |
+ |
11548 |
+- vhci_driver->nports = get_nports(); |
11549 |
+- dbg("available ports: %d", vhci_driver->nports); |
11550 |
+- |
11551 |
+- if (vhci_driver->nports <= 0) { |
11552 |
++ nports = get_nports(hc_device); |
11553 |
++ if (nports <= 0) { |
11554 |
+ err("no available ports"); |
11555 |
+ goto err; |
11556 |
+- } else if (vhci_driver->nports > MAXNPORT) { |
11557 |
+- err("port number exceeds %d", MAXNPORT); |
11558 |
++ } |
11559 |
++ dbg("available ports: %d", nports); |
11560 |
++ |
11561 |
++ vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver) + |
11562 |
++ nports * sizeof(struct usbip_imported_device)); |
11563 |
++ if (!vhci_driver) { |
11564 |
++ err("vhci_driver allocation failed"); |
11565 |
+ goto err; |
11566 |
+ } |
11567 |
+ |
11568 |
++ vhci_driver->nports = nports; |
11569 |
++ vhci_driver->hc_device = hc_device; |
11570 |
+ vhci_driver->ncontrollers = get_ncontrollers(); |
11571 |
+ dbg("available controllers: %d", vhci_driver->ncontrollers); |
11572 |
+ |
11573 |
+@@ -285,7 +291,7 @@ int usbip_vhci_driver_open(void) |
11574 |
+ return 0; |
11575 |
+ |
11576 |
+ err: |
11577 |
+- udev_device_unref(vhci_driver->hc_device); |
11578 |
++ udev_device_unref(hc_device); |
11579 |
+ |
11580 |
+ if (vhci_driver) |
11581 |
+ free(vhci_driver); |
11582 |
+diff --git a/tools/usb/usbip/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h |
11583 |
+index 418b404d5121..6c9aca216705 100644 |
11584 |
+--- a/tools/usb/usbip/libsrc/vhci_driver.h |
11585 |
++++ b/tools/usb/usbip/libsrc/vhci_driver.h |
11586 |
+@@ -13,7 +13,6 @@ |
11587 |
+ |
11588 |
+ #define USBIP_VHCI_BUS_TYPE "platform" |
11589 |
+ #define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0" |
11590 |
+-#define MAXNPORT 128 |
11591 |
+ |
11592 |
+ enum hub_speed { |
11593 |
+ HUB_SPEED_HIGH = 0, |
11594 |
+@@ -41,7 +40,7 @@ struct usbip_vhci_driver { |
11595 |
+ |
11596 |
+ int ncontrollers; |
11597 |
+ int nports; |
11598 |
+- struct usbip_imported_device idev[MAXNPORT]; |
11599 |
++ struct usbip_imported_device idev[]; |
11600 |
+ }; |
11601 |
+ |
11602 |
+ |
11603 |
+diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c |
11604 |
+index 9db9d21bb2ec..6a8db858caa5 100644 |
11605 |
+--- a/tools/usb/usbip/src/usbip_detach.c |
11606 |
++++ b/tools/usb/usbip/src/usbip_detach.c |
11607 |
+@@ -43,7 +43,7 @@ void usbip_detach_usage(void) |
11608 |
+ |
11609 |
+ static int detach_port(char *port) |
11610 |
+ { |
11611 |
+- int ret; |
11612 |
++ int ret = 0; |
11613 |
+ uint8_t portnum; |
11614 |
+ char path[PATH_MAX+1]; |
11615 |
+ |
11616 |
+@@ -73,9 +73,12 @@ static int detach_port(char *port) |
11617 |
+ } |
11618 |
+ |
11619 |
+ ret = usbip_vhci_detach_device(portnum); |
11620 |
+- if (ret < 0) |
11621 |
+- return -1; |
11622 |
++ if (ret < 0) { |
11623 |
++ ret = -1; |
11624 |
++ goto call_driver_close; |
11625 |
++ } |
11626 |
+ |
11627 |
++call_driver_close: |
11628 |
+ usbip_vhci_driver_close(); |
11629 |
+ |
11630 |
+ return ret; |