1 |
commit: af2b20a2aff29338c1974510f50b2b97f1c7cead |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 19 09:15:23 2020 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 19 09:16:02 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=af2b20a2 |
7 |
|
8 |
Linux patch 5.8.2 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1001_linux-5.8.2.patch | 17484 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 17488 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 8e9f53b..2409f92 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -47,6 +47,10 @@ Patch: 1000_linux-5.8.1.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.8.1 |
23 |
|
24 |
+Patch: 1001_linux-5.8.2.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.8.2 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1001_linux-5.8.2.patch b/1001_linux-5.8.2.patch |
33 |
new file mode 100644 |
34 |
index 0000000..e74313e |
35 |
--- /dev/null |
36 |
+++ b/1001_linux-5.8.2.patch |
37 |
@@ -0,0 +1,17484 @@ |
38 |
+diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio |
39 |
+index d3e53a6d8331..5c62bfb0f3f5 100644 |
40 |
+--- a/Documentation/ABI/testing/sysfs-bus-iio |
41 |
++++ b/Documentation/ABI/testing/sysfs-bus-iio |
42 |
+@@ -1569,7 +1569,8 @@ What: /sys/bus/iio/devices/iio:deviceX/in_concentrationX_voc_raw |
43 |
+ KernelVersion: 4.3 |
44 |
+ Contact: linux-iio@×××××××××××.org |
45 |
+ Description: |
46 |
+- Raw (unscaled no offset etc.) percentage reading of a substance. |
47 |
++ Raw (unscaled no offset etc.) reading of a substance. Units |
48 |
++ after application of scale and offset are percents. |
49 |
+ |
50 |
+ What: /sys/bus/iio/devices/iio:deviceX/in_resistance_raw |
51 |
+ What: /sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw |
52 |
+diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst |
53 |
+index 4a50ab7817f7..b1ae1ac159cf 100644 |
54 |
+--- a/Documentation/core-api/cpu_hotplug.rst |
55 |
++++ b/Documentation/core-api/cpu_hotplug.rst |
56 |
+@@ -50,13 +50,6 @@ Command Line Switches |
57 |
+ |
58 |
+ This option is limited to the X86 and S390 architecture. |
59 |
+ |
60 |
+-``cede_offline={"off","on"}`` |
61 |
+- Use this option to disable/enable putting offlined processors to an extended |
62 |
+- ``H_CEDE`` state on supported pseries platforms. If nothing is specified, |
63 |
+- ``cede_offline`` is set to "on". |
64 |
+- |
65 |
+- This option is limited to the PowerPC architecture. |
66 |
+- |
67 |
+ ``cpu0_hotplug`` |
68 |
+ Allow to shutdown CPU0. |
69 |
+ |
70 |
+diff --git a/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml b/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml |
71 |
+index f88d36207b87..c871d462c952 100644 |
72 |
+--- a/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml |
73 |
++++ b/Documentation/devicetree/bindings/phy/socionext,uniphier-usb3hs-phy.yaml |
74 |
+@@ -31,12 +31,16 @@ properties: |
75 |
+ |
76 |
+ clocks: |
77 |
+ minItems: 1 |
78 |
+- maxItems: 2 |
79 |
++ maxItems: 3 |
80 |
+ |
81 |
+ clock-names: |
82 |
+ oneOf: |
83 |
+ - const: link # for PXs2 |
84 |
+- - items: # for PXs3 |
85 |
++ - items: # for PXs3 with phy-ext |
86 |
++ - const: link |
87 |
++ - const: phy |
88 |
++ - const: phy-ext |
89 |
++ - items: # for others |
90 |
+ - const: link |
91 |
+ - const: phy |
92 |
+ |
93 |
+diff --git a/Makefile b/Makefile |
94 |
+index 7932464518f1..6940f82a15cc 100644 |
95 |
+--- a/Makefile |
96 |
++++ b/Makefile |
97 |
+@@ -1,7 +1,7 @@ |
98 |
+ # SPDX-License-Identifier: GPL-2.0 |
99 |
+ VERSION = 5 |
100 |
+ PATCHLEVEL = 8 |
101 |
+-SUBLEVEL = 1 |
102 |
++SUBLEVEL = 2 |
103 |
+ EXTRAVERSION = |
104 |
+ NAME = Kleptomaniac Octopus |
105 |
+ |
106 |
+diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
107 |
+index 61f068a7b362..7abf555cd2fe 100644 |
108 |
+--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
109 |
++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
110 |
+@@ -128,7 +128,7 @@ |
111 |
+ }; |
112 |
+ |
113 |
+ macb0: ethernet@f0028000 { |
114 |
+- phy-mode = "rgmii"; |
115 |
++ phy-mode = "rgmii-rxid"; |
116 |
+ #address-cells = <1>; |
117 |
+ #size-cells = <0>; |
118 |
+ status = "okay"; |
119 |
+diff --git a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
120 |
+index ab27ff8bc3dc..afe090578e8f 100644 |
121 |
+--- a/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
122 |
++++ b/arch/arm/boot/dts/exynos5422-odroid-core.dtsi |
123 |
+@@ -411,12 +411,6 @@ |
124 |
+ status = "okay"; |
125 |
+ }; |
126 |
+ |
127 |
+-&bus_fsys { |
128 |
+- operating-points-v2 = <&bus_fsys2_opp_table>; |
129 |
+- devfreq = <&bus_wcore>; |
130 |
+- status = "okay"; |
131 |
+-}; |
132 |
+- |
133 |
+ &bus_fsys2 { |
134 |
+ operating-points-v2 = <&bus_fsys2_opp_table>; |
135 |
+ devfreq = <&bus_wcore>; |
136 |
+diff --git a/arch/arm/boot/dts/exynos5800.dtsi b/arch/arm/boot/dts/exynos5800.dtsi |
137 |
+index dfb99ab53c3e..526729dad53f 100644 |
138 |
+--- a/arch/arm/boot/dts/exynos5800.dtsi |
139 |
++++ b/arch/arm/boot/dts/exynos5800.dtsi |
140 |
+@@ -23,17 +23,17 @@ |
141 |
+ &cluster_a15_opp_table { |
142 |
+ opp-2000000000 { |
143 |
+ opp-hz = /bits/ 64 <2000000000>; |
144 |
+- opp-microvolt = <1312500>; |
145 |
++ opp-microvolt = <1312500 1312500 1500000>; |
146 |
+ clock-latency-ns = <140000>; |
147 |
+ }; |
148 |
+ opp-1900000000 { |
149 |
+ opp-hz = /bits/ 64 <1900000000>; |
150 |
+- opp-microvolt = <1262500>; |
151 |
++ opp-microvolt = <1262500 1262500 1500000>; |
152 |
+ clock-latency-ns = <140000>; |
153 |
+ }; |
154 |
+ opp-1800000000 { |
155 |
+ opp-hz = /bits/ 64 <1800000000>; |
156 |
+- opp-microvolt = <1237500>; |
157 |
++ opp-microvolt = <1237500 1237500 1500000>; |
158 |
+ clock-latency-ns = <140000>; |
159 |
+ }; |
160 |
+ opp-1700000000 { |
161 |
+diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts |
162 |
+index 79baf06019f5..10c3536b8e3d 100644 |
163 |
+--- a/arch/arm/boot/dts/r8a7793-gose.dts |
164 |
++++ b/arch/arm/boot/dts/r8a7793-gose.dts |
165 |
+@@ -336,7 +336,7 @@ |
166 |
+ reg = <0x20>; |
167 |
+ remote = <&vin1>; |
168 |
+ |
169 |
+- port { |
170 |
++ ports { |
171 |
+ #address-cells = <1>; |
172 |
+ #size-cells = <0>; |
173 |
+ |
174 |
+@@ -394,7 +394,7 @@ |
175 |
+ interrupts = <2 IRQ_TYPE_LEVEL_LOW>; |
176 |
+ default-input = <0>; |
177 |
+ |
178 |
+- port { |
179 |
++ ports { |
180 |
+ #address-cells = <1>; |
181 |
+ #size-cells = <0>; |
182 |
+ |
183 |
+diff --git a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi |
184 |
+index 7eb858732d6d..cc505458da2f 100644 |
185 |
+--- a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi |
186 |
++++ b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi |
187 |
+@@ -1574,143 +1574,157 @@ |
188 |
+ }; |
189 |
+ }; |
190 |
+ |
191 |
+- usart2_pins_a: usart2-0 { |
192 |
++ uart4_pins_a: uart4-0 { |
193 |
+ pins1 { |
194 |
+- pinmux = <STM32_PINMUX('F', 5, AF7)>, /* USART2_TX */ |
195 |
+- <STM32_PINMUX('D', 4, AF7)>; /* USART2_RTS */ |
196 |
++ pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */ |
197 |
+ bias-disable; |
198 |
+ drive-push-pull; |
199 |
+ slew-rate = <0>; |
200 |
+ }; |
201 |
+ pins2 { |
202 |
+- pinmux = <STM32_PINMUX('D', 6, AF7)>, /* USART2_RX */ |
203 |
+- <STM32_PINMUX('D', 3, AF7)>; /* USART2_CTS_NSS */ |
204 |
++ pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */ |
205 |
+ bias-disable; |
206 |
+ }; |
207 |
+ }; |
208 |
+ |
209 |
+- usart2_sleep_pins_a: usart2-sleep-0 { |
210 |
+- pins { |
211 |
+- pinmux = <STM32_PINMUX('F', 5, ANALOG)>, /* USART2_TX */ |
212 |
+- <STM32_PINMUX('D', 4, ANALOG)>, /* USART2_RTS */ |
213 |
+- <STM32_PINMUX('D', 6, ANALOG)>, /* USART2_RX */ |
214 |
+- <STM32_PINMUX('D', 3, ANALOG)>; /* USART2_CTS_NSS */ |
215 |
+- }; |
216 |
+- }; |
217 |
+- |
218 |
+- usart2_pins_b: usart2-1 { |
219 |
++ uart4_pins_b: uart4-1 { |
220 |
+ pins1 { |
221 |
+- pinmux = <STM32_PINMUX('F', 5, AF7)>, /* USART2_TX */ |
222 |
+- <STM32_PINMUX('A', 1, AF7)>; /* USART2_RTS */ |
223 |
++ pinmux = <STM32_PINMUX('D', 1, AF8)>; /* UART4_TX */ |
224 |
+ bias-disable; |
225 |
+ drive-push-pull; |
226 |
+ slew-rate = <0>; |
227 |
+ }; |
228 |
+ pins2 { |
229 |
+- pinmux = <STM32_PINMUX('F', 4, AF7)>, /* USART2_RX */ |
230 |
+- <STM32_PINMUX('E', 15, AF7)>; /* USART2_CTS_NSS */ |
231 |
++ pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */ |
232 |
+ bias-disable; |
233 |
+ }; |
234 |
+ }; |
235 |
+ |
236 |
+- usart2_sleep_pins_b: usart2-sleep-1 { |
237 |
+- pins { |
238 |
+- pinmux = <STM32_PINMUX('F', 5, ANALOG)>, /* USART2_TX */ |
239 |
+- <STM32_PINMUX('A', 1, ANALOG)>, /* USART2_RTS */ |
240 |
+- <STM32_PINMUX('F', 4, ANALOG)>, /* USART2_RX */ |
241 |
+- <STM32_PINMUX('E', 15, ANALOG)>; /* USART2_CTS_NSS */ |
242 |
++ uart4_pins_c: uart4-2 { |
243 |
++ pins1 { |
244 |
++ pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */ |
245 |
++ bias-disable; |
246 |
++ drive-push-pull; |
247 |
++ slew-rate = <0>; |
248 |
++ }; |
249 |
++ pins2 { |
250 |
++ pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */ |
251 |
++ bias-disable; |
252 |
+ }; |
253 |
+ }; |
254 |
+ |
255 |
+- usart3_pins_a: usart3-0 { |
256 |
++ uart7_pins_a: uart7-0 { |
257 |
+ pins1 { |
258 |
+- pinmux = <STM32_PINMUX('B', 10, AF7)>; /* USART3_TX */ |
259 |
++ pinmux = <STM32_PINMUX('E', 8, AF7)>; /* UART7_TX */ |
260 |
+ bias-disable; |
261 |
+ drive-push-pull; |
262 |
+ slew-rate = <0>; |
263 |
+ }; |
264 |
+ pins2 { |
265 |
+- pinmux = <STM32_PINMUX('B', 12, AF8)>; /* USART3_RX */ |
266 |
++ pinmux = <STM32_PINMUX('E', 7, AF7)>, /* UART7_RX */ |
267 |
++ <STM32_PINMUX('E', 10, AF7)>, /* UART7_CTS */ |
268 |
++ <STM32_PINMUX('E', 9, AF7)>; /* UART7_RTS */ |
269 |
+ bias-disable; |
270 |
+ }; |
271 |
+ }; |
272 |
+ |
273 |
+- uart4_pins_a: uart4-0 { |
274 |
++ uart7_pins_b: uart7-1 { |
275 |
+ pins1 { |
276 |
+- pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */ |
277 |
++ pinmux = <STM32_PINMUX('F', 7, AF7)>; /* UART7_TX */ |
278 |
+ bias-disable; |
279 |
+ drive-push-pull; |
280 |
+ slew-rate = <0>; |
281 |
+ }; |
282 |
+ pins2 { |
283 |
+- pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */ |
284 |
++ pinmux = <STM32_PINMUX('F', 6, AF7)>; /* UART7_RX */ |
285 |
+ bias-disable; |
286 |
+ }; |
287 |
+ }; |
288 |
+ |
289 |
+- uart4_pins_b: uart4-1 { |
290 |
++ uart8_pins_a: uart8-0 { |
291 |
+ pins1 { |
292 |
+- pinmux = <STM32_PINMUX('D', 1, AF8)>; /* UART4_TX */ |
293 |
++ pinmux = <STM32_PINMUX('E', 1, AF8)>; /* UART8_TX */ |
294 |
+ bias-disable; |
295 |
+ drive-push-pull; |
296 |
+ slew-rate = <0>; |
297 |
+ }; |
298 |
+ pins2 { |
299 |
+- pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */ |
300 |
++ pinmux = <STM32_PINMUX('E', 0, AF8)>; /* UART8_RX */ |
301 |
+ bias-disable; |
302 |
+ }; |
303 |
+ }; |
304 |
+ |
305 |
+- uart4_pins_c: uart4-2 { |
306 |
+- pins1 { |
307 |
+- pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */ |
308 |
++ spi4_pins_a: spi4-0 { |
309 |
++ pins { |
310 |
++ pinmux = <STM32_PINMUX('E', 12, AF5)>, /* SPI4_SCK */ |
311 |
++ <STM32_PINMUX('E', 6, AF5)>; /* SPI4_MOSI */ |
312 |
+ bias-disable; |
313 |
+ drive-push-pull; |
314 |
+- slew-rate = <0>; |
315 |
++ slew-rate = <1>; |
316 |
+ }; |
317 |
+ pins2 { |
318 |
+- pinmux = <STM32_PINMUX('B', 2, AF8)>; /* UART4_RX */ |
319 |
++ pinmux = <STM32_PINMUX('E', 13, AF5)>; /* SPI4_MISO */ |
320 |
+ bias-disable; |
321 |
+ }; |
322 |
+ }; |
323 |
+ |
324 |
+- uart7_pins_a: uart7-0 { |
325 |
++ usart2_pins_a: usart2-0 { |
326 |
+ pins1 { |
327 |
+- pinmux = <STM32_PINMUX('E', 8, AF7)>; /* UART4_TX */ |
328 |
++ pinmux = <STM32_PINMUX('F', 5, AF7)>, /* USART2_TX */ |
329 |
++ <STM32_PINMUX('D', 4, AF7)>; /* USART2_RTS */ |
330 |
+ bias-disable; |
331 |
+ drive-push-pull; |
332 |
+ slew-rate = <0>; |
333 |
+ }; |
334 |
+ pins2 { |
335 |
+- pinmux = <STM32_PINMUX('E', 7, AF7)>, /* UART4_RX */ |
336 |
+- <STM32_PINMUX('E', 10, AF7)>, /* UART4_CTS */ |
337 |
+- <STM32_PINMUX('E', 9, AF7)>; /* UART4_RTS */ |
338 |
++ pinmux = <STM32_PINMUX('D', 6, AF7)>, /* USART2_RX */ |
339 |
++ <STM32_PINMUX('D', 3, AF7)>; /* USART2_CTS_NSS */ |
340 |
+ bias-disable; |
341 |
+ }; |
342 |
+ }; |
343 |
+ |
344 |
+- uart7_pins_b: uart7-1 { |
345 |
++ usart2_sleep_pins_a: usart2-sleep-0 { |
346 |
++ pins { |
347 |
++ pinmux = <STM32_PINMUX('F', 5, ANALOG)>, /* USART2_TX */ |
348 |
++ <STM32_PINMUX('D', 4, ANALOG)>, /* USART2_RTS */ |
349 |
++ <STM32_PINMUX('D', 6, ANALOG)>, /* USART2_RX */ |
350 |
++ <STM32_PINMUX('D', 3, ANALOG)>; /* USART2_CTS_NSS */ |
351 |
++ }; |
352 |
++ }; |
353 |
++ |
354 |
++ usart2_pins_b: usart2-1 { |
355 |
+ pins1 { |
356 |
+- pinmux = <STM32_PINMUX('F', 7, AF7)>; /* UART7_TX */ |
357 |
++ pinmux = <STM32_PINMUX('F', 5, AF7)>, /* USART2_TX */ |
358 |
++ <STM32_PINMUX('A', 1, AF7)>; /* USART2_RTS */ |
359 |
+ bias-disable; |
360 |
+ drive-push-pull; |
361 |
+ slew-rate = <0>; |
362 |
+ }; |
363 |
+ pins2 { |
364 |
+- pinmux = <STM32_PINMUX('F', 6, AF7)>; /* UART7_RX */ |
365 |
++ pinmux = <STM32_PINMUX('F', 4, AF7)>, /* USART2_RX */ |
366 |
++ <STM32_PINMUX('E', 15, AF7)>; /* USART2_CTS_NSS */ |
367 |
+ bias-disable; |
368 |
+ }; |
369 |
+ }; |
370 |
+ |
371 |
+- uart8_pins_a: uart8-0 { |
372 |
++ usart2_sleep_pins_b: usart2-sleep-1 { |
373 |
++ pins { |
374 |
++ pinmux = <STM32_PINMUX('F', 5, ANALOG)>, /* USART2_TX */ |
375 |
++ <STM32_PINMUX('A', 1, ANALOG)>, /* USART2_RTS */ |
376 |
++ <STM32_PINMUX('F', 4, ANALOG)>, /* USART2_RX */ |
377 |
++ <STM32_PINMUX('E', 15, ANALOG)>; /* USART2_CTS_NSS */ |
378 |
++ }; |
379 |
++ }; |
380 |
++ |
381 |
++ usart3_pins_a: usart3-0 { |
382 |
+ pins1 { |
383 |
+- pinmux = <STM32_PINMUX('E', 1, AF8)>; /* UART8_TX */ |
384 |
++ pinmux = <STM32_PINMUX('B', 10, AF7)>; /* USART3_TX */ |
385 |
+ bias-disable; |
386 |
+ drive-push-pull; |
387 |
+ slew-rate = <0>; |
388 |
+ }; |
389 |
+ pins2 { |
390 |
+- pinmux = <STM32_PINMUX('E', 0, AF8)>; /* UART8_RX */ |
391 |
++ pinmux = <STM32_PINMUX('B', 12, AF8)>; /* USART3_RX */ |
392 |
+ bias-disable; |
393 |
+ }; |
394 |
+ }; |
395 |
+@@ -1776,18 +1790,4 @@ |
396 |
+ bias-disable; |
397 |
+ }; |
398 |
+ }; |
399 |
+- |
400 |
+- spi4_pins_a: spi4-0 { |
401 |
+- pins { |
402 |
+- pinmux = <STM32_PINMUX('E', 12, AF5)>, /* SPI4_SCK */ |
403 |
+- <STM32_PINMUX('E', 6, AF5)>; /* SPI4_MOSI */ |
404 |
+- bias-disable; |
405 |
+- drive-push-pull; |
406 |
+- slew-rate = <1>; |
407 |
+- }; |
408 |
+- pins2 { |
409 |
+- pinmux = <STM32_PINMUX('E', 13, AF5)>; /* SPI4_MISO */ |
410 |
+- bias-disable; |
411 |
+- }; |
412 |
+- }; |
413 |
+ }; |
414 |
+diff --git a/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi b/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi |
415 |
+index 22466afd38a3..235994a4a2eb 100644 |
416 |
+--- a/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi |
417 |
++++ b/arch/arm/boot/dts/sunxi-bananapi-m2-plus-v1.2.dtsi |
418 |
+@@ -16,15 +16,27 @@ |
419 |
+ regulator-type = "voltage"; |
420 |
+ regulator-boot-on; |
421 |
+ regulator-always-on; |
422 |
+- regulator-min-microvolt = <1100000>; |
423 |
+- regulator-max-microvolt = <1300000>; |
424 |
++ regulator-min-microvolt = <1108475>; |
425 |
++ regulator-max-microvolt = <1308475>; |
426 |
+ regulator-ramp-delay = <50>; /* 4ms */ |
427 |
+ gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */ |
428 |
+ gpios-states = <0x1>; |
429 |
+- states = <1100000 0>, <1300000 1>; |
430 |
++ states = <1108475 0>, <1308475 1>; |
431 |
+ }; |
432 |
+ }; |
433 |
+ |
434 |
+ &cpu0 { |
435 |
+ cpu-supply = <®_vdd_cpux>; |
436 |
+ }; |
437 |
++ |
438 |
++&cpu1 { |
439 |
++ cpu-supply = <®_vdd_cpux>; |
440 |
++}; |
441 |
++ |
442 |
++&cpu2 { |
443 |
++ cpu-supply = <®_vdd_cpux>; |
444 |
++}; |
445 |
++ |
446 |
++&cpu3 { |
447 |
++ cpu-supply = <®_vdd_cpux>; |
448 |
++}; |
449 |
+diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c |
450 |
+index cc726afea023..76ea4178a55c 100644 |
451 |
+--- a/arch/arm/kernel/stacktrace.c |
452 |
++++ b/arch/arm/kernel/stacktrace.c |
453 |
+@@ -22,6 +22,19 @@ |
454 |
+ * A simple function epilogue looks like this: |
455 |
+ * ldm sp, {fp, sp, pc} |
456 |
+ * |
457 |
++ * When compiled with clang, pc and sp are not pushed. A simple function |
458 |
++ * prologue looks like this when built with clang: |
459 |
++ * |
460 |
++ * stmdb {..., fp, lr} |
461 |
++ * add fp, sp, #x |
462 |
++ * sub sp, sp, #y |
463 |
++ * |
464 |
++ * A simple function epilogue looks like this when built with clang: |
465 |
++ * |
466 |
++ * sub sp, fp, #x |
467 |
++ * ldm {..., fp, pc} |
468 |
++ * |
469 |
++ * |
470 |
+ * Note that with framepointer enabled, even the leaf functions have the same |
471 |
+ * prologue and epilogue, therefore we can ignore the LR value in this case. |
472 |
+ */ |
473 |
+@@ -34,6 +47,16 @@ int notrace unwind_frame(struct stackframe *frame) |
474 |
+ low = frame->sp; |
475 |
+ high = ALIGN(low, THREAD_SIZE); |
476 |
+ |
477 |
++#ifdef CONFIG_CC_IS_CLANG |
478 |
++ /* check current frame pointer is within bounds */ |
479 |
++ if (fp < low + 4 || fp > high - 4) |
480 |
++ return -EINVAL; |
481 |
++ |
482 |
++ frame->sp = frame->fp; |
483 |
++ frame->fp = *(unsigned long *)(fp); |
484 |
++ frame->pc = frame->lr; |
485 |
++ frame->lr = *(unsigned long *)(fp + 4); |
486 |
++#else |
487 |
+ /* check current frame pointer is within bounds */ |
488 |
+ if (fp < low + 12 || fp > high - 4) |
489 |
+ return -EINVAL; |
490 |
+@@ -42,6 +65,7 @@ int notrace unwind_frame(struct stackframe *frame) |
491 |
+ frame->fp = *(unsigned long *)(fp - 12); |
492 |
+ frame->sp = *(unsigned long *)(fp - 8); |
493 |
+ frame->pc = *(unsigned long *)(fp - 4); |
494 |
++#endif |
495 |
+ |
496 |
+ return 0; |
497 |
+ } |
498 |
+diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c |
499 |
+index 074bde64064e..2aab043441e8 100644 |
500 |
+--- a/arch/arm/mach-at91/pm.c |
501 |
++++ b/arch/arm/mach-at91/pm.c |
502 |
+@@ -592,13 +592,13 @@ static void __init at91_pm_sram_init(void) |
503 |
+ sram_pool = gen_pool_get(&pdev->dev, NULL); |
504 |
+ if (!sram_pool) { |
505 |
+ pr_warn("%s: sram pool unavailable!\n", __func__); |
506 |
+- return; |
507 |
++ goto out_put_device; |
508 |
+ } |
509 |
+ |
510 |
+ sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz); |
511 |
+ if (!sram_base) { |
512 |
+ pr_warn("%s: unable to alloc sram!\n", __func__); |
513 |
+- return; |
514 |
++ goto out_put_device; |
515 |
+ } |
516 |
+ |
517 |
+ sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); |
518 |
+@@ -606,12 +606,17 @@ static void __init at91_pm_sram_init(void) |
519 |
+ at91_pm_suspend_in_sram_sz, false); |
520 |
+ if (!at91_suspend_sram_fn) { |
521 |
+ pr_warn("SRAM: Could not map\n"); |
522 |
+- return; |
523 |
++ goto out_put_device; |
524 |
+ } |
525 |
+ |
526 |
+ /* Copy the pm suspend handler to SRAM */ |
527 |
+ at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn, |
528 |
+ &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); |
529 |
++ return; |
530 |
++ |
531 |
++out_put_device: |
532 |
++ put_device(&pdev->dev); |
533 |
++ return; |
534 |
+ } |
535 |
+ |
536 |
+ static bool __init at91_is_pm_mode_active(int pm_mode) |
537 |
+diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c |
538 |
+index 7a8d1555db40..36c37444485a 100644 |
539 |
+--- a/arch/arm/mach-exynos/exynos.c |
540 |
++++ b/arch/arm/mach-exynos/exynos.c |
541 |
+@@ -193,7 +193,7 @@ static void __init exynos_dt_fixup(void) |
542 |
+ } |
543 |
+ |
544 |
+ DT_MACHINE_START(EXYNOS_DT, "Samsung Exynos (Flattened Device Tree)") |
545 |
+- .l2c_aux_val = 0x3c400001, |
546 |
++ .l2c_aux_val = 0x3c400000, |
547 |
+ .l2c_aux_mask = 0xc20fffff, |
548 |
+ .smp = smp_ops(exynos_smp_ops), |
549 |
+ .map_io = exynos_init_io, |
550 |
+diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c |
551 |
+index 9a681b421ae1..cd861c57d5ad 100644 |
552 |
+--- a/arch/arm/mach-exynos/mcpm-exynos.c |
553 |
++++ b/arch/arm/mach-exynos/mcpm-exynos.c |
554 |
+@@ -26,6 +26,7 @@ |
555 |
+ #define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30) |
556 |
+ |
557 |
+ static void __iomem *ns_sram_base_addr __ro_after_init; |
558 |
++static bool secure_firmware __ro_after_init; |
559 |
+ |
560 |
+ /* |
561 |
+ * The common v7_exit_coherency_flush API could not be used because of the |
562 |
+@@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init; |
563 |
+ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster) |
564 |
+ { |
565 |
+ unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER); |
566 |
++ bool state; |
567 |
+ |
568 |
+ pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); |
569 |
+ if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER || |
570 |
+ cluster >= EXYNOS5420_NR_CLUSTERS) |
571 |
+ return -EINVAL; |
572 |
+ |
573 |
+- if (!exynos_cpu_power_state(cpunr)) { |
574 |
+- exynos_cpu_power_up(cpunr); |
575 |
+- |
576 |
++ state = exynos_cpu_power_state(cpunr); |
577 |
++ exynos_cpu_power_up(cpunr); |
578 |
++ if (!state && secure_firmware) { |
579 |
+ /* |
580 |
+ * This assumes the cluster number of the big cores(Cortex A15) |
581 |
+ * is 0 and the Little cores(Cortex A7) is 1. |
582 |
+@@ -258,6 +260,8 @@ static int __init exynos_mcpm_init(void) |
583 |
+ return -ENOMEM; |
584 |
+ } |
585 |
+ |
586 |
++ secure_firmware = exynos_secure_firmware_available(); |
587 |
++ |
588 |
+ /* |
589 |
+ * To increase the stability of KFC reset we need to program |
590 |
+ * the PMU SPARE3 register |
591 |
+diff --git a/arch/arm/mach-socfpga/pm.c b/arch/arm/mach-socfpga/pm.c |
592 |
+index 6ed887cf8dc9..365c0428b21b 100644 |
593 |
+--- a/arch/arm/mach-socfpga/pm.c |
594 |
++++ b/arch/arm/mach-socfpga/pm.c |
595 |
+@@ -49,14 +49,14 @@ static int socfpga_setup_ocram_self_refresh(void) |
596 |
+ if (!ocram_pool) { |
597 |
+ pr_warn("%s: ocram pool unavailable!\n", __func__); |
598 |
+ ret = -ENODEV; |
599 |
+- goto put_node; |
600 |
++ goto put_device; |
601 |
+ } |
602 |
+ |
603 |
+ ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz); |
604 |
+ if (!ocram_base) { |
605 |
+ pr_warn("%s: unable to alloc ocram!\n", __func__); |
606 |
+ ret = -ENOMEM; |
607 |
+- goto put_node; |
608 |
++ goto put_device; |
609 |
+ } |
610 |
+ |
611 |
+ ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base); |
612 |
+@@ -67,7 +67,7 @@ static int socfpga_setup_ocram_self_refresh(void) |
613 |
+ if (!suspend_ocram_base) { |
614 |
+ pr_warn("%s: __arm_ioremap_exec failed!\n", __func__); |
615 |
+ ret = -ENOMEM; |
616 |
+- goto put_node; |
617 |
++ goto put_device; |
618 |
+ } |
619 |
+ |
620 |
+ /* Copy the code that puts DDR in self refresh to ocram */ |
621 |
+@@ -81,6 +81,8 @@ static int socfpga_setup_ocram_self_refresh(void) |
622 |
+ if (!socfpga_sdram_self_refresh_in_ocram) |
623 |
+ ret = -EFAULT; |
624 |
+ |
625 |
++put_device: |
626 |
++ put_device(&pdev->dev); |
627 |
+ put_node: |
628 |
+ of_node_put(np); |
629 |
+ |
630 |
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi |
631 |
+index cefda145c3c9..342733a20c33 100644 |
632 |
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi |
633 |
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi |
634 |
+@@ -279,7 +279,7 @@ |
635 |
+ |
636 |
+ ®_dldo4 { |
637 |
+ regulator-min-microvolt = <1800000>; |
638 |
+- regulator-max-microvolt = <3300000>; |
639 |
++ regulator-max-microvolt = <1800000>; |
640 |
+ regulator-name = "vcc-wifi-io"; |
641 |
+ }; |
642 |
+ |
643 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi |
644 |
+index 98b70d216a6f..2802ddbb83ac 100644 |
645 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi |
646 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi |
647 |
+@@ -336,9 +336,11 @@ |
648 |
+ |
649 |
+ bus-width = <4>; |
650 |
+ cap-sd-highspeed; |
651 |
+- sd-uhs-sdr50; |
652 |
+ max-frequency = <100000000>; |
653 |
+ |
654 |
++ /* WiFi firmware requires power to be kept while in suspend */ |
655 |
++ keep-power-in-suspend; |
656 |
++ |
657 |
+ non-removable; |
658 |
+ disable-wp; |
659 |
+ |
660 |
+@@ -398,7 +400,7 @@ |
661 |
+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; |
662 |
+ max-speed = <2000000>; |
663 |
+ clocks = <&wifi32k>; |
664 |
+- clock-names = "lpo"; |
665 |
++ clock-names = "lpo"; |
666 |
+ }; |
667 |
+ }; |
668 |
+ |
669 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
670 |
+index 1ef1e3672b96..ff5ba85b7562 100644 |
671 |
+--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
672 |
++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
673 |
+@@ -270,7 +270,6 @@ |
674 |
+ |
675 |
+ bus-width = <4>; |
676 |
+ cap-sd-highspeed; |
677 |
+- sd-uhs-sdr50; |
678 |
+ max-frequency = <100000000>; |
679 |
+ |
680 |
+ non-removable; |
681 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts |
682 |
+index dbbf29a0dbf6..026b21708b07 100644 |
683 |
+--- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts |
684 |
++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts |
685 |
+@@ -88,6 +88,10 @@ |
686 |
+ status = "okay"; |
687 |
+ }; |
688 |
+ |
689 |
++&sd_emmc_a { |
690 |
++ sd-uhs-sdr50; |
691 |
++}; |
692 |
++ |
693 |
+ &usb { |
694 |
+ phys = <&usb2_phy0>, <&usb2_phy1>; |
695 |
+ phy-names = "usb2-phy0", "usb2-phy1"; |
696 |
+diff --git a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
697 |
+index 7af288fa9475..a9412805c1d6 100644 |
698 |
+--- a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
699 |
++++ b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts |
700 |
+@@ -157,6 +157,7 @@ |
701 |
+ regulator-min-microvolt = <700000>; |
702 |
+ regulator-max-microvolt = <1150000>; |
703 |
+ regulator-enable-ramp-delay = <125>; |
704 |
++ regulator-always-on; |
705 |
+ }; |
706 |
+ |
707 |
+ ldo8_reg: LDO8 { |
708 |
+diff --git a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |
709 |
+index e035cf195b19..8c4bfbaf3a80 100644 |
710 |
+--- a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |
711 |
++++ b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts |
712 |
+@@ -530,6 +530,17 @@ |
713 |
+ status = "ok"; |
714 |
+ compatible = "adi,adv7533"; |
715 |
+ reg = <0x39>; |
716 |
++ adi,dsi-lanes = <4>; |
717 |
++ ports { |
718 |
++ #address-cells = <1>; |
719 |
++ #size-cells = <0>; |
720 |
++ port@0 { |
721 |
++ reg = <0>; |
722 |
++ }; |
723 |
++ port@1 { |
724 |
++ reg = <1>; |
725 |
++ }; |
726 |
++ }; |
727 |
+ }; |
728 |
+ }; |
729 |
+ |
730 |
+diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
731 |
+index c14205cd6bf5..3e47150c05ec 100644 |
732 |
+--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
733 |
++++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts |
734 |
+@@ -516,7 +516,7 @@ |
735 |
+ reg = <0x39>; |
736 |
+ interrupt-parent = <&gpio1>; |
737 |
+ interrupts = <1 2>; |
738 |
+- pd-gpio = <&gpio0 4 0>; |
739 |
++ pd-gpios = <&gpio0 4 0>; |
740 |
+ adi,dsi-lanes = <4>; |
741 |
+ #sound-dai-cells = <0>; |
742 |
+ |
743 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
744 |
+index e9c00367f7fd..5785bf0a807c 100644 |
745 |
+--- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
746 |
++++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
747 |
+@@ -556,7 +556,7 @@ |
748 |
+ pins = "gpio63", "gpio64", "gpio65", "gpio66", |
749 |
+ "gpio67", "gpio68"; |
750 |
+ drive-strength = <8>; |
751 |
+- bias-pull-none; |
752 |
++ bias-disable; |
753 |
+ }; |
754 |
+ }; |
755 |
+ cdc_pdm_lines_sus: pdm-lines-off { |
756 |
+@@ -585,7 +585,7 @@ |
757 |
+ pins = "gpio113", "gpio114", "gpio115", |
758 |
+ "gpio116"; |
759 |
+ drive-strength = <8>; |
760 |
+- bias-pull-none; |
761 |
++ bias-disable; |
762 |
+ }; |
763 |
+ }; |
764 |
+ |
765 |
+@@ -613,7 +613,7 @@ |
766 |
+ pinconf { |
767 |
+ pins = "gpio110"; |
768 |
+ drive-strength = <8>; |
769 |
+- bias-pull-none; |
770 |
++ bias-disable; |
771 |
+ }; |
772 |
+ }; |
773 |
+ |
774 |
+@@ -639,7 +639,7 @@ |
775 |
+ pinconf { |
776 |
+ pins = "gpio116"; |
777 |
+ drive-strength = <8>; |
778 |
+- bias-pull-none; |
779 |
++ bias-disable; |
780 |
+ }; |
781 |
+ }; |
782 |
+ ext_mclk_tlmm_lines_sus: mclk-lines-off { |
783 |
+@@ -667,7 +667,7 @@ |
784 |
+ pins = "gpio112", "gpio117", "gpio118", |
785 |
+ "gpio119"; |
786 |
+ drive-strength = <8>; |
787 |
+- bias-pull-none; |
788 |
++ bias-disable; |
789 |
+ }; |
790 |
+ }; |
791 |
+ ext_sec_tlmm_lines_sus: tlmm-lines-off { |
792 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
793 |
+index a603d947970e..16b059d7fd01 100644 |
794 |
+--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
795 |
++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
796 |
+@@ -2250,7 +2250,7 @@ |
797 |
+ status = "disabled"; |
798 |
+ }; |
799 |
+ |
800 |
+- sdhi0: sd@ee100000 { |
801 |
++ sdhi0: mmc@ee100000 { |
802 |
+ compatible = "renesas,sdhi-r8a774a1", |
803 |
+ "renesas,rcar-gen3-sdhi"; |
804 |
+ reg = <0 0xee100000 0 0x2000>; |
805 |
+@@ -2262,7 +2262,7 @@ |
806 |
+ status = "disabled"; |
807 |
+ }; |
808 |
+ |
809 |
+- sdhi1: sd@ee120000 { |
810 |
++ sdhi1: mmc@ee120000 { |
811 |
+ compatible = "renesas,sdhi-r8a774a1", |
812 |
+ "renesas,rcar-gen3-sdhi"; |
813 |
+ reg = <0 0xee120000 0 0x2000>; |
814 |
+@@ -2274,7 +2274,7 @@ |
815 |
+ status = "disabled"; |
816 |
+ }; |
817 |
+ |
818 |
+- sdhi2: sd@ee140000 { |
819 |
++ sdhi2: mmc@ee140000 { |
820 |
+ compatible = "renesas,sdhi-r8a774a1", |
821 |
+ "renesas,rcar-gen3-sdhi"; |
822 |
+ reg = <0 0xee140000 0 0x2000>; |
823 |
+@@ -2286,7 +2286,7 @@ |
824 |
+ status = "disabled"; |
825 |
+ }; |
826 |
+ |
827 |
+- sdhi3: sd@ee160000 { |
828 |
++ sdhi3: mmc@ee160000 { |
829 |
+ compatible = "renesas,sdhi-r8a774a1", |
830 |
+ "renesas,rcar-gen3-sdhi"; |
831 |
+ reg = <0 0xee160000 0 0x2000>; |
832 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
833 |
+index 1e51855c7cd3..6db8b6a4d191 100644 |
834 |
+--- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
835 |
++++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
836 |
+@@ -2108,7 +2108,7 @@ |
837 |
+ status = "disabled"; |
838 |
+ }; |
839 |
+ |
840 |
+- sdhi0: sd@ee100000 { |
841 |
++ sdhi0: mmc@ee100000 { |
842 |
+ compatible = "renesas,sdhi-r8a774b1", |
843 |
+ "renesas,rcar-gen3-sdhi"; |
844 |
+ reg = <0 0xee100000 0 0x2000>; |
845 |
+@@ -2120,7 +2120,7 @@ |
846 |
+ status = "disabled"; |
847 |
+ }; |
848 |
+ |
849 |
+- sdhi1: sd@ee120000 { |
850 |
++ sdhi1: mmc@ee120000 { |
851 |
+ compatible = "renesas,sdhi-r8a774b1", |
852 |
+ "renesas,rcar-gen3-sdhi"; |
853 |
+ reg = <0 0xee120000 0 0x2000>; |
854 |
+@@ -2132,7 +2132,7 @@ |
855 |
+ status = "disabled"; |
856 |
+ }; |
857 |
+ |
858 |
+- sdhi2: sd@ee140000 { |
859 |
++ sdhi2: mmc@ee140000 { |
860 |
+ compatible = "renesas,sdhi-r8a774b1", |
861 |
+ "renesas,rcar-gen3-sdhi"; |
862 |
+ reg = <0 0xee140000 0 0x2000>; |
863 |
+@@ -2144,7 +2144,7 @@ |
864 |
+ status = "disabled"; |
865 |
+ }; |
866 |
+ |
867 |
+- sdhi3: sd@ee160000 { |
868 |
++ sdhi3: mmc@ee160000 { |
869 |
+ compatible = "renesas,sdhi-r8a774b1", |
870 |
+ "renesas,rcar-gen3-sdhi"; |
871 |
+ reg = <0 0xee160000 0 0x2000>; |
872 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
873 |
+index 5c72a7efbb03..42171190cce4 100644 |
874 |
+--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
875 |
++++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
876 |
+@@ -1618,7 +1618,7 @@ |
877 |
+ status = "disabled"; |
878 |
+ }; |
879 |
+ |
880 |
+- sdhi0: sd@ee100000 { |
881 |
++ sdhi0: mmc@ee100000 { |
882 |
+ compatible = "renesas,sdhi-r8a774c0", |
883 |
+ "renesas,rcar-gen3-sdhi"; |
884 |
+ reg = <0 0xee100000 0 0x2000>; |
885 |
+@@ -1630,7 +1630,7 @@ |
886 |
+ status = "disabled"; |
887 |
+ }; |
888 |
+ |
889 |
+- sdhi1: sd@ee120000 { |
890 |
++ sdhi1: mmc@ee120000 { |
891 |
+ compatible = "renesas,sdhi-r8a774c0", |
892 |
+ "renesas,rcar-gen3-sdhi"; |
893 |
+ reg = <0 0xee120000 0 0x2000>; |
894 |
+@@ -1642,7 +1642,7 @@ |
895 |
+ status = "disabled"; |
896 |
+ }; |
897 |
+ |
898 |
+- sdhi3: sd@ee160000 { |
899 |
++ sdhi3: mmc@ee160000 { |
900 |
+ compatible = "renesas,sdhi-r8a774c0", |
901 |
+ "renesas,rcar-gen3-sdhi"; |
902 |
+ reg = <0 0xee160000 0 0x2000>; |
903 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77951.dtsi b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
904 |
+index 61d67d9714ab..9beb8e76d923 100644 |
905 |
+--- a/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
906 |
++++ b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
907 |
+@@ -2590,7 +2590,7 @@ |
908 |
+ status = "disabled"; |
909 |
+ }; |
910 |
+ |
911 |
+- sdhi0: sd@ee100000 { |
912 |
++ sdhi0: mmc@ee100000 { |
913 |
+ compatible = "renesas,sdhi-r8a7795", |
914 |
+ "renesas,rcar-gen3-sdhi"; |
915 |
+ reg = <0 0xee100000 0 0x2000>; |
916 |
+@@ -2603,7 +2603,7 @@ |
917 |
+ status = "disabled"; |
918 |
+ }; |
919 |
+ |
920 |
+- sdhi1: sd@ee120000 { |
921 |
++ sdhi1: mmc@ee120000 { |
922 |
+ compatible = "renesas,sdhi-r8a7795", |
923 |
+ "renesas,rcar-gen3-sdhi"; |
924 |
+ reg = <0 0xee120000 0 0x2000>; |
925 |
+@@ -2616,7 +2616,7 @@ |
926 |
+ status = "disabled"; |
927 |
+ }; |
928 |
+ |
929 |
+- sdhi2: sd@ee140000 { |
930 |
++ sdhi2: mmc@ee140000 { |
931 |
+ compatible = "renesas,sdhi-r8a7795", |
932 |
+ "renesas,rcar-gen3-sdhi"; |
933 |
+ reg = <0 0xee140000 0 0x2000>; |
934 |
+@@ -2629,7 +2629,7 @@ |
935 |
+ status = "disabled"; |
936 |
+ }; |
937 |
+ |
938 |
+- sdhi3: sd@ee160000 { |
939 |
++ sdhi3: mmc@ee160000 { |
940 |
+ compatible = "renesas,sdhi-r8a7795", |
941 |
+ "renesas,rcar-gen3-sdhi"; |
942 |
+ reg = <0 0xee160000 0 0x2000>; |
943 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
944 |
+index 33bf62acffbb..4dfb7f076787 100644 |
945 |
+--- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
946 |
++++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
947 |
+@@ -2394,7 +2394,7 @@ |
948 |
+ status = "disabled"; |
949 |
+ }; |
950 |
+ |
951 |
+- sdhi0: sd@ee100000 { |
952 |
++ sdhi0: mmc@ee100000 { |
953 |
+ compatible = "renesas,sdhi-r8a7796", |
954 |
+ "renesas,rcar-gen3-sdhi"; |
955 |
+ reg = <0 0xee100000 0 0x2000>; |
956 |
+@@ -2407,7 +2407,7 @@ |
957 |
+ status = "disabled"; |
958 |
+ }; |
959 |
+ |
960 |
+- sdhi1: sd@ee120000 { |
961 |
++ sdhi1: mmc@ee120000 { |
962 |
+ compatible = "renesas,sdhi-r8a7796", |
963 |
+ "renesas,rcar-gen3-sdhi"; |
964 |
+ reg = <0 0xee120000 0 0x2000>; |
965 |
+@@ -2420,7 +2420,7 @@ |
966 |
+ status = "disabled"; |
967 |
+ }; |
968 |
+ |
969 |
+- sdhi2: sd@ee140000 { |
970 |
++ sdhi2: mmc@ee140000 { |
971 |
+ compatible = "renesas,sdhi-r8a7796", |
972 |
+ "renesas,rcar-gen3-sdhi"; |
973 |
+ reg = <0 0xee140000 0 0x2000>; |
974 |
+@@ -2433,7 +2433,7 @@ |
975 |
+ status = "disabled"; |
976 |
+ }; |
977 |
+ |
978 |
+- sdhi3: sd@ee160000 { |
979 |
++ sdhi3: mmc@ee160000 { |
980 |
+ compatible = "renesas,sdhi-r8a7796", |
981 |
+ "renesas,rcar-gen3-sdhi"; |
982 |
+ reg = <0 0xee160000 0 0x2000>; |
983 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dts/renesas/r8a77961.dtsi |
984 |
+index 760e738b75b3..eabb0e635cd4 100644 |
985 |
+--- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi |
986 |
++++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi |
987 |
+@@ -1257,7 +1257,7 @@ |
988 |
+ status = "disabled"; |
989 |
+ }; |
990 |
+ |
991 |
+- sdhi0: sd@ee100000 { |
992 |
++ sdhi0: mmc@ee100000 { |
993 |
+ compatible = "renesas,sdhi-r8a77961", |
994 |
+ "renesas,rcar-gen3-sdhi"; |
995 |
+ reg = <0 0xee100000 0 0x2000>; |
996 |
+@@ -1269,7 +1269,7 @@ |
997 |
+ status = "disabled"; |
998 |
+ }; |
999 |
+ |
1000 |
+- sdhi1: sd@ee120000 { |
1001 |
++ sdhi1: mmc@ee120000 { |
1002 |
+ compatible = "renesas,sdhi-r8a77961", |
1003 |
+ "renesas,rcar-gen3-sdhi"; |
1004 |
+ reg = <0 0xee120000 0 0x2000>; |
1005 |
+@@ -1281,7 +1281,7 @@ |
1006 |
+ status = "disabled"; |
1007 |
+ }; |
1008 |
+ |
1009 |
+- sdhi2: sd@ee140000 { |
1010 |
++ sdhi2: mmc@ee140000 { |
1011 |
+ compatible = "renesas,sdhi-r8a77961", |
1012 |
+ "renesas,rcar-gen3-sdhi"; |
1013 |
+ reg = <0 0xee140000 0 0x2000>; |
1014 |
+@@ -1293,7 +1293,7 @@ |
1015 |
+ status = "disabled"; |
1016 |
+ }; |
1017 |
+ |
1018 |
+- sdhi3: sd@ee160000 { |
1019 |
++ sdhi3: mmc@ee160000 { |
1020 |
+ compatible = "renesas,sdhi-r8a77961", |
1021 |
+ "renesas,rcar-gen3-sdhi"; |
1022 |
+ reg = <0 0xee160000 0 0x2000>; |
1023 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
1024 |
+index 6f7ab39fd282..fe4dc12e2bdf 100644 |
1025 |
+--- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
1026 |
++++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
1027 |
+@@ -2120,7 +2120,7 @@ |
1028 |
+ status = "disabled"; |
1029 |
+ }; |
1030 |
+ |
1031 |
+- sdhi0: sd@ee100000 { |
1032 |
++ sdhi0: mmc@ee100000 { |
1033 |
+ compatible = "renesas,sdhi-r8a77965", |
1034 |
+ "renesas,rcar-gen3-sdhi"; |
1035 |
+ reg = <0 0xee100000 0 0x2000>; |
1036 |
+@@ -2133,7 +2133,7 @@ |
1037 |
+ status = "disabled"; |
1038 |
+ }; |
1039 |
+ |
1040 |
+- sdhi1: sd@ee120000 { |
1041 |
++ sdhi1: mmc@ee120000 { |
1042 |
+ compatible = "renesas,sdhi-r8a77965", |
1043 |
+ "renesas,rcar-gen3-sdhi"; |
1044 |
+ reg = <0 0xee120000 0 0x2000>; |
1045 |
+@@ -2146,7 +2146,7 @@ |
1046 |
+ status = "disabled"; |
1047 |
+ }; |
1048 |
+ |
1049 |
+- sdhi2: sd@ee140000 { |
1050 |
++ sdhi2: mmc@ee140000 { |
1051 |
+ compatible = "renesas,sdhi-r8a77965", |
1052 |
+ "renesas,rcar-gen3-sdhi"; |
1053 |
+ reg = <0 0xee140000 0 0x2000>; |
1054 |
+@@ -2159,7 +2159,7 @@ |
1055 |
+ status = "disabled"; |
1056 |
+ }; |
1057 |
+ |
1058 |
+- sdhi3: sd@ee160000 { |
1059 |
++ sdhi3: mmc@ee160000 { |
1060 |
+ compatible = "renesas,sdhi-r8a77965", |
1061 |
+ "renesas,rcar-gen3-sdhi"; |
1062 |
+ reg = <0 0xee160000 0 0x2000>; |
1063 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
1064 |
+index cd11f24744d4..1991bdc36792 100644 |
1065 |
+--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
1066 |
++++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
1067 |
+@@ -1595,7 +1595,7 @@ |
1068 |
+ status = "disabled"; |
1069 |
+ }; |
1070 |
+ |
1071 |
+- sdhi0: sd@ee100000 { |
1072 |
++ sdhi0: mmc@ee100000 { |
1073 |
+ compatible = "renesas,sdhi-r8a77990", |
1074 |
+ "renesas,rcar-gen3-sdhi"; |
1075 |
+ reg = <0 0xee100000 0 0x2000>; |
1076 |
+@@ -1608,7 +1608,7 @@ |
1077 |
+ status = "disabled"; |
1078 |
+ }; |
1079 |
+ |
1080 |
+- sdhi1: sd@ee120000 { |
1081 |
++ sdhi1: mmc@ee120000 { |
1082 |
+ compatible = "renesas,sdhi-r8a77990", |
1083 |
+ "renesas,rcar-gen3-sdhi"; |
1084 |
+ reg = <0 0xee120000 0 0x2000>; |
1085 |
+@@ -1621,7 +1621,7 @@ |
1086 |
+ status = "disabled"; |
1087 |
+ }; |
1088 |
+ |
1089 |
+- sdhi3: sd@ee160000 { |
1090 |
++ sdhi3: mmc@ee160000 { |
1091 |
+ compatible = "renesas,sdhi-r8a77990", |
1092 |
+ "renesas,rcar-gen3-sdhi"; |
1093 |
+ reg = <0 0xee160000 0 0x2000>; |
1094 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
1095 |
+index e5617ec0f49c..2c2272f5f5b5 100644 |
1096 |
+--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
1097 |
++++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
1098 |
+@@ -916,7 +916,7 @@ |
1099 |
+ status = "disabled"; |
1100 |
+ }; |
1101 |
+ |
1102 |
+- sdhi2: sd@ee140000 { |
1103 |
++ sdhi2: mmc@ee140000 { |
1104 |
+ compatible = "renesas,sdhi-r8a77995", |
1105 |
+ "renesas,rcar-gen3-sdhi"; |
1106 |
+ reg = <0 0xee140000 0 0x2000>; |
1107 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi |
1108 |
+index e17311e09082..216aafd90e7f 100644 |
1109 |
+--- a/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi |
1110 |
++++ b/arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi |
1111 |
+@@ -156,7 +156,7 @@ |
1112 |
+ pinctrl-0 = <&rgmii_pins>; |
1113 |
+ snps,reset-active-low; |
1114 |
+ snps,reset-delays-us = <0 10000 50000>; |
1115 |
+- snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>; |
1116 |
++ snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; |
1117 |
+ tx_delay = <0x10>; |
1118 |
+ rx_delay = <0x10>; |
1119 |
+ status = "okay"; |
1120 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi |
1121 |
+index 07694b196fdb..72c06abd27ea 100644 |
1122 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi |
1123 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi |
1124 |
+@@ -101,7 +101,7 @@ |
1125 |
+ |
1126 |
+ vcc5v0_host: vcc5v0-host-regulator { |
1127 |
+ compatible = "regulator-fixed"; |
1128 |
+- gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>; |
1129 |
++ gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; |
1130 |
+ enable-active-low; |
1131 |
+ pinctrl-names = "default"; |
1132 |
+ pinctrl-0 = <&vcc5v0_host_en>; |
1133 |
+@@ -157,7 +157,7 @@ |
1134 |
+ phy-mode = "rgmii"; |
1135 |
+ pinctrl-names = "default"; |
1136 |
+ pinctrl-0 = <&rgmii_pins>; |
1137 |
+- snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; |
1138 |
++ snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; |
1139 |
+ snps,reset-active-low; |
1140 |
+ snps,reset-delays-us = <0 10000 50000>; |
1141 |
+ tx_delay = <0x10>; |
1142 |
+diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c |
1143 |
+index d3775afb0f07..bfc8daf50744 100644 |
1144 |
+--- a/arch/m68k/mac/iop.c |
1145 |
++++ b/arch/m68k/mac/iop.c |
1146 |
+@@ -183,7 +183,7 @@ static __inline__ void iop_writeb(volatile struct mac_iop *iop, __u16 addr, __u8 |
1147 |
+ |
1148 |
+ static __inline__ void iop_stop(volatile struct mac_iop *iop) |
1149 |
+ { |
1150 |
+- iop->status_ctrl &= ~IOP_RUN; |
1151 |
++ iop->status_ctrl = IOP_AUTOINC; |
1152 |
+ } |
1153 |
+ |
1154 |
+ static __inline__ void iop_start(volatile struct mac_iop *iop) |
1155 |
+@@ -191,14 +191,9 @@ static __inline__ void iop_start(volatile struct mac_iop *iop) |
1156 |
+ iop->status_ctrl = IOP_RUN | IOP_AUTOINC; |
1157 |
+ } |
1158 |
+ |
1159 |
+-static __inline__ void iop_bypass(volatile struct mac_iop *iop) |
1160 |
+-{ |
1161 |
+- iop->status_ctrl |= IOP_BYPASS; |
1162 |
+-} |
1163 |
+- |
1164 |
+ static __inline__ void iop_interrupt(volatile struct mac_iop *iop) |
1165 |
+ { |
1166 |
+- iop->status_ctrl |= IOP_IRQ; |
1167 |
++ iop->status_ctrl = IOP_IRQ | IOP_RUN | IOP_AUTOINC; |
1168 |
+ } |
1169 |
+ |
1170 |
+ static int iop_alive(volatile struct mac_iop *iop) |
1171 |
+@@ -244,7 +239,6 @@ void __init iop_preinit(void) |
1172 |
+ } else { |
1173 |
+ iop_base[IOP_NUM_SCC] = (struct mac_iop *) SCC_IOP_BASE_QUADRA; |
1174 |
+ } |
1175 |
+- iop_base[IOP_NUM_SCC]->status_ctrl = 0x87; |
1176 |
+ iop_scc_present = 1; |
1177 |
+ } else { |
1178 |
+ iop_base[IOP_NUM_SCC] = NULL; |
1179 |
+@@ -256,7 +250,7 @@ void __init iop_preinit(void) |
1180 |
+ } else { |
1181 |
+ iop_base[IOP_NUM_ISM] = (struct mac_iop *) ISM_IOP_BASE_QUADRA; |
1182 |
+ } |
1183 |
+- iop_base[IOP_NUM_ISM]->status_ctrl = 0; |
1184 |
++ iop_stop(iop_base[IOP_NUM_ISM]); |
1185 |
+ iop_ism_present = 1; |
1186 |
+ } else { |
1187 |
+ iop_base[IOP_NUM_ISM] = NULL; |
1188 |
+@@ -415,7 +409,8 @@ static void iop_handle_send(uint iop_num, uint chan) |
1189 |
+ msg->status = IOP_MSGSTATUS_UNUSED; |
1190 |
+ msg = msg->next; |
1191 |
+ iop_send_queue[iop_num][chan] = msg; |
1192 |
+- if (msg) iop_do_send(msg); |
1193 |
++ if (msg && iop_readb(iop, IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) |
1194 |
++ iop_do_send(msg); |
1195 |
+ } |
1196 |
+ |
1197 |
+ /* |
1198 |
+@@ -489,16 +484,12 @@ int iop_send_message(uint iop_num, uint chan, void *privdata, |
1199 |
+ |
1200 |
+ if (!(q = iop_send_queue[iop_num][chan])) { |
1201 |
+ iop_send_queue[iop_num][chan] = msg; |
1202 |
++ iop_do_send(msg); |
1203 |
+ } else { |
1204 |
+ while (q->next) q = q->next; |
1205 |
+ q->next = msg; |
1206 |
+ } |
1207 |
+ |
1208 |
+- if (iop_readb(iop_base[iop_num], |
1209 |
+- IOP_ADDR_SEND_STATE + chan) == IOP_MSG_IDLE) { |
1210 |
+- iop_do_send(msg); |
1211 |
+- } |
1212 |
+- |
1213 |
+ return 0; |
1214 |
+ } |
1215 |
+ |
1216 |
+diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c |
1217 |
+index 1fd85c559700..950e6c6e8629 100644 |
1218 |
+--- a/arch/mips/cavium-octeon/octeon-usb.c |
1219 |
++++ b/arch/mips/cavium-octeon/octeon-usb.c |
1220 |
+@@ -518,6 +518,7 @@ static int __init dwc3_octeon_device_init(void) |
1221 |
+ |
1222 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1223 |
+ if (res == NULL) { |
1224 |
++ put_device(&pdev->dev); |
1225 |
+ dev_err(&pdev->dev, "No memory resources\n"); |
1226 |
+ return -ENXIO; |
1227 |
+ } |
1228 |
+@@ -529,8 +530,10 @@ static int __init dwc3_octeon_device_init(void) |
1229 |
+ * know the difference. |
1230 |
+ */ |
1231 |
+ base = devm_ioremap_resource(&pdev->dev, res); |
1232 |
+- if (IS_ERR(base)) |
1233 |
++ if (IS_ERR(base)) { |
1234 |
++ put_device(&pdev->dev); |
1235 |
+ return PTR_ERR(base); |
1236 |
++ } |
1237 |
+ |
1238 |
+ mutex_lock(&dwc3_octeon_clocks_mutex); |
1239 |
+ dwc3_octeon_clocks_start(&pdev->dev, (u64)base); |
1240 |
+diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h |
1241 |
+index 724dfddcab92..0b1bc7ed913b 100644 |
1242 |
+--- a/arch/mips/include/asm/cpu-features.h |
1243 |
++++ b/arch/mips/include/asm/cpu-features.h |
1244 |
+@@ -568,6 +568,10 @@ |
1245 |
+ # define cpu_has_mac2008_only __opt(MIPS_CPU_MAC_2008_ONLY) |
1246 |
+ #endif |
1247 |
+ |
1248 |
++#ifndef cpu_has_ftlbparex |
1249 |
++# define cpu_has_ftlbparex __opt(MIPS_CPU_FTLBPAREX) |
1250 |
++#endif |
1251 |
++ |
1252 |
+ #ifdef CONFIG_SMP |
1253 |
+ /* |
1254 |
+ * Some systems share FTLB RAMs between threads within a core (siblings in |
1255 |
+diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h |
1256 |
+index 104a509312b3..3a4773714b29 100644 |
1257 |
+--- a/arch/mips/include/asm/cpu.h |
1258 |
++++ b/arch/mips/include/asm/cpu.h |
1259 |
+@@ -425,6 +425,7 @@ enum cpu_type_enum { |
1260 |
+ #define MIPS_CPU_MM_SYSAD BIT_ULL(58) /* CPU supports write-through SysAD Valid merge */ |
1261 |
+ #define MIPS_CPU_MM_FULL BIT_ULL(59) /* CPU supports write-through full merge */ |
1262 |
+ #define MIPS_CPU_MAC_2008_ONLY BIT_ULL(60) /* CPU Only support MAC2008 Fused multiply-add instruction */ |
1263 |
++#define MIPS_CPU_FTLBPAREX BIT_ULL(61) /* CPU has FTLB parity exception */ |
1264 |
+ |
1265 |
+ /* |
1266 |
+ * CPU ASE encodings |
1267 |
+diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c |
1268 |
+index def1659fe262..3404011eb7cf 100644 |
1269 |
+--- a/arch/mips/kernel/cpu-probe.c |
1270 |
++++ b/arch/mips/kernel/cpu-probe.c |
1271 |
+@@ -1827,6 +1827,19 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) |
1272 |
+ default: |
1273 |
+ break; |
1274 |
+ } |
1275 |
++ |
1276 |
++ /* Recent MIPS cores use the implementation-dependent ExcCode 16 for |
1277 |
++ * cache/FTLB parity exceptions. |
1278 |
++ */ |
1279 |
++ switch (__get_cpu_type(c->cputype)) { |
1280 |
++ case CPU_PROAPTIV: |
1281 |
++ case CPU_P5600: |
1282 |
++ case CPU_P6600: |
1283 |
++ case CPU_I6400: |
1284 |
++ case CPU_I6500: |
1285 |
++ c->options |= MIPS_CPU_FTLBPAREX; |
1286 |
++ break; |
1287 |
++ } |
1288 |
+ } |
1289 |
+ |
1290 |
+ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu) |
1291 |
+diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c |
1292 |
+index f655af68176c..e664d8b43e72 100644 |
1293 |
+--- a/arch/mips/kernel/traps.c |
1294 |
++++ b/arch/mips/kernel/traps.c |
1295 |
+@@ -2457,7 +2457,8 @@ void __init trap_init(void) |
1296 |
+ if (cpu_has_fpu && !cpu_has_nofpuex) |
1297 |
+ set_except_vector(EXCCODE_FPE, handle_fpe); |
1298 |
+ |
1299 |
+- set_except_vector(MIPS_EXCCODE_TLBPAR, handle_ftlb); |
1300 |
++ if (cpu_has_ftlbparex) |
1301 |
++ set_except_vector(MIPS_EXCCODE_TLBPAR, handle_ftlb); |
1302 |
+ |
1303 |
+ if (cpu_has_rixiex) { |
1304 |
+ set_except_vector(EXCCODE_TLBRI, tlb_do_page_fault_0); |
1305 |
+diff --git a/arch/mips/kvm/vz.c b/arch/mips/kvm/vz.c |
1306 |
+index d9c462c14163..8397e623b926 100644 |
1307 |
+--- a/arch/mips/kvm/vz.c |
1308 |
++++ b/arch/mips/kvm/vz.c |
1309 |
+@@ -29,7 +29,9 @@ |
1310 |
+ #include <linux/kvm_host.h> |
1311 |
+ |
1312 |
+ #include "interrupt.h" |
1313 |
++#ifdef CONFIG_CPU_LOONGSON64 |
1314 |
+ #include "loongson_regs.h" |
1315 |
++#endif |
1316 |
+ |
1317 |
+ #include "trace.h" |
1318 |
+ |
1319 |
+diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c |
1320 |
+index 5958217861b8..9b3cc775c55e 100644 |
1321 |
+--- a/arch/mips/pci/pci-xtalk-bridge.c |
1322 |
++++ b/arch/mips/pci/pci-xtalk-bridge.c |
1323 |
+@@ -728,6 +728,7 @@ err_free_resource: |
1324 |
+ pci_free_resource_list(&host->windows); |
1325 |
+ err_remove_domain: |
1326 |
+ irq_domain_remove(domain); |
1327 |
++ irq_domain_free_fwnode(fn); |
1328 |
+ return err; |
1329 |
+ } |
1330 |
+ |
1331 |
+@@ -735,8 +736,10 @@ static int bridge_remove(struct platform_device *pdev) |
1332 |
+ { |
1333 |
+ struct pci_bus *bus = platform_get_drvdata(pdev); |
1334 |
+ struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); |
1335 |
++ struct fwnode_handle *fn = bc->domain->fwnode; |
1336 |
+ |
1337 |
+ irq_domain_remove(bc->domain); |
1338 |
++ irq_domain_free_fwnode(fn); |
1339 |
+ pci_lock_rescan_remove(); |
1340 |
+ pci_stop_root_bus(bus); |
1341 |
+ pci_remove_root_bus(bus); |
1342 |
+diff --git a/arch/parisc/include/asm/barrier.h b/arch/parisc/include/asm/barrier.h |
1343 |
+index dbaaca84f27f..640d46edf32e 100644 |
1344 |
+--- a/arch/parisc/include/asm/barrier.h |
1345 |
++++ b/arch/parisc/include/asm/barrier.h |
1346 |
+@@ -26,6 +26,67 @@ |
1347 |
+ #define __smp_rmb() mb() |
1348 |
+ #define __smp_wmb() mb() |
1349 |
+ |
1350 |
++#define __smp_store_release(p, v) \ |
1351 |
++do { \ |
1352 |
++ typeof(p) __p = (p); \ |
1353 |
++ union { typeof(*p) __val; char __c[1]; } __u = \ |
1354 |
++ { .__val = (__force typeof(*p)) (v) }; \ |
1355 |
++ compiletime_assert_atomic_type(*p); \ |
1356 |
++ switch (sizeof(*p)) { \ |
1357 |
++ case 1: \ |
1358 |
++ asm volatile("stb,ma %0,0(%1)" \ |
1359 |
++ : : "r"(*(__u8 *)__u.__c), "r"(__p) \ |
1360 |
++ : "memory"); \ |
1361 |
++ break; \ |
1362 |
++ case 2: \ |
1363 |
++ asm volatile("sth,ma %0,0(%1)" \ |
1364 |
++ : : "r"(*(__u16 *)__u.__c), "r"(__p) \ |
1365 |
++ : "memory"); \ |
1366 |
++ break; \ |
1367 |
++ case 4: \ |
1368 |
++ asm volatile("stw,ma %0,0(%1)" \ |
1369 |
++ : : "r"(*(__u32 *)__u.__c), "r"(__p) \ |
1370 |
++ : "memory"); \ |
1371 |
++ break; \ |
1372 |
++ case 8: \ |
1373 |
++ if (IS_ENABLED(CONFIG_64BIT)) \ |
1374 |
++ asm volatile("std,ma %0,0(%1)" \ |
1375 |
++ : : "r"(*(__u64 *)__u.__c), "r"(__p) \ |
1376 |
++ : "memory"); \ |
1377 |
++ break; \ |
1378 |
++ } \ |
1379 |
++} while (0) |
1380 |
++ |
1381 |
++#define __smp_load_acquire(p) \ |
1382 |
++({ \ |
1383 |
++ union { typeof(*p) __val; char __c[1]; } __u; \ |
1384 |
++ typeof(p) __p = (p); \ |
1385 |
++ compiletime_assert_atomic_type(*p); \ |
1386 |
++ switch (sizeof(*p)) { \ |
1387 |
++ case 1: \ |
1388 |
++ asm volatile("ldb,ma 0(%1),%0" \ |
1389 |
++ : "=r"(*(__u8 *)__u.__c) : "r"(__p) \ |
1390 |
++ : "memory"); \ |
1391 |
++ break; \ |
1392 |
++ case 2: \ |
1393 |
++ asm volatile("ldh,ma 0(%1),%0" \ |
1394 |
++ : "=r"(*(__u16 *)__u.__c) : "r"(__p) \ |
1395 |
++ : "memory"); \ |
1396 |
++ break; \ |
1397 |
++ case 4: \ |
1398 |
++ asm volatile("ldw,ma 0(%1),%0" \ |
1399 |
++ : "=r"(*(__u32 *)__u.__c) : "r"(__p) \ |
1400 |
++ : "memory"); \ |
1401 |
++ break; \ |
1402 |
++ case 8: \ |
1403 |
++ if (IS_ENABLED(CONFIG_64BIT)) \ |
1404 |
++ asm volatile("ldd,ma 0(%1),%0" \ |
1405 |
++ : "=r"(*(__u64 *)__u.__c) : "r"(__p) \ |
1406 |
++ : "memory"); \ |
1407 |
++ break; \ |
1408 |
++ } \ |
1409 |
++ __u.__val; \ |
1410 |
++}) |
1411 |
+ #include <asm-generic/barrier.h> |
1412 |
+ |
1413 |
+ #endif /* !__ASSEMBLY__ */ |
1414 |
+diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h |
1415 |
+index 70fecb8dc4e2..51b6c47f802f 100644 |
1416 |
+--- a/arch/parisc/include/asm/spinlock.h |
1417 |
++++ b/arch/parisc/include/asm/spinlock.h |
1418 |
+@@ -10,34 +10,25 @@ |
1419 |
+ static inline int arch_spin_is_locked(arch_spinlock_t *x) |
1420 |
+ { |
1421 |
+ volatile unsigned int *a = __ldcw_align(x); |
1422 |
+- smp_mb(); |
1423 |
+ return *a == 0; |
1424 |
+ } |
1425 |
+ |
1426 |
+-static inline void arch_spin_lock(arch_spinlock_t *x) |
1427 |
+-{ |
1428 |
+- volatile unsigned int *a; |
1429 |
+- |
1430 |
+- a = __ldcw_align(x); |
1431 |
+- while (__ldcw(a) == 0) |
1432 |
+- while (*a == 0) |
1433 |
+- cpu_relax(); |
1434 |
+-} |
1435 |
++#define arch_spin_lock(lock) arch_spin_lock_flags(lock, 0) |
1436 |
+ |
1437 |
+ static inline void arch_spin_lock_flags(arch_spinlock_t *x, |
1438 |
+ unsigned long flags) |
1439 |
+ { |
1440 |
+ volatile unsigned int *a; |
1441 |
+- unsigned long flags_dis; |
1442 |
+ |
1443 |
+ a = __ldcw_align(x); |
1444 |
+- while (__ldcw(a) == 0) { |
1445 |
+- local_save_flags(flags_dis); |
1446 |
+- local_irq_restore(flags); |
1447 |
++ while (__ldcw(a) == 0) |
1448 |
+ while (*a == 0) |
1449 |
+- cpu_relax(); |
1450 |
+- local_irq_restore(flags_dis); |
1451 |
+- } |
1452 |
++ if (flags & PSW_SM_I) { |
1453 |
++ local_irq_enable(); |
1454 |
++ cpu_relax(); |
1455 |
++ local_irq_disable(); |
1456 |
++ } else |
1457 |
++ cpu_relax(); |
1458 |
+ } |
1459 |
+ #define arch_spin_lock_flags arch_spin_lock_flags |
1460 |
+ |
1461 |
+@@ -46,12 +37,8 @@ static inline void arch_spin_unlock(arch_spinlock_t *x) |
1462 |
+ volatile unsigned int *a; |
1463 |
+ |
1464 |
+ a = __ldcw_align(x); |
1465 |
+-#ifdef CONFIG_SMP |
1466 |
+- (void) __ldcw(a); |
1467 |
+-#else |
1468 |
+- mb(); |
1469 |
+-#endif |
1470 |
+- *a = 1; |
1471 |
++ /* Release with ordered store. */ |
1472 |
++ __asm__ __volatile__("stw,ma %0,0(%1)" : : "r"(1), "r"(a) : "memory"); |
1473 |
+ } |
1474 |
+ |
1475 |
+ static inline int arch_spin_trylock(arch_spinlock_t *x) |
1476 |
+diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S |
1477 |
+index 4b484ec7c7da..519f9056fd00 100644 |
1478 |
+--- a/arch/parisc/kernel/entry.S |
1479 |
++++ b/arch/parisc/kernel/entry.S |
1480 |
+@@ -454,7 +454,6 @@ |
1481 |
+ nop |
1482 |
+ LDREG 0(\ptp),\pte |
1483 |
+ bb,<,n \pte,_PAGE_PRESENT_BIT,3f |
1484 |
+- LDCW 0(\tmp),\tmp1 |
1485 |
+ b \fault |
1486 |
+ stw \spc,0(\tmp) |
1487 |
+ 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1488 |
+@@ -464,23 +463,26 @@ |
1489 |
+ 3: |
1490 |
+ .endm |
1491 |
+ |
1492 |
+- /* Release pa_tlb_lock lock without reloading lock address. */ |
1493 |
+- .macro tlb_unlock0 spc,tmp,tmp1 |
1494 |
++ /* Release pa_tlb_lock lock without reloading lock address. |
1495 |
++ Note that the values in the register spc are limited to |
1496 |
++ NR_SPACE_IDS (262144). Thus, the stw instruction always |
1497 |
++ stores a nonzero value even when register spc is 64 bits. |
1498 |
++ We use an ordered store to ensure all prior accesses are |
1499 |
++ performed prior to releasing the lock. */ |
1500 |
++ .macro tlb_unlock0 spc,tmp |
1501 |
+ #ifdef CONFIG_SMP |
1502 |
+ 98: or,COND(=) %r0,\spc,%r0 |
1503 |
+- LDCW 0(\tmp),\tmp1 |
1504 |
+- or,COND(=) %r0,\spc,%r0 |
1505 |
+- stw \spc,0(\tmp) |
1506 |
++ stw,ma \spc,0(\tmp) |
1507 |
+ 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1508 |
+ #endif |
1509 |
+ .endm |
1510 |
+ |
1511 |
+ /* Release pa_tlb_lock lock. */ |
1512 |
+- .macro tlb_unlock1 spc,tmp,tmp1 |
1513 |
++ .macro tlb_unlock1 spc,tmp |
1514 |
+ #ifdef CONFIG_SMP |
1515 |
+ 98: load_pa_tlb_lock \tmp |
1516 |
+ 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1517 |
+- tlb_unlock0 \spc,\tmp,\tmp1 |
1518 |
++ tlb_unlock0 \spc,\tmp |
1519 |
+ #endif |
1520 |
+ .endm |
1521 |
+ |
1522 |
+@@ -1163,7 +1165,7 @@ dtlb_miss_20w: |
1523 |
+ |
1524 |
+ idtlbt pte,prot |
1525 |
+ |
1526 |
+- tlb_unlock1 spc,t0,t1 |
1527 |
++ tlb_unlock1 spc,t0 |
1528 |
+ rfir |
1529 |
+ nop |
1530 |
+ |
1531 |
+@@ -1189,7 +1191,7 @@ nadtlb_miss_20w: |
1532 |
+ |
1533 |
+ idtlbt pte,prot |
1534 |
+ |
1535 |
+- tlb_unlock1 spc,t0,t1 |
1536 |
++ tlb_unlock1 spc,t0 |
1537 |
+ rfir |
1538 |
+ nop |
1539 |
+ |
1540 |
+@@ -1223,7 +1225,7 @@ dtlb_miss_11: |
1541 |
+ |
1542 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1543 |
+ |
1544 |
+- tlb_unlock1 spc,t0,t1 |
1545 |
++ tlb_unlock1 spc,t0 |
1546 |
+ rfir |
1547 |
+ nop |
1548 |
+ |
1549 |
+@@ -1256,7 +1258,7 @@ nadtlb_miss_11: |
1550 |
+ |
1551 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1552 |
+ |
1553 |
+- tlb_unlock1 spc,t0,t1 |
1554 |
++ tlb_unlock1 spc,t0 |
1555 |
+ rfir |
1556 |
+ nop |
1557 |
+ |
1558 |
+@@ -1285,7 +1287,7 @@ dtlb_miss_20: |
1559 |
+ |
1560 |
+ idtlbt pte,prot |
1561 |
+ |
1562 |
+- tlb_unlock1 spc,t0,t1 |
1563 |
++ tlb_unlock1 spc,t0 |
1564 |
+ rfir |
1565 |
+ nop |
1566 |
+ |
1567 |
+@@ -1313,7 +1315,7 @@ nadtlb_miss_20: |
1568 |
+ |
1569 |
+ idtlbt pte,prot |
1570 |
+ |
1571 |
+- tlb_unlock1 spc,t0,t1 |
1572 |
++ tlb_unlock1 spc,t0 |
1573 |
+ rfir |
1574 |
+ nop |
1575 |
+ |
1576 |
+@@ -1420,7 +1422,7 @@ itlb_miss_20w: |
1577 |
+ |
1578 |
+ iitlbt pte,prot |
1579 |
+ |
1580 |
+- tlb_unlock1 spc,t0,t1 |
1581 |
++ tlb_unlock1 spc,t0 |
1582 |
+ rfir |
1583 |
+ nop |
1584 |
+ |
1585 |
+@@ -1444,7 +1446,7 @@ naitlb_miss_20w: |
1586 |
+ |
1587 |
+ iitlbt pte,prot |
1588 |
+ |
1589 |
+- tlb_unlock1 spc,t0,t1 |
1590 |
++ tlb_unlock1 spc,t0 |
1591 |
+ rfir |
1592 |
+ nop |
1593 |
+ |
1594 |
+@@ -1478,7 +1480,7 @@ itlb_miss_11: |
1595 |
+ |
1596 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1597 |
+ |
1598 |
+- tlb_unlock1 spc,t0,t1 |
1599 |
++ tlb_unlock1 spc,t0 |
1600 |
+ rfir |
1601 |
+ nop |
1602 |
+ |
1603 |
+@@ -1502,7 +1504,7 @@ naitlb_miss_11: |
1604 |
+ |
1605 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1606 |
+ |
1607 |
+- tlb_unlock1 spc,t0,t1 |
1608 |
++ tlb_unlock1 spc,t0 |
1609 |
+ rfir |
1610 |
+ nop |
1611 |
+ |
1612 |
+@@ -1532,7 +1534,7 @@ itlb_miss_20: |
1613 |
+ |
1614 |
+ iitlbt pte,prot |
1615 |
+ |
1616 |
+- tlb_unlock1 spc,t0,t1 |
1617 |
++ tlb_unlock1 spc,t0 |
1618 |
+ rfir |
1619 |
+ nop |
1620 |
+ |
1621 |
+@@ -1552,7 +1554,7 @@ naitlb_miss_20: |
1622 |
+ |
1623 |
+ iitlbt pte,prot |
1624 |
+ |
1625 |
+- tlb_unlock1 spc,t0,t1 |
1626 |
++ tlb_unlock1 spc,t0 |
1627 |
+ rfir |
1628 |
+ nop |
1629 |
+ |
1630 |
+@@ -1582,7 +1584,7 @@ dbit_trap_20w: |
1631 |
+ |
1632 |
+ idtlbt pte,prot |
1633 |
+ |
1634 |
+- tlb_unlock0 spc,t0,t1 |
1635 |
++ tlb_unlock0 spc,t0 |
1636 |
+ rfir |
1637 |
+ nop |
1638 |
+ #else |
1639 |
+@@ -1608,7 +1610,7 @@ dbit_trap_11: |
1640 |
+ |
1641 |
+ mtsp t1, %sr1 /* Restore sr1 */ |
1642 |
+ |
1643 |
+- tlb_unlock0 spc,t0,t1 |
1644 |
++ tlb_unlock0 spc,t0 |
1645 |
+ rfir |
1646 |
+ nop |
1647 |
+ |
1648 |
+@@ -1628,7 +1630,7 @@ dbit_trap_20: |
1649 |
+ |
1650 |
+ idtlbt pte,prot |
1651 |
+ |
1652 |
+- tlb_unlock0 spc,t0,t1 |
1653 |
++ tlb_unlock0 spc,t0 |
1654 |
+ rfir |
1655 |
+ nop |
1656 |
+ #endif |
1657 |
+diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
1658 |
+index f05c9d5b6b9e..3ad61a177f5b 100644 |
1659 |
+--- a/arch/parisc/kernel/syscall.S |
1660 |
++++ b/arch/parisc/kernel/syscall.S |
1661 |
+@@ -640,11 +640,7 @@ cas_action: |
1662 |
+ sub,<> %r28, %r25, %r0 |
1663 |
+ 2: stw %r24, 0(%r26) |
1664 |
+ /* Free lock */ |
1665 |
+-#ifdef CONFIG_SMP |
1666 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1667 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1668 |
+-#endif |
1669 |
+- stw %r20, 0(%sr2,%r20) |
1670 |
++ stw,ma %r20, 0(%sr2,%r20) |
1671 |
+ #if ENABLE_LWS_DEBUG |
1672 |
+ /* Clear thread register indicator */ |
1673 |
+ stw %r0, 4(%sr2,%r20) |
1674 |
+@@ -658,11 +654,7 @@ cas_action: |
1675 |
+ 3: |
1676 |
+ /* Error occurred on load or store */ |
1677 |
+ /* Free lock */ |
1678 |
+-#ifdef CONFIG_SMP |
1679 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1680 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1681 |
+-#endif |
1682 |
+- stw %r20, 0(%sr2,%r20) |
1683 |
++ stw,ma %r20, 0(%sr2,%r20) |
1684 |
+ #if ENABLE_LWS_DEBUG |
1685 |
+ stw %r0, 4(%sr2,%r20) |
1686 |
+ #endif |
1687 |
+@@ -863,11 +855,7 @@ cas2_action: |
1688 |
+ |
1689 |
+ cas2_end: |
1690 |
+ /* Free lock */ |
1691 |
+-#ifdef CONFIG_SMP |
1692 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1693 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1694 |
+-#endif |
1695 |
+- stw %r20, 0(%sr2,%r20) |
1696 |
++ stw,ma %r20, 0(%sr2,%r20) |
1697 |
+ /* Enable interrupts */ |
1698 |
+ ssm PSW_SM_I, %r0 |
1699 |
+ /* Return to userspace, set no error */ |
1700 |
+@@ -877,11 +865,7 @@ cas2_end: |
1701 |
+ 22: |
1702 |
+ /* Error occurred on load or store */ |
1703 |
+ /* Free lock */ |
1704 |
+-#ifdef CONFIG_SMP |
1705 |
+-98: LDCW 0(%sr2,%r20), %r1 /* Barrier */ |
1706 |
+-99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP) |
1707 |
+-#endif |
1708 |
+- stw %r20, 0(%sr2,%r20) |
1709 |
++ stw,ma %r20, 0(%sr2,%r20) |
1710 |
+ ssm PSW_SM_I, %r0 |
1711 |
+ ldo 1(%r0),%r28 |
1712 |
+ b lws_exit |
1713 |
+diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile |
1714 |
+index 63d7456b9518..2039ed41250d 100644 |
1715 |
+--- a/arch/powerpc/boot/Makefile |
1716 |
++++ b/arch/powerpc/boot/Makefile |
1717 |
+@@ -117,7 +117,7 @@ src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \ |
1718 |
+ elf_util.c $(zlib-y) devtree.c stdlib.c \ |
1719 |
+ oflib.c ofconsole.c cuboot.c |
1720 |
+ |
1721 |
+-src-wlib-$(CONFIG_PPC_MPC52XX) += mpc52xx-psc.c |
1722 |
++src-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c |
1723 |
+ src-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) += opal-calls.S opal.c |
1724 |
+ ifndef CONFIG_PPC64_BOOT_WRAPPER |
1725 |
+ src-wlib-y += crtsavres.S |
1726 |
+diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c |
1727 |
+index 0bfa7e87e546..9a19e5905485 100644 |
1728 |
+--- a/arch/powerpc/boot/serial.c |
1729 |
++++ b/arch/powerpc/boot/serial.c |
1730 |
+@@ -128,7 +128,7 @@ int serial_console_init(void) |
1731 |
+ dt_is_compatible(devp, "fsl,cpm2-smc-uart")) |
1732 |
+ rc = cpm_console_init(devp, &serial_cd); |
1733 |
+ #endif |
1734 |
+-#ifdef CONFIG_PPC_MPC52XX |
1735 |
++#ifdef CONFIG_PPC_MPC52xx |
1736 |
+ else if (dt_is_compatible(devp, "fsl,mpc5200-psc-uart")) |
1737 |
+ rc = mpc5200_psc_console_init(devp, &serial_cd); |
1738 |
+ #endif |
1739 |
+diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h |
1740 |
+index 29188810ba30..925cf89cbf4b 100644 |
1741 |
+--- a/arch/powerpc/include/asm/fixmap.h |
1742 |
++++ b/arch/powerpc/include/asm/fixmap.h |
1743 |
+@@ -52,7 +52,7 @@ enum fixed_addresses { |
1744 |
+ FIX_HOLE, |
1745 |
+ /* reserve the top 128K for early debugging purposes */ |
1746 |
+ FIX_EARLY_DEBUG_TOP = FIX_HOLE, |
1747 |
+- FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+((128*1024)/PAGE_SIZE)-1, |
1748 |
++ FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+(ALIGN(SZ_128, PAGE_SIZE)/PAGE_SIZE)-1, |
1749 |
+ #ifdef CONFIG_HIGHMEM |
1750 |
+ FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ |
1751 |
+ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, |
1752 |
+diff --git a/arch/powerpc/include/asm/perf_event.h b/arch/powerpc/include/asm/perf_event.h |
1753 |
+index eed3954082fa..1e8b2e1ec1db 100644 |
1754 |
+--- a/arch/powerpc/include/asm/perf_event.h |
1755 |
++++ b/arch/powerpc/include/asm/perf_event.h |
1756 |
+@@ -12,6 +12,8 @@ |
1757 |
+ |
1758 |
+ #ifdef CONFIG_PPC_PERF_CTRS |
1759 |
+ #include <asm/perf_event_server.h> |
1760 |
++#else |
1761 |
++static inline bool is_sier_available(void) { return false; } |
1762 |
+ #endif |
1763 |
+ |
1764 |
+ #ifdef CONFIG_FSL_EMB_PERF_EVENT |
1765 |
+diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h |
1766 |
+index ac3970fff0d5..8b5814a36b76 100644 |
1767 |
+--- a/arch/powerpc/include/asm/ptrace.h |
1768 |
++++ b/arch/powerpc/include/asm/ptrace.h |
1769 |
+@@ -238,7 +238,7 @@ static inline void set_trap_norestart(struct pt_regs *regs) |
1770 |
+ } |
1771 |
+ |
1772 |
+ #define arch_has_single_step() (1) |
1773 |
+-#ifndef CONFIG_BOOK3S_601 |
1774 |
++#ifndef CONFIG_PPC_BOOK3S_601 |
1775 |
+ #define arch_has_block_step() (true) |
1776 |
+ #else |
1777 |
+ #define arch_has_block_step() (false) |
1778 |
+diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h |
1779 |
+index 014968f25f7e..0107d724e9da 100644 |
1780 |
+--- a/arch/powerpc/include/asm/rtas.h |
1781 |
++++ b/arch/powerpc/include/asm/rtas.h |
1782 |
+@@ -253,8 +253,6 @@ extern int rtas_set_indicator_fast(int indicator, int index, int new_value); |
1783 |
+ extern void rtas_progress(char *s, unsigned short hex); |
1784 |
+ extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data); |
1785 |
+ extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data); |
1786 |
+-extern int rtas_online_cpus_mask(cpumask_var_t cpus); |
1787 |
+-extern int rtas_offline_cpus_mask(cpumask_var_t cpus); |
1788 |
+ extern int rtas_ibm_suspend_me(u64 handle); |
1789 |
+ |
1790 |
+ struct rtc_time; |
1791 |
+diff --git a/arch/powerpc/include/asm/timex.h b/arch/powerpc/include/asm/timex.h |
1792 |
+index d2d2c4bd8435..6047402b0a4d 100644 |
1793 |
+--- a/arch/powerpc/include/asm/timex.h |
1794 |
++++ b/arch/powerpc/include/asm/timex.h |
1795 |
+@@ -17,7 +17,7 @@ typedef unsigned long cycles_t; |
1796 |
+ |
1797 |
+ static inline cycles_t get_cycles(void) |
1798 |
+ { |
1799 |
+- if (IS_ENABLED(CONFIG_BOOK3S_601)) |
1800 |
++ if (IS_ENABLED(CONFIG_PPC_BOOK3S_601)) |
1801 |
+ return 0; |
1802 |
+ |
1803 |
+ return mftb(); |
1804 |
+diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c |
1805 |
+index 0000daf0e1da..c55e67bab271 100644 |
1806 |
+--- a/arch/powerpc/kernel/hw_breakpoint.c |
1807 |
++++ b/arch/powerpc/kernel/hw_breakpoint.c |
1808 |
+@@ -419,7 +419,7 @@ static int hw_breakpoint_validate_len(struct arch_hw_breakpoint *hw) |
1809 |
+ if (dawr_enabled()) { |
1810 |
+ max_len = DAWR_MAX_LEN; |
1811 |
+ /* DAWR region can't cross 512 bytes boundary */ |
1812 |
+- if (ALIGN(start_addr, SZ_512M) != ALIGN(end_addr - 1, SZ_512M)) |
1813 |
++ if (ALIGN_DOWN(start_addr, SZ_512) != ALIGN_DOWN(end_addr - 1, SZ_512)) |
1814 |
+ return -EINVAL; |
1815 |
+ } else if (IS_ENABLED(CONFIG_PPC_8xx)) { |
1816 |
+ /* 8xx can setup a range without limitation */ |
1817 |
+@@ -498,11 +498,11 @@ static bool dar_in_user_range(unsigned long dar, struct arch_hw_breakpoint *info |
1818 |
+ return ((info->address <= dar) && (dar - info->address < info->len)); |
1819 |
+ } |
1820 |
+ |
1821 |
+-static bool dar_user_range_overlaps(unsigned long dar, int size, |
1822 |
+- struct arch_hw_breakpoint *info) |
1823 |
++static bool ea_user_range_overlaps(unsigned long ea, int size, |
1824 |
++ struct arch_hw_breakpoint *info) |
1825 |
+ { |
1826 |
+- return ((dar < info->address + info->len) && |
1827 |
+- (dar + size > info->address)); |
1828 |
++ return ((ea < info->address + info->len) && |
1829 |
++ (ea + size > info->address)); |
1830 |
+ } |
1831 |
+ |
1832 |
+ static bool dar_in_hw_range(unsigned long dar, struct arch_hw_breakpoint *info) |
1833 |
+@@ -515,20 +515,22 @@ static bool dar_in_hw_range(unsigned long dar, struct arch_hw_breakpoint *info) |
1834 |
+ return ((hw_start_addr <= dar) && (hw_end_addr > dar)); |
1835 |
+ } |
1836 |
+ |
1837 |
+-static bool dar_hw_range_overlaps(unsigned long dar, int size, |
1838 |
+- struct arch_hw_breakpoint *info) |
1839 |
++static bool ea_hw_range_overlaps(unsigned long ea, int size, |
1840 |
++ struct arch_hw_breakpoint *info) |
1841 |
+ { |
1842 |
+ unsigned long hw_start_addr, hw_end_addr; |
1843 |
+ |
1844 |
+ hw_start_addr = ALIGN_DOWN(info->address, HW_BREAKPOINT_SIZE); |
1845 |
+ hw_end_addr = ALIGN(info->address + info->len, HW_BREAKPOINT_SIZE); |
1846 |
+ |
1847 |
+- return ((dar < hw_end_addr) && (dar + size > hw_start_addr)); |
1848 |
++ return ((ea < hw_end_addr) && (ea + size > hw_start_addr)); |
1849 |
+ } |
1850 |
+ |
1851 |
+ /* |
1852 |
+ * If hw has multiple DAWR registers, we also need to check all |
1853 |
+ * dawrx constraint bits to confirm this is _really_ a valid event. |
1854 |
++ * If type is UNKNOWN, but privilege level matches, consider it as |
1855 |
++ * a positive match. |
1856 |
+ */ |
1857 |
+ static bool check_dawrx_constraints(struct pt_regs *regs, int type, |
1858 |
+ struct arch_hw_breakpoint *info) |
1859 |
+@@ -536,7 +538,12 @@ static bool check_dawrx_constraints(struct pt_regs *regs, int type, |
1860 |
+ if (OP_IS_LOAD(type) && !(info->type & HW_BRK_TYPE_READ)) |
1861 |
+ return false; |
1862 |
+ |
1863 |
+- if (OP_IS_STORE(type) && !(info->type & HW_BRK_TYPE_WRITE)) |
1864 |
++ /* |
1865 |
++ * The Cache Management instructions other than dcbz never |
1866 |
++ * cause a match. i.e. if type is CACHEOP, the instruction |
1867 |
++ * is dcbz, and dcbz is treated as Store. |
1868 |
++ */ |
1869 |
++ if ((OP_IS_STORE(type) || type == CACHEOP) && !(info->type & HW_BRK_TYPE_WRITE)) |
1870 |
+ return false; |
1871 |
+ |
1872 |
+ if (is_kernel_addr(regs->nip) && !(info->type & HW_BRK_TYPE_KERNEL)) |
1873 |
+@@ -553,7 +560,8 @@ static bool check_dawrx_constraints(struct pt_regs *regs, int type, |
1874 |
+ * including extraneous exception. Otherwise return false. |
1875 |
+ */ |
1876 |
+ static bool check_constraints(struct pt_regs *regs, struct ppc_inst instr, |
1877 |
+- int type, int size, struct arch_hw_breakpoint *info) |
1878 |
++ unsigned long ea, int type, int size, |
1879 |
++ struct arch_hw_breakpoint *info) |
1880 |
+ { |
1881 |
+ bool in_user_range = dar_in_user_range(regs->dar, info); |
1882 |
+ bool dawrx_constraints; |
1883 |
+@@ -569,22 +577,27 @@ static bool check_constraints(struct pt_regs *regs, struct ppc_inst instr, |
1884 |
+ } |
1885 |
+ |
1886 |
+ if (unlikely(ppc_inst_equal(instr, ppc_inst(0)))) { |
1887 |
+- if (in_user_range) |
1888 |
+- return true; |
1889 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31) && |
1890 |
++ !dar_in_hw_range(regs->dar, info)) |
1891 |
++ return false; |
1892 |
+ |
1893 |
+- if (dar_in_hw_range(regs->dar, info)) { |
1894 |
+- info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ; |
1895 |
+- return true; |
1896 |
+- } |
1897 |
+- return false; |
1898 |
++ return true; |
1899 |
+ } |
1900 |
+ |
1901 |
+ dawrx_constraints = check_dawrx_constraints(regs, type, info); |
1902 |
+ |
1903 |
+- if (dar_user_range_overlaps(regs->dar, size, info)) |
1904 |
++ if (type == UNKNOWN) { |
1905 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31) && |
1906 |
++ !dar_in_hw_range(regs->dar, info)) |
1907 |
++ return false; |
1908 |
++ |
1909 |
++ return dawrx_constraints; |
1910 |
++ } |
1911 |
++ |
1912 |
++ if (ea_user_range_overlaps(ea, size, info)) |
1913 |
+ return dawrx_constraints; |
1914 |
+ |
1915 |
+- if (dar_hw_range_overlaps(regs->dar, size, info)) { |
1916 |
++ if (ea_hw_range_overlaps(ea, size, info)) { |
1917 |
+ if (dawrx_constraints) { |
1918 |
+ info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ; |
1919 |
+ return true; |
1920 |
+@@ -593,8 +606,17 @@ static bool check_constraints(struct pt_regs *regs, struct ppc_inst instr, |
1921 |
+ return false; |
1922 |
+ } |
1923 |
+ |
1924 |
++static int cache_op_size(void) |
1925 |
++{ |
1926 |
++#ifdef __powerpc64__ |
1927 |
++ return ppc64_caches.l1d.block_size; |
1928 |
++#else |
1929 |
++ return L1_CACHE_BYTES; |
1930 |
++#endif |
1931 |
++} |
1932 |
++ |
1933 |
+ static void get_instr_detail(struct pt_regs *regs, struct ppc_inst *instr, |
1934 |
+- int *type, int *size, bool *larx_stcx) |
1935 |
++ int *type, int *size, unsigned long *ea) |
1936 |
+ { |
1937 |
+ struct instruction_op op; |
1938 |
+ |
1939 |
+@@ -602,16 +624,23 @@ static void get_instr_detail(struct pt_regs *regs, struct ppc_inst *instr, |
1940 |
+ return; |
1941 |
+ |
1942 |
+ analyse_instr(&op, regs, *instr); |
1943 |
+- |
1944 |
+- /* |
1945 |
+- * Set size = 8 if analyse_instr() fails. If it's a userspace |
1946 |
+- * watchpoint(valid or extraneous), we can notify user about it. |
1947 |
+- * If it's a kernel watchpoint, instruction emulation will fail |
1948 |
+- * in stepping_handler() and watchpoint will be disabled. |
1949 |
+- */ |
1950 |
+ *type = GETTYPE(op.type); |
1951 |
+- *size = !(*type == UNKNOWN) ? GETSIZE(op.type) : 8; |
1952 |
+- *larx_stcx = (*type == LARX || *type == STCX); |
1953 |
++ *ea = op.ea; |
1954 |
++#ifdef __powerpc64__ |
1955 |
++ if (!(regs->msr & MSR_64BIT)) |
1956 |
++ *ea &= 0xffffffffUL; |
1957 |
++#endif |
1958 |
++ |
1959 |
++ *size = GETSIZE(op.type); |
1960 |
++ if (*type == CACHEOP) { |
1961 |
++ *size = cache_op_size(); |
1962 |
++ *ea &= ~(*size - 1); |
1963 |
++ } |
1964 |
++} |
1965 |
++ |
1966 |
++static bool is_larx_stcx_instr(int type) |
1967 |
++{ |
1968 |
++ return type == LARX || type == STCX; |
1969 |
+ } |
1970 |
+ |
1971 |
+ /* |
1972 |
+@@ -678,7 +707,7 @@ int hw_breakpoint_handler(struct die_args *args) |
1973 |
+ struct ppc_inst instr = ppc_inst(0); |
1974 |
+ int type = 0; |
1975 |
+ int size = 0; |
1976 |
+- bool larx_stcx = false; |
1977 |
++ unsigned long ea; |
1978 |
+ |
1979 |
+ /* Disable breakpoints during exception handling */ |
1980 |
+ hw_breakpoint_disable(); |
1981 |
+@@ -692,7 +721,7 @@ int hw_breakpoint_handler(struct die_args *args) |
1982 |
+ rcu_read_lock(); |
1983 |
+ |
1984 |
+ if (!IS_ENABLED(CONFIG_PPC_8xx)) |
1985 |
+- get_instr_detail(regs, &instr, &type, &size, &larx_stcx); |
1986 |
++ get_instr_detail(regs, &instr, &type, &size, &ea); |
1987 |
+ |
1988 |
+ for (i = 0; i < nr_wp_slots(); i++) { |
1989 |
+ bp[i] = __this_cpu_read(bp_per_reg[i]); |
1990 |
+@@ -702,7 +731,7 @@ int hw_breakpoint_handler(struct die_args *args) |
1991 |
+ info[i] = counter_arch_bp(bp[i]); |
1992 |
+ info[i]->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ; |
1993 |
+ |
1994 |
+- if (check_constraints(regs, instr, type, size, info[i])) { |
1995 |
++ if (check_constraints(regs, instr, ea, type, size, info[i])) { |
1996 |
+ if (!IS_ENABLED(CONFIG_PPC_8xx) && |
1997 |
+ ppc_inst_equal(instr, ppc_inst(0))) { |
1998 |
+ handler_error(bp[i], info[i]); |
1999 |
+@@ -744,7 +773,7 @@ int hw_breakpoint_handler(struct die_args *args) |
2000 |
+ } |
2001 |
+ |
2002 |
+ if (!IS_ENABLED(CONFIG_PPC_8xx)) { |
2003 |
+- if (larx_stcx) { |
2004 |
++ if (is_larx_stcx_instr(type)) { |
2005 |
+ for (i = 0; i < nr_wp_slots(); i++) { |
2006 |
+ if (!hit[i]) |
2007 |
+ continue; |
2008 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
2009 |
+index a09eba03f180..806d554ce357 100644 |
2010 |
+--- a/arch/powerpc/kernel/rtas.c |
2011 |
++++ b/arch/powerpc/kernel/rtas.c |
2012 |
+@@ -843,96 +843,6 @@ static void rtas_percpu_suspend_me(void *info) |
2013 |
+ __rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1); |
2014 |
+ } |
2015 |
+ |
2016 |
+-enum rtas_cpu_state { |
2017 |
+- DOWN, |
2018 |
+- UP, |
2019 |
+-}; |
2020 |
+- |
2021 |
+-#ifndef CONFIG_SMP |
2022 |
+-static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
2023 |
+- cpumask_var_t cpus) |
2024 |
+-{ |
2025 |
+- if (!cpumask_empty(cpus)) { |
2026 |
+- cpumask_clear(cpus); |
2027 |
+- return -EINVAL; |
2028 |
+- } else |
2029 |
+- return 0; |
2030 |
+-} |
2031 |
+-#else |
2032 |
+-/* On return cpumask will be altered to indicate CPUs changed. |
2033 |
+- * CPUs with states changed will be set in the mask, |
2034 |
+- * CPUs with status unchanged will be unset in the mask. */ |
2035 |
+-static int rtas_cpu_state_change_mask(enum rtas_cpu_state state, |
2036 |
+- cpumask_var_t cpus) |
2037 |
+-{ |
2038 |
+- int cpu; |
2039 |
+- int cpuret = 0; |
2040 |
+- int ret = 0; |
2041 |
+- |
2042 |
+- if (cpumask_empty(cpus)) |
2043 |
+- return 0; |
2044 |
+- |
2045 |
+- for_each_cpu(cpu, cpus) { |
2046 |
+- struct device *dev = get_cpu_device(cpu); |
2047 |
+- |
2048 |
+- switch (state) { |
2049 |
+- case DOWN: |
2050 |
+- cpuret = device_offline(dev); |
2051 |
+- break; |
2052 |
+- case UP: |
2053 |
+- cpuret = device_online(dev); |
2054 |
+- break; |
2055 |
+- } |
2056 |
+- if (cpuret < 0) { |
2057 |
+- pr_debug("%s: cpu_%s for cpu#%d returned %d.\n", |
2058 |
+- __func__, |
2059 |
+- ((state == UP) ? "up" : "down"), |
2060 |
+- cpu, cpuret); |
2061 |
+- if (!ret) |
2062 |
+- ret = cpuret; |
2063 |
+- if (state == UP) { |
2064 |
+- /* clear bits for unchanged cpus, return */ |
2065 |
+- cpumask_shift_right(cpus, cpus, cpu); |
2066 |
+- cpumask_shift_left(cpus, cpus, cpu); |
2067 |
+- break; |
2068 |
+- } else { |
2069 |
+- /* clear bit for unchanged cpu, continue */ |
2070 |
+- cpumask_clear_cpu(cpu, cpus); |
2071 |
+- } |
2072 |
+- } |
2073 |
+- cond_resched(); |
2074 |
+- } |
2075 |
+- |
2076 |
+- return ret; |
2077 |
+-} |
2078 |
+-#endif |
2079 |
+- |
2080 |
+-int rtas_online_cpus_mask(cpumask_var_t cpus) |
2081 |
+-{ |
2082 |
+- int ret; |
2083 |
+- |
2084 |
+- ret = rtas_cpu_state_change_mask(UP, cpus); |
2085 |
+- |
2086 |
+- if (ret) { |
2087 |
+- cpumask_var_t tmp_mask; |
2088 |
+- |
2089 |
+- if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL)) |
2090 |
+- return ret; |
2091 |
+- |
2092 |
+- /* Use tmp_mask to preserve cpus mask from first failure */ |
2093 |
+- cpumask_copy(tmp_mask, cpus); |
2094 |
+- rtas_offline_cpus_mask(tmp_mask); |
2095 |
+- free_cpumask_var(tmp_mask); |
2096 |
+- } |
2097 |
+- |
2098 |
+- return ret; |
2099 |
+-} |
2100 |
+- |
2101 |
+-int rtas_offline_cpus_mask(cpumask_var_t cpus) |
2102 |
+-{ |
2103 |
+- return rtas_cpu_state_change_mask(DOWN, cpus); |
2104 |
+-} |
2105 |
+- |
2106 |
+ int rtas_ibm_suspend_me(u64 handle) |
2107 |
+ { |
2108 |
+ long state; |
2109 |
+@@ -940,8 +850,6 @@ int rtas_ibm_suspend_me(u64 handle) |
2110 |
+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
2111 |
+ struct rtas_suspend_me_data data; |
2112 |
+ DECLARE_COMPLETION_ONSTACK(done); |
2113 |
+- cpumask_var_t offline_mask; |
2114 |
+- int cpuret; |
2115 |
+ |
2116 |
+ if (!rtas_service_present("ibm,suspend-me")) |
2117 |
+ return -ENOSYS; |
2118 |
+@@ -962,9 +870,6 @@ int rtas_ibm_suspend_me(u64 handle) |
2119 |
+ return -EIO; |
2120 |
+ } |
2121 |
+ |
2122 |
+- if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL)) |
2123 |
+- return -ENOMEM; |
2124 |
+- |
2125 |
+ atomic_set(&data.working, 0); |
2126 |
+ atomic_set(&data.done, 0); |
2127 |
+ atomic_set(&data.error, 0); |
2128 |
+@@ -973,24 +878,8 @@ int rtas_ibm_suspend_me(u64 handle) |
2129 |
+ |
2130 |
+ lock_device_hotplug(); |
2131 |
+ |
2132 |
+- /* All present CPUs must be online */ |
2133 |
+- cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask); |
2134 |
+- cpuret = rtas_online_cpus_mask(offline_mask); |
2135 |
+- if (cpuret) { |
2136 |
+- pr_err("%s: Could not bring present CPUs online.\n", __func__); |
2137 |
+- atomic_set(&data.error, cpuret); |
2138 |
+- goto out; |
2139 |
+- } |
2140 |
+- |
2141 |
+ cpu_hotplug_disable(); |
2142 |
+ |
2143 |
+- /* Check if we raced with a CPU-Offline Operation */ |
2144 |
+- if (!cpumask_equal(cpu_present_mask, cpu_online_mask)) { |
2145 |
+- pr_info("%s: Raced against a concurrent CPU-Offline\n", __func__); |
2146 |
+- atomic_set(&data.error, -EAGAIN); |
2147 |
+- goto out_hotplug_enable; |
2148 |
+- } |
2149 |
+- |
2150 |
+ /* Call function on all CPUs. One of us will make the |
2151 |
+ * rtas call |
2152 |
+ */ |
2153 |
+@@ -1001,18 +890,11 @@ int rtas_ibm_suspend_me(u64 handle) |
2154 |
+ if (atomic_read(&data.error) != 0) |
2155 |
+ printk(KERN_ERR "Error doing global join\n"); |
2156 |
+ |
2157 |
+-out_hotplug_enable: |
2158 |
+- cpu_hotplug_enable(); |
2159 |
+ |
2160 |
+- /* Take down CPUs not online prior to suspend */ |
2161 |
+- cpuret = rtas_offline_cpus_mask(offline_mask); |
2162 |
+- if (cpuret) |
2163 |
+- pr_warn("%s: Could not restore CPUs to offline state.\n", |
2164 |
+- __func__); |
2165 |
++ cpu_hotplug_enable(); |
2166 |
+ |
2167 |
+-out: |
2168 |
+ unlock_device_hotplug(); |
2169 |
+- free_cpumask_var(offline_mask); |
2170 |
++ |
2171 |
+ return atomic_read(&data.error); |
2172 |
+ } |
2173 |
+ |
2174 |
+diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c |
2175 |
+index e0f4ba45b6cc..8dad44262e75 100644 |
2176 |
+--- a/arch/powerpc/kernel/vdso.c |
2177 |
++++ b/arch/powerpc/kernel/vdso.c |
2178 |
+@@ -677,7 +677,7 @@ int vdso_getcpu_init(void) |
2179 |
+ node = cpu_to_node(cpu); |
2180 |
+ WARN_ON_ONCE(node > 0xffff); |
2181 |
+ |
2182 |
+- val = (cpu & 0xfff) | ((node & 0xffff) << 16); |
2183 |
++ val = (cpu & 0xffff) | ((node & 0xffff) << 16); |
2184 |
+ mtspr(SPRN_SPRG_VDSO_WRITE, val); |
2185 |
+ get_paca()->sprg_vdso = val; |
2186 |
+ |
2187 |
+diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c |
2188 |
+index 9b9f92ad0e7a..3d5c9092feb1 100644 |
2189 |
+--- a/arch/powerpc/mm/book3s64/hash_utils.c |
2190 |
++++ b/arch/powerpc/mm/book3s64/hash_utils.c |
2191 |
+@@ -663,11 +663,10 @@ static void __init htab_init_page_sizes(void) |
2192 |
+ * Pick a size for the linear mapping. Currently, we only |
2193 |
+ * support 16M, 1M and 4K which is the default |
2194 |
+ */ |
2195 |
+- if (IS_ENABLED(STRICT_KERNEL_RWX) && |
2196 |
++ if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX) && |
2197 |
+ (unsigned long)_stext % 0x1000000) { |
2198 |
+ if (mmu_psize_defs[MMU_PAGE_16M].shift) |
2199 |
+- pr_warn("Kernel not 16M aligned, " |
2200 |
+- "disabling 16M linear map alignment"); |
2201 |
++ pr_warn("Kernel not 16M aligned, disabling 16M linear map alignment\n"); |
2202 |
+ aligned = false; |
2203 |
+ } |
2204 |
+ |
2205 |
+diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c |
2206 |
+index d174106bab67..82ace6acb0aa 100644 |
2207 |
+--- a/arch/powerpc/mm/book3s64/pkeys.c |
2208 |
++++ b/arch/powerpc/mm/book3s64/pkeys.c |
2209 |
+@@ -83,13 +83,17 @@ static int pkey_initialize(void) |
2210 |
+ scan_pkey_feature(); |
2211 |
+ |
2212 |
+ /* |
2213 |
+- * Let's assume 32 pkeys on P8 bare metal, if its not defined by device |
2214 |
+- * tree. We make this exception since skiboot forgot to expose this |
2215 |
+- * property on power8. |
2216 |
++ * Let's assume 32 pkeys on P8/P9 bare metal, if its not defined by device |
2217 |
++ * tree. We make this exception since some version of skiboot forgot to |
2218 |
++ * expose this property on power8/9. |
2219 |
+ */ |
2220 |
+- if (!pkeys_devtree_defined && !firmware_has_feature(FW_FEATURE_LPAR) && |
2221 |
+- cpu_has_feature(CPU_FTRS_POWER8)) |
2222 |
+- pkeys_total = 32; |
2223 |
++ if (!pkeys_devtree_defined && !firmware_has_feature(FW_FEATURE_LPAR)) { |
2224 |
++ unsigned long pvr = mfspr(SPRN_PVR); |
2225 |
++ |
2226 |
++ if (PVR_VER(pvr) == PVR_POWER8 || PVR_VER(pvr) == PVR_POWER8E || |
2227 |
++ PVR_VER(pvr) == PVR_POWER8NVL || PVR_VER(pvr) == PVR_POWER9) |
2228 |
++ pkeys_total = 32; |
2229 |
++ } |
2230 |
+ |
2231 |
+ /* |
2232 |
+ * Adjust the upper limit, based on the number of bits supported by |
2233 |
+diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c |
2234 |
+index bb00e0cba119..c2989c171883 100644 |
2235 |
+--- a/arch/powerpc/mm/book3s64/radix_pgtable.c |
2236 |
++++ b/arch/powerpc/mm/book3s64/radix_pgtable.c |
2237 |
+@@ -700,6 +700,21 @@ static void free_pmd_table(pmd_t *pmd_start, pud_t *pud) |
2238 |
+ pud_clear(pud); |
2239 |
+ } |
2240 |
+ |
2241 |
++static void free_pud_table(pud_t *pud_start, p4d_t *p4d) |
2242 |
++{ |
2243 |
++ pud_t *pud; |
2244 |
++ int i; |
2245 |
++ |
2246 |
++ for (i = 0; i < PTRS_PER_PUD; i++) { |
2247 |
++ pud = pud_start + i; |
2248 |
++ if (!pud_none(*pud)) |
2249 |
++ return; |
2250 |
++ } |
2251 |
++ |
2252 |
++ pud_free(&init_mm, pud_start); |
2253 |
++ p4d_clear(p4d); |
2254 |
++} |
2255 |
++ |
2256 |
+ struct change_mapping_params { |
2257 |
+ pte_t *pte; |
2258 |
+ unsigned long start; |
2259 |
+@@ -874,6 +889,7 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end) |
2260 |
+ |
2261 |
+ pud_base = (pud_t *)p4d_page_vaddr(*p4d); |
2262 |
+ remove_pud_table(pud_base, addr, next); |
2263 |
++ free_pud_table(pud_base, p4d); |
2264 |
+ } |
2265 |
+ |
2266 |
+ spin_unlock(&init_mm.page_table_lock); |
2267 |
+diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c |
2268 |
+index 3b75e8f60609..014d1c045bc3 100644 |
2269 |
+--- a/arch/powerpc/platforms/cell/spufs/coredump.c |
2270 |
++++ b/arch/powerpc/platforms/cell/spufs/coredump.c |
2271 |
+@@ -105,7 +105,7 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i, |
2272 |
+ size_t sz = spufs_coredump_read[i].size; |
2273 |
+ char fullname[80]; |
2274 |
+ struct elf_note en; |
2275 |
+- size_t ret; |
2276 |
++ int ret; |
2277 |
+ |
2278 |
+ sprintf(fullname, "SPU/%d/%s", dfd, spufs_coredump_read[i].name); |
2279 |
+ en.n_namesz = strlen(fullname) + 1; |
2280 |
+diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c |
2281 |
+index 3e8cbfe7a80f..6d4ee03d476a 100644 |
2282 |
+--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c |
2283 |
++++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c |
2284 |
+@@ -35,54 +35,10 @@ |
2285 |
+ #include <asm/topology.h> |
2286 |
+ |
2287 |
+ #include "pseries.h" |
2288 |
+-#include "offline_states.h" |
2289 |
+ |
2290 |
+ /* This version can't take the spinlock, because it never returns */ |
2291 |
+ static int rtas_stop_self_token = RTAS_UNKNOWN_SERVICE; |
2292 |
+ |
2293 |
+-static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = |
2294 |
+- CPU_STATE_OFFLINE; |
2295 |
+-static DEFINE_PER_CPU(enum cpu_state_vals, current_state) = CPU_STATE_OFFLINE; |
2296 |
+- |
2297 |
+-static enum cpu_state_vals default_offline_state = CPU_STATE_OFFLINE; |
2298 |
+- |
2299 |
+-static bool cede_offline_enabled __read_mostly = true; |
2300 |
+- |
2301 |
+-/* |
2302 |
+- * Enable/disable cede_offline when available. |
2303 |
+- */ |
2304 |
+-static int __init setup_cede_offline(char *str) |
2305 |
+-{ |
2306 |
+- return (kstrtobool(str, &cede_offline_enabled) == 0); |
2307 |
+-} |
2308 |
+- |
2309 |
+-__setup("cede_offline=", setup_cede_offline); |
2310 |
+- |
2311 |
+-enum cpu_state_vals get_cpu_current_state(int cpu) |
2312 |
+-{ |
2313 |
+- return per_cpu(current_state, cpu); |
2314 |
+-} |
2315 |
+- |
2316 |
+-void set_cpu_current_state(int cpu, enum cpu_state_vals state) |
2317 |
+-{ |
2318 |
+- per_cpu(current_state, cpu) = state; |
2319 |
+-} |
2320 |
+- |
2321 |
+-enum cpu_state_vals get_preferred_offline_state(int cpu) |
2322 |
+-{ |
2323 |
+- return per_cpu(preferred_offline_state, cpu); |
2324 |
+-} |
2325 |
+- |
2326 |
+-void set_preferred_offline_state(int cpu, enum cpu_state_vals state) |
2327 |
+-{ |
2328 |
+- per_cpu(preferred_offline_state, cpu) = state; |
2329 |
+-} |
2330 |
+- |
2331 |
+-void set_default_offline_state(int cpu) |
2332 |
+-{ |
2333 |
+- per_cpu(preferred_offline_state, cpu) = default_offline_state; |
2334 |
+-} |
2335 |
+- |
2336 |
+ static void rtas_stop_self(void) |
2337 |
+ { |
2338 |
+ static struct rtas_args args; |
2339 |
+@@ -101,9 +57,7 @@ static void rtas_stop_self(void) |
2340 |
+ |
2341 |
+ static void pseries_mach_cpu_die(void) |
2342 |
+ { |
2343 |
+- unsigned int cpu = smp_processor_id(); |
2344 |
+ unsigned int hwcpu = hard_smp_processor_id(); |
2345 |
+- u8 cede_latency_hint = 0; |
2346 |
+ |
2347 |
+ local_irq_disable(); |
2348 |
+ idle_task_exit(); |
2349 |
+@@ -112,49 +66,6 @@ static void pseries_mach_cpu_die(void) |
2350 |
+ else |
2351 |
+ xics_teardown_cpu(); |
2352 |
+ |
2353 |
+- if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { |
2354 |
+- set_cpu_current_state(cpu, CPU_STATE_INACTIVE); |
2355 |
+- if (ppc_md.suspend_disable_cpu) |
2356 |
+- ppc_md.suspend_disable_cpu(); |
2357 |
+- |
2358 |
+- cede_latency_hint = 2; |
2359 |
+- |
2360 |
+- get_lppaca()->idle = 1; |
2361 |
+- if (!lppaca_shared_proc(get_lppaca())) |
2362 |
+- get_lppaca()->donate_dedicated_cpu = 1; |
2363 |
+- |
2364 |
+- while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { |
2365 |
+- while (!prep_irq_for_idle()) { |
2366 |
+- local_irq_enable(); |
2367 |
+- local_irq_disable(); |
2368 |
+- } |
2369 |
+- |
2370 |
+- extended_cede_processor(cede_latency_hint); |
2371 |
+- } |
2372 |
+- |
2373 |
+- local_irq_disable(); |
2374 |
+- |
2375 |
+- if (!lppaca_shared_proc(get_lppaca())) |
2376 |
+- get_lppaca()->donate_dedicated_cpu = 0; |
2377 |
+- get_lppaca()->idle = 0; |
2378 |
+- |
2379 |
+- if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { |
2380 |
+- unregister_slb_shadow(hwcpu); |
2381 |
+- |
2382 |
+- hard_irq_disable(); |
2383 |
+- /* |
2384 |
+- * Call to start_secondary_resume() will not return. |
2385 |
+- * Kernel stack will be reset and start_secondary() |
2386 |
+- * will be called to continue the online operation. |
2387 |
+- */ |
2388 |
+- start_secondary_resume(); |
2389 |
+- } |
2390 |
+- } |
2391 |
+- |
2392 |
+- /* Requested state is CPU_STATE_OFFLINE at this point */ |
2393 |
+- WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE); |
2394 |
+- |
2395 |
+- set_cpu_current_state(cpu, CPU_STATE_OFFLINE); |
2396 |
+ unregister_slb_shadow(hwcpu); |
2397 |
+ rtas_stop_self(); |
2398 |
+ |
2399 |
+@@ -200,24 +111,13 @@ static void pseries_cpu_die(unsigned int cpu) |
2400 |
+ int cpu_status = 1; |
2401 |
+ unsigned int pcpu = get_hard_smp_processor_id(cpu); |
2402 |
+ |
2403 |
+- if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { |
2404 |
+- cpu_status = 1; |
2405 |
+- for (tries = 0; tries < 5000; tries++) { |
2406 |
+- if (get_cpu_current_state(cpu) == CPU_STATE_INACTIVE) { |
2407 |
+- cpu_status = 0; |
2408 |
+- break; |
2409 |
+- } |
2410 |
+- msleep(1); |
2411 |
+- } |
2412 |
+- } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) { |
2413 |
++ for (tries = 0; tries < 25; tries++) { |
2414 |
++ cpu_status = smp_query_cpu_stopped(pcpu); |
2415 |
++ if (cpu_status == QCSS_STOPPED || |
2416 |
++ cpu_status == QCSS_HARDWARE_ERROR) |
2417 |
++ break; |
2418 |
++ cpu_relax(); |
2419 |
+ |
2420 |
+- for (tries = 0; tries < 25; tries++) { |
2421 |
+- cpu_status = smp_query_cpu_stopped(pcpu); |
2422 |
+- if (cpu_status == QCSS_STOPPED || |
2423 |
+- cpu_status == QCSS_HARDWARE_ERROR) |
2424 |
+- break; |
2425 |
+- cpu_relax(); |
2426 |
+- } |
2427 |
+ } |
2428 |
+ |
2429 |
+ if (cpu_status != 0) { |
2430 |
+@@ -359,28 +259,15 @@ static int dlpar_offline_cpu(struct device_node *dn) |
2431 |
+ if (get_hard_smp_processor_id(cpu) != thread) |
2432 |
+ continue; |
2433 |
+ |
2434 |
+- if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE) |
2435 |
++ if (!cpu_online(cpu)) |
2436 |
+ break; |
2437 |
+ |
2438 |
+- if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { |
2439 |
+- set_preferred_offline_state(cpu, |
2440 |
+- CPU_STATE_OFFLINE); |
2441 |
+- cpu_maps_update_done(); |
2442 |
+- timed_topology_update(1); |
2443 |
+- rc = device_offline(get_cpu_device(cpu)); |
2444 |
+- if (rc) |
2445 |
+- goto out; |
2446 |
+- cpu_maps_update_begin(); |
2447 |
+- break; |
2448 |
+- } |
2449 |
+- |
2450 |
+- /* |
2451 |
+- * The cpu is in CPU_STATE_INACTIVE. |
2452 |
+- * Upgrade it's state to CPU_STATE_OFFLINE. |
2453 |
+- */ |
2454 |
+- set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); |
2455 |
+- WARN_ON(plpar_hcall_norets(H_PROD, thread) != H_SUCCESS); |
2456 |
+- __cpu_die(cpu); |
2457 |
++ cpu_maps_update_done(); |
2458 |
++ timed_topology_update(1); |
2459 |
++ rc = device_offline(get_cpu_device(cpu)); |
2460 |
++ if (rc) |
2461 |
++ goto out; |
2462 |
++ cpu_maps_update_begin(); |
2463 |
+ break; |
2464 |
+ } |
2465 |
+ if (cpu == num_possible_cpus()) { |
2466 |
+@@ -414,8 +301,6 @@ static int dlpar_online_cpu(struct device_node *dn) |
2467 |
+ for_each_present_cpu(cpu) { |
2468 |
+ if (get_hard_smp_processor_id(cpu) != thread) |
2469 |
+ continue; |
2470 |
+- BUG_ON(get_cpu_current_state(cpu) |
2471 |
+- != CPU_STATE_OFFLINE); |
2472 |
+ cpu_maps_update_done(); |
2473 |
+ timed_topology_update(1); |
2474 |
+ find_and_online_cpu_nid(cpu); |
2475 |
+@@ -854,7 +739,6 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add) |
2476 |
+ parent = of_find_node_by_path("/cpus"); |
2477 |
+ if (!parent) { |
2478 |
+ pr_warn("Could not find CPU root node in device tree\n"); |
2479 |
+- kfree(cpu_drcs); |
2480 |
+ return -1; |
2481 |
+ } |
2482 |
+ |
2483 |
+@@ -1013,27 +897,8 @@ static struct notifier_block pseries_smp_nb = { |
2484 |
+ .notifier_call = pseries_smp_notifier, |
2485 |
+ }; |
2486 |
+ |
2487 |
+-#define MAX_CEDE_LATENCY_LEVELS 4 |
2488 |
+-#define CEDE_LATENCY_PARAM_LENGTH 10 |
2489 |
+-#define CEDE_LATENCY_PARAM_MAX_LENGTH \ |
2490 |
+- (MAX_CEDE_LATENCY_LEVELS * CEDE_LATENCY_PARAM_LENGTH * sizeof(char)) |
2491 |
+-#define CEDE_LATENCY_TOKEN 45 |
2492 |
+- |
2493 |
+-static char cede_parameters[CEDE_LATENCY_PARAM_MAX_LENGTH]; |
2494 |
+- |
2495 |
+-static int parse_cede_parameters(void) |
2496 |
+-{ |
2497 |
+- memset(cede_parameters, 0, CEDE_LATENCY_PARAM_MAX_LENGTH); |
2498 |
+- return rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, |
2499 |
+- NULL, |
2500 |
+- CEDE_LATENCY_TOKEN, |
2501 |
+- __pa(cede_parameters), |
2502 |
+- CEDE_LATENCY_PARAM_MAX_LENGTH); |
2503 |
+-} |
2504 |
+- |
2505 |
+ static int __init pseries_cpu_hotplug_init(void) |
2506 |
+ { |
2507 |
+- int cpu; |
2508 |
+ int qcss_tok; |
2509 |
+ |
2510 |
+ #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE |
2511 |
+@@ -1056,16 +921,8 @@ static int __init pseries_cpu_hotplug_init(void) |
2512 |
+ smp_ops->cpu_die = pseries_cpu_die; |
2513 |
+ |
2514 |
+ /* Processors can be added/removed only on LPAR */ |
2515 |
+- if (firmware_has_feature(FW_FEATURE_LPAR)) { |
2516 |
++ if (firmware_has_feature(FW_FEATURE_LPAR)) |
2517 |
+ of_reconfig_notifier_register(&pseries_smp_nb); |
2518 |
+- cpu_maps_update_begin(); |
2519 |
+- if (cede_offline_enabled && parse_cede_parameters() == 0) { |
2520 |
+- default_offline_state = CPU_STATE_INACTIVE; |
2521 |
+- for_each_online_cpu(cpu) |
2522 |
+- set_default_offline_state(cpu); |
2523 |
+- } |
2524 |
+- cpu_maps_update_done(); |
2525 |
+- } |
2526 |
+ |
2527 |
+ return 0; |
2528 |
+ } |
2529 |
+diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h |
2530 |
+deleted file mode 100644 |
2531 |
+index 51414aee2862..000000000000 |
2532 |
+--- a/arch/powerpc/platforms/pseries/offline_states.h |
2533 |
++++ /dev/null |
2534 |
+@@ -1,38 +0,0 @@ |
2535 |
+-/* SPDX-License-Identifier: GPL-2.0 */ |
2536 |
+-#ifndef _OFFLINE_STATES_H_ |
2537 |
+-#define _OFFLINE_STATES_H_ |
2538 |
+- |
2539 |
+-/* Cpu offline states go here */ |
2540 |
+-enum cpu_state_vals { |
2541 |
+- CPU_STATE_OFFLINE, |
2542 |
+- CPU_STATE_INACTIVE, |
2543 |
+- CPU_STATE_ONLINE, |
2544 |
+- CPU_MAX_OFFLINE_STATES |
2545 |
+-}; |
2546 |
+- |
2547 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2548 |
+-extern enum cpu_state_vals get_cpu_current_state(int cpu); |
2549 |
+-extern void set_cpu_current_state(int cpu, enum cpu_state_vals state); |
2550 |
+-extern void set_preferred_offline_state(int cpu, enum cpu_state_vals state); |
2551 |
+-extern void set_default_offline_state(int cpu); |
2552 |
+-#else |
2553 |
+-static inline enum cpu_state_vals get_cpu_current_state(int cpu) |
2554 |
+-{ |
2555 |
+- return CPU_STATE_ONLINE; |
2556 |
+-} |
2557 |
+- |
2558 |
+-static inline void set_cpu_current_state(int cpu, enum cpu_state_vals state) |
2559 |
+-{ |
2560 |
+-} |
2561 |
+- |
2562 |
+-static inline void set_preferred_offline_state(int cpu, enum cpu_state_vals state) |
2563 |
+-{ |
2564 |
+-} |
2565 |
+- |
2566 |
+-static inline void set_default_offline_state(int cpu) |
2567 |
+-{ |
2568 |
+-} |
2569 |
+-#endif |
2570 |
+- |
2571 |
+-extern enum cpu_state_vals get_preferred_offline_state(int cpu); |
2572 |
+-#endif |
2573 |
+diff --git a/arch/powerpc/platforms/pseries/pmem.c b/arch/powerpc/platforms/pseries/pmem.c |
2574 |
+index f860a897a9e0..f827de7087e9 100644 |
2575 |
+--- a/arch/powerpc/platforms/pseries/pmem.c |
2576 |
++++ b/arch/powerpc/platforms/pseries/pmem.c |
2577 |
+@@ -24,7 +24,6 @@ |
2578 |
+ #include <asm/topology.h> |
2579 |
+ |
2580 |
+ #include "pseries.h" |
2581 |
+-#include "offline_states.h" |
2582 |
+ |
2583 |
+ static struct device_node *pmem_node; |
2584 |
+ |
2585 |
+diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c |
2586 |
+index 6891710833be..7ebacac03dc3 100644 |
2587 |
+--- a/arch/powerpc/platforms/pseries/smp.c |
2588 |
++++ b/arch/powerpc/platforms/pseries/smp.c |
2589 |
+@@ -44,8 +44,6 @@ |
2590 |
+ #include <asm/svm.h> |
2591 |
+ |
2592 |
+ #include "pseries.h" |
2593 |
+-#include "offline_states.h" |
2594 |
+- |
2595 |
+ |
2596 |
+ /* |
2597 |
+ * The Primary thread of each non-boot processor was started from the OF client |
2598 |
+@@ -108,10 +106,7 @@ static inline int smp_startup_cpu(unsigned int lcpu) |
2599 |
+ |
2600 |
+ /* Fixup atomic count: it exited inside IRQ handler. */ |
2601 |
+ task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count = 0; |
2602 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2603 |
+- if (get_cpu_current_state(lcpu) == CPU_STATE_INACTIVE) |
2604 |
+- goto out; |
2605 |
+-#endif |
2606 |
++ |
2607 |
+ /* |
2608 |
+ * If the RTAS start-cpu token does not exist then presume the |
2609 |
+ * cpu is already spinning. |
2610 |
+@@ -126,9 +121,6 @@ static inline int smp_startup_cpu(unsigned int lcpu) |
2611 |
+ return 0; |
2612 |
+ } |
2613 |
+ |
2614 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2615 |
+-out: |
2616 |
+-#endif |
2617 |
+ return 1; |
2618 |
+ } |
2619 |
+ |
2620 |
+@@ -143,10 +135,6 @@ static void smp_setup_cpu(int cpu) |
2621 |
+ vpa_init(cpu); |
2622 |
+ |
2623 |
+ cpumask_clear_cpu(cpu, of_spin_mask); |
2624 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2625 |
+- set_cpu_current_state(cpu, CPU_STATE_ONLINE); |
2626 |
+- set_default_offline_state(cpu); |
2627 |
+-#endif |
2628 |
+ } |
2629 |
+ |
2630 |
+ static int smp_pSeries_kick_cpu(int nr) |
2631 |
+@@ -163,20 +151,6 @@ static int smp_pSeries_kick_cpu(int nr) |
2632 |
+ * the processor will continue on to secondary_start |
2633 |
+ */ |
2634 |
+ paca_ptrs[nr]->cpu_start = 1; |
2635 |
+-#ifdef CONFIG_HOTPLUG_CPU |
2636 |
+- set_preferred_offline_state(nr, CPU_STATE_ONLINE); |
2637 |
+- |
2638 |
+- if (get_cpu_current_state(nr) == CPU_STATE_INACTIVE) { |
2639 |
+- long rc; |
2640 |
+- unsigned long hcpuid; |
2641 |
+- |
2642 |
+- hcpuid = get_hard_smp_processor_id(nr); |
2643 |
+- rc = plpar_hcall_norets(H_PROD, hcpuid); |
2644 |
+- if (rc != H_SUCCESS) |
2645 |
+- printk(KERN_ERR "Error: Prod to wake up processor %d " |
2646 |
+- "Ret= %ld\n", nr, rc); |
2647 |
+- } |
2648 |
+-#endif |
2649 |
+ |
2650 |
+ return 0; |
2651 |
+ } |
2652 |
+diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c |
2653 |
+index 0a24a5a185f0..f789693f61f4 100644 |
2654 |
+--- a/arch/powerpc/platforms/pseries/suspend.c |
2655 |
++++ b/arch/powerpc/platforms/pseries/suspend.c |
2656 |
+@@ -132,15 +132,11 @@ static ssize_t store_hibernate(struct device *dev, |
2657 |
+ struct device_attribute *attr, |
2658 |
+ const char *buf, size_t count) |
2659 |
+ { |
2660 |
+- cpumask_var_t offline_mask; |
2661 |
+ int rc; |
2662 |
+ |
2663 |
+ if (!capable(CAP_SYS_ADMIN)) |
2664 |
+ return -EPERM; |
2665 |
+ |
2666 |
+- if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL)) |
2667 |
+- return -ENOMEM; |
2668 |
+- |
2669 |
+ stream_id = simple_strtoul(buf, NULL, 16); |
2670 |
+ |
2671 |
+ do { |
2672 |
+@@ -150,32 +146,16 @@ static ssize_t store_hibernate(struct device *dev, |
2673 |
+ } while (rc == -EAGAIN); |
2674 |
+ |
2675 |
+ if (!rc) { |
2676 |
+- /* All present CPUs must be online */ |
2677 |
+- cpumask_andnot(offline_mask, cpu_present_mask, |
2678 |
+- cpu_online_mask); |
2679 |
+- rc = rtas_online_cpus_mask(offline_mask); |
2680 |
+- if (rc) { |
2681 |
+- pr_err("%s: Could not bring present CPUs online.\n", |
2682 |
+- __func__); |
2683 |
+- goto out; |
2684 |
+- } |
2685 |
+- |
2686 |
+ stop_topology_update(); |
2687 |
+ rc = pm_suspend(PM_SUSPEND_MEM); |
2688 |
+ start_topology_update(); |
2689 |
+- |
2690 |
+- /* Take down CPUs not online prior to suspend */ |
2691 |
+- if (!rtas_offline_cpus_mask(offline_mask)) |
2692 |
+- pr_warn("%s: Could not restore CPUs to offline " |
2693 |
+- "state.\n", __func__); |
2694 |
+ } |
2695 |
+ |
2696 |
+ stream_id = 0; |
2697 |
+ |
2698 |
+ if (!rc) |
2699 |
+ rc = count; |
2700 |
+-out: |
2701 |
+- free_cpumask_var(offline_mask); |
2702 |
++ |
2703 |
+ return rc; |
2704 |
+ } |
2705 |
+ |
2706 |
+diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h |
2707 |
+index fbb507504a3b..3a0ac0c7a9a3 100644 |
2708 |
+--- a/arch/s390/include/asm/topology.h |
2709 |
++++ b/arch/s390/include/asm/topology.h |
2710 |
+@@ -86,12 +86,6 @@ static inline const struct cpumask *cpumask_of_node(int node) |
2711 |
+ |
2712 |
+ #define pcibus_to_node(bus) __pcibus_to_node(bus) |
2713 |
+ |
2714 |
+-#define node_distance(a, b) __node_distance(a, b) |
2715 |
+-static inline int __node_distance(int a, int b) |
2716 |
+-{ |
2717 |
+- return 0; |
2718 |
+-} |
2719 |
+- |
2720 |
+ #else /* !CONFIG_NUMA */ |
2721 |
+ |
2722 |
+ #define numa_node_id numa_node_id |
2723 |
+diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c |
2724 |
+index 190357ff86b3..46c1bf2a3b4b 100644 |
2725 |
+--- a/arch/s390/mm/gmap.c |
2726 |
++++ b/arch/s390/mm/gmap.c |
2727 |
+@@ -2485,23 +2485,36 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long bitmap[4], |
2728 |
+ } |
2729 |
+ EXPORT_SYMBOL_GPL(gmap_sync_dirty_log_pmd); |
2730 |
+ |
2731 |
++#ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2732 |
++static int thp_split_walk_pmd_entry(pmd_t *pmd, unsigned long addr, |
2733 |
++ unsigned long end, struct mm_walk *walk) |
2734 |
++{ |
2735 |
++ struct vm_area_struct *vma = walk->vma; |
2736 |
++ |
2737 |
++ split_huge_pmd(vma, pmd, addr); |
2738 |
++ return 0; |
2739 |
++} |
2740 |
++ |
2741 |
++static const struct mm_walk_ops thp_split_walk_ops = { |
2742 |
++ .pmd_entry = thp_split_walk_pmd_entry, |
2743 |
++}; |
2744 |
++ |
2745 |
+ static inline void thp_split_mm(struct mm_struct *mm) |
2746 |
+ { |
2747 |
+-#ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2748 |
+ struct vm_area_struct *vma; |
2749 |
+- unsigned long addr; |
2750 |
+ |
2751 |
+ for (vma = mm->mmap; vma != NULL; vma = vma->vm_next) { |
2752 |
+- for (addr = vma->vm_start; |
2753 |
+- addr < vma->vm_end; |
2754 |
+- addr += PAGE_SIZE) |
2755 |
+- follow_page(vma, addr, FOLL_SPLIT); |
2756 |
+ vma->vm_flags &= ~VM_HUGEPAGE; |
2757 |
+ vma->vm_flags |= VM_NOHUGEPAGE; |
2758 |
++ walk_page_vma(vma, &thp_split_walk_ops, NULL); |
2759 |
+ } |
2760 |
+ mm->def_flags |= VM_NOHUGEPAGE; |
2761 |
+-#endif |
2762 |
+ } |
2763 |
++#else |
2764 |
++static inline void thp_split_mm(struct mm_struct *mm) |
2765 |
++{ |
2766 |
++} |
2767 |
++#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
2768 |
+ |
2769 |
+ /* |
2770 |
+ * Remove all empty zero pages from the mapping for lazy refaulting |
2771 |
+diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c |
2772 |
+index f4242b894cf2..a78c5b59e1ab 100644 |
2773 |
+--- a/arch/s390/net/bpf_jit_comp.c |
2774 |
++++ b/arch/s390/net/bpf_jit_comp.c |
2775 |
+@@ -489,6 +489,24 @@ static void save_restore_regs(struct bpf_jit *jit, int op, u32 stack_depth) |
2776 |
+ } while (re <= last); |
2777 |
+ } |
2778 |
+ |
2779 |
++static void bpf_skip(struct bpf_jit *jit, int size) |
2780 |
++{ |
2781 |
++ if (size >= 6 && !is_valid_rel(size)) { |
2782 |
++ /* brcl 0xf,size */ |
2783 |
++ EMIT6_PCREL_RIL(0xc0f4000000, size); |
2784 |
++ size -= 6; |
2785 |
++ } else if (size >= 4 && is_valid_rel(size)) { |
2786 |
++ /* brc 0xf,size */ |
2787 |
++ EMIT4_PCREL(0xa7f40000, size); |
2788 |
++ size -= 4; |
2789 |
++ } |
2790 |
++ while (size >= 2) { |
2791 |
++ /* bcr 0,%0 */ |
2792 |
++ _EMIT2(0x0700); |
2793 |
++ size -= 2; |
2794 |
++ } |
2795 |
++} |
2796 |
++ |
2797 |
+ /* |
2798 |
+ * Emit function prologue |
2799 |
+ * |
2800 |
+@@ -1268,8 +1286,12 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, |
2801 |
+ last = (i == fp->len - 1) ? 1 : 0; |
2802 |
+ if (last) |
2803 |
+ break; |
2804 |
+- /* j <exit> */ |
2805 |
+- EMIT4_PCREL(0xa7f40000, jit->exit_ip - jit->prg); |
2806 |
++ if (!is_first_pass(jit) && can_use_rel(jit, jit->exit_ip)) |
2807 |
++ /* brc 0xf, <exit> */ |
2808 |
++ EMIT4_PCREL_RIC(0xa7040000, 0xf, jit->exit_ip); |
2809 |
++ else |
2810 |
++ /* brcl 0xf, <exit> */ |
2811 |
++ EMIT6_PCREL_RILC(0xc0040000, 0xf, jit->exit_ip); |
2812 |
+ break; |
2813 |
+ /* |
2814 |
+ * Branch relative (number of skipped instructions) to offset on |
2815 |
+@@ -1417,21 +1439,10 @@ branch_ks: |
2816 |
+ } |
2817 |
+ break; |
2818 |
+ branch_ku: |
2819 |
+- is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32; |
2820 |
+- /* clfi or clgfi %dst,imm */ |
2821 |
+- EMIT6_IMM(is_jmp32 ? 0xc20f0000 : 0xc20e0000, |
2822 |
+- dst_reg, imm); |
2823 |
+- if (!is_first_pass(jit) && |
2824 |
+- can_use_rel(jit, addrs[i + off + 1])) { |
2825 |
+- /* brc mask,off */ |
2826 |
+- EMIT4_PCREL_RIC(0xa7040000, |
2827 |
+- mask >> 12, addrs[i + off + 1]); |
2828 |
+- } else { |
2829 |
+- /* brcl mask,off */ |
2830 |
+- EMIT6_PCREL_RILC(0xc0040000, |
2831 |
+- mask >> 12, addrs[i + off + 1]); |
2832 |
+- } |
2833 |
+- break; |
2834 |
++ /* lgfi %w1,imm (load sign extend imm) */ |
2835 |
++ src_reg = REG_1; |
2836 |
++ EMIT6_IMM(0xc0010000, src_reg, imm); |
2837 |
++ goto branch_xu; |
2838 |
+ branch_xs: |
2839 |
+ is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32; |
2840 |
+ if (!is_first_pass(jit) && |
2841 |
+@@ -1510,7 +1521,14 @@ static bool bpf_is_new_addr_sane(struct bpf_jit *jit, int i) |
2842 |
+ */ |
2843 |
+ static int bpf_set_addr(struct bpf_jit *jit, int i) |
2844 |
+ { |
2845 |
+- if (!bpf_is_new_addr_sane(jit, i)) |
2846 |
++ int delta; |
2847 |
++ |
2848 |
++ if (is_codegen_pass(jit)) { |
2849 |
++ delta = jit->prg - jit->addrs[i]; |
2850 |
++ if (delta < 0) |
2851 |
++ bpf_skip(jit, -delta); |
2852 |
++ } |
2853 |
++ if (WARN_ON_ONCE(!bpf_is_new_addr_sane(jit, i))) |
2854 |
+ return -1; |
2855 |
+ jit->addrs[i] = jit->prg; |
2856 |
+ return 0; |
2857 |
+diff --git a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S |
2858 |
+index ec437db1fa54..494a3bda8487 100644 |
2859 |
+--- a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S |
2860 |
++++ b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S |
2861 |
+@@ -127,10 +127,6 @@ ddq_add_8: |
2862 |
+ |
2863 |
+ /* generate a unique variable for ddq_add_x */ |
2864 |
+ |
2865 |
+-.macro setddq n |
2866 |
+- var_ddq_add = ddq_add_\n |
2867 |
+-.endm |
2868 |
+- |
2869 |
+ /* generate a unique variable for xmm register */ |
2870 |
+ .macro setxdata n |
2871 |
+ var_xdata = %xmm\n |
2872 |
+@@ -140,9 +136,7 @@ ddq_add_8: |
2873 |
+ |
2874 |
+ .macro club name, id |
2875 |
+ .altmacro |
2876 |
+- .if \name == DDQ_DATA |
2877 |
+- setddq %\id |
2878 |
+- .elseif \name == XDATA |
2879 |
++ .if \name == XDATA |
2880 |
+ setxdata %\id |
2881 |
+ .endif |
2882 |
+ .noaltmacro |
2883 |
+@@ -165,9 +159,8 @@ ddq_add_8: |
2884 |
+ |
2885 |
+ .set i, 1 |
2886 |
+ .rept (by - 1) |
2887 |
+- club DDQ_DATA, i |
2888 |
+ club XDATA, i |
2889 |
+- vpaddq var_ddq_add(%rip), xcounter, var_xdata |
2890 |
++ vpaddq (ddq_add_1 + 16 * (i - 1))(%rip), xcounter, var_xdata |
2891 |
+ vptest ddq_low_msk(%rip), var_xdata |
2892 |
+ jnz 1f |
2893 |
+ vpaddq ddq_high_add_1(%rip), var_xdata, var_xdata |
2894 |
+@@ -180,8 +173,7 @@ ddq_add_8: |
2895 |
+ vmovdqa 1*16(p_keys), xkeyA |
2896 |
+ |
2897 |
+ vpxor xkey0, xdata0, xdata0 |
2898 |
+- club DDQ_DATA, by |
2899 |
+- vpaddq var_ddq_add(%rip), xcounter, xcounter |
2900 |
++ vpaddq (ddq_add_1 + 16 * (by - 1))(%rip), xcounter, xcounter |
2901 |
+ vptest ddq_low_msk(%rip), xcounter |
2902 |
+ jnz 1f |
2903 |
+ vpaddq ddq_high_add_1(%rip), xcounter, xcounter |
2904 |
+diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S |
2905 |
+index 54e7d15dbd0d..7d4298e6d4cb 100644 |
2906 |
+--- a/arch/x86/crypto/aesni-intel_asm.S |
2907 |
++++ b/arch/x86/crypto/aesni-intel_asm.S |
2908 |
+@@ -266,7 +266,7 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff |
2909 |
+ PSHUFB_XMM %xmm2, %xmm0 |
2910 |
+ movdqu %xmm0, CurCount(%arg2) # ctx_data.current_counter = iv |
2911 |
+ |
2912 |
+- PRECOMPUTE \SUBKEY, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, |
2913 |
++ PRECOMPUTE \SUBKEY, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7 |
2914 |
+ movdqu HashKey(%arg2), %xmm13 |
2915 |
+ |
2916 |
+ CALC_AAD_HASH %xmm13, \AAD, \AADLEN, %xmm0, %xmm1, %xmm2, %xmm3, \ |
2917 |
+@@ -978,7 +978,7 @@ _initial_blocks_done\@: |
2918 |
+ * arg1, %arg3, %arg4 are used as pointers only, not modified |
2919 |
+ * %r11 is the data offset value |
2920 |
+ */ |
2921 |
+-.macro GHASH_4_ENCRYPT_4_PARALLEL_ENC TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2922 |
++.macro GHASH_4_ENCRYPT_4_PARALLEL_enc TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2923 |
+ TMP6 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 operation |
2924 |
+ |
2925 |
+ movdqa \XMM1, \XMM5 |
2926 |
+@@ -1186,7 +1186,7 @@ aes_loop_par_enc_done\@: |
2927 |
+ * arg1, %arg3, %arg4 are used as pointers only, not modified |
2928 |
+ * %r11 is the data offset value |
2929 |
+ */ |
2930 |
+-.macro GHASH_4_ENCRYPT_4_PARALLEL_DEC TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2931 |
++.macro GHASH_4_ENCRYPT_4_PARALLEL_dec TMP1 TMP2 TMP3 TMP4 TMP5 \ |
2932 |
+ TMP6 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 operation |
2933 |
+ |
2934 |
+ movdqa \XMM1, \XMM5 |
2935 |
+diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S |
2936 |
+index 8501ec4532f4..442599cbe796 100644 |
2937 |
+--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S |
2938 |
++++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S |
2939 |
+@@ -170,7 +170,7 @@ continue_block: |
2940 |
+ |
2941 |
+ ## branch into array |
2942 |
+ lea jump_table(%rip), %bufp |
2943 |
+- movzxw (%bufp, %rax, 2), len |
2944 |
++ movzwq (%bufp, %rax, 2), len |
2945 |
+ lea crc_array(%rip), %bufp |
2946 |
+ lea (%bufp, len, 1), %bufp |
2947 |
+ JMP_NOSPEC bufp |
2948 |
+diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c |
2949 |
+index 3de1065eefc4..1038e9f1e354 100644 |
2950 |
+--- a/arch/x86/events/intel/uncore_snb.c |
2951 |
++++ b/arch/x86/events/intel/uncore_snb.c |
2952 |
+@@ -1085,6 +1085,7 @@ static struct pci_dev *tgl_uncore_get_mc_dev(void) |
2953 |
+ } |
2954 |
+ |
2955 |
+ #define TGL_UNCORE_MMIO_IMC_MEM_OFFSET 0x10000 |
2956 |
++#define TGL_UNCORE_PCI_IMC_MAP_SIZE 0xe000 |
2957 |
+ |
2958 |
+ static void tgl_uncore_imc_freerunning_init_box(struct intel_uncore_box *box) |
2959 |
+ { |
2960 |
+@@ -1112,7 +1113,7 @@ static void tgl_uncore_imc_freerunning_init_box(struct intel_uncore_box *box) |
2961 |
+ addr |= ((resource_size_t)mch_bar << 32); |
2962 |
+ #endif |
2963 |
+ |
2964 |
+- box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE); |
2965 |
++ box->io_addr = ioremap(addr, TGL_UNCORE_PCI_IMC_MAP_SIZE); |
2966 |
+ } |
2967 |
+ |
2968 |
+ static struct intel_uncore_ops tgl_uncore_imc_freerunning_ops = { |
2969 |
+diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h |
2970 |
+index 79d8d5496330..f4234575f3fd 100644 |
2971 |
+--- a/arch/x86/include/asm/topology.h |
2972 |
++++ b/arch/x86/include/asm/topology.h |
2973 |
+@@ -193,7 +193,7 @@ static inline void sched_clear_itmt_support(void) |
2974 |
+ } |
2975 |
+ #endif /* CONFIG_SCHED_MC_PRIO */ |
2976 |
+ |
2977 |
+-#ifdef CONFIG_SMP |
2978 |
++#if defined(CONFIG_SMP) && defined(CONFIG_X86_64) |
2979 |
+ #include <asm/cpufeature.h> |
2980 |
+ |
2981 |
+ DECLARE_STATIC_KEY_FALSE(arch_scale_freq_key); |
2982 |
+diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h |
2983 |
+index 18dfa07d3ef0..2f3e8f2a958f 100644 |
2984 |
+--- a/arch/x86/include/asm/uaccess.h |
2985 |
++++ b/arch/x86/include/asm/uaccess.h |
2986 |
+@@ -314,11 +314,14 @@ do { \ |
2987 |
+ |
2988 |
+ #define __get_user_size(x, ptr, size, retval) \ |
2989 |
+ do { \ |
2990 |
++ unsigned char x_u8__; \ |
2991 |
++ \ |
2992 |
+ retval = 0; \ |
2993 |
+ __chk_user_ptr(ptr); \ |
2994 |
+ switch (size) { \ |
2995 |
+ case 1: \ |
2996 |
+- __get_user_asm(x, ptr, retval, "b", "=q"); \ |
2997 |
++ __get_user_asm(x_u8__, ptr, retval, "b", "=q"); \ |
2998 |
++ (x) = x_u8__; \ |
2999 |
+ break; \ |
3000 |
+ case 2: \ |
3001 |
+ __get_user_asm(x, ptr, retval, "w", "=r"); \ |
3002 |
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
3003 |
+index 81ffcfbfaef2..21325a4a78b9 100644 |
3004 |
+--- a/arch/x86/kernel/apic/io_apic.c |
3005 |
++++ b/arch/x86/kernel/apic/io_apic.c |
3006 |
+@@ -2335,8 +2335,13 @@ static int mp_irqdomain_create(int ioapic) |
3007 |
+ |
3008 |
+ static void ioapic_destroy_irqdomain(int idx) |
3009 |
+ { |
3010 |
++ struct ioapic_domain_cfg *cfg = &ioapics[idx].irqdomain_cfg; |
3011 |
++ struct fwnode_handle *fn = ioapics[idx].irqdomain->fwnode; |
3012 |
++ |
3013 |
+ if (ioapics[idx].irqdomain) { |
3014 |
+ irq_domain_remove(ioapics[idx].irqdomain); |
3015 |
++ if (!cfg->dev) |
3016 |
++ irq_domain_free_fwnode(fn); |
3017 |
+ ioapics[idx].irqdomain = NULL; |
3018 |
+ } |
3019 |
+ } |
3020 |
+diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c |
3021 |
+index 0593b192eb8f..7843ab3fde09 100644 |
3022 |
+--- a/arch/x86/kernel/cpu/mce/inject.c |
3023 |
++++ b/arch/x86/kernel/cpu/mce/inject.c |
3024 |
+@@ -511,7 +511,7 @@ static void do_inject(void) |
3025 |
+ */ |
3026 |
+ if (inj_type == DFR_INT_INJ) { |
3027 |
+ i_mce.status |= MCI_STATUS_DEFERRED; |
3028 |
+- i_mce.status |= (i_mce.status & ~MCI_STATUS_UC); |
3029 |
++ i_mce.status &= ~MCI_STATUS_UC; |
3030 |
+ } |
3031 |
+ |
3032 |
+ /* |
3033 |
+diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c |
3034 |
+index 9a97415b2139..3ebc70bd01e8 100644 |
3035 |
+--- a/arch/x86/kernel/process_64.c |
3036 |
++++ b/arch/x86/kernel/process_64.c |
3037 |
+@@ -314,7 +314,7 @@ static unsigned long x86_fsgsbase_read_task(struct task_struct *task, |
3038 |
+ */ |
3039 |
+ mutex_lock(&task->mm->context.lock); |
3040 |
+ ldt = task->mm->context.ldt; |
3041 |
+- if (unlikely(idx >= ldt->nr_entries)) |
3042 |
++ if (unlikely(!ldt || idx >= ldt->nr_entries)) |
3043 |
+ base = 0; |
3044 |
+ else |
3045 |
+ base = get_desc_base(ldt->entries + idx); |
3046 |
+diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c |
3047 |
+index ffbd9a3d78d8..518ac6bf752e 100644 |
3048 |
+--- a/arch/x86/kernel/smpboot.c |
3049 |
++++ b/arch/x86/kernel/smpboot.c |
3050 |
+@@ -56,6 +56,7 @@ |
3051 |
+ #include <linux/cpuidle.h> |
3052 |
+ #include <linux/numa.h> |
3053 |
+ #include <linux/pgtable.h> |
3054 |
++#include <linux/overflow.h> |
3055 |
+ |
3056 |
+ #include <asm/acpi.h> |
3057 |
+ #include <asm/desc.h> |
3058 |
+@@ -1777,6 +1778,7 @@ void native_play_dead(void) |
3059 |
+ |
3060 |
+ #endif |
3061 |
+ |
3062 |
++#ifdef CONFIG_X86_64 |
3063 |
+ /* |
3064 |
+ * APERF/MPERF frequency ratio computation. |
3065 |
+ * |
3066 |
+@@ -1975,6 +1977,7 @@ static bool core_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq) |
3067 |
+ static bool intel_set_max_freq_ratio(void) |
3068 |
+ { |
3069 |
+ u64 base_freq, turbo_freq; |
3070 |
++ u64 turbo_ratio; |
3071 |
+ |
3072 |
+ if (slv_set_max_freq_ratio(&base_freq, &turbo_freq)) |
3073 |
+ goto out; |
3074 |
+@@ -2000,15 +2003,23 @@ out: |
3075 |
+ /* |
3076 |
+ * Some hypervisors advertise X86_FEATURE_APERFMPERF |
3077 |
+ * but then fill all MSR's with zeroes. |
3078 |
++ * Some CPUs have turbo boost but don't declare any turbo ratio |
3079 |
++ * in MSR_TURBO_RATIO_LIMIT. |
3080 |
+ */ |
3081 |
+- if (!base_freq) { |
3082 |
+- pr_debug("Couldn't determine cpu base frequency, necessary for scale-invariant accounting.\n"); |
3083 |
++ if (!base_freq || !turbo_freq) { |
3084 |
++ pr_debug("Couldn't determine cpu base or turbo frequency, necessary for scale-invariant accounting.\n"); |
3085 |
+ return false; |
3086 |
+ } |
3087 |
+ |
3088 |
+- arch_turbo_freq_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, |
3089 |
+- base_freq); |
3090 |
++ turbo_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, base_freq); |
3091 |
++ if (!turbo_ratio) { |
3092 |
++ pr_debug("Non-zero turbo and base frequencies led to a 0 ratio.\n"); |
3093 |
++ return false; |
3094 |
++ } |
3095 |
++ |
3096 |
++ arch_turbo_freq_ratio = turbo_ratio; |
3097 |
+ arch_set_max_freq_ratio(turbo_disabled()); |
3098 |
++ |
3099 |
+ return true; |
3100 |
+ } |
3101 |
+ |
3102 |
+@@ -2048,11 +2059,19 @@ static void init_freq_invariance(bool secondary) |
3103 |
+ } |
3104 |
+ } |
3105 |
+ |
3106 |
++static void disable_freq_invariance_workfn(struct work_struct *work) |
3107 |
++{ |
3108 |
++ static_branch_disable(&arch_scale_freq_key); |
3109 |
++} |
3110 |
++ |
3111 |
++static DECLARE_WORK(disable_freq_invariance_work, |
3112 |
++ disable_freq_invariance_workfn); |
3113 |
++ |
3114 |
+ DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE; |
3115 |
+ |
3116 |
+ void arch_scale_freq_tick(void) |
3117 |
+ { |
3118 |
+- u64 freq_scale; |
3119 |
++ u64 freq_scale = SCHED_CAPACITY_SCALE; |
3120 |
+ u64 aperf, mperf; |
3121 |
+ u64 acnt, mcnt; |
3122 |
+ |
3123 |
+@@ -2064,19 +2083,32 @@ void arch_scale_freq_tick(void) |
3124 |
+ |
3125 |
+ acnt = aperf - this_cpu_read(arch_prev_aperf); |
3126 |
+ mcnt = mperf - this_cpu_read(arch_prev_mperf); |
3127 |
+- if (!mcnt) |
3128 |
+- return; |
3129 |
+ |
3130 |
+ this_cpu_write(arch_prev_aperf, aperf); |
3131 |
+ this_cpu_write(arch_prev_mperf, mperf); |
3132 |
+ |
3133 |
+- acnt <<= 2*SCHED_CAPACITY_SHIFT; |
3134 |
+- mcnt *= arch_max_freq_ratio; |
3135 |
++ if (check_shl_overflow(acnt, 2*SCHED_CAPACITY_SHIFT, &acnt)) |
3136 |
++ goto error; |
3137 |
++ |
3138 |
++ if (check_mul_overflow(mcnt, arch_max_freq_ratio, &mcnt) || !mcnt) |
3139 |
++ goto error; |
3140 |
+ |
3141 |
+ freq_scale = div64_u64(acnt, mcnt); |
3142 |
++ if (!freq_scale) |
3143 |
++ goto error; |
3144 |
+ |
3145 |
+ if (freq_scale > SCHED_CAPACITY_SCALE) |
3146 |
+ freq_scale = SCHED_CAPACITY_SCALE; |
3147 |
+ |
3148 |
+ this_cpu_write(arch_freq_scale, freq_scale); |
3149 |
++ return; |
3150 |
++ |
3151 |
++error: |
3152 |
++ pr_warn("Scheduler frequency invariance went wobbly, disabling!\n"); |
3153 |
++ schedule_work(&disable_freq_invariance_work); |
3154 |
++} |
3155 |
++#else |
3156 |
++static inline void init_freq_invariance(bool secondary) |
3157 |
++{ |
3158 |
+ } |
3159 |
++#endif /* CONFIG_X86_64 */ |
3160 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
3161 |
+index 5bbf76189afa..f8ead44c3265 100644 |
3162 |
+--- a/arch/x86/kvm/svm/svm.c |
3163 |
++++ b/arch/x86/kvm/svm/svm.c |
3164 |
+@@ -2522,7 +2522,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) |
3165 |
+ !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)) |
3166 |
+ return 1; |
3167 |
+ |
3168 |
+- if (data & ~kvm_spec_ctrl_valid_bits(vcpu)) |
3169 |
++ if (kvm_spec_ctrl_test_value(data)) |
3170 |
+ return 1; |
3171 |
+ |
3172 |
+ svm->spec_ctrl = data; |
3173 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
3174 |
+index 13745f2a5ecd..eb33c764d159 100644 |
3175 |
+--- a/arch/x86/kvm/vmx/vmx.c |
3176 |
++++ b/arch/x86/kvm/vmx/vmx.c |
3177 |
+@@ -2062,7 +2062,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
3178 |
+ !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) |
3179 |
+ return 1; |
3180 |
+ |
3181 |
+- if (data & ~kvm_spec_ctrl_valid_bits(vcpu)) |
3182 |
++ if (kvm_spec_ctrl_test_value(data)) |
3183 |
+ return 1; |
3184 |
+ |
3185 |
+ vmx->spec_ctrl = data; |
3186 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
3187 |
+index 88c593f83b28..4fe976c2495e 100644 |
3188 |
+--- a/arch/x86/kvm/x86.c |
3189 |
++++ b/arch/x86/kvm/x86.c |
3190 |
+@@ -10676,28 +10676,32 @@ bool kvm_arch_no_poll(struct kvm_vcpu *vcpu) |
3191 |
+ } |
3192 |
+ EXPORT_SYMBOL_GPL(kvm_arch_no_poll); |
3193 |
+ |
3194 |
+-u64 kvm_spec_ctrl_valid_bits(struct kvm_vcpu *vcpu) |
3195 |
++ |
3196 |
++int kvm_spec_ctrl_test_value(u64 value) |
3197 |
+ { |
3198 |
+- uint64_t bits = SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_SSBD; |
3199 |
++ /* |
3200 |
++ * test that setting IA32_SPEC_CTRL to given value |
3201 |
++ * is allowed by the host processor |
3202 |
++ */ |
3203 |
++ |
3204 |
++ u64 saved_value; |
3205 |
++ unsigned long flags; |
3206 |
++ int ret = 0; |
3207 |
+ |
3208 |
+- /* The STIBP bit doesn't fault even if it's not advertised */ |
3209 |
+- if (!guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) && |
3210 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS)) |
3211 |
+- bits &= ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP); |
3212 |
+- if (!boot_cpu_has(X86_FEATURE_SPEC_CTRL) && |
3213 |
+- !boot_cpu_has(X86_FEATURE_AMD_IBRS)) |
3214 |
+- bits &= ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP); |
3215 |
++ local_irq_save(flags); |
3216 |
+ |
3217 |
+- if (!guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL_SSBD) && |
3218 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)) |
3219 |
+- bits &= ~SPEC_CTRL_SSBD; |
3220 |
+- if (!boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) && |
3221 |
+- !boot_cpu_has(X86_FEATURE_AMD_SSBD)) |
3222 |
+- bits &= ~SPEC_CTRL_SSBD; |
3223 |
++ if (rdmsrl_safe(MSR_IA32_SPEC_CTRL, &saved_value)) |
3224 |
++ ret = 1; |
3225 |
++ else if (wrmsrl_safe(MSR_IA32_SPEC_CTRL, value)) |
3226 |
++ ret = 1; |
3227 |
++ else |
3228 |
++ wrmsrl(MSR_IA32_SPEC_CTRL, saved_value); |
3229 |
+ |
3230 |
+- return bits; |
3231 |
++ local_irq_restore(flags); |
3232 |
++ |
3233 |
++ return ret; |
3234 |
+ } |
3235 |
+-EXPORT_SYMBOL_GPL(kvm_spec_ctrl_valid_bits); |
3236 |
++EXPORT_SYMBOL_GPL(kvm_spec_ctrl_test_value); |
3237 |
+ |
3238 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); |
3239 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_fast_mmio); |
3240 |
+diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h |
3241 |
+index 6eb62e97e59f..1878799d8661 100644 |
3242 |
+--- a/arch/x86/kvm/x86.h |
3243 |
++++ b/arch/x86/kvm/x86.h |
3244 |
+@@ -363,7 +363,7 @@ static inline bool kvm_dr7_valid(u64 data) |
3245 |
+ |
3246 |
+ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu); |
3247 |
+ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu); |
3248 |
+-u64 kvm_spec_ctrl_valid_bits(struct kvm_vcpu *vcpu); |
3249 |
++int kvm_spec_ctrl_test_value(u64 value); |
3250 |
+ bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu); |
3251 |
+ |
3252 |
+ #endif |
3253 |
+diff --git a/block/blk-iocost.c b/block/blk-iocost.c |
3254 |
+index 8ac4aad66ebc..86ba6fd254e1 100644 |
3255 |
+--- a/block/blk-iocost.c |
3256 |
++++ b/block/blk-iocost.c |
3257 |
+@@ -1370,7 +1370,7 @@ static void ioc_timer_fn(struct timer_list *timer) |
3258 |
+ * should have woken up in the last period and expire idle iocgs. |
3259 |
+ */ |
3260 |
+ list_for_each_entry_safe(iocg, tiocg, &ioc->active_iocgs, active_list) { |
3261 |
+- if (!waitqueue_active(&iocg->waitq) && iocg->abs_vdebt && |
3262 |
++ if (!waitqueue_active(&iocg->waitq) && !iocg->abs_vdebt && |
3263 |
+ !iocg_is_idle(iocg)) |
3264 |
+ continue; |
3265 |
+ |
3266 |
+diff --git a/block/blk-zoned.c b/block/blk-zoned.c |
3267 |
+index 23831fa8701d..480dfff69a00 100644 |
3268 |
+--- a/block/blk-zoned.c |
3269 |
++++ b/block/blk-zoned.c |
3270 |
+@@ -497,6 +497,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk, |
3271 |
+ if (WARN_ON_ONCE(!queue_is_mq(q))) |
3272 |
+ return -EIO; |
3273 |
+ |
3274 |
++ if (!get_capacity(disk)) |
3275 |
++ return -EIO; |
3276 |
++ |
3277 |
+ /* |
3278 |
+ * Ensure that all memory allocations in this context are done as if |
3279 |
+ * GFP_NOIO was specified. |
3280 |
+diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c |
3281 |
+index a4e306690a21..4a0f03157e08 100644 |
3282 |
+--- a/drivers/acpi/acpica/exprep.c |
3283 |
++++ b/drivers/acpi/acpica/exprep.c |
3284 |
+@@ -473,10 +473,6 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) |
3285 |
+ (u8)access_byte_width; |
3286 |
+ } |
3287 |
+ } |
3288 |
+- /* An additional reference for the container */ |
3289 |
+- |
3290 |
+- acpi_ut_add_reference(obj_desc->field.region_obj); |
3291 |
+- |
3292 |
+ ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
3293 |
+ "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
3294 |
+ obj_desc->field.start_field_bit_offset, |
3295 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
3296 |
+index c365faf4e6cd..4c0d4e434196 100644 |
3297 |
+--- a/drivers/acpi/acpica/utdelete.c |
3298 |
++++ b/drivers/acpi/acpica/utdelete.c |
3299 |
+@@ -568,11 +568,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
3300 |
+ next_object = object->buffer_field.buffer_obj; |
3301 |
+ break; |
3302 |
+ |
3303 |
+- case ACPI_TYPE_LOCAL_REGION_FIELD: |
3304 |
+- |
3305 |
+- next_object = object->field.region_obj; |
3306 |
+- break; |
3307 |
+- |
3308 |
+ case ACPI_TYPE_LOCAL_BANK_FIELD: |
3309 |
+ |
3310 |
+ next_object = object->bank_field.bank_obj; |
3311 |
+@@ -613,6 +608,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
3312 |
+ } |
3313 |
+ break; |
3314 |
+ |
3315 |
++ case ACPI_TYPE_LOCAL_REGION_FIELD: |
3316 |
+ case ACPI_TYPE_REGION: |
3317 |
+ default: |
3318 |
+ |
3319 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
3320 |
+index 48ca81cb8ebc..e8628716ea34 100644 |
3321 |
+--- a/drivers/base/dd.c |
3322 |
++++ b/drivers/base/dd.c |
3323 |
+@@ -276,7 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) |
3324 |
+ |
3325 |
+ list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) |
3326 |
+ dev_info(private->device, "deferred probe pending\n"); |
3327 |
+- wake_up(&probe_timeout_waitqueue); |
3328 |
++ wake_up_all(&probe_timeout_waitqueue); |
3329 |
+ } |
3330 |
+ static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); |
3331 |
+ |
3332 |
+@@ -487,7 +487,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) |
3333 |
+ drv->bus->name, __func__, drv->name, dev_name(dev)); |
3334 |
+ if (!list_empty(&dev->devres_head)) { |
3335 |
+ dev_crit(dev, "Resources present before probing\n"); |
3336 |
+- return -EBUSY; |
3337 |
++ ret = -EBUSY; |
3338 |
++ goto done; |
3339 |
+ } |
3340 |
+ |
3341 |
+ re_probe: |
3342 |
+@@ -607,7 +608,7 @@ pinctrl_bind_failed: |
3343 |
+ ret = 0; |
3344 |
+ done: |
3345 |
+ atomic_dec(&probe_count); |
3346 |
+- wake_up(&probe_waitqueue); |
3347 |
++ wake_up_all(&probe_waitqueue); |
3348 |
+ return ret; |
3349 |
+ } |
3350 |
+ |
3351 |
+diff --git a/drivers/base/firmware_loader/fallback_platform.c b/drivers/base/firmware_loader/fallback_platform.c |
3352 |
+index cdd2c9a9f38a..685edb7dd05a 100644 |
3353 |
+--- a/drivers/base/firmware_loader/fallback_platform.c |
3354 |
++++ b/drivers/base/firmware_loader/fallback_platform.c |
3355 |
+@@ -25,7 +25,10 @@ int firmware_fallback_platform(struct fw_priv *fw_priv, u32 opt_flags) |
3356 |
+ if (rc) |
3357 |
+ return rc; /* rc == -ENOENT when the fw was not found */ |
3358 |
+ |
3359 |
+- fw_priv->data = vmalloc(size); |
3360 |
++ if (fw_priv->data && size > fw_priv->allocated_size) |
3361 |
++ return -ENOMEM; |
3362 |
++ if (!fw_priv->data) |
3363 |
++ fw_priv->data = vmalloc(size); |
3364 |
+ if (!fw_priv->data) |
3365 |
+ return -ENOMEM; |
3366 |
+ |
3367 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
3368 |
+index 475e1a738560..776083963ee6 100644 |
3369 |
+--- a/drivers/block/loop.c |
3370 |
++++ b/drivers/block/loop.c |
3371 |
+@@ -2402,6 +2402,8 @@ static void __exit loop_exit(void) |
3372 |
+ |
3373 |
+ range = max_loop ? max_loop << part_shift : 1UL << MINORBITS; |
3374 |
+ |
3375 |
++ mutex_lock(&loop_ctl_mutex); |
3376 |
++ |
3377 |
+ idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); |
3378 |
+ idr_destroy(&loop_index_idr); |
3379 |
+ |
3380 |
+@@ -2409,6 +2411,8 @@ static void __exit loop_exit(void) |
3381 |
+ unregister_blkdev(LOOP_MAJOR, "loop"); |
3382 |
+ |
3383 |
+ misc_deregister(&loop_misc); |
3384 |
++ |
3385 |
++ mutex_unlock(&loop_ctl_mutex); |
3386 |
+ } |
3387 |
+ |
3388 |
+ module_init(loop_init); |
3389 |
+diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c |
3390 |
+index a296f8526433..64ee799c1761 100644 |
3391 |
+--- a/drivers/bluetooth/btmrvl_sdio.c |
3392 |
++++ b/drivers/bluetooth/btmrvl_sdio.c |
3393 |
+@@ -328,7 +328,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8897 = { |
3394 |
+ |
3395 |
+ static const struct btmrvl_sdio_device btmrvl_sdio_sd8977 = { |
3396 |
+ .helper = NULL, |
3397 |
+- .firmware = "mrvl/sd8977_uapsta.bin", |
3398 |
++ .firmware = "mrvl/sdsd8977_combo_v2.bin", |
3399 |
+ .reg = &btmrvl_reg_8977, |
3400 |
+ .support_pscan_win_report = true, |
3401 |
+ .sd_blksz_fw_dl = 256, |
3402 |
+@@ -346,7 +346,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8987 = { |
3403 |
+ |
3404 |
+ static const struct btmrvl_sdio_device btmrvl_sdio_sd8997 = { |
3405 |
+ .helper = NULL, |
3406 |
+- .firmware = "mrvl/sd8997_uapsta.bin", |
3407 |
++ .firmware = "mrvl/sdsd8997_combo_v4.bin", |
3408 |
+ .reg = &btmrvl_reg_8997, |
3409 |
+ .support_pscan_win_report = true, |
3410 |
+ .sd_blksz_fw_dl = 256, |
3411 |
+@@ -1831,6 +1831,6 @@ MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); |
3412 |
+ MODULE_FIRMWARE("mrvl/sd8797_uapsta.bin"); |
3413 |
+ MODULE_FIRMWARE("mrvl/sd8887_uapsta.bin"); |
3414 |
+ MODULE_FIRMWARE("mrvl/sd8897_uapsta.bin"); |
3415 |
+-MODULE_FIRMWARE("mrvl/sd8977_uapsta.bin"); |
3416 |
++MODULE_FIRMWARE("mrvl/sdsd8977_combo_v2.bin"); |
3417 |
+ MODULE_FIRMWARE("mrvl/sd8987_uapsta.bin"); |
3418 |
+-MODULE_FIRMWARE("mrvl/sd8997_uapsta.bin"); |
3419 |
++MODULE_FIRMWARE("mrvl/sdsd8997_combo_v4.bin"); |
3420 |
+diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
3421 |
+index bff095be2f97..c7ab7a23bd67 100644 |
3422 |
+--- a/drivers/bluetooth/btmtksdio.c |
3423 |
++++ b/drivers/bluetooth/btmtksdio.c |
3424 |
+@@ -685,7 +685,7 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
3425 |
+ const u8 *fw_ptr; |
3426 |
+ size_t fw_size; |
3427 |
+ int err, dlen; |
3428 |
+- u8 flag; |
3429 |
++ u8 flag, param; |
3430 |
+ |
3431 |
+ err = request_firmware(&fw, fwname, &hdev->dev); |
3432 |
+ if (err < 0) { |
3433 |
+@@ -693,6 +693,20 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
3434 |
+ return err; |
3435 |
+ } |
3436 |
+ |
3437 |
++ /* Power on data RAM the firmware relies on. */ |
3438 |
++ param = 1; |
3439 |
++ wmt_params.op = MTK_WMT_FUNC_CTRL; |
3440 |
++ wmt_params.flag = 3; |
3441 |
++ wmt_params.dlen = sizeof(param); |
3442 |
++ wmt_params.data = ¶m; |
3443 |
++ wmt_params.status = NULL; |
3444 |
++ |
3445 |
++ err = mtk_hci_wmt_sync(hdev, &wmt_params); |
3446 |
++ if (err < 0) { |
3447 |
++ bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
3448 |
++ return err; |
3449 |
++ } |
3450 |
++ |
3451 |
+ fw_ptr = fw->data; |
3452 |
+ fw_size = fw->size; |
3453 |
+ |
3454 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
3455 |
+index 5f022e9cf667..a5fef9aa419f 100644 |
3456 |
+--- a/drivers/bluetooth/btusb.c |
3457 |
++++ b/drivers/bluetooth/btusb.c |
3458 |
+@@ -1720,6 +1720,7 @@ static int btusb_setup_csr(struct hci_dev *hdev) |
3459 |
+ { |
3460 |
+ struct hci_rp_read_local_version *rp; |
3461 |
+ struct sk_buff *skb; |
3462 |
++ bool is_fake = false; |
3463 |
+ |
3464 |
+ BT_DBG("%s", hdev->name); |
3465 |
+ |
3466 |
+@@ -1739,18 +1740,69 @@ static int btusb_setup_csr(struct hci_dev *hdev) |
3467 |
+ |
3468 |
+ rp = (struct hci_rp_read_local_version *)skb->data; |
3469 |
+ |
3470 |
+- /* Detect controllers which aren't real CSR ones. */ |
3471 |
++ /* Detect a wide host of Chinese controllers that aren't CSR. |
3472 |
++ * |
3473 |
++ * Known fake bcdDevices: 0x0100, 0x0134, 0x1915, 0x2520, 0x7558, 0x8891 |
3474 |
++ * |
3475 |
++ * The main thing they have in common is that these are really popular low-cost |
3476 |
++ * options that support newer Bluetooth versions but rely on heavy VID/PID |
3477 |
++ * squatting of this poor old Bluetooth 1.1 device. Even sold as such. |
3478 |
++ * |
3479 |
++ * We detect actual CSR devices by checking that the HCI manufacturer code |
3480 |
++ * is Cambridge Silicon Radio (10) and ensuring that LMP sub-version and |
3481 |
++ * HCI rev values always match. As they both store the firmware number. |
3482 |
++ */ |
3483 |
+ if (le16_to_cpu(rp->manufacturer) != 10 || |
3484 |
+- le16_to_cpu(rp->lmp_subver) == 0x0c5c) { |
3485 |
++ le16_to_cpu(rp->hci_rev) != le16_to_cpu(rp->lmp_subver)) |
3486 |
++ is_fake = true; |
3487 |
++ |
3488 |
++ /* Known legit CSR firmware build numbers and their supported BT versions: |
3489 |
++ * - 1.1 (0x1) -> 0x0073, 0x020d, 0x033c, 0x034e |
3490 |
++ * - 1.2 (0x2) -> 0x04d9, 0x0529 |
3491 |
++ * - 2.0 (0x3) -> 0x07a6, 0x07ad, 0x0c5c |
3492 |
++ * - 2.1 (0x4) -> 0x149c, 0x1735, 0x1899 (0x1899 is a BlueCore4-External) |
3493 |
++ * - 4.0 (0x6) -> 0x1d86, 0x2031, 0x22bb |
3494 |
++ * |
3495 |
++ * e.g. Real CSR dongles with LMP subversion 0x73 are old enough that |
3496 |
++ * support BT 1.1 only; so it's a dead giveaway when some |
3497 |
++ * third-party BT 4.0 dongle reuses it. |
3498 |
++ */ |
3499 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x034e && |
3500 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_1_1) |
3501 |
++ is_fake = true; |
3502 |
++ |
3503 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x0529 && |
3504 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_1_2) |
3505 |
++ is_fake = true; |
3506 |
++ |
3507 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x0c5c && |
3508 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_2_0) |
3509 |
++ is_fake = true; |
3510 |
++ |
3511 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x1899 && |
3512 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_2_1) |
3513 |
++ is_fake = true; |
3514 |
++ |
3515 |
++ else if (le16_to_cpu(rp->lmp_subver) <= 0x22bb && |
3516 |
++ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_4_0) |
3517 |
++ is_fake = true; |
3518 |
++ |
3519 |
++ if (is_fake) { |
3520 |
++ bt_dev_warn(hdev, "CSR: Unbranded CSR clone detected; adding workarounds..."); |
3521 |
++ |
3522 |
++ /* Generally these clones have big discrepancies between |
3523 |
++ * advertised features and what's actually supported. |
3524 |
++ * Probably will need to be expanded in the future; |
3525 |
++ * without these the controller will lock up. |
3526 |
++ */ |
3527 |
++ set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks); |
3528 |
++ set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks); |
3529 |
++ |
3530 |
+ /* Clear the reset quirk since this is not an actual |
3531 |
+ * early Bluetooth 1.1 device from CSR. |
3532 |
+ */ |
3533 |
+ clear_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); |
3534 |
+- |
3535 |
+- /* These fake CSR controllers have all a broken |
3536 |
+- * stored link key handling and so just disable it. |
3537 |
+- */ |
3538 |
+- set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks); |
3539 |
++ clear_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
3540 |
+ } |
3541 |
+ |
3542 |
+ kfree_skb(skb); |
3543 |
+@@ -2925,7 +2977,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
3544 |
+ const u8 *fw_ptr; |
3545 |
+ size_t fw_size; |
3546 |
+ int err, dlen; |
3547 |
+- u8 flag; |
3548 |
++ u8 flag, param; |
3549 |
+ |
3550 |
+ err = request_firmware(&fw, fwname, &hdev->dev); |
3551 |
+ if (err < 0) { |
3552 |
+@@ -2933,6 +2985,20 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
3553 |
+ return err; |
3554 |
+ } |
3555 |
+ |
3556 |
++ /* Power on data RAM the firmware relies on. */ |
3557 |
++ param = 1; |
3558 |
++ wmt_params.op = BTMTK_WMT_FUNC_CTRL; |
3559 |
++ wmt_params.flag = 3; |
3560 |
++ wmt_params.dlen = sizeof(param); |
3561 |
++ wmt_params.data = ¶m; |
3562 |
++ wmt_params.status = NULL; |
3563 |
++ |
3564 |
++ err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); |
3565 |
++ if (err < 0) { |
3566 |
++ bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
3567 |
++ return err; |
3568 |
++ } |
3569 |
++ |
3570 |
+ fw_ptr = fw->data; |
3571 |
+ fw_size = fw->size; |
3572 |
+ |
3573 |
+@@ -4001,11 +4067,13 @@ static int btusb_probe(struct usb_interface *intf, |
3574 |
+ if (bcdDevice < 0x117) |
3575 |
+ set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); |
3576 |
+ |
3577 |
++ /* This must be set first in case we disable it for fakes */ |
3578 |
++ set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
3579 |
++ |
3580 |
+ /* Fake CSR devices with broken commands */ |
3581 |
+- if (bcdDevice <= 0x100 || bcdDevice == 0x134) |
3582 |
++ if (le16_to_cpu(udev->descriptor.idVendor) == 0x0a12 && |
3583 |
++ le16_to_cpu(udev->descriptor.idProduct) == 0x0001) |
3584 |
+ hdev->setup = btusb_setup_csr; |
3585 |
+- |
3586 |
+- set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
3587 |
+ } |
3588 |
+ |
3589 |
+ if (id->driver_info & BTUSB_SNIFFER) { |
3590 |
+diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c |
3591 |
+index e60b2e0773db..e41854e0d79a 100644 |
3592 |
+--- a/drivers/bluetooth/hci_h5.c |
3593 |
++++ b/drivers/bluetooth/hci_h5.c |
3594 |
+@@ -793,7 +793,7 @@ static int h5_serdev_probe(struct serdev_device *serdev) |
3595 |
+ if (!h5) |
3596 |
+ return -ENOMEM; |
3597 |
+ |
3598 |
+- set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.flags); |
3599 |
++ set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.hdev_flags); |
3600 |
+ |
3601 |
+ h5->hu = &h5->serdev_hu; |
3602 |
+ h5->serdev_hu.serdev = serdev; |
3603 |
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c |
3604 |
+index 81c3c38baba1..9150b0c3f302 100644 |
3605 |
+--- a/drivers/bluetooth/hci_qca.c |
3606 |
++++ b/drivers/bluetooth/hci_qca.c |
3607 |
+@@ -46,7 +46,7 @@ |
3608 |
+ #define HCI_MAX_IBS_SIZE 10 |
3609 |
+ |
3610 |
+ #define IBS_WAKE_RETRANS_TIMEOUT_MS 100 |
3611 |
+-#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 40 |
3612 |
++#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 200 |
3613 |
+ #define IBS_HOST_TX_IDLE_TIMEOUT_MS 2000 |
3614 |
+ #define CMD_TRANS_TIMEOUT_MS 100 |
3615 |
+ #define MEMDUMP_TIMEOUT_MS 8000 |
3616 |
+@@ -72,7 +72,8 @@ enum qca_flags { |
3617 |
+ QCA_DROP_VENDOR_EVENT, |
3618 |
+ QCA_SUSPENDING, |
3619 |
+ QCA_MEMDUMP_COLLECTION, |
3620 |
+- QCA_HW_ERROR_EVENT |
3621 |
++ QCA_HW_ERROR_EVENT, |
3622 |
++ QCA_SSR_TRIGGERED |
3623 |
+ }; |
3624 |
+ |
3625 |
+ enum qca_capabilities { |
3626 |
+@@ -862,6 +863,13 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb) |
3627 |
+ BT_DBG("hu %p qca enq skb %p tx_ibs_state %d", hu, skb, |
3628 |
+ qca->tx_ibs_state); |
3629 |
+ |
3630 |
++ if (test_bit(QCA_SSR_TRIGGERED, &qca->flags)) { |
3631 |
++ /* As SSR is in progress, ignore the packets */ |
3632 |
++ bt_dev_dbg(hu->hdev, "SSR is in progress"); |
3633 |
++ kfree_skb(skb); |
3634 |
++ return 0; |
3635 |
++ } |
3636 |
++ |
3637 |
+ /* Prepend skb with frame type */ |
3638 |
+ memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); |
3639 |
+ |
3640 |
+@@ -983,8 +991,11 @@ static void qca_controller_memdump(struct work_struct *work) |
3641 |
+ while ((skb = skb_dequeue(&qca->rx_memdump_q))) { |
3642 |
+ |
3643 |
+ mutex_lock(&qca->hci_memdump_lock); |
3644 |
+- /* Skip processing the received packets if timeout detected. */ |
3645 |
+- if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT) { |
3646 |
++ /* Skip processing the received packets if timeout detected |
3647 |
++ * or memdump collection completed. |
3648 |
++ */ |
3649 |
++ if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT || |
3650 |
++ qca->memdump_state == QCA_MEMDUMP_COLLECTED) { |
3651 |
+ mutex_unlock(&qca->hci_memdump_lock); |
3652 |
+ return; |
3653 |
+ } |
3654 |
+@@ -1128,6 +1139,7 @@ static int qca_controller_memdump_event(struct hci_dev *hdev, |
3655 |
+ struct hci_uart *hu = hci_get_drvdata(hdev); |
3656 |
+ struct qca_data *qca = hu->priv; |
3657 |
+ |
3658 |
++ set_bit(QCA_SSR_TRIGGERED, &qca->flags); |
3659 |
+ skb_queue_tail(&qca->rx_memdump_q, skb); |
3660 |
+ queue_work(qca->workqueue, &qca->ctrl_memdump_evt); |
3661 |
+ |
3662 |
+@@ -1485,9 +1497,8 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code) |
3663 |
+ { |
3664 |
+ struct hci_uart *hu = hci_get_drvdata(hdev); |
3665 |
+ struct qca_data *qca = hu->priv; |
3666 |
+- struct qca_memdump_data *qca_memdump = qca->qca_memdump; |
3667 |
+- char *memdump_buf = NULL; |
3668 |
+ |
3669 |
++ set_bit(QCA_SSR_TRIGGERED, &qca->flags); |
3670 |
+ set_bit(QCA_HW_ERROR_EVENT, &qca->flags); |
3671 |
+ bt_dev_info(hdev, "mem_dump_status: %d", qca->memdump_state); |
3672 |
+ |
3673 |
+@@ -1509,19 +1520,23 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code) |
3674 |
+ qca_wait_for_dump_collection(hdev); |
3675 |
+ } |
3676 |
+ |
3677 |
++ mutex_lock(&qca->hci_memdump_lock); |
3678 |
+ if (qca->memdump_state != QCA_MEMDUMP_COLLECTED) { |
3679 |
+ bt_dev_err(hu->hdev, "clearing allocated memory due to memdump timeout"); |
3680 |
+- mutex_lock(&qca->hci_memdump_lock); |
3681 |
+- if (qca_memdump) |
3682 |
+- memdump_buf = qca_memdump->memdump_buf_head; |
3683 |
+- vfree(memdump_buf); |
3684 |
+- kfree(qca_memdump); |
3685 |
+- qca->qca_memdump = NULL; |
3686 |
++ if (qca->qca_memdump) { |
3687 |
++ vfree(qca->qca_memdump->memdump_buf_head); |
3688 |
++ kfree(qca->qca_memdump); |
3689 |
++ qca->qca_memdump = NULL; |
3690 |
++ } |
3691 |
+ qca->memdump_state = QCA_MEMDUMP_TIMEOUT; |
3692 |
+ cancel_delayed_work(&qca->ctrl_memdump_timeout); |
3693 |
+- skb_queue_purge(&qca->rx_memdump_q); |
3694 |
+- mutex_unlock(&qca->hci_memdump_lock); |
3695 |
++ } |
3696 |
++ mutex_unlock(&qca->hci_memdump_lock); |
3697 |
++ |
3698 |
++ if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT || |
3699 |
++ qca->memdump_state == QCA_MEMDUMP_COLLECTED) { |
3700 |
+ cancel_work_sync(&qca->ctrl_memdump_evt); |
3701 |
++ skb_queue_purge(&qca->rx_memdump_q); |
3702 |
+ } |
3703 |
+ |
3704 |
+ clear_bit(QCA_HW_ERROR_EVENT, &qca->flags); |
3705 |
+@@ -1532,10 +1547,30 @@ static void qca_cmd_timeout(struct hci_dev *hdev) |
3706 |
+ struct hci_uart *hu = hci_get_drvdata(hdev); |
3707 |
+ struct qca_data *qca = hu->priv; |
3708 |
+ |
3709 |
+- if (qca->memdump_state == QCA_MEMDUMP_IDLE) |
3710 |
++ set_bit(QCA_SSR_TRIGGERED, &qca->flags); |
3711 |
++ if (qca->memdump_state == QCA_MEMDUMP_IDLE) { |
3712 |
++ set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); |
3713 |
+ qca_send_crashbuffer(hu); |
3714 |
+- else |
3715 |
+- bt_dev_info(hdev, "Dump collection is in process"); |
3716 |
++ qca_wait_for_dump_collection(hdev); |
3717 |
++ } else if (qca->memdump_state == QCA_MEMDUMP_COLLECTING) { |
3718 |
++ /* Let us wait here until memory dump collected or |
3719 |
++ * memory dump timer expired. |
3720 |
++ */ |
3721 |
++ bt_dev_info(hdev, "waiting for dump to complete"); |
3722 |
++ qca_wait_for_dump_collection(hdev); |
3723 |
++ } |
3724 |
++ |
3725 |
++ mutex_lock(&qca->hci_memdump_lock); |
3726 |
++ if (qca->memdump_state != QCA_MEMDUMP_COLLECTED) { |
3727 |
++ qca->memdump_state = QCA_MEMDUMP_TIMEOUT; |
3728 |
++ if (!test_bit(QCA_HW_ERROR_EVENT, &qca->flags)) { |
3729 |
++ /* Inject hw error event to reset the device |
3730 |
++ * and driver. |
3731 |
++ */ |
3732 |
++ hci_reset_dev(hu->hdev); |
3733 |
++ } |
3734 |
++ } |
3735 |
++ mutex_unlock(&qca->hci_memdump_lock); |
3736 |
+ } |
3737 |
+ |
3738 |
+ static int qca_wcn3990_init(struct hci_uart *hu) |
3739 |
+@@ -1641,11 +1676,15 @@ static int qca_setup(struct hci_uart *hu) |
3740 |
+ bt_dev_info(hdev, "setting up %s", |
3741 |
+ qca_is_wcn399x(soc_type) ? "wcn399x" : "ROME/QCA6390"); |
3742 |
+ |
3743 |
++ qca->memdump_state = QCA_MEMDUMP_IDLE; |
3744 |
++ |
3745 |
+ retry: |
3746 |
+ ret = qca_power_on(hdev); |
3747 |
+ if (ret) |
3748 |
+ return ret; |
3749 |
+ |
3750 |
++ clear_bit(QCA_SSR_TRIGGERED, &qca->flags); |
3751 |
++ |
3752 |
+ if (qca_is_wcn399x(soc_type)) { |
3753 |
+ set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); |
3754 |
+ |
3755 |
+@@ -1788,9 +1827,6 @@ static void qca_power_shutdown(struct hci_uart *hu) |
3756 |
+ qca_flush(hu); |
3757 |
+ spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); |
3758 |
+ |
3759 |
+- hu->hdev->hw_error = NULL; |
3760 |
+- hu->hdev->cmd_timeout = NULL; |
3761 |
+- |
3762 |
+ /* Non-serdev device usually is powered by external power |
3763 |
+ * and don't need additional action in driver for power down |
3764 |
+ */ |
3765 |
+@@ -1812,6 +1848,9 @@ static int qca_power_off(struct hci_dev *hdev) |
3766 |
+ struct qca_data *qca = hu->priv; |
3767 |
+ enum qca_btsoc_type soc_type = qca_soc_type(hu); |
3768 |
+ |
3769 |
++ hu->hdev->hw_error = NULL; |
3770 |
++ hu->hdev->cmd_timeout = NULL; |
3771 |
++ |
3772 |
+ /* Stop sending shutdown command if soc crashes. */ |
3773 |
+ if (soc_type != QCA_ROME |
3774 |
+ && qca->memdump_state == QCA_MEMDUMP_IDLE) { |
3775 |
+@@ -1819,7 +1858,6 @@ static int qca_power_off(struct hci_dev *hdev) |
3776 |
+ usleep_range(8000, 10000); |
3777 |
+ } |
3778 |
+ |
3779 |
+- qca->memdump_state = QCA_MEMDUMP_IDLE; |
3780 |
+ qca_power_shutdown(hu); |
3781 |
+ return 0; |
3782 |
+ } |
3783 |
+@@ -1962,17 +2000,17 @@ static int qca_serdev_probe(struct serdev_device *serdev) |
3784 |
+ } |
3785 |
+ |
3786 |
+ qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); |
3787 |
+- if (!qcadev->susclk) { |
3788 |
++ if (IS_ERR(qcadev->susclk)) { |
3789 |
+ dev_warn(&serdev->dev, "failed to acquire clk\n"); |
3790 |
+- } else { |
3791 |
+- err = clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ); |
3792 |
+- if (err) |
3793 |
+- return err; |
3794 |
+- |
3795 |
+- err = clk_prepare_enable(qcadev->susclk); |
3796 |
+- if (err) |
3797 |
+- return err; |
3798 |
++ return PTR_ERR(qcadev->susclk); |
3799 |
+ } |
3800 |
++ err = clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ); |
3801 |
++ if (err) |
3802 |
++ return err; |
3803 |
++ |
3804 |
++ err = clk_prepare_enable(qcadev->susclk); |
3805 |
++ if (err) |
3806 |
++ return err; |
3807 |
+ |
3808 |
+ err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto); |
3809 |
+ if (err) { |
3810 |
+@@ -2083,8 +2121,6 @@ static int __maybe_unused qca_suspend(struct device *dev) |
3811 |
+ |
3812 |
+ qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; |
3813 |
+ qca->ibs_sent_slps++; |
3814 |
+- |
3815 |
+- qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off); |
3816 |
+ break; |
3817 |
+ |
3818 |
+ case HCI_IBS_TX_ASLEEP: |
3819 |
+@@ -2112,8 +2148,10 @@ static int __maybe_unused qca_suspend(struct device *dev) |
3820 |
+ qca->rx_ibs_state == HCI_IBS_RX_ASLEEP, |
3821 |
+ msecs_to_jiffies(IBS_BTSOC_TX_IDLE_TIMEOUT_MS)); |
3822 |
+ |
3823 |
+- if (ret > 0) |
3824 |
++ if (ret > 0) { |
3825 |
++ qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off); |
3826 |
+ return 0; |
3827 |
++ } |
3828 |
+ |
3829 |
+ if (ret == 0) |
3830 |
+ ret = -ETIMEDOUT; |
3831 |
+diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c |
3832 |
+index 599855e4c57c..7b233312e723 100644 |
3833 |
+--- a/drivers/bluetooth/hci_serdev.c |
3834 |
++++ b/drivers/bluetooth/hci_serdev.c |
3835 |
+@@ -355,7 +355,8 @@ void hci_uart_unregister_device(struct hci_uart *hu) |
3836 |
+ struct hci_dev *hdev = hu->hdev; |
3837 |
+ |
3838 |
+ clear_bit(HCI_UART_PROTO_READY, &hu->flags); |
3839 |
+- hci_unregister_dev(hdev); |
3840 |
++ if (test_bit(HCI_UART_REGISTERED, &hu->flags)) |
3841 |
++ hci_unregister_dev(hdev); |
3842 |
+ hci_free_dev(hdev); |
3843 |
+ |
3844 |
+ cancel_work_sync(&hu->write_work); |
3845 |
+diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c |
3846 |
+index 191c97b84715..fb5a901fd89e 100644 |
3847 |
+--- a/drivers/bus/ti-sysc.c |
3848 |
++++ b/drivers/bus/ti-sysc.c |
3849 |
+@@ -1395,6 +1395,10 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { |
3850 |
+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3851 |
+ SYSC_QUIRK("tptc", 0, 0, -ENODEV, -ENODEV, 0x40007c00, 0xffffffff, |
3852 |
+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3853 |
++ SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, |
3854 |
++ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3855 |
++ SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff, |
3856 |
++ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3857 |
+ SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, |
3858 |
+ 0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), |
3859 |
+ SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff, |
3860 |
+@@ -1473,8 +1477,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { |
3861 |
+ SYSC_QUIRK("tpcc", 0, 0, -ENODEV, -ENODEV, 0x40014c00, 0xffffffff, 0), |
3862 |
+ SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000004, 0xffffffff, 0), |
3863 |
+ SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000008, 0xffffffff, 0), |
3864 |
+- SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0), |
3865 |
+- SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff, 0), |
3866 |
+ SYSC_QUIRK("venc", 0x58003000, 0, -ENODEV, -ENODEV, 0x00000002, 0xffffffff, 0), |
3867 |
+ SYSC_QUIRK("vfpe", 0, 0, 0x104, -ENODEV, 0x4d001200, 0xffffffff, 0), |
3868 |
+ #endif |
3869 |
+diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c |
3870 |
+index 4b34a5195c65..5bfdf222d5f9 100644 |
3871 |
+--- a/drivers/char/agp/intel-gtt.c |
3872 |
++++ b/drivers/char/agp/intel-gtt.c |
3873 |
+@@ -304,8 +304,10 @@ static int intel_gtt_setup_scratch_page(void) |
3874 |
+ if (intel_private.needs_dmar) { |
3875 |
+ dma_addr = pci_map_page(intel_private.pcidev, page, 0, |
3876 |
+ PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
3877 |
+- if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) |
3878 |
++ if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) { |
3879 |
++ __free_page(page); |
3880 |
+ return -EINVAL; |
3881 |
++ } |
3882 |
+ |
3883 |
+ intel_private.scratch_page_dma = dma_addr; |
3884 |
+ } else |
3885 |
+diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c |
3886 |
+index 8c77e88012e9..ddaeceb7e109 100644 |
3887 |
+--- a/drivers/char/tpm/tpm-chip.c |
3888 |
++++ b/drivers/char/tpm/tpm-chip.c |
3889 |
+@@ -386,13 +386,8 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
3890 |
+ chip->cdev.owner = THIS_MODULE; |
3891 |
+ chip->cdevs.owner = THIS_MODULE; |
3892 |
+ |
3893 |
+- chip->work_space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3894 |
+- if (!chip->work_space.context_buf) { |
3895 |
+- rc = -ENOMEM; |
3896 |
+- goto out; |
3897 |
+- } |
3898 |
+- chip->work_space.session_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3899 |
+- if (!chip->work_space.session_buf) { |
3900 |
++ rc = tpm2_init_space(&chip->work_space, TPM2_SPACE_BUFFER_SIZE); |
3901 |
++ if (rc) { |
3902 |
+ rc = -ENOMEM; |
3903 |
+ goto out; |
3904 |
+ } |
3905 |
+diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
3906 |
+index 0fbcede241ea..947d1db0a5cc 100644 |
3907 |
+--- a/drivers/char/tpm/tpm.h |
3908 |
++++ b/drivers/char/tpm/tpm.h |
3909 |
+@@ -59,6 +59,9 @@ enum tpm_addr { |
3910 |
+ |
3911 |
+ #define TPM_TAG_RQU_COMMAND 193 |
3912 |
+ |
3913 |
++/* TPM2 specific constants. */ |
3914 |
++#define TPM2_SPACE_BUFFER_SIZE 16384 /* 16 kB */ |
3915 |
++ |
3916 |
+ struct stclear_flags_t { |
3917 |
+ __be16 tag; |
3918 |
+ u8 deactivated; |
3919 |
+@@ -228,7 +231,7 @@ unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); |
3920 |
+ int tpm2_probe(struct tpm_chip *chip); |
3921 |
+ int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip); |
3922 |
+ int tpm2_find_cc(struct tpm_chip *chip, u32 cc); |
3923 |
+-int tpm2_init_space(struct tpm_space *space); |
3924 |
++int tpm2_init_space(struct tpm_space *space, unsigned int buf_size); |
3925 |
+ void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space); |
3926 |
+ void tpm2_flush_space(struct tpm_chip *chip); |
3927 |
+ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, |
3928 |
+diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c |
3929 |
+index 982d341d8837..784b8b3cb903 100644 |
3930 |
+--- a/drivers/char/tpm/tpm2-space.c |
3931 |
++++ b/drivers/char/tpm/tpm2-space.c |
3932 |
+@@ -38,18 +38,21 @@ static void tpm2_flush_sessions(struct tpm_chip *chip, struct tpm_space *space) |
3933 |
+ } |
3934 |
+ } |
3935 |
+ |
3936 |
+-int tpm2_init_space(struct tpm_space *space) |
3937 |
++int tpm2_init_space(struct tpm_space *space, unsigned int buf_size) |
3938 |
+ { |
3939 |
+- space->context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3940 |
++ space->context_buf = kzalloc(buf_size, GFP_KERNEL); |
3941 |
+ if (!space->context_buf) |
3942 |
+ return -ENOMEM; |
3943 |
+ |
3944 |
+- space->session_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); |
3945 |
++ space->session_buf = kzalloc(buf_size, GFP_KERNEL); |
3946 |
+ if (space->session_buf == NULL) { |
3947 |
+ kfree(space->context_buf); |
3948 |
++ /* Prevent caller getting a dangling pointer. */ |
3949 |
++ space->context_buf = NULL; |
3950 |
+ return -ENOMEM; |
3951 |
+ } |
3952 |
+ |
3953 |
++ space->buf_size = buf_size; |
3954 |
+ return 0; |
3955 |
+ } |
3956 |
+ |
3957 |
+@@ -311,8 +314,10 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, |
3958 |
+ sizeof(space->context_tbl)); |
3959 |
+ memcpy(&chip->work_space.session_tbl, &space->session_tbl, |
3960 |
+ sizeof(space->session_tbl)); |
3961 |
+- memcpy(chip->work_space.context_buf, space->context_buf, PAGE_SIZE); |
3962 |
+- memcpy(chip->work_space.session_buf, space->session_buf, PAGE_SIZE); |
3963 |
++ memcpy(chip->work_space.context_buf, space->context_buf, |
3964 |
++ space->buf_size); |
3965 |
++ memcpy(chip->work_space.session_buf, space->session_buf, |
3966 |
++ space->buf_size); |
3967 |
+ |
3968 |
+ rc = tpm2_load_space(chip); |
3969 |
+ if (rc) { |
3970 |
+@@ -492,7 +497,7 @@ static int tpm2_save_space(struct tpm_chip *chip) |
3971 |
+ continue; |
3972 |
+ |
3973 |
+ rc = tpm2_save_context(chip, space->context_tbl[i], |
3974 |
+- space->context_buf, PAGE_SIZE, |
3975 |
++ space->context_buf, space->buf_size, |
3976 |
+ &offset); |
3977 |
+ if (rc == -ENOENT) { |
3978 |
+ space->context_tbl[i] = 0; |
3979 |
+@@ -509,9 +514,8 @@ static int tpm2_save_space(struct tpm_chip *chip) |
3980 |
+ continue; |
3981 |
+ |
3982 |
+ rc = tpm2_save_context(chip, space->session_tbl[i], |
3983 |
+- space->session_buf, PAGE_SIZE, |
3984 |
++ space->session_buf, space->buf_size, |
3985 |
+ &offset); |
3986 |
+- |
3987 |
+ if (rc == -ENOENT) { |
3988 |
+ /* handle error saving session, just forget it */ |
3989 |
+ space->session_tbl[i] = 0; |
3990 |
+@@ -557,8 +561,10 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, |
3991 |
+ sizeof(space->context_tbl)); |
3992 |
+ memcpy(&space->session_tbl, &chip->work_space.session_tbl, |
3993 |
+ sizeof(space->session_tbl)); |
3994 |
+- memcpy(space->context_buf, chip->work_space.context_buf, PAGE_SIZE); |
3995 |
+- memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE); |
3996 |
++ memcpy(space->context_buf, chip->work_space.context_buf, |
3997 |
++ space->buf_size); |
3998 |
++ memcpy(space->session_buf, chip->work_space.session_buf, |
3999 |
++ space->buf_size); |
4000 |
+ |
4001 |
+ return 0; |
4002 |
+ out: |
4003 |
+diff --git a/drivers/char/tpm/tpmrm-dev.c b/drivers/char/tpm/tpmrm-dev.c |
4004 |
+index 7a0a7051a06f..eef0fb06ea83 100644 |
4005 |
+--- a/drivers/char/tpm/tpmrm-dev.c |
4006 |
++++ b/drivers/char/tpm/tpmrm-dev.c |
4007 |
+@@ -21,7 +21,7 @@ static int tpmrm_open(struct inode *inode, struct file *file) |
4008 |
+ if (priv == NULL) |
4009 |
+ return -ENOMEM; |
4010 |
+ |
4011 |
+- rc = tpm2_init_space(&priv->space); |
4012 |
++ rc = tpm2_init_space(&priv->space, TPM2_SPACE_BUFFER_SIZE); |
4013 |
+ if (rc) { |
4014 |
+ kfree(priv); |
4015 |
+ return -ENOMEM; |
4016 |
+diff --git a/drivers/clk/bcm/clk-bcm63xx-gate.c b/drivers/clk/bcm/clk-bcm63xx-gate.c |
4017 |
+index 98e884957db8..911a29bd744e 100644 |
4018 |
+--- a/drivers/clk/bcm/clk-bcm63xx-gate.c |
4019 |
++++ b/drivers/clk/bcm/clk-bcm63xx-gate.c |
4020 |
+@@ -155,6 +155,7 @@ static int clk_bcm63xx_probe(struct platform_device *pdev) |
4021 |
+ |
4022 |
+ for (entry = table; entry->name; entry++) |
4023 |
+ maxbit = max_t(u8, maxbit, entry->bit); |
4024 |
++ maxbit++; |
4025 |
+ |
4026 |
+ hw = devm_kzalloc(&pdev->dev, struct_size(hw, data.hws, maxbit), |
4027 |
+ GFP_KERNEL); |
4028 |
+diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c |
4029 |
+index c491f5de0f3f..c754dfbb73fd 100644 |
4030 |
+--- a/drivers/clk/clk-scmi.c |
4031 |
++++ b/drivers/clk/clk-scmi.c |
4032 |
+@@ -103,6 +103,8 @@ static const struct clk_ops scmi_clk_ops = { |
4033 |
+ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk) |
4034 |
+ { |
4035 |
+ int ret; |
4036 |
++ unsigned long min_rate, max_rate; |
4037 |
++ |
4038 |
+ struct clk_init_data init = { |
4039 |
+ .flags = CLK_GET_RATE_NOCACHE, |
4040 |
+ .num_parents = 0, |
4041 |
+@@ -112,9 +114,23 @@ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk) |
4042 |
+ |
4043 |
+ sclk->hw.init = &init; |
4044 |
+ ret = devm_clk_hw_register(dev, &sclk->hw); |
4045 |
+- if (!ret) |
4046 |
+- clk_hw_set_rate_range(&sclk->hw, sclk->info->range.min_rate, |
4047 |
+- sclk->info->range.max_rate); |
4048 |
++ if (ret) |
4049 |
++ return ret; |
4050 |
++ |
4051 |
++ if (sclk->info->rate_discrete) { |
4052 |
++ int num_rates = sclk->info->list.num_rates; |
4053 |
++ |
4054 |
++ if (num_rates <= 0) |
4055 |
++ return -EINVAL; |
4056 |
++ |
4057 |
++ min_rate = sclk->info->list.rates[0]; |
4058 |
++ max_rate = sclk->info->list.rates[num_rates - 1]; |
4059 |
++ } else { |
4060 |
++ min_rate = sclk->info->range.min_rate; |
4061 |
++ max_rate = sclk->info->range.max_rate; |
4062 |
++ } |
4063 |
++ |
4064 |
++ clk_hw_set_rate_range(&sclk->hw, min_rate, max_rate); |
4065 |
+ return ret; |
4066 |
+ } |
4067 |
+ |
4068 |
+diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c |
4069 |
+index ca4383e3a02a..538677befb86 100644 |
4070 |
+--- a/drivers/clk/qcom/gcc-sc7180.c |
4071 |
++++ b/drivers/clk/qcom/gcc-sc7180.c |
4072 |
+@@ -1061,7 +1061,7 @@ static struct clk_branch gcc_disp_gpll0_clk_src = { |
4073 |
+ .hw = &gpll0.clkr.hw, |
4074 |
+ }, |
4075 |
+ .num_parents = 1, |
4076 |
+- .ops = &clk_branch2_ops, |
4077 |
++ .ops = &clk_branch2_aon_ops, |
4078 |
+ }, |
4079 |
+ }, |
4080 |
+ }; |
4081 |
+diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c |
4082 |
+index f6ce888098be..90f7febaf528 100644 |
4083 |
+--- a/drivers/clk/qcom/gcc-sdm845.c |
4084 |
++++ b/drivers/clk/qcom/gcc-sdm845.c |
4085 |
+@@ -1,6 +1,6 @@ |
4086 |
+ // SPDX-License-Identifier: GPL-2.0 |
4087 |
+ /* |
4088 |
+- * Copyright (c) 2018, The Linux Foundation. All rights reserved. |
4089 |
++ * Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. |
4090 |
+ */ |
4091 |
+ |
4092 |
+ #include <linux/kernel.h> |
4093 |
+@@ -1344,7 +1344,7 @@ static struct clk_branch gcc_disp_gpll0_clk_src = { |
4094 |
+ "gpll0", |
4095 |
+ }, |
4096 |
+ .num_parents = 1, |
4097 |
+- .ops = &clk_branch2_ops, |
4098 |
++ .ops = &clk_branch2_aon_ops, |
4099 |
+ }, |
4100 |
+ }, |
4101 |
+ }; |
4102 |
+diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm |
4103 |
+index c6cbfc8baf72..a967894c4613 100644 |
4104 |
+--- a/drivers/cpufreq/Kconfig.arm |
4105 |
++++ b/drivers/cpufreq/Kconfig.arm |
4106 |
+@@ -41,6 +41,7 @@ config ARM_ARMADA_37XX_CPUFREQ |
4107 |
+ config ARM_ARMADA_8K_CPUFREQ |
4108 |
+ tristate "Armada 8K CPUFreq driver" |
4109 |
+ depends on ARCH_MVEBU && CPUFREQ_DT |
4110 |
++ select ARMADA_AP_CPU_CLK |
4111 |
+ help |
4112 |
+ This enables the CPUFreq driver support for Marvell |
4113 |
+ Armada8k SOCs. |
4114 |
+diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c |
4115 |
+index aa0f06dec959..df1c941260d1 100644 |
4116 |
+--- a/drivers/cpufreq/armada-37xx-cpufreq.c |
4117 |
++++ b/drivers/cpufreq/armada-37xx-cpufreq.c |
4118 |
+@@ -456,6 +456,7 @@ static int __init armada37xx_cpufreq_driver_init(void) |
4119 |
+ /* Now that everything is setup, enable the DVFS at hardware level */ |
4120 |
+ armada37xx_cpufreq_enable_dvfs(nb_pm_base); |
4121 |
+ |
4122 |
++ memset(&pdata, 0, sizeof(pdata)); |
4123 |
+ pdata.suspend = armada37xx_cpufreq_suspend; |
4124 |
+ pdata.resume = armada37xx_cpufreq_resume; |
4125 |
+ |
4126 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
4127 |
+index 0128de3603df..e9e8200a0211 100644 |
4128 |
+--- a/drivers/cpufreq/cpufreq.c |
4129 |
++++ b/drivers/cpufreq/cpufreq.c |
4130 |
+@@ -621,6 +621,24 @@ static struct cpufreq_governor *find_governor(const char *str_governor) |
4131 |
+ return NULL; |
4132 |
+ } |
4133 |
+ |
4134 |
++static struct cpufreq_governor *get_governor(const char *str_governor) |
4135 |
++{ |
4136 |
++ struct cpufreq_governor *t; |
4137 |
++ |
4138 |
++ mutex_lock(&cpufreq_governor_mutex); |
4139 |
++ t = find_governor(str_governor); |
4140 |
++ if (!t) |
4141 |
++ goto unlock; |
4142 |
++ |
4143 |
++ if (!try_module_get(t->owner)) |
4144 |
++ t = NULL; |
4145 |
++ |
4146 |
++unlock: |
4147 |
++ mutex_unlock(&cpufreq_governor_mutex); |
4148 |
++ |
4149 |
++ return t; |
4150 |
++} |
4151 |
++ |
4152 |
+ static unsigned int cpufreq_parse_policy(char *str_governor) |
4153 |
+ { |
4154 |
+ if (!strncasecmp(str_governor, "performance", CPUFREQ_NAME_LEN)) |
4155 |
+@@ -640,28 +658,14 @@ static struct cpufreq_governor *cpufreq_parse_governor(char *str_governor) |
4156 |
+ { |
4157 |
+ struct cpufreq_governor *t; |
4158 |
+ |
4159 |
+- mutex_lock(&cpufreq_governor_mutex); |
4160 |
+- |
4161 |
+- t = find_governor(str_governor); |
4162 |
+- if (!t) { |
4163 |
+- int ret; |
4164 |
+- |
4165 |
+- mutex_unlock(&cpufreq_governor_mutex); |
4166 |
+- |
4167 |
+- ret = request_module("cpufreq_%s", str_governor); |
4168 |
+- if (ret) |
4169 |
+- return NULL; |
4170 |
+- |
4171 |
+- mutex_lock(&cpufreq_governor_mutex); |
4172 |
++ t = get_governor(str_governor); |
4173 |
++ if (t) |
4174 |
++ return t; |
4175 |
+ |
4176 |
+- t = find_governor(str_governor); |
4177 |
+- } |
4178 |
+- if (t && !try_module_get(t->owner)) |
4179 |
+- t = NULL; |
4180 |
+- |
4181 |
+- mutex_unlock(&cpufreq_governor_mutex); |
4182 |
++ if (request_module("cpufreq_%s", str_governor)) |
4183 |
++ return NULL; |
4184 |
+ |
4185 |
+- return t; |
4186 |
++ return get_governor(str_governor); |
4187 |
+ } |
4188 |
+ |
4189 |
+ /** |
4190 |
+@@ -815,12 +819,14 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, |
4191 |
+ goto out; |
4192 |
+ } |
4193 |
+ |
4194 |
++ mutex_lock(&cpufreq_governor_mutex); |
4195 |
+ for_each_governor(t) { |
4196 |
+ if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char)) |
4197 |
+ - (CPUFREQ_NAME_LEN + 2))) |
4198 |
+- goto out; |
4199 |
++ break; |
4200 |
+ i += scnprintf(&buf[i], CPUFREQ_NAME_PLEN, "%s ", t->name); |
4201 |
+ } |
4202 |
++ mutex_unlock(&cpufreq_governor_mutex); |
4203 |
+ out: |
4204 |
+ i += sprintf(&buf[i], "\n"); |
4205 |
+ return i; |
4206 |
+@@ -1058,15 +1064,17 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) |
4207 |
+ struct cpufreq_governor *def_gov = cpufreq_default_governor(); |
4208 |
+ struct cpufreq_governor *gov = NULL; |
4209 |
+ unsigned int pol = CPUFREQ_POLICY_UNKNOWN; |
4210 |
++ int ret; |
4211 |
+ |
4212 |
+ if (has_target()) { |
4213 |
+ /* Update policy governor to the one used before hotplug. */ |
4214 |
+- gov = find_governor(policy->last_governor); |
4215 |
++ gov = get_governor(policy->last_governor); |
4216 |
+ if (gov) { |
4217 |
+ pr_debug("Restoring governor %s for cpu %d\n", |
4218 |
+ policy->governor->name, policy->cpu); |
4219 |
+ } else if (def_gov) { |
4220 |
+ gov = def_gov; |
4221 |
++ __module_get(gov->owner); |
4222 |
+ } else { |
4223 |
+ return -ENODATA; |
4224 |
+ } |
4225 |
+@@ -1089,7 +1097,11 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) |
4226 |
+ return -ENODATA; |
4227 |
+ } |
4228 |
+ |
4229 |
+- return cpufreq_set_policy(policy, gov, pol); |
4230 |
++ ret = cpufreq_set_policy(policy, gov, pol); |
4231 |
++ if (gov) |
4232 |
++ module_put(gov->owner); |
4233 |
++ |
4234 |
++ return ret; |
4235 |
+ } |
4236 |
+ |
4237 |
+ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) |
4238 |
+diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c |
4239 |
+index b2f9882bc010..bf90a4fcabd1 100644 |
4240 |
+--- a/drivers/crypto/caam/caamalg.c |
4241 |
++++ b/drivers/crypto/caam/caamalg.c |
4242 |
+@@ -838,7 +838,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, |
4243 |
+ u32 *desc; |
4244 |
+ |
4245 |
+ if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { |
4246 |
+- dev_err(jrdev, "key size mismatch\n"); |
4247 |
++ dev_dbg(jrdev, "key size mismatch\n"); |
4248 |
+ return -EINVAL; |
4249 |
+ } |
4250 |
+ |
4251 |
+diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c |
4252 |
+index 27e36bdf6163..315d53499ce8 100644 |
4253 |
+--- a/drivers/crypto/caam/caamalg_qi.c |
4254 |
++++ b/drivers/crypto/caam/caamalg_qi.c |
4255 |
+@@ -728,7 +728,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, |
4256 |
+ int ret = 0; |
4257 |
+ |
4258 |
+ if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { |
4259 |
+- dev_err(jrdev, "key size mismatch\n"); |
4260 |
++ dev_dbg(jrdev, "key size mismatch\n"); |
4261 |
+ return -EINVAL; |
4262 |
+ } |
4263 |
+ |
4264 |
+diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c |
4265 |
+index 28669cbecf77..e1b6bc6ef091 100644 |
4266 |
+--- a/drivers/crypto/caam/caamalg_qi2.c |
4267 |
++++ b/drivers/crypto/caam/caamalg_qi2.c |
4268 |
+@@ -1058,7 +1058,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key, |
4269 |
+ u32 *desc; |
4270 |
+ |
4271 |
+ if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { |
4272 |
+- dev_err(dev, "key size mismatch\n"); |
4273 |
++ dev_dbg(dev, "key size mismatch\n"); |
4274 |
+ return -EINVAL; |
4275 |
+ } |
4276 |
+ |
4277 |
+diff --git a/drivers/crypto/cavium/cpt/cptvf_algs.c b/drivers/crypto/cavium/cpt/cptvf_algs.c |
4278 |
+index 1be1adffff1d..2e4bf90c5798 100644 |
4279 |
+--- a/drivers/crypto/cavium/cpt/cptvf_algs.c |
4280 |
++++ b/drivers/crypto/cavium/cpt/cptvf_algs.c |
4281 |
+@@ -200,6 +200,7 @@ static inline int cvm_enc_dec(struct skcipher_request *req, u32 enc) |
4282 |
+ int status; |
4283 |
+ |
4284 |
+ memset(req_info, 0, sizeof(struct cpt_request_info)); |
4285 |
++ req_info->may_sleep = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) != 0; |
4286 |
+ memset(fctx, 0, sizeof(struct fc_context)); |
4287 |
+ create_input_list(req, enc, enc_iv_len); |
4288 |
+ create_output_list(req, enc_iv_len); |
4289 |
+diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c |
4290 |
+index 7a24019356b5..e343249c8d05 100644 |
4291 |
+--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c |
4292 |
++++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c |
4293 |
+@@ -133,7 +133,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
4294 |
+ |
4295 |
+ /* Setup gather (input) components */ |
4296 |
+ g_sz_bytes = ((req->incnt + 3) / 4) * sizeof(struct sglist_component); |
4297 |
+- info->gather_components = kzalloc(g_sz_bytes, GFP_KERNEL); |
4298 |
++ info->gather_components = kzalloc(g_sz_bytes, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
4299 |
+ if (!info->gather_components) { |
4300 |
+ ret = -ENOMEM; |
4301 |
+ goto scatter_gather_clean; |
4302 |
+@@ -150,7 +150,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
4303 |
+ |
4304 |
+ /* Setup scatter (output) components */ |
4305 |
+ s_sz_bytes = ((req->outcnt + 3) / 4) * sizeof(struct sglist_component); |
4306 |
+- info->scatter_components = kzalloc(s_sz_bytes, GFP_KERNEL); |
4307 |
++ info->scatter_components = kzalloc(s_sz_bytes, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
4308 |
+ if (!info->scatter_components) { |
4309 |
+ ret = -ENOMEM; |
4310 |
+ goto scatter_gather_clean; |
4311 |
+@@ -167,7 +167,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
4312 |
+ |
4313 |
+ /* Create and initialize DPTR */ |
4314 |
+ info->dlen = g_sz_bytes + s_sz_bytes + SG_LIST_HDR_SIZE; |
4315 |
+- info->in_buffer = kzalloc(info->dlen, GFP_KERNEL); |
4316 |
++ info->in_buffer = kzalloc(info->dlen, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
4317 |
+ if (!info->in_buffer) { |
4318 |
+ ret = -ENOMEM; |
4319 |
+ goto scatter_gather_clean; |
4320 |
+@@ -195,7 +195,7 @@ static inline int setup_sgio_list(struct cpt_vf *cptvf, |
4321 |
+ } |
4322 |
+ |
4323 |
+ /* Create and initialize RPTR */ |
4324 |
+- info->out_buffer = kzalloc(COMPLETION_CODE_SIZE, GFP_KERNEL); |
4325 |
++ info->out_buffer = kzalloc(COMPLETION_CODE_SIZE, req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
4326 |
+ if (!info->out_buffer) { |
4327 |
+ ret = -ENOMEM; |
4328 |
+ goto scatter_gather_clean; |
4329 |
+@@ -421,7 +421,7 @@ int process_request(struct cpt_vf *cptvf, struct cpt_request_info *req) |
4330 |
+ struct cpt_vq_command vq_cmd; |
4331 |
+ union cpt_inst_s cptinst; |
4332 |
+ |
4333 |
+- info = kzalloc(sizeof(*info), GFP_KERNEL); |
4334 |
++ info = kzalloc(sizeof(*info), req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
4335 |
+ if (unlikely(!info)) { |
4336 |
+ dev_err(&pdev->dev, "Unable to allocate memory for info_buffer\n"); |
4337 |
+ return -ENOMEM; |
4338 |
+@@ -443,7 +443,7 @@ int process_request(struct cpt_vf *cptvf, struct cpt_request_info *req) |
4339 |
+ * Get buffer for union cpt_res_s response |
4340 |
+ * structure and its physical address |
4341 |
+ */ |
4342 |
+- info->completion_addr = kzalloc(sizeof(union cpt_res_s), GFP_KERNEL); |
4343 |
++ info->completion_addr = kzalloc(sizeof(union cpt_res_s), req->may_sleep ? GFP_KERNEL : GFP_ATOMIC); |
4344 |
+ if (unlikely(!info->completion_addr)) { |
4345 |
+ dev_err(&pdev->dev, "Unable to allocate memory for completion_addr\n"); |
4346 |
+ ret = -ENOMEM; |
4347 |
+diff --git a/drivers/crypto/cavium/cpt/request_manager.h b/drivers/crypto/cavium/cpt/request_manager.h |
4348 |
+index 3514b082eca7..1e8dd9ebcc17 100644 |
4349 |
+--- a/drivers/crypto/cavium/cpt/request_manager.h |
4350 |
++++ b/drivers/crypto/cavium/cpt/request_manager.h |
4351 |
+@@ -62,6 +62,8 @@ struct cpt_request_info { |
4352 |
+ union ctrl_info ctrl; /* User control information */ |
4353 |
+ struct cptvf_request req; /* Request Information (Core specific) */ |
4354 |
+ |
4355 |
++ bool may_sleep; |
4356 |
++ |
4357 |
+ struct buf_ptr in[MAX_BUF_CNT]; |
4358 |
+ struct buf_ptr out[MAX_BUF_CNT]; |
4359 |
+ |
4360 |
+diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h |
4361 |
+index 3f68262d9ab4..87a34d91fdf7 100644 |
4362 |
+--- a/drivers/crypto/ccp/ccp-dev.h |
4363 |
++++ b/drivers/crypto/ccp/ccp-dev.h |
4364 |
+@@ -469,6 +469,7 @@ struct ccp_sg_workarea { |
4365 |
+ unsigned int sg_used; |
4366 |
+ |
4367 |
+ struct scatterlist *dma_sg; |
4368 |
++ struct scatterlist *dma_sg_head; |
4369 |
+ struct device *dma_dev; |
4370 |
+ unsigned int dma_count; |
4371 |
+ enum dma_data_direction dma_dir; |
4372 |
+diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
4373 |
+index 422193690fd4..64112c736810 100644 |
4374 |
+--- a/drivers/crypto/ccp/ccp-ops.c |
4375 |
++++ b/drivers/crypto/ccp/ccp-ops.c |
4376 |
+@@ -63,7 +63,7 @@ static u32 ccp_gen_jobid(struct ccp_device *ccp) |
4377 |
+ static void ccp_sg_free(struct ccp_sg_workarea *wa) |
4378 |
+ { |
4379 |
+ if (wa->dma_count) |
4380 |
+- dma_unmap_sg(wa->dma_dev, wa->dma_sg, wa->nents, wa->dma_dir); |
4381 |
++ dma_unmap_sg(wa->dma_dev, wa->dma_sg_head, wa->nents, wa->dma_dir); |
4382 |
+ |
4383 |
+ wa->dma_count = 0; |
4384 |
+ } |
4385 |
+@@ -92,6 +92,7 @@ static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev, |
4386 |
+ return 0; |
4387 |
+ |
4388 |
+ wa->dma_sg = sg; |
4389 |
++ wa->dma_sg_head = sg; |
4390 |
+ wa->dma_dev = dev; |
4391 |
+ wa->dma_dir = dma_dir; |
4392 |
+ wa->dma_count = dma_map_sg(dev, sg, wa->nents, dma_dir); |
4393 |
+@@ -104,14 +105,28 @@ static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev, |
4394 |
+ static void ccp_update_sg_workarea(struct ccp_sg_workarea *wa, unsigned int len) |
4395 |
+ { |
4396 |
+ unsigned int nbytes = min_t(u64, len, wa->bytes_left); |
4397 |
++ unsigned int sg_combined_len = 0; |
4398 |
+ |
4399 |
+ if (!wa->sg) |
4400 |
+ return; |
4401 |
+ |
4402 |
+ wa->sg_used += nbytes; |
4403 |
+ wa->bytes_left -= nbytes; |
4404 |
+- if (wa->sg_used == wa->sg->length) { |
4405 |
+- wa->sg = sg_next(wa->sg); |
4406 |
++ if (wa->sg_used == sg_dma_len(wa->dma_sg)) { |
4407 |
++ /* Advance to the next DMA scatterlist entry */ |
4408 |
++ wa->dma_sg = sg_next(wa->dma_sg); |
4409 |
++ |
4410 |
++ /* In the case that the DMA mapped scatterlist has entries |
4411 |
++ * that have been merged, the non-DMA mapped scatterlist |
4412 |
++ * must be advanced multiple times for each merged entry. |
4413 |
++ * This ensures that the current non-DMA mapped entry |
4414 |
++ * corresponds to the current DMA mapped entry. |
4415 |
++ */ |
4416 |
++ do { |
4417 |
++ sg_combined_len += wa->sg->length; |
4418 |
++ wa->sg = sg_next(wa->sg); |
4419 |
++ } while (wa->sg_used > sg_combined_len); |
4420 |
++ |
4421 |
+ wa->sg_used = 0; |
4422 |
+ } |
4423 |
+ } |
4424 |
+@@ -299,7 +314,7 @@ static unsigned int ccp_queue_buf(struct ccp_data *data, unsigned int from) |
4425 |
+ /* Update the structures and generate the count */ |
4426 |
+ buf_count = 0; |
4427 |
+ while (sg_wa->bytes_left && (buf_count < dm_wa->length)) { |
4428 |
+- nbytes = min(sg_wa->sg->length - sg_wa->sg_used, |
4429 |
++ nbytes = min(sg_dma_len(sg_wa->dma_sg) - sg_wa->sg_used, |
4430 |
+ dm_wa->length - buf_count); |
4431 |
+ nbytes = min_t(u64, sg_wa->bytes_left, nbytes); |
4432 |
+ |
4433 |
+@@ -331,11 +346,11 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
4434 |
+ * and destination. The resulting len values will always be <= UINT_MAX |
4435 |
+ * because the dma length is an unsigned int. |
4436 |
+ */ |
4437 |
+- sg_src_len = sg_dma_len(src->sg_wa.sg) - src->sg_wa.sg_used; |
4438 |
++ sg_src_len = sg_dma_len(src->sg_wa.dma_sg) - src->sg_wa.sg_used; |
4439 |
+ sg_src_len = min_t(u64, src->sg_wa.bytes_left, sg_src_len); |
4440 |
+ |
4441 |
+ if (dst) { |
4442 |
+- sg_dst_len = sg_dma_len(dst->sg_wa.sg) - dst->sg_wa.sg_used; |
4443 |
++ sg_dst_len = sg_dma_len(dst->sg_wa.dma_sg) - dst->sg_wa.sg_used; |
4444 |
+ sg_dst_len = min_t(u64, src->sg_wa.bytes_left, sg_dst_len); |
4445 |
+ op_len = min(sg_src_len, sg_dst_len); |
4446 |
+ } else { |
4447 |
+@@ -365,7 +380,7 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
4448 |
+ /* Enough data in the sg element, but we need to |
4449 |
+ * adjust for any previously copied data |
4450 |
+ */ |
4451 |
+- op->src.u.dma.address = sg_dma_address(src->sg_wa.sg); |
4452 |
++ op->src.u.dma.address = sg_dma_address(src->sg_wa.dma_sg); |
4453 |
+ op->src.u.dma.offset = src->sg_wa.sg_used; |
4454 |
+ op->src.u.dma.length = op_len & ~(block_size - 1); |
4455 |
+ |
4456 |
+@@ -386,7 +401,7 @@ static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst, |
4457 |
+ /* Enough room in the sg element, but we need to |
4458 |
+ * adjust for any previously used area |
4459 |
+ */ |
4460 |
+- op->dst.u.dma.address = sg_dma_address(dst->sg_wa.sg); |
4461 |
++ op->dst.u.dma.address = sg_dma_address(dst->sg_wa.dma_sg); |
4462 |
+ op->dst.u.dma.offset = dst->sg_wa.sg_used; |
4463 |
+ op->dst.u.dma.length = op->src.u.dma.length; |
4464 |
+ } |
4465 |
+@@ -2028,7 +2043,7 @@ ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4466 |
+ dst.sg_wa.sg_used = 0; |
4467 |
+ for (i = 1; i <= src.sg_wa.dma_count; i++) { |
4468 |
+ if (!dst.sg_wa.sg || |
4469 |
+- (dst.sg_wa.sg->length < src.sg_wa.sg->length)) { |
4470 |
++ (sg_dma_len(dst.sg_wa.sg) < sg_dma_len(src.sg_wa.sg))) { |
4471 |
+ ret = -EINVAL; |
4472 |
+ goto e_dst; |
4473 |
+ } |
4474 |
+@@ -2054,8 +2069,8 @@ ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
4475 |
+ goto e_dst; |
4476 |
+ } |
4477 |
+ |
4478 |
+- dst.sg_wa.sg_used += src.sg_wa.sg->length; |
4479 |
+- if (dst.sg_wa.sg_used == dst.sg_wa.sg->length) { |
4480 |
++ dst.sg_wa.sg_used += sg_dma_len(src.sg_wa.sg); |
4481 |
++ if (dst.sg_wa.sg_used == sg_dma_len(dst.sg_wa.sg)) { |
4482 |
+ dst.sg_wa.sg = sg_next(dst.sg_wa.sg); |
4483 |
+ dst.sg_wa.sg_used = 0; |
4484 |
+ } |
4485 |
+diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c |
4486 |
+index 872ea3ff1c6b..f144fe04748b 100644 |
4487 |
+--- a/drivers/crypto/ccree/cc_cipher.c |
4488 |
++++ b/drivers/crypto/ccree/cc_cipher.c |
4489 |
+@@ -159,7 +159,6 @@ static int cc_cipher_init(struct crypto_tfm *tfm) |
4490 |
+ skcipher_alg.base); |
4491 |
+ struct device *dev = drvdata_to_dev(cc_alg->drvdata); |
4492 |
+ unsigned int max_key_buf_size = cc_alg->skcipher_alg.max_keysize; |
4493 |
+- int rc = 0; |
4494 |
+ |
4495 |
+ dev_dbg(dev, "Initializing context @%p for %s\n", ctx_p, |
4496 |
+ crypto_tfm_alg_name(tfm)); |
4497 |
+@@ -171,10 +170,19 @@ static int cc_cipher_init(struct crypto_tfm *tfm) |
4498 |
+ ctx_p->flow_mode = cc_alg->flow_mode; |
4499 |
+ ctx_p->drvdata = cc_alg->drvdata; |
4500 |
+ |
4501 |
++ if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) { |
4502 |
++ /* Alloc hash tfm for essiv */ |
4503 |
++ ctx_p->shash_tfm = crypto_alloc_shash("sha256-generic", 0, 0); |
4504 |
++ if (IS_ERR(ctx_p->shash_tfm)) { |
4505 |
++ dev_err(dev, "Error allocating hash tfm for ESSIV.\n"); |
4506 |
++ return PTR_ERR(ctx_p->shash_tfm); |
4507 |
++ } |
4508 |
++ } |
4509 |
++ |
4510 |
+ /* Allocate key buffer, cache line aligned */ |
4511 |
+ ctx_p->user.key = kmalloc(max_key_buf_size, GFP_KERNEL); |
4512 |
+ if (!ctx_p->user.key) |
4513 |
+- return -ENOMEM; |
4514 |
++ goto free_shash; |
4515 |
+ |
4516 |
+ dev_dbg(dev, "Allocated key buffer in context. key=@%p\n", |
4517 |
+ ctx_p->user.key); |
4518 |
+@@ -186,21 +194,19 @@ static int cc_cipher_init(struct crypto_tfm *tfm) |
4519 |
+ if (dma_mapping_error(dev, ctx_p->user.key_dma_addr)) { |
4520 |
+ dev_err(dev, "Mapping Key %u B at va=%pK for DMA failed\n", |
4521 |
+ max_key_buf_size, ctx_p->user.key); |
4522 |
+- return -ENOMEM; |
4523 |
++ goto free_key; |
4524 |
+ } |
4525 |
+ dev_dbg(dev, "Mapped key %u B at va=%pK to dma=%pad\n", |
4526 |
+ max_key_buf_size, ctx_p->user.key, &ctx_p->user.key_dma_addr); |
4527 |
+ |
4528 |
+- if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) { |
4529 |
+- /* Alloc hash tfm for essiv */ |
4530 |
+- ctx_p->shash_tfm = crypto_alloc_shash("sha256-generic", 0, 0); |
4531 |
+- if (IS_ERR(ctx_p->shash_tfm)) { |
4532 |
+- dev_err(dev, "Error allocating hash tfm for ESSIV.\n"); |
4533 |
+- return PTR_ERR(ctx_p->shash_tfm); |
4534 |
+- } |
4535 |
+- } |
4536 |
++ return 0; |
4537 |
+ |
4538 |
+- return rc; |
4539 |
++free_key: |
4540 |
++ kfree(ctx_p->user.key); |
4541 |
++free_shash: |
4542 |
++ crypto_free_shash(ctx_p->shash_tfm); |
4543 |
++ |
4544 |
++ return -ENOMEM; |
4545 |
+ } |
4546 |
+ |
4547 |
+ static void cc_cipher_exit(struct crypto_tfm *tfm) |
4548 |
+diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c |
4549 |
+index c27e7160d2df..4ad4ffd90cee 100644 |
4550 |
+--- a/drivers/crypto/hisilicon/sec/sec_algs.c |
4551 |
++++ b/drivers/crypto/hisilicon/sec/sec_algs.c |
4552 |
+@@ -175,7 +175,8 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, |
4553 |
+ dma_addr_t *psec_sgl, |
4554 |
+ struct scatterlist *sgl, |
4555 |
+ int count, |
4556 |
+- struct sec_dev_info *info) |
4557 |
++ struct sec_dev_info *info, |
4558 |
++ gfp_t gfp) |
4559 |
+ { |
4560 |
+ struct sec_hw_sgl *sgl_current = NULL; |
4561 |
+ struct sec_hw_sgl *sgl_next; |
4562 |
+@@ -190,7 +191,7 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, |
4563 |
+ sge_index = i % SEC_MAX_SGE_NUM; |
4564 |
+ if (sge_index == 0) { |
4565 |
+ sgl_next = dma_pool_zalloc(info->hw_sgl_pool, |
4566 |
+- GFP_KERNEL, &sgl_next_dma); |
4567 |
++ gfp, &sgl_next_dma); |
4568 |
+ if (!sgl_next) { |
4569 |
+ ret = -ENOMEM; |
4570 |
+ goto err_free_hw_sgls; |
4571 |
+@@ -545,14 +546,14 @@ void sec_alg_callback(struct sec_bd_info *resp, void *shadow) |
4572 |
+ } |
4573 |
+ |
4574 |
+ static int sec_alg_alloc_and_calc_split_sizes(int length, size_t **split_sizes, |
4575 |
+- int *steps) |
4576 |
++ int *steps, gfp_t gfp) |
4577 |
+ { |
4578 |
+ size_t *sizes; |
4579 |
+ int i; |
4580 |
+ |
4581 |
+ /* Split into suitable sized blocks */ |
4582 |
+ *steps = roundup(length, SEC_REQ_LIMIT) / SEC_REQ_LIMIT; |
4583 |
+- sizes = kcalloc(*steps, sizeof(*sizes), GFP_KERNEL); |
4584 |
++ sizes = kcalloc(*steps, sizeof(*sizes), gfp); |
4585 |
+ if (!sizes) |
4586 |
+ return -ENOMEM; |
4587 |
+ |
4588 |
+@@ -568,7 +569,7 @@ static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes, |
4589 |
+ int steps, struct scatterlist ***splits, |
4590 |
+ int **splits_nents, |
4591 |
+ int sgl_len_in, |
4592 |
+- struct device *dev) |
4593 |
++ struct device *dev, gfp_t gfp) |
4594 |
+ { |
4595 |
+ int ret, count; |
4596 |
+ |
4597 |
+@@ -576,12 +577,12 @@ static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes, |
4598 |
+ if (!count) |
4599 |
+ return -EINVAL; |
4600 |
+ |
4601 |
+- *splits = kcalloc(steps, sizeof(struct scatterlist *), GFP_KERNEL); |
4602 |
++ *splits = kcalloc(steps, sizeof(struct scatterlist *), gfp); |
4603 |
+ if (!*splits) { |
4604 |
+ ret = -ENOMEM; |
4605 |
+ goto err_unmap_sg; |
4606 |
+ } |
4607 |
+- *splits_nents = kcalloc(steps, sizeof(int), GFP_KERNEL); |
4608 |
++ *splits_nents = kcalloc(steps, sizeof(int), gfp); |
4609 |
+ if (!*splits_nents) { |
4610 |
+ ret = -ENOMEM; |
4611 |
+ goto err_free_splits; |
4612 |
+@@ -589,7 +590,7 @@ static int sec_map_and_split_sg(struct scatterlist *sgl, size_t *split_sizes, |
4613 |
+ |
4614 |
+ /* output the scatter list before and after this */ |
4615 |
+ ret = sg_split(sgl, count, 0, steps, split_sizes, |
4616 |
+- *splits, *splits_nents, GFP_KERNEL); |
4617 |
++ *splits, *splits_nents, gfp); |
4618 |
+ if (ret) { |
4619 |
+ ret = -ENOMEM; |
4620 |
+ goto err_free_splits_nents; |
4621 |
+@@ -630,13 +631,13 @@ static struct sec_request_el |
4622 |
+ int el_size, bool different_dest, |
4623 |
+ struct scatterlist *sgl_in, int n_ents_in, |
4624 |
+ struct scatterlist *sgl_out, int n_ents_out, |
4625 |
+- struct sec_dev_info *info) |
4626 |
++ struct sec_dev_info *info, gfp_t gfp) |
4627 |
+ { |
4628 |
+ struct sec_request_el *el; |
4629 |
+ struct sec_bd_info *req; |
4630 |
+ int ret; |
4631 |
+ |
4632 |
+- el = kzalloc(sizeof(*el), GFP_KERNEL); |
4633 |
++ el = kzalloc(sizeof(*el), gfp); |
4634 |
+ if (!el) |
4635 |
+ return ERR_PTR(-ENOMEM); |
4636 |
+ el->el_length = el_size; |
4637 |
+@@ -668,7 +669,7 @@ static struct sec_request_el |
4638 |
+ el->sgl_in = sgl_in; |
4639 |
+ |
4640 |
+ ret = sec_alloc_and_fill_hw_sgl(&el->in, &el->dma_in, el->sgl_in, |
4641 |
+- n_ents_in, info); |
4642 |
++ n_ents_in, info, gfp); |
4643 |
+ if (ret) |
4644 |
+ goto err_free_el; |
4645 |
+ |
4646 |
+@@ -679,7 +680,7 @@ static struct sec_request_el |
4647 |
+ el->sgl_out = sgl_out; |
4648 |
+ ret = sec_alloc_and_fill_hw_sgl(&el->out, &el->dma_out, |
4649 |
+ el->sgl_out, |
4650 |
+- n_ents_out, info); |
4651 |
++ n_ents_out, info, gfp); |
4652 |
+ if (ret) |
4653 |
+ goto err_free_hw_sgl_in; |
4654 |
+ |
4655 |
+@@ -720,6 +721,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
4656 |
+ int *splits_out_nents = NULL; |
4657 |
+ struct sec_request_el *el, *temp; |
4658 |
+ bool split = skreq->src != skreq->dst; |
4659 |
++ gfp_t gfp = skreq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC; |
4660 |
+ |
4661 |
+ mutex_init(&sec_req->lock); |
4662 |
+ sec_req->req_base = &skreq->base; |
4663 |
+@@ -728,13 +730,13 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
4664 |
+ sec_req->len_in = sg_nents(skreq->src); |
4665 |
+ |
4666 |
+ ret = sec_alg_alloc_and_calc_split_sizes(skreq->cryptlen, &split_sizes, |
4667 |
+- &steps); |
4668 |
++ &steps, gfp); |
4669 |
+ if (ret) |
4670 |
+ return ret; |
4671 |
+ sec_req->num_elements = steps; |
4672 |
+ ret = sec_map_and_split_sg(skreq->src, split_sizes, steps, &splits_in, |
4673 |
+ &splits_in_nents, sec_req->len_in, |
4674 |
+- info->dev); |
4675 |
++ info->dev, gfp); |
4676 |
+ if (ret) |
4677 |
+ goto err_free_split_sizes; |
4678 |
+ |
4679 |
+@@ -742,7 +744,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
4680 |
+ sec_req->len_out = sg_nents(skreq->dst); |
4681 |
+ ret = sec_map_and_split_sg(skreq->dst, split_sizes, steps, |
4682 |
+ &splits_out, &splits_out_nents, |
4683 |
+- sec_req->len_out, info->dev); |
4684 |
++ sec_req->len_out, info->dev, gfp); |
4685 |
+ if (ret) |
4686 |
+ goto err_unmap_in_sg; |
4687 |
+ } |
4688 |
+@@ -775,7 +777,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, |
4689 |
+ splits_in[i], splits_in_nents[i], |
4690 |
+ split ? splits_out[i] : NULL, |
4691 |
+ split ? splits_out_nents[i] : 0, |
4692 |
+- info); |
4693 |
++ info, gfp); |
4694 |
+ if (IS_ERR(el)) { |
4695 |
+ ret = PTR_ERR(el); |
4696 |
+ goto err_free_elements; |
4697 |
+diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c |
4698 |
+index e14d3dd291f0..1b050391c0c9 100644 |
4699 |
+--- a/drivers/crypto/qat/qat_common/qat_algs.c |
4700 |
++++ b/drivers/crypto/qat/qat_common/qat_algs.c |
4701 |
+@@ -55,6 +55,7 @@ |
4702 |
+ #include <crypto/hmac.h> |
4703 |
+ #include <crypto/algapi.h> |
4704 |
+ #include <crypto/authenc.h> |
4705 |
++#include <crypto/xts.h> |
4706 |
+ #include <linux/dma-mapping.h> |
4707 |
+ #include "adf_accel_devices.h" |
4708 |
+ #include "adf_transport.h" |
4709 |
+@@ -1102,6 +1103,14 @@ static int qat_alg_skcipher_blk_encrypt(struct skcipher_request *req) |
4710 |
+ return qat_alg_skcipher_encrypt(req); |
4711 |
+ } |
4712 |
+ |
4713 |
++static int qat_alg_skcipher_xts_encrypt(struct skcipher_request *req) |
4714 |
++{ |
4715 |
++ if (req->cryptlen < XTS_BLOCK_SIZE) |
4716 |
++ return -EINVAL; |
4717 |
++ |
4718 |
++ return qat_alg_skcipher_encrypt(req); |
4719 |
++} |
4720 |
++ |
4721 |
+ static int qat_alg_skcipher_decrypt(struct skcipher_request *req) |
4722 |
+ { |
4723 |
+ struct crypto_skcipher *stfm = crypto_skcipher_reqtfm(req); |
4724 |
+@@ -1161,6 +1170,15 @@ static int qat_alg_skcipher_blk_decrypt(struct skcipher_request *req) |
4725 |
+ |
4726 |
+ return qat_alg_skcipher_decrypt(req); |
4727 |
+ } |
4728 |
++ |
4729 |
++static int qat_alg_skcipher_xts_decrypt(struct skcipher_request *req) |
4730 |
++{ |
4731 |
++ if (req->cryptlen < XTS_BLOCK_SIZE) |
4732 |
++ return -EINVAL; |
4733 |
++ |
4734 |
++ return qat_alg_skcipher_decrypt(req); |
4735 |
++} |
4736 |
++ |
4737 |
+ static int qat_alg_aead_init(struct crypto_aead *tfm, |
4738 |
+ enum icp_qat_hw_auth_algo hash, |
4739 |
+ const char *hash_name) |
4740 |
+@@ -1354,8 +1372,8 @@ static struct skcipher_alg qat_skciphers[] = { { |
4741 |
+ .init = qat_alg_skcipher_init_tfm, |
4742 |
+ .exit = qat_alg_skcipher_exit_tfm, |
4743 |
+ .setkey = qat_alg_skcipher_xts_setkey, |
4744 |
+- .decrypt = qat_alg_skcipher_blk_decrypt, |
4745 |
+- .encrypt = qat_alg_skcipher_blk_encrypt, |
4746 |
++ .decrypt = qat_alg_skcipher_xts_decrypt, |
4747 |
++ .encrypt = qat_alg_skcipher_xts_encrypt, |
4748 |
+ .min_keysize = 2 * AES_MIN_KEY_SIZE, |
4749 |
+ .max_keysize = 2 * AES_MAX_KEY_SIZE, |
4750 |
+ .ivsize = AES_BLOCK_SIZE, |
4751 |
+diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c |
4752 |
+index 6bd8f6a2a24f..aeb03081415c 100644 |
4753 |
+--- a/drivers/crypto/qat/qat_common/qat_uclo.c |
4754 |
++++ b/drivers/crypto/qat/qat_common/qat_uclo.c |
4755 |
+@@ -332,13 +332,18 @@ static int qat_uclo_create_batch_init_list(struct icp_qat_fw_loader_handle |
4756 |
+ } |
4757 |
+ return 0; |
4758 |
+ out_err: |
4759 |
++ /* Do not free the list head unless we allocated it. */ |
4760 |
++ tail_old = tail_old->next; |
4761 |
++ if (flag) { |
4762 |
++ kfree(*init_tab_base); |
4763 |
++ *init_tab_base = NULL; |
4764 |
++ } |
4765 |
++ |
4766 |
+ while (tail_old) { |
4767 |
+ mem_init = tail_old->next; |
4768 |
+ kfree(tail_old); |
4769 |
+ tail_old = mem_init; |
4770 |
+ } |
4771 |
+- if (flag) |
4772 |
+- kfree(*init_tab_base); |
4773 |
+ return -ENOMEM; |
4774 |
+ } |
4775 |
+ |
4776 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
4777 |
+index 52b9c3e141f3..46c84dce6544 100644 |
4778 |
+--- a/drivers/devfreq/devfreq.c |
4779 |
++++ b/drivers/devfreq/devfreq.c |
4780 |
+@@ -1657,8 +1657,7 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
4781 |
+ unsigned long cur_freq, min_freq, max_freq; |
4782 |
+ unsigned int polling_ms; |
4783 |
+ |
4784 |
+- seq_printf(s, "%-30s %-10s %-10s %-15s %10s %12s %12s %12s\n", |
4785 |
+- "dev_name", |
4786 |
++ seq_printf(s, "%-30s %-30s %-15s %10s %12s %12s %12s\n", |
4787 |
+ "dev", |
4788 |
+ "parent_dev", |
4789 |
+ "governor", |
4790 |
+@@ -1666,10 +1665,9 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
4791 |
+ "cur_freq_Hz", |
4792 |
+ "min_freq_Hz", |
4793 |
+ "max_freq_Hz"); |
4794 |
+- seq_printf(s, "%30s %10s %10s %15s %10s %12s %12s %12s\n", |
4795 |
++ seq_printf(s, "%30s %30s %15s %10s %12s %12s %12s\n", |
4796 |
++ "------------------------------", |
4797 |
+ "------------------------------", |
4798 |
+- "----------", |
4799 |
+- "----------", |
4800 |
+ "---------------", |
4801 |
+ "----------", |
4802 |
+ "------------", |
4803 |
+@@ -1698,8 +1696,7 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
4804 |
+ mutex_unlock(&devfreq->lock); |
4805 |
+ |
4806 |
+ seq_printf(s, |
4807 |
+- "%-30s %-10s %-10s %-15s %10d %12ld %12ld %12ld\n", |
4808 |
+- dev_name(devfreq->dev.parent), |
4809 |
++ "%-30s %-30s %-15s %10d %12ld %12ld %12ld\n", |
4810 |
+ dev_name(&devfreq->dev), |
4811 |
+ p_devfreq ? dev_name(&p_devfreq->dev) : "null", |
4812 |
+ devfreq->governor_name, |
4813 |
+diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c |
4814 |
+index 24f04f78285b..027769e39f9b 100644 |
4815 |
+--- a/drivers/devfreq/rk3399_dmc.c |
4816 |
++++ b/drivers/devfreq/rk3399_dmc.c |
4817 |
+@@ -95,18 +95,20 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, |
4818 |
+ |
4819 |
+ mutex_lock(&dmcfreq->lock); |
4820 |
+ |
4821 |
+- if (target_rate >= dmcfreq->odt_dis_freq) |
4822 |
+- odt_enable = true; |
4823 |
+- |
4824 |
+- /* |
4825 |
+- * This makes a SMC call to the TF-A to set the DDR PD (power-down) |
4826 |
+- * timings and to enable or disable the ODT (on-die termination) |
4827 |
+- * resistors. |
4828 |
+- */ |
4829 |
+- arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, dmcfreq->odt_pd_arg0, |
4830 |
+- dmcfreq->odt_pd_arg1, |
4831 |
+- ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, |
4832 |
+- odt_enable, 0, 0, 0, &res); |
4833 |
++ if (dmcfreq->regmap_pmu) { |
4834 |
++ if (target_rate >= dmcfreq->odt_dis_freq) |
4835 |
++ odt_enable = true; |
4836 |
++ |
4837 |
++ /* |
4838 |
++ * This makes a SMC call to the TF-A to set the DDR PD |
4839 |
++ * (power-down) timings and to enable or disable the |
4840 |
++ * ODT (on-die termination) resistors. |
4841 |
++ */ |
4842 |
++ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, dmcfreq->odt_pd_arg0, |
4843 |
++ dmcfreq->odt_pd_arg1, |
4844 |
++ ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, |
4845 |
++ odt_enable, 0, 0, 0, &res); |
4846 |
++ } |
4847 |
+ |
4848 |
+ /* |
4849 |
+ * If frequency scaling from low to high, adjust voltage first. |
4850 |
+@@ -371,13 +373,14 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) |
4851 |
+ } |
4852 |
+ |
4853 |
+ node = of_parse_phandle(np, "rockchip,pmu", 0); |
4854 |
+- if (node) { |
4855 |
+- data->regmap_pmu = syscon_node_to_regmap(node); |
4856 |
+- of_node_put(node); |
4857 |
+- if (IS_ERR(data->regmap_pmu)) { |
4858 |
+- ret = PTR_ERR(data->regmap_pmu); |
4859 |
+- goto err_edev; |
4860 |
+- } |
4861 |
++ if (!node) |
4862 |
++ goto no_pmu; |
4863 |
++ |
4864 |
++ data->regmap_pmu = syscon_node_to_regmap(node); |
4865 |
++ of_node_put(node); |
4866 |
++ if (IS_ERR(data->regmap_pmu)) { |
4867 |
++ ret = PTR_ERR(data->regmap_pmu); |
4868 |
++ goto err_edev; |
4869 |
+ } |
4870 |
+ |
4871 |
+ regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); |
4872 |
+@@ -399,6 +402,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) |
4873 |
+ goto err_edev; |
4874 |
+ }; |
4875 |
+ |
4876 |
++no_pmu: |
4877 |
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, 0, 0, |
4878 |
+ ROCKCHIP_SIP_CONFIG_DRAM_INIT, |
4879 |
+ 0, 0, 0, 0, &res); |
4880 |
+diff --git a/drivers/dma-buf/st-dma-fence-chain.c b/drivers/dma-buf/st-dma-fence-chain.c |
4881 |
+index 5d45ba7ba3cd..9525f7f56119 100644 |
4882 |
+--- a/drivers/dma-buf/st-dma-fence-chain.c |
4883 |
++++ b/drivers/dma-buf/st-dma-fence-chain.c |
4884 |
+@@ -318,15 +318,16 @@ static int find_out_of_order(void *arg) |
4885 |
+ goto err; |
4886 |
+ } |
4887 |
+ |
4888 |
+- if (fence && fence != fc.chains[1]) { |
4889 |
++ /* |
4890 |
++ * We signaled the middle fence (2) of the 1-2-3 chain. The behavior |
4891 |
++ * of the dma-fence-chain is to make us wait for all the fences up to |
4892 |
++ * the point we want. Since fence 1 is still not signaled, this what |
4893 |
++ * we should get as fence to wait upon (fence 2 being garbage |
4894 |
++ * collected during the traversal of the chain). |
4895 |
++ */ |
4896 |
++ if (fence != fc.chains[0]) { |
4897 |
+ pr_err("Incorrect chain-fence.seqno:%lld reported for completed seqno:2\n", |
4898 |
+- fence->seqno); |
4899 |
+- |
4900 |
+- dma_fence_get(fence); |
4901 |
+- err = dma_fence_chain_find_seqno(&fence, 2); |
4902 |
+- dma_fence_put(fence); |
4903 |
+- if (err) |
4904 |
+- pr_err("Reported %d for finding self!\n", err); |
4905 |
++ fence ? fence->seqno : 0); |
4906 |
+ |
4907 |
+ err = -EINVAL; |
4908 |
+ } |
4909 |
+@@ -415,20 +416,18 @@ static int __find_race(void *arg) |
4910 |
+ if (!fence) |
4911 |
+ goto signal; |
4912 |
+ |
4913 |
+- err = dma_fence_chain_find_seqno(&fence, seqno); |
4914 |
+- if (err) { |
4915 |
+- pr_err("Reported an invalid fence for find-self:%d\n", |
4916 |
+- seqno); |
4917 |
+- dma_fence_put(fence); |
4918 |
+- break; |
4919 |
+- } |
4920 |
+- |
4921 |
+- if (fence->seqno < seqno) { |
4922 |
+- pr_err("Reported an earlier fence.seqno:%lld for seqno:%d\n", |
4923 |
+- fence->seqno, seqno); |
4924 |
+- err = -EINVAL; |
4925 |
+- dma_fence_put(fence); |
4926 |
+- break; |
4927 |
++ /* |
4928 |
++ * We can only find ourselves if we are on fence we were |
4929 |
++ * looking for. |
4930 |
++ */ |
4931 |
++ if (fence->seqno == seqno) { |
4932 |
++ err = dma_fence_chain_find_seqno(&fence, seqno); |
4933 |
++ if (err) { |
4934 |
++ pr_err("Reported an invalid fence for find-self:%d\n", |
4935 |
++ seqno); |
4936 |
++ dma_fence_put(fence); |
4937 |
++ break; |
4938 |
++ } |
4939 |
+ } |
4940 |
+ |
4941 |
+ dma_fence_put(fence); |
4942 |
+diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c |
4943 |
+index 0e7ea3591b78..5e7593753799 100644 |
4944 |
+--- a/drivers/edac/edac_device_sysfs.c |
4945 |
++++ b/drivers/edac/edac_device_sysfs.c |
4946 |
+@@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) |
4947 |
+ |
4948 |
+ /* Error exit stack */ |
4949 |
+ err_kobj_reg: |
4950 |
++ kobject_put(&edac_dev->kobj); |
4951 |
+ module_put(edac_dev->owner); |
4952 |
+ |
4953 |
+ err_out: |
4954 |
+diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c |
4955 |
+index 72c9eb9fdffb..53042af7262e 100644 |
4956 |
+--- a/drivers/edac/edac_pci_sysfs.c |
4957 |
++++ b/drivers/edac/edac_pci_sysfs.c |
4958 |
+@@ -386,7 +386,7 @@ static int edac_pci_main_kobj_setup(void) |
4959 |
+ |
4960 |
+ /* Error unwind statck */ |
4961 |
+ kobject_init_and_add_fail: |
4962 |
+- kfree(edac_pci_top_main_kobj); |
4963 |
++ kobject_put(edac_pci_top_main_kobj); |
4964 |
+ |
4965 |
+ kzalloc_fail: |
4966 |
+ module_put(THIS_MODULE); |
4967 |
+diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c |
4968 |
+index bafbfe358f97..9e44479f0284 100644 |
4969 |
+--- a/drivers/firmware/arm_scmi/scmi_pm_domain.c |
4970 |
++++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c |
4971 |
+@@ -85,7 +85,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) |
4972 |
+ for (i = 0; i < num_domains; i++, scmi_pd++) { |
4973 |
+ u32 state; |
4974 |
+ |
4975 |
+- domains[i] = &scmi_pd->genpd; |
4976 |
++ if (handle->power_ops->state_get(handle, i, &state)) { |
4977 |
++ dev_warn(dev, "failed to get state for domain %d\n", i); |
4978 |
++ continue; |
4979 |
++ } |
4980 |
+ |
4981 |
+ scmi_pd->domain = i; |
4982 |
+ scmi_pd->handle = handle; |
4983 |
+@@ -94,13 +97,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) |
4984 |
+ scmi_pd->genpd.power_off = scmi_pd_power_off; |
4985 |
+ scmi_pd->genpd.power_on = scmi_pd_power_on; |
4986 |
+ |
4987 |
+- if (handle->power_ops->state_get(handle, i, &state)) { |
4988 |
+- dev_warn(dev, "failed to get state for domain %d\n", i); |
4989 |
+- continue; |
4990 |
+- } |
4991 |
+- |
4992 |
+ pm_genpd_init(&scmi_pd->genpd, NULL, |
4993 |
+ state == SCMI_POWER_STATE_GENERIC_OFF); |
4994 |
++ |
4995 |
++ domains[i] = &scmi_pd->genpd; |
4996 |
+ } |
4997 |
+ |
4998 |
+ scmi_pd_data->domains = domains; |
4999 |
+diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c |
5000 |
+index 0e7233a20f34..d4fda210adfe 100644 |
5001 |
+--- a/drivers/firmware/qcom_scm.c |
5002 |
++++ b/drivers/firmware/qcom_scm.c |
5003 |
+@@ -391,7 +391,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) |
5004 |
+ |
5005 |
+ desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; |
5006 |
+ |
5007 |
+- return qcom_scm_call(__scm->dev, &desc, NULL); |
5008 |
++ return qcom_scm_call_atomic(__scm->dev, &desc, NULL); |
5009 |
+ } |
5010 |
+ |
5011 |
+ static void qcom_scm_set_download_mode(bool enable) |
5012 |
+@@ -650,7 +650,7 @@ int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) |
5013 |
+ int ret; |
5014 |
+ |
5015 |
+ |
5016 |
+- ret = qcom_scm_call(__scm->dev, &desc, &res); |
5017 |
++ ret = qcom_scm_call_atomic(__scm->dev, &desc, &res); |
5018 |
+ if (ret >= 0) |
5019 |
+ *val = res.result[0]; |
5020 |
+ |
5021 |
+@@ -669,8 +669,7 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) |
5022 |
+ .owner = ARM_SMCCC_OWNER_SIP, |
5023 |
+ }; |
5024 |
+ |
5025 |
+- |
5026 |
+- return qcom_scm_call(__scm->dev, &desc, NULL); |
5027 |
++ return qcom_scm_call_atomic(__scm->dev, &desc, NULL); |
5028 |
+ } |
5029 |
+ EXPORT_SYMBOL(qcom_scm_io_writel); |
5030 |
+ |
5031 |
+diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c |
5032 |
+index 5c91c4365da1..7dbce4c4ebdf 100644 |
5033 |
+--- a/drivers/gpio/gpiolib-devres.c |
5034 |
++++ b/drivers/gpio/gpiolib-devres.c |
5035 |
+@@ -487,10 +487,12 @@ static void devm_gpio_chip_release(struct device *dev, void *res) |
5036 |
+ } |
5037 |
+ |
5038 |
+ /** |
5039 |
+- * devm_gpiochip_add_data() - Resource managed gpiochip_add_data() |
5040 |
++ * devm_gpiochip_add_data_with_key() - Resource managed gpiochip_add_data_with_key() |
5041 |
+ * @dev: pointer to the device that gpio_chip belongs to. |
5042 |
+ * @gc: the GPIO chip to register |
5043 |
+ * @data: driver-private data associated with this chip |
5044 |
++ * @lock_key: lockdep class for IRQ lock |
5045 |
++ * @request_key: lockdep class for IRQ request |
5046 |
+ * |
5047 |
+ * Context: potentially before irqs will work |
5048 |
+ * |
5049 |
+@@ -501,8 +503,9 @@ static void devm_gpio_chip_release(struct device *dev, void *res) |
5050 |
+ * gc->base is invalid or already associated with a different chip. |
5051 |
+ * Otherwise it returns zero as a success code. |
5052 |
+ */ |
5053 |
+-int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
5054 |
+- void *data) |
5055 |
++int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc, void *data, |
5056 |
++ struct lock_class_key *lock_key, |
5057 |
++ struct lock_class_key *request_key) |
5058 |
+ { |
5059 |
+ struct gpio_chip **ptr; |
5060 |
+ int ret; |
5061 |
+@@ -512,7 +515,7 @@ int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
5062 |
+ if (!ptr) |
5063 |
+ return -ENOMEM; |
5064 |
+ |
5065 |
+- ret = gpiochip_add_data(gc, data); |
5066 |
++ ret = gpiochip_add_data_with_key(gc, data, lock_key, request_key); |
5067 |
+ if (ret < 0) { |
5068 |
+ devres_free(ptr); |
5069 |
+ return ret; |
5070 |
+@@ -523,4 +526,4 @@ int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
5071 |
+ |
5072 |
+ return 0; |
5073 |
+ } |
5074 |
+-EXPORT_SYMBOL_GPL(devm_gpiochip_add_data); |
5075 |
++EXPORT_SYMBOL_GPL(devm_gpiochip_add_data_with_key); |
5076 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
5077 |
+index a414da22a359..f87b225437fc 100644 |
5078 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
5079 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |
5080 |
+@@ -223,12 +223,16 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, |
5081 |
+ *pos &= (1UL << 22) - 1; |
5082 |
+ |
5083 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5084 |
+- if (r < 0) |
5085 |
++ if (r < 0) { |
5086 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5087 |
+ return r; |
5088 |
++ } |
5089 |
+ |
5090 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5091 |
+- if (r < 0) |
5092 |
++ if (r < 0) { |
5093 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5094 |
+ return r; |
5095 |
++ } |
5096 |
+ |
5097 |
+ if (use_bank) { |
5098 |
+ if ((sh_bank != 0xFFFFFFFF && sh_bank >= adev->gfx.config.max_sh_per_se) || |
5099 |
+@@ -332,12 +336,16 @@ static ssize_t amdgpu_debugfs_regs_pcie_read(struct file *f, char __user *buf, |
5100 |
+ return -EINVAL; |
5101 |
+ |
5102 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5103 |
+- if (r < 0) |
5104 |
++ if (r < 0) { |
5105 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5106 |
+ return r; |
5107 |
++ } |
5108 |
+ |
5109 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5110 |
+- if (r < 0) |
5111 |
++ if (r < 0) { |
5112 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5113 |
+ return r; |
5114 |
++ } |
5115 |
+ |
5116 |
+ while (size) { |
5117 |
+ uint32_t value; |
5118 |
+@@ -387,12 +395,16 @@ static ssize_t amdgpu_debugfs_regs_pcie_write(struct file *f, const char __user |
5119 |
+ return -EINVAL; |
5120 |
+ |
5121 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5122 |
+- if (r < 0) |
5123 |
++ if (r < 0) { |
5124 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5125 |
+ return r; |
5126 |
++ } |
5127 |
+ |
5128 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5129 |
+- if (r < 0) |
5130 |
++ if (r < 0) { |
5131 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5132 |
+ return r; |
5133 |
++ } |
5134 |
+ |
5135 |
+ while (size) { |
5136 |
+ uint32_t value; |
5137 |
+@@ -443,12 +455,16 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf, |
5138 |
+ return -EINVAL; |
5139 |
+ |
5140 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5141 |
+- if (r < 0) |
5142 |
++ if (r < 0) { |
5143 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5144 |
+ return r; |
5145 |
++ } |
5146 |
+ |
5147 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5148 |
+- if (r < 0) |
5149 |
++ if (r < 0) { |
5150 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5151 |
+ return r; |
5152 |
++ } |
5153 |
+ |
5154 |
+ while (size) { |
5155 |
+ uint32_t value; |
5156 |
+@@ -498,12 +514,16 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __user |
5157 |
+ return -EINVAL; |
5158 |
+ |
5159 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5160 |
+- if (r < 0) |
5161 |
++ if (r < 0) { |
5162 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5163 |
+ return r; |
5164 |
++ } |
5165 |
+ |
5166 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5167 |
+- if (r < 0) |
5168 |
++ if (r < 0) { |
5169 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5170 |
+ return r; |
5171 |
++ } |
5172 |
+ |
5173 |
+ while (size) { |
5174 |
+ uint32_t value; |
5175 |
+@@ -554,12 +574,16 @@ static ssize_t amdgpu_debugfs_regs_smc_read(struct file *f, char __user *buf, |
5176 |
+ return -EINVAL; |
5177 |
+ |
5178 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5179 |
+- if (r < 0) |
5180 |
++ if (r < 0) { |
5181 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5182 |
+ return r; |
5183 |
++ } |
5184 |
+ |
5185 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5186 |
+- if (r < 0) |
5187 |
++ if (r < 0) { |
5188 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5189 |
+ return r; |
5190 |
++ } |
5191 |
+ |
5192 |
+ while (size) { |
5193 |
+ uint32_t value; |
5194 |
+@@ -609,12 +633,16 @@ static ssize_t amdgpu_debugfs_regs_smc_write(struct file *f, const char __user * |
5195 |
+ return -EINVAL; |
5196 |
+ |
5197 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5198 |
+- if (r < 0) |
5199 |
++ if (r < 0) { |
5200 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5201 |
+ return r; |
5202 |
++ } |
5203 |
+ |
5204 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5205 |
+- if (r < 0) |
5206 |
++ if (r < 0) { |
5207 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5208 |
+ return r; |
5209 |
++ } |
5210 |
+ |
5211 |
+ while (size) { |
5212 |
+ uint32_t value; |
5213 |
+@@ -764,12 +792,16 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, |
5214 |
+ valuesize = sizeof(values); |
5215 |
+ |
5216 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5217 |
+- if (r < 0) |
5218 |
++ if (r < 0) { |
5219 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5220 |
+ return r; |
5221 |
++ } |
5222 |
+ |
5223 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5224 |
+- if (r < 0) |
5225 |
++ if (r < 0) { |
5226 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5227 |
+ return r; |
5228 |
++ } |
5229 |
+ |
5230 |
+ r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize); |
5231 |
+ |
5232 |
+@@ -842,12 +874,16 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf, |
5233 |
+ simd = (*pos & GENMASK_ULL(44, 37)) >> 37; |
5234 |
+ |
5235 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5236 |
+- if (r < 0) |
5237 |
++ if (r < 0) { |
5238 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5239 |
+ return r; |
5240 |
++ } |
5241 |
+ |
5242 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5243 |
+- if (r < 0) |
5244 |
++ if (r < 0) { |
5245 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5246 |
+ return r; |
5247 |
++ } |
5248 |
+ |
5249 |
+ /* switch to the specific se/sh/cu */ |
5250 |
+ mutex_lock(&adev->grbm_idx_mutex); |
5251 |
+@@ -941,7 +977,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, |
5252 |
+ |
5253 |
+ r = amdgpu_virt_enable_access_debugfs(adev); |
5254 |
+ if (r < 0) |
5255 |
+- return r; |
5256 |
++ goto err; |
5257 |
+ |
5258 |
+ /* switch to the specific se/sh/cu */ |
5259 |
+ mutex_lock(&adev->grbm_idx_mutex); |
5260 |
+@@ -977,6 +1013,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, |
5261 |
+ } |
5262 |
+ |
5263 |
+ err: |
5264 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5265 |
+ kfree(data); |
5266 |
+ amdgpu_virt_disable_access_debugfs(adev); |
5267 |
+ return result; |
5268 |
+@@ -1003,8 +1040,10 @@ static ssize_t amdgpu_debugfs_gfxoff_write(struct file *f, const char __user *bu |
5269 |
+ return -EINVAL; |
5270 |
+ |
5271 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
5272 |
+- if (r < 0) |
5273 |
++ if (r < 0) { |
5274 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5275 |
+ return r; |
5276 |
++ } |
5277 |
+ |
5278 |
+ while (size) { |
5279 |
+ uint32_t value; |
5280 |
+@@ -1140,8 +1179,10 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) |
5281 |
+ int r = 0, i; |
5282 |
+ |
5283 |
+ r = pm_runtime_get_sync(dev->dev); |
5284 |
+- if (r < 0) |
5285 |
++ if (r < 0) { |
5286 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5287 |
+ return r; |
5288 |
++ } |
5289 |
+ |
5290 |
+ /* Avoid accidently unparking the sched thread during GPU reset */ |
5291 |
+ mutex_lock(&adev->lock_reset); |
5292 |
+@@ -1197,8 +1238,10 @@ static int amdgpu_debugfs_evict_vram(struct seq_file *m, void *data) |
5293 |
+ int r; |
5294 |
+ |
5295 |
+ r = pm_runtime_get_sync(dev->dev); |
5296 |
+- if (r < 0) |
5297 |
++ if (r < 0) { |
5298 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5299 |
+ return r; |
5300 |
++ } |
5301 |
+ |
5302 |
+ seq_printf(m, "(%d)\n", amdgpu_bo_evict_vram(adev)); |
5303 |
+ |
5304 |
+@@ -1216,8 +1259,10 @@ static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data) |
5305 |
+ int r; |
5306 |
+ |
5307 |
+ r = pm_runtime_get_sync(dev->dev); |
5308 |
+- if (r < 0) |
5309 |
++ if (r < 0) { |
5310 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5311 |
+ return r; |
5312 |
++ } |
5313 |
+ |
5314 |
+ seq_printf(m, "(%d)\n", ttm_bo_evict_mm(&adev->mman.bdev, TTM_PL_TT)); |
5315 |
+ |
5316 |
+@@ -1417,16 +1462,16 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val) |
5317 |
+ return -EINVAL; |
5318 |
+ |
5319 |
+ ret = pm_runtime_get_sync(adev->ddev->dev); |
5320 |
+- if (ret < 0) |
5321 |
++ if (ret < 0) { |
5322 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
5323 |
+ return ret; |
5324 |
++ } |
5325 |
+ |
5326 |
+ if (is_support_sw_smu(adev)) { |
5327 |
+ ret = smu_get_dpm_freq_range(&adev->smu, SMU_SCLK, &min_freq, &max_freq, true); |
5328 |
+ if (ret || val > max_freq || val < min_freq) |
5329 |
+ return -EINVAL; |
5330 |
+ ret = smu_set_soft_freq_range(&adev->smu, SMU_SCLK, (uint32_t)val, (uint32_t)val, true); |
5331 |
+- } else { |
5332 |
+- return 0; |
5333 |
+ } |
5334 |
+ |
5335 |
+ pm_runtime_mark_last_busy(adev->ddev->dev); |
5336 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |
5337 |
+index 43d8ed7dbd00..652c57a3b847 100644 |
5338 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |
5339 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |
5340 |
+@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, |
5341 |
+ attach = dma_buf_dynamic_attach(dma_buf, dev->dev, |
5342 |
+ &amdgpu_dma_buf_attach_ops, obj); |
5343 |
+ if (IS_ERR(attach)) { |
5344 |
+- drm_gem_object_put(obj); |
5345 |
++ drm_gem_object_put_unlocked(obj); |
5346 |
+ return ERR_CAST(attach); |
5347 |
+ } |
5348 |
+ |
5349 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
5350 |
+index d878fe7fee51..3414e119f0cb 100644 |
5351 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
5352 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
5353 |
+@@ -416,7 +416,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, |
5354 |
+ ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + index; |
5355 |
+ } |
5356 |
+ amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq)); |
5357 |
+- amdgpu_irq_get(adev, irq_src, irq_type); |
5358 |
++ |
5359 |
++ if (irq_src) |
5360 |
++ amdgpu_irq_get(adev, irq_src, irq_type); |
5361 |
+ |
5362 |
+ ring->fence_drv.irq_src = irq_src; |
5363 |
+ ring->fence_drv.irq_type = irq_type; |
5364 |
+@@ -537,8 +539,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) |
5365 |
+ /* no need to trigger GPU reset as we are unloading */ |
5366 |
+ amdgpu_fence_driver_force_completion(ring); |
5367 |
+ } |
5368 |
+- amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
5369 |
+- ring->fence_drv.irq_type); |
5370 |
++ if (ring->fence_drv.irq_src) |
5371 |
++ amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
5372 |
++ ring->fence_drv.irq_type); |
5373 |
+ drm_sched_fini(&ring->sched); |
5374 |
+ del_timer_sync(&ring->fence_drv.fallback_timer); |
5375 |
+ for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) |
5376 |
+@@ -574,8 +577,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev) |
5377 |
+ } |
5378 |
+ |
5379 |
+ /* disable the interrupt */ |
5380 |
+- amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
5381 |
+- ring->fence_drv.irq_type); |
5382 |
++ if (ring->fence_drv.irq_src) |
5383 |
++ amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
5384 |
++ ring->fence_drv.irq_type); |
5385 |
+ } |
5386 |
+ } |
5387 |
+ |
5388 |
+@@ -601,8 +605,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev) |
5389 |
+ continue; |
5390 |
+ |
5391 |
+ /* enable the interrupt */ |
5392 |
+- amdgpu_irq_get(adev, ring->fence_drv.irq_src, |
5393 |
+- ring->fence_drv.irq_type); |
5394 |
++ if (ring->fence_drv.irq_src) |
5395 |
++ amdgpu_irq_get(adev, ring->fence_drv.irq_src, |
5396 |
++ ring->fence_drv.irq_type); |
5397 |
+ } |
5398 |
+ } |
5399 |
+ |
5400 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c |
5401 |
+index 713c32560445..25ebf8f19b85 100644 |
5402 |
+--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c |
5403 |
++++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c |
5404 |
+@@ -462,7 +462,7 @@ static int jpeg_v2_5_wait_for_idle(void *handle) |
5405 |
+ return ret; |
5406 |
+ } |
5407 |
+ |
5408 |
+- return ret; |
5409 |
++ return 0; |
5410 |
+ } |
5411 |
+ |
5412 |
+ static int jpeg_v2_5_set_clockgating_state(void *handle, |
5413 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c |
5414 |
+index a2e1a73f66b8..5c6a6ae48d39 100644 |
5415 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c |
5416 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c |
5417 |
+@@ -106,7 +106,7 @@ bool dm_pp_apply_display_requirements( |
5418 |
+ adev->powerplay.pp_funcs->display_configuration_change( |
5419 |
+ adev->powerplay.pp_handle, |
5420 |
+ &adev->pm.pm_display_cfg); |
5421 |
+- else |
5422 |
++ else if (adev->smu.ppt_funcs) |
5423 |
+ smu_display_configuration_change(smu, |
5424 |
+ &adev->pm.pm_display_cfg); |
5425 |
+ |
5426 |
+@@ -530,6 +530,8 @@ bool dm_pp_get_static_clocks( |
5427 |
+ &pp_clk_info); |
5428 |
+ else if (adev->smu.ppt_funcs) |
5429 |
+ ret = smu_get_current_clocks(&adev->smu, &pp_clk_info); |
5430 |
++ else |
5431 |
++ return false; |
5432 |
+ if (ret) |
5433 |
+ return false; |
5434 |
+ |
5435 |
+@@ -590,7 +592,7 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp, |
5436 |
+ if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) |
5437 |
+ pp_funcs->set_watermarks_for_clocks_ranges(pp_handle, |
5438 |
+ &wm_with_clock_ranges); |
5439 |
+- else |
5440 |
++ else if (adev->smu.ppt_funcs) |
5441 |
+ smu_set_watermarks_for_clock_ranges(&adev->smu, |
5442 |
+ &wm_with_clock_ranges); |
5443 |
+ } |
5444 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
5445 |
+index 48ab51533d5d..841cc051b7d0 100644 |
5446 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
5447 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
5448 |
+@@ -3298,9 +3298,11 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx) |
5449 |
+ write_i2c_redriver_setting(pipe_ctx, false); |
5450 |
+ } |
5451 |
+ } |
5452 |
+- dc->hwss.disable_stream(pipe_ctx); |
5453 |
+ |
5454 |
+ disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); |
5455 |
++ |
5456 |
++ dc->hwss.disable_stream(pipe_ctx); |
5457 |
++ |
5458 |
+ if (pipe_ctx->stream->timing.flags.DSC) { |
5459 |
+ if (dc_is_dp_signal(pipe_ctx->stream->signal)) |
5460 |
+ dp_set_dsc_enable(pipe_ctx, false); |
5461 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c |
5462 |
+index aefd29a440b5..be8f265976b0 100644 |
5463 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c |
5464 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c |
5465 |
+@@ -503,7 +503,7 @@ bool dal_ddc_service_query_ddc_data( |
5466 |
+ uint8_t *read_buf, |
5467 |
+ uint32_t read_size) |
5468 |
+ { |
5469 |
+- bool ret = false; |
5470 |
++ bool success = true; |
5471 |
+ uint32_t payload_size = |
5472 |
+ dal_ddc_service_is_in_aux_transaction_mode(ddc) ? |
5473 |
+ DEFAULT_AUX_MAX_DATA_SIZE : EDID_SEGMENT_SIZE; |
5474 |
+@@ -527,7 +527,6 @@ bool dal_ddc_service_query_ddc_data( |
5475 |
+ * but we want to read 256 over i2c!!!!*/ |
5476 |
+ if (dal_ddc_service_is_in_aux_transaction_mode(ddc)) { |
5477 |
+ struct aux_payload payload; |
5478 |
+- bool read_available = true; |
5479 |
+ |
5480 |
+ payload.i2c_over_aux = true; |
5481 |
+ payload.address = address; |
5482 |
+@@ -536,21 +535,26 @@ bool dal_ddc_service_query_ddc_data( |
5483 |
+ |
5484 |
+ if (write_size != 0) { |
5485 |
+ payload.write = true; |
5486 |
+- payload.mot = false; |
5487 |
++ /* should not set mot (middle of transaction) to 0 |
5488 |
++ * if there are pending read payloads |
5489 |
++ */ |
5490 |
++ payload.mot = read_size == 0 ? false : true; |
5491 |
+ payload.length = write_size; |
5492 |
+ payload.data = write_buf; |
5493 |
+ |
5494 |
+- ret = dal_ddc_submit_aux_command(ddc, &payload); |
5495 |
+- read_available = ret; |
5496 |
++ success = dal_ddc_submit_aux_command(ddc, &payload); |
5497 |
+ } |
5498 |
+ |
5499 |
+- if (read_size != 0 && read_available) { |
5500 |
++ if (read_size != 0 && success) { |
5501 |
+ payload.write = false; |
5502 |
++ /* should set mot (middle of transaction) to 0 |
5503 |
++ * since it is the last payload to send |
5504 |
++ */ |
5505 |
+ payload.mot = false; |
5506 |
+ payload.length = read_size; |
5507 |
+ payload.data = read_buf; |
5508 |
+ |
5509 |
+- ret = dal_ddc_submit_aux_command(ddc, &payload); |
5510 |
++ success = dal_ddc_submit_aux_command(ddc, &payload); |
5511 |
+ } |
5512 |
+ } else { |
5513 |
+ struct i2c_command command = {0}; |
5514 |
+@@ -573,7 +577,7 @@ bool dal_ddc_service_query_ddc_data( |
5515 |
+ command.number_of_payloads = |
5516 |
+ dal_ddc_i2c_payloads_get_count(&payloads); |
5517 |
+ |
5518 |
+- ret = dm_helpers_submit_i2c( |
5519 |
++ success = dm_helpers_submit_i2c( |
5520 |
+ ddc->ctx, |
5521 |
+ ddc->link, |
5522 |
+ &command); |
5523 |
+@@ -581,7 +585,7 @@ bool dal_ddc_service_query_ddc_data( |
5524 |
+ dal_ddc_i2c_payloads_destroy(&payloads); |
5525 |
+ } |
5526 |
+ |
5527 |
+- return ret; |
5528 |
++ return success; |
5529 |
+ } |
5530 |
+ |
5531 |
+ bool dal_ddc_submit_aux_command(struct ddc_service *ddc, |
5532 |
+@@ -598,7 +602,7 @@ bool dal_ddc_submit_aux_command(struct ddc_service *ddc, |
5533 |
+ |
5534 |
+ do { |
5535 |
+ struct aux_payload current_payload; |
5536 |
+- bool is_end_of_payload = (retrieved + DEFAULT_AUX_MAX_DATA_SIZE) > |
5537 |
++ bool is_end_of_payload = (retrieved + DEFAULT_AUX_MAX_DATA_SIZE) >= |
5538 |
+ payload->length; |
5539 |
+ |
5540 |
+ current_payload.address = payload->address; |
5541 |
+@@ -607,7 +611,10 @@ bool dal_ddc_submit_aux_command(struct ddc_service *ddc, |
5542 |
+ current_payload.i2c_over_aux = payload->i2c_over_aux; |
5543 |
+ current_payload.length = is_end_of_payload ? |
5544 |
+ payload->length - retrieved : DEFAULT_AUX_MAX_DATA_SIZE; |
5545 |
+- current_payload.mot = !is_end_of_payload; |
5546 |
++ /* set mot (middle of transaction) to false |
5547 |
++ * if it is the last payload |
5548 |
++ */ |
5549 |
++ current_payload.mot = is_end_of_payload ? payload->mot:true; |
5550 |
+ current_payload.reply = payload->reply; |
5551 |
+ current_payload.write = payload->write; |
5552 |
+ |
5553 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
5554 |
+index 91cd884d6f25..6124af571bff 100644 |
5555 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
5556 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
5557 |
+@@ -1102,6 +1102,10 @@ static inline enum link_training_result perform_link_training_int( |
5558 |
+ dpcd_pattern.v1_4.TRAINING_PATTERN_SET = DPCD_TRAINING_PATTERN_VIDEOIDLE; |
5559 |
+ dpcd_set_training_pattern(link, dpcd_pattern); |
5560 |
+ |
5561 |
++ /* delay 5ms after notifying sink of idle pattern before switching output */ |
5562 |
++ if (link->connector_signal != SIGNAL_TYPE_EDP) |
5563 |
++ msleep(5); |
5564 |
++ |
5565 |
+ /* 4. mainlink output idle pattern*/ |
5566 |
+ dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); |
5567 |
+ |
5568 |
+@@ -1551,6 +1555,12 @@ bool perform_link_training_with_retries( |
5569 |
+ struct dc_link *link = stream->link; |
5570 |
+ enum dp_panel_mode panel_mode = dp_get_panel_mode(link); |
5571 |
+ |
5572 |
++ /* We need to do this before the link training to ensure the idle pattern in SST |
5573 |
++ * mode will be sent right after the link training |
5574 |
++ */ |
5575 |
++ link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, |
5576 |
++ pipe_ctx->stream_res.stream_enc->id, true); |
5577 |
++ |
5578 |
+ for (j = 0; j < attempts; ++j) { |
5579 |
+ |
5580 |
+ dp_enable_link_phy( |
5581 |
+@@ -1567,12 +1577,6 @@ bool perform_link_training_with_retries( |
5582 |
+ |
5583 |
+ dp_set_panel_mode(link, panel_mode); |
5584 |
+ |
5585 |
+- /* We need to do this before the link training to ensure the idle pattern in SST |
5586 |
+- * mode will be sent right after the link training |
5587 |
+- */ |
5588 |
+- link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, |
5589 |
+- pipe_ctx->stream_res.stream_enc->id, true); |
5590 |
+- |
5591 |
+ if (link->aux_access_disabled) { |
5592 |
+ dc_link_dp_perform_link_training_skip_aux(link, link_setting); |
5593 |
+ return true; |
5594 |
+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 |
5595 |
+index b77e9dc16086..2af1d74d16ad 100644 |
5596 |
+--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
5597 |
++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |
5598 |
+@@ -1069,8 +1069,17 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx) |
5599 |
+ link->dc->hwss.set_abm_immediate_disable(pipe_ctx); |
5600 |
+ } |
5601 |
+ |
5602 |
+- if (dc_is_dp_signal(pipe_ctx->stream->signal)) |
5603 |
++ if (dc_is_dp_signal(pipe_ctx->stream->signal)) { |
5604 |
+ pipe_ctx->stream_res.stream_enc->funcs->dp_blank(pipe_ctx->stream_res.stream_enc); |
5605 |
++ |
5606 |
++ /* |
5607 |
++ * After output is idle pattern some sinks need time to recognize the stream |
5608 |
++ * has changed or they enter protection state and hang. |
5609 |
++ */ |
5610 |
++ if (!dc_is_embedded_signal(pipe_ctx->stream->signal)) |
5611 |
++ msleep(60); |
5612 |
++ } |
5613 |
++ |
5614 |
+ } |
5615 |
+ |
5616 |
+ |
5617 |
+diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |
5618 |
+index 27c5fc9572b2..e4630a76d7bf 100644 |
5619 |
+--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |
5620 |
++++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c |
5621 |
+@@ -2042,8 +2042,6 @@ static void arcturus_fill_eeprom_i2c_req(SwI2cRequest_t *req, bool write, |
5622 |
+ { |
5623 |
+ int i; |
5624 |
+ |
5625 |
+- BUG_ON(numbytes > MAX_SW_I2C_COMMANDS); |
5626 |
+- |
5627 |
+ req->I2CcontrollerPort = 0; |
5628 |
+ req->I2CSpeed = 2; |
5629 |
+ req->SlaveAddress = address; |
5630 |
+@@ -2081,6 +2079,12 @@ static int arcturus_i2c_eeprom_read_data(struct i2c_adapter *control, |
5631 |
+ struct smu_table_context *smu_table = &adev->smu.smu_table; |
5632 |
+ struct smu_table *table = &smu_table->driver_table; |
5633 |
+ |
5634 |
++ if (numbytes > MAX_SW_I2C_COMMANDS) { |
5635 |
++ dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", |
5636 |
++ numbytes, MAX_SW_I2C_COMMANDS); |
5637 |
++ return -EINVAL; |
5638 |
++ } |
5639 |
++ |
5640 |
+ memset(&req, 0, sizeof(req)); |
5641 |
+ arcturus_fill_eeprom_i2c_req(&req, false, address, numbytes, data); |
5642 |
+ |
5643 |
+@@ -2117,6 +2121,12 @@ static int arcturus_i2c_eeprom_write_data(struct i2c_adapter *control, |
5644 |
+ SwI2cRequest_t req; |
5645 |
+ struct amdgpu_device *adev = to_amdgpu_device(control); |
5646 |
+ |
5647 |
++ if (numbytes > MAX_SW_I2C_COMMANDS) { |
5648 |
++ dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", |
5649 |
++ numbytes, MAX_SW_I2C_COMMANDS); |
5650 |
++ return -EINVAL; |
5651 |
++ } |
5652 |
++ |
5653 |
+ memset(&req, 0, sizeof(req)); |
5654 |
+ arcturus_fill_eeprom_i2c_req(&req, true, address, numbytes, data); |
5655 |
+ |
5656 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c |
5657 |
+index aa76c2cea747..7897be877b96 100644 |
5658 |
+--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c |
5659 |
++++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c |
5660 |
+@@ -164,7 +164,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu) |
5661 |
+ chip_name = "navi12"; |
5662 |
+ break; |
5663 |
+ default: |
5664 |
+- BUG(); |
5665 |
++ dev_err(adev->dev, "Unsupported ASIC type %d\n", adev->asic_type); |
5666 |
++ return -EINVAL; |
5667 |
+ } |
5668 |
+ |
5669 |
+ snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name); |
5670 |
+diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c |
5671 |
+index 37715cc6064e..ab45ac445045 100644 |
5672 |
+--- a/drivers/gpu/drm/arm/malidp_planes.c |
5673 |
++++ b/drivers/gpu/drm/arm/malidp_planes.c |
5674 |
+@@ -928,7 +928,7 @@ int malidp_de_planes_init(struct drm_device *drm) |
5675 |
+ const struct malidp_hw_regmap *map = &malidp->dev->hw->map; |
5676 |
+ struct malidp_plane *plane = NULL; |
5677 |
+ enum drm_plane_type plane_type; |
5678 |
+- unsigned long crtcs = 1 << drm->mode_config.num_crtc; |
5679 |
++ unsigned long crtcs = BIT(drm->mode_config.num_crtc); |
5680 |
+ unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | |
5681 |
+ DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; |
5682 |
+ unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | |
5683 |
+diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c |
5684 |
+index 92acd336aa89..ca98133411aa 100644 |
5685 |
+--- a/drivers/gpu/drm/bridge/sil-sii8620.c |
5686 |
++++ b/drivers/gpu/drm/bridge/sil-sii8620.c |
5687 |
+@@ -178,7 +178,7 @@ static void sii8620_read_buf(struct sii8620 *ctx, u16 addr, u8 *buf, int len) |
5688 |
+ |
5689 |
+ static u8 sii8620_readb(struct sii8620 *ctx, u16 addr) |
5690 |
+ { |
5691 |
+- u8 ret; |
5692 |
++ u8 ret = 0; |
5693 |
+ |
5694 |
+ sii8620_read_buf(ctx, addr, &ret, 1); |
5695 |
+ return ret; |
5696 |
+diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
5697 |
+index 6ad688b320ae..8a0e34f2160a 100644 |
5698 |
+--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
5699 |
++++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c |
5700 |
+@@ -475,7 +475,7 @@ static int ti_sn_bridge_calc_min_dp_rate_idx(struct ti_sn_bridge *pdata) |
5701 |
+ 1000 * pdata->dp_lanes * DP_CLK_FUDGE_DEN); |
5702 |
+ |
5703 |
+ for (i = 1; i < ARRAY_SIZE(ti_sn_bridge_dp_rate_lut) - 1; i++) |
5704 |
+- if (ti_sn_bridge_dp_rate_lut[i] > dp_rate_mhz) |
5705 |
++ if (ti_sn_bridge_dp_rate_lut[i] >= dp_rate_mhz) |
5706 |
+ break; |
5707 |
+ |
5708 |
+ return i; |
5709 |
+@@ -827,6 +827,12 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, |
5710 |
+ buf[i]); |
5711 |
+ } |
5712 |
+ |
5713 |
++ /* Clear old status bits before start so we don't get confused */ |
5714 |
++ regmap_write(pdata->regmap, SN_AUX_CMD_STATUS_REG, |
5715 |
++ AUX_IRQ_STATUS_NAT_I2C_FAIL | |
5716 |
++ AUX_IRQ_STATUS_AUX_RPLY_TOUT | |
5717 |
++ AUX_IRQ_STATUS_AUX_SHORT); |
5718 |
++ |
5719 |
+ regmap_write(pdata->regmap, SN_AUX_CMD_REG, request_val | AUX_CMD_SEND); |
5720 |
+ |
5721 |
+ ret = regmap_read_poll_timeout(pdata->regmap, SN_AUX_CMD_REG, val, |
5722 |
+diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c |
5723 |
+index 2bea22130703..bfe4602f206b 100644 |
5724 |
+--- a/drivers/gpu/drm/drm_debugfs.c |
5725 |
++++ b/drivers/gpu/drm/drm_debugfs.c |
5726 |
+@@ -311,13 +311,13 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf, |
5727 |
+ |
5728 |
+ buf[len] = '\0'; |
5729 |
+ |
5730 |
+- if (!strcmp(buf, "on")) |
5731 |
++ if (sysfs_streq(buf, "on")) |
5732 |
+ connector->force = DRM_FORCE_ON; |
5733 |
+- else if (!strcmp(buf, "digital")) |
5734 |
++ else if (sysfs_streq(buf, "digital")) |
5735 |
+ connector->force = DRM_FORCE_ON_DIGITAL; |
5736 |
+- else if (!strcmp(buf, "off")) |
5737 |
++ else if (sysfs_streq(buf, "off")) |
5738 |
+ connector->force = DRM_FORCE_OFF; |
5739 |
+- else if (!strcmp(buf, "unspecified")) |
5740 |
++ else if (sysfs_streq(buf, "unspecified")) |
5741 |
+ connector->force = DRM_FORCE_UNSPECIFIED; |
5742 |
+ else |
5743 |
+ return -EINVAL; |
5744 |
+diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c |
5745 |
+index ee2058ad482c..d22480ebb29e 100644 |
5746 |
+--- a/drivers/gpu/drm/drm_gem.c |
5747 |
++++ b/drivers/gpu/drm/drm_gem.c |
5748 |
+@@ -709,6 +709,8 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles, |
5749 |
+ if (!objs) |
5750 |
+ return -ENOMEM; |
5751 |
+ |
5752 |
++ *objs_out = objs; |
5753 |
++ |
5754 |
+ handles = kvmalloc_array(count, sizeof(u32), GFP_KERNEL); |
5755 |
+ if (!handles) { |
5756 |
+ ret = -ENOMEM; |
5757 |
+@@ -722,8 +724,6 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles, |
5758 |
+ } |
5759 |
+ |
5760 |
+ ret = objects_lookup(filp, handles, count, objs); |
5761 |
+- *objs_out = objs; |
5762 |
+- |
5763 |
+ out: |
5764 |
+ kvfree(handles); |
5765 |
+ return ret; |
5766 |
+diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c |
5767 |
+index 55531895dde6..37b03fefbdf6 100644 |
5768 |
+--- a/drivers/gpu/drm/drm_mipi_dsi.c |
5769 |
++++ b/drivers/gpu/drm/drm_mipi_dsi.c |
5770 |
+@@ -1082,11 +1082,11 @@ EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format); |
5771 |
+ */ |
5772 |
+ int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline) |
5773 |
+ { |
5774 |
+- u8 payload[3] = { MIPI_DCS_SET_TEAR_SCANLINE, scanline >> 8, |
5775 |
+- scanline & 0xff }; |
5776 |
++ u8 payload[2] = { scanline >> 8, scanline & 0xff }; |
5777 |
+ ssize_t err; |
5778 |
+ |
5779 |
+- err = mipi_dsi_generic_write(dsi, payload, sizeof(payload)); |
5780 |
++ err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_SCANLINE, payload, |
5781 |
++ sizeof(payload)); |
5782 |
+ if (err < 0) |
5783 |
+ return err; |
5784 |
+ |
5785 |
+diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c |
5786 |
+index f4ca1ff80af9..60e9a9c91e9d 100644 |
5787 |
+--- a/drivers/gpu/drm/drm_mm.c |
5788 |
++++ b/drivers/gpu/drm/drm_mm.c |
5789 |
+@@ -407,7 +407,7 @@ next_hole_high_addr(struct drm_mm_node *entry, u64 size) |
5790 |
+ left_node = rb_entry(left_rb_node, |
5791 |
+ struct drm_mm_node, rb_hole_addr); |
5792 |
+ if ((left_node->subtree_max_hole < size || |
5793 |
+- entry->size == entry->subtree_max_hole) && |
5794 |
++ HOLE_SIZE(entry) == entry->subtree_max_hole) && |
5795 |
+ parent_rb_node && parent_rb_node->rb_left != rb_node) |
5796 |
+ return rb_hole_addr_to_node(parent_rb_node); |
5797 |
+ } |
5798 |
+@@ -447,7 +447,7 @@ next_hole_low_addr(struct drm_mm_node *entry, u64 size) |
5799 |
+ right_node = rb_entry(right_rb_node, |
5800 |
+ struct drm_mm_node, rb_hole_addr); |
5801 |
+ if ((right_node->subtree_max_hole < size || |
5802 |
+- entry->size == entry->subtree_max_hole) && |
5803 |
++ HOLE_SIZE(entry) == entry->subtree_max_hole) && |
5804 |
+ parent_rb_node && parent_rb_node->rb_right != rb_node) |
5805 |
+ return rb_hole_addr_to_node(parent_rb_node); |
5806 |
+ } |
5807 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
5808 |
+index a31eeff2b297..4a512b062df8 100644 |
5809 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
5810 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
5811 |
+@@ -722,7 +722,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
5812 |
+ ret = pm_runtime_get_sync(gpu->dev); |
5813 |
+ if (ret < 0) { |
5814 |
+ dev_err(gpu->dev, "Failed to enable GPU power domain\n"); |
5815 |
+- return ret; |
5816 |
++ goto pm_put; |
5817 |
+ } |
5818 |
+ |
5819 |
+ etnaviv_hw_identify(gpu); |
5820 |
+@@ -819,6 +819,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) |
5821 |
+ |
5822 |
+ fail: |
5823 |
+ pm_runtime_mark_last_busy(gpu->dev); |
5824 |
++pm_put: |
5825 |
+ pm_runtime_put_autosuspend(gpu->dev); |
5826 |
+ |
5827 |
+ return ret; |
5828 |
+@@ -859,7 +860,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m) |
5829 |
+ |
5830 |
+ ret = pm_runtime_get_sync(gpu->dev); |
5831 |
+ if (ret < 0) |
5832 |
+- return ret; |
5833 |
++ goto pm_put; |
5834 |
+ |
5835 |
+ dma_lo = gpu_read(gpu, VIVS_FE_DMA_LOW); |
5836 |
+ dma_hi = gpu_read(gpu, VIVS_FE_DMA_HIGH); |
5837 |
+@@ -1003,6 +1004,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m) |
5838 |
+ ret = 0; |
5839 |
+ |
5840 |
+ pm_runtime_mark_last_busy(gpu->dev); |
5841 |
++pm_put: |
5842 |
+ pm_runtime_put_autosuspend(gpu->dev); |
5843 |
+ |
5844 |
+ return ret; |
5845 |
+@@ -1016,7 +1018,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) |
5846 |
+ dev_err(gpu->dev, "recover hung GPU!\n"); |
5847 |
+ |
5848 |
+ if (pm_runtime_get_sync(gpu->dev) < 0) |
5849 |
+- return; |
5850 |
++ goto pm_put; |
5851 |
+ |
5852 |
+ mutex_lock(&gpu->lock); |
5853 |
+ |
5854 |
+@@ -1035,6 +1037,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) |
5855 |
+ |
5856 |
+ mutex_unlock(&gpu->lock); |
5857 |
+ pm_runtime_mark_last_busy(gpu->dev); |
5858 |
++pm_put: |
5859 |
+ pm_runtime_put_autosuspend(gpu->dev); |
5860 |
+ } |
5861 |
+ |
5862 |
+@@ -1308,8 +1311,10 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) |
5863 |
+ |
5864 |
+ if (!submit->runtime_resumed) { |
5865 |
+ ret = pm_runtime_get_sync(gpu->dev); |
5866 |
+- if (ret < 0) |
5867 |
++ if (ret < 0) { |
5868 |
++ pm_runtime_put_noidle(gpu->dev); |
5869 |
+ return NULL; |
5870 |
++ } |
5871 |
+ submit->runtime_resumed = true; |
5872 |
+ } |
5873 |
+ |
5874 |
+@@ -1326,6 +1331,7 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) |
5875 |
+ ret = event_alloc(gpu, nr_events, event); |
5876 |
+ if (ret) { |
5877 |
+ DRM_ERROR("no free events\n"); |
5878 |
++ pm_runtime_put_noidle(gpu->dev); |
5879 |
+ return NULL; |
5880 |
+ } |
5881 |
+ |
5882 |
+@@ -1496,7 +1502,7 @@ static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu) |
5883 |
+ if (gpu->clk_bus) { |
5884 |
+ ret = clk_prepare_enable(gpu->clk_bus); |
5885 |
+ if (ret) |
5886 |
+- return ret; |
5887 |
++ goto disable_clk_reg; |
5888 |
+ } |
5889 |
+ |
5890 |
+ if (gpu->clk_core) { |
5891 |
+@@ -1519,6 +1525,9 @@ disable_clk_core: |
5892 |
+ disable_clk_bus: |
5893 |
+ if (gpu->clk_bus) |
5894 |
+ clk_disable_unprepare(gpu->clk_bus); |
5895 |
++disable_clk_reg: |
5896 |
++ if (gpu->clk_reg) |
5897 |
++ clk_disable_unprepare(gpu->clk_reg); |
5898 |
+ |
5899 |
+ return ret; |
5900 |
+ } |
5901 |
+diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c |
5902 |
+index ba4ca17fd4d8..87869b9997a6 100644 |
5903 |
+--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c |
5904 |
++++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c |
5905 |
+@@ -209,9 +209,8 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, |
5906 |
+ if (!pdev->dev.of_node) |
5907 |
+ return -ENODEV; |
5908 |
+ |
5909 |
+- hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); |
5910 |
+- if (!hdmi) |
5911 |
+- return -ENOMEM; |
5912 |
++ hdmi = dev_get_drvdata(dev); |
5913 |
++ memset(hdmi, 0, sizeof(*hdmi)); |
5914 |
+ |
5915 |
+ match = of_match_node(dw_hdmi_imx_dt_ids, pdev->dev.of_node); |
5916 |
+ plat_data = match->data; |
5917 |
+@@ -235,8 +234,6 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, |
5918 |
+ drm_encoder_helper_add(encoder, &dw_hdmi_imx_encoder_helper_funcs); |
5919 |
+ drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); |
5920 |
+ |
5921 |
+- platform_set_drvdata(pdev, hdmi); |
5922 |
+- |
5923 |
+ hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); |
5924 |
+ |
5925 |
+ /* |
5926 |
+@@ -266,6 +263,14 @@ static const struct component_ops dw_hdmi_imx_ops = { |
5927 |
+ |
5928 |
+ static int dw_hdmi_imx_probe(struct platform_device *pdev) |
5929 |
+ { |
5930 |
++ struct imx_hdmi *hdmi; |
5931 |
++ |
5932 |
++ hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); |
5933 |
++ if (!hdmi) |
5934 |
++ return -ENOMEM; |
5935 |
++ |
5936 |
++ platform_set_drvdata(pdev, hdmi); |
5937 |
++ |
5938 |
+ return component_add(&pdev->dev, &dw_hdmi_imx_ops); |
5939 |
+ } |
5940 |
+ |
5941 |
+diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c |
5942 |
+index 2e38f1a5cf8d..3421043a558d 100644 |
5943 |
+--- a/drivers/gpu/drm/imx/imx-drm-core.c |
5944 |
++++ b/drivers/gpu/drm/imx/imx-drm-core.c |
5945 |
+@@ -275,9 +275,10 @@ static void imx_drm_unbind(struct device *dev) |
5946 |
+ |
5947 |
+ drm_kms_helper_poll_fini(drm); |
5948 |
+ |
5949 |
++ component_unbind_all(drm->dev, drm); |
5950 |
++ |
5951 |
+ drm_mode_config_cleanup(drm); |
5952 |
+ |
5953 |
+- component_unbind_all(drm->dev, drm); |
5954 |
+ dev_set_drvdata(dev, NULL); |
5955 |
+ |
5956 |
+ drm_dev_put(drm); |
5957 |
+diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c |
5958 |
+index 66ea68e8da87..1823af9936c9 100644 |
5959 |
+--- a/drivers/gpu/drm/imx/imx-ldb.c |
5960 |
++++ b/drivers/gpu/drm/imx/imx-ldb.c |
5961 |
+@@ -590,9 +590,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) |
5962 |
+ int ret; |
5963 |
+ int i; |
5964 |
+ |
5965 |
+- imx_ldb = devm_kzalloc(dev, sizeof(*imx_ldb), GFP_KERNEL); |
5966 |
+- if (!imx_ldb) |
5967 |
+- return -ENOMEM; |
5968 |
++ imx_ldb = dev_get_drvdata(dev); |
5969 |
++ memset(imx_ldb, 0, sizeof(*imx_ldb)); |
5970 |
+ |
5971 |
+ imx_ldb->regmap = syscon_regmap_lookup_by_phandle(np, "gpr"); |
5972 |
+ if (IS_ERR(imx_ldb->regmap)) { |
5973 |
+@@ -700,8 +699,6 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) |
5974 |
+ } |
5975 |
+ } |
5976 |
+ |
5977 |
+- dev_set_drvdata(dev, imx_ldb); |
5978 |
+- |
5979 |
+ return 0; |
5980 |
+ |
5981 |
+ free_child: |
5982 |
+@@ -733,6 +730,14 @@ static const struct component_ops imx_ldb_ops = { |
5983 |
+ |
5984 |
+ static int imx_ldb_probe(struct platform_device *pdev) |
5985 |
+ { |
5986 |
++ struct imx_ldb *imx_ldb; |
5987 |
++ |
5988 |
++ imx_ldb = devm_kzalloc(&pdev->dev, sizeof(*imx_ldb), GFP_KERNEL); |
5989 |
++ if (!imx_ldb) |
5990 |
++ return -ENOMEM; |
5991 |
++ |
5992 |
++ platform_set_drvdata(pdev, imx_ldb); |
5993 |
++ |
5994 |
+ return component_add(&pdev->dev, &imx_ldb_ops); |
5995 |
+ } |
5996 |
+ |
5997 |
+diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c |
5998 |
+index ee63782c77e9..3758de3e09bd 100644 |
5999 |
+--- a/drivers/gpu/drm/imx/imx-tve.c |
6000 |
++++ b/drivers/gpu/drm/imx/imx-tve.c |
6001 |
+@@ -490,6 +490,13 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve) |
6002 |
+ return 0; |
6003 |
+ } |
6004 |
+ |
6005 |
++static void imx_tve_disable_regulator(void *data) |
6006 |
++{ |
6007 |
++ struct imx_tve *tve = data; |
6008 |
++ |
6009 |
++ regulator_disable(tve->dac_reg); |
6010 |
++} |
6011 |
++ |
6012 |
+ static bool imx_tve_readable_reg(struct device *dev, unsigned int reg) |
6013 |
+ { |
6014 |
+ return (reg % 4 == 0) && (reg <= 0xdc); |
6015 |
+@@ -542,9 +549,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
6016 |
+ int irq; |
6017 |
+ int ret; |
6018 |
+ |
6019 |
+- tve = devm_kzalloc(dev, sizeof(*tve), GFP_KERNEL); |
6020 |
+- if (!tve) |
6021 |
+- return -ENOMEM; |
6022 |
++ tve = dev_get_drvdata(dev); |
6023 |
++ memset(tve, 0, sizeof(*tve)); |
6024 |
+ |
6025 |
+ tve->dev = dev; |
6026 |
+ spin_lock_init(&tve->lock); |
6027 |
+@@ -614,6 +620,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
6028 |
+ ret = regulator_enable(tve->dac_reg); |
6029 |
+ if (ret) |
6030 |
+ return ret; |
6031 |
++ ret = devm_add_action_or_reset(dev, imx_tve_disable_regulator, tve); |
6032 |
++ if (ret) |
6033 |
++ return ret; |
6034 |
+ } |
6035 |
+ |
6036 |
+ tve->clk = devm_clk_get(dev, "tve"); |
6037 |
+@@ -655,27 +664,23 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
6038 |
+ if (ret) |
6039 |
+ return ret; |
6040 |
+ |
6041 |
+- dev_set_drvdata(dev, tve); |
6042 |
+- |
6043 |
+ return 0; |
6044 |
+ } |
6045 |
+ |
6046 |
+-static void imx_tve_unbind(struct device *dev, struct device *master, |
6047 |
+- void *data) |
6048 |
+-{ |
6049 |
+- struct imx_tve *tve = dev_get_drvdata(dev); |
6050 |
+- |
6051 |
+- if (!IS_ERR(tve->dac_reg)) |
6052 |
+- regulator_disable(tve->dac_reg); |
6053 |
+-} |
6054 |
+- |
6055 |
+ static const struct component_ops imx_tve_ops = { |
6056 |
+ .bind = imx_tve_bind, |
6057 |
+- .unbind = imx_tve_unbind, |
6058 |
+ }; |
6059 |
+ |
6060 |
+ static int imx_tve_probe(struct platform_device *pdev) |
6061 |
+ { |
6062 |
++ struct imx_tve *tve; |
6063 |
++ |
6064 |
++ tve = devm_kzalloc(&pdev->dev, sizeof(*tve), GFP_KERNEL); |
6065 |
++ if (!tve) |
6066 |
++ return -ENOMEM; |
6067 |
++ |
6068 |
++ platform_set_drvdata(pdev, tve); |
6069 |
++ |
6070 |
+ return component_add(&pdev->dev, &imx_tve_ops); |
6071 |
+ } |
6072 |
+ |
6073 |
+diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c |
6074 |
+index 63c0284f8b3c..2256c9789fc2 100644 |
6075 |
+--- a/drivers/gpu/drm/imx/ipuv3-crtc.c |
6076 |
++++ b/drivers/gpu/drm/imx/ipuv3-crtc.c |
6077 |
+@@ -438,21 +438,13 @@ static int ipu_drm_bind(struct device *dev, struct device *master, void *data) |
6078 |
+ struct ipu_client_platformdata *pdata = dev->platform_data; |
6079 |
+ struct drm_device *drm = data; |
6080 |
+ struct ipu_crtc *ipu_crtc; |
6081 |
+- int ret; |
6082 |
+ |
6083 |
+- ipu_crtc = devm_kzalloc(dev, sizeof(*ipu_crtc), GFP_KERNEL); |
6084 |
+- if (!ipu_crtc) |
6085 |
+- return -ENOMEM; |
6086 |
++ ipu_crtc = dev_get_drvdata(dev); |
6087 |
++ memset(ipu_crtc, 0, sizeof(*ipu_crtc)); |
6088 |
+ |
6089 |
+ ipu_crtc->dev = dev; |
6090 |
+ |
6091 |
+- ret = ipu_crtc_init(ipu_crtc, pdata, drm); |
6092 |
+- if (ret) |
6093 |
+- return ret; |
6094 |
+- |
6095 |
+- dev_set_drvdata(dev, ipu_crtc); |
6096 |
+- |
6097 |
+- return 0; |
6098 |
++ return ipu_crtc_init(ipu_crtc, pdata, drm); |
6099 |
+ } |
6100 |
+ |
6101 |
+ static void ipu_drm_unbind(struct device *dev, struct device *master, |
6102 |
+@@ -474,6 +466,7 @@ static const struct component_ops ipu_crtc_ops = { |
6103 |
+ static int ipu_drm_probe(struct platform_device *pdev) |
6104 |
+ { |
6105 |
+ struct device *dev = &pdev->dev; |
6106 |
++ struct ipu_crtc *ipu_crtc; |
6107 |
+ int ret; |
6108 |
+ |
6109 |
+ if (!dev->platform_data) |
6110 |
+@@ -483,6 +476,12 @@ static int ipu_drm_probe(struct platform_device *pdev) |
6111 |
+ if (ret) |
6112 |
+ return ret; |
6113 |
+ |
6114 |
++ ipu_crtc = devm_kzalloc(dev, sizeof(*ipu_crtc), GFP_KERNEL); |
6115 |
++ if (!ipu_crtc) |
6116 |
++ return -ENOMEM; |
6117 |
++ |
6118 |
++ dev_set_drvdata(dev, ipu_crtc); |
6119 |
++ |
6120 |
+ return component_add(dev, &ipu_crtc_ops); |
6121 |
+ } |
6122 |
+ |
6123 |
+diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c |
6124 |
+index ac916c84a631..622eabe9efb3 100644 |
6125 |
+--- a/drivers/gpu/drm/imx/parallel-display.c |
6126 |
++++ b/drivers/gpu/drm/imx/parallel-display.c |
6127 |
+@@ -326,9 +326,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) |
6128 |
+ u32 bus_format = 0; |
6129 |
+ const char *fmt; |
6130 |
+ |
6131 |
+- imxpd = devm_kzalloc(dev, sizeof(*imxpd), GFP_KERNEL); |
6132 |
+- if (!imxpd) |
6133 |
+- return -ENOMEM; |
6134 |
++ imxpd = dev_get_drvdata(dev); |
6135 |
++ memset(imxpd, 0, sizeof(*imxpd)); |
6136 |
+ |
6137 |
+ edidp = of_get_property(np, "edid", &imxpd->edid_len); |
6138 |
+ if (edidp) |
6139 |
+@@ -359,8 +358,6 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) |
6140 |
+ if (ret) |
6141 |
+ return ret; |
6142 |
+ |
6143 |
+- dev_set_drvdata(dev, imxpd); |
6144 |
+- |
6145 |
+ return 0; |
6146 |
+ } |
6147 |
+ |
6148 |
+@@ -382,6 +379,14 @@ static const struct component_ops imx_pd_ops = { |
6149 |
+ |
6150 |
+ static int imx_pd_probe(struct platform_device *pdev) |
6151 |
+ { |
6152 |
++ struct imx_parallel_display *imxpd; |
6153 |
++ |
6154 |
++ imxpd = devm_kzalloc(&pdev->dev, sizeof(*imxpd), GFP_KERNEL); |
6155 |
++ if (!imxpd) |
6156 |
++ return -ENOMEM; |
6157 |
++ |
6158 |
++ platform_set_drvdata(pdev, imxpd); |
6159 |
++ |
6160 |
+ return component_add(&pdev->dev, &imx_pd_ops); |
6161 |
+ } |
6162 |
+ |
6163 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6164 |
+index 21e77d67151f..1d330204c465 100644 |
6165 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6166 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6167 |
+@@ -854,10 +854,19 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) |
6168 |
+ /* Turn on the resources */ |
6169 |
+ pm_runtime_get_sync(gmu->dev); |
6170 |
+ |
6171 |
++ /* |
6172 |
++ * "enable" the GX power domain which won't actually do anything but it |
6173 |
++ * will make sure that the refcounting is correct in case we need to |
6174 |
++ * bring down the GX after a GMU failure |
6175 |
++ */ |
6176 |
++ if (!IS_ERR_OR_NULL(gmu->gxpd)) |
6177 |
++ pm_runtime_get_sync(gmu->gxpd); |
6178 |
++ |
6179 |
+ /* Use a known rate to bring up the GMU */ |
6180 |
+ clk_set_rate(gmu->core_clk, 200000000); |
6181 |
+ ret = clk_bulk_prepare_enable(gmu->nr_clocks, gmu->clocks); |
6182 |
+ if (ret) { |
6183 |
++ pm_runtime_put(gmu->gxpd); |
6184 |
+ pm_runtime_put(gmu->dev); |
6185 |
+ return ret; |
6186 |
+ } |
6187 |
+@@ -903,19 +912,12 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) |
6188 |
+ else |
6189 |
+ a6xx_hfi_set_freq(gmu, gmu->current_perf_index); |
6190 |
+ |
6191 |
+- /* |
6192 |
+- * "enable" the GX power domain which won't actually do anything but it |
6193 |
+- * will make sure that the refcounting is correct in case we need to |
6194 |
+- * bring down the GX after a GMU failure |
6195 |
+- */ |
6196 |
+- if (!IS_ERR_OR_NULL(gmu->gxpd)) |
6197 |
+- pm_runtime_get(gmu->gxpd); |
6198 |
+- |
6199 |
+ out: |
6200 |
+ /* On failure, shut down the GMU to leave it in a good state */ |
6201 |
+ if (ret) { |
6202 |
+ disable_irq(gmu->gmu_irq); |
6203 |
+ a6xx_rpmh_stop(gmu); |
6204 |
++ pm_runtime_put(gmu->gxpd); |
6205 |
+ pm_runtime_put(gmu->dev); |
6206 |
+ } |
6207 |
+ |
6208 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
6209 |
+index e15b42a780e0..969d95aa873c 100644 |
6210 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
6211 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |
6212 |
+@@ -389,7 +389,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event) |
6213 |
+ spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags); |
6214 |
+ |
6215 |
+ if (!fevent) { |
6216 |
+- DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event); |
6217 |
++ DRM_ERROR_RATELIMITED("crtc%d event %d overflow\n", crtc->base.id, event); |
6218 |
+ return; |
6219 |
+ } |
6220 |
+ |
6221 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |
6222 |
+index 29d4fde3172b..8ef2f62e4111 100644 |
6223 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |
6224 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |
6225 |
+@@ -43,6 +43,10 @@ |
6226 |
+ |
6227 |
+ #define DSPP_SC7180_MASK BIT(DPU_DSPP_PCC) |
6228 |
+ |
6229 |
++#define INTF_SDM845_MASK (0) |
6230 |
++ |
6231 |
++#define INTF_SC7180_MASK BIT(DPU_INTF_INPUT_CTRL) | BIT(DPU_INTF_TE) |
6232 |
++ |
6233 |
+ #define DEFAULT_PIXEL_RAM_SIZE (50 * 1024) |
6234 |
+ #define DEFAULT_DPU_LINE_WIDTH 2048 |
6235 |
+ #define DEFAULT_DPU_OUTPUT_LINE_WIDTH 2560 |
6236 |
+@@ -400,26 +404,26 @@ static struct dpu_pingpong_cfg sc7180_pp[] = { |
6237 |
+ /************************************************************* |
6238 |
+ * INTF sub blocks config |
6239 |
+ *************************************************************/ |
6240 |
+-#define INTF_BLK(_name, _id, _base, _type, _ctrl_id) \ |
6241 |
++#define INTF_BLK(_name, _id, _base, _type, _ctrl_id, _features) \ |
6242 |
+ {\ |
6243 |
+ .name = _name, .id = _id, \ |
6244 |
+ .base = _base, .len = 0x280, \ |
6245 |
+- .features = BIT(DPU_CTL_ACTIVE_CFG), \ |
6246 |
++ .features = _features, \ |
6247 |
+ .type = _type, \ |
6248 |
+ .controller_id = _ctrl_id, \ |
6249 |
+ .prog_fetch_lines_worst_case = 24 \ |
6250 |
+ } |
6251 |
+ |
6252 |
+ static const struct dpu_intf_cfg sdm845_intf[] = { |
6253 |
+- INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0), |
6254 |
+- INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0), |
6255 |
+- INTF_BLK("intf_2", INTF_2, 0x6B000, INTF_DSI, 1), |
6256 |
+- INTF_BLK("intf_3", INTF_3, 0x6B800, INTF_DP, 1), |
6257 |
++ INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, INTF_SDM845_MASK), |
6258 |
++ INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, INTF_SDM845_MASK), |
6259 |
++ INTF_BLK("intf_2", INTF_2, 0x6B000, INTF_DSI, 1, INTF_SDM845_MASK), |
6260 |
++ INTF_BLK("intf_3", INTF_3, 0x6B800, INTF_DP, 1, INTF_SDM845_MASK), |
6261 |
+ }; |
6262 |
+ |
6263 |
+ static const struct dpu_intf_cfg sc7180_intf[] = { |
6264 |
+- INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0), |
6265 |
+- INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0), |
6266 |
++ INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, INTF_SC7180_MASK), |
6267 |
++ INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, INTF_SC7180_MASK), |
6268 |
+ }; |
6269 |
+ |
6270 |
+ /************************************************************* |
6271 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |
6272 |
+index f7de43838c69..e4206206a174 100644 |
6273 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |
6274 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |
6275 |
+@@ -185,6 +185,19 @@ enum { |
6276 |
+ DPU_CTL_MAX |
6277 |
+ }; |
6278 |
+ |
6279 |
++/** |
6280 |
++ * INTF sub-blocks |
6281 |
++ * @DPU_INTF_INPUT_CTRL Supports the setting of pp block from which |
6282 |
++ * pixel data arrives to this INTF |
6283 |
++ * @DPU_INTF_TE INTF block has TE configuration support |
6284 |
++ * @DPU_INTF_MAX |
6285 |
++ */ |
6286 |
++enum { |
6287 |
++ DPU_INTF_INPUT_CTRL = 0x1, |
6288 |
++ DPU_INTF_TE, |
6289 |
++ DPU_INTF_MAX |
6290 |
++}; |
6291 |
++ |
6292 |
+ /** |
6293 |
+ * VBIF sub-blocks and features |
6294 |
+ * @DPU_VBIF_QOS_OTLIM VBIF supports OT Limit |
6295 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |
6296 |
+index efe9a5719c6b..64f556d693dd 100644 |
6297 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |
6298 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |
6299 |
+@@ -225,14 +225,9 @@ static void dpu_hw_intf_bind_pingpong_blk( |
6300 |
+ bool enable, |
6301 |
+ const enum dpu_pingpong pp) |
6302 |
+ { |
6303 |
+- struct dpu_hw_blk_reg_map *c; |
6304 |
++ struct dpu_hw_blk_reg_map *c = &intf->hw; |
6305 |
+ u32 mux_cfg; |
6306 |
+ |
6307 |
+- if (!intf) |
6308 |
+- return; |
6309 |
+- |
6310 |
+- c = &intf->hw; |
6311 |
+- |
6312 |
+ mux_cfg = DPU_REG_READ(c, INTF_MUX); |
6313 |
+ mux_cfg &= ~0xf; |
6314 |
+ |
6315 |
+@@ -280,7 +275,7 @@ static void _setup_intf_ops(struct dpu_hw_intf_ops *ops, |
6316 |
+ ops->get_status = dpu_hw_intf_get_status; |
6317 |
+ ops->enable_timing = dpu_hw_intf_enable_timing_engine; |
6318 |
+ ops->get_line_count = dpu_hw_intf_get_line_count; |
6319 |
+- if (cap & BIT(DPU_CTL_ACTIVE_CFG)) |
6320 |
++ if (cap & BIT(DPU_INTF_INPUT_CTRL)) |
6321 |
+ ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk; |
6322 |
+ } |
6323 |
+ |
6324 |
+diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c |
6325 |
+index 6277fde13df9..f63bb7e452d2 100644 |
6326 |
+--- a/drivers/gpu/drm/msm/msm_gem.c |
6327 |
++++ b/drivers/gpu/drm/msm/msm_gem.c |
6328 |
+@@ -994,10 +994,8 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file, |
6329 |
+ |
6330 |
+ static int msm_gem_new_impl(struct drm_device *dev, |
6331 |
+ uint32_t size, uint32_t flags, |
6332 |
+- struct drm_gem_object **obj, |
6333 |
+- bool struct_mutex_locked) |
6334 |
++ struct drm_gem_object **obj) |
6335 |
+ { |
6336 |
+- struct msm_drm_private *priv = dev->dev_private; |
6337 |
+ struct msm_gem_object *msm_obj; |
6338 |
+ |
6339 |
+ switch (flags & MSM_BO_CACHE_MASK) { |
6340 |
+@@ -1023,15 +1021,6 @@ static int msm_gem_new_impl(struct drm_device *dev, |
6341 |
+ INIT_LIST_HEAD(&msm_obj->submit_entry); |
6342 |
+ INIT_LIST_HEAD(&msm_obj->vmas); |
6343 |
+ |
6344 |
+- if (struct_mutex_locked) { |
6345 |
+- WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
6346 |
+- list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
6347 |
+- } else { |
6348 |
+- mutex_lock(&dev->struct_mutex); |
6349 |
+- list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
6350 |
+- mutex_unlock(&dev->struct_mutex); |
6351 |
+- } |
6352 |
+- |
6353 |
+ *obj = &msm_obj->base; |
6354 |
+ |
6355 |
+ return 0; |
6356 |
+@@ -1041,6 +1030,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, |
6357 |
+ uint32_t size, uint32_t flags, bool struct_mutex_locked) |
6358 |
+ { |
6359 |
+ struct msm_drm_private *priv = dev->dev_private; |
6360 |
++ struct msm_gem_object *msm_obj; |
6361 |
+ struct drm_gem_object *obj = NULL; |
6362 |
+ bool use_vram = false; |
6363 |
+ int ret; |
6364 |
+@@ -1061,14 +1051,15 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, |
6365 |
+ if (size == 0) |
6366 |
+ return ERR_PTR(-EINVAL); |
6367 |
+ |
6368 |
+- ret = msm_gem_new_impl(dev, size, flags, &obj, struct_mutex_locked); |
6369 |
++ ret = msm_gem_new_impl(dev, size, flags, &obj); |
6370 |
+ if (ret) |
6371 |
+ goto fail; |
6372 |
+ |
6373 |
++ msm_obj = to_msm_bo(obj); |
6374 |
++ |
6375 |
+ if (use_vram) { |
6376 |
+ struct msm_gem_vma *vma; |
6377 |
+ struct page **pages; |
6378 |
+- struct msm_gem_object *msm_obj = to_msm_bo(obj); |
6379 |
+ |
6380 |
+ mutex_lock(&msm_obj->lock); |
6381 |
+ |
6382 |
+@@ -1103,6 +1094,15 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, |
6383 |
+ mapping_set_gfp_mask(obj->filp->f_mapping, GFP_HIGHUSER); |
6384 |
+ } |
6385 |
+ |
6386 |
++ if (struct_mutex_locked) { |
6387 |
++ WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
6388 |
++ list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
6389 |
++ } else { |
6390 |
++ mutex_lock(&dev->struct_mutex); |
6391 |
++ list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
6392 |
++ mutex_unlock(&dev->struct_mutex); |
6393 |
++ } |
6394 |
++ |
6395 |
+ return obj; |
6396 |
+ |
6397 |
+ fail: |
6398 |
+@@ -1125,6 +1125,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev, |
6399 |
+ struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
6400 |
+ struct dma_buf *dmabuf, struct sg_table *sgt) |
6401 |
+ { |
6402 |
++ struct msm_drm_private *priv = dev->dev_private; |
6403 |
+ struct msm_gem_object *msm_obj; |
6404 |
+ struct drm_gem_object *obj; |
6405 |
+ uint32_t size; |
6406 |
+@@ -1138,7 +1139,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
6407 |
+ |
6408 |
+ size = PAGE_ALIGN(dmabuf->size); |
6409 |
+ |
6410 |
+- ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj, false); |
6411 |
++ ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj); |
6412 |
+ if (ret) |
6413 |
+ goto fail; |
6414 |
+ |
6415 |
+@@ -1163,6 +1164,11 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
6416 |
+ } |
6417 |
+ |
6418 |
+ mutex_unlock(&msm_obj->lock); |
6419 |
++ |
6420 |
++ mutex_lock(&dev->struct_mutex); |
6421 |
++ list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
6422 |
++ mutex_unlock(&dev->struct_mutex); |
6423 |
++ |
6424 |
+ return obj; |
6425 |
+ |
6426 |
+ fail: |
6427 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c |
6428 |
+index 8f6455697ba7..ed6819519f6d 100644 |
6429 |
+--- a/drivers/gpu/drm/nouveau/dispnv50/head.c |
6430 |
++++ b/drivers/gpu/drm/nouveau/dispnv50/head.c |
6431 |
+@@ -84,18 +84,20 @@ nv50_head_atomic_check_dither(struct nv50_head_atom *armh, |
6432 |
+ { |
6433 |
+ u32 mode = 0x00; |
6434 |
+ |
6435 |
+- if (asyc->dither.mode == DITHERING_MODE_AUTO) { |
6436 |
+- if (asyh->base.depth > asyh->or.bpc * 3) |
6437 |
+- mode = DITHERING_MODE_DYNAMIC2X2; |
6438 |
+- } else { |
6439 |
+- mode = asyc->dither.mode; |
6440 |
+- } |
6441 |
++ if (asyc->dither.mode) { |
6442 |
++ if (asyc->dither.mode == DITHERING_MODE_AUTO) { |
6443 |
++ if (asyh->base.depth > asyh->or.bpc * 3) |
6444 |
++ mode = DITHERING_MODE_DYNAMIC2X2; |
6445 |
++ } else { |
6446 |
++ mode = asyc->dither.mode; |
6447 |
++ } |
6448 |
+ |
6449 |
+- if (asyc->dither.depth == DITHERING_DEPTH_AUTO) { |
6450 |
+- if (asyh->or.bpc >= 8) |
6451 |
+- mode |= DITHERING_DEPTH_8BPC; |
6452 |
+- } else { |
6453 |
+- mode |= asyc->dither.depth; |
6454 |
++ if (asyc->dither.depth == DITHERING_DEPTH_AUTO) { |
6455 |
++ if (asyh->or.bpc >= 8) |
6456 |
++ mode |= DITHERING_DEPTH_8BPC; |
6457 |
++ } else { |
6458 |
++ mode |= asyc->dither.depth; |
6459 |
++ } |
6460 |
+ } |
6461 |
+ |
6462 |
+ asyh->dither.enable = mode; |
6463 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
6464 |
+index 63b5c8cf9ae4..8f63cda3db17 100644 |
6465 |
+--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
6466 |
++++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c |
6467 |
+@@ -54,8 +54,10 @@ nouveau_debugfs_strap_peek(struct seq_file *m, void *data) |
6468 |
+ int ret; |
6469 |
+ |
6470 |
+ ret = pm_runtime_get_sync(drm->dev->dev); |
6471 |
+- if (ret < 0 && ret != -EACCES) |
6472 |
++ if (ret < 0 && ret != -EACCES) { |
6473 |
++ pm_runtime_put_autosuspend(drm->dev->dev); |
6474 |
+ return ret; |
6475 |
++ } |
6476 |
+ |
6477 |
+ seq_printf(m, "0x%08x\n", |
6478 |
+ nvif_rd32(&drm->client.device.object, 0x101000)); |
6479 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c |
6480 |
+index ac93d12201dc..880d962c1b19 100644 |
6481 |
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c |
6482 |
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c |
6483 |
+@@ -1026,8 +1026,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) |
6484 |
+ |
6485 |
+ /* need to bring up power immediately if opening device */ |
6486 |
+ ret = pm_runtime_get_sync(dev->dev); |
6487 |
+- if (ret < 0 && ret != -EACCES) |
6488 |
++ if (ret < 0 && ret != -EACCES) { |
6489 |
++ pm_runtime_put_autosuspend(dev->dev); |
6490 |
+ return ret; |
6491 |
++ } |
6492 |
+ |
6493 |
+ get_task_comm(tmpname, current); |
6494 |
+ snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid)); |
6495 |
+@@ -1109,8 +1111,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
6496 |
+ long ret; |
6497 |
+ |
6498 |
+ ret = pm_runtime_get_sync(dev->dev); |
6499 |
+- if (ret < 0 && ret != -EACCES) |
6500 |
++ if (ret < 0 && ret != -EACCES) { |
6501 |
++ pm_runtime_put_autosuspend(dev->dev); |
6502 |
+ return ret; |
6503 |
++ } |
6504 |
+ |
6505 |
+ switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) { |
6506 |
+ case DRM_NOUVEAU_NVIF: |
6507 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c |
6508 |
+index 4c3f131ad31d..c5ee5b7364a0 100644 |
6509 |
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c |
6510 |
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c |
6511 |
+@@ -45,8 +45,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem) |
6512 |
+ int ret; |
6513 |
+ |
6514 |
+ ret = pm_runtime_get_sync(dev); |
6515 |
+- if (WARN_ON(ret < 0 && ret != -EACCES)) |
6516 |
++ if (WARN_ON(ret < 0 && ret != -EACCES)) { |
6517 |
++ pm_runtime_put_autosuspend(dev); |
6518 |
+ return; |
6519 |
++ } |
6520 |
+ |
6521 |
+ if (gem->import_attach) |
6522 |
+ drm_prime_gem_destroy(gem, nvbo->bo.sg); |
6523 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
6524 |
+index feaac908efed..34403b810dba 100644 |
6525 |
+--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
6526 |
++++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c |
6527 |
+@@ -96,12 +96,9 @@ nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags) |
6528 |
+ else |
6529 |
+ nvbe->ttm.ttm.func = &nv50_sgdma_backend; |
6530 |
+ |
6531 |
+- if (ttm_dma_tt_init(&nvbe->ttm, bo, page_flags)) |
6532 |
+- /* |
6533 |
+- * A failing ttm_dma_tt_init() will call ttm_tt_destroy() |
6534 |
+- * and thus our nouveau_sgdma_destroy() hook, so we don't need |
6535 |
+- * to free nvbe here. |
6536 |
+- */ |
6537 |
++ if (ttm_dma_tt_init(&nvbe->ttm, bo, page_flags)) { |
6538 |
++ kfree(nvbe); |
6539 |
+ return NULL; |
6540 |
++ } |
6541 |
+ return &nvbe->ttm.ttm; |
6542 |
+ } |
6543 |
+diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c |
6544 |
+index 4aeb960ccf15..444b77490a42 100644 |
6545 |
+--- a/drivers/gpu/drm/panel/panel-simple.c |
6546 |
++++ b/drivers/gpu/drm/panel/panel-simple.c |
6547 |
+@@ -2304,7 +2304,7 @@ static const struct drm_display_mode lg_lb070wv8_mode = { |
6548 |
+ static const struct panel_desc lg_lb070wv8 = { |
6549 |
+ .modes = &lg_lb070wv8_mode, |
6550 |
+ .num_modes = 1, |
6551 |
+- .bpc = 16, |
6552 |
++ .bpc = 8, |
6553 |
+ .size = { |
6554 |
+ .width = 151, |
6555 |
+ .height = 91, |
6556 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c |
6557 |
+index 7914b1570841..f9519afca29d 100644 |
6558 |
+--- a/drivers/gpu/drm/panfrost/panfrost_job.c |
6559 |
++++ b/drivers/gpu/drm/panfrost/panfrost_job.c |
6560 |
+@@ -145,6 +145,8 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) |
6561 |
+ u64 jc_head = job->jc; |
6562 |
+ int ret; |
6563 |
+ |
6564 |
++ panfrost_devfreq_record_busy(pfdev); |
6565 |
++ |
6566 |
+ ret = pm_runtime_get_sync(pfdev->dev); |
6567 |
+ if (ret < 0) |
6568 |
+ return; |
6569 |
+@@ -155,7 +157,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) |
6570 |
+ } |
6571 |
+ |
6572 |
+ cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); |
6573 |
+- panfrost_devfreq_record_busy(pfdev); |
6574 |
+ |
6575 |
+ job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF); |
6576 |
+ job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32); |
6577 |
+@@ -410,12 +411,12 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) |
6578 |
+ for (i = 0; i < NUM_JOB_SLOTS; i++) { |
6579 |
+ if (pfdev->jobs[i]) { |
6580 |
+ pm_runtime_put_noidle(pfdev->dev); |
6581 |
++ panfrost_devfreq_record_idle(pfdev); |
6582 |
+ pfdev->jobs[i] = NULL; |
6583 |
+ } |
6584 |
+ } |
6585 |
+ spin_unlock_irqrestore(&pfdev->js->job_lock, flags); |
6586 |
+ |
6587 |
+- panfrost_devfreq_record_idle(pfdev); |
6588 |
+ panfrost_device_reset(pfdev); |
6589 |
+ |
6590 |
+ for (i = 0; i < NUM_JOB_SLOTS; i++) |
6591 |
+diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c |
6592 |
+index f434efdeca44..ba20c6f03719 100644 |
6593 |
+--- a/drivers/gpu/drm/radeon/ci_dpm.c |
6594 |
++++ b/drivers/gpu/drm/radeon/ci_dpm.c |
6595 |
+@@ -4351,7 +4351,7 @@ static int ci_set_mc_special_registers(struct radeon_device *rdev, |
6596 |
+ table->mc_reg_table_entry[k].mc_data[j] |= 0x100; |
6597 |
+ } |
6598 |
+ j++; |
6599 |
+- if (j > SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE) |
6600 |
++ if (j >= SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE) |
6601 |
+ return -EINVAL; |
6602 |
+ |
6603 |
+ if (!pi->mem_gddr5) { |
6604 |
+diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
6605 |
+index 35db79a168bf..df1a7eb73651 100644 |
6606 |
+--- a/drivers/gpu/drm/radeon/radeon_display.c |
6607 |
++++ b/drivers/gpu/drm/radeon/radeon_display.c |
6608 |
+@@ -635,8 +635,10 @@ radeon_crtc_set_config(struct drm_mode_set *set, |
6609 |
+ dev = set->crtc->dev; |
6610 |
+ |
6611 |
+ ret = pm_runtime_get_sync(dev->dev); |
6612 |
+- if (ret < 0) |
6613 |
++ if (ret < 0) { |
6614 |
++ pm_runtime_put_autosuspend(dev->dev); |
6615 |
+ return ret; |
6616 |
++ } |
6617 |
+ |
6618 |
+ ret = drm_crtc_helper_set_config(set, ctx); |
6619 |
+ |
6620 |
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c |
6621 |
+index bbb0883e8ce6..4cd30613fa1d 100644 |
6622 |
+--- a/drivers/gpu/drm/radeon/radeon_drv.c |
6623 |
++++ b/drivers/gpu/drm/radeon/radeon_drv.c |
6624 |
+@@ -171,12 +171,7 @@ int radeon_no_wb; |
6625 |
+ int radeon_modeset = -1; |
6626 |
+ int radeon_dynclks = -1; |
6627 |
+ int radeon_r4xx_atom = 0; |
6628 |
+-#ifdef __powerpc__ |
6629 |
+-/* Default to PCI on PowerPC (fdo #95017) */ |
6630 |
+ int radeon_agpmode = -1; |
6631 |
+-#else |
6632 |
+-int radeon_agpmode = 0; |
6633 |
+-#endif |
6634 |
+ int radeon_vram_limit = 0; |
6635 |
+ int radeon_gart_size = -1; /* auto */ |
6636 |
+ int radeon_benchmarking = 0; |
6637 |
+@@ -549,8 +544,10 @@ long radeon_drm_ioctl(struct file *filp, |
6638 |
+ long ret; |
6639 |
+ dev = file_priv->minor->dev; |
6640 |
+ ret = pm_runtime_get_sync(dev->dev); |
6641 |
+- if (ret < 0) |
6642 |
++ if (ret < 0) { |
6643 |
++ pm_runtime_put_autosuspend(dev->dev); |
6644 |
+ return ret; |
6645 |
++ } |
6646 |
+ |
6647 |
+ ret = drm_ioctl(filp, cmd, arg); |
6648 |
+ |
6649 |
+diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c |
6650 |
+index c5d1dc9618a4..99ee60f8b604 100644 |
6651 |
+--- a/drivers/gpu/drm/radeon/radeon_kms.c |
6652 |
++++ b/drivers/gpu/drm/radeon/radeon_kms.c |
6653 |
+@@ -638,8 +638,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
6654 |
+ file_priv->driver_priv = NULL; |
6655 |
+ |
6656 |
+ r = pm_runtime_get_sync(dev->dev); |
6657 |
+- if (r < 0) |
6658 |
++ if (r < 0) { |
6659 |
++ pm_runtime_put_autosuspend(dev->dev); |
6660 |
+ return r; |
6661 |
++ } |
6662 |
+ |
6663 |
+ /* new gpu have virtual address space support */ |
6664 |
+ if (rdev->family >= CHIP_CAYMAN) { |
6665 |
+diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c |
6666 |
+index f894968d6e45..3f590d916e91 100644 |
6667 |
+--- a/drivers/gpu/drm/stm/ltdc.c |
6668 |
++++ b/drivers/gpu/drm/stm/ltdc.c |
6669 |
+@@ -423,9 +423,12 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, |
6670 |
+ struct drm_crtc_state *old_state) |
6671 |
+ { |
6672 |
+ struct ltdc_device *ldev = crtc_to_ltdc(crtc); |
6673 |
++ struct drm_device *ddev = crtc->dev; |
6674 |
+ |
6675 |
+ DRM_DEBUG_DRIVER("\n"); |
6676 |
+ |
6677 |
++ pm_runtime_get_sync(ddev->dev); |
6678 |
++ |
6679 |
+ /* Sets the background color value */ |
6680 |
+ reg_write(ldev->regs, LTDC_BCCR, BCCR_BCBLACK); |
6681 |
+ |
6682 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
6683 |
+index 12823d60c4e8..4be53768f014 100644 |
6684 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
6685 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
6686 |
+@@ -139,12 +139,16 @@ static int panel_connector_get_modes(struct drm_connector *connector) |
6687 |
+ int i; |
6688 |
+ |
6689 |
+ for (i = 0; i < timings->num_timings; i++) { |
6690 |
+- struct drm_display_mode *mode = drm_mode_create(dev); |
6691 |
++ struct drm_display_mode *mode; |
6692 |
+ struct videomode vm; |
6693 |
+ |
6694 |
+ if (videomode_from_timings(timings, &vm, i)) |
6695 |
+ break; |
6696 |
+ |
6697 |
++ mode = drm_mode_create(dev); |
6698 |
++ if (!mode) |
6699 |
++ break; |
6700 |
++ |
6701 |
+ drm_display_mode_from_videomode(&vm, mode); |
6702 |
+ |
6703 |
+ mode->type = DRM_MODE_TYPE_DRIVER; |
6704 |
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c |
6705 |
+index 2ec448e1d663..9f296b9da05b 100644 |
6706 |
+--- a/drivers/gpu/drm/ttm/ttm_tt.c |
6707 |
++++ b/drivers/gpu/drm/ttm/ttm_tt.c |
6708 |
+@@ -242,7 +242,6 @@ int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo, |
6709 |
+ ttm_tt_init_fields(ttm, bo, page_flags); |
6710 |
+ |
6711 |
+ if (ttm_tt_alloc_page_directory(ttm)) { |
6712 |
+- ttm_tt_destroy(ttm); |
6713 |
+ pr_err("Failed allocating page table\n"); |
6714 |
+ return -ENOMEM; |
6715 |
+ } |
6716 |
+@@ -266,7 +265,6 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo, |
6717 |
+ |
6718 |
+ INIT_LIST_HEAD(&ttm_dma->pages_list); |
6719 |
+ if (ttm_dma_tt_alloc_page_directory(ttm_dma)) { |
6720 |
+- ttm_tt_destroy(ttm); |
6721 |
+ pr_err("Failed allocating page table\n"); |
6722 |
+ return -ENOMEM; |
6723 |
+ } |
6724 |
+@@ -288,7 +286,6 @@ int ttm_sg_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo, |
6725 |
+ else |
6726 |
+ ret = ttm_dma_tt_alloc_page_directory(ttm_dma); |
6727 |
+ if (ret) { |
6728 |
+- ttm_tt_destroy(ttm); |
6729 |
+ pr_err("Failed allocating page table\n"); |
6730 |
+ return -ENOMEM; |
6731 |
+ } |
6732 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c |
6733 |
+index 1fd458e877ca..51818e76facd 100644 |
6734 |
+--- a/drivers/gpu/drm/xen/xen_drm_front.c |
6735 |
++++ b/drivers/gpu/drm/xen/xen_drm_front.c |
6736 |
+@@ -400,8 +400,8 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, |
6737 |
+ args->size = args->pitch * args->height; |
6738 |
+ |
6739 |
+ obj = xen_drm_front_gem_create(dev, args->size); |
6740 |
+- if (IS_ERR_OR_NULL(obj)) { |
6741 |
+- ret = PTR_ERR_OR_ZERO(obj); |
6742 |
++ if (IS_ERR(obj)) { |
6743 |
++ ret = PTR_ERR(obj); |
6744 |
+ goto fail; |
6745 |
+ } |
6746 |
+ |
6747 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c |
6748 |
+index f0b85e094111..4ec8a49241e1 100644 |
6749 |
+--- a/drivers/gpu/drm/xen/xen_drm_front_gem.c |
6750 |
++++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c |
6751 |
+@@ -83,7 +83,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) |
6752 |
+ |
6753 |
+ size = round_up(size, PAGE_SIZE); |
6754 |
+ xen_obj = gem_create_obj(dev, size); |
6755 |
+- if (IS_ERR_OR_NULL(xen_obj)) |
6756 |
++ if (IS_ERR(xen_obj)) |
6757 |
+ return xen_obj; |
6758 |
+ |
6759 |
+ if (drm_info->front_info->cfg.be_alloc) { |
6760 |
+@@ -117,7 +117,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) |
6761 |
+ */ |
6762 |
+ xen_obj->num_pages = DIV_ROUND_UP(size, PAGE_SIZE); |
6763 |
+ xen_obj->pages = drm_gem_get_pages(&xen_obj->base); |
6764 |
+- if (IS_ERR_OR_NULL(xen_obj->pages)) { |
6765 |
++ if (IS_ERR(xen_obj->pages)) { |
6766 |
+ ret = PTR_ERR(xen_obj->pages); |
6767 |
+ xen_obj->pages = NULL; |
6768 |
+ goto fail; |
6769 |
+@@ -136,7 +136,7 @@ struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, |
6770 |
+ struct xen_gem_object *xen_obj; |
6771 |
+ |
6772 |
+ xen_obj = gem_create(dev, size); |
6773 |
+- if (IS_ERR_OR_NULL(xen_obj)) |
6774 |
++ if (IS_ERR(xen_obj)) |
6775 |
+ return ERR_CAST(xen_obj); |
6776 |
+ |
6777 |
+ return &xen_obj->base; |
6778 |
+@@ -194,7 +194,7 @@ xen_drm_front_gem_import_sg_table(struct drm_device *dev, |
6779 |
+ |
6780 |
+ size = attach->dmabuf->size; |
6781 |
+ xen_obj = gem_create_obj(dev, size); |
6782 |
+- if (IS_ERR_OR_NULL(xen_obj)) |
6783 |
++ if (IS_ERR(xen_obj)) |
6784 |
+ return ERR_CAST(xen_obj); |
6785 |
+ |
6786 |
+ ret = gem_alloc_pages_array(xen_obj, size); |
6787 |
+diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c |
6788 |
+index 78096bbcd226..ef11b1e4de39 100644 |
6789 |
+--- a/drivers/gpu/drm/xen/xen_drm_front_kms.c |
6790 |
++++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c |
6791 |
+@@ -60,7 +60,7 @@ fb_create(struct drm_device *dev, struct drm_file *filp, |
6792 |
+ int ret; |
6793 |
+ |
6794 |
+ fb = drm_gem_fb_create_with_funcs(dev, filp, mode_cmd, &fb_funcs); |
6795 |
+- if (IS_ERR_OR_NULL(fb)) |
6796 |
++ if (IS_ERR(fb)) |
6797 |
+ return fb; |
6798 |
+ |
6799 |
+ gem_obj = fb->obj[0]; |
6800 |
+diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c |
6801 |
+index c0392672a842..1b4997bda1c7 100644 |
6802 |
+--- a/drivers/gpu/host1x/debug.c |
6803 |
++++ b/drivers/gpu/host1x/debug.c |
6804 |
+@@ -16,6 +16,8 @@ |
6805 |
+ #include "debug.h" |
6806 |
+ #include "channel.h" |
6807 |
+ |
6808 |
++static DEFINE_MUTEX(debug_lock); |
6809 |
++ |
6810 |
+ unsigned int host1x_debug_trace_cmdbuf; |
6811 |
+ |
6812 |
+ static pid_t host1x_debug_force_timeout_pid; |
6813 |
+@@ -52,12 +54,14 @@ static int show_channel(struct host1x_channel *ch, void *data, bool show_fifo) |
6814 |
+ struct output *o = data; |
6815 |
+ |
6816 |
+ mutex_lock(&ch->cdma.lock); |
6817 |
++ mutex_lock(&debug_lock); |
6818 |
+ |
6819 |
+ if (show_fifo) |
6820 |
+ host1x_hw_show_channel_fifo(m, ch, o); |
6821 |
+ |
6822 |
+ host1x_hw_show_channel_cdma(m, ch, o); |
6823 |
+ |
6824 |
++ mutex_unlock(&debug_lock); |
6825 |
+ mutex_unlock(&ch->cdma.lock); |
6826 |
+ |
6827 |
+ return 0; |
6828 |
+diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c |
6829 |
+index ee2a025e54cf..b3dae9ec1a38 100644 |
6830 |
+--- a/drivers/gpu/ipu-v3/ipu-common.c |
6831 |
++++ b/drivers/gpu/ipu-v3/ipu-common.c |
6832 |
+@@ -124,6 +124,8 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat) |
6833 |
+ case V4L2_PIX_FMT_RGBX32: |
6834 |
+ case V4L2_PIX_FMT_ARGB32: |
6835 |
+ case V4L2_PIX_FMT_XRGB32: |
6836 |
++ case V4L2_PIX_FMT_RGB32: |
6837 |
++ case V4L2_PIX_FMT_BGR32: |
6838 |
+ return IPUV3_COLORSPACE_RGB; |
6839 |
+ default: |
6840 |
+ return IPUV3_COLORSPACE_UNKNOWN; |
6841 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
6842 |
+index dea9cc65bf80..e8641ce677e4 100644 |
6843 |
+--- a/drivers/hid/hid-input.c |
6844 |
++++ b/drivers/hid/hid-input.c |
6845 |
+@@ -350,13 +350,13 @@ static int hidinput_query_battery_capacity(struct hid_device *dev) |
6846 |
+ u8 *buf; |
6847 |
+ int ret; |
6848 |
+ |
6849 |
+- buf = kmalloc(2, GFP_KERNEL); |
6850 |
++ buf = kmalloc(4, GFP_KERNEL); |
6851 |
+ if (!buf) |
6852 |
+ return -ENOMEM; |
6853 |
+ |
6854 |
+- ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 2, |
6855 |
++ ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 4, |
6856 |
+ dev->battery_report_type, HID_REQ_GET_REPORT); |
6857 |
+- if (ret != 2) { |
6858 |
++ if (ret < 2) { |
6859 |
+ kfree(buf); |
6860 |
+ return -ENODATA; |
6861 |
+ } |
6862 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c |
6863 |
+index 0c35cd5e0d1d..6089c481f8f1 100644 |
6864 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x.c |
6865 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x.c |
6866 |
+@@ -507,6 +507,12 @@ static void etm4_disable_hw(void *info) |
6867 |
+ readl_relaxed(drvdata->base + TRCSSCSRn(i)); |
6868 |
+ } |
6869 |
+ |
6870 |
++ /* read back the current counter values */ |
6871 |
++ for (i = 0; i < drvdata->nr_cntr; i++) { |
6872 |
++ config->cntr_val[i] = |
6873 |
++ readl_relaxed(drvdata->base + TRCCNTVRn(i)); |
6874 |
++ } |
6875 |
++ |
6876 |
+ coresight_disclaim_device_unlocked(drvdata->base); |
6877 |
+ |
6878 |
+ CS_LOCK(drvdata->base); |
6879 |
+@@ -1196,8 +1202,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) |
6880 |
+ } |
6881 |
+ |
6882 |
+ for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { |
6883 |
+- state->trcacvr[i] = readl(drvdata->base + TRCACVRn(i)); |
6884 |
+- state->trcacatr[i] = readl(drvdata->base + TRCACATRn(i)); |
6885 |
++ state->trcacvr[i] = readq(drvdata->base + TRCACVRn(i)); |
6886 |
++ state->trcacatr[i] = readq(drvdata->base + TRCACATRn(i)); |
6887 |
+ } |
6888 |
+ |
6889 |
+ /* |
6890 |
+@@ -1208,10 +1214,10 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) |
6891 |
+ */ |
6892 |
+ |
6893 |
+ for (i = 0; i < drvdata->numcidc; i++) |
6894 |
+- state->trccidcvr[i] = readl(drvdata->base + TRCCIDCVRn(i)); |
6895 |
++ state->trccidcvr[i] = readq(drvdata->base + TRCCIDCVRn(i)); |
6896 |
+ |
6897 |
+ for (i = 0; i < drvdata->numvmidc; i++) |
6898 |
+- state->trcvmidcvr[i] = readl(drvdata->base + TRCVMIDCVRn(i)); |
6899 |
++ state->trcvmidcvr[i] = readq(drvdata->base + TRCVMIDCVRn(i)); |
6900 |
+ |
6901 |
+ state->trccidcctlr0 = readl(drvdata->base + TRCCIDCCTLR0); |
6902 |
+ state->trccidcctlr1 = readl(drvdata->base + TRCCIDCCTLR1); |
6903 |
+@@ -1309,18 +1315,18 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) |
6904 |
+ } |
6905 |
+ |
6906 |
+ for (i = 0; i < drvdata->nr_addr_cmp * 2; i++) { |
6907 |
+- writel_relaxed(state->trcacvr[i], |
6908 |
++ writeq_relaxed(state->trcacvr[i], |
6909 |
+ drvdata->base + TRCACVRn(i)); |
6910 |
+- writel_relaxed(state->trcacatr[i], |
6911 |
++ writeq_relaxed(state->trcacatr[i], |
6912 |
+ drvdata->base + TRCACATRn(i)); |
6913 |
+ } |
6914 |
+ |
6915 |
+ for (i = 0; i < drvdata->numcidc; i++) |
6916 |
+- writel_relaxed(state->trccidcvr[i], |
6917 |
++ writeq_relaxed(state->trccidcvr[i], |
6918 |
+ drvdata->base + TRCCIDCVRn(i)); |
6919 |
+ |
6920 |
+ for (i = 0; i < drvdata->numvmidc; i++) |
6921 |
+- writel_relaxed(state->trcvmidcvr[i], |
6922 |
++ writeq_relaxed(state->trcvmidcvr[i], |
6923 |
+ drvdata->base + TRCVMIDCVRn(i)); |
6924 |
+ |
6925 |
+ writel_relaxed(state->trccidcctlr0, drvdata->base + TRCCIDCCTLR0); |
6926 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h |
6927 |
+index 4a695bf90582..47729e04aac7 100644 |
6928 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x.h |
6929 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x.h |
6930 |
+@@ -133,7 +133,7 @@ |
6931 |
+ #define ETMv4_MAX_CTXID_CMP 8 |
6932 |
+ #define ETM_MAX_VMID_CMP 8 |
6933 |
+ #define ETM_MAX_PE_CMP 8 |
6934 |
+-#define ETM_MAX_RES_SEL 16 |
6935 |
++#define ETM_MAX_RES_SEL 32 |
6936 |
+ #define ETM_MAX_SS_CMP 8 |
6937 |
+ |
6938 |
+ #define ETM_ARCH_V4 0x40 |
6939 |
+@@ -325,7 +325,7 @@ struct etmv4_save_state { |
6940 |
+ u32 trccntctlr[ETMv4_MAX_CNTR]; |
6941 |
+ u32 trccntvr[ETMv4_MAX_CNTR]; |
6942 |
+ |
6943 |
+- u32 trcrsctlr[ETM_MAX_RES_SEL * 2]; |
6944 |
++ u32 trcrsctlr[ETM_MAX_RES_SEL]; |
6945 |
+ |
6946 |
+ u32 trcssccr[ETM_MAX_SS_CMP]; |
6947 |
+ u32 trcsscsr[ETM_MAX_SS_CMP]; |
6948 |
+@@ -334,7 +334,7 @@ struct etmv4_save_state { |
6949 |
+ u64 trcacvr[ETM_MAX_SINGLE_ADDR_CMP]; |
6950 |
+ u64 trcacatr[ETM_MAX_SINGLE_ADDR_CMP]; |
6951 |
+ u64 trccidcvr[ETMv4_MAX_CTXID_CMP]; |
6952 |
+- u32 trcvmidcvr[ETM_MAX_VMID_CMP]; |
6953 |
++ u64 trcvmidcvr[ETM_MAX_VMID_CMP]; |
6954 |
+ u32 trccidcctlr0; |
6955 |
+ u32 trccidcctlr1; |
6956 |
+ u32 trcvmidcctlr0; |
6957 |
+diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
6958 |
+index 36cce2bfb744..6375504ba8b0 100644 |
6959 |
+--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
6960 |
++++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
6961 |
+@@ -639,15 +639,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata) |
6962 |
+ |
6963 |
+ spin_lock_irqsave(&drvdata->spinlock, flags); |
6964 |
+ |
6965 |
+- /* There is no point in reading a TMC in HW FIFO mode */ |
6966 |
+- mode = readl_relaxed(drvdata->base + TMC_MODE); |
6967 |
+- if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
6968 |
+- spin_unlock_irqrestore(&drvdata->spinlock, flags); |
6969 |
+- return -EINVAL; |
6970 |
+- } |
6971 |
+- |
6972 |
+ /* Re-enable the TMC if need be */ |
6973 |
+ if (drvdata->mode == CS_MODE_SYSFS) { |
6974 |
++ /* There is no point in reading a TMC in HW FIFO mode */ |
6975 |
++ mode = readl_relaxed(drvdata->base + TMC_MODE); |
6976 |
++ if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
6977 |
++ spin_unlock_irqrestore(&drvdata->spinlock, flags); |
6978 |
++ return -EINVAL; |
6979 |
++ } |
6980 |
+ /* |
6981 |
+ * The trace run will continue with the same allocated trace |
6982 |
+ * buffer. As such zero-out the buffer so that we don't end |
6983 |
+diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c |
6984 |
+index 62167b87caea..8345ba65d41d 100644 |
6985 |
+--- a/drivers/iio/amplifiers/ad8366.c |
6986 |
++++ b/drivers/iio/amplifiers/ad8366.c |
6987 |
+@@ -262,8 +262,11 @@ static int ad8366_probe(struct spi_device *spi) |
6988 |
+ case ID_ADA4961: |
6989 |
+ case ID_ADL5240: |
6990 |
+ case ID_HMC1119: |
6991 |
+- st->reset_gpio = devm_gpiod_get(&spi->dev, "reset", |
6992 |
+- GPIOD_OUT_HIGH); |
6993 |
++ st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH); |
6994 |
++ if (IS_ERR(st->reset_gpio)) { |
6995 |
++ ret = PTR_ERR(st->reset_gpio); |
6996 |
++ goto error_disable_reg; |
6997 |
++ } |
6998 |
+ indio_dev->channels = ada4961_channels; |
6999 |
+ indio_dev->num_channels = ARRAY_SIZE(ada4961_channels); |
7000 |
+ break; |
7001 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
7002 |
+index 905a2beaf885..eadba29432dd 100644 |
7003 |
+--- a/drivers/infiniband/core/device.c |
7004 |
++++ b/drivers/infiniband/core/device.c |
7005 |
+@@ -1339,6 +1339,10 @@ out: |
7006 |
+ return ret; |
7007 |
+ } |
7008 |
+ |
7009 |
++static void prevent_dealloc_device(struct ib_device *ib_dev) |
7010 |
++{ |
7011 |
++} |
7012 |
++ |
7013 |
+ /** |
7014 |
+ * ib_register_device - Register an IB device with IB core |
7015 |
+ * @device: Device to register |
7016 |
+@@ -1409,11 +1413,11 @@ int ib_register_device(struct ib_device *device, const char *name) |
7017 |
+ * possibility for a parallel unregistration along with this |
7018 |
+ * error flow. Since we have a refcount here we know any |
7019 |
+ * parallel flow is stopped in disable_device and will see the |
7020 |
+- * NULL pointers, causing the responsibility to |
7021 |
++ * special dealloc_driver pointer, causing the responsibility to |
7022 |
+ * ib_dealloc_device() to revert back to this thread. |
7023 |
+ */ |
7024 |
+ dealloc_fn = device->ops.dealloc_driver; |
7025 |
+- device->ops.dealloc_driver = NULL; |
7026 |
++ device->ops.dealloc_driver = prevent_dealloc_device; |
7027 |
+ ib_device_put(device); |
7028 |
+ __ib_unregister_device(device); |
7029 |
+ device->ops.dealloc_driver = dealloc_fn; |
7030 |
+@@ -1462,7 +1466,8 @@ static void __ib_unregister_device(struct ib_device *ib_dev) |
7031 |
+ * Drivers using the new flow may not call ib_dealloc_device except |
7032 |
+ * in error unwind prior to registration success. |
7033 |
+ */ |
7034 |
+- if (ib_dev->ops.dealloc_driver) { |
7035 |
++ if (ib_dev->ops.dealloc_driver && |
7036 |
++ ib_dev->ops.dealloc_driver != prevent_dealloc_device) { |
7037 |
+ WARN_ON(kref_read(&ib_dev->dev.kobj.kref) <= 1); |
7038 |
+ ib_dealloc_device(ib_dev); |
7039 |
+ } |
7040 |
+diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c |
7041 |
+index e16105be2eb2..98cd6403ca60 100644 |
7042 |
+--- a/drivers/infiniband/core/nldev.c |
7043 |
++++ b/drivers/infiniband/core/nldev.c |
7044 |
+@@ -738,9 +738,6 @@ static int fill_stat_counter_qps(struct sk_buff *msg, |
7045 |
+ xa_lock(&rt->xa); |
7046 |
+ xa_for_each(&rt->xa, id, res) { |
7047 |
+ qp = container_of(res, struct ib_qp, res); |
7048 |
+- if (qp->qp_type == IB_QPT_RAW_PACKET && !capable(CAP_NET_RAW)) |
7049 |
+- continue; |
7050 |
+- |
7051 |
+ if (!qp->counter || (qp->counter->id != counter->id)) |
7052 |
+ continue; |
7053 |
+ |
7054 |
+diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c |
7055 |
+index 53d6505c0c7b..f369f0a19e85 100644 |
7056 |
+--- a/drivers/infiniband/core/verbs.c |
7057 |
++++ b/drivers/infiniband/core/verbs.c |
7058 |
+@@ -1712,7 +1712,7 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, |
7059 |
+ if (!(rdma_protocol_ib(qp->device, |
7060 |
+ attr->alt_ah_attr.port_num) && |
7061 |
+ rdma_protocol_ib(qp->device, port))) { |
7062 |
+- ret = EINVAL; |
7063 |
++ ret = -EINVAL; |
7064 |
+ goto out; |
7065 |
+ } |
7066 |
+ } |
7067 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7068 |
+index 0618ced45bf8..eb71b941d21b 100644 |
7069 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7070 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7071 |
+@@ -3053,6 +3053,7 @@ static void get_cqe_status(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp, |
7072 |
+ IB_WC_RETRY_EXC_ERR }, |
7073 |
+ { HNS_ROCE_CQE_V2_RNR_RETRY_EXC_ERR, IB_WC_RNR_RETRY_EXC_ERR }, |
7074 |
+ { HNS_ROCE_CQE_V2_REMOTE_ABORT_ERR, IB_WC_REM_ABORT_ERR }, |
7075 |
++ { HNS_ROCE_CQE_V2_GENERAL_ERR, IB_WC_GENERAL_ERR} |
7076 |
+ }; |
7077 |
+ |
7078 |
+ u32 cqe_status = roce_get_field(cqe->byte_4, V2_CQE_BYTE_4_STATUS_M, |
7079 |
+@@ -3074,6 +3075,14 @@ static void get_cqe_status(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp, |
7080 |
+ print_hex_dump(KERN_ERR, "", DUMP_PREFIX_NONE, 16, 4, cqe, |
7081 |
+ sizeof(*cqe), false); |
7082 |
+ |
7083 |
++ /* |
7084 |
++ * For hns ROCEE, GENERAL_ERR is an error type that is not defined in |
7085 |
++ * the standard protocol, the driver must ignore it and needn't to set |
7086 |
++ * the QP to an error state. |
7087 |
++ */ |
7088 |
++ if (cqe_status == HNS_ROCE_CQE_V2_GENERAL_ERR) |
7089 |
++ return; |
7090 |
++ |
7091 |
+ /* |
7092 |
+ * Hip08 hardware cannot flush the WQEs in SQ/RQ if the QP state gets |
7093 |
+ * into errored mode. Hence, as a workaround to this hardware |
7094 |
+@@ -4301,7 +4310,9 @@ static bool check_qp_state(enum ib_qp_state cur_state, |
7095 |
+ [IB_QPS_RTR] = { [IB_QPS_RESET] = true, |
7096 |
+ [IB_QPS_RTS] = true, |
7097 |
+ [IB_QPS_ERR] = true }, |
7098 |
+- [IB_QPS_RTS] = { [IB_QPS_RESET] = true, [IB_QPS_ERR] = true }, |
7099 |
++ [IB_QPS_RTS] = { [IB_QPS_RESET] = true, |
7100 |
++ [IB_QPS_RTS] = true, |
7101 |
++ [IB_QPS_ERR] = true }, |
7102 |
+ [IB_QPS_SQD] = {}, |
7103 |
+ [IB_QPS_SQE] = {}, |
7104 |
+ [IB_QPS_ERR] = { [IB_QPS_RESET] = true, [IB_QPS_ERR] = true } |
7105 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h |
7106 |
+index e176b0aaa4ac..e6c385ced187 100644 |
7107 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h |
7108 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h |
7109 |
+@@ -230,6 +230,7 @@ enum { |
7110 |
+ HNS_ROCE_CQE_V2_TRANSPORT_RETRY_EXC_ERR = 0x15, |
7111 |
+ HNS_ROCE_CQE_V2_RNR_RETRY_EXC_ERR = 0x16, |
7112 |
+ HNS_ROCE_CQE_V2_REMOTE_ABORT_ERR = 0x22, |
7113 |
++ HNS_ROCE_CQE_V2_GENERAL_ERR = 0x23, |
7114 |
+ |
7115 |
+ HNS_ROCE_V2_CQE_STATUS_MASK = 0xff, |
7116 |
+ }; |
7117 |
+diff --git a/drivers/infiniband/hw/qedr/qedr.h b/drivers/infiniband/hw/qedr/qedr.h |
7118 |
+index fdf90ecb2699..460292179b32 100644 |
7119 |
+--- a/drivers/infiniband/hw/qedr/qedr.h |
7120 |
++++ b/drivers/infiniband/hw/qedr/qedr.h |
7121 |
+@@ -235,6 +235,7 @@ struct qedr_ucontext { |
7122 |
+ u32 dpi_size; |
7123 |
+ u16 dpi; |
7124 |
+ bool db_rec; |
7125 |
++ u8 edpm_mode; |
7126 |
+ }; |
7127 |
+ |
7128 |
+ union db_prod32 { |
7129 |
+@@ -344,10 +345,10 @@ struct qedr_srq_hwq_info { |
7130 |
+ u32 wqe_prod; |
7131 |
+ u32 sge_prod; |
7132 |
+ u32 wr_prod_cnt; |
7133 |
+- u32 wr_cons_cnt; |
7134 |
++ atomic_t wr_cons_cnt; |
7135 |
+ u32 num_elems; |
7136 |
+ |
7137 |
+- u32 *virt_prod_pair_addr; |
7138 |
++ struct rdma_srq_producers *virt_prod_pair_addr; |
7139 |
+ dma_addr_t phy_prod_pair_addr; |
7140 |
+ }; |
7141 |
+ |
7142 |
+diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c |
7143 |
+index 9b9e80266367..1a7f1f805be3 100644 |
7144 |
+--- a/drivers/infiniband/hw/qedr/verbs.c |
7145 |
++++ b/drivers/infiniband/hw/qedr/verbs.c |
7146 |
+@@ -275,7 +275,8 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata) |
7147 |
+ DP_ERR(dev, "Problem copying data from user space\n"); |
7148 |
+ return -EFAULT; |
7149 |
+ } |
7150 |
+- |
7151 |
++ ctx->edpm_mode = !!(ureq.context_flags & |
7152 |
++ QEDR_ALLOC_UCTX_EDPM_MODE); |
7153 |
+ ctx->db_rec = !!(ureq.context_flags & QEDR_ALLOC_UCTX_DB_REC); |
7154 |
+ } |
7155 |
+ |
7156 |
+@@ -316,11 +317,15 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata) |
7157 |
+ uresp.dpm_flags = QEDR_DPM_TYPE_IWARP_LEGACY; |
7158 |
+ else |
7159 |
+ uresp.dpm_flags = QEDR_DPM_TYPE_ROCE_ENHANCED | |
7160 |
+- QEDR_DPM_TYPE_ROCE_LEGACY; |
7161 |
++ QEDR_DPM_TYPE_ROCE_LEGACY | |
7162 |
++ QEDR_DPM_TYPE_ROCE_EDPM_MODE; |
7163 |
+ |
7164 |
+- uresp.dpm_flags |= QEDR_DPM_SIZES_SET; |
7165 |
+- uresp.ldpm_limit_size = QEDR_LDPM_MAX_SIZE; |
7166 |
+- uresp.edpm_trans_size = QEDR_EDPM_TRANS_SIZE; |
7167 |
++ if (ureq.context_flags & QEDR_SUPPORT_DPM_SIZES) { |
7168 |
++ uresp.dpm_flags |= QEDR_DPM_SIZES_SET; |
7169 |
++ uresp.ldpm_limit_size = QEDR_LDPM_MAX_SIZE; |
7170 |
++ uresp.edpm_trans_size = QEDR_EDPM_TRANS_SIZE; |
7171 |
++ uresp.edpm_limit_size = QEDR_EDPM_MAX_SIZE; |
7172 |
++ } |
7173 |
+ |
7174 |
+ uresp.wids_enabled = 1; |
7175 |
+ uresp.wid_count = oparams.wid_count; |
7176 |
+@@ -1750,7 +1755,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev, |
7177 |
+ struct qed_rdma_create_qp_out_params out_params; |
7178 |
+ struct qedr_pd *pd = get_qedr_pd(ibpd); |
7179 |
+ struct qedr_create_qp_uresp uresp; |
7180 |
+- struct qedr_ucontext *ctx = NULL; |
7181 |
++ struct qedr_ucontext *ctx = pd ? pd->uctx : NULL; |
7182 |
+ struct qedr_create_qp_ureq ureq; |
7183 |
+ int alloc_and_init = rdma_protocol_roce(&dev->ibdev, 1); |
7184 |
+ int rc = -EINVAL; |
7185 |
+@@ -1788,6 +1793,9 @@ static int qedr_create_user_qp(struct qedr_dev *dev, |
7186 |
+ in_params.rq_pbl_ptr = qp->urq.pbl_tbl->pa; |
7187 |
+ } |
7188 |
+ |
7189 |
++ if (ctx) |
7190 |
++ SET_FIELD(in_params.flags, QED_ROCE_EDPM_MODE, ctx->edpm_mode); |
7191 |
++ |
7192 |
+ qp->qed_qp = dev->ops->rdma_create_qp(dev->rdma_ctx, |
7193 |
+ &in_params, &out_params); |
7194 |
+ |
7195 |
+@@ -3686,7 +3694,7 @@ static u32 qedr_srq_elem_left(struct qedr_srq_hwq_info *hw_srq) |
7196 |
+ * count and consumer count and subtract it from max |
7197 |
+ * work request supported so that we get elements left. |
7198 |
+ */ |
7199 |
+- used = hw_srq->wr_prod_cnt - hw_srq->wr_cons_cnt; |
7200 |
++ used = hw_srq->wr_prod_cnt - (u32)atomic_read(&hw_srq->wr_cons_cnt); |
7201 |
+ |
7202 |
+ return hw_srq->max_wr - used; |
7203 |
+ } |
7204 |
+@@ -3701,7 +3709,6 @@ int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, |
7205 |
+ unsigned long flags; |
7206 |
+ int status = 0; |
7207 |
+ u32 num_sge; |
7208 |
+- u32 offset; |
7209 |
+ |
7210 |
+ spin_lock_irqsave(&srq->lock, flags); |
7211 |
+ |
7212 |
+@@ -3714,7 +3721,8 @@ int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, |
7213 |
+ if (!qedr_srq_elem_left(hw_srq) || |
7214 |
+ wr->num_sge > srq->hw_srq.max_sges) { |
7215 |
+ DP_ERR(dev, "Can't post WR (%d,%d) || (%d > %d)\n", |
7216 |
+- hw_srq->wr_prod_cnt, hw_srq->wr_cons_cnt, |
7217 |
++ hw_srq->wr_prod_cnt, |
7218 |
++ atomic_read(&hw_srq->wr_cons_cnt), |
7219 |
+ wr->num_sge, srq->hw_srq.max_sges); |
7220 |
+ status = -ENOMEM; |
7221 |
+ *bad_wr = wr; |
7222 |
+@@ -3748,22 +3756,20 @@ int qedr_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, |
7223 |
+ hw_srq->sge_prod++; |
7224 |
+ } |
7225 |
+ |
7226 |
+- /* Flush WQE and SGE information before |
7227 |
++ /* Update WQE and SGE information before |
7228 |
+ * updating producer. |
7229 |
+ */ |
7230 |
+- wmb(); |
7231 |
++ dma_wmb(); |
7232 |
+ |
7233 |
+ /* SRQ producer is 8 bytes. Need to update SGE producer index |
7234 |
+ * in first 4 bytes and need to update WQE producer in |
7235 |
+ * next 4 bytes. |
7236 |
+ */ |
7237 |
+- *srq->hw_srq.virt_prod_pair_addr = hw_srq->sge_prod; |
7238 |
+- offset = offsetof(struct rdma_srq_producers, wqe_prod); |
7239 |
+- *((u8 *)srq->hw_srq.virt_prod_pair_addr + offset) = |
7240 |
+- hw_srq->wqe_prod; |
7241 |
++ srq->hw_srq.virt_prod_pair_addr->sge_prod = hw_srq->sge_prod; |
7242 |
++ /* Make sure sge producer is updated first */ |
7243 |
++ dma_wmb(); |
7244 |
++ srq->hw_srq.virt_prod_pair_addr->wqe_prod = hw_srq->wqe_prod; |
7245 |
+ |
7246 |
+- /* Flush producer after updating it. */ |
7247 |
+- wmb(); |
7248 |
+ wr = wr->next; |
7249 |
+ } |
7250 |
+ |
7251 |
+@@ -4182,7 +4188,7 @@ static int process_resp_one_srq(struct qedr_dev *dev, struct qedr_qp *qp, |
7252 |
+ } else { |
7253 |
+ __process_resp_one(dev, qp, cq, wc, resp, wr_id); |
7254 |
+ } |
7255 |
+- srq->hw_srq.wr_cons_cnt++; |
7256 |
++ atomic_inc(&srq->hw_srq.wr_cons_cnt); |
7257 |
+ |
7258 |
+ return 1; |
7259 |
+ } |
7260 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c |
7261 |
+index 831ad578a7b2..46e111c218fd 100644 |
7262 |
+--- a/drivers/infiniband/sw/rxe/rxe_recv.c |
7263 |
++++ b/drivers/infiniband/sw/rxe/rxe_recv.c |
7264 |
+@@ -330,10 +330,14 @@ err1: |
7265 |
+ |
7266 |
+ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb) |
7267 |
+ { |
7268 |
++ struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); |
7269 |
+ const struct ib_gid_attr *gid_attr; |
7270 |
+ union ib_gid dgid; |
7271 |
+ union ib_gid *pdgid; |
7272 |
+ |
7273 |
++ if (pkt->mask & RXE_LOOPBACK_MASK) |
7274 |
++ return 0; |
7275 |
++ |
7276 |
+ if (skb->protocol == htons(ETH_P_IP)) { |
7277 |
+ ipv6_addr_set_v4mapped(ip_hdr(skb)->daddr, |
7278 |
+ (struct in6_addr *)&dgid); |
7279 |
+@@ -366,7 +370,7 @@ void rxe_rcv(struct sk_buff *skb) |
7280 |
+ if (unlikely(skb->len < pkt->offset + RXE_BTH_BYTES)) |
7281 |
+ goto drop; |
7282 |
+ |
7283 |
+- if (unlikely(rxe_match_dgid(rxe, skb) < 0)) { |
7284 |
++ if (rxe_match_dgid(rxe, skb) < 0) { |
7285 |
+ pr_warn_ratelimited("failed matching dgid\n"); |
7286 |
+ goto drop; |
7287 |
+ } |
7288 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c |
7289 |
+index b8a22af724e8..84fec5fd798d 100644 |
7290 |
+--- a/drivers/infiniband/sw/rxe/rxe_verbs.c |
7291 |
++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c |
7292 |
+@@ -684,6 +684,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, |
7293 |
+ unsigned int mask; |
7294 |
+ unsigned int length = 0; |
7295 |
+ int i; |
7296 |
++ struct ib_send_wr *next; |
7297 |
+ |
7298 |
+ while (wr) { |
7299 |
+ mask = wr_opcode_mask(wr->opcode, qp); |
7300 |
+@@ -700,6 +701,8 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, |
7301 |
+ break; |
7302 |
+ } |
7303 |
+ |
7304 |
++ next = wr->next; |
7305 |
++ |
7306 |
+ length = 0; |
7307 |
+ for (i = 0; i < wr->num_sge; i++) |
7308 |
+ length += wr->sg_list[i].length; |
7309 |
+@@ -710,7 +713,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, |
7310 |
+ *bad_wr = wr; |
7311 |
+ break; |
7312 |
+ } |
7313 |
+- wr = wr->next; |
7314 |
++ wr = next; |
7315 |
+ } |
7316 |
+ |
7317 |
+ rxe_run_task(&qp->req.task, 1); |
7318 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
7319 |
+index 564388a85603..776e89231c52 100644 |
7320 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
7321 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
7322 |
+@@ -12,6 +12,7 @@ |
7323 |
+ |
7324 |
+ #include <linux/module.h> |
7325 |
+ #include <linux/rculist.h> |
7326 |
++#include <linux/random.h> |
7327 |
+ |
7328 |
+ #include "rtrs-clt.h" |
7329 |
+ #include "rtrs-log.h" |
7330 |
+@@ -23,6 +24,12 @@ |
7331 |
+ * leads to "false positives" failed reconnect attempts |
7332 |
+ */ |
7333 |
+ #define RTRS_RECONNECT_BACKOFF 1000 |
7334 |
++/* |
7335 |
++ * Wait for additional random time between 0 and 8 seconds |
7336 |
++ * before starting to reconnect to avoid clients reconnecting |
7337 |
++ * all at once in case of a major network outage |
7338 |
++ */ |
7339 |
++#define RTRS_RECONNECT_SEED 8 |
7340 |
+ |
7341 |
+ MODULE_DESCRIPTION("RDMA Transport Client"); |
7342 |
+ MODULE_LICENSE("GPL"); |
7343 |
+@@ -306,7 +313,8 @@ static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con) |
7344 |
+ */ |
7345 |
+ delay_ms = clt->reconnect_delay_sec * 1000; |
7346 |
+ queue_delayed_work(rtrs_wq, &sess->reconnect_dwork, |
7347 |
+- msecs_to_jiffies(delay_ms)); |
7348 |
++ msecs_to_jiffies(delay_ms + |
7349 |
++ prandom_u32() % RTRS_RECONNECT_SEED)); |
7350 |
+ } else { |
7351 |
+ /* |
7352 |
+ * Error can happen just on establishing new connection, |
7353 |
+@@ -2503,7 +2511,9 @@ reconnect_again: |
7354 |
+ sess->stats->reconnects.fail_cnt++; |
7355 |
+ delay_ms = clt->reconnect_delay_sec * 1000; |
7356 |
+ queue_delayed_work(rtrs_wq, &sess->reconnect_dwork, |
7357 |
+- msecs_to_jiffies(delay_ms)); |
7358 |
++ msecs_to_jiffies(delay_ms + |
7359 |
++ prandom_u32() % |
7360 |
++ RTRS_RECONNECT_SEED)); |
7361 |
+ } |
7362 |
+ } |
7363 |
+ |
7364 |
+@@ -2972,7 +2982,7 @@ static int __init rtrs_client_init(void) |
7365 |
+ pr_err("Failed to create rtrs-client dev class\n"); |
7366 |
+ return PTR_ERR(rtrs_clt_dev_class); |
7367 |
+ } |
7368 |
+- rtrs_wq = alloc_workqueue("rtrs_client_wq", WQ_MEM_RECLAIM, 0); |
7369 |
++ rtrs_wq = alloc_workqueue("rtrs_client_wq", 0, 0); |
7370 |
+ if (!rtrs_wq) { |
7371 |
+ class_destroy(rtrs_clt_dev_class); |
7372 |
+ return -ENOMEM; |
7373 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
7374 |
+index 0d9241f5d9e6..a219bd1bdbc2 100644 |
7375 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
7376 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
7377 |
+@@ -2150,7 +2150,7 @@ static int __init rtrs_server_init(void) |
7378 |
+ err = PTR_ERR(rtrs_dev_class); |
7379 |
+ goto out_chunk_pool; |
7380 |
+ } |
7381 |
+- rtrs_wq = alloc_workqueue("rtrs_server_wq", WQ_MEM_RECLAIM, 0); |
7382 |
++ rtrs_wq = alloc_workqueue("rtrs_server_wq", 0, 0); |
7383 |
+ if (!rtrs_wq) { |
7384 |
+ err = -ENOMEM; |
7385 |
+ goto out_dev_class; |
7386 |
+diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c |
7387 |
+index 683b812c5c47..16f47041f1bf 100644 |
7388 |
+--- a/drivers/iommu/intel/dmar.c |
7389 |
++++ b/drivers/iommu/intel/dmar.c |
7390 |
+@@ -1102,6 +1102,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) |
7391 |
+ } |
7392 |
+ |
7393 |
+ drhd->iommu = iommu; |
7394 |
++ iommu->drhd = drhd; |
7395 |
+ |
7396 |
+ return 0; |
7397 |
+ |
7398 |
+diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c |
7399 |
+index d759e7234e98..a459eac96754 100644 |
7400 |
+--- a/drivers/iommu/intel/iommu.c |
7401 |
++++ b/drivers/iommu/intel/iommu.c |
7402 |
+@@ -356,6 +356,7 @@ static int intel_iommu_strict; |
7403 |
+ static int intel_iommu_superpage = 1; |
7404 |
+ static int iommu_identity_mapping; |
7405 |
+ static int intel_no_bounce; |
7406 |
++static int iommu_skip_te_disable; |
7407 |
+ |
7408 |
+ #define IDENTMAP_GFX 2 |
7409 |
+ #define IDENTMAP_AZALIA 4 |
7410 |
+@@ -1629,6 +1630,10 @@ static void iommu_disable_translation(struct intel_iommu *iommu) |
7411 |
+ u32 sts; |
7412 |
+ unsigned long flag; |
7413 |
+ |
7414 |
++ if (iommu_skip_te_disable && iommu->drhd->gfx_dedicated && |
7415 |
++ (cap_read_drain(iommu->cap) || cap_write_drain(iommu->cap))) |
7416 |
++ return; |
7417 |
++ |
7418 |
+ raw_spin_lock_irqsave(&iommu->register_lock, flag); |
7419 |
+ iommu->gcmd &= ~DMA_GCMD_TE; |
7420 |
+ writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); |
7421 |
+@@ -4039,6 +4044,7 @@ static void __init init_no_remapping_devices(void) |
7422 |
+ |
7423 |
+ /* This IOMMU has *only* gfx devices. Either bypass it or |
7424 |
+ set the gfx_mapped flag, as appropriate */ |
7425 |
++ drhd->gfx_dedicated = 1; |
7426 |
+ if (!dmar_map_gfx) { |
7427 |
+ drhd->ignored = 1; |
7428 |
+ for_each_active_dev_scope(drhd->devices, |
7429 |
+@@ -6182,6 +6188,27 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0044, quirk_calpella_no_shadow_g |
7430 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0062, quirk_calpella_no_shadow_gtt); |
7431 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x006a, quirk_calpella_no_shadow_gtt); |
7432 |
+ |
7433 |
++static void quirk_igfx_skip_te_disable(struct pci_dev *dev) |
7434 |
++{ |
7435 |
++ unsigned short ver; |
7436 |
++ |
7437 |
++ if (!IS_GFX_DEVICE(dev)) |
7438 |
++ return; |
7439 |
++ |
7440 |
++ ver = (dev->device >> 8) & 0xff; |
7441 |
++ if (ver != 0x45 && ver != 0x46 && ver != 0x4c && |
7442 |
++ ver != 0x4e && ver != 0x8a && ver != 0x98 && |
7443 |
++ ver != 0x9a) |
7444 |
++ return; |
7445 |
++ |
7446 |
++ if (risky_device(dev)) |
7447 |
++ return; |
7448 |
++ |
7449 |
++ pci_info(dev, "Skip IOMMU disabling for graphics\n"); |
7450 |
++ iommu_skip_te_disable = 1; |
7451 |
++} |
7452 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_igfx_skip_te_disable); |
7453 |
++ |
7454 |
+ /* On Tylersburg chipsets, some BIOSes have been known to enable the |
7455 |
+ ISOCH DMAR unit for the Azalia sound device, but not give it any |
7456 |
+ TLB entries, which causes it to deadlock. Check for that. We do |
7457 |
+diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c |
7458 |
+index 9564d23d094f..aa096b333a99 100644 |
7459 |
+--- a/drivers/iommu/intel/irq_remapping.c |
7460 |
++++ b/drivers/iommu/intel/irq_remapping.c |
7461 |
+@@ -628,13 +628,21 @@ out_free_table: |
7462 |
+ |
7463 |
+ static void intel_teardown_irq_remapping(struct intel_iommu *iommu) |
7464 |
+ { |
7465 |
++ struct fwnode_handle *fn; |
7466 |
++ |
7467 |
+ if (iommu && iommu->ir_table) { |
7468 |
+ if (iommu->ir_msi_domain) { |
7469 |
++ fn = iommu->ir_msi_domain->fwnode; |
7470 |
++ |
7471 |
+ irq_domain_remove(iommu->ir_msi_domain); |
7472 |
++ irq_domain_free_fwnode(fn); |
7473 |
+ iommu->ir_msi_domain = NULL; |
7474 |
+ } |
7475 |
+ if (iommu->ir_domain) { |
7476 |
++ fn = iommu->ir_domain->fwnode; |
7477 |
++ |
7478 |
+ irq_domain_remove(iommu->ir_domain); |
7479 |
++ irq_domain_free_fwnode(fn); |
7480 |
+ iommu->ir_domain = NULL; |
7481 |
+ } |
7482 |
+ free_pages((unsigned long)iommu->ir_table->base, |
7483 |
+diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c |
7484 |
+index fd7c537fb42a..4127eeab10af 100644 |
7485 |
+--- a/drivers/irqchip/irq-bcm7038-l1.c |
7486 |
++++ b/drivers/irqchip/irq-bcm7038-l1.c |
7487 |
+@@ -327,7 +327,11 @@ static int bcm7038_l1_suspend(void) |
7488 |
+ u32 val; |
7489 |
+ |
7490 |
+ /* Wakeup interrupt should only come from the boot cpu */ |
7491 |
++#ifdef CONFIG_SMP |
7492 |
+ boot_cpu = cpu_logical_map(0); |
7493 |
++#else |
7494 |
++ boot_cpu = 0; |
7495 |
++#endif |
7496 |
+ |
7497 |
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) { |
7498 |
+ for (word = 0; word < intc->n_words; word++) { |
7499 |
+@@ -347,7 +351,11 @@ static void bcm7038_l1_resume(void) |
7500 |
+ struct bcm7038_l1_chip *intc; |
7501 |
+ int boot_cpu, word; |
7502 |
+ |
7503 |
++#ifdef CONFIG_SMP |
7504 |
+ boot_cpu = cpu_logical_map(0); |
7505 |
++#else |
7506 |
++ boot_cpu = 0; |
7507 |
++#endif |
7508 |
+ |
7509 |
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) { |
7510 |
+ for (word = 0; word < intc->n_words; word++) { |
7511 |
+diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
7512 |
+index beac4caefad9..da44bfa48bc2 100644 |
7513 |
+--- a/drivers/irqchip/irq-gic-v3-its.c |
7514 |
++++ b/drivers/irqchip/irq-gic-v3-its.c |
7515 |
+@@ -2814,7 +2814,7 @@ static int allocate_vpe_l1_table(void) |
7516 |
+ if (val & GICR_VPROPBASER_4_1_VALID) |
7517 |
+ goto out; |
7518 |
+ |
7519 |
+- gic_data_rdist()->vpe_table_mask = kzalloc(sizeof(cpumask_t), GFP_KERNEL); |
7520 |
++ gic_data_rdist()->vpe_table_mask = kzalloc(sizeof(cpumask_t), GFP_ATOMIC); |
7521 |
+ if (!gic_data_rdist()->vpe_table_mask) |
7522 |
+ return -ENOMEM; |
7523 |
+ |
7524 |
+@@ -2881,7 +2881,7 @@ static int allocate_vpe_l1_table(void) |
7525 |
+ |
7526 |
+ pr_debug("np = %d, npg = %lld, psz = %d, epp = %d, esz = %d\n", |
7527 |
+ np, npg, psz, epp, esz); |
7528 |
+- page = alloc_pages(GFP_KERNEL | __GFP_ZERO, get_order(np * PAGE_SIZE)); |
7529 |
++ page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, get_order(np * PAGE_SIZE)); |
7530 |
+ if (!page) |
7531 |
+ return -ENOMEM; |
7532 |
+ |
7533 |
+diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c |
7534 |
+index 1ece9337c78d..720cf96ae90e 100644 |
7535 |
+--- a/drivers/irqchip/irq-loongson-htvec.c |
7536 |
++++ b/drivers/irqchip/irq-loongson-htvec.c |
7537 |
+@@ -109,11 +109,14 @@ static struct irq_chip htvec_irq_chip = { |
7538 |
+ static int htvec_domain_alloc(struct irq_domain *domain, unsigned int virq, |
7539 |
+ unsigned int nr_irqs, void *arg) |
7540 |
+ { |
7541 |
++ int ret; |
7542 |
+ unsigned long hwirq; |
7543 |
+ unsigned int type, i; |
7544 |
+ struct htvec *priv = domain->host_data; |
7545 |
+ |
7546 |
+- irq_domain_translate_onecell(domain, arg, &hwirq, &type); |
7547 |
++ ret = irq_domain_translate_onecell(domain, arg, &hwirq, &type); |
7548 |
++ if (ret) |
7549 |
++ return ret; |
7550 |
+ |
7551 |
+ for (i = 0; i < nr_irqs; i++) { |
7552 |
+ irq_domain_set_info(domain, virq + i, hwirq + i, &htvec_irq_chip, |
7553 |
+@@ -192,7 +195,7 @@ static int htvec_of_init(struct device_node *node, |
7554 |
+ if (!priv->htvec_domain) { |
7555 |
+ pr_err("Failed to create IRQ domain\n"); |
7556 |
+ err = -ENOMEM; |
7557 |
+- goto iounmap_base; |
7558 |
++ goto irq_dispose; |
7559 |
+ } |
7560 |
+ |
7561 |
+ htvec_reset(priv); |
7562 |
+@@ -203,6 +206,9 @@ static int htvec_of_init(struct device_node *node, |
7563 |
+ |
7564 |
+ return 0; |
7565 |
+ |
7566 |
++irq_dispose: |
7567 |
++ for (; i > 0; i--) |
7568 |
++ irq_dispose_mapping(parent_irq[i - 1]); |
7569 |
+ iounmap_base: |
7570 |
+ iounmap(priv->base); |
7571 |
+ free_priv: |
7572 |
+diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c |
7573 |
+index 63b61474a0cc..6ef86a334c62 100644 |
7574 |
+--- a/drivers/irqchip/irq-loongson-liointc.c |
7575 |
++++ b/drivers/irqchip/irq-loongson-liointc.c |
7576 |
+@@ -114,6 +114,7 @@ static int liointc_set_type(struct irq_data *data, unsigned int type) |
7577 |
+ liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false); |
7578 |
+ break; |
7579 |
+ default: |
7580 |
++ irq_gc_unlock_irqrestore(gc, flags); |
7581 |
+ return -EINVAL; |
7582 |
+ } |
7583 |
+ irq_gc_unlock_irqrestore(gc, flags); |
7584 |
+diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c |
7585 |
+index 2a05b9305012..9bf6b9a5f734 100644 |
7586 |
+--- a/drivers/irqchip/irq-loongson-pch-pic.c |
7587 |
++++ b/drivers/irqchip/irq-loongson-pch-pic.c |
7588 |
+@@ -64,15 +64,6 @@ static void pch_pic_bitclr(struct pch_pic *priv, int offset, int bit) |
7589 |
+ raw_spin_unlock(&priv->pic_lock); |
7590 |
+ } |
7591 |
+ |
7592 |
+-static void pch_pic_eoi_irq(struct irq_data *d) |
7593 |
+-{ |
7594 |
+- u32 idx = PIC_REG_IDX(d->hwirq); |
7595 |
+- struct pch_pic *priv = irq_data_get_irq_chip_data(d); |
7596 |
+- |
7597 |
+- writel(BIT(PIC_REG_BIT(d->hwirq)), |
7598 |
+- priv->base + PCH_PIC_CLR + idx * 4); |
7599 |
+-} |
7600 |
+- |
7601 |
+ static void pch_pic_mask_irq(struct irq_data *d) |
7602 |
+ { |
7603 |
+ struct pch_pic *priv = irq_data_get_irq_chip_data(d); |
7604 |
+@@ -85,6 +76,9 @@ static void pch_pic_unmask_irq(struct irq_data *d) |
7605 |
+ { |
7606 |
+ struct pch_pic *priv = irq_data_get_irq_chip_data(d); |
7607 |
+ |
7608 |
++ writel(BIT(PIC_REG_BIT(d->hwirq)), |
7609 |
++ priv->base + PCH_PIC_CLR + PIC_REG_IDX(d->hwirq) * 4); |
7610 |
++ |
7611 |
+ irq_chip_unmask_parent(d); |
7612 |
+ pch_pic_bitclr(priv, PCH_PIC_MASK, d->hwirq); |
7613 |
+ } |
7614 |
+@@ -124,7 +118,6 @@ static struct irq_chip pch_pic_irq_chip = { |
7615 |
+ .irq_mask = pch_pic_mask_irq, |
7616 |
+ .irq_unmask = pch_pic_unmask_irq, |
7617 |
+ .irq_ack = irq_chip_ack_parent, |
7618 |
+- .irq_eoi = pch_pic_eoi_irq, |
7619 |
+ .irq_set_affinity = irq_chip_set_affinity_parent, |
7620 |
+ .irq_set_type = pch_pic_set_type, |
7621 |
+ }; |
7622 |
+@@ -135,22 +128,25 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq, |
7623 |
+ int err; |
7624 |
+ unsigned int type; |
7625 |
+ unsigned long hwirq; |
7626 |
+- struct irq_fwspec fwspec; |
7627 |
++ struct irq_fwspec *fwspec = arg; |
7628 |
++ struct irq_fwspec parent_fwspec; |
7629 |
+ struct pch_pic *priv = domain->host_data; |
7630 |
+ |
7631 |
+- irq_domain_translate_twocell(domain, arg, &hwirq, &type); |
7632 |
++ err = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); |
7633 |
++ if (err) |
7634 |
++ return err; |
7635 |
+ |
7636 |
+- fwspec.fwnode = domain->parent->fwnode; |
7637 |
+- fwspec.param_count = 1; |
7638 |
+- fwspec.param[0] = hwirq + priv->ht_vec_base; |
7639 |
++ parent_fwspec.fwnode = domain->parent->fwnode; |
7640 |
++ parent_fwspec.param_count = 1; |
7641 |
++ parent_fwspec.param[0] = hwirq + priv->ht_vec_base; |
7642 |
+ |
7643 |
+- err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); |
7644 |
++ err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec); |
7645 |
+ if (err) |
7646 |
+ return err; |
7647 |
+ |
7648 |
+ irq_domain_set_info(domain, virq, hwirq, |
7649 |
+ &pch_pic_irq_chip, priv, |
7650 |
+- handle_fasteoi_ack_irq, NULL, NULL); |
7651 |
++ handle_level_irq, NULL, NULL); |
7652 |
+ irq_set_probe(virq); |
7653 |
+ |
7654 |
+ return 0; |
7655 |
+diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c |
7656 |
+index 73eae5966a40..6ff98b87e5c0 100644 |
7657 |
+--- a/drivers/irqchip/irq-mtk-sysirq.c |
7658 |
++++ b/drivers/irqchip/irq-mtk-sysirq.c |
7659 |
+@@ -15,7 +15,7 @@ |
7660 |
+ #include <linux/spinlock.h> |
7661 |
+ |
7662 |
+ struct mtk_sysirq_chip_data { |
7663 |
+- spinlock_t lock; |
7664 |
++ raw_spinlock_t lock; |
7665 |
+ u32 nr_intpol_bases; |
7666 |
+ void __iomem **intpol_bases; |
7667 |
+ u32 *intpol_words; |
7668 |
+@@ -37,7 +37,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) |
7669 |
+ reg_index = chip_data->which_word[hwirq]; |
7670 |
+ offset = hwirq & 0x1f; |
7671 |
+ |
7672 |
+- spin_lock_irqsave(&chip_data->lock, flags); |
7673 |
++ raw_spin_lock_irqsave(&chip_data->lock, flags); |
7674 |
+ value = readl_relaxed(base + reg_index * 4); |
7675 |
+ if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_EDGE_FALLING) { |
7676 |
+ if (type == IRQ_TYPE_LEVEL_LOW) |
7677 |
+@@ -53,7 +53,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) |
7678 |
+ |
7679 |
+ data = data->parent_data; |
7680 |
+ ret = data->chip->irq_set_type(data, type); |
7681 |
+- spin_unlock_irqrestore(&chip_data->lock, flags); |
7682 |
++ raw_spin_unlock_irqrestore(&chip_data->lock, flags); |
7683 |
+ return ret; |
7684 |
+ } |
7685 |
+ |
7686 |
+@@ -212,7 +212,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, |
7687 |
+ ret = -ENOMEM; |
7688 |
+ goto out_free_which_word; |
7689 |
+ } |
7690 |
+- spin_lock_init(&chip_data->lock); |
7691 |
++ raw_spin_lock_init(&chip_data->lock); |
7692 |
+ |
7693 |
+ return 0; |
7694 |
+ |
7695 |
+diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c |
7696 |
+index 7e3ebf6ed2cd..be0a35d91796 100644 |
7697 |
+--- a/drivers/irqchip/irq-ti-sci-inta.c |
7698 |
++++ b/drivers/irqchip/irq-ti-sci-inta.c |
7699 |
+@@ -572,7 +572,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) |
7700 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
7701 |
+ inta->base = devm_ioremap_resource(dev, res); |
7702 |
+ if (IS_ERR(inta->base)) |
7703 |
+- return -ENODEV; |
7704 |
++ return PTR_ERR(inta->base); |
7705 |
+ |
7706 |
+ domain = irq_domain_add_linear(dev_of_node(dev), |
7707 |
+ ti_sci_get_num_resources(inta->vint), |
7708 |
+diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c |
7709 |
+index 3363a6551a70..cc3929f858b6 100644 |
7710 |
+--- a/drivers/leds/led-class.c |
7711 |
++++ b/drivers/leds/led-class.c |
7712 |
+@@ -173,6 +173,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev) |
7713 |
+ { |
7714 |
+ led_cdev->flags |= LED_SUSPENDED; |
7715 |
+ led_set_brightness_nopm(led_cdev, 0); |
7716 |
++ flush_work(&led_cdev->set_brightness_work); |
7717 |
+ } |
7718 |
+ EXPORT_SYMBOL_GPL(led_classdev_suspend); |
7719 |
+ |
7720 |
+diff --git a/drivers/leds/leds-lm355x.c b/drivers/leds/leds-lm355x.c |
7721 |
+index 11ce05249751..b2eb2e1e9c04 100644 |
7722 |
+--- a/drivers/leds/leds-lm355x.c |
7723 |
++++ b/drivers/leds/leds-lm355x.c |
7724 |
+@@ -164,18 +164,19 @@ static int lm355x_chip_init(struct lm355x_chip_data *chip) |
7725 |
+ /* input and output pins configuration */ |
7726 |
+ switch (chip->type) { |
7727 |
+ case CHIP_LM3554: |
7728 |
+- reg_val = pdata->pin_tx2 | pdata->ntc_pin; |
7729 |
++ reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin; |
7730 |
+ ret = regmap_update_bits(chip->regmap, 0xE0, 0x28, reg_val); |
7731 |
+ if (ret < 0) |
7732 |
+ goto out; |
7733 |
+- reg_val = pdata->pass_mode; |
7734 |
++ reg_val = (u32)pdata->pass_mode; |
7735 |
+ ret = regmap_update_bits(chip->regmap, 0xA0, 0x04, reg_val); |
7736 |
+ if (ret < 0) |
7737 |
+ goto out; |
7738 |
+ break; |
7739 |
+ |
7740 |
+ case CHIP_LM3556: |
7741 |
+- reg_val = pdata->pin_tx2 | pdata->ntc_pin | pdata->pass_mode; |
7742 |
++ reg_val = (u32)pdata->pin_tx2 | (u32)pdata->ntc_pin | |
7743 |
++ (u32)pdata->pass_mode; |
7744 |
+ ret = regmap_update_bits(chip->regmap, 0x0A, 0xC4, reg_val); |
7745 |
+ if (ret < 0) |
7746 |
+ goto out; |
7747 |
+diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c |
7748 |
+index ac824d7b2dcf..6aa903529570 100644 |
7749 |
+--- a/drivers/macintosh/via-macii.c |
7750 |
++++ b/drivers/macintosh/via-macii.c |
7751 |
+@@ -270,15 +270,12 @@ static int macii_autopoll(int devs) |
7752 |
+ unsigned long flags; |
7753 |
+ int err = 0; |
7754 |
+ |
7755 |
++ local_irq_save(flags); |
7756 |
++ |
7757 |
+ /* bit 1 == device 1, and so on. */ |
7758 |
+ autopoll_devs = devs & 0xFFFE; |
7759 |
+ |
7760 |
+- if (!autopoll_devs) |
7761 |
+- return 0; |
7762 |
+- |
7763 |
+- local_irq_save(flags); |
7764 |
+- |
7765 |
+- if (current_req == NULL) { |
7766 |
++ if (autopoll_devs && !current_req) { |
7767 |
+ /* Send a Talk Reg 0. The controller will repeatedly transmit |
7768 |
+ * this as long as it is idle. |
7769 |
+ */ |
7770 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
7771 |
+index 2014016f9a60..445bb84ee27f 100644 |
7772 |
+--- a/drivers/md/bcache/super.c |
7773 |
++++ b/drivers/md/bcache/super.c |
7774 |
+@@ -2100,7 +2100,14 @@ found: |
7775 |
+ sysfs_create_link(&c->kobj, &ca->kobj, buf)) |
7776 |
+ goto err; |
7777 |
+ |
7778 |
+- if (ca->sb.seq > c->sb.seq) { |
7779 |
++ /* |
7780 |
++ * A special case is both ca->sb.seq and c->sb.seq are 0, |
7781 |
++ * such condition happens on a new created cache device whose |
7782 |
++ * super block is never flushed yet. In this case c->sb.version |
7783 |
++ * and other members should be updated too, otherwise we will |
7784 |
++ * have a mistaken super block version in cache set. |
7785 |
++ */ |
7786 |
++ if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) { |
7787 |
+ c->sb.version = ca->sb.version; |
7788 |
+ memcpy(c->sb.set_uuid, ca->sb.set_uuid, 16); |
7789 |
+ c->sb.flags = ca->sb.flags; |
7790 |
+diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c |
7791 |
+index 813a99ffa86f..73fd50e77975 100644 |
7792 |
+--- a/drivers/md/md-cluster.c |
7793 |
++++ b/drivers/md/md-cluster.c |
7794 |
+@@ -1518,6 +1518,7 @@ static void unlock_all_bitmaps(struct mddev *mddev) |
7795 |
+ } |
7796 |
+ } |
7797 |
+ kfree(cinfo->other_bitmap_lockres); |
7798 |
++ cinfo->other_bitmap_lockres = NULL; |
7799 |
+ } |
7800 |
+ } |
7801 |
+ |
7802 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
7803 |
+index f567f536b529..90756450b958 100644 |
7804 |
+--- a/drivers/md/md.c |
7805 |
++++ b/drivers/md/md.c |
7806 |
+@@ -470,17 +470,18 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) |
7807 |
+ struct mddev *mddev = bio->bi_disk->private_data; |
7808 |
+ unsigned int sectors; |
7809 |
+ |
7810 |
+- if (unlikely(test_bit(MD_BROKEN, &mddev->flags)) && (rw == WRITE)) { |
7811 |
++ if (mddev == NULL || mddev->pers == NULL) { |
7812 |
+ bio_io_error(bio); |
7813 |
+ return BLK_QC_T_NONE; |
7814 |
+ } |
7815 |
+ |
7816 |
+- blk_queue_split(q, &bio); |
7817 |
+- |
7818 |
+- if (mddev == NULL || mddev->pers == NULL) { |
7819 |
++ if (unlikely(test_bit(MD_BROKEN, &mddev->flags)) && (rw == WRITE)) { |
7820 |
+ bio_io_error(bio); |
7821 |
+ return BLK_QC_T_NONE; |
7822 |
+ } |
7823 |
++ |
7824 |
++ blk_queue_split(q, &bio); |
7825 |
++ |
7826 |
+ if (mddev->ro == 1 && unlikely(rw == WRITE)) { |
7827 |
+ if (bio_sectors(bio) != 0) |
7828 |
+ bio->bi_status = BLK_STS_IOERR; |
7829 |
+diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c |
7830 |
+index 0e7e2772f08f..2d95e16cd248 100644 |
7831 |
+--- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c |
7832 |
++++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c |
7833 |
+@@ -277,11 +277,7 @@ static int cros_ec_cec_probe(struct platform_device *pdev) |
7834 |
+ platform_set_drvdata(pdev, cros_ec_cec); |
7835 |
+ cros_ec_cec->cros_ec = cros_ec; |
7836 |
+ |
7837 |
+- ret = device_init_wakeup(&pdev->dev, 1); |
7838 |
+- if (ret) { |
7839 |
+- dev_err(&pdev->dev, "failed to initialize wakeup\n"); |
7840 |
+- return ret; |
7841 |
+- } |
7842 |
++ device_init_wakeup(&pdev->dev, 1); |
7843 |
+ |
7844 |
+ cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec, |
7845 |
+ DRV_NAME, |
7846 |
+diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c |
7847 |
+index 97144734eb05..3f1ca40b9b98 100644 |
7848 |
+--- a/drivers/media/firewire/firedtv-fw.c |
7849 |
++++ b/drivers/media/firewire/firedtv-fw.c |
7850 |
+@@ -272,6 +272,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
7851 |
+ |
7852 |
+ name_len = fw_csr_string(unit->directory, CSR_MODEL, |
7853 |
+ name, sizeof(name)); |
7854 |
++ if (name_len < 0) |
7855 |
++ return name_len; |
7856 |
+ for (i = ARRAY_SIZE(model_names); --i; ) |
7857 |
+ if (strlen(model_names[i]) <= name_len && |
7858 |
+ strncmp(name, model_names[i], name_len) == 0) |
7859 |
+diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c |
7860 |
+index eb39cf5ea089..9df575238952 100644 |
7861 |
+--- a/drivers/media/i2c/tvp5150.c |
7862 |
++++ b/drivers/media/i2c/tvp5150.c |
7863 |
+@@ -1664,8 +1664,10 @@ static int tvp5150_registered(struct v4l2_subdev *sd) |
7864 |
+ return 0; |
7865 |
+ |
7866 |
+ err: |
7867 |
+- for (i = 0; i < decoder->connectors_num; i++) |
7868 |
++ for (i = 0; i < decoder->connectors_num; i++) { |
7869 |
+ media_device_unregister_entity(&decoder->connectors[i].ent); |
7870 |
++ media_entity_cleanup(&decoder->connectors[i].ent); |
7871 |
++ } |
7872 |
+ return ret; |
7873 |
+ #endif |
7874 |
+ |
7875 |
+@@ -2248,8 +2250,10 @@ static int tvp5150_remove(struct i2c_client *c) |
7876 |
+ |
7877 |
+ for (i = 0; i < decoder->connectors_num; i++) |
7878 |
+ v4l2_fwnode_connector_free(&decoder->connectors[i].base); |
7879 |
+- for (i = 0; i < decoder->connectors_num; i++) |
7880 |
++ for (i = 0; i < decoder->connectors_num; i++) { |
7881 |
+ media_device_unregister_entity(&decoder->connectors[i].ent); |
7882 |
++ media_entity_cleanup(&decoder->connectors[i].ent); |
7883 |
++ } |
7884 |
+ v4l2_async_unregister_subdev(sd); |
7885 |
+ v4l2_ctrl_handler_free(&decoder->hdl); |
7886 |
+ pm_runtime_disable(&c->dev); |
7887 |
+diff --git a/drivers/media/mc/mc-request.c b/drivers/media/mc/mc-request.c |
7888 |
+index e3fca436c75b..c0782fd96c59 100644 |
7889 |
+--- a/drivers/media/mc/mc-request.c |
7890 |
++++ b/drivers/media/mc/mc-request.c |
7891 |
+@@ -296,9 +296,18 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) |
7892 |
+ if (WARN_ON(!mdev->ops->req_alloc ^ !mdev->ops->req_free)) |
7893 |
+ return -ENOMEM; |
7894 |
+ |
7895 |
++ if (mdev->ops->req_alloc) |
7896 |
++ req = mdev->ops->req_alloc(mdev); |
7897 |
++ else |
7898 |
++ req = kzalloc(sizeof(*req), GFP_KERNEL); |
7899 |
++ if (!req) |
7900 |
++ return -ENOMEM; |
7901 |
++ |
7902 |
+ fd = get_unused_fd_flags(O_CLOEXEC); |
7903 |
+- if (fd < 0) |
7904 |
+- return fd; |
7905 |
++ if (fd < 0) { |
7906 |
++ ret = fd; |
7907 |
++ goto err_free_req; |
7908 |
++ } |
7909 |
+ |
7910 |
+ filp = anon_inode_getfile("request", &request_fops, NULL, O_CLOEXEC); |
7911 |
+ if (IS_ERR(filp)) { |
7912 |
+@@ -306,15 +315,6 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) |
7913 |
+ goto err_put_fd; |
7914 |
+ } |
7915 |
+ |
7916 |
+- if (mdev->ops->req_alloc) |
7917 |
+- req = mdev->ops->req_alloc(mdev); |
7918 |
+- else |
7919 |
+- req = kzalloc(sizeof(*req), GFP_KERNEL); |
7920 |
+- if (!req) { |
7921 |
+- ret = -ENOMEM; |
7922 |
+- goto err_fput; |
7923 |
+- } |
7924 |
+- |
7925 |
+ filp->private_data = req; |
7926 |
+ req->mdev = mdev; |
7927 |
+ req->state = MEDIA_REQUEST_STATE_IDLE; |
7928 |
+@@ -336,12 +336,15 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) |
7929 |
+ |
7930 |
+ return 0; |
7931 |
+ |
7932 |
+-err_fput: |
7933 |
+- fput(filp); |
7934 |
+- |
7935 |
+ err_put_fd: |
7936 |
+ put_unused_fd(fd); |
7937 |
+ |
7938 |
++err_free_req: |
7939 |
++ if (mdev->ops->req_free) |
7940 |
++ mdev->ops->req_free(req); |
7941 |
++ else |
7942 |
++ kfree(req); |
7943 |
++ |
7944 |
+ return ret; |
7945 |
+ } |
7946 |
+ |
7947 |
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c |
7948 |
+index 9aaf3b8060d5..9c31d950cddf 100644 |
7949 |
+--- a/drivers/media/platform/exynos4-is/media-dev.c |
7950 |
++++ b/drivers/media/platform/exynos4-is/media-dev.c |
7951 |
+@@ -1270,6 +1270,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd) |
7952 |
+ |
7953 |
+ pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl, |
7954 |
+ PINCTRL_STATE_IDLE); |
7955 |
++ if (IS_ERR(pctl->state_idle)) |
7956 |
++ return PTR_ERR(pctl->state_idle); |
7957 |
++ |
7958 |
+ return 0; |
7959 |
+ } |
7960 |
+ |
7961 |
+diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c |
7962 |
+index 09775b6624c6..326e79b8531c 100644 |
7963 |
+--- a/drivers/media/platform/marvell-ccic/mcam-core.c |
7964 |
++++ b/drivers/media/platform/marvell-ccic/mcam-core.c |
7965 |
+@@ -1940,6 +1940,7 @@ int mccic_register(struct mcam_camera *cam) |
7966 |
+ out: |
7967 |
+ v4l2_async_notifier_unregister(&cam->notifier); |
7968 |
+ v4l2_device_unregister(&cam->v4l2_dev); |
7969 |
++ v4l2_async_notifier_cleanup(&cam->notifier); |
7970 |
+ return ret; |
7971 |
+ } |
7972 |
+ EXPORT_SYMBOL_GPL(mccic_register); |
7973 |
+@@ -1961,6 +1962,7 @@ void mccic_shutdown(struct mcam_camera *cam) |
7974 |
+ v4l2_ctrl_handler_free(&cam->ctrl_handler); |
7975 |
+ v4l2_async_notifier_unregister(&cam->notifier); |
7976 |
+ v4l2_device_unregister(&cam->v4l2_dev); |
7977 |
++ v4l2_async_notifier_cleanup(&cam->notifier); |
7978 |
+ } |
7979 |
+ EXPORT_SYMBOL_GPL(mccic_shutdown); |
7980 |
+ |
7981 |
+diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c |
7982 |
+index 58abfbdfb82d..90b6d939f3ad 100644 |
7983 |
+--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c |
7984 |
++++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c |
7985 |
+@@ -96,6 +96,7 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, |
7986 |
+ { |
7987 |
+ struct device_node *larb_node; |
7988 |
+ struct platform_device *larb_pdev; |
7989 |
++ int ret; |
7990 |
+ int i; |
7991 |
+ |
7992 |
+ if (comp_id < 0 || comp_id >= MTK_MDP_COMP_ID_MAX) { |
7993 |
+@@ -113,8 +114,8 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, |
7994 |
+ if (IS_ERR(comp->clk[i])) { |
7995 |
+ if (PTR_ERR(comp->clk[i]) != -EPROBE_DEFER) |
7996 |
+ dev_err(dev, "Failed to get clock\n"); |
7997 |
+- |
7998 |
+- return PTR_ERR(comp->clk[i]); |
7999 |
++ ret = PTR_ERR(comp->clk[i]); |
8000 |
++ goto put_dev; |
8001 |
+ } |
8002 |
+ |
8003 |
+ /* Only RDMA needs two clocks */ |
8004 |
+@@ -133,20 +134,27 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, |
8005 |
+ if (!larb_node) { |
8006 |
+ dev_err(dev, |
8007 |
+ "Missing mediadek,larb phandle in %pOF node\n", node); |
8008 |
+- return -EINVAL; |
8009 |
++ ret = -EINVAL; |
8010 |
++ goto put_dev; |
8011 |
+ } |
8012 |
+ |
8013 |
+ larb_pdev = of_find_device_by_node(larb_node); |
8014 |
+ if (!larb_pdev) { |
8015 |
+ dev_warn(dev, "Waiting for larb device %pOF\n", larb_node); |
8016 |
+ of_node_put(larb_node); |
8017 |
+- return -EPROBE_DEFER; |
8018 |
++ ret = -EPROBE_DEFER; |
8019 |
++ goto put_dev; |
8020 |
+ } |
8021 |
+ of_node_put(larb_node); |
8022 |
+ |
8023 |
+ comp->larb_dev = &larb_pdev->dev; |
8024 |
+ |
8025 |
+ return 0; |
8026 |
++ |
8027 |
++put_dev: |
8028 |
++ of_node_put(comp->dev_node); |
8029 |
++ |
8030 |
++ return ret; |
8031 |
+ } |
8032 |
+ |
8033 |
+ void mtk_mdp_comp_deinit(struct device *dev, struct mtk_mdp_comp *comp) |
8034 |
+diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c |
8035 |
+index 4dbdf3180d10..607b7685c982 100644 |
8036 |
+--- a/drivers/media/platform/omap3isp/isppreview.c |
8037 |
++++ b/drivers/media/platform/omap3isp/isppreview.c |
8038 |
+@@ -2287,7 +2287,7 @@ static int preview_init_entities(struct isp_prev_device *prev) |
8039 |
+ me->ops = &preview_media_ops; |
8040 |
+ ret = media_entity_pads_init(me, PREV_PADS_NUM, pads); |
8041 |
+ if (ret < 0) |
8042 |
+- return ret; |
8043 |
++ goto error_handler_free; |
8044 |
+ |
8045 |
+ preview_init_formats(sd, NULL); |
8046 |
+ |
8047 |
+@@ -2320,6 +2320,8 @@ error_video_out: |
8048 |
+ omap3isp_video_cleanup(&prev->video_in); |
8049 |
+ error_video_in: |
8050 |
+ media_entity_cleanup(&prev->subdev.entity); |
8051 |
++error_handler_free: |
8052 |
++ v4l2_ctrl_handler_free(&prev->ctrls); |
8053 |
+ return ret; |
8054 |
+ } |
8055 |
+ |
8056 |
+diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c |
8057 |
+index 6932fd47071b..15bcb7f6e113 100644 |
8058 |
+--- a/drivers/media/platform/s5p-g2d/g2d.c |
8059 |
++++ b/drivers/media/platform/s5p-g2d/g2d.c |
8060 |
+@@ -695,21 +695,13 @@ static int g2d_probe(struct platform_device *pdev) |
8061 |
+ vfd->lock = &dev->mutex; |
8062 |
+ vfd->v4l2_dev = &dev->v4l2_dev; |
8063 |
+ vfd->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING; |
8064 |
+- ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0); |
8065 |
+- if (ret) { |
8066 |
+- v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
8067 |
+- goto rel_vdev; |
8068 |
+- } |
8069 |
+- video_set_drvdata(vfd, dev); |
8070 |
+- dev->vfd = vfd; |
8071 |
+- v4l2_info(&dev->v4l2_dev, "device registered as /dev/video%d\n", |
8072 |
+- vfd->num); |
8073 |
++ |
8074 |
+ platform_set_drvdata(pdev, dev); |
8075 |
+ dev->m2m_dev = v4l2_m2m_init(&g2d_m2m_ops); |
8076 |
+ if (IS_ERR(dev->m2m_dev)) { |
8077 |
+ v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); |
8078 |
+ ret = PTR_ERR(dev->m2m_dev); |
8079 |
+- goto unreg_video_dev; |
8080 |
++ goto rel_vdev; |
8081 |
+ } |
8082 |
+ |
8083 |
+ def_frame.stride = (def_frame.width * def_frame.fmt->depth) >> 3; |
8084 |
+@@ -717,14 +709,24 @@ static int g2d_probe(struct platform_device *pdev) |
8085 |
+ of_id = of_match_node(exynos_g2d_match, pdev->dev.of_node); |
8086 |
+ if (!of_id) { |
8087 |
+ ret = -ENODEV; |
8088 |
+- goto unreg_video_dev; |
8089 |
++ goto free_m2m; |
8090 |
+ } |
8091 |
+ dev->variant = (struct g2d_variant *)of_id->data; |
8092 |
+ |
8093 |
++ ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0); |
8094 |
++ if (ret) { |
8095 |
++ v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
8096 |
++ goto free_m2m; |
8097 |
++ } |
8098 |
++ video_set_drvdata(vfd, dev); |
8099 |
++ dev->vfd = vfd; |
8100 |
++ v4l2_info(&dev->v4l2_dev, "device registered as /dev/video%d\n", |
8101 |
++ vfd->num); |
8102 |
++ |
8103 |
+ return 0; |
8104 |
+ |
8105 |
+-unreg_video_dev: |
8106 |
+- video_unregister_device(dev->vfd); |
8107 |
++free_m2m: |
8108 |
++ v4l2_m2m_release(dev->m2m_dev); |
8109 |
+ rel_vdev: |
8110 |
+ video_device_release(vfd); |
8111 |
+ unreg_v4l2_dev: |
8112 |
+diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig |
8113 |
+index 15d29c91662f..25ba03edcb5c 100644 |
8114 |
+--- a/drivers/media/usb/dvb-usb/Kconfig |
8115 |
++++ b/drivers/media/usb/dvb-usb/Kconfig |
8116 |
+@@ -151,6 +151,7 @@ config DVB_USB_CXUSB |
8117 |
+ config DVB_USB_CXUSB_ANALOG |
8118 |
+ bool "Analog support for the Conexant USB2.0 hybrid reference design" |
8119 |
+ depends on DVB_USB_CXUSB && VIDEO_V4L2 |
8120 |
++ depends on VIDEO_V4L2=y || VIDEO_V4L2=DVB_USB_CXUSB |
8121 |
+ select VIDEO_CX25840 |
8122 |
+ select VIDEOBUF2_VMALLOC |
8123 |
+ help |
8124 |
+diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c |
8125 |
+index f889c9d740cd..dbf0455d5d50 100644 |
8126 |
+--- a/drivers/media/usb/go7007/go7007-usb.c |
8127 |
++++ b/drivers/media/usb/go7007/go7007-usb.c |
8128 |
+@@ -1132,6 +1132,10 @@ static int go7007_usb_probe(struct usb_interface *intf, |
8129 |
+ go->hpi_ops = &go7007_usb_onboard_hpi_ops; |
8130 |
+ go->hpi_context = usb; |
8131 |
+ |
8132 |
++ ep = usb->usbdev->ep_in[4]; |
8133 |
++ if (!ep) |
8134 |
++ return -ENODEV; |
8135 |
++ |
8136 |
+ /* Allocate the URB and buffer for receiving incoming interrupts */ |
8137 |
+ usb->intr_urb = usb_alloc_urb(0, GFP_KERNEL); |
8138 |
+ if (usb->intr_urb == NULL) |
8139 |
+@@ -1141,7 +1145,6 @@ static int go7007_usb_probe(struct usb_interface *intf, |
8140 |
+ if (usb->intr_urb->transfer_buffer == NULL) |
8141 |
+ goto allocfail; |
8142 |
+ |
8143 |
+- ep = usb->usbdev->ep_in[4]; |
8144 |
+ if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) |
8145 |
+ usb_fill_bulk_urb(usb->intr_urb, usb->usbdev, |
8146 |
+ usb_rcvbulkpipe(usb->usbdev, 4), |
8147 |
+@@ -1263,9 +1266,13 @@ static int go7007_usb_probe(struct usb_interface *intf, |
8148 |
+ |
8149 |
+ /* Allocate the URBs and buffers for receiving the video stream */ |
8150 |
+ if (board->flags & GO7007_USB_EZUSB) { |
8151 |
++ if (!usb->usbdev->ep_in[6]) |
8152 |
++ goto allocfail; |
8153 |
+ v_urb_len = 1024; |
8154 |
+ video_pipe = usb_rcvbulkpipe(usb->usbdev, 6); |
8155 |
+ } else { |
8156 |
++ if (!usb->usbdev->ep_in[1]) |
8157 |
++ goto allocfail; |
8158 |
+ v_urb_len = 512; |
8159 |
+ video_pipe = usb_rcvbulkpipe(usb->usbdev, 1); |
8160 |
+ } |
8161 |
+@@ -1285,6 +1292,8 @@ static int go7007_usb_probe(struct usb_interface *intf, |
8162 |
+ /* Allocate the URBs and buffers for receiving the audio stream */ |
8163 |
+ if ((board->flags & GO7007_USB_EZUSB) && |
8164 |
+ (board->main_info.flags & GO7007_BOARD_HAS_AUDIO)) { |
8165 |
++ if (!usb->usbdev->ep_in[8]) |
8166 |
++ goto allocfail; |
8167 |
+ for (i = 0; i < 8; ++i) { |
8168 |
+ usb->audio_urbs[i] = usb_alloc_urb(0, GFP_KERNEL); |
8169 |
+ if (usb->audio_urbs[i] == NULL) |
8170 |
+diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c |
8171 |
+index 25196d6268e2..85b31d3de57a 100644 |
8172 |
+--- a/drivers/memory/samsung/exynos5422-dmc.c |
8173 |
++++ b/drivers/memory/samsung/exynos5422-dmc.c |
8174 |
+@@ -270,12 +270,14 @@ static int find_target_freq_idx(struct exynos5_dmc *dmc, |
8175 |
+ * This function switches between these banks according to the |
8176 |
+ * currently used clock source. |
8177 |
+ */ |
8178 |
+-static void exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) |
8179 |
++static int exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) |
8180 |
+ { |
8181 |
+ unsigned int reg; |
8182 |
+ int ret; |
8183 |
+ |
8184 |
+ ret = regmap_read(dmc->clk_regmap, CDREX_LPDDR3PHY_CON3, ®); |
8185 |
++ if (ret) |
8186 |
++ return ret; |
8187 |
+ |
8188 |
+ if (set) |
8189 |
+ reg |= EXYNOS5_TIMING_SET_SWI; |
8190 |
+@@ -283,6 +285,8 @@ static void exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) |
8191 |
+ reg &= ~EXYNOS5_TIMING_SET_SWI; |
8192 |
+ |
8193 |
+ regmap_write(dmc->clk_regmap, CDREX_LPDDR3PHY_CON3, reg); |
8194 |
++ |
8195 |
++ return 0; |
8196 |
+ } |
8197 |
+ |
8198 |
+ /** |
8199 |
+@@ -516,7 +520,7 @@ exynos5_dmc_switch_to_bypass_configuration(struct exynos5_dmc *dmc, |
8200 |
+ /* |
8201 |
+ * Delays are long enough, so use them for the new coming clock. |
8202 |
+ */ |
8203 |
+- exynos5_switch_timing_regs(dmc, USE_MX_MSPLL_TIMINGS); |
8204 |
++ ret = exynos5_switch_timing_regs(dmc, USE_MX_MSPLL_TIMINGS); |
8205 |
+ |
8206 |
+ return ret; |
8207 |
+ } |
8208 |
+@@ -577,7 +581,9 @@ exynos5_dmc_change_freq_and_volt(struct exynos5_dmc *dmc, |
8209 |
+ |
8210 |
+ clk_set_rate(dmc->fout_bpll, target_rate); |
8211 |
+ |
8212 |
+- exynos5_switch_timing_regs(dmc, USE_BPLL_TIMINGS); |
8213 |
++ ret = exynos5_switch_timing_regs(dmc, USE_BPLL_TIMINGS); |
8214 |
++ if (ret) |
8215 |
++ goto disable_clocks; |
8216 |
+ |
8217 |
+ ret = clk_set_parent(dmc->mout_mclk_cdrex, dmc->mout_bpll); |
8218 |
+ if (ret) |
8219 |
+diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c |
8220 |
+index 97f26bc77ad4..c900948881d5 100644 |
8221 |
+--- a/drivers/memory/tegra/tegra186-emc.c |
8222 |
++++ b/drivers/memory/tegra/tegra186-emc.c |
8223 |
+@@ -185,7 +185,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
8224 |
+ if (IS_ERR(emc->clk)) { |
8225 |
+ err = PTR_ERR(emc->clk); |
8226 |
+ dev_err(&pdev->dev, "failed to get EMC clock: %d\n", err); |
8227 |
+- return err; |
8228 |
++ goto put_bpmp; |
8229 |
+ } |
8230 |
+ |
8231 |
+ platform_set_drvdata(pdev, emc); |
8232 |
+@@ -201,7 +201,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
8233 |
+ err = tegra_bpmp_transfer(emc->bpmp, &msg); |
8234 |
+ if (err < 0) { |
8235 |
+ dev_err(&pdev->dev, "failed to EMC DVFS pairs: %d\n", err); |
8236 |
+- return err; |
8237 |
++ goto put_bpmp; |
8238 |
+ } |
8239 |
+ |
8240 |
+ emc->debugfs.min_rate = ULONG_MAX; |
8241 |
+@@ -211,8 +211,10 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
8242 |
+ |
8243 |
+ emc->dvfs = devm_kmalloc_array(&pdev->dev, emc->num_dvfs, |
8244 |
+ sizeof(*emc->dvfs), GFP_KERNEL); |
8245 |
+- if (!emc->dvfs) |
8246 |
+- return -ENOMEM; |
8247 |
++ if (!emc->dvfs) { |
8248 |
++ err = -ENOMEM; |
8249 |
++ goto put_bpmp; |
8250 |
++ } |
8251 |
+ |
8252 |
+ dev_dbg(&pdev->dev, "%u DVFS pairs:\n", emc->num_dvfs); |
8253 |
+ |
8254 |
+@@ -237,7 +239,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
8255 |
+ "failed to set rate range [%lu-%lu] for %pC\n", |
8256 |
+ emc->debugfs.min_rate, emc->debugfs.max_rate, |
8257 |
+ emc->clk); |
8258 |
+- return err; |
8259 |
++ goto put_bpmp; |
8260 |
+ } |
8261 |
+ |
8262 |
+ emc->debugfs.root = debugfs_create_dir("emc", NULL); |
8263 |
+@@ -254,6 +256,10 @@ static int tegra186_emc_probe(struct platform_device *pdev) |
8264 |
+ emc, &tegra186_emc_debug_max_rate_fops); |
8265 |
+ |
8266 |
+ return 0; |
8267 |
++ |
8268 |
++put_bpmp: |
8269 |
++ tegra_bpmp_put(emc->bpmp); |
8270 |
++ return err; |
8271 |
+ } |
8272 |
+ |
8273 |
+ static int tegra186_emc_remove(struct platform_device *pdev) |
8274 |
+diff --git a/drivers/mfd/ioc3.c b/drivers/mfd/ioc3.c |
8275 |
+index 74cee7cb0afc..d939ccc46509 100644 |
8276 |
+--- a/drivers/mfd/ioc3.c |
8277 |
++++ b/drivers/mfd/ioc3.c |
8278 |
+@@ -616,7 +616,10 @@ static int ioc3_mfd_probe(struct pci_dev *pdev, |
8279 |
+ /* Remove all already added MFD devices */ |
8280 |
+ mfd_remove_devices(&ipd->pdev->dev); |
8281 |
+ if (ipd->domain) { |
8282 |
++ struct fwnode_handle *fn = ipd->domain->fwnode; |
8283 |
++ |
8284 |
+ irq_domain_remove(ipd->domain); |
8285 |
++ irq_domain_free_fwnode(fn); |
8286 |
+ free_irq(ipd->domain_irq, (void *)ipd); |
8287 |
+ } |
8288 |
+ pci_iounmap(pdev, regs); |
8289 |
+@@ -643,7 +646,10 @@ static void ioc3_mfd_remove(struct pci_dev *pdev) |
8290 |
+ /* Release resources */ |
8291 |
+ mfd_remove_devices(&ipd->pdev->dev); |
8292 |
+ if (ipd->domain) { |
8293 |
++ struct fwnode_handle *fn = ipd->domain->fwnode; |
8294 |
++ |
8295 |
+ irq_domain_remove(ipd->domain); |
8296 |
++ irq_domain_free_fwnode(fn); |
8297 |
+ free_irq(ipd->domain_irq, (void *)ipd); |
8298 |
+ } |
8299 |
+ pci_iounmap(pdev, ipd->regs); |
8300 |
+diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c |
8301 |
+index f0263d1a1fdf..d97a243ad30c 100644 |
8302 |
+--- a/drivers/misc/cxl/sysfs.c |
8303 |
++++ b/drivers/misc/cxl/sysfs.c |
8304 |
+@@ -624,7 +624,7 @@ static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int c |
8305 |
+ rc = kobject_init_and_add(&cr->kobj, &afu_config_record_type, |
8306 |
+ &afu->dev.kobj, "cr%i", cr->cr); |
8307 |
+ if (rc) |
8308 |
+- goto err; |
8309 |
++ goto err1; |
8310 |
+ |
8311 |
+ rc = sysfs_create_bin_file(&cr->kobj, &cr->config_attr); |
8312 |
+ if (rc) |
8313 |
+diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c |
8314 |
+index 736675f0a246..10338800f6be 100644 |
8315 |
+--- a/drivers/misc/lkdtm/bugs.c |
8316 |
++++ b/drivers/misc/lkdtm/bugs.c |
8317 |
+@@ -13,7 +13,7 @@ |
8318 |
+ #include <linux/uaccess.h> |
8319 |
+ #include <linux/slab.h> |
8320 |
+ |
8321 |
+-#ifdef CONFIG_X86_32 |
8322 |
++#if IS_ENABLED(CONFIG_X86_32) && !IS_ENABLED(CONFIG_UML) |
8323 |
+ #include <asm/desc.h> |
8324 |
+ #endif |
8325 |
+ |
8326 |
+@@ -118,9 +118,8 @@ noinline void lkdtm_CORRUPT_STACK(void) |
8327 |
+ /* Use default char array length that triggers stack protection. */ |
8328 |
+ char data[8] __aligned(sizeof(void *)); |
8329 |
+ |
8330 |
+- __lkdtm_CORRUPT_STACK(&data); |
8331 |
+- |
8332 |
+- pr_info("Corrupted stack containing char array ...\n"); |
8333 |
++ pr_info("Corrupting stack containing char array ...\n"); |
8334 |
++ __lkdtm_CORRUPT_STACK((void *)&data); |
8335 |
+ } |
8336 |
+ |
8337 |
+ /* Same as above but will only get a canary with -fstack-protector-strong */ |
8338 |
+@@ -131,9 +130,8 @@ noinline void lkdtm_CORRUPT_STACK_STRONG(void) |
8339 |
+ unsigned long *ptr; |
8340 |
+ } data __aligned(sizeof(void *)); |
8341 |
+ |
8342 |
+- __lkdtm_CORRUPT_STACK(&data); |
8343 |
+- |
8344 |
+- pr_info("Corrupted stack containing union ...\n"); |
8345 |
++ pr_info("Corrupting stack containing union ...\n"); |
8346 |
++ __lkdtm_CORRUPT_STACK((void *)&data); |
8347 |
+ } |
8348 |
+ |
8349 |
+ void lkdtm_UNALIGNED_LOAD_STORE_WRITE(void) |
8350 |
+@@ -248,6 +246,7 @@ void lkdtm_ARRAY_BOUNDS(void) |
8351 |
+ |
8352 |
+ kfree(not_checked); |
8353 |
+ kfree(checked); |
8354 |
++ pr_err("FAIL: survived array bounds overflow!\n"); |
8355 |
+ } |
8356 |
+ |
8357 |
+ void lkdtm_CORRUPT_LIST_ADD(void) |
8358 |
+@@ -419,7 +418,7 @@ void lkdtm_UNSET_SMEP(void) |
8359 |
+ |
8360 |
+ void lkdtm_DOUBLE_FAULT(void) |
8361 |
+ { |
8362 |
+-#ifdef CONFIG_X86_32 |
8363 |
++#if IS_ENABLED(CONFIG_X86_32) && !IS_ENABLED(CONFIG_UML) |
8364 |
+ /* |
8365 |
+ * Trigger #DF by setting the stack limit to zero. This clobbers |
8366 |
+ * a GDT TLS slot, which is okay because the current task will die |
8367 |
+@@ -454,38 +453,42 @@ void lkdtm_DOUBLE_FAULT(void) |
8368 |
+ #endif |
8369 |
+ } |
8370 |
+ |
8371 |
+-#ifdef CONFIG_ARM64_PTR_AUTH |
8372 |
++#ifdef CONFIG_ARM64 |
8373 |
+ static noinline void change_pac_parameters(void) |
8374 |
+ { |
8375 |
+- /* Reset the keys of current task */ |
8376 |
+- ptrauth_thread_init_kernel(current); |
8377 |
+- ptrauth_thread_switch_kernel(current); |
8378 |
++ if (IS_ENABLED(CONFIG_ARM64_PTR_AUTH)) { |
8379 |
++ /* Reset the keys of current task */ |
8380 |
++ ptrauth_thread_init_kernel(current); |
8381 |
++ ptrauth_thread_switch_kernel(current); |
8382 |
++ } |
8383 |
+ } |
8384 |
++#endif |
8385 |
+ |
8386 |
+-#define CORRUPT_PAC_ITERATE 10 |
8387 |
+ noinline void lkdtm_CORRUPT_PAC(void) |
8388 |
+ { |
8389 |
++#ifdef CONFIG_ARM64 |
8390 |
++#define CORRUPT_PAC_ITERATE 10 |
8391 |
+ int i; |
8392 |
+ |
8393 |
++ if (!IS_ENABLED(CONFIG_ARM64_PTR_AUTH)) |
8394 |
++ pr_err("FAIL: kernel not built with CONFIG_ARM64_PTR_AUTH\n"); |
8395 |
++ |
8396 |
+ if (!system_supports_address_auth()) { |
8397 |
+- pr_err("FAIL: arm64 pointer authentication feature not present\n"); |
8398 |
++ pr_err("FAIL: CPU lacks pointer authentication feature\n"); |
8399 |
+ return; |
8400 |
+ } |
8401 |
+ |
8402 |
+- pr_info("Change the PAC parameters to force function return failure\n"); |
8403 |
++ pr_info("changing PAC parameters to force function return failure...\n"); |
8404 |
+ /* |
8405 |
+- * Pac is a hash value computed from input keys, return address and |
8406 |
++ * PAC is a hash value computed from input keys, return address and |
8407 |
+ * stack pointer. As pac has fewer bits so there is a chance of |
8408 |
+ * collision, so iterate few times to reduce the collision probability. |
8409 |
+ */ |
8410 |
+ for (i = 0; i < CORRUPT_PAC_ITERATE; i++) |
8411 |
+ change_pac_parameters(); |
8412 |
+ |
8413 |
+- pr_err("FAIL: %s test failed. Kernel may be unstable from here\n", __func__); |
8414 |
+-} |
8415 |
+-#else /* !CONFIG_ARM64_PTR_AUTH */ |
8416 |
+-noinline void lkdtm_CORRUPT_PAC(void) |
8417 |
+-{ |
8418 |
+- pr_err("FAIL: arm64 pointer authentication config disabled\n"); |
8419 |
+-} |
8420 |
++ pr_err("FAIL: survived PAC changes! Kernel may be unstable from here\n"); |
8421 |
++#else |
8422 |
++ pr_err("XFAIL: this test is arm64-only\n"); |
8423 |
+ #endif |
8424 |
++} |
8425 |
+diff --git a/drivers/misc/lkdtm/lkdtm.h b/drivers/misc/lkdtm/lkdtm.h |
8426 |
+index 601a2156a0d4..8878538b2c13 100644 |
8427 |
+--- a/drivers/misc/lkdtm/lkdtm.h |
8428 |
++++ b/drivers/misc/lkdtm/lkdtm.h |
8429 |
+@@ -31,9 +31,7 @@ void lkdtm_CORRUPT_USER_DS(void); |
8430 |
+ void lkdtm_STACK_GUARD_PAGE_LEADING(void); |
8431 |
+ void lkdtm_STACK_GUARD_PAGE_TRAILING(void); |
8432 |
+ void lkdtm_UNSET_SMEP(void); |
8433 |
+-#ifdef CONFIG_X86_32 |
8434 |
+ void lkdtm_DOUBLE_FAULT(void); |
8435 |
+-#endif |
8436 |
+ void lkdtm_CORRUPT_PAC(void); |
8437 |
+ |
8438 |
+ /* lkdtm_heap.c */ |
8439 |
+diff --git a/drivers/misc/lkdtm/perms.c b/drivers/misc/lkdtm/perms.c |
8440 |
+index 62f76d506f04..2dede2ef658f 100644 |
8441 |
+--- a/drivers/misc/lkdtm/perms.c |
8442 |
++++ b/drivers/misc/lkdtm/perms.c |
8443 |
+@@ -57,6 +57,7 @@ static noinline void execute_location(void *dst, bool write) |
8444 |
+ } |
8445 |
+ pr_info("attempting bad execution at %px\n", func); |
8446 |
+ func(); |
8447 |
++ pr_err("FAIL: func returned\n"); |
8448 |
+ } |
8449 |
+ |
8450 |
+ static void execute_user_location(void *dst) |
8451 |
+@@ -75,20 +76,22 @@ static void execute_user_location(void *dst) |
8452 |
+ return; |
8453 |
+ pr_info("attempting bad execution at %px\n", func); |
8454 |
+ func(); |
8455 |
++ pr_err("FAIL: func returned\n"); |
8456 |
+ } |
8457 |
+ |
8458 |
+ void lkdtm_WRITE_RO(void) |
8459 |
+ { |
8460 |
+- /* Explicitly cast away "const" for the test. */ |
8461 |
+- unsigned long *ptr = (unsigned long *)&rodata; |
8462 |
++ /* Explicitly cast away "const" for the test and make volatile. */ |
8463 |
++ volatile unsigned long *ptr = (unsigned long *)&rodata; |
8464 |
+ |
8465 |
+ pr_info("attempting bad rodata write at %px\n", ptr); |
8466 |
+ *ptr ^= 0xabcd1234; |
8467 |
++ pr_err("FAIL: survived bad write\n"); |
8468 |
+ } |
8469 |
+ |
8470 |
+ void lkdtm_WRITE_RO_AFTER_INIT(void) |
8471 |
+ { |
8472 |
+- unsigned long *ptr = &ro_after_init; |
8473 |
++ volatile unsigned long *ptr = &ro_after_init; |
8474 |
+ |
8475 |
+ /* |
8476 |
+ * Verify we were written to during init. Since an Oops |
8477 |
+@@ -102,19 +105,21 @@ void lkdtm_WRITE_RO_AFTER_INIT(void) |
8478 |
+ |
8479 |
+ pr_info("attempting bad ro_after_init write at %px\n", ptr); |
8480 |
+ *ptr ^= 0xabcd1234; |
8481 |
++ pr_err("FAIL: survived bad write\n"); |
8482 |
+ } |
8483 |
+ |
8484 |
+ void lkdtm_WRITE_KERN(void) |
8485 |
+ { |
8486 |
+ size_t size; |
8487 |
+- unsigned char *ptr; |
8488 |
++ volatile unsigned char *ptr; |
8489 |
+ |
8490 |
+ size = (unsigned long)do_overwritten - (unsigned long)do_nothing; |
8491 |
+ ptr = (unsigned char *)do_overwritten; |
8492 |
+ |
8493 |
+ pr_info("attempting bad %zu byte write at %px\n", size, ptr); |
8494 |
+- memcpy(ptr, (unsigned char *)do_nothing, size); |
8495 |
++ memcpy((void *)ptr, (unsigned char *)do_nothing, size); |
8496 |
+ flush_icache_range((unsigned long)ptr, (unsigned long)(ptr + size)); |
8497 |
++ pr_err("FAIL: survived bad write\n"); |
8498 |
+ |
8499 |
+ do_overwritten(); |
8500 |
+ } |
8501 |
+@@ -193,9 +198,11 @@ void lkdtm_ACCESS_USERSPACE(void) |
8502 |
+ pr_info("attempting bad read at %px\n", ptr); |
8503 |
+ tmp = *ptr; |
8504 |
+ tmp += 0xc0dec0de; |
8505 |
++ pr_err("FAIL: survived bad read\n"); |
8506 |
+ |
8507 |
+ pr_info("attempting bad write at %px\n", ptr); |
8508 |
+ *ptr = tmp; |
8509 |
++ pr_err("FAIL: survived bad write\n"); |
8510 |
+ |
8511 |
+ vm_munmap(user_addr, PAGE_SIZE); |
8512 |
+ } |
8513 |
+@@ -203,19 +210,20 @@ void lkdtm_ACCESS_USERSPACE(void) |
8514 |
+ void lkdtm_ACCESS_NULL(void) |
8515 |
+ { |
8516 |
+ unsigned long tmp; |
8517 |
+- unsigned long *ptr = (unsigned long *)NULL; |
8518 |
++ volatile unsigned long *ptr = (unsigned long *)NULL; |
8519 |
+ |
8520 |
+ pr_info("attempting bad read at %px\n", ptr); |
8521 |
+ tmp = *ptr; |
8522 |
+ tmp += 0xc0dec0de; |
8523 |
++ pr_err("FAIL: survived bad read\n"); |
8524 |
+ |
8525 |
+ pr_info("attempting bad write at %px\n", ptr); |
8526 |
+ *ptr = tmp; |
8527 |
++ pr_err("FAIL: survived bad write\n"); |
8528 |
+ } |
8529 |
+ |
8530 |
+ void __init lkdtm_perms_init(void) |
8531 |
+ { |
8532 |
+ /* Make sure we can write to __ro_after_init values during __init */ |
8533 |
+ ro_after_init |= 0xAA; |
8534 |
+- |
8535 |
+ } |
8536 |
+diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c |
8537 |
+index e172719dd86d..b833367a45d0 100644 |
8538 |
+--- a/drivers/misc/lkdtm/usercopy.c |
8539 |
++++ b/drivers/misc/lkdtm/usercopy.c |
8540 |
+@@ -304,19 +304,22 @@ void lkdtm_USERCOPY_KERNEL(void) |
8541 |
+ return; |
8542 |
+ } |
8543 |
+ |
8544 |
+- pr_info("attempting good copy_to_user from kernel rodata\n"); |
8545 |
++ pr_info("attempting good copy_to_user from kernel rodata: %px\n", |
8546 |
++ test_text); |
8547 |
+ if (copy_to_user((void __user *)user_addr, test_text, |
8548 |
+ unconst + sizeof(test_text))) { |
8549 |
+ pr_warn("copy_to_user failed unexpectedly?!\n"); |
8550 |
+ goto free_user; |
8551 |
+ } |
8552 |
+ |
8553 |
+- pr_info("attempting bad copy_to_user from kernel text\n"); |
8554 |
++ pr_info("attempting bad copy_to_user from kernel text: %px\n", |
8555 |
++ vm_mmap); |
8556 |
+ if (copy_to_user((void __user *)user_addr, vm_mmap, |
8557 |
+ unconst + PAGE_SIZE)) { |
8558 |
+ pr_warn("copy_to_user failed, but lacked Oops\n"); |
8559 |
+ goto free_user; |
8560 |
+ } |
8561 |
++ pr_err("FAIL: survived bad copy_to_user()\n"); |
8562 |
+ |
8563 |
+ free_user: |
8564 |
+ vm_munmap(user_addr, PAGE_SIZE); |
8565 |
+diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c |
8566 |
+index 4a6c9ba82538..4d9f7681817c 100644 |
8567 |
+--- a/drivers/mmc/host/sdhci-cadence.c |
8568 |
++++ b/drivers/mmc/host/sdhci-cadence.c |
8569 |
+@@ -202,57 +202,6 @@ static u32 sdhci_cdns_get_emmc_mode(struct sdhci_cdns_priv *priv) |
8570 |
+ return FIELD_GET(SDHCI_CDNS_HRS06_MODE, tmp); |
8571 |
+ } |
8572 |
+ |
8573 |
+-static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, |
8574 |
+- unsigned int timing) |
8575 |
+-{ |
8576 |
+- struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host); |
8577 |
+- u32 mode; |
8578 |
+- |
8579 |
+- switch (timing) { |
8580 |
+- case MMC_TIMING_MMC_HS: |
8581 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_SDR; |
8582 |
+- break; |
8583 |
+- case MMC_TIMING_MMC_DDR52: |
8584 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_DDR; |
8585 |
+- break; |
8586 |
+- case MMC_TIMING_MMC_HS200: |
8587 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_HS200; |
8588 |
+- break; |
8589 |
+- case MMC_TIMING_MMC_HS400: |
8590 |
+- if (priv->enhanced_strobe) |
8591 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400ES; |
8592 |
+- else |
8593 |
+- mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400; |
8594 |
+- break; |
8595 |
+- default: |
8596 |
+- mode = SDHCI_CDNS_HRS06_MODE_SD; |
8597 |
+- break; |
8598 |
+- } |
8599 |
+- |
8600 |
+- sdhci_cdns_set_emmc_mode(priv, mode); |
8601 |
+- |
8602 |
+- /* For SD, fall back to the default handler */ |
8603 |
+- if (mode == SDHCI_CDNS_HRS06_MODE_SD) |
8604 |
+- sdhci_set_uhs_signaling(host, timing); |
8605 |
+-} |
8606 |
+- |
8607 |
+-static const struct sdhci_ops sdhci_cdns_ops = { |
8608 |
+- .set_clock = sdhci_set_clock, |
8609 |
+- .get_timeout_clock = sdhci_cdns_get_timeout_clock, |
8610 |
+- .set_bus_width = sdhci_set_bus_width, |
8611 |
+- .reset = sdhci_reset, |
8612 |
+- .set_uhs_signaling = sdhci_cdns_set_uhs_signaling, |
8613 |
+-}; |
8614 |
+- |
8615 |
+-static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = { |
8616 |
+- .ops = &sdhci_cdns_ops, |
8617 |
+- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, |
8618 |
+-}; |
8619 |
+- |
8620 |
+-static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { |
8621 |
+- .ops = &sdhci_cdns_ops, |
8622 |
+-}; |
8623 |
+- |
8624 |
+ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) |
8625 |
+ { |
8626 |
+ struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host); |
8627 |
+@@ -286,23 +235,24 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) |
8628 |
+ return 0; |
8629 |
+ } |
8630 |
+ |
8631 |
+-static int sdhci_cdns_execute_tuning(struct mmc_host *mmc, u32 opcode) |
8632 |
++/* |
8633 |
++ * In SD mode, software must not use the hardware tuning and instead perform |
8634 |
++ * an almost identical procedure to eMMC. |
8635 |
++ */ |
8636 |
++static int sdhci_cdns_execute_tuning(struct sdhci_host *host, u32 opcode) |
8637 |
+ { |
8638 |
+- struct sdhci_host *host = mmc_priv(mmc); |
8639 |
+ int cur_streak = 0; |
8640 |
+ int max_streak = 0; |
8641 |
+ int end_of_streak = 0; |
8642 |
+ int i; |
8643 |
+ |
8644 |
+ /* |
8645 |
+- * This handler only implements the eMMC tuning that is specific to |
8646 |
+- * this controller. Fall back to the standard method for SD timing. |
8647 |
++ * Do not execute tuning for UHS_SDR50 or UHS_DDR50. |
8648 |
++ * The delay is set by probe, based on the DT properties. |
8649 |
+ */ |
8650 |
+- if (host->timing != MMC_TIMING_MMC_HS200) |
8651 |
+- return sdhci_execute_tuning(mmc, opcode); |
8652 |
+- |
8653 |
+- if (WARN_ON(opcode != MMC_SEND_TUNING_BLOCK_HS200)) |
8654 |
+- return -EINVAL; |
8655 |
++ if (host->timing != MMC_TIMING_MMC_HS200 && |
8656 |
++ host->timing != MMC_TIMING_UHS_SDR104) |
8657 |
++ return 0; |
8658 |
+ |
8659 |
+ for (i = 0; i < SDHCI_CDNS_MAX_TUNING_LOOP; i++) { |
8660 |
+ if (sdhci_cdns_set_tune_val(host, i) || |
8661 |
+@@ -325,6 +275,58 @@ static int sdhci_cdns_execute_tuning(struct mmc_host *mmc, u32 opcode) |
8662 |
+ return sdhci_cdns_set_tune_val(host, end_of_streak - max_streak / 2); |
8663 |
+ } |
8664 |
+ |
8665 |
++static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, |
8666 |
++ unsigned int timing) |
8667 |
++{ |
8668 |
++ struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host); |
8669 |
++ u32 mode; |
8670 |
++ |
8671 |
++ switch (timing) { |
8672 |
++ case MMC_TIMING_MMC_HS: |
8673 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_SDR; |
8674 |
++ break; |
8675 |
++ case MMC_TIMING_MMC_DDR52: |
8676 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_DDR; |
8677 |
++ break; |
8678 |
++ case MMC_TIMING_MMC_HS200: |
8679 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_HS200; |
8680 |
++ break; |
8681 |
++ case MMC_TIMING_MMC_HS400: |
8682 |
++ if (priv->enhanced_strobe) |
8683 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400ES; |
8684 |
++ else |
8685 |
++ mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400; |
8686 |
++ break; |
8687 |
++ default: |
8688 |
++ mode = SDHCI_CDNS_HRS06_MODE_SD; |
8689 |
++ break; |
8690 |
++ } |
8691 |
++ |
8692 |
++ sdhci_cdns_set_emmc_mode(priv, mode); |
8693 |
++ |
8694 |
++ /* For SD, fall back to the default handler */ |
8695 |
++ if (mode == SDHCI_CDNS_HRS06_MODE_SD) |
8696 |
++ sdhci_set_uhs_signaling(host, timing); |
8697 |
++} |
8698 |
++ |
8699 |
++static const struct sdhci_ops sdhci_cdns_ops = { |
8700 |
++ .set_clock = sdhci_set_clock, |
8701 |
++ .get_timeout_clock = sdhci_cdns_get_timeout_clock, |
8702 |
++ .set_bus_width = sdhci_set_bus_width, |
8703 |
++ .reset = sdhci_reset, |
8704 |
++ .platform_execute_tuning = sdhci_cdns_execute_tuning, |
8705 |
++ .set_uhs_signaling = sdhci_cdns_set_uhs_signaling, |
8706 |
++}; |
8707 |
++ |
8708 |
++static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = { |
8709 |
++ .ops = &sdhci_cdns_ops, |
8710 |
++ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, |
8711 |
++}; |
8712 |
++ |
8713 |
++static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { |
8714 |
++ .ops = &sdhci_cdns_ops, |
8715 |
++}; |
8716 |
++ |
8717 |
+ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc, |
8718 |
+ struct mmc_ios *ios) |
8719 |
+ { |
8720 |
+@@ -385,7 +387,6 @@ static int sdhci_cdns_probe(struct platform_device *pdev) |
8721 |
+ priv->hrs_addr = host->ioaddr; |
8722 |
+ priv->enhanced_strobe = false; |
8723 |
+ host->ioaddr += SDHCI_CDNS_SRS_BASE; |
8724 |
+- host->mmc_host_ops.execute_tuning = sdhci_cdns_execute_tuning; |
8725 |
+ host->mmc_host_ops.hs400_enhanced_strobe = |
8726 |
+ sdhci_cdns_hs400_enhanced_strobe; |
8727 |
+ sdhci_enable_v4_mode(host); |
8728 |
+diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c |
8729 |
+index db9b544465cd..fb26e743e1fd 100644 |
8730 |
+--- a/drivers/mmc/host/sdhci-of-arasan.c |
8731 |
++++ b/drivers/mmc/host/sdhci-of-arasan.c |
8732 |
+@@ -1299,6 +1299,8 @@ sdhci_arasan_register_sdcardclk(struct sdhci_arasan_data *sdhci_arasan, |
8733 |
+ clk_data->sdcardclk_hw.init = &sdcardclk_init; |
8734 |
+ clk_data->sdcardclk = |
8735 |
+ devm_clk_register(dev, &clk_data->sdcardclk_hw); |
8736 |
++ if (IS_ERR(clk_data->sdcardclk)) |
8737 |
++ return PTR_ERR(clk_data->sdcardclk); |
8738 |
+ clk_data->sdcardclk_hw.init = NULL; |
8739 |
+ |
8740 |
+ ret = of_clk_add_provider(np, of_clk_src_simple_get, |
8741 |
+@@ -1349,6 +1351,8 @@ sdhci_arasan_register_sampleclk(struct sdhci_arasan_data *sdhci_arasan, |
8742 |
+ clk_data->sampleclk_hw.init = &sampleclk_init; |
8743 |
+ clk_data->sampleclk = |
8744 |
+ devm_clk_register(dev, &clk_data->sampleclk_hw); |
8745 |
++ if (IS_ERR(clk_data->sampleclk)) |
8746 |
++ return PTR_ERR(clk_data->sampleclk); |
8747 |
+ clk_data->sampleclk_hw.init = NULL; |
8748 |
+ |
8749 |
+ ret = of_clk_add_provider(np, of_clk_src_simple_get, |
8750 |
+diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c |
8751 |
+index e2a846885902..ed3c605fcf0c 100644 |
8752 |
+--- a/drivers/mmc/host/sdhci-pci-o2micro.c |
8753 |
++++ b/drivers/mmc/host/sdhci-pci-o2micro.c |
8754 |
+@@ -561,6 +561,12 @@ static int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot) |
8755 |
+ slot->host->mmc_host_ops.get_cd = sdhci_o2_get_cd; |
8756 |
+ } |
8757 |
+ |
8758 |
++ if (chip->pdev->device == PCI_DEVICE_ID_O2_SEABIRD1) { |
8759 |
++ slot->host->mmc_host_ops.get_cd = sdhci_o2_get_cd; |
8760 |
++ host->mmc->caps2 |= MMC_CAP2_NO_SDIO; |
8761 |
++ host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN; |
8762 |
++ } |
8763 |
++ |
8764 |
+ host->mmc_host_ops.execute_tuning = sdhci_o2_execute_tuning; |
8765 |
+ |
8766 |
+ if (chip->pdev->device != PCI_DEVICE_ID_O2_FUJIN2) |
8767 |
+diff --git a/drivers/most/core.c b/drivers/most/core.c |
8768 |
+index f781c46cd4af..353ab277cbc6 100644 |
8769 |
+--- a/drivers/most/core.c |
8770 |
++++ b/drivers/most/core.c |
8771 |
+@@ -1283,10 +1283,8 @@ int most_register_interface(struct most_interface *iface) |
8772 |
+ struct most_channel *c; |
8773 |
+ |
8774 |
+ if (!iface || !iface->enqueue || !iface->configure || |
8775 |
+- !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) { |
8776 |
+- dev_err(iface->dev, "Bad interface or channel overflow\n"); |
8777 |
++ !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) |
8778 |
+ return -EINVAL; |
8779 |
+- } |
8780 |
+ |
8781 |
+ id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL); |
8782 |
+ if (id < 0) { |
8783 |
+diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
8784 |
+index 44068e9eea03..ac934a715a19 100644 |
8785 |
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
8786 |
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
8787 |
+@@ -3023,8 +3023,9 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) |
8788 |
+ if (ret < 0) |
8789 |
+ goto err; |
8790 |
+ |
8791 |
+- /* set edu transfer function to call */ |
8792 |
+- ctrl->dma_trans = brcmnand_edu_trans; |
8793 |
++ if (has_edu(ctrl)) |
8794 |
++ /* set edu transfer function to call */ |
8795 |
++ ctrl->dma_trans = brcmnand_edu_trans; |
8796 |
+ } |
8797 |
+ |
8798 |
+ /* Disable automatic device ID config, direct addressing */ |
8799 |
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
8800 |
+index f1daf330951b..78b5f211598c 100644 |
8801 |
+--- a/drivers/mtd/nand/raw/qcom_nandc.c |
8802 |
++++ b/drivers/mtd/nand/raw/qcom_nandc.c |
8803 |
+@@ -459,11 +459,13 @@ struct qcom_nand_host { |
8804 |
+ * among different NAND controllers. |
8805 |
+ * @ecc_modes - ecc mode for NAND |
8806 |
+ * @is_bam - whether NAND controller is using BAM |
8807 |
++ * @is_qpic - whether NAND CTRL is part of qpic IP |
8808 |
+ * @dev_cmd_reg_start - NAND_DEV_CMD_* registers starting offset |
8809 |
+ */ |
8810 |
+ struct qcom_nandc_props { |
8811 |
+ u32 ecc_modes; |
8812 |
+ bool is_bam; |
8813 |
++ bool is_qpic; |
8814 |
+ u32 dev_cmd_reg_start; |
8815 |
+ }; |
8816 |
+ |
8817 |
+@@ -2774,7 +2776,8 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc) |
8818 |
+ u32 nand_ctrl; |
8819 |
+ |
8820 |
+ /* kill onenand */ |
8821 |
+- nandc_write(nandc, SFLASHC_BURST_CFG, 0); |
8822 |
++ if (!nandc->props->is_qpic) |
8823 |
++ nandc_write(nandc, SFLASHC_BURST_CFG, 0); |
8824 |
+ nandc_write(nandc, dev_cmd_reg_addr(nandc, NAND_DEV_CMD_VLD), |
8825 |
+ NAND_DEV_CMD_VLD_VAL); |
8826 |
+ |
8827 |
+@@ -3035,12 +3038,14 @@ static const struct qcom_nandc_props ipq806x_nandc_props = { |
8828 |
+ static const struct qcom_nandc_props ipq4019_nandc_props = { |
8829 |
+ .ecc_modes = (ECC_BCH_4BIT | ECC_BCH_8BIT), |
8830 |
+ .is_bam = true, |
8831 |
++ .is_qpic = true, |
8832 |
+ .dev_cmd_reg_start = 0x0, |
8833 |
+ }; |
8834 |
+ |
8835 |
+ static const struct qcom_nandc_props ipq8074_nandc_props = { |
8836 |
+ .ecc_modes = (ECC_BCH_4BIT | ECC_BCH_8BIT), |
8837 |
+ .is_bam = true, |
8838 |
++ .is_qpic = true, |
8839 |
+ .dev_cmd_reg_start = 0x7000, |
8840 |
+ }; |
8841 |
+ |
8842 |
+diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c |
8843 |
+index 61d2a0ad2131..3259c9fc981f 100644 |
8844 |
+--- a/drivers/mtd/spi-nor/controllers/intel-spi.c |
8845 |
++++ b/drivers/mtd/spi-nor/controllers/intel-spi.c |
8846 |
+@@ -612,6 +612,15 @@ static int intel_spi_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf, |
8847 |
+ return 0; |
8848 |
+ } |
8849 |
+ |
8850 |
++ /* |
8851 |
++ * We hope that HW sequencer will do the right thing automatically and |
8852 |
++ * with the SW sequencer we cannot use preopcode anyway, so just ignore |
8853 |
++ * the Write Disable operation and pretend it was completed |
8854 |
++ * successfully. |
8855 |
++ */ |
8856 |
++ if (opcode == SPINOR_OP_WRDI) |
8857 |
++ return 0; |
8858 |
++ |
8859 |
+ writel(0, ispi->base + FADDR); |
8860 |
+ |
8861 |
+ /* Write the value beforehand */ |
8862 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
8863 |
+index fee16c947c2e..359043659327 100644 |
8864 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
8865 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
8866 |
+@@ -3485,7 +3485,6 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { |
8867 |
+ .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
8868 |
+ .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
8869 |
+ .port_set_ether_type = mv88e6351_port_set_ether_type, |
8870 |
+- .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, |
8871 |
+ .port_egress_rate_limiting = mv88e6095_port_egress_rate_limiting, |
8872 |
+ .port_pause_limit = mv88e6097_port_pause_limit, |
8873 |
+ .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, |
8874 |
+diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c |
8875 |
+index ac88caca5ad4..1368816abaed 100644 |
8876 |
+--- a/drivers/net/dsa/rtl8366.c |
8877 |
++++ b/drivers/net/dsa/rtl8366.c |
8878 |
+@@ -43,18 +43,26 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
8879 |
+ int ret; |
8880 |
+ int i; |
8881 |
+ |
8882 |
++ dev_dbg(smi->dev, |
8883 |
++ "setting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n", |
8884 |
++ vid, member, untag); |
8885 |
++ |
8886 |
+ /* Update the 4K table */ |
8887 |
+ ret = smi->ops->get_vlan_4k(smi, vid, &vlan4k); |
8888 |
+ if (ret) |
8889 |
+ return ret; |
8890 |
+ |
8891 |
+- vlan4k.member = member; |
8892 |
+- vlan4k.untag = untag; |
8893 |
++ vlan4k.member |= member; |
8894 |
++ vlan4k.untag |= untag; |
8895 |
+ vlan4k.fid = fid; |
8896 |
+ ret = smi->ops->set_vlan_4k(smi, &vlan4k); |
8897 |
+ if (ret) |
8898 |
+ return ret; |
8899 |
+ |
8900 |
++ dev_dbg(smi->dev, |
8901 |
++ "resulting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n", |
8902 |
++ vid, vlan4k.member, vlan4k.untag); |
8903 |
++ |
8904 |
+ /* Try to find an existing MC entry for this VID */ |
8905 |
+ for (i = 0; i < smi->num_vlan_mc; i++) { |
8906 |
+ struct rtl8366_vlan_mc vlanmc; |
8907 |
+@@ -65,11 +73,16 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
8908 |
+ |
8909 |
+ if (vid == vlanmc.vid) { |
8910 |
+ /* update the MC entry */ |
8911 |
+- vlanmc.member = member; |
8912 |
+- vlanmc.untag = untag; |
8913 |
++ vlanmc.member |= member; |
8914 |
++ vlanmc.untag |= untag; |
8915 |
+ vlanmc.fid = fid; |
8916 |
+ |
8917 |
+ ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
8918 |
++ |
8919 |
++ dev_dbg(smi->dev, |
8920 |
++ "resulting VLAN%d MC members: 0x%02x, untagged: 0x%02x\n", |
8921 |
++ vid, vlanmc.member, vlanmc.untag); |
8922 |
++ |
8923 |
+ break; |
8924 |
+ } |
8925 |
+ } |
8926 |
+@@ -384,7 +397,7 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, |
8927 |
+ if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) |
8928 |
+ dev_err(smi->dev, "port is DSA or CPU port\n"); |
8929 |
+ |
8930 |
+- for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { |
8931 |
++ for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { |
8932 |
+ int pvid_val = 0; |
8933 |
+ |
8934 |
+ dev_info(smi->dev, "add VLAN %04x\n", vid); |
8935 |
+@@ -407,13 +420,13 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, |
8936 |
+ if (ret < 0) |
8937 |
+ return; |
8938 |
+ } |
8939 |
+- } |
8940 |
+ |
8941 |
+- ret = rtl8366_set_vlan(smi, port, member, untag, 0); |
8942 |
+- if (ret) |
8943 |
+- dev_err(smi->dev, |
8944 |
+- "failed to set up VLAN %04x", |
8945 |
+- vid); |
8946 |
++ ret = rtl8366_set_vlan(smi, vid, member, untag, 0); |
8947 |
++ if (ret) |
8948 |
++ dev_err(smi->dev, |
8949 |
++ "failed to set up VLAN %04x", |
8950 |
++ vid); |
8951 |
++ } |
8952 |
+ } |
8953 |
+ EXPORT_SYMBOL_GPL(rtl8366_vlan_add); |
8954 |
+ |
8955 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c |
8956 |
+index 743d3b13b39d..bb1fc6052bcf 100644 |
8957 |
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c |
8958 |
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c |
8959 |
+@@ -123,21 +123,21 @@ static const char aq_macsec_stat_names[][ETH_GSTRING_LEN] = { |
8960 |
+ "MACSec OutUnctrlHitDropRedir", |
8961 |
+ }; |
8962 |
+ |
8963 |
+-static const char *aq_macsec_txsc_stat_names[] = { |
8964 |
++static const char * const aq_macsec_txsc_stat_names[] = { |
8965 |
+ "MACSecTXSC%d ProtectedPkts", |
8966 |
+ "MACSecTXSC%d EncryptedPkts", |
8967 |
+ "MACSecTXSC%d ProtectedOctets", |
8968 |
+ "MACSecTXSC%d EncryptedOctets", |
8969 |
+ }; |
8970 |
+ |
8971 |
+-static const char *aq_macsec_txsa_stat_names[] = { |
8972 |
++static const char * const aq_macsec_txsa_stat_names[] = { |
8973 |
+ "MACSecTXSC%dSA%d HitDropRedirect", |
8974 |
+ "MACSecTXSC%dSA%d Protected2Pkts", |
8975 |
+ "MACSecTXSC%dSA%d ProtectedPkts", |
8976 |
+ "MACSecTXSC%dSA%d EncryptedPkts", |
8977 |
+ }; |
8978 |
+ |
8979 |
+-static const char *aq_macsec_rxsa_stat_names[] = { |
8980 |
++static const char * const aq_macsec_rxsa_stat_names[] = { |
8981 |
+ "MACSecRXSC%dSA%d UntaggedHitPkts", |
8982 |
+ "MACSecRXSC%dSA%d CtrlHitDrpRedir", |
8983 |
+ "MACSecRXSC%dSA%d NotUsingSa", |
8984 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
8985 |
+index a312864969af..6640fd35b29b 100644 |
8986 |
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
8987 |
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c |
8988 |
+@@ -782,7 +782,7 @@ static int hw_atl_a0_hw_multicast_list_set(struct aq_hw_s *self, |
8989 |
+ int err = 0; |
8990 |
+ |
8991 |
+ if (count > (HW_ATL_A0_MAC_MAX - HW_ATL_A0_MAC_MIN)) { |
8992 |
+- err = EBADRQC; |
8993 |
++ err = -EBADRQC; |
8994 |
+ goto err_exit; |
8995 |
+ } |
8996 |
+ for (self->aq_nic_cfg->mc_list_count = 0U; |
8997 |
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
8998 |
+index 2213e6ab8151..4b1b5928b104 100644 |
8999 |
+--- a/drivers/net/ethernet/cadence/macb_main.c |
9000 |
++++ b/drivers/net/ethernet/cadence/macb_main.c |
9001 |
+@@ -578,7 +578,7 @@ static void macb_mac_config(struct phylink_config *config, unsigned int mode, |
9002 |
+ if (bp->caps & MACB_CAPS_MACB_IS_EMAC) { |
9003 |
+ if (state->interface == PHY_INTERFACE_MODE_RMII) |
9004 |
+ ctrl |= MACB_BIT(RM9200_RMII); |
9005 |
+- } else { |
9006 |
++ } else if (macb_is_gem(bp)) { |
9007 |
+ ctrl &= ~(GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL)); |
9008 |
+ |
9009 |
+ if (state->interface == PHY_INTERFACE_MODE_SGMII) |
9010 |
+@@ -639,10 +639,13 @@ static void macb_mac_link_up(struct phylink_config *config, |
9011 |
+ ctrl |= MACB_BIT(FD); |
9012 |
+ |
9013 |
+ if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC)) { |
9014 |
+- ctrl &= ~(GEM_BIT(GBE) | MACB_BIT(PAE)); |
9015 |
++ ctrl &= ~MACB_BIT(PAE); |
9016 |
++ if (macb_is_gem(bp)) { |
9017 |
++ ctrl &= ~GEM_BIT(GBE); |
9018 |
+ |
9019 |
+- if (speed == SPEED_1000) |
9020 |
+- ctrl |= GEM_BIT(GBE); |
9021 |
++ if (speed == SPEED_1000) |
9022 |
++ ctrl |= GEM_BIT(GBE); |
9023 |
++ } |
9024 |
+ |
9025 |
+ /* We do not support MLO_PAUSE_RX yet */ |
9026 |
+ if (tx_pause) |
9027 |
+diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
9028 |
+index 43d11c38b38a..4cddd628d41b 100644 |
9029 |
+--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
9030 |
++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c |
9031 |
+@@ -1167,7 +1167,7 @@ static int cn23xx_get_pf_num(struct octeon_device *oct) |
9032 |
+ oct->pf_num = ((fdl_bit >> CN23XX_PCIE_SRIOV_FDL_BIT_POS) & |
9033 |
+ CN23XX_PCIE_SRIOV_FDL_MASK); |
9034 |
+ } else { |
9035 |
+- ret = EINVAL; |
9036 |
++ ret = -EINVAL; |
9037 |
+ |
9038 |
+ /* Under some virtual environments, extended PCI regs are |
9039 |
+ * inaccessible, in which case the above read will have failed. |
9040 |
+diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
9041 |
+index 2ba0ce115e63..4fee95584e31 100644 |
9042 |
+--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
9043 |
++++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c |
9044 |
+@@ -2042,11 +2042,11 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg) |
9045 |
+ /* Save message data locally to prevent them from |
9046 |
+ * being overwritten by next ndo_set_rx_mode call(). |
9047 |
+ */ |
9048 |
+- spin_lock(&nic->rx_mode_wq_lock); |
9049 |
++ spin_lock_bh(&nic->rx_mode_wq_lock); |
9050 |
+ mode = vf_work->mode; |
9051 |
+ mc = vf_work->mc; |
9052 |
+ vf_work->mc = NULL; |
9053 |
+- spin_unlock(&nic->rx_mode_wq_lock); |
9054 |
++ spin_unlock_bh(&nic->rx_mode_wq_lock); |
9055 |
+ |
9056 |
+ __nicvf_set_rx_mode_task(mode, mc, nic); |
9057 |
+ } |
9058 |
+@@ -2180,6 +2180,9 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
9059 |
+ nic->max_queues *= 2; |
9060 |
+ nic->ptp_clock = ptp_clock; |
9061 |
+ |
9062 |
++ /* Initialize mutex that serializes usage of VF's mailbox */ |
9063 |
++ mutex_init(&nic->rx_mode_mtx); |
9064 |
++ |
9065 |
+ /* MAP VF's configuration registers */ |
9066 |
+ nic->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0); |
9067 |
+ if (!nic->reg_base) { |
9068 |
+@@ -2256,7 +2259,6 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
9069 |
+ |
9070 |
+ INIT_WORK(&nic->rx_mode_work.work, nicvf_set_rx_mode_task); |
9071 |
+ spin_lock_init(&nic->rx_mode_wq_lock); |
9072 |
+- mutex_init(&nic->rx_mode_mtx); |
9073 |
+ |
9074 |
+ err = register_netdev(netdev); |
9075 |
+ if (err) { |
9076 |
+diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
9077 |
+index 0998ceb1a26e..a4b2b18009c1 100644 |
9078 |
+--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
9079 |
++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
9080 |
+@@ -1109,7 +1109,7 @@ static void drain_bufs(struct dpaa2_eth_priv *priv, int count) |
9081 |
+ buf_array, count); |
9082 |
+ if (ret < 0) { |
9083 |
+ if (ret == -EBUSY && |
9084 |
+- retries++ >= DPAA2_ETH_SWP_BUSY_RETRIES) |
9085 |
++ retries++ < DPAA2_ETH_SWP_BUSY_RETRIES) |
9086 |
+ continue; |
9087 |
+ netdev_err(priv->net_dev, "dpaa2_io_service_acquire() failed\n"); |
9088 |
+ return; |
9089 |
+@@ -2207,7 +2207,7 @@ close: |
9090 |
+ free: |
9091 |
+ fsl_mc_object_free(dpcon); |
9092 |
+ |
9093 |
+- return NULL; |
9094 |
++ return ERR_PTR(err); |
9095 |
+ } |
9096 |
+ |
9097 |
+ static void free_dpcon(struct dpaa2_eth_priv *priv, |
9098 |
+@@ -2231,8 +2231,8 @@ alloc_channel(struct dpaa2_eth_priv *priv) |
9099 |
+ return NULL; |
9100 |
+ |
9101 |
+ channel->dpcon = setup_dpcon(priv); |
9102 |
+- if (IS_ERR_OR_NULL(channel->dpcon)) { |
9103 |
+- err = PTR_ERR_OR_ZERO(channel->dpcon); |
9104 |
++ if (IS_ERR(channel->dpcon)) { |
9105 |
++ err = PTR_ERR(channel->dpcon); |
9106 |
+ goto err_setup; |
9107 |
+ } |
9108 |
+ |
9109 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c |
9110 |
+index f151d6e111dd..ef67e8599b39 100644 |
9111 |
+--- a/drivers/net/ethernet/freescale/fman/fman.c |
9112 |
++++ b/drivers/net/ethernet/freescale/fman/fman.c |
9113 |
+@@ -1398,8 +1398,7 @@ static void enable_time_stamp(struct fman *fman) |
9114 |
+ { |
9115 |
+ struct fman_fpm_regs __iomem *fpm_rg = fman->fpm_regs; |
9116 |
+ u16 fm_clk_freq = fman->state->fm_clk_freq; |
9117 |
+- u32 tmp, intgr, ts_freq; |
9118 |
+- u64 frac; |
9119 |
++ u32 tmp, intgr, ts_freq, frac; |
9120 |
+ |
9121 |
+ ts_freq = (u32)(1 << fman->state->count1_micro_bit); |
9122 |
+ /* configure timestamp so that bit 8 will count 1 microsecond |
9123 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
9124 |
+index 004c266802a8..bce3c9398887 100644 |
9125 |
+--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
9126 |
++++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c |
9127 |
+@@ -1200,7 +1200,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) |
9128 |
+ list_for_each(pos, |
9129 |
+ &dtsec->multicast_addr_hash->lsts[bucket]) { |
9130 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
9131 |
+- if (hash_entry->addr == addr) { |
9132 |
++ if (hash_entry && hash_entry->addr == addr) { |
9133 |
+ list_del_init(&hash_entry->node); |
9134 |
+ kfree(hash_entry); |
9135 |
+ break; |
9136 |
+@@ -1213,7 +1213,7 @@ int dtsec_del_hash_mac_address(struct fman_mac *dtsec, enet_addr_t *eth_addr) |
9137 |
+ list_for_each(pos, |
9138 |
+ &dtsec->unicast_addr_hash->lsts[bucket]) { |
9139 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
9140 |
+- if (hash_entry->addr == addr) { |
9141 |
++ if (hash_entry && hash_entry->addr == addr) { |
9142 |
+ list_del_init(&hash_entry->node); |
9143 |
+ kfree(hash_entry); |
9144 |
+ break; |
9145 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_mac.h b/drivers/net/ethernet/freescale/fman/fman_mac.h |
9146 |
+index dd6d0526f6c1..19f327efdaff 100644 |
9147 |
+--- a/drivers/net/ethernet/freescale/fman/fman_mac.h |
9148 |
++++ b/drivers/net/ethernet/freescale/fman/fman_mac.h |
9149 |
+@@ -252,7 +252,7 @@ static inline struct eth_hash_t *alloc_hash_table(u16 size) |
9150 |
+ struct eth_hash_t *hash; |
9151 |
+ |
9152 |
+ /* Allocate address hash table */ |
9153 |
+- hash = kmalloc_array(size, sizeof(struct eth_hash_t *), GFP_KERNEL); |
9154 |
++ hash = kmalloc(sizeof(*hash), GFP_KERNEL); |
9155 |
+ if (!hash) |
9156 |
+ return NULL; |
9157 |
+ |
9158 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c |
9159 |
+index a5500ede4070..645764abdaae 100644 |
9160 |
+--- a/drivers/net/ethernet/freescale/fman/fman_memac.c |
9161 |
++++ b/drivers/net/ethernet/freescale/fman/fman_memac.c |
9162 |
+@@ -852,7 +852,6 @@ int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, |
9163 |
+ |
9164 |
+ tmp = ioread32be(®s->command_config); |
9165 |
+ tmp &= ~CMD_CFG_PFC_MODE; |
9166 |
+- priority = 0; |
9167 |
+ |
9168 |
+ iowrite32be(tmp, ®s->command_config); |
9169 |
+ |
9170 |
+@@ -982,7 +981,7 @@ int memac_del_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr) |
9171 |
+ |
9172 |
+ list_for_each(pos, &memac->multicast_addr_hash->lsts[hash]) { |
9173 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
9174 |
+- if (hash_entry->addr == addr) { |
9175 |
++ if (hash_entry && hash_entry->addr == addr) { |
9176 |
+ list_del_init(&hash_entry->node); |
9177 |
+ kfree(hash_entry); |
9178 |
+ break; |
9179 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c |
9180 |
+index 87b26f063cc8..c27df153f895 100644 |
9181 |
+--- a/drivers/net/ethernet/freescale/fman/fman_port.c |
9182 |
++++ b/drivers/net/ethernet/freescale/fman/fman_port.c |
9183 |
+@@ -1767,6 +1767,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
9184 |
+ struct fman_port *port; |
9185 |
+ struct fman *fman; |
9186 |
+ struct device_node *fm_node, *port_node; |
9187 |
++ struct platform_device *fm_pdev; |
9188 |
+ struct resource res; |
9189 |
+ struct resource *dev_res; |
9190 |
+ u32 val; |
9191 |
+@@ -1791,8 +1792,14 @@ static int fman_port_probe(struct platform_device *of_dev) |
9192 |
+ goto return_err; |
9193 |
+ } |
9194 |
+ |
9195 |
+- fman = dev_get_drvdata(&of_find_device_by_node(fm_node)->dev); |
9196 |
++ fm_pdev = of_find_device_by_node(fm_node); |
9197 |
+ of_node_put(fm_node); |
9198 |
++ if (!fm_pdev) { |
9199 |
++ err = -EINVAL; |
9200 |
++ goto return_err; |
9201 |
++ } |
9202 |
++ |
9203 |
++ fman = dev_get_drvdata(&fm_pdev->dev); |
9204 |
+ if (!fman) { |
9205 |
+ err = -EINVAL; |
9206 |
+ goto return_err; |
9207 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
9208 |
+index 8c7eb878d5b4..41946b16f6c7 100644 |
9209 |
+--- a/drivers/net/ethernet/freescale/fman/fman_tgec.c |
9210 |
++++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c |
9211 |
+@@ -626,7 +626,7 @@ int tgec_del_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr) |
9212 |
+ |
9213 |
+ list_for_each(pos, &tgec->multicast_addr_hash->lsts[hash]) { |
9214 |
+ hash_entry = ETH_HASH_ENTRY_OBJ(pos); |
9215 |
+- if (hash_entry->addr == addr) { |
9216 |
++ if (hash_entry && hash_entry->addr == addr) { |
9217 |
+ list_del_init(&hash_entry->node); |
9218 |
+ kfree(hash_entry); |
9219 |
+ break; |
9220 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
9221 |
+index fa82768e5eda..d338efe5f3f5 100644 |
9222 |
+--- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
9223 |
++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
9224 |
+@@ -1863,8 +1863,10 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) |
9225 |
+ |
9226 |
+ adapter->rss_key = kzalloc(adapter->rss_key_size, GFP_KERNEL); |
9227 |
+ adapter->rss_lut = kzalloc(adapter->rss_lut_size, GFP_KERNEL); |
9228 |
+- if (!adapter->rss_key || !adapter->rss_lut) |
9229 |
++ if (!adapter->rss_key || !adapter->rss_lut) { |
9230 |
++ err = -ENOMEM; |
9231 |
+ goto err_mem; |
9232 |
++ } |
9233 |
+ if (RSS_AQ(adapter)) |
9234 |
+ adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_RSS; |
9235 |
+ else |
9236 |
+@@ -1946,7 +1948,10 @@ static void iavf_watchdog_task(struct work_struct *work) |
9237 |
+ iavf_send_api_ver(adapter); |
9238 |
+ } |
9239 |
+ } else { |
9240 |
+- if (!iavf_process_aq_command(adapter) && |
9241 |
++ /* An error will be returned if no commands were |
9242 |
++ * processed; use this opportunity to update stats |
9243 |
++ */ |
9244 |
++ if (iavf_process_aq_command(adapter) && |
9245 |
+ adapter->state == __IAVF_RUNNING) |
9246 |
+ iavf_request_stats(adapter); |
9247 |
+ } |
9248 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c |
9249 |
+index 4420fc02f7e7..504a02b071ce 100644 |
9250 |
+--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c |
9251 |
++++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c |
9252 |
+@@ -2922,6 +2922,8 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx) |
9253 |
+ ICE_FLOW_ENTRY_HNDL(e)); |
9254 |
+ |
9255 |
+ list_del(&p->l_entry); |
9256 |
++ |
9257 |
++ mutex_destroy(&p->entries_lock); |
9258 |
+ devm_kfree(ice_hw_to_dev(hw), p); |
9259 |
+ } |
9260 |
+ mutex_unlock(&hw->fl_profs_locks[blk_idx]); |
9261 |
+@@ -3039,7 +3041,7 @@ void ice_clear_hw_tbls(struct ice_hw *hw) |
9262 |
+ memset(prof_redir->t, 0, |
9263 |
+ prof_redir->count * sizeof(*prof_redir->t)); |
9264 |
+ |
9265 |
+- memset(es->t, 0, es->count * sizeof(*es->t)); |
9266 |
++ memset(es->t, 0, es->count * sizeof(*es->t) * es->fvw); |
9267 |
+ memset(es->ref_count, 0, es->count * sizeof(*es->ref_count)); |
9268 |
+ memset(es->written, 0, es->count * sizeof(*es->written)); |
9269 |
+ } |
9270 |
+@@ -3150,10 +3152,12 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw) |
9271 |
+ es->ref_count = devm_kcalloc(ice_hw_to_dev(hw), es->count, |
9272 |
+ sizeof(*es->ref_count), |
9273 |
+ GFP_KERNEL); |
9274 |
++ if (!es->ref_count) |
9275 |
++ goto err; |
9276 |
+ |
9277 |
+ es->written = devm_kcalloc(ice_hw_to_dev(hw), es->count, |
9278 |
+ sizeof(*es->written), GFP_KERNEL); |
9279 |
+- if (!es->ref_count) |
9280 |
++ if (!es->written) |
9281 |
+ goto err; |
9282 |
+ } |
9283 |
+ return 0; |
9284 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9285 |
+index 24f4d8e0da98..ee72397813d4 100644 |
9286 |
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9287 |
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9288 |
+@@ -2981,6 +2981,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, |
9289 |
+ err = mvpp2_rx_refill(port, bm_pool, pool); |
9290 |
+ if (err) { |
9291 |
+ netdev_err(port->dev, "failed to refill BM pools\n"); |
9292 |
++ dev_kfree_skb_any(skb); |
9293 |
+ goto err_drop_frame; |
9294 |
+ } |
9295 |
+ |
9296 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
9297 |
+index 2569bb6228b6..2e5f7efb82a8 100644 |
9298 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
9299 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
9300 |
+@@ -847,18 +847,15 @@ static int connect_fts_in_prio(struct mlx5_core_dev *dev, |
9301 |
+ { |
9302 |
+ struct mlx5_flow_root_namespace *root = find_root(&prio->node); |
9303 |
+ struct mlx5_flow_table *iter; |
9304 |
+- int i = 0; |
9305 |
+ int err; |
9306 |
+ |
9307 |
+ fs_for_each_ft(iter, prio) { |
9308 |
+- i++; |
9309 |
+ err = root->cmds->modify_flow_table(root, iter, ft); |
9310 |
+ if (err) { |
9311 |
+- mlx5_core_warn(dev, "Failed to modify flow table %d\n", |
9312 |
+- iter->id); |
9313 |
++ mlx5_core_err(dev, |
9314 |
++ "Failed to modify flow table id %d, type %d, err %d\n", |
9315 |
++ iter->id, iter->type, err); |
9316 |
+ /* The driver is out of sync with the FW */ |
9317 |
+- if (i > 1) |
9318 |
+- WARN_ON(true); |
9319 |
+ return err; |
9320 |
+ } |
9321 |
+ } |
9322 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
9323 |
+index 8887b2440c7d..9b08eb557a31 100644 |
9324 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
9325 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
9326 |
+@@ -279,29 +279,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
9327 |
+ |
9328 |
+ /* The order of the actions are must to be keep, only the following |
9329 |
+ * order is supported by SW steering: |
9330 |
+- * TX: push vlan -> modify header -> encap |
9331 |
++ * TX: modify header -> push vlan -> encap |
9332 |
+ * RX: decap -> pop vlan -> modify header |
9333 |
+ */ |
9334 |
+- if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { |
9335 |
+- tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); |
9336 |
+- if (!tmp_action) { |
9337 |
+- err = -ENOMEM; |
9338 |
+- goto free_actions; |
9339 |
+- } |
9340 |
+- fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
9341 |
+- actions[num_actions++] = tmp_action; |
9342 |
+- } |
9343 |
+- |
9344 |
+- if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { |
9345 |
+- tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); |
9346 |
+- if (!tmp_action) { |
9347 |
+- err = -ENOMEM; |
9348 |
+- goto free_actions; |
9349 |
+- } |
9350 |
+- fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
9351 |
+- actions[num_actions++] = tmp_action; |
9352 |
+- } |
9353 |
+- |
9354 |
+ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) { |
9355 |
+ enum mlx5dr_action_reformat_type decap_type = |
9356 |
+ DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2; |
9357 |
+@@ -354,6 +334,26 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
9358 |
+ actions[num_actions++] = |
9359 |
+ fte->action.modify_hdr->action.dr_action; |
9360 |
+ |
9361 |
++ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { |
9362 |
++ tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); |
9363 |
++ if (!tmp_action) { |
9364 |
++ err = -ENOMEM; |
9365 |
++ goto free_actions; |
9366 |
++ } |
9367 |
++ fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
9368 |
++ actions[num_actions++] = tmp_action; |
9369 |
++ } |
9370 |
++ |
9371 |
++ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { |
9372 |
++ tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); |
9373 |
++ if (!tmp_action) { |
9374 |
++ err = -ENOMEM; |
9375 |
++ goto free_actions; |
9376 |
++ } |
9377 |
++ fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
9378 |
++ actions[num_actions++] = tmp_action; |
9379 |
++ } |
9380 |
++ |
9381 |
+ if (delay_encap_set) |
9382 |
+ actions[num_actions++] = |
9383 |
+ fte->action.pkt_reformat->action.dr_action; |
9384 |
+diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c |
9385 |
+index f17da67a4622..d0b79cca5184 100644 |
9386 |
+--- a/drivers/net/ethernet/mscc/ocelot.c |
9387 |
++++ b/drivers/net/ethernet/mscc/ocelot.c |
9388 |
+@@ -1605,14 +1605,14 @@ static int ocelot_port_obj_add_mdb(struct net_device *dev, |
9389 |
+ addr[0] = 0; |
9390 |
+ |
9391 |
+ if (!new) { |
9392 |
+- addr[2] = mc->ports << 0; |
9393 |
+- addr[1] = mc->ports << 8; |
9394 |
++ addr[1] = mc->ports >> 8; |
9395 |
++ addr[2] = mc->ports & 0xff; |
9396 |
+ ocelot_mact_forget(ocelot, addr, vid); |
9397 |
+ } |
9398 |
+ |
9399 |
+ mc->ports |= BIT(port); |
9400 |
+- addr[2] = mc->ports << 0; |
9401 |
+- addr[1] = mc->ports << 8; |
9402 |
++ addr[1] = mc->ports >> 8; |
9403 |
++ addr[2] = mc->ports & 0xff; |
9404 |
+ |
9405 |
+ return ocelot_mact_learn(ocelot, 0, addr, vid, ENTRYTYPE_MACv4); |
9406 |
+ } |
9407 |
+@@ -1636,9 +1636,9 @@ static int ocelot_port_obj_del_mdb(struct net_device *dev, |
9408 |
+ return -ENOENT; |
9409 |
+ |
9410 |
+ memcpy(addr, mc->addr, ETH_ALEN); |
9411 |
+- addr[2] = mc->ports << 0; |
9412 |
+- addr[1] = mc->ports << 8; |
9413 |
+ addr[0] = 0; |
9414 |
++ addr[1] = mc->ports >> 8; |
9415 |
++ addr[2] = mc->ports & 0xff; |
9416 |
+ ocelot_mact_forget(ocelot, addr, vid); |
9417 |
+ |
9418 |
+ mc->ports &= ~BIT(port); |
9419 |
+@@ -1648,8 +1648,8 @@ static int ocelot_port_obj_del_mdb(struct net_device *dev, |
9420 |
+ return 0; |
9421 |
+ } |
9422 |
+ |
9423 |
+- addr[2] = mc->ports << 0; |
9424 |
+- addr[1] = mc->ports << 8; |
9425 |
++ addr[1] = mc->ports >> 8; |
9426 |
++ addr[2] = mc->ports & 0xff; |
9427 |
+ |
9428 |
+ return ocelot_mact_learn(ocelot, 0, addr, vid, ENTRYTYPE_MACv4); |
9429 |
+ } |
9430 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c |
9431 |
+index 2924cde440aa..85c686c16741 100644 |
9432 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c |
9433 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c |
9434 |
+@@ -247,12 +247,11 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
9435 |
+ goto err_out_pci_disable_device; |
9436 |
+ } |
9437 |
+ |
9438 |
+- pci_set_master(pdev); |
9439 |
+ pcie_print_link_status(pdev); |
9440 |
+ |
9441 |
+ err = ionic_map_bars(ionic); |
9442 |
+ if (err) |
9443 |
+- goto err_out_pci_clear_master; |
9444 |
++ goto err_out_pci_disable_device; |
9445 |
+ |
9446 |
+ /* Configure the device */ |
9447 |
+ err = ionic_setup(ionic); |
9448 |
+@@ -260,6 +259,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
9449 |
+ dev_err(dev, "Cannot setup device: %d, aborting\n", err); |
9450 |
+ goto err_out_unmap_bars; |
9451 |
+ } |
9452 |
++ pci_set_master(pdev); |
9453 |
+ |
9454 |
+ err = ionic_identify(ionic); |
9455 |
+ if (err) { |
9456 |
+@@ -350,6 +350,7 @@ err_out_reset: |
9457 |
+ ionic_reset(ionic); |
9458 |
+ err_out_teardown: |
9459 |
+ ionic_dev_teardown(ionic); |
9460 |
++ pci_clear_master(pdev); |
9461 |
+ /* Don't fail the probe for these errors, keep |
9462 |
+ * the hw interface around for inspection |
9463 |
+ */ |
9464 |
+@@ -358,8 +359,6 @@ err_out_teardown: |
9465 |
+ err_out_unmap_bars: |
9466 |
+ ionic_unmap_bars(ionic); |
9467 |
+ pci_release_regions(pdev); |
9468 |
+-err_out_pci_clear_master: |
9469 |
+- pci_clear_master(pdev); |
9470 |
+ err_out_pci_disable_device: |
9471 |
+ pci_disable_device(pdev); |
9472 |
+ err_out_debugfs_del_dev: |
9473 |
+@@ -389,9 +388,9 @@ static void ionic_remove(struct pci_dev *pdev) |
9474 |
+ ionic_port_reset(ionic); |
9475 |
+ ionic_reset(ionic); |
9476 |
+ ionic_dev_teardown(ionic); |
9477 |
++ pci_clear_master(pdev); |
9478 |
+ ionic_unmap_bars(ionic); |
9479 |
+ pci_release_regions(pdev); |
9480 |
+- pci_clear_master(pdev); |
9481 |
+ pci_disable_device(pdev); |
9482 |
+ ionic_debugfs_del_dev(ionic); |
9483 |
+ mutex_destroy(&ionic->dev_cmd_lock); |
9484 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
9485 |
+index e55d41546cff..aa93f9a6252d 100644 |
9486 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
9487 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
9488 |
+@@ -723,7 +723,7 @@ static bool ionic_notifyq_service(struct ionic_cq *cq, |
9489 |
+ eid = le64_to_cpu(comp->event.eid); |
9490 |
+ |
9491 |
+ /* Have we run out of new completions to process? */ |
9492 |
+- if (eid <= lif->last_eid) |
9493 |
++ if ((s64)(eid - lif->last_eid) <= 0) |
9494 |
+ return false; |
9495 |
+ |
9496 |
+ lif->last_eid = eid; |
9497 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c |
9498 |
+index d13ec88313c3..eb70fdddddbf 100644 |
9499 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c |
9500 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c |
9501 |
+@@ -2355,6 +2355,11 @@ qed_cxt_free_ilt_range(struct qed_hwfn *p_hwfn, |
9502 |
+ elem_size = SRQ_CXT_SIZE; |
9503 |
+ p_blk = &p_cli->pf_blks[SRQ_BLK]; |
9504 |
+ break; |
9505 |
++ case QED_ELEM_XRC_SRQ: |
9506 |
++ p_cli = &p_hwfn->p_cxt_mngr->clients[ILT_CLI_TSDM]; |
9507 |
++ elem_size = XRC_SRQ_CXT_SIZE; |
9508 |
++ p_blk = &p_cli->pf_blks[SRQ_BLK]; |
9509 |
++ break; |
9510 |
+ case QED_ELEM_TASK: |
9511 |
+ p_cli = &p_hwfn->p_cxt_mngr->clients[ILT_CLI_CDUT]; |
9512 |
+ elem_size = TYPE1_TASK_CXT_SIZE(p_hwfn); |
9513 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c |
9514 |
+index 19c0c8864da1..4ad5f21de79e 100644 |
9515 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c |
9516 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c |
9517 |
+@@ -404,6 +404,7 @@ static void qed_rdma_resc_free(struct qed_hwfn *p_hwfn) |
9518 |
+ qed_rdma_bmap_free(p_hwfn, &p_hwfn->p_rdma_info->srq_map, 1); |
9519 |
+ qed_rdma_bmap_free(p_hwfn, &p_hwfn->p_rdma_info->real_cid_map, 1); |
9520 |
+ qed_rdma_bmap_free(p_hwfn, &p_hwfn->p_rdma_info->xrc_srq_map, 1); |
9521 |
++ qed_rdma_bmap_free(p_hwfn, &p_hwfn->p_rdma_info->xrcd_map, 1); |
9522 |
+ |
9523 |
+ kfree(p_rdma_info->port); |
9524 |
+ kfree(p_rdma_info->dev); |
9525 |
+diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c |
9526 |
+index 6646eba9f57f..6eef0f45b133 100644 |
9527 |
+--- a/drivers/net/ethernet/sgi/ioc3-eth.c |
9528 |
++++ b/drivers/net/ethernet/sgi/ioc3-eth.c |
9529 |
+@@ -951,7 +951,7 @@ out_stop: |
9530 |
+ dma_free_coherent(ip->dma_dev, RX_RING_SIZE, ip->rxr, |
9531 |
+ ip->rxr_dma); |
9532 |
+ if (ip->tx_ring) |
9533 |
+- dma_free_coherent(ip->dma_dev, TX_RING_SIZE, ip->tx_ring, |
9534 |
++ dma_free_coherent(ip->dma_dev, TX_RING_SIZE + SZ_16K - 1, ip->tx_ring, |
9535 |
+ ip->txr_dma); |
9536 |
+ out_free: |
9537 |
+ free_netdev(dev); |
9538 |
+@@ -964,7 +964,7 @@ static int ioc3eth_remove(struct platform_device *pdev) |
9539 |
+ struct ioc3_private *ip = netdev_priv(dev); |
9540 |
+ |
9541 |
+ dma_free_coherent(ip->dma_dev, RX_RING_SIZE, ip->rxr, ip->rxr_dma); |
9542 |
+- dma_free_coherent(ip->dma_dev, TX_RING_SIZE, ip->tx_ring, ip->txr_dma); |
9543 |
++ dma_free_coherent(ip->dma_dev, TX_RING_SIZE + SZ_16K - 1, ip->tx_ring, ip->txr_dma); |
9544 |
+ |
9545 |
+ unregister_netdev(dev); |
9546 |
+ del_timer_sync(&ip->ioc3_timer); |
9547 |
+diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c |
9548 |
+index 6d778bc3d012..88832277edd5 100644 |
9549 |
+--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c |
9550 |
++++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c |
9551 |
+@@ -223,6 +223,9 @@ static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev, |
9552 |
+ u32 port_mask, unreg_mcast = 0; |
9553 |
+ int ret; |
9554 |
+ |
9555 |
++ if (!netif_running(ndev) || !vid) |
9556 |
++ return 0; |
9557 |
++ |
9558 |
+ ret = pm_runtime_get_sync(common->dev); |
9559 |
+ if (ret < 0) { |
9560 |
+ pm_runtime_put_noidle(common->dev); |
9561 |
+@@ -246,6 +249,9 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev, |
9562 |
+ struct am65_cpsw_common *common = am65_ndev_to_common(ndev); |
9563 |
+ int ret; |
9564 |
+ |
9565 |
++ if (!netif_running(ndev) || !vid) |
9566 |
++ return 0; |
9567 |
++ |
9568 |
+ ret = pm_runtime_get_sync(common->dev); |
9569 |
+ if (ret < 0) { |
9570 |
+ pm_runtime_put_noidle(common->dev); |
9571 |
+@@ -571,6 +577,16 @@ static int am65_cpsw_nuss_ndo_slave_stop(struct net_device *ndev) |
9572 |
+ return 0; |
9573 |
+ } |
9574 |
+ |
9575 |
++static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg) |
9576 |
++{ |
9577 |
++ struct am65_cpsw_port *port = arg; |
9578 |
++ |
9579 |
++ if (!vdev) |
9580 |
++ return 0; |
9581 |
++ |
9582 |
++ return am65_cpsw_nuss_ndo_slave_add_vid(port->ndev, 0, vid); |
9583 |
++} |
9584 |
++ |
9585 |
+ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) |
9586 |
+ { |
9587 |
+ struct am65_cpsw_common *common = am65_ndev_to_common(ndev); |
9588 |
+@@ -644,6 +660,9 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) |
9589 |
+ } |
9590 |
+ } |
9591 |
+ |
9592 |
++ /* restore vlan configurations */ |
9593 |
++ vlan_for_each(ndev, cpsw_restore_vlans, port); |
9594 |
++ |
9595 |
+ phy_attached_info(port->slave.phy); |
9596 |
+ phy_start(port->slave.phy); |
9597 |
+ |
9598 |
+diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c |
9599 |
+index 3902b3aeb0c2..94267e1f5d30 100644 |
9600 |
+--- a/drivers/net/ethernet/toshiba/spider_net.c |
9601 |
++++ b/drivers/net/ethernet/toshiba/spider_net.c |
9602 |
+@@ -283,8 +283,8 @@ spider_net_free_chain(struct spider_net_card *card, |
9603 |
+ descr = descr->next; |
9604 |
+ } while (descr != chain->ring); |
9605 |
+ |
9606 |
+- dma_free_coherent(&card->pdev->dev, chain->num_desc, |
9607 |
+- chain->hwring, chain->dma_addr); |
9608 |
++ dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr), |
9609 |
++ chain->hwring, chain->dma_addr); |
9610 |
+ } |
9611 |
+ |
9612 |
+ /** |
9613 |
+diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c |
9614 |
+index 929244064abd..9a15f14daa47 100644 |
9615 |
+--- a/drivers/net/ethernet/xilinx/ll_temac_main.c |
9616 |
++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c |
9617 |
+@@ -1407,10 +1407,8 @@ static int temac_probe(struct platform_device *pdev) |
9618 |
+ } |
9619 |
+ |
9620 |
+ /* map device registers */ |
9621 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
9622 |
+- lp->regs = devm_ioremap(&pdev->dev, res->start, |
9623 |
+- resource_size(res)); |
9624 |
+- if (!lp->regs) { |
9625 |
++ lp->regs = devm_platform_ioremap_resource_byname(pdev, 0); |
9626 |
++ if (IS_ERR(lp->regs)) { |
9627 |
+ dev_err(&pdev->dev, "could not map TEMAC registers\n"); |
9628 |
+ return -ENOMEM; |
9629 |
+ } |
9630 |
+diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
9631 |
+index 6267f706e8ee..0d779bba1b01 100644 |
9632 |
+--- a/drivers/net/hyperv/netvsc_drv.c |
9633 |
++++ b/drivers/net/hyperv/netvsc_drv.c |
9634 |
+@@ -532,12 +532,13 @@ static int netvsc_xmit(struct sk_buff *skb, struct net_device *net, bool xdp_tx) |
9635 |
+ u32 hash; |
9636 |
+ struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT]; |
9637 |
+ |
9638 |
+- /* if VF is present and up then redirect packets |
9639 |
+- * already called with rcu_read_lock_bh |
9640 |
++ /* If VF is present and up then redirect packets to it. |
9641 |
++ * Skip the VF if it is marked down or has no carrier. |
9642 |
++ * If netpoll is in uses, then VF can not be used either. |
9643 |
+ */ |
9644 |
+ vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev); |
9645 |
+ if (vf_netdev && netif_running(vf_netdev) && |
9646 |
+- !netpoll_tx_running(net)) |
9647 |
++ netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net)) |
9648 |
+ return netvsc_vf_xmit(net, vf_netdev, skb); |
9649 |
+ |
9650 |
+ /* We will atmost need two pages to describe the rndis |
9651 |
+diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c |
9652 |
+index d4c2e62b2439..179f5ea405d8 100644 |
9653 |
+--- a/drivers/net/phy/marvell10g.c |
9654 |
++++ b/drivers/net/phy/marvell10g.c |
9655 |
+@@ -205,13 +205,6 @@ static int mv3310_hwmon_config(struct phy_device *phydev, bool enable) |
9656 |
+ MV_V2_TEMP_CTRL_MASK, val); |
9657 |
+ } |
9658 |
+ |
9659 |
+-static void mv3310_hwmon_disable(void *data) |
9660 |
+-{ |
9661 |
+- struct phy_device *phydev = data; |
9662 |
+- |
9663 |
+- mv3310_hwmon_config(phydev, false); |
9664 |
+-} |
9665 |
+- |
9666 |
+ static int mv3310_hwmon_probe(struct phy_device *phydev) |
9667 |
+ { |
9668 |
+ struct device *dev = &phydev->mdio.dev; |
9669 |
+@@ -235,10 +228,6 @@ static int mv3310_hwmon_probe(struct phy_device *phydev) |
9670 |
+ if (ret) |
9671 |
+ return ret; |
9672 |
+ |
9673 |
+- ret = devm_add_action_or_reset(dev, mv3310_hwmon_disable, phydev); |
9674 |
+- if (ret) |
9675 |
+- return ret; |
9676 |
+- |
9677 |
+ priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, |
9678 |
+ priv->hwmon_name, phydev, |
9679 |
+ &mv3310_hwmon_chip_info, NULL); |
9680 |
+@@ -423,6 +412,11 @@ static int mv3310_probe(struct phy_device *phydev) |
9681 |
+ return phy_sfp_probe(phydev, &mv3310_sfp_ops); |
9682 |
+ } |
9683 |
+ |
9684 |
++static void mv3310_remove(struct phy_device *phydev) |
9685 |
++{ |
9686 |
++ mv3310_hwmon_config(phydev, false); |
9687 |
++} |
9688 |
++ |
9689 |
+ static int mv3310_suspend(struct phy_device *phydev) |
9690 |
+ { |
9691 |
+ return mv3310_power_down(phydev); |
9692 |
+@@ -762,6 +756,7 @@ static struct phy_driver mv3310_drivers[] = { |
9693 |
+ .read_status = mv3310_read_status, |
9694 |
+ .get_tunable = mv3310_get_tunable, |
9695 |
+ .set_tunable = mv3310_set_tunable, |
9696 |
++ .remove = mv3310_remove, |
9697 |
+ }, |
9698 |
+ { |
9699 |
+ .phy_id = MARVELL_PHY_ID_88E2110, |
9700 |
+@@ -776,6 +771,7 @@ static struct phy_driver mv3310_drivers[] = { |
9701 |
+ .read_status = mv3310_read_status, |
9702 |
+ .get_tunable = mv3310_get_tunable, |
9703 |
+ .set_tunable = mv3310_set_tunable, |
9704 |
++ .remove = mv3310_remove, |
9705 |
+ }, |
9706 |
+ }; |
9707 |
+ |
9708 |
+diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c |
9709 |
+index 5ddc44f87eaf..8f5f2586e784 100644 |
9710 |
+--- a/drivers/net/phy/mscc/mscc_main.c |
9711 |
++++ b/drivers/net/phy/mscc/mscc_main.c |
9712 |
+@@ -1379,6 +1379,11 @@ static int vsc8584_config_init(struct phy_device *phydev) |
9713 |
+ if (ret) |
9714 |
+ goto err; |
9715 |
+ |
9716 |
++ ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, |
9717 |
++ MSCC_PHY_PAGE_STANDARD); |
9718 |
++ if (ret) |
9719 |
++ goto err; |
9720 |
++ |
9721 |
+ if (!phy_interface_is_rgmii(phydev)) { |
9722 |
+ val = PROC_CMD_MCB_ACCESS_MAC_CONF | PROC_CMD_RST_CONF_PORT | |
9723 |
+ PROC_CMD_READ_MOD_WRITE_PORT; |
9724 |
+@@ -1751,7 +1756,11 @@ static int vsc8514_config_init(struct phy_device *phydev) |
9725 |
+ val &= ~MAC_CFG_MASK; |
9726 |
+ val |= MAC_CFG_QSGMII; |
9727 |
+ ret = phy_base_write(phydev, MSCC_PHY_MAC_CFG_FASTLINK, val); |
9728 |
++ if (ret) |
9729 |
++ goto err; |
9730 |
+ |
9731 |
++ ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, |
9732 |
++ MSCC_PHY_PAGE_STANDARD); |
9733 |
+ if (ret) |
9734 |
+ goto err; |
9735 |
+ |
9736 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
9737 |
+index b4978c5fb2ca..98369430a3be 100644 |
9738 |
+--- a/drivers/net/phy/phy_device.c |
9739 |
++++ b/drivers/net/phy/phy_device.c |
9740 |
+@@ -616,7 +616,9 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, |
9741 |
+ if (c45_ids) |
9742 |
+ dev->c45_ids = *c45_ids; |
9743 |
+ dev->irq = bus->irq[addr]; |
9744 |
++ |
9745 |
+ dev_set_name(&mdiodev->dev, PHY_ID_FMT, bus->id, addr); |
9746 |
++ device_initialize(&mdiodev->dev); |
9747 |
+ |
9748 |
+ dev->state = PHY_DOWN; |
9749 |
+ |
9750 |
+@@ -650,10 +652,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, |
9751 |
+ ret = phy_request_driver_module(dev, phy_id); |
9752 |
+ } |
9753 |
+ |
9754 |
+- if (!ret) { |
9755 |
+- device_initialize(&mdiodev->dev); |
9756 |
+- } else { |
9757 |
+- kfree(dev); |
9758 |
++ if (ret) { |
9759 |
++ put_device(&mdiodev->dev); |
9760 |
+ dev = ERR_PTR(ret); |
9761 |
+ } |
9762 |
+ |
9763 |
+diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c |
9764 |
+index 7d39f998535d..2b02fefd094d 100644 |
9765 |
+--- a/drivers/net/usb/r8152.c |
9766 |
++++ b/drivers/net/usb/r8152.c |
9767 |
+@@ -1504,7 +1504,7 @@ static int determine_ethernet_addr(struct r8152 *tp, struct sockaddr *sa) |
9768 |
+ |
9769 |
+ sa->sa_family = dev->type; |
9770 |
+ |
9771 |
+- ret = eth_platform_get_mac_address(&dev->dev, sa->sa_data); |
9772 |
++ ret = eth_platform_get_mac_address(&tp->udev->dev, sa->sa_data); |
9773 |
+ if (ret < 0) { |
9774 |
+ if (tp->version == RTL_VER_01) { |
9775 |
+ ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data); |
9776 |
+diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c |
9777 |
+index ca395f9679d0..2818015324b8 100644 |
9778 |
+--- a/drivers/net/vmxnet3/vmxnet3_drv.c |
9779 |
++++ b/drivers/net/vmxnet3/vmxnet3_drv.c |
9780 |
+@@ -886,7 +886,8 @@ vmxnet3_parse_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, |
9781 |
+ |
9782 |
+ switch (protocol) { |
9783 |
+ case IPPROTO_TCP: |
9784 |
+- ctx->l4_hdr_size = tcp_hdrlen(skb); |
9785 |
++ ctx->l4_hdr_size = skb->encapsulation ? inner_tcp_hdrlen(skb) : |
9786 |
++ tcp_hdrlen(skb); |
9787 |
+ break; |
9788 |
+ case IPPROTO_UDP: |
9789 |
+ ctx->l4_hdr_size = sizeof(struct udphdr); |
9790 |
+diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
9791 |
+index a7c3939264b0..35a7d409d8d3 100644 |
9792 |
+--- a/drivers/net/vxlan.c |
9793 |
++++ b/drivers/net/vxlan.c |
9794 |
+@@ -2722,7 +2722,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
9795 |
+ ndst = &rt->dst; |
9796 |
+ skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM); |
9797 |
+ |
9798 |
+- tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); |
9799 |
++ tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
9800 |
+ ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); |
9801 |
+ err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr), |
9802 |
+ vni, md, flags, udp_sum); |
9803 |
+@@ -2762,7 +2762,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
9804 |
+ |
9805 |
+ skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM); |
9806 |
+ |
9807 |
+- tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); |
9808 |
++ tos = ip_tunnel_ecn_encap(tos, old_iph, skb); |
9809 |
+ ttl = ttl ? : ip6_dst_hoplimit(ndst); |
9810 |
+ skb_scrub_packet(skb, xnet); |
9811 |
+ err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr), |
9812 |
+diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c |
9813 |
+index b2868433718f..1ea15f2123ed 100644 |
9814 |
+--- a/drivers/net/wan/lapbether.c |
9815 |
++++ b/drivers/net/wan/lapbether.c |
9816 |
+@@ -157,6 +157,12 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, |
9817 |
+ if (!netif_running(dev)) |
9818 |
+ goto drop; |
9819 |
+ |
9820 |
++ /* There should be a pseudo header of 1 byte added by upper layers. |
9821 |
++ * Check to make sure it is there before reading it. |
9822 |
++ */ |
9823 |
++ if (skb->len < 1) |
9824 |
++ goto drop; |
9825 |
++ |
9826 |
+ switch (skb->data[0]) { |
9827 |
+ case X25_IFACE_DATA: |
9828 |
+ break; |
9829 |
+@@ -305,6 +311,7 @@ static void lapbeth_setup(struct net_device *dev) |
9830 |
+ dev->netdev_ops = &lapbeth_netdev_ops; |
9831 |
+ dev->needs_free_netdev = true; |
9832 |
+ dev->type = ARPHRD_X25; |
9833 |
++ dev->hard_header_len = 0; |
9834 |
+ dev->mtu = 1000; |
9835 |
+ dev->addr_len = 0; |
9836 |
+ } |
9837 |
+@@ -331,7 +338,8 @@ static int lapbeth_new_device(struct net_device *dev) |
9838 |
+ * then this driver prepends a length field of 2 bytes, |
9839 |
+ * then the underlying Ethernet device prepends its own header. |
9840 |
+ */ |
9841 |
+- ndev->hard_header_len = -1 + 3 + 2 + dev->hard_header_len; |
9842 |
++ ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len |
9843 |
++ + dev->needed_headroom; |
9844 |
+ |
9845 |
+ lapbeth = netdev_priv(ndev); |
9846 |
+ lapbeth->axdev = ndev; |
9847 |
+diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c |
9848 |
+index 4fd10ac3a941..bbe869575855 100644 |
9849 |
+--- a/drivers/net/wireless/ath/ath10k/htt_tx.c |
9850 |
++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c |
9851 |
+@@ -1591,7 +1591,9 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt, |
9852 |
+ err_unmap_msdu: |
9853 |
+ dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); |
9854 |
+ err_free_msdu_id: |
9855 |
++ spin_lock_bh(&htt->tx_lock); |
9856 |
+ ath10k_htt_tx_free_msdu_id(htt, msdu_id); |
9857 |
++ spin_unlock_bh(&htt->tx_lock); |
9858 |
+ err: |
9859 |
+ return res; |
9860 |
+ } |
9861 |
+@@ -1798,7 +1800,9 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt, |
9862 |
+ err_unmap_msdu: |
9863 |
+ dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); |
9864 |
+ err_free_msdu_id: |
9865 |
++ spin_lock_bh(&htt->tx_lock); |
9866 |
+ ath10k_htt_tx_free_msdu_id(htt, msdu_id); |
9867 |
++ spin_unlock_bh(&htt->tx_lock); |
9868 |
+ err: |
9869 |
+ return res; |
9870 |
+ } |
9871 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
9872 |
+index de0ef1b545c4..2e31cc10c195 100644 |
9873 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
9874 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h |
9875 |
+@@ -19,7 +19,7 @@ |
9876 |
+ #define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 |
9877 |
+ |
9878 |
+ #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ |
9879 |
+-#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002 |
9880 |
++#define BRCMF_BSS_RSSI_ON_CHANNEL 0x0004 |
9881 |
+ |
9882 |
+ #define BRCMF_STA_BRCM 0x00000001 /* Running a Broadcom driver */ |
9883 |
+ #define BRCMF_STA_WME 0x00000002 /* WMM association */ |
9884 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
9885 |
+index 09701262330d..babaac682f13 100644 |
9886 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
9887 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
9888 |
+@@ -621,6 +621,7 @@ static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h, |
9889 |
+ static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
9890 |
+ int ifidx) |
9891 |
+ { |
9892 |
++ struct brcmf_fws_hanger_item *hi; |
9893 |
+ bool (*matchfn)(struct sk_buff *, void *) = NULL; |
9894 |
+ struct sk_buff *skb; |
9895 |
+ int prec; |
9896 |
+@@ -632,6 +633,9 @@ static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
9897 |
+ skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
9898 |
+ while (skb) { |
9899 |
+ hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
9900 |
++ hi = &fws->hanger.items[hslot]; |
9901 |
++ WARN_ON(skb != hi->pkt); |
9902 |
++ hi->state = BRCMF_FWS_HANGER_ITEM_STATE_FREE; |
9903 |
+ brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, |
9904 |
+ true); |
9905 |
+ brcmu_pkt_buf_free_skb(skb); |
9906 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
9907 |
+index 310d8075f5d7..bc02168ebb53 100644 |
9908 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
9909 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
9910 |
+@@ -3699,7 +3699,11 @@ static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus) |
9911 |
+ if (bus->idlecount > bus->idletime) { |
9912 |
+ brcmf_dbg(SDIO, "idle\n"); |
9913 |
+ sdio_claim_host(bus->sdiodev->func1); |
9914 |
+- brcmf_sdio_wd_timer(bus, false); |
9915 |
++#ifdef DEBUG |
9916 |
++ if (!BRCMF_FWCON_ON() || |
9917 |
++ bus->console_interval == 0) |
9918 |
++#endif |
9919 |
++ brcmf_sdio_wd_timer(bus, false); |
9920 |
+ bus->idlecount = 0; |
9921 |
+ brcmf_sdio_bus_sleep(bus, true, false); |
9922 |
+ sdio_release_host(bus->sdiodev->func1); |
9923 |
+diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c |
9924 |
+index 348c17ce72f5..f78e062df572 100644 |
9925 |
+--- a/drivers/net/wireless/intel/iwlegacy/common.c |
9926 |
++++ b/drivers/net/wireless/intel/iwlegacy/common.c |
9927 |
+@@ -4286,8 +4286,8 @@ il_apm_init(struct il_priv *il) |
9928 |
+ * power savings, even without L1. |
9929 |
+ */ |
9930 |
+ if (il->cfg->set_l0s) { |
9931 |
+- pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); |
9932 |
+- if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { |
9933 |
++ ret = pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); |
9934 |
++ if (!ret && (lctl & PCI_EXP_LNKCTL_ASPM_L1)) { |
9935 |
+ /* L1-ASPM enabled; disable(!) L0S */ |
9936 |
+ il_set_bit(il, CSR_GIO_REG, |
9937 |
+ CSR_GIO_REG_VAL_L0S_ENABLED); |
9938 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h |
9939 |
+index 71cd8629b28e..8b476b007c5e 100644 |
9940 |
+--- a/drivers/net/wireless/marvell/mwifiex/sdio.h |
9941 |
++++ b/drivers/net/wireless/marvell/mwifiex/sdio.h |
9942 |
+@@ -36,9 +36,9 @@ |
9943 |
+ #define SD8897_DEFAULT_FW_NAME "mrvl/sd8897_uapsta.bin" |
9944 |
+ #define SD8887_DEFAULT_FW_NAME "mrvl/sd8887_uapsta.bin" |
9945 |
+ #define SD8801_DEFAULT_FW_NAME "mrvl/sd8801_uapsta.bin" |
9946 |
+-#define SD8977_DEFAULT_FW_NAME "mrvl/sd8977_uapsta.bin" |
9947 |
++#define SD8977_DEFAULT_FW_NAME "mrvl/sdsd8977_combo_v2.bin" |
9948 |
+ #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin" |
9949 |
+-#define SD8997_DEFAULT_FW_NAME "mrvl/sd8997_uapsta.bin" |
9950 |
++#define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin" |
9951 |
+ |
9952 |
+ #define BLOCK_MODE 1 |
9953 |
+ #define BYTE_MODE 0 |
9954 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
9955 |
+index f21660149f58..962d8bfe6f10 100644 |
9956 |
+--- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
9957 |
++++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c |
9958 |
+@@ -580,6 +580,11 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, |
9959 |
+ { |
9960 |
+ struct host_cmd_ds_802_11_key_material *key = |
9961 |
+ &resp->params.key_material; |
9962 |
++ int len; |
9963 |
++ |
9964 |
++ len = le16_to_cpu(key->key_param_set.key_len); |
9965 |
++ if (len > sizeof(key->key_param_set.key)) |
9966 |
++ return -EINVAL; |
9967 |
+ |
9968 |
+ if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { |
9969 |
+ if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { |
9970 |
+@@ -593,9 +598,8 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, |
9971 |
+ |
9972 |
+ memset(priv->aes_key.key_param_set.key, 0, |
9973 |
+ sizeof(key->key_param_set.key)); |
9974 |
+- priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; |
9975 |
+- memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, |
9976 |
+- le16_to_cpu(priv->aes_key.key_param_set.key_len)); |
9977 |
++ priv->aes_key.key_param_set.key_len = cpu_to_le16(len); |
9978 |
++ memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, len); |
9979 |
+ |
9980 |
+ return 0; |
9981 |
+ } |
9982 |
+@@ -610,9 +614,14 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, |
9983 |
+ struct host_cmd_ds_command *resp) |
9984 |
+ { |
9985 |
+ struct host_cmd_ds_802_11_key_material_v2 *key_v2; |
9986 |
+- __le16 len; |
9987 |
++ int len; |
9988 |
+ |
9989 |
+ key_v2 = &resp->params.key_material_v2; |
9990 |
++ |
9991 |
++ len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len); |
9992 |
++ if (len > WLAN_KEY_LEN_CCMP) |
9993 |
++ return -EINVAL; |
9994 |
++ |
9995 |
+ if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) { |
9996 |
+ if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) { |
9997 |
+ mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n"); |
9998 |
+@@ -628,10 +637,9 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, |
9999 |
+ memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0, |
10000 |
+ WLAN_KEY_LEN_CCMP); |
10001 |
+ priv->aes_key_v2.key_param_set.key_params.aes.key_len = |
10002 |
+- key_v2->key_param_set.key_params.aes.key_len; |
10003 |
+- len = priv->aes_key_v2.key_param_set.key_params.aes.key_len; |
10004 |
++ cpu_to_le16(len); |
10005 |
+ memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key, |
10006 |
+- key_v2->key_param_set.key_params.aes.key, le16_to_cpu(len)); |
10007 |
++ key_v2->key_param_set.key_params.aes.key, len); |
10008 |
+ |
10009 |
+ return 0; |
10010 |
+ } |
10011 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c |
10012 |
+index 6e869b8c5e26..cb8c1d80ead9 100644 |
10013 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c |
10014 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c |
10015 |
+@@ -180,8 +180,10 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd, |
10016 |
+ struct mt7615_mcu_rxd *rxd = (struct mt7615_mcu_rxd *)skb->data; |
10017 |
+ int ret = 0; |
10018 |
+ |
10019 |
+- if (seq != rxd->seq) |
10020 |
+- return -EAGAIN; |
10021 |
++ if (seq != rxd->seq) { |
10022 |
++ ret = -EAGAIN; |
10023 |
++ goto out; |
10024 |
++ } |
10025 |
+ |
10026 |
+ switch (cmd) { |
10027 |
+ case MCU_CMD_PATCH_SEM_CONTROL: |
10028 |
+@@ -208,6 +210,7 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd, |
10029 |
+ default: |
10030 |
+ break; |
10031 |
+ } |
10032 |
++out: |
10033 |
+ dev_kfree_skb(skb); |
10034 |
+ |
10035 |
+ return ret; |
10036 |
+@@ -1206,8 +1209,12 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_dev *dev, struct ieee80211_vif *vif, |
10037 |
+ skb = enable ? wskb : sskb; |
10038 |
+ |
10039 |
+ err = __mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, true); |
10040 |
+- if (err < 0) |
10041 |
++ if (err < 0) { |
10042 |
++ skb = enable ? sskb : wskb; |
10043 |
++ dev_kfree_skb(skb); |
10044 |
++ |
10045 |
+ return err; |
10046 |
++ } |
10047 |
+ |
10048 |
+ cmd = enable ? MCU_EXT_CMD_STA_REC_UPDATE : MCU_EXT_CMD_WTBL_UPDATE; |
10049 |
+ skb = enable ? sskb : wskb; |
10050 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb.c |
10051 |
+index 5be6704770ad..7906e6a71c5b 100644 |
10052 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/usb.c |
10053 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb.c |
10054 |
+@@ -166,12 +166,16 @@ __mt7663u_mac_set_key(struct mt7615_dev *dev, |
10055 |
+ |
10056 |
+ lockdep_assert_held(&dev->mt76.mutex); |
10057 |
+ |
10058 |
+- if (!sta) |
10059 |
+- return -EINVAL; |
10060 |
++ if (!sta) { |
10061 |
++ err = -EINVAL; |
10062 |
++ goto out; |
10063 |
++ } |
10064 |
+ |
10065 |
+ cipher = mt7615_mac_get_cipher(key->cipher); |
10066 |
+- if (cipher == MT_CIPHER_NONE) |
10067 |
+- return -EOPNOTSUPP; |
10068 |
++ if (cipher == MT_CIPHER_NONE) { |
10069 |
++ err = -EOPNOTSUPP; |
10070 |
++ goto out; |
10071 |
++ } |
10072 |
+ |
10073 |
+ wcid = &wd->sta->wcid; |
10074 |
+ |
10075 |
+@@ -179,19 +183,22 @@ __mt7663u_mac_set_key(struct mt7615_dev *dev, |
10076 |
+ err = mt7615_mac_wtbl_update_key(dev, wcid, key->key, key->keylen, |
10077 |
+ cipher, key->cmd); |
10078 |
+ if (err < 0) |
10079 |
+- return err; |
10080 |
++ goto out; |
10081 |
+ |
10082 |
+ err = mt7615_mac_wtbl_update_pk(dev, wcid, cipher, key->keyidx, |
10083 |
+ key->cmd); |
10084 |
+ if (err < 0) |
10085 |
+- return err; |
10086 |
++ goto out; |
10087 |
+ |
10088 |
+ if (key->cmd == SET_KEY) |
10089 |
+ wcid->cipher |= BIT(cipher); |
10090 |
+ else |
10091 |
+ wcid->cipher &= ~BIT(cipher); |
10092 |
+ |
10093 |
+- return 0; |
10094 |
++out: |
10095 |
++ kfree(key->key); |
10096 |
++ |
10097 |
++ return err; |
10098 |
+ } |
10099 |
+ |
10100 |
+ void mt7663u_wtbl_work(struct work_struct *work) |
10101 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c |
10102 |
+index cd709fd617db..3e66ff98cab8 100644 |
10103 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c |
10104 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c |
10105 |
+@@ -34,7 +34,6 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, |
10106 |
+ |
10107 |
+ ret = mt76u_bulk_msg(&dev->mt76, skb->data, skb->len, NULL, |
10108 |
+ 1000, ep); |
10109 |
+- dev_kfree_skb(skb); |
10110 |
+ if (ret < 0) |
10111 |
+ goto out; |
10112 |
+ |
10113 |
+@@ -43,6 +42,7 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, |
10114 |
+ |
10115 |
+ out: |
10116 |
+ mutex_unlock(&mdev->mcu.mutex); |
10117 |
++ dev_kfree_skb(skb); |
10118 |
+ |
10119 |
+ return ret; |
10120 |
+ } |
10121 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c |
10122 |
+index 5278bee812f1..7e48f56b5b08 100644 |
10123 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c |
10124 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c |
10125 |
+@@ -384,6 +384,7 @@ int mt7915_init_debugfs(struct mt7915_dev *dev) |
10126 |
+ return 0; |
10127 |
+ } |
10128 |
+ |
10129 |
++#ifdef CONFIG_MAC80211_DEBUGFS |
10130 |
+ /** per-station debugfs **/ |
10131 |
+ |
10132 |
+ /* usage: <tx mode> <ldpc> <stbc> <bw> <gi> <nss> <mcs> */ |
10133 |
+@@ -461,3 +462,4 @@ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
10134 |
+ debugfs_create_file("fixed_rate", 0600, dir, sta, &fops_fixed_rate); |
10135 |
+ debugfs_create_file("stats", 0400, dir, sta, &fops_sta_stats); |
10136 |
+ } |
10137 |
++#endif |
10138 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c |
10139 |
+index c8c12c740c1a..8fb8255650a7 100644 |
10140 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c |
10141 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c |
10142 |
+@@ -505,15 +505,22 @@ static void |
10143 |
+ mt7915_mcu_tx_rate_report(struct mt7915_dev *dev, struct sk_buff *skb) |
10144 |
+ { |
10145 |
+ struct mt7915_mcu_ra_info *ra = (struct mt7915_mcu_ra_info *)skb->data; |
10146 |
+- u16 wcidx = le16_to_cpu(ra->wlan_idx); |
10147 |
+- struct mt76_wcid *wcid = rcu_dereference(dev->mt76.wcid[wcidx]); |
10148 |
+- struct mt7915_sta *msta = container_of(wcid, struct mt7915_sta, wcid); |
10149 |
+- struct mt7915_sta_stats *stats = &msta->stats; |
10150 |
+- struct mt76_phy *mphy = &dev->mphy; |
10151 |
+ struct rate_info rate = {}, prob_rate = {}; |
10152 |
++ u16 probe = le16_to_cpu(ra->prob_up_rate); |
10153 |
+ u16 attempts = le16_to_cpu(ra->attempts); |
10154 |
+ u16 curr = le16_to_cpu(ra->curr_rate); |
10155 |
+- u16 probe = le16_to_cpu(ra->prob_up_rate); |
10156 |
++ u16 wcidx = le16_to_cpu(ra->wlan_idx); |
10157 |
++ struct mt76_phy *mphy = &dev->mphy; |
10158 |
++ struct mt7915_sta_stats *stats; |
10159 |
++ struct mt7915_sta *msta; |
10160 |
++ struct mt76_wcid *wcid; |
10161 |
++ |
10162 |
++ if (wcidx >= MT76_N_WCIDS) |
10163 |
++ return; |
10164 |
++ |
10165 |
++ wcid = rcu_dereference(dev->mt76.wcid[wcidx]); |
10166 |
++ msta = container_of(wcid, struct mt7915_sta, wcid); |
10167 |
++ stats = &msta->stats; |
10168 |
+ |
10169 |
+ if (msta->wcid.ext_phy && dev->mt76.phy2) |
10170 |
+ mphy = dev->mt76.phy2; |
10171 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c |
10172 |
+index eea777f8acea..6aafff9d4231 100644 |
10173 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/core.c |
10174 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/core.c |
10175 |
+@@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus, |
10176 |
+ } |
10177 |
+ |
10178 |
+ wiphy = qtnf_wiphy_allocate(bus, pdev); |
10179 |
+- if (!wiphy) |
10180 |
++ if (!wiphy) { |
10181 |
++ if (pdev) |
10182 |
++ platform_device_unregister(pdev); |
10183 |
+ return ERR_PTR(-ENOMEM); |
10184 |
++ } |
10185 |
+ |
10186 |
+ mac = wiphy_priv(wiphy); |
10187 |
+ |
10188 |
+diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c |
10189 |
+index cbf3d503df1c..30ebe426a4ab 100644 |
10190 |
+--- a/drivers/net/wireless/realtek/rtw88/coex.c |
10191 |
++++ b/drivers/net/wireless/realtek/rtw88/coex.c |
10192 |
+@@ -1934,7 +1934,8 @@ static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) |
10193 |
+ if (coex_stat->wl_under_ips) |
10194 |
+ return; |
10195 |
+ |
10196 |
+- if (coex->freeze && !coex_stat->bt_setup_link) |
10197 |
++ if (coex->freeze && coex_dm->reason == COEX_RSN_BTINFO && |
10198 |
++ !coex_stat->bt_setup_link) |
10199 |
+ return; |
10200 |
+ |
10201 |
+ coex_stat->cnt_wl[COEX_CNT_WL_COEXRUN]++; |
10202 |
+diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c |
10203 |
+index 6478fd7a78f6..13e79482f6d5 100644 |
10204 |
+--- a/drivers/net/wireless/realtek/rtw88/fw.c |
10205 |
++++ b/drivers/net/wireless/realtek/rtw88/fw.c |
10206 |
+@@ -456,7 +456,7 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
10207 |
+ SET_RA_INFO_INIT_RA_LVL(h2c_pkt, si->init_ra_lv); |
10208 |
+ SET_RA_INFO_SGI_EN(h2c_pkt, si->sgi_enable); |
10209 |
+ SET_RA_INFO_BW_MODE(h2c_pkt, si->bw_mode); |
10210 |
+- SET_RA_INFO_LDPC(h2c_pkt, si->ldpc_en); |
10211 |
++ SET_RA_INFO_LDPC(h2c_pkt, !!si->ldpc_en); |
10212 |
+ SET_RA_INFO_NO_UPDATE(h2c_pkt, no_update); |
10213 |
+ SET_RA_INFO_VHT_EN(h2c_pkt, si->vht_enable); |
10214 |
+ SET_RA_INFO_DIS_PT(h2c_pkt, disable_pt); |
10215 |
+diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c |
10216 |
+index 0eefafc51c62..665d4bbdee6a 100644 |
10217 |
+--- a/drivers/net/wireless/realtek/rtw88/main.c |
10218 |
++++ b/drivers/net/wireless/realtek/rtw88/main.c |
10219 |
+@@ -722,8 +722,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
10220 |
+ stbc_en = VHT_STBC_EN; |
10221 |
+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC) |
10222 |
+ ldpc_en = VHT_LDPC_EN; |
10223 |
+- if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
10224 |
+- is_support_sgi = true; |
10225 |
+ } else if (sta->ht_cap.ht_supported) { |
10226 |
+ ra_mask |= (sta->ht_cap.mcs.rx_mask[1] << 20) | |
10227 |
+ (sta->ht_cap.mcs.rx_mask[0] << 12); |
10228 |
+@@ -731,9 +729,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
10229 |
+ stbc_en = HT_STBC_EN; |
10230 |
+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING) |
10231 |
+ ldpc_en = HT_LDPC_EN; |
10232 |
+- if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20 || |
10233 |
+- sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
10234 |
+- is_support_sgi = true; |
10235 |
+ } |
10236 |
+ |
10237 |
+ if (efuse->hw_cap.nss == 1) |
10238 |
+@@ -775,12 +770,18 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si) |
10239 |
+ switch (sta->bandwidth) { |
10240 |
+ case IEEE80211_STA_RX_BW_80: |
10241 |
+ bw_mode = RTW_CHANNEL_WIDTH_80; |
10242 |
++ is_support_sgi = sta->vht_cap.vht_supported && |
10243 |
++ (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80); |
10244 |
+ break; |
10245 |
+ case IEEE80211_STA_RX_BW_40: |
10246 |
+ bw_mode = RTW_CHANNEL_WIDTH_40; |
10247 |
++ is_support_sgi = sta->ht_cap.ht_supported && |
10248 |
++ (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40); |
10249 |
+ break; |
10250 |
+ default: |
10251 |
+ bw_mode = RTW_CHANNEL_WIDTH_20; |
10252 |
++ is_support_sgi = sta->ht_cap.ht_supported && |
10253 |
++ (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20); |
10254 |
+ break; |
10255 |
+ } |
10256 |
+ |
10257 |
+diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822ce.c b/drivers/net/wireless/realtek/rtw88/rtw8822ce.c |
10258 |
+index 7b6bd990651e..026ac49ce6e3 100644 |
10259 |
+--- a/drivers/net/wireless/realtek/rtw88/rtw8822ce.c |
10260 |
++++ b/drivers/net/wireless/realtek/rtw88/rtw8822ce.c |
10261 |
+@@ -11,6 +11,10 @@ static const struct pci_device_id rtw_8822ce_id_table[] = { |
10262 |
+ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xC822), |
10263 |
+ .driver_data = (kernel_ulong_t)&rtw8822c_hw_spec |
10264 |
+ }, |
10265 |
++ { |
10266 |
++ PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xC82F), |
10267 |
++ .driver_data = (kernel_ulong_t)&rtw8822c_hw_spec |
10268 |
++ }, |
10269 |
+ {} |
10270 |
+ }; |
10271 |
+ MODULE_DEVICE_TABLE(pci, rtw_8822ce_id_table); |
10272 |
+diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c |
10273 |
+index 850864dbafa1..e6d426edab56 100644 |
10274 |
+--- a/drivers/net/wireless/ti/wl1251/event.c |
10275 |
++++ b/drivers/net/wireless/ti/wl1251/event.c |
10276 |
+@@ -70,7 +70,7 @@ static int wl1251_event_ps_report(struct wl1251 *wl, |
10277 |
+ break; |
10278 |
+ } |
10279 |
+ |
10280 |
+- return 0; |
10281 |
++ return ret; |
10282 |
+ } |
10283 |
+ |
10284 |
+ static void wl1251_event_mbox_dump(struct event_mailbox *mbox) |
10285 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
10286 |
+index 66509472fe06..57d51148e71b 100644 |
10287 |
+--- a/drivers/nvme/host/multipath.c |
10288 |
++++ b/drivers/nvme/host/multipath.c |
10289 |
+@@ -246,6 +246,12 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, |
10290 |
+ fallback = ns; |
10291 |
+ } |
10292 |
+ |
10293 |
++ /* No optimized path found, re-check the current path */ |
10294 |
++ if (!nvme_path_is_disabled(old) && |
10295 |
++ old->ana_state == NVME_ANA_OPTIMIZED) { |
10296 |
++ found = old; |
10297 |
++ goto out; |
10298 |
++ } |
10299 |
+ if (!fallback) |
10300 |
+ return NULL; |
10301 |
+ found = fallback; |
10302 |
+@@ -266,10 +272,13 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head) |
10303 |
+ struct nvme_ns *ns; |
10304 |
+ |
10305 |
+ ns = srcu_dereference(head->current_path[node], &head->srcu); |
10306 |
+- if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns) |
10307 |
+- ns = nvme_round_robin_path(head, node, ns); |
10308 |
+- if (unlikely(!ns || !nvme_path_is_optimized(ns))) |
10309 |
+- ns = __nvme_find_path(head, node); |
10310 |
++ if (unlikely(!ns)) |
10311 |
++ return __nvme_find_path(head, node); |
10312 |
++ |
10313 |
++ if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR) |
10314 |
++ return nvme_round_robin_path(head, node, ns); |
10315 |
++ if (unlikely(!nvme_path_is_optimized(ns))) |
10316 |
++ return __nvme_find_path(head, node); |
10317 |
+ return ns; |
10318 |
+ } |
10319 |
+ |
10320 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
10321 |
+index 13506a87a444..af0cfd25ed7a 100644 |
10322 |
+--- a/drivers/nvme/host/rdma.c |
10323 |
++++ b/drivers/nvme/host/rdma.c |
10324 |
+@@ -941,15 +941,20 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) |
10325 |
+ ret = PTR_ERR(ctrl->ctrl.connect_q); |
10326 |
+ goto out_free_tag_set; |
10327 |
+ } |
10328 |
+- } else { |
10329 |
+- blk_mq_update_nr_hw_queues(&ctrl->tag_set, |
10330 |
+- ctrl->ctrl.queue_count - 1); |
10331 |
+ } |
10332 |
+ |
10333 |
+ ret = nvme_rdma_start_io_queues(ctrl); |
10334 |
+ if (ret) |
10335 |
+ goto out_cleanup_connect_q; |
10336 |
+ |
10337 |
++ if (!new) { |
10338 |
++ nvme_start_queues(&ctrl->ctrl); |
10339 |
++ nvme_wait_freeze(&ctrl->ctrl); |
10340 |
++ blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, |
10341 |
++ ctrl->ctrl.queue_count - 1); |
10342 |
++ nvme_unfreeze(&ctrl->ctrl); |
10343 |
++ } |
10344 |
++ |
10345 |
+ return 0; |
10346 |
+ |
10347 |
+ out_cleanup_connect_q: |
10348 |
+@@ -982,6 +987,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
10349 |
+ bool remove) |
10350 |
+ { |
10351 |
+ if (ctrl->ctrl.queue_count > 1) { |
10352 |
++ nvme_start_freeze(&ctrl->ctrl); |
10353 |
+ nvme_stop_queues(&ctrl->ctrl); |
10354 |
+ nvme_rdma_stop_io_queues(ctrl); |
10355 |
+ if (ctrl->ctrl.tagset) { |
10356 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
10357 |
+index f3a91818167b..83bb329d4113 100644 |
10358 |
+--- a/drivers/nvme/host/tcp.c |
10359 |
++++ b/drivers/nvme/host/tcp.c |
10360 |
+@@ -1744,15 +1744,20 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) |
10361 |
+ ret = PTR_ERR(ctrl->connect_q); |
10362 |
+ goto out_free_tag_set; |
10363 |
+ } |
10364 |
+- } else { |
10365 |
+- blk_mq_update_nr_hw_queues(ctrl->tagset, |
10366 |
+- ctrl->queue_count - 1); |
10367 |
+ } |
10368 |
+ |
10369 |
+ ret = nvme_tcp_start_io_queues(ctrl); |
10370 |
+ if (ret) |
10371 |
+ goto out_cleanup_connect_q; |
10372 |
+ |
10373 |
++ if (!new) { |
10374 |
++ nvme_start_queues(ctrl); |
10375 |
++ nvme_wait_freeze(ctrl); |
10376 |
++ blk_mq_update_nr_hw_queues(ctrl->tagset, |
10377 |
++ ctrl->queue_count - 1); |
10378 |
++ nvme_unfreeze(ctrl); |
10379 |
++ } |
10380 |
++ |
10381 |
+ return 0; |
10382 |
+ |
10383 |
+ out_cleanup_connect_q: |
10384 |
+@@ -1857,6 +1862,7 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
10385 |
+ { |
10386 |
+ if (ctrl->queue_count <= 1) |
10387 |
+ return; |
10388 |
++ nvme_start_freeze(ctrl); |
10389 |
+ nvme_stop_queues(ctrl); |
10390 |
+ nvme_tcp_stop_io_queues(ctrl); |
10391 |
+ if (ctrl->tagset) { |
10392 |
+diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c |
10393 |
+index 925feb21d5ad..59523245db8a 100644 |
10394 |
+--- a/drivers/nvmem/sprd-efuse.c |
10395 |
++++ b/drivers/nvmem/sprd-efuse.c |
10396 |
+@@ -378,8 +378,8 @@ static int sprd_efuse_probe(struct platform_device *pdev) |
10397 |
+ return -ENOMEM; |
10398 |
+ |
10399 |
+ efuse->base = devm_platform_ioremap_resource(pdev, 0); |
10400 |
+- if (!efuse->base) |
10401 |
+- return -ENOMEM; |
10402 |
++ if (IS_ERR(efuse->base)) |
10403 |
++ return PTR_ERR(efuse->base); |
10404 |
+ |
10405 |
+ ret = of_hwspin_lock_get_id(np, 0); |
10406 |
+ if (ret < 0) { |
10407 |
+diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c |
10408 |
+index 7e112829d250..00785fa81ff7 100644 |
10409 |
+--- a/drivers/parisc/sba_iommu.c |
10410 |
++++ b/drivers/parisc/sba_iommu.c |
10411 |
+@@ -1270,7 +1270,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) |
10412 |
+ ** (one that doesn't overlap memory or LMMIO space) in the |
10413 |
+ ** IBASE and IMASK registers. |
10414 |
+ */ |
10415 |
+- ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE); |
10416 |
++ ioc->ibase = READ_REG(ioc->ioc_hpa + IOC_IBASE) & ~0x1fffffULL; |
10417 |
+ iova_space_size = ~(READ_REG(ioc->ioc_hpa + IOC_IMASK) & 0xFFFFFFFFUL) + 1; |
10418 |
+ |
10419 |
+ if ((ioc->ibase < 0xfed00000UL) && ((ioc->ibase + iova_space_size) > 0xfee00000UL)) { |
10420 |
+diff --git a/drivers/pci/access.c b/drivers/pci/access.c |
10421 |
+index 79c4a2ef269a..9793f17fa184 100644 |
10422 |
+--- a/drivers/pci/access.c |
10423 |
++++ b/drivers/pci/access.c |
10424 |
+@@ -204,17 +204,13 @@ EXPORT_SYMBOL(pci_bus_set_ops); |
10425 |
+ static DECLARE_WAIT_QUEUE_HEAD(pci_cfg_wait); |
10426 |
+ |
10427 |
+ static noinline void pci_wait_cfg(struct pci_dev *dev) |
10428 |
++ __must_hold(&pci_lock) |
10429 |
+ { |
10430 |
+- DECLARE_WAITQUEUE(wait, current); |
10431 |
+- |
10432 |
+- __add_wait_queue(&pci_cfg_wait, &wait); |
10433 |
+ do { |
10434 |
+- set_current_state(TASK_UNINTERRUPTIBLE); |
10435 |
+ raw_spin_unlock_irq(&pci_lock); |
10436 |
+- schedule(); |
10437 |
++ wait_event(pci_cfg_wait, !dev->block_cfg_access); |
10438 |
+ raw_spin_lock_irq(&pci_lock); |
10439 |
+ } while (dev->block_cfg_access); |
10440 |
+- __remove_wait_queue(&pci_cfg_wait, &wait); |
10441 |
+ } |
10442 |
+ |
10443 |
+ /* Returns 0 on success, negative values indicate error. */ |
10444 |
+diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c |
10445 |
+index 1c15c8352125..4a829ccff7d0 100644 |
10446 |
+--- a/drivers/pci/controller/cadence/pcie-cadence-ep.c |
10447 |
++++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c |
10448 |
+@@ -8,7 +8,6 @@ |
10449 |
+ #include <linux/of.h> |
10450 |
+ #include <linux/pci-epc.h> |
10451 |
+ #include <linux/platform_device.h> |
10452 |
+-#include <linux/pm_runtime.h> |
10453 |
+ #include <linux/sizes.h> |
10454 |
+ |
10455 |
+ #include "pcie-cadence.h" |
10456 |
+@@ -440,8 +439,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) |
10457 |
+ epc = devm_pci_epc_create(dev, &cdns_pcie_epc_ops); |
10458 |
+ if (IS_ERR(epc)) { |
10459 |
+ dev_err(dev, "failed to create epc device\n"); |
10460 |
+- ret = PTR_ERR(epc); |
10461 |
+- goto err_init; |
10462 |
++ return PTR_ERR(epc); |
10463 |
+ } |
10464 |
+ |
10465 |
+ epc_set_drvdata(epc, ep); |
10466 |
+@@ -453,7 +451,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) |
10467 |
+ resource_size(pcie->mem_res), PAGE_SIZE); |
10468 |
+ if (ret < 0) { |
10469 |
+ dev_err(dev, "failed to initialize the memory space\n"); |
10470 |
+- goto err_init; |
10471 |
++ return ret; |
10472 |
+ } |
10473 |
+ |
10474 |
+ ep->irq_cpu_addr = pci_epc_mem_alloc_addr(epc, &ep->irq_phys_addr, |
10475 |
+@@ -472,8 +470,5 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) |
10476 |
+ free_epc_mem: |
10477 |
+ pci_epc_mem_exit(epc); |
10478 |
+ |
10479 |
+- err_init: |
10480 |
+- pm_runtime_put_sync(dev); |
10481 |
+- |
10482 |
+ return ret; |
10483 |
+ } |
10484 |
+diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c |
10485 |
+index 8c2543f28ba0..b2411e8e6f18 100644 |
10486 |
+--- a/drivers/pci/controller/cadence/pcie-cadence-host.c |
10487 |
++++ b/drivers/pci/controller/cadence/pcie-cadence-host.c |
10488 |
+@@ -7,7 +7,6 @@ |
10489 |
+ #include <linux/of_address.h> |
10490 |
+ #include <linux/of_pci.h> |
10491 |
+ #include <linux/platform_device.h> |
10492 |
+-#include <linux/pm_runtime.h> |
10493 |
+ |
10494 |
+ #include "pcie-cadence.h" |
10495 |
+ |
10496 |
+@@ -70,6 +69,7 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc) |
10497 |
+ { |
10498 |
+ struct cdns_pcie *pcie = &rc->pcie; |
10499 |
+ u32 value, ctrl; |
10500 |
++ u32 id; |
10501 |
+ |
10502 |
+ /* |
10503 |
+ * Set the root complex BAR configuration register: |
10504 |
+@@ -89,8 +89,12 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc) |
10505 |
+ cdns_pcie_writel(pcie, CDNS_PCIE_LM_RC_BAR_CFG, value); |
10506 |
+ |
10507 |
+ /* Set root port configuration space */ |
10508 |
+- if (rc->vendor_id != 0xffff) |
10509 |
+- cdns_pcie_rp_writew(pcie, PCI_VENDOR_ID, rc->vendor_id); |
10510 |
++ if (rc->vendor_id != 0xffff) { |
10511 |
++ id = CDNS_PCIE_LM_ID_VENDOR(rc->vendor_id) | |
10512 |
++ CDNS_PCIE_LM_ID_SUBSYS(rc->vendor_id); |
10513 |
++ cdns_pcie_writel(pcie, CDNS_PCIE_LM_ID, id); |
10514 |
++ } |
10515 |
++ |
10516 |
+ if (rc->device_id != 0xffff) |
10517 |
+ cdns_pcie_rp_writew(pcie, PCI_DEVICE_ID, rc->device_id); |
10518 |
+ |
10519 |
+@@ -250,7 +254,7 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc) |
10520 |
+ |
10521 |
+ ret = cdns_pcie_host_init(dev, &resources, rc); |
10522 |
+ if (ret) |
10523 |
+- goto err_init; |
10524 |
++ return ret; |
10525 |
+ |
10526 |
+ list_splice_init(&resources, &bridge->windows); |
10527 |
+ bridge->dev.parent = dev; |
10528 |
+@@ -268,8 +272,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc) |
10529 |
+ err_host_probe: |
10530 |
+ pci_free_resource_list(&resources); |
10531 |
+ |
10532 |
+- err_init: |
10533 |
+- pm_runtime_put_sync(dev); |
10534 |
+- |
10535 |
+ return ret; |
10536 |
+ } |
10537 |
+diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controller/pci-loongson.c |
10538 |
+index 459009c8a4a0..58b862aaa6e9 100644 |
10539 |
+--- a/drivers/pci/controller/pci-loongson.c |
10540 |
++++ b/drivers/pci/controller/pci-loongson.c |
10541 |
+@@ -37,11 +37,11 @@ static void bridge_class_quirk(struct pci_dev *dev) |
10542 |
+ { |
10543 |
+ dev->class = PCI_CLASS_BRIDGE_PCI << 8; |
10544 |
+ } |
10545 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LOONGSON, |
10546 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, |
10547 |
+ DEV_PCIE_PORT_0, bridge_class_quirk); |
10548 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LOONGSON, |
10549 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, |
10550 |
+ DEV_PCIE_PORT_1, bridge_class_quirk); |
10551 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LOONGSON, |
10552 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, |
10553 |
+ DEV_PCIE_PORT_2, bridge_class_quirk); |
10554 |
+ |
10555 |
+ static void system_bus_quirk(struct pci_dev *pdev) |
10556 |
+diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c |
10557 |
+index d210a36561be..060c24f5221e 100644 |
10558 |
+--- a/drivers/pci/controller/pcie-rcar-host.c |
10559 |
++++ b/drivers/pci/controller/pcie-rcar-host.c |
10560 |
+@@ -986,7 +986,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) |
10561 |
+ err = pm_runtime_get_sync(pcie->dev); |
10562 |
+ if (err < 0) { |
10563 |
+ dev_err(pcie->dev, "pm_runtime_get_sync failed\n"); |
10564 |
+- goto err_pm_disable; |
10565 |
++ goto err_pm_put; |
10566 |
+ } |
10567 |
+ |
10568 |
+ err = rcar_pcie_get_resources(host); |
10569 |
+@@ -1057,8 +1057,6 @@ err_unmap_msi_irqs: |
10570 |
+ |
10571 |
+ err_pm_put: |
10572 |
+ pm_runtime_put(dev); |
10573 |
+- |
10574 |
+-err_pm_disable: |
10575 |
+ pm_runtime_disable(dev); |
10576 |
+ pci_free_resource_list(&host->resources); |
10577 |
+ |
10578 |
+diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c |
10579 |
+index 9a64cf90c291..ebec0a6e77ed 100644 |
10580 |
+--- a/drivers/pci/controller/vmd.c |
10581 |
++++ b/drivers/pci/controller/vmd.c |
10582 |
+@@ -560,6 +560,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) |
10583 |
+ if (!vmd->bus) { |
10584 |
+ pci_free_resource_list(&resources); |
10585 |
+ irq_domain_remove(vmd->irq_domain); |
10586 |
++ irq_domain_free_fwnode(fn); |
10587 |
+ return -ENODEV; |
10588 |
+ } |
10589 |
+ |
10590 |
+@@ -673,6 +674,7 @@ static void vmd_cleanup_srcu(struct vmd_dev *vmd) |
10591 |
+ static void vmd_remove(struct pci_dev *dev) |
10592 |
+ { |
10593 |
+ struct vmd_dev *vmd = pci_get_drvdata(dev); |
10594 |
++ struct fwnode_handle *fn = vmd->irq_domain->fwnode; |
10595 |
+ |
10596 |
+ sysfs_remove_link(&vmd->dev->dev.kobj, "domain"); |
10597 |
+ pci_stop_root_bus(vmd->bus); |
10598 |
+@@ -680,6 +682,7 @@ static void vmd_remove(struct pci_dev *dev) |
10599 |
+ vmd_cleanup_srcu(vmd); |
10600 |
+ vmd_detach_resources(vmd); |
10601 |
+ irq_domain_remove(vmd->irq_domain); |
10602 |
++ irq_domain_free_fwnode(fn); |
10603 |
+ } |
10604 |
+ |
10605 |
+ #ifdef CONFIG_PM_SLEEP |
10606 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
10607 |
+index b17e5ffd31b1..253c30cc1967 100644 |
10608 |
+--- a/drivers/pci/pcie/aspm.c |
10609 |
++++ b/drivers/pci/pcie/aspm.c |
10610 |
+@@ -1182,6 +1182,7 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp) |
10611 |
+ cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]); |
10612 |
+ else |
10613 |
+ cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); |
10614 |
++ cnt += sprintf(buffer + cnt, "\n"); |
10615 |
+ return cnt; |
10616 |
+ } |
10617 |
+ |
10618 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
10619 |
+index 2ea61abd5830..d442219cd270 100644 |
10620 |
+--- a/drivers/pci/quirks.c |
10621 |
++++ b/drivers/pci/quirks.c |
10622 |
+@@ -4422,6 +4422,8 @@ static int pci_quirk_amd_sb_acs(struct pci_dev *dev, u16 acs_flags) |
10623 |
+ if (ACPI_FAILURE(status)) |
10624 |
+ return -ENODEV; |
10625 |
+ |
10626 |
++ acpi_put_table(header); |
10627 |
++ |
10628 |
+ /* Filter out flags not applicable to multifunction */ |
10629 |
+ acs_flags &= (PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_EC | PCI_ACS_DT); |
10630 |
+ |
10631 |
+diff --git a/drivers/phy/cadence/phy-cadence-salvo.c b/drivers/phy/cadence/phy-cadence-salvo.c |
10632 |
+index 1ecbb964cd21..016514e4aa54 100644 |
10633 |
+--- a/drivers/phy/cadence/phy-cadence-salvo.c |
10634 |
++++ b/drivers/phy/cadence/phy-cadence-salvo.c |
10635 |
+@@ -88,7 +88,7 @@ |
10636 |
+ #define TB_ADDR_TX_RCVDETSC_CTRL 0x4124 |
10637 |
+ |
10638 |
+ /* TB_ADDR_TX_RCVDETSC_CTRL */ |
10639 |
+-#define RXDET_IN_P3_32KHZ BIT(1) |
10640 |
++#define RXDET_IN_P3_32KHZ BIT(0) |
10641 |
+ |
10642 |
+ struct cdns_reg_pairs { |
10643 |
+ u16 val; |
10644 |
+diff --git a/drivers/phy/marvell/phy-armada38x-comphy.c b/drivers/phy/marvell/phy-armada38x-comphy.c |
10645 |
+index 6960dfd8ad8c..0fe408964334 100644 |
10646 |
+--- a/drivers/phy/marvell/phy-armada38x-comphy.c |
10647 |
++++ b/drivers/phy/marvell/phy-armada38x-comphy.c |
10648 |
+@@ -41,6 +41,7 @@ struct a38x_comphy_lane { |
10649 |
+ |
10650 |
+ struct a38x_comphy { |
10651 |
+ void __iomem *base; |
10652 |
++ void __iomem *conf; |
10653 |
+ struct device *dev; |
10654 |
+ struct a38x_comphy_lane lane[MAX_A38X_COMPHY]; |
10655 |
+ }; |
10656 |
+@@ -54,6 +55,21 @@ static const u8 gbe_mux[MAX_A38X_COMPHY][MAX_A38X_PORTS] = { |
10657 |
+ { 0, 0, 3 }, |
10658 |
+ }; |
10659 |
+ |
10660 |
++static void a38x_set_conf(struct a38x_comphy_lane *lane, bool enable) |
10661 |
++{ |
10662 |
++ struct a38x_comphy *priv = lane->priv; |
10663 |
++ u32 conf; |
10664 |
++ |
10665 |
++ if (priv->conf) { |
10666 |
++ conf = readl_relaxed(priv->conf); |
10667 |
++ if (enable) |
10668 |
++ conf |= BIT(lane->port); |
10669 |
++ else |
10670 |
++ conf &= ~BIT(lane->port); |
10671 |
++ writel(conf, priv->conf); |
10672 |
++ } |
10673 |
++} |
10674 |
++ |
10675 |
+ static void a38x_comphy_set_reg(struct a38x_comphy_lane *lane, |
10676 |
+ unsigned int offset, u32 mask, u32 value) |
10677 |
+ { |
10678 |
+@@ -97,6 +113,7 @@ static int a38x_comphy_set_mode(struct phy *phy, enum phy_mode mode, int sub) |
10679 |
+ { |
10680 |
+ struct a38x_comphy_lane *lane = phy_get_drvdata(phy); |
10681 |
+ unsigned int gen; |
10682 |
++ int ret; |
10683 |
+ |
10684 |
+ if (mode != PHY_MODE_ETHERNET) |
10685 |
+ return -EINVAL; |
10686 |
+@@ -115,13 +132,20 @@ static int a38x_comphy_set_mode(struct phy *phy, enum phy_mode mode, int sub) |
10687 |
+ return -EINVAL; |
10688 |
+ } |
10689 |
+ |
10690 |
++ a38x_set_conf(lane, false); |
10691 |
++ |
10692 |
+ a38x_comphy_set_speed(lane, gen, gen); |
10693 |
+ |
10694 |
+- return a38x_comphy_poll(lane, COMPHY_STAT1, |
10695 |
+- COMPHY_STAT1_PLL_RDY_TX | |
10696 |
+- COMPHY_STAT1_PLL_RDY_RX, |
10697 |
+- COMPHY_STAT1_PLL_RDY_TX | |
10698 |
+- COMPHY_STAT1_PLL_RDY_RX); |
10699 |
++ ret = a38x_comphy_poll(lane, COMPHY_STAT1, |
10700 |
++ COMPHY_STAT1_PLL_RDY_TX | |
10701 |
++ COMPHY_STAT1_PLL_RDY_RX, |
10702 |
++ COMPHY_STAT1_PLL_RDY_TX | |
10703 |
++ COMPHY_STAT1_PLL_RDY_RX); |
10704 |
++ |
10705 |
++ if (ret == 0) |
10706 |
++ a38x_set_conf(lane, true); |
10707 |
++ |
10708 |
++ return ret; |
10709 |
+ } |
10710 |
+ |
10711 |
+ static const struct phy_ops a38x_comphy_ops = { |
10712 |
+@@ -174,14 +198,21 @@ static int a38x_comphy_probe(struct platform_device *pdev) |
10713 |
+ if (!priv) |
10714 |
+ return -ENOMEM; |
10715 |
+ |
10716 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
10717 |
+- base = devm_ioremap_resource(&pdev->dev, res); |
10718 |
++ base = devm_platform_ioremap_resource(pdev, 0); |
10719 |
+ if (IS_ERR(base)) |
10720 |
+ return PTR_ERR(base); |
10721 |
+ |
10722 |
+ priv->dev = &pdev->dev; |
10723 |
+ priv->base = base; |
10724 |
+ |
10725 |
++ /* Optional */ |
10726 |
++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "conf"); |
10727 |
++ if (res) { |
10728 |
++ priv->conf = devm_ioremap_resource(&pdev->dev, res); |
10729 |
++ if (IS_ERR(priv->conf)) |
10730 |
++ return PTR_ERR(priv->conf); |
10731 |
++ } |
10732 |
++ |
10733 |
+ for_each_available_child_of_node(pdev->dev.of_node, child) { |
10734 |
+ struct phy *phy; |
10735 |
+ int ret; |
10736 |
+diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
10737 |
+index bfb22f868857..5087b7c44d55 100644 |
10738 |
+--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
10739 |
++++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
10740 |
+@@ -111,6 +111,7 @@ struct rcar_gen3_chan { |
10741 |
+ struct work_struct work; |
10742 |
+ struct mutex lock; /* protects rphys[...].powered */ |
10743 |
+ enum usb_dr_mode dr_mode; |
10744 |
++ int irq; |
10745 |
+ bool extcon_host; |
10746 |
+ bool is_otg_channel; |
10747 |
+ bool uses_otg_pins; |
10748 |
+@@ -389,12 +390,38 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch) |
10749 |
+ rcar_gen3_device_recognition(ch); |
10750 |
+ } |
10751 |
+ |
10752 |
++static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) |
10753 |
++{ |
10754 |
++ struct rcar_gen3_chan *ch = _ch; |
10755 |
++ void __iomem *usb2_base = ch->base; |
10756 |
++ u32 status = readl(usb2_base + USB2_OBINTSTA); |
10757 |
++ irqreturn_t ret = IRQ_NONE; |
10758 |
++ |
10759 |
++ if (status & USB2_OBINT_BITS) { |
10760 |
++ dev_vdbg(ch->dev, "%s: %08x\n", __func__, status); |
10761 |
++ writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA); |
10762 |
++ rcar_gen3_device_recognition(ch); |
10763 |
++ ret = IRQ_HANDLED; |
10764 |
++ } |
10765 |
++ |
10766 |
++ return ret; |
10767 |
++} |
10768 |
++ |
10769 |
+ static int rcar_gen3_phy_usb2_init(struct phy *p) |
10770 |
+ { |
10771 |
+ struct rcar_gen3_phy *rphy = phy_get_drvdata(p); |
10772 |
+ struct rcar_gen3_chan *channel = rphy->ch; |
10773 |
+ void __iomem *usb2_base = channel->base; |
10774 |
+ u32 val; |
10775 |
++ int ret; |
10776 |
++ |
10777 |
++ if (!rcar_gen3_is_any_rphy_initialized(channel) && channel->irq >= 0) { |
10778 |
++ INIT_WORK(&channel->work, rcar_gen3_phy_usb2_work); |
10779 |
++ ret = request_irq(channel->irq, rcar_gen3_phy_usb2_irq, |
10780 |
++ IRQF_SHARED, dev_name(channel->dev), channel); |
10781 |
++ if (ret < 0) |
10782 |
++ dev_err(channel->dev, "No irq handler (%d)\n", channel->irq); |
10783 |
++ } |
10784 |
+ |
10785 |
+ /* Initialize USB2 part */ |
10786 |
+ val = readl(usb2_base + USB2_INT_ENABLE); |
10787 |
+@@ -433,6 +460,9 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p) |
10788 |
+ val &= ~USB2_INT_ENABLE_UCOM_INTEN; |
10789 |
+ writel(val, usb2_base + USB2_INT_ENABLE); |
10790 |
+ |
10791 |
++ if (channel->irq >= 0 && !rcar_gen3_is_any_rphy_initialized(channel)) |
10792 |
++ free_irq(channel->irq, channel); |
10793 |
++ |
10794 |
+ return 0; |
10795 |
+ } |
10796 |
+ |
10797 |
+@@ -503,23 +533,6 @@ static const struct phy_ops rz_g1c_phy_usb2_ops = { |
10798 |
+ .owner = THIS_MODULE, |
10799 |
+ }; |
10800 |
+ |
10801 |
+-static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) |
10802 |
+-{ |
10803 |
+- struct rcar_gen3_chan *ch = _ch; |
10804 |
+- void __iomem *usb2_base = ch->base; |
10805 |
+- u32 status = readl(usb2_base + USB2_OBINTSTA); |
10806 |
+- irqreturn_t ret = IRQ_NONE; |
10807 |
+- |
10808 |
+- if (status & USB2_OBINT_BITS) { |
10809 |
+- dev_vdbg(ch->dev, "%s: %08x\n", __func__, status); |
10810 |
+- writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA); |
10811 |
+- rcar_gen3_device_recognition(ch); |
10812 |
+- ret = IRQ_HANDLED; |
10813 |
+- } |
10814 |
+- |
10815 |
+- return ret; |
10816 |
+-} |
10817 |
+- |
10818 |
+ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = { |
10819 |
+ { |
10820 |
+ .compatible = "renesas,usb2-phy-r8a77470", |
10821 |
+@@ -598,7 +611,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) |
10822 |
+ struct phy_provider *provider; |
10823 |
+ struct resource *res; |
10824 |
+ const struct phy_ops *phy_usb2_ops; |
10825 |
+- int irq, ret = 0, i; |
10826 |
++ int ret = 0, i; |
10827 |
+ |
10828 |
+ if (!dev->of_node) { |
10829 |
+ dev_err(dev, "This driver needs device tree\n"); |
10830 |
+@@ -614,16 +627,8 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) |
10831 |
+ if (IS_ERR(channel->base)) |
10832 |
+ return PTR_ERR(channel->base); |
10833 |
+ |
10834 |
+- /* call request_irq for OTG */ |
10835 |
+- irq = platform_get_irq_optional(pdev, 0); |
10836 |
+- if (irq >= 0) { |
10837 |
+- INIT_WORK(&channel->work, rcar_gen3_phy_usb2_work); |
10838 |
+- irq = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq, |
10839 |
+- IRQF_SHARED, dev_name(dev), channel); |
10840 |
+- if (irq < 0) |
10841 |
+- dev_err(dev, "No irq handler (%d)\n", irq); |
10842 |
+- } |
10843 |
+- |
10844 |
++ /* get irq number here and request_irq for OTG in phy_init */ |
10845 |
++ channel->irq = platform_get_irq_optional(pdev, 0); |
10846 |
+ channel->dr_mode = rcar_gen3_get_dr_mode(dev->of_node); |
10847 |
+ if (channel->dr_mode != USB_DR_MODE_UNKNOWN) { |
10848 |
+ int ret; |
10849 |
+diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c |
10850 |
+index e510732afb8b..7f6279fb4f8f 100644 |
10851 |
+--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c |
10852 |
++++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c |
10853 |
+@@ -714,7 +714,9 @@ static int exynos5_usbdrd_phy_calibrate(struct phy *phy) |
10854 |
+ struct phy_usb_instance *inst = phy_get_drvdata(phy); |
10855 |
+ struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst); |
10856 |
+ |
10857 |
+- return exynos5420_usbdrd_phy_calibrate(phy_drd); |
10858 |
++ if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI) |
10859 |
++ return exynos5420_usbdrd_phy_calibrate(phy_drd); |
10860 |
++ return 0; |
10861 |
+ } |
10862 |
+ |
10863 |
+ static const struct phy_ops exynos5_usbdrd_phy_ops = { |
10864 |
+diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c |
10865 |
+index f3a8a465d27e..02f677eb1d53 100644 |
10866 |
+--- a/drivers/pinctrl/pinctrl-single.c |
10867 |
++++ b/drivers/pinctrl/pinctrl-single.c |
10868 |
+@@ -916,7 +916,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, |
10869 |
+ |
10870 |
+ /* If pinconf isn't supported, don't parse properties in below. */ |
10871 |
+ if (!PCS_HAS_PINCONF) |
10872 |
+- return 0; |
10873 |
++ return -ENOTSUPP; |
10874 |
+ |
10875 |
+ /* cacluate how much properties are supported in current node */ |
10876 |
+ for (i = 0; i < ARRAY_SIZE(prop2); i++) { |
10877 |
+@@ -928,7 +928,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, |
10878 |
+ nconfs++; |
10879 |
+ } |
10880 |
+ if (!nconfs) |
10881 |
+- return 0; |
10882 |
++ return -ENOTSUPP; |
10883 |
+ |
10884 |
+ func->conf = devm_kcalloc(pcs->dev, |
10885 |
+ nconfs, sizeof(struct pcs_conf_vals), |
10886 |
+@@ -1056,9 +1056,12 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, |
10887 |
+ |
10888 |
+ if (PCS_HAS_PINCONF && function) { |
10889 |
+ res = pcs_parse_pinconf(pcs, np, function, map); |
10890 |
+- if (res) |
10891 |
++ if (res == 0) |
10892 |
++ *num_maps = 2; |
10893 |
++ else if (res == -ENOTSUPP) |
10894 |
++ *num_maps = 1; |
10895 |
++ else |
10896 |
+ goto free_pingroups; |
10897 |
+- *num_maps = 2; |
10898 |
+ } else { |
10899 |
+ *num_maps = 1; |
10900 |
+ } |
10901 |
+diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c |
10902 |
+index 8c4d00482ef0..6c42f73c1dfd 100644 |
10903 |
+--- a/drivers/platform/x86/asus-nb-wmi.c |
10904 |
++++ b/drivers/platform/x86/asus-nb-wmi.c |
10905 |
+@@ -110,6 +110,16 @@ static struct quirk_entry quirk_asus_forceals = { |
10906 |
+ .wmi_force_als_set = true, |
10907 |
+ }; |
10908 |
+ |
10909 |
++static struct quirk_entry quirk_asus_ga401i = { |
10910 |
++ .wmi_backlight_power = true, |
10911 |
++ .wmi_backlight_set_devstate = true, |
10912 |
++}; |
10913 |
++ |
10914 |
++static struct quirk_entry quirk_asus_ga502i = { |
10915 |
++ .wmi_backlight_power = true, |
10916 |
++ .wmi_backlight_set_devstate = true, |
10917 |
++}; |
10918 |
++ |
10919 |
+ static int dmi_matched(const struct dmi_system_id *dmi) |
10920 |
+ { |
10921 |
+ pr_info("Identified laptop model '%s'\n", dmi->ident); |
10922 |
+@@ -411,6 +421,78 @@ static const struct dmi_system_id asus_quirks[] = { |
10923 |
+ }, |
10924 |
+ .driver_data = &quirk_asus_forceals, |
10925 |
+ }, |
10926 |
++ { |
10927 |
++ .callback = dmi_matched, |
10928 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IH", |
10929 |
++ .matches = { |
10930 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10931 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IH"), |
10932 |
++ }, |
10933 |
++ .driver_data = &quirk_asus_ga401i, |
10934 |
++ }, |
10935 |
++ { |
10936 |
++ .callback = dmi_matched, |
10937 |
++ .ident = "ASUSTeK COMPUTER INC. GA401II", |
10938 |
++ .matches = { |
10939 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10940 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401II"), |
10941 |
++ }, |
10942 |
++ .driver_data = &quirk_asus_ga401i, |
10943 |
++ }, |
10944 |
++ { |
10945 |
++ .callback = dmi_matched, |
10946 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IU", |
10947 |
++ .matches = { |
10948 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10949 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IU"), |
10950 |
++ }, |
10951 |
++ .driver_data = &quirk_asus_ga401i, |
10952 |
++ }, |
10953 |
++ { |
10954 |
++ .callback = dmi_matched, |
10955 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IV", |
10956 |
++ .matches = { |
10957 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10958 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IV"), |
10959 |
++ }, |
10960 |
++ .driver_data = &quirk_asus_ga401i, |
10961 |
++ }, |
10962 |
++ { |
10963 |
++ .callback = dmi_matched, |
10964 |
++ .ident = "ASUSTeK COMPUTER INC. GA401IVC", |
10965 |
++ .matches = { |
10966 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10967 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA401IVC"), |
10968 |
++ }, |
10969 |
++ .driver_data = &quirk_asus_ga401i, |
10970 |
++ }, |
10971 |
++ { |
10972 |
++ .callback = dmi_matched, |
10973 |
++ .ident = "ASUSTeK COMPUTER INC. GA502II", |
10974 |
++ .matches = { |
10975 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10976 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502II"), |
10977 |
++ }, |
10978 |
++ .driver_data = &quirk_asus_ga502i, |
10979 |
++ }, |
10980 |
++ { |
10981 |
++ .callback = dmi_matched, |
10982 |
++ .ident = "ASUSTeK COMPUTER INC. GA502IU", |
10983 |
++ .matches = { |
10984 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10985 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502IU"), |
10986 |
++ }, |
10987 |
++ .driver_data = &quirk_asus_ga502i, |
10988 |
++ }, |
10989 |
++ { |
10990 |
++ .callback = dmi_matched, |
10991 |
++ .ident = "ASUSTeK COMPUTER INC. GA502IV", |
10992 |
++ .matches = { |
10993 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10994 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502IV"), |
10995 |
++ }, |
10996 |
++ .driver_data = &quirk_asus_ga502i, |
10997 |
++ }, |
10998 |
+ {}, |
10999 |
+ }; |
11000 |
+ |
11001 |
+diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c |
11002 |
+index 9ee79b74311c..86261970bd8f 100644 |
11003 |
+--- a/drivers/platform/x86/intel-hid.c |
11004 |
++++ b/drivers/platform/x86/intel-hid.c |
11005 |
+@@ -571,7 +571,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) |
11006 |
+ return AE_OK; |
11007 |
+ |
11008 |
+ if (acpi_match_device_ids(dev, ids) == 0) |
11009 |
+- if (acpi_create_platform_device(dev, NULL)) |
11010 |
++ if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) |
11011 |
+ dev_info(&dev->dev, |
11012 |
+ "intel-hid: created platform device\n"); |
11013 |
+ |
11014 |
+diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
11015 |
+index 0487b606a274..e85d8e58320c 100644 |
11016 |
+--- a/drivers/platform/x86/intel-vbtn.c |
11017 |
++++ b/drivers/platform/x86/intel-vbtn.c |
11018 |
+@@ -299,7 +299,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) |
11019 |
+ return AE_OK; |
11020 |
+ |
11021 |
+ if (acpi_match_device_ids(dev, ids) == 0) |
11022 |
+- if (acpi_create_platform_device(dev, NULL)) |
11023 |
++ if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) |
11024 |
+ dev_info(&dev->dev, |
11025 |
+ "intel-vbtn: created platform device\n"); |
11026 |
+ |
11027 |
+diff --git a/drivers/power/supply/88pm860x_battery.c b/drivers/power/supply/88pm860x_battery.c |
11028 |
+index 1308f3a185f3..590da88a17a2 100644 |
11029 |
+--- a/drivers/power/supply/88pm860x_battery.c |
11030 |
++++ b/drivers/power/supply/88pm860x_battery.c |
11031 |
+@@ -433,7 +433,7 @@ static void pm860x_init_battery(struct pm860x_battery_info *info) |
11032 |
+ int ret; |
11033 |
+ int data; |
11034 |
+ int bat_remove; |
11035 |
+- int soc; |
11036 |
++ int soc = 0; |
11037 |
+ |
11038 |
+ /* measure enable on GPADC1 */ |
11039 |
+ data = MEAS1_GP1; |
11040 |
+@@ -496,7 +496,9 @@ static void pm860x_init_battery(struct pm860x_battery_info *info) |
11041 |
+ } |
11042 |
+ mutex_unlock(&info->lock); |
11043 |
+ |
11044 |
+- calc_soc(info, OCV_MODE_ACTIVE, &soc); |
11045 |
++ ret = calc_soc(info, OCV_MODE_ACTIVE, &soc); |
11046 |
++ if (ret < 0) |
11047 |
++ goto out; |
11048 |
+ |
11049 |
+ data = pm860x_reg_read(info->i2c, PM8607_POWER_UP_LOG); |
11050 |
+ bat_remove = data & BAT_WU_LOG; |
11051 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
11052 |
+index 03154f5b939f..720f28844795 100644 |
11053 |
+--- a/drivers/regulator/core.c |
11054 |
++++ b/drivers/regulator/core.c |
11055 |
+@@ -5023,7 +5023,6 @@ regulator_register(const struct regulator_desc *regulator_desc, |
11056 |
+ struct regulator_dev *rdev; |
11057 |
+ bool dangling_cfg_gpiod = false; |
11058 |
+ bool dangling_of_gpiod = false; |
11059 |
+- bool reg_device_fail = false; |
11060 |
+ struct device *dev; |
11061 |
+ int ret, i; |
11062 |
+ |
11063 |
+@@ -5152,10 +5151,12 @@ regulator_register(const struct regulator_desc *regulator_desc, |
11064 |
+ } |
11065 |
+ |
11066 |
+ /* register with sysfs */ |
11067 |
++ device_initialize(&rdev->dev); |
11068 |
+ rdev->dev.class = ®ulator_class; |
11069 |
+ rdev->dev.parent = dev; |
11070 |
+ dev_set_name(&rdev->dev, "regulator.%lu", |
11071 |
+ (unsigned long) atomic_inc_return(®ulator_no)); |
11072 |
++ dev_set_drvdata(&rdev->dev, rdev); |
11073 |
+ |
11074 |
+ /* set regulator constraints */ |
11075 |
+ if (init_data) |
11076 |
+@@ -5206,12 +5207,9 @@ regulator_register(const struct regulator_desc *regulator_desc, |
11077 |
+ !rdev->desc->fixed_uV) |
11078 |
+ rdev->is_switch = true; |
11079 |
+ |
11080 |
+- dev_set_drvdata(&rdev->dev, rdev); |
11081 |
+- ret = device_register(&rdev->dev); |
11082 |
+- if (ret != 0) { |
11083 |
+- reg_device_fail = true; |
11084 |
++ ret = device_add(&rdev->dev); |
11085 |
++ if (ret != 0) |
11086 |
+ goto unset_supplies; |
11087 |
+- } |
11088 |
+ |
11089 |
+ rdev_init_debugfs(rdev); |
11090 |
+ |
11091 |
+@@ -5233,17 +5231,15 @@ unset_supplies: |
11092 |
+ mutex_unlock(®ulator_list_mutex); |
11093 |
+ wash: |
11094 |
+ kfree(rdev->coupling_desc.coupled_rdevs); |
11095 |
+- kfree(rdev->constraints); |
11096 |
+ mutex_lock(®ulator_list_mutex); |
11097 |
+ regulator_ena_gpio_free(rdev); |
11098 |
+ mutex_unlock(®ulator_list_mutex); |
11099 |
++ put_device(&rdev->dev); |
11100 |
++ rdev = NULL; |
11101 |
+ clean: |
11102 |
+ if (dangling_of_gpiod) |
11103 |
+ gpiod_put(config->ena_gpiod); |
11104 |
+- if (reg_device_fail) |
11105 |
+- put_device(&rdev->dev); |
11106 |
+- else |
11107 |
+- kfree(rdev); |
11108 |
++ kfree(rdev); |
11109 |
+ kfree(config); |
11110 |
+ rinse: |
11111 |
+ if (dangling_cfg_gpiod) |
11112 |
+diff --git a/drivers/reset/reset-intel-gw.c b/drivers/reset/reset-intel-gw.c |
11113 |
+index 854238444616..effc177db80a 100644 |
11114 |
+--- a/drivers/reset/reset-intel-gw.c |
11115 |
++++ b/drivers/reset/reset-intel-gw.c |
11116 |
+@@ -15,9 +15,9 @@ |
11117 |
+ #define RCU_RST_STAT 0x0024 |
11118 |
+ #define RCU_RST_REQ 0x0048 |
11119 |
+ |
11120 |
+-#define REG_OFFSET GENMASK(31, 16) |
11121 |
+-#define BIT_OFFSET GENMASK(15, 8) |
11122 |
+-#define STAT_BIT_OFFSET GENMASK(7, 0) |
11123 |
++#define REG_OFFSET_MASK GENMASK(31, 16) |
11124 |
++#define BIT_OFFSET_MASK GENMASK(15, 8) |
11125 |
++#define STAT_BIT_OFFSET_MASK GENMASK(7, 0) |
11126 |
+ |
11127 |
+ #define to_reset_data(x) container_of(x, struct intel_reset_data, rcdev) |
11128 |
+ |
11129 |
+@@ -51,11 +51,11 @@ static u32 id_to_reg_and_bit_offsets(struct intel_reset_data *data, |
11130 |
+ unsigned long id, u32 *rst_req, |
11131 |
+ u32 *req_bit, u32 *stat_bit) |
11132 |
+ { |
11133 |
+- *rst_req = FIELD_GET(REG_OFFSET, id); |
11134 |
+- *req_bit = FIELD_GET(BIT_OFFSET, id); |
11135 |
++ *rst_req = FIELD_GET(REG_OFFSET_MASK, id); |
11136 |
++ *req_bit = FIELD_GET(BIT_OFFSET_MASK, id); |
11137 |
+ |
11138 |
+ if (data->soc_data->legacy) |
11139 |
+- *stat_bit = FIELD_GET(STAT_BIT_OFFSET, id); |
11140 |
++ *stat_bit = FIELD_GET(STAT_BIT_OFFSET_MASK, id); |
11141 |
+ else |
11142 |
+ *stat_bit = *req_bit; |
11143 |
+ |
11144 |
+@@ -141,14 +141,14 @@ static int intel_reset_xlate(struct reset_controller_dev *rcdev, |
11145 |
+ if (spec->args[1] > 31) |
11146 |
+ return -EINVAL; |
11147 |
+ |
11148 |
+- id = FIELD_PREP(REG_OFFSET, spec->args[0]); |
11149 |
+- id |= FIELD_PREP(BIT_OFFSET, spec->args[1]); |
11150 |
++ id = FIELD_PREP(REG_OFFSET_MASK, spec->args[0]); |
11151 |
++ id |= FIELD_PREP(BIT_OFFSET_MASK, spec->args[1]); |
11152 |
+ |
11153 |
+ if (data->soc_data->legacy) { |
11154 |
+ if (spec->args[2] > 31) |
11155 |
+ return -EINVAL; |
11156 |
+ |
11157 |
+- id |= FIELD_PREP(STAT_BIT_OFFSET, spec->args[2]); |
11158 |
++ id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, spec->args[2]); |
11159 |
+ } |
11160 |
+ |
11161 |
+ return id; |
11162 |
+@@ -210,11 +210,11 @@ static int intel_reset_probe(struct platform_device *pdev) |
11163 |
+ if (ret) |
11164 |
+ return ret; |
11165 |
+ |
11166 |
+- data->reboot_id = FIELD_PREP(REG_OFFSET, rb_id[0]); |
11167 |
+- data->reboot_id |= FIELD_PREP(BIT_OFFSET, rb_id[1]); |
11168 |
++ data->reboot_id = FIELD_PREP(REG_OFFSET_MASK, rb_id[0]); |
11169 |
++ data->reboot_id |= FIELD_PREP(BIT_OFFSET_MASK, rb_id[1]); |
11170 |
+ |
11171 |
+ if (data->soc_data->legacy) |
11172 |
+- data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET, rb_id[2]); |
11173 |
++ data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, rb_id[2]); |
11174 |
+ |
11175 |
+ data->restart_nb.notifier_call = intel_reset_restart_handler; |
11176 |
+ data->restart_nb.priority = 128; |
11177 |
+diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c |
11178 |
+index facb588d09e4..069d6b39cacf 100644 |
11179 |
+--- a/drivers/s390/block/dasd_diag.c |
11180 |
++++ b/drivers/s390/block/dasd_diag.c |
11181 |
+@@ -319,7 +319,7 @@ dasd_diag_check_device(struct dasd_device *device) |
11182 |
+ struct dasd_diag_characteristics *rdc_data; |
11183 |
+ struct vtoc_cms_label *label; |
11184 |
+ struct dasd_block *block; |
11185 |
+- struct dasd_diag_bio bio; |
11186 |
++ struct dasd_diag_bio *bio; |
11187 |
+ unsigned int sb, bsize; |
11188 |
+ blocknum_t end_block; |
11189 |
+ int rc; |
11190 |
+@@ -395,29 +395,36 @@ dasd_diag_check_device(struct dasd_device *device) |
11191 |
+ rc = -ENOMEM; |
11192 |
+ goto out; |
11193 |
+ } |
11194 |
++ bio = kzalloc(sizeof(*bio), GFP_KERNEL); |
11195 |
++ if (bio == NULL) { |
11196 |
++ DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
11197 |
++ "No memory to allocate initialization bio"); |
11198 |
++ rc = -ENOMEM; |
11199 |
++ goto out_label; |
11200 |
++ } |
11201 |
+ rc = 0; |
11202 |
+ end_block = 0; |
11203 |
+ /* try all sizes - needed for ECKD devices */ |
11204 |
+ for (bsize = 512; bsize <= PAGE_SIZE; bsize <<= 1) { |
11205 |
+ mdsk_init_io(device, bsize, 0, &end_block); |
11206 |
+- memset(&bio, 0, sizeof (struct dasd_diag_bio)); |
11207 |
+- bio.type = MDSK_READ_REQ; |
11208 |
+- bio.block_number = private->pt_block + 1; |
11209 |
+- bio.buffer = label; |
11210 |
++ memset(bio, 0, sizeof(*bio)); |
11211 |
++ bio->type = MDSK_READ_REQ; |
11212 |
++ bio->block_number = private->pt_block + 1; |
11213 |
++ bio->buffer = label; |
11214 |
+ memset(&private->iob, 0, sizeof (struct dasd_diag_rw_io)); |
11215 |
+ private->iob.dev_nr = rdc_data->dev_nr; |
11216 |
+ private->iob.key = 0; |
11217 |
+ private->iob.flags = 0; /* do synchronous io */ |
11218 |
+ private->iob.block_count = 1; |
11219 |
+ private->iob.interrupt_params = 0; |
11220 |
+- private->iob.bio_list = &bio; |
11221 |
++ private->iob.bio_list = bio; |
11222 |
+ private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; |
11223 |
+ rc = dia250(&private->iob, RW_BIO); |
11224 |
+ if (rc == 3) { |
11225 |
+ pr_warn("%s: A 64-bit DIAG call failed\n", |
11226 |
+ dev_name(&device->cdev->dev)); |
11227 |
+ rc = -EOPNOTSUPP; |
11228 |
+- goto out_label; |
11229 |
++ goto out_bio; |
11230 |
+ } |
11231 |
+ mdsk_term_io(device); |
11232 |
+ if (rc == 0) |
11233 |
+@@ -427,7 +434,7 @@ dasd_diag_check_device(struct dasd_device *device) |
11234 |
+ pr_warn("%s: Accessing the DASD failed because of an incorrect format (rc=%d)\n", |
11235 |
+ dev_name(&device->cdev->dev), rc); |
11236 |
+ rc = -EIO; |
11237 |
+- goto out_label; |
11238 |
++ goto out_bio; |
11239 |
+ } |
11240 |
+ /* check for label block */ |
11241 |
+ if (memcmp(label->label_id, DASD_DIAG_CMS1, |
11242 |
+@@ -457,6 +464,8 @@ dasd_diag_check_device(struct dasd_device *device) |
11243 |
+ (rc == 4) ? ", read-only device" : ""); |
11244 |
+ rc = 0; |
11245 |
+ } |
11246 |
++out_bio: |
11247 |
++ kfree(bio); |
11248 |
+ out_label: |
11249 |
+ free_page((long) label); |
11250 |
+ out: |
11251 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
11252 |
+index 88e998de2d03..c8e57007c423 100644 |
11253 |
+--- a/drivers/s390/net/qeth_core_main.c |
11254 |
++++ b/drivers/s390/net/qeth_core_main.c |
11255 |
+@@ -204,12 +204,17 @@ EXPORT_SYMBOL_GPL(qeth_threads_running); |
11256 |
+ void qeth_clear_working_pool_list(struct qeth_card *card) |
11257 |
+ { |
11258 |
+ struct qeth_buffer_pool_entry *pool_entry, *tmp; |
11259 |
++ struct qeth_qdio_q *queue = card->qdio.in_q; |
11260 |
++ unsigned int i; |
11261 |
+ |
11262 |
+ QETH_CARD_TEXT(card, 5, "clwrklst"); |
11263 |
+ list_for_each_entry_safe(pool_entry, tmp, |
11264 |
+ &card->qdio.in_buf_pool.entry_list, list){ |
11265 |
+ list_del(&pool_entry->list); |
11266 |
+ } |
11267 |
++ |
11268 |
++ for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) |
11269 |
++ queue->bufs[i].pool_entry = NULL; |
11270 |
+ } |
11271 |
+ EXPORT_SYMBOL_GPL(qeth_clear_working_pool_list); |
11272 |
+ |
11273 |
+@@ -2951,7 +2956,7 @@ static struct qeth_buffer_pool_entry *qeth_find_free_buffer_pool_entry( |
11274 |
+ static int qeth_init_input_buffer(struct qeth_card *card, |
11275 |
+ struct qeth_qdio_buffer *buf) |
11276 |
+ { |
11277 |
+- struct qeth_buffer_pool_entry *pool_entry; |
11278 |
++ struct qeth_buffer_pool_entry *pool_entry = buf->pool_entry; |
11279 |
+ int i; |
11280 |
+ |
11281 |
+ if ((card->options.cq == QETH_CQ_ENABLED) && (!buf->rx_skb)) { |
11282 |
+@@ -2962,9 +2967,13 @@ static int qeth_init_input_buffer(struct qeth_card *card, |
11283 |
+ return -ENOMEM; |
11284 |
+ } |
11285 |
+ |
11286 |
+- pool_entry = qeth_find_free_buffer_pool_entry(card); |
11287 |
+- if (!pool_entry) |
11288 |
+- return -ENOBUFS; |
11289 |
++ if (!pool_entry) { |
11290 |
++ pool_entry = qeth_find_free_buffer_pool_entry(card); |
11291 |
++ if (!pool_entry) |
11292 |
++ return -ENOBUFS; |
11293 |
++ |
11294 |
++ buf->pool_entry = pool_entry; |
11295 |
++ } |
11296 |
+ |
11297 |
+ /* |
11298 |
+ * since the buffer is accessed only from the input_tasklet |
11299 |
+@@ -2972,8 +2981,6 @@ static int qeth_init_input_buffer(struct qeth_card *card, |
11300 |
+ * the QETH_IN_BUF_REQUEUE_THRESHOLD we should never run out off |
11301 |
+ * buffers |
11302 |
+ */ |
11303 |
+- |
11304 |
+- buf->pool_entry = pool_entry; |
11305 |
+ for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { |
11306 |
+ buf->buffer->element[i].length = PAGE_SIZE; |
11307 |
+ buf->buffer->element[i].addr = |
11308 |
+@@ -5802,6 +5809,7 @@ static unsigned int qeth_rx_poll(struct qeth_card *card, int budget) |
11309 |
+ if (done) { |
11310 |
+ QETH_CARD_STAT_INC(card, rx_bufs); |
11311 |
+ qeth_put_buffer_pool_entry(card, buffer->pool_entry); |
11312 |
++ buffer->pool_entry = NULL; |
11313 |
+ qeth_queue_input_buffer(card, card->rx.b_index); |
11314 |
+ card->rx.b_count--; |
11315 |
+ |
11316 |
+diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
11317 |
+index 2d3bca3c0141..b4e06aeb6dc1 100644 |
11318 |
+--- a/drivers/s390/net/qeth_l2_main.c |
11319 |
++++ b/drivers/s390/net/qeth_l2_main.c |
11320 |
+@@ -1142,6 +1142,10 @@ static void qeth_bridge_state_change(struct qeth_card *card, |
11321 |
+ int extrasize; |
11322 |
+ |
11323 |
+ QETH_CARD_TEXT(card, 2, "brstchng"); |
11324 |
++ if (qports->num_entries == 0) { |
11325 |
++ QETH_CARD_TEXT(card, 2, "BPempty"); |
11326 |
++ return; |
11327 |
++ } |
11328 |
+ if (qports->entry_length != sizeof(struct qeth_sbp_port_entry)) { |
11329 |
+ QETH_CARD_TEXT_(card, 2, "BPsz%04x", qports->entry_length); |
11330 |
+ return; |
11331 |
+diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c |
11332 |
+index 65691c21f133..29294f0ef8a9 100644 |
11333 |
+--- a/drivers/scsi/arm/cumana_2.c |
11334 |
++++ b/drivers/scsi/arm/cumana_2.c |
11335 |
+@@ -450,7 +450,7 @@ static int cumanascsi2_probe(struct expansion_card *ec, |
11336 |
+ |
11337 |
+ if (info->info.scsi.dma != NO_DMA) |
11338 |
+ free_dma(info->info.scsi.dma); |
11339 |
+- free_irq(ec->irq, host); |
11340 |
++ free_irq(ec->irq, info); |
11341 |
+ |
11342 |
+ out_release: |
11343 |
+ fas216_release(host); |
11344 |
+diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c |
11345 |
+index 6e204a2e0c8d..591ae2a6dd74 100644 |
11346 |
+--- a/drivers/scsi/arm/eesox.c |
11347 |
++++ b/drivers/scsi/arm/eesox.c |
11348 |
+@@ -571,7 +571,7 @@ static int eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id) |
11349 |
+ |
11350 |
+ if (info->info.scsi.dma != NO_DMA) |
11351 |
+ free_dma(info->info.scsi.dma); |
11352 |
+- free_irq(ec->irq, host); |
11353 |
++ free_irq(ec->irq, info); |
11354 |
+ |
11355 |
+ out_remove: |
11356 |
+ fas216_remove(host); |
11357 |
+diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c |
11358 |
+index 772a13e5fd91..d99ef014528e 100644 |
11359 |
+--- a/drivers/scsi/arm/powertec.c |
11360 |
++++ b/drivers/scsi/arm/powertec.c |
11361 |
+@@ -378,7 +378,7 @@ static int powertecscsi_probe(struct expansion_card *ec, |
11362 |
+ |
11363 |
+ if (info->info.scsi.dma != NO_DMA) |
11364 |
+ free_dma(info->info.scsi.dma); |
11365 |
+- free_irq(ec->irq, host); |
11366 |
++ free_irq(ec->irq, info); |
11367 |
+ |
11368 |
+ out_release: |
11369 |
+ fas216_release(host); |
11370 |
+diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c |
11371 |
+index 00668335c2af..924ea9f4cdd0 100644 |
11372 |
+--- a/drivers/scsi/megaraid/megaraid_sas_base.c |
11373 |
++++ b/drivers/scsi/megaraid/megaraid_sas_base.c |
11374 |
+@@ -5602,9 +5602,13 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) |
11375 |
+ &instance->irq_context[i])) { |
11376 |
+ dev_err(&instance->pdev->dev, |
11377 |
+ "Failed to register IRQ for vector %d.\n", i); |
11378 |
+- for (j = 0; j < i; j++) |
11379 |
++ for (j = 0; j < i; j++) { |
11380 |
++ if (j < instance->low_latency_index_start) |
11381 |
++ irq_set_affinity_hint( |
11382 |
++ pci_irq_vector(pdev, j), NULL); |
11383 |
+ free_irq(pci_irq_vector(pdev, j), |
11384 |
+ &instance->irq_context[j]); |
11385 |
++ } |
11386 |
+ /* Retry irq register for IO_APIC*/ |
11387 |
+ instance->msix_vectors = 0; |
11388 |
+ instance->msix_load_balance = false; |
11389 |
+@@ -5642,6 +5646,9 @@ megasas_destroy_irqs(struct megasas_instance *instance) { |
11390 |
+ |
11391 |
+ if (instance->msix_vectors) |
11392 |
+ for (i = 0; i < instance->msix_vectors; i++) { |
11393 |
++ if (i < instance->low_latency_index_start) |
11394 |
++ irq_set_affinity_hint( |
11395 |
++ pci_irq_vector(instance->pdev, i), NULL); |
11396 |
+ free_irq(pci_irq_vector(instance->pdev, i), |
11397 |
+ &instance->irq_context[i]); |
11398 |
+ } |
11399 |
+diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c |
11400 |
+index f9f8f4921654..fd1d03064079 100644 |
11401 |
+--- a/drivers/scsi/mesh.c |
11402 |
++++ b/drivers/scsi/mesh.c |
11403 |
+@@ -1045,6 +1045,8 @@ static void handle_error(struct mesh_state *ms) |
11404 |
+ while ((in_8(&mr->bus_status1) & BS1_RST) != 0) |
11405 |
+ udelay(1); |
11406 |
+ printk("done\n"); |
11407 |
++ if (ms->dma_started) |
11408 |
++ halt_dma(ms); |
11409 |
+ handle_reset(ms); |
11410 |
+ /* request_q is empty, no point in mesh_start() */ |
11411 |
+ return; |
11412 |
+@@ -1357,7 +1359,8 @@ static void halt_dma(struct mesh_state *ms) |
11413 |
+ ms->conn_tgt, ms->data_ptr, scsi_bufflen(cmd), |
11414 |
+ ms->tgts[ms->conn_tgt].data_goes_out); |
11415 |
+ } |
11416 |
+- scsi_dma_unmap(cmd); |
11417 |
++ if (cmd) |
11418 |
++ scsi_dma_unmap(cmd); |
11419 |
+ ms->dma_started = 0; |
11420 |
+ } |
11421 |
+ |
11422 |
+@@ -1712,6 +1715,9 @@ static int mesh_host_reset(struct scsi_cmnd *cmd) |
11423 |
+ |
11424 |
+ spin_lock_irqsave(ms->host->host_lock, flags); |
11425 |
+ |
11426 |
++ if (ms->dma_started) |
11427 |
++ halt_dma(ms); |
11428 |
++ |
11429 |
+ /* Reset the controller & dbdma channel */ |
11430 |
+ out_le32(&md->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* stop dma */ |
11431 |
+ out_8(&mr->exception, 0xff); /* clear all exception bits */ |
11432 |
+diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c |
11433 |
+index 8865c35d3421..7c2ad8c18398 100644 |
11434 |
+--- a/drivers/scsi/qla2xxx/qla_iocb.c |
11435 |
++++ b/drivers/scsi/qla2xxx/qla_iocb.c |
11436 |
+@@ -2305,8 +2305,8 @@ __qla2x00_alloc_iocbs(struct qla_qpair *qpair, srb_t *sp) |
11437 |
+ pkt = req->ring_ptr; |
11438 |
+ memset(pkt, 0, REQUEST_ENTRY_SIZE); |
11439 |
+ if (IS_QLAFX00(ha)) { |
11440 |
+- wrt_reg_byte((void __iomem *)&pkt->entry_count, req_cnt); |
11441 |
+- wrt_reg_word((void __iomem *)&pkt->handle, handle); |
11442 |
++ wrt_reg_byte((u8 __force __iomem *)&pkt->entry_count, req_cnt); |
11443 |
++ wrt_reg_dword((__le32 __force __iomem *)&pkt->handle, handle); |
11444 |
+ } else { |
11445 |
+ pkt->entry_count = req_cnt; |
11446 |
+ pkt->handle = handle; |
11447 |
+diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
11448 |
+index 843cccb38cb7..b0d93bf79978 100644 |
11449 |
+--- a/drivers/scsi/scsi_debug.c |
11450 |
++++ b/drivers/scsi/scsi_debug.c |
11451 |
+@@ -6610,6 +6610,12 @@ static int __init scsi_debug_init(void) |
11452 |
+ pr_err("submit_queues must be 1 or more\n"); |
11453 |
+ return -EINVAL; |
11454 |
+ } |
11455 |
++ |
11456 |
++ if ((sdebug_max_queue > SDEBUG_CANQUEUE) || (sdebug_max_queue < 1)) { |
11457 |
++ pr_err("max_queue must be in range [1, %d]\n", SDEBUG_CANQUEUE); |
11458 |
++ return -EINVAL; |
11459 |
++ } |
11460 |
++ |
11461 |
+ sdebug_q_arr = kcalloc(submit_queues, sizeof(struct sdebug_queue), |
11462 |
+ GFP_KERNEL); |
11463 |
+ if (sdebug_q_arr == NULL) |
11464 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
11465 |
+index 06056e9ec333..ae620dada8ce 100644 |
11466 |
+--- a/drivers/scsi/scsi_lib.c |
11467 |
++++ b/drivers/scsi/scsi_lib.c |
11468 |
+@@ -2841,8 +2841,10 @@ scsi_host_block(struct Scsi_Host *shost) |
11469 |
+ mutex_lock(&sdev->state_mutex); |
11470 |
+ ret = scsi_internal_device_block_nowait(sdev); |
11471 |
+ mutex_unlock(&sdev->state_mutex); |
11472 |
+- if (ret) |
11473 |
++ if (ret) { |
11474 |
++ scsi_device_put(sdev); |
11475 |
+ break; |
11476 |
++ } |
11477 |
+ } |
11478 |
+ |
11479 |
+ /* |
11480 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
11481 |
+index a483c0720a0c..e412e43d2382 100644 |
11482 |
+--- a/drivers/scsi/ufs/ufshcd.c |
11483 |
++++ b/drivers/scsi/ufs/ufshcd.c |
11484 |
+@@ -1314,6 +1314,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, |
11485 |
+ unsigned long flags; |
11486 |
+ struct list_head *clk_list = &hba->clk_list_head; |
11487 |
+ struct ufs_clk_info *clki; |
11488 |
++ ktime_t curr_t; |
11489 |
+ |
11490 |
+ if (!ufshcd_is_clkscaling_supported(hba)) |
11491 |
+ return -EINVAL; |
11492 |
+@@ -1321,6 +1322,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, |
11493 |
+ memset(stat, 0, sizeof(*stat)); |
11494 |
+ |
11495 |
+ spin_lock_irqsave(hba->host->host_lock, flags); |
11496 |
++ curr_t = ktime_get(); |
11497 |
+ if (!scaling->window_start_t) |
11498 |
+ goto start_window; |
11499 |
+ |
11500 |
+@@ -1332,18 +1334,17 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev, |
11501 |
+ */ |
11502 |
+ stat->current_frequency = clki->curr_freq; |
11503 |
+ if (scaling->is_busy_started) |
11504 |
+- scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(), |
11505 |
+- scaling->busy_start_t)); |
11506 |
++ scaling->tot_busy_t += ktime_us_delta(curr_t, |
11507 |
++ scaling->busy_start_t); |
11508 |
+ |
11509 |
+- stat->total_time = jiffies_to_usecs((long)jiffies - |
11510 |
+- (long)scaling->window_start_t); |
11511 |
++ stat->total_time = ktime_us_delta(curr_t, scaling->window_start_t); |
11512 |
+ stat->busy_time = scaling->tot_busy_t; |
11513 |
+ start_window: |
11514 |
+- scaling->window_start_t = jiffies; |
11515 |
++ scaling->window_start_t = curr_t; |
11516 |
+ scaling->tot_busy_t = 0; |
11517 |
+ |
11518 |
+ if (hba->outstanding_reqs) { |
11519 |
+- scaling->busy_start_t = ktime_get(); |
11520 |
++ scaling->busy_start_t = curr_t; |
11521 |
+ scaling->is_busy_started = true; |
11522 |
+ } else { |
11523 |
+ scaling->busy_start_t = 0; |
11524 |
+@@ -1877,6 +1878,7 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) |
11525 |
+ static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba) |
11526 |
+ { |
11527 |
+ bool queue_resume_work = false; |
11528 |
++ ktime_t curr_t = ktime_get(); |
11529 |
+ |
11530 |
+ if (!ufshcd_is_clkscaling_supported(hba)) |
11531 |
+ return; |
11532 |
+@@ -1892,13 +1894,13 @@ static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba) |
11533 |
+ &hba->clk_scaling.resume_work); |
11534 |
+ |
11535 |
+ if (!hba->clk_scaling.window_start_t) { |
11536 |
+- hba->clk_scaling.window_start_t = jiffies; |
11537 |
++ hba->clk_scaling.window_start_t = curr_t; |
11538 |
+ hba->clk_scaling.tot_busy_t = 0; |
11539 |
+ hba->clk_scaling.is_busy_started = false; |
11540 |
+ } |
11541 |
+ |
11542 |
+ if (!hba->clk_scaling.is_busy_started) { |
11543 |
+- hba->clk_scaling.busy_start_t = ktime_get(); |
11544 |
++ hba->clk_scaling.busy_start_t = curr_t; |
11545 |
+ hba->clk_scaling.is_busy_started = true; |
11546 |
+ } |
11547 |
+ } |
11548 |
+@@ -6816,20 +6818,30 @@ out: |
11549 |
+ |
11550 |
+ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf) |
11551 |
+ { |
11552 |
++ struct ufs_dev_info *dev_info = &hba->dev_info; |
11553 |
+ u8 lun; |
11554 |
+ u32 d_lu_wb_buf_alloc; |
11555 |
+ |
11556 |
+ if (!ufshcd_is_wb_allowed(hba)) |
11557 |
+ return; |
11558 |
++ /* |
11559 |
++ * Probe WB only for UFS-2.2 and UFS-3.1 (and later) devices or |
11560 |
++ * UFS devices with quirk UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES |
11561 |
++ * enabled |
11562 |
++ */ |
11563 |
++ if (!(dev_info->wspecversion >= 0x310 || |
11564 |
++ dev_info->wspecversion == 0x220 || |
11565 |
++ (hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES))) |
11566 |
++ goto wb_disabled; |
11567 |
+ |
11568 |
+ if (hba->desc_size.dev_desc < DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP + 4) |
11569 |
+ goto wb_disabled; |
11570 |
+ |
11571 |
+- hba->dev_info.d_ext_ufs_feature_sup = |
11572 |
++ dev_info->d_ext_ufs_feature_sup = |
11573 |
+ get_unaligned_be32(desc_buf + |
11574 |
+ DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP); |
11575 |
+ |
11576 |
+- if (!(hba->dev_info.d_ext_ufs_feature_sup & UFS_DEV_WRITE_BOOSTER_SUP)) |
11577 |
++ if (!(dev_info->d_ext_ufs_feature_sup & UFS_DEV_WRITE_BOOSTER_SUP)) |
11578 |
+ goto wb_disabled; |
11579 |
+ |
11580 |
+ /* |
11581 |
+@@ -6838,17 +6850,17 @@ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf) |
11582 |
+ * a max of 1 lun would have wb buffer configured. |
11583 |
+ * Now only shared buffer mode is supported. |
11584 |
+ */ |
11585 |
+- hba->dev_info.b_wb_buffer_type = |
11586 |
++ dev_info->b_wb_buffer_type = |
11587 |
+ desc_buf[DEVICE_DESC_PARAM_WB_TYPE]; |
11588 |
+ |
11589 |
+- hba->dev_info.b_presrv_uspc_en = |
11590 |
++ dev_info->b_presrv_uspc_en = |
11591 |
+ desc_buf[DEVICE_DESC_PARAM_WB_PRESRV_USRSPC_EN]; |
11592 |
+ |
11593 |
+- if (hba->dev_info.b_wb_buffer_type == WB_BUF_MODE_SHARED) { |
11594 |
+- hba->dev_info.d_wb_alloc_units = |
11595 |
++ if (dev_info->b_wb_buffer_type == WB_BUF_MODE_SHARED) { |
11596 |
++ dev_info->d_wb_alloc_units = |
11597 |
+ get_unaligned_be32(desc_buf + |
11598 |
+ DEVICE_DESC_PARAM_WB_SHARED_ALLOC_UNITS); |
11599 |
+- if (!hba->dev_info.d_wb_alloc_units) |
11600 |
++ if (!dev_info->d_wb_alloc_units) |
11601 |
+ goto wb_disabled; |
11602 |
+ } else { |
11603 |
+ for (lun = 0; lun < UFS_UPIU_MAX_WB_LUN_ID; lun++) { |
11604 |
+@@ -6859,7 +6871,7 @@ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf) |
11605 |
+ (u8 *)&d_lu_wb_buf_alloc, |
11606 |
+ sizeof(d_lu_wb_buf_alloc)); |
11607 |
+ if (d_lu_wb_buf_alloc) { |
11608 |
+- hba->dev_info.wb_dedicated_lu = lun; |
11609 |
++ dev_info->wb_dedicated_lu = lun; |
11610 |
+ break; |
11611 |
+ } |
11612 |
+ } |
11613 |
+@@ -6948,14 +6960,7 @@ static int ufs_get_device_desc(struct ufs_hba *hba) |
11614 |
+ |
11615 |
+ ufs_fixup_device_setup(hba); |
11616 |
+ |
11617 |
+- /* |
11618 |
+- * Probe WB only for UFS-3.1 devices or UFS devices with quirk |
11619 |
+- * UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES enabled |
11620 |
+- */ |
11621 |
+- if (dev_info->wspecversion >= 0x310 || |
11622 |
+- dev_info->wspecversion == 0x220 || |
11623 |
+- (hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES)) |
11624 |
+- ufshcd_wb_probe(hba, desc_buf); |
11625 |
++ ufshcd_wb_probe(hba, desc_buf); |
11626 |
+ |
11627 |
+ /* |
11628 |
+ * ufshcd_read_string_desc returns size of the string |
11629 |
+diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h |
11630 |
+index bf97d616e597..16187be98a94 100644 |
11631 |
+--- a/drivers/scsi/ufs/ufshcd.h |
11632 |
++++ b/drivers/scsi/ufs/ufshcd.h |
11633 |
+@@ -411,7 +411,7 @@ struct ufs_saved_pwr_info { |
11634 |
+ struct ufs_clk_scaling { |
11635 |
+ int active_reqs; |
11636 |
+ unsigned long tot_busy_t; |
11637 |
+- unsigned long window_start_t; |
11638 |
++ ktime_t window_start_t; |
11639 |
+ ktime_t busy_start_t; |
11640 |
+ struct device_attribute enable_attr; |
11641 |
+ struct ufs_saved_pwr_info saved_pwr_info; |
11642 |
+diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c |
11643 |
+index bdcf16f88a97..4c9225f15c4e 100644 |
11644 |
+--- a/drivers/soc/qcom/pdr_interface.c |
11645 |
++++ b/drivers/soc/qcom/pdr_interface.c |
11646 |
+@@ -278,13 +278,15 @@ static void pdr_indack_work(struct work_struct *work) |
11647 |
+ |
11648 |
+ list_for_each_entry_safe(ind, tmp, &pdr->indack_list, node) { |
11649 |
+ pds = ind->pds; |
11650 |
+- pdr_send_indack_msg(pdr, pds, ind->transaction_id); |
11651 |
+ |
11652 |
+ mutex_lock(&pdr->status_lock); |
11653 |
+ pds->state = ind->curr_state; |
11654 |
+ pdr->status(pds->state, pds->service_path, pdr->priv); |
11655 |
+ mutex_unlock(&pdr->status_lock); |
11656 |
+ |
11657 |
++ /* Ack the indication after clients release the PD resources */ |
11658 |
++ pdr_send_indack_msg(pdr, pds, ind->transaction_id); |
11659 |
++ |
11660 |
+ mutex_lock(&pdr->list_lock); |
11661 |
+ list_del(&ind->node); |
11662 |
+ mutex_unlock(&pdr->list_lock); |
11663 |
+diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c |
11664 |
+index 076fd27f3081..ae6675782581 100644 |
11665 |
+--- a/drivers/soc/qcom/rpmh-rsc.c |
11666 |
++++ b/drivers/soc/qcom/rpmh-rsc.c |
11667 |
+@@ -175,13 +175,21 @@ static void write_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id, |
11668 |
+ static void write_tcs_reg_sync(const struct rsc_drv *drv, int reg, int tcs_id, |
11669 |
+ u32 data) |
11670 |
+ { |
11671 |
+- u32 new_data; |
11672 |
++ int i; |
11673 |
+ |
11674 |
+ writel(data, tcs_reg_addr(drv, reg, tcs_id)); |
11675 |
+- if (readl_poll_timeout_atomic(tcs_reg_addr(drv, reg, tcs_id), new_data, |
11676 |
+- new_data == data, 1, USEC_PER_SEC)) |
11677 |
+- pr_err("%s: error writing %#x to %d:%#x\n", drv->name, |
11678 |
+- data, tcs_id, reg); |
11679 |
++ |
11680 |
++ /* |
11681 |
++ * Wait until we read back the same value. Use a counter rather than |
11682 |
++ * ktime for timeout since this may be called after timekeeping stops. |
11683 |
++ */ |
11684 |
++ for (i = 0; i < USEC_PER_SEC; i++) { |
11685 |
++ if (readl(tcs_reg_addr(drv, reg, tcs_id)) == data) |
11686 |
++ return; |
11687 |
++ udelay(1); |
11688 |
++ } |
11689 |
++ pr_err("%s: error writing %#x to %d:%#x\n", drv->name, |
11690 |
++ data, tcs_id, reg); |
11691 |
+ } |
11692 |
+ |
11693 |
+ /** |
11694 |
+@@ -1023,6 +1031,7 @@ static struct platform_driver rpmh_driver = { |
11695 |
+ .driver = { |
11696 |
+ .name = "rpmh", |
11697 |
+ .of_match_table = rpmh_drv_match, |
11698 |
++ .suppress_bind_attrs = true, |
11699 |
+ }, |
11700 |
+ }; |
11701 |
+ |
11702 |
+diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c |
11703 |
+index 5986c520b196..bb390ff67d1d 100644 |
11704 |
+--- a/drivers/spi/spi-dw-dma.c |
11705 |
++++ b/drivers/spi/spi-dw-dma.c |
11706 |
+@@ -372,8 +372,20 @@ static int dw_spi_dma_setup(struct dw_spi *dws, struct spi_transfer *xfer) |
11707 |
+ { |
11708 |
+ u16 imr = 0, dma_ctrl = 0; |
11709 |
+ |
11710 |
++ /* |
11711 |
++ * Having a Rx DMA channel serviced with higher priority than a Tx DMA |
11712 |
++ * channel might not be enough to provide a well balanced DMA-based |
11713 |
++ * SPI transfer interface. There might still be moments when the Tx DMA |
11714 |
++ * channel is occasionally handled faster than the Rx DMA channel. |
11715 |
++ * That in its turn will eventually cause the SPI Rx FIFO overflow if |
11716 |
++ * SPI bus speed is high enough to fill the SPI Rx FIFO in before it's |
11717 |
++ * cleared by the Rx DMA channel. In order to fix the problem the Tx |
11718 |
++ * DMA activity is intentionally slowed down by limiting the SPI Tx |
11719 |
++ * FIFO depth with a value twice bigger than the Tx burst length |
11720 |
++ * calculated earlier by the dw_spi_dma_maxburst_init() method. |
11721 |
++ */ |
11722 |
+ dw_writel(dws, DW_SPI_DMARDLR, dws->rxburst - 1); |
11723 |
+- dw_writel(dws, DW_SPI_DMATDLR, dws->fifo_len - dws->txburst); |
11724 |
++ dw_writel(dws, DW_SPI_DMATDLR, dws->txburst); |
11725 |
+ |
11726 |
+ if (xfer->tx_buf) |
11727 |
+ dma_ctrl |= SPI_DMA_TDMAE; |
11728 |
+diff --git a/drivers/spi/spi-lantiq-ssc.c b/drivers/spi/spi-lantiq-ssc.c |
11729 |
+index 1fd7ee53d451..049a64451c75 100644 |
11730 |
+--- a/drivers/spi/spi-lantiq-ssc.c |
11731 |
++++ b/drivers/spi/spi-lantiq-ssc.c |
11732 |
+@@ -184,6 +184,7 @@ struct lantiq_ssc_spi { |
11733 |
+ unsigned int tx_fifo_size; |
11734 |
+ unsigned int rx_fifo_size; |
11735 |
+ unsigned int base_cs; |
11736 |
++ unsigned int fdx_tx_level; |
11737 |
+ }; |
11738 |
+ |
11739 |
+ static u32 lantiq_ssc_readl(const struct lantiq_ssc_spi *spi, u32 reg) |
11740 |
+@@ -481,6 +482,7 @@ static void tx_fifo_write(struct lantiq_ssc_spi *spi) |
11741 |
+ u32 data; |
11742 |
+ unsigned int tx_free = tx_fifo_free(spi); |
11743 |
+ |
11744 |
++ spi->fdx_tx_level = 0; |
11745 |
+ while (spi->tx_todo && tx_free) { |
11746 |
+ switch (spi->bits_per_word) { |
11747 |
+ case 2 ... 8: |
11748 |
+@@ -509,6 +511,7 @@ static void tx_fifo_write(struct lantiq_ssc_spi *spi) |
11749 |
+ |
11750 |
+ lantiq_ssc_writel(spi, data, LTQ_SPI_TB); |
11751 |
+ tx_free--; |
11752 |
++ spi->fdx_tx_level++; |
11753 |
+ } |
11754 |
+ } |
11755 |
+ |
11756 |
+@@ -520,6 +523,13 @@ static void rx_fifo_read_full_duplex(struct lantiq_ssc_spi *spi) |
11757 |
+ u32 data; |
11758 |
+ unsigned int rx_fill = rx_fifo_level(spi); |
11759 |
+ |
11760 |
++ /* |
11761 |
++ * Wait until all expected data to be shifted in. |
11762 |
++ * Otherwise, rx overrun may occur. |
11763 |
++ */ |
11764 |
++ while (rx_fill != spi->fdx_tx_level) |
11765 |
++ rx_fill = rx_fifo_level(spi); |
11766 |
++ |
11767 |
+ while (rx_fill) { |
11768 |
+ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); |
11769 |
+ |
11770 |
+@@ -899,7 +909,7 @@ static int lantiq_ssc_probe(struct platform_device *pdev) |
11771 |
+ master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) | |
11772 |
+ SPI_BPW_MASK(16) | SPI_BPW_MASK(32); |
11773 |
+ |
11774 |
+- spi->wq = alloc_ordered_workqueue(dev_name(dev), 0); |
11775 |
++ spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM); |
11776 |
+ if (!spi->wq) { |
11777 |
+ err = -ENOMEM; |
11778 |
+ goto err_clk_put; |
11779 |
+diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c |
11780 |
+index 9b8a5e1233c0..4776aa815c3f 100644 |
11781 |
+--- a/drivers/spi/spi-rockchip.c |
11782 |
++++ b/drivers/spi/spi-rockchip.c |
11783 |
+@@ -288,7 +288,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs) |
11784 |
+ static void rockchip_spi_pio_reader(struct rockchip_spi *rs) |
11785 |
+ { |
11786 |
+ u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR); |
11787 |
+- u32 rx_left = rs->rx_left - words; |
11788 |
++ u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0; |
11789 |
+ |
11790 |
+ /* the hardware doesn't allow us to change fifo threshold |
11791 |
+ * level while spi is enabled, so instead make sure to leave |
11792 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
11793 |
+index 59e07675ef86..455e99c4958e 100644 |
11794 |
+--- a/drivers/spi/spidev.c |
11795 |
++++ b/drivers/spi/spidev.c |
11796 |
+@@ -224,6 +224,11 @@ static int spidev_message(struct spidev_data *spidev, |
11797 |
+ for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; |
11798 |
+ n; |
11799 |
+ n--, k_tmp++, u_tmp++) { |
11800 |
++ /* Ensure that also following allocations from rx_buf/tx_buf will meet |
11801 |
++ * DMA alignment requirements. |
11802 |
++ */ |
11803 |
++ unsigned int len_aligned = ALIGN(u_tmp->len, ARCH_KMALLOC_MINALIGN); |
11804 |
++ |
11805 |
+ k_tmp->len = u_tmp->len; |
11806 |
+ |
11807 |
+ total += k_tmp->len; |
11808 |
+@@ -239,17 +244,17 @@ static int spidev_message(struct spidev_data *spidev, |
11809 |
+ |
11810 |
+ if (u_tmp->rx_buf) { |
11811 |
+ /* this transfer needs space in RX bounce buffer */ |
11812 |
+- rx_total += k_tmp->len; |
11813 |
++ rx_total += len_aligned; |
11814 |
+ if (rx_total > bufsiz) { |
11815 |
+ status = -EMSGSIZE; |
11816 |
+ goto done; |
11817 |
+ } |
11818 |
+ k_tmp->rx_buf = rx_buf; |
11819 |
+- rx_buf += k_tmp->len; |
11820 |
++ rx_buf += len_aligned; |
11821 |
+ } |
11822 |
+ if (u_tmp->tx_buf) { |
11823 |
+ /* this transfer needs space in TX bounce buffer */ |
11824 |
+- tx_total += k_tmp->len; |
11825 |
++ tx_total += len_aligned; |
11826 |
+ if (tx_total > bufsiz) { |
11827 |
+ status = -EMSGSIZE; |
11828 |
+ goto done; |
11829 |
+@@ -259,7 +264,7 @@ static int spidev_message(struct spidev_data *spidev, |
11830 |
+ (uintptr_t) u_tmp->tx_buf, |
11831 |
+ u_tmp->len)) |
11832 |
+ goto done; |
11833 |
+- tx_buf += k_tmp->len; |
11834 |
++ tx_buf += len_aligned; |
11835 |
+ } |
11836 |
+ |
11837 |
+ k_tmp->cs_change = !!u_tmp->cs_change; |
11838 |
+@@ -293,16 +298,16 @@ static int spidev_message(struct spidev_data *spidev, |
11839 |
+ goto done; |
11840 |
+ |
11841 |
+ /* copy any rx data out of bounce buffer */ |
11842 |
+- rx_buf = spidev->rx_buffer; |
11843 |
+- for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { |
11844 |
++ for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; |
11845 |
++ n; |
11846 |
++ n--, k_tmp++, u_tmp++) { |
11847 |
+ if (u_tmp->rx_buf) { |
11848 |
+ if (copy_to_user((u8 __user *) |
11849 |
+- (uintptr_t) u_tmp->rx_buf, rx_buf, |
11850 |
++ (uintptr_t) u_tmp->rx_buf, k_tmp->rx_buf, |
11851 |
+ u_tmp->len)) { |
11852 |
+ status = -EFAULT; |
11853 |
+ goto done; |
11854 |
+ } |
11855 |
+- rx_buf += u_tmp->len; |
11856 |
+ } |
11857 |
+ } |
11858 |
+ status = total; |
11859 |
+diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c |
11860 |
+index 70f133a842dd..3ed66aae741d 100644 |
11861 |
+--- a/drivers/staging/media/allegro-dvt/allegro-core.c |
11862 |
++++ b/drivers/staging/media/allegro-dvt/allegro-core.c |
11863 |
+@@ -3065,9 +3065,9 @@ static int allegro_probe(struct platform_device *pdev) |
11864 |
+ return -EINVAL; |
11865 |
+ } |
11866 |
+ regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
11867 |
+- if (IS_ERR(regs)) { |
11868 |
++ if (!regs) { |
11869 |
+ dev_err(&pdev->dev, "failed to map registers\n"); |
11870 |
+- return PTR_ERR(regs); |
11871 |
++ return -ENOMEM; |
11872 |
+ } |
11873 |
+ dev->regmap = devm_regmap_init_mmio(&pdev->dev, regs, |
11874 |
+ &allegro_regmap_config); |
11875 |
+@@ -3085,9 +3085,9 @@ static int allegro_probe(struct platform_device *pdev) |
11876 |
+ sram_regs = devm_ioremap(&pdev->dev, |
11877 |
+ sram_res->start, |
11878 |
+ resource_size(sram_res)); |
11879 |
+- if (IS_ERR(sram_regs)) { |
11880 |
++ if (!sram_regs) { |
11881 |
+ dev_err(&pdev->dev, "failed to map sram\n"); |
11882 |
+- return PTR_ERR(sram_regs); |
11883 |
++ return -ENOMEM; |
11884 |
+ } |
11885 |
+ dev->sram = devm_regmap_init_mmio(&pdev->dev, sram_regs, |
11886 |
+ &allegro_sram_config); |
11887 |
+diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c |
11888 |
+index d049374413dc..e188944941b5 100644 |
11889 |
+--- a/drivers/staging/media/rkisp1/rkisp1-resizer.c |
11890 |
++++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c |
11891 |
+@@ -437,8 +437,8 @@ static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd, |
11892 |
+ u32 pad = code->pad; |
11893 |
+ int ret; |
11894 |
+ |
11895 |
+- /* supported mbus codes are the same in isp sink pad */ |
11896 |
+- code->pad = RKISP1_ISP_PAD_SINK_VIDEO; |
11897 |
++ /* supported mbus codes are the same in isp video src pad */ |
11898 |
++ code->pad = RKISP1_ISP_PAD_SOURCE_VIDEO; |
11899 |
+ ret = v4l2_subdev_call(&rsz->rkisp1->isp.sd, pad, enum_mbus_code, |
11900 |
+ &dummy_cfg, code); |
11901 |
+ |
11902 |
+@@ -553,11 +553,11 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz, |
11903 |
+ src_fmt->code = sink_fmt->code; |
11904 |
+ |
11905 |
+ sink_fmt->width = clamp_t(u32, format->width, |
11906 |
+- rsz->config->min_rsz_width, |
11907 |
+- rsz->config->max_rsz_width); |
11908 |
++ RKISP1_ISP_MIN_WIDTH, |
11909 |
++ RKISP1_ISP_MAX_WIDTH); |
11910 |
+ sink_fmt->height = clamp_t(u32, format->height, |
11911 |
+- rsz->config->min_rsz_height, |
11912 |
+- rsz->config->max_rsz_height); |
11913 |
++ RKISP1_ISP_MIN_HEIGHT, |
11914 |
++ RKISP1_ISP_MAX_HEIGHT); |
11915 |
+ |
11916 |
+ *format = *sink_fmt; |
11917 |
+ |
11918 |
+diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c |
11919 |
+index fcfb9024a83f..6ec65187bef9 100644 |
11920 |
+--- a/drivers/staging/rtl8192u/r8192U_core.c |
11921 |
++++ b/drivers/staging/rtl8192u/r8192U_core.c |
11922 |
+@@ -2374,7 +2374,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) |
11923 |
+ ret = eprom_read(dev, (EEPROM_TX_PW_INDEX_CCK >> 1)); |
11924 |
+ if (ret < 0) |
11925 |
+ return ret; |
11926 |
+- priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8; |
11927 |
++ priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8; |
11928 |
+ } else |
11929 |
+ priv->EEPROMTxPowerLevelCCK = 0x10; |
11930 |
+ RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK); |
11931 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c |
11932 |
+index 28ea8c3a4cba..355590f1e130 100644 |
11933 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c |
11934 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c |
11935 |
+@@ -2805,6 +2805,7 @@ failed_platform_init: |
11936 |
+ |
11937 |
+ static int vchiq_remove(struct platform_device *pdev) |
11938 |
+ { |
11939 |
++ platform_device_unregister(bcm2835_audio); |
11940 |
+ platform_device_unregister(bcm2835_camera); |
11941 |
+ vchiq_debugfs_deinit(); |
11942 |
+ device_destroy(vchiq_class, vchiq_devid); |
11943 |
+diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
11944 |
+index 297db1d2d960..81e8b15ef405 100644 |
11945 |
+--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
11946 |
++++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
11947 |
+@@ -43,7 +43,7 @@ |
11948 |
+ #define PCI_DEVICE_ID_PROC_ICL_THERMAL 0x8a03 |
11949 |
+ |
11950 |
+ /* JasperLake thermal reporting device */ |
11951 |
+-#define PCI_DEVICE_ID_PROC_JSL_THERMAL 0x4503 |
11952 |
++#define PCI_DEVICE_ID_PROC_JSL_THERMAL 0x4E03 |
11953 |
+ |
11954 |
+ /* TigerLake thermal reporting device */ |
11955 |
+ #define PCI_DEVICE_ID_PROC_TGL_THERMAL 0x9A03 |
11956 |
+diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
11957 |
+index 85776db4bf34..2ce4b19f312a 100644 |
11958 |
+--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
11959 |
++++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
11960 |
+@@ -169,7 +169,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, |
11961 |
+ |
11962 |
+ data = ti_bandgap_get_sensor_data(bgp, id); |
11963 |
+ |
11964 |
+- if (!IS_ERR_OR_NULL(data)) |
11965 |
++ if (IS_ERR_OR_NULL(data)) |
11966 |
+ data = ti_thermal_build_data(bgp, id); |
11967 |
+ |
11968 |
+ if (!data) |
11969 |
+diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c |
11970 |
+index 5e24c2e57c0d..37ae7fc5f8dd 100644 |
11971 |
+--- a/drivers/usb/cdns3/gadget.c |
11972 |
++++ b/drivers/usb/cdns3/gadget.c |
11973 |
+@@ -242,9 +242,10 @@ int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep) |
11974 |
+ return -ENOMEM; |
11975 |
+ |
11976 |
+ priv_ep->alloc_ring_size = ring_size; |
11977 |
+- memset(priv_ep->trb_pool, 0, ring_size); |
11978 |
+ } |
11979 |
+ |
11980 |
++ memset(priv_ep->trb_pool, 0, ring_size); |
11981 |
++ |
11982 |
+ priv_ep->num_trbs = num_trbs; |
11983 |
+ |
11984 |
+ if (!priv_ep->num) |
11985 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
11986 |
+index e0b77674869c..c96c50faccf7 100644 |
11987 |
+--- a/drivers/usb/core/quirks.c |
11988 |
++++ b/drivers/usb/core/quirks.c |
11989 |
+@@ -25,17 +25,23 @@ static unsigned int quirk_count; |
11990 |
+ |
11991 |
+ static char quirks_param[128]; |
11992 |
+ |
11993 |
+-static int quirks_param_set(const char *val, const struct kernel_param *kp) |
11994 |
++static int quirks_param_set(const char *value, const struct kernel_param *kp) |
11995 |
+ { |
11996 |
+- char *p, *field; |
11997 |
++ char *val, *p, *field; |
11998 |
+ u16 vid, pid; |
11999 |
+ u32 flags; |
12000 |
+ size_t i; |
12001 |
+ int err; |
12002 |
+ |
12003 |
++ val = kstrdup(value, GFP_KERNEL); |
12004 |
++ if (!val) |
12005 |
++ return -ENOMEM; |
12006 |
++ |
12007 |
+ err = param_set_copystring(val, kp); |
12008 |
+- if (err) |
12009 |
++ if (err) { |
12010 |
++ kfree(val); |
12011 |
+ return err; |
12012 |
++ } |
12013 |
+ |
12014 |
+ mutex_lock(&quirk_mutex); |
12015 |
+ |
12016 |
+@@ -60,10 +66,11 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp) |
12017 |
+ if (!quirk_list) { |
12018 |
+ quirk_count = 0; |
12019 |
+ mutex_unlock(&quirk_mutex); |
12020 |
++ kfree(val); |
12021 |
+ return -ENOMEM; |
12022 |
+ } |
12023 |
+ |
12024 |
+- for (i = 0, p = (char *)val; p && *p;) { |
12025 |
++ for (i = 0, p = val; p && *p;) { |
12026 |
+ /* Each entry consists of VID:PID:flags */ |
12027 |
+ field = strsep(&p, ":"); |
12028 |
+ if (!field) |
12029 |
+@@ -144,6 +151,7 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp) |
12030 |
+ |
12031 |
+ unlock: |
12032 |
+ mutex_unlock(&quirk_mutex); |
12033 |
++ kfree(val); |
12034 |
+ |
12035 |
+ return 0; |
12036 |
+ } |
12037 |
+diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c |
12038 |
+index cb8ddbd53718..db9fd4bd1a38 100644 |
12039 |
+--- a/drivers/usb/dwc2/platform.c |
12040 |
++++ b/drivers/usb/dwc2/platform.c |
12041 |
+@@ -582,6 +582,7 @@ static int dwc2_driver_probe(struct platform_device *dev) |
12042 |
+ if (hsotg->gadget_enabled) { |
12043 |
+ retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget); |
12044 |
+ if (retval) { |
12045 |
++ hsotg->gadget.udc = NULL; |
12046 |
+ dwc2_hsotg_remove(hsotg); |
12047 |
+ goto error_init; |
12048 |
+ } |
12049 |
+@@ -593,7 +594,8 @@ error_init: |
12050 |
+ if (hsotg->params.activate_stm_id_vb_detection) |
12051 |
+ regulator_disable(hsotg->usb33d); |
12052 |
+ error: |
12053 |
+- dwc2_lowlevel_hw_disable(hsotg); |
12054 |
++ if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) |
12055 |
++ dwc2_lowlevel_hw_disable(hsotg); |
12056 |
+ return retval; |
12057 |
+ } |
12058 |
+ |
12059 |
+diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c |
12060 |
+index 1f7f4d88ed9d..88b75b5a039c 100644 |
12061 |
+--- a/drivers/usb/dwc3/dwc3-meson-g12a.c |
12062 |
++++ b/drivers/usb/dwc3/dwc3-meson-g12a.c |
12063 |
+@@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
12064 |
+ goto err_disable_clks; |
12065 |
+ } |
12066 |
+ |
12067 |
+- ret = reset_control_reset(priv->reset); |
12068 |
++ ret = reset_control_deassert(priv->reset); |
12069 |
+ if (ret) |
12070 |
+- goto err_disable_clks; |
12071 |
++ goto err_assert_reset; |
12072 |
+ |
12073 |
+ ret = dwc3_meson_g12a_get_phys(priv); |
12074 |
+ if (ret) |
12075 |
+- goto err_disable_clks; |
12076 |
++ goto err_assert_reset; |
12077 |
+ |
12078 |
+ ret = priv->drvdata->setup_regmaps(priv, base); |
12079 |
+ if (ret) |
12080 |
+@@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
12081 |
+ if (priv->vbus) { |
12082 |
+ ret = regulator_enable(priv->vbus); |
12083 |
+ if (ret) |
12084 |
+- goto err_disable_clks; |
12085 |
++ goto err_assert_reset; |
12086 |
+ } |
12087 |
+ |
12088 |
+ /* Get dr_mode */ |
12089 |
+@@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
12090 |
+ |
12091 |
+ ret = priv->drvdata->usb_init(priv); |
12092 |
+ if (ret) |
12093 |
+- goto err_disable_clks; |
12094 |
++ goto err_assert_reset; |
12095 |
+ |
12096 |
+ /* Init PHYs */ |
12097 |
+ for (i = 0 ; i < PHY_COUNT ; ++i) { |
12098 |
+ ret = phy_init(priv->phys[i]); |
12099 |
+ if (ret) |
12100 |
+- goto err_disable_clks; |
12101 |
++ goto err_assert_reset; |
12102 |
+ } |
12103 |
+ |
12104 |
+ /* Set PHY Power */ |
12105 |
+@@ -809,6 +809,9 @@ err_phys_exit: |
12106 |
+ for (i = 0 ; i < PHY_COUNT ; ++i) |
12107 |
+ phy_exit(priv->phys[i]); |
12108 |
+ |
12109 |
++err_assert_reset: |
12110 |
++ reset_control_assert(priv->reset); |
12111 |
++ |
12112 |
+ err_disable_clks: |
12113 |
+ clk_bulk_disable_unprepare(priv->drvdata->num_clks, |
12114 |
+ priv->drvdata->clks); |
12115 |
+diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c |
12116 |
+index db2d4980cb35..3633df6d7610 100644 |
12117 |
+--- a/drivers/usb/gadget/function/f_uac2.c |
12118 |
++++ b/drivers/usb/gadget/function/f_uac2.c |
12119 |
+@@ -215,10 +215,7 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = { |
12120 |
+ .bDescriptorSubtype = UAC_MS_HEADER, |
12121 |
+ .bcdADC = cpu_to_le16(0x200), |
12122 |
+ .bCategory = UAC2_FUNCTION_IO_BOX, |
12123 |
+- .wTotalLength = cpu_to_le16(sizeof in_clk_src_desc |
12124 |
+- + sizeof out_clk_src_desc + sizeof usb_out_it_desc |
12125 |
+- + sizeof io_in_it_desc + sizeof usb_in_ot_desc |
12126 |
+- + sizeof io_out_ot_desc), |
12127 |
++ /* .wTotalLength = DYNAMIC */ |
12128 |
+ .bmControls = 0, |
12129 |
+ }; |
12130 |
+ |
12131 |
+@@ -501,7 +498,7 @@ static void setup_descriptor(struct f_uac2_opts *opts) |
12132 |
+ as_in_hdr_desc.bTerminalLink = usb_in_ot_desc.bTerminalID; |
12133 |
+ |
12134 |
+ iad_desc.bInterfaceCount = 1; |
12135 |
+- ac_hdr_desc.wTotalLength = 0; |
12136 |
++ ac_hdr_desc.wTotalLength = cpu_to_le16(sizeof(ac_hdr_desc)); |
12137 |
+ |
12138 |
+ if (EPIN_EN(opts)) { |
12139 |
+ u16 len = le16_to_cpu(ac_hdr_desc.wTotalLength); |
12140 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c |
12141 |
+index 02a3a774670b..2dca11f0a744 100644 |
12142 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_core.c |
12143 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_core.c |
12144 |
+@@ -282,6 +282,7 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) |
12145 |
+ * in that case reinit is passed as 1 |
12146 |
+ */ |
12147 |
+ if (reinit) { |
12148 |
++ int i; |
12149 |
+ /* Enable interrupts */ |
12150 |
+ temp = bdc_readl(bdc->regs, BDC_BDCSC); |
12151 |
+ temp |= BDC_GIE; |
12152 |
+@@ -291,6 +292,9 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit) |
12153 |
+ /* Initialize SRR to 0 */ |
12154 |
+ memset(bdc->srr.sr_bds, 0, |
12155 |
+ NUM_SR_ENTRIES * sizeof(struct bdc_bd)); |
12156 |
++ /* clear ep flags to avoid post disconnect stops/deconfigs */ |
12157 |
++ for (i = 1; i < bdc->num_eps; ++i) |
12158 |
++ bdc->bdc_ep_array[i]->flags = 0; |
12159 |
+ } else { |
12160 |
+ /* One time initiaization only */ |
12161 |
+ /* Enable status report function pointers */ |
12162 |
+@@ -599,9 +603,14 @@ static int bdc_remove(struct platform_device *pdev) |
12163 |
+ static int bdc_suspend(struct device *dev) |
12164 |
+ { |
12165 |
+ struct bdc *bdc = dev_get_drvdata(dev); |
12166 |
++ int ret; |
12167 |
+ |
12168 |
+- clk_disable_unprepare(bdc->clk); |
12169 |
+- return 0; |
12170 |
++ /* Halt the controller */ |
12171 |
++ ret = bdc_stop(bdc); |
12172 |
++ if (!ret) |
12173 |
++ clk_disable_unprepare(bdc->clk); |
12174 |
++ |
12175 |
++ return ret; |
12176 |
+ } |
12177 |
+ |
12178 |
+ static int bdc_resume(struct device *dev) |
12179 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
12180 |
+index d49c6dc1082d..9ddc0b4e92c9 100644 |
12181 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c |
12182 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
12183 |
+@@ -615,7 +615,6 @@ int bdc_ep_enable(struct bdc_ep *ep) |
12184 |
+ } |
12185 |
+ bdc_dbg_bd_list(bdc, ep); |
12186 |
+ /* only for ep0: config ep is called for ep0 from connect event */ |
12187 |
+- ep->flags |= BDC_EP_ENABLED; |
12188 |
+ if (ep->ep_num == 1) |
12189 |
+ return ret; |
12190 |
+ |
12191 |
+@@ -759,10 +758,13 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) |
12192 |
+ __func__, ep->name, start_bdi, end_bdi); |
12193 |
+ dev_dbg(bdc->dev, "ep_dequeue ep=%p ep->desc=%p\n", |
12194 |
+ ep, (void *)ep->usb_ep.desc); |
12195 |
+- /* Stop the ep to see where the HW is ? */ |
12196 |
+- ret = bdc_stop_ep(bdc, ep->ep_num); |
12197 |
+- /* if there is an issue with stopping ep, then no need to go further */ |
12198 |
+- if (ret) |
12199 |
++ /* if still connected, stop the ep to see where the HW is ? */ |
12200 |
++ if (!(bdc_readl(bdc->regs, BDC_USPC) & BDC_PST_MASK)) { |
12201 |
++ ret = bdc_stop_ep(bdc, ep->ep_num); |
12202 |
++ /* if there is an issue, then no need to go further */ |
12203 |
++ if (ret) |
12204 |
++ return 0; |
12205 |
++ } else |
12206 |
+ return 0; |
12207 |
+ |
12208 |
+ /* |
12209 |
+@@ -1911,7 +1913,9 @@ static int bdc_gadget_ep_disable(struct usb_ep *_ep) |
12210 |
+ __func__, ep->name, ep->flags); |
12211 |
+ |
12212 |
+ if (!(ep->flags & BDC_EP_ENABLED)) { |
12213 |
+- dev_warn(bdc->dev, "%s is already disabled\n", ep->name); |
12214 |
++ if (bdc->gadget.speed != USB_SPEED_UNKNOWN) |
12215 |
++ dev_warn(bdc->dev, "%s is already disabled\n", |
12216 |
++ ep->name); |
12217 |
+ return 0; |
12218 |
+ } |
12219 |
+ spin_lock_irqsave(&bdc->lock, flags); |
12220 |
+diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
12221 |
+index 5eff85eeaa5a..7530bd9a08c4 100644 |
12222 |
+--- a/drivers/usb/gadget/udc/net2280.c |
12223 |
++++ b/drivers/usb/gadget/udc/net2280.c |
12224 |
+@@ -3781,8 +3781,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
12225 |
+ return 0; |
12226 |
+ |
12227 |
+ done: |
12228 |
+- if (dev) |
12229 |
++ if (dev) { |
12230 |
+ net2280_remove(pdev); |
12231 |
++ kfree(dev); |
12232 |
++ } |
12233 |
+ return retval; |
12234 |
+ } |
12235 |
+ |
12236 |
+diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c |
12237 |
+index 9dd02160cca9..e3780d4d6514 100644 |
12238 |
+--- a/drivers/usb/mtu3/mtu3_core.c |
12239 |
++++ b/drivers/usb/mtu3/mtu3_core.c |
12240 |
+@@ -131,8 +131,12 @@ static void mtu3_device_disable(struct mtu3 *mtu) |
12241 |
+ mtu3_setbits(ibase, SSUSB_U2_CTRL(0), |
12242 |
+ SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN); |
12243 |
+ |
12244 |
+- if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) |
12245 |
++ if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) { |
12246 |
+ mtu3_clrbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL); |
12247 |
++ if (mtu->is_u3_ip) |
12248 |
++ mtu3_clrbits(ibase, SSUSB_U3_CTRL(0), |
12249 |
++ SSUSB_U3_PORT_DUAL_MODE); |
12250 |
++ } |
12251 |
+ |
12252 |
+ mtu3_setbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN); |
12253 |
+ } |
12254 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
12255 |
+index f5143eedbc48..a90801ef0055 100644 |
12256 |
+--- a/drivers/usb/serial/cp210x.c |
12257 |
++++ b/drivers/usb/serial/cp210x.c |
12258 |
+@@ -272,6 +272,8 @@ static struct usb_serial_driver cp210x_device = { |
12259 |
+ .break_ctl = cp210x_break_ctl, |
12260 |
+ .set_termios = cp210x_set_termios, |
12261 |
+ .tx_empty = cp210x_tx_empty, |
12262 |
++ .throttle = usb_serial_generic_throttle, |
12263 |
++ .unthrottle = usb_serial_generic_unthrottle, |
12264 |
+ .tiocmget = cp210x_tiocmget, |
12265 |
+ .tiocmset = cp210x_tiocmset, |
12266 |
+ .attach = cp210x_attach, |
12267 |
+@@ -915,6 +917,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, |
12268 |
+ u32 baud; |
12269 |
+ u16 bits; |
12270 |
+ u32 ctl_hs; |
12271 |
++ u32 flow_repl; |
12272 |
+ |
12273 |
+ cp210x_read_u32_reg(port, CP210X_GET_BAUDRATE, &baud); |
12274 |
+ |
12275 |
+@@ -1015,6 +1018,22 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, |
12276 |
+ ctl_hs = le32_to_cpu(flow_ctl.ulControlHandshake); |
12277 |
+ if (ctl_hs & CP210X_SERIAL_CTS_HANDSHAKE) { |
12278 |
+ dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); |
12279 |
++ /* |
12280 |
++ * When the port is closed, the CP210x hardware disables |
12281 |
++ * auto-RTS and RTS is deasserted but it leaves auto-CTS when |
12282 |
++ * in hardware flow control mode. When re-opening the port, if |
12283 |
++ * auto-CTS is enabled on the cp210x, then auto-RTS must be |
12284 |
++ * re-enabled in the driver. |
12285 |
++ */ |
12286 |
++ flow_repl = le32_to_cpu(flow_ctl.ulFlowReplace); |
12287 |
++ flow_repl &= ~CP210X_SERIAL_RTS_MASK; |
12288 |
++ flow_repl |= CP210X_SERIAL_RTS_SHIFT(CP210X_SERIAL_RTS_FLOW_CTL); |
12289 |
++ flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); |
12290 |
++ cp210x_write_reg_block(port, |
12291 |
++ CP210X_SET_FLOW, |
12292 |
++ &flow_ctl, |
12293 |
++ sizeof(flow_ctl)); |
12294 |
++ |
12295 |
+ cflag |= CRTSCTS; |
12296 |
+ } else { |
12297 |
+ dev_dbg(dev, "%s - flow control = NONE\n", __func__); |
12298 |
+diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c |
12299 |
+index b8dfeb4fb2ed..ffbb2a8901b2 100644 |
12300 |
+--- a/drivers/usb/serial/iuu_phoenix.c |
12301 |
++++ b/drivers/usb/serial/iuu_phoenix.c |
12302 |
+@@ -353,10 +353,11 @@ static void iuu_led_activity_on(struct urb *urb) |
12303 |
+ struct usb_serial_port *port = urb->context; |
12304 |
+ int result; |
12305 |
+ char *buf_ptr = port->write_urb->transfer_buffer; |
12306 |
+- *buf_ptr++ = IUU_SET_LED; |
12307 |
++ |
12308 |
+ if (xmas) { |
12309 |
+- get_random_bytes(buf_ptr, 6); |
12310 |
+- *(buf_ptr+7) = 1; |
12311 |
++ buf_ptr[0] = IUU_SET_LED; |
12312 |
++ get_random_bytes(buf_ptr + 1, 6); |
12313 |
++ buf_ptr[7] = 1; |
12314 |
+ } else { |
12315 |
+ iuu_rgbf_fill_buffer(buf_ptr, 255, 255, 0, 0, 0, 0, 255); |
12316 |
+ } |
12317 |
+@@ -374,13 +375,14 @@ static void iuu_led_activity_off(struct urb *urb) |
12318 |
+ struct usb_serial_port *port = urb->context; |
12319 |
+ int result; |
12320 |
+ char *buf_ptr = port->write_urb->transfer_buffer; |
12321 |
++ |
12322 |
+ if (xmas) { |
12323 |
+ iuu_rxcmd(urb); |
12324 |
+ return; |
12325 |
+- } else { |
12326 |
+- *buf_ptr++ = IUU_SET_LED; |
12327 |
+- iuu_rgbf_fill_buffer(buf_ptr, 0, 0, 255, 255, 0, 0, 255); |
12328 |
+ } |
12329 |
++ |
12330 |
++ iuu_rgbf_fill_buffer(buf_ptr, 0, 0, 255, 255, 0, 0, 255); |
12331 |
++ |
12332 |
+ usb_fill_bulk_urb(port->write_urb, port->serial->dev, |
12333 |
+ usb_sndbulkpipe(port->serial->dev, |
12334 |
+ port->bulk_out_endpointAddress), |
12335 |
+diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c |
12336 |
+index c7334cc65bb2..8ac6f341dcc1 100644 |
12337 |
+--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c |
12338 |
++++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c |
12339 |
+@@ -70,6 +70,8 @@ struct vdpasim { |
12340 |
+ u32 status; |
12341 |
+ u32 generation; |
12342 |
+ u64 features; |
12343 |
++ /* spinlock to synchronize iommu table */ |
12344 |
++ spinlock_t iommu_lock; |
12345 |
+ }; |
12346 |
+ |
12347 |
+ static struct vdpasim *vdpasim_dev; |
12348 |
+@@ -118,7 +120,9 @@ static void vdpasim_reset(struct vdpasim *vdpasim) |
12349 |
+ for (i = 0; i < VDPASIM_VQ_NUM; i++) |
12350 |
+ vdpasim_vq_reset(&vdpasim->vqs[i]); |
12351 |
+ |
12352 |
++ spin_lock(&vdpasim->iommu_lock); |
12353 |
+ vhost_iotlb_reset(vdpasim->iommu); |
12354 |
++ spin_unlock(&vdpasim->iommu_lock); |
12355 |
+ |
12356 |
+ vdpasim->features = 0; |
12357 |
+ vdpasim->status = 0; |
12358 |
+@@ -236,8 +240,10 @@ static dma_addr_t vdpasim_map_page(struct device *dev, struct page *page, |
12359 |
+ /* For simplicity, use identical mapping to avoid e.g iova |
12360 |
+ * allocator. |
12361 |
+ */ |
12362 |
++ spin_lock(&vdpasim->iommu_lock); |
12363 |
+ ret = vhost_iotlb_add_range(iommu, pa, pa + size - 1, |
12364 |
+ pa, dir_to_perm(dir)); |
12365 |
++ spin_unlock(&vdpasim->iommu_lock); |
12366 |
+ if (ret) |
12367 |
+ return DMA_MAPPING_ERROR; |
12368 |
+ |
12369 |
+@@ -251,8 +257,10 @@ static void vdpasim_unmap_page(struct device *dev, dma_addr_t dma_addr, |
12370 |
+ struct vdpasim *vdpasim = dev_to_sim(dev); |
12371 |
+ struct vhost_iotlb *iommu = vdpasim->iommu; |
12372 |
+ |
12373 |
++ spin_lock(&vdpasim->iommu_lock); |
12374 |
+ vhost_iotlb_del_range(iommu, (u64)dma_addr, |
12375 |
+ (u64)dma_addr + size - 1); |
12376 |
++ spin_unlock(&vdpasim->iommu_lock); |
12377 |
+ } |
12378 |
+ |
12379 |
+ static void *vdpasim_alloc_coherent(struct device *dev, size_t size, |
12380 |
+@@ -264,9 +272,10 @@ static void *vdpasim_alloc_coherent(struct device *dev, size_t size, |
12381 |
+ void *addr = kmalloc(size, flag); |
12382 |
+ int ret; |
12383 |
+ |
12384 |
+- if (!addr) |
12385 |
++ spin_lock(&vdpasim->iommu_lock); |
12386 |
++ if (!addr) { |
12387 |
+ *dma_addr = DMA_MAPPING_ERROR; |
12388 |
+- else { |
12389 |
++ } else { |
12390 |
+ u64 pa = virt_to_phys(addr); |
12391 |
+ |
12392 |
+ ret = vhost_iotlb_add_range(iommu, (u64)pa, |
12393 |
+@@ -279,6 +288,7 @@ static void *vdpasim_alloc_coherent(struct device *dev, size_t size, |
12394 |
+ } else |
12395 |
+ *dma_addr = (dma_addr_t)pa; |
12396 |
+ } |
12397 |
++ spin_unlock(&vdpasim->iommu_lock); |
12398 |
+ |
12399 |
+ return addr; |
12400 |
+ } |
12401 |
+@@ -290,8 +300,11 @@ static void vdpasim_free_coherent(struct device *dev, size_t size, |
12402 |
+ struct vdpasim *vdpasim = dev_to_sim(dev); |
12403 |
+ struct vhost_iotlb *iommu = vdpasim->iommu; |
12404 |
+ |
12405 |
++ spin_lock(&vdpasim->iommu_lock); |
12406 |
+ vhost_iotlb_del_range(iommu, (u64)dma_addr, |
12407 |
+ (u64)dma_addr + size - 1); |
12408 |
++ spin_unlock(&vdpasim->iommu_lock); |
12409 |
++ |
12410 |
+ kfree(phys_to_virt((uintptr_t)dma_addr)); |
12411 |
+ } |
12412 |
+ |
12413 |
+@@ -532,6 +545,7 @@ static int vdpasim_set_map(struct vdpa_device *vdpa, |
12414 |
+ u64 start = 0ULL, last = 0ULL - 1; |
12415 |
+ int ret; |
12416 |
+ |
12417 |
++ spin_lock(&vdpasim->iommu_lock); |
12418 |
+ vhost_iotlb_reset(vdpasim->iommu); |
12419 |
+ |
12420 |
+ for (map = vhost_iotlb_itree_first(iotlb, start, last); map; |
12421 |
+@@ -541,10 +555,12 @@ static int vdpasim_set_map(struct vdpa_device *vdpa, |
12422 |
+ if (ret) |
12423 |
+ goto err; |
12424 |
+ } |
12425 |
++ spin_unlock(&vdpasim->iommu_lock); |
12426 |
+ return 0; |
12427 |
+ |
12428 |
+ err: |
12429 |
+ vhost_iotlb_reset(vdpasim->iommu); |
12430 |
++ spin_unlock(&vdpasim->iommu_lock); |
12431 |
+ return ret; |
12432 |
+ } |
12433 |
+ |
12434 |
+@@ -552,16 +568,23 @@ static int vdpasim_dma_map(struct vdpa_device *vdpa, u64 iova, u64 size, |
12435 |
+ u64 pa, u32 perm) |
12436 |
+ { |
12437 |
+ struct vdpasim *vdpasim = vdpa_to_sim(vdpa); |
12438 |
++ int ret; |
12439 |
+ |
12440 |
+- return vhost_iotlb_add_range(vdpasim->iommu, iova, |
12441 |
+- iova + size - 1, pa, perm); |
12442 |
++ spin_lock(&vdpasim->iommu_lock); |
12443 |
++ ret = vhost_iotlb_add_range(vdpasim->iommu, iova, iova + size - 1, pa, |
12444 |
++ perm); |
12445 |
++ spin_unlock(&vdpasim->iommu_lock); |
12446 |
++ |
12447 |
++ return ret; |
12448 |
+ } |
12449 |
+ |
12450 |
+ static int vdpasim_dma_unmap(struct vdpa_device *vdpa, u64 iova, u64 size) |
12451 |
+ { |
12452 |
+ struct vdpasim *vdpasim = vdpa_to_sim(vdpa); |
12453 |
+ |
12454 |
++ spin_lock(&vdpasim->iommu_lock); |
12455 |
+ vhost_iotlb_del_range(vdpasim->iommu, iova, iova + size - 1); |
12456 |
++ spin_unlock(&vdpasim->iommu_lock); |
12457 |
+ |
12458 |
+ return 0; |
12459 |
+ } |
12460 |
+diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c |
12461 |
+index 504cda38763e..df3c52d72159 100644 |
12462 |
+--- a/drivers/video/console/newport_con.c |
12463 |
++++ b/drivers/video/console/newport_con.c |
12464 |
+@@ -31,6 +31,8 @@ |
12465 |
+ #include <linux/linux_logo.h> |
12466 |
+ #include <linux/font.h> |
12467 |
+ |
12468 |
++#define NEWPORT_LEN 0x10000 |
12469 |
++ |
12470 |
+ #define FONT_DATA ((unsigned char *)font_vga_8x16.data) |
12471 |
+ |
12472 |
+ /* borrowed from fbcon.c */ |
12473 |
+@@ -42,6 +44,7 @@ |
12474 |
+ static unsigned char *font_data[MAX_NR_CONSOLES]; |
12475 |
+ |
12476 |
+ static struct newport_regs *npregs; |
12477 |
++static unsigned long newport_addr; |
12478 |
+ |
12479 |
+ static int logo_active; |
12480 |
+ static int topscan; |
12481 |
+@@ -701,7 +704,6 @@ const struct consw newport_con = { |
12482 |
+ static int newport_probe(struct gio_device *dev, |
12483 |
+ const struct gio_device_id *id) |
12484 |
+ { |
12485 |
+- unsigned long newport_addr; |
12486 |
+ int err; |
12487 |
+ |
12488 |
+ if (!dev->resource.start) |
12489 |
+@@ -711,7 +713,7 @@ static int newport_probe(struct gio_device *dev, |
12490 |
+ return -EBUSY; /* we only support one Newport as console */ |
12491 |
+ |
12492 |
+ newport_addr = dev->resource.start + 0xF0000; |
12493 |
+- if (!request_mem_region(newport_addr, 0x10000, "Newport")) |
12494 |
++ if (!request_mem_region(newport_addr, NEWPORT_LEN, "Newport")) |
12495 |
+ return -ENODEV; |
12496 |
+ |
12497 |
+ npregs = (struct newport_regs *)/* ioremap cannot fail */ |
12498 |
+@@ -719,6 +721,11 @@ static int newport_probe(struct gio_device *dev, |
12499 |
+ console_lock(); |
12500 |
+ err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); |
12501 |
+ console_unlock(); |
12502 |
++ |
12503 |
++ if (err) { |
12504 |
++ iounmap((void *)npregs); |
12505 |
++ release_mem_region(newport_addr, NEWPORT_LEN); |
12506 |
++ } |
12507 |
+ return err; |
12508 |
+ } |
12509 |
+ |
12510 |
+@@ -726,6 +733,7 @@ static void newport_remove(struct gio_device *dev) |
12511 |
+ { |
12512 |
+ give_up_console(&newport_con); |
12513 |
+ iounmap((void *)npregs); |
12514 |
++ release_mem_region(newport_addr, NEWPORT_LEN); |
12515 |
+ } |
12516 |
+ |
12517 |
+ static struct gio_device_id newport_ids[] = { |
12518 |
+diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c |
12519 |
+index f5a676bfd67a..09a20d4ab35f 100644 |
12520 |
+--- a/drivers/video/fbdev/neofb.c |
12521 |
++++ b/drivers/video/fbdev/neofb.c |
12522 |
+@@ -1819,6 +1819,7 @@ static int neo_scan_monitor(struct fb_info *info) |
12523 |
+ #else |
12524 |
+ printk(KERN_ERR |
12525 |
+ "neofb: Only 640x480, 800x600/480 and 1024x768 panels are currently supported\n"); |
12526 |
++ kfree(info->monspecs.modedb); |
12527 |
+ return -1; |
12528 |
+ #endif |
12529 |
+ default: |
12530 |
+diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c |
12531 |
+index 00b96a78676e..6f972bed410a 100644 |
12532 |
+--- a/drivers/video/fbdev/pxafb.c |
12533 |
++++ b/drivers/video/fbdev/pxafb.c |
12534 |
+@@ -2417,8 +2417,8 @@ static int pxafb_remove(struct platform_device *dev) |
12535 |
+ |
12536 |
+ free_pages_exact(fbi->video_mem, fbi->video_mem_size); |
12537 |
+ |
12538 |
+- dma_free_wc(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, |
12539 |
+- fbi->dma_buff_phys); |
12540 |
++ dma_free_coherent(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, |
12541 |
++ fbi->dma_buff_phys); |
12542 |
+ |
12543 |
+ return 0; |
12544 |
+ } |
12545 |
+diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c |
12546 |
+index 3c8ae87f0ea7..3fd87aeb6c79 100644 |
12547 |
+--- a/drivers/video/fbdev/savage/savagefb_driver.c |
12548 |
++++ b/drivers/video/fbdev/savage/savagefb_driver.c |
12549 |
+@@ -2157,6 +2157,8 @@ static int savage_init_fb_info(struct fb_info *info, struct pci_dev *dev, |
12550 |
+ info->flags |= FBINFO_HWACCEL_COPYAREA | |
12551 |
+ FBINFO_HWACCEL_FILLRECT | |
12552 |
+ FBINFO_HWACCEL_IMAGEBLIT; |
12553 |
++ else |
12554 |
++ kfree(info->pixmap.addr); |
12555 |
+ } |
12556 |
+ #endif |
12557 |
+ return err; |
12558 |
+diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c |
12559 |
+index 6a1b4a853d9e..8cd655d6d628 100644 |
12560 |
+--- a/drivers/video/fbdev/sm712fb.c |
12561 |
++++ b/drivers/video/fbdev/sm712fb.c |
12562 |
+@@ -1429,6 +1429,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb, |
12563 |
+ static void smtc_unmap_smem(struct smtcfb_info *sfb) |
12564 |
+ { |
12565 |
+ if (sfb && sfb->fb->screen_base) { |
12566 |
++ if (sfb->chip_id == 0x720) |
12567 |
++ sfb->fb->screen_base -= 0x00200000; |
12568 |
+ iounmap(sfb->fb->screen_base); |
12569 |
+ sfb->fb->screen_base = NULL; |
12570 |
+ } |
12571 |
+diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
12572 |
+index 77c57568e5d7..292413b27575 100644 |
12573 |
+--- a/drivers/xen/balloon.c |
12574 |
++++ b/drivers/xen/balloon.c |
12575 |
+@@ -568,11 +568,13 @@ static int add_ballooned_pages(int nr_pages) |
12576 |
+ if (xen_hotplug_unpopulated) { |
12577 |
+ st = reserve_additional_memory(); |
12578 |
+ if (st != BP_ECANCELED) { |
12579 |
++ int rc; |
12580 |
++ |
12581 |
+ mutex_unlock(&balloon_mutex); |
12582 |
+- wait_event(balloon_wq, |
12583 |
++ rc = wait_event_interruptible(balloon_wq, |
12584 |
+ !list_empty(&ballooned_pages)); |
12585 |
+ mutex_lock(&balloon_mutex); |
12586 |
+- return 0; |
12587 |
++ return rc ? -ENOMEM : 0; |
12588 |
+ } |
12589 |
+ } |
12590 |
+ |
12591 |
+@@ -630,6 +632,12 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) |
12592 |
+ out_undo: |
12593 |
+ mutex_unlock(&balloon_mutex); |
12594 |
+ free_xenballooned_pages(pgno, pages); |
12595 |
++ /* |
12596 |
++ * NB: free_xenballooned_pages will only subtract pgno pages, but since |
12597 |
++ * target_unpopulated is incremented with nr_pages at the start we need |
12598 |
++ * to remove the remaining ones also, or accounting will be screwed. |
12599 |
++ */ |
12600 |
++ balloon_stats.target_unpopulated -= nr_pages - pgno; |
12601 |
+ return ret; |
12602 |
+ } |
12603 |
+ EXPORT_SYMBOL(alloc_xenballooned_pages); |
12604 |
+diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c |
12605 |
+index 75d3bb948bf3..b1b6eebafd5d 100644 |
12606 |
+--- a/drivers/xen/gntdev-dmabuf.c |
12607 |
++++ b/drivers/xen/gntdev-dmabuf.c |
12608 |
+@@ -613,6 +613,14 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev, |
12609 |
+ goto fail_detach; |
12610 |
+ } |
12611 |
+ |
12612 |
++ /* Check that we have zero offset. */ |
12613 |
++ if (sgt->sgl->offset) { |
12614 |
++ ret = ERR_PTR(-EINVAL); |
12615 |
++ pr_debug("DMA buffer has %d bytes offset, user-space expects 0\n", |
12616 |
++ sgt->sgl->offset); |
12617 |
++ goto fail_unmap; |
12618 |
++ } |
12619 |
++ |
12620 |
+ /* Check number of pages that imported buffer has. */ |
12621 |
+ if (attach->dmabuf->size != gntdev_dmabuf->nr_pages << PAGE_SHIFT) { |
12622 |
+ ret = ERR_PTR(-EINVAL); |
12623 |
+diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c |
12624 |
+index 15a99f9c7253..39def020a074 100644 |
12625 |
+--- a/fs/9p/v9fs.c |
12626 |
++++ b/fs/9p/v9fs.c |
12627 |
+@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) |
12628 |
+ } |
12629 |
+ |
12630 |
+ #ifdef CONFIG_9P_FSCACHE |
12631 |
+- if (v9ses->fscache) { |
12632 |
++ if (v9ses->fscache) |
12633 |
+ v9fs_cache_session_put_cookie(v9ses); |
12634 |
+- kfree(v9ses->cachetag); |
12635 |
+- } |
12636 |
++ kfree(v9ses->cachetag); |
12637 |
+ #endif |
12638 |
+ kfree(v9ses->uname); |
12639 |
+ kfree(v9ses->aname); |
12640 |
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
12641 |
+index d404cce8ae40..7c8efa0c3ee6 100644 |
12642 |
+--- a/fs/btrfs/ctree.h |
12643 |
++++ b/fs/btrfs/ctree.h |
12644 |
+@@ -2982,6 +2982,8 @@ int btrfs_dirty_pages(struct inode *inode, struct page **pages, |
12645 |
+ size_t num_pages, loff_t pos, size_t write_bytes, |
12646 |
+ struct extent_state **cached); |
12647 |
+ int btrfs_fdatawrite_range(struct inode *inode, loff_t start, loff_t end); |
12648 |
++int btrfs_check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
12649 |
++ size_t *write_bytes, bool nowait); |
12650 |
+ |
12651 |
+ /* tree-defrag.c */ |
12652 |
+ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, |
12653 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
12654 |
+index c0bc35f932bf..96223813b618 100644 |
12655 |
+--- a/fs/btrfs/extent-tree.c |
12656 |
++++ b/fs/btrfs/extent-tree.c |
12657 |
+@@ -5466,6 +5466,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) |
12658 |
+ } |
12659 |
+ } |
12660 |
+ |
12661 |
++ /* |
12662 |
++ * This subvolume is going to be completely dropped, and won't be |
12663 |
++ * recorded as dirty roots, thus pertrans meta rsv will not be freed at |
12664 |
++ * commit transaction time. So free it here manually. |
12665 |
++ */ |
12666 |
++ btrfs_qgroup_convert_reserved_meta(root, INT_MAX); |
12667 |
++ btrfs_qgroup_free_meta_all_pertrans(root); |
12668 |
++ |
12669 |
+ if (test_bit(BTRFS_ROOT_IN_RADIX, &root->state)) |
12670 |
+ btrfs_add_dropped_root(trans, root); |
12671 |
+ else |
12672 |
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
12673 |
+index 60278e52c37a..eeaee346f5a9 100644 |
12674 |
+--- a/fs/btrfs/extent_io.c |
12675 |
++++ b/fs/btrfs/extent_io.c |
12676 |
+@@ -4516,6 +4516,8 @@ int try_release_extent_mapping(struct page *page, gfp_t mask) |
12677 |
+ |
12678 |
+ /* once for us */ |
12679 |
+ free_extent_map(em); |
12680 |
++ |
12681 |
++ cond_resched(); /* Allow large-extent preemption. */ |
12682 |
+ } |
12683 |
+ } |
12684 |
+ return try_release_extent_state(tree, page, mask); |
12685 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
12686 |
+index b0d2c976587e..1523aa4eaff0 100644 |
12687 |
+--- a/fs/btrfs/file.c |
12688 |
++++ b/fs/btrfs/file.c |
12689 |
+@@ -1532,8 +1532,8 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages, |
12690 |
+ return ret; |
12691 |
+ } |
12692 |
+ |
12693 |
+-static noinline int check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
12694 |
+- size_t *write_bytes, bool nowait) |
12695 |
++int btrfs_check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
12696 |
++ size_t *write_bytes, bool nowait) |
12697 |
+ { |
12698 |
+ struct btrfs_fs_info *fs_info = inode->root->fs_info; |
12699 |
+ struct btrfs_root *root = inode->root; |
12700 |
+@@ -1648,8 +1648,8 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, |
12701 |
+ if (ret < 0) { |
12702 |
+ if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | |
12703 |
+ BTRFS_INODE_PREALLOC)) && |
12704 |
+- check_can_nocow(BTRFS_I(inode), pos, |
12705 |
+- &write_bytes, false) > 0) { |
12706 |
++ btrfs_check_can_nocow(BTRFS_I(inode), pos, |
12707 |
++ &write_bytes, false) > 0) { |
12708 |
+ /* |
12709 |
+ * For nodata cow case, no need to reserve |
12710 |
+ * data space. |
12711 |
+@@ -1928,8 +1928,8 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, |
12712 |
+ */ |
12713 |
+ if (!(BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | |
12714 |
+ BTRFS_INODE_PREALLOC)) || |
12715 |
+- check_can_nocow(BTRFS_I(inode), pos, &nocow_bytes, |
12716 |
+- true) <= 0) { |
12717 |
++ btrfs_check_can_nocow(BTRFS_I(inode), pos, &nocow_bytes, |
12718 |
++ true) <= 0) { |
12719 |
+ inode_unlock(inode); |
12720 |
+ return -EAGAIN; |
12721 |
+ } |
12722 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
12723 |
+index 6862cd7e21a9..3f77ec5de8ec 100644 |
12724 |
+--- a/fs/btrfs/inode.c |
12725 |
++++ b/fs/btrfs/inode.c |
12726 |
+@@ -4511,11 +4511,13 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, |
12727 |
+ struct extent_state *cached_state = NULL; |
12728 |
+ struct extent_changeset *data_reserved = NULL; |
12729 |
+ char *kaddr; |
12730 |
++ bool only_release_metadata = false; |
12731 |
+ u32 blocksize = fs_info->sectorsize; |
12732 |
+ pgoff_t index = from >> PAGE_SHIFT; |
12733 |
+ unsigned offset = from & (blocksize - 1); |
12734 |
+ struct page *page; |
12735 |
+ gfp_t mask = btrfs_alloc_write_mask(mapping); |
12736 |
++ size_t write_bytes = blocksize; |
12737 |
+ int ret = 0; |
12738 |
+ u64 block_start; |
12739 |
+ u64 block_end; |
12740 |
+@@ -4527,11 +4529,27 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, |
12741 |
+ block_start = round_down(from, blocksize); |
12742 |
+ block_end = block_start + blocksize - 1; |
12743 |
+ |
12744 |
+- ret = btrfs_delalloc_reserve_space(inode, &data_reserved, |
12745 |
+- block_start, blocksize); |
12746 |
+- if (ret) |
12747 |
+- goto out; |
12748 |
+ |
12749 |
++ ret = btrfs_check_data_free_space(inode, &data_reserved, block_start, |
12750 |
++ blocksize); |
12751 |
++ if (ret < 0) { |
12752 |
++ if ((BTRFS_I(inode)->flags & (BTRFS_INODE_NODATACOW | |
12753 |
++ BTRFS_INODE_PREALLOC)) && |
12754 |
++ btrfs_check_can_nocow(BTRFS_I(inode), block_start, |
12755 |
++ &write_bytes, false) > 0) { |
12756 |
++ /* For nocow case, no need to reserve data space */ |
12757 |
++ only_release_metadata = true; |
12758 |
++ } else { |
12759 |
++ goto out; |
12760 |
++ } |
12761 |
++ } |
12762 |
++ ret = btrfs_delalloc_reserve_metadata(BTRFS_I(inode), blocksize); |
12763 |
++ if (ret < 0) { |
12764 |
++ if (!only_release_metadata) |
12765 |
++ btrfs_free_reserved_data_space(inode, data_reserved, |
12766 |
++ block_start, blocksize); |
12767 |
++ goto out; |
12768 |
++ } |
12769 |
+ again: |
12770 |
+ page = find_or_create_page(mapping, index, mask); |
12771 |
+ if (!page) { |
12772 |
+@@ -4600,14 +4618,26 @@ again: |
12773 |
+ set_page_dirty(page); |
12774 |
+ unlock_extent_cached(io_tree, block_start, block_end, &cached_state); |
12775 |
+ |
12776 |
++ if (only_release_metadata) |
12777 |
++ set_extent_bit(&BTRFS_I(inode)->io_tree, block_start, |
12778 |
++ block_end, EXTENT_NORESERVE, NULL, NULL, |
12779 |
++ GFP_NOFS); |
12780 |
++ |
12781 |
+ out_unlock: |
12782 |
+- if (ret) |
12783 |
+- btrfs_delalloc_release_space(inode, data_reserved, block_start, |
12784 |
+- blocksize, true); |
12785 |
++ if (ret) { |
12786 |
++ if (only_release_metadata) |
12787 |
++ btrfs_delalloc_release_metadata(BTRFS_I(inode), |
12788 |
++ blocksize, true); |
12789 |
++ else |
12790 |
++ btrfs_delalloc_release_space(inode, data_reserved, |
12791 |
++ block_start, blocksize, true); |
12792 |
++ } |
12793 |
+ btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize); |
12794 |
+ unlock_page(page); |
12795 |
+ put_page(page); |
12796 |
+ out: |
12797 |
++ if (only_release_metadata) |
12798 |
++ btrfs_drew_write_unlock(&BTRFS_I(inode)->root->snapshot_lock); |
12799 |
+ extent_changeset_free(data_reserved); |
12800 |
+ return ret; |
12801 |
+ } |
12802 |
+diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c |
12803 |
+index c7bd3fdd7792..475968ccbd1d 100644 |
12804 |
+--- a/fs/btrfs/space-info.c |
12805 |
++++ b/fs/btrfs/space-info.c |
12806 |
+@@ -468,8 +468,8 @@ again: |
12807 |
+ "block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %s", |
12808 |
+ cache->start, cache->length, cache->used, cache->pinned, |
12809 |
+ cache->reserved, cache->ro ? "[readonly]" : ""); |
12810 |
+- btrfs_dump_free_space(cache, bytes); |
12811 |
+ spin_unlock(&cache->lock); |
12812 |
++ btrfs_dump_free_space(cache, bytes); |
12813 |
+ } |
12814 |
+ if (++index < BTRFS_NR_RAID_TYPES) |
12815 |
+ goto again; |
12816 |
+diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c |
12817 |
+index e93670ecfae5..624617c12250 100644 |
12818 |
+--- a/fs/dlm/lockspace.c |
12819 |
++++ b/fs/dlm/lockspace.c |
12820 |
+@@ -622,6 +622,9 @@ static int new_lockspace(const char *name, const char *cluster, |
12821 |
+ wait_event(ls->ls_recover_lock_wait, |
12822 |
+ test_bit(LSFL_RECOVER_LOCK, &ls->ls_flags)); |
12823 |
+ |
12824 |
++ /* let kobject handle freeing of ls if there's an error */ |
12825 |
++ do_unreg = 1; |
12826 |
++ |
12827 |
+ ls->ls_kobj.kset = dlm_kset; |
12828 |
+ error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL, |
12829 |
+ "%s", ls->ls_name); |
12830 |
+@@ -629,9 +632,6 @@ static int new_lockspace(const char *name, const char *cluster, |
12831 |
+ goto out_recoverd; |
12832 |
+ kobject_uevent(&ls->ls_kobj, KOBJ_ADD); |
12833 |
+ |
12834 |
+- /* let kobject handle freeing of ls if there's an error */ |
12835 |
+- do_unreg = 1; |
12836 |
+- |
12837 |
+ /* This uevent triggers dlm_controld in userspace to add us to the |
12838 |
+ group of nodes that are members of this lockspace (managed by the |
12839 |
+ cluster infrastructure.) Once it's done that, it tells us who the |
12840 |
+diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c |
12841 |
+index 7dd4bbe9674f..586f9d0a8b2f 100644 |
12842 |
+--- a/fs/erofs/inode.c |
12843 |
++++ b/fs/erofs/inode.c |
12844 |
+@@ -8,31 +8,80 @@ |
12845 |
+ |
12846 |
+ #include <trace/events/erofs.h> |
12847 |
+ |
12848 |
+-/* no locking */ |
12849 |
+-static int erofs_read_inode(struct inode *inode, void *data) |
12850 |
++/* |
12851 |
++ * if inode is successfully read, return its inode page (or sometimes |
12852 |
++ * the inode payload page if it's an extended inode) in order to fill |
12853 |
++ * inline data if possible. |
12854 |
++ */ |
12855 |
++static struct page *erofs_read_inode(struct inode *inode, |
12856 |
++ unsigned int *ofs) |
12857 |
+ { |
12858 |
++ struct super_block *sb = inode->i_sb; |
12859 |
++ struct erofs_sb_info *sbi = EROFS_SB(sb); |
12860 |
+ struct erofs_inode *vi = EROFS_I(inode); |
12861 |
+- struct erofs_inode_compact *dic = data; |
12862 |
+- struct erofs_inode_extended *die; |
12863 |
++ const erofs_off_t inode_loc = iloc(sbi, vi->nid); |
12864 |
++ |
12865 |
++ erofs_blk_t blkaddr, nblks = 0; |
12866 |
++ struct page *page; |
12867 |
++ struct erofs_inode_compact *dic; |
12868 |
++ struct erofs_inode_extended *die, *copied = NULL; |
12869 |
++ unsigned int ifmt; |
12870 |
++ int err; |
12871 |
+ |
12872 |
+- const unsigned int ifmt = le16_to_cpu(dic->i_format); |
12873 |
+- struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb); |
12874 |
+- erofs_blk_t nblks = 0; |
12875 |
++ blkaddr = erofs_blknr(inode_loc); |
12876 |
++ *ofs = erofs_blkoff(inode_loc); |
12877 |
+ |
12878 |
+- vi->datalayout = erofs_inode_datalayout(ifmt); |
12879 |
++ erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u", |
12880 |
++ __func__, vi->nid, *ofs, blkaddr); |
12881 |
++ |
12882 |
++ page = erofs_get_meta_page(sb, blkaddr); |
12883 |
++ if (IS_ERR(page)) { |
12884 |
++ erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld", |
12885 |
++ vi->nid, PTR_ERR(page)); |
12886 |
++ return page; |
12887 |
++ } |
12888 |
+ |
12889 |
++ dic = page_address(page) + *ofs; |
12890 |
++ ifmt = le16_to_cpu(dic->i_format); |
12891 |
++ |
12892 |
++ vi->datalayout = erofs_inode_datalayout(ifmt); |
12893 |
+ if (vi->datalayout >= EROFS_INODE_DATALAYOUT_MAX) { |
12894 |
+ erofs_err(inode->i_sb, "unsupported datalayout %u of nid %llu", |
12895 |
+ vi->datalayout, vi->nid); |
12896 |
+- DBG_BUGON(1); |
12897 |
+- return -EOPNOTSUPP; |
12898 |
++ err = -EOPNOTSUPP; |
12899 |
++ goto err_out; |
12900 |
+ } |
12901 |
+ |
12902 |
+ switch (erofs_inode_version(ifmt)) { |
12903 |
+ case EROFS_INODE_LAYOUT_EXTENDED: |
12904 |
+- die = data; |
12905 |
+- |
12906 |
+ vi->inode_isize = sizeof(struct erofs_inode_extended); |
12907 |
++ /* check if the inode acrosses page boundary */ |
12908 |
++ if (*ofs + vi->inode_isize <= PAGE_SIZE) { |
12909 |
++ *ofs += vi->inode_isize; |
12910 |
++ die = (struct erofs_inode_extended *)dic; |
12911 |
++ } else { |
12912 |
++ const unsigned int gotten = PAGE_SIZE - *ofs; |
12913 |
++ |
12914 |
++ copied = kmalloc(vi->inode_isize, GFP_NOFS); |
12915 |
++ if (!copied) { |
12916 |
++ err = -ENOMEM; |
12917 |
++ goto err_out; |
12918 |
++ } |
12919 |
++ memcpy(copied, dic, gotten); |
12920 |
++ unlock_page(page); |
12921 |
++ put_page(page); |
12922 |
++ |
12923 |
++ page = erofs_get_meta_page(sb, blkaddr + 1); |
12924 |
++ if (IS_ERR(page)) { |
12925 |
++ erofs_err(sb, "failed to get inode payload page (nid: %llu), err %ld", |
12926 |
++ vi->nid, PTR_ERR(page)); |
12927 |
++ kfree(copied); |
12928 |
++ return page; |
12929 |
++ } |
12930 |
++ *ofs = vi->inode_isize - gotten; |
12931 |
++ memcpy((u8 *)copied + gotten, page_address(page), *ofs); |
12932 |
++ die = copied; |
12933 |
++ } |
12934 |
+ vi->xattr_isize = erofs_xattr_ibody_size(die->i_xattr_icount); |
12935 |
+ |
12936 |
+ inode->i_mode = le16_to_cpu(die->i_mode); |
12937 |
+@@ -69,9 +118,12 @@ static int erofs_read_inode(struct inode *inode, void *data) |
12938 |
+ /* total blocks for compressed files */ |
12939 |
+ if (erofs_inode_is_data_compressed(vi->datalayout)) |
12940 |
+ nblks = le32_to_cpu(die->i_u.compressed_blocks); |
12941 |
++ |
12942 |
++ kfree(copied); |
12943 |
+ break; |
12944 |
+ case EROFS_INODE_LAYOUT_COMPACT: |
12945 |
+ vi->inode_isize = sizeof(struct erofs_inode_compact); |
12946 |
++ *ofs += vi->inode_isize; |
12947 |
+ vi->xattr_isize = erofs_xattr_ibody_size(dic->i_xattr_icount); |
12948 |
+ |
12949 |
+ inode->i_mode = le16_to_cpu(dic->i_mode); |
12950 |
+@@ -111,8 +163,8 @@ static int erofs_read_inode(struct inode *inode, void *data) |
12951 |
+ erofs_err(inode->i_sb, |
12952 |
+ "unsupported on-disk inode version %u of nid %llu", |
12953 |
+ erofs_inode_version(ifmt), vi->nid); |
12954 |
+- DBG_BUGON(1); |
12955 |
+- return -EOPNOTSUPP; |
12956 |
++ err = -EOPNOTSUPP; |
12957 |
++ goto err_out; |
12958 |
+ } |
12959 |
+ |
12960 |
+ if (!nblks) |
12961 |
+@@ -120,13 +172,18 @@ static int erofs_read_inode(struct inode *inode, void *data) |
12962 |
+ inode->i_blocks = roundup(inode->i_size, EROFS_BLKSIZ) >> 9; |
12963 |
+ else |
12964 |
+ inode->i_blocks = nblks << LOG_SECTORS_PER_BLOCK; |
12965 |
+- return 0; |
12966 |
++ return page; |
12967 |
+ |
12968 |
+ bogusimode: |
12969 |
+ erofs_err(inode->i_sb, "bogus i_mode (%o) @ nid %llu", |
12970 |
+ inode->i_mode, vi->nid); |
12971 |
++ err = -EFSCORRUPTED; |
12972 |
++err_out: |
12973 |
+ DBG_BUGON(1); |
12974 |
+- return -EFSCORRUPTED; |
12975 |
++ kfree(copied); |
12976 |
++ unlock_page(page); |
12977 |
++ put_page(page); |
12978 |
++ return ERR_PTR(err); |
12979 |
+ } |
12980 |
+ |
12981 |
+ static int erofs_fill_symlink(struct inode *inode, void *data, |
12982 |
+@@ -146,7 +203,7 @@ static int erofs_fill_symlink(struct inode *inode, void *data, |
12983 |
+ if (!lnk) |
12984 |
+ return -ENOMEM; |
12985 |
+ |
12986 |
+- m_pofs += vi->inode_isize + vi->xattr_isize; |
12987 |
++ m_pofs += vi->xattr_isize; |
12988 |
+ /* inline symlink data shouldn't cross page boundary as well */ |
12989 |
+ if (m_pofs + inode->i_size > PAGE_SIZE) { |
12990 |
+ kfree(lnk); |
12991 |
+@@ -167,37 +224,17 @@ static int erofs_fill_symlink(struct inode *inode, void *data, |
12992 |
+ |
12993 |
+ static int erofs_fill_inode(struct inode *inode, int isdir) |
12994 |
+ { |
12995 |
+- struct super_block *sb = inode->i_sb; |
12996 |
+ struct erofs_inode *vi = EROFS_I(inode); |
12997 |
+ struct page *page; |
12998 |
+- void *data; |
12999 |
+- int err; |
13000 |
+- erofs_blk_t blkaddr; |
13001 |
+ unsigned int ofs; |
13002 |
+- erofs_off_t inode_loc; |
13003 |
++ int err = 0; |
13004 |
+ |
13005 |
+ trace_erofs_fill_inode(inode, isdir); |
13006 |
+- inode_loc = iloc(EROFS_SB(sb), vi->nid); |
13007 |
+- blkaddr = erofs_blknr(inode_loc); |
13008 |
+- ofs = erofs_blkoff(inode_loc); |
13009 |
+- |
13010 |
+- erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u", |
13011 |
+- __func__, vi->nid, ofs, blkaddr); |
13012 |
+ |
13013 |
+- page = erofs_get_meta_page(sb, blkaddr); |
13014 |
+- |
13015 |
+- if (IS_ERR(page)) { |
13016 |
+- erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld", |
13017 |
+- vi->nid, PTR_ERR(page)); |
13018 |
++ /* read inode base data from disk */ |
13019 |
++ page = erofs_read_inode(inode, &ofs); |
13020 |
++ if (IS_ERR(page)) |
13021 |
+ return PTR_ERR(page); |
13022 |
+- } |
13023 |
+- |
13024 |
+- DBG_BUGON(!PageUptodate(page)); |
13025 |
+- data = page_address(page); |
13026 |
+- |
13027 |
+- err = erofs_read_inode(inode, data + ofs); |
13028 |
+- if (err) |
13029 |
+- goto out_unlock; |
13030 |
+ |
13031 |
+ /* setup the new inode */ |
13032 |
+ switch (inode->i_mode & S_IFMT) { |
13033 |
+@@ -210,7 +247,7 @@ static int erofs_fill_inode(struct inode *inode, int isdir) |
13034 |
+ inode->i_fop = &erofs_dir_fops; |
13035 |
+ break; |
13036 |
+ case S_IFLNK: |
13037 |
+- err = erofs_fill_symlink(inode, data, ofs); |
13038 |
++ err = erofs_fill_symlink(inode, page_address(page), ofs); |
13039 |
+ if (err) |
13040 |
+ goto out_unlock; |
13041 |
+ inode_nohighmem(inode); |
13042 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
13043 |
+index 493e5047e67c..f926d94867f7 100644 |
13044 |
+--- a/fs/io_uring.c |
13045 |
++++ b/fs/io_uring.c |
13046 |
+@@ -669,12 +669,12 @@ struct io_kiocb { |
13047 |
+ * restore the work, if needed. |
13048 |
+ */ |
13049 |
+ struct { |
13050 |
+- struct callback_head task_work; |
13051 |
+ struct hlist_node hash_node; |
13052 |
+ struct async_poll *apoll; |
13053 |
+ }; |
13054 |
+ struct io_wq_work work; |
13055 |
+ }; |
13056 |
++ struct callback_head task_work; |
13057 |
+ }; |
13058 |
+ |
13059 |
+ #define IO_PLUG_THRESHOLD 2 |
13060 |
+@@ -1549,12 +1549,9 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr) |
13061 |
+ /* |
13062 |
+ * Called if REQ_F_LINK_HEAD is set, and we fail the head request |
13063 |
+ */ |
13064 |
+-static void io_fail_links(struct io_kiocb *req) |
13065 |
++static void __io_fail_links(struct io_kiocb *req) |
13066 |
+ { |
13067 |
+ struct io_ring_ctx *ctx = req->ctx; |
13068 |
+- unsigned long flags; |
13069 |
+- |
13070 |
+- spin_lock_irqsave(&ctx->completion_lock, flags); |
13071 |
+ |
13072 |
+ while (!list_empty(&req->link_list)) { |
13073 |
+ struct io_kiocb *link = list_first_entry(&req->link_list, |
13074 |
+@@ -1568,13 +1565,29 @@ static void io_fail_links(struct io_kiocb *req) |
13075 |
+ io_link_cancel_timeout(link); |
13076 |
+ } else { |
13077 |
+ io_cqring_fill_event(link, -ECANCELED); |
13078 |
++ link->flags |= REQ_F_COMP_LOCKED; |
13079 |
+ __io_double_put_req(link); |
13080 |
+ } |
13081 |
+ req->flags &= ~REQ_F_LINK_TIMEOUT; |
13082 |
+ } |
13083 |
+ |
13084 |
+ io_commit_cqring(ctx); |
13085 |
+- spin_unlock_irqrestore(&ctx->completion_lock, flags); |
13086 |
++} |
13087 |
++ |
13088 |
++static void io_fail_links(struct io_kiocb *req) |
13089 |
++{ |
13090 |
++ struct io_ring_ctx *ctx = req->ctx; |
13091 |
++ |
13092 |
++ if (!(req->flags & REQ_F_COMP_LOCKED)) { |
13093 |
++ unsigned long flags; |
13094 |
++ |
13095 |
++ spin_lock_irqsave(&ctx->completion_lock, flags); |
13096 |
++ __io_fail_links(req); |
13097 |
++ spin_unlock_irqrestore(&ctx->completion_lock, flags); |
13098 |
++ } else { |
13099 |
++ __io_fail_links(req); |
13100 |
++ } |
13101 |
++ |
13102 |
+ io_cqring_ev_posted(ctx); |
13103 |
+ } |
13104 |
+ |
13105 |
+@@ -1747,6 +1760,17 @@ static int io_put_kbuf(struct io_kiocb *req) |
13106 |
+ return cflags; |
13107 |
+ } |
13108 |
+ |
13109 |
++static inline bool io_run_task_work(void) |
13110 |
++{ |
13111 |
++ if (current->task_works) { |
13112 |
++ __set_current_state(TASK_RUNNING); |
13113 |
++ task_work_run(); |
13114 |
++ return true; |
13115 |
++ } |
13116 |
++ |
13117 |
++ return false; |
13118 |
++} |
13119 |
++ |
13120 |
+ static void io_iopoll_queue(struct list_head *again) |
13121 |
+ { |
13122 |
+ struct io_kiocb *req; |
13123 |
+@@ -1936,6 +1960,7 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, |
13124 |
+ */ |
13125 |
+ if (!(++iters & 7)) { |
13126 |
+ mutex_unlock(&ctx->uring_lock); |
13127 |
++ io_run_task_work(); |
13128 |
+ mutex_lock(&ctx->uring_lock); |
13129 |
+ } |
13130 |
+ |
13131 |
+@@ -2661,8 +2686,10 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) |
13132 |
+ |
13133 |
+ if (req->file->f_op->read_iter) |
13134 |
+ ret2 = call_read_iter(req->file, kiocb, &iter); |
13135 |
+- else |
13136 |
++ else if (req->file->f_op->read) |
13137 |
+ ret2 = loop_rw_iter(READ, req->file, kiocb, &iter); |
13138 |
++ else |
13139 |
++ ret2 = -EINVAL; |
13140 |
+ |
13141 |
+ /* Catch -EAGAIN return for forced non-blocking submission */ |
13142 |
+ if (!force_nonblock || ret2 != -EAGAIN) { |
13143 |
+@@ -2776,8 +2803,10 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) |
13144 |
+ |
13145 |
+ if (req->file->f_op->write_iter) |
13146 |
+ ret2 = call_write_iter(req->file, kiocb, &iter); |
13147 |
+- else |
13148 |
++ else if (req->file->f_op->write) |
13149 |
+ ret2 = loop_rw_iter(WRITE, req->file, kiocb, &iter); |
13150 |
++ else |
13151 |
++ ret2 = -EINVAL; |
13152 |
+ |
13153 |
+ if (!force_nonblock) |
13154 |
+ current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; |
13155 |
+@@ -4088,22 +4117,22 @@ static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb) |
13156 |
+ { |
13157 |
+ struct task_struct *tsk = req->task; |
13158 |
+ struct io_ring_ctx *ctx = req->ctx; |
13159 |
+- int ret, notify = TWA_RESUME; |
13160 |
++ int ret, notify; |
13161 |
+ |
13162 |
+ /* |
13163 |
+- * SQPOLL kernel thread doesn't need notification, just a wakeup. |
13164 |
+- * If we're not using an eventfd, then TWA_RESUME is always fine, |
13165 |
+- * as we won't have dependencies between request completions for |
13166 |
+- * other kernel wait conditions. |
13167 |
++ * SQPOLL kernel thread doesn't need notification, just a wakeup. For |
13168 |
++ * all other cases, use TWA_SIGNAL unconditionally to ensure we're |
13169 |
++ * processing task_work. There's no reliable way to tell if TWA_RESUME |
13170 |
++ * will do the job. |
13171 |
+ */ |
13172 |
+- if (ctx->flags & IORING_SETUP_SQPOLL) |
13173 |
+- notify = 0; |
13174 |
+- else if (ctx->cq_ev_fd) |
13175 |
++ notify = 0; |
13176 |
++ if (!(ctx->flags & IORING_SETUP_SQPOLL)) |
13177 |
+ notify = TWA_SIGNAL; |
13178 |
+ |
13179 |
+ ret = task_work_add(tsk, cb, notify); |
13180 |
+ if (!ret) |
13181 |
+ wake_up_process(tsk); |
13182 |
++ |
13183 |
+ return ret; |
13184 |
+ } |
13185 |
+ |
13186 |
+@@ -4124,6 +4153,8 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, |
13187 |
+ tsk = req->task; |
13188 |
+ req->result = mask; |
13189 |
+ init_task_work(&req->task_work, func); |
13190 |
++ percpu_ref_get(&req->ctx->refs); |
13191 |
++ |
13192 |
+ /* |
13193 |
+ * If this fails, then the task is exiting. When a task exits, the |
13194 |
+ * work gets canceled, so just cancel this request as well instead |
13195 |
+@@ -4160,9 +4191,24 @@ static bool io_poll_rewait(struct io_kiocb *req, struct io_poll_iocb *poll) |
13196 |
+ return false; |
13197 |
+ } |
13198 |
+ |
13199 |
+-static void io_poll_remove_double(struct io_kiocb *req, void *data) |
13200 |
++static struct io_poll_iocb *io_poll_get_double(struct io_kiocb *req) |
13201 |
++{ |
13202 |
++ /* pure poll stashes this in ->io, poll driven retry elsewhere */ |
13203 |
++ if (req->opcode == IORING_OP_POLL_ADD) |
13204 |
++ return (struct io_poll_iocb *) req->io; |
13205 |
++ return req->apoll->double_poll; |
13206 |
++} |
13207 |
++ |
13208 |
++static struct io_poll_iocb *io_poll_get_single(struct io_kiocb *req) |
13209 |
++{ |
13210 |
++ if (req->opcode == IORING_OP_POLL_ADD) |
13211 |
++ return &req->poll; |
13212 |
++ return &req->apoll->poll; |
13213 |
++} |
13214 |
++ |
13215 |
++static void io_poll_remove_double(struct io_kiocb *req) |
13216 |
+ { |
13217 |
+- struct io_poll_iocb *poll = data; |
13218 |
++ struct io_poll_iocb *poll = io_poll_get_double(req); |
13219 |
+ |
13220 |
+ lockdep_assert_held(&req->ctx->completion_lock); |
13221 |
+ |
13222 |
+@@ -4182,7 +4228,7 @@ static void io_poll_complete(struct io_kiocb *req, __poll_t mask, int error) |
13223 |
+ { |
13224 |
+ struct io_ring_ctx *ctx = req->ctx; |
13225 |
+ |
13226 |
+- io_poll_remove_double(req, req->io); |
13227 |
++ io_poll_remove_double(req); |
13228 |
+ req->poll.done = true; |
13229 |
+ io_cqring_fill_event(req, error ? error : mangle_poll(mask)); |
13230 |
+ io_commit_cqring(ctx); |
13231 |
+@@ -4208,6 +4254,7 @@ static void io_poll_task_handler(struct io_kiocb *req, struct io_kiocb **nxt) |
13232 |
+ static void io_poll_task_func(struct callback_head *cb) |
13233 |
+ { |
13234 |
+ struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); |
13235 |
++ struct io_ring_ctx *ctx = req->ctx; |
13236 |
+ struct io_kiocb *nxt = NULL; |
13237 |
+ |
13238 |
+ io_poll_task_handler(req, &nxt); |
13239 |
+@@ -4218,13 +4265,14 @@ static void io_poll_task_func(struct callback_head *cb) |
13240 |
+ __io_queue_sqe(nxt, NULL); |
13241 |
+ mutex_unlock(&ctx->uring_lock); |
13242 |
+ } |
13243 |
++ percpu_ref_put(&ctx->refs); |
13244 |
+ } |
13245 |
+ |
13246 |
+ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, |
13247 |
+ int sync, void *key) |
13248 |
+ { |
13249 |
+ struct io_kiocb *req = wait->private; |
13250 |
+- struct io_poll_iocb *poll = req->apoll->double_poll; |
13251 |
++ struct io_poll_iocb *poll = io_poll_get_single(req); |
13252 |
+ __poll_t mask = key_to_poll(key); |
13253 |
+ |
13254 |
+ /* for instances that support it check for an event match first: */ |
13255 |
+@@ -4238,6 +4286,8 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, |
13256 |
+ done = list_empty(&poll->wait.entry); |
13257 |
+ if (!done) |
13258 |
+ list_del_init(&poll->wait.entry); |
13259 |
++ /* make sure double remove sees this as being gone */ |
13260 |
++ wait->private = NULL; |
13261 |
+ spin_unlock(&poll->head->lock); |
13262 |
+ if (!done) |
13263 |
+ __io_async_wake(req, poll, mask, io_poll_task_func); |
13264 |
+@@ -4332,6 +4382,7 @@ static void io_async_task_func(struct callback_head *cb) |
13265 |
+ |
13266 |
+ if (io_poll_rewait(req, &apoll->poll)) { |
13267 |
+ spin_unlock_irq(&ctx->completion_lock); |
13268 |
++ percpu_ref_put(&ctx->refs); |
13269 |
+ return; |
13270 |
+ } |
13271 |
+ |
13272 |
+@@ -4346,7 +4397,7 @@ static void io_async_task_func(struct callback_head *cb) |
13273 |
+ } |
13274 |
+ } |
13275 |
+ |
13276 |
+- io_poll_remove_double(req, apoll->double_poll); |
13277 |
++ io_poll_remove_double(req); |
13278 |
+ spin_unlock_irq(&ctx->completion_lock); |
13279 |
+ |
13280 |
+ /* restore ->work in case we need to retry again */ |
13281 |
+@@ -4356,7 +4407,6 @@ static void io_async_task_func(struct callback_head *cb) |
13282 |
+ kfree(apoll); |
13283 |
+ |
13284 |
+ if (!canceled) { |
13285 |
+- __set_current_state(TASK_RUNNING); |
13286 |
+ if (io_sq_thread_acquire_mm(ctx, req)) { |
13287 |
+ io_cqring_add_event(req, -EFAULT); |
13288 |
+ goto end_req; |
13289 |
+@@ -4370,6 +4420,7 @@ end_req: |
13290 |
+ req_set_fail_links(req); |
13291 |
+ io_double_put_req(req); |
13292 |
+ } |
13293 |
++ percpu_ref_put(&ctx->refs); |
13294 |
+ } |
13295 |
+ |
13296 |
+ static int io_async_wake(struct wait_queue_entry *wait, unsigned mode, int sync, |
13297 |
+@@ -4472,8 +4523,8 @@ static bool io_arm_poll_handler(struct io_kiocb *req) |
13298 |
+ |
13299 |
+ ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask, |
13300 |
+ io_async_wake); |
13301 |
+- if (ret) { |
13302 |
+- io_poll_remove_double(req, apoll->double_poll); |
13303 |
++ if (ret || ipt.error) { |
13304 |
++ io_poll_remove_double(req); |
13305 |
+ spin_unlock_irq(&ctx->completion_lock); |
13306 |
+ if (req->flags & REQ_F_WORK_INITIALIZED) |
13307 |
+ memcpy(&req->work, &apoll->work, sizeof(req->work)); |
13308 |
+@@ -4507,14 +4558,13 @@ static bool io_poll_remove_one(struct io_kiocb *req) |
13309 |
+ { |
13310 |
+ bool do_complete; |
13311 |
+ |
13312 |
++ io_poll_remove_double(req); |
13313 |
++ |
13314 |
+ if (req->opcode == IORING_OP_POLL_ADD) { |
13315 |
+- io_poll_remove_double(req, req->io); |
13316 |
+ do_complete = __io_poll_remove_one(req, &req->poll); |
13317 |
+ } else { |
13318 |
+ struct async_poll *apoll = req->apoll; |
13319 |
+ |
13320 |
+- io_poll_remove_double(req, apoll->double_poll); |
13321 |
+- |
13322 |
+ /* non-poll requests have submit ref still */ |
13323 |
+ do_complete = __io_poll_remove_one(req, &apoll->poll); |
13324 |
+ if (do_complete) { |
13325 |
+@@ -4536,6 +4586,7 @@ static bool io_poll_remove_one(struct io_kiocb *req) |
13326 |
+ io_cqring_fill_event(req, -ECANCELED); |
13327 |
+ io_commit_cqring(req->ctx); |
13328 |
+ req->flags |= REQ_F_COMP_LOCKED; |
13329 |
++ req_set_fail_links(req); |
13330 |
+ io_put_req(req); |
13331 |
+ } |
13332 |
+ |
13333 |
+@@ -4709,6 +4760,23 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) |
13334 |
+ return HRTIMER_NORESTART; |
13335 |
+ } |
13336 |
+ |
13337 |
++static int __io_timeout_cancel(struct io_kiocb *req) |
13338 |
++{ |
13339 |
++ int ret; |
13340 |
++ |
13341 |
++ list_del_init(&req->list); |
13342 |
++ |
13343 |
++ ret = hrtimer_try_to_cancel(&req->io->timeout.timer); |
13344 |
++ if (ret == -1) |
13345 |
++ return -EALREADY; |
13346 |
++ |
13347 |
++ req_set_fail_links(req); |
13348 |
++ req->flags |= REQ_F_COMP_LOCKED; |
13349 |
++ io_cqring_fill_event(req, -ECANCELED); |
13350 |
++ io_put_req(req); |
13351 |
++ return 0; |
13352 |
++} |
13353 |
++ |
13354 |
+ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) |
13355 |
+ { |
13356 |
+ struct io_kiocb *req; |
13357 |
+@@ -4716,7 +4784,6 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) |
13358 |
+ |
13359 |
+ list_for_each_entry(req, &ctx->timeout_list, list) { |
13360 |
+ if (user_data == req->user_data) { |
13361 |
+- list_del_init(&req->list); |
13362 |
+ ret = 0; |
13363 |
+ break; |
13364 |
+ } |
13365 |
+@@ -4725,14 +4792,7 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data) |
13366 |
+ if (ret == -ENOENT) |
13367 |
+ return ret; |
13368 |
+ |
13369 |
+- ret = hrtimer_try_to_cancel(&req->io->timeout.timer); |
13370 |
+- if (ret == -1) |
13371 |
+- return -EALREADY; |
13372 |
+- |
13373 |
+- req_set_fail_links(req); |
13374 |
+- io_cqring_fill_event(req, -ECANCELED); |
13375 |
+- io_put_req(req); |
13376 |
+- return 0; |
13377 |
++ return __io_timeout_cancel(req); |
13378 |
+ } |
13379 |
+ |
13380 |
+ static int io_timeout_remove_prep(struct io_kiocb *req, |
13381 |
+@@ -6082,8 +6142,7 @@ static int io_sq_thread(void *data) |
13382 |
+ if (!list_empty(&ctx->poll_list) || need_resched() || |
13383 |
+ (!time_after(jiffies, timeout) && ret != -EBUSY && |
13384 |
+ !percpu_ref_is_dying(&ctx->refs))) { |
13385 |
+- if (current->task_works) |
13386 |
+- task_work_run(); |
13387 |
++ io_run_task_work(); |
13388 |
+ cond_resched(); |
13389 |
+ continue; |
13390 |
+ } |
13391 |
+@@ -6115,8 +6174,7 @@ static int io_sq_thread(void *data) |
13392 |
+ finish_wait(&ctx->sqo_wait, &wait); |
13393 |
+ break; |
13394 |
+ } |
13395 |
+- if (current->task_works) { |
13396 |
+- task_work_run(); |
13397 |
++ if (io_run_task_work()) { |
13398 |
+ finish_wait(&ctx->sqo_wait, &wait); |
13399 |
+ continue; |
13400 |
+ } |
13401 |
+@@ -6145,8 +6203,7 @@ static int io_sq_thread(void *data) |
13402 |
+ timeout = jiffies + ctx->sq_thread_idle; |
13403 |
+ } |
13404 |
+ |
13405 |
+- if (current->task_works) |
13406 |
+- task_work_run(); |
13407 |
++ io_run_task_work(); |
13408 |
+ |
13409 |
+ io_sq_thread_drop_mm(ctx); |
13410 |
+ revert_creds(old_cred); |
13411 |
+@@ -6211,9 +6268,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, |
13412 |
+ do { |
13413 |
+ if (io_cqring_events(ctx, false) >= min_events) |
13414 |
+ return 0; |
13415 |
+- if (!current->task_works) |
13416 |
++ if (!io_run_task_work()) |
13417 |
+ break; |
13418 |
+- task_work_run(); |
13419 |
+ } while (1); |
13420 |
+ |
13421 |
+ if (sig) { |
13422 |
+@@ -6235,8 +6291,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, |
13423 |
+ prepare_to_wait_exclusive(&ctx->wait, &iowq.wq, |
13424 |
+ TASK_INTERRUPTIBLE); |
13425 |
+ /* make sure we run task_work before checking for signals */ |
13426 |
+- if (current->task_works) |
13427 |
+- task_work_run(); |
13428 |
++ if (io_run_task_work()) |
13429 |
++ continue; |
13430 |
+ if (signal_pending(current)) { |
13431 |
+ if (current->jobctl & JOBCTL_TASK_WORK) { |
13432 |
+ spin_lock_irq(¤t->sighand->siglock); |
13433 |
+@@ -7086,6 +7142,9 @@ static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries, |
13434 |
+ return SIZE_MAX; |
13435 |
+ #endif |
13436 |
+ |
13437 |
++ if (sq_offset) |
13438 |
++ *sq_offset = off; |
13439 |
++ |
13440 |
+ sq_array_size = array_size(sizeof(u32), sq_entries); |
13441 |
+ if (sq_array_size == SIZE_MAX) |
13442 |
+ return SIZE_MAX; |
13443 |
+@@ -7093,9 +7152,6 @@ static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries, |
13444 |
+ if (check_add_overflow(off, sq_array_size, &off)) |
13445 |
+ return SIZE_MAX; |
13446 |
+ |
13447 |
+- if (sq_offset) |
13448 |
+- *sq_offset = off; |
13449 |
+- |
13450 |
+ return off; |
13451 |
+ } |
13452 |
+ |
13453 |
+@@ -7488,6 +7544,71 @@ static bool io_wq_files_match(struct io_wq_work *work, void *data) |
13454 |
+ return work->files == files; |
13455 |
+ } |
13456 |
+ |
13457 |
++/* |
13458 |
++ * Returns true if 'preq' is the link parent of 'req' |
13459 |
++ */ |
13460 |
++static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req) |
13461 |
++{ |
13462 |
++ struct io_kiocb *link; |
13463 |
++ |
13464 |
++ if (!(preq->flags & REQ_F_LINK_HEAD)) |
13465 |
++ return false; |
13466 |
++ |
13467 |
++ list_for_each_entry(link, &preq->link_list, link_list) { |
13468 |
++ if (link == req) |
13469 |
++ return true; |
13470 |
++ } |
13471 |
++ |
13472 |
++ return false; |
13473 |
++} |
13474 |
++ |
13475 |
++/* |
13476 |
++ * We're looking to cancel 'req' because it's holding on to our files, but |
13477 |
++ * 'req' could be a link to another request. See if it is, and cancel that |
13478 |
++ * parent request if so. |
13479 |
++ */ |
13480 |
++static bool io_poll_remove_link(struct io_ring_ctx *ctx, struct io_kiocb *req) |
13481 |
++{ |
13482 |
++ struct hlist_node *tmp; |
13483 |
++ struct io_kiocb *preq; |
13484 |
++ bool found = false; |
13485 |
++ int i; |
13486 |
++ |
13487 |
++ spin_lock_irq(&ctx->completion_lock); |
13488 |
++ for (i = 0; i < (1U << ctx->cancel_hash_bits); i++) { |
13489 |
++ struct hlist_head *list; |
13490 |
++ |
13491 |
++ list = &ctx->cancel_hash[i]; |
13492 |
++ hlist_for_each_entry_safe(preq, tmp, list, hash_node) { |
13493 |
++ found = io_match_link(preq, req); |
13494 |
++ if (found) { |
13495 |
++ io_poll_remove_one(preq); |
13496 |
++ break; |
13497 |
++ } |
13498 |
++ } |
13499 |
++ } |
13500 |
++ spin_unlock_irq(&ctx->completion_lock); |
13501 |
++ return found; |
13502 |
++} |
13503 |
++ |
13504 |
++static bool io_timeout_remove_link(struct io_ring_ctx *ctx, |
13505 |
++ struct io_kiocb *req) |
13506 |
++{ |
13507 |
++ struct io_kiocb *preq; |
13508 |
++ bool found = false; |
13509 |
++ |
13510 |
++ spin_lock_irq(&ctx->completion_lock); |
13511 |
++ list_for_each_entry(preq, &ctx->timeout_list, list) { |
13512 |
++ found = io_match_link(preq, req); |
13513 |
++ if (found) { |
13514 |
++ __io_timeout_cancel(preq); |
13515 |
++ break; |
13516 |
++ } |
13517 |
++ } |
13518 |
++ spin_unlock_irq(&ctx->completion_lock); |
13519 |
++ return found; |
13520 |
++} |
13521 |
++ |
13522 |
+ static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
13523 |
+ struct files_struct *files) |
13524 |
+ { |
13525 |
+@@ -7529,10 +7650,10 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
13526 |
+ clear_bit(0, &ctx->cq_check_overflow); |
13527 |
+ ctx->rings->sq_flags &= ~IORING_SQ_CQ_OVERFLOW; |
13528 |
+ } |
13529 |
+- spin_unlock_irq(&ctx->completion_lock); |
13530 |
+- |
13531 |
+ WRITE_ONCE(ctx->rings->cq_overflow, |
13532 |
+ atomic_inc_return(&ctx->cached_cq_overflow)); |
13533 |
++ io_commit_cqring(ctx); |
13534 |
++ spin_unlock_irq(&ctx->completion_lock); |
13535 |
+ |
13536 |
+ /* |
13537 |
+ * Put inflight ref and overflow ref. If that's |
13538 |
+@@ -7545,6 +7666,9 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
13539 |
+ } |
13540 |
+ } else { |
13541 |
+ io_wq_cancel_work(ctx->io_wq, &cancel_req->work); |
13542 |
++ /* could be a link, check and remove if it is */ |
13543 |
++ if (!io_poll_remove_link(ctx, cancel_req)) |
13544 |
++ io_timeout_remove_link(ctx, cancel_req); |
13545 |
+ io_put_req(cancel_req); |
13546 |
+ } |
13547 |
+ |
13548 |
+@@ -7655,8 +7779,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, |
13549 |
+ int submitted = 0; |
13550 |
+ struct fd f; |
13551 |
+ |
13552 |
+- if (current->task_works) |
13553 |
+- task_work_run(); |
13554 |
++ io_run_task_work(); |
13555 |
+ |
13556 |
+ if (flags & ~(IORING_ENTER_GETEVENTS | IORING_ENTER_SQ_WAKEUP)) |
13557 |
+ return -EINVAL; |
13558 |
+@@ -7828,6 +7951,10 @@ static int io_allocate_scq_urings(struct io_ring_ctx *ctx, |
13559 |
+ struct io_rings *rings; |
13560 |
+ size_t size, sq_array_offset; |
13561 |
+ |
13562 |
++ /* make sure these are sane, as we already accounted them */ |
13563 |
++ ctx->sq_entries = p->sq_entries; |
13564 |
++ ctx->cq_entries = p->cq_entries; |
13565 |
++ |
13566 |
+ size = rings_size(p->sq_entries, p->cq_entries, &sq_array_offset); |
13567 |
+ if (size == SIZE_MAX) |
13568 |
+ return -EOVERFLOW; |
13569 |
+@@ -7844,8 +7971,6 @@ static int io_allocate_scq_urings(struct io_ring_ctx *ctx, |
13570 |
+ rings->cq_ring_entries = p->cq_entries; |
13571 |
+ ctx->sq_mask = rings->sq_ring_mask; |
13572 |
+ ctx->cq_mask = rings->cq_ring_mask; |
13573 |
+- ctx->sq_entries = rings->sq_ring_entries; |
13574 |
+- ctx->cq_entries = rings->cq_ring_entries; |
13575 |
+ |
13576 |
+ size = array_size(sizeof(struct io_uring_sqe), p->sq_entries); |
13577 |
+ if (size == SIZE_MAX) { |
13578 |
+diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c |
13579 |
+index 06b342d8462b..e23b3f62483c 100644 |
13580 |
+--- a/fs/kernfs/file.c |
13581 |
++++ b/fs/kernfs/file.c |
13582 |
+@@ -912,7 +912,7 @@ repeat: |
13583 |
+ } |
13584 |
+ |
13585 |
+ fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, |
13586 |
+- &name, 0); |
13587 |
++ NULL, 0); |
13588 |
+ iput(inode); |
13589 |
+ } |
13590 |
+ |
13591 |
+diff --git a/fs/minix/inode.c b/fs/minix/inode.c |
13592 |
+index 7cb5fd38eb14..0dd929346f3f 100644 |
13593 |
+--- a/fs/minix/inode.c |
13594 |
++++ b/fs/minix/inode.c |
13595 |
+@@ -150,6 +150,23 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) |
13596 |
+ return 0; |
13597 |
+ } |
13598 |
+ |
13599 |
++static bool minix_check_superblock(struct minix_sb_info *sbi) |
13600 |
++{ |
13601 |
++ if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
13602 |
++ return false; |
13603 |
++ |
13604 |
++ /* |
13605 |
++ * s_max_size must not exceed the block mapping limitation. This check |
13606 |
++ * is only needed for V1 filesystems, since V2/V3 support an extra level |
13607 |
++ * of indirect blocks which places the limit well above U32_MAX. |
13608 |
++ */ |
13609 |
++ if (sbi->s_version == MINIX_V1 && |
13610 |
++ sbi->s_max_size > (7 + 512 + 512*512) * BLOCK_SIZE) |
13611 |
++ return false; |
13612 |
++ |
13613 |
++ return true; |
13614 |
++} |
13615 |
++ |
13616 |
+ static int minix_fill_super(struct super_block *s, void *data, int silent) |
13617 |
+ { |
13618 |
+ struct buffer_head *bh; |
13619 |
+@@ -228,11 +245,12 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) |
13620 |
+ } else |
13621 |
+ goto out_no_fs; |
13622 |
+ |
13623 |
++ if (!minix_check_superblock(sbi)) |
13624 |
++ goto out_illegal_sb; |
13625 |
++ |
13626 |
+ /* |
13627 |
+ * Allocate the buffer map to keep the superblock small. |
13628 |
+ */ |
13629 |
+- if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) |
13630 |
+- goto out_illegal_sb; |
13631 |
+ i = (sbi->s_imap_blocks + sbi->s_zmap_blocks) * sizeof(bh); |
13632 |
+ map = kzalloc(i, GFP_KERNEL); |
13633 |
+ if (!map) |
13634 |
+@@ -468,6 +486,13 @@ static struct inode *V1_minix_iget(struct inode *inode) |
13635 |
+ iget_failed(inode); |
13636 |
+ return ERR_PTR(-EIO); |
13637 |
+ } |
13638 |
++ if (raw_inode->i_nlinks == 0) { |
13639 |
++ printk("MINIX-fs: deleted inode referenced: %lu\n", |
13640 |
++ inode->i_ino); |
13641 |
++ brelse(bh); |
13642 |
++ iget_failed(inode); |
13643 |
++ return ERR_PTR(-ESTALE); |
13644 |
++ } |
13645 |
+ inode->i_mode = raw_inode->i_mode; |
13646 |
+ i_uid_write(inode, raw_inode->i_uid); |
13647 |
+ i_gid_write(inode, raw_inode->i_gid); |
13648 |
+@@ -501,6 +526,13 @@ static struct inode *V2_minix_iget(struct inode *inode) |
13649 |
+ iget_failed(inode); |
13650 |
+ return ERR_PTR(-EIO); |
13651 |
+ } |
13652 |
++ if (raw_inode->i_nlinks == 0) { |
13653 |
++ printk("MINIX-fs: deleted inode referenced: %lu\n", |
13654 |
++ inode->i_ino); |
13655 |
++ brelse(bh); |
13656 |
++ iget_failed(inode); |
13657 |
++ return ERR_PTR(-ESTALE); |
13658 |
++ } |
13659 |
+ inode->i_mode = raw_inode->i_mode; |
13660 |
+ i_uid_write(inode, raw_inode->i_uid); |
13661 |
+ i_gid_write(inode, raw_inode->i_gid); |
13662 |
+diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c |
13663 |
+index 043c3fdbc8e7..446148792f41 100644 |
13664 |
+--- a/fs/minix/itree_common.c |
13665 |
++++ b/fs/minix/itree_common.c |
13666 |
+@@ -75,6 +75,7 @@ static int alloc_branch(struct inode *inode, |
13667 |
+ int n = 0; |
13668 |
+ int i; |
13669 |
+ int parent = minix_new_block(inode); |
13670 |
++ int err = -ENOSPC; |
13671 |
+ |
13672 |
+ branch[0].key = cpu_to_block(parent); |
13673 |
+ if (parent) for (n = 1; n < num; n++) { |
13674 |
+@@ -85,6 +86,11 @@ static int alloc_branch(struct inode *inode, |
13675 |
+ break; |
13676 |
+ branch[n].key = cpu_to_block(nr); |
13677 |
+ bh = sb_getblk(inode->i_sb, parent); |
13678 |
++ if (!bh) { |
13679 |
++ minix_free_block(inode, nr); |
13680 |
++ err = -ENOMEM; |
13681 |
++ break; |
13682 |
++ } |
13683 |
+ lock_buffer(bh); |
13684 |
+ memset(bh->b_data, 0, bh->b_size); |
13685 |
+ branch[n].bh = bh; |
13686 |
+@@ -103,7 +109,7 @@ static int alloc_branch(struct inode *inode, |
13687 |
+ bforget(branch[i].bh); |
13688 |
+ for (i = 0; i < n; i++) |
13689 |
+ minix_free_block(inode, block_to_cpu(branch[i].key)); |
13690 |
+- return -ENOSPC; |
13691 |
++ return err; |
13692 |
+ } |
13693 |
+ |
13694 |
+ static inline int splice_branch(struct inode *inode, |
13695 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
13696 |
+index dd2e14f5875d..d61dac48dff5 100644 |
13697 |
+--- a/fs/nfs/pnfs.c |
13698 |
++++ b/fs/nfs/pnfs.c |
13699 |
+@@ -1226,31 +1226,27 @@ out: |
13700 |
+ return status; |
13701 |
+ } |
13702 |
+ |
13703 |
++static bool |
13704 |
++pnfs_layout_segments_returnable(struct pnfs_layout_hdr *lo, |
13705 |
++ enum pnfs_iomode iomode, |
13706 |
++ u32 seq) |
13707 |
++{ |
13708 |
++ struct pnfs_layout_range recall_range = { |
13709 |
++ .length = NFS4_MAX_UINT64, |
13710 |
++ .iomode = iomode, |
13711 |
++ }; |
13712 |
++ return pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs, |
13713 |
++ &recall_range, seq) != -EBUSY; |
13714 |
++} |
13715 |
++ |
13716 |
+ /* Return true if layoutreturn is needed */ |
13717 |
+ static bool |
13718 |
+ pnfs_layout_need_return(struct pnfs_layout_hdr *lo) |
13719 |
+ { |
13720 |
+- struct pnfs_layout_segment *s; |
13721 |
+- enum pnfs_iomode iomode; |
13722 |
+- u32 seq; |
13723 |
+- |
13724 |
+ if (!test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) |
13725 |
+ return false; |
13726 |
+- |
13727 |
+- seq = lo->plh_return_seq; |
13728 |
+- iomode = lo->plh_return_iomode; |
13729 |
+- |
13730 |
+- /* Defer layoutreturn until all recalled lsegs are done */ |
13731 |
+- list_for_each_entry(s, &lo->plh_segs, pls_list) { |
13732 |
+- if (seq && pnfs_seqid_is_newer(s->pls_seq, seq)) |
13733 |
+- continue; |
13734 |
+- if (iomode != IOMODE_ANY && s->pls_range.iomode != iomode) |
13735 |
+- continue; |
13736 |
+- if (test_bit(NFS_LSEG_LAYOUTRETURN, &s->pls_flags)) |
13737 |
+- return false; |
13738 |
+- } |
13739 |
+- |
13740 |
+- return true; |
13741 |
++ return pnfs_layout_segments_returnable(lo, lo->plh_return_iomode, |
13742 |
++ lo->plh_return_seq); |
13743 |
+ } |
13744 |
+ |
13745 |
+ static void pnfs_layoutreturn_before_put_layout_hdr(struct pnfs_layout_hdr *lo) |
13746 |
+@@ -2392,16 +2388,6 @@ out_forget: |
13747 |
+ return ERR_PTR(-EAGAIN); |
13748 |
+ } |
13749 |
+ |
13750 |
+-static int |
13751 |
+-mark_lseg_invalid_or_return(struct pnfs_layout_segment *lseg, |
13752 |
+- struct list_head *tmp_list) |
13753 |
+-{ |
13754 |
+- if (!mark_lseg_invalid(lseg, tmp_list)) |
13755 |
+- return 0; |
13756 |
+- pnfs_cache_lseg_for_layoutreturn(lseg->pls_layout, lseg); |
13757 |
+- return 1; |
13758 |
+-} |
13759 |
+- |
13760 |
+ /** |
13761 |
+ * pnfs_mark_matching_lsegs_return - Free or return matching layout segments |
13762 |
+ * @lo: pointer to layout header |
13763 |
+@@ -2438,7 +2424,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, |
13764 |
+ lseg, lseg->pls_range.iomode, |
13765 |
+ lseg->pls_range.offset, |
13766 |
+ lseg->pls_range.length); |
13767 |
+- if (mark_lseg_invalid_or_return(lseg, tmp_list)) |
13768 |
++ if (mark_lseg_invalid(lseg, tmp_list)) |
13769 |
+ continue; |
13770 |
+ remaining++; |
13771 |
+ set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags); |
13772 |
+diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c |
13773 |
+index 9e40dfecf1b1..186fa2c2c6ba 100644 |
13774 |
+--- a/fs/nfsd/nfs4recover.c |
13775 |
++++ b/fs/nfsd/nfs4recover.c |
13776 |
+@@ -747,13 +747,11 @@ struct cld_upcall { |
13777 |
+ }; |
13778 |
+ |
13779 |
+ static int |
13780 |
+-__cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg) |
13781 |
++__cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn) |
13782 |
+ { |
13783 |
+ int ret; |
13784 |
+ struct rpc_pipe_msg msg; |
13785 |
+ struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_u); |
13786 |
+- struct nfsd_net *nn = net_generic(pipe->dentry->d_sb->s_fs_info, |
13787 |
+- nfsd_net_id); |
13788 |
+ |
13789 |
+ memset(&msg, 0, sizeof(msg)); |
13790 |
+ msg.data = cmsg; |
13791 |
+@@ -773,7 +771,7 @@ out: |
13792 |
+ } |
13793 |
+ |
13794 |
+ static int |
13795 |
+-cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg) |
13796 |
++cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn) |
13797 |
+ { |
13798 |
+ int ret; |
13799 |
+ |
13800 |
+@@ -782,7 +780,7 @@ cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg) |
13801 |
+ * upcalls queued. |
13802 |
+ */ |
13803 |
+ do { |
13804 |
+- ret = __cld_pipe_upcall(pipe, cmsg); |
13805 |
++ ret = __cld_pipe_upcall(pipe, cmsg, nn); |
13806 |
+ } while (ret == -EAGAIN); |
13807 |
+ |
13808 |
+ return ret; |
13809 |
+@@ -1115,7 +1113,7 @@ nfsd4_cld_create(struct nfs4_client *clp) |
13810 |
+ memcpy(cup->cu_u.cu_msg.cm_u.cm_name.cn_id, clp->cl_name.data, |
13811 |
+ clp->cl_name.len); |
13812 |
+ |
13813 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13814 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13815 |
+ if (!ret) { |
13816 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13817 |
+ set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
13818 |
+@@ -1180,7 +1178,7 @@ nfsd4_cld_create_v2(struct nfs4_client *clp) |
13819 |
+ } else |
13820 |
+ cmsg->cm_u.cm_clntinfo.cc_princhash.cp_len = 0; |
13821 |
+ |
13822 |
+- ret = cld_pipe_upcall(cn->cn_pipe, cmsg); |
13823 |
++ ret = cld_pipe_upcall(cn->cn_pipe, cmsg, nn); |
13824 |
+ if (!ret) { |
13825 |
+ ret = cmsg->cm_status; |
13826 |
+ set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
13827 |
+@@ -1218,7 +1216,7 @@ nfsd4_cld_remove(struct nfs4_client *clp) |
13828 |
+ memcpy(cup->cu_u.cu_msg.cm_u.cm_name.cn_id, clp->cl_name.data, |
13829 |
+ clp->cl_name.len); |
13830 |
+ |
13831 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13832 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13833 |
+ if (!ret) { |
13834 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13835 |
+ clear_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
13836 |
+@@ -1261,7 +1259,7 @@ nfsd4_cld_check_v0(struct nfs4_client *clp) |
13837 |
+ memcpy(cup->cu_u.cu_msg.cm_u.cm_name.cn_id, clp->cl_name.data, |
13838 |
+ clp->cl_name.len); |
13839 |
+ |
13840 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13841 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13842 |
+ if (!ret) { |
13843 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13844 |
+ set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); |
13845 |
+@@ -1404,7 +1402,7 @@ nfsd4_cld_grace_start(struct nfsd_net *nn) |
13846 |
+ } |
13847 |
+ |
13848 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GraceStart; |
13849 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13850 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13851 |
+ if (!ret) |
13852 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13853 |
+ |
13854 |
+@@ -1432,7 +1430,7 @@ nfsd4_cld_grace_done_v0(struct nfsd_net *nn) |
13855 |
+ |
13856 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GraceDone; |
13857 |
+ cup->cu_u.cu_msg.cm_u.cm_gracetime = nn->boot_time; |
13858 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13859 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13860 |
+ if (!ret) |
13861 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13862 |
+ |
13863 |
+@@ -1460,7 +1458,7 @@ nfsd4_cld_grace_done(struct nfsd_net *nn) |
13864 |
+ } |
13865 |
+ |
13866 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GraceDone; |
13867 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13868 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13869 |
+ if (!ret) |
13870 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13871 |
+ |
13872 |
+@@ -1524,7 +1522,7 @@ nfsd4_cld_get_version(struct nfsd_net *nn) |
13873 |
+ goto out_err; |
13874 |
+ } |
13875 |
+ cup->cu_u.cu_msg.cm_cmd = Cld_GetVersion; |
13876 |
+- ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); |
13877 |
++ ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg, nn); |
13878 |
+ if (!ret) { |
13879 |
+ ret = cup->cu_u.cu_msg.cm_status; |
13880 |
+ if (ret) |
13881 |
+diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c |
13882 |
+index 751bc4dc7466..8e3a369086db 100644 |
13883 |
+--- a/fs/ocfs2/dlmglue.c |
13884 |
++++ b/fs/ocfs2/dlmglue.c |
13885 |
+@@ -2871,9 +2871,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex) |
13886 |
+ |
13887 |
+ status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE, |
13888 |
+ 0, 0); |
13889 |
+- if (status < 0) |
13890 |
++ if (status < 0) { |
13891 |
+ mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status); |
13892 |
+ |
13893 |
++ if (ex) |
13894 |
++ up_write(&osb->nfs_sync_rwlock); |
13895 |
++ else |
13896 |
++ up_read(&osb->nfs_sync_rwlock); |
13897 |
++ } |
13898 |
++ |
13899 |
+ return status; |
13900 |
+ } |
13901 |
+ |
13902 |
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c |
13903 |
+index a9e297eefdff..36714df37d5d 100644 |
13904 |
+--- a/fs/pstore/platform.c |
13905 |
++++ b/fs/pstore/platform.c |
13906 |
+@@ -269,6 +269,9 @@ static int pstore_compress(const void *in, void *out, |
13907 |
+ { |
13908 |
+ int ret; |
13909 |
+ |
13910 |
++ if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION)) |
13911 |
++ return -EINVAL; |
13912 |
++ |
13913 |
+ ret = crypto_comp_compress(tfm, in, inlen, out, &outlen); |
13914 |
+ if (ret) { |
13915 |
+ pr_err("crypto_comp_compress failed, ret = %d!\n", ret); |
13916 |
+@@ -668,7 +671,7 @@ static void decompress_record(struct pstore_record *record) |
13917 |
+ int unzipped_len; |
13918 |
+ char *unzipped, *workspace; |
13919 |
+ |
13920 |
+- if (!record->compressed) |
13921 |
++ if (!IS_ENABLED(CONFIG_PSTORE_COMPRESSION) || !record->compressed) |
13922 |
+ return; |
13923 |
+ |
13924 |
+ /* Only PSTORE_TYPE_DMESG support compression. */ |
13925 |
+diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h |
13926 |
+index c45acbd3add9..708feb8eac76 100644 |
13927 |
+--- a/fs/xfs/libxfs/xfs_shared.h |
13928 |
++++ b/fs/xfs/libxfs/xfs_shared.h |
13929 |
+@@ -65,6 +65,7 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp, |
13930 |
+ #define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */ |
13931 |
+ #define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ |
13932 |
+ #define XFS_TRANS_NO_WRITECOUNT 0x40 /* do not elevate SB writecount */ |
13933 |
++#define XFS_TRANS_RES_FDBLKS 0x80 /* reserve newly freed blocks */ |
13934 |
+ /* |
13935 |
+ * LOWMODE is used by the allocator to activate the lowspace algorithm - when |
13936 |
+ * free space is running low the extent allocator may choose to allocate an |
13937 |
+diff --git a/fs/xfs/libxfs/xfs_trans_space.h b/fs/xfs/libxfs/xfs_trans_space.h |
13938 |
+index 88221c7a04cc..c6df01a2a158 100644 |
13939 |
+--- a/fs/xfs/libxfs/xfs_trans_space.h |
13940 |
++++ b/fs/xfs/libxfs/xfs_trans_space.h |
13941 |
+@@ -57,7 +57,7 @@ |
13942 |
+ XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK) |
13943 |
+ #define XFS_IALLOC_SPACE_RES(mp) \ |
13944 |
+ (M_IGEO(mp)->ialloc_blks + \ |
13945 |
+- (xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1 * \ |
13946 |
++ ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ |
13947 |
+ (M_IGEO(mp)->inobt_maxlevels - 1))) |
13948 |
+ |
13949 |
+ /* |
13950 |
+diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c |
13951 |
+index 7badd6dfe544..955302e7cdde 100644 |
13952 |
+--- a/fs/xfs/scrub/bmap.c |
13953 |
++++ b/fs/xfs/scrub/bmap.c |
13954 |
+@@ -45,9 +45,27 @@ xchk_setup_inode_bmap( |
13955 |
+ */ |
13956 |
+ if (S_ISREG(VFS_I(sc->ip)->i_mode) && |
13957 |
+ sc->sm->sm_type == XFS_SCRUB_TYPE_BMBTD) { |
13958 |
++ struct address_space *mapping = VFS_I(sc->ip)->i_mapping; |
13959 |
++ |
13960 |
+ inode_dio_wait(VFS_I(sc->ip)); |
13961 |
+- error = filemap_write_and_wait(VFS_I(sc->ip)->i_mapping); |
13962 |
+- if (error) |
13963 |
++ |
13964 |
++ /* |
13965 |
++ * Try to flush all incore state to disk before we examine the |
13966 |
++ * space mappings for the data fork. Leave accumulated errors |
13967 |
++ * in the mapping for the writer threads to consume. |
13968 |
++ * |
13969 |
++ * On ENOSPC or EIO writeback errors, we continue into the |
13970 |
++ * extent mapping checks because write failures do not |
13971 |
++ * necessarily imply anything about the correctness of the file |
13972 |
++ * metadata. The metadata and the file data could be on |
13973 |
++ * completely separate devices; a media failure might only |
13974 |
++ * affect a subset of the disk, etc. We can handle delalloc |
13975 |
++ * extents in the scrubber, so leaving them in memory is fine. |
13976 |
++ */ |
13977 |
++ error = filemap_fdatawrite(mapping); |
13978 |
++ if (!error) |
13979 |
++ error = filemap_fdatawait_keep_errors(mapping); |
13980 |
++ if (error && (error != -ENOSPC && error != -EIO)) |
13981 |
+ goto out; |
13982 |
+ } |
13983 |
+ |
13984 |
+diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c |
13985 |
+index f37f5cc4b19f..afdc7f8e0e70 100644 |
13986 |
+--- a/fs/xfs/xfs_bmap_util.c |
13987 |
++++ b/fs/xfs/xfs_bmap_util.c |
13988 |
+@@ -1567,6 +1567,7 @@ xfs_swap_extents( |
13989 |
+ int lock_flags; |
13990 |
+ uint64_t f; |
13991 |
+ int resblks = 0; |
13992 |
++ unsigned int flags = 0; |
13993 |
+ |
13994 |
+ /* |
13995 |
+ * Lock the inodes against other IO, page faults and truncate to |
13996 |
+@@ -1630,17 +1631,16 @@ xfs_swap_extents( |
13997 |
+ resblks += XFS_SWAP_RMAP_SPACE_RES(mp, tipnext, w); |
13998 |
+ |
13999 |
+ /* |
14000 |
+- * Handle the corner case where either inode might straddle the |
14001 |
+- * btree format boundary. If so, the inode could bounce between |
14002 |
+- * btree <-> extent format on unmap -> remap cycles, freeing and |
14003 |
+- * allocating a bmapbt block each time. |
14004 |
++ * If either inode straddles a bmapbt block allocation boundary, |
14005 |
++ * the rmapbt algorithm triggers repeated allocs and frees as |
14006 |
++ * extents are remapped. This can exhaust the block reservation |
14007 |
++ * prematurely and cause shutdown. Return freed blocks to the |
14008 |
++ * transaction reservation to counter this behavior. |
14009 |
+ */ |
14010 |
+- if (ipnext == (XFS_IFORK_MAXEXT(ip, w) + 1)) |
14011 |
+- resblks += XFS_IFORK_MAXEXT(ip, w); |
14012 |
+- if (tipnext == (XFS_IFORK_MAXEXT(tip, w) + 1)) |
14013 |
+- resblks += XFS_IFORK_MAXEXT(tip, w); |
14014 |
++ flags |= XFS_TRANS_RES_FDBLKS; |
14015 |
+ } |
14016 |
+- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp); |
14017 |
++ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, flags, |
14018 |
++ &tp); |
14019 |
+ if (error) |
14020 |
+ goto out_unlock; |
14021 |
+ |
14022 |
+diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c |
14023 |
+index d6cd83317344..938023dd8ce5 100644 |
14024 |
+--- a/fs/xfs/xfs_qm.c |
14025 |
++++ b/fs/xfs/xfs_qm.c |
14026 |
+@@ -148,6 +148,7 @@ xfs_qm_dqpurge( |
14027 |
+ error = xfs_bwrite(bp); |
14028 |
+ xfs_buf_relse(bp); |
14029 |
+ } else if (error == -EAGAIN) { |
14030 |
++ dqp->dq_flags &= ~XFS_DQ_FREEING; |
14031 |
+ goto out_unlock; |
14032 |
+ } |
14033 |
+ xfs_dqflock(dqp); |
14034 |
+diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c |
14035 |
+index 107bf2a2f344..d89201d40891 100644 |
14036 |
+--- a/fs/xfs/xfs_reflink.c |
14037 |
++++ b/fs/xfs/xfs_reflink.c |
14038 |
+@@ -1003,6 +1003,7 @@ xfs_reflink_remap_extent( |
14039 |
+ xfs_filblks_t rlen; |
14040 |
+ xfs_filblks_t unmap_len; |
14041 |
+ xfs_off_t newlen; |
14042 |
++ int64_t qres; |
14043 |
+ int error; |
14044 |
+ |
14045 |
+ unmap_len = irec->br_startoff + irec->br_blockcount - destoff; |
14046 |
+@@ -1025,13 +1026,19 @@ xfs_reflink_remap_extent( |
14047 |
+ xfs_ilock(ip, XFS_ILOCK_EXCL); |
14048 |
+ xfs_trans_ijoin(tp, ip, 0); |
14049 |
+ |
14050 |
+- /* If we're not just clearing space, then do we have enough quota? */ |
14051 |
+- if (real_extent) { |
14052 |
+- error = xfs_trans_reserve_quota_nblks(tp, ip, |
14053 |
+- irec->br_blockcount, 0, XFS_QMOPT_RES_REGBLKS); |
14054 |
+- if (error) |
14055 |
+- goto out_cancel; |
14056 |
+- } |
14057 |
++ /* |
14058 |
++ * Reserve quota for this operation. We don't know if the first unmap |
14059 |
++ * in the dest file will cause a bmap btree split, so we always reserve |
14060 |
++ * at least enough blocks for that split. If the extent being mapped |
14061 |
++ * in is written, we need to reserve quota for that too. |
14062 |
++ */ |
14063 |
++ qres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK); |
14064 |
++ if (real_extent) |
14065 |
++ qres += irec->br_blockcount; |
14066 |
++ error = xfs_trans_reserve_quota_nblks(tp, ip, qres, 0, |
14067 |
++ XFS_QMOPT_RES_REGBLKS); |
14068 |
++ if (error) |
14069 |
++ goto out_cancel; |
14070 |
+ |
14071 |
+ trace_xfs_reflink_remap(ip, irec->br_startoff, |
14072 |
+ irec->br_blockcount, irec->br_startblock); |
14073 |
+diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c |
14074 |
+index 3c94e5ff4316..0ad72a83edac 100644 |
14075 |
+--- a/fs/xfs/xfs_trans.c |
14076 |
++++ b/fs/xfs/xfs_trans.c |
14077 |
+@@ -107,7 +107,8 @@ xfs_trans_dup( |
14078 |
+ |
14079 |
+ ntp->t_flags = XFS_TRANS_PERM_LOG_RES | |
14080 |
+ (tp->t_flags & XFS_TRANS_RESERVE) | |
14081 |
+- (tp->t_flags & XFS_TRANS_NO_WRITECOUNT); |
14082 |
++ (tp->t_flags & XFS_TRANS_NO_WRITECOUNT) | |
14083 |
++ (tp->t_flags & XFS_TRANS_RES_FDBLKS); |
14084 |
+ /* We gave our writer reference to the new transaction */ |
14085 |
+ tp->t_flags |= XFS_TRANS_NO_WRITECOUNT; |
14086 |
+ ntp->t_ticket = xfs_log_ticket_get(tp->t_ticket); |
14087 |
+@@ -272,6 +273,8 @@ xfs_trans_alloc( |
14088 |
+ */ |
14089 |
+ WARN_ON(resp->tr_logres > 0 && |
14090 |
+ mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE); |
14091 |
++ ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) || |
14092 |
++ xfs_sb_version_haslazysbcount(&mp->m_sb)); |
14093 |
+ |
14094 |
+ tp->t_magic = XFS_TRANS_HEADER_MAGIC; |
14095 |
+ tp->t_flags = flags; |
14096 |
+@@ -365,6 +368,20 @@ xfs_trans_mod_sb( |
14097 |
+ tp->t_blk_res_used += (uint)-delta; |
14098 |
+ if (tp->t_blk_res_used > tp->t_blk_res) |
14099 |
+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); |
14100 |
++ } else if (delta > 0 && (tp->t_flags & XFS_TRANS_RES_FDBLKS)) { |
14101 |
++ int64_t blkres_delta; |
14102 |
++ |
14103 |
++ /* |
14104 |
++ * Return freed blocks directly to the reservation |
14105 |
++ * instead of the global pool, being careful not to |
14106 |
++ * overflow the trans counter. This is used to preserve |
14107 |
++ * reservation across chains of transaction rolls that |
14108 |
++ * repeatedly free and allocate blocks. |
14109 |
++ */ |
14110 |
++ blkres_delta = min_t(int64_t, delta, |
14111 |
++ UINT_MAX - tp->t_blk_res); |
14112 |
++ tp->t_blk_res += blkres_delta; |
14113 |
++ delta -= blkres_delta; |
14114 |
+ } |
14115 |
+ tp->t_fdblocks_delta += delta; |
14116 |
+ if (xfs_sb_version_haslazysbcount(&mp->m_sb)) |
14117 |
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h |
14118 |
+index 052e0f05a984..9e9b1ec30b90 100644 |
14119 |
+--- a/include/asm-generic/vmlinux.lds.h |
14120 |
++++ b/include/asm-generic/vmlinux.lds.h |
14121 |
+@@ -375,6 +375,7 @@ |
14122 |
+ */ |
14123 |
+ #ifndef RO_AFTER_INIT_DATA |
14124 |
+ #define RO_AFTER_INIT_DATA \ |
14125 |
++ . = ALIGN(8); \ |
14126 |
+ __start_ro_after_init = .; \ |
14127 |
+ *(.data..ro_after_init) \ |
14128 |
+ JUMP_TABLE_DATA \ |
14129 |
+diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h |
14130 |
+index 48ea093ff04c..4e035aca6f7e 100644 |
14131 |
+--- a/include/linux/bitfield.h |
14132 |
++++ b/include/linux/bitfield.h |
14133 |
+@@ -77,7 +77,7 @@ |
14134 |
+ */ |
14135 |
+ #define FIELD_FIT(_mask, _val) \ |
14136 |
+ ({ \ |
14137 |
+- __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_FIT: "); \ |
14138 |
++ __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_FIT: "); \ |
14139 |
+ !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \ |
14140 |
+ }) |
14141 |
+ |
14142 |
+diff --git a/include/linux/dmar.h b/include/linux/dmar.h |
14143 |
+index d7bf029df737..65565820328a 100644 |
14144 |
+--- a/include/linux/dmar.h |
14145 |
++++ b/include/linux/dmar.h |
14146 |
+@@ -48,6 +48,7 @@ struct dmar_drhd_unit { |
14147 |
+ u16 segment; /* PCI domain */ |
14148 |
+ u8 ignored:1; /* ignore drhd */ |
14149 |
+ u8 include_all:1; |
14150 |
++ u8 gfx_dedicated:1; /* graphic dedicated */ |
14151 |
+ struct intel_iommu *iommu; |
14152 |
+ }; |
14153 |
+ |
14154 |
+diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h |
14155 |
+index c4f272af7af5..e6217d8e2e9f 100644 |
14156 |
+--- a/include/linux/gpio/driver.h |
14157 |
++++ b/include/linux/gpio/driver.h |
14158 |
+@@ -509,8 +509,16 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, |
14159 |
+ gpiochip_add_data_with_key(gc, data, &lock_key, \ |
14160 |
+ &request_key); \ |
14161 |
+ }) |
14162 |
++#define devm_gpiochip_add_data(dev, gc, data) ({ \ |
14163 |
++ static struct lock_class_key lock_key; \ |
14164 |
++ static struct lock_class_key request_key; \ |
14165 |
++ devm_gpiochip_add_data_with_key(dev, gc, data, &lock_key, \ |
14166 |
++ &request_key); \ |
14167 |
++ }) |
14168 |
+ #else |
14169 |
+ #define gpiochip_add_data(gc, data) gpiochip_add_data_with_key(gc, data, NULL, NULL) |
14170 |
++#define devm_gpiochip_add_data(dev, gc, data) \ |
14171 |
++ devm_gpiochip_add_data_with_key(dev, gc, data, NULL, NULL) |
14172 |
+ #endif /* CONFIG_LOCKDEP */ |
14173 |
+ |
14174 |
+ static inline int gpiochip_add(struct gpio_chip *gc) |
14175 |
+@@ -518,8 +526,9 @@ static inline int gpiochip_add(struct gpio_chip *gc) |
14176 |
+ return gpiochip_add_data(gc, NULL); |
14177 |
+ } |
14178 |
+ extern void gpiochip_remove(struct gpio_chip *gc); |
14179 |
+-extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, |
14180 |
+- void *data); |
14181 |
++extern int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc, void *data, |
14182 |
++ struct lock_class_key *lock_key, |
14183 |
++ struct lock_class_key *request_key); |
14184 |
+ |
14185 |
+ extern struct gpio_chip *gpiochip_find(void *data, |
14186 |
+ int (*match)(struct gpio_chip *gc, void *data)); |
14187 |
+diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h |
14188 |
+index 4c1e6b34e824..ad76f3d0a6ba 100644 |
14189 |
+--- a/include/linux/gpio/regmap.h |
14190 |
++++ b/include/linux/gpio/regmap.h |
14191 |
+@@ -8,7 +8,7 @@ struct gpio_regmap; |
14192 |
+ struct irq_domain; |
14193 |
+ struct regmap; |
14194 |
+ |
14195 |
+-#define GPIO_REGMAP_ADDR_ZERO ((unsigned long)(-1)) |
14196 |
++#define GPIO_REGMAP_ADDR_ZERO ((unsigned int)(-1)) |
14197 |
+ #define GPIO_REGMAP_ADDR(addr) ((addr) ? : GPIO_REGMAP_ADDR_ZERO) |
14198 |
+ |
14199 |
+ /** |
14200 |
+diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h |
14201 |
+index 3e8fa1c7a1e6..04bd9279c3fb 100644 |
14202 |
+--- a/include/linux/intel-iommu.h |
14203 |
++++ b/include/linux/intel-iommu.h |
14204 |
+@@ -600,6 +600,8 @@ struct intel_iommu { |
14205 |
+ struct iommu_device iommu; /* IOMMU core code handle */ |
14206 |
+ int node; |
14207 |
+ u32 flags; /* Software defined flags */ |
14208 |
++ |
14209 |
++ struct dmar_drhd_unit *drhd; |
14210 |
+ }; |
14211 |
+ |
14212 |
+ /* PCI domain-device relationship */ |
14213 |
+diff --git a/include/linux/tpm.h b/include/linux/tpm.h |
14214 |
+index 03e9b184411b..8f4ff39f51e7 100644 |
14215 |
+--- a/include/linux/tpm.h |
14216 |
++++ b/include/linux/tpm.h |
14217 |
+@@ -96,6 +96,7 @@ struct tpm_space { |
14218 |
+ u8 *context_buf; |
14219 |
+ u32 session_tbl[3]; |
14220 |
+ u8 *session_buf; |
14221 |
++ u32 buf_size; |
14222 |
+ }; |
14223 |
+ |
14224 |
+ struct tpm_bios_log { |
14225 |
+diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h |
14226 |
+index 64356b199e94..739ba9a03ec1 100644 |
14227 |
+--- a/include/linux/tpm_eventlog.h |
14228 |
++++ b/include/linux/tpm_eventlog.h |
14229 |
+@@ -211,9 +211,16 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, |
14230 |
+ |
14231 |
+ efispecid = (struct tcg_efi_specid_event_head *)event_header->event; |
14232 |
+ |
14233 |
+- /* Check if event is malformed. */ |
14234 |
++ /* |
14235 |
++ * Perform validation of the event in order to identify malformed |
14236 |
++ * events. This function may be asked to parse arbitrary byte sequences |
14237 |
++ * immediately following a valid event log. The caller expects this |
14238 |
++ * function to recognize that the byte sequence is not a valid event |
14239 |
++ * and to return an event size of 0. |
14240 |
++ */ |
14241 |
+ if (memcmp(efispecid->signature, TCG_SPECID_SIG, |
14242 |
+- sizeof(TCG_SPECID_SIG)) || count > efispecid->num_algs) { |
14243 |
++ sizeof(TCG_SPECID_SIG)) || |
14244 |
++ !efispecid->num_algs || count != efispecid->num_algs) { |
14245 |
+ size = 0; |
14246 |
+ goto out; |
14247 |
+ } |
14248 |
+diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h |
14249 |
+index a1fecf311621..3a5b717d92e8 100644 |
14250 |
+--- a/include/linux/tracepoint.h |
14251 |
++++ b/include/linux/tracepoint.h |
14252 |
+@@ -361,7 +361,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) |
14253 |
+ static const char *___tp_str __tracepoint_string = str; \ |
14254 |
+ ___tp_str; \ |
14255 |
+ }) |
14256 |
+-#define __tracepoint_string __attribute__((section("__tracepoint_str"))) |
14257 |
++#define __tracepoint_string __attribute__((section("__tracepoint_str"), used)) |
14258 |
+ #else |
14259 |
+ /* |
14260 |
+ * tracepoint_string() is used to save the string address for userspace |
14261 |
+diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h |
14262 |
+index 18190055374c..155019220c47 100644 |
14263 |
+--- a/include/net/bluetooth/bluetooth.h |
14264 |
++++ b/include/net/bluetooth/bluetooth.h |
14265 |
+@@ -41,6 +41,8 @@ |
14266 |
+ #define BLUETOOTH_VER_1_1 1 |
14267 |
+ #define BLUETOOTH_VER_1_2 2 |
14268 |
+ #define BLUETOOTH_VER_2_0 3 |
14269 |
++#define BLUETOOTH_VER_2_1 4 |
14270 |
++#define BLUETOOTH_VER_4_0 6 |
14271 |
+ |
14272 |
+ /* Reserv for core and drivers use */ |
14273 |
+ #define BT_SKB_RESERVE 8 |
14274 |
+diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
14275 |
+index 16ab6ce87883..1c321b6d1ed8 100644 |
14276 |
+--- a/include/net/bluetooth/hci.h |
14277 |
++++ b/include/net/bluetooth/hci.h |
14278 |
+@@ -227,6 +227,17 @@ enum { |
14279 |
+ * supported. |
14280 |
+ */ |
14281 |
+ HCI_QUIRK_VALID_LE_STATES, |
14282 |
++ |
14283 |
++ /* When this quirk is set, then erroneous data reporting |
14284 |
++ * is ignored. This is mainly due to the fact that the HCI |
14285 |
++ * Read Default Erroneous Data Reporting command is advertised, |
14286 |
++ * but not supported; these controllers often reply with unknown |
14287 |
++ * command and tend to lock up randomly. Needing a hard reset. |
14288 |
++ * |
14289 |
++ * This quirk can be set before hci_register_dev is called or |
14290 |
++ * during the hdev->setup vendor callback. |
14291 |
++ */ |
14292 |
++ HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, |
14293 |
+ }; |
14294 |
+ |
14295 |
+ /* HCI device flags */ |
14296 |
+diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h |
14297 |
+index cdd4f1db8670..da3728871e85 100644 |
14298 |
+--- a/include/net/bluetooth/hci_core.h |
14299 |
++++ b/include/net/bluetooth/hci_core.h |
14300 |
+@@ -1387,7 +1387,7 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status) |
14301 |
+ __u8 encrypt; |
14302 |
+ |
14303 |
+ if (conn->state == BT_CONFIG) { |
14304 |
+- if (status) |
14305 |
++ if (!status) |
14306 |
+ conn->state = BT_CONNECTED; |
14307 |
+ |
14308 |
+ hci_connect_cfm(conn, status); |
14309 |
+diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h |
14310 |
+index e5b388f5fa20..1d59bf55bb4d 100644 |
14311 |
+--- a/include/net/inet_connection_sock.h |
14312 |
++++ b/include/net/inet_connection_sock.h |
14313 |
+@@ -316,6 +316,10 @@ int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, |
14314 |
+ int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, |
14315 |
+ char __user *optval, unsigned int optlen); |
14316 |
+ |
14317 |
++/* update the fast reuse flag when adding a socket */ |
14318 |
++void inet_csk_update_fastreuse(struct inet_bind_bucket *tb, |
14319 |
++ struct sock *sk); |
14320 |
++ |
14321 |
+ struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu); |
14322 |
+ |
14323 |
+ #define TCP_PINGPONG_THRESH 3 |
14324 |
+diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h |
14325 |
+index 83be2d93b407..fe96aa462d05 100644 |
14326 |
+--- a/include/net/ip_vs.h |
14327 |
++++ b/include/net/ip_vs.h |
14328 |
+@@ -1624,18 +1624,16 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) |
14329 |
+ } |
14330 |
+ #endif /* CONFIG_IP_VS_NFCT */ |
14331 |
+ |
14332 |
+-/* Really using conntrack? */ |
14333 |
+-static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp, |
14334 |
+- struct sk_buff *skb) |
14335 |
++/* Using old conntrack that can not be redirected to another real server? */ |
14336 |
++static inline bool ip_vs_conn_uses_old_conntrack(struct ip_vs_conn *cp, |
14337 |
++ struct sk_buff *skb) |
14338 |
+ { |
14339 |
+ #ifdef CONFIG_IP_VS_NFCT |
14340 |
+ enum ip_conntrack_info ctinfo; |
14341 |
+ struct nf_conn *ct; |
14342 |
+ |
14343 |
+- if (!(cp->flags & IP_VS_CONN_F_NFCT)) |
14344 |
+- return false; |
14345 |
+ ct = nf_ct_get(skb, &ctinfo); |
14346 |
+- if (ct) |
14347 |
++ if (ct && nf_ct_is_confirmed(ct)) |
14348 |
+ return true; |
14349 |
+ #endif |
14350 |
+ return false; |
14351 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
14352 |
+index 4de9485f73d9..0c1d2843a6d7 100644 |
14353 |
+--- a/include/net/tcp.h |
14354 |
++++ b/include/net/tcp.h |
14355 |
+@@ -1664,6 +1664,8 @@ void tcp_fastopen_destroy_cipher(struct sock *sk); |
14356 |
+ void tcp_fastopen_ctx_destroy(struct net *net); |
14357 |
+ int tcp_fastopen_reset_cipher(struct net *net, struct sock *sk, |
14358 |
+ void *primary_key, void *backup_key); |
14359 |
++int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *icsk, |
14360 |
++ u64 *key); |
14361 |
+ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb); |
14362 |
+ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, |
14363 |
+ struct request_sock *req, |
14364 |
+diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h |
14365 |
+index 8bd33050b7bb..a3fd55194e0b 100644 |
14366 |
+--- a/include/uapi/linux/bpf.h |
14367 |
++++ b/include/uapi/linux/bpf.h |
14368 |
+@@ -3168,7 +3168,7 @@ union bpf_attr { |
14369 |
+ * Return |
14370 |
+ * The id is returned or 0 in case the id could not be retrieved. |
14371 |
+ * |
14372 |
+- * int bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) |
14373 |
++ * long bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) |
14374 |
+ * Description |
14375 |
+ * Copy *size* bytes from *data* into a ring buffer *ringbuf*. |
14376 |
+ * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification |
14377 |
+diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h |
14378 |
+index c1735455bc53..965290f7dcc2 100644 |
14379 |
+--- a/include/uapi/linux/seccomp.h |
14380 |
++++ b/include/uapi/linux/seccomp.h |
14381 |
+@@ -123,5 +123,6 @@ struct seccomp_notif_resp { |
14382 |
+ #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) |
14383 |
+ #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ |
14384 |
+ struct seccomp_notif_resp) |
14385 |
+-#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) |
14386 |
++#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) |
14387 |
++ |
14388 |
+ #endif /* _UAPI_LINUX_SECCOMP_H */ |
14389 |
+diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h |
14390 |
+index a0b83c9d4498..bf7333b2b5d7 100644 |
14391 |
+--- a/include/uapi/rdma/qedr-abi.h |
14392 |
++++ b/include/uapi/rdma/qedr-abi.h |
14393 |
+@@ -39,8 +39,9 @@ |
14394 |
+ |
14395 |
+ /* user kernel communication data structures. */ |
14396 |
+ enum qedr_alloc_ucontext_flags { |
14397 |
+- QEDR_ALLOC_UCTX_RESERVED = 1 << 0, |
14398 |
+- QEDR_ALLOC_UCTX_DB_REC = 1 << 1 |
14399 |
++ QEDR_ALLOC_UCTX_EDPM_MODE = 1 << 0, |
14400 |
++ QEDR_ALLOC_UCTX_DB_REC = 1 << 1, |
14401 |
++ QEDR_SUPPORT_DPM_SIZES = 1 << 2, |
14402 |
+ }; |
14403 |
+ |
14404 |
+ struct qedr_alloc_ucontext_req { |
14405 |
+@@ -50,13 +51,14 @@ struct qedr_alloc_ucontext_req { |
14406 |
+ |
14407 |
+ #define QEDR_LDPM_MAX_SIZE (8192) |
14408 |
+ #define QEDR_EDPM_TRANS_SIZE (64) |
14409 |
++#define QEDR_EDPM_MAX_SIZE (ROCE_REQ_MAX_INLINE_DATA_SIZE) |
14410 |
+ |
14411 |
+ enum qedr_rdma_dpm_type { |
14412 |
+ QEDR_DPM_TYPE_NONE = 0, |
14413 |
+ QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0, |
14414 |
+ QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1, |
14415 |
+ QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2, |
14416 |
+- QEDR_DPM_TYPE_RESERVED = 1 << 3, |
14417 |
++ QEDR_DPM_TYPE_ROCE_EDPM_MODE = 1 << 3, |
14418 |
+ QEDR_DPM_SIZES_SET = 1 << 4, |
14419 |
+ }; |
14420 |
+ |
14421 |
+@@ -77,6 +79,8 @@ struct qedr_alloc_ucontext_resp { |
14422 |
+ __u16 ldpm_limit_size; |
14423 |
+ __u8 edpm_trans_size; |
14424 |
+ __u8 reserved; |
14425 |
++ __u16 edpm_limit_size; |
14426 |
++ __u8 padding[6]; |
14427 |
+ }; |
14428 |
+ |
14429 |
+ struct qedr_alloc_pd_ureq { |
14430 |
+diff --git a/kernel/bpf/map_iter.c b/kernel/bpf/map_iter.c |
14431 |
+index c69071e334bf..1a04c168563d 100644 |
14432 |
+--- a/kernel/bpf/map_iter.c |
14433 |
++++ b/kernel/bpf/map_iter.c |
14434 |
+@@ -6,7 +6,7 @@ |
14435 |
+ #include <linux/kernel.h> |
14436 |
+ |
14437 |
+ struct bpf_iter_seq_map_info { |
14438 |
+- u32 mid; |
14439 |
++ u32 map_id; |
14440 |
+ }; |
14441 |
+ |
14442 |
+ static void *bpf_map_seq_start(struct seq_file *seq, loff_t *pos) |
14443 |
+@@ -14,27 +14,23 @@ static void *bpf_map_seq_start(struct seq_file *seq, loff_t *pos) |
14444 |
+ struct bpf_iter_seq_map_info *info = seq->private; |
14445 |
+ struct bpf_map *map; |
14446 |
+ |
14447 |
+- map = bpf_map_get_curr_or_next(&info->mid); |
14448 |
++ map = bpf_map_get_curr_or_next(&info->map_id); |
14449 |
+ if (!map) |
14450 |
+ return NULL; |
14451 |
+ |
14452 |
+- ++*pos; |
14453 |
++ if (*pos == 0) |
14454 |
++ ++*pos; |
14455 |
+ return map; |
14456 |
+ } |
14457 |
+ |
14458 |
+ static void *bpf_map_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
14459 |
+ { |
14460 |
+ struct bpf_iter_seq_map_info *info = seq->private; |
14461 |
+- struct bpf_map *map; |
14462 |
+ |
14463 |
+ ++*pos; |
14464 |
+- ++info->mid; |
14465 |
++ ++info->map_id; |
14466 |
+ bpf_map_put((struct bpf_map *)v); |
14467 |
+- map = bpf_map_get_curr_or_next(&info->mid); |
14468 |
+- if (!map) |
14469 |
+- return NULL; |
14470 |
+- |
14471 |
+- return map; |
14472 |
++ return bpf_map_get_curr_or_next(&info->map_id); |
14473 |
+ } |
14474 |
+ |
14475 |
+ struct bpf_iter__bpf_map { |
14476 |
+diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c |
14477 |
+index 4dbf2b6035f8..ac7869a38999 100644 |
14478 |
+--- a/kernel/bpf/task_iter.c |
14479 |
++++ b/kernel/bpf/task_iter.c |
14480 |
+@@ -50,7 +50,8 @@ static void *task_seq_start(struct seq_file *seq, loff_t *pos) |
14481 |
+ if (!task) |
14482 |
+ return NULL; |
14483 |
+ |
14484 |
+- ++*pos; |
14485 |
++ if (*pos == 0) |
14486 |
++ ++*pos; |
14487 |
+ return task; |
14488 |
+ } |
14489 |
+ |
14490 |
+@@ -209,7 +210,8 @@ static void *task_file_seq_start(struct seq_file *seq, loff_t *pos) |
14491 |
+ return NULL; |
14492 |
+ } |
14493 |
+ |
14494 |
+- ++*pos; |
14495 |
++ if (*pos == 0) |
14496 |
++ ++*pos; |
14497 |
+ info->task = task; |
14498 |
+ info->files = files; |
14499 |
+ |
14500 |
+diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c |
14501 |
+index 6c6569e0586c..1e9e500ff790 100644 |
14502 |
+--- a/kernel/rcu/tree.c |
14503 |
++++ b/kernel/rcu/tree.c |
14504 |
+@@ -3105,7 +3105,7 @@ static void kfree_rcu_work(struct work_struct *work) |
14505 |
+ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp) |
14506 |
+ { |
14507 |
+ struct kfree_rcu_cpu_work *krwp; |
14508 |
+- bool queued = false; |
14509 |
++ bool repeat = false; |
14510 |
+ int i; |
14511 |
+ |
14512 |
+ lockdep_assert_held(&krcp->lock); |
14513 |
+@@ -3143,11 +3143,14 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp) |
14514 |
+ * been detached following each other, one by one. |
14515 |
+ */ |
14516 |
+ queue_rcu_work(system_wq, &krwp->rcu_work); |
14517 |
+- queued = true; |
14518 |
+ } |
14519 |
++ |
14520 |
++ /* Repeat if any "free" corresponding channel is still busy. */ |
14521 |
++ if (krcp->bhead || krcp->head) |
14522 |
++ repeat = true; |
14523 |
+ } |
14524 |
+ |
14525 |
+- return queued; |
14526 |
++ return !repeat; |
14527 |
+ } |
14528 |
+ |
14529 |
+ static inline void kfree_rcu_drain_unlock(struct kfree_rcu_cpu *krcp, |
14530 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
14531 |
+index 2142c6767682..c3cbdc436e2e 100644 |
14532 |
+--- a/kernel/sched/core.c |
14533 |
++++ b/kernel/sched/core.c |
14534 |
+@@ -1237,6 +1237,20 @@ static void uclamp_fork(struct task_struct *p) |
14535 |
+ } |
14536 |
+ } |
14537 |
+ |
14538 |
++static void __init init_uclamp_rq(struct rq *rq) |
14539 |
++{ |
14540 |
++ enum uclamp_id clamp_id; |
14541 |
++ struct uclamp_rq *uc_rq = rq->uclamp; |
14542 |
++ |
14543 |
++ for_each_clamp_id(clamp_id) { |
14544 |
++ uc_rq[clamp_id] = (struct uclamp_rq) { |
14545 |
++ .value = uclamp_none(clamp_id) |
14546 |
++ }; |
14547 |
++ } |
14548 |
++ |
14549 |
++ rq->uclamp_flags = 0; |
14550 |
++} |
14551 |
++ |
14552 |
+ static void __init init_uclamp(void) |
14553 |
+ { |
14554 |
+ struct uclamp_se uc_max = {}; |
14555 |
+@@ -1245,11 +1259,8 @@ static void __init init_uclamp(void) |
14556 |
+ |
14557 |
+ mutex_init(&uclamp_mutex); |
14558 |
+ |
14559 |
+- for_each_possible_cpu(cpu) { |
14560 |
+- memset(&cpu_rq(cpu)->uclamp, 0, |
14561 |
+- sizeof(struct uclamp_rq)*UCLAMP_CNT); |
14562 |
+- cpu_rq(cpu)->uclamp_flags = 0; |
14563 |
+- } |
14564 |
++ for_each_possible_cpu(cpu) |
14565 |
++ init_uclamp_rq(cpu_rq(cpu)); |
14566 |
+ |
14567 |
+ for_each_clamp_id(clamp_id) { |
14568 |
+ uclamp_se_set(&init_task.uclamp_req[clamp_id], |
14569 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
14570 |
+index 04fa8dbcfa4d..6b3b59cc51d6 100644 |
14571 |
+--- a/kernel/sched/fair.c |
14572 |
++++ b/kernel/sched/fair.c |
14573 |
+@@ -10027,7 +10027,12 @@ static void kick_ilb(unsigned int flags) |
14574 |
+ { |
14575 |
+ int ilb_cpu; |
14576 |
+ |
14577 |
+- nohz.next_balance++; |
14578 |
++ /* |
14579 |
++ * Increase nohz.next_balance only when if full ilb is triggered but |
14580 |
++ * not if we only update stats. |
14581 |
++ */ |
14582 |
++ if (flags & NOHZ_BALANCE_KICK) |
14583 |
++ nohz.next_balance = jiffies+1; |
14584 |
+ |
14585 |
+ ilb_cpu = find_new_ilb(); |
14586 |
+ |
14587 |
+@@ -10348,6 +10353,14 @@ static bool _nohz_idle_balance(struct rq *this_rq, unsigned int flags, |
14588 |
+ } |
14589 |
+ } |
14590 |
+ |
14591 |
++ /* |
14592 |
++ * next_balance will be updated only when there is a need. |
14593 |
++ * When the CPU is attached to null domain for ex, it will not be |
14594 |
++ * updated. |
14595 |
++ */ |
14596 |
++ if (likely(update_next_balance)) |
14597 |
++ nohz.next_balance = next_balance; |
14598 |
++ |
14599 |
+ /* Newly idle CPU doesn't need an update */ |
14600 |
+ if (idle != CPU_NEWLY_IDLE) { |
14601 |
+ update_blocked_averages(this_cpu); |
14602 |
+@@ -10368,14 +10381,6 @@ abort: |
14603 |
+ if (has_blocked_load) |
14604 |
+ WRITE_ONCE(nohz.has_blocked, 1); |
14605 |
+ |
14606 |
+- /* |
14607 |
+- * next_balance will be updated only when there is a need. |
14608 |
+- * When the CPU is attached to null domain for ex, it will not be |
14609 |
+- * updated. |
14610 |
+- */ |
14611 |
+- if (likely(update_next_balance)) |
14612 |
+- nohz.next_balance = next_balance; |
14613 |
+- |
14614 |
+ return ret; |
14615 |
+ } |
14616 |
+ |
14617 |
+diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c |
14618 |
+index ba81187bb7af..9079d865a935 100644 |
14619 |
+--- a/kernel/sched/topology.c |
14620 |
++++ b/kernel/sched/topology.c |
14621 |
+@@ -1328,7 +1328,7 @@ sd_init(struct sched_domain_topology_level *tl, |
14622 |
+ sd_flags = (*tl->sd_flags)(); |
14623 |
+ if (WARN_ONCE(sd_flags & ~TOPOLOGY_SD_FLAGS, |
14624 |
+ "wrong sd_flags in topology description\n")) |
14625 |
+- sd_flags &= ~TOPOLOGY_SD_FLAGS; |
14626 |
++ sd_flags &= TOPOLOGY_SD_FLAGS; |
14627 |
+ |
14628 |
+ /* Apply detected topology flags */ |
14629 |
+ sd_flags |= dflags; |
14630 |
+diff --git a/kernel/seccomp.c b/kernel/seccomp.c |
14631 |
+index d653d8426de9..c461ba992513 100644 |
14632 |
+--- a/kernel/seccomp.c |
14633 |
++++ b/kernel/seccomp.c |
14634 |
+@@ -42,6 +42,14 @@ |
14635 |
+ #include <linux/uaccess.h> |
14636 |
+ #include <linux/anon_inodes.h> |
14637 |
+ |
14638 |
++/* |
14639 |
++ * When SECCOMP_IOCTL_NOTIF_ID_VALID was first introduced, it had the |
14640 |
++ * wrong direction flag in the ioctl number. This is the broken one, |
14641 |
++ * which the kernel needs to keep supporting until all userspaces stop |
14642 |
++ * using the wrong command number. |
14643 |
++ */ |
14644 |
++#define SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR SECCOMP_IOR(2, __u64) |
14645 |
++ |
14646 |
+ enum notify_state { |
14647 |
+ SECCOMP_NOTIFY_INIT, |
14648 |
+ SECCOMP_NOTIFY_SENT, |
14649 |
+@@ -1186,6 +1194,7 @@ static long seccomp_notify_ioctl(struct file *file, unsigned int cmd, |
14650 |
+ return seccomp_notify_recv(filter, buf); |
14651 |
+ case SECCOMP_IOCTL_NOTIF_SEND: |
14652 |
+ return seccomp_notify_send(filter, buf); |
14653 |
++ case SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR: |
14654 |
+ case SECCOMP_IOCTL_NOTIF_ID_VALID: |
14655 |
+ return seccomp_notify_id_valid(filter, buf); |
14656 |
+ default: |
14657 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
14658 |
+index 6f16f7c5d375..42b67d2cea37 100644 |
14659 |
+--- a/kernel/signal.c |
14660 |
++++ b/kernel/signal.c |
14661 |
+@@ -2541,7 +2541,21 @@ bool get_signal(struct ksignal *ksig) |
14662 |
+ |
14663 |
+ relock: |
14664 |
+ spin_lock_irq(&sighand->siglock); |
14665 |
+- current->jobctl &= ~JOBCTL_TASK_WORK; |
14666 |
++ /* |
14667 |
++ * Make sure we can safely read ->jobctl() in task_work add. As Oleg |
14668 |
++ * states: |
14669 |
++ * |
14670 |
++ * It pairs with mb (implied by cmpxchg) before READ_ONCE. So we |
14671 |
++ * roughly have |
14672 |
++ * |
14673 |
++ * task_work_add: get_signal: |
14674 |
++ * STORE(task->task_works, new_work); STORE(task->jobctl); |
14675 |
++ * mb(); mb(); |
14676 |
++ * LOAD(task->jobctl); LOAD(task->task_works); |
14677 |
++ * |
14678 |
++ * and we can rely on STORE-MB-LOAD [ in task_work_add]. |
14679 |
++ */ |
14680 |
++ smp_store_mb(current->jobctl, current->jobctl & ~JOBCTL_TASK_WORK); |
14681 |
+ if (unlikely(current->task_works)) { |
14682 |
+ spin_unlock_irq(&sighand->siglock); |
14683 |
+ task_work_run(); |
14684 |
+diff --git a/kernel/task_work.c b/kernel/task_work.c |
14685 |
+index 5c0848ca1287..613b2d634af8 100644 |
14686 |
+--- a/kernel/task_work.c |
14687 |
++++ b/kernel/task_work.c |
14688 |
+@@ -42,7 +42,13 @@ task_work_add(struct task_struct *task, struct callback_head *work, int notify) |
14689 |
+ set_notify_resume(task); |
14690 |
+ break; |
14691 |
+ case TWA_SIGNAL: |
14692 |
+- if (lock_task_sighand(task, &flags)) { |
14693 |
++ /* |
14694 |
++ * Only grab the sighand lock if we don't already have some |
14695 |
++ * task_work pending. This pairs with the smp_store_mb() |
14696 |
++ * in get_signal(), see comment there. |
14697 |
++ */ |
14698 |
++ if (!(READ_ONCE(task->jobctl) & JOBCTL_TASK_WORK) && |
14699 |
++ lock_task_sighand(task, &flags)) { |
14700 |
+ task->jobctl |= JOBCTL_TASK_WORK; |
14701 |
+ signal_wake_up(task, 0); |
14702 |
+ unlock_task_sighand(task, &flags); |
14703 |
+diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c |
14704 |
+index 3e2dc9b8858c..f0199a4ba1ad 100644 |
14705 |
+--- a/kernel/time/tick-sched.c |
14706 |
++++ b/kernel/time/tick-sched.c |
14707 |
+@@ -351,16 +351,24 @@ void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) |
14708 |
+ EXPORT_SYMBOL_GPL(tick_nohz_dep_clear_cpu); |
14709 |
+ |
14710 |
+ /* |
14711 |
+- * Set a per-task tick dependency. Posix CPU timers need this in order to elapse |
14712 |
+- * per task timers. |
14713 |
++ * Set a per-task tick dependency. RCU need this. Also posix CPU timers |
14714 |
++ * in order to elapse per task timers. |
14715 |
+ */ |
14716 |
+ void tick_nohz_dep_set_task(struct task_struct *tsk, enum tick_dep_bits bit) |
14717 |
+ { |
14718 |
+- /* |
14719 |
+- * We could optimize this with just kicking the target running the task |
14720 |
+- * if that noise matters for nohz full users. |
14721 |
+- */ |
14722 |
+- tick_nohz_dep_set_all(&tsk->tick_dep_mask, bit); |
14723 |
++ if (!atomic_fetch_or(BIT(bit), &tsk->tick_dep_mask)) { |
14724 |
++ if (tsk == current) { |
14725 |
++ preempt_disable(); |
14726 |
++ tick_nohz_full_kick(); |
14727 |
++ preempt_enable(); |
14728 |
++ } else { |
14729 |
++ /* |
14730 |
++ * Some future tick_nohz_full_kick_task() |
14731 |
++ * should optimize this. |
14732 |
++ */ |
14733 |
++ tick_nohz_full_kick_all(); |
14734 |
++ } |
14735 |
++ } |
14736 |
+ } |
14737 |
+ EXPORT_SYMBOL_GPL(tick_nohz_dep_set_task); |
14738 |
+ |
14739 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
14740 |
+index 5ef0484513ec..588e8e396019 100644 |
14741 |
+--- a/kernel/trace/blktrace.c |
14742 |
++++ b/kernel/trace/blktrace.c |
14743 |
+@@ -522,10 +522,18 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
14744 |
+ if (!bt->msg_data) |
14745 |
+ goto err; |
14746 |
+ |
14747 |
+- ret = -ENOENT; |
14748 |
+- |
14749 |
+- dir = debugfs_lookup(buts->name, blk_debugfs_root); |
14750 |
+- if (!dir) |
14751 |
++#ifdef CONFIG_BLK_DEBUG_FS |
14752 |
++ /* |
14753 |
++ * When tracing whole make_request drivers (multiqueue) block devices, |
14754 |
++ * reuse the existing debugfs directory created by the block layer on |
14755 |
++ * init. For request-based block devices, all partitions block devices, |
14756 |
++ * and scsi-generic block devices we create a temporary new debugfs |
14757 |
++ * directory that will be removed once the trace ends. |
14758 |
++ */ |
14759 |
++ if (queue_is_mq(q) && bdev && bdev == bdev->bd_contains) |
14760 |
++ dir = q->debugfs_dir; |
14761 |
++ else |
14762 |
++#endif |
14763 |
+ bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); |
14764 |
+ |
14765 |
+ bt->dev = dev; |
14766 |
+@@ -563,8 +571,6 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
14767 |
+ |
14768 |
+ ret = 0; |
14769 |
+ err: |
14770 |
+- if (dir && !bt->dir) |
14771 |
+- dput(dir); |
14772 |
+ if (ret) |
14773 |
+ blk_trace_free(bt); |
14774 |
+ return ret; |
14775 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
14776 |
+index 1903b80db6eb..7d879fae3777 100644 |
14777 |
+--- a/kernel/trace/ftrace.c |
14778 |
++++ b/kernel/trace/ftrace.c |
14779 |
+@@ -139,9 +139,6 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops) |
14780 |
+ #endif |
14781 |
+ } |
14782 |
+ |
14783 |
+-#define FTRACE_PID_IGNORE -1 |
14784 |
+-#define FTRACE_PID_TRACE -2 |
14785 |
+- |
14786 |
+ static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip, |
14787 |
+ struct ftrace_ops *op, struct pt_regs *regs) |
14788 |
+ { |
14789 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
14790 |
+index bb62269724d5..6fc6da55b94e 100644 |
14791 |
+--- a/kernel/trace/trace.c |
14792 |
++++ b/kernel/trace/trace.c |
14793 |
+@@ -5887,7 +5887,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) |
14794 |
+ } |
14795 |
+ |
14796 |
+ /* If trace pipe files are being read, we can't change the tracer */ |
14797 |
+- if (tr->current_trace->ref) { |
14798 |
++ if (tr->trace_ref) { |
14799 |
+ ret = -EBUSY; |
14800 |
+ goto out; |
14801 |
+ } |
14802 |
+@@ -6103,7 +6103,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) |
14803 |
+ |
14804 |
+ nonseekable_open(inode, filp); |
14805 |
+ |
14806 |
+- tr->current_trace->ref++; |
14807 |
++ tr->trace_ref++; |
14808 |
+ out: |
14809 |
+ mutex_unlock(&trace_types_lock); |
14810 |
+ return ret; |
14811 |
+@@ -6122,7 +6122,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file) |
14812 |
+ |
14813 |
+ mutex_lock(&trace_types_lock); |
14814 |
+ |
14815 |
+- tr->current_trace->ref--; |
14816 |
++ tr->trace_ref--; |
14817 |
+ |
14818 |
+ if (iter->trace->pipe_close) |
14819 |
+ iter->trace->pipe_close(iter); |
14820 |
+@@ -7424,7 +7424,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) |
14821 |
+ |
14822 |
+ filp->private_data = info; |
14823 |
+ |
14824 |
+- tr->current_trace->ref++; |
14825 |
++ tr->trace_ref++; |
14826 |
+ |
14827 |
+ mutex_unlock(&trace_types_lock); |
14828 |
+ |
14829 |
+@@ -7525,7 +7525,7 @@ static int tracing_buffers_release(struct inode *inode, struct file *file) |
14830 |
+ |
14831 |
+ mutex_lock(&trace_types_lock); |
14832 |
+ |
14833 |
+- iter->tr->current_trace->ref--; |
14834 |
++ iter->tr->trace_ref--; |
14835 |
+ |
14836 |
+ __trace_array_put(iter->tr); |
14837 |
+ |
14838 |
+@@ -8733,7 +8733,7 @@ static int __remove_instance(struct trace_array *tr) |
14839 |
+ int i; |
14840 |
+ |
14841 |
+ /* Reference counter for a newly created trace array = 1. */ |
14842 |
+- if (tr->ref > 1 || (tr->current_trace && tr->current_trace->ref)) |
14843 |
++ if (tr->ref > 1 || (tr->current_trace && tr->trace_ref)) |
14844 |
+ return -EBUSY; |
14845 |
+ |
14846 |
+ list_del(&tr->list); |
14847 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
14848 |
+index 13db4000af3f..610d21355526 100644 |
14849 |
+--- a/kernel/trace/trace.h |
14850 |
++++ b/kernel/trace/trace.h |
14851 |
+@@ -356,6 +356,7 @@ struct trace_array { |
14852 |
+ struct trace_event_file *trace_marker_file; |
14853 |
+ cpumask_var_t tracing_cpumask; /* only trace on set CPUs */ |
14854 |
+ int ref; |
14855 |
++ int trace_ref; |
14856 |
+ #ifdef CONFIG_FUNCTION_TRACER |
14857 |
+ struct ftrace_ops *ops; |
14858 |
+ struct trace_pid_list __rcu *function_pids; |
14859 |
+@@ -547,7 +548,6 @@ struct tracer { |
14860 |
+ struct tracer *next; |
14861 |
+ struct tracer_flags *flags; |
14862 |
+ int enabled; |
14863 |
+- int ref; |
14864 |
+ bool print_max; |
14865 |
+ bool allow_instances; |
14866 |
+ #ifdef CONFIG_TRACER_MAX_TRACE |
14867 |
+@@ -1103,6 +1103,10 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags) |
14868 |
+ extern struct list_head ftrace_pids; |
14869 |
+ |
14870 |
+ #ifdef CONFIG_FUNCTION_TRACER |
14871 |
++ |
14872 |
++#define FTRACE_PID_IGNORE -1 |
14873 |
++#define FTRACE_PID_TRACE -2 |
14874 |
++ |
14875 |
+ struct ftrace_func_command { |
14876 |
+ struct list_head list; |
14877 |
+ char *name; |
14878 |
+@@ -1114,7 +1118,8 @@ struct ftrace_func_command { |
14879 |
+ extern bool ftrace_filter_param __initdata; |
14880 |
+ static inline int ftrace_trace_task(struct trace_array *tr) |
14881 |
+ { |
14882 |
+- return !this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid); |
14883 |
++ return this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid) != |
14884 |
++ FTRACE_PID_IGNORE; |
14885 |
+ } |
14886 |
+ extern int ftrace_is_dead(void); |
14887 |
+ int ftrace_create_function_files(struct trace_array *tr, |
14888 |
+diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c |
14889 |
+index 8cc01a603416..c9acf1c12cfc 100644 |
14890 |
+--- a/lib/crc-t10dif.c |
14891 |
++++ b/lib/crc-t10dif.c |
14892 |
+@@ -19,39 +19,46 @@ |
14893 |
+ static struct crypto_shash __rcu *crct10dif_tfm; |
14894 |
+ static struct static_key crct10dif_fallback __read_mostly; |
14895 |
+ static DEFINE_MUTEX(crc_t10dif_mutex); |
14896 |
++static struct work_struct crct10dif_rehash_work; |
14897 |
+ |
14898 |
+-static int crc_t10dif_rehash(struct notifier_block *self, unsigned long val, void *data) |
14899 |
++static int crc_t10dif_notify(struct notifier_block *self, unsigned long val, void *data) |
14900 |
+ { |
14901 |
+ struct crypto_alg *alg = data; |
14902 |
+- struct crypto_shash *new, *old; |
14903 |
+ |
14904 |
+ if (val != CRYPTO_MSG_ALG_LOADED || |
14905 |
+ static_key_false(&crct10dif_fallback) || |
14906 |
+ strncmp(alg->cra_name, CRC_T10DIF_STRING, strlen(CRC_T10DIF_STRING))) |
14907 |
+ return 0; |
14908 |
+ |
14909 |
++ schedule_work(&crct10dif_rehash_work); |
14910 |
++ return 0; |
14911 |
++} |
14912 |
++ |
14913 |
++static void crc_t10dif_rehash(struct work_struct *work) |
14914 |
++{ |
14915 |
++ struct crypto_shash *new, *old; |
14916 |
++ |
14917 |
+ mutex_lock(&crc_t10dif_mutex); |
14918 |
+ old = rcu_dereference_protected(crct10dif_tfm, |
14919 |
+ lockdep_is_held(&crc_t10dif_mutex)); |
14920 |
+ if (!old) { |
14921 |
+ mutex_unlock(&crc_t10dif_mutex); |
14922 |
+- return 0; |
14923 |
++ return; |
14924 |
+ } |
14925 |
+ new = crypto_alloc_shash("crct10dif", 0, 0); |
14926 |
+ if (IS_ERR(new)) { |
14927 |
+ mutex_unlock(&crc_t10dif_mutex); |
14928 |
+- return 0; |
14929 |
++ return; |
14930 |
+ } |
14931 |
+ rcu_assign_pointer(crct10dif_tfm, new); |
14932 |
+ mutex_unlock(&crc_t10dif_mutex); |
14933 |
+ |
14934 |
+ synchronize_rcu(); |
14935 |
+ crypto_free_shash(old); |
14936 |
+- return 0; |
14937 |
+ } |
14938 |
+ |
14939 |
+ static struct notifier_block crc_t10dif_nb = { |
14940 |
+- .notifier_call = crc_t10dif_rehash, |
14941 |
++ .notifier_call = crc_t10dif_notify, |
14942 |
+ }; |
14943 |
+ |
14944 |
+ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len) |
14945 |
+@@ -86,19 +93,26 @@ EXPORT_SYMBOL(crc_t10dif); |
14946 |
+ |
14947 |
+ static int __init crc_t10dif_mod_init(void) |
14948 |
+ { |
14949 |
++ struct crypto_shash *tfm; |
14950 |
++ |
14951 |
++ INIT_WORK(&crct10dif_rehash_work, crc_t10dif_rehash); |
14952 |
+ crypto_register_notifier(&crc_t10dif_nb); |
14953 |
+- crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0); |
14954 |
+- if (IS_ERR(crct10dif_tfm)) { |
14955 |
++ mutex_lock(&crc_t10dif_mutex); |
14956 |
++ tfm = crypto_alloc_shash("crct10dif", 0, 0); |
14957 |
++ if (IS_ERR(tfm)) { |
14958 |
+ static_key_slow_inc(&crct10dif_fallback); |
14959 |
+- crct10dif_tfm = NULL; |
14960 |
++ tfm = NULL; |
14961 |
+ } |
14962 |
++ RCU_INIT_POINTER(crct10dif_tfm, tfm); |
14963 |
++ mutex_unlock(&crc_t10dif_mutex); |
14964 |
+ return 0; |
14965 |
+ } |
14966 |
+ |
14967 |
+ static void __exit crc_t10dif_mod_fini(void) |
14968 |
+ { |
14969 |
+ crypto_unregister_notifier(&crc_t10dif_nb); |
14970 |
+- crypto_free_shash(crct10dif_tfm); |
14971 |
++ cancel_work_sync(&crct10dif_rehash_work); |
14972 |
++ crypto_free_shash(rcu_dereference_protected(crct10dif_tfm, 1)); |
14973 |
+ } |
14974 |
+ |
14975 |
+ module_init(crc_t10dif_mod_init); |
14976 |
+@@ -106,11 +120,27 @@ module_exit(crc_t10dif_mod_fini); |
14977 |
+ |
14978 |
+ static int crc_t10dif_transform_show(char *buffer, const struct kernel_param *kp) |
14979 |
+ { |
14980 |
++ struct crypto_shash *tfm; |
14981 |
++ const char *name; |
14982 |
++ int len; |
14983 |
++ |
14984 |
+ if (static_key_false(&crct10dif_fallback)) |
14985 |
+ return sprintf(buffer, "fallback\n"); |
14986 |
+ |
14987 |
+- return sprintf(buffer, "%s\n", |
14988 |
+- crypto_tfm_alg_driver_name(crypto_shash_tfm(crct10dif_tfm))); |
14989 |
++ rcu_read_lock(); |
14990 |
++ tfm = rcu_dereference(crct10dif_tfm); |
14991 |
++ if (!tfm) { |
14992 |
++ len = sprintf(buffer, "init\n"); |
14993 |
++ goto unlock; |
14994 |
++ } |
14995 |
++ |
14996 |
++ name = crypto_tfm_alg_driver_name(crypto_shash_tfm(tfm)); |
14997 |
++ len = sprintf(buffer, "%s\n", name); |
14998 |
++ |
14999 |
++unlock: |
15000 |
++ rcu_read_unlock(); |
15001 |
++ |
15002 |
++ return len; |
15003 |
+ } |
15004 |
+ |
15005 |
+ module_param_call(transform, NULL, crc_t10dif_transform_show, NULL, 0644); |
15006 |
+diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
15007 |
+index 321437bbf87d..98876a8255c7 100644 |
15008 |
+--- a/lib/dynamic_debug.c |
15009 |
++++ b/lib/dynamic_debug.c |
15010 |
+@@ -87,22 +87,22 @@ static struct { unsigned flag:8; char opt_char; } opt_array[] = { |
15011 |
+ { _DPRINTK_FLAGS_NONE, '_' }, |
15012 |
+ }; |
15013 |
+ |
15014 |
++struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; }; |
15015 |
++ |
15016 |
+ /* format a string into buf[] which describes the _ddebug's flags */ |
15017 |
+-static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, |
15018 |
+- size_t maxlen) |
15019 |
++static char *ddebug_describe_flags(unsigned int flags, struct flagsbuf *fb) |
15020 |
+ { |
15021 |
+- char *p = buf; |
15022 |
++ char *p = fb->buf; |
15023 |
+ int i; |
15024 |
+ |
15025 |
+- BUG_ON(maxlen < 6); |
15026 |
+ for (i = 0; i < ARRAY_SIZE(opt_array); ++i) |
15027 |
+- if (dp->flags & opt_array[i].flag) |
15028 |
++ if (flags & opt_array[i].flag) |
15029 |
+ *p++ = opt_array[i].opt_char; |
15030 |
+- if (p == buf) |
15031 |
++ if (p == fb->buf) |
15032 |
+ *p++ = '_'; |
15033 |
+ *p = '\0'; |
15034 |
+ |
15035 |
+- return buf; |
15036 |
++ return fb->buf; |
15037 |
+ } |
15038 |
+ |
15039 |
+ #define vpr_info(fmt, ...) \ |
15040 |
+@@ -144,7 +144,7 @@ static int ddebug_change(const struct ddebug_query *query, |
15041 |
+ struct ddebug_table *dt; |
15042 |
+ unsigned int newflags; |
15043 |
+ unsigned int nfound = 0; |
15044 |
+- char flagbuf[10]; |
15045 |
++ struct flagsbuf fbuf; |
15046 |
+ |
15047 |
+ /* search for matching ddebugs */ |
15048 |
+ mutex_lock(&ddebug_lock); |
15049 |
+@@ -201,8 +201,7 @@ static int ddebug_change(const struct ddebug_query *query, |
15050 |
+ vpr_info("changed %s:%d [%s]%s =%s\n", |
15051 |
+ trim_prefix(dp->filename), dp->lineno, |
15052 |
+ dt->mod_name, dp->function, |
15053 |
+- ddebug_describe_flags(dp, flagbuf, |
15054 |
+- sizeof(flagbuf))); |
15055 |
++ ddebug_describe_flags(dp->flags, &fbuf)); |
15056 |
+ } |
15057 |
+ } |
15058 |
+ mutex_unlock(&ddebug_lock); |
15059 |
+@@ -816,7 +815,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) |
15060 |
+ { |
15061 |
+ struct ddebug_iter *iter = m->private; |
15062 |
+ struct _ddebug *dp = p; |
15063 |
+- char flagsbuf[10]; |
15064 |
++ struct flagsbuf flags; |
15065 |
+ |
15066 |
+ vpr_info("called m=%p p=%p\n", m, p); |
15067 |
+ |
15068 |
+@@ -829,7 +828,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) |
15069 |
+ seq_printf(m, "%s:%u [%s]%s =%s \"", |
15070 |
+ trim_prefix(dp->filename), dp->lineno, |
15071 |
+ iter->table->mod_name, dp->function, |
15072 |
+- ddebug_describe_flags(dp, flagsbuf, sizeof(flagsbuf))); |
15073 |
++ ddebug_describe_flags(dp->flags, &flags)); |
15074 |
+ seq_escape(m, dp->format, "\t\r\n\""); |
15075 |
+ seq_puts(m, "\"\n"); |
15076 |
+ |
15077 |
+diff --git a/lib/kobject.c b/lib/kobject.c |
15078 |
+index 1e4b7382a88e..3afb939f2a1c 100644 |
15079 |
+--- a/lib/kobject.c |
15080 |
++++ b/lib/kobject.c |
15081 |
+@@ -599,14 +599,7 @@ out: |
15082 |
+ } |
15083 |
+ EXPORT_SYMBOL_GPL(kobject_move); |
15084 |
+ |
15085 |
+-/** |
15086 |
+- * kobject_del() - Unlink kobject from hierarchy. |
15087 |
+- * @kobj: object. |
15088 |
+- * |
15089 |
+- * This is the function that should be called to delete an object |
15090 |
+- * successfully added via kobject_add(). |
15091 |
+- */ |
15092 |
+-void kobject_del(struct kobject *kobj) |
15093 |
++static void __kobject_del(struct kobject *kobj) |
15094 |
+ { |
15095 |
+ struct kernfs_node *sd; |
15096 |
+ const struct kobj_type *ktype; |
15097 |
+@@ -632,9 +625,23 @@ void kobject_del(struct kobject *kobj) |
15098 |
+ |
15099 |
+ kobj->state_in_sysfs = 0; |
15100 |
+ kobj_kset_leave(kobj); |
15101 |
+- kobject_put(kobj->parent); |
15102 |
+ kobj->parent = NULL; |
15103 |
+ } |
15104 |
++ |
15105 |
++/** |
15106 |
++ * kobject_del() - Unlink kobject from hierarchy. |
15107 |
++ * @kobj: object. |
15108 |
++ * |
15109 |
++ * This is the function that should be called to delete an object |
15110 |
++ * successfully added via kobject_add(). |
15111 |
++ */ |
15112 |
++void kobject_del(struct kobject *kobj) |
15113 |
++{ |
15114 |
++ struct kobject *parent = kobj->parent; |
15115 |
++ |
15116 |
++ __kobject_del(kobj); |
15117 |
++ kobject_put(parent); |
15118 |
++} |
15119 |
+ EXPORT_SYMBOL(kobject_del); |
15120 |
+ |
15121 |
+ /** |
15122 |
+@@ -670,6 +677,7 @@ EXPORT_SYMBOL(kobject_get_unless_zero); |
15123 |
+ */ |
15124 |
+ static void kobject_cleanup(struct kobject *kobj) |
15125 |
+ { |
15126 |
++ struct kobject *parent = kobj->parent; |
15127 |
+ struct kobj_type *t = get_ktype(kobj); |
15128 |
+ const char *name = kobj->name; |
15129 |
+ |
15130 |
+@@ -684,7 +692,10 @@ static void kobject_cleanup(struct kobject *kobj) |
15131 |
+ if (kobj->state_in_sysfs) { |
15132 |
+ pr_debug("kobject: '%s' (%p): auto cleanup kobject_del\n", |
15133 |
+ kobject_name(kobj), kobj); |
15134 |
+- kobject_del(kobj); |
15135 |
++ __kobject_del(kobj); |
15136 |
++ } else { |
15137 |
++ /* avoid dropping the parent reference unnecessarily */ |
15138 |
++ parent = NULL; |
15139 |
+ } |
15140 |
+ |
15141 |
+ if (t && t->release) { |
15142 |
+@@ -698,6 +709,8 @@ static void kobject_cleanup(struct kobject *kobj) |
15143 |
+ pr_debug("kobject: '%s': free name\n", name); |
15144 |
+ kfree_const(name); |
15145 |
+ } |
15146 |
++ |
15147 |
++ kobject_put(parent); |
15148 |
+ } |
15149 |
+ |
15150 |
+ #ifdef CONFIG_DEBUG_KOBJECT_RELEASE |
15151 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
15152 |
+index 8c7ca737a19b..dcdab2675a21 100644 |
15153 |
+--- a/mm/mmap.c |
15154 |
++++ b/mm/mmap.c |
15155 |
+@@ -3171,6 +3171,7 @@ void exit_mmap(struct mm_struct *mm) |
15156 |
+ if (vma->vm_flags & VM_ACCOUNT) |
15157 |
+ nr_accounted += vma_pages(vma); |
15158 |
+ vma = remove_vma(vma); |
15159 |
++ cond_resched(); |
15160 |
+ } |
15161 |
+ vm_unacct_memory(nr_accounted); |
15162 |
+ } |
15163 |
+diff --git a/mm/vmstat.c b/mm/vmstat.c |
15164 |
+index 3fb23a21f6dd..7fb01d225337 100644 |
15165 |
+--- a/mm/vmstat.c |
15166 |
++++ b/mm/vmstat.c |
15167 |
+@@ -1596,12 +1596,6 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
15168 |
+ zone->present_pages, |
15169 |
+ zone_managed_pages(zone)); |
15170 |
+ |
15171 |
+- /* If unpopulated, no other information is useful */ |
15172 |
+- if (!populated_zone(zone)) { |
15173 |
+- seq_putc(m, '\n'); |
15174 |
+- return; |
15175 |
+- } |
15176 |
+- |
15177 |
+ seq_printf(m, |
15178 |
+ "\n protection: (%ld", |
15179 |
+ zone->lowmem_reserve[0]); |
15180 |
+@@ -1609,6 +1603,12 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
15181 |
+ seq_printf(m, ", %ld", zone->lowmem_reserve[i]); |
15182 |
+ seq_putc(m, ')'); |
15183 |
+ |
15184 |
++ /* If unpopulated, no other information is useful */ |
15185 |
++ if (!populated_zone(zone)) { |
15186 |
++ seq_putc(m, '\n'); |
15187 |
++ return; |
15188 |
++ } |
15189 |
++ |
15190 |
+ for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) |
15191 |
+ seq_printf(m, "\n %-12s %lu", zone_stat_name(i), |
15192 |
+ zone_page_state(zone, i)); |
15193 |
+diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c |
15194 |
+index bb55d92691b0..cff4944d5b66 100644 |
15195 |
+--- a/net/bluetooth/6lowpan.c |
15196 |
++++ b/net/bluetooth/6lowpan.c |
15197 |
+@@ -50,6 +50,7 @@ static bool enable_6lowpan; |
15198 |
+ /* We are listening incoming connections via this channel |
15199 |
+ */ |
15200 |
+ static struct l2cap_chan *listen_chan; |
15201 |
++static DEFINE_MUTEX(set_lock); |
15202 |
+ |
15203 |
+ struct lowpan_peer { |
15204 |
+ struct list_head list; |
15205 |
+@@ -1078,12 +1079,14 @@ static void do_enable_set(struct work_struct *work) |
15206 |
+ |
15207 |
+ enable_6lowpan = set_enable->flag; |
15208 |
+ |
15209 |
++ mutex_lock(&set_lock); |
15210 |
+ if (listen_chan) { |
15211 |
+ l2cap_chan_close(listen_chan, 0); |
15212 |
+ l2cap_chan_put(listen_chan); |
15213 |
+ } |
15214 |
+ |
15215 |
+ listen_chan = bt_6lowpan_listen(); |
15216 |
++ mutex_unlock(&set_lock); |
15217 |
+ |
15218 |
+ kfree(set_enable); |
15219 |
+ } |
15220 |
+@@ -1135,11 +1138,13 @@ static ssize_t lowpan_control_write(struct file *fp, |
15221 |
+ if (ret == -EINVAL) |
15222 |
+ return ret; |
15223 |
+ |
15224 |
++ mutex_lock(&set_lock); |
15225 |
+ if (listen_chan) { |
15226 |
+ l2cap_chan_close(listen_chan, 0); |
15227 |
+ l2cap_chan_put(listen_chan); |
15228 |
+ listen_chan = NULL; |
15229 |
+ } |
15230 |
++ mutex_unlock(&set_lock); |
15231 |
+ |
15232 |
+ if (conn) { |
15233 |
+ struct lowpan_peer *peer; |
15234 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
15235 |
+index dbe2d79f233f..41fba93d857a 100644 |
15236 |
+--- a/net/bluetooth/hci_core.c |
15237 |
++++ b/net/bluetooth/hci_core.c |
15238 |
+@@ -606,7 +606,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt) |
15239 |
+ if (hdev->commands[8] & 0x01) |
15240 |
+ hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL); |
15241 |
+ |
15242 |
+- if (hdev->commands[18] & 0x04) |
15243 |
++ if (hdev->commands[18] & 0x04 && |
15244 |
++ !test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks)) |
15245 |
+ hci_req_add(req, HCI_OP_READ_DEF_ERR_DATA_REPORTING, 0, NULL); |
15246 |
+ |
15247 |
+ /* Some older Broadcom based Bluetooth 1.2 controllers do not |
15248 |
+@@ -851,7 +852,8 @@ static int hci_init4_req(struct hci_request *req, unsigned long opt) |
15249 |
+ /* Set erroneous data reporting if supported to the wideband speech |
15250 |
+ * setting value |
15251 |
+ */ |
15252 |
+- if (hdev->commands[18] & 0x08) { |
15253 |
++ if (hdev->commands[18] & 0x08 && |
15254 |
++ !test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks)) { |
15255 |
+ bool enabled = hci_dev_test_flag(hdev, |
15256 |
+ HCI_WIDEBAND_SPEECH_ENABLED); |
15257 |
+ |
15258 |
+@@ -3289,10 +3291,10 @@ static int hci_suspend_wait_event(struct hci_dev *hdev) |
15259 |
+ WAKE_COND, SUSPEND_NOTIFIER_TIMEOUT); |
15260 |
+ |
15261 |
+ if (ret == 0) { |
15262 |
+- bt_dev_dbg(hdev, "Timed out waiting for suspend"); |
15263 |
++ bt_dev_err(hdev, "Timed out waiting for suspend events"); |
15264 |
+ for (i = 0; i < __SUSPEND_NUM_TASKS; ++i) { |
15265 |
+ if (test_bit(i, hdev->suspend_tasks)) |
15266 |
+- bt_dev_dbg(hdev, "Bit %d is set", i); |
15267 |
++ bt_dev_err(hdev, "Suspend timeout bit: %d", i); |
15268 |
+ clear_bit(i, hdev->suspend_tasks); |
15269 |
+ } |
15270 |
+ |
15271 |
+@@ -3360,12 +3362,15 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action, |
15272 |
+ ret = hci_change_suspend_state(hdev, BT_RUNNING); |
15273 |
+ } |
15274 |
+ |
15275 |
+- /* If suspend failed, restore it to running */ |
15276 |
+- if (ret && action == PM_SUSPEND_PREPARE) |
15277 |
+- hci_change_suspend_state(hdev, BT_RUNNING); |
15278 |
+- |
15279 |
+ done: |
15280 |
+- return ret ? notifier_from_errno(-EBUSY) : NOTIFY_STOP; |
15281 |
++ /* We always allow suspend even if suspend preparation failed and |
15282 |
++ * attempt to recover in resume. |
15283 |
++ */ |
15284 |
++ if (ret) |
15285 |
++ bt_dev_err(hdev, "Suspend notifier action (%lu) failed: %d", |
15286 |
++ action, ret); |
15287 |
++ |
15288 |
++ return NOTIFY_STOP; |
15289 |
+ } |
15290 |
+ |
15291 |
+ /* Alloc HCI device */ |
15292 |
+@@ -3603,9 +3608,10 @@ void hci_unregister_dev(struct hci_dev *hdev) |
15293 |
+ |
15294 |
+ cancel_work_sync(&hdev->power_on); |
15295 |
+ |
15296 |
+- hci_dev_do_close(hdev); |
15297 |
+- |
15298 |
+ unregister_pm_notifier(&hdev->suspend_notifier); |
15299 |
++ cancel_work_sync(&hdev->suspend_prepare); |
15300 |
++ |
15301 |
++ hci_dev_do_close(hdev); |
15302 |
+ |
15303 |
+ if (!test_bit(HCI_INIT, &hdev->flags) && |
15304 |
+ !hci_dev_test_flag(hdev, HCI_SETUP) && |
15305 |
+diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c |
15306 |
+index 4494ea6056cd..42b88a92afe9 100644 |
15307 |
+--- a/net/bpfilter/bpfilter_kern.c |
15308 |
++++ b/net/bpfilter/bpfilter_kern.c |
15309 |
+@@ -50,6 +50,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname, |
15310 |
+ req.len = optlen; |
15311 |
+ if (!bpfilter_ops.info.pid) |
15312 |
+ goto out; |
15313 |
++ pos = 0; |
15314 |
+ n = kernel_write(bpfilter_ops.info.pipe_to_umh, &req, sizeof(req), |
15315 |
+ &pos); |
15316 |
+ if (n != sizeof(req)) { |
15317 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
15318 |
+index 2e5b7870e5d3..a14a8cb6ccca 100644 |
15319 |
+--- a/net/core/sock.c |
15320 |
++++ b/net/core/sock.c |
15321 |
+@@ -3443,6 +3443,16 @@ static void sock_inuse_add(struct net *net, int val) |
15322 |
+ } |
15323 |
+ #endif |
15324 |
+ |
15325 |
++static void tw_prot_cleanup(struct timewait_sock_ops *twsk_prot) |
15326 |
++{ |
15327 |
++ if (!twsk_prot) |
15328 |
++ return; |
15329 |
++ kfree(twsk_prot->twsk_slab_name); |
15330 |
++ twsk_prot->twsk_slab_name = NULL; |
15331 |
++ kmem_cache_destroy(twsk_prot->twsk_slab); |
15332 |
++ twsk_prot->twsk_slab = NULL; |
15333 |
++} |
15334 |
++ |
15335 |
+ static void req_prot_cleanup(struct request_sock_ops *rsk_prot) |
15336 |
+ { |
15337 |
+ if (!rsk_prot) |
15338 |
+@@ -3513,7 +3523,7 @@ int proto_register(struct proto *prot, int alloc_slab) |
15339 |
+ prot->slab_flags, |
15340 |
+ NULL); |
15341 |
+ if (prot->twsk_prot->twsk_slab == NULL) |
15342 |
+- goto out_free_timewait_sock_slab_name; |
15343 |
++ goto out_free_timewait_sock_slab; |
15344 |
+ } |
15345 |
+ } |
15346 |
+ |
15347 |
+@@ -3521,15 +3531,15 @@ int proto_register(struct proto *prot, int alloc_slab) |
15348 |
+ ret = assign_proto_idx(prot); |
15349 |
+ if (ret) { |
15350 |
+ mutex_unlock(&proto_list_mutex); |
15351 |
+- goto out_free_timewait_sock_slab_name; |
15352 |
++ goto out_free_timewait_sock_slab; |
15353 |
+ } |
15354 |
+ list_add(&prot->node, &proto_list); |
15355 |
+ mutex_unlock(&proto_list_mutex); |
15356 |
+ return ret; |
15357 |
+ |
15358 |
+-out_free_timewait_sock_slab_name: |
15359 |
++out_free_timewait_sock_slab: |
15360 |
+ if (alloc_slab && prot->twsk_prot) |
15361 |
+- kfree(prot->twsk_prot->twsk_slab_name); |
15362 |
++ tw_prot_cleanup(prot->twsk_prot); |
15363 |
+ out_free_request_sock_slab: |
15364 |
+ if (alloc_slab) { |
15365 |
+ req_prot_cleanup(prot->rsk_prot); |
15366 |
+@@ -3553,12 +3563,7 @@ void proto_unregister(struct proto *prot) |
15367 |
+ prot->slab = NULL; |
15368 |
+ |
15369 |
+ req_prot_cleanup(prot->rsk_prot); |
15370 |
+- |
15371 |
+- if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { |
15372 |
+- kmem_cache_destroy(prot->twsk_prot->twsk_slab); |
15373 |
+- kfree(prot->twsk_prot->twsk_slab_name); |
15374 |
+- prot->twsk_prot->twsk_slab = NULL; |
15375 |
+- } |
15376 |
++ tw_prot_cleanup(prot->twsk_prot); |
15377 |
+ } |
15378 |
+ EXPORT_SYMBOL(proto_unregister); |
15379 |
+ |
15380 |
+diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c |
15381 |
+index afaf582a5aa9..a1be020bde8e 100644 |
15382 |
+--- a/net/ipv4/inet_connection_sock.c |
15383 |
++++ b/net/ipv4/inet_connection_sock.c |
15384 |
+@@ -296,6 +296,57 @@ static inline int sk_reuseport_match(struct inet_bind_bucket *tb, |
15385 |
+ ipv6_only_sock(sk), true, false); |
15386 |
+ } |
15387 |
+ |
15388 |
++void inet_csk_update_fastreuse(struct inet_bind_bucket *tb, |
15389 |
++ struct sock *sk) |
15390 |
++{ |
15391 |
++ kuid_t uid = sock_i_uid(sk); |
15392 |
++ bool reuse = sk->sk_reuse && sk->sk_state != TCP_LISTEN; |
15393 |
++ |
15394 |
++ if (hlist_empty(&tb->owners)) { |
15395 |
++ tb->fastreuse = reuse; |
15396 |
++ if (sk->sk_reuseport) { |
15397 |
++ tb->fastreuseport = FASTREUSEPORT_ANY; |
15398 |
++ tb->fastuid = uid; |
15399 |
++ tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
15400 |
++ tb->fast_ipv6_only = ipv6_only_sock(sk); |
15401 |
++ tb->fast_sk_family = sk->sk_family; |
15402 |
++#if IS_ENABLED(CONFIG_IPV6) |
15403 |
++ tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
15404 |
++#endif |
15405 |
++ } else { |
15406 |
++ tb->fastreuseport = 0; |
15407 |
++ } |
15408 |
++ } else { |
15409 |
++ if (!reuse) |
15410 |
++ tb->fastreuse = 0; |
15411 |
++ if (sk->sk_reuseport) { |
15412 |
++ /* We didn't match or we don't have fastreuseport set on |
15413 |
++ * the tb, but we have sk_reuseport set on this socket |
15414 |
++ * and we know that there are no bind conflicts with |
15415 |
++ * this socket in this tb, so reset our tb's reuseport |
15416 |
++ * settings so that any subsequent sockets that match |
15417 |
++ * our current socket will be put on the fast path. |
15418 |
++ * |
15419 |
++ * If we reset we need to set FASTREUSEPORT_STRICT so we |
15420 |
++ * do extra checking for all subsequent sk_reuseport |
15421 |
++ * socks. |
15422 |
++ */ |
15423 |
++ if (!sk_reuseport_match(tb, sk)) { |
15424 |
++ tb->fastreuseport = FASTREUSEPORT_STRICT; |
15425 |
++ tb->fastuid = uid; |
15426 |
++ tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
15427 |
++ tb->fast_ipv6_only = ipv6_only_sock(sk); |
15428 |
++ tb->fast_sk_family = sk->sk_family; |
15429 |
++#if IS_ENABLED(CONFIG_IPV6) |
15430 |
++ tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
15431 |
++#endif |
15432 |
++ } |
15433 |
++ } else { |
15434 |
++ tb->fastreuseport = 0; |
15435 |
++ } |
15436 |
++ } |
15437 |
++} |
15438 |
++ |
15439 |
+ /* Obtain a reference to a local port for the given sock, |
15440 |
+ * if snum is zero it means select any available local port. |
15441 |
+ * We try to allocate an odd port (and leave even ports for connect()) |
15442 |
+@@ -308,7 +359,6 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) |
15443 |
+ struct inet_bind_hashbucket *head; |
15444 |
+ struct net *net = sock_net(sk); |
15445 |
+ struct inet_bind_bucket *tb = NULL; |
15446 |
+- kuid_t uid = sock_i_uid(sk); |
15447 |
+ int l3mdev; |
15448 |
+ |
15449 |
+ l3mdev = inet_sk_bound_l3mdev(sk); |
15450 |
+@@ -345,49 +395,8 @@ tb_found: |
15451 |
+ goto fail_unlock; |
15452 |
+ } |
15453 |
+ success: |
15454 |
+- if (hlist_empty(&tb->owners)) { |
15455 |
+- tb->fastreuse = reuse; |
15456 |
+- if (sk->sk_reuseport) { |
15457 |
+- tb->fastreuseport = FASTREUSEPORT_ANY; |
15458 |
+- tb->fastuid = uid; |
15459 |
+- tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
15460 |
+- tb->fast_ipv6_only = ipv6_only_sock(sk); |
15461 |
+- tb->fast_sk_family = sk->sk_family; |
15462 |
+-#if IS_ENABLED(CONFIG_IPV6) |
15463 |
+- tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
15464 |
+-#endif |
15465 |
+- } else { |
15466 |
+- tb->fastreuseport = 0; |
15467 |
+- } |
15468 |
+- } else { |
15469 |
+- if (!reuse) |
15470 |
+- tb->fastreuse = 0; |
15471 |
+- if (sk->sk_reuseport) { |
15472 |
+- /* We didn't match or we don't have fastreuseport set on |
15473 |
+- * the tb, but we have sk_reuseport set on this socket |
15474 |
+- * and we know that there are no bind conflicts with |
15475 |
+- * this socket in this tb, so reset our tb's reuseport |
15476 |
+- * settings so that any subsequent sockets that match |
15477 |
+- * our current socket will be put on the fast path. |
15478 |
+- * |
15479 |
+- * If we reset we need to set FASTREUSEPORT_STRICT so we |
15480 |
+- * do extra checking for all subsequent sk_reuseport |
15481 |
+- * socks. |
15482 |
+- */ |
15483 |
+- if (!sk_reuseport_match(tb, sk)) { |
15484 |
+- tb->fastreuseport = FASTREUSEPORT_STRICT; |
15485 |
+- tb->fastuid = uid; |
15486 |
+- tb->fast_rcv_saddr = sk->sk_rcv_saddr; |
15487 |
+- tb->fast_ipv6_only = ipv6_only_sock(sk); |
15488 |
+- tb->fast_sk_family = sk->sk_family; |
15489 |
+-#if IS_ENABLED(CONFIG_IPV6) |
15490 |
+- tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
15491 |
+-#endif |
15492 |
+- } |
15493 |
+- } else { |
15494 |
+- tb->fastreuseport = 0; |
15495 |
+- } |
15496 |
+- } |
15497 |
++ inet_csk_update_fastreuse(tb, sk); |
15498 |
++ |
15499 |
+ if (!inet_csk(sk)->icsk_bind_hash) |
15500 |
+ inet_bind_hash(sk, tb, port); |
15501 |
+ WARN_ON(inet_csk(sk)->icsk_bind_hash != tb); |
15502 |
+diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c |
15503 |
+index 2bbaaf0c7176..006a34b18537 100644 |
15504 |
+--- a/net/ipv4/inet_hashtables.c |
15505 |
++++ b/net/ipv4/inet_hashtables.c |
15506 |
+@@ -163,6 +163,7 @@ int __inet_inherit_port(const struct sock *sk, struct sock *child) |
15507 |
+ return -ENOMEM; |
15508 |
+ } |
15509 |
+ } |
15510 |
++ inet_csk_update_fastreuse(tb, child); |
15511 |
+ } |
15512 |
+ inet_bind_hash(child, tb, port); |
15513 |
+ spin_unlock(&head->lock); |
15514 |
+diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c |
15515 |
+index 5653e3b011bf..54023a46db04 100644 |
15516 |
+--- a/net/ipv4/sysctl_net_ipv4.c |
15517 |
++++ b/net/ipv4/sysctl_net_ipv4.c |
15518 |
+@@ -301,24 +301,16 @@ static int proc_tcp_fastopen_key(struct ctl_table *table, int write, |
15519 |
+ struct ctl_table tbl = { .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * |
15520 |
+ 2 * TCP_FASTOPEN_KEY_MAX) + |
15521 |
+ (TCP_FASTOPEN_KEY_MAX * 5)) }; |
15522 |
+- struct tcp_fastopen_context *ctx; |
15523 |
+- u32 user_key[TCP_FASTOPEN_KEY_MAX * 4]; |
15524 |
+- __le32 key[TCP_FASTOPEN_KEY_MAX * 4]; |
15525 |
++ u32 user_key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(u32)]; |
15526 |
++ __le32 key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(__le32)]; |
15527 |
+ char *backup_data; |
15528 |
+- int ret, i = 0, off = 0, n_keys = 0; |
15529 |
++ int ret, i = 0, off = 0, n_keys; |
15530 |
+ |
15531 |
+ tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); |
15532 |
+ if (!tbl.data) |
15533 |
+ return -ENOMEM; |
15534 |
+ |
15535 |
+- rcu_read_lock(); |
15536 |
+- ctx = rcu_dereference(net->ipv4.tcp_fastopen_ctx); |
15537 |
+- if (ctx) { |
15538 |
+- n_keys = tcp_fastopen_context_len(ctx); |
15539 |
+- memcpy(&key[0], &ctx->key[0], TCP_FASTOPEN_KEY_LENGTH * n_keys); |
15540 |
+- } |
15541 |
+- rcu_read_unlock(); |
15542 |
+- |
15543 |
++ n_keys = tcp_fastopen_get_cipher(net, NULL, (u64 *)key); |
15544 |
+ if (!n_keys) { |
15545 |
+ memset(&key[0], 0, TCP_FASTOPEN_KEY_LENGTH); |
15546 |
+ n_keys = 1; |
15547 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
15548 |
+index 6f0caf9a866d..30c1142584b1 100644 |
15549 |
+--- a/net/ipv4/tcp.c |
15550 |
++++ b/net/ipv4/tcp.c |
15551 |
+@@ -3694,22 +3694,14 @@ static int do_tcp_getsockopt(struct sock *sk, int level, |
15552 |
+ return 0; |
15553 |
+ |
15554 |
+ case TCP_FASTOPEN_KEY: { |
15555 |
+- __u8 key[TCP_FASTOPEN_KEY_BUF_LENGTH]; |
15556 |
+- struct tcp_fastopen_context *ctx; |
15557 |
+- unsigned int key_len = 0; |
15558 |
++ u64 key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(u64)]; |
15559 |
++ unsigned int key_len; |
15560 |
+ |
15561 |
+ if (get_user(len, optlen)) |
15562 |
+ return -EFAULT; |
15563 |
+ |
15564 |
+- rcu_read_lock(); |
15565 |
+- ctx = rcu_dereference(icsk->icsk_accept_queue.fastopenq.ctx); |
15566 |
+- if (ctx) { |
15567 |
+- key_len = tcp_fastopen_context_len(ctx) * |
15568 |
+- TCP_FASTOPEN_KEY_LENGTH; |
15569 |
+- memcpy(&key[0], &ctx->key[0], key_len); |
15570 |
+- } |
15571 |
+- rcu_read_unlock(); |
15572 |
+- |
15573 |
++ key_len = tcp_fastopen_get_cipher(net, icsk, key) * |
15574 |
++ TCP_FASTOPEN_KEY_LENGTH; |
15575 |
+ len = min_t(unsigned int, len, key_len); |
15576 |
+ if (put_user(len, optlen)) |
15577 |
+ return -EFAULT; |
15578 |
+diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c |
15579 |
+index 19ad9586c720..1bb85821f1e6 100644 |
15580 |
+--- a/net/ipv4/tcp_fastopen.c |
15581 |
++++ b/net/ipv4/tcp_fastopen.c |
15582 |
+@@ -108,6 +108,29 @@ out: |
15583 |
+ return err; |
15584 |
+ } |
15585 |
+ |
15586 |
++int tcp_fastopen_get_cipher(struct net *net, struct inet_connection_sock *icsk, |
15587 |
++ u64 *key) |
15588 |
++{ |
15589 |
++ struct tcp_fastopen_context *ctx; |
15590 |
++ int n_keys = 0, i; |
15591 |
++ |
15592 |
++ rcu_read_lock(); |
15593 |
++ if (icsk) |
15594 |
++ ctx = rcu_dereference(icsk->icsk_accept_queue.fastopenq.ctx); |
15595 |
++ else |
15596 |
++ ctx = rcu_dereference(net->ipv4.tcp_fastopen_ctx); |
15597 |
++ if (ctx) { |
15598 |
++ n_keys = tcp_fastopen_context_len(ctx); |
15599 |
++ for (i = 0; i < n_keys; i++) { |
15600 |
++ put_unaligned_le64(ctx->key[i].key[0], key + (i * 2)); |
15601 |
++ put_unaligned_le64(ctx->key[i].key[1], key + (i * 2) + 1); |
15602 |
++ } |
15603 |
++ } |
15604 |
++ rcu_read_unlock(); |
15605 |
++ |
15606 |
++ return n_keys; |
15607 |
++} |
15608 |
++ |
15609 |
+ static bool __tcp_fastopen_cookie_gen_cipher(struct request_sock *req, |
15610 |
+ struct sk_buff *syn, |
15611 |
+ const siphash_key_t *key, |
15612 |
+diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c |
15613 |
+index aa6a603a2425..517f6a2ac15a 100644 |
15614 |
+--- a/net/netfilter/ipvs/ip_vs_core.c |
15615 |
++++ b/net/netfilter/ipvs/ip_vs_core.c |
15616 |
+@@ -2066,14 +2066,14 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int |
15617 |
+ |
15618 |
+ conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); |
15619 |
+ if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) { |
15620 |
+- bool uses_ct = false, resched = false; |
15621 |
++ bool old_ct = false, resched = false; |
15622 |
+ |
15623 |
+ if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && |
15624 |
+ unlikely(!atomic_read(&cp->dest->weight))) { |
15625 |
+ resched = true; |
15626 |
+- uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
15627 |
++ old_ct = ip_vs_conn_uses_old_conntrack(cp, skb); |
15628 |
+ } else if (is_new_conn_expected(cp, conn_reuse_mode)) { |
15629 |
+- uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
15630 |
++ old_ct = ip_vs_conn_uses_old_conntrack(cp, skb); |
15631 |
+ if (!atomic_read(&cp->n_control)) { |
15632 |
+ resched = true; |
15633 |
+ } else { |
15634 |
+@@ -2081,15 +2081,17 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int |
15635 |
+ * that uses conntrack while it is still |
15636 |
+ * referenced by controlled connection(s). |
15637 |
+ */ |
15638 |
+- resched = !uses_ct; |
15639 |
++ resched = !old_ct; |
15640 |
+ } |
15641 |
+ } |
15642 |
+ |
15643 |
+ if (resched) { |
15644 |
++ if (!old_ct) |
15645 |
++ cp->flags &= ~IP_VS_CONN_F_NFCT; |
15646 |
+ if (!atomic_read(&cp->n_control)) |
15647 |
+ ip_vs_conn_expire_now(cp); |
15648 |
+ __ip_vs_conn_put(cp); |
15649 |
+- if (uses_ct) |
15650 |
++ if (old_ct) |
15651 |
+ return NF_DROP; |
15652 |
+ cp = NULL; |
15653 |
+ } |
15654 |
+diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c |
15655 |
+index 951b6e87ed5d..7bc6537f3ccb 100644 |
15656 |
+--- a/net/netfilter/nft_meta.c |
15657 |
++++ b/net/netfilter/nft_meta.c |
15658 |
+@@ -253,7 +253,7 @@ static bool nft_meta_get_eval_ifname(enum nft_meta_keys key, u32 *dest, |
15659 |
+ return false; |
15660 |
+ break; |
15661 |
+ case NFT_META_IIFGROUP: |
15662 |
+- if (!nft_meta_store_ifgroup(dest, nft_out(pkt))) |
15663 |
++ if (!nft_meta_store_ifgroup(dest, nft_in(pkt))) |
15664 |
+ return false; |
15665 |
+ break; |
15666 |
+ case NFT_META_OIFGROUP: |
15667 |
+diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c |
15668 |
+index ba5ffd3badd3..b5c867fe3232 100644 |
15669 |
+--- a/net/nfc/rawsock.c |
15670 |
++++ b/net/nfc/rawsock.c |
15671 |
+@@ -332,10 +332,13 @@ static int rawsock_create(struct net *net, struct socket *sock, |
15672 |
+ if ((sock->type != SOCK_SEQPACKET) && (sock->type != SOCK_RAW)) |
15673 |
+ return -ESOCKTNOSUPPORT; |
15674 |
+ |
15675 |
+- if (sock->type == SOCK_RAW) |
15676 |
++ if (sock->type == SOCK_RAW) { |
15677 |
++ if (!capable(CAP_NET_RAW)) |
15678 |
++ return -EPERM; |
15679 |
+ sock->ops = &rawsock_raw_ops; |
15680 |
+- else |
15681 |
++ } else { |
15682 |
+ sock->ops = &rawsock_ops; |
15683 |
++ } |
15684 |
+ |
15685 |
+ sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto, kern); |
15686 |
+ if (!sk) |
15687 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
15688 |
+index 29bd405adbbd..301f41d4929b 100644 |
15689 |
+--- a/net/packet/af_packet.c |
15690 |
++++ b/net/packet/af_packet.c |
15691 |
+@@ -942,6 +942,7 @@ static int prb_queue_frozen(struct tpacket_kbdq_core *pkc) |
15692 |
+ } |
15693 |
+ |
15694 |
+ static void prb_clear_blk_fill_status(struct packet_ring_buffer *rb) |
15695 |
++ __releases(&pkc->blk_fill_in_prog_lock) |
15696 |
+ { |
15697 |
+ struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); |
15698 |
+ atomic_dec(&pkc->blk_fill_in_prog); |
15699 |
+@@ -989,6 +990,7 @@ static void prb_fill_curr_block(char *curr, |
15700 |
+ struct tpacket_kbdq_core *pkc, |
15701 |
+ struct tpacket_block_desc *pbd, |
15702 |
+ unsigned int len) |
15703 |
++ __acquires(&pkc->blk_fill_in_prog_lock) |
15704 |
+ { |
15705 |
+ struct tpacket3_hdr *ppd; |
15706 |
+ |
15707 |
+@@ -2286,8 +2288,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, |
15708 |
+ if (do_vnet && |
15709 |
+ virtio_net_hdr_from_skb(skb, h.raw + macoff - |
15710 |
+ sizeof(struct virtio_net_hdr), |
15711 |
+- vio_le(), true, 0)) |
15712 |
++ vio_le(), true, 0)) { |
15713 |
++ if (po->tp_version == TPACKET_V3) |
15714 |
++ prb_clear_blk_fill_status(&po->rx_ring); |
15715 |
+ goto drop_n_account; |
15716 |
++ } |
15717 |
+ |
15718 |
+ if (po->tp_version <= TPACKET_V2) { |
15719 |
+ packet_increment_rx_head(po, &po->rx_ring); |
15720 |
+@@ -2393,7 +2398,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, |
15721 |
+ __clear_bit(slot_id, po->rx_ring.rx_owner_map); |
15722 |
+ spin_unlock(&sk->sk_receive_queue.lock); |
15723 |
+ sk->sk_data_ready(sk); |
15724 |
+- } else { |
15725 |
++ } else if (po->tp_version == TPACKET_V3) { |
15726 |
+ prb_clear_blk_fill_status(&po->rx_ring); |
15727 |
+ } |
15728 |
+ |
15729 |
+diff --git a/net/socket.c b/net/socket.c |
15730 |
+index 976426d03f09..481fd5f25669 100644 |
15731 |
+--- a/net/socket.c |
15732 |
++++ b/net/socket.c |
15733 |
+@@ -500,7 +500,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) |
15734 |
+ if (f.file) { |
15735 |
+ sock = sock_from_file(f.file, err); |
15736 |
+ if (likely(sock)) { |
15737 |
+- *fput_needed = f.flags; |
15738 |
++ *fput_needed = f.flags & FDPUT_FPUT; |
15739 |
+ return sock; |
15740 |
+ } |
15741 |
+ fdput(f); |
15742 |
+diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c |
15743 |
+index cf0fd170ac18..90b8329fef82 100644 |
15744 |
+--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c |
15745 |
++++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c |
15746 |
+@@ -584,7 +584,7 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, int len, |
15747 |
+ buf->head[0].iov_len); |
15748 |
+ memmove(ptr, ptr + GSS_KRB5_TOK_HDR_LEN + headskip, movelen); |
15749 |
+ buf->head[0].iov_len -= GSS_KRB5_TOK_HDR_LEN + headskip; |
15750 |
+- buf->len = len - GSS_KRB5_TOK_HDR_LEN + headskip; |
15751 |
++ buf->len = len - (GSS_KRB5_TOK_HDR_LEN + headskip); |
15752 |
+ |
15753 |
+ /* Trim off the trailing "extra count" and checksum blob */ |
15754 |
+ xdr_buf_trim(buf, ec + GSS_KRB5_TOK_HDR_LEN + tailskip); |
15755 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
15756 |
+index 46027d0c903f..c28051f7d217 100644 |
15757 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
15758 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
15759 |
+@@ -958,7 +958,6 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs |
15760 |
+ |
15761 |
+ maj_stat = gss_unwrap(ctx, 0, priv_len, buf); |
15762 |
+ pad = priv_len - buf->len; |
15763 |
+- buf->len -= pad; |
15764 |
+ /* The upper layers assume the buffer is aligned on 4-byte boundaries. |
15765 |
+ * In the krb5p case, at least, the data ends up offset, so we need to |
15766 |
+ * move it around. */ |
15767 |
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c |
15768 |
+index 5eb35309ecef..83806fa94def 100644 |
15769 |
+--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c |
15770 |
++++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c |
15771 |
+@@ -684,7 +684,6 @@ static int svc_rdma_build_read_chunk(struct svc_rqst *rqstp, |
15772 |
+ struct svc_rdma_read_info *info, |
15773 |
+ __be32 *p) |
15774 |
+ { |
15775 |
+- unsigned int i; |
15776 |
+ int ret; |
15777 |
+ |
15778 |
+ ret = -EINVAL; |
15779 |
+@@ -707,12 +706,6 @@ static int svc_rdma_build_read_chunk(struct svc_rqst *rqstp, |
15780 |
+ info->ri_chunklen += rs_length; |
15781 |
+ } |
15782 |
+ |
15783 |
+- /* Pages under I/O have been copied to head->rc_pages. |
15784 |
+- * Prevent their premature release by svc_xprt_release() . |
15785 |
+- */ |
15786 |
+- for (i = 0; i < info->ri_readctxt->rc_page_count; i++) |
15787 |
+- rqstp->rq_pages[i] = NULL; |
15788 |
+- |
15789 |
+ return ret; |
15790 |
+ } |
15791 |
+ |
15792 |
+@@ -807,6 +800,26 @@ out: |
15793 |
+ return ret; |
15794 |
+ } |
15795 |
+ |
15796 |
++/* Pages under I/O have been copied to head->rc_pages. Ensure they |
15797 |
++ * are not released by svc_xprt_release() until the I/O is complete. |
15798 |
++ * |
15799 |
++ * This has to be done after all Read WRs are constructed to properly |
15800 |
++ * handle a page that is part of I/O on behalf of two different RDMA |
15801 |
++ * segments. |
15802 |
++ * |
15803 |
++ * Do this only if I/O has been posted. Otherwise, we do indeed want |
15804 |
++ * svc_xprt_release() to clean things up properly. |
15805 |
++ */ |
15806 |
++static void svc_rdma_save_io_pages(struct svc_rqst *rqstp, |
15807 |
++ const unsigned int start, |
15808 |
++ const unsigned int num_pages) |
15809 |
++{ |
15810 |
++ unsigned int i; |
15811 |
++ |
15812 |
++ for (i = start; i < num_pages + start; i++) |
15813 |
++ rqstp->rq_pages[i] = NULL; |
15814 |
++} |
15815 |
++ |
15816 |
+ /** |
15817 |
+ * svc_rdma_recv_read_chunk - Pull a Read chunk from the client |
15818 |
+ * @rdma: controlling RDMA transport |
15819 |
+@@ -860,6 +873,7 @@ int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma, struct svc_rqst *rqstp, |
15820 |
+ ret = svc_rdma_post_chunk_ctxt(&info->ri_cc); |
15821 |
+ if (ret < 0) |
15822 |
+ goto out_err; |
15823 |
++ svc_rdma_save_io_pages(rqstp, 0, head->rc_page_count); |
15824 |
+ return 0; |
15825 |
+ |
15826 |
+ out_err: |
15827 |
+diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c |
15828 |
+index 0e55f8365ce2..0cbad566f281 100644 |
15829 |
+--- a/net/tls/tls_device.c |
15830 |
++++ b/net/tls/tls_device.c |
15831 |
+@@ -561,7 +561,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page, |
15832 |
+ { |
15833 |
+ struct tls_context *tls_ctx = tls_get_ctx(sk); |
15834 |
+ struct iov_iter msg_iter; |
15835 |
+- char *kaddr = kmap(page); |
15836 |
++ char *kaddr; |
15837 |
+ struct kvec iov; |
15838 |
+ int rc; |
15839 |
+ |
15840 |
+@@ -576,6 +576,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page, |
15841 |
+ goto out; |
15842 |
+ } |
15843 |
+ |
15844 |
++ kaddr = kmap(page); |
15845 |
+ iov.iov_base = kaddr + offset; |
15846 |
+ iov.iov_len = size; |
15847 |
+ iov_iter_kvec(&msg_iter, WRITE, &iov, 1, size); |
15848 |
+diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c |
15849 |
+index 626bf9044418..6cd0df1c5caf 100644 |
15850 |
+--- a/net/vmw_vsock/af_vsock.c |
15851 |
++++ b/net/vmw_vsock/af_vsock.c |
15852 |
+@@ -1032,7 +1032,7 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock, |
15853 |
+ } |
15854 |
+ |
15855 |
+ /* Connected sockets that can produce data can be written. */ |
15856 |
+- if (sk->sk_state == TCP_ESTABLISHED) { |
15857 |
++ if (transport && sk->sk_state == TCP_ESTABLISHED) { |
15858 |
+ if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { |
15859 |
+ bool space_avail_now = false; |
15860 |
+ int ret = transport->notify_poll_out( |
15861 |
+diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c |
15862 |
+index d5992f787232..59f45fef5110 100644 |
15863 |
+--- a/samples/bpf/fds_example.c |
15864 |
++++ b/samples/bpf/fds_example.c |
15865 |
+@@ -30,6 +30,8 @@ |
15866 |
+ #define BPF_M_MAP 1 |
15867 |
+ #define BPF_M_PROG 2 |
15868 |
+ |
15869 |
++char bpf_log_buf[BPF_LOG_BUF_SIZE]; |
15870 |
++ |
15871 |
+ static void usage(void) |
15872 |
+ { |
15873 |
+ printf("Usage: fds_example [...]\n"); |
15874 |
+@@ -57,7 +59,6 @@ static int bpf_prog_create(const char *object) |
15875 |
+ BPF_EXIT_INSN(), |
15876 |
+ }; |
15877 |
+ size_t insns_cnt = sizeof(insns) / sizeof(struct bpf_insn); |
15878 |
+- char bpf_log_buf[BPF_LOG_BUF_SIZE]; |
15879 |
+ struct bpf_object *obj; |
15880 |
+ int prog_fd; |
15881 |
+ |
15882 |
+diff --git a/samples/bpf/map_perf_test_kern.c b/samples/bpf/map_perf_test_kern.c |
15883 |
+index 12e91ae64d4d..c9b31193ca12 100644 |
15884 |
+--- a/samples/bpf/map_perf_test_kern.c |
15885 |
++++ b/samples/bpf/map_perf_test_kern.c |
15886 |
+@@ -11,6 +11,8 @@ |
15887 |
+ #include <bpf/bpf_helpers.h> |
15888 |
+ #include "bpf_legacy.h" |
15889 |
+ #include <bpf/bpf_tracing.h> |
15890 |
++#include <bpf/bpf_core_read.h> |
15891 |
++#include "trace_common.h" |
15892 |
+ |
15893 |
+ #define MAX_ENTRIES 1000 |
15894 |
+ #define MAX_NR_CPUS 1024 |
15895 |
+@@ -154,9 +156,10 @@ int stress_percpu_hmap_alloc(struct pt_regs *ctx) |
15896 |
+ return 0; |
15897 |
+ } |
15898 |
+ |
15899 |
+-SEC("kprobe/sys_connect") |
15900 |
++SEC("kprobe/" SYSCALL(sys_connect)) |
15901 |
+ int stress_lru_hmap_alloc(struct pt_regs *ctx) |
15902 |
+ { |
15903 |
++ struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx); |
15904 |
+ char fmt[] = "Failed at stress_lru_hmap_alloc. ret:%dn"; |
15905 |
+ union { |
15906 |
+ u16 dst6[8]; |
15907 |
+@@ -175,8 +178,8 @@ int stress_lru_hmap_alloc(struct pt_regs *ctx) |
15908 |
+ long val = 1; |
15909 |
+ u32 key = 0; |
15910 |
+ |
15911 |
+- in6 = (struct sockaddr_in6 *)PT_REGS_PARM2(ctx); |
15912 |
+- addrlen = (int)PT_REGS_PARM3(ctx); |
15913 |
++ in6 = (struct sockaddr_in6 *)PT_REGS_PARM2_CORE(real_regs); |
15914 |
++ addrlen = (int)PT_REGS_PARM3_CORE(real_regs); |
15915 |
+ |
15916 |
+ if (addrlen != sizeof(*in6)) |
15917 |
+ return 0; |
15918 |
+diff --git a/samples/bpf/test_map_in_map_kern.c b/samples/bpf/test_map_in_map_kern.c |
15919 |
+index 6cee61e8ce9b..36a203e69064 100644 |
15920 |
+--- a/samples/bpf/test_map_in_map_kern.c |
15921 |
++++ b/samples/bpf/test_map_in_map_kern.c |
15922 |
+@@ -13,6 +13,8 @@ |
15923 |
+ #include <bpf/bpf_helpers.h> |
15924 |
+ #include "bpf_legacy.h" |
15925 |
+ #include <bpf/bpf_tracing.h> |
15926 |
++#include <bpf/bpf_core_read.h> |
15927 |
++#include "trace_common.h" |
15928 |
+ |
15929 |
+ #define MAX_NR_PORTS 65536 |
15930 |
+ |
15931 |
+@@ -102,9 +104,10 @@ static __always_inline int do_inline_hash_lookup(void *inner_map, u32 port) |
15932 |
+ return result ? *result : -ENOENT; |
15933 |
+ } |
15934 |
+ |
15935 |
+-SEC("kprobe/sys_connect") |
15936 |
++SEC("kprobe/" SYSCALL(sys_connect)) |
15937 |
+ int trace_sys_connect(struct pt_regs *ctx) |
15938 |
+ { |
15939 |
++ struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx); |
15940 |
+ struct sockaddr_in6 *in6; |
15941 |
+ u16 test_case, port, dst6[8]; |
15942 |
+ int addrlen, ret, inline_ret, ret_key = 0; |
15943 |
+@@ -112,8 +115,8 @@ int trace_sys_connect(struct pt_regs *ctx) |
15944 |
+ void *outer_map, *inner_map; |
15945 |
+ bool inline_hash = false; |
15946 |
+ |
15947 |
+- in6 = (struct sockaddr_in6 *)PT_REGS_PARM2(ctx); |
15948 |
+- addrlen = (int)PT_REGS_PARM3(ctx); |
15949 |
++ in6 = (struct sockaddr_in6 *)PT_REGS_PARM2_CORE(real_regs); |
15950 |
++ addrlen = (int)PT_REGS_PARM3_CORE(real_regs); |
15951 |
+ |
15952 |
+ if (addrlen != sizeof(*in6)) |
15953 |
+ return 0; |
15954 |
+diff --git a/samples/bpf/test_probe_write_user_kern.c b/samples/bpf/test_probe_write_user_kern.c |
15955 |
+index f033f36a13a3..fd651a65281e 100644 |
15956 |
+--- a/samples/bpf/test_probe_write_user_kern.c |
15957 |
++++ b/samples/bpf/test_probe_write_user_kern.c |
15958 |
+@@ -10,6 +10,8 @@ |
15959 |
+ #include <linux/version.h> |
15960 |
+ #include <bpf/bpf_helpers.h> |
15961 |
+ #include <bpf/bpf_tracing.h> |
15962 |
++#include <bpf/bpf_core_read.h> |
15963 |
++#include "trace_common.h" |
15964 |
+ |
15965 |
+ struct bpf_map_def SEC("maps") dnat_map = { |
15966 |
+ .type = BPF_MAP_TYPE_HASH, |
15967 |
+@@ -26,13 +28,14 @@ struct bpf_map_def SEC("maps") dnat_map = { |
15968 |
+ * This example sits on a syscall, and the syscall ABI is relatively stable |
15969 |
+ * of course, across platforms, and over time, the ABI may change. |
15970 |
+ */ |
15971 |
+-SEC("kprobe/sys_connect") |
15972 |
++SEC("kprobe/" SYSCALL(sys_connect)) |
15973 |
+ int bpf_prog1(struct pt_regs *ctx) |
15974 |
+ { |
15975 |
++ struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1_CORE(ctx); |
15976 |
++ void *sockaddr_arg = (void *)PT_REGS_PARM2_CORE(real_regs); |
15977 |
++ int sockaddr_len = (int)PT_REGS_PARM3_CORE(real_regs); |
15978 |
+ struct sockaddr_in new_addr, orig_addr = {}; |
15979 |
+ struct sockaddr_in *mapped_addr; |
15980 |
+- void *sockaddr_arg = (void *)PT_REGS_PARM2(ctx); |
15981 |
+- int sockaddr_len = (int)PT_REGS_PARM3(ctx); |
15982 |
+ |
15983 |
+ if (sockaddr_len > sizeof(orig_addr)) |
15984 |
+ return 0; |
15985 |
+diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c |
15986 |
+index 7225107a9aaf..e59022b3f125 100644 |
15987 |
+--- a/scripts/recordmcount.c |
15988 |
++++ b/scripts/recordmcount.c |
15989 |
+@@ -434,6 +434,11 @@ static int arm_is_fake_mcount(Elf32_Rel const *rp) |
15990 |
+ return 1; |
15991 |
+ } |
15992 |
+ |
15993 |
++static int arm64_is_fake_mcount(Elf64_Rel const *rp) |
15994 |
++{ |
15995 |
++ return ELF64_R_TYPE(w(rp->r_info)) != R_AARCH64_CALL26; |
15996 |
++} |
15997 |
++ |
15998 |
+ /* 64-bit EM_MIPS has weird ELF64_Rela.r_info. |
15999 |
+ * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf |
16000 |
+ * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40] |
16001 |
+@@ -547,6 +552,7 @@ static int do_file(char const *const fname) |
16002 |
+ make_nop = make_nop_arm64; |
16003 |
+ rel_type_nop = R_AARCH64_NONE; |
16004 |
+ ideal_nop = ideal_nop4_arm64; |
16005 |
++ is_fake_mcount64 = arm64_is_fake_mcount; |
16006 |
+ break; |
16007 |
+ case EM_IA_64: reltype = R_IA64_IMM64; break; |
16008 |
+ case EM_MIPS: /* reltype: e_class */ break; |
16009 |
+diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c |
16010 |
+index 576d11a60417..6ceb88eb9b59 100644 |
16011 |
+--- a/scripts/selinux/mdp/mdp.c |
16012 |
++++ b/scripts/selinux/mdp/mdp.c |
16013 |
+@@ -67,8 +67,14 @@ int main(int argc, char *argv[]) |
16014 |
+ |
16015 |
+ initial_sid_to_string_len = sizeof(initial_sid_to_string) / sizeof (char *); |
16016 |
+ /* print out the sids */ |
16017 |
+- for (i = 1; i < initial_sid_to_string_len; i++) |
16018 |
+- fprintf(fout, "sid %s\n", initial_sid_to_string[i]); |
16019 |
++ for (i = 1; i < initial_sid_to_string_len; i++) { |
16020 |
++ const char *name = initial_sid_to_string[i]; |
16021 |
++ |
16022 |
++ if (name) |
16023 |
++ fprintf(fout, "sid %s\n", name); |
16024 |
++ else |
16025 |
++ fprintf(fout, "sid unused%d\n", i); |
16026 |
++ } |
16027 |
+ fprintf(fout, "\n"); |
16028 |
+ |
16029 |
+ /* print out the class permissions */ |
16030 |
+@@ -126,9 +132,16 @@ int main(int argc, char *argv[]) |
16031 |
+ #define OBJUSERROLETYPE "user_u:object_r:base_t" |
16032 |
+ |
16033 |
+ /* default sids */ |
16034 |
+- for (i = 1; i < initial_sid_to_string_len; i++) |
16035 |
+- fprintf(fout, "sid %s " SUBJUSERROLETYPE "%s\n", |
16036 |
+- initial_sid_to_string[i], mls ? ":" SYSTEMLOW : ""); |
16037 |
++ for (i = 1; i < initial_sid_to_string_len; i++) { |
16038 |
++ const char *name = initial_sid_to_string[i]; |
16039 |
++ |
16040 |
++ if (name) |
16041 |
++ fprintf(fout, "sid %s ", name); |
16042 |
++ else |
16043 |
++ fprintf(fout, "sid unused%d\n", i); |
16044 |
++ fprintf(fout, SUBJUSERROLETYPE "%s\n", |
16045 |
++ mls ? ":" SYSTEMLOW : ""); |
16046 |
++ } |
16047 |
+ fprintf(fout, "\n"); |
16048 |
+ |
16049 |
+ #define FS_USE(behavior, fstype) \ |
16050 |
+diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h |
16051 |
+index 9d94080bdad8..f0748f8ca47e 100644 |
16052 |
+--- a/security/integrity/ima/ima.h |
16053 |
++++ b/security/integrity/ima/ima.h |
16054 |
+@@ -404,6 +404,7 @@ static inline void ima_free_modsig(struct modsig *modsig) |
16055 |
+ #ifdef CONFIG_IMA_LSM_RULES |
16056 |
+ |
16057 |
+ #define security_filter_rule_init security_audit_rule_init |
16058 |
++#define security_filter_rule_free security_audit_rule_free |
16059 |
+ #define security_filter_rule_match security_audit_rule_match |
16060 |
+ |
16061 |
+ #else |
16062 |
+@@ -414,6 +415,10 @@ static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr, |
16063 |
+ return -EINVAL; |
16064 |
+ } |
16065 |
+ |
16066 |
++static inline void security_filter_rule_free(void *lsmrule) |
16067 |
++{ |
16068 |
++} |
16069 |
++ |
16070 |
+ static inline int security_filter_rule_match(u32 secid, u32 field, u32 op, |
16071 |
+ void *lsmrule) |
16072 |
+ { |
16073 |
+diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c |
16074 |
+index e493063a3c34..3e3e568c8130 100644 |
16075 |
+--- a/security/integrity/ima/ima_policy.c |
16076 |
++++ b/security/integrity/ima/ima_policy.c |
16077 |
+@@ -258,9 +258,24 @@ static void ima_lsm_free_rule(struct ima_rule_entry *entry) |
16078 |
+ int i; |
16079 |
+ |
16080 |
+ for (i = 0; i < MAX_LSM_RULES; i++) { |
16081 |
+- kfree(entry->lsm[i].rule); |
16082 |
++ security_filter_rule_free(entry->lsm[i].rule); |
16083 |
+ kfree(entry->lsm[i].args_p); |
16084 |
+ } |
16085 |
++} |
16086 |
++ |
16087 |
++static void ima_free_rule(struct ima_rule_entry *entry) |
16088 |
++{ |
16089 |
++ if (!entry) |
16090 |
++ return; |
16091 |
++ |
16092 |
++ /* |
16093 |
++ * entry->template->fields may be allocated in ima_parse_rule() but that |
16094 |
++ * reference is owned by the corresponding ima_template_desc element in |
16095 |
++ * the defined_templates list and cannot be freed here |
16096 |
++ */ |
16097 |
++ kfree(entry->fsname); |
16098 |
++ kfree(entry->keyrings); |
16099 |
++ ima_lsm_free_rule(entry); |
16100 |
+ kfree(entry); |
16101 |
+ } |
16102 |
+ |
16103 |
+@@ -302,6 +317,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry) |
16104 |
+ |
16105 |
+ out_err: |
16106 |
+ ima_lsm_free_rule(nentry); |
16107 |
++ kfree(nentry); |
16108 |
+ return NULL; |
16109 |
+ } |
16110 |
+ |
16111 |
+@@ -315,11 +331,29 @@ static int ima_lsm_update_rule(struct ima_rule_entry *entry) |
16112 |
+ |
16113 |
+ list_replace_rcu(&entry->list, &nentry->list); |
16114 |
+ synchronize_rcu(); |
16115 |
++ /* |
16116 |
++ * ima_lsm_copy_rule() shallow copied all references, except for the |
16117 |
++ * LSM references, from entry to nentry so we only want to free the LSM |
16118 |
++ * references and the entry itself. All other memory refrences will now |
16119 |
++ * be owned by nentry. |
16120 |
++ */ |
16121 |
+ ima_lsm_free_rule(entry); |
16122 |
++ kfree(entry); |
16123 |
+ |
16124 |
+ return 0; |
16125 |
+ } |
16126 |
+ |
16127 |
++static bool ima_rule_contains_lsm_cond(struct ima_rule_entry *entry) |
16128 |
++{ |
16129 |
++ int i; |
16130 |
++ |
16131 |
++ for (i = 0; i < MAX_LSM_RULES; i++) |
16132 |
++ if (entry->lsm[i].args_p) |
16133 |
++ return true; |
16134 |
++ |
16135 |
++ return false; |
16136 |
++} |
16137 |
++ |
16138 |
+ /* |
16139 |
+ * The LSM policy can be reloaded, leaving the IMA LSM based rules referring |
16140 |
+ * to the old, stale LSM policy. Update the IMA LSM based rules to reflect |
16141 |
+@@ -890,6 +924,7 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry, |
16142 |
+ |
16143 |
+ if (ima_rules == &ima_default_rules) { |
16144 |
+ kfree(entry->lsm[lsm_rule].args_p); |
16145 |
++ entry->lsm[lsm_rule].args_p = NULL; |
16146 |
+ result = -EINVAL; |
16147 |
+ } else |
16148 |
+ result = 0; |
16149 |
+@@ -949,6 +984,60 @@ static void check_template_modsig(const struct ima_template_desc *template) |
16150 |
+ #undef MSG |
16151 |
+ } |
16152 |
+ |
16153 |
++static bool ima_validate_rule(struct ima_rule_entry *entry) |
16154 |
++{ |
16155 |
++ /* Ensure that the action is set */ |
16156 |
++ if (entry->action == UNKNOWN) |
16157 |
++ return false; |
16158 |
++ |
16159 |
++ /* |
16160 |
++ * Ensure that the hook function is compatible with the other |
16161 |
++ * components of the rule |
16162 |
++ */ |
16163 |
++ switch (entry->func) { |
16164 |
++ case NONE: |
16165 |
++ case FILE_CHECK: |
16166 |
++ case MMAP_CHECK: |
16167 |
++ case BPRM_CHECK: |
16168 |
++ case CREDS_CHECK: |
16169 |
++ case POST_SETATTR: |
16170 |
++ case MODULE_CHECK: |
16171 |
++ case FIRMWARE_CHECK: |
16172 |
++ case KEXEC_KERNEL_CHECK: |
16173 |
++ case KEXEC_INITRAMFS_CHECK: |
16174 |
++ case POLICY_CHECK: |
16175 |
++ /* Validation of these hook functions is in ima_parse_rule() */ |
16176 |
++ break; |
16177 |
++ case KEXEC_CMDLINE: |
16178 |
++ if (entry->action & ~(MEASURE | DONT_MEASURE)) |
16179 |
++ return false; |
16180 |
++ |
16181 |
++ if (entry->flags & ~(IMA_FUNC | IMA_PCR)) |
16182 |
++ return false; |
16183 |
++ |
16184 |
++ if (ima_rule_contains_lsm_cond(entry)) |
16185 |
++ return false; |
16186 |
++ |
16187 |
++ break; |
16188 |
++ case KEY_CHECK: |
16189 |
++ if (entry->action & ~(MEASURE | DONT_MEASURE)) |
16190 |
++ return false; |
16191 |
++ |
16192 |
++ if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_PCR | |
16193 |
++ IMA_KEYRINGS)) |
16194 |
++ return false; |
16195 |
++ |
16196 |
++ if (ima_rule_contains_lsm_cond(entry)) |
16197 |
++ return false; |
16198 |
++ |
16199 |
++ break; |
16200 |
++ default: |
16201 |
++ return false; |
16202 |
++ } |
16203 |
++ |
16204 |
++ return true; |
16205 |
++} |
16206 |
++ |
16207 |
+ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
16208 |
+ { |
16209 |
+ struct audit_buffer *ab; |
16210 |
+@@ -1126,7 +1215,6 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
16211 |
+ keyrings_len = strlen(args[0].from) + 1; |
16212 |
+ |
16213 |
+ if ((entry->keyrings) || |
16214 |
+- (entry->action != MEASURE) || |
16215 |
+ (entry->func != KEY_CHECK) || |
16216 |
+ (keyrings_len < 2)) { |
16217 |
+ result = -EINVAL; |
16218 |
+@@ -1332,7 +1420,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) |
16219 |
+ break; |
16220 |
+ } |
16221 |
+ } |
16222 |
+- if (!result && (entry->action == UNKNOWN)) |
16223 |
++ if (!result && !ima_validate_rule(entry)) |
16224 |
+ result = -EINVAL; |
16225 |
+ else if (entry->action == APPRAISE) |
16226 |
+ temp_ima_appraise |= ima_appraise_flag(entry->func); |
16227 |
+@@ -1381,7 +1469,7 @@ ssize_t ima_parse_add_rule(char *rule) |
16228 |
+ |
16229 |
+ result = ima_parse_rule(p, entry); |
16230 |
+ if (result) { |
16231 |
+- kfree(entry); |
16232 |
++ ima_free_rule(entry); |
16233 |
+ integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, |
16234 |
+ NULL, op, "invalid-policy", result, |
16235 |
+ audit_info); |
16236 |
+@@ -1402,15 +1490,11 @@ ssize_t ima_parse_add_rule(char *rule) |
16237 |
+ void ima_delete_rules(void) |
16238 |
+ { |
16239 |
+ struct ima_rule_entry *entry, *tmp; |
16240 |
+- int i; |
16241 |
+ |
16242 |
+ temp_ima_appraise = 0; |
16243 |
+ list_for_each_entry_safe(entry, tmp, &ima_temp_rules, list) { |
16244 |
+- for (i = 0; i < MAX_LSM_RULES; i++) |
16245 |
+- kfree(entry->lsm[i].args_p); |
16246 |
+- |
16247 |
+ list_del(&entry->list); |
16248 |
+- kfree(entry); |
16249 |
++ ima_free_rule(entry); |
16250 |
+ } |
16251 |
+ } |
16252 |
+ |
16253 |
+diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c |
16254 |
+index 840a192e9337..9c4308077574 100644 |
16255 |
+--- a/security/smack/smackfs.c |
16256 |
++++ b/security/smack/smackfs.c |
16257 |
+@@ -884,7 +884,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, |
16258 |
+ } |
16259 |
+ |
16260 |
+ ret = sscanf(rule, "%d", &maplevel); |
16261 |
+- if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) |
16262 |
++ if (ret != 1 || maplevel < 0 || maplevel > SMACK_CIPSO_MAXLEVEL) |
16263 |
+ goto out; |
16264 |
+ |
16265 |
+ rule += SMK_DIGITLEN; |
16266 |
+@@ -905,6 +905,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, |
16267 |
+ |
16268 |
+ for (i = 0; i < catlen; i++) { |
16269 |
+ rule += SMK_DIGITLEN; |
16270 |
++ if (rule > data + count) { |
16271 |
++ rc = -EOVERFLOW; |
16272 |
++ goto out; |
16273 |
++ } |
16274 |
+ ret = sscanf(rule, "%u", &cat); |
16275 |
+ if (ret != 1 || cat > SMACK_CIPSO_MAXCATNUM) |
16276 |
+ goto out; |
16277 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
16278 |
+index 417c8e17d839..00d155b98c1d 100644 |
16279 |
+--- a/sound/pci/hda/patch_realtek.c |
16280 |
++++ b/sound/pci/hda/patch_realtek.c |
16281 |
+@@ -4118,7 +4118,7 @@ static int micmute_led_set(struct led_classdev *led_cdev, |
16282 |
+ struct alc_spec *spec = codec->spec; |
16283 |
+ |
16284 |
+ alc_update_gpio_led(codec, spec->gpio_mic_led_mask, |
16285 |
+- spec->micmute_led_polarity, !!brightness); |
16286 |
++ spec->micmute_led_polarity, !brightness); |
16287 |
+ return 0; |
16288 |
+ } |
16289 |
+ |
16290 |
+@@ -4173,8 +4173,6 @@ static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, |
16291 |
+ { |
16292 |
+ struct alc_spec *spec = codec->spec; |
16293 |
+ |
16294 |
+- spec->micmute_led_polarity = 1; |
16295 |
+- |
16296 |
+ alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); |
16297 |
+ } |
16298 |
+ |
16299 |
+diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c |
16300 |
+index 473efe9ef998..b0370bb10c14 100644 |
16301 |
+--- a/sound/soc/codecs/hdac_hda.c |
16302 |
++++ b/sound/soc/codecs/hdac_hda.c |
16303 |
+@@ -289,7 +289,6 @@ static int hdac_hda_dai_open(struct snd_pcm_substream *substream, |
16304 |
+ struct hdac_hda_priv *hda_pvt; |
16305 |
+ struct hda_pcm_stream *hda_stream; |
16306 |
+ struct hda_pcm *pcm; |
16307 |
+- int ret; |
16308 |
+ |
16309 |
+ hda_pvt = snd_soc_component_get_drvdata(component); |
16310 |
+ pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai); |
16311 |
+@@ -300,11 +299,7 @@ static int hdac_hda_dai_open(struct snd_pcm_substream *substream, |
16312 |
+ |
16313 |
+ hda_stream = &pcm->stream[substream->stream]; |
16314 |
+ |
16315 |
+- ret = hda_stream->ops.open(hda_stream, &hda_pvt->codec, substream); |
16316 |
+- if (ret < 0) |
16317 |
+- snd_hda_codec_pcm_put(pcm); |
16318 |
+- |
16319 |
+- return ret; |
16320 |
++ return hda_stream->ops.open(hda_stream, &hda_pvt->codec, substream); |
16321 |
+ } |
16322 |
+ |
16323 |
+ static void hdac_hda_dai_close(struct snd_pcm_substream *substream, |
16324 |
+diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c |
16325 |
+index 54c8135fe43c..cf071121c839 100644 |
16326 |
+--- a/sound/soc/codecs/tas2770.c |
16327 |
++++ b/sound/soc/codecs/tas2770.c |
16328 |
+@@ -758,8 +758,7 @@ static int tas2770_i2c_probe(struct i2c_client *client, |
16329 |
+ } |
16330 |
+ } |
16331 |
+ |
16332 |
+- tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, |
16333 |
+- "reset-gpio", |
16334 |
++ tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset", |
16335 |
+ GPIOD_OUT_HIGH); |
16336 |
+ if (IS_ERR(tas2770->reset_gpio)) { |
16337 |
+ if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) { |
16338 |
+diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c |
16339 |
+index c6b5eb2d2af7..fff1f02dadfe 100644 |
16340 |
+--- a/sound/soc/fsl/fsl_easrc.c |
16341 |
++++ b/sound/soc/fsl/fsl_easrc.c |
16342 |
+@@ -1133,7 +1133,7 @@ int fsl_easrc_set_ctx_format(struct fsl_asrc_pair *ctx, |
16343 |
+ struct fsl_easrc_ctx_priv *ctx_priv = ctx->private; |
16344 |
+ struct fsl_easrc_data_fmt *in_fmt = &ctx_priv->in_params.fmt; |
16345 |
+ struct fsl_easrc_data_fmt *out_fmt = &ctx_priv->out_params.fmt; |
16346 |
+- int ret; |
16347 |
++ int ret = 0; |
16348 |
+ |
16349 |
+ /* Get the bitfield values for input data format */ |
16350 |
+ if (in_raw_format && out_raw_format) { |
16351 |
+diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c |
16352 |
+index 9d436b0c5718..7031869a023a 100644 |
16353 |
+--- a/sound/soc/fsl/fsl_sai.c |
16354 |
++++ b/sound/soc/fsl/fsl_sai.c |
16355 |
+@@ -680,10 +680,11 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai) |
16356 |
+ regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0); |
16357 |
+ |
16358 |
+ regmap_update_bits(sai->regmap, FSL_SAI_TCR1(ofs), |
16359 |
+- FSL_SAI_CR1_RFW_MASK, |
16360 |
++ FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), |
16361 |
+ sai->soc_data->fifo_depth - FSL_SAI_MAXBURST_TX); |
16362 |
+ regmap_update_bits(sai->regmap, FSL_SAI_RCR1(ofs), |
16363 |
+- FSL_SAI_CR1_RFW_MASK, FSL_SAI_MAXBURST_RX - 1); |
16364 |
++ FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), |
16365 |
++ FSL_SAI_MAXBURST_RX - 1); |
16366 |
+ |
16367 |
+ snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx, |
16368 |
+ &sai->dma_params_rx); |
16369 |
+diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h |
16370 |
+index 76b15deea80c..6aba7d28f5f3 100644 |
16371 |
+--- a/sound/soc/fsl/fsl_sai.h |
16372 |
++++ b/sound/soc/fsl/fsl_sai.h |
16373 |
+@@ -94,7 +94,7 @@ |
16374 |
+ #define FSL_SAI_CSR_FRDE BIT(0) |
16375 |
+ |
16376 |
+ /* SAI Transmit and Receive Configuration 1 Register */ |
16377 |
+-#define FSL_SAI_CR1_RFW_MASK 0x1f |
16378 |
++#define FSL_SAI_CR1_RFW_MASK(x) ((x) - 1) |
16379 |
+ |
16380 |
+ /* SAI Transmit and Receive Configuration 2 Register */ |
16381 |
+ #define FSL_SAI_CR2_SYNC BIT(30) |
16382 |
+diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c |
16383 |
+index 7a4decf34191..c84c60df17db 100644 |
16384 |
+--- a/sound/soc/intel/boards/bxt_rt298.c |
16385 |
++++ b/sound/soc/intel/boards/bxt_rt298.c |
16386 |
+@@ -565,6 +565,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card) |
16387 |
+ /* broxton audio machine driver for SPT + RT298S */ |
16388 |
+ static struct snd_soc_card broxton_rt298 = { |
16389 |
+ .name = "broxton-rt298", |
16390 |
++ .owner = THIS_MODULE, |
16391 |
+ .dai_link = broxton_rt298_dais, |
16392 |
+ .num_links = ARRAY_SIZE(broxton_rt298_dais), |
16393 |
+ .controls = broxton_controls, |
16394 |
+@@ -580,6 +581,7 @@ static struct snd_soc_card broxton_rt298 = { |
16395 |
+ |
16396 |
+ static struct snd_soc_card geminilake_rt298 = { |
16397 |
+ .name = "geminilake-rt298", |
16398 |
++ .owner = THIS_MODULE, |
16399 |
+ .dai_link = broxton_rt298_dais, |
16400 |
+ .num_links = ARRAY_SIZE(broxton_rt298_dais), |
16401 |
+ .controls = broxton_controls, |
16402 |
+diff --git a/sound/soc/intel/boards/cml_rt1011_rt5682.c b/sound/soc/intel/boards/cml_rt1011_rt5682.c |
16403 |
+index 68eff29daf8f..23dd8c5fc1e7 100644 |
16404 |
+--- a/sound/soc/intel/boards/cml_rt1011_rt5682.c |
16405 |
++++ b/sound/soc/intel/boards/cml_rt1011_rt5682.c |
16406 |
+@@ -34,7 +34,6 @@ |
16407 |
+ #define SOF_RT1011_SPEAKER_WR BIT(1) |
16408 |
+ #define SOF_RT1011_SPEAKER_TL BIT(2) |
16409 |
+ #define SOF_RT1011_SPEAKER_TR BIT(3) |
16410 |
+-#define SPK_CH 4 |
16411 |
+ |
16412 |
+ /* Default: Woofer speakers */ |
16413 |
+ static unsigned long sof_rt1011_quirk = SOF_RT1011_SPEAKER_WL | |
16414 |
+@@ -376,10 +375,17 @@ SND_SOC_DAILINK_DEF(ssp0_codec, |
16415 |
+ |
16416 |
+ SND_SOC_DAILINK_DEF(ssp1_pin, |
16417 |
+ DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin"))); |
16418 |
+-SND_SOC_DAILINK_DEF(ssp1_codec, |
16419 |
++SND_SOC_DAILINK_DEF(ssp1_codec_2spk, |
16420 |
+ DAILINK_COMP_ARRAY( |
16421 |
+ /* WL */ COMP_CODEC("i2c-10EC1011:00", CML_RT1011_CODEC_DAI), |
16422 |
+ /* WR */ COMP_CODEC("i2c-10EC1011:01", CML_RT1011_CODEC_DAI))); |
16423 |
++SND_SOC_DAILINK_DEF(ssp1_codec_4spk, |
16424 |
++ DAILINK_COMP_ARRAY( |
16425 |
++ /* WL */ COMP_CODEC("i2c-10EC1011:00", CML_RT1011_CODEC_DAI), |
16426 |
++ /* WR */ COMP_CODEC("i2c-10EC1011:01", CML_RT1011_CODEC_DAI), |
16427 |
++ /* TL */ COMP_CODEC("i2c-10EC1011:02", CML_RT1011_CODEC_DAI), |
16428 |
++ /* TR */ COMP_CODEC("i2c-10EC1011:03", CML_RT1011_CODEC_DAI))); |
16429 |
++ |
16430 |
+ |
16431 |
+ SND_SOC_DAILINK_DEF(dmic_pin, |
16432 |
+ DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin"))); |
16433 |
+@@ -475,7 +481,7 @@ static struct snd_soc_dai_link cml_rt1011_rt5682_dailink[] = { |
16434 |
+ .no_pcm = 1, |
16435 |
+ .init = cml_rt1011_spk_init, |
16436 |
+ .ops = &cml_rt1011_ops, |
16437 |
+- SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform), |
16438 |
++ SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec_2spk, platform), |
16439 |
+ }, |
16440 |
+ }; |
16441 |
+ |
16442 |
+@@ -488,11 +494,21 @@ static struct snd_soc_codec_conf rt1011_conf[] = { |
16443 |
+ .dlc = COMP_CODEC_CONF("i2c-10EC1011:01"), |
16444 |
+ .name_prefix = "WR", |
16445 |
+ }, |
16446 |
++ /* single configuration structure for 2 and 4 channels */ |
16447 |
++ { |
16448 |
++ .dlc = COMP_CODEC_CONF("i2c-10EC1011:02"), |
16449 |
++ .name_prefix = "TL", |
16450 |
++ }, |
16451 |
++ { |
16452 |
++ .dlc = COMP_CODEC_CONF("i2c-10EC1011:03"), |
16453 |
++ .name_prefix = "TR", |
16454 |
++ }, |
16455 |
+ }; |
16456 |
+ |
16457 |
+ /* Cometlake audio machine driver for RT1011 and RT5682 */ |
16458 |
+ static struct snd_soc_card snd_soc_card_cml = { |
16459 |
+ .name = "cml_rt1011_rt5682", |
16460 |
++ .owner = THIS_MODULE, |
16461 |
+ .dai_link = cml_rt1011_rt5682_dailink, |
16462 |
+ .num_links = ARRAY_SIZE(cml_rt1011_rt5682_dailink), |
16463 |
+ .codec_conf = rt1011_conf, |
16464 |
+@@ -509,8 +525,6 @@ static struct snd_soc_card snd_soc_card_cml = { |
16465 |
+ |
16466 |
+ static int snd_cml_rt1011_probe(struct platform_device *pdev) |
16467 |
+ { |
16468 |
+- struct snd_soc_dai_link_component *rt1011_dais_components; |
16469 |
+- struct snd_soc_codec_conf *rt1011_dais_confs; |
16470 |
+ struct card_private *ctx; |
16471 |
+ struct snd_soc_acpi_mach *mach; |
16472 |
+ const char *platform_name; |
16473 |
+@@ -529,65 +543,15 @@ static int snd_cml_rt1011_probe(struct platform_device *pdev) |
16474 |
+ |
16475 |
+ dev_info(&pdev->dev, "sof_rt1011_quirk = %lx\n", sof_rt1011_quirk); |
16476 |
+ |
16477 |
++ /* when 4 speaker is available, update codec config */ |
16478 |
+ if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_TL | |
16479 |
+ SOF_RT1011_SPEAKER_TR)) { |
16480 |
+- rt1011_dais_confs = devm_kzalloc(&pdev->dev, |
16481 |
+- sizeof(struct snd_soc_codec_conf) * |
16482 |
+- SPK_CH, GFP_KERNEL); |
16483 |
+- |
16484 |
+- if (!rt1011_dais_confs) |
16485 |
+- return -ENOMEM; |
16486 |
+- |
16487 |
+- rt1011_dais_components = devm_kzalloc(&pdev->dev, |
16488 |
+- sizeof(struct snd_soc_dai_link_component) * |
16489 |
+- SPK_CH, GFP_KERNEL); |
16490 |
+- |
16491 |
+- if (!rt1011_dais_components) |
16492 |
+- return -ENOMEM; |
16493 |
+- |
16494 |
+- for (i = 0; i < SPK_CH; i++) { |
16495 |
+- rt1011_dais_confs[i].dlc.name = devm_kasprintf(&pdev->dev, |
16496 |
+- GFP_KERNEL, |
16497 |
+- "i2c-10EC1011:0%d", |
16498 |
+- i); |
16499 |
+- |
16500 |
+- if (!rt1011_dais_confs[i].dlc.name) |
16501 |
+- return -ENOMEM; |
16502 |
+- |
16503 |
+- switch (i) { |
16504 |
+- case 0: |
16505 |
+- rt1011_dais_confs[i].name_prefix = "WL"; |
16506 |
+- break; |
16507 |
+- case 1: |
16508 |
+- rt1011_dais_confs[i].name_prefix = "WR"; |
16509 |
+- break; |
16510 |
+- case 2: |
16511 |
+- rt1011_dais_confs[i].name_prefix = "TL"; |
16512 |
+- break; |
16513 |
+- case 3: |
16514 |
+- rt1011_dais_confs[i].name_prefix = "TR"; |
16515 |
+- break; |
16516 |
+- default: |
16517 |
+- return -EINVAL; |
16518 |
+- } |
16519 |
+- rt1011_dais_components[i].name = devm_kasprintf(&pdev->dev, |
16520 |
+- GFP_KERNEL, |
16521 |
+- "i2c-10EC1011:0%d", |
16522 |
+- i); |
16523 |
+- if (!rt1011_dais_components[i].name) |
16524 |
+- return -ENOMEM; |
16525 |
+- |
16526 |
+- rt1011_dais_components[i].dai_name = CML_RT1011_CODEC_DAI; |
16527 |
+- } |
16528 |
+- |
16529 |
+- snd_soc_card_cml.codec_conf = rt1011_dais_confs; |
16530 |
+- snd_soc_card_cml.num_configs = SPK_CH; |
16531 |
+- |
16532 |
+ for (i = 0; i < ARRAY_SIZE(cml_rt1011_rt5682_dailink); i++) { |
16533 |
+ if (!strcmp(cml_rt1011_rt5682_dailink[i].codecs->dai_name, |
16534 |
+- CML_RT1011_CODEC_DAI)) { |
16535 |
+- cml_rt1011_rt5682_dailink[i].codecs = rt1011_dais_components; |
16536 |
+- cml_rt1011_rt5682_dailink[i].num_codecs = SPK_CH; |
16537 |
++ CML_RT1011_CODEC_DAI)) { |
16538 |
++ cml_rt1011_rt5682_dailink[i].codecs = ssp1_codec_4spk; |
16539 |
++ cml_rt1011_rt5682_dailink[i].num_codecs = |
16540 |
++ ARRAY_SIZE(ssp1_codec_4spk); |
16541 |
+ } |
16542 |
+ } |
16543 |
+ } |
16544 |
+diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c |
16545 |
+index e1c1a8ba78e6..1bfd9613449e 100644 |
16546 |
+--- a/sound/soc/intel/boards/sof_sdw.c |
16547 |
++++ b/sound/soc/intel/boards/sof_sdw.c |
16548 |
+@@ -893,6 +893,7 @@ static const char sdw_card_long_name[] = "Intel Soundwire SOF"; |
16549 |
+ |
16550 |
+ static struct snd_soc_card card_sof_sdw = { |
16551 |
+ .name = "soundwire", |
16552 |
++ .owner = THIS_MODULE, |
16553 |
+ .late_probe = sof_sdw_hdmi_card_late_probe, |
16554 |
+ .codec_conf = codec_conf, |
16555 |
+ .num_configs = ARRAY_SIZE(codec_conf), |
16556 |
+diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c |
16557 |
+index 89f7f64747cd..33058518c3da 100644 |
16558 |
+--- a/sound/soc/meson/axg-card.c |
16559 |
++++ b/sound/soc/meson/axg-card.c |
16560 |
+@@ -116,7 +116,7 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card, |
16561 |
+ |
16562 |
+ lb = &card->dai_link[*index + 1]; |
16563 |
+ |
16564 |
+- lb->name = kasprintf(GFP_KERNEL, "%s-lb", pad->name); |
16565 |
++ lb->name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-lb", pad->name); |
16566 |
+ if (!lb->name) |
16567 |
+ return -ENOMEM; |
16568 |
+ |
16569 |
+@@ -327,20 +327,22 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, |
16570 |
+ return ret; |
16571 |
+ |
16572 |
+ if (axg_card_cpu_is_playback_fe(dai_link->cpus->of_node)) |
16573 |
+- ret = meson_card_set_fe_link(card, dai_link, np, true); |
16574 |
++ return meson_card_set_fe_link(card, dai_link, np, true); |
16575 |
+ else if (axg_card_cpu_is_capture_fe(dai_link->cpus->of_node)) |
16576 |
+- ret = meson_card_set_fe_link(card, dai_link, np, false); |
16577 |
+- else |
16578 |
+- ret = meson_card_set_be_link(card, dai_link, np); |
16579 |
++ return meson_card_set_fe_link(card, dai_link, np, false); |
16580 |
+ |
16581 |
++ |
16582 |
++ ret = meson_card_set_be_link(card, dai_link, np); |
16583 |
+ if (ret) |
16584 |
+ return ret; |
16585 |
+ |
16586 |
+- if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) |
16587 |
+- ret = axg_card_parse_tdm(card, np, index); |
16588 |
+- else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) { |
16589 |
++ if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) { |
16590 |
+ dai_link->params = &codec_params; |
16591 |
+- dai_link->no_pcm = 0; /* link is not a DPCM BE */ |
16592 |
++ } else { |
16593 |
++ dai_link->no_pcm = 1; |
16594 |
++ snd_soc_dai_link_set_capabilities(dai_link); |
16595 |
++ if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) |
16596 |
++ ret = axg_card_parse_tdm(card, np, index); |
16597 |
+ } |
16598 |
+ |
16599 |
+ return ret; |
16600 |
+diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c |
16601 |
+index 358c8c0d861c..f7e8e9da68a0 100644 |
16602 |
+--- a/sound/soc/meson/axg-tdm-formatter.c |
16603 |
++++ b/sound/soc/meson/axg-tdm-formatter.c |
16604 |
+@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks); |
16605 |
+ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) |
16606 |
+ { |
16607 |
+ struct axg_tdm_stream *ts = formatter->stream; |
16608 |
+- bool invert = formatter->drv->quirks->invert_sclk; |
16609 |
++ bool invert; |
16610 |
+ int ret; |
16611 |
+ |
16612 |
+ /* Do nothing if the formatter is already enabled */ |
16613 |
+@@ -96,11 +96,12 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) |
16614 |
+ return ret; |
16615 |
+ |
16616 |
+ /* |
16617 |
+- * If sclk is inverted, invert it back and provide the inversion |
16618 |
+- * required by the formatter |
16619 |
++ * If sclk is inverted, it means the bit should latched on the |
16620 |
++ * rising edge which is what our HW expects. If not, we need to |
16621 |
++ * invert it before the formatter. |
16622 |
+ */ |
16623 |
+- invert ^= axg_tdm_sclk_invert(ts->iface->fmt); |
16624 |
+- ret = clk_set_phase(formatter->sclk, invert ? 180 : 0); |
16625 |
++ invert = axg_tdm_sclk_invert(ts->iface->fmt); |
16626 |
++ ret = clk_set_phase(formatter->sclk, invert ? 0 : 180); |
16627 |
+ if (ret) |
16628 |
+ return ret; |
16629 |
+ |
16630 |
+diff --git a/sound/soc/meson/axg-tdm-formatter.h b/sound/soc/meson/axg-tdm-formatter.h |
16631 |
+index 9ef98e955cb2..a1f0dcc0ff13 100644 |
16632 |
+--- a/sound/soc/meson/axg-tdm-formatter.h |
16633 |
++++ b/sound/soc/meson/axg-tdm-formatter.h |
16634 |
+@@ -16,7 +16,6 @@ struct snd_kcontrol; |
16635 |
+ |
16636 |
+ struct axg_tdm_formatter_hw { |
16637 |
+ unsigned int skew_offset; |
16638 |
+- bool invert_sclk; |
16639 |
+ }; |
16640 |
+ |
16641 |
+ struct axg_tdm_formatter_ops { |
16642 |
+diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c |
16643 |
+index 6de27238e9df..36df30915378 100644 |
16644 |
+--- a/sound/soc/meson/axg-tdm-interface.c |
16645 |
++++ b/sound/soc/meson/axg-tdm-interface.c |
16646 |
+@@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
16647 |
+ { |
16648 |
+ struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); |
16649 |
+ |
16650 |
+- /* These modes are not supported */ |
16651 |
+- if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) { |
16652 |
++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
16653 |
++ case SND_SOC_DAIFMT_CBS_CFS: |
16654 |
++ if (!iface->mclk) { |
16655 |
++ dev_err(dai->dev, "cpu clock master: mclk missing\n"); |
16656 |
++ return -ENODEV; |
16657 |
++ } |
16658 |
++ break; |
16659 |
++ |
16660 |
++ case SND_SOC_DAIFMT_CBM_CFM: |
16661 |
++ break; |
16662 |
++ |
16663 |
++ case SND_SOC_DAIFMT_CBS_CFM: |
16664 |
++ case SND_SOC_DAIFMT_CBM_CFS: |
16665 |
+ dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); |
16666 |
++ /* Fall-through */ |
16667 |
++ default: |
16668 |
+ return -EINVAL; |
16669 |
+ } |
16670 |
+ |
16671 |
+- /* If the TDM interface is the clock master, it requires mclk */ |
16672 |
+- if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) { |
16673 |
+- dev_err(dai->dev, "cpu clock master: mclk missing\n"); |
16674 |
+- return -ENODEV; |
16675 |
+- } |
16676 |
+- |
16677 |
+ iface->fmt = fmt; |
16678 |
+ return 0; |
16679 |
+ } |
16680 |
+@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream, |
16681 |
+ if (ret) |
16682 |
+ return ret; |
16683 |
+ |
16684 |
+- if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) { |
16685 |
++ if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) == |
16686 |
++ SND_SOC_DAIFMT_CBS_CFS) { |
16687 |
+ ret = axg_tdm_iface_set_sclk(dai, params); |
16688 |
+ if (ret) |
16689 |
+ return ret; |
16690 |
+diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c |
16691 |
+index 973d4c02ef8d..88ed95ae886b 100644 |
16692 |
+--- a/sound/soc/meson/axg-tdmin.c |
16693 |
++++ b/sound/soc/meson/axg-tdmin.c |
16694 |
+@@ -228,15 +228,29 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = { |
16695 |
+ .regmap_cfg = &axg_tdmin_regmap_cfg, |
16696 |
+ .ops = &axg_tdmin_ops, |
16697 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
16698 |
+- .invert_sclk = false, |
16699 |
+ .skew_offset = 2, |
16700 |
+ }, |
16701 |
+ }; |
16702 |
+ |
16703 |
++static const struct axg_tdm_formatter_driver g12a_tdmin_drv = { |
16704 |
++ .component_drv = &axg_tdmin_component_drv, |
16705 |
++ .regmap_cfg = &axg_tdmin_regmap_cfg, |
16706 |
++ .ops = &axg_tdmin_ops, |
16707 |
++ .quirks = &(const struct axg_tdm_formatter_hw) { |
16708 |
++ .skew_offset = 3, |
16709 |
++ }, |
16710 |
++}; |
16711 |
++ |
16712 |
+ static const struct of_device_id axg_tdmin_of_match[] = { |
16713 |
+ { |
16714 |
+ .compatible = "amlogic,axg-tdmin", |
16715 |
+ .data = &axg_tdmin_drv, |
16716 |
++ }, { |
16717 |
++ .compatible = "amlogic,g12a-tdmin", |
16718 |
++ .data = &g12a_tdmin_drv, |
16719 |
++ }, { |
16720 |
++ .compatible = "amlogic,sm1-tdmin", |
16721 |
++ .data = &g12a_tdmin_drv, |
16722 |
+ }, {} |
16723 |
+ }; |
16724 |
+ MODULE_DEVICE_TABLE(of, axg_tdmin_of_match); |
16725 |
+diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c |
16726 |
+index 418ec314b37d..3ceabddae629 100644 |
16727 |
+--- a/sound/soc/meson/axg-tdmout.c |
16728 |
++++ b/sound/soc/meson/axg-tdmout.c |
16729 |
+@@ -238,7 +238,6 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { |
16730 |
+ .regmap_cfg = &axg_tdmout_regmap_cfg, |
16731 |
+ .ops = &axg_tdmout_ops, |
16732 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
16733 |
+- .invert_sclk = true, |
16734 |
+ .skew_offset = 1, |
16735 |
+ }, |
16736 |
+ }; |
16737 |
+@@ -248,7 +247,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmout_drv = { |
16738 |
+ .regmap_cfg = &axg_tdmout_regmap_cfg, |
16739 |
+ .ops = &axg_tdmout_ops, |
16740 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
16741 |
+- .invert_sclk = true, |
16742 |
+ .skew_offset = 2, |
16743 |
+ }, |
16744 |
+ }; |
16745 |
+@@ -309,7 +307,6 @@ static const struct axg_tdm_formatter_driver sm1_tdmout_drv = { |
16746 |
+ .regmap_cfg = &axg_tdmout_regmap_cfg, |
16747 |
+ .ops = &axg_tdmout_ops, |
16748 |
+ .quirks = &(const struct axg_tdm_formatter_hw) { |
16749 |
+- .invert_sclk = true, |
16750 |
+ .skew_offset = 2, |
16751 |
+ }, |
16752 |
+ }; |
16753 |
+diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c |
16754 |
+index 4abf7efb7eac..fdd2d5303b2a 100644 |
16755 |
+--- a/sound/soc/meson/gx-card.c |
16756 |
++++ b/sound/soc/meson/gx-card.c |
16757 |
+@@ -96,21 +96,21 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np, |
16758 |
+ return ret; |
16759 |
+ |
16760 |
+ if (gx_card_cpu_identify(dai_link->cpus, "FIFO")) |
16761 |
+- ret = meson_card_set_fe_link(card, dai_link, np, true); |
16762 |
+- else |
16763 |
+- ret = meson_card_set_be_link(card, dai_link, np); |
16764 |
++ return meson_card_set_fe_link(card, dai_link, np, true); |
16765 |
+ |
16766 |
++ ret = meson_card_set_be_link(card, dai_link, np); |
16767 |
+ if (ret) |
16768 |
+ return ret; |
16769 |
+ |
16770 |
+- /* Check if the cpu is the i2s encoder and parse i2s data */ |
16771 |
+- if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) |
16772 |
+- ret = gx_card_parse_i2s(card, np, index); |
16773 |
+- |
16774 |
+ /* Or apply codec to codec params if necessary */ |
16775 |
+- else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) { |
16776 |
++ if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) { |
16777 |
+ dai_link->params = &codec_params; |
16778 |
+- dai_link->no_pcm = 0; /* link is not a DPCM BE */ |
16779 |
++ } else { |
16780 |
++ dai_link->no_pcm = 1; |
16781 |
++ snd_soc_dai_link_set_capabilities(dai_link); |
16782 |
++ /* Check if the cpu is the i2s encoder and parse i2s data */ |
16783 |
++ if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) |
16784 |
++ ret = gx_card_parse_i2s(card, np, index); |
16785 |
+ } |
16786 |
+ |
16787 |
+ return ret; |
16788 |
+diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c |
16789 |
+index 5a4a91c88734..c734131ff0d6 100644 |
16790 |
+--- a/sound/soc/meson/meson-card-utils.c |
16791 |
++++ b/sound/soc/meson/meson-card-utils.c |
16792 |
+@@ -147,10 +147,6 @@ int meson_card_set_be_link(struct snd_soc_card *card, |
16793 |
+ struct device_node *np; |
16794 |
+ int ret, num_codecs; |
16795 |
+ |
16796 |
+- link->no_pcm = 1; |
16797 |
+- link->dpcm_playback = 1; |
16798 |
+- link->dpcm_capture = 1; |
16799 |
+- |
16800 |
+ num_codecs = of_get_child_count(node); |
16801 |
+ if (!num_codecs) { |
16802 |
+ dev_err(card->dev, "be link %s has no codec\n", |
16803 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
16804 |
+index 2b8abf88ec60..f1d641cd48da 100644 |
16805 |
+--- a/sound/soc/soc-core.c |
16806 |
++++ b/sound/soc/soc-core.c |
16807 |
+@@ -446,7 +446,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( |
16808 |
+ |
16809 |
+ dev->parent = card->dev; |
16810 |
+ dev->release = soc_release_rtd_dev; |
16811 |
+- dev->groups = soc_dev_attr_groups; |
16812 |
+ |
16813 |
+ dev_set_name(dev, "%s", dai_link->name); |
16814 |
+ |
16815 |
+@@ -503,6 +502,10 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( |
16816 |
+ /* see for_each_card_rtds */ |
16817 |
+ list_add_tail(&rtd->list, &card->rtd_list); |
16818 |
+ |
16819 |
++ ret = device_add_groups(dev, soc_dev_attr_groups); |
16820 |
++ if (ret < 0) |
16821 |
++ goto free_rtd; |
16822 |
++ |
16823 |
+ return rtd; |
16824 |
+ |
16825 |
+ free_rtd: |
16826 |
+diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c |
16827 |
+index 457159975b01..cecbbed2de9d 100644 |
16828 |
+--- a/sound/soc/soc-dai.c |
16829 |
++++ b/sound/soc/soc-dai.c |
16830 |
+@@ -400,28 +400,30 @@ void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link) |
16831 |
+ struct snd_soc_dai_link_component *codec; |
16832 |
+ struct snd_soc_dai *dai; |
16833 |
+ bool supported[SNDRV_PCM_STREAM_LAST + 1]; |
16834 |
++ bool supported_cpu; |
16835 |
++ bool supported_codec; |
16836 |
+ int direction; |
16837 |
+ int i; |
16838 |
+ |
16839 |
+ for_each_pcm_streams(direction) { |
16840 |
+- supported[direction] = true; |
16841 |
++ supported_cpu = false; |
16842 |
++ supported_codec = false; |
16843 |
+ |
16844 |
+ for_each_link_cpus(dai_link, i, cpu) { |
16845 |
+ dai = snd_soc_find_dai(cpu); |
16846 |
+- if (!dai || !snd_soc_dai_stream_valid(dai, direction)) { |
16847 |
+- supported[direction] = false; |
16848 |
++ if (dai && snd_soc_dai_stream_valid(dai, direction)) { |
16849 |
++ supported_cpu = true; |
16850 |
+ break; |
16851 |
+ } |
16852 |
+ } |
16853 |
+- if (!supported[direction]) |
16854 |
+- continue; |
16855 |
+ for_each_link_codecs(dai_link, i, codec) { |
16856 |
+ dai = snd_soc_find_dai(codec); |
16857 |
+- if (!dai || !snd_soc_dai_stream_valid(dai, direction)) { |
16858 |
+- supported[direction] = false; |
16859 |
++ if (dai && snd_soc_dai_stream_valid(dai, direction)) { |
16860 |
++ supported_codec = true; |
16861 |
+ break; |
16862 |
+ } |
16863 |
+ } |
16864 |
++ supported[direction] = supported_cpu && supported_codec; |
16865 |
+ } |
16866 |
+ |
16867 |
+ dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK]; |
16868 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
16869 |
+index c517064f5391..74baf1fce053 100644 |
16870 |
+--- a/sound/soc/soc-pcm.c |
16871 |
++++ b/sound/soc/soc-pcm.c |
16872 |
+@@ -2802,30 +2802,36 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) |
16873 |
+ if (rtd->dai_link->dpcm_playback) { |
16874 |
+ stream = SNDRV_PCM_STREAM_PLAYBACK; |
16875 |
+ |
16876 |
+- for_each_rtd_cpu_dais(rtd, i, cpu_dai) |
16877 |
+- if (!snd_soc_dai_stream_valid(cpu_dai, |
16878 |
+- stream)) { |
16879 |
+- dev_err(rtd->card->dev, |
16880 |
+- "CPU DAI %s for rtd %s does not support playback\n", |
16881 |
+- cpu_dai->name, |
16882 |
+- rtd->dai_link->stream_name); |
16883 |
+- return -EINVAL; |
16884 |
++ for_each_rtd_cpu_dais(rtd, i, cpu_dai) { |
16885 |
++ if (snd_soc_dai_stream_valid(cpu_dai, stream)) { |
16886 |
++ playback = 1; |
16887 |
++ break; |
16888 |
+ } |
16889 |
+- playback = 1; |
16890 |
++ } |
16891 |
++ |
16892 |
++ if (!playback) { |
16893 |
++ dev_err(rtd->card->dev, |
16894 |
++ "No CPU DAIs support playback for stream %s\n", |
16895 |
++ rtd->dai_link->stream_name); |
16896 |
++ return -EINVAL; |
16897 |
++ } |
16898 |
+ } |
16899 |
+ if (rtd->dai_link->dpcm_capture) { |
16900 |
+ stream = SNDRV_PCM_STREAM_CAPTURE; |
16901 |
+ |
16902 |
+- for_each_rtd_cpu_dais(rtd, i, cpu_dai) |
16903 |
+- if (!snd_soc_dai_stream_valid(cpu_dai, |
16904 |
+- stream)) { |
16905 |
+- dev_err(rtd->card->dev, |
16906 |
+- "CPU DAI %s for rtd %s does not support capture\n", |
16907 |
+- cpu_dai->name, |
16908 |
+- rtd->dai_link->stream_name); |
16909 |
+- return -EINVAL; |
16910 |
++ for_each_rtd_cpu_dais(rtd, i, cpu_dai) { |
16911 |
++ if (snd_soc_dai_stream_valid(cpu_dai, stream)) { |
16912 |
++ capture = 1; |
16913 |
++ break; |
16914 |
+ } |
16915 |
+- capture = 1; |
16916 |
++ } |
16917 |
++ |
16918 |
++ if (!capture) { |
16919 |
++ dev_err(rtd->card->dev, |
16920 |
++ "No CPU DAIs support capture for stream %s\n", |
16921 |
++ rtd->dai_link->stream_name); |
16922 |
++ return -EINVAL; |
16923 |
++ } |
16924 |
+ } |
16925 |
+ } else { |
16926 |
+ /* Adapt stream for codec2codec links */ |
16927 |
+diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c |
16928 |
+index d03b5be31255..9e922df6a710 100644 |
16929 |
+--- a/sound/soc/sof/nocodec.c |
16930 |
++++ b/sound/soc/sof/nocodec.c |
16931 |
+@@ -14,6 +14,7 @@ |
16932 |
+ |
16933 |
+ static struct snd_soc_card sof_nocodec_card = { |
16934 |
+ .name = "nocodec", /* the sof- prefix is added by the core */ |
16935 |
++ .owner = THIS_MODULE |
16936 |
+ }; |
16937 |
+ |
16938 |
+ static int sof_nocodec_bes_setup(struct device *dev, |
16939 |
+diff --git a/sound/usb/card.h b/sound/usb/card.h |
16940 |
+index de43267b9c8a..5351d7183b1b 100644 |
16941 |
+--- a/sound/usb/card.h |
16942 |
++++ b/sound/usb/card.h |
16943 |
+@@ -137,6 +137,7 @@ struct snd_usb_substream { |
16944 |
+ unsigned int tx_length_quirk:1; /* add length specifier to transfers */ |
16945 |
+ unsigned int fmt_type; /* USB audio format type (1-3) */ |
16946 |
+ unsigned int pkt_offset_adj; /* Bytes to drop from beginning of packets (for non-compliant devices) */ |
16947 |
++ unsigned int stream_offset_adj; /* Bytes to drop from beginning of stream (for non-compliant devices) */ |
16948 |
+ |
16949 |
+ unsigned int running: 1; /* running status */ |
16950 |
+ |
16951 |
+diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
16952 |
+index cec1cfd7edb7..199cdbfdc761 100644 |
16953 |
+--- a/sound/usb/mixer_quirks.c |
16954 |
++++ b/sound/usb/mixer_quirks.c |
16955 |
+@@ -185,6 +185,7 @@ static const struct rc_config { |
16956 |
+ { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ |
16957 |
+ { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
16958 |
+ { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
16959 |
++ { USB_ID(0x041e, 0x3263), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ |
16960 |
+ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ |
16961 |
+ }; |
16962 |
+ |
16963 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
16964 |
+index a69d9e75f66f..eb3cececda79 100644 |
16965 |
+--- a/sound/usb/pcm.c |
16966 |
++++ b/sound/usb/pcm.c |
16967 |
+@@ -1420,6 +1420,12 @@ static void retire_capture_urb(struct snd_usb_substream *subs, |
16968 |
+ // continue; |
16969 |
+ } |
16970 |
+ bytes = urb->iso_frame_desc[i].actual_length; |
16971 |
++ if (subs->stream_offset_adj > 0) { |
16972 |
++ unsigned int adj = min(subs->stream_offset_adj, bytes); |
16973 |
++ cp += adj; |
16974 |
++ bytes -= adj; |
16975 |
++ subs->stream_offset_adj -= adj; |
16976 |
++ } |
16977 |
+ frames = bytes / stride; |
16978 |
+ if (!subs->txfr_quirk) |
16979 |
+ bytes = frames * stride; |
16980 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
16981 |
+index 9092cc0aa807..a53eb67ad4bd 100644 |
16982 |
+--- a/sound/usb/quirks-table.h |
16983 |
++++ b/sound/usb/quirks-table.h |
16984 |
+@@ -3541,6 +3541,62 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
16985 |
+ } |
16986 |
+ } |
16987 |
+ }, |
16988 |
++{ |
16989 |
++ /* |
16990 |
++ * PIONEER DJ DDJ-RB |
16991 |
++ * PCM is 4 channels out, 2 dummy channels in @ 44.1 fixed |
16992 |
++ * The feedback for the output is the dummy input. |
16993 |
++ */ |
16994 |
++ USB_DEVICE_VENDOR_SPEC(0x2b73, 0x000e), |
16995 |
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
16996 |
++ .ifnum = QUIRK_ANY_INTERFACE, |
16997 |
++ .type = QUIRK_COMPOSITE, |
16998 |
++ .data = (const struct snd_usb_audio_quirk[]) { |
16999 |
++ { |
17000 |
++ .ifnum = 0, |
17001 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
17002 |
++ .data = &(const struct audioformat) { |
17003 |
++ .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
17004 |
++ .channels = 4, |
17005 |
++ .iface = 0, |
17006 |
++ .altsetting = 1, |
17007 |
++ .altset_idx = 1, |
17008 |
++ .endpoint = 0x01, |
17009 |
++ .ep_attr = USB_ENDPOINT_XFER_ISOC| |
17010 |
++ USB_ENDPOINT_SYNC_ASYNC, |
17011 |
++ .rates = SNDRV_PCM_RATE_44100, |
17012 |
++ .rate_min = 44100, |
17013 |
++ .rate_max = 44100, |
17014 |
++ .nr_rates = 1, |
17015 |
++ .rate_table = (unsigned int[]) { 44100 } |
17016 |
++ } |
17017 |
++ }, |
17018 |
++ { |
17019 |
++ .ifnum = 0, |
17020 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
17021 |
++ .data = &(const struct audioformat) { |
17022 |
++ .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
17023 |
++ .channels = 2, |
17024 |
++ .iface = 0, |
17025 |
++ .altsetting = 1, |
17026 |
++ .altset_idx = 1, |
17027 |
++ .endpoint = 0x82, |
17028 |
++ .ep_attr = USB_ENDPOINT_XFER_ISOC| |
17029 |
++ USB_ENDPOINT_SYNC_ASYNC| |
17030 |
++ USB_ENDPOINT_USAGE_IMPLICIT_FB, |
17031 |
++ .rates = SNDRV_PCM_RATE_44100, |
17032 |
++ .rate_min = 44100, |
17033 |
++ .rate_max = 44100, |
17034 |
++ .nr_rates = 1, |
17035 |
++ .rate_table = (unsigned int[]) { 44100 } |
17036 |
++ } |
17037 |
++ }, |
17038 |
++ { |
17039 |
++ .ifnum = -1 |
17040 |
++ } |
17041 |
++ } |
17042 |
++ } |
17043 |
++}, |
17044 |
+ |
17045 |
+ #define ALC1220_VB_DESKTOP(vend, prod) { \ |
17046 |
+ USB_DEVICE(vend, prod), \ |
17047 |
+@@ -3645,7 +3701,13 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */ |
17048 |
+ * with. |
17049 |
+ */ |
17050 |
+ { |
17051 |
+- USB_DEVICE(0x534d, 0x2109), |
17052 |
++ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | |
17053 |
++ USB_DEVICE_ID_MATCH_INT_CLASS | |
17054 |
++ USB_DEVICE_ID_MATCH_INT_SUBCLASS, |
17055 |
++ .idVendor = 0x534d, |
17056 |
++ .idProduct = 0x2109, |
17057 |
++ .bInterfaceClass = USB_CLASS_AUDIO, |
17058 |
++ .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, |
17059 |
+ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
17060 |
+ .vendor_name = "MacroSilicon", |
17061 |
+ .product_name = "MS2109", |
17062 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
17063 |
+index fca72730a802..ef1c1cf040b4 100644 |
17064 |
+--- a/sound/usb/quirks.c |
17065 |
++++ b/sound/usb/quirks.c |
17066 |
+@@ -1495,6 +1495,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, |
17067 |
+ case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ |
17068 |
+ pioneer_djm_set_format_quirk(subs); |
17069 |
+ break; |
17070 |
++ case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ |
17071 |
++ subs->stream_offset_adj = 2; |
17072 |
++ break; |
17073 |
+ } |
17074 |
+ } |
17075 |
+ |
17076 |
+diff --git a/sound/usb/stream.c b/sound/usb/stream.c |
17077 |
+index 15296f2c902c..e03ff2a7a73f 100644 |
17078 |
+--- a/sound/usb/stream.c |
17079 |
++++ b/sound/usb/stream.c |
17080 |
+@@ -94,6 +94,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, |
17081 |
+ subs->tx_length_quirk = as->chip->tx_length_quirk; |
17082 |
+ subs->speed = snd_usb_get_speed(subs->dev); |
17083 |
+ subs->pkt_offset_adj = 0; |
17084 |
++ subs->stream_offset_adj = 0; |
17085 |
+ |
17086 |
+ snd_usb_set_pcm_ops(as->pcm, stream); |
17087 |
+ |
17088 |
+diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c |
17089 |
+index faac8189b285..c2f1fd414820 100644 |
17090 |
+--- a/tools/bpf/bpftool/btf.c |
17091 |
++++ b/tools/bpf/bpftool/btf.c |
17092 |
+@@ -596,7 +596,7 @@ static int do_dump(int argc, char **argv) |
17093 |
+ goto done; |
17094 |
+ } |
17095 |
+ if (!btf) { |
17096 |
+- err = ENOENT; |
17097 |
++ err = -ENOENT; |
17098 |
+ p_err("can't find btf with ID (%u)", btf_id); |
17099 |
+ goto done; |
17100 |
+ } |
17101 |
+diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c |
17102 |
+index 10de76b296ba..540ffde0b03a 100644 |
17103 |
+--- a/tools/bpf/bpftool/gen.c |
17104 |
++++ b/tools/bpf/bpftool/gen.c |
17105 |
+@@ -305,8 +305,11 @@ static int do_skeleton(int argc, char **argv) |
17106 |
+ opts.object_name = obj_name; |
17107 |
+ obj = bpf_object__open_mem(obj_data, file_sz, &opts); |
17108 |
+ if (IS_ERR(obj)) { |
17109 |
++ char err_buf[256]; |
17110 |
++ |
17111 |
++ libbpf_strerror(PTR_ERR(obj), err_buf, sizeof(err_buf)); |
17112 |
++ p_err("failed to open BPF object file: %s", err_buf); |
17113 |
+ obj = NULL; |
17114 |
+- p_err("failed to open BPF object file: %ld", PTR_ERR(obj)); |
17115 |
+ goto out; |
17116 |
+ } |
17117 |
+ |
17118 |
+diff --git a/tools/build/Build.include b/tools/build/Build.include |
17119 |
+index 9ec01f4454f9..585486e40995 100644 |
17120 |
+--- a/tools/build/Build.include |
17121 |
++++ b/tools/build/Build.include |
17122 |
+@@ -74,7 +74,8 @@ dep-cmd = $(if $(wildcard $(fixdep)), |
17123 |
+ # dependencies in the cmd file |
17124 |
+ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), \ |
17125 |
+ @set -e; \ |
17126 |
+- $(echo-cmd) $(cmd_$(1)) && $(dep-cmd)) |
17127 |
++ $(echo-cmd) $(cmd_$(1)); \ |
17128 |
++ $(dep-cmd)) |
17129 |
+ |
17130 |
+ # if_changed - execute command if any prerequisite is newer than |
17131 |
+ # target, or command line has changed |
17132 |
+diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h |
17133 |
+index 8bd33050b7bb..a3fd55194e0b 100644 |
17134 |
+--- a/tools/include/uapi/linux/bpf.h |
17135 |
++++ b/tools/include/uapi/linux/bpf.h |
17136 |
+@@ -3168,7 +3168,7 @@ union bpf_attr { |
17137 |
+ * Return |
17138 |
+ * The id is returned or 0 in case the id could not be retrieved. |
17139 |
+ * |
17140 |
+- * int bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) |
17141 |
++ * long bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) |
17142 |
+ * Description |
17143 |
+ * Copy *size* bytes from *data* into a ring buffer *ringbuf*. |
17144 |
+ * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification |
17145 |
+diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h |
17146 |
+index 58eceb884df3..eebf020cbe3e 100644 |
17147 |
+--- a/tools/lib/bpf/bpf_tracing.h |
17148 |
++++ b/tools/lib/bpf/bpf_tracing.h |
17149 |
+@@ -215,7 +215,7 @@ struct pt_regs; |
17150 |
+ #define PT_REGS_PARM5(x) ((x)->regs[8]) |
17151 |
+ #define PT_REGS_RET(x) ((x)->regs[31]) |
17152 |
+ #define PT_REGS_FP(x) ((x)->regs[30]) /* Works only with CONFIG_FRAME_POINTER */ |
17153 |
+-#define PT_REGS_RC(x) ((x)->regs[1]) |
17154 |
++#define PT_REGS_RC(x) ((x)->regs[2]) |
17155 |
+ #define PT_REGS_SP(x) ((x)->regs[29]) |
17156 |
+ #define PT_REGS_IP(x) ((x)->cp0_epc) |
17157 |
+ |
17158 |
+@@ -226,7 +226,7 @@ struct pt_regs; |
17159 |
+ #define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((x), regs[8]) |
17160 |
+ #define PT_REGS_RET_CORE(x) BPF_CORE_READ((x), regs[31]) |
17161 |
+ #define PT_REGS_FP_CORE(x) BPF_CORE_READ((x), regs[30]) |
17162 |
+-#define PT_REGS_RC_CORE(x) BPF_CORE_READ((x), regs[1]) |
17163 |
++#define PT_REGS_RC_CORE(x) BPF_CORE_READ((x), regs[2]) |
17164 |
+ #define PT_REGS_SP_CORE(x) BPF_CORE_READ((x), regs[29]) |
17165 |
+ #define PT_REGS_IP_CORE(x) BPF_CORE_READ((x), cp0_epc) |
17166 |
+ |
17167 |
+diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py |
17168 |
+index f9b769f3437d..425ef40067e7 100755 |
17169 |
+--- a/tools/testing/kunit/kunit.py |
17170 |
++++ b/tools/testing/kunit/kunit.py |
17171 |
+@@ -240,12 +240,6 @@ def main(argv, linux=None): |
17172 |
+ if cli_args.subcommand == 'run': |
17173 |
+ if not os.path.exists(cli_args.build_dir): |
17174 |
+ os.mkdir(cli_args.build_dir) |
17175 |
+- kunit_kernel.kunitconfig_path = os.path.join( |
17176 |
+- cli_args.build_dir, |
17177 |
+- kunit_kernel.kunitconfig_path) |
17178 |
+- |
17179 |
+- if not os.path.exists(kunit_kernel.kunitconfig_path): |
17180 |
+- create_default_kunitconfig() |
17181 |
+ |
17182 |
+ if not linux: |
17183 |
+ linux = kunit_kernel.LinuxSourceTree() |
17184 |
+@@ -263,12 +257,6 @@ def main(argv, linux=None): |
17185 |
+ if cli_args.build_dir: |
17186 |
+ if not os.path.exists(cli_args.build_dir): |
17187 |
+ os.mkdir(cli_args.build_dir) |
17188 |
+- kunit_kernel.kunitconfig_path = os.path.join( |
17189 |
+- cli_args.build_dir, |
17190 |
+- kunit_kernel.kunitconfig_path) |
17191 |
+- |
17192 |
+- if not os.path.exists(kunit_kernel.kunitconfig_path): |
17193 |
+- create_default_kunitconfig() |
17194 |
+ |
17195 |
+ if not linux: |
17196 |
+ linux = kunit_kernel.LinuxSourceTree() |
17197 |
+@@ -285,12 +273,6 @@ def main(argv, linux=None): |
17198 |
+ if cli_args.build_dir: |
17199 |
+ if not os.path.exists(cli_args.build_dir): |
17200 |
+ os.mkdir(cli_args.build_dir) |
17201 |
+- kunit_kernel.kunitconfig_path = os.path.join( |
17202 |
+- cli_args.build_dir, |
17203 |
+- kunit_kernel.kunitconfig_path) |
17204 |
+- |
17205 |
+- if not os.path.exists(kunit_kernel.kunitconfig_path): |
17206 |
+- create_default_kunitconfig() |
17207 |
+ |
17208 |
+ if not linux: |
17209 |
+ linux = kunit_kernel.LinuxSourceTree() |
17210 |
+@@ -309,12 +291,6 @@ def main(argv, linux=None): |
17211 |
+ if cli_args.build_dir: |
17212 |
+ if not os.path.exists(cli_args.build_dir): |
17213 |
+ os.mkdir(cli_args.build_dir) |
17214 |
+- kunit_kernel.kunitconfig_path = os.path.join( |
17215 |
+- cli_args.build_dir, |
17216 |
+- kunit_kernel.kunitconfig_path) |
17217 |
+- |
17218 |
+- if not os.path.exists(kunit_kernel.kunitconfig_path): |
17219 |
+- create_default_kunitconfig() |
17220 |
+ |
17221 |
+ if not linux: |
17222 |
+ linux = kunit_kernel.LinuxSourceTree() |
17223 |
+diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py |
17224 |
+index 63dbda2d029f..e20e2056cb38 100644 |
17225 |
+--- a/tools/testing/kunit/kunit_kernel.py |
17226 |
++++ b/tools/testing/kunit/kunit_kernel.py |
17227 |
+@@ -34,7 +34,7 @@ class LinuxSourceTreeOperations(object): |
17228 |
+ |
17229 |
+ def make_mrproper(self): |
17230 |
+ try: |
17231 |
+- subprocess.check_output(['make', 'mrproper']) |
17232 |
++ subprocess.check_output(['make', 'mrproper'], stderr=subprocess.STDOUT) |
17233 |
+ except OSError as e: |
17234 |
+ raise ConfigError('Could not call make command: ' + e) |
17235 |
+ except subprocess.CalledProcessError as e: |
17236 |
+@@ -47,7 +47,7 @@ class LinuxSourceTreeOperations(object): |
17237 |
+ if build_dir: |
17238 |
+ command += ['O=' + build_dir] |
17239 |
+ try: |
17240 |
+- subprocess.check_output(command, stderr=subprocess.PIPE) |
17241 |
++ subprocess.check_output(command, stderr=subprocess.STDOUT) |
17242 |
+ except OSError as e: |
17243 |
+ raise ConfigError('Could not call make command: ' + e) |
17244 |
+ except subprocess.CalledProcessError as e: |
17245 |
+@@ -77,7 +77,7 @@ class LinuxSourceTreeOperations(object): |
17246 |
+ if build_dir: |
17247 |
+ command += ['O=' + build_dir] |
17248 |
+ try: |
17249 |
+- subprocess.check_output(command) |
17250 |
++ subprocess.check_output(command, stderr=subprocess.STDOUT) |
17251 |
+ except OSError as e: |
17252 |
+ raise BuildError('Could not call execute make: ' + e) |
17253 |
+ except subprocess.CalledProcessError as e: |
17254 |
+diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py |
17255 |
+index f9eeaea94cad..287c74d821c3 100755 |
17256 |
+--- a/tools/testing/kunit/kunit_tool_test.py |
17257 |
++++ b/tools/testing/kunit/kunit_tool_test.py |
17258 |
+@@ -251,21 +251,21 @@ class KUnitMainTest(unittest.TestCase): |
17259 |
+ pass |
17260 |
+ |
17261 |
+ def test_config_passes_args_pass(self): |
17262 |
+- kunit.main(['config'], self.linux_source_mock) |
17263 |
++ kunit.main(['config', '--build_dir=.kunit'], self.linux_source_mock) |
17264 |
+ assert self.linux_source_mock.build_reconfig.call_count == 1 |
17265 |
+ assert self.linux_source_mock.run_kernel.call_count == 0 |
17266 |
+ |
17267 |
+ def test_build_passes_args_pass(self): |
17268 |
+ kunit.main(['build'], self.linux_source_mock) |
17269 |
+ assert self.linux_source_mock.build_reconfig.call_count == 0 |
17270 |
+- self.linux_source_mock.build_um_kernel.assert_called_once_with(False, 8, '', None) |
17271 |
++ self.linux_source_mock.build_um_kernel.assert_called_once_with(False, 8, '.kunit', None) |
17272 |
+ assert self.linux_source_mock.run_kernel.call_count == 0 |
17273 |
+ |
17274 |
+ def test_exec_passes_args_pass(self): |
17275 |
+ kunit.main(['exec'], self.linux_source_mock) |
17276 |
+ assert self.linux_source_mock.build_reconfig.call_count == 0 |
17277 |
+ assert self.linux_source_mock.run_kernel.call_count == 1 |
17278 |
+- self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=300) |
17279 |
++ self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='.kunit', timeout=300) |
17280 |
+ self.print_mock.assert_any_call(StrContains('Testing complete.')) |
17281 |
+ |
17282 |
+ def test_run_passes_args_pass(self): |
17283 |
+@@ -273,7 +273,7 @@ class KUnitMainTest(unittest.TestCase): |
17284 |
+ assert self.linux_source_mock.build_reconfig.call_count == 1 |
17285 |
+ assert self.linux_source_mock.run_kernel.call_count == 1 |
17286 |
+ self.linux_source_mock.run_kernel.assert_called_once_with( |
17287 |
+- build_dir='', timeout=300) |
17288 |
++ build_dir='.kunit', timeout=300) |
17289 |
+ self.print_mock.assert_any_call(StrContains('Testing complete.')) |
17290 |
+ |
17291 |
+ def test_exec_passes_args_fail(self): |
17292 |
+@@ -313,7 +313,7 @@ class KUnitMainTest(unittest.TestCase): |
17293 |
+ def test_exec_timeout(self): |
17294 |
+ timeout = 3453 |
17295 |
+ kunit.main(['exec', '--timeout', str(timeout)], self.linux_source_mock) |
17296 |
+- self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout) |
17297 |
++ self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='.kunit', timeout=timeout) |
17298 |
+ self.print_mock.assert_any_call(StrContains('Testing complete.')) |
17299 |
+ |
17300 |
+ def test_run_timeout(self): |
17301 |
+@@ -321,12 +321,12 @@ class KUnitMainTest(unittest.TestCase): |
17302 |
+ kunit.main(['run', '--timeout', str(timeout)], self.linux_source_mock) |
17303 |
+ assert self.linux_source_mock.build_reconfig.call_count == 1 |
17304 |
+ self.linux_source_mock.run_kernel.assert_called_once_with( |
17305 |
+- build_dir='', timeout=timeout) |
17306 |
++ build_dir='.kunit', timeout=timeout) |
17307 |
+ self.print_mock.assert_any_call(StrContains('Testing complete.')) |
17308 |
+ |
17309 |
+ def test_run_builddir(self): |
17310 |
+ build_dir = '.kunit' |
17311 |
+- kunit.main(['run', '--build_dir', build_dir], self.linux_source_mock) |
17312 |
++ kunit.main(['run', '--build_dir=.kunit'], self.linux_source_mock) |
17313 |
+ assert self.linux_source_mock.build_reconfig.call_count == 1 |
17314 |
+ self.linux_source_mock.run_kernel.assert_called_once_with( |
17315 |
+ build_dir=build_dir, timeout=300) |
17316 |
+diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh |
17317 |
+index ee64ff8df8f4..8383eb89d88a 100755 |
17318 |
+--- a/tools/testing/selftests/lkdtm/run.sh |
17319 |
++++ b/tools/testing/selftests/lkdtm/run.sh |
17320 |
+@@ -8,6 +8,7 @@ |
17321 |
+ # |
17322 |
+ set -e |
17323 |
+ TRIGGER=/sys/kernel/debug/provoke-crash/DIRECT |
17324 |
++CLEAR_ONCE=/sys/kernel/debug/clear_warn_once |
17325 |
+ KSELFTEST_SKIP_TEST=4 |
17326 |
+ |
17327 |
+ # Verify we have LKDTM available in the kernel. |
17328 |
+@@ -67,6 +68,11 @@ cleanup() { |
17329 |
+ } |
17330 |
+ trap cleanup EXIT |
17331 |
+ |
17332 |
++# Reset WARN_ONCE counters so we trip it each time this runs. |
17333 |
++if [ -w $CLEAR_ONCE ] ; then |
17334 |
++ echo 1 > $CLEAR_ONCE |
17335 |
++fi |
17336 |
++ |
17337 |
+ # Save existing dmesg so we can detect new content below |
17338 |
+ dmesg > "$DMESG" |
17339 |
+ |
17340 |
+diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt |
17341 |
+index 92ca32143ae5..9d266e79c6a2 100644 |
17342 |
+--- a/tools/testing/selftests/lkdtm/tests.txt |
17343 |
++++ b/tools/testing/selftests/lkdtm/tests.txt |
17344 |
+@@ -14,6 +14,7 @@ STACK_GUARD_PAGE_LEADING |
17345 |
+ STACK_GUARD_PAGE_TRAILING |
17346 |
+ UNSET_SMEP CR4 bits went missing |
17347 |
+ DOUBLE_FAULT |
17348 |
++CORRUPT_PAC |
17349 |
+ UNALIGNED_LOAD_STORE_WRITE |
17350 |
+ #OVERWRITE_ALLOCATION Corrupts memory on failure |
17351 |
+ #WRITE_AFTER_FREE Corrupts memory on failure |
17352 |
+diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c |
17353 |
+index 4b02933cab8a..bdc03a2097e8 100644 |
17354 |
+--- a/tools/testing/selftests/net/msg_zerocopy.c |
17355 |
++++ b/tools/testing/selftests/net/msg_zerocopy.c |
17356 |
+@@ -125,9 +125,8 @@ static int do_setcpu(int cpu) |
17357 |
+ CPU_ZERO(&mask); |
17358 |
+ CPU_SET(cpu, &mask); |
17359 |
+ if (sched_setaffinity(0, sizeof(mask), &mask)) |
17360 |
+- error(1, 0, "setaffinity %d", cpu); |
17361 |
+- |
17362 |
+- if (cfg_verbose) |
17363 |
++ fprintf(stderr, "cpu: unable to pin, may increase variance.\n"); |
17364 |
++ else if (cfg_verbose) |
17365 |
+ fprintf(stderr, "cpu: %u\n", cpu); |
17366 |
+ |
17367 |
+ return 0; |
17368 |
+diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
17369 |
+index a2e8c9da7fa5..d50cc05df495 100644 |
17370 |
+--- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
17371 |
++++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c |
17372 |
+@@ -19,6 +19,7 @@ |
17373 |
+ #include <limits.h> |
17374 |
+ #include <sys/time.h> |
17375 |
+ #include <sys/syscall.h> |
17376 |
++#include <sys/sysinfo.h> |
17377 |
+ #include <sys/types.h> |
17378 |
+ #include <sys/shm.h> |
17379 |
+ #include <linux/futex.h> |
17380 |
+@@ -104,8 +105,9 @@ static void start_thread_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
17381 |
+ |
17382 |
+ static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
17383 |
+ { |
17384 |
+- int pid; |
17385 |
+- cpu_set_t cpuset; |
17386 |
++ int pid, ncpus; |
17387 |
++ cpu_set_t *cpuset; |
17388 |
++ size_t size; |
17389 |
+ |
17390 |
+ pid = fork(); |
17391 |
+ if (pid == -1) { |
17392 |
+@@ -116,14 +118,23 @@ static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu) |
17393 |
+ if (pid) |
17394 |
+ return; |
17395 |
+ |
17396 |
+- CPU_ZERO(&cpuset); |
17397 |
+- CPU_SET(cpu, &cpuset); |
17398 |
++ ncpus = get_nprocs(); |
17399 |
++ size = CPU_ALLOC_SIZE(ncpus); |
17400 |
++ cpuset = CPU_ALLOC(ncpus); |
17401 |
++ if (!cpuset) { |
17402 |
++ perror("malloc"); |
17403 |
++ exit(1); |
17404 |
++ } |
17405 |
++ CPU_ZERO_S(size, cpuset); |
17406 |
++ CPU_SET_S(cpu, size, cpuset); |
17407 |
+ |
17408 |
+- if (sched_setaffinity(0, sizeof(cpuset), &cpuset)) { |
17409 |
++ if (sched_setaffinity(0, size, cpuset)) { |
17410 |
+ perror("sched_setaffinity"); |
17411 |
++ CPU_FREE(cpuset); |
17412 |
+ exit(1); |
17413 |
+ } |
17414 |
+ |
17415 |
++ CPU_FREE(cpuset); |
17416 |
+ fn(arg); |
17417 |
+ |
17418 |
+ exit(0); |
17419 |
+diff --git a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh |
17420 |
+index f52ed92b53e7..00dc32c0ed75 100755 |
17421 |
+--- a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh |
17422 |
++++ b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh |
17423 |
+@@ -5,12 +5,17 @@ pe_ok() { |
17424 |
+ local dev="$1" |
17425 |
+ local path="/sys/bus/pci/devices/$dev/eeh_pe_state" |
17426 |
+ |
17427 |
+- if ! [ -e "$path" ] ; then |
17428 |
++ # if a driver doesn't support the error handling callbacks then the |
17429 |
++ # device is recovered by removing and re-probing it. This causes the |
17430 |
++ # sysfs directory to disappear so read the PE state once and squash |
17431 |
++ # any potential error messages |
17432 |
++ local eeh_state="$(cat $path 2>/dev/null)" |
17433 |
++ if [ -z "$eeh_state" ]; then |
17434 |
+ return 1; |
17435 |
+ fi |
17436 |
+ |
17437 |
+- local fw_state="$(cut -d' ' -f1 < $path)" |
17438 |
+- local sw_state="$(cut -d' ' -f2 < $path)" |
17439 |
++ local fw_state="$(echo $eeh_state | cut -d' ' -f1)" |
17440 |
++ local sw_state="$(echo $eeh_state | cut -d' ' -f2)" |
17441 |
+ |
17442 |
+ # If EEH_PE_ISOLATED or EEH_PE_RECOVERING are set then the PE is in an |
17443 |
+ # error state or being recovered. Either way, not ok. |
17444 |
+diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c |
17445 |
+index 5ee0e98c4896..eb530e73e02c 100644 |
17446 |
+--- a/tools/testing/selftests/powerpc/utils.c |
17447 |
++++ b/tools/testing/selftests/powerpc/utils.c |
17448 |
+@@ -16,6 +16,7 @@ |
17449 |
+ #include <string.h> |
17450 |
+ #include <sys/ioctl.h> |
17451 |
+ #include <sys/stat.h> |
17452 |
++#include <sys/sysinfo.h> |
17453 |
+ #include <sys/types.h> |
17454 |
+ #include <sys/utsname.h> |
17455 |
+ #include <unistd.h> |
17456 |
+@@ -88,28 +89,40 @@ void *get_auxv_entry(int type) |
17457 |
+ |
17458 |
+ int pick_online_cpu(void) |
17459 |
+ { |
17460 |
+- cpu_set_t mask; |
17461 |
+- int cpu; |
17462 |
++ int ncpus, cpu = -1; |
17463 |
++ cpu_set_t *mask; |
17464 |
++ size_t size; |
17465 |
++ |
17466 |
++ ncpus = get_nprocs_conf(); |
17467 |
++ size = CPU_ALLOC_SIZE(ncpus); |
17468 |
++ mask = CPU_ALLOC(ncpus); |
17469 |
++ if (!mask) { |
17470 |
++ perror("malloc"); |
17471 |
++ return -1; |
17472 |
++ } |
17473 |
+ |
17474 |
+- CPU_ZERO(&mask); |
17475 |
++ CPU_ZERO_S(size, mask); |
17476 |
+ |
17477 |
+- if (sched_getaffinity(0, sizeof(mask), &mask)) { |
17478 |
++ if (sched_getaffinity(0, size, mask)) { |
17479 |
+ perror("sched_getaffinity"); |
17480 |
+- return -1; |
17481 |
++ goto done; |
17482 |
+ } |
17483 |
+ |
17484 |
+ /* We prefer a primary thread, but skip 0 */ |
17485 |
+- for (cpu = 8; cpu < CPU_SETSIZE; cpu += 8) |
17486 |
+- if (CPU_ISSET(cpu, &mask)) |
17487 |
+- return cpu; |
17488 |
++ for (cpu = 8; cpu < ncpus; cpu += 8) |
17489 |
++ if (CPU_ISSET_S(cpu, size, mask)) |
17490 |
++ goto done; |
17491 |
+ |
17492 |
+ /* Search for anything, but in reverse */ |
17493 |
+- for (cpu = CPU_SETSIZE - 1; cpu >= 0; cpu--) |
17494 |
+- if (CPU_ISSET(cpu, &mask)) |
17495 |
+- return cpu; |
17496 |
++ for (cpu = ncpus - 1; cpu >= 0; cpu--) |
17497 |
++ if (CPU_ISSET_S(cpu, size, mask)) |
17498 |
++ goto done; |
17499 |
+ |
17500 |
+ printf("No cpus in affinity mask?!\n"); |
17501 |
+- return -1; |
17502 |
++ |
17503 |
++done: |
17504 |
++ CPU_FREE(mask); |
17505 |
++ return cpu; |
17506 |
+ } |
17507 |
+ |
17508 |
+ bool is_ppc64le(void) |
17509 |
+diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c |
17510 |
+index 252140a52553..ccf276e13882 100644 |
17511 |
+--- a/tools/testing/selftests/seccomp/seccomp_bpf.c |
17512 |
++++ b/tools/testing/selftests/seccomp/seccomp_bpf.c |
17513 |
+@@ -180,7 +180,7 @@ struct seccomp_metadata { |
17514 |
+ #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) |
17515 |
+ #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ |
17516 |
+ struct seccomp_notif_resp) |
17517 |
+-#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) |
17518 |
++#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) |
17519 |
+ |
17520 |
+ struct seccomp_notif { |
17521 |
+ __u64 id; |