1 |
commit: b6de6417a82978446b2e3e3bec49271f305452e6 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 30 12:54:04 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 30 12:54:04 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b6de6417 |
7 |
|
8 |
Linux patch 5.10.4 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1003_linux-5.10.4.patch | 23858 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 23862 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 025c3da..ce1d3f7 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -55,6 +55,10 @@ Patch: 1002_linux-5.10.3.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.3 |
23 |
|
24 |
+Patch: 1003_linux-5.10.4.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.4 |
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/1003_linux-5.10.4.patch b/1003_linux-5.10.4.patch |
33 |
new file mode 100644 |
34 |
index 0000000..a623431 |
35 |
--- /dev/null |
36 |
+++ b/1003_linux-5.10.4.patch |
37 |
@@ -0,0 +1,23858 @@ |
38 |
+diff --git a/Documentation/locking/seqlock.rst b/Documentation/locking/seqlock.rst |
39 |
+index a334b584f2b34..64405e5da63e4 100644 |
40 |
+--- a/Documentation/locking/seqlock.rst |
41 |
++++ b/Documentation/locking/seqlock.rst |
42 |
+@@ -89,7 +89,7 @@ Read path:: |
43 |
+ |
44 |
+ .. _seqcount_locktype_t: |
45 |
+ |
46 |
+-Sequence counters with associated locks (``seqcount_LOCKTYPE_t``) |
47 |
++Sequence counters with associated locks (``seqcount_LOCKNAME_t``) |
48 |
+ ----------------------------------------------------------------- |
49 |
+ |
50 |
+ As discussed at :ref:`seqcount_t`, sequence count write side critical |
51 |
+@@ -115,27 +115,26 @@ The following sequence counters with associated locks are defined: |
52 |
+ - ``seqcount_mutex_t`` |
53 |
+ - ``seqcount_ww_mutex_t`` |
54 |
+ |
55 |
+-The plain seqcount read and write APIs branch out to the specific |
56 |
+-seqcount_LOCKTYPE_t implementation at compile-time. This avoids kernel |
57 |
+-API explosion per each new seqcount LOCKTYPE. |
58 |
++The sequence counter read and write APIs can take either a plain |
59 |
++seqcount_t or any of the seqcount_LOCKNAME_t variants above. |
60 |
+ |
61 |
+-Initialization (replace "LOCKTYPE" with one of the supported locks):: |
62 |
++Initialization (replace "LOCKNAME" with one of the supported locks):: |
63 |
+ |
64 |
+ /* dynamic */ |
65 |
+- seqcount_LOCKTYPE_t foo_seqcount; |
66 |
+- seqcount_LOCKTYPE_init(&foo_seqcount, &lock); |
67 |
++ seqcount_LOCKNAME_t foo_seqcount; |
68 |
++ seqcount_LOCKNAME_init(&foo_seqcount, &lock); |
69 |
+ |
70 |
+ /* static */ |
71 |
+- static seqcount_LOCKTYPE_t foo_seqcount = |
72 |
+- SEQCNT_LOCKTYPE_ZERO(foo_seqcount, &lock); |
73 |
++ static seqcount_LOCKNAME_t foo_seqcount = |
74 |
++ SEQCNT_LOCKNAME_ZERO(foo_seqcount, &lock); |
75 |
+ |
76 |
+ /* C99 struct init */ |
77 |
+ struct { |
78 |
+- .seq = SEQCNT_LOCKTYPE_ZERO(foo.seq, &lock), |
79 |
++ .seq = SEQCNT_LOCKNAME_ZERO(foo.seq, &lock), |
80 |
+ } foo; |
81 |
+ |
82 |
+ Write path: same as in :ref:`seqcount_t`, while running from a context |
83 |
+-with the associated LOCKTYPE lock acquired. |
84 |
++with the associated write serialization lock acquired. |
85 |
+ |
86 |
+ Read path: same as in :ref:`seqcount_t`. |
87 |
+ |
88 |
+diff --git a/Documentation/x86/topology.rst b/Documentation/x86/topology.rst |
89 |
+index e29739904e37e..7f58010ea86af 100644 |
90 |
+--- a/Documentation/x86/topology.rst |
91 |
++++ b/Documentation/x86/topology.rst |
92 |
+@@ -41,6 +41,8 @@ Package |
93 |
+ Packages contain a number of cores plus shared resources, e.g. DRAM |
94 |
+ controller, shared caches etc. |
95 |
+ |
96 |
++Modern systems may also use the term 'Die' for package. |
97 |
++ |
98 |
+ AMD nomenclature for package is 'Node'. |
99 |
+ |
100 |
+ Package-related topology information in the kernel: |
101 |
+@@ -53,11 +55,18 @@ Package-related topology information in the kernel: |
102 |
+ |
103 |
+ The number of dies in a package. This information is retrieved via CPUID. |
104 |
+ |
105 |
++ - cpuinfo_x86.cpu_die_id: |
106 |
++ |
107 |
++ The physical ID of the die. This information is retrieved via CPUID. |
108 |
++ |
109 |
+ - cpuinfo_x86.phys_proc_id: |
110 |
+ |
111 |
+ The physical ID of the package. This information is retrieved via CPUID |
112 |
+ and deduced from the APIC IDs of the cores in the package. |
113 |
+ |
114 |
++ Modern systems use this value for the socket. There may be multiple |
115 |
++ packages within a socket. This value may differ from cpu_die_id. |
116 |
++ |
117 |
+ - cpuinfo_x86.logical_proc_id: |
118 |
+ |
119 |
+ The logical ID of the package. As we do not trust BIOSes to enumerate the |
120 |
+diff --git a/Makefile b/Makefile |
121 |
+index a72bc404123d5..1e50d6af932ab 100644 |
122 |
+--- a/Makefile |
123 |
++++ b/Makefile |
124 |
+@@ -1,7 +1,7 @@ |
125 |
+ # SPDX-License-Identifier: GPL-2.0 |
126 |
+ VERSION = 5 |
127 |
+ PATCHLEVEL = 10 |
128 |
+-SUBLEVEL = 3 |
129 |
++SUBLEVEL = 4 |
130 |
+ EXTRAVERSION = |
131 |
+ NAME = Kleptomaniac Octopus |
132 |
+ |
133 |
+diff --git a/arch/Kconfig b/arch/Kconfig |
134 |
+index ba4e966484ab5..ddd4641446bdd 100644 |
135 |
+--- a/arch/Kconfig |
136 |
++++ b/arch/Kconfig |
137 |
+@@ -143,6 +143,22 @@ config UPROBES |
138 |
+ managed by the kernel and kept transparent to the probed |
139 |
+ application. ) |
140 |
+ |
141 |
++config HAVE_64BIT_ALIGNED_ACCESS |
142 |
++ def_bool 64BIT && !HAVE_EFFICIENT_UNALIGNED_ACCESS |
143 |
++ help |
144 |
++ Some architectures require 64 bit accesses to be 64 bit |
145 |
++ aligned, which also requires structs containing 64 bit values |
146 |
++ to be 64 bit aligned too. This includes some 32 bit |
147 |
++ architectures which can do 64 bit accesses, as well as 64 bit |
148 |
++ architectures without unaligned access. |
149 |
++ |
150 |
++ This symbol should be selected by an architecture if 64 bit |
151 |
++ accesses are required to be 64 bit aligned in this way even |
152 |
++ though it is not a 64 bit architecture. |
153 |
++ |
154 |
++ See Documentation/unaligned-memory-access.txt for more |
155 |
++ information on the topic of unaligned memory accesses. |
156 |
++ |
157 |
+ config HAVE_EFFICIENT_UNALIGNED_ACCESS |
158 |
+ bool |
159 |
+ help |
160 |
+diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S |
161 |
+index caa27322a0ab7..3a392983ac079 100644 |
162 |
+--- a/arch/arm/boot/compressed/head.S |
163 |
++++ b/arch/arm/boot/compressed/head.S |
164 |
+@@ -116,7 +116,7 @@ |
165 |
+ /* |
166 |
+ * Debug print of the final appended DTB location |
167 |
+ */ |
168 |
+- .macro dbgadtb, begin, end |
169 |
++ .macro dbgadtb, begin, size |
170 |
+ #ifdef DEBUG |
171 |
+ kputc #'D' |
172 |
+ kputc #'T' |
173 |
+@@ -129,7 +129,7 @@ |
174 |
+ kputc #'(' |
175 |
+ kputc #'0' |
176 |
+ kputc #'x' |
177 |
+- kphex \end, 8 /* End of appended DTB */ |
178 |
++ kphex \size, 8 /* Size of appended DTB */ |
179 |
+ kputc #')' |
180 |
+ kputc #'\n' |
181 |
+ #endif |
182 |
+diff --git a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
183 |
+index 654648b05c7c2..aeccedd125740 100644 |
184 |
+--- a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
185 |
++++ b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi |
186 |
+@@ -266,11 +266,6 @@ |
187 |
+ reg = <0x11000 0x100>; |
188 |
+ }; |
189 |
+ |
190 |
+-&i2c1 { |
191 |
+- compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c"; |
192 |
+- reg = <0x11100 0x100>; |
193 |
+-}; |
194 |
+- |
195 |
+ &mpic { |
196 |
+ reg = <0x20a00 0x2d0>, <0x21070 0x58>; |
197 |
+ }; |
198 |
+diff --git a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
199 |
+index 2d44d9ad4e400..e6ad821a86359 100644 |
200 |
+--- a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
201 |
++++ b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
202 |
+@@ -82,11 +82,6 @@ |
203 |
+ status = "okay"; |
204 |
+ }; |
205 |
+ |
206 |
+-&vuart { |
207 |
+- // VUART Host Console |
208 |
+- status = "okay"; |
209 |
+-}; |
210 |
+- |
211 |
+ &uart1 { |
212 |
+ // Host Console |
213 |
+ status = "okay"; |
214 |
+diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
215 |
+index 1deb30ec912cf..6e9baf3bba531 100644 |
216 |
+--- a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
217 |
++++ b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts |
218 |
+@@ -22,9 +22,9 @@ |
219 |
+ #size-cells = <1>; |
220 |
+ ranges; |
221 |
+ |
222 |
+- vga_memory: framebuffer@7f000000 { |
223 |
++ vga_memory: framebuffer@9f000000 { |
224 |
+ no-map; |
225 |
+- reg = <0x7f000000 0x01000000>; |
226 |
++ reg = <0x9f000000 0x01000000>; /* 16M */ |
227 |
+ }; |
228 |
+ }; |
229 |
+ |
230 |
+diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts b/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts |
231 |
+index 4d070d6ba09f9..e86c22ce6d123 100644 |
232 |
+--- a/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts |
233 |
++++ b/arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts |
234 |
+@@ -26,7 +26,7 @@ |
235 |
+ #size-cells = <1>; |
236 |
+ ranges; |
237 |
+ |
238 |
+- flash_memory: region@ba000000 { |
239 |
++ flash_memory: region@b8000000 { |
240 |
+ no-map; |
241 |
+ reg = <0xb8000000 0x4000000>; /* 64M */ |
242 |
+ }; |
243 |
+diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi |
244 |
+index b58220a49cbd8..bf97aaad7be9b 100644 |
245 |
+--- a/arch/arm/boot/dts/aspeed-g6.dtsi |
246 |
++++ b/arch/arm/boot/dts/aspeed-g6.dtsi |
247 |
+@@ -357,7 +357,7 @@ |
248 |
+ #gpio-cells = <2>; |
249 |
+ gpio-controller; |
250 |
+ compatible = "aspeed,ast2600-gpio"; |
251 |
+- reg = <0x1e780000 0x800>; |
252 |
++ reg = <0x1e780000 0x400>; |
253 |
+ interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; |
254 |
+ gpio-ranges = <&pinctrl 0 0 208>; |
255 |
+ ngpios = <208>; |
256 |
+diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts |
257 |
+index eae28b82c7fd0..73b6b1f89de99 100644 |
258 |
+--- a/arch/arm/boot/dts/at91-sam9x60ek.dts |
259 |
++++ b/arch/arm/boot/dts/at91-sam9x60ek.dts |
260 |
+@@ -569,11 +569,14 @@ |
261 |
+ atmel,pins = <AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; |
262 |
+ }; |
263 |
+ }; |
264 |
+-}; /* pinctrl */ |
265 |
+ |
266 |
+-&pmc { |
267 |
+- atmel,osc-bypass; |
268 |
+-}; |
269 |
++ usb1 { |
270 |
++ pinctrl_usb_default: usb_default { |
271 |
++ atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE |
272 |
++ AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; |
273 |
++ }; |
274 |
++ }; |
275 |
++}; /* pinctrl */ |
276 |
+ |
277 |
+ &pwm0 { |
278 |
+ pinctrl-names = "default"; |
279 |
+@@ -684,6 +687,8 @@ |
280 |
+ atmel,vbus-gpio = <0 |
281 |
+ &pioD 15 GPIO_ACTIVE_HIGH |
282 |
+ &pioD 16 GPIO_ACTIVE_HIGH>; |
283 |
++ pinctrl-names = "default"; |
284 |
++ pinctrl-0 = <&pinctrl_usb_default>; |
285 |
+ status = "okay"; |
286 |
+ }; |
287 |
+ |
288 |
+diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
289 |
+index cf13632edd444..5179258f92470 100644 |
290 |
+--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
291 |
++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts |
292 |
+@@ -242,6 +242,11 @@ |
293 |
+ atmel,pins = |
294 |
+ <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */ |
295 |
+ }; |
296 |
++ pinctrl_usb_default: usb_default { |
297 |
++ atmel,pins = |
298 |
++ <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE |
299 |
++ AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; |
300 |
++ }; |
301 |
+ }; |
302 |
+ }; |
303 |
+ }; |
304 |
+@@ -259,6 +264,8 @@ |
305 |
+ &pioE 3 GPIO_ACTIVE_LOW |
306 |
+ &pioE 4 GPIO_ACTIVE_LOW |
307 |
+ >; |
308 |
++ pinctrl-names = "default"; |
309 |
++ pinctrl-0 = <&pinctrl_usb_default>; |
310 |
+ status = "okay"; |
311 |
+ }; |
312 |
+ |
313 |
+diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts |
314 |
+index e5974a17374cf..0b3ad1b580b83 100644 |
315 |
+--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts |
316 |
++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts |
317 |
+@@ -134,6 +134,11 @@ |
318 |
+ atmel,pins = |
319 |
+ <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; |
320 |
+ }; |
321 |
++ pinctrl_usb_default: usb_default { |
322 |
++ atmel,pins = |
323 |
++ <AT91_PIOE 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE |
324 |
++ AT91_PIOE 14 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; |
325 |
++ }; |
326 |
+ pinctrl_key_gpio: key_gpio_0 { |
327 |
+ atmel,pins = |
328 |
+ <AT91_PIOE 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; |
329 |
+@@ -159,6 +164,8 @@ |
330 |
+ &pioE 11 GPIO_ACTIVE_HIGH |
331 |
+ &pioE 14 GPIO_ACTIVE_HIGH |
332 |
+ >; |
333 |
++ pinctrl-names = "default"; |
334 |
++ pinctrl-0 = <&pinctrl_usb_default>; |
335 |
+ status = "okay"; |
336 |
+ }; |
337 |
+ |
338 |
+diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi |
339 |
+index 5653e70c84b4b..36a42a9fe1957 100644 |
340 |
+--- a/arch/arm/boot/dts/at91sam9rl.dtsi |
341 |
++++ b/arch/arm/boot/dts/at91sam9rl.dtsi |
342 |
+@@ -282,23 +282,26 @@ |
343 |
+ atmel,adc-use-res = "highres"; |
344 |
+ |
345 |
+ trigger0 { |
346 |
+- trigger-name = "timer-counter-0"; |
347 |
++ trigger-name = "external-rising"; |
348 |
+ trigger-value = <0x1>; |
349 |
++ trigger-external; |
350 |
+ }; |
351 |
++ |
352 |
+ trigger1 { |
353 |
+- trigger-name = "timer-counter-1"; |
354 |
+- trigger-value = <0x3>; |
355 |
++ trigger-name = "external-falling"; |
356 |
++ trigger-value = <0x2>; |
357 |
++ trigger-external; |
358 |
+ }; |
359 |
+ |
360 |
+ trigger2 { |
361 |
+- trigger-name = "timer-counter-2"; |
362 |
+- trigger-value = <0x5>; |
363 |
++ trigger-name = "external-any"; |
364 |
++ trigger-value = <0x3>; |
365 |
++ trigger-external; |
366 |
+ }; |
367 |
+ |
368 |
+ trigger3 { |
369 |
+- trigger-name = "external"; |
370 |
+- trigger-value = <0x13>; |
371 |
+- trigger-external; |
372 |
++ trigger-name = "continuous"; |
373 |
++ trigger-value = <0x6>; |
374 |
+ }; |
375 |
+ }; |
376 |
+ |
377 |
+diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts |
378 |
+index 0c26467de4d03..5963566dbcc9d 100644 |
379 |
+--- a/arch/arm/boot/dts/meson8b-odroidc1.dts |
380 |
++++ b/arch/arm/boot/dts/meson8b-odroidc1.dts |
381 |
+@@ -224,7 +224,7 @@ |
382 |
+ reg = <0>; |
383 |
+ |
384 |
+ reset-assert-us = <10000>; |
385 |
+- reset-deassert-us = <30000>; |
386 |
++ reset-deassert-us = <80000>; |
387 |
+ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; |
388 |
+ |
389 |
+ interrupt-parent = <&gpio_intc>; |
390 |
+diff --git a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts |
391 |
+index cc498191ddd1d..8f4eb1ed45816 100644 |
392 |
+--- a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts |
393 |
++++ b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts |
394 |
+@@ -81,7 +81,7 @@ |
395 |
+ reg = <0>; |
396 |
+ |
397 |
+ reset-assert-us = <10000>; |
398 |
+- reset-deassert-us = <30000>; |
399 |
++ reset-deassert-us = <80000>; |
400 |
+ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; |
401 |
+ }; |
402 |
+ }; |
403 |
+diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts |
404 |
+index cfa85aa3da085..6afa8fd7c412d 100644 |
405 |
+--- a/arch/arm/boot/dts/omap4-panda-es.dts |
406 |
++++ b/arch/arm/boot/dts/omap4-panda-es.dts |
407 |
+@@ -46,7 +46,7 @@ |
408 |
+ |
409 |
+ button_pins: pinmux_button_pins { |
410 |
+ pinctrl-single,pins = < |
411 |
+- OMAP4_IOPAD(0x11b, PIN_INPUT_PULLUP | MUX_MODE3) /* gpio_113 */ |
412 |
++ OMAP4_IOPAD(0x0fc, PIN_INPUT_PULLUP | MUX_MODE3) /* gpio_113 */ |
413 |
+ >; |
414 |
+ }; |
415 |
+ }; |
416 |
+diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi |
417 |
+index 2ddc85dff8ce9..2c4952427296e 100644 |
418 |
+--- a/arch/arm/boot/dts/sama5d2.dtsi |
419 |
++++ b/arch/arm/boot/dts/sama5d2.dtsi |
420 |
+@@ -656,6 +656,7 @@ |
421 |
+ clocks = <&pmc PMC_TYPE_PERIPHERAL 51>; |
422 |
+ #address-cells = <1>; |
423 |
+ #size-cells = <1>; |
424 |
++ no-memory-wc; |
425 |
+ ranges = <0 0xf8044000 0x1420>; |
426 |
+ }; |
427 |
+ |
428 |
+@@ -724,7 +725,7 @@ |
429 |
+ |
430 |
+ can0: can@f8054000 { |
431 |
+ compatible = "bosch,m_can"; |
432 |
+- reg = <0xf8054000 0x4000>, <0x210000 0x4000>; |
433 |
++ reg = <0xf8054000 0x4000>, <0x210000 0x1c00>; |
434 |
+ reg-names = "m_can", "message_ram"; |
435 |
+ interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>, |
436 |
+ <64 IRQ_TYPE_LEVEL_HIGH 7>; |
437 |
+@@ -1130,7 +1131,7 @@ |
438 |
+ |
439 |
+ can1: can@fc050000 { |
440 |
+ compatible = "bosch,m_can"; |
441 |
+- reg = <0xfc050000 0x4000>, <0x210000 0x4000>; |
442 |
++ reg = <0xfc050000 0x4000>, <0x210000 0x3800>; |
443 |
+ reg-names = "m_can", "message_ram"; |
444 |
+ interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>, |
445 |
+ <65 IRQ_TYPE_LEVEL_HIGH 7>; |
446 |
+@@ -1140,7 +1141,7 @@ |
447 |
+ assigned-clocks = <&pmc PMC_TYPE_GCK 57>; |
448 |
+ assigned-clock-parents = <&pmc PMC_TYPE_CORE PMC_UTMI>; |
449 |
+ assigned-clock-rates = <40000000>; |
450 |
+- bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>; |
451 |
++ bosch,mram-cfg = <0x1c00 0 0 64 0 0 32 32>; |
452 |
+ status = "disabled"; |
453 |
+ }; |
454 |
+ |
455 |
+diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts |
456 |
+index b158771ac0b7d..055334ae3d288 100644 |
457 |
+--- a/arch/arm/boot/dts/tegra20-ventana.dts |
458 |
++++ b/arch/arm/boot/dts/tegra20-ventana.dts |
459 |
+@@ -3,6 +3,7 @@ |
460 |
+ |
461 |
+ #include <dt-bindings/input/input.h> |
462 |
+ #include "tegra20.dtsi" |
463 |
++#include "tegra20-cpu-opp.dtsi" |
464 |
+ |
465 |
+ / { |
466 |
+ model = "NVIDIA Tegra20 Ventana evaluation board"; |
467 |
+@@ -592,6 +593,16 @@ |
468 |
+ #clock-cells = <0>; |
469 |
+ }; |
470 |
+ |
471 |
++ cpus { |
472 |
++ cpu0: cpu@0 { |
473 |
++ operating-points-v2 = <&cpu0_opp_table>; |
474 |
++ }; |
475 |
++ |
476 |
++ cpu@1 { |
477 |
++ operating-points-v2 = <&cpu0_opp_table>; |
478 |
++ }; |
479 |
++ }; |
480 |
++ |
481 |
+ gpio-keys { |
482 |
+ compatible = "gpio-keys"; |
483 |
+ |
484 |
+diff --git a/arch/arm/crypto/aes-ce-core.S b/arch/arm/crypto/aes-ce-core.S |
485 |
+index 4d1707388d941..312428d83eedb 100644 |
486 |
+--- a/arch/arm/crypto/aes-ce-core.S |
487 |
++++ b/arch/arm/crypto/aes-ce-core.S |
488 |
+@@ -386,20 +386,32 @@ ENTRY(ce_aes_ctr_encrypt) |
489 |
+ .Lctrloop4x: |
490 |
+ subs r4, r4, #4 |
491 |
+ bmi .Lctr1x |
492 |
+- add r6, r6, #1 |
493 |
++ |
494 |
++ /* |
495 |
++ * NOTE: the sequence below has been carefully tweaked to avoid |
496 |
++ * a silicon erratum that exists in Cortex-A57 (#1742098) and |
497 |
++ * Cortex-A72 (#1655431) cores, where AESE/AESMC instruction pairs |
498 |
++ * may produce an incorrect result if they take their input from a |
499 |
++ * register of which a single 32-bit lane has been updated the last |
500 |
++ * time it was modified. To work around this, the lanes of registers |
501 |
++ * q0-q3 below are not manipulated individually, and the different |
502 |
++ * counter values are prepared by successive manipulations of q7. |
503 |
++ */ |
504 |
++ add ip, r6, #1 |
505 |
+ vmov q0, q7 |
506 |
++ rev ip, ip |
507 |
++ add lr, r6, #2 |
508 |
++ vmov s31, ip @ set lane 3 of q1 via q7 |
509 |
++ add ip, r6, #3 |
510 |
++ rev lr, lr |
511 |
+ vmov q1, q7 |
512 |
+- rev ip, r6 |
513 |
+- add r6, r6, #1 |
514 |
++ vmov s31, lr @ set lane 3 of q2 via q7 |
515 |
++ rev ip, ip |
516 |
+ vmov q2, q7 |
517 |
+- vmov s7, ip |
518 |
+- rev ip, r6 |
519 |
+- add r6, r6, #1 |
520 |
++ vmov s31, ip @ set lane 3 of q3 via q7 |
521 |
++ add r6, r6, #4 |
522 |
+ vmov q3, q7 |
523 |
+- vmov s11, ip |
524 |
+- rev ip, r6 |
525 |
+- add r6, r6, #1 |
526 |
+- vmov s15, ip |
527 |
++ |
528 |
+ vld1.8 {q4-q5}, [r1]! |
529 |
+ vld1.8 {q6}, [r1]! |
530 |
+ vld1.8 {q15}, [r1]! |
531 |
+diff --git a/arch/arm/crypto/aes-neonbs-glue.c b/arch/arm/crypto/aes-neonbs-glue.c |
532 |
+index bda8bf17631e1..f70af1d0514b9 100644 |
533 |
+--- a/arch/arm/crypto/aes-neonbs-glue.c |
534 |
++++ b/arch/arm/crypto/aes-neonbs-glue.c |
535 |
+@@ -19,7 +19,7 @@ MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@××××××.org>"); |
536 |
+ MODULE_LICENSE("GPL v2"); |
537 |
+ |
538 |
+ MODULE_ALIAS_CRYPTO("ecb(aes)"); |
539 |
+-MODULE_ALIAS_CRYPTO("cbc(aes)"); |
540 |
++MODULE_ALIAS_CRYPTO("cbc(aes)-all"); |
541 |
+ MODULE_ALIAS_CRYPTO("ctr(aes)"); |
542 |
+ MODULE_ALIAS_CRYPTO("xts(aes)"); |
543 |
+ |
544 |
+@@ -191,7 +191,8 @@ static int cbc_init(struct crypto_skcipher *tfm) |
545 |
+ struct aesbs_cbc_ctx *ctx = crypto_skcipher_ctx(tfm); |
546 |
+ unsigned int reqsize; |
547 |
+ |
548 |
+- ctx->enc_tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); |
549 |
++ ctx->enc_tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC | |
550 |
++ CRYPTO_ALG_NEED_FALLBACK); |
551 |
+ if (IS_ERR(ctx->enc_tfm)) |
552 |
+ return PTR_ERR(ctx->enc_tfm); |
553 |
+ |
554 |
+@@ -441,7 +442,8 @@ static struct skcipher_alg aes_algs[] = { { |
555 |
+ .base.cra_blocksize = AES_BLOCK_SIZE, |
556 |
+ .base.cra_ctxsize = sizeof(struct aesbs_cbc_ctx), |
557 |
+ .base.cra_module = THIS_MODULE, |
558 |
+- .base.cra_flags = CRYPTO_ALG_INTERNAL, |
559 |
++ .base.cra_flags = CRYPTO_ALG_INTERNAL | |
560 |
++ CRYPTO_ALG_NEED_FALLBACK, |
561 |
+ |
562 |
+ .min_keysize = AES_MIN_KEY_SIZE, |
563 |
+ .max_keysize = AES_MAX_KEY_SIZE, |
564 |
+diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S |
565 |
+index 55a47df047738..1c9e6d1452c5b 100644 |
566 |
+--- a/arch/arm/kernel/entry-armv.S |
567 |
++++ b/arch/arm/kernel/entry-armv.S |
568 |
+@@ -252,31 +252,10 @@ __und_svc: |
569 |
+ #else |
570 |
+ svc_entry |
571 |
+ #endif |
572 |
+- @ |
573 |
+- @ call emulation code, which returns using r9 if it has emulated |
574 |
+- @ the instruction, or the more conventional lr if we are to treat |
575 |
+- @ this as a real undefined instruction |
576 |
+- @ |
577 |
+- @ r0 - instruction |
578 |
+- @ |
579 |
+-#ifndef CONFIG_THUMB2_KERNEL |
580 |
+- ldr r0, [r4, #-4] |
581 |
+-#else |
582 |
+- mov r1, #2 |
583 |
+- ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2 |
584 |
+- cmp r0, #0xe800 @ 32-bit instruction if xx >= 0 |
585 |
+- blo __und_svc_fault |
586 |
+- ldrh r9, [r4] @ bottom 16 bits |
587 |
+- add r4, r4, #2 |
588 |
+- str r4, [sp, #S_PC] |
589 |
+- orr r0, r9, r0, lsl #16 |
590 |
+-#endif |
591 |
+- badr r9, __und_svc_finish |
592 |
+- mov r2, r4 |
593 |
+- bl call_fpe |
594 |
+ |
595 |
+ mov r1, #4 @ PC correction to apply |
596 |
+-__und_svc_fault: |
597 |
++ THUMB( tst r5, #PSR_T_BIT ) @ exception taken in Thumb mode? |
598 |
++ THUMB( movne r1, #2 ) @ if so, fix up PC correction |
599 |
+ mov r0, sp @ struct pt_regs *regs |
600 |
+ bl __und_fault |
601 |
+ |
602 |
+diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S |
603 |
+index f8904227e7fdc..98c1e68bdfcbb 100644 |
604 |
+--- a/arch/arm/kernel/head.S |
605 |
++++ b/arch/arm/kernel/head.S |
606 |
+@@ -671,12 +671,8 @@ ARM_BE8(rev16 ip, ip) |
607 |
+ ldrcc r7, [r4], #4 @ use branch for delay slot |
608 |
+ bcc 1b |
609 |
+ bx lr |
610 |
+-#else |
611 |
+-#ifdef CONFIG_CPU_ENDIAN_BE8 |
612 |
+- moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction |
613 |
+ #else |
614 |
+ moveq r0, #0x400000 @ set bit 22, mov to mvn instruction |
615 |
+-#endif |
616 |
+ b 2f |
617 |
+ 1: ldr ip, [r7, r3] |
618 |
+ #ifdef CONFIG_CPU_ENDIAN_BE8 |
619 |
+@@ -685,7 +681,7 @@ ARM_BE8(rev16 ip, ip) |
620 |
+ tst ip, #0x000f0000 @ check the rotation field |
621 |
+ orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24 |
622 |
+ biceq ip, ip, #0x00004000 @ clear bit 22 |
623 |
+- orreq ip, ip, r0 @ mask in offset bits 7-0 |
624 |
++ orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0 |
625 |
+ #else |
626 |
+ bic ip, ip, #0x000000ff |
627 |
+ tst ip, #0xf00 @ check the rotation field |
628 |
+diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S |
629 |
+index 0186cf9da890b..27b0a1f27fbdf 100644 |
630 |
+--- a/arch/arm/vfp/entry.S |
631 |
++++ b/arch/arm/vfp/entry.S |
632 |
+@@ -37,20 +37,3 @@ ENDPROC(vfp_null_entry) |
633 |
+ .align 2 |
634 |
+ .LCvfp: |
635 |
+ .word vfp_vector |
636 |
+- |
637 |
+-@ This code is called if the VFP does not exist. It needs to flag the |
638 |
+-@ failure to the VFP initialisation code. |
639 |
+- |
640 |
+- __INIT |
641 |
+-ENTRY(vfp_testing_entry) |
642 |
+- dec_preempt_count_ti r10, r4 |
643 |
+- ldr r0, VFP_arch_address |
644 |
+- str r0, [r0] @ set to non-zero value |
645 |
+- ret r9 @ we have handled the fault |
646 |
+-ENDPROC(vfp_testing_entry) |
647 |
+- |
648 |
+- .align 2 |
649 |
+-VFP_arch_address: |
650 |
+- .word VFP_arch |
651 |
+- |
652 |
+- __FINIT |
653 |
+diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S |
654 |
+index 4fcff9f59947d..d5837bf05a9a5 100644 |
655 |
+--- a/arch/arm/vfp/vfphw.S |
656 |
++++ b/arch/arm/vfp/vfphw.S |
657 |
+@@ -79,11 +79,6 @@ ENTRY(vfp_support_entry) |
658 |
+ DBGSTR3 "instr %08x pc %08x state %p", r0, r2, r10 |
659 |
+ |
660 |
+ .fpu vfpv2 |
661 |
+- ldr r3, [sp, #S_PSR] @ Neither lazy restore nor FP exceptions |
662 |
+- and r3, r3, #MODE_MASK @ are supported in kernel mode |
663 |
+- teq r3, #USR_MODE |
664 |
+- bne vfp_kmode_exception @ Returns through lr |
665 |
+- |
666 |
+ VFPFMRX r1, FPEXC @ Is the VFP enabled? |
667 |
+ DBGSTR1 "fpexc %08x", r1 |
668 |
+ tst r1, #FPEXC_EN |
669 |
+diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c |
670 |
+index 8c9e7f9f0277d..2cb355c1b5b71 100644 |
671 |
+--- a/arch/arm/vfp/vfpmodule.c |
672 |
++++ b/arch/arm/vfp/vfpmodule.c |
673 |
+@@ -23,6 +23,7 @@ |
674 |
+ #include <asm/cputype.h> |
675 |
+ #include <asm/system_info.h> |
676 |
+ #include <asm/thread_notify.h> |
677 |
++#include <asm/traps.h> |
678 |
+ #include <asm/vfp.h> |
679 |
+ |
680 |
+ #include "vfpinstr.h" |
681 |
+@@ -31,7 +32,6 @@ |
682 |
+ /* |
683 |
+ * Our undef handlers (in entry.S) |
684 |
+ */ |
685 |
+-asmlinkage void vfp_testing_entry(void); |
686 |
+ asmlinkage void vfp_support_entry(void); |
687 |
+ asmlinkage void vfp_null_entry(void); |
688 |
+ |
689 |
+@@ -42,7 +42,7 @@ asmlinkage void (*vfp_vector)(void) = vfp_null_entry; |
690 |
+ * Used in startup: set to non-zero if VFP checks fail |
691 |
+ * After startup, holds VFP architecture |
692 |
+ */ |
693 |
+-unsigned int VFP_arch; |
694 |
++static unsigned int __initdata VFP_arch; |
695 |
+ |
696 |
+ /* |
697 |
+ * The pointer to the vfpstate structure of the thread which currently |
698 |
+@@ -436,7 +436,7 @@ static void vfp_enable(void *unused) |
699 |
+ * present on all CPUs within a SMP complex. Needs to be called prior to |
700 |
+ * vfp_init(). |
701 |
+ */ |
702 |
+-void vfp_disable(void) |
703 |
++void __init vfp_disable(void) |
704 |
+ { |
705 |
+ if (VFP_arch) { |
706 |
+ pr_debug("%s: should be called prior to vfp_init\n", __func__); |
707 |
+@@ -642,7 +642,9 @@ static int vfp_starting_cpu(unsigned int unused) |
708 |
+ return 0; |
709 |
+ } |
710 |
+ |
711 |
+-void vfp_kmode_exception(void) |
712 |
++#ifdef CONFIG_KERNEL_MODE_NEON |
713 |
++ |
714 |
++static int vfp_kmode_exception(struct pt_regs *regs, unsigned int instr) |
715 |
+ { |
716 |
+ /* |
717 |
+ * If we reach this point, a floating point exception has been raised |
718 |
+@@ -660,9 +662,51 @@ void vfp_kmode_exception(void) |
719 |
+ pr_crit("BUG: unsupported FP instruction in kernel mode\n"); |
720 |
+ else |
721 |
+ pr_crit("BUG: FP instruction issued in kernel mode with FP unit disabled\n"); |
722 |
++ pr_crit("FPEXC == 0x%08x\n", fmrx(FPEXC)); |
723 |
++ return 1; |
724 |
+ } |
725 |
+ |
726 |
+-#ifdef CONFIG_KERNEL_MODE_NEON |
727 |
++static struct undef_hook vfp_kmode_exception_hook[] = {{ |
728 |
++ .instr_mask = 0xfe000000, |
729 |
++ .instr_val = 0xf2000000, |
730 |
++ .cpsr_mask = MODE_MASK | PSR_T_BIT, |
731 |
++ .cpsr_val = SVC_MODE, |
732 |
++ .fn = vfp_kmode_exception, |
733 |
++}, { |
734 |
++ .instr_mask = 0xff100000, |
735 |
++ .instr_val = 0xf4000000, |
736 |
++ .cpsr_mask = MODE_MASK | PSR_T_BIT, |
737 |
++ .cpsr_val = SVC_MODE, |
738 |
++ .fn = vfp_kmode_exception, |
739 |
++}, { |
740 |
++ .instr_mask = 0xef000000, |
741 |
++ .instr_val = 0xef000000, |
742 |
++ .cpsr_mask = MODE_MASK | PSR_T_BIT, |
743 |
++ .cpsr_val = SVC_MODE | PSR_T_BIT, |
744 |
++ .fn = vfp_kmode_exception, |
745 |
++}, { |
746 |
++ .instr_mask = 0xff100000, |
747 |
++ .instr_val = 0xf9000000, |
748 |
++ .cpsr_mask = MODE_MASK | PSR_T_BIT, |
749 |
++ .cpsr_val = SVC_MODE | PSR_T_BIT, |
750 |
++ .fn = vfp_kmode_exception, |
751 |
++}, { |
752 |
++ .instr_mask = 0x0c000e00, |
753 |
++ .instr_val = 0x0c000a00, |
754 |
++ .cpsr_mask = MODE_MASK, |
755 |
++ .cpsr_val = SVC_MODE, |
756 |
++ .fn = vfp_kmode_exception, |
757 |
++}}; |
758 |
++ |
759 |
++static int __init vfp_kmode_exception_hook_init(void) |
760 |
++{ |
761 |
++ int i; |
762 |
++ |
763 |
++ for (i = 0; i < ARRAY_SIZE(vfp_kmode_exception_hook); i++) |
764 |
++ register_undef_hook(&vfp_kmode_exception_hook[i]); |
765 |
++ return 0; |
766 |
++} |
767 |
++subsys_initcall(vfp_kmode_exception_hook_init); |
768 |
+ |
769 |
+ /* |
770 |
+ * Kernel-side NEON support functions |
771 |
+@@ -708,6 +752,21 @@ EXPORT_SYMBOL(kernel_neon_end); |
772 |
+ |
773 |
+ #endif /* CONFIG_KERNEL_MODE_NEON */ |
774 |
+ |
775 |
++static int __init vfp_detect(struct pt_regs *regs, unsigned int instr) |
776 |
++{ |
777 |
++ VFP_arch = UINT_MAX; /* mark as not present */ |
778 |
++ regs->ARM_pc += 4; |
779 |
++ return 0; |
780 |
++} |
781 |
++ |
782 |
++static struct undef_hook vfp_detect_hook __initdata = { |
783 |
++ .instr_mask = 0x0c000e00, |
784 |
++ .instr_val = 0x0c000a00, |
785 |
++ .cpsr_mask = MODE_MASK, |
786 |
++ .cpsr_val = SVC_MODE, |
787 |
++ .fn = vfp_detect, |
788 |
++}; |
789 |
++ |
790 |
+ /* |
791 |
+ * VFP support code initialisation. |
792 |
+ */ |
793 |
+@@ -728,10 +787,11 @@ static int __init vfp_init(void) |
794 |
+ * The handler is already setup to just log calls, so |
795 |
+ * we just need to read the VFPSID register. |
796 |
+ */ |
797 |
+- vfp_vector = vfp_testing_entry; |
798 |
++ register_undef_hook(&vfp_detect_hook); |
799 |
+ barrier(); |
800 |
+ vfpsid = fmrx(FPSID); |
801 |
+ barrier(); |
802 |
++ unregister_undef_hook(&vfp_detect_hook); |
803 |
+ vfp_vector = vfp_null_entry; |
804 |
+ |
805 |
+ pr_info("VFP support v0.3: "); |
806 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts |
807 |
+index 1b07c8c06eac5..463a72d6bb7c7 100644 |
808 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts |
809 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts |
810 |
+@@ -340,7 +340,7 @@ |
811 |
+ eee-broken-1000t; |
812 |
+ |
813 |
+ reset-assert-us = <10000>; |
814 |
+- reset-deassert-us = <30000>; |
815 |
++ reset-deassert-us = <80000>; |
816 |
+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; |
817 |
+ |
818 |
+ interrupt-parent = <&gpio_intc>; |
819 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi |
820 |
+index 6982632ae6461..39a09661c5f62 100644 |
821 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi |
822 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi |
823 |
+@@ -413,7 +413,7 @@ |
824 |
+ max-speed = <1000>; |
825 |
+ |
826 |
+ reset-assert-us = <10000>; |
827 |
+- reset-deassert-us = <30000>; |
828 |
++ reset-deassert-us = <80000>; |
829 |
+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; |
830 |
+ |
831 |
+ interrupt-parent = <&gpio_intc>; |
832 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi |
833 |
+index 2802ddbb83ac7..feb0885047400 100644 |
834 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi |
835 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi |
836 |
+@@ -264,7 +264,7 @@ |
837 |
+ max-speed = <1000>; |
838 |
+ |
839 |
+ reset-assert-us = <10000>; |
840 |
+- reset-deassert-us = <30000>; |
841 |
++ reset-deassert-us = <80000>; |
842 |
+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; |
843 |
+ |
844 |
+ interrupt-parent = <&gpio_intc>; |
845 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
846 |
+index 7be3e354093bf..de27beafe9db9 100644 |
847 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
848 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
849 |
+@@ -165,7 +165,7 @@ |
850 |
+ reg = <0>; |
851 |
+ |
852 |
+ reset-assert-us = <10000>; |
853 |
+- reset-deassert-us = <30000>; |
854 |
++ reset-deassert-us = <80000>; |
855 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
856 |
+ |
857 |
+ interrupt-parent = <&gpio_intc>; |
858 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
859 |
+index 70fcfb7b0683d..50de1d01e5655 100644 |
860 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
861 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
862 |
+@@ -200,7 +200,7 @@ |
863 |
+ reg = <0>; |
864 |
+ |
865 |
+ reset-assert-us = <10000>; |
866 |
+- reset-deassert-us = <30000>; |
867 |
++ reset-deassert-us = <80000>; |
868 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
869 |
+ |
870 |
+ interrupt-parent = <&gpio_intc>; |
871 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
872 |
+index 222ee8069cfaa..9b0b81f191f1f 100644 |
873 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
874 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
875 |
+@@ -126,7 +126,7 @@ |
876 |
+ reg = <0>; |
877 |
+ |
878 |
+ reset-assert-us = <10000>; |
879 |
+- reset-deassert-us = <30000>; |
880 |
++ reset-deassert-us = <80000>; |
881 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
882 |
+ |
883 |
+ interrupt-parent = <&gpio_intc>; |
884 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
885 |
+index ad812854a107f..a350fee1264d7 100644 |
886 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
887 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
888 |
+@@ -147,7 +147,7 @@ |
889 |
+ reg = <0>; |
890 |
+ |
891 |
+ reset-assert-us = <10000>; |
892 |
+- reset-deassert-us = <30000>; |
893 |
++ reset-deassert-us = <80000>; |
894 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
895 |
+ |
896 |
+ interrupt-parent = <&gpio_intc>; |
897 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts |
898 |
+index b08c4537f260d..b2ab05c220903 100644 |
899 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts |
900 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts |
901 |
+@@ -82,7 +82,7 @@ |
902 |
+ |
903 |
+ /* External PHY reset is shared with internal PHY Led signal */ |
904 |
+ reset-assert-us = <10000>; |
905 |
+- reset-deassert-us = <30000>; |
906 |
++ reset-deassert-us = <80000>; |
907 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
908 |
+ |
909 |
+ interrupt-parent = <&gpio_intc>; |
910 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
911 |
+index bff8ec2c1c70c..62d3e04299b67 100644 |
912 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
913 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts |
914 |
+@@ -194,7 +194,7 @@ |
915 |
+ reg = <0>; |
916 |
+ |
917 |
+ reset-assert-us = <10000>; |
918 |
+- reset-deassert-us = <30000>; |
919 |
++ reset-deassert-us = <80000>; |
920 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
921 |
+ |
922 |
+ interrupt-parent = <&gpio_intc>; |
923 |
+@@ -341,7 +341,7 @@ |
924 |
+ #size-cells = <1>; |
925 |
+ compatible = "winbond,w25q16", "jedec,spi-nor"; |
926 |
+ reg = <0>; |
927 |
+- spi-max-frequency = <3000000>; |
928 |
++ spi-max-frequency = <104000000>; |
929 |
+ }; |
930 |
+ }; |
931 |
+ |
932 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |
933 |
+index 83eca3af44ce7..dfa7a37a1281f 100644 |
934 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |
935 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts |
936 |
+@@ -112,7 +112,7 @@ |
937 |
+ max-speed = <1000>; |
938 |
+ |
939 |
+ reset-assert-us = <10000>; |
940 |
+- reset-deassert-us = <30000>; |
941 |
++ reset-deassert-us = <80000>; |
942 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
943 |
+ }; |
944 |
+ }; |
945 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts |
946 |
+index ea45ae0c71b7f..8edbfe040805c 100644 |
947 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts |
948 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-q200.dts |
949 |
+@@ -64,7 +64,7 @@ |
950 |
+ |
951 |
+ /* External PHY reset is shared with internal PHY Led signal */ |
952 |
+ reset-assert-us = <10000>; |
953 |
+- reset-deassert-us = <30000>; |
954 |
++ reset-deassert-us = <80000>; |
955 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
956 |
+ |
957 |
+ interrupt-parent = <&gpio_intc>; |
958 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
959 |
+index c89c9f846fb10..dde7cfe12cffa 100644 |
960 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
961 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
962 |
+@@ -114,7 +114,7 @@ |
963 |
+ max-speed = <1000>; |
964 |
+ |
965 |
+ reset-assert-us = <10000>; |
966 |
+- reset-deassert-us = <30000>; |
967 |
++ reset-deassert-us = <80000>; |
968 |
+ reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; |
969 |
+ }; |
970 |
+ }; |
971 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi |
972 |
+index 71317f5aada1d..c309517abae32 100644 |
973 |
+--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi |
974 |
++++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi |
975 |
+@@ -130,7 +130,7 @@ |
976 |
+ opp-microvolt = <790000>; |
977 |
+ }; |
978 |
+ |
979 |
+- opp-1512000000 { |
980 |
++ opp-1500000000 { |
981 |
+ opp-hz = /bits/ 64 <1500000000>; |
982 |
+ opp-microvolt = <800000>; |
983 |
+ }; |
984 |
+diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
985 |
+index b9ed6a33e2901..7599e1a00ff51 100644 |
986 |
+--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi |
987 |
++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
988 |
+@@ -79,8 +79,10 @@ |
989 |
+ }; |
990 |
+ |
991 |
+ psci { |
992 |
+- compatible = "arm,psci-0.2"; |
993 |
++ compatible = "arm,psci"; |
994 |
+ method = "smc"; |
995 |
++ cpu_off = <0x84000002>; |
996 |
++ cpu_on = <0xC4000003>; |
997 |
+ }; |
998 |
+ |
999 |
+ soc: soc@0 { |
1000 |
+@@ -481,13 +483,6 @@ |
1001 |
+ pmu_system_controller: system-controller@105c0000 { |
1002 |
+ compatible = "samsung,exynos7-pmu", "syscon"; |
1003 |
+ reg = <0x105c0000 0x5000>; |
1004 |
+- |
1005 |
+- reboot: syscon-reboot { |
1006 |
+- compatible = "syscon-reboot"; |
1007 |
+- regmap = <&pmu_system_controller>; |
1008 |
+- offset = <0x0400>; |
1009 |
+- mask = <0x1>; |
1010 |
+- }; |
1011 |
+ }; |
1012 |
+ |
1013 |
+ rtc: rtc@10590000 { |
1014 |
+@@ -687,3 +682,4 @@ |
1015 |
+ }; |
1016 |
+ |
1017 |
+ #include "exynos7-pinctrl.dtsi" |
1018 |
++#include "arm/exynos-syscon-restart.dtsi" |
1019 |
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts |
1020 |
+index 8161dd2379712..b3fa4dbeebd52 100644 |
1021 |
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts |
1022 |
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts |
1023 |
+@@ -155,20 +155,10 @@ |
1024 |
+ }; |
1025 |
+ |
1026 |
+ partition@210000 { |
1027 |
+- reg = <0x210000 0x0f0000>; |
1028 |
++ reg = <0x210000 0x1d0000>; |
1029 |
+ label = "bootloader"; |
1030 |
+ }; |
1031 |
+ |
1032 |
+- partition@300000 { |
1033 |
+- reg = <0x300000 0x040000>; |
1034 |
+- label = "DP firmware"; |
1035 |
+- }; |
1036 |
+- |
1037 |
+- partition@340000 { |
1038 |
+- reg = <0x340000 0x0a0000>; |
1039 |
+- label = "trusted firmware"; |
1040 |
+- }; |
1041 |
+- |
1042 |
+ partition@3e0000 { |
1043 |
+ reg = <0x3e0000 0x020000>; |
1044 |
+ label = "bootloader environment"; |
1045 |
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
1046 |
+index 7a6fb7e1fb82f..33aa0efa2293a 100644 |
1047 |
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
1048 |
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi |
1049 |
+@@ -309,7 +309,7 @@ |
1050 |
+ <0x0 0x20000000 0x0 0x10000000>; |
1051 |
+ reg-names = "fspi_base", "fspi_mmap"; |
1052 |
+ interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; |
1053 |
+- clocks = <&clockgen 4 3>, <&clockgen 4 3>; |
1054 |
++ clocks = <&clockgen 2 0>, <&clockgen 2 0>; |
1055 |
+ clock-names = "fspi_en", "fspi"; |
1056 |
+ status = "disabled"; |
1057 |
+ }; |
1058 |
+@@ -934,7 +934,7 @@ |
1059 |
+ ethernet@0,4 { |
1060 |
+ compatible = "fsl,enetc-ptp"; |
1061 |
+ reg = <0x000400 0 0 0 0>; |
1062 |
+- clocks = <&clockgen 4 0>; |
1063 |
++ clocks = <&clockgen 2 3>; |
1064 |
+ little-endian; |
1065 |
+ fsl,extts-fifo; |
1066 |
+ }; |
1067 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1068 |
+index f3a678e0fd99b..bf76ebe463794 100644 |
1069 |
+--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1070 |
++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1071 |
+@@ -146,7 +146,7 @@ |
1072 |
+ pinctrl-names = "default"; |
1073 |
+ pinctrl-0 = <&rgmii_pins>; |
1074 |
+ phy-mode = "rgmii-id"; |
1075 |
+- phy = <&phy1>; |
1076 |
++ phy-handle = <&phy1>; |
1077 |
+ status = "okay"; |
1078 |
+ }; |
1079 |
+ |
1080 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-7040.dtsi b/arch/arm64/boot/dts/marvell/armada-7040.dtsi |
1081 |
+index 7a3198cd7a071..2f440711d21d2 100644 |
1082 |
+--- a/arch/arm64/boot/dts/marvell/armada-7040.dtsi |
1083 |
++++ b/arch/arm64/boot/dts/marvell/armada-7040.dtsi |
1084 |
+@@ -15,10 +15,6 @@ |
1085 |
+ "marvell,armada-ap806"; |
1086 |
+ }; |
1087 |
+ |
1088 |
+-&smmu { |
1089 |
+- status = "okay"; |
1090 |
+-}; |
1091 |
+- |
1092 |
+ &cp0_pcie0 { |
1093 |
+ iommu-map = |
1094 |
+ <0x0 &smmu 0x480 0x20>, |
1095 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-8040.dtsi b/arch/arm64/boot/dts/marvell/armada-8040.dtsi |
1096 |
+index 79e8ce59baa88..22c2d6ebf3818 100644 |
1097 |
+--- a/arch/arm64/boot/dts/marvell/armada-8040.dtsi |
1098 |
++++ b/arch/arm64/boot/dts/marvell/armada-8040.dtsi |
1099 |
+@@ -15,10 +15,6 @@ |
1100 |
+ "marvell,armada-ap806"; |
1101 |
+ }; |
1102 |
+ |
1103 |
+-&smmu { |
1104 |
+- status = "okay"; |
1105 |
+-}; |
1106 |
+- |
1107 |
+ &cp0_pcie0 { |
1108 |
+ iommu-map = |
1109 |
+ <0x0 &smmu 0x480 0x20>, |
1110 |
+diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi |
1111 |
+index 9cfd961c45eb3..08a914d3a6435 100644 |
1112 |
+--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi |
1113 |
++++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi |
1114 |
+@@ -363,7 +363,7 @@ |
1115 |
+ compatible = "mediatek,mt8183-gce"; |
1116 |
+ reg = <0 0x10238000 0 0x4000>; |
1117 |
+ interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_LOW>; |
1118 |
+- #mbox-cells = <3>; |
1119 |
++ #mbox-cells = <2>; |
1120 |
+ clocks = <&infracfg CLK_INFRA_GCE>; |
1121 |
+ clock-names = "gce"; |
1122 |
+ }; |
1123 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1124 |
+index 93438d2b94696..6946fb210e484 100644 |
1125 |
+--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1126 |
++++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1127 |
+@@ -378,7 +378,7 @@ |
1128 |
+ nvidia,schmitt = <TEGRA_PIN_DISABLE>; |
1129 |
+ nvidia,lpdr = <TEGRA_PIN_ENABLE>; |
1130 |
+ nvidia,enable-input = <TEGRA_PIN_DISABLE>; |
1131 |
+- nvidia,io-high-voltage = <TEGRA_PIN_ENABLE>; |
1132 |
++ nvidia,io-hv = <TEGRA_PIN_ENABLE>; |
1133 |
+ nvidia,tristate = <TEGRA_PIN_DISABLE>; |
1134 |
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
1135 |
+ }; |
1136 |
+@@ -390,7 +390,7 @@ |
1137 |
+ nvidia,schmitt = <TEGRA_PIN_DISABLE>; |
1138 |
+ nvidia,lpdr = <TEGRA_PIN_ENABLE>; |
1139 |
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>; |
1140 |
+- nvidia,io-high-voltage = <TEGRA_PIN_ENABLE>; |
1141 |
++ nvidia,io-hv = <TEGRA_PIN_ENABLE>; |
1142 |
+ nvidia,tristate = <TEGRA_PIN_DISABLE>; |
1143 |
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
1144 |
+ }; |
1145 |
+diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi |
1146 |
+index 59e0cbfa22143..cdc1e3d60c58e 100644 |
1147 |
+--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi |
1148 |
++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi |
1149 |
+@@ -156,8 +156,8 @@ |
1150 |
+ no-map; |
1151 |
+ }; |
1152 |
+ |
1153 |
+- tz: tz@48500000 { |
1154 |
+- reg = <0x0 0x48500000 0x0 0x00200000>; |
1155 |
++ tz: memory@4a600000 { |
1156 |
++ reg = <0x0 0x4a600000 0x0 0x00400000>; |
1157 |
+ no-map; |
1158 |
+ }; |
1159 |
+ |
1160 |
+@@ -167,7 +167,7 @@ |
1161 |
+ }; |
1162 |
+ |
1163 |
+ q6_region: memory@4ab00000 { |
1164 |
+- reg = <0x0 0x4ab00000 0x0 0x02800000>; |
1165 |
++ reg = <0x0 0x4ab00000 0x0 0x05500000>; |
1166 |
+ no-map; |
1167 |
+ }; |
1168 |
+ }; |
1169 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi b/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi |
1170 |
+index b18d21e42f596..f7ac4c4033db6 100644 |
1171 |
+--- a/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi |
1172 |
++++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi |
1173 |
+@@ -78,6 +78,9 @@ |
1174 |
+ sda-gpios = <&msmgpio 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; |
1175 |
+ scl-gpios = <&msmgpio 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; |
1176 |
+ |
1177 |
++ pinctrl-names = "default"; |
1178 |
++ pinctrl-0 = <&muic_i2c_default>; |
1179 |
++ |
1180 |
+ #address-cells = <1>; |
1181 |
+ #size-cells = <0>; |
1182 |
+ |
1183 |
+@@ -314,6 +317,14 @@ |
1184 |
+ }; |
1185 |
+ }; |
1186 |
+ |
1187 |
++ muic_i2c_default: muic-i2c-default { |
1188 |
++ pins = "gpio105", "gpio106"; |
1189 |
++ function = "gpio"; |
1190 |
++ |
1191 |
++ drive-strength = <2>; |
1192 |
++ bias-disable; |
1193 |
++ }; |
1194 |
++ |
1195 |
+ muic_int_default: muic-int-default { |
1196 |
+ pins = "gpio12"; |
1197 |
+ function = "gpio"; |
1198 |
+diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1199 |
+index 6678f1e8e3958..c71f3afc1cc9f 100644 |
1200 |
+--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1201 |
++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1202 |
+@@ -1394,7 +1394,8 @@ |
1203 |
+ ipa: ipa@1e40000 { |
1204 |
+ compatible = "qcom,sc7180-ipa"; |
1205 |
+ |
1206 |
+- iommus = <&apps_smmu 0x440 0x3>; |
1207 |
++ iommus = <&apps_smmu 0x440 0x0>, |
1208 |
++ <&apps_smmu 0x442 0x0>; |
1209 |
+ reg = <0 0x1e40000 0 0x7000>, |
1210 |
+ <0 0x1e47000 0 0x2000>, |
1211 |
+ <0 0x1e04000 0 0x2c000>; |
1212 |
+@@ -2811,7 +2812,7 @@ |
1213 |
+ interrupt-controller; |
1214 |
+ #interrupt-cells = <1>; |
1215 |
+ |
1216 |
+- interconnects = <&mmss_noc MASTER_MDP0 &mc_virt SLAVE_EBI1>; |
1217 |
++ interconnects = <&mmss_noc MASTER_MDP0 0 &mc_virt SLAVE_EBI1 0>; |
1218 |
+ interconnect-names = "mdp0-mem"; |
1219 |
+ |
1220 |
+ iommus = <&apps_smmu 0x800 0x2>; |
1221 |
+diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi |
1222 |
+index 40e8c11f23ab0..f97f354af86f4 100644 |
1223 |
+--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi |
1224 |
++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi |
1225 |
+@@ -2141,7 +2141,8 @@ |
1226 |
+ ipa: ipa@1e40000 { |
1227 |
+ compatible = "qcom,sdm845-ipa"; |
1228 |
+ |
1229 |
+- iommus = <&apps_smmu 0x720 0x3>; |
1230 |
++ iommus = <&apps_smmu 0x720 0x0>, |
1231 |
++ <&apps_smmu 0x722 0x0>; |
1232 |
+ reg = <0 0x1e40000 0 0x7000>, |
1233 |
+ <0 0x1e47000 0 0x2000>, |
1234 |
+ <0 0x1e04000 0 0x2c000>; |
1235 |
+diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1236 |
+index d03ca31907466..76a8c996d497f 100644 |
1237 |
+--- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1238 |
++++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1239 |
+@@ -264,23 +264,28 @@ |
1240 |
+ status = "okay"; |
1241 |
+ clock-frequency = <400000>; |
1242 |
+ |
1243 |
+- hid@15 { |
1244 |
++ tsel: hid@15 { |
1245 |
+ compatible = "hid-over-i2c"; |
1246 |
+ reg = <0x15>; |
1247 |
+ hid-descr-addr = <0x1>; |
1248 |
+ |
1249 |
+- interrupts-extended = <&tlmm 37 IRQ_TYPE_EDGE_RISING>; |
1250 |
++ interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>; |
1251 |
++ |
1252 |
++ pinctrl-names = "default"; |
1253 |
++ pinctrl-0 = <&i2c3_hid_active>; |
1254 |
+ }; |
1255 |
+ |
1256 |
+- hid@2c { |
1257 |
++ tsc2: hid@2c { |
1258 |
+ compatible = "hid-over-i2c"; |
1259 |
+ reg = <0x2c>; |
1260 |
+ hid-descr-addr = <0x20>; |
1261 |
+ |
1262 |
+- interrupts-extended = <&tlmm 37 IRQ_TYPE_EDGE_RISING>; |
1263 |
++ interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>; |
1264 |
+ |
1265 |
+ pinctrl-names = "default"; |
1266 |
+- pinctrl-0 = <&i2c2_hid_active>; |
1267 |
++ pinctrl-0 = <&i2c3_hid_active>; |
1268 |
++ |
1269 |
++ status = "disabled"; |
1270 |
+ }; |
1271 |
+ }; |
1272 |
+ |
1273 |
+@@ -288,15 +293,15 @@ |
1274 |
+ status = "okay"; |
1275 |
+ clock-frequency = <400000>; |
1276 |
+ |
1277 |
+- hid@10 { |
1278 |
++ tsc1: hid@10 { |
1279 |
+ compatible = "hid-over-i2c"; |
1280 |
+ reg = <0x10>; |
1281 |
+ hid-descr-addr = <0x1>; |
1282 |
+ |
1283 |
+- interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>; |
1284 |
++ interrupts-extended = <&tlmm 125 IRQ_TYPE_LEVEL_LOW>; |
1285 |
+ |
1286 |
+ pinctrl-names = "default"; |
1287 |
+- pinctrl-0 = <&i2c6_hid_active>; |
1288 |
++ pinctrl-0 = <&i2c5_hid_active>; |
1289 |
+ }; |
1290 |
+ }; |
1291 |
+ |
1292 |
+@@ -304,7 +309,7 @@ |
1293 |
+ status = "okay"; |
1294 |
+ clock-frequency = <400000>; |
1295 |
+ |
1296 |
+- hid@5c { |
1297 |
++ ecsh: hid@5c { |
1298 |
+ compatible = "hid-over-i2c"; |
1299 |
+ reg = <0x5c>; |
1300 |
+ hid-descr-addr = <0x1>; |
1301 |
+@@ -312,7 +317,7 @@ |
1302 |
+ interrupts-extended = <&tlmm 92 IRQ_TYPE_LEVEL_LOW>; |
1303 |
+ |
1304 |
+ pinctrl-names = "default"; |
1305 |
+- pinctrl-0 = <&i2c12_hid_active>; |
1306 |
++ pinctrl-0 = <&i2c11_hid_active>; |
1307 |
+ }; |
1308 |
+ }; |
1309 |
+ |
1310 |
+@@ -426,8 +431,8 @@ |
1311 |
+ &tlmm { |
1312 |
+ gpio-reserved-ranges = <0 4>, <81 4>; |
1313 |
+ |
1314 |
+- i2c2_hid_active: i2c2-hid-active { |
1315 |
+- pins = <37>; |
1316 |
++ i2c3_hid_active: i2c2-hid-active { |
1317 |
++ pins = "gpio37"; |
1318 |
+ function = "gpio"; |
1319 |
+ |
1320 |
+ input-enable; |
1321 |
+@@ -435,8 +440,8 @@ |
1322 |
+ drive-strength = <2>; |
1323 |
+ }; |
1324 |
+ |
1325 |
+- i2c6_hid_active: i2c6-hid-active { |
1326 |
+- pins = <125>; |
1327 |
++ i2c5_hid_active: i2c5-hid-active { |
1328 |
++ pins = "gpio125"; |
1329 |
+ function = "gpio"; |
1330 |
+ |
1331 |
+ input-enable; |
1332 |
+@@ -444,8 +449,8 @@ |
1333 |
+ drive-strength = <2>; |
1334 |
+ }; |
1335 |
+ |
1336 |
+- i2c12_hid_active: i2c12-hid-active { |
1337 |
+- pins = <92>; |
1338 |
++ i2c11_hid_active: i2c11-hid-active { |
1339 |
++ pins = "gpio92"; |
1340 |
+ function = "gpio"; |
1341 |
+ |
1342 |
+ input-enable; |
1343 |
+@@ -454,7 +459,7 @@ |
1344 |
+ }; |
1345 |
+ |
1346 |
+ wcd_intr_default: wcd_intr_default { |
1347 |
+- pins = <54>; |
1348 |
++ pins = "gpio54"; |
1349 |
+ function = "gpio"; |
1350 |
+ |
1351 |
+ input-enable; |
1352 |
+diff --git a/arch/arm64/boot/dts/qcom/sm8250-mtp.dts b/arch/arm64/boot/dts/qcom/sm8250-mtp.dts |
1353 |
+index fd194ed7fbc86..98675e1f8204f 100644 |
1354 |
+--- a/arch/arm64/boot/dts/qcom/sm8250-mtp.dts |
1355 |
++++ b/arch/arm64/boot/dts/qcom/sm8250-mtp.dts |
1356 |
+@@ -14,7 +14,7 @@ |
1357 |
+ |
1358 |
+ / { |
1359 |
+ model = "Qualcomm Technologies, Inc. SM8250 MTP"; |
1360 |
+- compatible = "qcom,sm8250-mtp"; |
1361 |
++ compatible = "qcom,sm8250-mtp", "qcom,sm8250"; |
1362 |
+ |
1363 |
+ aliases { |
1364 |
+ serial0 = &uart12; |
1365 |
+diff --git a/arch/arm64/boot/dts/renesas/cat875.dtsi b/arch/arm64/boot/dts/renesas/cat875.dtsi |
1366 |
+index 33daa95706840..801ea54b027c4 100644 |
1367 |
+--- a/arch/arm64/boot/dts/renesas/cat875.dtsi |
1368 |
++++ b/arch/arm64/boot/dts/renesas/cat875.dtsi |
1369 |
+@@ -21,7 +21,6 @@ |
1370 |
+ status = "okay"; |
1371 |
+ |
1372 |
+ phy0: ethernet-phy@0 { |
1373 |
+- rxc-skew-ps = <1500>; |
1374 |
+ reg = <0>; |
1375 |
+ interrupt-parent = <&gpio2>; |
1376 |
+ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; |
1377 |
+diff --git a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi |
1378 |
+index 178401a34cbf8..b9e46aed53362 100644 |
1379 |
+--- a/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi |
1380 |
++++ b/arch/arm64/boot/dts/renesas/hihope-rzg2-ex.dtsi |
1381 |
+@@ -23,7 +23,6 @@ |
1382 |
+ status = "okay"; |
1383 |
+ |
1384 |
+ phy0: ethernet-phy@0 { |
1385 |
+- rxc-skew-ps = <1500>; |
1386 |
+ reg = <0>; |
1387 |
+ interrupt-parent = <&gpio2>; |
1388 |
+ interrupts = <11 IRQ_TYPE_LEVEL_LOW>; |
1389 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts |
1390 |
+index b70ffb1c6a630..b76282e704de1 100644 |
1391 |
+--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts |
1392 |
++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts |
1393 |
+@@ -334,6 +334,7 @@ |
1394 |
+ }; |
1395 |
+ |
1396 |
+ &usb20_otg { |
1397 |
++ dr_mode = "host"; |
1398 |
+ status = "okay"; |
1399 |
+ }; |
1400 |
+ |
1401 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi |
1402 |
+index bbdb19a3e85d1..db0d5c8e5f96a 100644 |
1403 |
+--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi |
1404 |
++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi |
1405 |
+@@ -1237,8 +1237,8 @@ |
1406 |
+ |
1407 |
+ uart0 { |
1408 |
+ uart0_xfer: uart0-xfer { |
1409 |
+- rockchip,pins = <1 RK_PB1 1 &pcfg_pull_up>, |
1410 |
+- <1 RK_PB0 1 &pcfg_pull_none>; |
1411 |
++ rockchip,pins = <1 RK_PB1 1 &pcfg_pull_none>, |
1412 |
++ <1 RK_PB0 1 &pcfg_pull_up>; |
1413 |
+ }; |
1414 |
+ |
1415 |
+ uart0_cts: uart0-cts { |
1416 |
+@@ -1256,8 +1256,8 @@ |
1417 |
+ |
1418 |
+ uart1 { |
1419 |
+ uart1_xfer: uart1-xfer { |
1420 |
+- rockchip,pins = <3 RK_PA4 4 &pcfg_pull_up>, |
1421 |
+- <3 RK_PA6 4 &pcfg_pull_none>; |
1422 |
++ rockchip,pins = <3 RK_PA4 4 &pcfg_pull_none>, |
1423 |
++ <3 RK_PA6 4 &pcfg_pull_up>; |
1424 |
+ }; |
1425 |
+ |
1426 |
+ uart1_cts: uart1-cts { |
1427 |
+@@ -1275,15 +1275,15 @@ |
1428 |
+ |
1429 |
+ uart2-0 { |
1430 |
+ uart2m0_xfer: uart2m0-xfer { |
1431 |
+- rockchip,pins = <1 RK_PA0 2 &pcfg_pull_up>, |
1432 |
+- <1 RK_PA1 2 &pcfg_pull_none>; |
1433 |
++ rockchip,pins = <1 RK_PA0 2 &pcfg_pull_none>, |
1434 |
++ <1 RK_PA1 2 &pcfg_pull_up>; |
1435 |
+ }; |
1436 |
+ }; |
1437 |
+ |
1438 |
+ uart2-1 { |
1439 |
+ uart2m1_xfer: uart2m1-xfer { |
1440 |
+- rockchip,pins = <2 RK_PA0 1 &pcfg_pull_up>, |
1441 |
+- <2 RK_PA1 1 &pcfg_pull_none>; |
1442 |
++ rockchip,pins = <2 RK_PA0 1 &pcfg_pull_none>, |
1443 |
++ <2 RK_PA1 1 &pcfg_pull_up>; |
1444 |
+ }; |
1445 |
+ }; |
1446 |
+ |
1447 |
+diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi |
1448 |
+index 533525229a8db..b9662205be9bf 100644 |
1449 |
+--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi |
1450 |
++++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi |
1451 |
+@@ -834,7 +834,7 @@ |
1452 |
+ }; |
1453 |
+ }; |
1454 |
+ |
1455 |
+- dss: dss@04a00000 { |
1456 |
++ dss: dss@4a00000 { |
1457 |
+ compatible = "ti,am65x-dss"; |
1458 |
+ reg = <0x0 0x04a00000 0x0 0x1000>, /* common */ |
1459 |
+ <0x0 0x04a02000 0x0 0x1000>, /* vidl1 */ |
1460 |
+@@ -867,6 +867,8 @@ |
1461 |
+ |
1462 |
+ status = "disabled"; |
1463 |
+ |
1464 |
++ dma-coherent; |
1465 |
++ |
1466 |
+ dss_ports: ports { |
1467 |
+ #address-cells = <1>; |
1468 |
+ #size-cells = <0>; |
1469 |
+diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi |
1470 |
+index e2a96b2c423c4..c66ded9079be4 100644 |
1471 |
+--- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi |
1472 |
++++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi |
1473 |
+@@ -1278,7 +1278,7 @@ |
1474 |
+ }; |
1475 |
+ }; |
1476 |
+ |
1477 |
+- dss: dss@04a00000 { |
1478 |
++ dss: dss@4a00000 { |
1479 |
+ compatible = "ti,j721e-dss"; |
1480 |
+ reg = |
1481 |
+ <0x00 0x04a00000 0x00 0x10000>, /* common_m */ |
1482 |
+diff --git a/arch/arm64/crypto/poly1305-armv8.pl b/arch/arm64/crypto/poly1305-armv8.pl |
1483 |
+index 6e5576d19af8f..cbc980fb02e33 100644 |
1484 |
+--- a/arch/arm64/crypto/poly1305-armv8.pl |
1485 |
++++ b/arch/arm64/crypto/poly1305-armv8.pl |
1486 |
+@@ -840,7 +840,6 @@ poly1305_blocks_neon: |
1487 |
+ ldp d14,d15,[sp,#64] |
1488 |
+ addp $ACC2,$ACC2,$ACC2 |
1489 |
+ ldr x30,[sp,#8] |
1490 |
+- .inst 0xd50323bf // autiasp |
1491 |
+ |
1492 |
+ //////////////////////////////////////////////////////////////// |
1493 |
+ // lazy reduction, but without narrowing |
1494 |
+@@ -882,6 +881,7 @@ poly1305_blocks_neon: |
1495 |
+ str x4,[$ctx,#8] // set is_base2_26 |
1496 |
+ |
1497 |
+ ldr x29,[sp],#80 |
1498 |
++ .inst 0xd50323bf // autiasp |
1499 |
+ ret |
1500 |
+ .size poly1305_blocks_neon,.-poly1305_blocks_neon |
1501 |
+ |
1502 |
+diff --git a/arch/arm64/crypto/poly1305-core.S_shipped b/arch/arm64/crypto/poly1305-core.S_shipped |
1503 |
+index 8d1c4e420ccdc..fb2822abf63aa 100644 |
1504 |
+--- a/arch/arm64/crypto/poly1305-core.S_shipped |
1505 |
++++ b/arch/arm64/crypto/poly1305-core.S_shipped |
1506 |
+@@ -779,7 +779,6 @@ poly1305_blocks_neon: |
1507 |
+ ldp d14,d15,[sp,#64] |
1508 |
+ addp v21.2d,v21.2d,v21.2d |
1509 |
+ ldr x30,[sp,#8] |
1510 |
+- .inst 0xd50323bf // autiasp |
1511 |
+ |
1512 |
+ //////////////////////////////////////////////////////////////// |
1513 |
+ // lazy reduction, but without narrowing |
1514 |
+@@ -821,6 +820,7 @@ poly1305_blocks_neon: |
1515 |
+ str x4,[x0,#8] // set is_base2_26 |
1516 |
+ |
1517 |
+ ldr x29,[sp],#80 |
1518 |
++ .inst 0xd50323bf // autiasp |
1519 |
+ ret |
1520 |
+ .size poly1305_blocks_neon,.-poly1305_blocks_neon |
1521 |
+ |
1522 |
+diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h |
1523 |
+index 0cd9f0f75c135..cc060c41adaab 100644 |
1524 |
+--- a/arch/arm64/include/asm/kvm_host.h |
1525 |
++++ b/arch/arm64/include/asm/kvm_host.h |
1526 |
+@@ -214,6 +214,7 @@ enum vcpu_sysreg { |
1527 |
+ #define c2_TTBR1 (TTBR1_EL1 * 2) /* Translation Table Base Register 1 */ |
1528 |
+ #define c2_TTBR1_high (c2_TTBR1 + 1) /* TTBR1 top 32 bits */ |
1529 |
+ #define c2_TTBCR (TCR_EL1 * 2) /* Translation Table Base Control R. */ |
1530 |
++#define c2_TTBCR2 (c2_TTBCR + 1) /* Translation Table Base Control R. 2 */ |
1531 |
+ #define c3_DACR (DACR32_EL2 * 2)/* Domain Access Control Register */ |
1532 |
+ #define c5_DFSR (ESR_EL1 * 2) /* Data Fault Status Register */ |
1533 |
+ #define c5_IFSR (IFSR32_EL2 * 2)/* Instruction Fault Status Register */ |
1534 |
+diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c |
1535 |
+index 52a0638ed967b..ef15c8a2a49dc 100644 |
1536 |
+--- a/arch/arm64/kernel/mte.c |
1537 |
++++ b/arch/arm64/kernel/mte.c |
1538 |
+@@ -189,7 +189,8 @@ long get_mte_ctrl(struct task_struct *task) |
1539 |
+ |
1540 |
+ switch (task->thread.sctlr_tcf0) { |
1541 |
+ case SCTLR_EL1_TCF0_NONE: |
1542 |
+- return PR_MTE_TCF_NONE; |
1543 |
++ ret |= PR_MTE_TCF_NONE; |
1544 |
++ break; |
1545 |
+ case SCTLR_EL1_TCF0_SYNC: |
1546 |
+ ret |= PR_MTE_TCF_SYNC; |
1547 |
+ break; |
1548 |
+diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c |
1549 |
+index c1fac9836af1a..2b28bf1a53266 100644 |
1550 |
+--- a/arch/arm64/kvm/sys_regs.c |
1551 |
++++ b/arch/arm64/kvm/sys_regs.c |
1552 |
+@@ -1987,6 +1987,7 @@ static const struct sys_reg_desc cp15_regs[] = { |
1553 |
+ { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 }, |
1554 |
+ { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 }, |
1555 |
+ { Op1( 0), CRn( 2), CRm( 0), Op2( 2), access_vm_reg, NULL, c2_TTBCR }, |
1556 |
++ { Op1( 0), CRn( 2), CRm( 0), Op2( 3), access_vm_reg, NULL, c2_TTBCR2 }, |
1557 |
+ { Op1( 0), CRn( 3), CRm( 0), Op2( 0), access_vm_reg, NULL, c3_DACR }, |
1558 |
+ { Op1( 0), CRn( 5), CRm( 0), Op2( 0), access_vm_reg, NULL, c5_DFSR }, |
1559 |
+ { Op1( 0), CRn( 5), CRm( 0), Op2( 1), access_vm_reg, NULL, c5_IFSR }, |
1560 |
+diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c |
1561 |
+index 0ac53d87493c8..2bea1799b8de7 100644 |
1562 |
+--- a/arch/m68k/mac/config.c |
1563 |
++++ b/arch/m68k/mac/config.c |
1564 |
+@@ -777,16 +777,12 @@ static struct resource scc_b_rsrcs[] = { |
1565 |
+ struct platform_device scc_a_pdev = { |
1566 |
+ .name = "scc", |
1567 |
+ .id = 0, |
1568 |
+- .num_resources = ARRAY_SIZE(scc_a_rsrcs), |
1569 |
+- .resource = scc_a_rsrcs, |
1570 |
+ }; |
1571 |
+ EXPORT_SYMBOL(scc_a_pdev); |
1572 |
+ |
1573 |
+ struct platform_device scc_b_pdev = { |
1574 |
+ .name = "scc", |
1575 |
+ .id = 1, |
1576 |
+- .num_resources = ARRAY_SIZE(scc_b_rsrcs), |
1577 |
+- .resource = scc_b_rsrcs, |
1578 |
+ }; |
1579 |
+ EXPORT_SYMBOL(scc_b_pdev); |
1580 |
+ |
1581 |
+@@ -813,10 +809,15 @@ static void __init mac_identify(void) |
1582 |
+ |
1583 |
+ /* Set up serial port resources for the console initcall. */ |
1584 |
+ |
1585 |
+- scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2; |
1586 |
+- scc_a_rsrcs[0].end = scc_a_rsrcs[0].start; |
1587 |
+- scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase; |
1588 |
+- scc_b_rsrcs[0].end = scc_b_rsrcs[0].start; |
1589 |
++ scc_a_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase + 2; |
1590 |
++ scc_a_rsrcs[0].end = scc_a_rsrcs[0].start; |
1591 |
++ scc_a_pdev.num_resources = ARRAY_SIZE(scc_a_rsrcs); |
1592 |
++ scc_a_pdev.resource = scc_a_rsrcs; |
1593 |
++ |
1594 |
++ scc_b_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase; |
1595 |
++ scc_b_rsrcs[0].end = scc_b_rsrcs[0].start; |
1596 |
++ scc_b_pdev.num_resources = ARRAY_SIZE(scc_b_rsrcs); |
1597 |
++ scc_b_pdev.resource = scc_b_rsrcs; |
1598 |
+ |
1599 |
+ switch (macintosh_config->scc_type) { |
1600 |
+ case MAC_SCC_PSC: |
1601 |
+diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig |
1602 |
+index 6889f74e06f54..490bb6da74b7e 100644 |
1603 |
+--- a/arch/mips/bcm47xx/Kconfig |
1604 |
++++ b/arch/mips/bcm47xx/Kconfig |
1605 |
+@@ -27,6 +27,7 @@ config BCM47XX_BCMA |
1606 |
+ select BCMA |
1607 |
+ select BCMA_HOST_SOC |
1608 |
+ select BCMA_DRIVER_MIPS |
1609 |
++ select BCMA_DRIVER_PCI if PCI |
1610 |
+ select BCMA_DRIVER_PCI_HOSTMODE if PCI |
1611 |
+ select BCMA_DRIVER_GPIO |
1612 |
+ default y |
1613 |
+diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c |
1614 |
+index ca579deef9391..9d11f68a9e8bb 100644 |
1615 |
+--- a/arch/mips/kernel/setup.c |
1616 |
++++ b/arch/mips/kernel/setup.c |
1617 |
+@@ -498,8 +498,8 @@ static void __init request_crashkernel(struct resource *res) |
1618 |
+ |
1619 |
+ static void __init check_kernel_sections_mem(void) |
1620 |
+ { |
1621 |
+- phys_addr_t start = PFN_PHYS(PFN_DOWN(__pa_symbol(&_text))); |
1622 |
+- phys_addr_t size = PFN_PHYS(PFN_UP(__pa_symbol(&_end))) - start; |
1623 |
++ phys_addr_t start = __pa_symbol(&_text); |
1624 |
++ phys_addr_t size = __pa_symbol(&_end) - start; |
1625 |
+ |
1626 |
+ if (!memblock_is_region_memory(start, size)) { |
1627 |
+ pr_info("Kernel sections are not in the memory maps\n"); |
1628 |
+diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile |
1629 |
+index f8ce6d2dde7b1..e4b364b5da9e7 100644 |
1630 |
+--- a/arch/powerpc/boot/Makefile |
1631 |
++++ b/arch/powerpc/boot/Makefile |
1632 |
+@@ -368,6 +368,8 @@ initrd-y := $(filter-out $(image-y), $(initrd-y)) |
1633 |
+ targets += $(image-y) $(initrd-y) |
1634 |
+ targets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ |
1635 |
+ $(patsubst $(x).%, dts/%.dtb, $(filter $(x).%, $(image-y)))) |
1636 |
++targets += $(foreach x, dtbImage uImage cuImage simpleImage treeImage, \ |
1637 |
++ $(patsubst $(x).%, dts/fsl/%.dtb, $(filter $(x).%, $(image-y)))) |
1638 |
+ |
1639 |
+ $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz |
1640 |
+ |
1641 |
+diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h |
1642 |
+index 4a4d3afd53406..299ab33505a6c 100644 |
1643 |
+--- a/arch/powerpc/include/asm/bitops.h |
1644 |
++++ b/arch/powerpc/include/asm/bitops.h |
1645 |
+@@ -216,15 +216,34 @@ static inline void arch___clear_bit_unlock(int nr, volatile unsigned long *addr) |
1646 |
+ */ |
1647 |
+ static inline int fls(unsigned int x) |
1648 |
+ { |
1649 |
+- return 32 - __builtin_clz(x); |
1650 |
++ int lz; |
1651 |
++ |
1652 |
++ if (__builtin_constant_p(x)) |
1653 |
++ return x ? 32 - __builtin_clz(x) : 0; |
1654 |
++ asm("cntlzw %0,%1" : "=r" (lz) : "r" (x)); |
1655 |
++ return 32 - lz; |
1656 |
+ } |
1657 |
+ |
1658 |
+ #include <asm-generic/bitops/builtin-__fls.h> |
1659 |
+ |
1660 |
++/* |
1661 |
++ * 64-bit can do this using one cntlzd (count leading zeroes doubleword) |
1662 |
++ * instruction; for 32-bit we use the generic version, which does two |
1663 |
++ * 32-bit fls calls. |
1664 |
++ */ |
1665 |
++#ifdef CONFIG_PPC64 |
1666 |
+ static inline int fls64(__u64 x) |
1667 |
+ { |
1668 |
+- return 64 - __builtin_clzll(x); |
1669 |
++ int lz; |
1670 |
++ |
1671 |
++ if (__builtin_constant_p(x)) |
1672 |
++ return x ? 64 - __builtin_clzll(x) : 0; |
1673 |
++ asm("cntlzd %0,%1" : "=r" (lz) : "r" (x)); |
1674 |
++ return 64 - lz; |
1675 |
+ } |
1676 |
++#else |
1677 |
++#include <asm-generic/bitops/fls64.h> |
1678 |
++#endif |
1679 |
+ |
1680 |
+ #ifdef CONFIG_PPC64 |
1681 |
+ unsigned int __arch_hweight8(unsigned int w); |
1682 |
+diff --git a/arch/powerpc/include/asm/book3s/32/mmu-hash.h b/arch/powerpc/include/asm/book3s/32/mmu-hash.h |
1683 |
+index 2e277ca0170fb..a8982d52f6b1d 100644 |
1684 |
+--- a/arch/powerpc/include/asm/book3s/32/mmu-hash.h |
1685 |
++++ b/arch/powerpc/include/asm/book3s/32/mmu-hash.h |
1686 |
+@@ -94,6 +94,7 @@ typedef struct { |
1687 |
+ } mm_context_t; |
1688 |
+ |
1689 |
+ void update_bats(void); |
1690 |
++static inline void cleanup_cpu_mmu_context(void) { }; |
1691 |
+ |
1692 |
+ /* patch sites */ |
1693 |
+ extern s32 patch__hash_page_A0, patch__hash_page_A1, patch__hash_page_A2; |
1694 |
+diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h |
1695 |
+index 1376be95e975f..523d3e6e24009 100644 |
1696 |
+--- a/arch/powerpc/include/asm/book3s/32/pgtable.h |
1697 |
++++ b/arch/powerpc/include/asm/book3s/32/pgtable.h |
1698 |
+@@ -524,9 +524,9 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, |
1699 |
+ if (pte_val(*ptep) & _PAGE_HASHPTE) |
1700 |
+ flush_hash_entry(mm, ptep, addr); |
1701 |
+ __asm__ __volatile__("\ |
1702 |
+- stw%U0%X0 %2,%0\n\ |
1703 |
++ stw%X0 %2,%0\n\ |
1704 |
+ eieio\n\ |
1705 |
+- stw%U0%X0 %L2,%1" |
1706 |
++ stw%X1 %L2,%1" |
1707 |
+ : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4)) |
1708 |
+ : "r" (pte) : "memory"); |
1709 |
+ |
1710 |
+diff --git a/arch/powerpc/include/asm/cpm1.h b/arch/powerpc/include/asm/cpm1.h |
1711 |
+index a116fe9317892..3bdd74739cb88 100644 |
1712 |
+--- a/arch/powerpc/include/asm/cpm1.h |
1713 |
++++ b/arch/powerpc/include/asm/cpm1.h |
1714 |
+@@ -68,6 +68,7 @@ extern void cpm_reset(void); |
1715 |
+ #define PROFF_SPI ((uint)0x0180) |
1716 |
+ #define PROFF_SCC3 ((uint)0x0200) |
1717 |
+ #define PROFF_SMC1 ((uint)0x0280) |
1718 |
++#define PROFF_DSP1 ((uint)0x02c0) |
1719 |
+ #define PROFF_SCC4 ((uint)0x0300) |
1720 |
+ #define PROFF_SMC2 ((uint)0x0380) |
1721 |
+ |
1722 |
+diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h |
1723 |
+index 3d2f94afc13ae..398eba3998790 100644 |
1724 |
+--- a/arch/powerpc/include/asm/cputable.h |
1725 |
++++ b/arch/powerpc/include/asm/cputable.h |
1726 |
+@@ -369,7 +369,7 @@ static inline void cpu_feature_keys_init(void) { } |
1727 |
+ CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX) |
1728 |
+ #define CPU_FTRS_82XX (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_NOEXECUTE) |
1729 |
+ #define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ |
1730 |
+- CPU_FTR_MAYBE_CAN_NAP) |
1731 |
++ CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NOEXECUTE) |
1732 |
+ #define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \ |
1733 |
+ CPU_FTR_MAYBE_CAN_NAP | \ |
1734 |
+ CPU_FTR_COMMON | CPU_FTR_NOEXECUTE) |
1735 |
+@@ -409,7 +409,6 @@ static inline void cpu_feature_keys_init(void) { } |
1736 |
+ CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ |
1737 |
+ CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \ |
1738 |
+ CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT) |
1739 |
+-#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) |
1740 |
+ |
1741 |
+ /* 64-bit CPUs */ |
1742 |
+ #define CPU_FTRS_PPC970 (CPU_FTR_LWSYNC | \ |
1743 |
+@@ -520,8 +519,6 @@ enum { |
1744 |
+ CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX | |
1745 |
+ CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 | |
1746 |
+ CPU_FTRS_CLASSIC32 | |
1747 |
+-#else |
1748 |
+- CPU_FTRS_GENERIC_32 | |
1749 |
+ #endif |
1750 |
+ #ifdef CONFIG_PPC_8xx |
1751 |
+ CPU_FTRS_8XX | |
1752 |
+@@ -596,8 +593,6 @@ enum { |
1753 |
+ CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX & |
1754 |
+ CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 & |
1755 |
+ CPU_FTRS_CLASSIC32 & |
1756 |
+-#else |
1757 |
+- CPU_FTRS_GENERIC_32 & |
1758 |
+ #endif |
1759 |
+ #ifdef CONFIG_PPC_8xx |
1760 |
+ CPU_FTRS_8XX & |
1761 |
+diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h |
1762 |
+index 6277e7596ae58..ac75f4ab0dba1 100644 |
1763 |
+--- a/arch/powerpc/include/asm/nohash/pgtable.h |
1764 |
++++ b/arch/powerpc/include/asm/nohash/pgtable.h |
1765 |
+@@ -192,9 +192,9 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, |
1766 |
+ */ |
1767 |
+ if (IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_PTE_64BIT) && !percpu) { |
1768 |
+ __asm__ __volatile__("\ |
1769 |
+- stw%U0%X0 %2,%0\n\ |
1770 |
++ stw%X0 %2,%0\n\ |
1771 |
+ eieio\n\ |
1772 |
+- stw%U0%X0 %L2,%1" |
1773 |
++ stw%X1 %L2,%1" |
1774 |
+ : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4)) |
1775 |
+ : "r" (pte) : "memory"); |
1776 |
+ return; |
1777 |
+diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile |
1778 |
+index bf0bf1b900d21..fe2ef598e2ead 100644 |
1779 |
+--- a/arch/powerpc/kernel/Makefile |
1780 |
++++ b/arch/powerpc/kernel/Makefile |
1781 |
+@@ -173,6 +173,9 @@ KCOV_INSTRUMENT_cputable.o := n |
1782 |
+ KCOV_INSTRUMENT_setup_64.o := n |
1783 |
+ KCOV_INSTRUMENT_paca.o := n |
1784 |
+ |
1785 |
++CFLAGS_setup_64.o += -fno-stack-protector |
1786 |
++CFLAGS_paca.o += -fno-stack-protector |
1787 |
++ |
1788 |
+ extra-$(CONFIG_PPC_FPU) += fpu.o |
1789 |
+ extra-$(CONFIG_ALTIVEC) += vector.o |
1790 |
+ extra-$(CONFIG_PPC64) += entry_64.o |
1791 |
+diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/kernel/head_32.h |
1792 |
+index 7c767765071da..c88e66adecb52 100644 |
1793 |
+--- a/arch/powerpc/kernel/head_32.h |
1794 |
++++ b/arch/powerpc/kernel/head_32.h |
1795 |
+@@ -131,18 +131,28 @@ |
1796 |
+ #ifdef CONFIG_VMAP_STACK |
1797 |
+ mfspr r11, SPRN_SRR0 |
1798 |
+ mtctr r11 |
1799 |
+-#endif |
1800 |
+ andi. r11, r9, MSR_PR |
1801 |
+- lwz r11,TASK_STACK-THREAD(r12) |
1802 |
++ mr r11, r1 |
1803 |
++ lwz r1,TASK_STACK-THREAD(r12) |
1804 |
+ beq- 99f |
1805 |
+- addi r11, r11, THREAD_SIZE - INT_FRAME_SIZE |
1806 |
+-#ifdef CONFIG_VMAP_STACK |
1807 |
++ addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE |
1808 |
+ li r10, MSR_KERNEL & ~(MSR_IR | MSR_RI) /* can take DTLB miss */ |
1809 |
+ mtmsr r10 |
1810 |
+ isync |
1811 |
++ tovirt(r12, r12) |
1812 |
++ stw r11,GPR1(r1) |
1813 |
++ stw r11,0(r1) |
1814 |
++ mr r11, r1 |
1815 |
++#else |
1816 |
++ andi. r11, r9, MSR_PR |
1817 |
++ lwz r11,TASK_STACK-THREAD(r12) |
1818 |
++ beq- 99f |
1819 |
++ addi r11, r11, THREAD_SIZE - INT_FRAME_SIZE |
1820 |
++ tophys(r11, r11) |
1821 |
++ stw r1,GPR1(r11) |
1822 |
++ stw r1,0(r11) |
1823 |
++ tovirt(r1, r11) /* set new kernel sp */ |
1824 |
+ #endif |
1825 |
+- tovirt_vmstack r12, r12 |
1826 |
+- tophys_novmstack r11, r11 |
1827 |
+ mflr r10 |
1828 |
+ stw r10, _LINK(r11) |
1829 |
+ #ifdef CONFIG_VMAP_STACK |
1830 |
+@@ -150,9 +160,6 @@ |
1831 |
+ #else |
1832 |
+ mfspr r10,SPRN_SRR0 |
1833 |
+ #endif |
1834 |
+- stw r1,GPR1(r11) |
1835 |
+- stw r1,0(r11) |
1836 |
+- tovirt_novmstack r1, r11 /* set new kernel sp */ |
1837 |
+ stw r10,_NIP(r11) |
1838 |
+ mfcr r10 |
1839 |
+ rlwinm r10,r10,0,4,2 /* Clear SO bit in CR */ |
1840 |
+diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
1841 |
+index 1510b2a56669f..2d6581db0c7b6 100644 |
1842 |
+--- a/arch/powerpc/kernel/head_64.S |
1843 |
++++ b/arch/powerpc/kernel/head_64.S |
1844 |
+@@ -417,6 +417,10 @@ generic_secondary_common_init: |
1845 |
+ /* From now on, r24 is expected to be logical cpuid */ |
1846 |
+ mr r24,r5 |
1847 |
+ |
1848 |
++ /* Create a temp kernel stack for use before relocation is on. */ |
1849 |
++ ld r1,PACAEMERGSP(r13) |
1850 |
++ subi r1,r1,STACK_FRAME_OVERHEAD |
1851 |
++ |
1852 |
+ /* See if we need to call a cpu state restore handler */ |
1853 |
+ LOAD_REG_ADDR(r23, cur_cpu_spec) |
1854 |
+ ld r23,0(r23) |
1855 |
+@@ -445,10 +449,6 @@ generic_secondary_common_init: |
1856 |
+ sync /* order paca.run and cur_cpu_spec */ |
1857 |
+ isync /* In case code patching happened */ |
1858 |
+ |
1859 |
+- /* Create a temp kernel stack for use before relocation is on. */ |
1860 |
+- ld r1,PACAEMERGSP(r13) |
1861 |
+- subi r1,r1,STACK_FRAME_OVERHEAD |
1862 |
+- |
1863 |
+ b __secondary_start |
1864 |
+ #endif /* SMP */ |
1865 |
+ |
1866 |
+@@ -990,7 +990,7 @@ start_here_common: |
1867 |
+ bl start_kernel |
1868 |
+ |
1869 |
+ /* Not reached */ |
1870 |
+- trap |
1871 |
++0: trap |
1872 |
+ EMIT_BUG_ENTRY 0b, __FILE__, __LINE__, 0 |
1873 |
+ .previous |
1874 |
+ |
1875 |
+diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c |
1876 |
+index 0ad15768d762c..7f5aae3c387d2 100644 |
1877 |
+--- a/arch/powerpc/kernel/paca.c |
1878 |
++++ b/arch/powerpc/kernel/paca.c |
1879 |
+@@ -208,7 +208,7 @@ static struct rtas_args * __init new_rtas_args(int cpu, unsigned long limit) |
1880 |
+ struct paca_struct **paca_ptrs __read_mostly; |
1881 |
+ EXPORT_SYMBOL(paca_ptrs); |
1882 |
+ |
1883 |
+-void __init __nostackprotector initialise_paca(struct paca_struct *new_paca, int cpu) |
1884 |
++void __init initialise_paca(struct paca_struct *new_paca, int cpu) |
1885 |
+ { |
1886 |
+ #ifdef CONFIG_PPC_PSERIES |
1887 |
+ new_paca->lppaca_ptr = NULL; |
1888 |
+@@ -241,7 +241,7 @@ void __init __nostackprotector initialise_paca(struct paca_struct *new_paca, int |
1889 |
+ } |
1890 |
+ |
1891 |
+ /* Put the paca pointer into r13 and SPRG_PACA */ |
1892 |
+-void __nostackprotector setup_paca(struct paca_struct *new_paca) |
1893 |
++void setup_paca(struct paca_struct *new_paca) |
1894 |
+ { |
1895 |
+ /* Setup r13 */ |
1896 |
+ local_paca = new_paca; |
1897 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
1898 |
+index 954f41676f692..cccb32cf0e08c 100644 |
1899 |
+--- a/arch/powerpc/kernel/rtas.c |
1900 |
++++ b/arch/powerpc/kernel/rtas.c |
1901 |
+@@ -1030,7 +1030,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = { |
1902 |
+ { "ibm,display-message", -1, 0, -1, -1, -1 }, |
1903 |
+ { "ibm,errinjct", -1, 2, -1, -1, -1, 1024 }, |
1904 |
+ { "ibm,close-errinjct", -1, -1, -1, -1, -1 }, |
1905 |
+- { "ibm,open-errinct", -1, -1, -1, -1, -1 }, |
1906 |
++ { "ibm,open-errinjct", -1, -1, -1, -1, -1 }, |
1907 |
+ { "ibm,get-config-addr-info2", -1, -1, -1, -1, -1 }, |
1908 |
+ { "ibm,get-dynamic-sensor-state", -1, 1, -1, -1, -1 }, |
1909 |
+ { "ibm,get-indices", -1, 2, 3, -1, -1 }, |
1910 |
+diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c |
1911 |
+index 808ec9fab6052..da8c71f321ad3 100644 |
1912 |
+--- a/arch/powerpc/kernel/setup-common.c |
1913 |
++++ b/arch/powerpc/kernel/setup-common.c |
1914 |
+@@ -919,8 +919,6 @@ void __init setup_arch(char **cmdline_p) |
1915 |
+ |
1916 |
+ /* On BookE, setup per-core TLB data structures. */ |
1917 |
+ setup_tlb_core_data(); |
1918 |
+- |
1919 |
+- smp_release_cpus(); |
1920 |
+ #endif |
1921 |
+ |
1922 |
+ /* Print various info about the machine that has been gathered so far. */ |
1923 |
+@@ -944,6 +942,8 @@ void __init setup_arch(char **cmdline_p) |
1924 |
+ exc_lvl_early_init(); |
1925 |
+ emergency_stack_init(); |
1926 |
+ |
1927 |
++ smp_release_cpus(); |
1928 |
++ |
1929 |
+ initmem_init(); |
1930 |
+ |
1931 |
+ early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT); |
1932 |
+diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h |
1933 |
+index 2ec835574cc94..2dd0d9cb5a208 100644 |
1934 |
+--- a/arch/powerpc/kernel/setup.h |
1935 |
++++ b/arch/powerpc/kernel/setup.h |
1936 |
+@@ -8,12 +8,6 @@ |
1937 |
+ #ifndef __ARCH_POWERPC_KERNEL_SETUP_H |
1938 |
+ #define __ARCH_POWERPC_KERNEL_SETUP_H |
1939 |
+ |
1940 |
+-#ifdef CONFIG_CC_IS_CLANG |
1941 |
+-#define __nostackprotector |
1942 |
+-#else |
1943 |
+-#define __nostackprotector __attribute__((__optimize__("no-stack-protector"))) |
1944 |
+-#endif |
1945 |
+- |
1946 |
+ void initialize_cache_info(void); |
1947 |
+ void irqstack_early_init(void); |
1948 |
+ |
1949 |
+diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c |
1950 |
+index 74fd47f46fa58..c28e949cc2229 100644 |
1951 |
+--- a/arch/powerpc/kernel/setup_64.c |
1952 |
++++ b/arch/powerpc/kernel/setup_64.c |
1953 |
+@@ -283,7 +283,7 @@ void __init record_spr_defaults(void) |
1954 |
+ * device-tree is not accessible via normal means at this point. |
1955 |
+ */ |
1956 |
+ |
1957 |
+-void __init __nostackprotector early_setup(unsigned long dt_ptr) |
1958 |
++void __init early_setup(unsigned long dt_ptr) |
1959 |
+ { |
1960 |
+ static __initdata struct paca_struct boot_paca; |
1961 |
+ |
1962 |
+diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c |
1963 |
+index 8c2857cbd9609..7d6cf75a7fd80 100644 |
1964 |
+--- a/arch/powerpc/kernel/smp.c |
1965 |
++++ b/arch/powerpc/kernel/smp.c |
1966 |
+@@ -919,7 +919,7 @@ static struct sched_domain_topology_level powerpc_topology[] = { |
1967 |
+ { NULL, }, |
1968 |
+ }; |
1969 |
+ |
1970 |
+-static int init_big_cores(void) |
1971 |
++static int __init init_big_cores(void) |
1972 |
+ { |
1973 |
+ int cpu; |
1974 |
+ |
1975 |
+diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c |
1976 |
+index 855457ed09b54..b18bce1a209fa 100644 |
1977 |
+--- a/arch/powerpc/lib/sstep.c |
1978 |
++++ b/arch/powerpc/lib/sstep.c |
1979 |
+@@ -1346,6 +1346,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, |
1980 |
+ switch (opcode) { |
1981 |
+ #ifdef __powerpc64__ |
1982 |
+ case 1: |
1983 |
++ if (!cpu_has_feature(CPU_FTR_ARCH_31)) |
1984 |
++ return -1; |
1985 |
++ |
1986 |
+ prefix_r = GET_PREFIX_R(word); |
1987 |
+ ra = GET_PREFIX_RA(suffix); |
1988 |
+ rd = (suffix >> 21) & 0x1f; |
1989 |
+@@ -2733,6 +2736,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, |
1990 |
+ } |
1991 |
+ break; |
1992 |
+ case 1: /* Prefixed instructions */ |
1993 |
++ if (!cpu_has_feature(CPU_FTR_ARCH_31)) |
1994 |
++ return -1; |
1995 |
++ |
1996 |
+ prefix_r = GET_PREFIX_R(word); |
1997 |
+ ra = GET_PREFIX_RA(suffix); |
1998 |
+ op->update_reg = ra; |
1999 |
+@@ -2751,6 +2757,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, |
2000 |
+ case 41: /* plwa */ |
2001 |
+ op->type = MKOP(LOAD, PREFIXED | SIGNEXT, 4); |
2002 |
+ break; |
2003 |
++#ifdef CONFIG_VSX |
2004 |
+ case 42: /* plxsd */ |
2005 |
+ op->reg = rd + 32; |
2006 |
+ op->type = MKOP(LOAD_VSX, PREFIXED, 8); |
2007 |
+@@ -2791,13 +2798,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, |
2008 |
+ op->element_size = 16; |
2009 |
+ op->vsx_flags = VSX_CHECK_VEC; |
2010 |
+ break; |
2011 |
++#endif /* CONFIG_VSX */ |
2012 |
+ case 56: /* plq */ |
2013 |
+ op->type = MKOP(LOAD, PREFIXED, 16); |
2014 |
+ break; |
2015 |
+ case 57: /* pld */ |
2016 |
+ op->type = MKOP(LOAD, PREFIXED, 8); |
2017 |
+ break; |
2018 |
+- case 60: /* stq */ |
2019 |
++ case 60: /* pstq */ |
2020 |
+ op->type = MKOP(STORE, PREFIXED, 16); |
2021 |
+ break; |
2022 |
+ case 61: /* pstd */ |
2023 |
+diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c |
2024 |
+index 0add963a849b3..72e1b51beb10c 100644 |
2025 |
+--- a/arch/powerpc/mm/fault.c |
2026 |
++++ b/arch/powerpc/mm/fault.c |
2027 |
+@@ -303,7 +303,6 @@ static inline void cmo_account_page_fault(void) |
2028 |
+ static inline void cmo_account_page_fault(void) { } |
2029 |
+ #endif /* CONFIG_PPC_SMLPAR */ |
2030 |
+ |
2031 |
+-#ifdef CONFIG_PPC_BOOK3S |
2032 |
+ static void sanity_check_fault(bool is_write, bool is_user, |
2033 |
+ unsigned long error_code, unsigned long address) |
2034 |
+ { |
2035 |
+@@ -320,6 +319,9 @@ static void sanity_check_fault(bool is_write, bool is_user, |
2036 |
+ return; |
2037 |
+ } |
2038 |
+ |
2039 |
++ if (!IS_ENABLED(CONFIG_PPC_BOOK3S)) |
2040 |
++ return; |
2041 |
++ |
2042 |
+ /* |
2043 |
+ * For hash translation mode, we should never get a |
2044 |
+ * PROTFAULT. Any update to pte to reduce access will result in us |
2045 |
+@@ -354,10 +356,6 @@ static void sanity_check_fault(bool is_write, bool is_user, |
2046 |
+ |
2047 |
+ WARN_ON_ONCE(error_code & DSISR_PROTFAULT); |
2048 |
+ } |
2049 |
+-#else |
2050 |
+-static void sanity_check_fault(bool is_write, bool is_user, |
2051 |
+- unsigned long error_code, unsigned long address) { } |
2052 |
+-#endif /* CONFIG_PPC_BOOK3S */ |
2053 |
+ |
2054 |
+ /* |
2055 |
+ * Define the correct "is_write" bit in error_code based |
2056 |
+diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c |
2057 |
+index 3fc325bebe4df..22eb1c718e622 100644 |
2058 |
+--- a/arch/powerpc/mm/mem.c |
2059 |
++++ b/arch/powerpc/mm/mem.c |
2060 |
+@@ -532,7 +532,7 @@ void __flush_dcache_icache(void *p) |
2061 |
+ * space occurs, before returning to user space. |
2062 |
+ */ |
2063 |
+ |
2064 |
+- if (cpu_has_feature(MMU_FTR_TYPE_44x)) |
2065 |
++ if (mmu_has_feature(MMU_FTR_TYPE_44x)) |
2066 |
+ return; |
2067 |
+ |
2068 |
+ invalidate_icache_range(addr, addr + PAGE_SIZE); |
2069 |
+diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c |
2070 |
+index 08643cba14948..43599e671d383 100644 |
2071 |
+--- a/arch/powerpc/perf/core-book3s.c |
2072 |
++++ b/arch/powerpc/perf/core-book3s.c |
2073 |
+@@ -137,6 +137,9 @@ static void pmao_restore_workaround(bool ebb) { } |
2074 |
+ |
2075 |
+ bool is_sier_available(void) |
2076 |
+ { |
2077 |
++ if (!ppmu) |
2078 |
++ return false; |
2079 |
++ |
2080 |
+ if (ppmu->flags & PPMU_HAS_SIER) |
2081 |
+ return true; |
2082 |
+ |
2083 |
+@@ -2121,6 +2124,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val, |
2084 |
+ local64_set(&event->hw.period_left, left); |
2085 |
+ perf_event_update_userpage(event); |
2086 |
+ |
2087 |
++ /* |
2088 |
++ * Due to hardware limitation, sometimes SIAR could sample a kernel |
2089 |
++ * address even when freeze on supervisor state (kernel) is set in |
2090 |
++ * MMCR2. Check attr.exclude_kernel and address to drop the sample in |
2091 |
++ * these cases. |
2092 |
++ */ |
2093 |
++ if (event->attr.exclude_kernel && record) |
2094 |
++ if (is_kernel_addr(mfspr(SPRN_SIAR))) |
2095 |
++ record = 0; |
2096 |
++ |
2097 |
+ /* |
2098 |
+ * Finally record data if requested. |
2099 |
+ */ |
2100 |
+diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c |
2101 |
+index 2848904df6383..e1a21d34c6e49 100644 |
2102 |
+--- a/arch/powerpc/perf/isa207-common.c |
2103 |
++++ b/arch/powerpc/perf/isa207-common.c |
2104 |
+@@ -247,6 +247,9 @@ void isa207_get_mem_weight(u64 *weight) |
2105 |
+ u64 sier = mfspr(SPRN_SIER); |
2106 |
+ u64 val = (sier & ISA207_SIER_TYPE_MASK) >> ISA207_SIER_TYPE_SHIFT; |
2107 |
+ |
2108 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31)) |
2109 |
++ mantissa = P10_MMCRA_THR_CTR_MANT(mmcra); |
2110 |
++ |
2111 |
+ if (val == 0 || val == 7) |
2112 |
+ *weight = 0; |
2113 |
+ else |
2114 |
+@@ -311,9 +314,11 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) |
2115 |
+ } |
2116 |
+ |
2117 |
+ if (unit >= 6 && unit <= 9) { |
2118 |
+- if (cpu_has_feature(CPU_FTR_ARCH_31) && (unit == 6)) { |
2119 |
+- mask |= CNST_L2L3_GROUP_MASK; |
2120 |
+- value |= CNST_L2L3_GROUP_VAL(event >> p10_L2L3_EVENT_SHIFT); |
2121 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31)) { |
2122 |
++ if (unit == 6) { |
2123 |
++ mask |= CNST_L2L3_GROUP_MASK; |
2124 |
++ value |= CNST_L2L3_GROUP_VAL(event >> p10_L2L3_EVENT_SHIFT); |
2125 |
++ } |
2126 |
+ } else if (cpu_has_feature(CPU_FTR_ARCH_300)) { |
2127 |
+ mask |= CNST_CACHE_GROUP_MASK; |
2128 |
+ value |= CNST_CACHE_GROUP_VAL(event & 0xff); |
2129 |
+@@ -339,12 +344,22 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) |
2130 |
+ value |= CNST_L1_QUAL_VAL(cache); |
2131 |
+ } |
2132 |
+ |
2133 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31)) { |
2134 |
++ mask |= CNST_RADIX_SCOPE_GROUP_MASK; |
2135 |
++ value |= CNST_RADIX_SCOPE_GROUP_VAL(event >> p10_EVENT_RADIX_SCOPE_QUAL_SHIFT); |
2136 |
++ } |
2137 |
++ |
2138 |
+ if (is_event_marked(event)) { |
2139 |
+ mask |= CNST_SAMPLE_MASK; |
2140 |
+ value |= CNST_SAMPLE_VAL(event >> EVENT_SAMPLE_SHIFT); |
2141 |
+ } |
2142 |
+ |
2143 |
+- if (cpu_has_feature(CPU_FTR_ARCH_300)) { |
2144 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31)) { |
2145 |
++ if (event_is_threshold(event)) { |
2146 |
++ mask |= CNST_THRESH_CTL_SEL_MASK; |
2147 |
++ value |= CNST_THRESH_CTL_SEL_VAL(event >> EVENT_THRESH_SHIFT); |
2148 |
++ } |
2149 |
++ } else if (cpu_has_feature(CPU_FTR_ARCH_300)) { |
2150 |
+ if (event_is_threshold(event) && is_thresh_cmp_valid(event)) { |
2151 |
+ mask |= CNST_THRESH_MASK; |
2152 |
+ value |= CNST_THRESH_VAL(event >> EVENT_THRESH_SHIFT); |
2153 |
+@@ -456,6 +471,13 @@ int isa207_compute_mmcr(u64 event[], int n_ev, |
2154 |
+ } |
2155 |
+ } |
2156 |
+ |
2157 |
++ /* Set RADIX_SCOPE_QUAL bit */ |
2158 |
++ if (cpu_has_feature(CPU_FTR_ARCH_31)) { |
2159 |
++ val = (event[i] >> p10_EVENT_RADIX_SCOPE_QUAL_SHIFT) & |
2160 |
++ p10_EVENT_RADIX_SCOPE_QUAL_MASK; |
2161 |
++ mmcr1 |= val << p10_MMCR1_RADIX_SCOPE_QUAL_SHIFT; |
2162 |
++ } |
2163 |
++ |
2164 |
+ if (is_event_marked(event[i])) { |
2165 |
+ mmcra |= MMCRA_SAMPLE_ENABLE; |
2166 |
+ |
2167 |
+diff --git a/arch/powerpc/perf/isa207-common.h b/arch/powerpc/perf/isa207-common.h |
2168 |
+index 7025de5e60e7d..454b32c314406 100644 |
2169 |
+--- a/arch/powerpc/perf/isa207-common.h |
2170 |
++++ b/arch/powerpc/perf/isa207-common.h |
2171 |
+@@ -101,6 +101,9 @@ |
2172 |
+ #define p10_EVENT_CACHE_SEL_MASK 0x3ull |
2173 |
+ #define p10_EVENT_MMCR3_MASK 0x7fffull |
2174 |
+ #define p10_EVENT_MMCR3_SHIFT 45 |
2175 |
++#define p10_EVENT_RADIX_SCOPE_QUAL_SHIFT 9 |
2176 |
++#define p10_EVENT_RADIX_SCOPE_QUAL_MASK 0x1 |
2177 |
++#define p10_MMCR1_RADIX_SCOPE_QUAL_SHIFT 45 |
2178 |
+ |
2179 |
+ #define p10_EVENT_VALID_MASK \ |
2180 |
+ ((p10_SDAR_MODE_MASK << p10_SDAR_MODE_SHIFT | \ |
2181 |
+@@ -112,6 +115,7 @@ |
2182 |
+ (p9_EVENT_COMBINE_MASK << p9_EVENT_COMBINE_SHIFT) | \ |
2183 |
+ (p10_EVENT_MMCR3_MASK << p10_EVENT_MMCR3_SHIFT) | \ |
2184 |
+ (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \ |
2185 |
++ (p10_EVENT_RADIX_SCOPE_QUAL_MASK << p10_EVENT_RADIX_SCOPE_QUAL_SHIFT) | \ |
2186 |
+ EVENT_LINUX_MASK | \ |
2187 |
+ EVENT_PSEL_MASK)) |
2188 |
+ /* |
2189 |
+@@ -125,9 +129,9 @@ |
2190 |
+ * |
2191 |
+ * 28 24 20 16 12 8 4 0 |
2192 |
+ * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | |
2193 |
+- * [ ] | [ ] [ sample ] [ ] [6] [5] [4] [3] [2] [1] |
2194 |
+- * | | | | |
2195 |
+- * BHRB IFM -* | | | Count of events for each PMC. |
2196 |
++ * [ ] | [ ] | [ sample ] [ ] [6] [5] [4] [3] [2] [1] |
2197 |
++ * | | | | | |
2198 |
++ * BHRB IFM -* | | |*radix_scope | Count of events for each PMC. |
2199 |
+ * EBB -* | | p1, p2, p3, p4, p5, p6. |
2200 |
+ * L1 I/D qualifier -* | |
2201 |
+ * nc - number of counters -* |
2202 |
+@@ -145,6 +149,9 @@ |
2203 |
+ #define CNST_THRESH_VAL(v) (((v) & EVENT_THRESH_MASK) << 32) |
2204 |
+ #define CNST_THRESH_MASK CNST_THRESH_VAL(EVENT_THRESH_MASK) |
2205 |
+ |
2206 |
++#define CNST_THRESH_CTL_SEL_VAL(v) (((v) & 0x7ffull) << 32) |
2207 |
++#define CNST_THRESH_CTL_SEL_MASK CNST_THRESH_CTL_SEL_VAL(0x7ff) |
2208 |
++ |
2209 |
+ #define CNST_EBB_VAL(v) (((v) & EVENT_EBB_MASK) << 24) |
2210 |
+ #define CNST_EBB_MASK CNST_EBB_VAL(EVENT_EBB_MASK) |
2211 |
+ |
2212 |
+@@ -165,6 +172,9 @@ |
2213 |
+ #define CNST_L2L3_GROUP_VAL(v) (((v) & 0x1full) << 55) |
2214 |
+ #define CNST_L2L3_GROUP_MASK CNST_L2L3_GROUP_VAL(0x1f) |
2215 |
+ |
2216 |
++#define CNST_RADIX_SCOPE_GROUP_VAL(v) (((v) & 0x1ull) << 21) |
2217 |
++#define CNST_RADIX_SCOPE_GROUP_MASK CNST_RADIX_SCOPE_GROUP_VAL(1) |
2218 |
++ |
2219 |
+ /* |
2220 |
+ * For NC we are counting up to 4 events. This requires three bits, and we need |
2221 |
+ * the fifth event to overflow and set the 4th bit. To achieve that we bias the |
2222 |
+@@ -221,6 +231,10 @@ |
2223 |
+ #define MMCRA_THR_CTR_EXP(v) (((v) >> MMCRA_THR_CTR_EXP_SHIFT) &\ |
2224 |
+ MMCRA_THR_CTR_EXP_MASK) |
2225 |
+ |
2226 |
++#define P10_MMCRA_THR_CTR_MANT_MASK 0xFFul |
2227 |
++#define P10_MMCRA_THR_CTR_MANT(v) (((v) >> MMCRA_THR_CTR_MANT_SHIFT) &\ |
2228 |
++ P10_MMCRA_THR_CTR_MANT_MASK) |
2229 |
++ |
2230 |
+ /* MMCRA Threshold Compare bit constant for power9 */ |
2231 |
+ #define p9_MMCRA_THR_CMP_SHIFT 45 |
2232 |
+ |
2233 |
+diff --git a/arch/powerpc/perf/power10-pmu.c b/arch/powerpc/perf/power10-pmu.c |
2234 |
+index 9dbe8f9b89b4f..cf44fb7446130 100644 |
2235 |
+--- a/arch/powerpc/perf/power10-pmu.c |
2236 |
++++ b/arch/powerpc/perf/power10-pmu.c |
2237 |
+@@ -23,10 +23,10 @@ |
2238 |
+ * |
2239 |
+ * 28 24 20 16 12 8 4 0 |
2240 |
+ * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | |
2241 |
+- * [ ] [ sample ] [ ] [ ] [ pmc ] [unit ] [ ] m [ pmcxsel ] |
2242 |
+- * | | | | | | |
2243 |
+- * | | | | | *- mark |
2244 |
+- * | | | *- L1/L2/L3 cache_sel | |
2245 |
++ * [ ] [ sample ] [ ] [ ] [ pmc ] [unit ] [ ] | m [ pmcxsel ] |
2246 |
++ * | | | | | | | |
2247 |
++ * | | | | | | *- mark |
2248 |
++ * | | | *- L1/L2/L3 cache_sel | |*-radix_scope_qual |
2249 |
+ * | | sdar_mode | |
2250 |
+ * | *- sampling mode for marked events *- combine |
2251 |
+ * | |
2252 |
+@@ -59,6 +59,7 @@ |
2253 |
+ * |
2254 |
+ * MMCR1[16] = cache_sel[0] |
2255 |
+ * MMCR1[17] = cache_sel[1] |
2256 |
++ * MMCR1[18] = radix_scope_qual |
2257 |
+ * |
2258 |
+ * if mark: |
2259 |
+ * MMCRA[63] = 1 (SAMPLE_ENABLE) |
2260 |
+@@ -175,6 +176,7 @@ PMU_FORMAT_ATTR(src_sel, "config:45-46"); |
2261 |
+ PMU_FORMAT_ATTR(invert_bit, "config:47"); |
2262 |
+ PMU_FORMAT_ATTR(src_mask, "config:48-53"); |
2263 |
+ PMU_FORMAT_ATTR(src_match, "config:54-59"); |
2264 |
++PMU_FORMAT_ATTR(radix_scope, "config:9"); |
2265 |
+ |
2266 |
+ static struct attribute *power10_pmu_format_attr[] = { |
2267 |
+ &format_attr_event.attr, |
2268 |
+@@ -194,6 +196,7 @@ static struct attribute *power10_pmu_format_attr[] = { |
2269 |
+ &format_attr_invert_bit.attr, |
2270 |
+ &format_attr_src_mask.attr, |
2271 |
+ &format_attr_src_match.attr, |
2272 |
++ &format_attr_radix_scope.attr, |
2273 |
+ NULL, |
2274 |
+ }; |
2275 |
+ |
2276 |
+diff --git a/arch/powerpc/platforms/8xx/micropatch.c b/arch/powerpc/platforms/8xx/micropatch.c |
2277 |
+index aed4bc75f3520..aef179fcbd4f8 100644 |
2278 |
+--- a/arch/powerpc/platforms/8xx/micropatch.c |
2279 |
++++ b/arch/powerpc/platforms/8xx/micropatch.c |
2280 |
+@@ -360,6 +360,17 @@ void __init cpm_load_patch(cpm8xx_t *cp) |
2281 |
+ if (IS_ENABLED(CONFIG_SMC_UCODE_PATCH)) { |
2282 |
+ smc_uart_t *smp; |
2283 |
+ |
2284 |
++ if (IS_ENABLED(CONFIG_PPC_EARLY_DEBUG_CPM)) { |
2285 |
++ int i; |
2286 |
++ |
2287 |
++ for (i = 0; i < sizeof(*smp); i += 4) { |
2288 |
++ u32 __iomem *src = (u32 __iomem *)&cp->cp_dparam[PROFF_SMC1 + i]; |
2289 |
++ u32 __iomem *dst = (u32 __iomem *)&cp->cp_dparam[PROFF_DSP1 + i]; |
2290 |
++ |
2291 |
++ out_be32(dst, in_be32(src)); |
2292 |
++ } |
2293 |
++ } |
2294 |
++ |
2295 |
+ smp = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC1]; |
2296 |
+ out_be16(&smp->smc_rpbase, 0x1ec0); |
2297 |
+ smp = (smc_uart_t *)&cp->cp_dparam[PROFF_SMC2]; |
2298 |
+diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype |
2299 |
+index c194c4ae8bc7d..32a9c4c09b989 100644 |
2300 |
+--- a/arch/powerpc/platforms/Kconfig.cputype |
2301 |
++++ b/arch/powerpc/platforms/Kconfig.cputype |
2302 |
+@@ -36,7 +36,7 @@ config PPC_BOOK3S_6xx |
2303 |
+ select PPC_HAVE_PMU_SUPPORT |
2304 |
+ select PPC_HAVE_KUEP |
2305 |
+ select PPC_HAVE_KUAP |
2306 |
+- select HAVE_ARCH_VMAP_STACK if !ADB_PMU |
2307 |
++ select HAVE_ARCH_VMAP_STACK |
2308 |
+ |
2309 |
+ config PPC_85xx |
2310 |
+ bool "Freescale 85xx" |
2311 |
+diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S |
2312 |
+index 7e0f8ba6e54a5..d497a60003d2d 100644 |
2313 |
+--- a/arch/powerpc/platforms/powermac/sleep.S |
2314 |
++++ b/arch/powerpc/platforms/powermac/sleep.S |
2315 |
+@@ -44,7 +44,8 @@ |
2316 |
+ #define SL_TB 0xa0 |
2317 |
+ #define SL_R2 0xa8 |
2318 |
+ #define SL_CR 0xac |
2319 |
+-#define SL_R12 0xb0 /* r12 to r31 */ |
2320 |
++#define SL_LR 0xb0 |
2321 |
++#define SL_R12 0xb4 /* r12 to r31 */ |
2322 |
+ #define SL_SIZE (SL_R12 + 80) |
2323 |
+ |
2324 |
+ .section .text |
2325 |
+@@ -63,105 +64,107 @@ _GLOBAL(low_sleep_handler) |
2326 |
+ blr |
2327 |
+ #else |
2328 |
+ mflr r0 |
2329 |
+- stw r0,4(r1) |
2330 |
+- stwu r1,-SL_SIZE(r1) |
2331 |
++ lis r11,sleep_storage@ha |
2332 |
++ addi r11,r11,sleep_storage@l |
2333 |
++ stw r0,SL_LR(r11) |
2334 |
+ mfcr r0 |
2335 |
+- stw r0,SL_CR(r1) |
2336 |
+- stw r2,SL_R2(r1) |
2337 |
+- stmw r12,SL_R12(r1) |
2338 |
++ stw r0,SL_CR(r11) |
2339 |
++ stw r1,SL_SP(r11) |
2340 |
++ stw r2,SL_R2(r11) |
2341 |
++ stmw r12,SL_R12(r11) |
2342 |
+ |
2343 |
+ /* Save MSR & SDR1 */ |
2344 |
+ mfmsr r4 |
2345 |
+- stw r4,SL_MSR(r1) |
2346 |
++ stw r4,SL_MSR(r11) |
2347 |
+ mfsdr1 r4 |
2348 |
+- stw r4,SL_SDR1(r1) |
2349 |
++ stw r4,SL_SDR1(r11) |
2350 |
+ |
2351 |
+ /* Get a stable timebase and save it */ |
2352 |
+ 1: mftbu r4 |
2353 |
+- stw r4,SL_TB(r1) |
2354 |
++ stw r4,SL_TB(r11) |
2355 |
+ mftb r5 |
2356 |
+- stw r5,SL_TB+4(r1) |
2357 |
++ stw r5,SL_TB+4(r11) |
2358 |
+ mftbu r3 |
2359 |
+ cmpw r3,r4 |
2360 |
+ bne 1b |
2361 |
+ |
2362 |
+ /* Save SPRGs */ |
2363 |
+ mfsprg r4,0 |
2364 |
+- stw r4,SL_SPRG0(r1) |
2365 |
++ stw r4,SL_SPRG0(r11) |
2366 |
+ mfsprg r4,1 |
2367 |
+- stw r4,SL_SPRG0+4(r1) |
2368 |
++ stw r4,SL_SPRG0+4(r11) |
2369 |
+ mfsprg r4,2 |
2370 |
+- stw r4,SL_SPRG0+8(r1) |
2371 |
++ stw r4,SL_SPRG0+8(r11) |
2372 |
+ mfsprg r4,3 |
2373 |
+- stw r4,SL_SPRG0+12(r1) |
2374 |
++ stw r4,SL_SPRG0+12(r11) |
2375 |
+ |
2376 |
+ /* Save BATs */ |
2377 |
+ mfdbatu r4,0 |
2378 |
+- stw r4,SL_DBAT0(r1) |
2379 |
++ stw r4,SL_DBAT0(r11) |
2380 |
+ mfdbatl r4,0 |
2381 |
+- stw r4,SL_DBAT0+4(r1) |
2382 |
++ stw r4,SL_DBAT0+4(r11) |
2383 |
+ mfdbatu r4,1 |
2384 |
+- stw r4,SL_DBAT1(r1) |
2385 |
++ stw r4,SL_DBAT1(r11) |
2386 |
+ mfdbatl r4,1 |
2387 |
+- stw r4,SL_DBAT1+4(r1) |
2388 |
++ stw r4,SL_DBAT1+4(r11) |
2389 |
+ mfdbatu r4,2 |
2390 |
+- stw r4,SL_DBAT2(r1) |
2391 |
++ stw r4,SL_DBAT2(r11) |
2392 |
+ mfdbatl r4,2 |
2393 |
+- stw r4,SL_DBAT2+4(r1) |
2394 |
++ stw r4,SL_DBAT2+4(r11) |
2395 |
+ mfdbatu r4,3 |
2396 |
+- stw r4,SL_DBAT3(r1) |
2397 |
++ stw r4,SL_DBAT3(r11) |
2398 |
+ mfdbatl r4,3 |
2399 |
+- stw r4,SL_DBAT3+4(r1) |
2400 |
++ stw r4,SL_DBAT3+4(r11) |
2401 |
+ mfibatu r4,0 |
2402 |
+- stw r4,SL_IBAT0(r1) |
2403 |
++ stw r4,SL_IBAT0(r11) |
2404 |
+ mfibatl r4,0 |
2405 |
+- stw r4,SL_IBAT0+4(r1) |
2406 |
++ stw r4,SL_IBAT0+4(r11) |
2407 |
+ mfibatu r4,1 |
2408 |
+- stw r4,SL_IBAT1(r1) |
2409 |
++ stw r4,SL_IBAT1(r11) |
2410 |
+ mfibatl r4,1 |
2411 |
+- stw r4,SL_IBAT1+4(r1) |
2412 |
++ stw r4,SL_IBAT1+4(r11) |
2413 |
+ mfibatu r4,2 |
2414 |
+- stw r4,SL_IBAT2(r1) |
2415 |
++ stw r4,SL_IBAT2(r11) |
2416 |
+ mfibatl r4,2 |
2417 |
+- stw r4,SL_IBAT2+4(r1) |
2418 |
++ stw r4,SL_IBAT2+4(r11) |
2419 |
+ mfibatu r4,3 |
2420 |
+- stw r4,SL_IBAT3(r1) |
2421 |
++ stw r4,SL_IBAT3(r11) |
2422 |
+ mfibatl r4,3 |
2423 |
+- stw r4,SL_IBAT3+4(r1) |
2424 |
++ stw r4,SL_IBAT3+4(r11) |
2425 |
+ |
2426 |
+ BEGIN_MMU_FTR_SECTION |
2427 |
+ mfspr r4,SPRN_DBAT4U |
2428 |
+- stw r4,SL_DBAT4(r1) |
2429 |
++ stw r4,SL_DBAT4(r11) |
2430 |
+ mfspr r4,SPRN_DBAT4L |
2431 |
+- stw r4,SL_DBAT4+4(r1) |
2432 |
++ stw r4,SL_DBAT4+4(r11) |
2433 |
+ mfspr r4,SPRN_DBAT5U |
2434 |
+- stw r4,SL_DBAT5(r1) |
2435 |
++ stw r4,SL_DBAT5(r11) |
2436 |
+ mfspr r4,SPRN_DBAT5L |
2437 |
+- stw r4,SL_DBAT5+4(r1) |
2438 |
++ stw r4,SL_DBAT5+4(r11) |
2439 |
+ mfspr r4,SPRN_DBAT6U |
2440 |
+- stw r4,SL_DBAT6(r1) |
2441 |
++ stw r4,SL_DBAT6(r11) |
2442 |
+ mfspr r4,SPRN_DBAT6L |
2443 |
+- stw r4,SL_DBAT6+4(r1) |
2444 |
++ stw r4,SL_DBAT6+4(r11) |
2445 |
+ mfspr r4,SPRN_DBAT7U |
2446 |
+- stw r4,SL_DBAT7(r1) |
2447 |
++ stw r4,SL_DBAT7(r11) |
2448 |
+ mfspr r4,SPRN_DBAT7L |
2449 |
+- stw r4,SL_DBAT7+4(r1) |
2450 |
++ stw r4,SL_DBAT7+4(r11) |
2451 |
+ mfspr r4,SPRN_IBAT4U |
2452 |
+- stw r4,SL_IBAT4(r1) |
2453 |
++ stw r4,SL_IBAT4(r11) |
2454 |
+ mfspr r4,SPRN_IBAT4L |
2455 |
+- stw r4,SL_IBAT4+4(r1) |
2456 |
++ stw r4,SL_IBAT4+4(r11) |
2457 |
+ mfspr r4,SPRN_IBAT5U |
2458 |
+- stw r4,SL_IBAT5(r1) |
2459 |
++ stw r4,SL_IBAT5(r11) |
2460 |
+ mfspr r4,SPRN_IBAT5L |
2461 |
+- stw r4,SL_IBAT5+4(r1) |
2462 |
++ stw r4,SL_IBAT5+4(r11) |
2463 |
+ mfspr r4,SPRN_IBAT6U |
2464 |
+- stw r4,SL_IBAT6(r1) |
2465 |
++ stw r4,SL_IBAT6(r11) |
2466 |
+ mfspr r4,SPRN_IBAT6L |
2467 |
+- stw r4,SL_IBAT6+4(r1) |
2468 |
++ stw r4,SL_IBAT6+4(r11) |
2469 |
+ mfspr r4,SPRN_IBAT7U |
2470 |
+- stw r4,SL_IBAT7(r1) |
2471 |
++ stw r4,SL_IBAT7(r11) |
2472 |
+ mfspr r4,SPRN_IBAT7L |
2473 |
+- stw r4,SL_IBAT7+4(r1) |
2474 |
++ stw r4,SL_IBAT7+4(r11) |
2475 |
+ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) |
2476 |
+ |
2477 |
+ /* Backup various CPU config stuffs */ |
2478 |
+@@ -180,9 +183,9 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) |
2479 |
+ lis r5,grackle_wake_up@ha |
2480 |
+ addi r5,r5,grackle_wake_up@l |
2481 |
+ tophys(r5,r5) |
2482 |
+- stw r5,SL_PC(r1) |
2483 |
++ stw r5,SL_PC(r11) |
2484 |
+ lis r4,KERNELBASE@h |
2485 |
+- tophys(r5,r1) |
2486 |
++ tophys(r5,r11) |
2487 |
+ addi r5,r5,SL_PC |
2488 |
+ lis r6,MAGIC@ha |
2489 |
+ addi r6,r6,MAGIC@l |
2490 |
+@@ -194,12 +197,6 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) |
2491 |
+ tophys(r3,r3) |
2492 |
+ stw r3,0x80(r4) |
2493 |
+ stw r5,0x84(r4) |
2494 |
+- /* Store a pointer to our backup storage into |
2495 |
+- * a kernel global |
2496 |
+- */ |
2497 |
+- lis r3,sleep_storage@ha |
2498 |
+- addi r3,r3,sleep_storage@l |
2499 |
+- stw r5,0(r3) |
2500 |
+ |
2501 |
+ .globl low_cpu_offline_self |
2502 |
+ low_cpu_offline_self: |
2503 |
+@@ -279,7 +276,7 @@ _GLOBAL(core99_wake_up) |
2504 |
+ lis r3,sleep_storage@ha |
2505 |
+ addi r3,r3,sleep_storage@l |
2506 |
+ tophys(r3,r3) |
2507 |
+- lwz r1,0(r3) |
2508 |
++ addi r1,r3,SL_PC |
2509 |
+ |
2510 |
+ /* Pass thru to older resume code ... */ |
2511 |
+ _ASM_NOKPROBE_SYMBOL(core99_wake_up) |
2512 |
+@@ -399,13 +396,6 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) |
2513 |
+ blt 1b |
2514 |
+ sync |
2515 |
+ |
2516 |
+- /* restore the MSR and turn on the MMU */ |
2517 |
+- lwz r3,SL_MSR(r1) |
2518 |
+- bl turn_on_mmu |
2519 |
+- |
2520 |
+- /* get back the stack pointer */ |
2521 |
+- tovirt(r1,r1) |
2522 |
+- |
2523 |
+ /* Restore TB */ |
2524 |
+ li r3,0 |
2525 |
+ mttbl r3 |
2526 |
+@@ -419,28 +409,24 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) |
2527 |
+ mtcr r0 |
2528 |
+ lwz r2,SL_R2(r1) |
2529 |
+ lmw r12,SL_R12(r1) |
2530 |
+- addi r1,r1,SL_SIZE |
2531 |
+- lwz r0,4(r1) |
2532 |
+- mtlr r0 |
2533 |
+- blr |
2534 |
+-_ASM_NOKPROBE_SYMBOL(grackle_wake_up) |
2535 |
+ |
2536 |
+-turn_on_mmu: |
2537 |
+- mflr r4 |
2538 |
+- tovirt(r4,r4) |
2539 |
++ /* restore the MSR and SP and turn on the MMU and return */ |
2540 |
++ lwz r3,SL_MSR(r1) |
2541 |
++ lwz r4,SL_LR(r1) |
2542 |
++ lwz r1,SL_SP(r1) |
2543 |
+ mtsrr0 r4 |
2544 |
+ mtsrr1 r3 |
2545 |
+ sync |
2546 |
+ isync |
2547 |
+ rfi |
2548 |
+-_ASM_NOKPROBE_SYMBOL(turn_on_mmu) |
2549 |
++_ASM_NOKPROBE_SYMBOL(grackle_wake_up) |
2550 |
+ |
2551 |
+ #endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */ |
2552 |
+ |
2553 |
+- .section .data |
2554 |
++ .section .bss |
2555 |
+ .balign L1_CACHE_BYTES |
2556 |
+ sleep_storage: |
2557 |
+- .long 0 |
2558 |
++ .space SL_SIZE |
2559 |
+ .balign L1_CACHE_BYTES, 0 |
2560 |
+ |
2561 |
+ #endif /* CONFIG_PPC_BOOK3S_32 */ |
2562 |
+diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c |
2563 |
+index 6828108486f83..0e42fe2d7b6ac 100644 |
2564 |
+--- a/arch/powerpc/platforms/powernv/memtrace.c |
2565 |
++++ b/arch/powerpc/platforms/powernv/memtrace.c |
2566 |
+@@ -30,6 +30,7 @@ struct memtrace_entry { |
2567 |
+ char name[16]; |
2568 |
+ }; |
2569 |
+ |
2570 |
++static DEFINE_MUTEX(memtrace_mutex); |
2571 |
+ static u64 memtrace_size; |
2572 |
+ |
2573 |
+ static struct memtrace_entry *memtrace_array; |
2574 |
+@@ -67,6 +68,23 @@ static int change_memblock_state(struct memory_block *mem, void *arg) |
2575 |
+ return 0; |
2576 |
+ } |
2577 |
+ |
2578 |
++static void memtrace_clear_range(unsigned long start_pfn, |
2579 |
++ unsigned long nr_pages) |
2580 |
++{ |
2581 |
++ unsigned long pfn; |
2582 |
++ |
2583 |
++ /* |
2584 |
++ * As pages are offline, we cannot trust the memmap anymore. As HIGHMEM |
2585 |
++ * does not apply, avoid passing around "struct page" and use |
2586 |
++ * clear_page() instead directly. |
2587 |
++ */ |
2588 |
++ for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) { |
2589 |
++ if (IS_ALIGNED(pfn, PAGES_PER_SECTION)) |
2590 |
++ cond_resched(); |
2591 |
++ clear_page(__va(PFN_PHYS(pfn))); |
2592 |
++ } |
2593 |
++} |
2594 |
++ |
2595 |
+ /* called with device_hotplug_lock held */ |
2596 |
+ static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) |
2597 |
+ { |
2598 |
+@@ -111,6 +129,11 @@ static u64 memtrace_alloc_node(u32 nid, u64 size) |
2599 |
+ lock_device_hotplug(); |
2600 |
+ for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) { |
2601 |
+ if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) { |
2602 |
++ /* |
2603 |
++ * Clear the range while we still have a linear |
2604 |
++ * mapping. |
2605 |
++ */ |
2606 |
++ memtrace_clear_range(base_pfn, nr_pages); |
2607 |
+ /* |
2608 |
+ * Remove memory in memory block size chunks so that |
2609 |
+ * iomem resources are always split to the same size and |
2610 |
+@@ -257,6 +280,7 @@ static int memtrace_online(void) |
2611 |
+ |
2612 |
+ static int memtrace_enable_set(void *data, u64 val) |
2613 |
+ { |
2614 |
++ int rc = -EAGAIN; |
2615 |
+ u64 bytes; |
2616 |
+ |
2617 |
+ /* |
2618 |
+@@ -269,25 +293,31 @@ static int memtrace_enable_set(void *data, u64 val) |
2619 |
+ return -EINVAL; |
2620 |
+ } |
2621 |
+ |
2622 |
++ mutex_lock(&memtrace_mutex); |
2623 |
++ |
2624 |
+ /* Re-add/online previously removed/offlined memory */ |
2625 |
+ if (memtrace_size) { |
2626 |
+ if (memtrace_online()) |
2627 |
+- return -EAGAIN; |
2628 |
++ goto out_unlock; |
2629 |
+ } |
2630 |
+ |
2631 |
+- if (!val) |
2632 |
+- return 0; |
2633 |
++ if (!val) { |
2634 |
++ rc = 0; |
2635 |
++ goto out_unlock; |
2636 |
++ } |
2637 |
+ |
2638 |
+ /* Offline and remove memory */ |
2639 |
+ if (memtrace_init_regions_runtime(val)) |
2640 |
+- return -EINVAL; |
2641 |
++ goto out_unlock; |
2642 |
+ |
2643 |
+ if (memtrace_init_debugfs()) |
2644 |
+- return -EINVAL; |
2645 |
++ goto out_unlock; |
2646 |
+ |
2647 |
+ memtrace_size = val; |
2648 |
+- |
2649 |
+- return 0; |
2650 |
++ rc = 0; |
2651 |
++out_unlock: |
2652 |
++ mutex_unlock(&memtrace_mutex); |
2653 |
++ return rc; |
2654 |
+ } |
2655 |
+ |
2656 |
+ static int memtrace_enable_get(void *data, u64 *val) |
2657 |
+diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c |
2658 |
+index abeaa533b976b..b711dc3262a30 100644 |
2659 |
+--- a/arch/powerpc/platforms/powernv/npu-dma.c |
2660 |
++++ b/arch/powerpc/platforms/powernv/npu-dma.c |
2661 |
+@@ -385,7 +385,8 @@ static void pnv_npu_peers_take_ownership(struct iommu_table_group *table_group) |
2662 |
+ for (i = 0; i < npucomp->pe_num; ++i) { |
2663 |
+ struct pnv_ioda_pe *pe = npucomp->pe[i]; |
2664 |
+ |
2665 |
+- if (!pe->table_group.ops->take_ownership) |
2666 |
++ if (!pe->table_group.ops || |
2667 |
++ !pe->table_group.ops->take_ownership) |
2668 |
+ continue; |
2669 |
+ pe->table_group.ops->take_ownership(&pe->table_group); |
2670 |
+ } |
2671 |
+@@ -401,7 +402,8 @@ static void pnv_npu_peers_release_ownership( |
2672 |
+ for (i = 0; i < npucomp->pe_num; ++i) { |
2673 |
+ struct pnv_ioda_pe *pe = npucomp->pe[i]; |
2674 |
+ |
2675 |
+- if (!pe->table_group.ops->release_ownership) |
2676 |
++ if (!pe->table_group.ops || |
2677 |
++ !pe->table_group.ops->release_ownership) |
2678 |
+ continue; |
2679 |
+ pe->table_group.ops->release_ownership(&pe->table_group); |
2680 |
+ } |
2681 |
+@@ -623,6 +625,11 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid, |
2682 |
+ return -ENODEV; |
2683 |
+ |
2684 |
+ hose = pci_bus_to_host(npdev->bus); |
2685 |
++ if (hose->npu == NULL) { |
2686 |
++ dev_info_once(&npdev->dev, "Nvlink1 does not support contexts"); |
2687 |
++ return 0; |
2688 |
++ } |
2689 |
++ |
2690 |
+ nphb = hose->private_data; |
2691 |
+ |
2692 |
+ dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=%u\n", |
2693 |
+@@ -670,6 +677,11 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev) |
2694 |
+ return -ENODEV; |
2695 |
+ |
2696 |
+ hose = pci_bus_to_host(npdev->bus); |
2697 |
++ if (hose->npu == NULL) { |
2698 |
++ dev_info_once(&npdev->dev, "Nvlink1 does not support contexts"); |
2699 |
++ return 0; |
2700 |
++ } |
2701 |
++ |
2702 |
+ nphb = hose->private_data; |
2703 |
+ |
2704 |
+ dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n", |
2705 |
+diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/powernv/pci-sriov.c |
2706 |
+index c4434f20f42fa..28aac933a4391 100644 |
2707 |
+--- a/arch/powerpc/platforms/powernv/pci-sriov.c |
2708 |
++++ b/arch/powerpc/platforms/powernv/pci-sriov.c |
2709 |
+@@ -422,7 +422,7 @@ static int pnv_pci_vf_assign_m64(struct pci_dev *pdev, u16 num_vfs) |
2710 |
+ { |
2711 |
+ struct pnv_iov_data *iov; |
2712 |
+ struct pnv_phb *phb; |
2713 |
+- unsigned int win; |
2714 |
++ int win; |
2715 |
+ struct resource *res; |
2716 |
+ int i, j; |
2717 |
+ int64_t rc; |
2718 |
+diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c |
2719 |
+index a02012f1b04af..12cbffd3c2e32 100644 |
2720 |
+--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c |
2721 |
++++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c |
2722 |
+@@ -746,6 +746,7 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add) |
2723 |
+ parent = of_find_node_by_path("/cpus"); |
2724 |
+ if (!parent) { |
2725 |
+ pr_warn("Could not find CPU root node in device tree\n"); |
2726 |
++ kfree(cpu_drcs); |
2727 |
+ return -1; |
2728 |
+ } |
2729 |
+ |
2730 |
+diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c |
2731 |
+index 81e0ac58d6204..64b36a93c33a6 100644 |
2732 |
+--- a/arch/powerpc/platforms/pseries/suspend.c |
2733 |
++++ b/arch/powerpc/platforms/pseries/suspend.c |
2734 |
+@@ -13,7 +13,6 @@ |
2735 |
+ #include <asm/mmu.h> |
2736 |
+ #include <asm/rtas.h> |
2737 |
+ #include <asm/topology.h> |
2738 |
+-#include "../../kernel/cacheinfo.h" |
2739 |
+ |
2740 |
+ static u64 stream_id; |
2741 |
+ static struct device suspend_dev; |
2742 |
+@@ -78,9 +77,7 @@ static void pseries_suspend_enable_irqs(void) |
2743 |
+ * Update configuration which can be modified based on device tree |
2744 |
+ * changes during resume. |
2745 |
+ */ |
2746 |
+- cacheinfo_cpu_offline(smp_processor_id()); |
2747 |
+ post_mobility_fixup(); |
2748 |
+- cacheinfo_cpu_online(smp_processor_id()); |
2749 |
+ } |
2750 |
+ |
2751 |
+ /** |
2752 |
+@@ -187,7 +184,6 @@ static struct bus_type suspend_subsys = { |
2753 |
+ |
2754 |
+ static const struct platform_suspend_ops pseries_suspend_ops = { |
2755 |
+ .valid = suspend_valid_only_mem, |
2756 |
+- .begin = pseries_suspend_begin, |
2757 |
+ .prepare_late = pseries_prepare_late, |
2758 |
+ .enter = pseries_suspend_enter, |
2759 |
+ }; |
2760 |
+diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c |
2761 |
+index 5c1a50912229a..9b0d85bff021e 100644 |
2762 |
+--- a/arch/powerpc/xmon/nonstdio.c |
2763 |
++++ b/arch/powerpc/xmon/nonstdio.c |
2764 |
+@@ -178,7 +178,7 @@ void xmon_printf(const char *format, ...) |
2765 |
+ |
2766 |
+ if (n && rc == 0) { |
2767 |
+ /* No udbg hooks, fallback to printk() - dangerous */ |
2768 |
+- printk("%s", xmon_outbuf); |
2769 |
++ pr_cont("%s", xmon_outbuf); |
2770 |
+ } |
2771 |
+ } |
2772 |
+ |
2773 |
+diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c |
2774 |
+index 55c43a6c91112..5559edf36756c 100644 |
2775 |
+--- a/arch/powerpc/xmon/xmon.c |
2776 |
++++ b/arch/powerpc/xmon/xmon.c |
2777 |
+@@ -1383,6 +1383,7 @@ static long check_bp_loc(unsigned long addr) |
2778 |
+ return 1; |
2779 |
+ } |
2780 |
+ |
2781 |
++#ifndef CONFIG_PPC_8xx |
2782 |
+ static int find_free_data_bpt(void) |
2783 |
+ { |
2784 |
+ int i; |
2785 |
+@@ -1394,6 +1395,7 @@ static int find_free_data_bpt(void) |
2786 |
+ printf("Couldn't find free breakpoint register\n"); |
2787 |
+ return -1; |
2788 |
+ } |
2789 |
++#endif |
2790 |
+ |
2791 |
+ static void print_data_bpts(void) |
2792 |
+ { |
2793 |
+diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c |
2794 |
+index 8e577f14f1205..e4133c20744ce 100644 |
2795 |
+--- a/arch/riscv/mm/init.c |
2796 |
++++ b/arch/riscv/mm/init.c |
2797 |
+@@ -174,7 +174,7 @@ void __init setup_bootmem(void) |
2798 |
+ * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed |
2799 |
+ * as it is unusable by kernel. |
2800 |
+ */ |
2801 |
+- memblock_enforce_memory_limit(mem_start - PAGE_OFFSET); |
2802 |
++ memblock_enforce_memory_limit(-PAGE_OFFSET); |
2803 |
+ |
2804 |
+ /* Reserve from the start of the kernel to the end of the kernel */ |
2805 |
+ memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); |
2806 |
+diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S |
2807 |
+index 92beb14446449..6343dca0dbeb6 100644 |
2808 |
+--- a/arch/s390/kernel/entry.S |
2809 |
++++ b/arch/s390/kernel/entry.S |
2810 |
+@@ -110,9 +110,9 @@ _LPP_OFFSET = __LC_LPP |
2811 |
+ #endif |
2812 |
+ .endm |
2813 |
+ |
2814 |
+- .macro SWITCH_ASYNC savearea,timer |
2815 |
++ .macro SWITCH_ASYNC savearea,timer,clock |
2816 |
+ tmhh %r8,0x0001 # interrupting from user ? |
2817 |
+- jnz 2f |
2818 |
++ jnz 4f |
2819 |
+ #if IS_ENABLED(CONFIG_KVM) |
2820 |
+ lgr %r14,%r9 |
2821 |
+ larl %r13,.Lsie_gmap |
2822 |
+@@ -125,10 +125,26 @@ _LPP_OFFSET = __LC_LPP |
2823 |
+ #endif |
2824 |
+ 0: larl %r13,.Lpsw_idle_exit |
2825 |
+ cgr %r13,%r9 |
2826 |
+- jne 1f |
2827 |
++ jne 3f |
2828 |
+ |
2829 |
+- mvc __CLOCK_IDLE_EXIT(8,%r2), __LC_INT_CLOCK |
2830 |
+- mvc __TIMER_IDLE_EXIT(8,%r2), __LC_ASYNC_ENTER_TIMER |
2831 |
++ larl %r1,smp_cpu_mtid |
2832 |
++ llgf %r1,0(%r1) |
2833 |
++ ltgr %r1,%r1 |
2834 |
++ jz 2f # no SMT, skip mt_cycles calculation |
2835 |
++ .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+80(%r15) |
2836 |
++ larl %r3,mt_cycles |
2837 |
++ ag %r3,__LC_PERCPU_OFFSET |
2838 |
++ la %r4,__SF_EMPTY+16(%r15) |
2839 |
++1: lg %r0,0(%r3) |
2840 |
++ slg %r0,0(%r4) |
2841 |
++ alg %r0,64(%r4) |
2842 |
++ stg %r0,0(%r3) |
2843 |
++ la %r3,8(%r3) |
2844 |
++ la %r4,8(%r4) |
2845 |
++ brct %r1,1b |
2846 |
++ |
2847 |
++2: mvc __CLOCK_IDLE_EXIT(8,%r2), \clock |
2848 |
++ mvc __TIMER_IDLE_EXIT(8,%r2), \timer |
2849 |
+ # account system time going idle |
2850 |
+ ni __LC_CPU_FLAGS+7,255-_CIF_ENABLED_WAIT |
2851 |
+ |
2852 |
+@@ -146,17 +162,17 @@ _LPP_OFFSET = __LC_LPP |
2853 |
+ mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2) |
2854 |
+ |
2855 |
+ nihh %r8,0xfcfd # clear wait state and irq bits |
2856 |
+-1: lg %r14,__LC_ASYNC_STACK # are we already on the target stack? |
2857 |
++3: lg %r14,__LC_ASYNC_STACK # are we already on the target stack? |
2858 |
+ slgr %r14,%r15 |
2859 |
+ srag %r14,%r14,STACK_SHIFT |
2860 |
+- jnz 3f |
2861 |
++ jnz 5f |
2862 |
+ CHECK_STACK \savearea |
2863 |
+ aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
2864 |
+- j 4f |
2865 |
+-2: UPDATE_VTIME %r14,%r15,\timer |
2866 |
++ j 6f |
2867 |
++4: UPDATE_VTIME %r14,%r15,\timer |
2868 |
+ BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP |
2869 |
+-3: lg %r15,__LC_ASYNC_STACK # load async stack |
2870 |
+-4: la %r11,STACK_FRAME_OVERHEAD(%r15) |
2871 |
++5: lg %r15,__LC_ASYNC_STACK # load async stack |
2872 |
++6: la %r11,STACK_FRAME_OVERHEAD(%r15) |
2873 |
+ .endm |
2874 |
+ |
2875 |
+ .macro UPDATE_VTIME w1,w2,enter_timer |
2876 |
+@@ -745,7 +761,7 @@ ENTRY(io_int_handler) |
2877 |
+ stmg %r8,%r15,__LC_SAVE_AREA_ASYNC |
2878 |
+ lg %r12,__LC_CURRENT |
2879 |
+ lmg %r8,%r9,__LC_IO_OLD_PSW |
2880 |
+- SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER |
2881 |
++ SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER,__LC_INT_CLOCK |
2882 |
+ stmg %r0,%r7,__PT_R0(%r11) |
2883 |
+ # clear user controlled registers to prevent speculative use |
2884 |
+ xgr %r0,%r0 |
2885 |
+@@ -945,7 +961,7 @@ ENTRY(ext_int_handler) |
2886 |
+ stmg %r8,%r15,__LC_SAVE_AREA_ASYNC |
2887 |
+ lg %r12,__LC_CURRENT |
2888 |
+ lmg %r8,%r9,__LC_EXT_OLD_PSW |
2889 |
+- SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER |
2890 |
++ SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER,__LC_INT_CLOCK |
2891 |
+ stmg %r0,%r7,__PT_R0(%r11) |
2892 |
+ # clear user controlled registers to prevent speculative use |
2893 |
+ xgr %r0,%r0 |
2894 |
+@@ -1167,7 +1183,7 @@ ENTRY(mcck_int_handler) |
2895 |
+ TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_IA_VALID |
2896 |
+ jno .Lmcck_panic |
2897 |
+ 4: ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off |
2898 |
+- SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+64,__LC_MCCK_ENTER_TIMER |
2899 |
++ SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+64,__LC_MCCK_ENTER_TIMER,__LC_MCCK_CLOCK |
2900 |
+ .Lmcck_skip: |
2901 |
+ lghi %r14,__LC_GPREGS_SAVE_AREA+64 |
2902 |
+ stmg %r0,%r7,__PT_R0(%r11) |
2903 |
+diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c |
2904 |
+index 390d97daa2b3f..3a0d545f0ce84 100644 |
2905 |
+--- a/arch/s390/kernel/smp.c |
2906 |
++++ b/arch/s390/kernel/smp.c |
2907 |
+@@ -896,24 +896,12 @@ static void __no_sanitize_address smp_start_secondary(void *cpuvoid) |
2908 |
+ /* Upping and downing of CPUs */ |
2909 |
+ int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
2910 |
+ { |
2911 |
+- struct pcpu *pcpu; |
2912 |
+- int base, i, rc; |
2913 |
++ struct pcpu *pcpu = pcpu_devices + cpu; |
2914 |
++ int rc; |
2915 |
+ |
2916 |
+- pcpu = pcpu_devices + cpu; |
2917 |
+ if (pcpu->state != CPU_STATE_CONFIGURED) |
2918 |
+ return -EIO; |
2919 |
+- base = smp_get_base_cpu(cpu); |
2920 |
+- for (i = 0; i <= smp_cpu_mtid; i++) { |
2921 |
+- if (base + i < nr_cpu_ids) |
2922 |
+- if (cpu_online(base + i)) |
2923 |
+- break; |
2924 |
+- } |
2925 |
+- /* |
2926 |
+- * If this is the first CPU of the core to get online |
2927 |
+- * do an initial CPU reset. |
2928 |
+- */ |
2929 |
+- if (i > smp_cpu_mtid && |
2930 |
+- pcpu_sigp_retry(pcpu_devices + base, SIGP_INITIAL_CPU_RESET, 0) != |
2931 |
++ if (pcpu_sigp_retry(pcpu, SIGP_INITIAL_CPU_RESET, 0) != |
2932 |
+ SIGP_CC_ORDER_CODE_ACCEPTED) |
2933 |
+ return -EIO; |
2934 |
+ |
2935 |
+diff --git a/arch/s390/lib/test_unwind.c b/arch/s390/lib/test_unwind.c |
2936 |
+index 7c988994931f0..6bad84c372dcb 100644 |
2937 |
+--- a/arch/s390/lib/test_unwind.c |
2938 |
++++ b/arch/s390/lib/test_unwind.c |
2939 |
+@@ -205,12 +205,15 @@ static noinline int unwindme_func3(struct unwindme *u) |
2940 |
+ /* This function must appear in the backtrace. */ |
2941 |
+ static noinline int unwindme_func2(struct unwindme *u) |
2942 |
+ { |
2943 |
++ unsigned long flags; |
2944 |
+ int rc; |
2945 |
+ |
2946 |
+ if (u->flags & UWM_SWITCH_STACK) { |
2947 |
+- preempt_disable(); |
2948 |
++ local_irq_save(flags); |
2949 |
++ local_mcck_disable(); |
2950 |
+ rc = CALL_ON_STACK(unwindme_func3, S390_lowcore.nodat_stack, 1, u); |
2951 |
+- preempt_enable(); |
2952 |
++ local_mcck_enable(); |
2953 |
++ local_irq_restore(flags); |
2954 |
+ return rc; |
2955 |
+ } else { |
2956 |
+ return unwindme_func3(u); |
2957 |
+diff --git a/arch/s390/purgatory/head.S b/arch/s390/purgatory/head.S |
2958 |
+index 5a10ce34b95d1..3d1c31e0cf3dd 100644 |
2959 |
+--- a/arch/s390/purgatory/head.S |
2960 |
++++ b/arch/s390/purgatory/head.S |
2961 |
+@@ -62,14 +62,15 @@ |
2962 |
+ jh 10b |
2963 |
+ .endm |
2964 |
+ |
2965 |
+-.macro START_NEXT_KERNEL base |
2966 |
++.macro START_NEXT_KERNEL base subcode |
2967 |
+ lg %r4,kernel_entry-\base(%r13) |
2968 |
+ lg %r5,load_psw_mask-\base(%r13) |
2969 |
+ ogr %r4,%r5 |
2970 |
+ stg %r4,0(%r0) |
2971 |
+ |
2972 |
+ xgr %r0,%r0 |
2973 |
+- diag %r0,%r0,0x308 |
2974 |
++ lghi %r1,\subcode |
2975 |
++ diag %r0,%r1,0x308 |
2976 |
+ .endm |
2977 |
+ |
2978 |
+ .text |
2979 |
+@@ -123,7 +124,7 @@ ENTRY(purgatory_start) |
2980 |
+ je .start_crash_kernel |
2981 |
+ |
2982 |
+ /* start normal kernel */ |
2983 |
+- START_NEXT_KERNEL .base_crash |
2984 |
++ START_NEXT_KERNEL .base_crash 0 |
2985 |
+ |
2986 |
+ .return_old_kernel: |
2987 |
+ lmg %r6,%r15,gprregs-.base_crash(%r13) |
2988 |
+@@ -227,7 +228,7 @@ ENTRY(purgatory_start) |
2989 |
+ MEMCPY %r9,%r10,%r11 |
2990 |
+ |
2991 |
+ /* start crash kernel */ |
2992 |
+- START_NEXT_KERNEL .base_dst |
2993 |
++ START_NEXT_KERNEL .base_dst 1 |
2994 |
+ |
2995 |
+ |
2996 |
+ load_psw_mask: |
2997 |
+diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c |
2998 |
+index 96edf64d4fb30..182bb7bdaa0a1 100644 |
2999 |
+--- a/arch/sparc/mm/init_64.c |
3000 |
++++ b/arch/sparc/mm/init_64.c |
3001 |
+@@ -2894,7 +2894,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) |
3002 |
+ if (!page) |
3003 |
+ return NULL; |
3004 |
+ if (!pgtable_pte_page_ctor(page)) { |
3005 |
+- free_unref_page(page); |
3006 |
++ __free_page(page); |
3007 |
+ return NULL; |
3008 |
+ } |
3009 |
+ return (pte_t *) page_address(page); |
3010 |
+diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c |
3011 |
+index 4d80526a4236e..d8845d4aac6a7 100644 |
3012 |
+--- a/arch/um/drivers/chan_user.c |
3013 |
++++ b/arch/um/drivers/chan_user.c |
3014 |
+@@ -26,10 +26,10 @@ int generic_read(int fd, char *c_out, void *unused) |
3015 |
+ n = read(fd, c_out, sizeof(*c_out)); |
3016 |
+ if (n > 0) |
3017 |
+ return n; |
3018 |
+- else if (errno == EAGAIN) |
3019 |
+- return 0; |
3020 |
+ else if (n == 0) |
3021 |
+ return -EIO; |
3022 |
++ else if (errno == EAGAIN) |
3023 |
++ return 0; |
3024 |
+ return -errno; |
3025 |
+ } |
3026 |
+ |
3027 |
+diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c |
3028 |
+index fc7f1e7467032..87ca4a47cd66e 100644 |
3029 |
+--- a/arch/um/drivers/xterm.c |
3030 |
++++ b/arch/um/drivers/xterm.c |
3031 |
+@@ -18,6 +18,7 @@ |
3032 |
+ struct xterm_chan { |
3033 |
+ int pid; |
3034 |
+ int helper_pid; |
3035 |
++ int chan_fd; |
3036 |
+ char *title; |
3037 |
+ int device; |
3038 |
+ int raw; |
3039 |
+@@ -33,6 +34,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts) |
3040 |
+ return NULL; |
3041 |
+ *data = ((struct xterm_chan) { .pid = -1, |
3042 |
+ .helper_pid = -1, |
3043 |
++ .chan_fd = -1, |
3044 |
+ .device = device, |
3045 |
+ .title = opts->xterm_title, |
3046 |
+ .raw = opts->raw } ); |
3047 |
+@@ -149,6 +151,7 @@ static int xterm_open(int input, int output, int primary, void *d, |
3048 |
+ goto out_kill; |
3049 |
+ } |
3050 |
+ |
3051 |
++ data->chan_fd = fd; |
3052 |
+ new = xterm_fd(fd, &data->helper_pid); |
3053 |
+ if (new < 0) { |
3054 |
+ err = new; |
3055 |
+@@ -206,6 +209,8 @@ static void xterm_close(int fd, void *d) |
3056 |
+ os_kill_process(data->helper_pid, 0); |
3057 |
+ data->helper_pid = -1; |
3058 |
+ |
3059 |
++ if (data->chan_fd != -1) |
3060 |
++ os_close_file(data->chan_fd); |
3061 |
+ os_close_file(fd); |
3062 |
+ } |
3063 |
+ |
3064 |
+diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c |
3065 |
+index 3d109ff3309b2..8dafc3f2add42 100644 |
3066 |
+--- a/arch/um/kernel/time.c |
3067 |
++++ b/arch/um/kernel/time.c |
3068 |
+@@ -260,11 +260,6 @@ static void __time_travel_add_event(struct time_travel_event *e, |
3069 |
+ struct time_travel_event *tmp; |
3070 |
+ bool inserted = false; |
3071 |
+ |
3072 |
+- if (WARN(time_travel_mode == TT_MODE_BASIC && |
3073 |
+- e != &time_travel_timer_event, |
3074 |
+- "only timer events can be handled in basic mode")) |
3075 |
+- return; |
3076 |
+- |
3077 |
+ if (e->pending) |
3078 |
+ return; |
3079 |
+ |
3080 |
+diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c |
3081 |
+index d508310ee5e1e..f1732c308c615 100644 |
3082 |
+--- a/arch/um/os-Linux/irq.c |
3083 |
++++ b/arch/um/os-Linux/irq.c |
3084 |
+@@ -48,7 +48,7 @@ int os_epoll_triggered(int index, int events) |
3085 |
+ int os_event_mask(int irq_type) |
3086 |
+ { |
3087 |
+ if (irq_type == IRQ_READ) |
3088 |
+- return EPOLLIN | EPOLLPRI; |
3089 |
++ return EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP | EPOLLRDHUP; |
3090 |
+ if (irq_type == IRQ_WRITE) |
3091 |
+ return EPOLLOUT; |
3092 |
+ return 0; |
3093 |
+diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c |
3094 |
+index 1d7558dac75f3..a3dd61521d240 100644 |
3095 |
+--- a/arch/um/os-Linux/umid.c |
3096 |
++++ b/arch/um/os-Linux/umid.c |
3097 |
+@@ -137,20 +137,13 @@ static inline int is_umdir_used(char *dir) |
3098 |
+ { |
3099 |
+ char pid[sizeof("nnnnnnnnn")], *end, *file; |
3100 |
+ int dead, fd, p, n, err; |
3101 |
+- size_t filelen; |
3102 |
++ size_t filelen = strlen(dir) + sizeof("/pid") + 1; |
3103 |
+ |
3104 |
+- err = asprintf(&file, "%s/pid", dir); |
3105 |
+- if (err < 0) |
3106 |
+- return 0; |
3107 |
+- |
3108 |
+- filelen = strlen(file); |
3109 |
++ file = malloc(filelen); |
3110 |
++ if (!file) |
3111 |
++ return -ENOMEM; |
3112 |
+ |
3113 |
+- n = snprintf(file, filelen, "%s/pid", dir); |
3114 |
+- if (n >= filelen) { |
3115 |
+- printk(UM_KERN_ERR "is_umdir_used - pid filename too long\n"); |
3116 |
+- err = -E2BIG; |
3117 |
+- goto out; |
3118 |
+- } |
3119 |
++ snprintf(file, filelen, "%s/pid", dir); |
3120 |
+ |
3121 |
+ dead = 0; |
3122 |
+ fd = open(file, O_RDONLY); |
3123 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
3124 |
+index af457f8cb29dd..7d4d89fa8647a 100644 |
3125 |
+--- a/arch/x86/events/intel/core.c |
3126 |
++++ b/arch/x86/events/intel/core.c |
3127 |
+@@ -257,7 +257,8 @@ static struct event_constraint intel_icl_event_constraints[] = { |
3128 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0x48, 0x54, 0xf), |
3129 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0x60, 0x8b, 0xf), |
3130 |
+ INTEL_UEVENT_CONSTRAINT(0x04a3, 0xff), /* CYCLE_ACTIVITY.STALLS_TOTAL */ |
3131 |
+- INTEL_UEVENT_CONSTRAINT(0x10a3, 0xff), /* CYCLE_ACTIVITY.STALLS_MEM_ANY */ |
3132 |
++ INTEL_UEVENT_CONSTRAINT(0x10a3, 0xff), /* CYCLE_ACTIVITY.CYCLES_MEM_ANY */ |
3133 |
++ INTEL_UEVENT_CONSTRAINT(0x14a3, 0xff), /* CYCLE_ACTIVITY.STALLS_MEM_ANY */ |
3134 |
+ INTEL_EVENT_CONSTRAINT(0xa3, 0xf), /* CYCLE_ACTIVITY.* */ |
3135 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0xa8, 0xb0, 0xf), |
3136 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0xb7, 0xbd, 0xf), |
3137 |
+@@ -5464,7 +5465,7 @@ __init int intel_pmu_init(void) |
3138 |
+ mem_attr = icl_events_attrs; |
3139 |
+ td_attr = icl_td_events_attrs; |
3140 |
+ tsx_attr = icl_tsx_events_attrs; |
3141 |
+- x86_pmu.rtm_abort_event = X86_CONFIG(.event=0xca, .umask=0x02); |
3142 |
++ x86_pmu.rtm_abort_event = X86_CONFIG(.event=0xc9, .umask=0x04); |
3143 |
+ x86_pmu.lbr_pt_coexist = true; |
3144 |
+ intel_pmu_pebs_data_source_skl(pmem); |
3145 |
+ x86_pmu.update_topdown_event = icl_update_topdown_event; |
3146 |
+diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c |
3147 |
+index 8961653c5dd2b..e2b0efcba1017 100644 |
3148 |
+--- a/arch/x86/events/intel/lbr.c |
3149 |
++++ b/arch/x86/events/intel/lbr.c |
3150 |
+@@ -919,7 +919,7 @@ static __always_inline bool get_lbr_predicted(u64 info) |
3151 |
+ return !(info & LBR_INFO_MISPRED); |
3152 |
+ } |
3153 |
+ |
3154 |
+-static __always_inline bool get_lbr_cycles(u64 info) |
3155 |
++static __always_inline u16 get_lbr_cycles(u64 info) |
3156 |
+ { |
3157 |
+ if (static_cpu_has(X86_FEATURE_ARCH_LBR) && |
3158 |
+ !(x86_pmu.lbr_timed_lbr && info & LBR_INFO_CYC_CNT_VALID)) |
3159 |
+diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h |
3160 |
+index 4e3099d9ae625..57af25cb44f63 100644 |
3161 |
+--- a/arch/x86/include/asm/apic.h |
3162 |
++++ b/arch/x86/include/asm/apic.h |
3163 |
+@@ -259,6 +259,7 @@ static inline u64 native_x2apic_icr_read(void) |
3164 |
+ |
3165 |
+ extern int x2apic_mode; |
3166 |
+ extern int x2apic_phys; |
3167 |
++extern void __init x2apic_set_max_apicid(u32 apicid); |
3168 |
+ extern void __init check_x2apic(void); |
3169 |
+ extern void x2apic_setup(void); |
3170 |
+ static inline int x2apic_enabled(void) |
3171 |
+diff --git a/arch/x86/include/asm/cacheinfo.h b/arch/x86/include/asm/cacheinfo.h |
3172 |
+index 86b63c7feab75..86b2e0dcc4bfe 100644 |
3173 |
+--- a/arch/x86/include/asm/cacheinfo.h |
3174 |
++++ b/arch/x86/include/asm/cacheinfo.h |
3175 |
+@@ -2,7 +2,7 @@ |
3176 |
+ #ifndef _ASM_X86_CACHEINFO_H |
3177 |
+ #define _ASM_X86_CACHEINFO_H |
3178 |
+ |
3179 |
+-void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id); |
3180 |
+-void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id); |
3181 |
++void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu); |
3182 |
++void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu); |
3183 |
+ |
3184 |
+ #endif /* _ASM_X86_CACHEINFO_H */ |
3185 |
+diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h |
3186 |
+index a0f147893a041..fc25c88c7ff29 100644 |
3187 |
+--- a/arch/x86/include/asm/mce.h |
3188 |
++++ b/arch/x86/include/asm/mce.h |
3189 |
+@@ -177,7 +177,8 @@ enum mce_notifier_prios { |
3190 |
+ MCE_PRIO_EXTLOG, |
3191 |
+ MCE_PRIO_UC, |
3192 |
+ MCE_PRIO_EARLY, |
3193 |
+- MCE_PRIO_CEC |
3194 |
++ MCE_PRIO_CEC, |
3195 |
++ MCE_PRIO_HIGHEST = MCE_PRIO_CEC |
3196 |
+ }; |
3197 |
+ |
3198 |
+ struct notifier_block; |
3199 |
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
3200 |
+index b3eef1d5c9037..113f6ca7b8284 100644 |
3201 |
+--- a/arch/x86/kernel/apic/apic.c |
3202 |
++++ b/arch/x86/kernel/apic/apic.c |
3203 |
+@@ -1841,20 +1841,22 @@ static __init void try_to_enable_x2apic(int remap_mode) |
3204 |
+ return; |
3205 |
+ |
3206 |
+ if (remap_mode != IRQ_REMAP_X2APIC_MODE) { |
3207 |
+- /* IR is required if there is APIC ID > 255 even when running |
3208 |
+- * under KVM |
3209 |
++ /* |
3210 |
++ * Using X2APIC without IR is not architecturally supported |
3211 |
++ * on bare metal but may be supported in guests. |
3212 |
+ */ |
3213 |
+- if (max_physical_apicid > 255 || |
3214 |
+- !x86_init.hyper.x2apic_available()) { |
3215 |
++ if (!x86_init.hyper.x2apic_available()) { |
3216 |
+ pr_info("x2apic: IRQ remapping doesn't support X2APIC mode\n"); |
3217 |
+ x2apic_disable(); |
3218 |
+ return; |
3219 |
+ } |
3220 |
+ |
3221 |
+ /* |
3222 |
+- * without IR all CPUs can be addressed by IOAPIC/MSI |
3223 |
+- * only in physical mode |
3224 |
++ * Without IR, all CPUs can be addressed by IOAPIC/MSI only |
3225 |
++ * in physical mode, and CPUs with an APIC ID that cannnot |
3226 |
++ * be addressed must not be brought online. |
3227 |
+ */ |
3228 |
++ x2apic_set_max_apicid(255); |
3229 |
+ x2apic_phys = 1; |
3230 |
+ } |
3231 |
+ x2apic_enable(); |
3232 |
+diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c |
3233 |
+index bc9693841353c..e14eae6d6ea71 100644 |
3234 |
+--- a/arch/x86/kernel/apic/x2apic_phys.c |
3235 |
++++ b/arch/x86/kernel/apic/x2apic_phys.c |
3236 |
+@@ -8,6 +8,12 @@ |
3237 |
+ int x2apic_phys; |
3238 |
+ |
3239 |
+ static struct apic apic_x2apic_phys; |
3240 |
++static u32 x2apic_max_apicid __ro_after_init; |
3241 |
++ |
3242 |
++void __init x2apic_set_max_apicid(u32 apicid) |
3243 |
++{ |
3244 |
++ x2apic_max_apicid = apicid; |
3245 |
++} |
3246 |
+ |
3247 |
+ static int __init set_x2apic_phys_mode(char *arg) |
3248 |
+ { |
3249 |
+@@ -98,6 +104,9 @@ static int x2apic_phys_probe(void) |
3250 |
+ /* Common x2apic functions, also used by x2apic_cluster */ |
3251 |
+ int x2apic_apic_id_valid(u32 apicid) |
3252 |
+ { |
3253 |
++ if (x2apic_max_apicid && apicid > x2apic_max_apicid) |
3254 |
++ return 0; |
3255 |
++ |
3256 |
+ return 1; |
3257 |
+ } |
3258 |
+ |
3259 |
+diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
3260 |
+index 6062ce586b959..2f1fbd8150af7 100644 |
3261 |
+--- a/arch/x86/kernel/cpu/amd.c |
3262 |
++++ b/arch/x86/kernel/cpu/amd.c |
3263 |
+@@ -330,7 +330,6 @@ static void legacy_fixup_core_id(struct cpuinfo_x86 *c) |
3264 |
+ */ |
3265 |
+ static void amd_get_topology(struct cpuinfo_x86 *c) |
3266 |
+ { |
3267 |
+- u8 node_id; |
3268 |
+ int cpu = smp_processor_id(); |
3269 |
+ |
3270 |
+ /* get information required for multi-node processors */ |
3271 |
+@@ -340,7 +339,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) |
3272 |
+ |
3273 |
+ cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
3274 |
+ |
3275 |
+- node_id = ecx & 0xff; |
3276 |
++ c->cpu_die_id = ecx & 0xff; |
3277 |
+ |
3278 |
+ if (c->x86 == 0x15) |
3279 |
+ c->cu_id = ebx & 0xff; |
3280 |
+@@ -360,15 +359,15 @@ static void amd_get_topology(struct cpuinfo_x86 *c) |
3281 |
+ if (!err) |
3282 |
+ c->x86_coreid_bits = get_count_order(c->x86_max_cores); |
3283 |
+ |
3284 |
+- cacheinfo_amd_init_llc_id(c, cpu, node_id); |
3285 |
++ cacheinfo_amd_init_llc_id(c, cpu); |
3286 |
+ |
3287 |
+ } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
3288 |
+ u64 value; |
3289 |
+ |
3290 |
+ rdmsrl(MSR_FAM10H_NODE_ID, value); |
3291 |
+- node_id = value & 7; |
3292 |
++ c->cpu_die_id = value & 7; |
3293 |
+ |
3294 |
+- per_cpu(cpu_llc_id, cpu) = node_id; |
3295 |
++ per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; |
3296 |
+ } else |
3297 |
+ return; |
3298 |
+ |
3299 |
+@@ -393,7 +392,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c) |
3300 |
+ /* Convert the initial APIC ID into the socket ID */ |
3301 |
+ c->phys_proc_id = c->initial_apicid >> bits; |
3302 |
+ /* use socket ID also for last level cache */ |
3303 |
+- per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; |
3304 |
++ per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id; |
3305 |
+ } |
3306 |
+ |
3307 |
+ static void amd_detect_ppin(struct cpuinfo_x86 *c) |
3308 |
+diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c |
3309 |
+index 57074cf3ad7c1..f9ac682e75e78 100644 |
3310 |
+--- a/arch/x86/kernel/cpu/cacheinfo.c |
3311 |
++++ b/arch/x86/kernel/cpu/cacheinfo.c |
3312 |
+@@ -646,7 +646,7 @@ static int find_num_cache_leaves(struct cpuinfo_x86 *c) |
3313 |
+ return i; |
3314 |
+ } |
3315 |
+ |
3316 |
+-void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
3317 |
++void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu) |
3318 |
+ { |
3319 |
+ /* |
3320 |
+ * We may have multiple LLCs if L3 caches exist, so check if we |
3321 |
+@@ -657,7 +657,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
3322 |
+ |
3323 |
+ if (c->x86 < 0x17) { |
3324 |
+ /* LLC is at the node level. */ |
3325 |
+- per_cpu(cpu_llc_id, cpu) = node_id; |
3326 |
++ per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; |
3327 |
+ } else if (c->x86 == 0x17 && c->x86_model <= 0x1F) { |
3328 |
+ /* |
3329 |
+ * LLC is at the core complex level. |
3330 |
+@@ -684,7 +684,7 @@ void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
3331 |
+ } |
3332 |
+ } |
3333 |
+ |
3334 |
+-void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu, u8 node_id) |
3335 |
++void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c, int cpu) |
3336 |
+ { |
3337 |
+ /* |
3338 |
+ * We may have multiple LLCs if L3 caches exist, so check if we |
3339 |
+diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c |
3340 |
+index ac6c30e5801da..dc0840aae26c1 100644 |
3341 |
+--- a/arch/x86/kernel/cpu/hygon.c |
3342 |
++++ b/arch/x86/kernel/cpu/hygon.c |
3343 |
+@@ -65,7 +65,6 @@ static void hygon_get_topology_early(struct cpuinfo_x86 *c) |
3344 |
+ */ |
3345 |
+ static void hygon_get_topology(struct cpuinfo_x86 *c) |
3346 |
+ { |
3347 |
+- u8 node_id; |
3348 |
+ int cpu = smp_processor_id(); |
3349 |
+ |
3350 |
+ /* get information required for multi-node processors */ |
3351 |
+@@ -75,7 +74,7 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) |
3352 |
+ |
3353 |
+ cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
3354 |
+ |
3355 |
+- node_id = ecx & 0xff; |
3356 |
++ c->cpu_die_id = ecx & 0xff; |
3357 |
+ |
3358 |
+ c->cpu_core_id = ebx & 0xff; |
3359 |
+ |
3360 |
+@@ -93,14 +92,14 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) |
3361 |
+ /* Socket ID is ApicId[6] for these processors. */ |
3362 |
+ c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; |
3363 |
+ |
3364 |
+- cacheinfo_hygon_init_llc_id(c, cpu, node_id); |
3365 |
++ cacheinfo_hygon_init_llc_id(c, cpu); |
3366 |
+ } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
3367 |
+ u64 value; |
3368 |
+ |
3369 |
+ rdmsrl(MSR_FAM10H_NODE_ID, value); |
3370 |
+- node_id = value & 7; |
3371 |
++ c->cpu_die_id = value & 7; |
3372 |
+ |
3373 |
+- per_cpu(cpu_llc_id, cpu) = node_id; |
3374 |
++ per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; |
3375 |
+ } else |
3376 |
+ return; |
3377 |
+ |
3378 |
+@@ -123,7 +122,7 @@ static void hygon_detect_cmp(struct cpuinfo_x86 *c) |
3379 |
+ /* Convert the initial APIC ID into the socket ID */ |
3380 |
+ c->phys_proc_id = c->initial_apicid >> bits; |
3381 |
+ /* use socket ID also for last level cache */ |
3382 |
+- per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; |
3383 |
++ per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id; |
3384 |
+ } |
3385 |
+ |
3386 |
+ static void srat_detect_node(struct cpuinfo_x86 *c) |
3387 |
+diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c |
3388 |
+index 32b7099e35111..311688202ea51 100644 |
3389 |
+--- a/arch/x86/kernel/cpu/mce/core.c |
3390 |
++++ b/arch/x86/kernel/cpu/mce/core.c |
3391 |
+@@ -162,7 +162,8 @@ EXPORT_SYMBOL_GPL(mce_log); |
3392 |
+ |
3393 |
+ void mce_register_decode_chain(struct notifier_block *nb) |
3394 |
+ { |
3395 |
+- if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC)) |
3396 |
++ if (WARN_ON(nb->priority < MCE_PRIO_LOWEST || |
3397 |
++ nb->priority > MCE_PRIO_HIGHEST)) |
3398 |
+ return; |
3399 |
+ |
3400 |
+ blocking_notifier_chain_register(&x86_mce_decoder_chain, nb); |
3401 |
+diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
3402 |
+index 547c7abb39f51..39f7d8c3c064b 100644 |
3403 |
+--- a/arch/x86/kernel/kprobes/core.c |
3404 |
++++ b/arch/x86/kernel/kprobes/core.c |
3405 |
+@@ -937,6 +937,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr) |
3406 |
+ * So clear it by resetting the current kprobe: |
3407 |
+ */ |
3408 |
+ regs->flags &= ~X86_EFLAGS_TF; |
3409 |
++ /* |
3410 |
++ * Since the single step (trap) has been cancelled, |
3411 |
++ * we need to restore BTF here. |
3412 |
++ */ |
3413 |
++ restore_btf(); |
3414 |
+ |
3415 |
+ /* |
3416 |
+ * If the TF flag was set before the kprobe hit, |
3417 |
+diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c |
3418 |
+index ae64f98ec2ab6..4c09ba1102047 100644 |
3419 |
+--- a/arch/x86/kernel/tboot.c |
3420 |
++++ b/arch/x86/kernel/tboot.c |
3421 |
+@@ -93,6 +93,7 @@ static struct mm_struct tboot_mm = { |
3422 |
+ .pgd = swapper_pg_dir, |
3423 |
+ .mm_users = ATOMIC_INIT(2), |
3424 |
+ .mm_count = ATOMIC_INIT(1), |
3425 |
++ .write_protect_seq = SEQCNT_ZERO(tboot_mm.write_protect_seq), |
3426 |
+ MMAP_LOCK_INITIALIZER(init_mm) |
3427 |
+ .page_table_lock = __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock), |
3428 |
+ .mmlist = LIST_HEAD_INIT(init_mm.mmlist), |
3429 |
+diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h |
3430 |
+index f7a6e8f83783c..dc921d76e42e8 100644 |
3431 |
+--- a/arch/x86/kvm/cpuid.h |
3432 |
++++ b/arch/x86/kvm/cpuid.h |
3433 |
+@@ -264,6 +264,20 @@ static inline int guest_cpuid_stepping(struct kvm_vcpu *vcpu) |
3434 |
+ return x86_stepping(best->eax); |
3435 |
+ } |
3436 |
+ |
3437 |
++static inline bool guest_has_spec_ctrl_msr(struct kvm_vcpu *vcpu) |
3438 |
++{ |
3439 |
++ return (guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) || |
3440 |
++ guest_cpuid_has(vcpu, X86_FEATURE_AMD_STIBP) || |
3441 |
++ guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS) || |
3442 |
++ guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)); |
3443 |
++} |
3444 |
++ |
3445 |
++static inline bool guest_has_pred_cmd_msr(struct kvm_vcpu *vcpu) |
3446 |
++{ |
3447 |
++ return (guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) || |
3448 |
++ guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBPB)); |
3449 |
++} |
3450 |
++ |
3451 |
+ static inline bool supports_cpuid_fault(struct kvm_vcpu *vcpu) |
3452 |
+ { |
3453 |
+ return vcpu->arch.msr_platform_info & MSR_PLATFORM_INFO_CPUID_FAULT; |
3454 |
+diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c |
3455 |
+index 566f4d18185b1..5c9630c3f6ba1 100644 |
3456 |
+--- a/arch/x86/kvm/svm/sev.c |
3457 |
++++ b/arch/x86/kvm/svm/sev.c |
3458 |
+@@ -1127,9 +1127,6 @@ void sev_vm_destroy(struct kvm *kvm) |
3459 |
+ |
3460 |
+ int __init sev_hardware_setup(void) |
3461 |
+ { |
3462 |
+- struct sev_user_data_status *status; |
3463 |
+- int rc; |
3464 |
+- |
3465 |
+ /* Maximum number of encrypted guests supported simultaneously */ |
3466 |
+ max_sev_asid = cpuid_ecx(0x8000001F); |
3467 |
+ |
3468 |
+@@ -1148,26 +1145,9 @@ int __init sev_hardware_setup(void) |
3469 |
+ if (!sev_reclaim_asid_bitmap) |
3470 |
+ return 1; |
3471 |
+ |
3472 |
+- status = kmalloc(sizeof(*status), GFP_KERNEL); |
3473 |
+- if (!status) |
3474 |
+- return 1; |
3475 |
+- |
3476 |
+- /* |
3477 |
+- * Check SEV platform status. |
3478 |
+- * |
3479 |
+- * PLATFORM_STATUS can be called in any state, if we failed to query |
3480 |
+- * the PLATFORM status then either PSP firmware does not support SEV |
3481 |
+- * feature or SEV firmware is dead. |
3482 |
+- */ |
3483 |
+- rc = sev_platform_status(status, NULL); |
3484 |
+- if (rc) |
3485 |
+- goto err; |
3486 |
+- |
3487 |
+ pr_info("SEV supported\n"); |
3488 |
+ |
3489 |
+-err: |
3490 |
+- kfree(status); |
3491 |
+- return rc; |
3492 |
++ return 0; |
3493 |
+ } |
3494 |
+ |
3495 |
+ void sev_hardware_teardown(void) |
3496 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
3497 |
+index da7eb4aaf44f8..94b0cb8330451 100644 |
3498 |
+--- a/arch/x86/kvm/svm/svm.c |
3499 |
++++ b/arch/x86/kvm/svm/svm.c |
3500 |
+@@ -2543,10 +2543,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
3501 |
+ break; |
3502 |
+ case MSR_IA32_SPEC_CTRL: |
3503 |
+ if (!msr_info->host_initiated && |
3504 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) && |
3505 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_STIBP) && |
3506 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS) && |
3507 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)) |
3508 |
++ !guest_has_spec_ctrl_msr(vcpu)) |
3509 |
+ return 1; |
3510 |
+ |
3511 |
+ msr_info->data = svm->spec_ctrl; |
3512 |
+@@ -2630,10 +2627,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) |
3513 |
+ break; |
3514 |
+ case MSR_IA32_SPEC_CTRL: |
3515 |
+ if (!msr->host_initiated && |
3516 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) && |
3517 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_STIBP) && |
3518 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS) && |
3519 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)) |
3520 |
++ !guest_has_spec_ctrl_msr(vcpu)) |
3521 |
+ return 1; |
3522 |
+ |
3523 |
+ if (kvm_spec_ctrl_test_value(data)) |
3524 |
+@@ -2658,12 +2652,12 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) |
3525 |
+ break; |
3526 |
+ case MSR_IA32_PRED_CMD: |
3527 |
+ if (!msr->host_initiated && |
3528 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBPB)) |
3529 |
++ !guest_has_pred_cmd_msr(vcpu)) |
3530 |
+ return 1; |
3531 |
+ |
3532 |
+ if (data & ~PRED_CMD_IBPB) |
3533 |
+ return 1; |
3534 |
+- if (!boot_cpu_has(X86_FEATURE_AMD_IBPB)) |
3535 |
++ if (!boot_cpu_has(X86_FEATURE_IBPB)) |
3536 |
+ return 1; |
3537 |
+ if (!data) |
3538 |
+ break; |
3539 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
3540 |
+index 47b8357b97517..c01aac2bac37c 100644 |
3541 |
+--- a/arch/x86/kvm/vmx/vmx.c |
3542 |
++++ b/arch/x86/kvm/vmx/vmx.c |
3543 |
+@@ -1826,7 +1826,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
3544 |
+ break; |
3545 |
+ case MSR_IA32_SPEC_CTRL: |
3546 |
+ if (!msr_info->host_initiated && |
3547 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) |
3548 |
++ !guest_has_spec_ctrl_msr(vcpu)) |
3549 |
+ return 1; |
3550 |
+ |
3551 |
+ msr_info->data = to_vmx(vcpu)->spec_ctrl; |
3552 |
+@@ -2028,7 +2028,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
3553 |
+ break; |
3554 |
+ case MSR_IA32_SPEC_CTRL: |
3555 |
+ if (!msr_info->host_initiated && |
3556 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) |
3557 |
++ !guest_has_spec_ctrl_msr(vcpu)) |
3558 |
+ return 1; |
3559 |
+ |
3560 |
+ if (kvm_spec_ctrl_test_value(data)) |
3561 |
+@@ -2063,12 +2063,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
3562 |
+ goto find_uret_msr; |
3563 |
+ case MSR_IA32_PRED_CMD: |
3564 |
+ if (!msr_info->host_initiated && |
3565 |
+- !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) |
3566 |
++ !guest_has_pred_cmd_msr(vcpu)) |
3567 |
+ return 1; |
3568 |
+ |
3569 |
+ if (data & ~PRED_CMD_IBPB) |
3570 |
+ return 1; |
3571 |
+- if (!boot_cpu_has(X86_FEATURE_SPEC_CTRL)) |
3572 |
++ if (!boot_cpu_has(X86_FEATURE_IBPB)) |
3573 |
+ return 1; |
3574 |
+ if (!data) |
3575 |
+ break; |
3576 |
+diff --git a/arch/x86/mm/ident_map.c b/arch/x86/mm/ident_map.c |
3577 |
+index fe7a12599d8eb..968d7005f4a72 100644 |
3578 |
+--- a/arch/x86/mm/ident_map.c |
3579 |
++++ b/arch/x86/mm/ident_map.c |
3580 |
+@@ -62,6 +62,7 @@ static int ident_p4d_init(struct x86_mapping_info *info, p4d_t *p4d_page, |
3581 |
+ unsigned long addr, unsigned long end) |
3582 |
+ { |
3583 |
+ unsigned long next; |
3584 |
++ int result; |
3585 |
+ |
3586 |
+ for (; addr < end; addr = next) { |
3587 |
+ p4d_t *p4d = p4d_page + p4d_index(addr); |
3588 |
+@@ -73,13 +74,20 @@ static int ident_p4d_init(struct x86_mapping_info *info, p4d_t *p4d_page, |
3589 |
+ |
3590 |
+ if (p4d_present(*p4d)) { |
3591 |
+ pud = pud_offset(p4d, 0); |
3592 |
+- ident_pud_init(info, pud, addr, next); |
3593 |
++ result = ident_pud_init(info, pud, addr, next); |
3594 |
++ if (result) |
3595 |
++ return result; |
3596 |
++ |
3597 |
+ continue; |
3598 |
+ } |
3599 |
+ pud = (pud_t *)info->alloc_pgt_page(info->context); |
3600 |
+ if (!pud) |
3601 |
+ return -ENOMEM; |
3602 |
+- ident_pud_init(info, pud, addr, next); |
3603 |
++ |
3604 |
++ result = ident_pud_init(info, pud, addr, next); |
3605 |
++ if (result) |
3606 |
++ return result; |
3607 |
++ |
3608 |
+ set_p4d(p4d, __p4d(__pa(pud) | info->kernpg_flag)); |
3609 |
+ } |
3610 |
+ |
3611 |
+diff --git a/crypto/Kconfig b/crypto/Kconfig |
3612 |
+index 094ef56ab7b42..37de7d006858d 100644 |
3613 |
+--- a/crypto/Kconfig |
3614 |
++++ b/crypto/Kconfig |
3615 |
+@@ -145,7 +145,7 @@ config CRYPTO_MANAGER_DISABLE_TESTS |
3616 |
+ |
3617 |
+ config CRYPTO_MANAGER_EXTRA_TESTS |
3618 |
+ bool "Enable extra run-time crypto self tests" |
3619 |
+- depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS |
3620 |
++ depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS && CRYPTO_MANAGER |
3621 |
+ help |
3622 |
+ Enable extra run-time self tests of registered crypto algorithms, |
3623 |
+ including randomized fuzz tests. |
3624 |
+diff --git a/crypto/ecdh.c b/crypto/ecdh.c |
3625 |
+index b0232d6ab4ce7..d56b8603dec95 100644 |
3626 |
+--- a/crypto/ecdh.c |
3627 |
++++ b/crypto/ecdh.c |
3628 |
+@@ -53,12 +53,13 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf, |
3629 |
+ return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, |
3630 |
+ ctx->private_key); |
3631 |
+ |
3632 |
+- if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, |
3633 |
+- (const u64 *)params.key, params.key_size) < 0) |
3634 |
+- return -EINVAL; |
3635 |
+- |
3636 |
+ memcpy(ctx->private_key, params.key, params.key_size); |
3637 |
+ |
3638 |
++ if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, |
3639 |
++ ctx->private_key, params.key_size) < 0) { |
3640 |
++ memzero_explicit(ctx->private_key, params.key_size); |
3641 |
++ return -EINVAL; |
3642 |
++ } |
3643 |
+ return 0; |
3644 |
+ } |
3645 |
+ |
3646 |
+diff --git a/drivers/accessibility/speakup/speakup_dectlk.c b/drivers/accessibility/speakup/speakup_dectlk.c |
3647 |
+index 780214b5ca16e..ab6d61e80b1cb 100644 |
3648 |
+--- a/drivers/accessibility/speakup/speakup_dectlk.c |
3649 |
++++ b/drivers/accessibility/speakup/speakup_dectlk.c |
3650 |
+@@ -37,7 +37,7 @@ static unsigned char get_index(struct spk_synth *synth); |
3651 |
+ static int in_escape; |
3652 |
+ static int is_flushing; |
3653 |
+ |
3654 |
+-static spinlock_t flush_lock; |
3655 |
++static DEFINE_SPINLOCK(flush_lock); |
3656 |
+ static DECLARE_WAIT_QUEUE_HEAD(flush); |
3657 |
+ |
3658 |
+ static struct var_t vars[] = { |
3659 |
+diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c |
3660 |
+index 4ed755a963aa5..8f2dc176bb412 100644 |
3661 |
+--- a/drivers/acpi/acpi_pnp.c |
3662 |
++++ b/drivers/acpi/acpi_pnp.c |
3663 |
+@@ -319,6 +319,9 @@ static bool matching_id(const char *idstr, const char *list_id) |
3664 |
+ { |
3665 |
+ int i; |
3666 |
+ |
3667 |
++ if (strlen(idstr) != strlen(list_id)) |
3668 |
++ return false; |
3669 |
++ |
3670 |
+ if (memcmp(idstr, list_id, 3)) |
3671 |
+ return false; |
3672 |
+ |
3673 |
+diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c |
3674 |
+index 94d91c67aeaeb..ef77dbcaf58f6 100644 |
3675 |
+--- a/drivers/acpi/device_pm.c |
3676 |
++++ b/drivers/acpi/device_pm.c |
3677 |
+@@ -749,7 +749,7 @@ static void acpi_pm_notify_work_func(struct acpi_device_wakeup_context *context) |
3678 |
+ static DEFINE_MUTEX(acpi_wakeup_lock); |
3679 |
+ |
3680 |
+ static int __acpi_device_wakeup_enable(struct acpi_device *adev, |
3681 |
+- u32 target_state, int max_count) |
3682 |
++ u32 target_state) |
3683 |
+ { |
3684 |
+ struct acpi_device_wakeup *wakeup = &adev->wakeup; |
3685 |
+ acpi_status status; |
3686 |
+@@ -757,9 +757,10 @@ static int __acpi_device_wakeup_enable(struct acpi_device *adev, |
3687 |
+ |
3688 |
+ mutex_lock(&acpi_wakeup_lock); |
3689 |
+ |
3690 |
+- if (wakeup->enable_count >= max_count) |
3691 |
++ if (wakeup->enable_count >= INT_MAX) { |
3692 |
++ acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n"); |
3693 |
+ goto out; |
3694 |
+- |
3695 |
++ } |
3696 |
+ if (wakeup->enable_count > 0) |
3697 |
+ goto inc; |
3698 |
+ |
3699 |
+@@ -799,7 +800,7 @@ out: |
3700 |
+ */ |
3701 |
+ static int acpi_device_wakeup_enable(struct acpi_device *adev, u32 target_state) |
3702 |
+ { |
3703 |
+- return __acpi_device_wakeup_enable(adev, target_state, 1); |
3704 |
++ return __acpi_device_wakeup_enable(adev, target_state); |
3705 |
+ } |
3706 |
+ |
3707 |
+ /** |
3708 |
+@@ -829,8 +830,12 @@ out: |
3709 |
+ mutex_unlock(&acpi_wakeup_lock); |
3710 |
+ } |
3711 |
+ |
3712 |
+-static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable, |
3713 |
+- int max_count) |
3714 |
++/** |
3715 |
++ * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device. |
3716 |
++ * @dev: Device to enable/disable to generate wakeup events. |
3717 |
++ * @enable: Whether to enable or disable the wakeup functionality. |
3718 |
++ */ |
3719 |
++int acpi_pm_set_device_wakeup(struct device *dev, bool enable) |
3720 |
+ { |
3721 |
+ struct acpi_device *adev; |
3722 |
+ int error; |
3723 |
+@@ -850,36 +855,14 @@ static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable, |
3724 |
+ return 0; |
3725 |
+ } |
3726 |
+ |
3727 |
+- error = __acpi_device_wakeup_enable(adev, acpi_target_system_state(), |
3728 |
+- max_count); |
3729 |
++ error = __acpi_device_wakeup_enable(adev, acpi_target_system_state()); |
3730 |
+ if (!error) |
3731 |
+ dev_dbg(dev, "Wakeup enabled by ACPI\n"); |
3732 |
+ |
3733 |
+ return error; |
3734 |
+ } |
3735 |
+- |
3736 |
+-/** |
3737 |
+- * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device. |
3738 |
+- * @dev: Device to enable/disable to generate wakeup events. |
3739 |
+- * @enable: Whether to enable or disable the wakeup functionality. |
3740 |
+- */ |
3741 |
+-int acpi_pm_set_device_wakeup(struct device *dev, bool enable) |
3742 |
+-{ |
3743 |
+- return __acpi_pm_set_device_wakeup(dev, enable, 1); |
3744 |
+-} |
3745 |
+ EXPORT_SYMBOL_GPL(acpi_pm_set_device_wakeup); |
3746 |
+ |
3747 |
+-/** |
3748 |
+- * acpi_pm_set_bridge_wakeup - Enable/disable remote wakeup for given bridge. |
3749 |
+- * @dev: Bridge device to enable/disable to generate wakeup events. |
3750 |
+- * @enable: Whether to enable or disable the wakeup functionality. |
3751 |
+- */ |
3752 |
+-int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) |
3753 |
+-{ |
3754 |
+- return __acpi_pm_set_device_wakeup(dev, enable, INT_MAX); |
3755 |
+-} |
3756 |
+-EXPORT_SYMBOL_GPL(acpi_pm_set_bridge_wakeup); |
3757 |
+- |
3758 |
+ /** |
3759 |
+ * acpi_dev_pm_low_power - Put ACPI device into a low-power state. |
3760 |
+ * @dev: Device to put into a low-power state. |
3761 |
+diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c |
3762 |
+index 442608220b5c8..4c97b0f44fce2 100644 |
3763 |
+--- a/drivers/acpi/nfit/core.c |
3764 |
++++ b/drivers/acpi/nfit/core.c |
3765 |
+@@ -5,6 +5,7 @@ |
3766 |
+ #include <linux/list_sort.h> |
3767 |
+ #include <linux/libnvdimm.h> |
3768 |
+ #include <linux/module.h> |
3769 |
++#include <linux/nospec.h> |
3770 |
+ #include <linux/mutex.h> |
3771 |
+ #include <linux/ndctl.h> |
3772 |
+ #include <linux/sysfs.h> |
3773 |
+@@ -478,8 +479,11 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, |
3774 |
+ cmd_mask = nd_desc->cmd_mask; |
3775 |
+ if (cmd == ND_CMD_CALL && call_pkg->nd_family) { |
3776 |
+ family = call_pkg->nd_family; |
3777 |
+- if (!test_bit(family, &nd_desc->bus_family_mask)) |
3778 |
++ if (family > NVDIMM_BUS_FAMILY_MAX || |
3779 |
++ !test_bit(family, &nd_desc->bus_family_mask)) |
3780 |
+ return -EINVAL; |
3781 |
++ family = array_index_nospec(family, |
3782 |
++ NVDIMM_BUS_FAMILY_MAX + 1); |
3783 |
+ dsm_mask = acpi_desc->family_dsm_mask[family]; |
3784 |
+ guid = to_nfit_bus_uuid(family); |
3785 |
+ } else { |
3786 |
+diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c |
3787 |
+index ad04824ca3baa..f2f5f1dc7c61d 100644 |
3788 |
+--- a/drivers/acpi/resource.c |
3789 |
++++ b/drivers/acpi/resource.c |
3790 |
+@@ -541,7 +541,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares, |
3791 |
+ ret = c->preproc(ares, c->preproc_data); |
3792 |
+ if (ret < 0) { |
3793 |
+ c->error = ret; |
3794 |
+- return AE_CTRL_TERMINATE; |
3795 |
++ return AE_ABORT_METHOD; |
3796 |
+ } else if (ret > 0) { |
3797 |
+ return AE_OK; |
3798 |
+ } |
3799 |
+diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
3800 |
+index b5117576792bc..2a3952925855d 100644 |
3801 |
+--- a/drivers/android/binder.c |
3802 |
++++ b/drivers/android/binder.c |
3803 |
+@@ -3146,6 +3146,7 @@ static void binder_transaction(struct binder_proc *proc, |
3804 |
+ t->buffer->debug_id = t->debug_id; |
3805 |
+ t->buffer->transaction = t; |
3806 |
+ t->buffer->target_node = target_node; |
3807 |
++ t->buffer->clear_on_free = !!(t->flags & TF_CLEAR_BUF); |
3808 |
+ trace_binder_transaction_alloc_buf(t->buffer); |
3809 |
+ |
3810 |
+ if (binder_alloc_copy_user_to_buffer( |
3811 |
+diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c |
3812 |
+index 2f846b7ae8b82..7caf74ad24053 100644 |
3813 |
+--- a/drivers/android/binder_alloc.c |
3814 |
++++ b/drivers/android/binder_alloc.c |
3815 |
+@@ -696,6 +696,8 @@ static void binder_free_buf_locked(struct binder_alloc *alloc, |
3816 |
+ binder_insert_free_buffer(alloc, buffer); |
3817 |
+ } |
3818 |
+ |
3819 |
++static void binder_alloc_clear_buf(struct binder_alloc *alloc, |
3820 |
++ struct binder_buffer *buffer); |
3821 |
+ /** |
3822 |
+ * binder_alloc_free_buf() - free a binder buffer |
3823 |
+ * @alloc: binder_alloc for this proc |
3824 |
+@@ -706,6 +708,18 @@ static void binder_free_buf_locked(struct binder_alloc *alloc, |
3825 |
+ void binder_alloc_free_buf(struct binder_alloc *alloc, |
3826 |
+ struct binder_buffer *buffer) |
3827 |
+ { |
3828 |
++ /* |
3829 |
++ * We could eliminate the call to binder_alloc_clear_buf() |
3830 |
++ * from binder_alloc_deferred_release() by moving this to |
3831 |
++ * binder_alloc_free_buf_locked(). However, that could |
3832 |
++ * increase contention for the alloc mutex if clear_on_free |
3833 |
++ * is used frequently for large buffers. The mutex is not |
3834 |
++ * needed for correctness here. |
3835 |
++ */ |
3836 |
++ if (buffer->clear_on_free) { |
3837 |
++ binder_alloc_clear_buf(alloc, buffer); |
3838 |
++ buffer->clear_on_free = false; |
3839 |
++ } |
3840 |
+ mutex_lock(&alloc->mutex); |
3841 |
+ binder_free_buf_locked(alloc, buffer); |
3842 |
+ mutex_unlock(&alloc->mutex); |
3843 |
+@@ -802,6 +816,10 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc) |
3844 |
+ /* Transaction should already have been freed */ |
3845 |
+ BUG_ON(buffer->transaction); |
3846 |
+ |
3847 |
++ if (buffer->clear_on_free) { |
3848 |
++ binder_alloc_clear_buf(alloc, buffer); |
3849 |
++ buffer->clear_on_free = false; |
3850 |
++ } |
3851 |
+ binder_free_buf_locked(alloc, buffer); |
3852 |
+ buffers++; |
3853 |
+ } |
3854 |
+@@ -1135,6 +1153,36 @@ static struct page *binder_alloc_get_page(struct binder_alloc *alloc, |
3855 |
+ return lru_page->page_ptr; |
3856 |
+ } |
3857 |
+ |
3858 |
++/** |
3859 |
++ * binder_alloc_clear_buf() - zero out buffer |
3860 |
++ * @alloc: binder_alloc for this proc |
3861 |
++ * @buffer: binder buffer to be cleared |
3862 |
++ * |
3863 |
++ * memset the given buffer to 0 |
3864 |
++ */ |
3865 |
++static void binder_alloc_clear_buf(struct binder_alloc *alloc, |
3866 |
++ struct binder_buffer *buffer) |
3867 |
++{ |
3868 |
++ size_t bytes = binder_alloc_buffer_size(alloc, buffer); |
3869 |
++ binder_size_t buffer_offset = 0; |
3870 |
++ |
3871 |
++ while (bytes) { |
3872 |
++ unsigned long size; |
3873 |
++ struct page *page; |
3874 |
++ pgoff_t pgoff; |
3875 |
++ void *kptr; |
3876 |
++ |
3877 |
++ page = binder_alloc_get_page(alloc, buffer, |
3878 |
++ buffer_offset, &pgoff); |
3879 |
++ size = min_t(size_t, bytes, PAGE_SIZE - pgoff); |
3880 |
++ kptr = kmap(page) + pgoff; |
3881 |
++ memset(kptr, 0, size); |
3882 |
++ kunmap(page); |
3883 |
++ bytes -= size; |
3884 |
++ buffer_offset += size; |
3885 |
++ } |
3886 |
++} |
3887 |
++ |
3888 |
+ /** |
3889 |
+ * binder_alloc_copy_user_to_buffer() - copy src user to tgt user |
3890 |
+ * @alloc: binder_alloc for this proc |
3891 |
+diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h |
3892 |
+index 55d8b4106766a..6e8e001381af4 100644 |
3893 |
+--- a/drivers/android/binder_alloc.h |
3894 |
++++ b/drivers/android/binder_alloc.h |
3895 |
+@@ -23,6 +23,7 @@ struct binder_transaction; |
3896 |
+ * @entry: entry alloc->buffers |
3897 |
+ * @rb_node: node for allocated_buffers/free_buffers rb trees |
3898 |
+ * @free: %true if buffer is free |
3899 |
++ * @clear_on_free: %true if buffer must be zeroed after use |
3900 |
+ * @allow_user_free: %true if user is allowed to free buffer |
3901 |
+ * @async_transaction: %true if buffer is in use for an async txn |
3902 |
+ * @debug_id: unique ID for debugging |
3903 |
+@@ -41,9 +42,10 @@ struct binder_buffer { |
3904 |
+ struct rb_node rb_node; /* free entry by size or allocated entry */ |
3905 |
+ /* by address */ |
3906 |
+ unsigned free:1; |
3907 |
++ unsigned clear_on_free:1; |
3908 |
+ unsigned allow_user_free:1; |
3909 |
+ unsigned async_transaction:1; |
3910 |
+- unsigned debug_id:29; |
3911 |
++ unsigned debug_id:28; |
3912 |
+ |
3913 |
+ struct binder_transaction *transaction; |
3914 |
+ |
3915 |
+diff --git a/drivers/base/core.c b/drivers/base/core.c |
3916 |
+index d661ada1518fb..e8cb66093f211 100644 |
3917 |
+--- a/drivers/base/core.c |
3918 |
++++ b/drivers/base/core.c |
3919 |
+@@ -1386,7 +1386,7 @@ static void device_links_purge(struct device *dev) |
3920 |
+ return; |
3921 |
+ |
3922 |
+ mutex_lock(&wfs_lock); |
3923 |
+- list_del(&dev->links.needs_suppliers); |
3924 |
++ list_del_init(&dev->links.needs_suppliers); |
3925 |
+ mutex_unlock(&wfs_lock); |
3926 |
+ |
3927 |
+ /* |
3928 |
+diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c |
3929 |
+index beb34b4f76b0e..172f720b8d637 100644 |
3930 |
+--- a/drivers/block/null_blk_zoned.c |
3931 |
++++ b/drivers/block/null_blk_zoned.c |
3932 |
+@@ -6,8 +6,7 @@ |
3933 |
+ #define CREATE_TRACE_POINTS |
3934 |
+ #include "null_blk_trace.h" |
3935 |
+ |
3936 |
+-/* zone_size in MBs to sectors. */ |
3937 |
+-#define ZONE_SIZE_SHIFT 11 |
3938 |
++#define MB_TO_SECTS(mb) (((sector_t)mb * SZ_1M) >> SECTOR_SHIFT) |
3939 |
+ |
3940 |
+ static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect) |
3941 |
+ { |
3942 |
+@@ -16,7 +15,7 @@ static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect) |
3943 |
+ |
3944 |
+ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) |
3945 |
+ { |
3946 |
+- sector_t dev_size = (sector_t)dev->size * 1024 * 1024; |
3947 |
++ sector_t dev_capacity_sects, zone_capacity_sects; |
3948 |
+ sector_t sector = 0; |
3949 |
+ unsigned int i; |
3950 |
+ |
3951 |
+@@ -38,9 +37,13 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) |
3952 |
+ return -EINVAL; |
3953 |
+ } |
3954 |
+ |
3955 |
+- dev->zone_size_sects = dev->zone_size << ZONE_SIZE_SHIFT; |
3956 |
+- dev->nr_zones = dev_size >> |
3957 |
+- (SECTOR_SHIFT + ilog2(dev->zone_size_sects)); |
3958 |
++ zone_capacity_sects = MB_TO_SECTS(dev->zone_capacity); |
3959 |
++ dev_capacity_sects = MB_TO_SECTS(dev->size); |
3960 |
++ dev->zone_size_sects = MB_TO_SECTS(dev->zone_size); |
3961 |
++ dev->nr_zones = dev_capacity_sects >> ilog2(dev->zone_size_sects); |
3962 |
++ if (dev_capacity_sects & (dev->zone_size_sects - 1)) |
3963 |
++ dev->nr_zones++; |
3964 |
++ |
3965 |
+ dev->zones = kvmalloc_array(dev->nr_zones, sizeof(struct blk_zone), |
3966 |
+ GFP_KERNEL | __GFP_ZERO); |
3967 |
+ if (!dev->zones) |
3968 |
+@@ -101,8 +104,12 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) |
3969 |
+ struct blk_zone *zone = &dev->zones[i]; |
3970 |
+ |
3971 |
+ zone->start = zone->wp = sector; |
3972 |
+- zone->len = dev->zone_size_sects; |
3973 |
+- zone->capacity = dev->zone_capacity << ZONE_SIZE_SHIFT; |
3974 |
++ if (zone->start + dev->zone_size_sects > dev_capacity_sects) |
3975 |
++ zone->len = dev_capacity_sects - zone->start; |
3976 |
++ else |
3977 |
++ zone->len = dev->zone_size_sects; |
3978 |
++ zone->capacity = |
3979 |
++ min_t(sector_t, zone->len, zone_capacity_sects); |
3980 |
+ zone->type = BLK_ZONE_TYPE_SEQWRITE_REQ; |
3981 |
+ zone->cond = BLK_ZONE_COND_EMPTY; |
3982 |
+ |
3983 |
+@@ -332,8 +339,11 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, |
3984 |
+ |
3985 |
+ trace_nullb_zone_op(cmd, zno, zone->cond); |
3986 |
+ |
3987 |
+- if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) |
3988 |
++ if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) { |
3989 |
++ if (append) |
3990 |
++ return BLK_STS_IOERR; |
3991 |
+ return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); |
3992 |
++ } |
3993 |
+ |
3994 |
+ null_lock_zone(dev, zno); |
3995 |
+ |
3996 |
+diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c |
3997 |
+index 4f4474eecadb7..d9dd138ca9c64 100644 |
3998 |
+--- a/drivers/block/rnbd/rnbd-clt-sysfs.c |
3999 |
++++ b/drivers/block/rnbd/rnbd-clt-sysfs.c |
4000 |
+@@ -433,8 +433,9 @@ void rnbd_clt_remove_dev_symlink(struct rnbd_clt_dev *dev) |
4001 |
+ * i.e. rnbd_clt_unmap_dev_store() leading to a sysfs warning because |
4002 |
+ * of sysfs link already was removed already. |
4003 |
+ */ |
4004 |
+- if (strlen(dev->blk_symlink_name) && try_module_get(THIS_MODULE)) { |
4005 |
++ if (dev->blk_symlink_name && try_module_get(THIS_MODULE)) { |
4006 |
+ sysfs_remove_link(rnbd_devs_kobj, dev->blk_symlink_name); |
4007 |
++ kfree(dev->blk_symlink_name); |
4008 |
+ module_put(THIS_MODULE); |
4009 |
+ } |
4010 |
+ } |
4011 |
+@@ -487,10 +488,17 @@ static int rnbd_clt_get_path_name(struct rnbd_clt_dev *dev, char *buf, |
4012 |
+ static int rnbd_clt_add_dev_symlink(struct rnbd_clt_dev *dev) |
4013 |
+ { |
4014 |
+ struct kobject *gd_kobj = &disk_to_dev(dev->gd)->kobj; |
4015 |
+- int ret; |
4016 |
++ int ret, len; |
4017 |
++ |
4018 |
++ len = strlen(dev->pathname) + strlen(dev->sess->sessname) + 2; |
4019 |
++ dev->blk_symlink_name = kzalloc(len, GFP_KERNEL); |
4020 |
++ if (!dev->blk_symlink_name) { |
4021 |
++ rnbd_clt_err(dev, "Failed to allocate memory for blk_symlink_name\n"); |
4022 |
++ return -ENOMEM; |
4023 |
++ } |
4024 |
+ |
4025 |
+ ret = rnbd_clt_get_path_name(dev, dev->blk_symlink_name, |
4026 |
+- sizeof(dev->blk_symlink_name)); |
4027 |
++ len); |
4028 |
+ if (ret) { |
4029 |
+ rnbd_clt_err(dev, "Failed to get /sys/block symlink path, err: %d\n", |
4030 |
+ ret); |
4031 |
+@@ -508,7 +516,8 @@ static int rnbd_clt_add_dev_symlink(struct rnbd_clt_dev *dev) |
4032 |
+ return 0; |
4033 |
+ |
4034 |
+ out_err: |
4035 |
+- dev->blk_symlink_name[0] = '\0'; |
4036 |
++ kfree(dev->blk_symlink_name); |
4037 |
++ dev->blk_symlink_name = NULL ; |
4038 |
+ return ret; |
4039 |
+ } |
4040 |
+ |
4041 |
+diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c |
4042 |
+index 8b2411ccbda97..7af1b60582fe5 100644 |
4043 |
+--- a/drivers/block/rnbd/rnbd-clt.c |
4044 |
++++ b/drivers/block/rnbd/rnbd-clt.c |
4045 |
+@@ -59,6 +59,7 @@ static void rnbd_clt_put_dev(struct rnbd_clt_dev *dev) |
4046 |
+ ida_simple_remove(&index_ida, dev->clt_device_id); |
4047 |
+ mutex_unlock(&ida_lock); |
4048 |
+ kfree(dev->hw_queues); |
4049 |
++ kfree(dev->pathname); |
4050 |
+ rnbd_clt_put_sess(dev->sess); |
4051 |
+ mutex_destroy(&dev->lock); |
4052 |
+ kfree(dev); |
4053 |
+@@ -1381,10 +1382,16 @@ static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess, |
4054 |
+ pathname, sess->sessname, ret); |
4055 |
+ goto out_queues; |
4056 |
+ } |
4057 |
++ |
4058 |
++ dev->pathname = kstrdup(pathname, GFP_KERNEL); |
4059 |
++ if (!dev->pathname) { |
4060 |
++ ret = -ENOMEM; |
4061 |
++ goto out_queues; |
4062 |
++ } |
4063 |
++ |
4064 |
+ dev->clt_device_id = ret; |
4065 |
+ dev->sess = sess; |
4066 |
+ dev->access_mode = access_mode; |
4067 |
+- strlcpy(dev->pathname, pathname, sizeof(dev->pathname)); |
4068 |
+ mutex_init(&dev->lock); |
4069 |
+ refcount_set(&dev->refcount, 1); |
4070 |
+ dev->dev_state = DEV_STATE_INIT; |
4071 |
+@@ -1413,8 +1420,8 @@ static bool __exists_dev(const char *pathname) |
4072 |
+ list_for_each_entry(sess, &sess_list, list) { |
4073 |
+ mutex_lock(&sess->lock); |
4074 |
+ list_for_each_entry(dev, &sess->devs_list, list) { |
4075 |
+- if (!strncmp(dev->pathname, pathname, |
4076 |
+- sizeof(dev->pathname))) { |
4077 |
++ if (strlen(dev->pathname) == strlen(pathname) && |
4078 |
++ !strcmp(dev->pathname, pathname)) { |
4079 |
+ found = true; |
4080 |
+ break; |
4081 |
+ } |
4082 |
+diff --git a/drivers/block/rnbd/rnbd-clt.h b/drivers/block/rnbd/rnbd-clt.h |
4083 |
+index ed33654aa4868..b193d59040503 100644 |
4084 |
+--- a/drivers/block/rnbd/rnbd-clt.h |
4085 |
++++ b/drivers/block/rnbd/rnbd-clt.h |
4086 |
+@@ -108,7 +108,7 @@ struct rnbd_clt_dev { |
4087 |
+ u32 clt_device_id; |
4088 |
+ struct mutex lock; |
4089 |
+ enum rnbd_clt_dev_state dev_state; |
4090 |
+- char pathname[NAME_MAX]; |
4091 |
++ char *pathname; |
4092 |
+ enum rnbd_access_mode access_mode; |
4093 |
+ bool read_only; |
4094 |
+ bool rotational; |
4095 |
+@@ -126,7 +126,7 @@ struct rnbd_clt_dev { |
4096 |
+ struct list_head list; |
4097 |
+ struct gendisk *gd; |
4098 |
+ struct kobject kobj; |
4099 |
+- char blk_symlink_name[NAME_MAX]; |
4100 |
++ char *blk_symlink_name; |
4101 |
+ refcount_t refcount; |
4102 |
+ struct work_struct unmap_on_rmmod_work; |
4103 |
+ }; |
4104 |
+diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c |
4105 |
+index 76912c584a76d..9860d4842f36c 100644 |
4106 |
+--- a/drivers/block/xen-blkback/xenbus.c |
4107 |
++++ b/drivers/block/xen-blkback/xenbus.c |
4108 |
+@@ -274,6 +274,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) |
4109 |
+ |
4110 |
+ if (ring->xenblkd) { |
4111 |
+ kthread_stop(ring->xenblkd); |
4112 |
++ ring->xenblkd = NULL; |
4113 |
+ wake_up(&ring->shutdown_wq); |
4114 |
+ } |
4115 |
+ |
4116 |
+@@ -675,7 +676,8 @@ static int xen_blkbk_probe(struct xenbus_device *dev, |
4117 |
+ /* setup back pointer */ |
4118 |
+ be->blkif->be = be; |
4119 |
+ |
4120 |
+- err = xenbus_watch_pathfmt(dev, &be->backend_watch, backend_changed, |
4121 |
++ err = xenbus_watch_pathfmt(dev, &be->backend_watch, NULL, |
4122 |
++ backend_changed, |
4123 |
+ "%s/%s", dev->nodename, "physical-device"); |
4124 |
+ if (err) |
4125 |
+ goto fail; |
4126 |
+diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
4127 |
+index ba45c59bd9f36..5f9f027956317 100644 |
4128 |
+--- a/drivers/bluetooth/btmtksdio.c |
4129 |
++++ b/drivers/bluetooth/btmtksdio.c |
4130 |
+@@ -704,7 +704,7 @@ static int mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
4131 |
+ err = mtk_hci_wmt_sync(hdev, &wmt_params); |
4132 |
+ if (err < 0) { |
4133 |
+ bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
4134 |
+- return err; |
4135 |
++ goto free_fw; |
4136 |
+ } |
4137 |
+ |
4138 |
+ fw_ptr = fw->data; |
4139 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
4140 |
+index 1005b6e8ff743..80468745d5c5e 100644 |
4141 |
+--- a/drivers/bluetooth/btusb.c |
4142 |
++++ b/drivers/bluetooth/btusb.c |
4143 |
+@@ -1763,6 +1763,8 @@ static int btusb_setup_bcm92035(struct hci_dev *hdev) |
4144 |
+ |
4145 |
+ static int btusb_setup_csr(struct hci_dev *hdev) |
4146 |
+ { |
4147 |
++ struct btusb_data *data = hci_get_drvdata(hdev); |
4148 |
++ u16 bcdDevice = le16_to_cpu(data->udev->descriptor.bcdDevice); |
4149 |
+ struct hci_rp_read_local_version *rp; |
4150 |
+ struct sk_buff *skb; |
4151 |
+ bool is_fake = false; |
4152 |
+@@ -1832,6 +1834,12 @@ static int btusb_setup_csr(struct hci_dev *hdev) |
4153 |
+ le16_to_cpu(rp->hci_ver) > BLUETOOTH_VER_4_0) |
4154 |
+ is_fake = true; |
4155 |
+ |
4156 |
++ /* Other clones which beat all the above checks */ |
4157 |
++ else if (bcdDevice == 0x0134 && |
4158 |
++ le16_to_cpu(rp->lmp_subver) == 0x0c5c && |
4159 |
++ le16_to_cpu(rp->hci_ver) == BLUETOOTH_VER_2_0) |
4160 |
++ is_fake = true; |
4161 |
++ |
4162 |
+ if (is_fake) { |
4163 |
+ bt_dev_warn(hdev, "CSR: Unbranded CSR clone detected; adding workarounds..."); |
4164 |
+ |
4165 |
+@@ -3067,7 +3075,7 @@ static int btusb_mtk_setup_firmware(struct hci_dev *hdev, const char *fwname) |
4166 |
+ err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params); |
4167 |
+ if (err < 0) { |
4168 |
+ bt_dev_err(hdev, "Failed to power on data RAM (%d)", err); |
4169 |
+- return err; |
4170 |
++ goto err_release_fw; |
4171 |
+ } |
4172 |
+ |
4173 |
+ fw_ptr = fw->data; |
4174 |
+diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c |
4175 |
+index 981d96cc76959..78d635f1d1567 100644 |
4176 |
+--- a/drivers/bluetooth/hci_h5.c |
4177 |
++++ b/drivers/bluetooth/hci_h5.c |
4178 |
+@@ -245,6 +245,9 @@ static int h5_close(struct hci_uart *hu) |
4179 |
+ skb_queue_purge(&h5->rel); |
4180 |
+ skb_queue_purge(&h5->unrel); |
4181 |
+ |
4182 |
++ kfree_skb(h5->rx_skb); |
4183 |
++ h5->rx_skb = NULL; |
4184 |
++ |
4185 |
+ if (h5->vnd && h5->vnd->close) |
4186 |
+ h5->vnd->close(h5); |
4187 |
+ |
4188 |
+diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c |
4189 |
+index e71a6f52ea0cf..2d7c764bb7dcf 100644 |
4190 |
+--- a/drivers/bus/fsl-mc/fsl-mc-allocator.c |
4191 |
++++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c |
4192 |
+@@ -292,8 +292,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, |
4193 |
+ goto error; |
4194 |
+ |
4195 |
+ mc_adev = resource->data; |
4196 |
+- if (!mc_adev) |
4197 |
++ if (!mc_adev) { |
4198 |
++ error = -EINVAL; |
4199 |
+ goto error; |
4200 |
++ } |
4201 |
+ |
4202 |
+ mc_adev->consumer_link = device_link_add(&mc_dev->dev, |
4203 |
+ &mc_adev->dev, |
4204 |
+diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c |
4205 |
+index 76a6ee505d33d..806766b1b45f6 100644 |
4206 |
+--- a/drivers/bus/fsl-mc/fsl-mc-bus.c |
4207 |
++++ b/drivers/bus/fsl-mc/fsl-mc-bus.c |
4208 |
+@@ -967,8 +967,11 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) |
4209 |
+ platform_set_drvdata(pdev, mc); |
4210 |
+ |
4211 |
+ plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
4212 |
+- if (plat_res) |
4213 |
++ if (plat_res) { |
4214 |
+ mc->fsl_mc_regs = devm_ioremap_resource(&pdev->dev, plat_res); |
4215 |
++ if (IS_ERR(mc->fsl_mc_regs)) |
4216 |
++ return PTR_ERR(mc->fsl_mc_regs); |
4217 |
++ } |
4218 |
+ |
4219 |
+ if (mc->fsl_mc_regs && IS_ENABLED(CONFIG_ACPI) && |
4220 |
+ !dev_of_node(&pdev->dev)) { |
4221 |
+diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c |
4222 |
+index 0ffdebde82657..8cefa359fccd8 100644 |
4223 |
+--- a/drivers/bus/mhi/core/init.c |
4224 |
++++ b/drivers/bus/mhi/core/init.c |
4225 |
+@@ -610,7 +610,7 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, |
4226 |
+ { |
4227 |
+ struct mhi_event *mhi_event; |
4228 |
+ const struct mhi_event_config *event_cfg; |
4229 |
+- struct device *dev = &mhi_cntrl->mhi_dev->dev; |
4230 |
++ struct device *dev = mhi_cntrl->cntrl_dev; |
4231 |
+ int i, num; |
4232 |
+ |
4233 |
+ num = config->num_events; |
4234 |
+@@ -692,7 +692,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, |
4235 |
+ const struct mhi_controller_config *config) |
4236 |
+ { |
4237 |
+ const struct mhi_channel_config *ch_cfg; |
4238 |
+- struct device *dev = &mhi_cntrl->mhi_dev->dev; |
4239 |
++ struct device *dev = mhi_cntrl->cntrl_dev; |
4240 |
+ int i; |
4241 |
+ u32 chan; |
4242 |
+ |
4243 |
+@@ -1276,10 +1276,8 @@ static int mhi_driver_remove(struct device *dev) |
4244 |
+ mutex_unlock(&mhi_chan->mutex); |
4245 |
+ } |
4246 |
+ |
4247 |
+- read_lock_bh(&mhi_cntrl->pm_lock); |
4248 |
+ while (mhi_dev->dev_wake) |
4249 |
+ mhi_device_put(mhi_dev); |
4250 |
+- read_unlock_bh(&mhi_cntrl->pm_lock); |
4251 |
+ |
4252 |
+ return 0; |
4253 |
+ } |
4254 |
+diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c |
4255 |
+index 9f7ed1fcd4285..626dedd110cbc 100644 |
4256 |
+--- a/drivers/bus/mips_cdmm.c |
4257 |
++++ b/drivers/bus/mips_cdmm.c |
4258 |
+@@ -559,10 +559,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus) |
4259 |
+ dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id); |
4260 |
+ ++id; |
4261 |
+ ret = device_register(&dev->dev); |
4262 |
+- if (ret) { |
4263 |
++ if (ret) |
4264 |
+ put_device(&dev->dev); |
4265 |
+- kfree(dev); |
4266 |
+- } |
4267 |
+ } |
4268 |
+ } |
4269 |
+ |
4270 |
+diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c |
4271 |
+index 3c4c956035954..c8cbec5308f02 100644 |
4272 |
+--- a/drivers/clk/at91/sam9x60.c |
4273 |
++++ b/drivers/clk/at91/sam9x60.c |
4274 |
+@@ -174,7 +174,6 @@ static void __init sam9x60_pmc_setup(struct device_node *np) |
4275 |
+ struct regmap *regmap; |
4276 |
+ struct clk_hw *hw; |
4277 |
+ int i; |
4278 |
+- bool bypass; |
4279 |
+ |
4280 |
+ i = of_property_match_string(np, "clock-names", "td_slck"); |
4281 |
+ if (i < 0) |
4282 |
+@@ -209,10 +208,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) |
4283 |
+ if (IS_ERR(hw)) |
4284 |
+ goto err_free; |
4285 |
+ |
4286 |
+- bypass = of_property_read_bool(np, "atmel,osc-bypass"); |
4287 |
+- |
4288 |
+- hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, |
4289 |
+- bypass); |
4290 |
++ hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, 0); |
4291 |
+ if (IS_ERR(hw)) |
4292 |
+ goto err_free; |
4293 |
+ main_osc_hw = hw; |
4294 |
+diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c |
4295 |
+index 0db2ab3eca147..a092a940baa40 100644 |
4296 |
+--- a/drivers/clk/at91/sama7g5.c |
4297 |
++++ b/drivers/clk/at91/sama7g5.c |
4298 |
+@@ -838,7 +838,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np) |
4299 |
+ sama7g5_pmc = pmc_data_allocate(PMC_I2S1_MUX + 1, |
4300 |
+ nck(sama7g5_systemck), |
4301 |
+ nck(sama7g5_periphck), |
4302 |
+- nck(sama7g5_gck)); |
4303 |
++ nck(sama7g5_gck), 8); |
4304 |
+ if (!sama7g5_pmc) |
4305 |
+ return; |
4306 |
+ |
4307 |
+@@ -980,6 +980,8 @@ static void __init sama7g5_pmc_setup(struct device_node *np) |
4308 |
+ sama7g5_prog_mux_table); |
4309 |
+ if (IS_ERR(hw)) |
4310 |
+ goto err_free; |
4311 |
++ |
4312 |
++ sama7g5_pmc->pchws[i] = hw; |
4313 |
+ } |
4314 |
+ |
4315 |
+ for (i = 0; i < ARRAY_SIZE(sama7g5_systemck); i++) { |
4316 |
+@@ -1052,7 +1054,7 @@ err_free: |
4317 |
+ kfree(alloc_mem); |
4318 |
+ } |
4319 |
+ |
4320 |
+- pmc_data_free(sama7g5_pmc); |
4321 |
++ kfree(sama7g5_pmc); |
4322 |
+ } |
4323 |
+ |
4324 |
+ /* Some clks are used for a clocksource */ |
4325 |
+diff --git a/drivers/clk/bcm/clk-bcm2711-dvp.c b/drivers/clk/bcm/clk-bcm2711-dvp.c |
4326 |
+index 8333e20dc9d22..69e2f85f7029d 100644 |
4327 |
+--- a/drivers/clk/bcm/clk-bcm2711-dvp.c |
4328 |
++++ b/drivers/clk/bcm/clk-bcm2711-dvp.c |
4329 |
+@@ -108,6 +108,7 @@ static const struct of_device_id clk_dvp_dt_ids[] = { |
4330 |
+ { .compatible = "brcm,brcm2711-dvp", }, |
4331 |
+ { /* sentinel */ } |
4332 |
+ }; |
4333 |
++MODULE_DEVICE_TABLE(of, clk_dvp_dt_ids); |
4334 |
+ |
4335 |
+ static struct platform_driver clk_dvp_driver = { |
4336 |
+ .probe = clk_dvp_probe, |
4337 |
+diff --git a/drivers/clk/clk-fsl-sai.c b/drivers/clk/clk-fsl-sai.c |
4338 |
+index 0221180a4dd73..1e81c8d8a6fd3 100644 |
4339 |
+--- a/drivers/clk/clk-fsl-sai.c |
4340 |
++++ b/drivers/clk/clk-fsl-sai.c |
4341 |
+@@ -68,9 +68,20 @@ static int fsl_sai_clk_probe(struct platform_device *pdev) |
4342 |
+ if (IS_ERR(hw)) |
4343 |
+ return PTR_ERR(hw); |
4344 |
+ |
4345 |
++ platform_set_drvdata(pdev, hw); |
4346 |
++ |
4347 |
+ return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); |
4348 |
+ } |
4349 |
+ |
4350 |
++static int fsl_sai_clk_remove(struct platform_device *pdev) |
4351 |
++{ |
4352 |
++ struct clk_hw *hw = platform_get_drvdata(pdev); |
4353 |
++ |
4354 |
++ clk_hw_unregister_composite(hw); |
4355 |
++ |
4356 |
++ return 0; |
4357 |
++} |
4358 |
++ |
4359 |
+ static const struct of_device_id of_fsl_sai_clk_ids[] = { |
4360 |
+ { .compatible = "fsl,vf610-sai-clock" }, |
4361 |
+ { } |
4362 |
+@@ -79,6 +90,7 @@ MODULE_DEVICE_TABLE(of, of_fsl_sai_clk_ids); |
4363 |
+ |
4364 |
+ static struct platform_driver fsl_sai_clk_driver = { |
4365 |
+ .probe = fsl_sai_clk_probe, |
4366 |
++ .remove = fsl_sai_clk_remove, |
4367 |
+ .driver = { |
4368 |
+ .name = "fsl-sai-clk", |
4369 |
+ .of_match_table = of_fsl_sai_clk_ids, |
4370 |
+diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c |
4371 |
+index aa21371f9104c..a3e883a9f4067 100644 |
4372 |
+--- a/drivers/clk/clk-s2mps11.c |
4373 |
++++ b/drivers/clk/clk-s2mps11.c |
4374 |
+@@ -195,6 +195,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev) |
4375 |
+ return ret; |
4376 |
+ |
4377 |
+ err_reg: |
4378 |
++ of_node_put(s2mps11_clks[0].clk_np); |
4379 |
+ while (--i >= 0) |
4380 |
+ clkdev_drop(s2mps11_clks[i].lookup); |
4381 |
+ |
4382 |
+diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c |
4383 |
+index c90460e7ef215..43db67337bc06 100644 |
4384 |
+--- a/drivers/clk/clk-versaclock5.c |
4385 |
++++ b/drivers/clk/clk-versaclock5.c |
4386 |
+@@ -739,8 +739,8 @@ static int vc5_update_power(struct device_node *np_output, |
4387 |
+ { |
4388 |
+ u32 value; |
4389 |
+ |
4390 |
+- if (!of_property_read_u32(np_output, |
4391 |
+- "idt,voltage-microvolts", &value)) { |
4392 |
++ if (!of_property_read_u32(np_output, "idt,voltage-microvolt", |
4393 |
++ &value)) { |
4394 |
+ clk_out->clk_output_cfg0_mask |= VC5_CLK_OUTPUT_CFG0_PWR_MASK; |
4395 |
+ switch (value) { |
4396 |
+ case 1800000: |
4397 |
+diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c |
4398 |
+index dac6edc670cce..c8e9cb6c8e39c 100644 |
4399 |
+--- a/drivers/clk/ingenic/cgu.c |
4400 |
++++ b/drivers/clk/ingenic/cgu.c |
4401 |
+@@ -392,15 +392,21 @@ static unsigned int |
4402 |
+ ingenic_clk_calc_hw_div(const struct ingenic_cgu_clk_info *clk_info, |
4403 |
+ unsigned int div) |
4404 |
+ { |
4405 |
+- unsigned int i; |
4406 |
++ unsigned int i, best_i = 0, best = (unsigned int)-1; |
4407 |
+ |
4408 |
+ for (i = 0; i < (1 << clk_info->div.bits) |
4409 |
+ && clk_info->div.div_table[i]; i++) { |
4410 |
+- if (clk_info->div.div_table[i] >= div) |
4411 |
+- return i; |
4412 |
++ if (clk_info->div.div_table[i] >= div && |
4413 |
++ clk_info->div.div_table[i] < best) { |
4414 |
++ best = clk_info->div.div_table[i]; |
4415 |
++ best_i = i; |
4416 |
++ |
4417 |
++ if (div == best) |
4418 |
++ break; |
4419 |
++ } |
4420 |
+ } |
4421 |
+ |
4422 |
+- return i - 1; |
4423 |
++ return best_i; |
4424 |
+ } |
4425 |
+ |
4426 |
+ static unsigned |
4427 |
+diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig |
4428 |
+index 034da203e8e0e..9a8a548d839d8 100644 |
4429 |
+--- a/drivers/clk/meson/Kconfig |
4430 |
++++ b/drivers/clk/meson/Kconfig |
4431 |
+@@ -110,6 +110,7 @@ config COMMON_CLK_G12A |
4432 |
+ select COMMON_CLK_MESON_AO_CLKC |
4433 |
+ select COMMON_CLK_MESON_EE_CLKC |
4434 |
+ select COMMON_CLK_MESON_CPU_DYNDIV |
4435 |
++ select COMMON_CLK_MESON_VID_PLL_DIV |
4436 |
+ select MFD_SYSCON |
4437 |
+ help |
4438 |
+ Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2 |
4439 |
+diff --git a/drivers/clk/mvebu/armada-37xx-xtal.c b/drivers/clk/mvebu/armada-37xx-xtal.c |
4440 |
+index e9e306d4e9af9..41271351cf1f4 100644 |
4441 |
+--- a/drivers/clk/mvebu/armada-37xx-xtal.c |
4442 |
++++ b/drivers/clk/mvebu/armada-37xx-xtal.c |
4443 |
+@@ -13,8 +13,8 @@ |
4444 |
+ #include <linux/platform_device.h> |
4445 |
+ #include <linux/regmap.h> |
4446 |
+ |
4447 |
+-#define NB_GPIO1_LATCH 0xC |
4448 |
+-#define XTAL_MODE BIT(31) |
4449 |
++#define NB_GPIO1_LATCH 0x8 |
4450 |
++#define XTAL_MODE BIT(9) |
4451 |
+ |
4452 |
+ static int armada_3700_xtal_clock_probe(struct platform_device *pdev) |
4453 |
+ { |
4454 |
+diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c |
4455 |
+index 68d8f7aaf64e1..b080739ab0c33 100644 |
4456 |
+--- a/drivers/clk/qcom/gcc-sc7180.c |
4457 |
++++ b/drivers/clk/qcom/gcc-sc7180.c |
4458 |
+@@ -642,7 +642,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { |
4459 |
+ .name = "gcc_sdcc1_ice_core_clk_src", |
4460 |
+ .parent_data = gcc_parent_data_0, |
4461 |
+ .num_parents = 4, |
4462 |
+- .ops = &clk_rcg2_ops, |
4463 |
++ .ops = &clk_rcg2_floor_ops, |
4464 |
+ }, |
4465 |
+ }; |
4466 |
+ |
4467 |
+@@ -666,7 +666,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { |
4468 |
+ .name = "gcc_sdcc2_apps_clk_src", |
4469 |
+ .parent_data = gcc_parent_data_5, |
4470 |
+ .num_parents = 5, |
4471 |
+- .ops = &clk_rcg2_ops, |
4472 |
++ .ops = &clk_rcg2_floor_ops, |
4473 |
+ }, |
4474 |
+ }; |
4475 |
+ |
4476 |
+diff --git a/drivers/clk/renesas/r8a779a0-cpg-mssr.c b/drivers/clk/renesas/r8a779a0-cpg-mssr.c |
4477 |
+index 17ebbac7ddfb4..046d79416b7d0 100644 |
4478 |
+--- a/drivers/clk/renesas/r8a779a0-cpg-mssr.c |
4479 |
++++ b/drivers/clk/renesas/r8a779a0-cpg-mssr.c |
4480 |
+@@ -26,7 +26,6 @@ |
4481 |
+ #include <dt-bindings/clock/r8a779a0-cpg-mssr.h> |
4482 |
+ |
4483 |
+ #include "renesas-cpg-mssr.h" |
4484 |
+-#include "rcar-gen3-cpg.h" |
4485 |
+ |
4486 |
+ enum rcar_r8a779a0_clk_types { |
4487 |
+ CLK_TYPE_R8A779A0_MAIN = CLK_TYPE_CUSTOM, |
4488 |
+@@ -84,6 +83,14 @@ enum clk_ids { |
4489 |
+ DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_PLL2X_3X, CLK_MAIN, \ |
4490 |
+ .offset = _offset) |
4491 |
+ |
4492 |
++#define DEF_MDSEL(_name, _id, _md, _parent0, _div0, _parent1, _div1) \ |
4493 |
++ DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_MDSEL, \ |
4494 |
++ (_parent0) << 16 | (_parent1), \ |
4495 |
++ .div = (_div0) << 16 | (_div1), .offset = _md) |
4496 |
++ |
4497 |
++#define DEF_OSC(_name, _id, _parent, _div) \ |
4498 |
++ DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_OSC, _parent, .div = _div) |
4499 |
++ |
4500 |
+ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = { |
4501 |
+ /* External Clock Inputs */ |
4502 |
+ DEF_INPUT("extal", CLK_EXTAL), |
4503 |
+@@ -136,8 +143,8 @@ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = { |
4504 |
+ DEF_DIV6P1("canfd", R8A779A0_CLK_CANFD, CLK_PLL5_DIV4, 0x878), |
4505 |
+ DEF_DIV6P1("csi0", R8A779A0_CLK_CSI0, CLK_PLL5_DIV4, 0x880), |
4506 |
+ |
4507 |
+- DEF_GEN3_OSC("osc", R8A779A0_CLK_OSC, CLK_EXTAL, 8), |
4508 |
+- DEF_GEN3_MDSEL("r", R8A779A0_CLK_R, 29, CLK_EXTALR, 1, CLK_OCO, 1), |
4509 |
++ DEF_OSC("osc", R8A779A0_CLK_OSC, CLK_EXTAL, 8), |
4510 |
++ DEF_MDSEL("r", R8A779A0_CLK_R, 29, CLK_EXTALR, 1, CLK_OCO, 1), |
4511 |
+ }; |
4512 |
+ |
4513 |
+ static const struct mssr_mod_clk r8a779a0_mod_clks[] __initconst = { |
4514 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c |
4515 |
+index 5f66bf8797723..149cfde817cba 100644 |
4516 |
+--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c |
4517 |
++++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c |
4518 |
+@@ -389,6 +389,7 @@ static struct clk_div_table ths_div_table[] = { |
4519 |
+ { .val = 1, .div = 2 }, |
4520 |
+ { .val = 2, .div = 4 }, |
4521 |
+ { .val = 3, .div = 6 }, |
4522 |
++ { /* Sentinel */ }, |
4523 |
+ }; |
4524 |
+ static const char * const ths_parents[] = { "osc24M" }; |
4525 |
+ static struct ccu_div ths_clk = { |
4526 |
+diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
4527 |
+index 6b636362379ee..7e629a4493afd 100644 |
4528 |
+--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
4529 |
++++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
4530 |
+@@ -322,6 +322,7 @@ static struct clk_div_table ths_div_table[] = { |
4531 |
+ { .val = 1, .div = 2 }, |
4532 |
+ { .val = 2, .div = 4 }, |
4533 |
+ { .val = 3, .div = 6 }, |
4534 |
++ { /* Sentinel */ }, |
4535 |
+ }; |
4536 |
+ static SUNXI_CCU_DIV_TABLE_WITH_GATE(ths_clk, "ths", "osc24M", |
4537 |
+ 0x074, 0, 2, ths_div_table, BIT(31), 0); |
4538 |
+diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c |
4539 |
+index cfbaa90c7adbf..a5f526bb0483e 100644 |
4540 |
+--- a/drivers/clk/tegra/clk-dfll.c |
4541 |
++++ b/drivers/clk/tegra/clk-dfll.c |
4542 |
+@@ -1856,13 +1856,13 @@ static int dfll_fetch_pwm_params(struct tegra_dfll *td) |
4543 |
+ &td->reg_init_uV); |
4544 |
+ if (!ret) { |
4545 |
+ dev_err(td->dev, "couldn't get initialized voltage\n"); |
4546 |
+- return ret; |
4547 |
++ return -EINVAL; |
4548 |
+ } |
4549 |
+ |
4550 |
+ ret = read_dt_param(td, "nvidia,pwm-period-nanoseconds", &pwm_period); |
4551 |
+ if (!ret) { |
4552 |
+ dev_err(td->dev, "couldn't get PWM period\n"); |
4553 |
+- return ret; |
4554 |
++ return -EINVAL; |
4555 |
+ } |
4556 |
+ td->pwm_rate = (NSEC_PER_SEC / pwm_period) * (MAX_DFLL_VOLTAGES - 1); |
4557 |
+ |
4558 |
+diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h |
4559 |
+index ff7da2d3e94d8..24413812ec5b6 100644 |
4560 |
+--- a/drivers/clk/tegra/clk-id.h |
4561 |
++++ b/drivers/clk/tegra/clk-id.h |
4562 |
+@@ -227,6 +227,7 @@ enum clk_id { |
4563 |
+ tegra_clk_sdmmc4, |
4564 |
+ tegra_clk_sdmmc4_8, |
4565 |
+ tegra_clk_se, |
4566 |
++ tegra_clk_se_10, |
4567 |
+ tegra_clk_soc_therm, |
4568 |
+ tegra_clk_soc_therm_8, |
4569 |
+ tegra_clk_sor0, |
4570 |
+diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c |
4571 |
+index 2b2a3b81c16ba..60cc34f90cb9b 100644 |
4572 |
+--- a/drivers/clk/tegra/clk-tegra-periph.c |
4573 |
++++ b/drivers/clk/tegra/clk-tegra-periph.c |
4574 |
+@@ -630,7 +630,7 @@ static struct tegra_periph_init_data periph_clks[] = { |
4575 |
+ INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8), |
4576 |
+ INT8("host1x", mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_9), |
4577 |
+ INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se), |
4578 |
+- INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se), |
4579 |
++ INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se_10), |
4580 |
+ INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8), |
4581 |
+ INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8), |
4582 |
+ INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03), |
4583 |
+diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c |
4584 |
+index 95e36ba64accf..8024c6d2b9e95 100644 |
4585 |
+--- a/drivers/clk/ti/fapll.c |
4586 |
++++ b/drivers/clk/ti/fapll.c |
4587 |
+@@ -498,6 +498,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, |
4588 |
+ { |
4589 |
+ struct clk_init_data *init; |
4590 |
+ struct fapll_synth *synth; |
4591 |
++ struct clk *clk = ERR_PTR(-ENOMEM); |
4592 |
+ |
4593 |
+ init = kzalloc(sizeof(*init), GFP_KERNEL); |
4594 |
+ if (!init) |
4595 |
+@@ -520,13 +521,19 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, |
4596 |
+ synth->hw.init = init; |
4597 |
+ synth->clk_pll = pll_clk; |
4598 |
+ |
4599 |
+- return clk_register(NULL, &synth->hw); |
4600 |
++ clk = clk_register(NULL, &synth->hw); |
4601 |
++ if (IS_ERR(clk)) { |
4602 |
++ pr_err("failed to register clock\n"); |
4603 |
++ goto free; |
4604 |
++ } |
4605 |
++ |
4606 |
++ return clk; |
4607 |
+ |
4608 |
+ free: |
4609 |
+ kfree(synth); |
4610 |
+ kfree(init); |
4611 |
+ |
4612 |
+- return ERR_PTR(-ENOMEM); |
4613 |
++ return clk; |
4614 |
+ } |
4615 |
+ |
4616 |
+ static void __init ti_fapll_setup(struct device_node *node) |
4617 |
+diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig |
4618 |
+index 68b087bff59cc..2be849bb794ac 100644 |
4619 |
+--- a/drivers/clocksource/Kconfig |
4620 |
++++ b/drivers/clocksource/Kconfig |
4621 |
+@@ -654,7 +654,7 @@ config ATCPIT100_TIMER |
4622 |
+ |
4623 |
+ config RISCV_TIMER |
4624 |
+ bool "Timer for the RISC-V platform" if COMPILE_TEST |
4625 |
+- depends on GENERIC_SCHED_CLOCK && RISCV |
4626 |
++ depends on GENERIC_SCHED_CLOCK && RISCV && RISCV_SBI |
4627 |
+ select TIMER_PROBE |
4628 |
+ select TIMER_OF |
4629 |
+ help |
4630 |
+diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c |
4631 |
+index 6c3e841801461..d0177824c518b 100644 |
4632 |
+--- a/drivers/clocksource/arm_arch_timer.c |
4633 |
++++ b/drivers/clocksource/arm_arch_timer.c |
4634 |
+@@ -396,10 +396,10 @@ static void erratum_set_next_event_tval_generic(const int access, unsigned long |
4635 |
+ ctrl &= ~ARCH_TIMER_CTRL_IT_MASK; |
4636 |
+ |
4637 |
+ if (access == ARCH_TIMER_PHYS_ACCESS) { |
4638 |
+- cval = evt + arch_counter_get_cntpct(); |
4639 |
++ cval = evt + arch_counter_get_cntpct_stable(); |
4640 |
+ write_sysreg(cval, cntp_cval_el0); |
4641 |
+ } else { |
4642 |
+- cval = evt + arch_counter_get_cntvct(); |
4643 |
++ cval = evt + arch_counter_get_cntvct_stable(); |
4644 |
+ write_sysreg(cval, cntv_cval_el0); |
4645 |
+ } |
4646 |
+ |
4647 |
+@@ -822,15 +822,24 @@ static void arch_timer_evtstrm_enable(int divider) |
4648 |
+ |
4649 |
+ static void arch_timer_configure_evtstream(void) |
4650 |
+ { |
4651 |
+- int evt_stream_div, pos; |
4652 |
++ int evt_stream_div, lsb; |
4653 |
++ |
4654 |
++ /* |
4655 |
++ * As the event stream can at most be generated at half the frequency |
4656 |
++ * of the counter, use half the frequency when computing the divider. |
4657 |
++ */ |
4658 |
++ evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2; |
4659 |
++ |
4660 |
++ /* |
4661 |
++ * Find the closest power of two to the divisor. If the adjacent bit |
4662 |
++ * of lsb (last set bit, starts from 0) is set, then we use (lsb + 1). |
4663 |
++ */ |
4664 |
++ lsb = fls(evt_stream_div) - 1; |
4665 |
++ if (lsb > 0 && (evt_stream_div & BIT(lsb - 1))) |
4666 |
++ lsb++; |
4667 |
+ |
4668 |
+- /* Find the closest power of two to the divisor */ |
4669 |
+- evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ; |
4670 |
+- pos = fls(evt_stream_div); |
4671 |
+- if (pos > 1 && !(evt_stream_div & (1 << (pos - 2)))) |
4672 |
+- pos--; |
4673 |
+ /* enable event stream */ |
4674 |
+- arch_timer_evtstrm_enable(min(pos, 15)); |
4675 |
++ arch_timer_evtstrm_enable(max(0, min(lsb, 15))); |
4676 |
+ } |
4677 |
+ |
4678 |
+ static void arch_counter_set_user_access(void) |
4679 |
+diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c |
4680 |
+index 58fd9189fab7f..905fd6b163a81 100644 |
4681 |
+--- a/drivers/clocksource/ingenic-timer.c |
4682 |
++++ b/drivers/clocksource/ingenic-timer.c |
4683 |
+@@ -127,7 +127,7 @@ static irqreturn_t ingenic_tcu_cevt_cb(int irq, void *dev_id) |
4684 |
+ return IRQ_HANDLED; |
4685 |
+ } |
4686 |
+ |
4687 |
+-static struct clk * __init ingenic_tcu_get_clock(struct device_node *np, int id) |
4688 |
++static struct clk *ingenic_tcu_get_clock(struct device_node *np, int id) |
4689 |
+ { |
4690 |
+ struct of_phandle_args args; |
4691 |
+ |
4692 |
+diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c |
4693 |
+index 80e9606020307..4efd0cf3b602d 100644 |
4694 |
+--- a/drivers/clocksource/timer-cadence-ttc.c |
4695 |
++++ b/drivers/clocksource/timer-cadence-ttc.c |
4696 |
+@@ -413,10 +413,8 @@ static int __init ttc_setup_clockevent(struct clk *clk, |
4697 |
+ ttcce->ttc.clk = clk; |
4698 |
+ |
4699 |
+ err = clk_prepare_enable(ttcce->ttc.clk); |
4700 |
+- if (err) { |
4701 |
+- kfree(ttcce); |
4702 |
+- return err; |
4703 |
+- } |
4704 |
++ if (err) |
4705 |
++ goto out_kfree; |
4706 |
+ |
4707 |
+ ttcce->ttc.clk_rate_change_nb.notifier_call = |
4708 |
+ ttc_rate_change_clockevent_cb; |
4709 |
+@@ -426,7 +424,7 @@ static int __init ttc_setup_clockevent(struct clk *clk, |
4710 |
+ &ttcce->ttc.clk_rate_change_nb); |
4711 |
+ if (err) { |
4712 |
+ pr_warn("Unable to register clock notifier.\n"); |
4713 |
+- return err; |
4714 |
++ goto out_kfree; |
4715 |
+ } |
4716 |
+ |
4717 |
+ ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk); |
4718 |
+@@ -455,15 +453,17 @@ static int __init ttc_setup_clockevent(struct clk *clk, |
4719 |
+ |
4720 |
+ err = request_irq(irq, ttc_clock_event_interrupt, |
4721 |
+ IRQF_TIMER, ttcce->ce.name, ttcce); |
4722 |
+- if (err) { |
4723 |
+- kfree(ttcce); |
4724 |
+- return err; |
4725 |
+- } |
4726 |
++ if (err) |
4727 |
++ goto out_kfree; |
4728 |
+ |
4729 |
+ clockevents_config_and_register(&ttcce->ce, |
4730 |
+ ttcce->ttc.freq / PRESCALE, 1, 0xfffe); |
4731 |
+ |
4732 |
+ return 0; |
4733 |
++ |
4734 |
++out_kfree: |
4735 |
++ kfree(ttcce); |
4736 |
++ return err; |
4737 |
+ } |
4738 |
+ |
4739 |
+ static int __init ttc_timer_probe(struct platform_device *pdev) |
4740 |
+diff --git a/drivers/clocksource/timer-orion.c b/drivers/clocksource/timer-orion.c |
4741 |
+index d01ff41818676..5101e834d78ff 100644 |
4742 |
+--- a/drivers/clocksource/timer-orion.c |
4743 |
++++ b/drivers/clocksource/timer-orion.c |
4744 |
+@@ -143,7 +143,8 @@ static int __init orion_timer_init(struct device_node *np) |
4745 |
+ irq = irq_of_parse_and_map(np, 1); |
4746 |
+ if (irq <= 0) { |
4747 |
+ pr_err("%pOFn: unable to parse timer1 irq\n", np); |
4748 |
+- return -EINVAL; |
4749 |
++ ret = -EINVAL; |
4750 |
++ goto out_unprep_clk; |
4751 |
+ } |
4752 |
+ |
4753 |
+ rate = clk_get_rate(clk); |
4754 |
+@@ -160,7 +161,7 @@ static int __init orion_timer_init(struct device_node *np) |
4755 |
+ clocksource_mmio_readl_down); |
4756 |
+ if (ret) { |
4757 |
+ pr_err("Failed to initialize mmio timer\n"); |
4758 |
+- return ret; |
4759 |
++ goto out_unprep_clk; |
4760 |
+ } |
4761 |
+ |
4762 |
+ sched_clock_register(orion_read_sched_clock, 32, rate); |
4763 |
+@@ -170,7 +171,7 @@ static int __init orion_timer_init(struct device_node *np) |
4764 |
+ "orion_event", NULL); |
4765 |
+ if (ret) { |
4766 |
+ pr_err("%pOFn: unable to setup irq\n", np); |
4767 |
+- return ret; |
4768 |
++ goto out_unprep_clk; |
4769 |
+ } |
4770 |
+ |
4771 |
+ ticks_per_jiffy = (clk_get_rate(clk) + HZ/2) / HZ; |
4772 |
+@@ -183,5 +184,9 @@ static int __init orion_timer_init(struct device_node *np) |
4773 |
+ orion_delay_timer_init(rate); |
4774 |
+ |
4775 |
+ return 0; |
4776 |
++ |
4777 |
++out_unprep_clk: |
4778 |
++ clk_disable_unprepare(clk); |
4779 |
++ return ret; |
4780 |
+ } |
4781 |
+ TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init); |
4782 |
+diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c |
4783 |
+index 039c54a78aa57..710acc0a37044 100644 |
4784 |
+--- a/drivers/counter/microchip-tcb-capture.c |
4785 |
++++ b/drivers/counter/microchip-tcb-capture.c |
4786 |
+@@ -183,16 +183,20 @@ static int mchp_tc_count_action_get(struct counter_device *counter, |
4787 |
+ |
4788 |
+ regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr); |
4789 |
+ |
4790 |
+- *action = MCHP_TC_SYNAPSE_ACTION_NONE; |
4791 |
+- |
4792 |
+- if (cmr & ATMEL_TC_ETRGEDG_NONE) |
4793 |
++ switch (cmr & ATMEL_TC_ETRGEDG) { |
4794 |
++ default: |
4795 |
+ *action = MCHP_TC_SYNAPSE_ACTION_NONE; |
4796 |
+- else if (cmr & ATMEL_TC_ETRGEDG_RISING) |
4797 |
++ break; |
4798 |
++ case ATMEL_TC_ETRGEDG_RISING: |
4799 |
+ *action = MCHP_TC_SYNAPSE_ACTION_RISING_EDGE; |
4800 |
+- else if (cmr & ATMEL_TC_ETRGEDG_FALLING) |
4801 |
++ break; |
4802 |
++ case ATMEL_TC_ETRGEDG_FALLING: |
4803 |
+ *action = MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE; |
4804 |
+- else if (cmr & ATMEL_TC_ETRGEDG_BOTH) |
4805 |
++ break; |
4806 |
++ case ATMEL_TC_ETRGEDG_BOTH: |
4807 |
+ *action = MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE; |
4808 |
++ break; |
4809 |
++ } |
4810 |
+ |
4811 |
+ return 0; |
4812 |
+ } |
4813 |
+diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm |
4814 |
+index 015ec0c028358..1f73fa75b1a05 100644 |
4815 |
+--- a/drivers/cpufreq/Kconfig.arm |
4816 |
++++ b/drivers/cpufreq/Kconfig.arm |
4817 |
+@@ -94,7 +94,7 @@ config ARM_IMX6Q_CPUFREQ |
4818 |
+ tristate "Freescale i.MX6 cpufreq support" |
4819 |
+ depends on ARCH_MXC |
4820 |
+ depends on REGULATOR_ANATOP |
4821 |
+- select NVMEM_IMX_OCOTP |
4822 |
++ depends on NVMEM_IMX_OCOTP || COMPILE_TEST |
4823 |
+ select PM_OPP |
4824 |
+ help |
4825 |
+ This adds cpufreq driver support for Freescale i.MX6 series SoCs. |
4826 |
+diff --git a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c |
4827 |
+index 39e34f5066d3d..b0fc5e84f8570 100644 |
4828 |
+--- a/drivers/cpufreq/armada-8k-cpufreq.c |
4829 |
++++ b/drivers/cpufreq/armada-8k-cpufreq.c |
4830 |
+@@ -204,6 +204,12 @@ static void __exit armada_8k_cpufreq_exit(void) |
4831 |
+ } |
4832 |
+ module_exit(armada_8k_cpufreq_exit); |
4833 |
+ |
4834 |
++static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = { |
4835 |
++ { .compatible = "marvell,ap806-cpu-clock" }, |
4836 |
++ { }, |
4837 |
++}; |
4838 |
++MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match); |
4839 |
++ |
4840 |
+ MODULE_AUTHOR("Gregory Clement <gregory.clement@×××××××.com>"); |
4841 |
+ MODULE_DESCRIPTION("Armada 8K cpufreq driver"); |
4842 |
+ MODULE_LICENSE("GPL"); |
4843 |
+diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c |
4844 |
+index 5a7f6dafcddb6..ac57cddc5f2fe 100644 |
4845 |
+--- a/drivers/cpufreq/highbank-cpufreq.c |
4846 |
++++ b/drivers/cpufreq/highbank-cpufreq.c |
4847 |
+@@ -101,6 +101,13 @@ out_put_node: |
4848 |
+ } |
4849 |
+ module_init(hb_cpufreq_driver_init); |
4850 |
+ |
4851 |
++static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = { |
4852 |
++ { .compatible = "calxeda,highbank" }, |
4853 |
++ { .compatible = "calxeda,ecx-2000" }, |
4854 |
++ { }, |
4855 |
++}; |
4856 |
++MODULE_DEVICE_TABLE(of, hb_cpufreq_of_match); |
4857 |
++ |
4858 |
+ MODULE_AUTHOR("Mark Langsdorf <mark.langsdorf@×××××××.com>"); |
4859 |
+ MODULE_DESCRIPTION("Calxeda Highbank cpufreq driver"); |
4860 |
+ MODULE_LICENSE("GPL"); |
4861 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
4862 |
+index 36a3ccfe6d3d1..cb95da684457f 100644 |
4863 |
+--- a/drivers/cpufreq/intel_pstate.c |
4864 |
++++ b/drivers/cpufreq/intel_pstate.c |
4865 |
+@@ -2207,9 +2207,9 @@ static void intel_pstate_update_perf_limits(struct cpudata *cpu, |
4866 |
+ unsigned int policy_min, |
4867 |
+ unsigned int policy_max) |
4868 |
+ { |
4869 |
+- int max_freq = intel_pstate_get_max_freq(cpu); |
4870 |
+ int32_t max_policy_perf, min_policy_perf; |
4871 |
+ int max_state, turbo_max; |
4872 |
++ int max_freq; |
4873 |
+ |
4874 |
+ /* |
4875 |
+ * HWP needs some special consideration, because on BDX the |
4876 |
+@@ -2223,6 +2223,7 @@ static void intel_pstate_update_perf_limits(struct cpudata *cpu, |
4877 |
+ cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; |
4878 |
+ turbo_max = cpu->pstate.turbo_pstate; |
4879 |
+ } |
4880 |
++ max_freq = max_state * cpu->pstate.scaling; |
4881 |
+ |
4882 |
+ max_policy_perf = max_state * policy_max / max_freq; |
4883 |
+ if (policy_max == policy_min) { |
4884 |
+@@ -2325,9 +2326,18 @@ static void intel_pstate_adjust_policy_max(struct cpudata *cpu, |
4885 |
+ static void intel_pstate_verify_cpu_policy(struct cpudata *cpu, |
4886 |
+ struct cpufreq_policy_data *policy) |
4887 |
+ { |
4888 |
++ int max_freq; |
4889 |
++ |
4890 |
+ update_turbo_state(); |
4891 |
+- cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, |
4892 |
+- intel_pstate_get_max_freq(cpu)); |
4893 |
++ if (hwp_active) { |
4894 |
++ int max_state, turbo_max; |
4895 |
++ |
4896 |
++ intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state); |
4897 |
++ max_freq = max_state * cpu->pstate.scaling; |
4898 |
++ } else { |
4899 |
++ max_freq = intel_pstate_get_max_freq(cpu); |
4900 |
++ } |
4901 |
++ cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, max_freq); |
4902 |
+ |
4903 |
+ intel_pstate_adjust_policy_max(cpu, policy); |
4904 |
+ } |
4905 |
+diff --git a/drivers/cpufreq/loongson1-cpufreq.c b/drivers/cpufreq/loongson1-cpufreq.c |
4906 |
+index 0ea88778882ac..86f612593e497 100644 |
4907 |
+--- a/drivers/cpufreq/loongson1-cpufreq.c |
4908 |
++++ b/drivers/cpufreq/loongson1-cpufreq.c |
4909 |
+@@ -216,6 +216,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = { |
4910 |
+ |
4911 |
+ module_platform_driver(ls1x_cpufreq_platdrv); |
4912 |
+ |
4913 |
++MODULE_ALIAS("platform:ls1x-cpufreq"); |
4914 |
+ MODULE_AUTHOR("Kelvin Cheung <keguang.zhang@×××××.com>"); |
4915 |
+ MODULE_DESCRIPTION("Loongson1 CPUFreq driver"); |
4916 |
+ MODULE_LICENSE("GPL"); |
4917 |
+diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c |
4918 |
+index 7d1212c9b7c88..a310372dc53e9 100644 |
4919 |
+--- a/drivers/cpufreq/mediatek-cpufreq.c |
4920 |
++++ b/drivers/cpufreq/mediatek-cpufreq.c |
4921 |
+@@ -540,6 +540,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = { |
4922 |
+ |
4923 |
+ { } |
4924 |
+ }; |
4925 |
++MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines); |
4926 |
+ |
4927 |
+ static int __init mtk_cpufreq_driver_init(void) |
4928 |
+ { |
4929 |
+diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c |
4930 |
+index d06b37822c3df..fba9937a406b3 100644 |
4931 |
+--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c |
4932 |
++++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c |
4933 |
+@@ -464,6 +464,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = { |
4934 |
+ { .compatible = "qcom,msm8960", .data = &match_data_krait }, |
4935 |
+ {}, |
4936 |
+ }; |
4937 |
++MODULE_DEVICE_TABLE(of, qcom_cpufreq_match_list); |
4938 |
+ |
4939 |
+ /* |
4940 |
+ * Since the driver depends on smem and nvmem drivers, which may |
4941 |
+diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c |
4942 |
+index 43db05b949d95..e5140ad63db83 100644 |
4943 |
+--- a/drivers/cpufreq/scpi-cpufreq.c |
4944 |
++++ b/drivers/cpufreq/scpi-cpufreq.c |
4945 |
+@@ -233,6 +233,7 @@ static struct platform_driver scpi_cpufreq_platdrv = { |
4946 |
+ }; |
4947 |
+ module_platform_driver(scpi_cpufreq_platdrv); |
4948 |
+ |
4949 |
++MODULE_ALIAS("platform:scpi-cpufreq"); |
4950 |
+ MODULE_AUTHOR("Sudeep Holla <sudeep.holla@×××.com>"); |
4951 |
+ MODULE_DESCRIPTION("ARM SCPI CPUFreq interface driver"); |
4952 |
+ MODULE_LICENSE("GPL v2"); |
4953 |
+diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c |
4954 |
+index 4ac6fb23792a0..c40d3d7d4ea43 100644 |
4955 |
+--- a/drivers/cpufreq/sti-cpufreq.c |
4956 |
++++ b/drivers/cpufreq/sti-cpufreq.c |
4957 |
+@@ -292,6 +292,13 @@ register_cpufreq_dt: |
4958 |
+ } |
4959 |
+ module_init(sti_cpufreq_init); |
4960 |
+ |
4961 |
++static const struct of_device_id __maybe_unused sti_cpufreq_of_match[] = { |
4962 |
++ { .compatible = "st,stih407" }, |
4963 |
++ { .compatible = "st,stih410" }, |
4964 |
++ { }, |
4965 |
++}; |
4966 |
++MODULE_DEVICE_TABLE(of, sti_cpufreq_of_match); |
4967 |
++ |
4968 |
+ MODULE_DESCRIPTION("STMicroelectronics CPUFreq/OPP driver"); |
4969 |
+ MODULE_AUTHOR("Ajitpal Singh <ajitpal.singh@××.com>"); |
4970 |
+ MODULE_AUTHOR("Lee Jones <lee.jones@××××××.org>"); |
4971 |
+diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
4972 |
+index 9907a165135b7..2deed8d8773fa 100644 |
4973 |
+--- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
4974 |
++++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c |
4975 |
+@@ -167,6 +167,7 @@ static const struct of_device_id sun50i_cpufreq_match_list[] = { |
4976 |
+ { .compatible = "allwinner,sun50i-h6" }, |
4977 |
+ {} |
4978 |
+ }; |
4979 |
++MODULE_DEVICE_TABLE(of, sun50i_cpufreq_match_list); |
4980 |
+ |
4981 |
+ static const struct of_device_id *sun50i_cpufreq_match_node(void) |
4982 |
+ { |
4983 |
+diff --git a/drivers/cpufreq/vexpress-spc-cpufreq.c b/drivers/cpufreq/vexpress-spc-cpufreq.c |
4984 |
+index e89b905754d21..f711d8eaea6a2 100644 |
4985 |
+--- a/drivers/cpufreq/vexpress-spc-cpufreq.c |
4986 |
++++ b/drivers/cpufreq/vexpress-spc-cpufreq.c |
4987 |
+@@ -591,6 +591,7 @@ static struct platform_driver ve_spc_cpufreq_platdrv = { |
4988 |
+ }; |
4989 |
+ module_platform_driver(ve_spc_cpufreq_platdrv); |
4990 |
+ |
4991 |
++MODULE_ALIAS("platform:vexpress-spc-cpufreq"); |
4992 |
+ MODULE_AUTHOR("Viresh Kumar <viresh.kumar@××××××.org>"); |
4993 |
+ MODULE_AUTHOR("Sudeep Holla <sudeep.holla@×××.com>"); |
4994 |
+ MODULE_DESCRIPTION("Vexpress SPC ARM big LITTLE cpufreq driver"); |
4995 |
+diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig |
4996 |
+index 37da0c070a883..9d6645b1f0abe 100644 |
4997 |
+--- a/drivers/crypto/Kconfig |
4998 |
++++ b/drivers/crypto/Kconfig |
4999 |
+@@ -548,6 +548,7 @@ config CRYPTO_DEV_ATMEL_SHA |
5000 |
+ |
5001 |
+ config CRYPTO_DEV_ATMEL_I2C |
5002 |
+ tristate |
5003 |
++ select BITREVERSE |
5004 |
+ |
5005 |
+ config CRYPTO_DEV_ATMEL_ECC |
5006 |
+ tristate "Support for Microchip / Atmel ECC hw accelerator" |
5007 |
+diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |
5008 |
+index a94bf28f858a7..4c5a2c11d7141 100644 |
5009 |
+--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |
5010 |
++++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |
5011 |
+@@ -262,13 +262,13 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) |
5012 |
+ u32 common; |
5013 |
+ u64 byte_count; |
5014 |
+ __le32 *bf; |
5015 |
+- void *buf; |
5016 |
++ void *buf = NULL; |
5017 |
+ int j, i, todo; |
5018 |
+ int nbw = 0; |
5019 |
+ u64 fill, min_fill; |
5020 |
+ __be64 *bebits; |
5021 |
+ __le64 *lebits; |
5022 |
+- void *result; |
5023 |
++ void *result = NULL; |
5024 |
+ u64 bs; |
5025 |
+ int digestsize; |
5026 |
+ dma_addr_t addr_res, addr_pad; |
5027 |
+@@ -285,13 +285,17 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) |
5028 |
+ |
5029 |
+ /* the padding could be up to two block. */ |
5030 |
+ buf = kzalloc(bs * 2, GFP_KERNEL | GFP_DMA); |
5031 |
+- if (!buf) |
5032 |
+- return -ENOMEM; |
5033 |
++ if (!buf) { |
5034 |
++ err = -ENOMEM; |
5035 |
++ goto theend; |
5036 |
++ } |
5037 |
+ bf = (__le32 *)buf; |
5038 |
+ |
5039 |
+ result = kzalloc(digestsize, GFP_KERNEL | GFP_DMA); |
5040 |
+- if (!result) |
5041 |
+- return -ENOMEM; |
5042 |
++ if (!result) { |
5043 |
++ err = -ENOMEM; |
5044 |
++ goto theend; |
5045 |
++ } |
5046 |
+ |
5047 |
+ flow = rctx->flow; |
5048 |
+ chan = &ce->chanlist[flow]; |
5049 |
+@@ -403,11 +407,11 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) |
5050 |
+ dma_unmap_sg(ce->dev, areq->src, nr_sgs, DMA_TO_DEVICE); |
5051 |
+ dma_unmap_single(ce->dev, addr_res, digestsize, DMA_FROM_DEVICE); |
5052 |
+ |
5053 |
+- kfree(buf); |
5054 |
+ |
5055 |
+ memcpy(areq->result, result, algt->alg.hash.halg.digestsize); |
5056 |
+- kfree(result); |
5057 |
+ theend: |
5058 |
++ kfree(buf); |
5059 |
++ kfree(result); |
5060 |
+ crypto_finalize_hash_request(engine, breq, err); |
5061 |
+ return 0; |
5062 |
+ } |
5063 |
+diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c |
5064 |
+index 981de43ea5e24..2e3690f65786d 100644 |
5065 |
+--- a/drivers/crypto/amcc/crypto4xx_core.c |
5066 |
++++ b/drivers/crypto/amcc/crypto4xx_core.c |
5067 |
+@@ -917,7 +917,7 @@ int crypto4xx_build_pd(struct crypto_async_request *req, |
5068 |
+ } |
5069 |
+ |
5070 |
+ pd->pd_ctl.w = PD_CTL_HOST_READY | |
5071 |
+- ((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AHASH) | |
5072 |
++ ((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AHASH) || |
5073 |
+ (crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AEAD) ? |
5074 |
+ PD_CTL_HASH_FINAL : 0); |
5075 |
+ pd->pd_ctl_len.w = 0x00400000 | (assoclen + datalen); |
5076 |
+diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c |
5077 |
+index cf5bd7666dfcd..8697ae53b0633 100644 |
5078 |
+--- a/drivers/crypto/caam/caamalg.c |
5079 |
++++ b/drivers/crypto/caam/caamalg.c |
5080 |
+@@ -3404,8 +3404,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm) |
5081 |
+ fallback = crypto_alloc_skcipher(tfm_name, 0, |
5082 |
+ CRYPTO_ALG_NEED_FALLBACK); |
5083 |
+ if (IS_ERR(fallback)) { |
5084 |
+- dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n", |
5085 |
+- tfm_name, PTR_ERR(fallback)); |
5086 |
++ pr_err("Failed to allocate %s fallback: %ld\n", |
5087 |
++ tfm_name, PTR_ERR(fallback)); |
5088 |
+ return PTR_ERR(fallback); |
5089 |
+ } |
5090 |
+ |
5091 |
+diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c |
5092 |
+index 66f60d78bdc84..a24ae966df4a3 100644 |
5093 |
+--- a/drivers/crypto/caam/caamalg_qi.c |
5094 |
++++ b/drivers/crypto/caam/caamalg_qi.c |
5095 |
+@@ -2502,8 +2502,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm) |
5096 |
+ fallback = crypto_alloc_skcipher(tfm_name, 0, |
5097 |
+ CRYPTO_ALG_NEED_FALLBACK); |
5098 |
+ if (IS_ERR(fallback)) { |
5099 |
+- dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n", |
5100 |
+- tfm_name, PTR_ERR(fallback)); |
5101 |
++ pr_err("Failed to allocate %s fallback: %ld\n", |
5102 |
++ tfm_name, PTR_ERR(fallback)); |
5103 |
+ return PTR_ERR(fallback); |
5104 |
+ } |
5105 |
+ |
5106 |
+diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c |
5107 |
+index 98c1ff1744bb1..a780e627838ae 100644 |
5108 |
+--- a/drivers/crypto/caam/caamalg_qi2.c |
5109 |
++++ b/drivers/crypto/caam/caamalg_qi2.c |
5110 |
+@@ -1611,7 +1611,8 @@ static int caam_cra_init_skcipher(struct crypto_skcipher *tfm) |
5111 |
+ fallback = crypto_alloc_skcipher(tfm_name, 0, |
5112 |
+ CRYPTO_ALG_NEED_FALLBACK); |
5113 |
+ if (IS_ERR(fallback)) { |
5114 |
+- dev_err(ctx->dev, "Failed to allocate %s fallback: %ld\n", |
5115 |
++ dev_err(caam_alg->caam.dev, |
5116 |
++ "Failed to allocate %s fallback: %ld\n", |
5117 |
+ tfm_name, PTR_ERR(fallback)); |
5118 |
+ return PTR_ERR(fallback); |
5119 |
+ } |
5120 |
+diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c |
5121 |
+index eb2418450f120..2e1562108a858 100644 |
5122 |
+--- a/drivers/crypto/inside-secure/safexcel.c |
5123 |
++++ b/drivers/crypto/inside-secure/safexcel.c |
5124 |
+@@ -1639,7 +1639,7 @@ static int safexcel_probe_generic(void *pdev, |
5125 |
+ |
5126 |
+ priv->ring[i].rdr_req = devm_kcalloc(dev, |
5127 |
+ EIP197_DEFAULT_RING_SIZE, |
5128 |
+- sizeof(priv->ring[i].rdr_req), |
5129 |
++ sizeof(*priv->ring[i].rdr_req), |
5130 |
+ GFP_KERNEL); |
5131 |
+ if (!priv->ring[i].rdr_req) |
5132 |
+ return -ENOMEM; |
5133 |
+diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c |
5134 |
+index 4fd14d90cc409..1b1e0ab0a831a 100644 |
5135 |
+--- a/drivers/crypto/omap-aes.c |
5136 |
++++ b/drivers/crypto/omap-aes.c |
5137 |
+@@ -1137,7 +1137,7 @@ static int omap_aes_probe(struct platform_device *pdev) |
5138 |
+ if (err < 0) { |
5139 |
+ dev_err(dev, "%s: failed to get_sync(%d)\n", |
5140 |
+ __func__, err); |
5141 |
+- goto err_res; |
5142 |
++ goto err_pm_disable; |
5143 |
+ } |
5144 |
+ |
5145 |
+ omap_aes_dma_stop(dd); |
5146 |
+@@ -1246,6 +1246,7 @@ err_engine: |
5147 |
+ omap_aes_dma_cleanup(dd); |
5148 |
+ err_irq: |
5149 |
+ tasklet_kill(&dd->done_task); |
5150 |
++err_pm_disable: |
5151 |
+ pm_runtime_disable(dev); |
5152 |
+ err_res: |
5153 |
+ dd = NULL; |
5154 |
+diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c |
5155 |
+index 6b9d47682d04d..52ef80efeddc6 100644 |
5156 |
+--- a/drivers/crypto/qat/qat_common/qat_hal.c |
5157 |
++++ b/drivers/crypto/qat/qat_common/qat_hal.c |
5158 |
+@@ -1146,7 +1146,7 @@ static int qat_hal_put_rel_rd_xfer(struct icp_qat_fw_loader_handle *handle, |
5159 |
+ unsigned short mask; |
5160 |
+ unsigned short dr_offset = 0x10; |
5161 |
+ |
5162 |
+- status = ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES); |
5163 |
++ ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES); |
5164 |
+ if (CE_INUSE_CONTEXTS & ctx_enables) { |
5165 |
+ if (ctx & 0x1) { |
5166 |
+ pr_err("QAT: bad 4-ctx mode,ctx=0x%x\n", ctx); |
5167 |
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
5168 |
+index 66773892f665d..a713a35dc5022 100644 |
5169 |
+--- a/drivers/crypto/talitos.c |
5170 |
++++ b/drivers/crypto/talitos.c |
5171 |
+@@ -460,7 +460,7 @@ DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE) |
5172 |
+ /* |
5173 |
+ * locate current (offending) descriptor |
5174 |
+ */ |
5175 |
+-static u32 current_desc_hdr(struct device *dev, int ch) |
5176 |
++static __be32 current_desc_hdr(struct device *dev, int ch) |
5177 |
+ { |
5178 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
5179 |
+ int tail, iter; |
5180 |
+@@ -478,7 +478,7 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
5181 |
+ |
5182 |
+ iter = tail; |
5183 |
+ while (priv->chan[ch].fifo[iter].dma_desc != cur_desc && |
5184 |
+- priv->chan[ch].fifo[iter].desc->next_desc != cur_desc) { |
5185 |
++ priv->chan[ch].fifo[iter].desc->next_desc != cpu_to_be32(cur_desc)) { |
5186 |
+ iter = (iter + 1) & (priv->fifo_len - 1); |
5187 |
+ if (iter == tail) { |
5188 |
+ dev_err(dev, "couldn't locate current descriptor\n"); |
5189 |
+@@ -486,7 +486,7 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
5190 |
+ } |
5191 |
+ } |
5192 |
+ |
5193 |
+- if (priv->chan[ch].fifo[iter].desc->next_desc == cur_desc) { |
5194 |
++ if (priv->chan[ch].fifo[iter].desc->next_desc == cpu_to_be32(cur_desc)) { |
5195 |
+ struct talitos_edesc *edesc; |
5196 |
+ |
5197 |
+ edesc = container_of(priv->chan[ch].fifo[iter].desc, |
5198 |
+@@ -501,13 +501,13 @@ static u32 current_desc_hdr(struct device *dev, int ch) |
5199 |
+ /* |
5200 |
+ * user diagnostics; report root cause of error based on execution unit status |
5201 |
+ */ |
5202 |
+-static void report_eu_error(struct device *dev, int ch, u32 desc_hdr) |
5203 |
++static void report_eu_error(struct device *dev, int ch, __be32 desc_hdr) |
5204 |
+ { |
5205 |
+ struct talitos_private *priv = dev_get_drvdata(dev); |
5206 |
+ int i; |
5207 |
+ |
5208 |
+ if (!desc_hdr) |
5209 |
+- desc_hdr = in_be32(priv->chan[ch].reg + TALITOS_DESCBUF); |
5210 |
++ desc_hdr = cpu_to_be32(in_be32(priv->chan[ch].reg + TALITOS_DESCBUF)); |
5211 |
+ |
5212 |
+ switch (desc_hdr & DESC_HDR_SEL0_MASK) { |
5213 |
+ case DESC_HDR_SEL0_AFEU: |
5214 |
+diff --git a/drivers/dax/super.c b/drivers/dax/super.c |
5215 |
+index edc279be3e596..cadbd0a1a1ef0 100644 |
5216 |
+--- a/drivers/dax/super.c |
5217 |
++++ b/drivers/dax/super.c |
5218 |
+@@ -752,6 +752,7 @@ err_chrdev: |
5219 |
+ |
5220 |
+ static void __exit dax_core_exit(void) |
5221 |
+ { |
5222 |
++ dax_bus_exit(); |
5223 |
+ unregister_chrdev_region(dax_devt, MINORMASK+1); |
5224 |
+ ida_destroy(&dax_minor_ida); |
5225 |
+ dax_fs_exit(); |
5226 |
+diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c |
5227 |
+index 1c8f2581cb09a..1187e5e80eded 100644 |
5228 |
+--- a/drivers/dma-buf/dma-resv.c |
5229 |
++++ b/drivers/dma-buf/dma-resv.c |
5230 |
+@@ -200,7 +200,7 @@ int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences) |
5231 |
+ max = max(old->shared_count + num_fences, |
5232 |
+ old->shared_max * 2); |
5233 |
+ } else { |
5234 |
+- max = 4; |
5235 |
++ max = max(4ul, roundup_pow_of_two(num_fences)); |
5236 |
+ } |
5237 |
+ |
5238 |
+ new = dma_resv_list_alloc(max); |
5239 |
+diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c |
5240 |
+index 2753a6b916f60..9b0d463f89bbd 100644 |
5241 |
+--- a/drivers/dma/mv_xor_v2.c |
5242 |
++++ b/drivers/dma/mv_xor_v2.c |
5243 |
+@@ -771,8 +771,10 @@ static int mv_xor_v2_probe(struct platform_device *pdev) |
5244 |
+ goto disable_clk; |
5245 |
+ |
5246 |
+ msi_desc = first_msi_entry(&pdev->dev); |
5247 |
+- if (!msi_desc) |
5248 |
++ if (!msi_desc) { |
5249 |
++ ret = -ENODEV; |
5250 |
+ goto free_msi_irqs; |
5251 |
++ } |
5252 |
+ xor_dev->msi_desc = msi_desc; |
5253 |
+ |
5254 |
+ ret = devm_request_irq(&pdev->dev, msi_desc->irq, |
5255 |
+diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c |
5256 |
+index 82cf6c77f5c93..d3902784cae24 100644 |
5257 |
+--- a/drivers/dma/ti/k3-udma.c |
5258 |
++++ b/drivers/dma/ti/k3-udma.c |
5259 |
+@@ -3201,8 +3201,7 @@ static int udma_setup_resources(struct udma_dev *ud) |
5260 |
+ } else if (UDMA_CAP3_UCHAN_CNT(cap3)) { |
5261 |
+ ud->tpl_levels = 3; |
5262 |
+ ud->tpl_start_idx[1] = UDMA_CAP3_UCHAN_CNT(cap3); |
5263 |
+- ud->tpl_start_idx[0] = ud->tpl_start_idx[1] + |
5264 |
+- UDMA_CAP3_HCHAN_CNT(cap3); |
5265 |
++ ud->tpl_start_idx[0] = UDMA_CAP3_HCHAN_CNT(cap3); |
5266 |
+ } else if (UDMA_CAP3_HCHAN_CNT(cap3)) { |
5267 |
+ ud->tpl_levels = 2; |
5268 |
+ ud->tpl_start_idx[0] = UDMA_CAP3_HCHAN_CNT(cap3); |
5269 |
+diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c |
5270 |
+index 1362274d840b9..620f7041db6b5 100644 |
5271 |
+--- a/drivers/edac/amd64_edac.c |
5272 |
++++ b/drivers/edac/amd64_edac.c |
5273 |
+@@ -18,6 +18,9 @@ static struct amd64_family_type *fam_type; |
5274 |
+ /* Per-node stuff */ |
5275 |
+ static struct ecc_settings **ecc_stngs; |
5276 |
+ |
5277 |
++/* Device for the PCI component */ |
5278 |
++static struct device *pci_ctl_dev; |
5279 |
++ |
5280 |
+ /* |
5281 |
+ * Valid scrub rates for the K8 hardware memory scrubber. We map the scrubbing |
5282 |
+ * bandwidth to a valid bit pattern. The 'set' operation finds the 'matching- |
5283 |
+@@ -2683,6 +2686,9 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) |
5284 |
+ return -ENODEV; |
5285 |
+ } |
5286 |
+ |
5287 |
++ if (!pci_ctl_dev) |
5288 |
++ pci_ctl_dev = &pvt->F0->dev; |
5289 |
++ |
5290 |
+ edac_dbg(1, "F0: %s\n", pci_name(pvt->F0)); |
5291 |
+ edac_dbg(1, "F3: %s\n", pci_name(pvt->F3)); |
5292 |
+ edac_dbg(1, "F6: %s\n", pci_name(pvt->F6)); |
5293 |
+@@ -2707,6 +2713,9 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2) |
5294 |
+ return -ENODEV; |
5295 |
+ } |
5296 |
+ |
5297 |
++ if (!pci_ctl_dev) |
5298 |
++ pci_ctl_dev = &pvt->F2->dev; |
5299 |
++ |
5300 |
+ edac_dbg(1, "F1: %s\n", pci_name(pvt->F1)); |
5301 |
+ edac_dbg(1, "F2: %s\n", pci_name(pvt->F2)); |
5302 |
+ edac_dbg(1, "F3: %s\n", pci_name(pvt->F3)); |
5303 |
+@@ -3623,21 +3632,10 @@ static void remove_one_instance(unsigned int nid) |
5304 |
+ |
5305 |
+ static void setup_pci_device(void) |
5306 |
+ { |
5307 |
+- struct mem_ctl_info *mci; |
5308 |
+- struct amd64_pvt *pvt; |
5309 |
+- |
5310 |
+ if (pci_ctl) |
5311 |
+ return; |
5312 |
+ |
5313 |
+- mci = edac_mc_find(0); |
5314 |
+- if (!mci) |
5315 |
+- return; |
5316 |
+- |
5317 |
+- pvt = mci->pvt_info; |
5318 |
+- if (pvt->umc) |
5319 |
+- pci_ctl = edac_pci_create_generic_ctl(&pvt->F0->dev, EDAC_MOD_STR); |
5320 |
+- else |
5321 |
+- pci_ctl = edac_pci_create_generic_ctl(&pvt->F2->dev, EDAC_MOD_STR); |
5322 |
++ pci_ctl = edac_pci_create_generic_ctl(pci_ctl_dev, EDAC_MOD_STR); |
5323 |
+ if (!pci_ctl) { |
5324 |
+ pr_warn("%s(): Unable to create PCI control\n", __func__); |
5325 |
+ pr_warn("%s(): PCI error report via EDAC not set\n", __func__); |
5326 |
+@@ -3716,6 +3714,8 @@ static int __init amd64_edac_init(void) |
5327 |
+ return 0; |
5328 |
+ |
5329 |
+ err_pci: |
5330 |
++ pci_ctl_dev = NULL; |
5331 |
++ |
5332 |
+ msrs_free(msrs); |
5333 |
+ msrs = NULL; |
5334 |
+ |
5335 |
+@@ -3745,6 +3745,8 @@ static void __exit amd64_edac_exit(void) |
5336 |
+ kfree(ecc_stngs); |
5337 |
+ ecc_stngs = NULL; |
5338 |
+ |
5339 |
++ pci_ctl_dev = NULL; |
5340 |
++ |
5341 |
+ msrs_free(msrs); |
5342 |
+ msrs = NULL; |
5343 |
+ } |
5344 |
+diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c |
5345 |
+index c8d11da85becf..7b52691c45d26 100644 |
5346 |
+--- a/drivers/edac/i10nm_base.c |
5347 |
++++ b/drivers/edac/i10nm_base.c |
5348 |
+@@ -6,6 +6,7 @@ |
5349 |
+ */ |
5350 |
+ |
5351 |
+ #include <linux/kernel.h> |
5352 |
++#include <linux/io.h> |
5353 |
+ #include <asm/cpu_device_id.h> |
5354 |
+ #include <asm/intel-family.h> |
5355 |
+ #include <asm/mce.h> |
5356 |
+@@ -19,14 +20,16 @@ |
5357 |
+ #define i10nm_printk(level, fmt, arg...) \ |
5358 |
+ edac_printk(level, "i10nm", fmt, ##arg) |
5359 |
+ |
5360 |
+-#define I10NM_GET_SCK_BAR(d, reg) \ |
5361 |
++#define I10NM_GET_SCK_BAR(d, reg) \ |
5362 |
+ pci_read_config_dword((d)->uracu, 0xd0, &(reg)) |
5363 |
+ #define I10NM_GET_IMC_BAR(d, i, reg) \ |
5364 |
+ pci_read_config_dword((d)->uracu, 0xd8 + (i) * 4, &(reg)) |
5365 |
+ #define I10NM_GET_DIMMMTR(m, i, j) \ |
5366 |
+- (*(u32 *)((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4)) |
5367 |
++ readl((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4) |
5368 |
+ #define I10NM_GET_MCDDRTCFG(m, i, j) \ |
5369 |
+- (*(u32 *)((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4)) |
5370 |
++ readl((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4) |
5371 |
++#define I10NM_GET_MCMTR(m, i) \ |
5372 |
++ readl((m)->mbase + 0x20ef8 + (i) * 0x4000) |
5373 |
+ |
5374 |
+ #define I10NM_GET_SCK_MMIO_BASE(reg) (GET_BITFIELD(reg, 0, 28) << 23) |
5375 |
+ #define I10NM_GET_IMC_MMIO_OFFSET(reg) (GET_BITFIELD(reg, 0, 10) << 12) |
5376 |
+@@ -148,7 +151,7 @@ static bool i10nm_check_ecc(struct skx_imc *imc, int chan) |
5377 |
+ { |
5378 |
+ u32 mcmtr; |
5379 |
+ |
5380 |
+- mcmtr = *(u32 *)(imc->mbase + 0x20ef8 + chan * 0x4000); |
5381 |
++ mcmtr = I10NM_GET_MCMTR(imc, chan); |
5382 |
+ edac_dbg(1, "ch%d mcmtr reg %x\n", chan, mcmtr); |
5383 |
+ |
5384 |
+ return !!GET_BITFIELD(mcmtr, 2, 2); |
5385 |
+diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c |
5386 |
+index 7f28edb070bd0..6c474fbef32af 100644 |
5387 |
+--- a/drivers/edac/mce_amd.c |
5388 |
++++ b/drivers/edac/mce_amd.c |
5389 |
+@@ -1003,7 +1003,7 @@ static void decode_smca_error(struct mce *m) |
5390 |
+ pr_cont(", %s.\n", smca_mce_descs[bank_type].descs[xec]); |
5391 |
+ |
5392 |
+ if (bank_type == SMCA_UMC && xec == 0 && decode_dram_ecc) |
5393 |
+- decode_dram_ecc(cpu_to_node(m->extcpu), m); |
5394 |
++ decode_dram_ecc(topology_die_id(m->extcpu), m); |
5395 |
+ } |
5396 |
+ |
5397 |
+ static inline void amd_decode_err_code(u16 ec) |
5398 |
+diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c |
5399 |
+index 4a410fd2ea9ae..92af97e00828f 100644 |
5400 |
+--- a/drivers/extcon/extcon-max77693.c |
5401 |
++++ b/drivers/extcon/extcon-max77693.c |
5402 |
+@@ -1277,4 +1277,4 @@ module_platform_driver(max77693_muic_driver); |
5403 |
+ MODULE_DESCRIPTION("Maxim MAX77693 Extcon driver"); |
5404 |
+ MODULE_AUTHOR("Chanwoo Choi <cw00.choi@×××××××.com>"); |
5405 |
+ MODULE_LICENSE("GPL"); |
5406 |
+-MODULE_ALIAS("platform:extcon-max77693"); |
5407 |
++MODULE_ALIAS("platform:max77693-muic"); |
5408 |
+diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c |
5409 |
+index ce336899d6366..66196b293b6c2 100644 |
5410 |
+--- a/drivers/firmware/arm_scmi/notify.c |
5411 |
++++ b/drivers/firmware/arm_scmi/notify.c |
5412 |
+@@ -1474,17 +1474,17 @@ int scmi_notification_init(struct scmi_handle *handle) |
5413 |
+ ni->gid = gid; |
5414 |
+ ni->handle = handle; |
5415 |
+ |
5416 |
++ ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO, |
5417 |
++ sizeof(char *), GFP_KERNEL); |
5418 |
++ if (!ni->registered_protocols) |
5419 |
++ goto err; |
5420 |
++ |
5421 |
+ ni->notify_wq = alloc_workqueue(dev_name(handle->dev), |
5422 |
+ WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS, |
5423 |
+ 0); |
5424 |
+ if (!ni->notify_wq) |
5425 |
+ goto err; |
5426 |
+ |
5427 |
+- ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO, |
5428 |
+- sizeof(char *), GFP_KERNEL); |
5429 |
+- if (!ni->registered_protocols) |
5430 |
+- goto err; |
5431 |
+- |
5432 |
+ mutex_init(&ni->pending_mtx); |
5433 |
+ hash_init(ni->pending_events_handlers); |
5434 |
+ |
5435 |
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c |
5436 |
+index 6c6eec044a978..df3f9bcab581c 100644 |
5437 |
+--- a/drivers/firmware/efi/efi.c |
5438 |
++++ b/drivers/firmware/efi/efi.c |
5439 |
+@@ -57,6 +57,7 @@ struct mm_struct efi_mm = { |
5440 |
+ .mm_rb = RB_ROOT, |
5441 |
+ .mm_users = ATOMIC_INIT(2), |
5442 |
+ .mm_count = ATOMIC_INIT(1), |
5443 |
++ .write_protect_seq = SEQCNT_ZERO(efi_mm.write_protect_seq), |
5444 |
+ MMAP_LOCK_INITIALIZER(efi_mm) |
5445 |
+ .page_table_lock = __SPIN_LOCK_UNLOCKED(efi_mm.page_table_lock), |
5446 |
+ .mmlist = LIST_HEAD_INIT(efi_mm.mmlist), |
5447 |
+diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c |
5448 |
+index c1bbba9ee93a3..440d99c63638b 100644 |
5449 |
+--- a/drivers/firmware/tegra/bpmp-debugfs.c |
5450 |
++++ b/drivers/firmware/tegra/bpmp-debugfs.c |
5451 |
+@@ -412,16 +412,12 @@ static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp, |
5452 |
+ goto out; |
5453 |
+ } |
5454 |
+ |
5455 |
+- len = strlen(ppath) + strlen(name) + 1; |
5456 |
++ len = snprintf(pathbuf, pathlen, "%s%s/", ppath, name); |
5457 |
+ if (len >= pathlen) { |
5458 |
+ err = -EINVAL; |
5459 |
+ goto out; |
5460 |
+ } |
5461 |
+ |
5462 |
+- strncpy(pathbuf, ppath, pathlen); |
5463 |
+- strncat(pathbuf, name, strlen(name)); |
5464 |
+- strcat(pathbuf, "/"); |
5465 |
+- |
5466 |
+ err = bpmp_populate_debugfs_inband(bpmp, dentry, |
5467 |
+ pathbuf); |
5468 |
+ if (err < 0) |
5469 |
+diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c |
5470 |
+index c006ec008a1aa..90dbe58ca1edc 100644 |
5471 |
+--- a/drivers/fsi/fsi-master-aspeed.c |
5472 |
++++ b/drivers/fsi/fsi-master-aspeed.c |
5473 |
+@@ -8,6 +8,7 @@ |
5474 |
+ #include <linux/io.h> |
5475 |
+ #include <linux/mfd/syscon.h> |
5476 |
+ #include <linux/module.h> |
5477 |
++#include <linux/mutex.h> |
5478 |
+ #include <linux/of.h> |
5479 |
+ #include <linux/platform_device.h> |
5480 |
+ #include <linux/regmap.h> |
5481 |
+@@ -19,6 +20,7 @@ |
5482 |
+ |
5483 |
+ struct fsi_master_aspeed { |
5484 |
+ struct fsi_master master; |
5485 |
++ struct mutex lock; /* protect HW access */ |
5486 |
+ struct device *dev; |
5487 |
+ void __iomem *base; |
5488 |
+ struct clk *clk; |
5489 |
+@@ -254,6 +256,8 @@ static int aspeed_master_read(struct fsi_master *master, int link, |
5490 |
+ addr |= id << 21; |
5491 |
+ addr += link * FSI_HUB_LINK_SIZE; |
5492 |
+ |
5493 |
++ mutex_lock(&aspeed->lock); |
5494 |
++ |
5495 |
+ switch (size) { |
5496 |
+ case 1: |
5497 |
+ ret = opb_readb(aspeed, fsi_base + addr, val); |
5498 |
+@@ -265,14 +269,14 @@ static int aspeed_master_read(struct fsi_master *master, int link, |
5499 |
+ ret = opb_readl(aspeed, fsi_base + addr, val); |
5500 |
+ break; |
5501 |
+ default: |
5502 |
+- return -EINVAL; |
5503 |
++ ret = -EINVAL; |
5504 |
++ goto done; |
5505 |
+ } |
5506 |
+ |
5507 |
+ ret = check_errors(aspeed, ret); |
5508 |
+- if (ret) |
5509 |
+- return ret; |
5510 |
+- |
5511 |
+- return 0; |
5512 |
++done: |
5513 |
++ mutex_unlock(&aspeed->lock); |
5514 |
++ return ret; |
5515 |
+ } |
5516 |
+ |
5517 |
+ static int aspeed_master_write(struct fsi_master *master, int link, |
5518 |
+@@ -287,6 +291,8 @@ static int aspeed_master_write(struct fsi_master *master, int link, |
5519 |
+ addr |= id << 21; |
5520 |
+ addr += link * FSI_HUB_LINK_SIZE; |
5521 |
+ |
5522 |
++ mutex_lock(&aspeed->lock); |
5523 |
++ |
5524 |
+ switch (size) { |
5525 |
+ case 1: |
5526 |
+ ret = opb_writeb(aspeed, fsi_base + addr, *(u8 *)val); |
5527 |
+@@ -298,14 +304,14 @@ static int aspeed_master_write(struct fsi_master *master, int link, |
5528 |
+ ret = opb_writel(aspeed, fsi_base + addr, *(__be32 *)val); |
5529 |
+ break; |
5530 |
+ default: |
5531 |
+- return -EINVAL; |
5532 |
++ ret = -EINVAL; |
5533 |
++ goto done; |
5534 |
+ } |
5535 |
+ |
5536 |
+ ret = check_errors(aspeed, ret); |
5537 |
+- if (ret) |
5538 |
+- return ret; |
5539 |
+- |
5540 |
+- return 0; |
5541 |
++done: |
5542 |
++ mutex_unlock(&aspeed->lock); |
5543 |
++ return ret; |
5544 |
+ } |
5545 |
+ |
5546 |
+ static int aspeed_master_link_enable(struct fsi_master *master, int link, |
5547 |
+@@ -320,17 +326,21 @@ static int aspeed_master_link_enable(struct fsi_master *master, int link, |
5548 |
+ |
5549 |
+ reg = cpu_to_be32(0x80000000 >> bit); |
5550 |
+ |
5551 |
+- if (!enable) |
5552 |
+- return opb_writel(aspeed, ctrl_base + FSI_MCENP0 + (4 * idx), |
5553 |
+- reg); |
5554 |
++ mutex_lock(&aspeed->lock); |
5555 |
++ |
5556 |
++ if (!enable) { |
5557 |
++ ret = opb_writel(aspeed, ctrl_base + FSI_MCENP0 + (4 * idx), reg); |
5558 |
++ goto done; |
5559 |
++ } |
5560 |
+ |
5561 |
+ ret = opb_writel(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), reg); |
5562 |
+ if (ret) |
5563 |
+- return ret; |
5564 |
++ goto done; |
5565 |
+ |
5566 |
+ mdelay(FSI_LINK_ENABLE_SETUP_TIME); |
5567 |
+- |
5568 |
+- return 0; |
5569 |
++done: |
5570 |
++ mutex_unlock(&aspeed->lock); |
5571 |
++ return ret; |
5572 |
+ } |
5573 |
+ |
5574 |
+ static int aspeed_master_term(struct fsi_master *master, int link, uint8_t id) |
5575 |
+@@ -431,9 +441,11 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *att |
5576 |
+ { |
5577 |
+ struct fsi_master_aspeed *aspeed = dev_get_drvdata(dev); |
5578 |
+ |
5579 |
++ mutex_lock(&aspeed->lock); |
5580 |
+ gpiod_set_value(aspeed->cfam_reset_gpio, 1); |
5581 |
+ usleep_range(900, 1000); |
5582 |
+ gpiod_set_value(aspeed->cfam_reset_gpio, 0); |
5583 |
++ mutex_unlock(&aspeed->lock); |
5584 |
+ |
5585 |
+ return count; |
5586 |
+ } |
5587 |
+@@ -597,6 +609,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) |
5588 |
+ |
5589 |
+ dev_set_drvdata(&pdev->dev, aspeed); |
5590 |
+ |
5591 |
++ mutex_init(&aspeed->lock); |
5592 |
+ aspeed_master_init(aspeed); |
5593 |
+ |
5594 |
+ rc = fsi_master_register(&aspeed->master); |
5595 |
+diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c |
5596 |
+index 6e3c4d7a7d146..4ad3c4b276dcf 100644 |
5597 |
+--- a/drivers/gpio/gpiolib.c |
5598 |
++++ b/drivers/gpio/gpiolib.c |
5599 |
+@@ -1477,7 +1477,8 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc) |
5600 |
+ if (WARN_ON(gc->irq.irq_enable)) |
5601 |
+ return; |
5602 |
+ /* Check if the irqchip already has this hook... */ |
5603 |
+- if (irqchip->irq_enable == gpiochip_irq_enable) { |
5604 |
++ if (irqchip->irq_enable == gpiochip_irq_enable || |
5605 |
++ irqchip->irq_mask == gpiochip_irq_mask) { |
5606 |
+ /* |
5607 |
+ * ...and if so, give a gentle warning that this is bad |
5608 |
+ * practice. |
5609 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
5610 |
+index 65d1b23d7e746..b9c11c2b2885a 100644 |
5611 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
5612 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
5613 |
+@@ -1414,10 +1414,12 @@ out: |
5614 |
+ pm_runtime_put_autosuspend(connector->dev->dev); |
5615 |
+ } |
5616 |
+ |
5617 |
+- drm_dp_set_subconnector_property(&amdgpu_connector->base, |
5618 |
+- ret, |
5619 |
+- amdgpu_dig_connector->dpcd, |
5620 |
+- amdgpu_dig_connector->downstream_ports); |
5621 |
++ if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
5622 |
++ connector->connector_type == DRM_MODE_CONNECTOR_eDP) |
5623 |
++ drm_dp_set_subconnector_property(&amdgpu_connector->base, |
5624 |
++ ret, |
5625 |
++ amdgpu_dig_connector->dpcd, |
5626 |
++ amdgpu_dig_connector->downstream_ports); |
5627 |
+ return ret; |
5628 |
+ } |
5629 |
+ |
5630 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
5631 |
+index 8c9bacfdbc300..c485ec86804e5 100644 |
5632 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
5633 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
5634 |
+@@ -193,10 +193,14 @@ static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev) |
5635 |
+ } |
5636 |
+ |
5637 |
+ bool amdgpu_gfx_is_high_priority_compute_queue(struct amdgpu_device *adev, |
5638 |
+- int queue) |
5639 |
++ int pipe, int queue) |
5640 |
+ { |
5641 |
+- /* Policy: make queue 0 of each pipe as high priority compute queue */ |
5642 |
+- return (queue == 0); |
5643 |
++ bool multipipe_policy = amdgpu_gfx_is_multipipe_capable(adev); |
5644 |
++ int cond; |
5645 |
++ /* Policy: alternate between normal and high priority */ |
5646 |
++ cond = multipipe_policy ? pipe : queue; |
5647 |
++ |
5648 |
++ return ((cond % 2) != 0); |
5649 |
+ |
5650 |
+ } |
5651 |
+ |
5652 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |
5653 |
+index 258498cbf1eba..f353a5b71804e 100644 |
5654 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |
5655 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |
5656 |
+@@ -373,7 +373,7 @@ void amdgpu_queue_mask_bit_to_mec_queue(struct amdgpu_device *adev, int bit, |
5657 |
+ bool amdgpu_gfx_is_mec_queue_enabled(struct amdgpu_device *adev, int mec, |
5658 |
+ int pipe, int queue); |
5659 |
+ bool amdgpu_gfx_is_high_priority_compute_queue(struct amdgpu_device *adev, |
5660 |
+- int queue); |
5661 |
++ int pipe, int queue); |
5662 |
+ int amdgpu_gfx_me_queue_to_bit(struct amdgpu_device *adev, int me, |
5663 |
+ int pipe, int queue); |
5664 |
+ void amdgpu_gfx_bit_to_me_queue(struct amdgpu_device *adev, int bit, |
5665 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c |
5666 |
+index 3e4892b7b7d3c..ff4e226739308 100644 |
5667 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c |
5668 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c |
5669 |
+@@ -494,13 +494,14 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) |
5670 |
+ break; |
5671 |
+ } |
5672 |
+ |
5673 |
+- if (!amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE)) |
5674 |
++ if (!amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE)) { |
5675 |
+ size = 0; |
5676 |
+- else |
5677 |
++ } else { |
5678 |
+ size = amdgpu_gmc_get_vbios_fb_size(adev); |
5679 |
+ |
5680 |
+- if (adev->mman.keep_stolen_vga_memory) |
5681 |
+- size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION); |
5682 |
++ if (adev->mman.keep_stolen_vga_memory) |
5683 |
++ size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION); |
5684 |
++ } |
5685 |
+ |
5686 |
+ /* set to 0 if the pre-OS buffer uses up most of vram */ |
5687 |
+ if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024)) |
5688 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
5689 |
+index 55f4b8c3b9338..4ebb43e090999 100644 |
5690 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
5691 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
5692 |
+@@ -4334,7 +4334,8 @@ static int gfx_v10_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, |
5693 |
+ irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP |
5694 |
+ + ((ring->me - 1) * adev->gfx.mec.num_pipe_per_mec) |
5695 |
+ + ring->pipe; |
5696 |
+- hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue) ? |
5697 |
++ hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe, |
5698 |
++ ring->queue) ? |
5699 |
+ AMDGPU_GFX_PIPE_PRIO_HIGH : AMDGPU_GFX_PIPE_PRIO_NORMAL; |
5700 |
+ /* type-2 packets are deprecated on MEC, use type-3 instead */ |
5701 |
+ r = amdgpu_ring_init(adev, ring, 1024, |
5702 |
+@@ -6360,7 +6361,8 @@ static void gfx_v10_0_compute_mqd_set_priority(struct amdgpu_ring *ring, struct |
5703 |
+ struct amdgpu_device *adev = ring->adev; |
5704 |
+ |
5705 |
+ if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) { |
5706 |
+- if (amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue)) { |
5707 |
++ if (amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe, |
5708 |
++ ring->queue)) { |
5709 |
+ mqd->cp_hqd_pipe_priority = AMDGPU_GFX_PIPE_PRIO_HIGH; |
5710 |
+ mqd->cp_hqd_queue_priority = |
5711 |
+ AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM; |
5712 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
5713 |
+index 94b7e0531d092..c36258d56b445 100644 |
5714 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
5715 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
5716 |
+@@ -1915,7 +1915,8 @@ static int gfx_v8_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, |
5717 |
+ + ((ring->me - 1) * adev->gfx.mec.num_pipe_per_mec) |
5718 |
+ + ring->pipe; |
5719 |
+ |
5720 |
+- hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue) ? |
5721 |
++ hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe, |
5722 |
++ ring->queue) ? |
5723 |
+ AMDGPU_GFX_PIPE_PRIO_HIGH : AMDGPU_RING_PRIO_DEFAULT; |
5724 |
+ /* type-2 packets are deprecated on MEC, use type-3 instead */ |
5725 |
+ r = amdgpu_ring_init(adev, ring, 1024, |
5726 |
+@@ -4433,7 +4434,8 @@ static void gfx_v8_0_mqd_set_priority(struct amdgpu_ring *ring, struct vi_mqd *m |
5727 |
+ struct amdgpu_device *adev = ring->adev; |
5728 |
+ |
5729 |
+ if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) { |
5730 |
+- if (amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue)) { |
5731 |
++ if (amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe, |
5732 |
++ ring->queue)) { |
5733 |
+ mqd->cp_hqd_pipe_priority = AMDGPU_GFX_PIPE_PRIO_HIGH; |
5734 |
+ mqd->cp_hqd_queue_priority = |
5735 |
+ AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM; |
5736 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
5737 |
+index 0d8e203b10efb..957c12b727676 100644 |
5738 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
5739 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |
5740 |
+@@ -2228,7 +2228,8 @@ static int gfx_v9_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, |
5741 |
+ irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP |
5742 |
+ + ((ring->me - 1) * adev->gfx.mec.num_pipe_per_mec) |
5743 |
+ + ring->pipe; |
5744 |
+- hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue) ? |
5745 |
++ hw_prio = amdgpu_gfx_is_high_priority_compute_queue(adev, ring->pipe, |
5746 |
++ ring->queue) ? |
5747 |
+ AMDGPU_GFX_PIPE_PRIO_HIGH : AMDGPU_GFX_PIPE_PRIO_NORMAL; |
5748 |
+ /* type-2 packets are deprecated on MEC, use type-3 instead */ |
5749 |
+ return amdgpu_ring_init(adev, ring, 1024, |
5750 |
+@@ -3383,7 +3384,9 @@ static void gfx_v9_0_mqd_set_priority(struct amdgpu_ring *ring, struct v9_mqd *m |
5751 |
+ struct amdgpu_device *adev = ring->adev; |
5752 |
+ |
5753 |
+ if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) { |
5754 |
+- if (amdgpu_gfx_is_high_priority_compute_queue(adev, ring->queue)) { |
5755 |
++ if (amdgpu_gfx_is_high_priority_compute_queue(adev, |
5756 |
++ ring->pipe, |
5757 |
++ ring->queue)) { |
5758 |
+ mqd->cp_hqd_pipe_priority = AMDGPU_GFX_PIPE_PRIO_HIGH; |
5759 |
+ mqd->cp_hqd_queue_priority = |
5760 |
+ AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM; |
5761 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c |
5762 |
+index 3de5e14c5ae31..d7f67620f57ba 100644 |
5763 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c |
5764 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c |
5765 |
+@@ -774,6 +774,7 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size) |
5766 |
+ struct acpi_table_header *crat_table; |
5767 |
+ acpi_status status; |
5768 |
+ void *pcrat_image; |
5769 |
++ int rc = 0; |
5770 |
+ |
5771 |
+ if (!crat_image) |
5772 |
+ return -EINVAL; |
5773 |
+@@ -798,14 +799,17 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size) |
5774 |
+ } |
5775 |
+ |
5776 |
+ pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL); |
5777 |
+- if (!pcrat_image) |
5778 |
+- return -ENOMEM; |
5779 |
++ if (!pcrat_image) { |
5780 |
++ rc = -ENOMEM; |
5781 |
++ goto out; |
5782 |
++ } |
5783 |
+ |
5784 |
+ memcpy(pcrat_image, crat_table, crat_table->length); |
5785 |
+ *crat_image = pcrat_image; |
5786 |
+ *size = crat_table->length; |
5787 |
+- |
5788 |
+- return 0; |
5789 |
++out: |
5790 |
++ acpi_put_table(crat_table); |
5791 |
++ return rc; |
5792 |
+ } |
5793 |
+ |
5794 |
+ /* Memory required to create Virtual CRAT. |
5795 |
+@@ -988,6 +992,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) |
5796 |
+ CRAT_OEMID_LENGTH); |
5797 |
+ memcpy(crat_table->oem_table_id, acpi_table->oem_table_id, |
5798 |
+ CRAT_OEMTABLEID_LENGTH); |
5799 |
++ acpi_put_table(acpi_table); |
5800 |
+ } |
5801 |
+ crat_table->total_entries = 0; |
5802 |
+ crat_table->num_domains = 0; |
5803 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5804 |
+index 0f7749e9424d4..30c6b9edddb50 100644 |
5805 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5806 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5807 |
+@@ -2278,7 +2278,8 @@ void amdgpu_dm_update_connector_after_detect( |
5808 |
+ |
5809 |
+ drm_connector_update_edid_property(connector, |
5810 |
+ aconnector->edid); |
5811 |
+- drm_add_edid_modes(connector, aconnector->edid); |
5812 |
++ aconnector->num_modes = drm_add_edid_modes(connector, aconnector->edid); |
5813 |
++ drm_connector_list_update(connector); |
5814 |
+ |
5815 |
+ if (aconnector->dc_link->aux_mode) |
5816 |
+ drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux, |
5817 |
+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 |
5818 |
+index ff1e9963ec7a2..98464886341f6 100644 |
5819 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
5820 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c |
5821 |
+@@ -4230,7 +4230,7 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) |
5822 |
+ |
5823 |
+ if (edp_config_set.bits.PANEL_MODE_EDP |
5824 |
+ != panel_mode_edp) { |
5825 |
+- enum ddc_result result = DDC_RESULT_UNKNOWN; |
5826 |
++ enum dc_status result = DC_ERROR_UNEXPECTED; |
5827 |
+ |
5828 |
+ edp_config_set.bits.PANEL_MODE_EDP = |
5829 |
+ panel_mode_edp; |
5830 |
+@@ -4240,7 +4240,7 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) |
5831 |
+ &edp_config_set.raw, |
5832 |
+ sizeof(edp_config_set.raw)); |
5833 |
+ |
5834 |
+- ASSERT(result == DDC_RESULT_SUCESSFULL); |
5835 |
++ ASSERT(result == DC_OK); |
5836 |
+ } |
5837 |
+ } |
5838 |
+ DC_LOG_DETECTION_DP_CAPS("Link: %d eDP panel mode supported: %d " |
5839 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5840 |
+index b8695660b480e..09bc2c249e1af 100644 |
5841 |
+--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5842 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5843 |
+@@ -1614,7 +1614,7 @@ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma |
5844 |
+ struct pwl_float_data_ex *rgb = rgb_regamma; |
5845 |
+ const struct hw_x_point *coord_x = coordinates_x; |
5846 |
+ |
5847 |
+- build_coefficients(&coeff, true); |
5848 |
++ build_coefficients(&coeff, TRANSFER_FUNCTION_SRGB); |
5849 |
+ |
5850 |
+ i = 0; |
5851 |
+ while (i != hw_points_num + 1) { |
5852 |
+diff --git a/drivers/gpu/drm/aspeed/Kconfig b/drivers/gpu/drm/aspeed/Kconfig |
5853 |
+index 018383cfcfa79..5e95bcea43e92 100644 |
5854 |
+--- a/drivers/gpu/drm/aspeed/Kconfig |
5855 |
++++ b/drivers/gpu/drm/aspeed/Kconfig |
5856 |
+@@ -3,6 +3,7 @@ config DRM_ASPEED_GFX |
5857 |
+ tristate "ASPEED BMC Display Controller" |
5858 |
+ depends on DRM && OF |
5859 |
+ depends on (COMPILE_TEST || ARCH_ASPEED) |
5860 |
++ depends on MMU |
5861 |
+ select DRM_KMS_HELPER |
5862 |
+ select DRM_KMS_CMA_HELPER |
5863 |
+ select DMA_CMA if HAVE_DMA_CONTIGUOUS |
5864 |
+diff --git a/drivers/gpu/drm/bridge/ti-tpd12s015.c b/drivers/gpu/drm/bridge/ti-tpd12s015.c |
5865 |
+index 514cbf0eac75a..e0e015243a602 100644 |
5866 |
+--- a/drivers/gpu/drm/bridge/ti-tpd12s015.c |
5867 |
++++ b/drivers/gpu/drm/bridge/ti-tpd12s015.c |
5868 |
+@@ -160,7 +160,7 @@ static int tpd12s015_probe(struct platform_device *pdev) |
5869 |
+ |
5870 |
+ /* Register the IRQ if the HPD GPIO is IRQ-capable. */ |
5871 |
+ tpd->hpd_irq = gpiod_to_irq(tpd->hpd_gpio); |
5872 |
+- if (tpd->hpd_irq) { |
5873 |
++ if (tpd->hpd_irq >= 0) { |
5874 |
+ ret = devm_request_threaded_irq(&pdev->dev, tpd->hpd_irq, NULL, |
5875 |
+ tpd12s015_hpd_isr, |
5876 |
+ IRQF_TRIGGER_RISING | |
5877 |
+diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c |
5878 |
+index 2510717d5a08f..e25181bf2c480 100644 |
5879 |
+--- a/drivers/gpu/drm/drm_dp_aux_dev.c |
5880 |
++++ b/drivers/gpu/drm/drm_dp_aux_dev.c |
5881 |
+@@ -63,7 +63,7 @@ static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index) |
5882 |
+ |
5883 |
+ mutex_lock(&aux_idr_mutex); |
5884 |
+ aux_dev = idr_find(&aux_idr, index); |
5885 |
+- if (!kref_get_unless_zero(&aux_dev->refcount)) |
5886 |
++ if (aux_dev && !kref_get_unless_zero(&aux_dev->refcount)) |
5887 |
+ aux_dev = NULL; |
5888 |
+ mutex_unlock(&aux_idr_mutex); |
5889 |
+ |
5890 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
5891 |
+index 631125b46e04c..b7ddf504e0249 100644 |
5892 |
+--- a/drivers/gpu/drm/drm_edid.c |
5893 |
++++ b/drivers/gpu/drm/drm_edid.c |
5894 |
+@@ -3102,6 +3102,8 @@ static int drm_cvt_modes(struct drm_connector *connector, |
5895 |
+ |
5896 |
+ height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; |
5897 |
+ switch (cvt->code[1] & 0x0c) { |
5898 |
++ /* default - because compiler doesn't see that we've enumerated all cases */ |
5899 |
++ default: |
5900 |
+ case 0x00: |
5901 |
+ width = height * 4 / 3; |
5902 |
+ break; |
5903 |
+diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c |
5904 |
+index 720a767118c9c..deb4fd13591d2 100644 |
5905 |
+--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c |
5906 |
++++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c |
5907 |
+@@ -2083,7 +2083,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev |
5908 |
+ DRM_INFO("failed to retrieve link info, disabling eDP\n"); |
5909 |
+ drm_encoder_cleanup(encoder); |
5910 |
+ cdv_intel_dp_destroy(connector); |
5911 |
+- goto err_priv; |
5912 |
++ goto err_connector; |
5913 |
+ } else { |
5914 |
+ DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n", |
5915 |
+ intel_dp->dpcd[0], intel_dp->dpcd[1], |
5916 |
+diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |
5917 |
+index b07dc1156a0e6..bcc80f428172b 100644 |
5918 |
+--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |
5919 |
++++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |
5920 |
+@@ -382,7 +382,7 @@ eb_vma_misplaced(const struct drm_i915_gem_exec_object2 *entry, |
5921 |
+ return true; |
5922 |
+ |
5923 |
+ if (!(flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) && |
5924 |
+- (vma->node.start + vma->node.size - 1) >> 32) |
5925 |
++ (vma->node.start + vma->node.size + 4095) >> 32) |
5926 |
+ return true; |
5927 |
+ |
5928 |
+ if (flags & __EXEC_OBJECT_NEEDS_MAP && |
5929 |
+diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c b/drivers/gpu/drm/imx/dcss/dcss-plane.c |
5930 |
+index 961d671f171b4..f54087ac44d35 100644 |
5931 |
+--- a/drivers/gpu/drm/imx/dcss/dcss-plane.c |
5932 |
++++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c |
5933 |
+@@ -111,7 +111,8 @@ static bool dcss_plane_can_rotate(const struct drm_format_info *format, |
5934 |
+ supported_rotation = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 | |
5935 |
+ DRM_MODE_REFLECT_MASK; |
5936 |
+ else if (!format->is_yuv && |
5937 |
+- modifier == DRM_FORMAT_MOD_VIVANTE_TILED) |
5938 |
++ (modifier == DRM_FORMAT_MOD_VIVANTE_TILED || |
5939 |
++ modifier == DRM_FORMAT_MOD_VIVANTE_SUPER_TILED)) |
5940 |
+ supported_rotation = DRM_MODE_ROTATE_MASK | |
5941 |
+ DRM_MODE_REFLECT_MASK; |
5942 |
+ else if (format->is_yuv && linear_format && |
5943 |
+@@ -273,6 +274,7 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, |
5944 |
+ u32 src_w, src_h, dst_w, dst_h; |
5945 |
+ struct drm_rect src, dst; |
5946 |
+ bool enable = true; |
5947 |
++ bool is_rotation_90_or_270; |
5948 |
+ |
5949 |
+ if (!fb || !state->crtc || !state->visible) |
5950 |
+ return; |
5951 |
+@@ -311,8 +313,13 @@ static void dcss_plane_atomic_update(struct drm_plane *plane, |
5952 |
+ |
5953 |
+ dcss_plane_atomic_set_base(dcss_plane); |
5954 |
+ |
5955 |
++ is_rotation_90_or_270 = state->rotation & (DRM_MODE_ROTATE_90 | |
5956 |
++ DRM_MODE_ROTATE_270); |
5957 |
++ |
5958 |
+ dcss_scaler_setup(dcss->scaler, dcss_plane->ch_num, |
5959 |
+- state->fb->format, src_w, src_h, |
5960 |
++ state->fb->format, |
5961 |
++ is_rotation_90_or_270 ? src_h : src_w, |
5962 |
++ is_rotation_90_or_270 ? src_w : src_h, |
5963 |
+ dst_w, dst_h, |
5964 |
+ drm_mode_vrefresh(&crtc_state->mode)); |
5965 |
+ |
5966 |
+diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c |
5967 |
+index 92f8bd907193f..210f5e1630081 100644 |
5968 |
+--- a/drivers/gpu/drm/mcde/mcde_drv.c |
5969 |
++++ b/drivers/gpu/drm/mcde/mcde_drv.c |
5970 |
+@@ -331,8 +331,8 @@ static int mcde_probe(struct platform_device *pdev) |
5971 |
+ } |
5972 |
+ |
5973 |
+ irq = platform_get_irq(pdev, 0); |
5974 |
+- if (!irq) { |
5975 |
+- ret = -EINVAL; |
5976 |
++ if (irq < 0) { |
5977 |
++ ret = irq; |
5978 |
+ goto clk_disable; |
5979 |
+ } |
5980 |
+ |
5981 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |
5982 |
+index 8eba44be3a8ae..3064eac1a7507 100644 |
5983 |
+--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |
5984 |
++++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |
5985 |
+@@ -359,7 +359,7 @@ static const struct mtk_ddp_comp_funcs ddp_ufoe = { |
5986 |
+ |
5987 |
+ static const char * const mtk_ddp_comp_stem[MTK_DDP_COMP_TYPE_MAX] = { |
5988 |
+ [MTK_DISP_OVL] = "ovl", |
5989 |
+- [MTK_DISP_OVL_2L] = "ovl_2l", |
5990 |
++ [MTK_DISP_OVL_2L] = "ovl-2l", |
5991 |
+ [MTK_DISP_RDMA] = "rdma", |
5992 |
+ [MTK_DISP_WDMA] = "wdma", |
5993 |
+ [MTK_DISP_COLOR] = "color", |
5994 |
+diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c |
5995 |
+index 8b9c8dd788c41..3d1de9cbb1c8d 100644 |
5996 |
+--- a/drivers/gpu/drm/meson/meson_drv.c |
5997 |
++++ b/drivers/gpu/drm/meson/meson_drv.c |
5998 |
+@@ -389,15 +389,17 @@ static void meson_drv_unbind(struct device *dev) |
5999 |
+ meson_canvas_free(priv->canvas, priv->canvas_id_vd1_2); |
6000 |
+ } |
6001 |
+ |
6002 |
++ drm_dev_unregister(drm); |
6003 |
++ drm_kms_helper_poll_fini(drm); |
6004 |
++ drm_atomic_helper_shutdown(drm); |
6005 |
++ component_unbind_all(dev, drm); |
6006 |
++ drm_irq_uninstall(drm); |
6007 |
++ drm_dev_put(drm); |
6008 |
++ |
6009 |
+ if (priv->afbcd.ops) { |
6010 |
+ priv->afbcd.ops->reset(priv); |
6011 |
+ meson_rdma_free(priv); |
6012 |
+ } |
6013 |
+- |
6014 |
+- drm_dev_unregister(drm); |
6015 |
+- drm_irq_uninstall(drm); |
6016 |
+- drm_kms_helper_poll_fini(drm); |
6017 |
+- drm_dev_put(drm); |
6018 |
+ } |
6019 |
+ |
6020 |
+ static const struct component_master_ops meson_drv_master_ops = { |
6021 |
+diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c |
6022 |
+index 29a8ff41595d2..aad75a22dc338 100644 |
6023 |
+--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c |
6024 |
++++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c |
6025 |
+@@ -145,8 +145,6 @@ struct meson_dw_hdmi { |
6026 |
+ struct reset_control *hdmitx_apb; |
6027 |
+ struct reset_control *hdmitx_ctrl; |
6028 |
+ struct reset_control *hdmitx_phy; |
6029 |
+- struct clk *hdmi_pclk; |
6030 |
+- struct clk *venci_clk; |
6031 |
+ struct regulator *hdmi_supply; |
6032 |
+ u32 irq_stat; |
6033 |
+ struct dw_hdmi *hdmi; |
6034 |
+@@ -941,6 +939,34 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) |
6035 |
+ |
6036 |
+ } |
6037 |
+ |
6038 |
++static void meson_disable_regulator(void *data) |
6039 |
++{ |
6040 |
++ regulator_disable(data); |
6041 |
++} |
6042 |
++ |
6043 |
++static void meson_disable_clk(void *data) |
6044 |
++{ |
6045 |
++ clk_disable_unprepare(data); |
6046 |
++} |
6047 |
++ |
6048 |
++static int meson_enable_clk(struct device *dev, char *name) |
6049 |
++{ |
6050 |
++ struct clk *clk; |
6051 |
++ int ret; |
6052 |
++ |
6053 |
++ clk = devm_clk_get(dev, name); |
6054 |
++ if (IS_ERR(clk)) { |
6055 |
++ dev_err(dev, "Unable to get %s pclk\n", name); |
6056 |
++ return PTR_ERR(clk); |
6057 |
++ } |
6058 |
++ |
6059 |
++ ret = clk_prepare_enable(clk); |
6060 |
++ if (!ret) |
6061 |
++ ret = devm_add_action_or_reset(dev, meson_disable_clk, clk); |
6062 |
++ |
6063 |
++ return ret; |
6064 |
++} |
6065 |
++ |
6066 |
+ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, |
6067 |
+ void *data) |
6068 |
+ { |
6069 |
+@@ -989,6 +1015,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, |
6070 |
+ ret = regulator_enable(meson_dw_hdmi->hdmi_supply); |
6071 |
+ if (ret) |
6072 |
+ return ret; |
6073 |
++ ret = devm_add_action_or_reset(dev, meson_disable_regulator, |
6074 |
++ meson_dw_hdmi->hdmi_supply); |
6075 |
++ if (ret) |
6076 |
++ return ret; |
6077 |
+ } |
6078 |
+ |
6079 |
+ meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, |
6080 |
+@@ -1017,19 +1047,17 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, |
6081 |
+ if (IS_ERR(meson_dw_hdmi->hdmitx)) |
6082 |
+ return PTR_ERR(meson_dw_hdmi->hdmitx); |
6083 |
+ |
6084 |
+- meson_dw_hdmi->hdmi_pclk = devm_clk_get(dev, "isfr"); |
6085 |
+- if (IS_ERR(meson_dw_hdmi->hdmi_pclk)) { |
6086 |
+- dev_err(dev, "Unable to get HDMI pclk\n"); |
6087 |
+- return PTR_ERR(meson_dw_hdmi->hdmi_pclk); |
6088 |
+- } |
6089 |
+- clk_prepare_enable(meson_dw_hdmi->hdmi_pclk); |
6090 |
++ ret = meson_enable_clk(dev, "isfr"); |
6091 |
++ if (ret) |
6092 |
++ return ret; |
6093 |
+ |
6094 |
+- meson_dw_hdmi->venci_clk = devm_clk_get(dev, "venci"); |
6095 |
+- if (IS_ERR(meson_dw_hdmi->venci_clk)) { |
6096 |
+- dev_err(dev, "Unable to get venci clk\n"); |
6097 |
+- return PTR_ERR(meson_dw_hdmi->venci_clk); |
6098 |
+- } |
6099 |
+- clk_prepare_enable(meson_dw_hdmi->venci_clk); |
6100 |
++ ret = meson_enable_clk(dev, "iahb"); |
6101 |
++ if (ret) |
6102 |
++ return ret; |
6103 |
++ |
6104 |
++ ret = meson_enable_clk(dev, "venci"); |
6105 |
++ if (ret) |
6106 |
++ return ret; |
6107 |
+ |
6108 |
+ dw_plat_data->regm = devm_regmap_init(dev, NULL, meson_dw_hdmi, |
6109 |
+ &meson_dw_hdmi_regmap_config); |
6110 |
+@@ -1062,10 +1090,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, |
6111 |
+ |
6112 |
+ encoder->possible_crtcs = BIT(0); |
6113 |
+ |
6114 |
+- DRM_DEBUG_DRIVER("encoder initialized\n"); |
6115 |
+- |
6116 |
+ meson_dw_hdmi_init(meson_dw_hdmi); |
6117 |
+ |
6118 |
++ DRM_DEBUG_DRIVER("encoder initialized\n"); |
6119 |
++ |
6120 |
+ /* Bridge / Connector */ |
6121 |
+ |
6122 |
+ dw_plat_data->priv_data = meson_dw_hdmi; |
6123 |
+diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig |
6124 |
+index e5816b4984942..dabb4a1ccdcf7 100644 |
6125 |
+--- a/drivers/gpu/drm/msm/Kconfig |
6126 |
++++ b/drivers/gpu/drm/msm/Kconfig |
6127 |
+@@ -4,8 +4,8 @@ config DRM_MSM |
6128 |
+ tristate "MSM DRM" |
6129 |
+ depends on DRM |
6130 |
+ depends on ARCH_QCOM || SOC_IMX5 || (ARM && COMPILE_TEST) |
6131 |
++ depends on IOMMU_SUPPORT |
6132 |
+ depends on OF && COMMON_CLK |
6133 |
+- depends on MMU |
6134 |
+ depends on QCOM_OCMEM || QCOM_OCMEM=n |
6135 |
+ select IOMMU_IO_PGTABLE |
6136 |
+ select QCOM_MDT_LOADER if ARCH_QCOM |
6137 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6138 |
+index d6804a8023555..69ed2c6094665 100644 |
6139 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6140 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6141 |
+@@ -755,12 +755,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu) |
6142 |
+ gpu_write(gpu, REG_A5XX_CP_RB_CNTL, |
6143 |
+ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); |
6144 |
+ |
6145 |
+- /* Disable preemption if WHERE_AM_I isn't available */ |
6146 |
+- if (!a5xx_gpu->has_whereami && gpu->nr_rings > 1) { |
6147 |
+- a5xx_preempt_fini(gpu); |
6148 |
+- gpu->nr_rings = 1; |
6149 |
+- } else { |
6150 |
+- /* Create a privileged buffer for the RPTR shadow */ |
6151 |
++ /* Create a privileged buffer for the RPTR shadow */ |
6152 |
++ if (a5xx_gpu->has_whereami) { |
6153 |
+ if (!a5xx_gpu->shadow_bo) { |
6154 |
+ a5xx_gpu->shadow = msm_gem_kernel_new(gpu->dev, |
6155 |
+ sizeof(u32) * gpu->nr_rings, |
6156 |
+@@ -774,6 +770,10 @@ static int a5xx_hw_init(struct msm_gpu *gpu) |
6157 |
+ |
6158 |
+ gpu_write64(gpu, REG_A5XX_CP_RB_RPTR_ADDR, |
6159 |
+ REG_A5XX_CP_RB_RPTR_ADDR_HI, shadowptr(a5xx_gpu, gpu->rb[0])); |
6160 |
++ } else if (gpu->nr_rings > 1) { |
6161 |
++ /* Disable preemption if WHERE_AM_I isn't available */ |
6162 |
++ a5xx_preempt_fini(gpu); |
6163 |
++ gpu->nr_rings = 1; |
6164 |
+ } |
6165 |
+ |
6166 |
+ a5xx_preempt_hw_init(gpu); |
6167 |
+@@ -1207,7 +1207,9 @@ static int a5xx_pm_resume(struct msm_gpu *gpu) |
6168 |
+ static int a5xx_pm_suspend(struct msm_gpu *gpu) |
6169 |
+ { |
6170 |
+ struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); |
6171 |
++ struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); |
6172 |
+ u32 mask = 0xf; |
6173 |
++ int i, ret; |
6174 |
+ |
6175 |
+ /* A510 has 3 XIN ports in VBIF */ |
6176 |
+ if (adreno_is_a510(adreno_gpu)) |
6177 |
+@@ -1227,7 +1229,15 @@ static int a5xx_pm_suspend(struct msm_gpu *gpu) |
6178 |
+ gpu_write(gpu, REG_A5XX_RBBM_BLOCK_SW_RESET_CMD, 0x003C0000); |
6179 |
+ gpu_write(gpu, REG_A5XX_RBBM_BLOCK_SW_RESET_CMD, 0x00000000); |
6180 |
+ |
6181 |
+- return msm_gpu_pm_suspend(gpu); |
6182 |
++ ret = msm_gpu_pm_suspend(gpu); |
6183 |
++ if (ret) |
6184 |
++ return ret; |
6185 |
++ |
6186 |
++ if (a5xx_gpu->has_whereami) |
6187 |
++ for (i = 0; i < gpu->nr_rings; i++) |
6188 |
++ a5xx_gpu->shadow[i] = 0; |
6189 |
++ |
6190 |
++ return 0; |
6191 |
+ } |
6192 |
+ |
6193 |
+ static int a5xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) |
6194 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6195 |
+index 948f3656c20ca..420ca4a0eb5f7 100644 |
6196 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6197 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6198 |
+@@ -1045,12 +1045,21 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) |
6199 |
+ { |
6200 |
+ struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); |
6201 |
+ struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); |
6202 |
++ int i, ret; |
6203 |
+ |
6204 |
+ trace_msm_gpu_suspend(0); |
6205 |
+ |
6206 |
+ devfreq_suspend_device(gpu->devfreq.devfreq); |
6207 |
+ |
6208 |
+- return a6xx_gmu_stop(a6xx_gpu); |
6209 |
++ ret = a6xx_gmu_stop(a6xx_gpu); |
6210 |
++ if (ret) |
6211 |
++ return ret; |
6212 |
++ |
6213 |
++ if (adreno_gpu->base.hw_apriv || a6xx_gpu->has_whereami) |
6214 |
++ for (i = 0; i < gpu->nr_rings; i++) |
6215 |
++ a6xx_gpu->shadow[i] = 0; |
6216 |
++ |
6217 |
++ return 0; |
6218 |
+ } |
6219 |
+ |
6220 |
+ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) |
6221 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c |
6222 |
+index 393858ef8a832..37c8270681c23 100644 |
6223 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c |
6224 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c |
6225 |
+@@ -219,9 +219,6 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, |
6226 |
+ int i, ret = 0; |
6227 |
+ u64 avg_bw; |
6228 |
+ |
6229 |
+- if (!kms->num_paths) |
6230 |
+- return -EINVAL; |
6231 |
+- |
6232 |
+ drm_for_each_crtc(tmp_crtc, crtc->dev) { |
6233 |
+ if (tmp_crtc->enabled && |
6234 |
+ curr_client_type == |
6235 |
+@@ -239,6 +236,9 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, |
6236 |
+ } |
6237 |
+ } |
6238 |
+ |
6239 |
++ if (!kms->num_paths) |
6240 |
++ return 0; |
6241 |
++ |
6242 |
+ avg_bw = perf.bw_ctl; |
6243 |
+ do_div(avg_bw, (kms->num_paths * 1000)); /*Bps_to_icc*/ |
6244 |
+ |
6245 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c |
6246 |
+index b15b4ce4ba35a..4963bfe6a4726 100644 |
6247 |
+--- a/drivers/gpu/drm/msm/dp/dp_catalog.c |
6248 |
++++ b/drivers/gpu/drm/msm/dp/dp_catalog.c |
6249 |
+@@ -572,6 +572,19 @@ void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog) |
6250 |
+ dp_write_aux(catalog, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN); |
6251 |
+ } |
6252 |
+ |
6253 |
++u32 dp_catalog_hpd_get_state_status(struct dp_catalog *dp_catalog) |
6254 |
++{ |
6255 |
++ struct dp_catalog_private *catalog = container_of(dp_catalog, |
6256 |
++ struct dp_catalog_private, dp_catalog); |
6257 |
++ u32 status; |
6258 |
++ |
6259 |
++ status = dp_read_aux(catalog, REG_DP_DP_HPD_INT_STATUS); |
6260 |
++ status >>= DP_DP_HPD_STATE_STATUS_BITS_SHIFT; |
6261 |
++ status &= DP_DP_HPD_STATE_STATUS_BITS_MASK; |
6262 |
++ |
6263 |
++ return status; |
6264 |
++} |
6265 |
++ |
6266 |
+ u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog) |
6267 |
+ { |
6268 |
+ struct dp_catalog_private *catalog = container_of(dp_catalog, |
6269 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h |
6270 |
+index 4b7666f1fe6fe..6d257dbebf294 100644 |
6271 |
+--- a/drivers/gpu/drm/msm/dp/dp_catalog.h |
6272 |
++++ b/drivers/gpu/drm/msm/dp/dp_catalog.h |
6273 |
+@@ -97,6 +97,7 @@ void dp_catalog_ctrl_enable_irq(struct dp_catalog *dp_catalog, bool enable); |
6274 |
+ void dp_catalog_hpd_config_intr(struct dp_catalog *dp_catalog, |
6275 |
+ u32 intr_mask, bool en); |
6276 |
+ void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog); |
6277 |
++u32 dp_catalog_hpd_get_state_status(struct dp_catalog *dp_catalog); |
6278 |
+ u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog); |
6279 |
+ void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog); |
6280 |
+ int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, u8 v_level, |
6281 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c |
6282 |
+index 2e3e1917351f0..c83a1650437da 100644 |
6283 |
+--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c |
6284 |
++++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c |
6285 |
+@@ -1061,23 +1061,15 @@ static bool dp_ctrl_train_pattern_set(struct dp_ctrl_private *ctrl, |
6286 |
+ static int dp_ctrl_read_link_status(struct dp_ctrl_private *ctrl, |
6287 |
+ u8 *link_status) |
6288 |
+ { |
6289 |
+- int len = 0; |
6290 |
+- u32 const offset = DP_LANE_ALIGN_STATUS_UPDATED - DP_LANE0_1_STATUS; |
6291 |
+- u32 link_status_read_max_retries = 100; |
6292 |
+- |
6293 |
+- while (--link_status_read_max_retries) { |
6294 |
+- len = drm_dp_dpcd_read_link_status(ctrl->aux, |
6295 |
+- link_status); |
6296 |
+- if (len != DP_LINK_STATUS_SIZE) { |
6297 |
+- DRM_ERROR("DP link status read failed, err: %d\n", len); |
6298 |
+- return len; |
6299 |
+- } |
6300 |
++ int ret = 0, len; |
6301 |
+ |
6302 |
+- if (!(link_status[offset] & DP_LINK_STATUS_UPDATED)) |
6303 |
+- return 0; |
6304 |
++ len = drm_dp_dpcd_read_link_status(ctrl->aux, link_status); |
6305 |
++ if (len != DP_LINK_STATUS_SIZE) { |
6306 |
++ DRM_ERROR("DP link status read failed, err: %d\n", len); |
6307 |
++ ret = -EINVAL; |
6308 |
+ } |
6309 |
+ |
6310 |
+- return -ETIMEDOUT; |
6311 |
++ return ret; |
6312 |
+ } |
6313 |
+ |
6314 |
+ static int dp_ctrl_link_train_1(struct dp_ctrl_private *ctrl, |
6315 |
+@@ -1400,6 +1392,8 @@ int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip) |
6316 |
+ void dp_ctrl_host_deinit(struct dp_ctrl *dp_ctrl) |
6317 |
+ { |
6318 |
+ struct dp_ctrl_private *ctrl; |
6319 |
++ struct dp_io *dp_io; |
6320 |
++ struct phy *phy; |
6321 |
+ |
6322 |
+ if (!dp_ctrl) { |
6323 |
+ DRM_ERROR("Invalid input data\n"); |
6324 |
+@@ -1407,8 +1401,11 @@ void dp_ctrl_host_deinit(struct dp_ctrl *dp_ctrl) |
6325 |
+ } |
6326 |
+ |
6327 |
+ ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); |
6328 |
++ dp_io = &ctrl->parser->io; |
6329 |
++ phy = dp_io->phy; |
6330 |
+ |
6331 |
+ dp_catalog_ctrl_enable_irq(ctrl->catalog, false); |
6332 |
++ phy_exit(phy); |
6333 |
+ |
6334 |
+ DRM_DEBUG_DP("Host deinitialized successfully\n"); |
6335 |
+ } |
6336 |
+@@ -1643,9 +1640,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) |
6337 |
+ if (rc) |
6338 |
+ return rc; |
6339 |
+ |
6340 |
+- ctrl->link->phy_params.p_level = 0; |
6341 |
+- ctrl->link->phy_params.v_level = 0; |
6342 |
+- |
6343 |
+ while (--link_train_max_retries && |
6344 |
+ !atomic_read(&ctrl->dp_ctrl.aborted)) { |
6345 |
+ rc = dp_ctrl_reinitialize_mainlink(ctrl); |
6346 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c |
6347 |
+index e175aa3fd3a93..fe0279542a1c2 100644 |
6348 |
+--- a/drivers/gpu/drm/msm/dp/dp_display.c |
6349 |
++++ b/drivers/gpu/drm/msm/dp/dp_display.c |
6350 |
+@@ -108,14 +108,12 @@ struct dp_display_private { |
6351 |
+ /* event related only access by event thread */ |
6352 |
+ struct mutex event_mutex; |
6353 |
+ wait_queue_head_t event_q; |
6354 |
+- atomic_t hpd_state; |
6355 |
++ u32 hpd_state; |
6356 |
+ u32 event_pndx; |
6357 |
+ u32 event_gndx; |
6358 |
+ struct dp_event event_list[DP_EVENT_Q_MAX]; |
6359 |
+ spinlock_t event_lock; |
6360 |
+ |
6361 |
+- struct completion resume_comp; |
6362 |
+- |
6363 |
+ struct dp_audio *audio; |
6364 |
+ }; |
6365 |
+ |
6366 |
+@@ -335,6 +333,7 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp) |
6367 |
+ dp->dp_display.max_pclk_khz = DP_MAX_PIXEL_CLK_KHZ; |
6368 |
+ dp->dp_display.max_dp_lanes = dp->parser->max_dp_lanes; |
6369 |
+ |
6370 |
++ dp_link_reset_phy_params_vx_px(dp->link); |
6371 |
+ rc = dp_ctrl_on_link(dp->ctrl); |
6372 |
+ if (rc) { |
6373 |
+ DRM_ERROR("failed to complete DP link training\n"); |
6374 |
+@@ -366,6 +365,20 @@ static void dp_display_host_init(struct dp_display_private *dp) |
6375 |
+ dp->core_initialized = true; |
6376 |
+ } |
6377 |
+ |
6378 |
++static void dp_display_host_deinit(struct dp_display_private *dp) |
6379 |
++{ |
6380 |
++ if (!dp->core_initialized) { |
6381 |
++ DRM_DEBUG_DP("DP core not initialized\n"); |
6382 |
++ return; |
6383 |
++ } |
6384 |
++ |
6385 |
++ dp_ctrl_host_deinit(dp->ctrl); |
6386 |
++ dp_aux_deinit(dp->aux); |
6387 |
++ dp_power_deinit(dp->power); |
6388 |
++ |
6389 |
++ dp->core_initialized = false; |
6390 |
++} |
6391 |
++ |
6392 |
+ static int dp_display_usbpd_configure_cb(struct device *dev) |
6393 |
+ { |
6394 |
+ int rc = 0; |
6395 |
+@@ -490,7 +503,7 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) |
6396 |
+ |
6397 |
+ mutex_lock(&dp->event_mutex); |
6398 |
+ |
6399 |
+- state = atomic_read(&dp->hpd_state); |
6400 |
++ state = dp->hpd_state; |
6401 |
+ if (state == ST_SUSPEND_PENDING) { |
6402 |
+ mutex_unlock(&dp->event_mutex); |
6403 |
+ return 0; |
6404 |
+@@ -508,17 +521,14 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) |
6405 |
+ return 0; |
6406 |
+ } |
6407 |
+ |
6408 |
+- if (state == ST_SUSPENDED) |
6409 |
+- tout = DP_TIMEOUT_NONE; |
6410 |
+- |
6411 |
+- atomic_set(&dp->hpd_state, ST_CONNECT_PENDING); |
6412 |
++ dp->hpd_state = ST_CONNECT_PENDING; |
6413 |
+ |
6414 |
+ hpd->hpd_high = 1; |
6415 |
+ |
6416 |
+ ret = dp_display_usbpd_configure_cb(&dp->pdev->dev); |
6417 |
+ if (ret) { /* failed */ |
6418 |
+ hpd->hpd_high = 0; |
6419 |
+- atomic_set(&dp->hpd_state, ST_DISCONNECTED); |
6420 |
++ dp->hpd_state = ST_DISCONNECTED; |
6421 |
+ } |
6422 |
+ |
6423 |
+ /* start sanity checking */ |
6424 |
+@@ -539,10 +549,10 @@ static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) |
6425 |
+ |
6426 |
+ mutex_lock(&dp->event_mutex); |
6427 |
+ |
6428 |
+- state = atomic_read(&dp->hpd_state); |
6429 |
++ state = dp->hpd_state; |
6430 |
+ if (state == ST_CONNECT_PENDING) { |
6431 |
+ dp_display_enable(dp, 0); |
6432 |
+- atomic_set(&dp->hpd_state, ST_CONNECTED); |
6433 |
++ dp->hpd_state = ST_CONNECTED; |
6434 |
+ } |
6435 |
+ |
6436 |
+ mutex_unlock(&dp->event_mutex); |
6437 |
+@@ -553,7 +563,14 @@ static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) |
6438 |
+ static void dp_display_handle_plugged_change(struct msm_dp *dp_display, |
6439 |
+ bool plugged) |
6440 |
+ { |
6441 |
+- if (dp_display->plugged_cb && dp_display->codec_dev) |
6442 |
++ struct dp_display_private *dp; |
6443 |
++ |
6444 |
++ dp = container_of(dp_display, |
6445 |
++ struct dp_display_private, dp_display); |
6446 |
++ |
6447 |
++ /* notify audio subsystem only if sink supports audio */ |
6448 |
++ if (dp_display->plugged_cb && dp_display->codec_dev && |
6449 |
++ dp->audio_supported) |
6450 |
+ dp_display->plugged_cb(dp_display->codec_dev, plugged); |
6451 |
+ } |
6452 |
+ |
6453 |
+@@ -567,7 +584,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) |
6454 |
+ |
6455 |
+ mutex_lock(&dp->event_mutex); |
6456 |
+ |
6457 |
+- state = atomic_read(&dp->hpd_state); |
6458 |
++ state = dp->hpd_state; |
6459 |
+ if (state == ST_SUSPEND_PENDING) { |
6460 |
+ mutex_unlock(&dp->event_mutex); |
6461 |
+ return 0; |
6462 |
+@@ -585,7 +602,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) |
6463 |
+ return 0; |
6464 |
+ } |
6465 |
+ |
6466 |
+- atomic_set(&dp->hpd_state, ST_DISCONNECT_PENDING); |
6467 |
++ dp->hpd_state = ST_DISCONNECT_PENDING; |
6468 |
+ |
6469 |
+ /* disable HPD plug interrupt until disconnect is done */ |
6470 |
+ dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_PLUG_INT_MASK |
6471 |
+@@ -620,10 +637,10 @@ static int dp_disconnect_pending_timeout(struct dp_display_private *dp, u32 data |
6472 |
+ |
6473 |
+ mutex_lock(&dp->event_mutex); |
6474 |
+ |
6475 |
+- state = atomic_read(&dp->hpd_state); |
6476 |
++ state = dp->hpd_state; |
6477 |
+ if (state == ST_DISCONNECT_PENDING) { |
6478 |
+ dp_display_disable(dp, 0); |
6479 |
+- atomic_set(&dp->hpd_state, ST_DISCONNECTED); |
6480 |
++ dp->hpd_state = ST_DISCONNECTED; |
6481 |
+ } |
6482 |
+ |
6483 |
+ mutex_unlock(&dp->event_mutex); |
6484 |
+@@ -638,7 +655,7 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data) |
6485 |
+ mutex_lock(&dp->event_mutex); |
6486 |
+ |
6487 |
+ /* irq_hpd can happen at either connected or disconnected state */ |
6488 |
+- state = atomic_read(&dp->hpd_state); |
6489 |
++ state = dp->hpd_state; |
6490 |
+ if (state == ST_SUSPEND_PENDING) { |
6491 |
+ mutex_unlock(&dp->event_mutex); |
6492 |
+ return 0; |
6493 |
+@@ -789,17 +806,10 @@ static int dp_display_enable(struct dp_display_private *dp, u32 data) |
6494 |
+ |
6495 |
+ dp_display = g_dp_display; |
6496 |
+ |
6497 |
+- if (dp_display->power_on) { |
6498 |
+- DRM_DEBUG_DP("Link already setup, return\n"); |
6499 |
+- return 0; |
6500 |
+- } |
6501 |
+- |
6502 |
+ rc = dp_ctrl_on_stream(dp->ctrl); |
6503 |
+ if (!rc) |
6504 |
+ dp_display->power_on = true; |
6505 |
+ |
6506 |
+- /* complete resume_comp regardless it is armed or not */ |
6507 |
+- complete(&dp->resume_comp); |
6508 |
+ return rc; |
6509 |
+ } |
6510 |
+ |
6511 |
+@@ -828,9 +838,6 @@ static int dp_display_disable(struct dp_display_private *dp, u32 data) |
6512 |
+ |
6513 |
+ dp_display = g_dp_display; |
6514 |
+ |
6515 |
+- if (!dp_display->power_on) |
6516 |
+- return -EINVAL; |
6517 |
+- |
6518 |
+ /* wait only if audio was enabled */ |
6519 |
+ if (dp_display->audio_enabled) { |
6520 |
+ if (!wait_for_completion_timeout(&dp->audio_comp, |
6521 |
+@@ -1151,9 +1158,6 @@ static int dp_display_probe(struct platform_device *pdev) |
6522 |
+ } |
6523 |
+ |
6524 |
+ mutex_init(&dp->event_mutex); |
6525 |
+- |
6526 |
+- init_completion(&dp->resume_comp); |
6527 |
+- |
6528 |
+ g_dp_display = &dp->dp_display; |
6529 |
+ |
6530 |
+ /* Store DP audio handle inside DP display */ |
6531 |
+@@ -1189,20 +1193,54 @@ static int dp_display_remove(struct platform_device *pdev) |
6532 |
+ |
6533 |
+ static int dp_pm_resume(struct device *dev) |
6534 |
+ { |
6535 |
++ struct platform_device *pdev = to_platform_device(dev); |
6536 |
++ struct msm_dp *dp_display = platform_get_drvdata(pdev); |
6537 |
++ struct dp_display_private *dp; |
6538 |
++ u32 status; |
6539 |
++ |
6540 |
++ dp = container_of(dp_display, struct dp_display_private, dp_display); |
6541 |
++ |
6542 |
++ mutex_lock(&dp->event_mutex); |
6543 |
++ |
6544 |
++ /* start from disconnected state */ |
6545 |
++ dp->hpd_state = ST_DISCONNECTED; |
6546 |
++ |
6547 |
++ /* turn on dp ctrl/phy */ |
6548 |
++ dp_display_host_init(dp); |
6549 |
++ |
6550 |
++ dp_catalog_ctrl_hpd_config(dp->catalog); |
6551 |
++ |
6552 |
++ status = dp_catalog_hpd_get_state_status(dp->catalog); |
6553 |
++ |
6554 |
++ if (status) { |
6555 |
++ dp->dp_display.is_connected = true; |
6556 |
++ } else { |
6557 |
++ dp->dp_display.is_connected = false; |
6558 |
++ /* make sure next resume host_init be called */ |
6559 |
++ dp->core_initialized = false; |
6560 |
++ } |
6561 |
++ |
6562 |
++ mutex_unlock(&dp->event_mutex); |
6563 |
++ |
6564 |
+ return 0; |
6565 |
+ } |
6566 |
+ |
6567 |
+ static int dp_pm_suspend(struct device *dev) |
6568 |
+ { |
6569 |
+ struct platform_device *pdev = to_platform_device(dev); |
6570 |
+- struct dp_display_private *dp = platform_get_drvdata(pdev); |
6571 |
++ struct msm_dp *dp_display = platform_get_drvdata(pdev); |
6572 |
++ struct dp_display_private *dp; |
6573 |
+ |
6574 |
+- if (!dp) { |
6575 |
+- DRM_ERROR("DP driver bind failed. Invalid driver data\n"); |
6576 |
+- return -EINVAL; |
6577 |
+- } |
6578 |
++ dp = container_of(dp_display, struct dp_display_private, dp_display); |
6579 |
++ |
6580 |
++ mutex_lock(&dp->event_mutex); |
6581 |
+ |
6582 |
+- atomic_set(&dp->hpd_state, ST_SUSPENDED); |
6583 |
++ if (dp->core_initialized == true) |
6584 |
++ dp_display_host_deinit(dp); |
6585 |
++ |
6586 |
++ dp->hpd_state = ST_SUSPENDED; |
6587 |
++ |
6588 |
++ mutex_unlock(&dp->event_mutex); |
6589 |
+ |
6590 |
+ return 0; |
6591 |
+ } |
6592 |
+@@ -1317,19 +1355,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, |
6593 |
+ return 0; |
6594 |
+ } |
6595 |
+ |
6596 |
+-static int dp_display_wait4resume_done(struct dp_display_private *dp) |
6597 |
+-{ |
6598 |
+- int ret = 0; |
6599 |
+- |
6600 |
+- reinit_completion(&dp->resume_comp); |
6601 |
+- if (!wait_for_completion_timeout(&dp->resume_comp, |
6602 |
+- WAIT_FOR_RESUME_TIMEOUT_JIFFIES)) { |
6603 |
+- DRM_ERROR("wait4resume_done timedout\n"); |
6604 |
+- ret = -ETIMEDOUT; |
6605 |
+- } |
6606 |
+- return ret; |
6607 |
+-} |
6608 |
+- |
6609 |
+ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) |
6610 |
+ { |
6611 |
+ int rc = 0; |
6612 |
+@@ -1344,6 +1369,8 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) |
6613 |
+ |
6614 |
+ mutex_lock(&dp_display->event_mutex); |
6615 |
+ |
6616 |
++ dp_del_event(dp_display, EV_CONNECT_PENDING_TIMEOUT); |
6617 |
++ |
6618 |
+ rc = dp_display_set_mode(dp, &dp_display->dp_mode); |
6619 |
+ if (rc) { |
6620 |
+ DRM_ERROR("Failed to perform a mode set, rc=%d\n", rc); |
6621 |
+@@ -1358,15 +1385,10 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) |
6622 |
+ return rc; |
6623 |
+ } |
6624 |
+ |
6625 |
+- state = atomic_read(&dp_display->hpd_state); |
6626 |
+- if (state == ST_SUSPENDED) { |
6627 |
+- /* start link training */ |
6628 |
+- dp_add_event(dp_display, EV_HPD_PLUG_INT, 0, 0); |
6629 |
+- mutex_unlock(&dp_display->event_mutex); |
6630 |
++ state = dp_display->hpd_state; |
6631 |
+ |
6632 |
+- /* wait until dp interface is up */ |
6633 |
+- goto resume_done; |
6634 |
+- } |
6635 |
++ if (state == ST_SUSPEND_PENDING) |
6636 |
++ dp_display_host_init(dp_display); |
6637 |
+ |
6638 |
+ dp_display_enable(dp_display, 0); |
6639 |
+ |
6640 |
+@@ -1377,21 +1399,15 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) |
6641 |
+ dp_display_unprepare(dp); |
6642 |
+ } |
6643 |
+ |
6644 |
+- dp_del_event(dp_display, EV_CONNECT_PENDING_TIMEOUT); |
6645 |
+- |
6646 |
+ if (state == ST_SUSPEND_PENDING) |
6647 |
+ dp_add_event(dp_display, EV_IRQ_HPD_INT, 0, 0); |
6648 |
+ |
6649 |
+ /* completed connection */ |
6650 |
+- atomic_set(&dp_display->hpd_state, ST_CONNECTED); |
6651 |
++ dp_display->hpd_state = ST_CONNECTED; |
6652 |
+ |
6653 |
+ mutex_unlock(&dp_display->event_mutex); |
6654 |
+ |
6655 |
+ return rc; |
6656 |
+- |
6657 |
+-resume_done: |
6658 |
+- dp_display_wait4resume_done(dp_display); |
6659 |
+- return rc; |
6660 |
+ } |
6661 |
+ |
6662 |
+ int msm_dp_display_pre_disable(struct msm_dp *dp, struct drm_encoder *encoder) |
6663 |
+@@ -1415,20 +1431,20 @@ int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder) |
6664 |
+ |
6665 |
+ mutex_lock(&dp_display->event_mutex); |
6666 |
+ |
6667 |
++ dp_del_event(dp_display, EV_DISCONNECT_PENDING_TIMEOUT); |
6668 |
++ |
6669 |
+ dp_display_disable(dp_display, 0); |
6670 |
+ |
6671 |
+ rc = dp_display_unprepare(dp); |
6672 |
+ if (rc) |
6673 |
+ DRM_ERROR("DP display unprepare failed, rc=%d\n", rc); |
6674 |
+ |
6675 |
+- dp_del_event(dp_display, EV_DISCONNECT_PENDING_TIMEOUT); |
6676 |
+- |
6677 |
+- state = atomic_read(&dp_display->hpd_state); |
6678 |
++ state = dp_display->hpd_state; |
6679 |
+ if (state == ST_DISCONNECT_PENDING) { |
6680 |
+ /* completed disconnection */ |
6681 |
+- atomic_set(&dp_display->hpd_state, ST_DISCONNECTED); |
6682 |
++ dp_display->hpd_state = ST_DISCONNECTED; |
6683 |
+ } else { |
6684 |
+- atomic_set(&dp_display->hpd_state, ST_SUSPEND_PENDING); |
6685 |
++ dp_display->hpd_state = ST_SUSPEND_PENDING; |
6686 |
+ } |
6687 |
+ |
6688 |
+ mutex_unlock(&dp_display->event_mutex); |
6689 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c |
6690 |
+index c811da515fb3b..be986da78c4a5 100644 |
6691 |
+--- a/drivers/gpu/drm/msm/dp/dp_link.c |
6692 |
++++ b/drivers/gpu/drm/msm/dp/dp_link.c |
6693 |
+@@ -773,7 +773,8 @@ static int dp_link_process_link_training_request(struct dp_link_private *link) |
6694 |
+ link->request.test_lane_count); |
6695 |
+ |
6696 |
+ link->dp_link.link_params.num_lanes = link->request.test_lane_count; |
6697 |
+- link->dp_link.link_params.rate = link->request.test_link_rate; |
6698 |
++ link->dp_link.link_params.rate = |
6699 |
++ drm_dp_bw_code_to_link_rate(link->request.test_link_rate); |
6700 |
+ |
6701 |
+ return 0; |
6702 |
+ } |
6703 |
+@@ -869,6 +870,9 @@ static int dp_link_parse_vx_px(struct dp_link_private *link) |
6704 |
+ drm_dp_get_adjust_request_voltage(link->link_status, 0); |
6705 |
+ link->dp_link.phy_params.p_level = |
6706 |
+ drm_dp_get_adjust_request_pre_emphasis(link->link_status, 0); |
6707 |
++ |
6708 |
++ link->dp_link.phy_params.p_level >>= DP_TRAIN_PRE_EMPHASIS_SHIFT; |
6709 |
++ |
6710 |
+ DRM_DEBUG_DP("Requested: v_level = 0x%x, p_level = 0x%x\n", |
6711 |
+ link->dp_link.phy_params.v_level, |
6712 |
+ link->dp_link.phy_params.p_level); |
6713 |
+@@ -911,7 +915,8 @@ static int dp_link_process_phy_test_pattern_request( |
6714 |
+ link->request.test_lane_count); |
6715 |
+ |
6716 |
+ link->dp_link.link_params.num_lanes = link->request.test_lane_count; |
6717 |
+- link->dp_link.link_params.rate = link->request.test_link_rate; |
6718 |
++ link->dp_link.link_params.rate = |
6719 |
++ drm_dp_bw_code_to_link_rate(link->request.test_link_rate); |
6720 |
+ |
6721 |
+ ret = dp_link_parse_vx_px(link); |
6722 |
+ |
6723 |
+@@ -939,22 +944,20 @@ static u8 get_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r) |
6724 |
+ */ |
6725 |
+ static int dp_link_process_link_status_update(struct dp_link_private *link) |
6726 |
+ { |
6727 |
+- if (!(get_link_status(link->link_status, |
6728 |
+- DP_LANE_ALIGN_STATUS_UPDATED) & |
6729 |
+- DP_LINK_STATUS_UPDATED) || |
6730 |
+- (drm_dp_clock_recovery_ok(link->link_status, |
6731 |
+- link->dp_link.link_params.num_lanes) && |
6732 |
+- drm_dp_channel_eq_ok(link->link_status, |
6733 |
+- link->dp_link.link_params.num_lanes))) |
6734 |
+- return -EINVAL; |
6735 |
++ bool channel_eq_done = drm_dp_channel_eq_ok(link->link_status, |
6736 |
++ link->dp_link.link_params.num_lanes); |
6737 |
+ |
6738 |
+- DRM_DEBUG_DP("channel_eq_done = %d, clock_recovery_done = %d\n", |
6739 |
+- drm_dp_clock_recovery_ok(link->link_status, |
6740 |
+- link->dp_link.link_params.num_lanes), |
6741 |
+- drm_dp_clock_recovery_ok(link->link_status, |
6742 |
+- link->dp_link.link_params.num_lanes)); |
6743 |
++ bool clock_recovery_done = drm_dp_clock_recovery_ok(link->link_status, |
6744 |
++ link->dp_link.link_params.num_lanes); |
6745 |
+ |
6746 |
+- return 0; |
6747 |
++ DRM_DEBUG_DP("channel_eq_done = %d, clock_recovery_done = %d\n", |
6748 |
++ channel_eq_done, clock_recovery_done); |
6749 |
++ |
6750 |
++ if (channel_eq_done && clock_recovery_done) |
6751 |
++ return -EINVAL; |
6752 |
++ |
6753 |
++ |
6754 |
++ return 0; |
6755 |
+ } |
6756 |
+ |
6757 |
+ /** |
6758 |
+@@ -1156,6 +1159,12 @@ int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status) |
6759 |
+ return 0; |
6760 |
+ } |
6761 |
+ |
6762 |
++void dp_link_reset_phy_params_vx_px(struct dp_link *dp_link) |
6763 |
++{ |
6764 |
++ dp_link->phy_params.v_level = 0; |
6765 |
++ dp_link->phy_params.p_level = 0; |
6766 |
++} |
6767 |
++ |
6768 |
+ u32 dp_link_get_test_bits_depth(struct dp_link *dp_link, u32 bpp) |
6769 |
+ { |
6770 |
+ u32 tbd; |
6771 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_link.h b/drivers/gpu/drm/msm/dp/dp_link.h |
6772 |
+index 49811b6221e53..9dd4dd9265304 100644 |
6773 |
+--- a/drivers/gpu/drm/msm/dp/dp_link.h |
6774 |
++++ b/drivers/gpu/drm/msm/dp/dp_link.h |
6775 |
+@@ -135,6 +135,7 @@ static inline u32 dp_link_bit_depth_to_bpc(u32 tbd) |
6776 |
+ } |
6777 |
+ } |
6778 |
+ |
6779 |
++void dp_link_reset_phy_params_vx_px(struct dp_link *dp_link); |
6780 |
+ u32 dp_link_get_test_bits_depth(struct dp_link *dp_link, u32 bpp); |
6781 |
+ int dp_link_process_request(struct dp_link *dp_link); |
6782 |
+ int dp_link_get_colorimetry_config(struct dp_link *dp_link); |
6783 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_reg.h b/drivers/gpu/drm/msm/dp/dp_reg.h |
6784 |
+index 43042ff90a199..268602803d9a3 100644 |
6785 |
+--- a/drivers/gpu/drm/msm/dp/dp_reg.h |
6786 |
++++ b/drivers/gpu/drm/msm/dp/dp_reg.h |
6787 |
+@@ -32,6 +32,8 @@ |
6788 |
+ #define DP_DP_IRQ_HPD_INT_ACK (0x00000002) |
6789 |
+ #define DP_DP_HPD_REPLUG_INT_ACK (0x00000004) |
6790 |
+ #define DP_DP_HPD_UNPLUG_INT_ACK (0x00000008) |
6791 |
++#define DP_DP_HPD_STATE_STATUS_BITS_MASK (0x0000000F) |
6792 |
++#define DP_DP_HPD_STATE_STATUS_BITS_SHIFT (0x1C) |
6793 |
+ |
6794 |
+ #define REG_DP_DP_HPD_INT_MASK (0x0000000C) |
6795 |
+ #define DP_DP_HPD_PLUG_INT_MASK (0x00000001) |
6796 |
+diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
6797 |
+index 6ac04fc303f56..e4e9bf04b7368 100644 |
6798 |
+--- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
6799 |
++++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c |
6800 |
+@@ -559,6 +559,7 @@ static int dsi_pll_10nm_restore_state(struct msm_dsi_pll *pll) |
6801 |
+ struct pll_10nm_cached_state *cached = &pll_10nm->cached_state; |
6802 |
+ void __iomem *phy_base = pll_10nm->phy_cmn_mmio; |
6803 |
+ u32 val; |
6804 |
++ int ret; |
6805 |
+ |
6806 |
+ val = pll_read(pll_10nm->mmio + REG_DSI_10nm_PHY_PLL_PLL_OUTDIV_RATE); |
6807 |
+ val &= ~0x3; |
6808 |
+@@ -573,6 +574,13 @@ static int dsi_pll_10nm_restore_state(struct msm_dsi_pll *pll) |
6809 |
+ val |= cached->pll_mux; |
6810 |
+ pll_write(phy_base + REG_DSI_10nm_PHY_CMN_CLK_CFG1, val); |
6811 |
+ |
6812 |
++ ret = dsi_pll_10nm_vco_set_rate(&pll->clk_hw, pll_10nm->vco_current_rate, pll_10nm->vco_ref_clk_rate); |
6813 |
++ if (ret) { |
6814 |
++ DRM_DEV_ERROR(&pll_10nm->pdev->dev, |
6815 |
++ "restore vco rate failed. ret=%d\n", ret); |
6816 |
++ return ret; |
6817 |
++ } |
6818 |
++ |
6819 |
+ DBG("DSI PLL%d", pll_10nm->id); |
6820 |
+ |
6821 |
+ return 0; |
6822 |
+diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c |
6823 |
+index de0dfb8151258..93bf142e4a4e6 100644 |
6824 |
+--- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c |
6825 |
++++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c |
6826 |
+@@ -585,6 +585,7 @@ static int dsi_pll_7nm_restore_state(struct msm_dsi_pll *pll) |
6827 |
+ struct pll_7nm_cached_state *cached = &pll_7nm->cached_state; |
6828 |
+ void __iomem *phy_base = pll_7nm->phy_cmn_mmio; |
6829 |
+ u32 val; |
6830 |
++ int ret; |
6831 |
+ |
6832 |
+ val = pll_read(pll_7nm->mmio + REG_DSI_7nm_PHY_PLL_PLL_OUTDIV_RATE); |
6833 |
+ val &= ~0x3; |
6834 |
+@@ -599,6 +600,13 @@ static int dsi_pll_7nm_restore_state(struct msm_dsi_pll *pll) |
6835 |
+ val |= cached->pll_mux; |
6836 |
+ pll_write(phy_base + REG_DSI_7nm_PHY_CMN_CLK_CFG1, val); |
6837 |
+ |
6838 |
++ ret = dsi_pll_7nm_vco_set_rate(&pll->clk_hw, pll_7nm->vco_current_rate, pll_7nm->vco_ref_clk_rate); |
6839 |
++ if (ret) { |
6840 |
++ DRM_DEV_ERROR(&pll_7nm->pdev->dev, |
6841 |
++ "restore vco rate failed. ret=%d\n", ret); |
6842 |
++ return ret; |
6843 |
++ } |
6844 |
++ |
6845 |
+ DBG("DSI PLL%d", pll_7nm->id); |
6846 |
+ |
6847 |
+ return 0; |
6848 |
+diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h |
6849 |
+index b9dd8f8f48872..0b2686b060c73 100644 |
6850 |
+--- a/drivers/gpu/drm/msm/msm_drv.h |
6851 |
++++ b/drivers/gpu/drm/msm/msm_drv.h |
6852 |
+@@ -423,6 +423,11 @@ static inline int msm_dp_display_disable(struct msm_dp *dp, |
6853 |
+ { |
6854 |
+ return -EINVAL; |
6855 |
+ } |
6856 |
++static inline int msm_dp_display_pre_disable(struct msm_dp *dp, |
6857 |
++ struct drm_encoder *encoder) |
6858 |
++{ |
6859 |
++ return -EINVAL; |
6860 |
++} |
6861 |
+ static inline void msm_dp_display_mode_set(struct msm_dp *dp, |
6862 |
+ struct drm_encoder *encoder, |
6863 |
+ struct drm_display_mode *mode, |
6864 |
+diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c |
6865 |
+index 35122aef037b4..17f26052e8450 100644 |
6866 |
+--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c |
6867 |
++++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c |
6868 |
+@@ -134,11 +134,8 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb) |
6869 |
+ return -ENODEV; |
6870 |
+ |
6871 |
+ ret = drm_bridge_attach(&mxsfb->encoder, bridge, NULL, 0); |
6872 |
+- if (ret) { |
6873 |
+- DRM_DEV_ERROR(drm->dev, |
6874 |
+- "failed to attach bridge: %d\n", ret); |
6875 |
+- return ret; |
6876 |
+- } |
6877 |
++ if (ret) |
6878 |
++ return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); |
6879 |
+ |
6880 |
+ mxsfb->bridge = bridge; |
6881 |
+ |
6882 |
+@@ -212,7 +209,8 @@ static int mxsfb_load(struct drm_device *drm, |
6883 |
+ |
6884 |
+ ret = mxsfb_attach_bridge(mxsfb); |
6885 |
+ if (ret) { |
6886 |
+- dev_err(drm->dev, "Cannot connect bridge: %d\n", ret); |
6887 |
++ if (ret != -EPROBE_DEFER) |
6888 |
++ dev_err(drm->dev, "Cannot connect bridge: %d\n", ret); |
6889 |
+ goto err_vblank; |
6890 |
+ } |
6891 |
+ |
6892 |
+diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
6893 |
+index 42ec51bb7b1b0..7f43172488123 100644 |
6894 |
+--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
6895 |
++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
6896 |
+@@ -889,6 +889,7 @@ static int omap_dmm_probe(struct platform_device *dev) |
6897 |
+ &omap_dmm->refill_pa, GFP_KERNEL); |
6898 |
+ if (!omap_dmm->refill_va) { |
6899 |
+ dev_err(&dev->dev, "could not allocate refill memory\n"); |
6900 |
++ ret = -ENOMEM; |
6901 |
+ goto fail; |
6902 |
+ } |
6903 |
+ |
6904 |
+diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c |
6905 |
+index 2be358fb46f7d..204674fccd646 100644 |
6906 |
+--- a/drivers/gpu/drm/panel/panel-simple.c |
6907 |
++++ b/drivers/gpu/drm/panel/panel-simple.c |
6908 |
+@@ -1327,6 +1327,7 @@ static const struct drm_display_mode boe_nv133fhm_n61_modes = { |
6909 |
+ .vsync_start = 1080 + 3, |
6910 |
+ .vsync_end = 1080 + 3 + 6, |
6911 |
+ .vtotal = 1080 + 3 + 6 + 31, |
6912 |
++ .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC, |
6913 |
+ }; |
6914 |
+ |
6915 |
+ /* Also used for boe_nv133fhm_n62 */ |
6916 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c |
6917 |
+index e6896733838ab..bf7c34cfb84c0 100644 |
6918 |
+--- a/drivers/gpu/drm/panfrost/panfrost_device.c |
6919 |
++++ b/drivers/gpu/drm/panfrost/panfrost_device.c |
6920 |
+@@ -206,7 +206,6 @@ int panfrost_device_init(struct panfrost_device *pfdev) |
6921 |
+ struct resource *res; |
6922 |
+ |
6923 |
+ mutex_init(&pfdev->sched_lock); |
6924 |
+- mutex_init(&pfdev->reset_lock); |
6925 |
+ INIT_LIST_HEAD(&pfdev->scheduled_jobs); |
6926 |
+ INIT_LIST_HEAD(&pfdev->as_lru_list); |
6927 |
+ |
6928 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h |
6929 |
+index 2e9cbd1c4a58e..67f9f66904be2 100644 |
6930 |
+--- a/drivers/gpu/drm/panfrost/panfrost_device.h |
6931 |
++++ b/drivers/gpu/drm/panfrost/panfrost_device.h |
6932 |
+@@ -105,7 +105,11 @@ struct panfrost_device { |
6933 |
+ struct panfrost_perfcnt *perfcnt; |
6934 |
+ |
6935 |
+ struct mutex sched_lock; |
6936 |
+- struct mutex reset_lock; |
6937 |
++ |
6938 |
++ struct { |
6939 |
++ struct work_struct work; |
6940 |
++ atomic_t pending; |
6941 |
++ } reset; |
6942 |
+ |
6943 |
+ struct mutex shrinker_lock; |
6944 |
+ struct list_head shrinker_list; |
6945 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c |
6946 |
+index 30e7b7196dab0..1ce2001106e56 100644 |
6947 |
+--- a/drivers/gpu/drm/panfrost/panfrost_job.c |
6948 |
++++ b/drivers/gpu/drm/panfrost/panfrost_job.c |
6949 |
+@@ -20,12 +20,22 @@ |
6950 |
+ #include "panfrost_gpu.h" |
6951 |
+ #include "panfrost_mmu.h" |
6952 |
+ |
6953 |
++#define JOB_TIMEOUT_MS 500 |
6954 |
++ |
6955 |
+ #define job_write(dev, reg, data) writel(data, dev->iomem + (reg)) |
6956 |
+ #define job_read(dev, reg) readl(dev->iomem + (reg)) |
6957 |
+ |
6958 |
++enum panfrost_queue_status { |
6959 |
++ PANFROST_QUEUE_STATUS_ACTIVE, |
6960 |
++ PANFROST_QUEUE_STATUS_STOPPED, |
6961 |
++ PANFROST_QUEUE_STATUS_STARTING, |
6962 |
++ PANFROST_QUEUE_STATUS_FAULT_PENDING, |
6963 |
++}; |
6964 |
++ |
6965 |
+ struct panfrost_queue_state { |
6966 |
+ struct drm_gpu_scheduler sched; |
6967 |
+- |
6968 |
++ atomic_t status; |
6969 |
++ struct mutex lock; |
6970 |
+ u64 fence_context; |
6971 |
+ u64 emit_seqno; |
6972 |
+ }; |
6973 |
+@@ -369,13 +379,64 @@ void panfrost_job_enable_interrupts(struct panfrost_device *pfdev) |
6974 |
+ job_write(pfdev, JOB_INT_MASK, irq_mask); |
6975 |
+ } |
6976 |
+ |
6977 |
++static bool panfrost_scheduler_stop(struct panfrost_queue_state *queue, |
6978 |
++ struct drm_sched_job *bad) |
6979 |
++{ |
6980 |
++ enum panfrost_queue_status old_status; |
6981 |
++ bool stopped = false; |
6982 |
++ |
6983 |
++ mutex_lock(&queue->lock); |
6984 |
++ old_status = atomic_xchg(&queue->status, |
6985 |
++ PANFROST_QUEUE_STATUS_STOPPED); |
6986 |
++ if (old_status == PANFROST_QUEUE_STATUS_STOPPED) |
6987 |
++ goto out; |
6988 |
++ |
6989 |
++ WARN_ON(old_status != PANFROST_QUEUE_STATUS_ACTIVE); |
6990 |
++ drm_sched_stop(&queue->sched, bad); |
6991 |
++ if (bad) |
6992 |
++ drm_sched_increase_karma(bad); |
6993 |
++ |
6994 |
++ stopped = true; |
6995 |
++ |
6996 |
++ /* |
6997 |
++ * Set the timeout to max so the timer doesn't get started |
6998 |
++ * when we return from the timeout handler (restored in |
6999 |
++ * panfrost_scheduler_start()). |
7000 |
++ */ |
7001 |
++ queue->sched.timeout = MAX_SCHEDULE_TIMEOUT; |
7002 |
++ |
7003 |
++out: |
7004 |
++ mutex_unlock(&queue->lock); |
7005 |
++ |
7006 |
++ return stopped; |
7007 |
++} |
7008 |
++ |
7009 |
++static void panfrost_scheduler_start(struct panfrost_queue_state *queue) |
7010 |
++{ |
7011 |
++ enum panfrost_queue_status old_status; |
7012 |
++ |
7013 |
++ mutex_lock(&queue->lock); |
7014 |
++ old_status = atomic_xchg(&queue->status, |
7015 |
++ PANFROST_QUEUE_STATUS_STARTING); |
7016 |
++ WARN_ON(old_status != PANFROST_QUEUE_STATUS_STOPPED); |
7017 |
++ |
7018 |
++ /* Restore the original timeout before starting the scheduler. */ |
7019 |
++ queue->sched.timeout = msecs_to_jiffies(JOB_TIMEOUT_MS); |
7020 |
++ drm_sched_resubmit_jobs(&queue->sched); |
7021 |
++ drm_sched_start(&queue->sched, true); |
7022 |
++ old_status = atomic_xchg(&queue->status, |
7023 |
++ PANFROST_QUEUE_STATUS_ACTIVE); |
7024 |
++ if (old_status == PANFROST_QUEUE_STATUS_FAULT_PENDING) |
7025 |
++ drm_sched_fault(&queue->sched); |
7026 |
++ |
7027 |
++ mutex_unlock(&queue->lock); |
7028 |
++} |
7029 |
++ |
7030 |
+ static void panfrost_job_timedout(struct drm_sched_job *sched_job) |
7031 |
+ { |
7032 |
+ struct panfrost_job *job = to_panfrost_job(sched_job); |
7033 |
+ struct panfrost_device *pfdev = job->pfdev; |
7034 |
+ int js = panfrost_job_get_slot(job); |
7035 |
+- unsigned long flags; |
7036 |
+- int i; |
7037 |
+ |
7038 |
+ /* |
7039 |
+ * If the GPU managed to complete this jobs fence, the timeout is |
7040 |
+@@ -392,40 +453,13 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) |
7041 |
+ job_read(pfdev, JS_TAIL_LO(js)), |
7042 |
+ sched_job); |
7043 |
+ |
7044 |
+- if (!mutex_trylock(&pfdev->reset_lock)) |
7045 |
++ /* Scheduler is already stopped, nothing to do. */ |
7046 |
++ if (!panfrost_scheduler_stop(&pfdev->js->queue[js], sched_job)) |
7047 |
+ return; |
7048 |
+ |
7049 |
+- for (i = 0; i < NUM_JOB_SLOTS; i++) { |
7050 |
+- struct drm_gpu_scheduler *sched = &pfdev->js->queue[i].sched; |
7051 |
+- |
7052 |
+- drm_sched_stop(sched, sched_job); |
7053 |
+- if (js != i) |
7054 |
+- /* Ensure any timeouts on other slots have finished */ |
7055 |
+- cancel_delayed_work_sync(&sched->work_tdr); |
7056 |
+- } |
7057 |
+- |
7058 |
+- drm_sched_increase_karma(sched_job); |
7059 |
+- |
7060 |
+- spin_lock_irqsave(&pfdev->js->job_lock, flags); |
7061 |
+- for (i = 0; i < NUM_JOB_SLOTS; i++) { |
7062 |
+- if (pfdev->jobs[i]) { |
7063 |
+- pm_runtime_put_noidle(pfdev->dev); |
7064 |
+- panfrost_devfreq_record_idle(&pfdev->pfdevfreq); |
7065 |
+- pfdev->jobs[i] = NULL; |
7066 |
+- } |
7067 |
+- } |
7068 |
+- spin_unlock_irqrestore(&pfdev->js->job_lock, flags); |
7069 |
+- |
7070 |
+- panfrost_device_reset(pfdev); |
7071 |
+- |
7072 |
+- for (i = 0; i < NUM_JOB_SLOTS; i++) |
7073 |
+- drm_sched_resubmit_jobs(&pfdev->js->queue[i].sched); |
7074 |
+- |
7075 |
+- /* restart scheduler after GPU is usable again */ |
7076 |
+- for (i = 0; i < NUM_JOB_SLOTS; i++) |
7077 |
+- drm_sched_start(&pfdev->js->queue[i].sched, true); |
7078 |
+- |
7079 |
+- mutex_unlock(&pfdev->reset_lock); |
7080 |
++ /* Schedule a reset if there's no reset in progress. */ |
7081 |
++ if (!atomic_xchg(&pfdev->reset.pending, 1)) |
7082 |
++ schedule_work(&pfdev->reset.work); |
7083 |
+ } |
7084 |
+ |
7085 |
+ static const struct drm_sched_backend_ops panfrost_sched_ops = { |
7086 |
+@@ -457,6 +491,8 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) |
7087 |
+ job_write(pfdev, JOB_INT_CLEAR, mask); |
7088 |
+ |
7089 |
+ if (status & JOB_INT_MASK_ERR(j)) { |
7090 |
++ enum panfrost_queue_status old_status; |
7091 |
++ |
7092 |
+ job_write(pfdev, JS_COMMAND_NEXT(j), JS_COMMAND_NOP); |
7093 |
+ |
7094 |
+ dev_err(pfdev->dev, "js fault, js=%d, status=%s, head=0x%x, tail=0x%x", |
7095 |
+@@ -465,7 +501,18 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) |
7096 |
+ job_read(pfdev, JS_HEAD_LO(j)), |
7097 |
+ job_read(pfdev, JS_TAIL_LO(j))); |
7098 |
+ |
7099 |
+- drm_sched_fault(&pfdev->js->queue[j].sched); |
7100 |
++ /* |
7101 |
++ * When the queue is being restarted we don't report |
7102 |
++ * faults directly to avoid races between the timeout |
7103 |
++ * and reset handlers. panfrost_scheduler_start() will |
7104 |
++ * call drm_sched_fault() after the queue has been |
7105 |
++ * started if status == FAULT_PENDING. |
7106 |
++ */ |
7107 |
++ old_status = atomic_cmpxchg(&pfdev->js->queue[j].status, |
7108 |
++ PANFROST_QUEUE_STATUS_STARTING, |
7109 |
++ PANFROST_QUEUE_STATUS_FAULT_PENDING); |
7110 |
++ if (old_status == PANFROST_QUEUE_STATUS_ACTIVE) |
7111 |
++ drm_sched_fault(&pfdev->js->queue[j].sched); |
7112 |
+ } |
7113 |
+ |
7114 |
+ if (status & JOB_INT_MASK_DONE(j)) { |
7115 |
+@@ -492,11 +539,66 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) |
7116 |
+ return IRQ_HANDLED; |
7117 |
+ } |
7118 |
+ |
7119 |
++static void panfrost_reset(struct work_struct *work) |
7120 |
++{ |
7121 |
++ struct panfrost_device *pfdev = container_of(work, |
7122 |
++ struct panfrost_device, |
7123 |
++ reset.work); |
7124 |
++ unsigned long flags; |
7125 |
++ unsigned int i; |
7126 |
++ bool cookie; |
7127 |
++ |
7128 |
++ cookie = dma_fence_begin_signalling(); |
7129 |
++ for (i = 0; i < NUM_JOB_SLOTS; i++) { |
7130 |
++ /* |
7131 |
++ * We want pending timeouts to be handled before we attempt |
7132 |
++ * to stop the scheduler. If we don't do that and the timeout |
7133 |
++ * handler is in flight, it might have removed the bad job |
7134 |
++ * from the list, and we'll lose this job if the reset handler |
7135 |
++ * enters the critical section in panfrost_scheduler_stop() |
7136 |
++ * before the timeout handler. |
7137 |
++ * |
7138 |
++ * Timeout is set to MAX_SCHEDULE_TIMEOUT - 1 because we need |
7139 |
++ * something big enough to make sure the timer will not expire |
7140 |
++ * before we manage to stop the scheduler, but we can't use |
7141 |
++ * MAX_SCHEDULE_TIMEOUT because drm_sched_get_cleanup_job() |
7142 |
++ * considers that as 'timer is not running' and will dequeue |
7143 |
++ * the job without making sure the timeout handler is not |
7144 |
++ * running. |
7145 |
++ */ |
7146 |
++ pfdev->js->queue[i].sched.timeout = MAX_SCHEDULE_TIMEOUT - 1; |
7147 |
++ cancel_delayed_work_sync(&pfdev->js->queue[i].sched.work_tdr); |
7148 |
++ panfrost_scheduler_stop(&pfdev->js->queue[i], NULL); |
7149 |
++ } |
7150 |
++ |
7151 |
++ /* All timers have been stopped, we can safely reset the pending state. */ |
7152 |
++ atomic_set(&pfdev->reset.pending, 0); |
7153 |
++ |
7154 |
++ spin_lock_irqsave(&pfdev->js->job_lock, flags); |
7155 |
++ for (i = 0; i < NUM_JOB_SLOTS; i++) { |
7156 |
++ if (pfdev->jobs[i]) { |
7157 |
++ pm_runtime_put_noidle(pfdev->dev); |
7158 |
++ panfrost_devfreq_record_idle(&pfdev->pfdevfreq); |
7159 |
++ pfdev->jobs[i] = NULL; |
7160 |
++ } |
7161 |
++ } |
7162 |
++ spin_unlock_irqrestore(&pfdev->js->job_lock, flags); |
7163 |
++ |
7164 |
++ panfrost_device_reset(pfdev); |
7165 |
++ |
7166 |
++ for (i = 0; i < NUM_JOB_SLOTS; i++) |
7167 |
++ panfrost_scheduler_start(&pfdev->js->queue[i]); |
7168 |
++ |
7169 |
++ dma_fence_end_signalling(cookie); |
7170 |
++} |
7171 |
++ |
7172 |
+ int panfrost_job_init(struct panfrost_device *pfdev) |
7173 |
+ { |
7174 |
+ struct panfrost_job_slot *js; |
7175 |
+ int ret, j, irq; |
7176 |
+ |
7177 |
++ INIT_WORK(&pfdev->reset.work, panfrost_reset); |
7178 |
++ |
7179 |
+ pfdev->js = js = devm_kzalloc(pfdev->dev, sizeof(*js), GFP_KERNEL); |
7180 |
+ if (!js) |
7181 |
+ return -ENOMEM; |
7182 |
+@@ -519,7 +621,7 @@ int panfrost_job_init(struct panfrost_device *pfdev) |
7183 |
+ |
7184 |
+ ret = drm_sched_init(&js->queue[j].sched, |
7185 |
+ &panfrost_sched_ops, |
7186 |
+- 1, 0, msecs_to_jiffies(500), |
7187 |
++ 1, 0, msecs_to_jiffies(JOB_TIMEOUT_MS), |
7188 |
+ "pan_js"); |
7189 |
+ if (ret) { |
7190 |
+ dev_err(pfdev->dev, "Failed to create scheduler: %d.", ret); |
7191 |
+@@ -558,6 +660,7 @@ int panfrost_job_open(struct panfrost_file_priv *panfrost_priv) |
7192 |
+ int ret, i; |
7193 |
+ |
7194 |
+ for (i = 0; i < NUM_JOB_SLOTS; i++) { |
7195 |
++ mutex_init(&js->queue[i].lock); |
7196 |
+ sched = &js->queue[i].sched; |
7197 |
+ ret = drm_sched_entity_init(&panfrost_priv->sched_entity[i], |
7198 |
+ DRM_SCHED_PRIORITY_NORMAL, &sched, |
7199 |
+@@ -570,10 +673,14 @@ int panfrost_job_open(struct panfrost_file_priv *panfrost_priv) |
7200 |
+ |
7201 |
+ void panfrost_job_close(struct panfrost_file_priv *panfrost_priv) |
7202 |
+ { |
7203 |
++ struct panfrost_device *pfdev = panfrost_priv->pfdev; |
7204 |
++ struct panfrost_job_slot *js = pfdev->js; |
7205 |
+ int i; |
7206 |
+ |
7207 |
+- for (i = 0; i < NUM_JOB_SLOTS; i++) |
7208 |
++ for (i = 0; i < NUM_JOB_SLOTS; i++) { |
7209 |
+ drm_sched_entity_destroy(&panfrost_priv->sched_entity[i]); |
7210 |
++ mutex_destroy(&js->queue[i].lock); |
7211 |
++ } |
7212 |
+ } |
7213 |
+ |
7214 |
+ int panfrost_job_is_idle(struct panfrost_device *pfdev) |
7215 |
+diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c |
7216 |
+index c3aa39bd38ecd..b5259cb1383fc 100644 |
7217 |
+--- a/drivers/gpu/drm/tve200/tve200_drv.c |
7218 |
++++ b/drivers/gpu/drm/tve200/tve200_drv.c |
7219 |
+@@ -200,8 +200,8 @@ static int tve200_probe(struct platform_device *pdev) |
7220 |
+ } |
7221 |
+ |
7222 |
+ irq = platform_get_irq(pdev, 0); |
7223 |
+- if (!irq) { |
7224 |
+- ret = -EINVAL; |
7225 |
++ if (irq < 0) { |
7226 |
++ ret = irq; |
7227 |
+ goto clk_disable; |
7228 |
+ } |
7229 |
+ |
7230 |
+diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c |
7231 |
+index fef43f4e3bac4..edcfd8c120c44 100644 |
7232 |
+--- a/drivers/gpu/drm/udl/udl_modeset.c |
7233 |
++++ b/drivers/gpu/drm/udl/udl_modeset.c |
7234 |
+@@ -303,8 +303,10 @@ static int udl_handle_damage(struct drm_framebuffer *fb, int x, int y, |
7235 |
+ } |
7236 |
+ |
7237 |
+ urb = udl_get_urb(dev); |
7238 |
+- if (!urb) |
7239 |
++ if (!urb) { |
7240 |
++ ret = -ENOMEM; |
7241 |
+ goto out_drm_gem_shmem_vunmap; |
7242 |
++ } |
7243 |
+ cmd = urb->transfer_buffer; |
7244 |
+ |
7245 |
+ for (i = clip.y1; i < clip.y2; i++) { |
7246 |
+diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c |
7247 |
+index fa69b94debd9b..7596dc1646484 100644 |
7248 |
+--- a/drivers/hsi/controllers/omap_ssi_core.c |
7249 |
++++ b/drivers/hsi/controllers/omap_ssi_core.c |
7250 |
+@@ -355,7 +355,7 @@ static int ssi_add_controller(struct hsi_controller *ssi, |
7251 |
+ |
7252 |
+ err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL); |
7253 |
+ if (err < 0) |
7254 |
+- goto out_err; |
7255 |
++ return err; |
7256 |
+ ssi->id = err; |
7257 |
+ |
7258 |
+ ssi->owner = THIS_MODULE; |
7259 |
+diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c |
7260 |
+index 41fb17e0d6416..ad11cbddc3a7b 100644 |
7261 |
+--- a/drivers/hwmon/ina3221.c |
7262 |
++++ b/drivers/hwmon/ina3221.c |
7263 |
+@@ -489,7 +489,7 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable) |
7264 |
+ |
7265 |
+ /* For enabling routine, increase refcount and resume() at first */ |
7266 |
+ if (enable) { |
7267 |
+- ret = pm_runtime_get_sync(ina->pm_dev); |
7268 |
++ ret = pm_runtime_resume_and_get(ina->pm_dev); |
7269 |
+ if (ret < 0) { |
7270 |
+ dev_err(dev, "Failed to get PM runtime\n"); |
7271 |
+ return ret; |
7272 |
+diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c |
7273 |
+index a250481b5a97f..3bc2551577a30 100644 |
7274 |
+--- a/drivers/hwmon/k10temp.c |
7275 |
++++ b/drivers/hwmon/k10temp.c |
7276 |
+@@ -11,13 +11,6 @@ |
7277 |
+ * convert raw register values is from https://github.com/ocerman/zenpower. |
7278 |
+ * The information is not confirmed from chip datasheets, but experiments |
7279 |
+ * suggest that it provides reasonable temperature values. |
7280 |
+- * - Register addresses to read chip voltage and current are also from |
7281 |
+- * https://github.com/ocerman/zenpower, and not confirmed from chip |
7282 |
+- * datasheets. Current calibration is board specific and not typically |
7283 |
+- * shared by board vendors. For this reason, current values are |
7284 |
+- * normalized to report 1A/LSB for core current and and 0.25A/LSB for SoC |
7285 |
+- * current. Reported values can be adjusted using the sensors configuration |
7286 |
+- * file. |
7287 |
+ */ |
7288 |
+ |
7289 |
+ #include <linux/bitops.h> |
7290 |
+@@ -109,10 +102,7 @@ struct k10temp_data { |
7291 |
+ int temp_offset; |
7292 |
+ u32 temp_adjust_mask; |
7293 |
+ u32 show_temp; |
7294 |
+- u32 svi_addr[2]; |
7295 |
+ bool is_zen; |
7296 |
+- bool show_current; |
7297 |
+- int cfactor[2]; |
7298 |
+ }; |
7299 |
+ |
7300 |
+ #define TCTL_BIT 0 |
7301 |
+@@ -137,16 +127,6 @@ static const struct tctl_offset tctl_offset_table[] = { |
7302 |
+ { 0x17, "AMD Ryzen Threadripper 29", 27000 }, /* 29{20,50,70,90}[W]X */ |
7303 |
+ }; |
7304 |
+ |
7305 |
+-static bool is_threadripper(void) |
7306 |
+-{ |
7307 |
+- return strstr(boot_cpu_data.x86_model_id, "Threadripper"); |
7308 |
+-} |
7309 |
+- |
7310 |
+-static bool is_epyc(void) |
7311 |
+-{ |
7312 |
+- return strstr(boot_cpu_data.x86_model_id, "EPYC"); |
7313 |
+-} |
7314 |
+- |
7315 |
+ static void read_htcreg_pci(struct pci_dev *pdev, u32 *regval) |
7316 |
+ { |
7317 |
+ pci_read_config_dword(pdev, REG_HARDWARE_THERMAL_CONTROL, regval); |
7318 |
+@@ -211,16 +191,6 @@ static const char *k10temp_temp_label[] = { |
7319 |
+ "Tccd8", |
7320 |
+ }; |
7321 |
+ |
7322 |
+-static const char *k10temp_in_label[] = { |
7323 |
+- "Vcore", |
7324 |
+- "Vsoc", |
7325 |
+-}; |
7326 |
+- |
7327 |
+-static const char *k10temp_curr_label[] = { |
7328 |
+- "Icore", |
7329 |
+- "Isoc", |
7330 |
+-}; |
7331 |
+- |
7332 |
+ static int k10temp_read_labels(struct device *dev, |
7333 |
+ enum hwmon_sensor_types type, |
7334 |
+ u32 attr, int channel, const char **str) |
7335 |
+@@ -229,50 +199,6 @@ static int k10temp_read_labels(struct device *dev, |
7336 |
+ case hwmon_temp: |
7337 |
+ *str = k10temp_temp_label[channel]; |
7338 |
+ break; |
7339 |
+- case hwmon_in: |
7340 |
+- *str = k10temp_in_label[channel]; |
7341 |
+- break; |
7342 |
+- case hwmon_curr: |
7343 |
+- *str = k10temp_curr_label[channel]; |
7344 |
+- break; |
7345 |
+- default: |
7346 |
+- return -EOPNOTSUPP; |
7347 |
+- } |
7348 |
+- return 0; |
7349 |
+-} |
7350 |
+- |
7351 |
+-static int k10temp_read_curr(struct device *dev, u32 attr, int channel, |
7352 |
+- long *val) |
7353 |
+-{ |
7354 |
+- struct k10temp_data *data = dev_get_drvdata(dev); |
7355 |
+- u32 regval; |
7356 |
+- |
7357 |
+- switch (attr) { |
7358 |
+- case hwmon_curr_input: |
7359 |
+- amd_smn_read(amd_pci_dev_to_node_id(data->pdev), |
7360 |
+- data->svi_addr[channel], ®val); |
7361 |
+- *val = DIV_ROUND_CLOSEST(data->cfactor[channel] * |
7362 |
+- (regval & 0xff), |
7363 |
+- 1000); |
7364 |
+- break; |
7365 |
+- default: |
7366 |
+- return -EOPNOTSUPP; |
7367 |
+- } |
7368 |
+- return 0; |
7369 |
+-} |
7370 |
+- |
7371 |
+-static int k10temp_read_in(struct device *dev, u32 attr, int channel, long *val) |
7372 |
+-{ |
7373 |
+- struct k10temp_data *data = dev_get_drvdata(dev); |
7374 |
+- u32 regval; |
7375 |
+- |
7376 |
+- switch (attr) { |
7377 |
+- case hwmon_in_input: |
7378 |
+- amd_smn_read(amd_pci_dev_to_node_id(data->pdev), |
7379 |
+- data->svi_addr[channel], ®val); |
7380 |
+- regval = (regval >> 16) & 0xff; |
7381 |
+- *val = DIV_ROUND_CLOSEST(155000 - regval * 625, 100); |
7382 |
+- break; |
7383 |
+ default: |
7384 |
+ return -EOPNOTSUPP; |
7385 |
+ } |
7386 |
+@@ -331,10 +257,6 @@ static int k10temp_read(struct device *dev, enum hwmon_sensor_types type, |
7387 |
+ switch (type) { |
7388 |
+ case hwmon_temp: |
7389 |
+ return k10temp_read_temp(dev, attr, channel, val); |
7390 |
+- case hwmon_in: |
7391 |
+- return k10temp_read_in(dev, attr, channel, val); |
7392 |
+- case hwmon_curr: |
7393 |
+- return k10temp_read_curr(dev, attr, channel, val); |
7394 |
+ default: |
7395 |
+ return -EOPNOTSUPP; |
7396 |
+ } |
7397 |
+@@ -383,11 +305,6 @@ static umode_t k10temp_is_visible(const void *_data, |
7398 |
+ return 0; |
7399 |
+ } |
7400 |
+ break; |
7401 |
+- case hwmon_in: |
7402 |
+- case hwmon_curr: |
7403 |
+- if (!data->show_current) |
7404 |
+- return 0; |
7405 |
+- break; |
7406 |
+ default: |
7407 |
+ return 0; |
7408 |
+ } |
7409 |
+@@ -517,20 +434,10 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
7410 |
+ case 0x8: /* Zen+ */ |
7411 |
+ case 0x11: /* Zen APU */ |
7412 |
+ case 0x18: /* Zen+ APU */ |
7413 |
+- data->show_current = !is_threadripper() && !is_epyc(); |
7414 |
+- data->svi_addr[0] = F17H_M01H_SVI_TEL_PLANE0; |
7415 |
+- data->svi_addr[1] = F17H_M01H_SVI_TEL_PLANE1; |
7416 |
+- data->cfactor[0] = F17H_M01H_CFACTOR_ICORE; |
7417 |
+- data->cfactor[1] = F17H_M01H_CFACTOR_ISOC; |
7418 |
+ k10temp_get_ccd_support(pdev, data, 4); |
7419 |
+ break; |
7420 |
+ case 0x31: /* Zen2 Threadripper */ |
7421 |
+ case 0x71: /* Zen2 */ |
7422 |
+- data->show_current = !is_threadripper() && !is_epyc(); |
7423 |
+- data->cfactor[0] = F17H_M31H_CFACTOR_ICORE; |
7424 |
+- data->cfactor[1] = F17H_M31H_CFACTOR_ISOC; |
7425 |
+- data->svi_addr[0] = F17H_M31H_SVI_TEL_PLANE0; |
7426 |
+- data->svi_addr[1] = F17H_M31H_SVI_TEL_PLANE1; |
7427 |
+ k10temp_get_ccd_support(pdev, data, 8); |
7428 |
+ break; |
7429 |
+ } |
7430 |
+@@ -542,11 +449,6 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
7431 |
+ |
7432 |
+ switch (boot_cpu_data.x86_model) { |
7433 |
+ case 0x0 ... 0x1: /* Zen3 */ |
7434 |
+- data->show_current = true; |
7435 |
+- data->svi_addr[0] = F19H_M01_SVI_TEL_PLANE0; |
7436 |
+- data->svi_addr[1] = F19H_M01_SVI_TEL_PLANE1; |
7437 |
+- data->cfactor[0] = F19H_M01H_CFACTOR_ICORE; |
7438 |
+- data->cfactor[1] = F19H_M01H_CFACTOR_ISOC; |
7439 |
+ k10temp_get_ccd_support(pdev, data, 8); |
7440 |
+ break; |
7441 |
+ } |
7442 |
+diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c |
7443 |
+index 99430f6cf5a5d..a61313f320bda 100644 |
7444 |
+--- a/drivers/hwtracing/coresight/coresight-catu.c |
7445 |
++++ b/drivers/hwtracing/coresight/coresight-catu.c |
7446 |
+@@ -567,7 +567,7 @@ out: |
7447 |
+ return ret; |
7448 |
+ } |
7449 |
+ |
7450 |
+-static int __exit catu_remove(struct amba_device *adev) |
7451 |
++static int catu_remove(struct amba_device *adev) |
7452 |
+ { |
7453 |
+ struct catu_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7454 |
+ |
7455 |
+diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c |
7456 |
+index d28eae93e55c8..61dbc1afd8da5 100644 |
7457 |
+--- a/drivers/hwtracing/coresight/coresight-cti-core.c |
7458 |
++++ b/drivers/hwtracing/coresight/coresight-cti-core.c |
7459 |
+@@ -836,7 +836,7 @@ static void cti_device_release(struct device *dev) |
7460 |
+ if (drvdata->csdev_release) |
7461 |
+ drvdata->csdev_release(dev); |
7462 |
+ } |
7463 |
+-static int __exit cti_remove(struct amba_device *adev) |
7464 |
++static int cti_remove(struct amba_device *adev) |
7465 |
+ { |
7466 |
+ struct cti_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7467 |
+ |
7468 |
+diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c |
7469 |
+index 1b320ab581caf..0cf6f0b947b6f 100644 |
7470 |
+--- a/drivers/hwtracing/coresight/coresight-etb10.c |
7471 |
++++ b/drivers/hwtracing/coresight/coresight-etb10.c |
7472 |
+@@ -803,7 +803,7 @@ err_misc_register: |
7473 |
+ return ret; |
7474 |
+ } |
7475 |
+ |
7476 |
+-static int __exit etb_remove(struct amba_device *adev) |
7477 |
++static int etb_remove(struct amba_device *adev) |
7478 |
+ { |
7479 |
+ struct etb_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7480 |
+ |
7481 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c |
7482 |
+index 47f610b1c2b18..5bf5a5a4ce6d1 100644 |
7483 |
+--- a/drivers/hwtracing/coresight/coresight-etm3x-core.c |
7484 |
++++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c |
7485 |
+@@ -902,14 +902,14 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) |
7486 |
+ return 0; |
7487 |
+ } |
7488 |
+ |
7489 |
+-static void __exit clear_etmdrvdata(void *info) |
7490 |
++static void clear_etmdrvdata(void *info) |
7491 |
+ { |
7492 |
+ int cpu = *(int *)info; |
7493 |
+ |
7494 |
+ etmdrvdata[cpu] = NULL; |
7495 |
+ } |
7496 |
+ |
7497 |
+-static int __exit etm_remove(struct amba_device *adev) |
7498 |
++static int etm_remove(struct amba_device *adev) |
7499 |
+ { |
7500 |
+ struct etm_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7501 |
+ |
7502 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c |
7503 |
+index e516e5b879e3a..95b54b0a36252 100644 |
7504 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c |
7505 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c |
7506 |
+@@ -1570,14 +1570,14 @@ static struct amba_cs_uci_id uci_id_etm4[] = { |
7507 |
+ } |
7508 |
+ }; |
7509 |
+ |
7510 |
+-static void __exit clear_etmdrvdata(void *info) |
7511 |
++static void clear_etmdrvdata(void *info) |
7512 |
+ { |
7513 |
+ int cpu = *(int *)info; |
7514 |
+ |
7515 |
+ etmdrvdata[cpu] = NULL; |
7516 |
+ } |
7517 |
+ |
7518 |
+-static int __exit etm4_remove(struct amba_device *adev) |
7519 |
++static int etm4_remove(struct amba_device *adev) |
7520 |
+ { |
7521 |
+ struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7522 |
+ |
7523 |
+diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c |
7524 |
+index af40814ce5603..3fc6c678b51d8 100644 |
7525 |
+--- a/drivers/hwtracing/coresight/coresight-funnel.c |
7526 |
++++ b/drivers/hwtracing/coresight/coresight-funnel.c |
7527 |
+@@ -274,7 +274,7 @@ out_disable_clk: |
7528 |
+ return ret; |
7529 |
+ } |
7530 |
+ |
7531 |
+-static int __exit funnel_remove(struct device *dev) |
7532 |
++static int funnel_remove(struct device *dev) |
7533 |
+ { |
7534 |
+ struct funnel_drvdata *drvdata = dev_get_drvdata(dev); |
7535 |
+ |
7536 |
+@@ -328,7 +328,7 @@ static int static_funnel_probe(struct platform_device *pdev) |
7537 |
+ return ret; |
7538 |
+ } |
7539 |
+ |
7540 |
+-static int __exit static_funnel_remove(struct platform_device *pdev) |
7541 |
++static int static_funnel_remove(struct platform_device *pdev) |
7542 |
+ { |
7543 |
+ funnel_remove(&pdev->dev); |
7544 |
+ pm_runtime_disable(&pdev->dev); |
7545 |
+@@ -370,7 +370,7 @@ static int dynamic_funnel_probe(struct amba_device *adev, |
7546 |
+ return funnel_probe(&adev->dev, &adev->res); |
7547 |
+ } |
7548 |
+ |
7549 |
+-static int __exit dynamic_funnel_remove(struct amba_device *adev) |
7550 |
++static int dynamic_funnel_remove(struct amba_device *adev) |
7551 |
+ { |
7552 |
+ return funnel_remove(&adev->dev); |
7553 |
+ } |
7554 |
+diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c |
7555 |
+index 62afdde0e5eab..38008aca2c0f4 100644 |
7556 |
+--- a/drivers/hwtracing/coresight/coresight-replicator.c |
7557 |
++++ b/drivers/hwtracing/coresight/coresight-replicator.c |
7558 |
+@@ -291,7 +291,7 @@ out_disable_clk: |
7559 |
+ return ret; |
7560 |
+ } |
7561 |
+ |
7562 |
+-static int __exit replicator_remove(struct device *dev) |
7563 |
++static int replicator_remove(struct device *dev) |
7564 |
+ { |
7565 |
+ struct replicator_drvdata *drvdata = dev_get_drvdata(dev); |
7566 |
+ |
7567 |
+@@ -318,7 +318,7 @@ static int static_replicator_probe(struct platform_device *pdev) |
7568 |
+ return ret; |
7569 |
+ } |
7570 |
+ |
7571 |
+-static int __exit static_replicator_remove(struct platform_device *pdev) |
7572 |
++static int static_replicator_remove(struct platform_device *pdev) |
7573 |
+ { |
7574 |
+ replicator_remove(&pdev->dev); |
7575 |
+ pm_runtime_disable(&pdev->dev); |
7576 |
+@@ -388,7 +388,7 @@ static int dynamic_replicator_probe(struct amba_device *adev, |
7577 |
+ return replicator_probe(&adev->dev, &adev->res); |
7578 |
+ } |
7579 |
+ |
7580 |
+-static int __exit dynamic_replicator_remove(struct amba_device *adev) |
7581 |
++static int dynamic_replicator_remove(struct amba_device *adev) |
7582 |
+ { |
7583 |
+ return replicator_remove(&adev->dev); |
7584 |
+ } |
7585 |
+diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c |
7586 |
+index b0ad912651a99..587c1d7f25208 100644 |
7587 |
+--- a/drivers/hwtracing/coresight/coresight-stm.c |
7588 |
++++ b/drivers/hwtracing/coresight/coresight-stm.c |
7589 |
+@@ -951,7 +951,7 @@ stm_unregister: |
7590 |
+ return ret; |
7591 |
+ } |
7592 |
+ |
7593 |
+-static int __exit stm_remove(struct amba_device *adev) |
7594 |
++static int stm_remove(struct amba_device *adev) |
7595 |
+ { |
7596 |
+ struct stm_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7597 |
+ |
7598 |
+diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c |
7599 |
+index 5653e0945c74b..8169dff5a9f6a 100644 |
7600 |
+--- a/drivers/hwtracing/coresight/coresight-tmc-core.c |
7601 |
++++ b/drivers/hwtracing/coresight/coresight-tmc-core.c |
7602 |
+@@ -559,7 +559,7 @@ out: |
7603 |
+ spin_unlock_irqrestore(&drvdata->spinlock, flags); |
7604 |
+ } |
7605 |
+ |
7606 |
+-static int __exit tmc_remove(struct amba_device *adev) |
7607 |
++static int tmc_remove(struct amba_device *adev) |
7608 |
+ { |
7609 |
+ struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7610 |
+ |
7611 |
+diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c |
7612 |
+index 566c57e035961..5b35029461a0c 100644 |
7613 |
+--- a/drivers/hwtracing/coresight/coresight-tpiu.c |
7614 |
++++ b/drivers/hwtracing/coresight/coresight-tpiu.c |
7615 |
+@@ -173,7 +173,7 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) |
7616 |
+ return PTR_ERR(drvdata->csdev); |
7617 |
+ } |
7618 |
+ |
7619 |
+-static int __exit tpiu_remove(struct amba_device *adev) |
7620 |
++static int tpiu_remove(struct amba_device *adev) |
7621 |
+ { |
7622 |
+ struct tpiu_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
7623 |
+ |
7624 |
+diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c |
7625 |
+index 8b4c35f47a70f..dce75b85253c1 100644 |
7626 |
+--- a/drivers/i2c/busses/i2c-qcom-geni.c |
7627 |
++++ b/drivers/i2c/busses/i2c-qcom-geni.c |
7628 |
+@@ -366,6 +366,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
7629 |
+ geni_se_select_mode(se, GENI_SE_FIFO); |
7630 |
+ |
7631 |
+ writel_relaxed(len, se->base + SE_I2C_RX_TRANS_LEN); |
7632 |
++ geni_se_setup_m_cmd(se, I2C_READ, m_param); |
7633 |
+ |
7634 |
+ if (dma_buf && geni_se_rx_dma_prep(se, dma_buf, len, &rx_dma)) { |
7635 |
+ geni_se_select_mode(se, GENI_SE_FIFO); |
7636 |
+@@ -373,8 +374,6 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
7637 |
+ dma_buf = NULL; |
7638 |
+ } |
7639 |
+ |
7640 |
+- geni_se_setup_m_cmd(se, I2C_READ, m_param); |
7641 |
+- |
7642 |
+ time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); |
7643 |
+ if (!time_left) |
7644 |
+ geni_i2c_abort_xfer(gi2c); |
7645 |
+@@ -408,6 +407,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
7646 |
+ geni_se_select_mode(se, GENI_SE_FIFO); |
7647 |
+ |
7648 |
+ writel_relaxed(len, se->base + SE_I2C_TX_TRANS_LEN); |
7649 |
++ geni_se_setup_m_cmd(se, I2C_WRITE, m_param); |
7650 |
+ |
7651 |
+ if (dma_buf && geni_se_tx_dma_prep(se, dma_buf, len, &tx_dma)) { |
7652 |
+ geni_se_select_mode(se, GENI_SE_FIFO); |
7653 |
+@@ -415,8 +415,6 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, |
7654 |
+ dma_buf = NULL; |
7655 |
+ } |
7656 |
+ |
7657 |
+- geni_se_setup_m_cmd(se, I2C_WRITE, m_param); |
7658 |
+- |
7659 |
+ if (!dma_buf) /* Get FIFO IRQ */ |
7660 |
+ writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG); |
7661 |
+ |
7662 |
+diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig |
7663 |
+index 91ae90514aff4..17e9ceb9c6c48 100644 |
7664 |
+--- a/drivers/iio/adc/Kconfig |
7665 |
++++ b/drivers/iio/adc/Kconfig |
7666 |
+@@ -295,7 +295,7 @@ config ASPEED_ADC |
7667 |
+ config AT91_ADC |
7668 |
+ tristate "Atmel AT91 ADC" |
7669 |
+ depends on ARCH_AT91 || COMPILE_TEST |
7670 |
+- depends on INPUT && SYSFS |
7671 |
++ depends on INPUT && SYSFS && OF |
7672 |
+ select IIO_BUFFER |
7673 |
+ select IIO_TRIGGERED_BUFFER |
7674 |
+ help |
7675 |
+diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c |
7676 |
+index 86039e9ecaca1..3a6f239d4acca 100644 |
7677 |
+--- a/drivers/iio/adc/ad_sigma_delta.c |
7678 |
++++ b/drivers/iio/adc/ad_sigma_delta.c |
7679 |
+@@ -57,7 +57,7 @@ EXPORT_SYMBOL_GPL(ad_sd_set_comm); |
7680 |
+ int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg, |
7681 |
+ unsigned int size, unsigned int val) |
7682 |
+ { |
7683 |
+- uint8_t *data = sigma_delta->data; |
7684 |
++ uint8_t *data = sigma_delta->tx_buf; |
7685 |
+ struct spi_transfer t = { |
7686 |
+ .tx_buf = data, |
7687 |
+ .len = size + 1, |
7688 |
+@@ -99,7 +99,7 @@ EXPORT_SYMBOL_GPL(ad_sd_write_reg); |
7689 |
+ static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta, |
7690 |
+ unsigned int reg, unsigned int size, uint8_t *val) |
7691 |
+ { |
7692 |
+- uint8_t *data = sigma_delta->data; |
7693 |
++ uint8_t *data = sigma_delta->tx_buf; |
7694 |
+ int ret; |
7695 |
+ struct spi_transfer t[] = { |
7696 |
+ { |
7697 |
+@@ -146,22 +146,22 @@ int ad_sd_read_reg(struct ad_sigma_delta *sigma_delta, |
7698 |
+ { |
7699 |
+ int ret; |
7700 |
+ |
7701 |
+- ret = ad_sd_read_reg_raw(sigma_delta, reg, size, sigma_delta->data); |
7702 |
++ ret = ad_sd_read_reg_raw(sigma_delta, reg, size, sigma_delta->rx_buf); |
7703 |
+ if (ret < 0) |
7704 |
+ goto out; |
7705 |
+ |
7706 |
+ switch (size) { |
7707 |
+ case 4: |
7708 |
+- *val = get_unaligned_be32(sigma_delta->data); |
7709 |
++ *val = get_unaligned_be32(sigma_delta->rx_buf); |
7710 |
+ break; |
7711 |
+ case 3: |
7712 |
+- *val = get_unaligned_be24(&sigma_delta->data[0]); |
7713 |
++ *val = get_unaligned_be24(sigma_delta->rx_buf); |
7714 |
+ break; |
7715 |
+ case 2: |
7716 |
+- *val = get_unaligned_be16(sigma_delta->data); |
7717 |
++ *val = get_unaligned_be16(sigma_delta->rx_buf); |
7718 |
+ break; |
7719 |
+ case 1: |
7720 |
+- *val = sigma_delta->data[0]; |
7721 |
++ *val = sigma_delta->rx_buf[0]; |
7722 |
+ break; |
7723 |
+ default: |
7724 |
+ ret = -EINVAL; |
7725 |
+@@ -395,11 +395,9 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p) |
7726 |
+ struct iio_poll_func *pf = p; |
7727 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
7728 |
+ struct ad_sigma_delta *sigma_delta = iio_device_get_drvdata(indio_dev); |
7729 |
++ uint8_t *data = sigma_delta->rx_buf; |
7730 |
+ unsigned int reg_size; |
7731 |
+ unsigned int data_reg; |
7732 |
+- uint8_t data[16]; |
7733 |
+- |
7734 |
+- memset(data, 0x00, 16); |
7735 |
+ |
7736 |
+ reg_size = indio_dev->channels[0].scan_type.realbits + |
7737 |
+ indio_dev->channels[0].scan_type.shift; |
7738 |
+diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c |
7739 |
+index 9b2c548fae957..0a793e7cd53ee 100644 |
7740 |
+--- a/drivers/iio/adc/at91_adc.c |
7741 |
++++ b/drivers/iio/adc/at91_adc.c |
7742 |
+@@ -1469,7 +1469,7 @@ static struct platform_driver at91_adc_driver = { |
7743 |
+ .id_table = at91_adc_ids, |
7744 |
+ .driver = { |
7745 |
+ .name = DRIVER_NAME, |
7746 |
+- .of_match_table = of_match_ptr(at91_adc_dt_ids), |
7747 |
++ .of_match_table = at91_adc_dt_ids, |
7748 |
+ .pm = &at91_adc_pm_ops, |
7749 |
+ }, |
7750 |
+ }; |
7751 |
+diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c |
7752 |
+index 1f3d7d639d378..12584f1631d88 100644 |
7753 |
+--- a/drivers/iio/adc/rockchip_saradc.c |
7754 |
++++ b/drivers/iio/adc/rockchip_saradc.c |
7755 |
+@@ -462,7 +462,7 @@ static int rockchip_saradc_resume(struct device *dev) |
7756 |
+ |
7757 |
+ ret = clk_prepare_enable(info->clk); |
7758 |
+ if (ret) |
7759 |
+- return ret; |
7760 |
++ clk_disable_unprepare(info->pclk); |
7761 |
+ |
7762 |
+ return ret; |
7763 |
+ } |
7764 |
+diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c |
7765 |
+index 4b4fbe33930ce..b4a128b191889 100644 |
7766 |
+--- a/drivers/iio/adc/ti-ads124s08.c |
7767 |
++++ b/drivers/iio/adc/ti-ads124s08.c |
7768 |
+@@ -99,6 +99,14 @@ struct ads124s_private { |
7769 |
+ struct gpio_desc *reset_gpio; |
7770 |
+ struct spi_device *spi; |
7771 |
+ struct mutex lock; |
7772 |
++ /* |
7773 |
++ * Used to correctly align data. |
7774 |
++ * Ensure timestamp is naturally aligned. |
7775 |
++ * Note that the full buffer length may not be needed if not |
7776 |
++ * all channels are enabled, as long as the alignment of the |
7777 |
++ * timestamp is maintained. |
7778 |
++ */ |
7779 |
++ u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u32)] __aligned(8); |
7780 |
+ u8 data[5] ____cacheline_aligned; |
7781 |
+ }; |
7782 |
+ |
7783 |
+@@ -269,7 +277,6 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p) |
7784 |
+ struct iio_poll_func *pf = p; |
7785 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
7786 |
+ struct ads124s_private *priv = iio_priv(indio_dev); |
7787 |
+- u32 buffer[ADS124S08_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; |
7788 |
+ int scan_index, j = 0; |
7789 |
+ int ret; |
7790 |
+ |
7791 |
+@@ -284,7 +291,7 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p) |
7792 |
+ if (ret) |
7793 |
+ dev_err(&priv->spi->dev, "Start ADC conversions failed\n"); |
7794 |
+ |
7795 |
+- buffer[j] = ads124s_read(indio_dev, scan_index); |
7796 |
++ priv->buffer[j] = ads124s_read(indio_dev, scan_index); |
7797 |
+ ret = ads124s_write_cmd(indio_dev, ADS124S08_STOP_CONV); |
7798 |
+ if (ret) |
7799 |
+ dev_err(&priv->spi->dev, "Stop ADC conversions failed\n"); |
7800 |
+@@ -292,7 +299,7 @@ static irqreturn_t ads124s_trigger_handler(int irq, void *p) |
7801 |
+ j++; |
7802 |
+ } |
7803 |
+ |
7804 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
7805 |
++ iio_push_to_buffers_with_timestamp(indio_dev, priv->buffer, |
7806 |
+ pf->timestamp); |
7807 |
+ |
7808 |
+ iio_trigger_notify_done(indio_dev->trig); |
7809 |
+diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h |
7810 |
+index a82e040bd1098..32c2ea2d71129 100644 |
7811 |
+--- a/drivers/iio/imu/bmi160/bmi160.h |
7812 |
++++ b/drivers/iio/imu/bmi160/bmi160.h |
7813 |
+@@ -10,6 +10,13 @@ struct bmi160_data { |
7814 |
+ struct iio_trigger *trig; |
7815 |
+ struct regulator_bulk_data supplies[2]; |
7816 |
+ struct iio_mount_matrix orientation; |
7817 |
++ /* |
7818 |
++ * Ensure natural alignment for timestamp if present. |
7819 |
++ * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts. |
7820 |
++ * If fewer channels are enabled, less space may be needed, as |
7821 |
++ * long as the timestamp is still aligned to 8 bytes. |
7822 |
++ */ |
7823 |
++ __le16 buf[12] __aligned(8); |
7824 |
+ }; |
7825 |
+ |
7826 |
+ extern const struct regmap_config bmi160_regmap_config; |
7827 |
+diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c |
7828 |
+index 222ebb26f0132..82f03a4dc47a7 100644 |
7829 |
+--- a/drivers/iio/imu/bmi160/bmi160_core.c |
7830 |
++++ b/drivers/iio/imu/bmi160/bmi160_core.c |
7831 |
+@@ -427,8 +427,6 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) |
7832 |
+ struct iio_poll_func *pf = p; |
7833 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
7834 |
+ struct bmi160_data *data = iio_priv(indio_dev); |
7835 |
+- __le16 buf[16]; |
7836 |
+- /* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */ |
7837 |
+ int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L; |
7838 |
+ __le16 sample; |
7839 |
+ |
7840 |
+@@ -438,10 +436,10 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) |
7841 |
+ &sample, sizeof(sample)); |
7842 |
+ if (ret) |
7843 |
+ goto done; |
7844 |
+- buf[j++] = sample; |
7845 |
++ data->buf[j++] = sample; |
7846 |
+ } |
7847 |
+ |
7848 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buf, pf->timestamp); |
7849 |
++ iio_push_to_buffers_with_timestamp(indio_dev, data->buf, pf->timestamp); |
7850 |
+ done: |
7851 |
+ iio_trigger_notify_done(indio_dev->trig); |
7852 |
+ return IRQ_HANDLED; |
7853 |
+diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
7854 |
+index 42f485634d044..2ab1ac5a2412f 100644 |
7855 |
+--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
7856 |
++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
7857 |
+@@ -2255,19 +2255,35 @@ st_lsm6dsx_report_motion_event(struct st_lsm6dsx_hw *hw) |
7858 |
+ static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private) |
7859 |
+ { |
7860 |
+ struct st_lsm6dsx_hw *hw = private; |
7861 |
++ int fifo_len = 0, len; |
7862 |
+ bool event; |
7863 |
+- int count; |
7864 |
+ |
7865 |
+ event = st_lsm6dsx_report_motion_event(hw); |
7866 |
+ |
7867 |
+ if (!hw->settings->fifo_ops.read_fifo) |
7868 |
+ return event ? IRQ_HANDLED : IRQ_NONE; |
7869 |
+ |
7870 |
+- mutex_lock(&hw->fifo_lock); |
7871 |
+- count = hw->settings->fifo_ops.read_fifo(hw); |
7872 |
+- mutex_unlock(&hw->fifo_lock); |
7873 |
++ /* |
7874 |
++ * If we are using edge IRQs, new samples can arrive while |
7875 |
++ * processing current interrupt since there are no hw |
7876 |
++ * guarantees the irq line stays "low" long enough to properly |
7877 |
++ * detect the new interrupt. In this case the new sample will |
7878 |
++ * be missed. |
7879 |
++ * Polling FIFO status register allow us to read new |
7880 |
++ * samples even if the interrupt arrives while processing |
7881 |
++ * previous data and the timeslot where the line is "low" is |
7882 |
++ * too short to be properly detected. |
7883 |
++ */ |
7884 |
++ do { |
7885 |
++ mutex_lock(&hw->fifo_lock); |
7886 |
++ len = hw->settings->fifo_ops.read_fifo(hw); |
7887 |
++ mutex_unlock(&hw->fifo_lock); |
7888 |
++ |
7889 |
++ if (len > 0) |
7890 |
++ fifo_len += len; |
7891 |
++ } while (len > 0); |
7892 |
+ |
7893 |
+- return count || event ? IRQ_HANDLED : IRQ_NONE; |
7894 |
++ return fifo_len || event ? IRQ_HANDLED : IRQ_NONE; |
7895 |
+ } |
7896 |
+ |
7897 |
+ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw) |
7898 |
+diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c |
7899 |
+index a4f6bb96d4f42..276b609d79174 100644 |
7900 |
+--- a/drivers/iio/industrialio-buffer.c |
7901 |
++++ b/drivers/iio/industrialio-buffer.c |
7902 |
+@@ -865,12 +865,12 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev, |
7903 |
+ indio_dev->masklength, |
7904 |
+ in_ind + 1); |
7905 |
+ while (in_ind != out_ind) { |
7906 |
+- in_ind = find_next_bit(indio_dev->active_scan_mask, |
7907 |
+- indio_dev->masklength, |
7908 |
+- in_ind + 1); |
7909 |
+ length = iio_storage_bytes_for_si(indio_dev, in_ind); |
7910 |
+ /* Make sure we are aligned */ |
7911 |
+ in_loc = roundup(in_loc, length) + length; |
7912 |
++ in_ind = find_next_bit(indio_dev->active_scan_mask, |
7913 |
++ indio_dev->masklength, |
7914 |
++ in_ind + 1); |
7915 |
+ } |
7916 |
+ length = iio_storage_bytes_for_si(indio_dev, in_ind); |
7917 |
+ out_loc = roundup(out_loc, length); |
7918 |
+diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c |
7919 |
+index aa2972b048334..31224a33bade3 100644 |
7920 |
+--- a/drivers/iio/light/rpr0521.c |
7921 |
++++ b/drivers/iio/light/rpr0521.c |
7922 |
+@@ -194,6 +194,17 @@ struct rpr0521_data { |
7923 |
+ bool pxs_need_dis; |
7924 |
+ |
7925 |
+ struct regmap *regmap; |
7926 |
++ |
7927 |
++ /* |
7928 |
++ * Ensure correct naturally aligned timestamp. |
7929 |
++ * Note that the read will put garbage data into |
7930 |
++ * the padding but this should not be a problem |
7931 |
++ */ |
7932 |
++ struct { |
7933 |
++ __le16 channels[3]; |
7934 |
++ u8 garbage; |
7935 |
++ s64 ts __aligned(8); |
7936 |
++ } scan; |
7937 |
+ }; |
7938 |
+ |
7939 |
+ static IIO_CONST_ATTR(in_intensity_scale_available, RPR0521_ALS_SCALE_AVAIL); |
7940 |
+@@ -449,8 +460,6 @@ static irqreturn_t rpr0521_trigger_consumer_handler(int irq, void *p) |
7941 |
+ struct rpr0521_data *data = iio_priv(indio_dev); |
7942 |
+ int err; |
7943 |
+ |
7944 |
+- u8 buffer[16]; /* 3 16-bit channels + padding + ts */ |
7945 |
+- |
7946 |
+ /* Use irq timestamp when reasonable. */ |
7947 |
+ if (iio_trigger_using_own(indio_dev) && data->irq_timestamp) { |
7948 |
+ pf->timestamp = data->irq_timestamp; |
7949 |
+@@ -461,11 +470,11 @@ static irqreturn_t rpr0521_trigger_consumer_handler(int irq, void *p) |
7950 |
+ pf->timestamp = iio_get_time_ns(indio_dev); |
7951 |
+ |
7952 |
+ err = regmap_bulk_read(data->regmap, RPR0521_REG_PXS_DATA, |
7953 |
+- &buffer, |
7954 |
++ data->scan.channels, |
7955 |
+ (3 * 2) + 1); /* 3 * 16-bit + (discarded) int clear reg. */ |
7956 |
+ if (!err) |
7957 |
+ iio_push_to_buffers_with_timestamp(indio_dev, |
7958 |
+- buffer, pf->timestamp); |
7959 |
++ &data->scan, pf->timestamp); |
7960 |
+ else |
7961 |
+ dev_err(&data->client->dev, |
7962 |
+ "Trigger consumer can't read from sensor.\n"); |
7963 |
+diff --git a/drivers/iio/light/st_uvis25.h b/drivers/iio/light/st_uvis25.h |
7964 |
+index 78bc56aad1299..283086887caf5 100644 |
7965 |
+--- a/drivers/iio/light/st_uvis25.h |
7966 |
++++ b/drivers/iio/light/st_uvis25.h |
7967 |
+@@ -27,6 +27,11 @@ struct st_uvis25_hw { |
7968 |
+ struct iio_trigger *trig; |
7969 |
+ bool enabled; |
7970 |
+ int irq; |
7971 |
++ /* Ensure timestamp is naturally aligned */ |
7972 |
++ struct { |
7973 |
++ u8 chan; |
7974 |
++ s64 ts __aligned(8); |
7975 |
++ } scan; |
7976 |
+ }; |
7977 |
+ |
7978 |
+ extern const struct dev_pm_ops st_uvis25_pm_ops; |
7979 |
+diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c |
7980 |
+index a18a82e6bbf5d..1055594b22764 100644 |
7981 |
+--- a/drivers/iio/light/st_uvis25_core.c |
7982 |
++++ b/drivers/iio/light/st_uvis25_core.c |
7983 |
+@@ -232,17 +232,19 @@ static const struct iio_buffer_setup_ops st_uvis25_buffer_ops = { |
7984 |
+ |
7985 |
+ static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p) |
7986 |
+ { |
7987 |
+- u8 buffer[ALIGN(sizeof(u8), sizeof(s64)) + sizeof(s64)]; |
7988 |
+ struct iio_poll_func *pf = p; |
7989 |
+ struct iio_dev *iio_dev = pf->indio_dev; |
7990 |
+ struct st_uvis25_hw *hw = iio_priv(iio_dev); |
7991 |
++ unsigned int val; |
7992 |
+ int err; |
7993 |
+ |
7994 |
+- err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR, (int *)buffer); |
7995 |
++ err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR, &val); |
7996 |
+ if (err < 0) |
7997 |
+ goto out; |
7998 |
+ |
7999 |
+- iio_push_to_buffers_with_timestamp(iio_dev, buffer, |
8000 |
++ hw->scan.chan = val; |
8001 |
++ |
8002 |
++ iio_push_to_buffers_with_timestamp(iio_dev, &hw->scan, |
8003 |
+ iio_get_time_ns(iio_dev)); |
8004 |
+ |
8005 |
+ out: |
8006 |
+diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c |
8007 |
+index 838b13c8bb3db..c96415a1aeadd 100644 |
8008 |
+--- a/drivers/iio/magnetometer/mag3110.c |
8009 |
++++ b/drivers/iio/magnetometer/mag3110.c |
8010 |
+@@ -56,6 +56,12 @@ struct mag3110_data { |
8011 |
+ int sleep_val; |
8012 |
+ struct regulator *vdd_reg; |
8013 |
+ struct regulator *vddio_reg; |
8014 |
++ /* Ensure natural alignment of timestamp */ |
8015 |
++ struct { |
8016 |
++ __be16 channels[3]; |
8017 |
++ u8 temperature; |
8018 |
++ s64 ts __aligned(8); |
8019 |
++ } scan; |
8020 |
+ }; |
8021 |
+ |
8022 |
+ static int mag3110_request(struct mag3110_data *data) |
8023 |
+@@ -387,10 +393,9 @@ static irqreturn_t mag3110_trigger_handler(int irq, void *p) |
8024 |
+ struct iio_poll_func *pf = p; |
8025 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
8026 |
+ struct mag3110_data *data = iio_priv(indio_dev); |
8027 |
+- u8 buffer[16]; /* 3 16-bit channels + 1 byte temp + padding + ts */ |
8028 |
+ int ret; |
8029 |
+ |
8030 |
+- ret = mag3110_read(data, (__be16 *) buffer); |
8031 |
++ ret = mag3110_read(data, data->scan.channels); |
8032 |
+ if (ret < 0) |
8033 |
+ goto done; |
8034 |
+ |
8035 |
+@@ -399,10 +404,10 @@ static irqreturn_t mag3110_trigger_handler(int irq, void *p) |
8036 |
+ MAG3110_DIE_TEMP); |
8037 |
+ if (ret < 0) |
8038 |
+ goto done; |
8039 |
+- buffer[6] = ret; |
8040 |
++ data->scan.temperature = ret; |
8041 |
+ } |
8042 |
+ |
8043 |
+- iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
8044 |
++ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
8045 |
+ iio_get_time_ns(indio_dev)); |
8046 |
+ |
8047 |
+ done: |
8048 |
+diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c |
8049 |
+index ccdb0b70e48ca..1eb9e7b29e050 100644 |
8050 |
+--- a/drivers/iio/pressure/mpl3115.c |
8051 |
++++ b/drivers/iio/pressure/mpl3115.c |
8052 |
+@@ -144,7 +144,14 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p) |
8053 |
+ struct iio_poll_func *pf = p; |
8054 |
+ struct iio_dev *indio_dev = pf->indio_dev; |
8055 |
+ struct mpl3115_data *data = iio_priv(indio_dev); |
8056 |
+- u8 buffer[16]; /* 32-bit channel + 16-bit channel + padding + ts */ |
8057 |
++ /* |
8058 |
++ * 32-bit channel + 16-bit channel + padding + ts |
8059 |
++ * Note that it is possible for only one of the first 2 |
8060 |
++ * channels to be enabled. If that happens, the first element |
8061 |
++ * of the buffer may be either 16 or 32-bits. As such we cannot |
8062 |
++ * use a simple structure definition to express this data layout. |
8063 |
++ */ |
8064 |
++ u8 buffer[16] __aligned(8); |
8065 |
+ int ret, pos = 0; |
8066 |
+ |
8067 |
+ mutex_lock(&data->lock); |
8068 |
+diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c |
8069 |
+index f59bf8d585866..410de837d0417 100644 |
8070 |
+--- a/drivers/iio/trigger/iio-trig-hrtimer.c |
8071 |
++++ b/drivers/iio/trigger/iio-trig-hrtimer.c |
8072 |
+@@ -102,7 +102,7 @@ static int iio_trig_hrtimer_set_state(struct iio_trigger *trig, bool state) |
8073 |
+ |
8074 |
+ if (state) |
8075 |
+ hrtimer_start(&trig_info->timer, trig_info->period, |
8076 |
+- HRTIMER_MODE_REL); |
8077 |
++ HRTIMER_MODE_REL_HARD); |
8078 |
+ else |
8079 |
+ hrtimer_cancel(&trig_info->timer); |
8080 |
+ |
8081 |
+@@ -132,7 +132,7 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name) |
8082 |
+ trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops; |
8083 |
+ trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups; |
8084 |
+ |
8085 |
+- hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
8086 |
++ hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); |
8087 |
+ trig_info->timer.function = iio_hrtimer_trig_handler; |
8088 |
+ |
8089 |
+ trig_info->sampling_frequency = HRTIMER_DEFAULT_SAMPLING_FREQUENCY; |
8090 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
8091 |
+index a77750b8954db..c51b84b2d2f37 100644 |
8092 |
+--- a/drivers/infiniband/core/cma.c |
8093 |
++++ b/drivers/infiniband/core/cma.c |
8094 |
+@@ -477,6 +477,10 @@ static void cma_release_dev(struct rdma_id_private *id_priv) |
8095 |
+ list_del(&id_priv->list); |
8096 |
+ cma_dev_put(id_priv->cma_dev); |
8097 |
+ id_priv->cma_dev = NULL; |
8098 |
++ if (id_priv->id.route.addr.dev_addr.sgid_attr) { |
8099 |
++ rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr); |
8100 |
++ id_priv->id.route.addr.dev_addr.sgid_attr = NULL; |
8101 |
++ } |
8102 |
+ mutex_unlock(&lock); |
8103 |
+ } |
8104 |
+ |
8105 |
+@@ -1861,9 +1865,6 @@ static void _destroy_id(struct rdma_id_private *id_priv, |
8106 |
+ |
8107 |
+ kfree(id_priv->id.route.path_rec); |
8108 |
+ |
8109 |
+- if (id_priv->id.route.addr.dev_addr.sgid_attr) |
8110 |
+- rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr); |
8111 |
+- |
8112 |
+ put_net(id_priv->id.route.addr.dev_addr.net); |
8113 |
+ rdma_restrack_del(&id_priv->res); |
8114 |
+ kfree(id_priv); |
8115 |
+@@ -2495,8 +2496,9 @@ static int cma_listen_handler(struct rdma_cm_id *id, |
8116 |
+ return id_priv->id.event_handler(id, event); |
8117 |
+ } |
8118 |
+ |
8119 |
+-static void cma_listen_on_dev(struct rdma_id_private *id_priv, |
8120 |
+- struct cma_device *cma_dev) |
8121 |
++static int cma_listen_on_dev(struct rdma_id_private *id_priv, |
8122 |
++ struct cma_device *cma_dev, |
8123 |
++ struct rdma_id_private **to_destroy) |
8124 |
+ { |
8125 |
+ struct rdma_id_private *dev_id_priv; |
8126 |
+ struct net *net = id_priv->id.route.addr.dev_addr.net; |
8127 |
+@@ -2504,21 +2506,21 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv, |
8128 |
+ |
8129 |
+ lockdep_assert_held(&lock); |
8130 |
+ |
8131 |
++ *to_destroy = NULL; |
8132 |
+ if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1)) |
8133 |
+- return; |
8134 |
++ return 0; |
8135 |
+ |
8136 |
+ dev_id_priv = |
8137 |
+ __rdma_create_id(net, cma_listen_handler, id_priv, |
8138 |
+ id_priv->id.ps, id_priv->id.qp_type, id_priv); |
8139 |
+ if (IS_ERR(dev_id_priv)) |
8140 |
+- return; |
8141 |
++ return PTR_ERR(dev_id_priv); |
8142 |
+ |
8143 |
+ dev_id_priv->state = RDMA_CM_ADDR_BOUND; |
8144 |
+ memcpy(cma_src_addr(dev_id_priv), cma_src_addr(id_priv), |
8145 |
+ rdma_addr_size(cma_src_addr(id_priv))); |
8146 |
+ |
8147 |
+ _cma_attach_to_dev(dev_id_priv, cma_dev); |
8148 |
+- list_add_tail(&dev_id_priv->listen_list, &id_priv->listen_list); |
8149 |
+ cma_id_get(id_priv); |
8150 |
+ dev_id_priv->internal_id = 1; |
8151 |
+ dev_id_priv->afonly = id_priv->afonly; |
8152 |
+@@ -2527,19 +2529,42 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv, |
8153 |
+ |
8154 |
+ ret = rdma_listen(&dev_id_priv->id, id_priv->backlog); |
8155 |
+ if (ret) |
8156 |
+- dev_warn(&cma_dev->device->dev, |
8157 |
+- "RDMA CMA: cma_listen_on_dev, error %d\n", ret); |
8158 |
++ goto err_listen; |
8159 |
++ list_add_tail(&dev_id_priv->listen_list, &id_priv->listen_list); |
8160 |
++ return 0; |
8161 |
++err_listen: |
8162 |
++ /* Caller must destroy this after releasing lock */ |
8163 |
++ *to_destroy = dev_id_priv; |
8164 |
++ dev_warn(&cma_dev->device->dev, "RDMA CMA: %s, error %d\n", __func__, ret); |
8165 |
++ return ret; |
8166 |
+ } |
8167 |
+ |
8168 |
+-static void cma_listen_on_all(struct rdma_id_private *id_priv) |
8169 |
++static int cma_listen_on_all(struct rdma_id_private *id_priv) |
8170 |
+ { |
8171 |
++ struct rdma_id_private *to_destroy; |
8172 |
+ struct cma_device *cma_dev; |
8173 |
++ int ret; |
8174 |
+ |
8175 |
+ mutex_lock(&lock); |
8176 |
+ list_add_tail(&id_priv->list, &listen_any_list); |
8177 |
+- list_for_each_entry(cma_dev, &dev_list, list) |
8178 |
+- cma_listen_on_dev(id_priv, cma_dev); |
8179 |
++ list_for_each_entry(cma_dev, &dev_list, list) { |
8180 |
++ ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy); |
8181 |
++ if (ret) { |
8182 |
++ /* Prevent racing with cma_process_remove() */ |
8183 |
++ if (to_destroy) |
8184 |
++ list_del_init(&to_destroy->list); |
8185 |
++ goto err_listen; |
8186 |
++ } |
8187 |
++ } |
8188 |
+ mutex_unlock(&lock); |
8189 |
++ return 0; |
8190 |
++ |
8191 |
++err_listen: |
8192 |
++ list_del(&id_priv->list); |
8193 |
++ mutex_unlock(&lock); |
8194 |
++ if (to_destroy) |
8195 |
++ rdma_destroy_id(&to_destroy->id); |
8196 |
++ return ret; |
8197 |
+ } |
8198 |
+ |
8199 |
+ void rdma_set_service_type(struct rdma_cm_id *id, int tos) |
8200 |
+@@ -3692,8 +3717,11 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) |
8201 |
+ ret = -ENOSYS; |
8202 |
+ goto err; |
8203 |
+ } |
8204 |
+- } else |
8205 |
+- cma_listen_on_all(id_priv); |
8206 |
++ } else { |
8207 |
++ ret = cma_listen_on_all(id_priv); |
8208 |
++ if (ret) |
8209 |
++ goto err; |
8210 |
++ } |
8211 |
+ |
8212 |
+ return 0; |
8213 |
+ err: |
8214 |
+@@ -4773,69 +4801,6 @@ static struct notifier_block cma_nb = { |
8215 |
+ .notifier_call = cma_netdev_callback |
8216 |
+ }; |
8217 |
+ |
8218 |
+-static int cma_add_one(struct ib_device *device) |
8219 |
+-{ |
8220 |
+- struct cma_device *cma_dev; |
8221 |
+- struct rdma_id_private *id_priv; |
8222 |
+- unsigned int i; |
8223 |
+- unsigned long supported_gids = 0; |
8224 |
+- int ret; |
8225 |
+- |
8226 |
+- cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL); |
8227 |
+- if (!cma_dev) |
8228 |
+- return -ENOMEM; |
8229 |
+- |
8230 |
+- cma_dev->device = device; |
8231 |
+- cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, |
8232 |
+- sizeof(*cma_dev->default_gid_type), |
8233 |
+- GFP_KERNEL); |
8234 |
+- if (!cma_dev->default_gid_type) { |
8235 |
+- ret = -ENOMEM; |
8236 |
+- goto free_cma_dev; |
8237 |
+- } |
8238 |
+- |
8239 |
+- cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, |
8240 |
+- sizeof(*cma_dev->default_roce_tos), |
8241 |
+- GFP_KERNEL); |
8242 |
+- if (!cma_dev->default_roce_tos) { |
8243 |
+- ret = -ENOMEM; |
8244 |
+- goto free_gid_type; |
8245 |
+- } |
8246 |
+- |
8247 |
+- rdma_for_each_port (device, i) { |
8248 |
+- supported_gids = roce_gid_type_mask_support(device, i); |
8249 |
+- WARN_ON(!supported_gids); |
8250 |
+- if (supported_gids & (1 << CMA_PREFERRED_ROCE_GID_TYPE)) |
8251 |
+- cma_dev->default_gid_type[i - rdma_start_port(device)] = |
8252 |
+- CMA_PREFERRED_ROCE_GID_TYPE; |
8253 |
+- else |
8254 |
+- cma_dev->default_gid_type[i - rdma_start_port(device)] = |
8255 |
+- find_first_bit(&supported_gids, BITS_PER_LONG); |
8256 |
+- cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; |
8257 |
+- } |
8258 |
+- |
8259 |
+- init_completion(&cma_dev->comp); |
8260 |
+- refcount_set(&cma_dev->refcount, 1); |
8261 |
+- INIT_LIST_HEAD(&cma_dev->id_list); |
8262 |
+- ib_set_client_data(device, &cma_client, cma_dev); |
8263 |
+- |
8264 |
+- mutex_lock(&lock); |
8265 |
+- list_add_tail(&cma_dev->list, &dev_list); |
8266 |
+- list_for_each_entry(id_priv, &listen_any_list, list) |
8267 |
+- cma_listen_on_dev(id_priv, cma_dev); |
8268 |
+- mutex_unlock(&lock); |
8269 |
+- |
8270 |
+- trace_cm_add_one(device); |
8271 |
+- return 0; |
8272 |
+- |
8273 |
+-free_gid_type: |
8274 |
+- kfree(cma_dev->default_gid_type); |
8275 |
+- |
8276 |
+-free_cma_dev: |
8277 |
+- kfree(cma_dev); |
8278 |
+- return ret; |
8279 |
+-} |
8280 |
+- |
8281 |
+ static void cma_send_device_removal_put(struct rdma_id_private *id_priv) |
8282 |
+ { |
8283 |
+ struct rdma_cm_event event = { .event = RDMA_CM_EVENT_DEVICE_REMOVAL }; |
8284 |
+@@ -4898,6 +4863,80 @@ static void cma_process_remove(struct cma_device *cma_dev) |
8285 |
+ wait_for_completion(&cma_dev->comp); |
8286 |
+ } |
8287 |
+ |
8288 |
++static int cma_add_one(struct ib_device *device) |
8289 |
++{ |
8290 |
++ struct rdma_id_private *to_destroy; |
8291 |
++ struct cma_device *cma_dev; |
8292 |
++ struct rdma_id_private *id_priv; |
8293 |
++ unsigned int i; |
8294 |
++ unsigned long supported_gids = 0; |
8295 |
++ int ret; |
8296 |
++ |
8297 |
++ cma_dev = kmalloc(sizeof(*cma_dev), GFP_KERNEL); |
8298 |
++ if (!cma_dev) |
8299 |
++ return -ENOMEM; |
8300 |
++ |
8301 |
++ cma_dev->device = device; |
8302 |
++ cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, |
8303 |
++ sizeof(*cma_dev->default_gid_type), |
8304 |
++ GFP_KERNEL); |
8305 |
++ if (!cma_dev->default_gid_type) { |
8306 |
++ ret = -ENOMEM; |
8307 |
++ goto free_cma_dev; |
8308 |
++ } |
8309 |
++ |
8310 |
++ cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, |
8311 |
++ sizeof(*cma_dev->default_roce_tos), |
8312 |
++ GFP_KERNEL); |
8313 |
++ if (!cma_dev->default_roce_tos) { |
8314 |
++ ret = -ENOMEM; |
8315 |
++ goto free_gid_type; |
8316 |
++ } |
8317 |
++ |
8318 |
++ rdma_for_each_port (device, i) { |
8319 |
++ supported_gids = roce_gid_type_mask_support(device, i); |
8320 |
++ WARN_ON(!supported_gids); |
8321 |
++ if (supported_gids & (1 << CMA_PREFERRED_ROCE_GID_TYPE)) |
8322 |
++ cma_dev->default_gid_type[i - rdma_start_port(device)] = |
8323 |
++ CMA_PREFERRED_ROCE_GID_TYPE; |
8324 |
++ else |
8325 |
++ cma_dev->default_gid_type[i - rdma_start_port(device)] = |
8326 |
++ find_first_bit(&supported_gids, BITS_PER_LONG); |
8327 |
++ cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; |
8328 |
++ } |
8329 |
++ |
8330 |
++ init_completion(&cma_dev->comp); |
8331 |
++ refcount_set(&cma_dev->refcount, 1); |
8332 |
++ INIT_LIST_HEAD(&cma_dev->id_list); |
8333 |
++ ib_set_client_data(device, &cma_client, cma_dev); |
8334 |
++ |
8335 |
++ mutex_lock(&lock); |
8336 |
++ list_add_tail(&cma_dev->list, &dev_list); |
8337 |
++ list_for_each_entry(id_priv, &listen_any_list, list) { |
8338 |
++ ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy); |
8339 |
++ if (ret) |
8340 |
++ goto free_listen; |
8341 |
++ } |
8342 |
++ mutex_unlock(&lock); |
8343 |
++ |
8344 |
++ trace_cm_add_one(device); |
8345 |
++ return 0; |
8346 |
++ |
8347 |
++free_listen: |
8348 |
++ list_del(&cma_dev->list); |
8349 |
++ mutex_unlock(&lock); |
8350 |
++ |
8351 |
++ /* cma_process_remove() will delete to_destroy */ |
8352 |
++ cma_process_remove(cma_dev); |
8353 |
++ kfree(cma_dev->default_roce_tos); |
8354 |
++free_gid_type: |
8355 |
++ kfree(cma_dev->default_gid_type); |
8356 |
++ |
8357 |
++free_cma_dev: |
8358 |
++ kfree(cma_dev); |
8359 |
++ return ret; |
8360 |
++} |
8361 |
++ |
8362 |
+ static void cma_remove_one(struct ib_device *device, void *client_data) |
8363 |
+ { |
8364 |
+ struct cma_device *cma_dev = client_data; |
8365 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
8366 |
+index a3b1fc84cdcab..4a041511b70ec 100644 |
8367 |
+--- a/drivers/infiniband/core/device.c |
8368 |
++++ b/drivers/infiniband/core/device.c |
8369 |
+@@ -1374,9 +1374,6 @@ int ib_register_device(struct ib_device *device, const char *name, |
8370 |
+ } |
8371 |
+ |
8372 |
+ ret = enable_device_and_get(device); |
8373 |
+- dev_set_uevent_suppress(&device->dev, false); |
8374 |
+- /* Mark for userspace that device is ready */ |
8375 |
+- kobject_uevent(&device->dev.kobj, KOBJ_ADD); |
8376 |
+ if (ret) { |
8377 |
+ void (*dealloc_fn)(struct ib_device *); |
8378 |
+ |
8379 |
+@@ -1396,8 +1393,12 @@ int ib_register_device(struct ib_device *device, const char *name, |
8380 |
+ ib_device_put(device); |
8381 |
+ __ib_unregister_device(device); |
8382 |
+ device->ops.dealloc_driver = dealloc_fn; |
8383 |
++ dev_set_uevent_suppress(&device->dev, false); |
8384 |
+ return ret; |
8385 |
+ } |
8386 |
++ dev_set_uevent_suppress(&device->dev, false); |
8387 |
++ /* Mark for userspace that device is ready */ |
8388 |
++ kobject_uevent(&device->dev.kobj, KOBJ_ADD); |
8389 |
+ ib_device_put(device); |
8390 |
+ |
8391 |
+ return 0; |
8392 |
+diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c |
8393 |
+index 302f898c5833f..9ec6971056fa8 100644 |
8394 |
+--- a/drivers/infiniband/core/uverbs_std_types_device.c |
8395 |
++++ b/drivers/infiniband/core/uverbs_std_types_device.c |
8396 |
+@@ -317,8 +317,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_TABLE)( |
8397 |
+ struct ib_device *ib_dev; |
8398 |
+ size_t user_entry_size; |
8399 |
+ ssize_t num_entries; |
8400 |
+- size_t max_entries; |
8401 |
+- size_t num_bytes; |
8402 |
++ int max_entries; |
8403 |
+ u32 flags; |
8404 |
+ int ret; |
8405 |
+ |
8406 |
+@@ -336,19 +335,16 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_TABLE)( |
8407 |
+ attrs, UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES, |
8408 |
+ user_entry_size); |
8409 |
+ if (max_entries <= 0) |
8410 |
+- return -EINVAL; |
8411 |
++ return max_entries ?: -EINVAL; |
8412 |
+ |
8413 |
+ ucontext = ib_uverbs_get_ucontext(attrs); |
8414 |
+ if (IS_ERR(ucontext)) |
8415 |
+ return PTR_ERR(ucontext); |
8416 |
+ ib_dev = ucontext->device; |
8417 |
+ |
8418 |
+- if (check_mul_overflow(max_entries, sizeof(*entries), &num_bytes)) |
8419 |
+- return -EINVAL; |
8420 |
+- |
8421 |
+- entries = uverbs_zalloc(attrs, num_bytes); |
8422 |
+- if (!entries) |
8423 |
+- return -ENOMEM; |
8424 |
++ entries = uverbs_kcalloc(attrs, max_entries, sizeof(*entries)); |
8425 |
++ if (IS_ERR(entries)) |
8426 |
++ return PTR_ERR(entries); |
8427 |
+ |
8428 |
+ num_entries = rdma_query_gid_table(ib_dev, entries, max_entries); |
8429 |
+ if (num_entries < 0) |
8430 |
+diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c b/drivers/infiniband/core/uverbs_std_types_mr.c |
8431 |
+index 9b22bb553e8b3..dc58564417292 100644 |
8432 |
+--- a/drivers/infiniband/core/uverbs_std_types_mr.c |
8433 |
++++ b/drivers/infiniband/core/uverbs_std_types_mr.c |
8434 |
+@@ -33,6 +33,7 @@ |
8435 |
+ #include "rdma_core.h" |
8436 |
+ #include "uverbs.h" |
8437 |
+ #include <rdma/uverbs_std_types.h> |
8438 |
++#include "restrack.h" |
8439 |
+ |
8440 |
+ static int uverbs_free_mr(struct ib_uobject *uobject, |
8441 |
+ enum rdma_remove_reason why, |
8442 |
+@@ -134,6 +135,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_MR_REG)( |
8443 |
+ atomic_inc(&pd->usecnt); |
8444 |
+ atomic_inc(&dm->usecnt); |
8445 |
+ |
8446 |
++ rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); |
8447 |
++ rdma_restrack_set_name(&mr->res, NULL); |
8448 |
++ rdma_restrack_add(&mr->res); |
8449 |
+ uobj->object = mr; |
8450 |
+ |
8451 |
+ uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_REG_DM_MR_HANDLE); |
8452 |
+diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c |
8453 |
+index 740f8454b6b46..3d895cc41c3ad 100644 |
8454 |
+--- a/drivers/infiniband/core/verbs.c |
8455 |
++++ b/drivers/infiniband/core/verbs.c |
8456 |
+@@ -1698,8 +1698,10 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, |
8457 |
+ slave = rdma_lag_get_ah_roce_slave(qp->device, |
8458 |
+ &attr->ah_attr, |
8459 |
+ GFP_KERNEL); |
8460 |
+- if (IS_ERR(slave)) |
8461 |
++ if (IS_ERR(slave)) { |
8462 |
++ ret = PTR_ERR(slave); |
8463 |
+ goto out_av; |
8464 |
++ } |
8465 |
+ attr->xmit_slave = slave; |
8466 |
+ } |
8467 |
+ } |
8468 |
+diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
8469 |
+index cf3db96283976..266de55f57192 100644 |
8470 |
+--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
8471 |
++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c |
8472 |
+@@ -1657,8 +1657,8 @@ int bnxt_re_create_srq(struct ib_srq *ib_srq, |
8473 |
+ srq->qplib_srq.max_wqe = entries; |
8474 |
+ |
8475 |
+ srq->qplib_srq.max_sge = srq_init_attr->attr.max_sge; |
8476 |
+- srq->qplib_srq.wqe_size = |
8477 |
+- bnxt_re_get_rwqe_size(srq->qplib_srq.max_sge); |
8478 |
++ /* 128 byte wqe size for SRQ . So use max sges */ |
8479 |
++ srq->qplib_srq.wqe_size = bnxt_re_get_rwqe_size(dev_attr->max_srq_sges); |
8480 |
+ srq->qplib_srq.threshold = srq_init_attr->attr.srq_limit; |
8481 |
+ srq->srq_limit = srq_init_attr->attr.srq_limit; |
8482 |
+ srq->qplib_srq.eventq_hw_ring_id = rdev->nq[0].ring_id; |
8483 |
+@@ -2078,6 +2078,7 @@ int bnxt_re_query_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, |
8484 |
+ goto out; |
8485 |
+ } |
8486 |
+ qp_attr->qp_state = __to_ib_qp_state(qplib_qp->state); |
8487 |
++ qp_attr->cur_qp_state = __to_ib_qp_state(qplib_qp->cur_qp_state); |
8488 |
+ qp_attr->en_sqd_async_notify = qplib_qp->en_sqd_async_notify ? 1 : 0; |
8489 |
+ qp_attr->qp_access_flags = __to_ib_access_flags(qplib_qp->access); |
8490 |
+ qp_attr->pkey_index = qplib_qp->pkey_index; |
8491 |
+diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c |
8492 |
+index 28349ed508854..d6cfefc269ee3 100644 |
8493 |
+--- a/drivers/infiniband/hw/cxgb4/cq.c |
8494 |
++++ b/drivers/infiniband/hw/cxgb4/cq.c |
8495 |
+@@ -1008,6 +1008,9 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, |
8496 |
+ if (attr->flags) |
8497 |
+ return -EINVAL; |
8498 |
+ |
8499 |
++ if (entries < 1 || entries > ibdev->attrs.max_cqe) |
8500 |
++ return -EINVAL; |
8501 |
++ |
8502 |
+ if (vector >= rhp->rdev.lldi.nciq) |
8503 |
+ return -EINVAL; |
8504 |
+ |
8505 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c |
8506 |
+index 75b06db60f7c2..7dd3b6097226f 100644 |
8507 |
+--- a/drivers/infiniband/hw/hns/hns_roce_ah.c |
8508 |
++++ b/drivers/infiniband/hw/hns/hns_roce_ah.c |
8509 |
+@@ -31,13 +31,13 @@ |
8510 |
+ */ |
8511 |
+ |
8512 |
+ #include <linux/platform_device.h> |
8513 |
++#include <linux/pci.h> |
8514 |
+ #include <rdma/ib_addr.h> |
8515 |
+ #include <rdma/ib_cache.h> |
8516 |
+ #include "hns_roce_device.h" |
8517 |
+ |
8518 |
+-#define HNS_ROCE_PORT_NUM_SHIFT 24 |
8519 |
+-#define HNS_ROCE_VLAN_SL_BIT_MASK 7 |
8520 |
+-#define HNS_ROCE_VLAN_SL_SHIFT 13 |
8521 |
++#define VLAN_SL_MASK 7 |
8522 |
++#define VLAN_SL_SHIFT 13 |
8523 |
+ |
8524 |
+ static inline u16 get_ah_udp_sport(const struct rdma_ah_attr *ah_attr) |
8525 |
+ { |
8526 |
+@@ -58,47 +58,44 @@ static inline u16 get_ah_udp_sport(const struct rdma_ah_attr *ah_attr) |
8527 |
+ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, |
8528 |
+ struct ib_udata *udata) |
8529 |
+ { |
8530 |
+- struct hns_roce_dev *hr_dev = to_hr_dev(ibah->device); |
8531 |
+- const struct ib_gid_attr *gid_attr; |
8532 |
+- struct device *dev = hr_dev->dev; |
8533 |
+- struct hns_roce_ah *ah = to_hr_ah(ibah); |
8534 |
+ struct rdma_ah_attr *ah_attr = init_attr->ah_attr; |
8535 |
+ const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr); |
8536 |
+- u16 vlan_id = 0xffff; |
8537 |
+- bool vlan_en = false; |
8538 |
+- int ret; |
8539 |
+- |
8540 |
+- gid_attr = ah_attr->grh.sgid_attr; |
8541 |
+- ret = rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL); |
8542 |
+- if (ret) |
8543 |
+- return ret; |
8544 |
+- |
8545 |
+- /* Get mac address */ |
8546 |
+- memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN); |
8547 |
+- |
8548 |
+- if (vlan_id < VLAN_N_VID) { |
8549 |
+- vlan_en = true; |
8550 |
+- vlan_id |= (rdma_ah_get_sl(ah_attr) & |
8551 |
+- HNS_ROCE_VLAN_SL_BIT_MASK) << |
8552 |
+- HNS_ROCE_VLAN_SL_SHIFT; |
8553 |
+- } |
8554 |
++ struct hns_roce_dev *hr_dev = to_hr_dev(ibah->device); |
8555 |
++ struct hns_roce_ah *ah = to_hr_ah(ibah); |
8556 |
++ int ret = 0; |
8557 |
+ |
8558 |
+ ah->av.port = rdma_ah_get_port_num(ah_attr); |
8559 |
+ ah->av.gid_index = grh->sgid_index; |
8560 |
+- ah->av.vlan_id = vlan_id; |
8561 |
+- ah->av.vlan_en = vlan_en; |
8562 |
+- dev_dbg(dev, "gid_index = 0x%x,vlan_id = 0x%x\n", ah->av.gid_index, |
8563 |
+- ah->av.vlan_id); |
8564 |
+ |
8565 |
+ if (rdma_ah_get_static_rate(ah_attr)) |
8566 |
+ ah->av.stat_rate = IB_RATE_10_GBPS; |
8567 |
+ |
8568 |
+- memcpy(ah->av.dgid, grh->dgid.raw, HNS_ROCE_GID_SIZE); |
8569 |
+- ah->av.sl = rdma_ah_get_sl(ah_attr); |
8570 |
++ ah->av.hop_limit = grh->hop_limit; |
8571 |
+ ah->av.flowlabel = grh->flow_label; |
8572 |
+ ah->av.udp_sport = get_ah_udp_sport(ah_attr); |
8573 |
++ ah->av.sl = rdma_ah_get_sl(ah_attr); |
8574 |
++ ah->av.tclass = get_tclass(grh); |
8575 |
+ |
8576 |
+- return 0; |
8577 |
++ memcpy(ah->av.dgid, grh->dgid.raw, HNS_ROCE_GID_SIZE); |
8578 |
++ memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN); |
8579 |
++ |
8580 |
++ /* HIP08 needs to record vlan info in Address Vector */ |
8581 |
++ if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08) { |
8582 |
++ ah->av.vlan_en = 0; |
8583 |
++ |
8584 |
++ ret = rdma_read_gid_l2_fields(ah_attr->grh.sgid_attr, |
8585 |
++ &ah->av.vlan_id, NULL); |
8586 |
++ if (ret) |
8587 |
++ return ret; |
8588 |
++ |
8589 |
++ if (ah->av.vlan_id < VLAN_N_VID) { |
8590 |
++ ah->av.vlan_en = 1; |
8591 |
++ ah->av.vlan_id |= (rdma_ah_get_sl(ah_attr) & VLAN_SL_MASK) << |
8592 |
++ VLAN_SL_SHIFT; |
8593 |
++ } |
8594 |
++ } |
8595 |
++ |
8596 |
++ return ret; |
8597 |
+ } |
8598 |
+ |
8599 |
+ int hns_roce_query_ah(struct ib_ah *ibah, struct rdma_ah_attr *ah_attr) |
8600 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c |
8601 |
+index 809b22aa5056c..da346129f6e9e 100644 |
8602 |
+--- a/drivers/infiniband/hw/hns/hns_roce_cq.c |
8603 |
++++ b/drivers/infiniband/hw/hns/hns_roce_cq.c |
8604 |
+@@ -274,7 +274,7 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, |
8605 |
+ |
8606 |
+ if (udata) { |
8607 |
+ ret = ib_copy_from_udata(&ucmd, udata, |
8608 |
+- min(sizeof(ucmd), udata->inlen)); |
8609 |
++ min(udata->inlen, sizeof(ucmd))); |
8610 |
+ if (ret) { |
8611 |
+ ibdev_err(ibdev, "Failed to copy CQ udata, err %d\n", |
8612 |
+ ret); |
8613 |
+@@ -313,7 +313,8 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, |
8614 |
+ |
8615 |
+ if (udata) { |
8616 |
+ resp.cqn = hr_cq->cqn; |
8617 |
+- ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); |
8618 |
++ ret = ib_copy_to_udata(udata, &resp, |
8619 |
++ min(udata->outlen, sizeof(resp))); |
8620 |
+ if (ret) |
8621 |
+ goto err_cqc; |
8622 |
+ } |
8623 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h |
8624 |
+index 6d2acff69f982..1ea87f92aabbe 100644 |
8625 |
+--- a/drivers/infiniband/hw/hns/hns_roce_device.h |
8626 |
++++ b/drivers/infiniband/hw/hns/hns_roce_device.h |
8627 |
+@@ -547,7 +547,7 @@ struct hns_roce_av { |
8628 |
+ u8 dgid[HNS_ROCE_GID_SIZE]; |
8629 |
+ u8 mac[ETH_ALEN]; |
8630 |
+ u16 vlan_id; |
8631 |
+- bool vlan_en; |
8632 |
++ u8 vlan_en; |
8633 |
+ }; |
8634 |
+ |
8635 |
+ struct hns_roce_ah { |
8636 |
+@@ -1132,6 +1132,14 @@ static inline u32 to_hr_hem_entries_shift(u32 count, u32 buf_shift) |
8637 |
+ return ilog2(to_hr_hem_entries_count(count, buf_shift)); |
8638 |
+ } |
8639 |
+ |
8640 |
++#define DSCP_SHIFT 2 |
8641 |
++ |
8642 |
++static inline u8 get_tclass(const struct ib_global_route *grh) |
8643 |
++{ |
8644 |
++ return grh->sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP ? |
8645 |
++ grh->traffic_class >> DSCP_SHIFT : grh->traffic_class; |
8646 |
++} |
8647 |
++ |
8648 |
+ int hns_roce_init_uar_table(struct hns_roce_dev *dev); |
8649 |
+ int hns_roce_uar_alloc(struct hns_roce_dev *dev, struct hns_roce_uar *uar); |
8650 |
+ void hns_roce_uar_free(struct hns_roce_dev *dev, struct hns_roce_uar *uar); |
8651 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c |
8652 |
+index 7487cf3d2c37a..66f9f036ef946 100644 |
8653 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hem.c |
8654 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hem.c |
8655 |
+@@ -1017,7 +1017,7 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev, |
8656 |
+ |
8657 |
+ void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev) |
8658 |
+ { |
8659 |
+- if (hr_dev->caps.srqc_entry_sz) |
8660 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) |
8661 |
+ hns_roce_cleanup_hem_table(hr_dev, |
8662 |
+ &hr_dev->srq_table.table); |
8663 |
+ hns_roce_cleanup_hem_table(hr_dev, &hr_dev->cq_table.table); |
8664 |
+@@ -1027,7 +1027,7 @@ void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev) |
8665 |
+ if (hr_dev->caps.cqc_timer_entry_sz) |
8666 |
+ hns_roce_cleanup_hem_table(hr_dev, |
8667 |
+ &hr_dev->cqc_timer_table); |
8668 |
+- if (hr_dev->caps.sccc_sz) |
8669 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) |
8670 |
+ hns_roce_cleanup_hem_table(hr_dev, |
8671 |
+ &hr_dev->qp_table.sccc_table); |
8672 |
+ if (hr_dev->caps.trrl_entry_sz) |
8673 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
8674 |
+index 0468028ffe390..5c29c7d8c50e6 100644 |
8675 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
8676 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
8677 |
+@@ -214,25 +214,20 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp, |
8678 |
+ return 0; |
8679 |
+ } |
8680 |
+ |
8681 |
+-static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr, |
8682 |
+- unsigned int *sge_ind, unsigned int valid_num_sge) |
8683 |
++static void set_extend_sge(struct hns_roce_qp *qp, struct ib_sge *sge, |
8684 |
++ unsigned int *sge_ind, unsigned int cnt) |
8685 |
+ { |
8686 |
+ struct hns_roce_v2_wqe_data_seg *dseg; |
8687 |
+- unsigned int cnt = valid_num_sge; |
8688 |
+- struct ib_sge *sge = wr->sg_list; |
8689 |
+ unsigned int idx = *sge_ind; |
8690 |
+ |
8691 |
+- if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) { |
8692 |
+- cnt -= HNS_ROCE_SGE_IN_WQE; |
8693 |
+- sge += HNS_ROCE_SGE_IN_WQE; |
8694 |
+- } |
8695 |
+- |
8696 |
+ while (cnt > 0) { |
8697 |
+ dseg = hns_roce_get_extend_sge(qp, idx & (qp->sge.sge_cnt - 1)); |
8698 |
+- set_data_seg_v2(dseg, sge); |
8699 |
+- idx++; |
8700 |
++ if (likely(sge->length)) { |
8701 |
++ set_data_seg_v2(dseg, sge); |
8702 |
++ idx++; |
8703 |
++ cnt--; |
8704 |
++ } |
8705 |
+ sge++; |
8706 |
+- cnt--; |
8707 |
+ } |
8708 |
+ |
8709 |
+ *sge_ind = idx; |
8710 |
+@@ -340,7 +335,8 @@ static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr, |
8711 |
+ } |
8712 |
+ } |
8713 |
+ |
8714 |
+- set_extend_sge(qp, wr, sge_ind, valid_num_sge); |
8715 |
++ set_extend_sge(qp, wr->sg_list + i, sge_ind, |
8716 |
++ valid_num_sge - HNS_ROCE_SGE_IN_WQE); |
8717 |
+ } |
8718 |
+ |
8719 |
+ roce_set_field(rc_sq_wqe->byte_16, |
8720 |
+@@ -433,8 +429,6 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, |
8721 |
+ unsigned int curr_idx = *sge_idx; |
8722 |
+ int valid_num_sge; |
8723 |
+ u32 msg_len = 0; |
8724 |
+- bool loopback; |
8725 |
+- u8 *smac; |
8726 |
+ int ret; |
8727 |
+ |
8728 |
+ valid_num_sge = calc_wr_sge_num(wr, &msg_len); |
8729 |
+@@ -457,13 +451,6 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, |
8730 |
+ roce_set_field(ud_sq_wqe->byte_48, V2_UD_SEND_WQE_BYTE_48_DMAC_5_M, |
8731 |
+ V2_UD_SEND_WQE_BYTE_48_DMAC_5_S, ah->av.mac[5]); |
8732 |
+ |
8733 |
+- /* MAC loopback */ |
8734 |
+- smac = (u8 *)hr_dev->dev_addr[qp->port]; |
8735 |
+- loopback = ether_addr_equal_unaligned(ah->av.mac, smac) ? 1 : 0; |
8736 |
+- |
8737 |
+- roce_set_bit(ud_sq_wqe->byte_40, |
8738 |
+- V2_UD_SEND_WQE_BYTE_40_LBI_S, loopback); |
8739 |
+- |
8740 |
+ ud_sq_wqe->msg_len = cpu_to_le32(msg_len); |
8741 |
+ |
8742 |
+ /* Set sig attr */ |
8743 |
+@@ -495,8 +482,6 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, |
8744 |
+ roce_set_field(ud_sq_wqe->byte_32, V2_UD_SEND_WQE_BYTE_32_DQPN_M, |
8745 |
+ V2_UD_SEND_WQE_BYTE_32_DQPN_S, ud_wr(wr)->remote_qpn); |
8746 |
+ |
8747 |
+- roce_set_field(ud_sq_wqe->byte_36, V2_UD_SEND_WQE_BYTE_36_VLAN_M, |
8748 |
+- V2_UD_SEND_WQE_BYTE_36_VLAN_S, ah->av.vlan_id); |
8749 |
+ roce_set_field(ud_sq_wqe->byte_36, V2_UD_SEND_WQE_BYTE_36_HOPLIMIT_M, |
8750 |
+ V2_UD_SEND_WQE_BYTE_36_HOPLIMIT_S, ah->av.hop_limit); |
8751 |
+ roce_set_field(ud_sq_wqe->byte_36, V2_UD_SEND_WQE_BYTE_36_TCLASS_M, |
8752 |
+@@ -508,14 +493,21 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, |
8753 |
+ roce_set_field(ud_sq_wqe->byte_40, V2_UD_SEND_WQE_BYTE_40_PORTN_M, |
8754 |
+ V2_UD_SEND_WQE_BYTE_40_PORTN_S, qp->port); |
8755 |
+ |
8756 |
+- roce_set_bit(ud_sq_wqe->byte_40, V2_UD_SEND_WQE_BYTE_40_UD_VLAN_EN_S, |
8757 |
+- ah->av.vlan_en ? 1 : 0); |
8758 |
+ roce_set_field(ud_sq_wqe->byte_48, V2_UD_SEND_WQE_BYTE_48_SGID_INDX_M, |
8759 |
+ V2_UD_SEND_WQE_BYTE_48_SGID_INDX_S, ah->av.gid_index); |
8760 |
+ |
8761 |
++ if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08) { |
8762 |
++ roce_set_bit(ud_sq_wqe->byte_40, |
8763 |
++ V2_UD_SEND_WQE_BYTE_40_UD_VLAN_EN_S, |
8764 |
++ ah->av.vlan_en); |
8765 |
++ roce_set_field(ud_sq_wqe->byte_36, |
8766 |
++ V2_UD_SEND_WQE_BYTE_36_VLAN_M, |
8767 |
++ V2_UD_SEND_WQE_BYTE_36_VLAN_S, ah->av.vlan_id); |
8768 |
++ } |
8769 |
++ |
8770 |
+ memcpy(&ud_sq_wqe->dgid[0], &ah->av.dgid[0], GID_LEN_V2); |
8771 |
+ |
8772 |
+- set_extend_sge(qp, wr, &curr_idx, valid_num_sge); |
8773 |
++ set_extend_sge(qp, wr->sg_list, &curr_idx, valid_num_sge); |
8774 |
+ |
8775 |
+ *sge_idx = curr_idx; |
8776 |
+ |
8777 |
+@@ -4468,15 +4460,11 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp, |
8778 |
+ roce_set_field(qpc_mask->byte_24_mtu_tc, V2_QPC_BYTE_24_HOP_LIMIT_M, |
8779 |
+ V2_QPC_BYTE_24_HOP_LIMIT_S, 0); |
8780 |
+ |
8781 |
+- if (is_udp) |
8782 |
+- roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M, |
8783 |
+- V2_QPC_BYTE_24_TC_S, grh->traffic_class >> 2); |
8784 |
+- else |
8785 |
+- roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M, |
8786 |
+- V2_QPC_BYTE_24_TC_S, grh->traffic_class); |
8787 |
+- |
8788 |
++ roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M, |
8789 |
++ V2_QPC_BYTE_24_TC_S, get_tclass(&attr->ah_attr.grh)); |
8790 |
+ roce_set_field(qpc_mask->byte_24_mtu_tc, V2_QPC_BYTE_24_TC_M, |
8791 |
+ V2_QPC_BYTE_24_TC_S, 0); |
8792 |
++ |
8793 |
+ roce_set_field(context->byte_28_at_fl, V2_QPC_BYTE_28_FL_M, |
8794 |
+ V2_QPC_BYTE_28_FL_S, grh->flow_label); |
8795 |
+ roce_set_field(qpc_mask->byte_28_at_fl, V2_QPC_BYTE_28_FL_M, |
8796 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c |
8797 |
+index afeffafc59f90..ae721fa61e0e4 100644 |
8798 |
+--- a/drivers/infiniband/hw/hns/hns_roce_main.c |
8799 |
++++ b/drivers/infiniband/hw/hns/hns_roce_main.c |
8800 |
+@@ -325,7 +325,8 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, |
8801 |
+ |
8802 |
+ resp.cqe_size = hr_dev->caps.cqe_sz; |
8803 |
+ |
8804 |
+- ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); |
8805 |
++ ret = ib_copy_to_udata(udata, &resp, |
8806 |
++ min(udata->outlen, sizeof(resp))); |
8807 |
+ if (ret) |
8808 |
+ goto error_fail_copy_to_udata; |
8809 |
+ |
8810 |
+@@ -631,7 +632,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev) |
8811 |
+ goto err_unmap_trrl; |
8812 |
+ } |
8813 |
+ |
8814 |
+- if (hr_dev->caps.srqc_entry_sz) { |
8815 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) { |
8816 |
+ ret = hns_roce_init_hem_table(hr_dev, &hr_dev->srq_table.table, |
8817 |
+ HEM_TYPE_SRQC, |
8818 |
+ hr_dev->caps.srqc_entry_sz, |
8819 |
+@@ -643,7 +644,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev) |
8820 |
+ } |
8821 |
+ } |
8822 |
+ |
8823 |
+- if (hr_dev->caps.sccc_sz) { |
8824 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) { |
8825 |
+ ret = hns_roce_init_hem_table(hr_dev, |
8826 |
+ &hr_dev->qp_table.sccc_table, |
8827 |
+ HEM_TYPE_SCCC, |
8828 |
+@@ -687,11 +688,11 @@ err_unmap_qpc_timer: |
8829 |
+ hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qpc_timer_table); |
8830 |
+ |
8831 |
+ err_unmap_ctx: |
8832 |
+- if (hr_dev->caps.sccc_sz) |
8833 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) |
8834 |
+ hns_roce_cleanup_hem_table(hr_dev, |
8835 |
+ &hr_dev->qp_table.sccc_table); |
8836 |
+ err_unmap_srq: |
8837 |
+- if (hr_dev->caps.srqc_entry_sz) |
8838 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) |
8839 |
+ hns_roce_cleanup_hem_table(hr_dev, &hr_dev->srq_table.table); |
8840 |
+ |
8841 |
+ err_unmap_cq: |
8842 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c |
8843 |
+index 98f69496adb49..f78fa1d3d8075 100644 |
8844 |
+--- a/drivers/infiniband/hw/hns/hns_roce_pd.c |
8845 |
++++ b/drivers/infiniband/hw/hns/hns_roce_pd.c |
8846 |
+@@ -70,16 +70,17 @@ int hns_roce_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) |
8847 |
+ } |
8848 |
+ |
8849 |
+ if (udata) { |
8850 |
+- struct hns_roce_ib_alloc_pd_resp uresp = {.pdn = pd->pdn}; |
8851 |
++ struct hns_roce_ib_alloc_pd_resp resp = {.pdn = pd->pdn}; |
8852 |
+ |
8853 |
+- if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) { |
8854 |
++ ret = ib_copy_to_udata(udata, &resp, |
8855 |
++ min(udata->outlen, sizeof(resp))); |
8856 |
++ if (ret) { |
8857 |
+ hns_roce_pd_free(to_hr_dev(ib_dev), pd->pdn); |
8858 |
+- ibdev_err(ib_dev, "failed to copy to udata\n"); |
8859 |
+- return -EFAULT; |
8860 |
++ ibdev_err(ib_dev, "failed to copy to udata, ret = %d\n", ret); |
8861 |
+ } |
8862 |
+ } |
8863 |
+ |
8864 |
+- return 0; |
8865 |
++ return ret; |
8866 |
+ } |
8867 |
+ |
8868 |
+ int hns_roce_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata) |
8869 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c |
8870 |
+index 6c081dd985fc9..ef1452215b17d 100644 |
8871 |
+--- a/drivers/infiniband/hw/hns/hns_roce_qp.c |
8872 |
++++ b/drivers/infiniband/hw/hns/hns_roce_qp.c |
8873 |
+@@ -286,7 +286,7 @@ static int alloc_qpc(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) |
8874 |
+ } |
8875 |
+ } |
8876 |
+ |
8877 |
+- if (hr_dev->caps.sccc_sz) { |
8878 |
++ if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) { |
8879 |
+ /* Alloc memory for SCC CTX */ |
8880 |
+ ret = hns_roce_table_get(hr_dev, &qp_table->sccc_table, |
8881 |
+ hr_qp->qpn); |
8882 |
+@@ -432,7 +432,12 @@ static int set_extend_sge_param(struct hns_roce_dev *hr_dev, u32 sq_wqe_cnt, |
8883 |
+ } |
8884 |
+ |
8885 |
+ hr_qp->sge.sge_shift = HNS_ROCE_SGE_SHIFT; |
8886 |
+- hr_qp->sge.sge_cnt = cnt; |
8887 |
++ |
8888 |
++ /* If the number of extended sge is not zero, they MUST use the |
8889 |
++ * space of HNS_HW_PAGE_SIZE at least. |
8890 |
++ */ |
8891 |
++ hr_qp->sge.sge_cnt = cnt ? |
8892 |
++ max(cnt, (u32)HNS_HW_PAGE_SIZE / HNS_ROCE_SGE_SIZE) : 0; |
8893 |
+ |
8894 |
+ return 0; |
8895 |
+ } |
8896 |
+@@ -860,9 +865,12 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, |
8897 |
+ } |
8898 |
+ |
8899 |
+ if (udata) { |
8900 |
+- if (ib_copy_from_udata(ucmd, udata, sizeof(*ucmd))) { |
8901 |
+- ibdev_err(ibdev, "Failed to copy QP ucmd\n"); |
8902 |
+- return -EFAULT; |
8903 |
++ ret = ib_copy_from_udata(ucmd, udata, |
8904 |
++ min(udata->inlen, sizeof(*ucmd))); |
8905 |
++ if (ret) { |
8906 |
++ ibdev_err(ibdev, |
8907 |
++ "failed to copy QP ucmd, ret = %d\n", ret); |
8908 |
++ return ret; |
8909 |
+ } |
8910 |
+ |
8911 |
+ ret = set_user_sq_size(hr_dev, &init_attr->cap, hr_qp, ucmd); |
8912 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c |
8913 |
+index 8caf74e44efd9..75d74f4bb52c9 100644 |
8914 |
+--- a/drivers/infiniband/hw/hns/hns_roce_srq.c |
8915 |
++++ b/drivers/infiniband/hw/hns/hns_roce_srq.c |
8916 |
+@@ -300,7 +300,8 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, |
8917 |
+ srq->max_gs = init_attr->attr.max_sge; |
8918 |
+ |
8919 |
+ if (udata) { |
8920 |
+- ret = ib_copy_from_udata(&ucmd, udata, sizeof(ucmd)); |
8921 |
++ ret = ib_copy_from_udata(&ucmd, udata, |
8922 |
++ min(udata->inlen, sizeof(ucmd))); |
8923 |
+ if (ret) { |
8924 |
+ ibdev_err(ibdev, "Failed to copy SRQ udata, err %d\n", |
8925 |
+ ret); |
8926 |
+@@ -343,11 +344,10 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, |
8927 |
+ resp.srqn = srq->srqn; |
8928 |
+ |
8929 |
+ if (udata) { |
8930 |
+- if (ib_copy_to_udata(udata, &resp, |
8931 |
+- min(udata->outlen, sizeof(resp)))) { |
8932 |
+- ret = -EFAULT; |
8933 |
++ ret = ib_copy_to_udata(udata, &resp, |
8934 |
++ min(udata->outlen, sizeof(resp))); |
8935 |
++ if (ret) |
8936 |
+ goto err_srqc_alloc; |
8937 |
+- } |
8938 |
+ } |
8939 |
+ |
8940 |
+ return 0; |
8941 |
+diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c |
8942 |
+index b261797b258fd..971694e781b65 100644 |
8943 |
+--- a/drivers/infiniband/hw/mlx5/mr.c |
8944 |
++++ b/drivers/infiniband/hw/mlx5/mr.c |
8945 |
+@@ -642,6 +642,7 @@ void mlx5_mr_cache_free(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) |
8946 |
+ if (mlx5_mr_cache_invalidate(mr)) { |
8947 |
+ detach_mr_from_cache(mr); |
8948 |
+ destroy_mkey(dev, mr); |
8949 |
++ kfree(mr); |
8950 |
+ return; |
8951 |
+ } |
8952 |
+ |
8953 |
+@@ -1247,10 +1248,8 @@ err_1: |
8954 |
+ } |
8955 |
+ |
8956 |
+ static void set_mr_fields(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr, |
8957 |
+- int npages, u64 length, int access_flags) |
8958 |
++ u64 length, int access_flags) |
8959 |
+ { |
8960 |
+- mr->npages = npages; |
8961 |
+- atomic_add(npages, &dev->mdev->priv.reg_pages); |
8962 |
+ mr->ibmr.lkey = mr->mmkey.key; |
8963 |
+ mr->ibmr.rkey = mr->mmkey.key; |
8964 |
+ mr->ibmr.length = length; |
8965 |
+@@ -1290,8 +1289,7 @@ static struct ib_mr *mlx5_ib_get_dm_mr(struct ib_pd *pd, u64 start_addr, |
8966 |
+ |
8967 |
+ kfree(in); |
8968 |
+ |
8969 |
+- mr->umem = NULL; |
8970 |
+- set_mr_fields(dev, mr, 0, length, acc); |
8971 |
++ set_mr_fields(dev, mr, length, acc); |
8972 |
+ |
8973 |
+ return &mr->ibmr; |
8974 |
+ |
8975 |
+@@ -1419,7 +1417,9 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
8976 |
+ mlx5_ib_dbg(dev, "mkey 0x%x\n", mr->mmkey.key); |
8977 |
+ |
8978 |
+ mr->umem = umem; |
8979 |
+- set_mr_fields(dev, mr, npages, length, access_flags); |
8980 |
++ mr->npages = npages; |
8981 |
++ atomic_add(mr->npages, &dev->mdev->priv.reg_pages); |
8982 |
++ set_mr_fields(dev, mr, length, access_flags); |
8983 |
+ |
8984 |
+ if (xlt_with_umr && !(access_flags & IB_ACCESS_ON_DEMAND)) { |
8985 |
+ /* |
8986 |
+@@ -1531,8 +1531,6 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, |
8987 |
+ mlx5_ib_dbg(dev, "start 0x%llx, virt_addr 0x%llx, length 0x%llx, access_flags 0x%x\n", |
8988 |
+ start, virt_addr, length, access_flags); |
8989 |
+ |
8990 |
+- atomic_sub(mr->npages, &dev->mdev->priv.reg_pages); |
8991 |
+- |
8992 |
+ if (!mr->umem) |
8993 |
+ return -EINVAL; |
8994 |
+ |
8995 |
+@@ -1553,12 +1551,17 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, |
8996 |
+ * used. |
8997 |
+ */ |
8998 |
+ flags |= IB_MR_REREG_TRANS; |
8999 |
++ atomic_sub(mr->npages, &dev->mdev->priv.reg_pages); |
9000 |
++ mr->npages = 0; |
9001 |
+ ib_umem_release(mr->umem); |
9002 |
+ mr->umem = NULL; |
9003 |
++ |
9004 |
+ err = mr_umem_get(dev, addr, len, access_flags, &mr->umem, |
9005 |
+ &npages, &page_shift, &ncont, &order); |
9006 |
+ if (err) |
9007 |
+ goto err; |
9008 |
++ mr->npages = ncont; |
9009 |
++ atomic_add(mr->npages, &dev->mdev->priv.reg_pages); |
9010 |
+ } |
9011 |
+ |
9012 |
+ if (!mlx5_ib_can_reconfig_with_umr(dev, mr->access_flags, |
9013 |
+@@ -1609,7 +1612,7 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, |
9014 |
+ goto err; |
9015 |
+ } |
9016 |
+ |
9017 |
+- set_mr_fields(dev, mr, npages, len, access_flags); |
9018 |
++ set_mr_fields(dev, mr, len, access_flags); |
9019 |
+ |
9020 |
+ return 0; |
9021 |
+ |
9022 |
+diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c |
9023 |
+index 119b2573c9a08..26c3408dcacae 100644 |
9024 |
+--- a/drivers/infiniband/hw/mthca/mthca_cq.c |
9025 |
++++ b/drivers/infiniband/hw/mthca/mthca_cq.c |
9026 |
+@@ -604,7 +604,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev, |
9027 |
+ entry->byte_len = MTHCA_ATOMIC_BYTE_LEN; |
9028 |
+ break; |
9029 |
+ default: |
9030 |
+- entry->opcode = MTHCA_OPCODE_INVALID; |
9031 |
++ entry->opcode = 0xFF; |
9032 |
+ break; |
9033 |
+ } |
9034 |
+ } else { |
9035 |
+diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h |
9036 |
+index 9dbbf4d16796a..a445160de3e16 100644 |
9037 |
+--- a/drivers/infiniband/hw/mthca/mthca_dev.h |
9038 |
++++ b/drivers/infiniband/hw/mthca/mthca_dev.h |
9039 |
+@@ -105,7 +105,6 @@ enum { |
9040 |
+ MTHCA_OPCODE_ATOMIC_CS = 0x11, |
9041 |
+ MTHCA_OPCODE_ATOMIC_FA = 0x12, |
9042 |
+ MTHCA_OPCODE_BIND_MW = 0x18, |
9043 |
+- MTHCA_OPCODE_INVALID = 0xff |
9044 |
+ }; |
9045 |
+ |
9046 |
+ enum { |
9047 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c |
9048 |
+index af3923bf0a36b..d4917646641aa 100644 |
9049 |
+--- a/drivers/infiniband/sw/rxe/rxe_req.c |
9050 |
++++ b/drivers/infiniband/sw/rxe/rxe_req.c |
9051 |
+@@ -634,7 +634,8 @@ next_wqe: |
9052 |
+ } |
9053 |
+ |
9054 |
+ if (unlikely(qp_type(qp) == IB_QPT_RC && |
9055 |
+- qp->req.psn > (qp->comp.psn + RXE_MAX_UNACKED_PSNS))) { |
9056 |
++ psn_compare(qp->req.psn, (qp->comp.psn + |
9057 |
++ RXE_MAX_UNACKED_PSNS)) > 0)) { |
9058 |
+ qp->req.wait_psn = 1; |
9059 |
+ goto exit; |
9060 |
+ } |
9061 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
9062 |
+index f298adc02acba..d54a77ebe1184 100644 |
9063 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
9064 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
9065 |
+@@ -1640,10 +1640,8 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con) |
9066 |
+ return err; |
9067 |
+ } |
9068 |
+ err = rdma_resolve_route(con->c.cm_id, RTRS_CONNECT_TIMEOUT_MS); |
9069 |
+- if (err) { |
9070 |
++ if (err) |
9071 |
+ rtrs_err(s, "Resolving route failed, err: %d\n", err); |
9072 |
+- destroy_con_cq_qp(con); |
9073 |
+- } |
9074 |
+ |
9075 |
+ return err; |
9076 |
+ } |
9077 |
+@@ -1837,8 +1835,8 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id *cm_id, |
9078 |
+ cm_err = rtrs_rdma_route_resolved(con); |
9079 |
+ break; |
9080 |
+ case RDMA_CM_EVENT_ESTABLISHED: |
9081 |
+- con->cm_err = rtrs_rdma_conn_established(con, ev); |
9082 |
+- if (likely(!con->cm_err)) { |
9083 |
++ cm_err = rtrs_rdma_conn_established(con, ev); |
9084 |
++ if (likely(!cm_err)) { |
9085 |
+ /* |
9086 |
+ * Report success and wake up. Here we abuse state_wq, |
9087 |
+ * i.e. wake up without state change, but we set cm_err. |
9088 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
9089 |
+index d6f93601712e4..1cb778aff3c59 100644 |
9090 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
9091 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c |
9092 |
+@@ -1328,17 +1328,42 @@ static void rtrs_srv_dev_release(struct device *dev) |
9093 |
+ kfree(srv); |
9094 |
+ } |
9095 |
+ |
9096 |
+-static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, |
9097 |
+- const uuid_t *paths_uuid) |
9098 |
++static void free_srv(struct rtrs_srv *srv) |
9099 |
++{ |
9100 |
++ int i; |
9101 |
++ |
9102 |
++ WARN_ON(refcount_read(&srv->refcount)); |
9103 |
++ for (i = 0; i < srv->queue_depth; i++) |
9104 |
++ mempool_free(srv->chunks[i], chunk_pool); |
9105 |
++ kfree(srv->chunks); |
9106 |
++ mutex_destroy(&srv->paths_mutex); |
9107 |
++ mutex_destroy(&srv->paths_ev_mutex); |
9108 |
++ /* last put to release the srv structure */ |
9109 |
++ put_device(&srv->dev); |
9110 |
++} |
9111 |
++ |
9112 |
++static struct rtrs_srv *get_or_create_srv(struct rtrs_srv_ctx *ctx, |
9113 |
++ const uuid_t *paths_uuid) |
9114 |
+ { |
9115 |
+ struct rtrs_srv *srv; |
9116 |
+ int i; |
9117 |
+ |
9118 |
++ mutex_lock(&ctx->srv_mutex); |
9119 |
++ list_for_each_entry(srv, &ctx->srv_list, ctx_list) { |
9120 |
++ if (uuid_equal(&srv->paths_uuid, paths_uuid) && |
9121 |
++ refcount_inc_not_zero(&srv->refcount)) { |
9122 |
++ mutex_unlock(&ctx->srv_mutex); |
9123 |
++ return srv; |
9124 |
++ } |
9125 |
++ } |
9126 |
++ |
9127 |
++ /* need to allocate a new srv */ |
9128 |
+ srv = kzalloc(sizeof(*srv), GFP_KERNEL); |
9129 |
+- if (!srv) |
9130 |
++ if (!srv) { |
9131 |
++ mutex_unlock(&ctx->srv_mutex); |
9132 |
+ return NULL; |
9133 |
++ } |
9134 |
+ |
9135 |
+- refcount_set(&srv->refcount, 1); |
9136 |
+ INIT_LIST_HEAD(&srv->paths_list); |
9137 |
+ mutex_init(&srv->paths_mutex); |
9138 |
+ mutex_init(&srv->paths_ev_mutex); |
9139 |
+@@ -1347,6 +1372,8 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, |
9140 |
+ srv->ctx = ctx; |
9141 |
+ device_initialize(&srv->dev); |
9142 |
+ srv->dev.release = rtrs_srv_dev_release; |
9143 |
++ list_add(&srv->ctx_list, &ctx->srv_list); |
9144 |
++ mutex_unlock(&ctx->srv_mutex); |
9145 |
+ |
9146 |
+ srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks), |
9147 |
+ GFP_KERNEL); |
9148 |
+@@ -1358,7 +1385,7 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, |
9149 |
+ if (!srv->chunks[i]) |
9150 |
+ goto err_free_chunks; |
9151 |
+ } |
9152 |
+- list_add(&srv->ctx_list, &ctx->srv_list); |
9153 |
++ refcount_set(&srv->refcount, 1); |
9154 |
+ |
9155 |
+ return srv; |
9156 |
+ |
9157 |
+@@ -1369,52 +1396,9 @@ err_free_chunks: |
9158 |
+ |
9159 |
+ err_free_srv: |
9160 |
+ kfree(srv); |
9161 |
+- |
9162 |
+ return NULL; |
9163 |
+ } |
9164 |
+ |
9165 |
+-static void free_srv(struct rtrs_srv *srv) |
9166 |
+-{ |
9167 |
+- int i; |
9168 |
+- |
9169 |
+- WARN_ON(refcount_read(&srv->refcount)); |
9170 |
+- for (i = 0; i < srv->queue_depth; i++) |
9171 |
+- mempool_free(srv->chunks[i], chunk_pool); |
9172 |
+- kfree(srv->chunks); |
9173 |
+- mutex_destroy(&srv->paths_mutex); |
9174 |
+- mutex_destroy(&srv->paths_ev_mutex); |
9175 |
+- /* last put to release the srv structure */ |
9176 |
+- put_device(&srv->dev); |
9177 |
+-} |
9178 |
+- |
9179 |
+-static inline struct rtrs_srv *__find_srv_and_get(struct rtrs_srv_ctx *ctx, |
9180 |
+- const uuid_t *paths_uuid) |
9181 |
+-{ |
9182 |
+- struct rtrs_srv *srv; |
9183 |
+- |
9184 |
+- list_for_each_entry(srv, &ctx->srv_list, ctx_list) { |
9185 |
+- if (uuid_equal(&srv->paths_uuid, paths_uuid) && |
9186 |
+- refcount_inc_not_zero(&srv->refcount)) |
9187 |
+- return srv; |
9188 |
+- } |
9189 |
+- |
9190 |
+- return NULL; |
9191 |
+-} |
9192 |
+- |
9193 |
+-static struct rtrs_srv *get_or_create_srv(struct rtrs_srv_ctx *ctx, |
9194 |
+- const uuid_t *paths_uuid) |
9195 |
+-{ |
9196 |
+- struct rtrs_srv *srv; |
9197 |
+- |
9198 |
+- mutex_lock(&ctx->srv_mutex); |
9199 |
+- srv = __find_srv_and_get(ctx, paths_uuid); |
9200 |
+- if (!srv) |
9201 |
+- srv = __alloc_srv(ctx, paths_uuid); |
9202 |
+- mutex_unlock(&ctx->srv_mutex); |
9203 |
+- |
9204 |
+- return srv; |
9205 |
+-} |
9206 |
+- |
9207 |
+ static void put_srv(struct rtrs_srv *srv) |
9208 |
+ { |
9209 |
+ if (refcount_dec_and_test(&srv->refcount)) { |
9210 |
+@@ -1813,7 +1797,11 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id, |
9211 |
+ } |
9212 |
+ recon_cnt = le16_to_cpu(msg->recon_cnt); |
9213 |
+ srv = get_or_create_srv(ctx, &msg->paths_uuid); |
9214 |
+- if (!srv) { |
9215 |
++ /* |
9216 |
++ * "refcount == 0" happens if a previous thread calls get_or_create_srv |
9217 |
++ * allocate srv, but chunks of srv are not allocated yet. |
9218 |
++ */ |
9219 |
++ if (!srv || refcount_read(&srv->refcount) == 0) { |
9220 |
+ err = -ENOMEM; |
9221 |
+ goto reject_w_err; |
9222 |
+ } |
9223 |
+diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c |
9224 |
+index d6c924032aaa8..dd16f7b3c7ef6 100644 |
9225 |
+--- a/drivers/input/keyboard/omap4-keypad.c |
9226 |
++++ b/drivers/input/keyboard/omap4-keypad.c |
9227 |
+@@ -186,12 +186,8 @@ static int omap4_keypad_open(struct input_dev *input) |
9228 |
+ return 0; |
9229 |
+ } |
9230 |
+ |
9231 |
+-static void omap4_keypad_close(struct input_dev *input) |
9232 |
++static void omap4_keypad_stop(struct omap4_keypad *keypad_data) |
9233 |
+ { |
9234 |
+- struct omap4_keypad *keypad_data = input_get_drvdata(input); |
9235 |
+- |
9236 |
+- disable_irq(keypad_data->irq); |
9237 |
+- |
9238 |
+ /* Disable interrupts and wake-up events */ |
9239 |
+ kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, |
9240 |
+ OMAP4_VAL_IRQDISABLE); |
9241 |
+@@ -200,7 +196,15 @@ static void omap4_keypad_close(struct input_dev *input) |
9242 |
+ /* clear pending interrupts */ |
9243 |
+ kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, |
9244 |
+ kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); |
9245 |
++} |
9246 |
++ |
9247 |
++static void omap4_keypad_close(struct input_dev *input) |
9248 |
++{ |
9249 |
++ struct omap4_keypad *keypad_data; |
9250 |
+ |
9251 |
++ keypad_data = input_get_drvdata(input); |
9252 |
++ disable_irq(keypad_data->irq); |
9253 |
++ omap4_keypad_stop(keypad_data); |
9254 |
+ enable_irq(keypad_data->irq); |
9255 |
+ |
9256 |
+ pm_runtime_put_sync(input->dev.parent); |
9257 |
+@@ -223,13 +227,37 @@ static int omap4_keypad_parse_dt(struct device *dev, |
9258 |
+ return 0; |
9259 |
+ } |
9260 |
+ |
9261 |
++static int omap4_keypad_check_revision(struct device *dev, |
9262 |
++ struct omap4_keypad *keypad_data) |
9263 |
++{ |
9264 |
++ unsigned int rev; |
9265 |
++ |
9266 |
++ rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); |
9267 |
++ rev &= 0x03 << 30; |
9268 |
++ rev >>= 30; |
9269 |
++ switch (rev) { |
9270 |
++ case KBD_REVISION_OMAP4: |
9271 |
++ keypad_data->reg_offset = 0x00; |
9272 |
++ keypad_data->irqreg_offset = 0x00; |
9273 |
++ break; |
9274 |
++ case KBD_REVISION_OMAP5: |
9275 |
++ keypad_data->reg_offset = 0x10; |
9276 |
++ keypad_data->irqreg_offset = 0x0c; |
9277 |
++ break; |
9278 |
++ default: |
9279 |
++ dev_err(dev, "Keypad reports unsupported revision %d", rev); |
9280 |
++ return -EINVAL; |
9281 |
++ } |
9282 |
++ |
9283 |
++ return 0; |
9284 |
++} |
9285 |
++ |
9286 |
+ static int omap4_keypad_probe(struct platform_device *pdev) |
9287 |
+ { |
9288 |
+ struct omap4_keypad *keypad_data; |
9289 |
+ struct input_dev *input_dev; |
9290 |
+ struct resource *res; |
9291 |
+ unsigned int max_keys; |
9292 |
+- int rev; |
9293 |
+ int irq; |
9294 |
+ int error; |
9295 |
+ |
9296 |
+@@ -269,41 +297,33 @@ static int omap4_keypad_probe(struct platform_device *pdev) |
9297 |
+ goto err_release_mem; |
9298 |
+ } |
9299 |
+ |
9300 |
++ pm_runtime_enable(&pdev->dev); |
9301 |
+ |
9302 |
+ /* |
9303 |
+ * Enable clocks for the keypad module so that we can read |
9304 |
+ * revision register. |
9305 |
+ */ |
9306 |
+- pm_runtime_enable(&pdev->dev); |
9307 |
+ error = pm_runtime_get_sync(&pdev->dev); |
9308 |
+ if (error) { |
9309 |
+ dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n"); |
9310 |
+- goto err_unmap; |
9311 |
+- } |
9312 |
+- rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); |
9313 |
+- rev &= 0x03 << 30; |
9314 |
+- rev >>= 30; |
9315 |
+- switch (rev) { |
9316 |
+- case KBD_REVISION_OMAP4: |
9317 |
+- keypad_data->reg_offset = 0x00; |
9318 |
+- keypad_data->irqreg_offset = 0x00; |
9319 |
+- break; |
9320 |
+- case KBD_REVISION_OMAP5: |
9321 |
+- keypad_data->reg_offset = 0x10; |
9322 |
+- keypad_data->irqreg_offset = 0x0c; |
9323 |
+- break; |
9324 |
+- default: |
9325 |
+- dev_err(&pdev->dev, |
9326 |
+- "Keypad reports unsupported revision %d", rev); |
9327 |
+- error = -EINVAL; |
9328 |
+- goto err_pm_put_sync; |
9329 |
++ pm_runtime_put_noidle(&pdev->dev); |
9330 |
++ } else { |
9331 |
++ error = omap4_keypad_check_revision(&pdev->dev, |
9332 |
++ keypad_data); |
9333 |
++ if (!error) { |
9334 |
++ /* Ensure device does not raise interrupts */ |
9335 |
++ omap4_keypad_stop(keypad_data); |
9336 |
++ } |
9337 |
++ pm_runtime_put_sync(&pdev->dev); |
9338 |
+ } |
9339 |
++ if (error) |
9340 |
++ goto err_pm_disable; |
9341 |
+ |
9342 |
+ /* input device allocation */ |
9343 |
+ keypad_data->input = input_dev = input_allocate_device(); |
9344 |
+ if (!input_dev) { |
9345 |
+ error = -ENOMEM; |
9346 |
+- goto err_pm_put_sync; |
9347 |
++ goto err_pm_disable; |
9348 |
+ } |
9349 |
+ |
9350 |
+ input_dev->name = pdev->name; |
9351 |
+@@ -349,28 +369,25 @@ static int omap4_keypad_probe(struct platform_device *pdev) |
9352 |
+ goto err_free_keymap; |
9353 |
+ } |
9354 |
+ |
9355 |
+- device_init_wakeup(&pdev->dev, true); |
9356 |
+- pm_runtime_put_sync(&pdev->dev); |
9357 |
+- |
9358 |
+ error = input_register_device(keypad_data->input); |
9359 |
+ if (error < 0) { |
9360 |
+ dev_err(&pdev->dev, "failed to register input device\n"); |
9361 |
+- goto err_pm_disable; |
9362 |
++ goto err_free_irq; |
9363 |
+ } |
9364 |
+ |
9365 |
++ device_init_wakeup(&pdev->dev, true); |
9366 |
+ platform_set_drvdata(pdev, keypad_data); |
9367 |
++ |
9368 |
+ return 0; |
9369 |
+ |
9370 |
+-err_pm_disable: |
9371 |
+- pm_runtime_disable(&pdev->dev); |
9372 |
++err_free_irq: |
9373 |
+ free_irq(keypad_data->irq, keypad_data); |
9374 |
+ err_free_keymap: |
9375 |
+ kfree(keypad_data->keymap); |
9376 |
+ err_free_input: |
9377 |
+ input_free_device(input_dev); |
9378 |
+-err_pm_put_sync: |
9379 |
+- pm_runtime_put_sync(&pdev->dev); |
9380 |
+-err_unmap: |
9381 |
++err_pm_disable: |
9382 |
++ pm_runtime_disable(&pdev->dev); |
9383 |
+ iounmap(keypad_data->base); |
9384 |
+ err_release_mem: |
9385 |
+ release_mem_region(res->start, resource_size(res)); |
9386 |
+diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c |
9387 |
+index 7eba66fbef580..812edfced86ee 100644 |
9388 |
+--- a/drivers/input/mouse/cyapa_gen6.c |
9389 |
++++ b/drivers/input/mouse/cyapa_gen6.c |
9390 |
+@@ -573,7 +573,7 @@ static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa, |
9391 |
+ |
9392 |
+ memset(&cmd, 0, sizeof(cmd)); |
9393 |
+ put_unaligned_le16(PIP_OUTPUT_REPORT_ADDR, &cmd.head.addr); |
9394 |
+- put_unaligned_le16(sizeof(cmd), &cmd.head.length - 2); |
9395 |
++ put_unaligned_le16(sizeof(cmd) - 2, &cmd.head.length); |
9396 |
+ cmd.head.report_id = PIP_APP_CMD_REPORT_ID; |
9397 |
+ cmd.head.cmd_code = PIP_RETRIEVE_DATA_STRUCTURE; |
9398 |
+ put_unaligned_le16(read_offset, &cmd.read_offset); |
9399 |
+diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c |
9400 |
+index 8fd7fc39c4fd7..ff97897feaf2a 100644 |
9401 |
+--- a/drivers/input/touchscreen/ads7846.c |
9402 |
++++ b/drivers/input/touchscreen/ads7846.c |
9403 |
+@@ -33,6 +33,7 @@ |
9404 |
+ #include <linux/regulator/consumer.h> |
9405 |
+ #include <linux/module.h> |
9406 |
+ #include <asm/irq.h> |
9407 |
++#include <asm/unaligned.h> |
9408 |
+ |
9409 |
+ /* |
9410 |
+ * This code has been heavily tested on a Nokia 770, and lightly |
9411 |
+@@ -199,6 +200,26 @@ struct ads7846 { |
9412 |
+ #define REF_ON (READ_12BIT_DFR(x, 1, 1)) |
9413 |
+ #define REF_OFF (READ_12BIT_DFR(y, 0, 0)) |
9414 |
+ |
9415 |
++static int get_pendown_state(struct ads7846 *ts) |
9416 |
++{ |
9417 |
++ if (ts->get_pendown_state) |
9418 |
++ return ts->get_pendown_state(); |
9419 |
++ |
9420 |
++ return !gpio_get_value(ts->gpio_pendown); |
9421 |
++} |
9422 |
++ |
9423 |
++static void ads7846_report_pen_up(struct ads7846 *ts) |
9424 |
++{ |
9425 |
++ struct input_dev *input = ts->input; |
9426 |
++ |
9427 |
++ input_report_key(input, BTN_TOUCH, 0); |
9428 |
++ input_report_abs(input, ABS_PRESSURE, 0); |
9429 |
++ input_sync(input); |
9430 |
++ |
9431 |
++ ts->pendown = false; |
9432 |
++ dev_vdbg(&ts->spi->dev, "UP\n"); |
9433 |
++} |
9434 |
++ |
9435 |
+ /* Must be called with ts->lock held */ |
9436 |
+ static void ads7846_stop(struct ads7846 *ts) |
9437 |
+ { |
9438 |
+@@ -215,6 +236,10 @@ static void ads7846_stop(struct ads7846 *ts) |
9439 |
+ static void ads7846_restart(struct ads7846 *ts) |
9440 |
+ { |
9441 |
+ if (!ts->disabled && !ts->suspended) { |
9442 |
++ /* Check if pen was released since last stop */ |
9443 |
++ if (ts->pendown && !get_pendown_state(ts)) |
9444 |
++ ads7846_report_pen_up(ts); |
9445 |
++ |
9446 |
+ /* Tell IRQ thread that it may poll the device. */ |
9447 |
+ ts->stopped = false; |
9448 |
+ mb(); |
9449 |
+@@ -411,7 +436,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command) |
9450 |
+ |
9451 |
+ if (status == 0) { |
9452 |
+ /* BE12 value, then padding */ |
9453 |
+- status = be16_to_cpu(*((u16 *)&req->sample[1])); |
9454 |
++ status = get_unaligned_be16(&req->sample[1]); |
9455 |
+ status = status >> 3; |
9456 |
+ status &= 0x0fff; |
9457 |
+ } |
9458 |
+@@ -606,14 +631,6 @@ static const struct attribute_group ads784x_attr_group = { |
9459 |
+ |
9460 |
+ /*--------------------------------------------------------------------------*/ |
9461 |
+ |
9462 |
+-static int get_pendown_state(struct ads7846 *ts) |
9463 |
+-{ |
9464 |
+- if (ts->get_pendown_state) |
9465 |
+- return ts->get_pendown_state(); |
9466 |
+- |
9467 |
+- return !gpio_get_value(ts->gpio_pendown); |
9468 |
+-} |
9469 |
+- |
9470 |
+ static void null_wait_for_sync(void) |
9471 |
+ { |
9472 |
+ } |
9473 |
+@@ -786,10 +803,11 @@ static void ads7846_report_state(struct ads7846 *ts) |
9474 |
+ /* compute touch pressure resistance using equation #2 */ |
9475 |
+ Rt = z2; |
9476 |
+ Rt -= z1; |
9477 |
+- Rt *= x; |
9478 |
+ Rt *= ts->x_plate_ohms; |
9479 |
++ Rt = DIV_ROUND_CLOSEST(Rt, 16); |
9480 |
++ Rt *= x; |
9481 |
+ Rt /= z1; |
9482 |
+- Rt = (Rt + 2047) >> 12; |
9483 |
++ Rt = DIV_ROUND_CLOSEST(Rt, 256); |
9484 |
+ } else { |
9485 |
+ Rt = 0; |
9486 |
+ } |
9487 |
+@@ -868,16 +886,8 @@ static irqreturn_t ads7846_irq(int irq, void *handle) |
9488 |
+ msecs_to_jiffies(TS_POLL_PERIOD)); |
9489 |
+ } |
9490 |
+ |
9491 |
+- if (ts->pendown && !ts->stopped) { |
9492 |
+- struct input_dev *input = ts->input; |
9493 |
+- |
9494 |
+- input_report_key(input, BTN_TOUCH, 0); |
9495 |
+- input_report_abs(input, ABS_PRESSURE, 0); |
9496 |
+- input_sync(input); |
9497 |
+- |
9498 |
+- ts->pendown = false; |
9499 |
+- dev_vdbg(&ts->spi->dev, "UP\n"); |
9500 |
+- } |
9501 |
++ if (ts->pendown && !ts->stopped) |
9502 |
++ ads7846_report_pen_up(ts); |
9503 |
+ |
9504 |
+ return IRQ_HANDLED; |
9505 |
+ } |
9506 |
+diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c |
9507 |
+index 702fbaa6c9ada..ef37ccfa82562 100644 |
9508 |
+--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c |
9509 |
++++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c |
9510 |
+@@ -10,8 +10,15 @@ |
9511 |
+ |
9512 |
+ struct qcom_smmu { |
9513 |
+ struct arm_smmu_device smmu; |
9514 |
++ bool bypass_quirk; |
9515 |
++ u8 bypass_cbndx; |
9516 |
+ }; |
9517 |
+ |
9518 |
++static struct qcom_smmu *to_qcom_smmu(struct arm_smmu_device *smmu) |
9519 |
++{ |
9520 |
++ return container_of(smmu, struct qcom_smmu, smmu); |
9521 |
++} |
9522 |
++ |
9523 |
+ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = { |
9524 |
+ { .compatible = "qcom,adreno" }, |
9525 |
+ { .compatible = "qcom,mdp4" }, |
9526 |
+@@ -23,6 +30,87 @@ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = { |
9527 |
+ { } |
9528 |
+ }; |
9529 |
+ |
9530 |
++static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu) |
9531 |
++{ |
9532 |
++ unsigned int last_s2cr = ARM_SMMU_GR0_S2CR(smmu->num_mapping_groups - 1); |
9533 |
++ struct qcom_smmu *qsmmu = to_qcom_smmu(smmu); |
9534 |
++ u32 reg; |
9535 |
++ u32 smr; |
9536 |
++ int i; |
9537 |
++ |
9538 |
++ /* |
9539 |
++ * With some firmware versions writes to S2CR of type FAULT are |
9540 |
++ * ignored, and writing BYPASS will end up written as FAULT in the |
9541 |
++ * register. Perform a write to S2CR to detect if this is the case and |
9542 |
++ * if so reserve a context bank to emulate bypass streams. |
9543 |
++ */ |
9544 |
++ reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, S2CR_TYPE_BYPASS) | |
9545 |
++ FIELD_PREP(ARM_SMMU_S2CR_CBNDX, 0xff) | |
9546 |
++ FIELD_PREP(ARM_SMMU_S2CR_PRIVCFG, S2CR_PRIVCFG_DEFAULT); |
9547 |
++ arm_smmu_gr0_write(smmu, last_s2cr, reg); |
9548 |
++ reg = arm_smmu_gr0_read(smmu, last_s2cr); |
9549 |
++ if (FIELD_GET(ARM_SMMU_S2CR_TYPE, reg) != S2CR_TYPE_BYPASS) { |
9550 |
++ qsmmu->bypass_quirk = true; |
9551 |
++ qsmmu->bypass_cbndx = smmu->num_context_banks - 1; |
9552 |
++ |
9553 |
++ set_bit(qsmmu->bypass_cbndx, smmu->context_map); |
9554 |
++ |
9555 |
++ reg = FIELD_PREP(ARM_SMMU_CBAR_TYPE, CBAR_TYPE_S1_TRANS_S2_BYPASS); |
9556 |
++ arm_smmu_gr1_write(smmu, ARM_SMMU_GR1_CBAR(qsmmu->bypass_cbndx), reg); |
9557 |
++ } |
9558 |
++ |
9559 |
++ for (i = 0; i < smmu->num_mapping_groups; i++) { |
9560 |
++ smr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_SMR(i)); |
9561 |
++ |
9562 |
++ if (FIELD_GET(ARM_SMMU_SMR_VALID, smr)) { |
9563 |
++ smmu->smrs[i].id = FIELD_GET(ARM_SMMU_SMR_ID, smr); |
9564 |
++ smmu->smrs[i].mask = FIELD_GET(ARM_SMMU_SMR_MASK, smr); |
9565 |
++ smmu->smrs[i].valid = true; |
9566 |
++ |
9567 |
++ smmu->s2crs[i].type = S2CR_TYPE_BYPASS; |
9568 |
++ smmu->s2crs[i].privcfg = S2CR_PRIVCFG_DEFAULT; |
9569 |
++ smmu->s2crs[i].cbndx = 0xff; |
9570 |
++ } |
9571 |
++ } |
9572 |
++ |
9573 |
++ return 0; |
9574 |
++} |
9575 |
++ |
9576 |
++static void qcom_smmu_write_s2cr(struct arm_smmu_device *smmu, int idx) |
9577 |
++{ |
9578 |
++ struct arm_smmu_s2cr *s2cr = smmu->s2crs + idx; |
9579 |
++ struct qcom_smmu *qsmmu = to_qcom_smmu(smmu); |
9580 |
++ u32 cbndx = s2cr->cbndx; |
9581 |
++ u32 type = s2cr->type; |
9582 |
++ u32 reg; |
9583 |
++ |
9584 |
++ if (qsmmu->bypass_quirk) { |
9585 |
++ if (type == S2CR_TYPE_BYPASS) { |
9586 |
++ /* |
9587 |
++ * Firmware with quirky S2CR handling will substitute |
9588 |
++ * BYPASS writes with FAULT, so point the stream to the |
9589 |
++ * reserved context bank and ask for translation on the |
9590 |
++ * stream |
9591 |
++ */ |
9592 |
++ type = S2CR_TYPE_TRANS; |
9593 |
++ cbndx = qsmmu->bypass_cbndx; |
9594 |
++ } else if (type == S2CR_TYPE_FAULT) { |
9595 |
++ /* |
9596 |
++ * Firmware with quirky S2CR handling will ignore FAULT |
9597 |
++ * writes, so trick it to write FAULT by asking for a |
9598 |
++ * BYPASS. |
9599 |
++ */ |
9600 |
++ type = S2CR_TYPE_BYPASS; |
9601 |
++ cbndx = 0xff; |
9602 |
++ } |
9603 |
++ } |
9604 |
++ |
9605 |
++ reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, type) | |
9606 |
++ FIELD_PREP(ARM_SMMU_S2CR_CBNDX, cbndx) | |
9607 |
++ FIELD_PREP(ARM_SMMU_S2CR_PRIVCFG, s2cr->privcfg); |
9608 |
++ arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_S2CR(idx), reg); |
9609 |
++} |
9610 |
++ |
9611 |
+ static int qcom_smmu_def_domain_type(struct device *dev) |
9612 |
+ { |
9613 |
+ const struct of_device_id *match = |
9614 |
+@@ -61,8 +149,10 @@ static int qcom_smmu500_reset(struct arm_smmu_device *smmu) |
9615 |
+ } |
9616 |
+ |
9617 |
+ static const struct arm_smmu_impl qcom_smmu_impl = { |
9618 |
++ .cfg_probe = qcom_smmu_cfg_probe, |
9619 |
+ .def_domain_type = qcom_smmu_def_domain_type, |
9620 |
+ .reset = qcom_smmu500_reset, |
9621 |
++ .write_s2cr = qcom_smmu_write_s2cr, |
9622 |
+ }; |
9623 |
+ |
9624 |
+ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu) |
9625 |
+diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c |
9626 |
+index dad7fa86fbd4c..bcbacf22331d6 100644 |
9627 |
+--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c |
9628 |
++++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c |
9629 |
+@@ -929,9 +929,16 @@ static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx) |
9630 |
+ static void arm_smmu_write_s2cr(struct arm_smmu_device *smmu, int idx) |
9631 |
+ { |
9632 |
+ struct arm_smmu_s2cr *s2cr = smmu->s2crs + idx; |
9633 |
+- u32 reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, s2cr->type) | |
9634 |
+- FIELD_PREP(ARM_SMMU_S2CR_CBNDX, s2cr->cbndx) | |
9635 |
+- FIELD_PREP(ARM_SMMU_S2CR_PRIVCFG, s2cr->privcfg); |
9636 |
++ u32 reg; |
9637 |
++ |
9638 |
++ if (smmu->impl && smmu->impl->write_s2cr) { |
9639 |
++ smmu->impl->write_s2cr(smmu, idx); |
9640 |
++ return; |
9641 |
++ } |
9642 |
++ |
9643 |
++ reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, s2cr->type) | |
9644 |
++ FIELD_PREP(ARM_SMMU_S2CR_CBNDX, s2cr->cbndx) | |
9645 |
++ FIELD_PREP(ARM_SMMU_S2CR_PRIVCFG, s2cr->privcfg); |
9646 |
+ |
9647 |
+ if (smmu->features & ARM_SMMU_FEAT_EXIDS && smmu->smrs && |
9648 |
+ smmu->smrs[idx].valid) |
9649 |
+diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h |
9650 |
+index 1a746476927c9..b71647eaa319b 100644 |
9651 |
+--- a/drivers/iommu/arm/arm-smmu/arm-smmu.h |
9652 |
++++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h |
9653 |
+@@ -436,6 +436,7 @@ struct arm_smmu_impl { |
9654 |
+ int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain, |
9655 |
+ struct arm_smmu_device *smmu, |
9656 |
+ struct device *dev, int start); |
9657 |
++ void (*write_s2cr)(struct arm_smmu_device *smmu, int idx); |
9658 |
+ }; |
9659 |
+ |
9660 |
+ #define INVALID_SMENDX -1 |
9661 |
+diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c |
9662 |
+index a49afa11673cc..c9da9e93f545c 100644 |
9663 |
+--- a/drivers/iommu/intel/iommu.c |
9664 |
++++ b/drivers/iommu/intel/iommu.c |
9665 |
+@@ -5387,6 +5387,7 @@ static void intel_iommu_aux_detach_device(struct iommu_domain *domain, |
9666 |
+ aux_domain_remove_dev(to_dmar_domain(domain), dev); |
9667 |
+ } |
9668 |
+ |
9669 |
++#ifdef CONFIG_INTEL_IOMMU_SVM |
9670 |
+ /* |
9671 |
+ * 2D array for converting and sanitizing IOMMU generic TLB granularity to |
9672 |
+ * VT-d granularity. Invalidation is typically included in the unmap operation |
9673 |
+@@ -5433,7 +5434,6 @@ static inline u64 to_vtd_size(u64 granu_size, u64 nr_granules) |
9674 |
+ return order_base_2(nr_pages); |
9675 |
+ } |
9676 |
+ |
9677 |
+-#ifdef CONFIG_INTEL_IOMMU_SVM |
9678 |
+ static int |
9679 |
+ intel_iommu_sva_invalidate(struct iommu_domain *domain, struct device *dev, |
9680 |
+ struct iommu_cache_invalidate_info *inv_info) |
9681 |
+diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c |
9682 |
+index 23a3b877f7f1d..ede02dc2bcd0b 100644 |
9683 |
+--- a/drivers/irqchip/irq-alpine-msi.c |
9684 |
++++ b/drivers/irqchip/irq-alpine-msi.c |
9685 |
+@@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, |
9686 |
+ return 0; |
9687 |
+ |
9688 |
+ err_sgi: |
9689 |
+- while (--i >= 0) |
9690 |
+- irq_domain_free_irqs_parent(domain, virq, i); |
9691 |
++ irq_domain_free_irqs_parent(domain, virq, i - 1); |
9692 |
+ alpine_msix_free_sgi(priv, sgi, nr_irqs); |
9693 |
+ return err; |
9694 |
+ } |
9695 |
+diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c |
9696 |
+index b2ab8db439d92..532d0ae172d9f 100644 |
9697 |
+--- a/drivers/irqchip/irq-ti-sci-inta.c |
9698 |
++++ b/drivers/irqchip/irq-ti-sci-inta.c |
9699 |
+@@ -726,7 +726,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) |
9700 |
+ INIT_LIST_HEAD(&inta->vint_list); |
9701 |
+ mutex_init(&inta->vint_mutex); |
9702 |
+ |
9703 |
+- dev_info(dev, "Interrupt Aggregator domain %d created\n", pdev->id); |
9704 |
++ dev_info(dev, "Interrupt Aggregator domain %d created\n", inta->ti_sci_id); |
9705 |
+ |
9706 |
+ return 0; |
9707 |
+ } |
9708 |
+diff --git a/drivers/irqchip/irq-ti-sci-intr.c b/drivers/irqchip/irq-ti-sci-intr.c |
9709 |
+index ac9d6d658e65c..fe8fad22bcf96 100644 |
9710 |
+--- a/drivers/irqchip/irq-ti-sci-intr.c |
9711 |
++++ b/drivers/irqchip/irq-ti-sci-intr.c |
9712 |
+@@ -129,7 +129,7 @@ static void ti_sci_intr_irq_domain_free(struct irq_domain *domain, |
9713 |
+ * @virq: Corresponding Linux virtual IRQ number |
9714 |
+ * @hwirq: Corresponding hwirq for the IRQ within this IRQ domain |
9715 |
+ * |
9716 |
+- * Returns parent irq if all went well else appropriate error pointer. |
9717 |
++ * Returns intr output irq if all went well else appropriate error pointer. |
9718 |
+ */ |
9719 |
+ static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain, |
9720 |
+ unsigned int virq, u32 hwirq) |
9721 |
+@@ -173,7 +173,7 @@ static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain, |
9722 |
+ if (err) |
9723 |
+ goto err_msg; |
9724 |
+ |
9725 |
+- return p_hwirq; |
9726 |
++ return out_irq; |
9727 |
+ |
9728 |
+ err_msg: |
9729 |
+ irq_domain_free_irqs_parent(domain, virq, 1); |
9730 |
+@@ -198,19 +198,19 @@ static int ti_sci_intr_irq_domain_alloc(struct irq_domain *domain, |
9731 |
+ struct irq_fwspec *fwspec = data; |
9732 |
+ unsigned long hwirq; |
9733 |
+ unsigned int flags; |
9734 |
+- int err, p_hwirq; |
9735 |
++ int err, out_irq; |
9736 |
+ |
9737 |
+ err = ti_sci_intr_irq_domain_translate(domain, fwspec, &hwirq, &flags); |
9738 |
+ if (err) |
9739 |
+ return err; |
9740 |
+ |
9741 |
+- p_hwirq = ti_sci_intr_alloc_parent_irq(domain, virq, hwirq); |
9742 |
+- if (p_hwirq < 0) |
9743 |
+- return p_hwirq; |
9744 |
++ out_irq = ti_sci_intr_alloc_parent_irq(domain, virq, hwirq); |
9745 |
++ if (out_irq < 0) |
9746 |
++ return out_irq; |
9747 |
+ |
9748 |
+ irq_domain_set_hwirq_and_chip(domain, virq, hwirq, |
9749 |
+ &ti_sci_intr_irq_chip, |
9750 |
+- (void *)(uintptr_t)p_hwirq); |
9751 |
++ (void *)(uintptr_t)out_irq); |
9752 |
+ |
9753 |
+ return 0; |
9754 |
+ } |
9755 |
+diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c |
9756 |
+index bd39e9de6ecf7..5dc63c20b67ea 100644 |
9757 |
+--- a/drivers/irqchip/qcom-pdc.c |
9758 |
++++ b/drivers/irqchip/qcom-pdc.c |
9759 |
+@@ -159,6 +159,8 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) |
9760 |
+ { |
9761 |
+ int pin_out = d->hwirq; |
9762 |
+ enum pdc_irq_config_bits pdc_type; |
9763 |
++ enum pdc_irq_config_bits old_pdc_type; |
9764 |
++ int ret; |
9765 |
+ |
9766 |
+ if (pin_out == GPIO_NO_WAKE_IRQ) |
9767 |
+ return 0; |
9768 |
+@@ -187,9 +189,26 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) |
9769 |
+ return -EINVAL; |
9770 |
+ } |
9771 |
+ |
9772 |
++ old_pdc_type = pdc_reg_read(IRQ_i_CFG, pin_out); |
9773 |
+ pdc_reg_write(IRQ_i_CFG, pin_out, pdc_type); |
9774 |
+ |
9775 |
+- return irq_chip_set_type_parent(d, type); |
9776 |
++ ret = irq_chip_set_type_parent(d, type); |
9777 |
++ if (ret) |
9778 |
++ return ret; |
9779 |
++ |
9780 |
++ /* |
9781 |
++ * When we change types the PDC can give a phantom interrupt. |
9782 |
++ * Clear it. Specifically the phantom shows up when reconfiguring |
9783 |
++ * polarity of interrupt without changing the state of the signal |
9784 |
++ * but let's be consistent and clear it always. |
9785 |
++ * |
9786 |
++ * Doing this works because we have IRQCHIP_SET_TYPE_MASKED so the |
9787 |
++ * interrupt will be cleared before the rest of the system sees it. |
9788 |
++ */ |
9789 |
++ if (old_pdc_type != pdc_type) |
9790 |
++ irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, false); |
9791 |
++ |
9792 |
++ return 0; |
9793 |
+ } |
9794 |
+ |
9795 |
+ static struct irq_chip qcom_pdc_gic_chip = { |
9796 |
+diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c |
9797 |
+index 5fb4f24aeb2e8..f13117eed976d 100644 |
9798 |
+--- a/drivers/leds/leds-lp50xx.c |
9799 |
++++ b/drivers/leds/leds-lp50xx.c |
9800 |
+@@ -487,8 +487,10 @@ static int lp50xx_probe_dt(struct lp50xx *priv) |
9801 |
+ */ |
9802 |
+ mc_led_info = devm_kcalloc(priv->dev, LP50XX_LEDS_PER_MODULE, |
9803 |
+ sizeof(*mc_led_info), GFP_KERNEL); |
9804 |
+- if (!mc_led_info) |
9805 |
+- return -ENOMEM; |
9806 |
++ if (!mc_led_info) { |
9807 |
++ ret = -ENOMEM; |
9808 |
++ goto child_out; |
9809 |
++ } |
9810 |
+ |
9811 |
+ fwnode_for_each_child_node(child, led_node) { |
9812 |
+ ret = fwnode_property_read_u32(led_node, "color", |
9813 |
+diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c |
9814 |
+index e6fd47365b588..68fbf0b66fadd 100644 |
9815 |
+--- a/drivers/leds/leds-netxbig.c |
9816 |
++++ b/drivers/leds/leds-netxbig.c |
9817 |
+@@ -448,31 +448,39 @@ static int netxbig_leds_get_of_pdata(struct device *dev, |
9818 |
+ gpio_ext = devm_kzalloc(dev, sizeof(*gpio_ext), GFP_KERNEL); |
9819 |
+ if (!gpio_ext) { |
9820 |
+ of_node_put(gpio_ext_np); |
9821 |
+- return -ENOMEM; |
9822 |
++ ret = -ENOMEM; |
9823 |
++ goto put_device; |
9824 |
+ } |
9825 |
+ ret = netxbig_gpio_ext_get(dev, gpio_ext_dev, gpio_ext); |
9826 |
+ of_node_put(gpio_ext_np); |
9827 |
+ if (ret) |
9828 |
+- return ret; |
9829 |
++ goto put_device; |
9830 |
+ pdata->gpio_ext = gpio_ext; |
9831 |
+ |
9832 |
+ /* Timers (optional) */ |
9833 |
+ ret = of_property_count_u32_elems(np, "timers"); |
9834 |
+ if (ret > 0) { |
9835 |
+- if (ret % 3) |
9836 |
+- return -EINVAL; |
9837 |
++ if (ret % 3) { |
9838 |
++ ret = -EINVAL; |
9839 |
++ goto put_device; |
9840 |
++ } |
9841 |
++ |
9842 |
+ num_timers = ret / 3; |
9843 |
+ timers = devm_kcalloc(dev, num_timers, sizeof(*timers), |
9844 |
+ GFP_KERNEL); |
9845 |
+- if (!timers) |
9846 |
+- return -ENOMEM; |
9847 |
++ if (!timers) { |
9848 |
++ ret = -ENOMEM; |
9849 |
++ goto put_device; |
9850 |
++ } |
9851 |
+ for (i = 0; i < num_timers; i++) { |
9852 |
+ u32 tmp; |
9853 |
+ |
9854 |
+ of_property_read_u32_index(np, "timers", 3 * i, |
9855 |
+ &timers[i].mode); |
9856 |
+- if (timers[i].mode >= NETXBIG_LED_MODE_NUM) |
9857 |
+- return -EINVAL; |
9858 |
++ if (timers[i].mode >= NETXBIG_LED_MODE_NUM) { |
9859 |
++ ret = -EINVAL; |
9860 |
++ goto put_device; |
9861 |
++ } |
9862 |
+ of_property_read_u32_index(np, "timers", |
9863 |
+ 3 * i + 1, &tmp); |
9864 |
+ timers[i].delay_on = tmp; |
9865 |
+@@ -488,12 +496,15 @@ static int netxbig_leds_get_of_pdata(struct device *dev, |
9866 |
+ num_leds = of_get_available_child_count(np); |
9867 |
+ if (!num_leds) { |
9868 |
+ dev_err(dev, "No LED subnodes found in DT\n"); |
9869 |
+- return -ENODEV; |
9870 |
++ ret = -ENODEV; |
9871 |
++ goto put_device; |
9872 |
+ } |
9873 |
+ |
9874 |
+ leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL); |
9875 |
+- if (!leds) |
9876 |
+- return -ENOMEM; |
9877 |
++ if (!leds) { |
9878 |
++ ret = -ENOMEM; |
9879 |
++ goto put_device; |
9880 |
++ } |
9881 |
+ |
9882 |
+ led = leds; |
9883 |
+ for_each_available_child_of_node(np, child) { |
9884 |
+@@ -574,6 +585,8 @@ static int netxbig_leds_get_of_pdata(struct device *dev, |
9885 |
+ |
9886 |
+ err_node_put: |
9887 |
+ of_node_put(child); |
9888 |
++put_device: |
9889 |
++ put_device(gpio_ext_dev); |
9890 |
+ return ret; |
9891 |
+ } |
9892 |
+ |
9893 |
+diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c |
9894 |
+index 8c5bdc3847ee7..880fc8def5309 100644 |
9895 |
+--- a/drivers/leds/leds-turris-omnia.c |
9896 |
++++ b/drivers/leds/leds-turris-omnia.c |
9897 |
+@@ -98,9 +98,9 @@ static int omnia_led_register(struct i2c_client *client, struct omnia_led *led, |
9898 |
+ } |
9899 |
+ |
9900 |
+ ret = of_property_read_u32(np, "color", &color); |
9901 |
+- if (ret || color != LED_COLOR_ID_MULTI) { |
9902 |
++ if (ret || color != LED_COLOR_ID_RGB) { |
9903 |
+ dev_warn(dev, |
9904 |
+- "Node %pOF: must contain 'color' property with value LED_COLOR_ID_MULTI\n", |
9905 |
++ "Node %pOF: must contain 'color' property with value LED_COLOR_ID_RGB\n", |
9906 |
+ np); |
9907 |
+ return 0; |
9908 |
+ } |
9909 |
+diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c |
9910 |
+index f3d1a460fbce1..0ee3272491501 100644 |
9911 |
+--- a/drivers/macintosh/adb-iop.c |
9912 |
++++ b/drivers/macintosh/adb-iop.c |
9913 |
+@@ -25,6 +25,7 @@ |
9914 |
+ static struct adb_request *current_req; |
9915 |
+ static struct adb_request *last_req; |
9916 |
+ static unsigned int autopoll_devs; |
9917 |
++static u8 autopoll_addr; |
9918 |
+ |
9919 |
+ static enum adb_iop_state { |
9920 |
+ idle, |
9921 |
+@@ -41,6 +42,11 @@ static int adb_iop_autopoll(int); |
9922 |
+ static void adb_iop_poll(void); |
9923 |
+ static int adb_iop_reset_bus(void); |
9924 |
+ |
9925 |
++/* ADB command byte structure */ |
9926 |
++#define ADDR_MASK 0xF0 |
9927 |
++#define OP_MASK 0x0C |
9928 |
++#define TALK 0x0C |
9929 |
++ |
9930 |
+ struct adb_driver adb_iop_driver = { |
9931 |
+ .name = "ISM IOP", |
9932 |
+ .probe = adb_iop_probe, |
9933 |
+@@ -78,10 +84,7 @@ static void adb_iop_complete(struct iop_msg *msg) |
9934 |
+ |
9935 |
+ local_irq_save(flags); |
9936 |
+ |
9937 |
+- if (current_req->reply_expected) |
9938 |
+- adb_iop_state = awaiting_reply; |
9939 |
+- else |
9940 |
+- adb_iop_done(); |
9941 |
++ adb_iop_state = awaiting_reply; |
9942 |
+ |
9943 |
+ local_irq_restore(flags); |
9944 |
+ } |
9945 |
+@@ -89,38 +92,52 @@ static void adb_iop_complete(struct iop_msg *msg) |
9946 |
+ /* |
9947 |
+ * Listen for ADB messages from the IOP. |
9948 |
+ * |
9949 |
+- * This will be called when unsolicited messages (usually replies to TALK |
9950 |
+- * commands or autopoll packets) are received. |
9951 |
++ * This will be called when unsolicited IOP messages are received. |
9952 |
++ * These IOP messages can carry ADB autopoll responses and also occur |
9953 |
++ * after explicit ADB commands. |
9954 |
+ */ |
9955 |
+ |
9956 |
+ static void adb_iop_listen(struct iop_msg *msg) |
9957 |
+ { |
9958 |
+ struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message; |
9959 |
++ u8 addr = (amsg->cmd & ADDR_MASK) >> 4; |
9960 |
++ u8 op = amsg->cmd & OP_MASK; |
9961 |
+ unsigned long flags; |
9962 |
+ bool req_done = false; |
9963 |
+ |
9964 |
+ local_irq_save(flags); |
9965 |
+ |
9966 |
+- /* Handle a timeout. Timeout packets seem to occur even after |
9967 |
+- * we've gotten a valid reply to a TALK, presumably because of |
9968 |
+- * autopolling. |
9969 |
++ /* Responses to Talk commands may be unsolicited as they are |
9970 |
++ * produced when the IOP polls devices. They are mostly timeouts. |
9971 |
+ */ |
9972 |
+- |
9973 |
+- if (amsg->flags & ADB_IOP_EXPLICIT) { |
9974 |
++ if (op == TALK && ((1 << addr) & autopoll_devs)) |
9975 |
++ autopoll_addr = addr; |
9976 |
++ |
9977 |
++ switch (amsg->flags & (ADB_IOP_EXPLICIT | |
9978 |
++ ADB_IOP_AUTOPOLL | |
9979 |
++ ADB_IOP_TIMEOUT)) { |
9980 |
++ case ADB_IOP_EXPLICIT: |
9981 |
++ case ADB_IOP_EXPLICIT | ADB_IOP_TIMEOUT: |
9982 |
+ if (adb_iop_state == awaiting_reply) { |
9983 |
+ struct adb_request *req = current_req; |
9984 |
+ |
9985 |
+- req->reply_len = amsg->count + 1; |
9986 |
+- memcpy(req->reply, &amsg->cmd, req->reply_len); |
9987 |
++ if (req->reply_expected) { |
9988 |
++ req->reply_len = amsg->count + 1; |
9989 |
++ memcpy(req->reply, &amsg->cmd, req->reply_len); |
9990 |
++ } |
9991 |
+ |
9992 |
+ req_done = true; |
9993 |
+ } |
9994 |
+- } else if (!(amsg->flags & ADB_IOP_TIMEOUT)) { |
9995 |
+- adb_input(&amsg->cmd, amsg->count + 1, |
9996 |
+- amsg->flags & ADB_IOP_AUTOPOLL); |
9997 |
++ break; |
9998 |
++ case ADB_IOP_AUTOPOLL: |
9999 |
++ if (((1 << addr) & autopoll_devs) && |
10000 |
++ amsg->cmd == ADB_READREG(addr, 0)) |
10001 |
++ adb_input(&amsg->cmd, amsg->count + 1, 1); |
10002 |
++ break; |
10003 |
+ } |
10004 |
+- |
10005 |
+- msg->reply[0] = autopoll_devs ? ADB_IOP_AUTOPOLL : 0; |
10006 |
++ msg->reply[0] = autopoll_addr ? ADB_IOP_AUTOPOLL : 0; |
10007 |
++ msg->reply[1] = 0; |
10008 |
++ msg->reply[2] = autopoll_addr ? ADB_READREG(autopoll_addr, 0) : 0; |
10009 |
+ iop_complete_message(msg); |
10010 |
+ |
10011 |
+ if (req_done) |
10012 |
+@@ -233,6 +250,9 @@ static void adb_iop_set_ap_complete(struct iop_msg *msg) |
10013 |
+ struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message; |
10014 |
+ |
10015 |
+ autopoll_devs = (amsg->data[1] << 8) | amsg->data[0]; |
10016 |
++ if (autopoll_devs & (1 << autopoll_addr)) |
10017 |
++ return; |
10018 |
++ autopoll_addr = autopoll_devs ? (ffs(autopoll_devs) - 1) : 0; |
10019 |
+ } |
10020 |
+ |
10021 |
+ static int adb_iop_autopoll(int devs) |
10022 |
+diff --git a/drivers/mailbox/arm_mhu_db.c b/drivers/mailbox/arm_mhu_db.c |
10023 |
+index 275efe4cca0c2..8eb66c4ecf5bf 100644 |
10024 |
+--- a/drivers/mailbox/arm_mhu_db.c |
10025 |
++++ b/drivers/mailbox/arm_mhu_db.c |
10026 |
+@@ -180,7 +180,7 @@ static void mhu_db_shutdown(struct mbox_chan *chan) |
10027 |
+ |
10028 |
+ /* Reset channel */ |
10029 |
+ mhu_db_mbox_clear_irq(chan); |
10030 |
+- kfree(chan->con_priv); |
10031 |
++ devm_kfree(mbox->dev, chan->con_priv); |
10032 |
+ chan->con_priv = NULL; |
10033 |
+ } |
10034 |
+ |
10035 |
+diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c |
10036 |
+index cd0478d44058b..5e306bba43751 100644 |
10037 |
+--- a/drivers/md/dm-ioctl.c |
10038 |
++++ b/drivers/md/dm-ioctl.c |
10039 |
+@@ -1600,6 +1600,7 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para |
10040 |
+ |
10041 |
+ if (!argc) { |
10042 |
+ DMWARN("Empty message received."); |
10043 |
++ r = -EINVAL; |
10044 |
+ goto out_argv; |
10045 |
+ } |
10046 |
+ |
10047 |
+diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c |
10048 |
+index 4aaf4820b6f62..f0e64e76fd793 100644 |
10049 |
+--- a/drivers/md/md-cluster.c |
10050 |
++++ b/drivers/md/md-cluster.c |
10051 |
+@@ -664,9 +664,27 @@ out: |
10052 |
+ * Takes the lock on the TOKEN lock resource so no other |
10053 |
+ * node can communicate while the operation is underway. |
10054 |
+ */ |
10055 |
+-static int lock_token(struct md_cluster_info *cinfo, bool mddev_locked) |
10056 |
++static int lock_token(struct md_cluster_info *cinfo) |
10057 |
+ { |
10058 |
+- int error, set_bit = 0; |
10059 |
++ int error; |
10060 |
++ |
10061 |
++ error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX); |
10062 |
++ if (error) { |
10063 |
++ pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n", |
10064 |
++ __func__, __LINE__, error); |
10065 |
++ } else { |
10066 |
++ /* Lock the receive sequence */ |
10067 |
++ mutex_lock(&cinfo->recv_mutex); |
10068 |
++ } |
10069 |
++ return error; |
10070 |
++} |
10071 |
++ |
10072 |
++/* lock_comm() |
10073 |
++ * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel. |
10074 |
++ */ |
10075 |
++static int lock_comm(struct md_cluster_info *cinfo, bool mddev_locked) |
10076 |
++{ |
10077 |
++ int rv, set_bit = 0; |
10078 |
+ struct mddev *mddev = cinfo->mddev; |
10079 |
+ |
10080 |
+ /* |
10081 |
+@@ -677,34 +695,19 @@ static int lock_token(struct md_cluster_info *cinfo, bool mddev_locked) |
10082 |
+ */ |
10083 |
+ if (mddev_locked && !test_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, |
10084 |
+ &cinfo->state)) { |
10085 |
+- error = test_and_set_bit_lock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, |
10086 |
++ rv = test_and_set_bit_lock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, |
10087 |
+ &cinfo->state); |
10088 |
+- WARN_ON_ONCE(error); |
10089 |
++ WARN_ON_ONCE(rv); |
10090 |
+ md_wakeup_thread(mddev->thread); |
10091 |
+ set_bit = 1; |
10092 |
+ } |
10093 |
+- error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX); |
10094 |
+- if (set_bit) |
10095 |
+- clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); |
10096 |
+ |
10097 |
+- if (error) |
10098 |
+- pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n", |
10099 |
+- __func__, __LINE__, error); |
10100 |
+- |
10101 |
+- /* Lock the receive sequence */ |
10102 |
+- mutex_lock(&cinfo->recv_mutex); |
10103 |
+- return error; |
10104 |
+-} |
10105 |
+- |
10106 |
+-/* lock_comm() |
10107 |
+- * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel. |
10108 |
+- */ |
10109 |
+-static int lock_comm(struct md_cluster_info *cinfo, bool mddev_locked) |
10110 |
+-{ |
10111 |
+ wait_event(cinfo->wait, |
10112 |
+ !test_and_set_bit(MD_CLUSTER_SEND_LOCK, &cinfo->state)); |
10113 |
+- |
10114 |
+- return lock_token(cinfo, mddev_locked); |
10115 |
++ rv = lock_token(cinfo); |
10116 |
++ if (set_bit) |
10117 |
++ clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); |
10118 |
++ return rv; |
10119 |
+ } |
10120 |
+ |
10121 |
+ static void unlock_comm(struct md_cluster_info *cinfo) |
10122 |
+@@ -784,9 +787,11 @@ static int sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg, |
10123 |
+ { |
10124 |
+ int ret; |
10125 |
+ |
10126 |
+- lock_comm(cinfo, mddev_locked); |
10127 |
+- ret = __sendmsg(cinfo, cmsg); |
10128 |
+- unlock_comm(cinfo); |
10129 |
++ ret = lock_comm(cinfo, mddev_locked); |
10130 |
++ if (!ret) { |
10131 |
++ ret = __sendmsg(cinfo, cmsg); |
10132 |
++ unlock_comm(cinfo); |
10133 |
++ } |
10134 |
+ return ret; |
10135 |
+ } |
10136 |
+ |
10137 |
+@@ -1061,7 +1066,7 @@ static int metadata_update_start(struct mddev *mddev) |
10138 |
+ return 0; |
10139 |
+ } |
10140 |
+ |
10141 |
+- ret = lock_token(cinfo, 1); |
10142 |
++ ret = lock_token(cinfo); |
10143 |
+ clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state); |
10144 |
+ return ret; |
10145 |
+ } |
10146 |
+@@ -1255,7 +1260,10 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors) |
10147 |
+ int raid_slot = -1; |
10148 |
+ |
10149 |
+ md_update_sb(mddev, 1); |
10150 |
+- lock_comm(cinfo, 1); |
10151 |
++ if (lock_comm(cinfo, 1)) { |
10152 |
++ pr_err("%s: lock_comm failed\n", __func__); |
10153 |
++ return; |
10154 |
++ } |
10155 |
+ |
10156 |
+ memset(&cmsg, 0, sizeof(cmsg)); |
10157 |
+ cmsg.type = cpu_to_le32(METADATA_UPDATED); |
10158 |
+@@ -1407,7 +1415,8 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev) |
10159 |
+ cmsg.type = cpu_to_le32(NEWDISK); |
10160 |
+ memcpy(cmsg.uuid, uuid, 16); |
10161 |
+ cmsg.raid_slot = cpu_to_le32(rdev->desc_nr); |
10162 |
+- lock_comm(cinfo, 1); |
10163 |
++ if (lock_comm(cinfo, 1)) |
10164 |
++ return -EAGAIN; |
10165 |
+ ret = __sendmsg(cinfo, &cmsg); |
10166 |
+ if (ret) { |
10167 |
+ unlock_comm(cinfo); |
10168 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
10169 |
+index 4136bd8142894..3be74cf3635fe 100644 |
10170 |
+--- a/drivers/md/md.c |
10171 |
++++ b/drivers/md/md.c |
10172 |
+@@ -6948,8 +6948,10 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev) |
10173 |
+ goto busy; |
10174 |
+ |
10175 |
+ kick_rdev: |
10176 |
+- if (mddev_is_clustered(mddev)) |
10177 |
+- md_cluster_ops->remove_disk(mddev, rdev); |
10178 |
++ if (mddev_is_clustered(mddev)) { |
10179 |
++ if (md_cluster_ops->remove_disk(mddev, rdev)) |
10180 |
++ goto busy; |
10181 |
++ } |
10182 |
+ |
10183 |
+ md_kick_rdev_from_array(rdev); |
10184 |
+ set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags); |
10185 |
+@@ -7278,6 +7280,7 @@ static int update_raid_disks(struct mddev *mddev, int raid_disks) |
10186 |
+ return -EINVAL; |
10187 |
+ if (mddev->sync_thread || |
10188 |
+ test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || |
10189 |
++ test_bit(MD_RESYNCING_REMOTE, &mddev->recovery) || |
10190 |
+ mddev->reshape_position != MaxSector) |
10191 |
+ return -EBUSY; |
10192 |
+ |
10193 |
+@@ -9645,8 +9648,11 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev) |
10194 |
+ } |
10195 |
+ } |
10196 |
+ |
10197 |
+- if (mddev->raid_disks != le32_to_cpu(sb->raid_disks)) |
10198 |
+- update_raid_disks(mddev, le32_to_cpu(sb->raid_disks)); |
10199 |
++ if (mddev->raid_disks != le32_to_cpu(sb->raid_disks)) { |
10200 |
++ ret = update_raid_disks(mddev, le32_to_cpu(sb->raid_disks)); |
10201 |
++ if (ret) |
10202 |
++ pr_warn("md: updating array disks failed. %d\n", ret); |
10203 |
++ } |
10204 |
+ |
10205 |
+ /* |
10206 |
+ * Since mddev->delta_disks has already updated in update_raid_disks, |
10207 |
+diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c |
10208 |
+index 88f90dfd368b1..ae17407e477a4 100644 |
10209 |
+--- a/drivers/media/common/siano/smsdvb-main.c |
10210 |
++++ b/drivers/media/common/siano/smsdvb-main.c |
10211 |
+@@ -1169,12 +1169,15 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, |
10212 |
+ rc = dvb_create_media_graph(&client->adapter, true); |
10213 |
+ if (rc < 0) { |
10214 |
+ pr_err("dvb_create_media_graph failed %d\n", rc); |
10215 |
+- goto client_error; |
10216 |
++ goto media_graph_error; |
10217 |
+ } |
10218 |
+ |
10219 |
+ pr_info("DVB interface registered.\n"); |
10220 |
+ return 0; |
10221 |
+ |
10222 |
++media_graph_error: |
10223 |
++ smsdvb_debugfs_release(client); |
10224 |
++ |
10225 |
+ client_error: |
10226 |
+ dvb_unregister_frontend(&client->frontend); |
10227 |
+ |
10228 |
+diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c |
10229 |
+index 1ef5af9a8c8bc..cee1a4817af99 100644 |
10230 |
+--- a/drivers/media/i2c/imx214.c |
10231 |
++++ b/drivers/media/i2c/imx214.c |
10232 |
+@@ -786,7 +786,7 @@ static int imx214_s_stream(struct v4l2_subdev *subdev, int enable) |
10233 |
+ if (ret < 0) |
10234 |
+ goto err_rpm_put; |
10235 |
+ } else { |
10236 |
+- ret = imx214_start_streaming(imx214); |
10237 |
++ ret = imx214_stop_streaming(imx214); |
10238 |
+ if (ret < 0) |
10239 |
+ goto err_rpm_put; |
10240 |
+ pm_runtime_put(imx214->dev); |
10241 |
+diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c |
10242 |
+index 1cee45e353554..0ae66091a6962 100644 |
10243 |
+--- a/drivers/media/i2c/imx219.c |
10244 |
++++ b/drivers/media/i2c/imx219.c |
10245 |
+@@ -473,8 +473,8 @@ static const struct imx219_mode supported_modes[] = { |
10246 |
+ .width = 3280, |
10247 |
+ .height = 2464, |
10248 |
+ .crop = { |
10249 |
+- .left = 0, |
10250 |
+- .top = 0, |
10251 |
++ .left = IMX219_PIXEL_ARRAY_LEFT, |
10252 |
++ .top = IMX219_PIXEL_ARRAY_TOP, |
10253 |
+ .width = 3280, |
10254 |
+ .height = 2464 |
10255 |
+ }, |
10256 |
+@@ -489,8 +489,8 @@ static const struct imx219_mode supported_modes[] = { |
10257 |
+ .width = 1920, |
10258 |
+ .height = 1080, |
10259 |
+ .crop = { |
10260 |
+- .left = 680, |
10261 |
+- .top = 692, |
10262 |
++ .left = 688, |
10263 |
++ .top = 700, |
10264 |
+ .width = 1920, |
10265 |
+ .height = 1080 |
10266 |
+ }, |
10267 |
+@@ -505,8 +505,8 @@ static const struct imx219_mode supported_modes[] = { |
10268 |
+ .width = 1640, |
10269 |
+ .height = 1232, |
10270 |
+ .crop = { |
10271 |
+- .left = 0, |
10272 |
+- .top = 0, |
10273 |
++ .left = IMX219_PIXEL_ARRAY_LEFT, |
10274 |
++ .top = IMX219_PIXEL_ARRAY_TOP, |
10275 |
+ .width = 3280, |
10276 |
+ .height = 2464 |
10277 |
+ }, |
10278 |
+@@ -521,8 +521,8 @@ static const struct imx219_mode supported_modes[] = { |
10279 |
+ .width = 640, |
10280 |
+ .height = 480, |
10281 |
+ .crop = { |
10282 |
+- .left = 1000, |
10283 |
+- .top = 752, |
10284 |
++ .left = 1008, |
10285 |
++ .top = 760, |
10286 |
+ .width = 1280, |
10287 |
+ .height = 960 |
10288 |
+ }, |
10289 |
+@@ -1008,6 +1008,7 @@ static int imx219_get_selection(struct v4l2_subdev *sd, |
10290 |
+ return 0; |
10291 |
+ |
10292 |
+ case V4L2_SEL_TGT_CROP_DEFAULT: |
10293 |
++ case V4L2_SEL_TGT_CROP_BOUNDS: |
10294 |
+ sel->r.top = IMX219_PIXEL_ARRAY_TOP; |
10295 |
+ sel->r.left = IMX219_PIXEL_ARRAY_LEFT; |
10296 |
+ sel->r.width = IMX219_PIXEL_ARRAY_WIDTH; |
10297 |
+diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c |
10298 |
+index 03b4ed3a61b83..661208c9bfc5d 100644 |
10299 |
+--- a/drivers/media/i2c/max2175.c |
10300 |
++++ b/drivers/media/i2c/max2175.c |
10301 |
+@@ -503,7 +503,7 @@ static void max2175_set_bbfilter(struct max2175 *ctx) |
10302 |
+ } |
10303 |
+ } |
10304 |
+ |
10305 |
+-static bool max2175_set_csm_mode(struct max2175 *ctx, |
10306 |
++static int max2175_set_csm_mode(struct max2175 *ctx, |
10307 |
+ enum max2175_csm_mode new_mode) |
10308 |
+ { |
10309 |
+ int ret = max2175_poll_csm_ready(ctx); |
10310 |
+diff --git a/drivers/media/i2c/max9271.c b/drivers/media/i2c/max9271.c |
10311 |
+index 0f6f7a092a463..c247db569bab0 100644 |
10312 |
+--- a/drivers/media/i2c/max9271.c |
10313 |
++++ b/drivers/media/i2c/max9271.c |
10314 |
+@@ -223,12 +223,12 @@ int max9271_enable_gpios(struct max9271_device *dev, u8 gpio_mask) |
10315 |
+ { |
10316 |
+ int ret; |
10317 |
+ |
10318 |
+- ret = max9271_read(dev, 0x0f); |
10319 |
++ ret = max9271_read(dev, 0x0e); |
10320 |
+ if (ret < 0) |
10321 |
+ return 0; |
10322 |
+ |
10323 |
+ /* BIT(0) reserved: GPO is always enabled. */ |
10324 |
+- ret |= gpio_mask | BIT(0); |
10325 |
++ ret |= (gpio_mask & ~BIT(0)); |
10326 |
+ ret = max9271_write(dev, 0x0e, ret); |
10327 |
+ if (ret < 0) { |
10328 |
+ dev_err(&dev->client->dev, "Failed to enable gpio (%d)\n", ret); |
10329 |
+@@ -245,12 +245,12 @@ int max9271_disable_gpios(struct max9271_device *dev, u8 gpio_mask) |
10330 |
+ { |
10331 |
+ int ret; |
10332 |
+ |
10333 |
+- ret = max9271_read(dev, 0x0f); |
10334 |
++ ret = max9271_read(dev, 0x0e); |
10335 |
+ if (ret < 0) |
10336 |
+ return 0; |
10337 |
+ |
10338 |
+ /* BIT(0) reserved: GPO cannot be disabled */ |
10339 |
+- ret &= (~gpio_mask | BIT(0)); |
10340 |
++ ret &= ~(gpio_mask | BIT(0)); |
10341 |
+ ret = max9271_write(dev, 0x0e, ret); |
10342 |
+ if (ret < 0) { |
10343 |
+ dev_err(&dev->client->dev, "Failed to disable gpio (%d)\n", ret); |
10344 |
+diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c |
10345 |
+index 8d0254d0e5ea7..8f0812e859012 100644 |
10346 |
+--- a/drivers/media/i2c/ov5640.c |
10347 |
++++ b/drivers/media/i2c/ov5640.c |
10348 |
+@@ -1216,20 +1216,6 @@ static int ov5640_set_autogain(struct ov5640_dev *sensor, bool on) |
10349 |
+ BIT(1), on ? 0 : BIT(1)); |
10350 |
+ } |
10351 |
+ |
10352 |
+-static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on) |
10353 |
+-{ |
10354 |
+- int ret; |
10355 |
+- |
10356 |
+- ret = ov5640_write_reg(sensor, OV5640_REG_CCIR656_CTRL00, |
10357 |
+- on ? 0x1 : 0x00); |
10358 |
+- if (ret) |
10359 |
+- return ret; |
10360 |
+- |
10361 |
+- return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ? |
10362 |
+- OV5640_REG_SYS_CTRL0_SW_PWUP : |
10363 |
+- OV5640_REG_SYS_CTRL0_SW_PWDN); |
10364 |
+-} |
10365 |
+- |
10366 |
+ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on) |
10367 |
+ { |
10368 |
+ return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ? |
10369 |
+@@ -1994,13 +1980,13 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on) |
10370 |
+ static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on) |
10371 |
+ { |
10372 |
+ unsigned int flags = sensor->ep.bus.parallel.flags; |
10373 |
+- u8 pclk_pol = 0; |
10374 |
+- u8 hsync_pol = 0; |
10375 |
+- u8 vsync_pol = 0; |
10376 |
++ bool bt656 = sensor->ep.bus_type == V4L2_MBUS_BT656; |
10377 |
++ u8 polarities = 0; |
10378 |
+ int ret; |
10379 |
+ |
10380 |
+ if (!on) { |
10381 |
+ /* Reset settings to their default values. */ |
10382 |
++ ov5640_write_reg(sensor, OV5640_REG_CCIR656_CTRL00, 0x00); |
10383 |
+ ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x58); |
10384 |
+ ov5640_write_reg(sensor, OV5640_REG_POLARITY_CTRL00, 0x20); |
10385 |
+ ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE01, 0x00); |
10386 |
+@@ -2024,7 +2010,35 @@ static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on) |
10387 |
+ * - VSYNC: active high |
10388 |
+ * - HREF: active low |
10389 |
+ * - PCLK: active low |
10390 |
++ * |
10391 |
++ * VSYNC & HREF are not configured if BT656 bus mode is selected |
10392 |
+ */ |
10393 |
++ |
10394 |
++ /* |
10395 |
++ * BT656 embedded synchronization configuration |
10396 |
++ * |
10397 |
++ * CCIR656 CTRL00 |
10398 |
++ * - [7]: SYNC code selection (0: auto generate sync code, |
10399 |
++ * 1: sync code from regs 0x4732-0x4735) |
10400 |
++ * - [6]: f value in CCIR656 SYNC code when fixed f value |
10401 |
++ * - [5]: Fixed f value |
10402 |
++ * - [4:3]: Blank toggle data options (00: data=1'h040/1'h200, |
10403 |
++ * 01: data from regs 0x4736-0x4738, 10: always keep 0) |
10404 |
++ * - [1]: Clip data disable |
10405 |
++ * - [0]: CCIR656 mode enable |
10406 |
++ * |
10407 |
++ * Default CCIR656 SAV/EAV mode with default codes |
10408 |
++ * SAV=0xff000080 & EAV=0xff00009d is enabled here with settings: |
10409 |
++ * - CCIR656 mode enable |
10410 |
++ * - auto generation of sync codes |
10411 |
++ * - blank toggle data 1'h040/1'h200 |
10412 |
++ * - clip reserved data (0x00 & 0xff changed to 0x01 & 0xfe) |
10413 |
++ */ |
10414 |
++ ret = ov5640_write_reg(sensor, OV5640_REG_CCIR656_CTRL00, |
10415 |
++ bt656 ? 0x01 : 0x00); |
10416 |
++ if (ret) |
10417 |
++ return ret; |
10418 |
++ |
10419 |
+ /* |
10420 |
+ * configure parallel port control lines polarity |
10421 |
+ * |
10422 |
+@@ -2035,29 +2049,26 @@ static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on) |
10423 |
+ * datasheet and hardware, 0 is active high |
10424 |
+ * and 1 is active low...) |
10425 |
+ */ |
10426 |
+- if (sensor->ep.bus_type == V4L2_MBUS_PARALLEL) { |
10427 |
+- if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
10428 |
+- pclk_pol = 1; |
10429 |
++ if (!bt656) { |
10430 |
+ if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) |
10431 |
+- hsync_pol = 1; |
10432 |
++ polarities |= BIT(1); |
10433 |
+ if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) |
10434 |
+- vsync_pol = 1; |
10435 |
+- |
10436 |
+- ret = ov5640_write_reg(sensor, OV5640_REG_POLARITY_CTRL00, |
10437 |
+- (pclk_pol << 5) | (hsync_pol << 1) | |
10438 |
+- vsync_pol); |
10439 |
+- |
10440 |
+- if (ret) |
10441 |
+- return ret; |
10442 |
++ polarities |= BIT(0); |
10443 |
+ } |
10444 |
++ if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
10445 |
++ polarities |= BIT(5); |
10446 |
++ |
10447 |
++ ret = ov5640_write_reg(sensor, OV5640_REG_POLARITY_CTRL00, polarities); |
10448 |
++ if (ret) |
10449 |
++ return ret; |
10450 |
+ |
10451 |
+ /* |
10452 |
+- * powerdown MIPI TX/RX PHY & disable MIPI |
10453 |
++ * powerdown MIPI TX/RX PHY & enable DVP |
10454 |
+ * |
10455 |
+ * MIPI CONTROL 00 |
10456 |
+- * 4: PWDN PHY TX |
10457 |
+- * 3: PWDN PHY RX |
10458 |
+- * 2: MIPI enable |
10459 |
++ * [4] = 1 : Power down MIPI HS Tx |
10460 |
++ * [3] = 1 : Power down MIPI LS Rx |
10461 |
++ * [2] = 0 : DVP enable (MIPI disable) |
10462 |
+ */ |
10463 |
+ ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x18); |
10464 |
+ if (ret) |
10465 |
+@@ -2074,8 +2085,7 @@ static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on) |
10466 |
+ * - [3:0]: D[9:6] output enable |
10467 |
+ */ |
10468 |
+ ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE01, |
10469 |
+- sensor->ep.bus_type == V4L2_MBUS_PARALLEL ? |
10470 |
+- 0x7f : 0x1f); |
10471 |
++ bt656 ? 0x1f : 0x7f); |
10472 |
+ if (ret) |
10473 |
+ return ret; |
10474 |
+ |
10475 |
+@@ -2925,8 +2935,6 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) |
10476 |
+ |
10477 |
+ if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY) |
10478 |
+ ret = ov5640_set_stream_mipi(sensor, enable); |
10479 |
+- else if (sensor->ep.bus_type == V4L2_MBUS_BT656) |
10480 |
+- ret = ov5640_set_stream_bt656(sensor, enable); |
10481 |
+ else |
10482 |
+ ret = ov5640_set_stream_dvp(sensor, enable); |
10483 |
+ |
10484 |
+diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c |
10485 |
+index 1ed928c4ca70f..16bcb764b0e0d 100644 |
10486 |
+--- a/drivers/media/i2c/rdacm20.c |
10487 |
++++ b/drivers/media/i2c/rdacm20.c |
10488 |
+@@ -487,9 +487,18 @@ static int rdacm20_initialize(struct rdacm20_device *dev) |
10489 |
+ * Reset the sensor by cycling the OV10635 reset signal connected to the |
10490 |
+ * MAX9271 GPIO1 and verify communication with the OV10635. |
10491 |
+ */ |
10492 |
+- max9271_clear_gpios(dev->serializer, MAX9271_GPIO1OUT); |
10493 |
++ ret = max9271_enable_gpios(dev->serializer, MAX9271_GPIO1OUT); |
10494 |
++ if (ret) |
10495 |
++ return ret; |
10496 |
++ |
10497 |
++ ret = max9271_clear_gpios(dev->serializer, MAX9271_GPIO1OUT); |
10498 |
++ if (ret) |
10499 |
++ return ret; |
10500 |
+ usleep_range(10000, 15000); |
10501 |
+- max9271_set_gpios(dev->serializer, MAX9271_GPIO1OUT); |
10502 |
++ |
10503 |
++ ret = max9271_set_gpios(dev->serializer, MAX9271_GPIO1OUT); |
10504 |
++ if (ret) |
10505 |
++ return ret; |
10506 |
+ usleep_range(10000, 15000); |
10507 |
+ |
10508 |
+ again: |
10509 |
+diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c |
10510 |
+index 7d9401219a3ac..3b3221fd3fe8f 100644 |
10511 |
+--- a/drivers/media/i2c/tvp5150.c |
10512 |
++++ b/drivers/media/i2c/tvp5150.c |
10513 |
+@@ -2082,6 +2082,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) |
10514 |
+ |
10515 |
+ ep_np = of_graph_get_endpoint_by_regs(np, TVP5150_PAD_VID_OUT, 0); |
10516 |
+ if (!ep_np) { |
10517 |
++ ret = -EINVAL; |
10518 |
+ dev_err(dev, "Error no output endpoint available\n"); |
10519 |
+ goto err_free; |
10520 |
+ } |
10521 |
+diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c |
10522 |
+index 4e598e937dfe2..1fcd131482e0e 100644 |
10523 |
+--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c |
10524 |
++++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c |
10525 |
+@@ -791,6 +791,7 @@ static void cio2_vb2_return_all_buffers(struct cio2_queue *q, |
10526 |
+ atomic_dec(&q->bufs_queued); |
10527 |
+ vb2_buffer_done(&q->bufs[i]->vbb.vb2_buf, |
10528 |
+ state); |
10529 |
++ q->bufs[i] = NULL; |
10530 |
+ } |
10531 |
+ } |
10532 |
+ } |
10533 |
+@@ -1232,29 +1233,15 @@ static int cio2_subdev_get_fmt(struct v4l2_subdev *sd, |
10534 |
+ struct v4l2_subdev_format *fmt) |
10535 |
+ { |
10536 |
+ struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev); |
10537 |
+- struct v4l2_subdev_format format; |
10538 |
+- int ret; |
10539 |
+- |
10540 |
+- if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { |
10541 |
+- fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
10542 |
+- return 0; |
10543 |
+- } |
10544 |
+ |
10545 |
+- if (fmt->pad == CIO2_PAD_SINK) { |
10546 |
+- format.which = V4L2_SUBDEV_FORMAT_ACTIVE; |
10547 |
+- ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, |
10548 |
+- &format); |
10549 |
++ mutex_lock(&q->subdev_lock); |
10550 |
+ |
10551 |
+- if (ret) |
10552 |
+- return ret; |
10553 |
+- /* update colorspace etc */ |
10554 |
+- q->subdev_fmt.colorspace = format.format.colorspace; |
10555 |
+- q->subdev_fmt.ycbcr_enc = format.format.ycbcr_enc; |
10556 |
+- q->subdev_fmt.quantization = format.format.quantization; |
10557 |
+- q->subdev_fmt.xfer_func = format.format.xfer_func; |
10558 |
+- } |
10559 |
++ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) |
10560 |
++ fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
10561 |
++ else |
10562 |
++ fmt->format = q->subdev_fmt; |
10563 |
+ |
10564 |
+- fmt->format = q->subdev_fmt; |
10565 |
++ mutex_unlock(&q->subdev_lock); |
10566 |
+ |
10567 |
+ return 0; |
10568 |
+ } |
10569 |
+@@ -1271,6 +1258,9 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd, |
10570 |
+ struct v4l2_subdev_format *fmt) |
10571 |
+ { |
10572 |
+ struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev); |
10573 |
++ struct v4l2_mbus_framefmt *mbus; |
10574 |
++ u32 mbus_code = fmt->format.code; |
10575 |
++ unsigned int i; |
10576 |
+ |
10577 |
+ /* |
10578 |
+ * Only allow setting sink pad format; |
10579 |
+@@ -1279,16 +1269,29 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd, |
10580 |
+ if (fmt->pad == CIO2_PAD_SOURCE) |
10581 |
+ return cio2_subdev_get_fmt(sd, cfg, fmt); |
10582 |
+ |
10583 |
+- if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { |
10584 |
+- *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; |
10585 |
+- } else { |
10586 |
+- /* It's the sink, allow changing frame size */ |
10587 |
+- q->subdev_fmt.width = fmt->format.width; |
10588 |
+- q->subdev_fmt.height = fmt->format.height; |
10589 |
+- q->subdev_fmt.code = fmt->format.code; |
10590 |
+- fmt->format = q->subdev_fmt; |
10591 |
++ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) |
10592 |
++ mbus = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); |
10593 |
++ else |
10594 |
++ mbus = &q->subdev_fmt; |
10595 |
++ |
10596 |
++ fmt->format.code = formats[0].mbus_code; |
10597 |
++ |
10598 |
++ for (i = 0; i < ARRAY_SIZE(formats); i++) { |
10599 |
++ if (formats[i].mbus_code == fmt->format.code) { |
10600 |
++ fmt->format.code = mbus_code; |
10601 |
++ break; |
10602 |
++ } |
10603 |
+ } |
10604 |
+ |
10605 |
++ fmt->format.width = min_t(u32, fmt->format.width, CIO2_IMAGE_MAX_WIDTH); |
10606 |
++ fmt->format.height = min_t(u32, fmt->format.height, |
10607 |
++ CIO2_IMAGE_MAX_LENGTH); |
10608 |
++ fmt->format.field = V4L2_FIELD_NONE; |
10609 |
++ |
10610 |
++ mutex_lock(&q->subdev_lock); |
10611 |
++ *mbus = fmt->format; |
10612 |
++ mutex_unlock(&q->subdev_lock); |
10613 |
++ |
10614 |
+ return 0; |
10615 |
+ } |
10616 |
+ |
10617 |
+@@ -1547,6 +1550,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q) |
10618 |
+ |
10619 |
+ /* Initialize miscellaneous variables */ |
10620 |
+ mutex_init(&q->lock); |
10621 |
++ mutex_init(&q->subdev_lock); |
10622 |
+ |
10623 |
+ /* Initialize formats to default values */ |
10624 |
+ fmt = &q->subdev_fmt; |
10625 |
+@@ -1663,6 +1667,7 @@ fail_vdev_media_entity: |
10626 |
+ fail_subdev_media_entity: |
10627 |
+ cio2_fbpt_exit(q, &cio2->pci_dev->dev); |
10628 |
+ fail_fbpt: |
10629 |
++ mutex_destroy(&q->subdev_lock); |
10630 |
+ mutex_destroy(&q->lock); |
10631 |
+ |
10632 |
+ return r; |
10633 |
+@@ -1675,6 +1680,7 @@ static void cio2_queue_exit(struct cio2_device *cio2, struct cio2_queue *q) |
10634 |
+ v4l2_device_unregister_subdev(&q->subdev); |
10635 |
+ media_entity_cleanup(&q->subdev.entity); |
10636 |
+ cio2_fbpt_exit(q, &cio2->pci_dev->dev); |
10637 |
++ mutex_destroy(&q->subdev_lock); |
10638 |
+ mutex_destroy(&q->lock); |
10639 |
+ } |
10640 |
+ |
10641 |
+diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.h b/drivers/media/pci/intel/ipu3/ipu3-cio2.h |
10642 |
+index 549b08f88f0c7..146492383aa5b 100644 |
10643 |
+--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.h |
10644 |
++++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.h |
10645 |
+@@ -335,6 +335,7 @@ struct cio2_queue { |
10646 |
+ |
10647 |
+ /* Subdev, /dev/v4l-subdevX */ |
10648 |
+ struct v4l2_subdev subdev; |
10649 |
++ struct mutex subdev_lock; /* Serialise acces to subdev_fmt field */ |
10650 |
+ struct media_pad subdev_pads[CIO2_PADS]; |
10651 |
+ struct v4l2_mbus_framefmt subdev_fmt; |
10652 |
+ atomic_t frame_sequence; |
10653 |
+diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c |
10654 |
+index d4f12c250f91a..526042d8afae5 100644 |
10655 |
+--- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c |
10656 |
++++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c |
10657 |
+@@ -175,7 +175,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev) |
10658 |
+ struct spi_master *master; |
10659 |
+ struct netup_spi *nspi; |
10660 |
+ |
10661 |
+- master = spi_alloc_master(&ndev->pci_dev->dev, |
10662 |
++ master = devm_spi_alloc_master(&ndev->pci_dev->dev, |
10663 |
+ sizeof(struct netup_spi)); |
10664 |
+ if (!master) { |
10665 |
+ dev_err(&ndev->pci_dev->dev, |
10666 |
+@@ -208,6 +208,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev) |
10667 |
+ ndev->pci_slot, |
10668 |
+ ndev->pci_func); |
10669 |
+ if (!spi_new_device(master, &netup_spi_board)) { |
10670 |
++ spi_unregister_master(master); |
10671 |
+ ndev->spi = NULL; |
10672 |
+ dev_err(&ndev->pci_dev->dev, |
10673 |
+ "%s(): unable to create SPI device\n", __func__); |
10674 |
+@@ -226,13 +227,13 @@ void netup_spi_release(struct netup_unidvb_dev *ndev) |
10675 |
+ if (!spi) |
10676 |
+ return; |
10677 |
+ |
10678 |
++ spi_unregister_master(spi->master); |
10679 |
+ spin_lock_irqsave(&spi->lock, flags); |
10680 |
+ reg = readw(&spi->regs->control_stat); |
10681 |
+ writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat); |
10682 |
+ reg = readw(&spi->regs->control_stat); |
10683 |
+ writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat); |
10684 |
+ spin_unlock_irqrestore(&spi->lock, flags); |
10685 |
+- spi_unregister_master(spi->master); |
10686 |
+ ndev->spi = NULL; |
10687 |
+ } |
10688 |
+ |
10689 |
+diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c |
10690 |
+index 129a1f8ebe1ad..73fc901ecf3db 100644 |
10691 |
+--- a/drivers/media/pci/saa7146/mxb.c |
10692 |
++++ b/drivers/media/pci/saa7146/mxb.c |
10693 |
+@@ -641,16 +641,17 @@ static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio * |
10694 |
+ struct mxb *mxb = (struct mxb *)dev->ext_priv; |
10695 |
+ |
10696 |
+ DEB_D("VIDIOC_S_AUDIO %d\n", a->index); |
10697 |
+- if (mxb_inputs[mxb->cur_input].audioset & (1 << a->index)) { |
10698 |
+- if (mxb->cur_audinput != a->index) { |
10699 |
+- mxb->cur_audinput = a->index; |
10700 |
+- tea6420_route(mxb, a->index); |
10701 |
+- if (mxb->cur_audinput == 0) |
10702 |
+- mxb_update_audmode(mxb); |
10703 |
+- } |
10704 |
+- return 0; |
10705 |
++ if (a->index >= 32 || |
10706 |
++ !(mxb_inputs[mxb->cur_input].audioset & (1 << a->index))) |
10707 |
++ return -EINVAL; |
10708 |
++ |
10709 |
++ if (mxb->cur_audinput != a->index) { |
10710 |
++ mxb->cur_audinput = a->index; |
10711 |
++ tea6420_route(mxb, a->index); |
10712 |
++ if (mxb->cur_audinput == 0) |
10713 |
++ mxb_update_audmode(mxb); |
10714 |
+ } |
10715 |
+- return -EINVAL; |
10716 |
++ return 0; |
10717 |
+ } |
10718 |
+ |
10719 |
+ #ifdef CONFIG_VIDEO_ADV_DEBUG |
10720 |
+diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c |
10721 |
+index 906ce86437ae3..d137b94869d82 100644 |
10722 |
+--- a/drivers/media/pci/solo6x10/solo6x10-g723.c |
10723 |
++++ b/drivers/media/pci/solo6x10/solo6x10-g723.c |
10724 |
+@@ -385,7 +385,7 @@ int solo_g723_init(struct solo_dev *solo_dev) |
10725 |
+ |
10726 |
+ ret = snd_ctl_add(card, snd_ctl_new1(&kctl, solo_dev)); |
10727 |
+ if (ret < 0) |
10728 |
+- return ret; |
10729 |
++ goto snd_error; |
10730 |
+ |
10731 |
+ ret = solo_snd_pcm_init(solo_dev); |
10732 |
+ if (ret < 0) |
10733 |
+diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c |
10734 |
+index 227245ccaedc7..88a23bce569d9 100644 |
10735 |
+--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c |
10736 |
++++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c |
10737 |
+@@ -1306,6 +1306,7 @@ static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg) |
10738 |
+ jpeg->variant->clks); |
10739 |
+ if (ret) { |
10740 |
+ dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret); |
10741 |
++ put_device(&pdev->dev); |
10742 |
+ return ret; |
10743 |
+ } |
10744 |
+ |
10745 |
+@@ -1331,6 +1332,12 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work) |
10746 |
+ v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); |
10747 |
+ v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); |
10748 |
+ } |
10749 |
++ |
10750 |
++static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg) |
10751 |
++{ |
10752 |
++ put_device(jpeg->larb); |
10753 |
++} |
10754 |
++ |
10755 |
+ static int mtk_jpeg_probe(struct platform_device *pdev) |
10756 |
+ { |
10757 |
+ struct mtk_jpeg_dev *jpeg; |
10758 |
+@@ -1435,6 +1442,7 @@ err_m2m_init: |
10759 |
+ v4l2_device_unregister(&jpeg->v4l2_dev); |
10760 |
+ |
10761 |
+ err_dev_register: |
10762 |
++ mtk_jpeg_clk_release(jpeg); |
10763 |
+ |
10764 |
+ err_clk_init: |
10765 |
+ |
10766 |
+@@ -1452,6 +1460,7 @@ static int mtk_jpeg_remove(struct platform_device *pdev) |
10767 |
+ video_device_release(jpeg->vdev); |
10768 |
+ v4l2_m2m_release(jpeg->m2m_dev); |
10769 |
+ v4l2_device_unregister(&jpeg->v4l2_dev); |
10770 |
++ mtk_jpeg_clk_release(jpeg); |
10771 |
+ |
10772 |
+ return 0; |
10773 |
+ } |
10774 |
+diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
10775 |
+index 36dfe3fc056a4..ddee7046ce422 100644 |
10776 |
+--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
10777 |
++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c |
10778 |
+@@ -47,11 +47,14 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev) |
10779 |
+ dec_clk->clk_info = devm_kcalloc(&pdev->dev, |
10780 |
+ dec_clk->clk_num, sizeof(*clk_info), |
10781 |
+ GFP_KERNEL); |
10782 |
+- if (!dec_clk->clk_info) |
10783 |
+- return -ENOMEM; |
10784 |
++ if (!dec_clk->clk_info) { |
10785 |
++ ret = -ENOMEM; |
10786 |
++ goto put_device; |
10787 |
++ } |
10788 |
+ } else { |
10789 |
+ mtk_v4l2_err("Failed to get vdec clock count"); |
10790 |
+- return -EINVAL; |
10791 |
++ ret = -EINVAL; |
10792 |
++ goto put_device; |
10793 |
+ } |
10794 |
+ |
10795 |
+ for (i = 0; i < dec_clk->clk_num; i++) { |
10796 |
+@@ -60,25 +63,29 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev) |
10797 |
+ "clock-names", i, &clk_info->clk_name); |
10798 |
+ if (ret) { |
10799 |
+ mtk_v4l2_err("Failed to get clock name id = %d", i); |
10800 |
+- return ret; |
10801 |
++ goto put_device; |
10802 |
+ } |
10803 |
+ clk_info->vcodec_clk = devm_clk_get(&pdev->dev, |
10804 |
+ clk_info->clk_name); |
10805 |
+ if (IS_ERR(clk_info->vcodec_clk)) { |
10806 |
+ mtk_v4l2_err("devm_clk_get (%d)%s fail", i, |
10807 |
+ clk_info->clk_name); |
10808 |
+- return PTR_ERR(clk_info->vcodec_clk); |
10809 |
++ ret = PTR_ERR(clk_info->vcodec_clk); |
10810 |
++ goto put_device; |
10811 |
+ } |
10812 |
+ } |
10813 |
+ |
10814 |
+ pm_runtime_enable(&pdev->dev); |
10815 |
+- |
10816 |
++ return 0; |
10817 |
++put_device: |
10818 |
++ put_device(pm->larbvdec); |
10819 |
+ return ret; |
10820 |
+ } |
10821 |
+ |
10822 |
+ void mtk_vcodec_release_dec_pm(struct mtk_vcodec_dev *dev) |
10823 |
+ { |
10824 |
+ pm_runtime_disable(dev->pm.dev); |
10825 |
++ put_device(dev->pm.larbvdec); |
10826 |
+ } |
10827 |
+ |
10828 |
+ void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) |
10829 |
+diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
10830 |
+index ee22902aaa71c..1a047c25679fa 100644 |
10831 |
+--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
10832 |
++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c |
10833 |
+@@ -47,14 +47,16 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
10834 |
+ node = of_parse_phandle(dev->of_node, "mediatek,larb", 1); |
10835 |
+ if (!node) { |
10836 |
+ mtk_v4l2_err("no mediatek,larb found"); |
10837 |
+- return -ENODEV; |
10838 |
++ ret = -ENODEV; |
10839 |
++ goto put_larbvenc; |
10840 |
+ } |
10841 |
+ |
10842 |
+ pdev = of_find_device_by_node(node); |
10843 |
+ of_node_put(node); |
10844 |
+ if (!pdev) { |
10845 |
+ mtk_v4l2_err("no mediatek,larb device found"); |
10846 |
+- return -ENODEV; |
10847 |
++ ret = -ENODEV; |
10848 |
++ goto put_larbvenc; |
10849 |
+ } |
10850 |
+ |
10851 |
+ pm->larbvenclt = &pdev->dev; |
10852 |
+@@ -67,11 +69,14 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
10853 |
+ enc_clk->clk_info = devm_kcalloc(&pdev->dev, |
10854 |
+ enc_clk->clk_num, sizeof(*clk_info), |
10855 |
+ GFP_KERNEL); |
10856 |
+- if (!enc_clk->clk_info) |
10857 |
+- return -ENOMEM; |
10858 |
++ if (!enc_clk->clk_info) { |
10859 |
++ ret = -ENOMEM; |
10860 |
++ goto put_larbvenclt; |
10861 |
++ } |
10862 |
+ } else { |
10863 |
+ mtk_v4l2_err("Failed to get venc clock count"); |
10864 |
+- return -EINVAL; |
10865 |
++ ret = -EINVAL; |
10866 |
++ goto put_larbvenclt; |
10867 |
+ } |
10868 |
+ |
10869 |
+ for (i = 0; i < enc_clk->clk_num; i++) { |
10870 |
+@@ -80,17 +85,24 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) |
10871 |
+ "clock-names", i, &clk_info->clk_name); |
10872 |
+ if (ret) { |
10873 |
+ mtk_v4l2_err("venc failed to get clk name %d", i); |
10874 |
+- return ret; |
10875 |
++ goto put_larbvenclt; |
10876 |
+ } |
10877 |
+ clk_info->vcodec_clk = devm_clk_get(&pdev->dev, |
10878 |
+ clk_info->clk_name); |
10879 |
+ if (IS_ERR(clk_info->vcodec_clk)) { |
10880 |
+ mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i, |
10881 |
+ clk_info->clk_name); |
10882 |
+- return PTR_ERR(clk_info->vcodec_clk); |
10883 |
++ ret = PTR_ERR(clk_info->vcodec_clk); |
10884 |
++ goto put_larbvenclt; |
10885 |
+ } |
10886 |
+ } |
10887 |
+ |
10888 |
++ return 0; |
10889 |
++ |
10890 |
++put_larbvenclt: |
10891 |
++ put_device(pm->larbvenclt); |
10892 |
++put_larbvenc: |
10893 |
++ put_device(pm->larbvenc); |
10894 |
+ return ret; |
10895 |
+ } |
10896 |
+ |
10897 |
+diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c |
10898 |
+index 6103aaf43987b..d5bfd6fff85b4 100644 |
10899 |
+--- a/drivers/media/platform/qcom/venus/core.c |
10900 |
++++ b/drivers/media/platform/qcom/venus/core.c |
10901 |
+@@ -355,12 +355,26 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) |
10902 |
+ if (ret) |
10903 |
+ return ret; |
10904 |
+ |
10905 |
++ if (pm_ops->core_power) { |
10906 |
++ ret = pm_ops->core_power(dev, POWER_OFF); |
10907 |
++ if (ret) |
10908 |
++ return ret; |
10909 |
++ } |
10910 |
++ |
10911 |
+ ret = icc_set_bw(core->cpucfg_path, 0, 0); |
10912 |
+ if (ret) |
10913 |
+- return ret; |
10914 |
++ goto err_cpucfg_path; |
10915 |
+ |
10916 |
+- if (pm_ops->core_power) |
10917 |
+- ret = pm_ops->core_power(dev, POWER_OFF); |
10918 |
++ ret = icc_set_bw(core->video_path, 0, 0); |
10919 |
++ if (ret) |
10920 |
++ goto err_video_path; |
10921 |
++ |
10922 |
++ return ret; |
10923 |
++ |
10924 |
++err_video_path: |
10925 |
++ icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); |
10926 |
++err_cpucfg_path: |
10927 |
++ pm_ops->core_power(dev, POWER_ON); |
10928 |
+ |
10929 |
+ return ret; |
10930 |
+ } |
10931 |
+@@ -371,16 +385,20 @@ static __maybe_unused int venus_runtime_resume(struct device *dev) |
10932 |
+ const struct venus_pm_ops *pm_ops = core->pm_ops; |
10933 |
+ int ret; |
10934 |
+ |
10935 |
++ ret = icc_set_bw(core->video_path, kbps_to_icc(20000), 0); |
10936 |
++ if (ret) |
10937 |
++ return ret; |
10938 |
++ |
10939 |
++ ret = icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); |
10940 |
++ if (ret) |
10941 |
++ return ret; |
10942 |
++ |
10943 |
+ if (pm_ops->core_power) { |
10944 |
+ ret = pm_ops->core_power(dev, POWER_ON); |
10945 |
+ if (ret) |
10946 |
+ return ret; |
10947 |
+ } |
10948 |
+ |
10949 |
+- ret = icc_set_bw(core->cpucfg_path, 0, kbps_to_icc(1000)); |
10950 |
+- if (ret) |
10951 |
+- return ret; |
10952 |
+- |
10953 |
+ return hfi_core_resume(core, false); |
10954 |
+ } |
10955 |
+ |
10956 |
+diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c |
10957 |
+index a9538c2cc3c9d..2946547a0df4a 100644 |
10958 |
+--- a/drivers/media/platform/qcom/venus/pm_helpers.c |
10959 |
++++ b/drivers/media/platform/qcom/venus/pm_helpers.c |
10960 |
+@@ -212,6 +212,16 @@ static int load_scale_bw(struct venus_core *core) |
10961 |
+ } |
10962 |
+ mutex_unlock(&core->lock); |
10963 |
+ |
10964 |
++ /* |
10965 |
++ * keep minimum bandwidth vote for "video-mem" path, |
10966 |
++ * so that clks can be disabled during vdec_session_release(). |
10967 |
++ * Actual bandwidth drop will be done during device supend |
10968 |
++ * so that device can power down without any warnings. |
10969 |
++ */ |
10970 |
++ |
10971 |
++ if (!total_avg && !total_peak) |
10972 |
++ total_avg = kbps_to_icc(1000); |
10973 |
++ |
10974 |
+ dev_dbg(core->dev, VDBGL "total: avg_bw: %u, peak_bw: %u\n", |
10975 |
+ total_avg, total_peak); |
10976 |
+ |
10977 |
+diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c |
10978 |
+index ddee6ee37bab1..4afc5895bee74 100644 |
10979 |
+--- a/drivers/media/rc/sunxi-cir.c |
10980 |
++++ b/drivers/media/rc/sunxi-cir.c |
10981 |
+@@ -137,6 +137,8 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id) |
10982 |
+ } else if (status & REG_RXSTA_RPE) { |
10983 |
+ ir_raw_event_set_idle(ir->rc, true); |
10984 |
+ ir_raw_event_handle(ir->rc); |
10985 |
++ } else { |
10986 |
++ ir_raw_event_handle(ir->rc); |
10987 |
+ } |
10988 |
+ |
10989 |
+ spin_unlock(&ir->ir_lock); |
10990 |
+diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c |
10991 |
+index c295f642d352c..158c8e28ed2cc 100644 |
10992 |
+--- a/drivers/media/usb/gspca/gspca.c |
10993 |
++++ b/drivers/media/usb/gspca/gspca.c |
10994 |
+@@ -1575,6 +1575,7 @@ out: |
10995 |
+ input_unregister_device(gspca_dev->input_dev); |
10996 |
+ #endif |
10997 |
+ v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler); |
10998 |
++ v4l2_device_unregister(&gspca_dev->v4l2_dev); |
10999 |
+ kfree(gspca_dev->usb_buf); |
11000 |
+ kfree(gspca_dev); |
11001 |
+ return ret; |
11002 |
+diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c |
11003 |
+index bfba06ea60e9d..2df736c029d6e 100644 |
11004 |
+--- a/drivers/media/usb/tm6000/tm6000-video.c |
11005 |
++++ b/drivers/media/usb/tm6000/tm6000-video.c |
11006 |
+@@ -461,11 +461,12 @@ static int tm6000_alloc_urb_buffers(struct tm6000_core *dev) |
11007 |
+ if (dev->urb_buffer) |
11008 |
+ return 0; |
11009 |
+ |
11010 |
+- dev->urb_buffer = kmalloc_array(num_bufs, sizeof(void *), GFP_KERNEL); |
11011 |
++ dev->urb_buffer = kmalloc_array(num_bufs, sizeof(*dev->urb_buffer), |
11012 |
++ GFP_KERNEL); |
11013 |
+ if (!dev->urb_buffer) |
11014 |
+ return -ENOMEM; |
11015 |
+ |
11016 |
+- dev->urb_dma = kmalloc_array(num_bufs, sizeof(dma_addr_t *), |
11017 |
++ dev->urb_dma = kmalloc_array(num_bufs, sizeof(*dev->urb_dma), |
11018 |
+ GFP_KERNEL); |
11019 |
+ if (!dev->urb_dma) |
11020 |
+ return -ENOMEM; |
11021 |
+diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c |
11022 |
+index d7bbe33840cb4..dfc53d11053fc 100644 |
11023 |
+--- a/drivers/media/v4l2-core/v4l2-fwnode.c |
11024 |
++++ b/drivers/media/v4l2-core/v4l2-fwnode.c |
11025 |
+@@ -93,7 +93,7 @@ v4l2_fwnode_bus_type_to_mbus(enum v4l2_fwnode_bus_type type) |
11026 |
+ const struct v4l2_fwnode_bus_conv *conv = |
11027 |
+ get_v4l2_fwnode_bus_conv_by_fwnode_bus(type); |
11028 |
+ |
11029 |
+- return conv ? conv->mbus_type : V4L2_MBUS_UNKNOWN; |
11030 |
++ return conv ? conv->mbus_type : V4L2_MBUS_INVALID; |
11031 |
+ } |
11032 |
+ |
11033 |
+ static const char * |
11034 |
+@@ -436,6 +436,10 @@ static int __v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode, |
11035 |
+ v4l2_fwnode_mbus_type_to_string(vep->bus_type), |
11036 |
+ vep->bus_type); |
11037 |
+ mbus_type = v4l2_fwnode_bus_type_to_mbus(bus_type); |
11038 |
++ if (mbus_type == V4L2_MBUS_INVALID) { |
11039 |
++ pr_debug("unsupported bus type %u\n", bus_type); |
11040 |
++ return -EINVAL; |
11041 |
++ } |
11042 |
+ |
11043 |
+ if (vep->bus_type != V4L2_MBUS_UNKNOWN) { |
11044 |
+ if (mbus_type != V4L2_MBUS_UNKNOWN && |
11045 |
+diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig |
11046 |
+index 00e013b14703e..cc2c83e1accfb 100644 |
11047 |
+--- a/drivers/memory/Kconfig |
11048 |
++++ b/drivers/memory/Kconfig |
11049 |
+@@ -128,7 +128,7 @@ config OMAP_GPMC_DEBUG |
11050 |
+ |
11051 |
+ config TI_EMIF_SRAM |
11052 |
+ tristate "Texas Instruments EMIF SRAM driver" |
11053 |
+- depends on SOC_AM33XX || SOC_AM43XX || (ARM && COMPILE_TEST) |
11054 |
++ depends on SOC_AM33XX || SOC_AM43XX || (ARM && CPU_V7 && COMPILE_TEST) |
11055 |
+ depends on SRAM |
11056 |
+ help |
11057 |
+ This driver is for the EMIF module available on Texas Instruments |
11058 |
+diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c |
11059 |
+index 3ec5cb0fce1ee..555f7ac3b7dd9 100644 |
11060 |
+--- a/drivers/memory/jz4780-nemc.c |
11061 |
++++ b/drivers/memory/jz4780-nemc.c |
11062 |
+@@ -291,6 +291,8 @@ static int jz4780_nemc_probe(struct platform_device *pdev) |
11063 |
+ nemc->dev = dev; |
11064 |
+ |
11065 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
11066 |
++ if (!res) |
11067 |
++ return -EINVAL; |
11068 |
+ |
11069 |
+ /* |
11070 |
+ * The driver currently only uses the registers up to offset |
11071 |
+@@ -304,9 +306,9 @@ static int jz4780_nemc_probe(struct platform_device *pdev) |
11072 |
+ } |
11073 |
+ |
11074 |
+ nemc->base = devm_ioremap(dev, res->start, NEMC_REG_LEN); |
11075 |
+- if (IS_ERR(nemc->base)) { |
11076 |
++ if (!nemc->base) { |
11077 |
+ dev_err(dev, "failed to get I/O memory\n"); |
11078 |
+- return PTR_ERR(nemc->base); |
11079 |
++ return -ENOMEM; |
11080 |
+ } |
11081 |
+ |
11082 |
+ writel(0, nemc->base + NEMC_NFCSR); |
11083 |
+diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c |
11084 |
+index f2a33a1af8361..da0fdb4c75959 100644 |
11085 |
+--- a/drivers/memory/renesas-rpc-if.c |
11086 |
++++ b/drivers/memory/renesas-rpc-if.c |
11087 |
+@@ -212,7 +212,7 @@ EXPORT_SYMBOL(rpcif_enable_rpm); |
11088 |
+ |
11089 |
+ void rpcif_disable_rpm(struct rpcif *rpc) |
11090 |
+ { |
11091 |
+- pm_runtime_put_sync(rpc->dev); |
11092 |
++ pm_runtime_disable(rpc->dev); |
11093 |
+ } |
11094 |
+ EXPORT_SYMBOL(rpcif_disable_rpm); |
11095 |
+ |
11096 |
+@@ -508,7 +508,8 @@ exit: |
11097 |
+ return ret; |
11098 |
+ |
11099 |
+ err_out: |
11100 |
+- ret = reset_control_reset(rpc->rstc); |
11101 |
++ if (reset_control_reset(rpc->rstc)) |
11102 |
++ dev_err(rpc->dev, "Failed to reset HW\n"); |
11103 |
+ rpcif_hw_init(rpc, rpc->bus_size == 2); |
11104 |
+ goto exit; |
11105 |
+ } |
11106 |
+@@ -560,9 +561,11 @@ static int rpcif_probe(struct platform_device *pdev) |
11107 |
+ } else if (of_device_is_compatible(flash, "cfi-flash")) { |
11108 |
+ name = "rpc-if-hyperflash"; |
11109 |
+ } else { |
11110 |
++ of_node_put(flash); |
11111 |
+ dev_warn(&pdev->dev, "unknown flash type\n"); |
11112 |
+ return -ENODEV; |
11113 |
+ } |
11114 |
++ of_node_put(flash); |
11115 |
+ |
11116 |
+ vdev = platform_device_alloc(name, pdev->id); |
11117 |
+ if (!vdev) |
11118 |
+diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c |
11119 |
+index ef03d6fafc5ce..12bc3f5a6cbbd 100644 |
11120 |
+--- a/drivers/memstick/core/memstick.c |
11121 |
++++ b/drivers/memstick/core/memstick.c |
11122 |
+@@ -468,7 +468,6 @@ static void memstick_check(struct work_struct *work) |
11123 |
+ host->card = card; |
11124 |
+ if (device_register(&card->dev)) { |
11125 |
+ put_device(&card->dev); |
11126 |
+- kfree(host->card); |
11127 |
+ host->card = NULL; |
11128 |
+ } |
11129 |
+ } else |
11130 |
+diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c |
11131 |
+index dd3a1f3dcc191..d2ef46337191c 100644 |
11132 |
+--- a/drivers/memstick/host/r592.c |
11133 |
++++ b/drivers/memstick/host/r592.c |
11134 |
+@@ -759,8 +759,10 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
11135 |
+ goto error3; |
11136 |
+ |
11137 |
+ dev->mmio = pci_ioremap_bar(pdev, 0); |
11138 |
+- if (!dev->mmio) |
11139 |
++ if (!dev->mmio) { |
11140 |
++ error = -ENOMEM; |
11141 |
+ goto error4; |
11142 |
++ } |
11143 |
+ |
11144 |
+ dev->irq = pdev->irq; |
11145 |
+ spin_lock_init(&dev->irq_lock); |
11146 |
+@@ -786,12 +788,14 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
11147 |
+ &dev->dummy_dma_page_physical_address, GFP_KERNEL); |
11148 |
+ r592_stop_dma(dev , 0); |
11149 |
+ |
11150 |
+- if (request_irq(dev->irq, &r592_irq, IRQF_SHARED, |
11151 |
+- DRV_NAME, dev)) |
11152 |
++ error = request_irq(dev->irq, &r592_irq, IRQF_SHARED, |
11153 |
++ DRV_NAME, dev); |
11154 |
++ if (error) |
11155 |
+ goto error6; |
11156 |
+ |
11157 |
+ r592_update_card_detect(dev); |
11158 |
+- if (memstick_add_host(host)) |
11159 |
++ error = memstick_add_host(host); |
11160 |
++ if (error) |
11161 |
+ goto error7; |
11162 |
+ |
11163 |
+ message("driver successfully loaded"); |
11164 |
+diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig |
11165 |
+index 8b99a13669bfc..4789507f325b8 100644 |
11166 |
+--- a/drivers/mfd/Kconfig |
11167 |
++++ b/drivers/mfd/Kconfig |
11168 |
+@@ -1189,6 +1189,7 @@ config MFD_SIMPLE_MFD_I2C |
11169 |
+ config MFD_SL28CPLD |
11170 |
+ tristate "Kontron sl28cpld Board Management Controller" |
11171 |
+ depends on I2C |
11172 |
++ depends on ARCH_LAYERSCAPE || COMPILE_TEST |
11173 |
+ select MFD_SIMPLE_MFD_I2C |
11174 |
+ help |
11175 |
+ Say yes here to enable support for the Kontron sl28cpld board |
11176 |
+diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c |
11177 |
+index 247f9849e54ae..417b0355d904d 100644 |
11178 |
+--- a/drivers/mfd/htc-i2cpld.c |
11179 |
++++ b/drivers/mfd/htc-i2cpld.c |
11180 |
+@@ -346,6 +346,7 @@ static int htcpld_register_chip_i2c( |
11181 |
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { |
11182 |
+ dev_warn(dev, "i2c adapter %d non-functional\n", |
11183 |
+ pdata->i2c_adapter_id); |
11184 |
++ i2c_put_adapter(adapter); |
11185 |
+ return -EINVAL; |
11186 |
+ } |
11187 |
+ |
11188 |
+@@ -360,6 +361,7 @@ static int htcpld_register_chip_i2c( |
11189 |
+ /* I2C device registration failed, contineu with the next */ |
11190 |
+ dev_warn(dev, "Unable to add I2C device for 0x%x\n", |
11191 |
+ plat_chip_data->addr); |
11192 |
++ i2c_put_adapter(adapter); |
11193 |
+ return PTR_ERR(client); |
11194 |
+ } |
11195 |
+ |
11196 |
+diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c |
11197 |
+index 2283d88adcc25..30d82bfe5b02f 100644 |
11198 |
+--- a/drivers/mfd/motorola-cpcap.c |
11199 |
++++ b/drivers/mfd/motorola-cpcap.c |
11200 |
+@@ -97,7 +97,7 @@ static struct regmap_irq_chip cpcap_irq_chip[CPCAP_NR_IRQ_CHIPS] = { |
11201 |
+ .ack_base = CPCAP_REG_MI1, |
11202 |
+ .mask_base = CPCAP_REG_MIM1, |
11203 |
+ .use_ack = true, |
11204 |
+- .ack_invert = true, |
11205 |
++ .clear_ack = true, |
11206 |
+ }, |
11207 |
+ { |
11208 |
+ .name = "cpcap-m2", |
11209 |
+@@ -106,7 +106,7 @@ static struct regmap_irq_chip cpcap_irq_chip[CPCAP_NR_IRQ_CHIPS] = { |
11210 |
+ .ack_base = CPCAP_REG_MI2, |
11211 |
+ .mask_base = CPCAP_REG_MIM2, |
11212 |
+ .use_ack = true, |
11213 |
+- .ack_invert = true, |
11214 |
++ .clear_ack = true, |
11215 |
+ }, |
11216 |
+ { |
11217 |
+ .name = "cpcap1-4", |
11218 |
+@@ -115,7 +115,7 @@ static struct regmap_irq_chip cpcap_irq_chip[CPCAP_NR_IRQ_CHIPS] = { |
11219 |
+ .ack_base = CPCAP_REG_INT1, |
11220 |
+ .mask_base = CPCAP_REG_INTM1, |
11221 |
+ .use_ack = true, |
11222 |
+- .ack_invert = true, |
11223 |
++ .clear_ack = true, |
11224 |
+ }, |
11225 |
+ }; |
11226 |
+ |
11227 |
+diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c |
11228 |
+index 5e680bfdf5c90..988e2ba6dd0f3 100644 |
11229 |
+--- a/drivers/mfd/stmfx.c |
11230 |
++++ b/drivers/mfd/stmfx.c |
11231 |
+@@ -329,11 +329,11 @@ static int stmfx_chip_init(struct i2c_client *client) |
11232 |
+ |
11233 |
+ stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd"); |
11234 |
+ ret = PTR_ERR_OR_ZERO(stmfx->vdd); |
11235 |
+- if (ret == -ENODEV) { |
11236 |
+- stmfx->vdd = NULL; |
11237 |
+- } else { |
11238 |
+- return dev_err_probe(&client->dev, ret, |
11239 |
+- "Failed to get VDD regulator\n"); |
11240 |
++ if (ret) { |
11241 |
++ if (ret == -ENODEV) |
11242 |
++ stmfx->vdd = NULL; |
11243 |
++ else |
11244 |
++ return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n"); |
11245 |
+ } |
11246 |
+ |
11247 |
+ if (stmfx->vdd) { |
11248 |
+diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c |
11249 |
+index 146ca6fb3260f..d3844730eacaf 100644 |
11250 |
+--- a/drivers/misc/pci_endpoint_test.c |
11251 |
++++ b/drivers/misc/pci_endpoint_test.c |
11252 |
+@@ -811,8 +811,10 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, |
11253 |
+ |
11254 |
+ pci_set_master(pdev); |
11255 |
+ |
11256 |
+- if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type)) |
11257 |
++ if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type)) { |
11258 |
++ err = -EINVAL; |
11259 |
+ goto err_disable_irq; |
11260 |
++ } |
11261 |
+ |
11262 |
+ for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { |
11263 |
+ if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) { |
11264 |
+@@ -849,8 +851,10 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, |
11265 |
+ goto err_ida_remove; |
11266 |
+ } |
11267 |
+ |
11268 |
+- if (!pci_endpoint_test_request_irq(test)) |
11269 |
++ if (!pci_endpoint_test_request_irq(test)) { |
11270 |
++ err = -EINVAL; |
11271 |
+ goto err_kfree_test_name; |
11272 |
++ } |
11273 |
+ |
11274 |
+ misc_device = &test->miscdev; |
11275 |
+ misc_device->minor = MISC_DYNAMIC_MINOR; |
11276 |
+diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c |
11277 |
+index 29f6180a00363..316393c694d7a 100644 |
11278 |
+--- a/drivers/mmc/host/pxamci.c |
11279 |
++++ b/drivers/mmc/host/pxamci.c |
11280 |
+@@ -731,6 +731,7 @@ static int pxamci_probe(struct platform_device *pdev) |
11281 |
+ |
11282 |
+ host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); |
11283 |
+ if (IS_ERR(host->power)) { |
11284 |
++ ret = PTR_ERR(host->power); |
11285 |
+ dev_err(dev, "Failed requesting gpio_power\n"); |
11286 |
+ goto out; |
11287 |
+ } |
11288 |
+diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c |
11289 |
+index ed12aacb1c736..41d193fa77bbf 100644 |
11290 |
+--- a/drivers/mmc/host/sdhci-tegra.c |
11291 |
++++ b/drivers/mmc/host/sdhci-tegra.c |
11292 |
+@@ -1272,7 +1272,7 @@ static void tegra_sdhci_set_timeout(struct sdhci_host *host, |
11293 |
+ * busy wait mode. |
11294 |
+ */ |
11295 |
+ val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL); |
11296 |
+- if (cmd && cmd->busy_timeout >= 11 * HZ) |
11297 |
++ if (cmd && cmd->busy_timeout >= 11 * MSEC_PER_SEC) |
11298 |
+ val |= SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT; |
11299 |
+ else |
11300 |
+ val &= ~SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT; |
11301 |
+diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c |
11302 |
+index e9e163ae9d863..b07cbb0661fb1 100644 |
11303 |
+--- a/drivers/mtd/mtdcore.c |
11304 |
++++ b/drivers/mtd/mtdcore.c |
11305 |
+@@ -993,6 +993,8 @@ int __get_mtd_device(struct mtd_info *mtd) |
11306 |
+ } |
11307 |
+ } |
11308 |
+ |
11309 |
++ master->usecount++; |
11310 |
++ |
11311 |
+ while (mtd->parent) { |
11312 |
+ mtd->usecount++; |
11313 |
+ mtd = mtd->parent; |
11314 |
+@@ -1059,6 +1061,8 @@ void __put_mtd_device(struct mtd_info *mtd) |
11315 |
+ mtd = mtd->parent; |
11316 |
+ } |
11317 |
+ |
11318 |
++ master->usecount--; |
11319 |
++ |
11320 |
+ if (master->_put_device) |
11321 |
+ master->_put_device(master); |
11322 |
+ |
11323 |
+diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
11324 |
+index dc8104e675062..81028ba35f35d 100644 |
11325 |
+--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
11326 |
++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
11327 |
+@@ -149,8 +149,10 @@ static int gpmi_init(struct gpmi_nand_data *this) |
11328 |
+ int ret; |
11329 |
+ |
11330 |
+ ret = pm_runtime_get_sync(this->dev); |
11331 |
+- if (ret < 0) |
11332 |
++ if (ret < 0) { |
11333 |
++ pm_runtime_put_noidle(this->dev); |
11334 |
+ return ret; |
11335 |
++ } |
11336 |
+ |
11337 |
+ ret = gpmi_reset_block(r->gpmi_regs, false); |
11338 |
+ if (ret) |
11339 |
+@@ -2252,7 +2254,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
11340 |
+ void *buf_read = NULL; |
11341 |
+ const void *buf_write = NULL; |
11342 |
+ bool direct = false; |
11343 |
+- struct completion *completion; |
11344 |
++ struct completion *dma_completion, *bch_completion; |
11345 |
+ unsigned long to; |
11346 |
+ |
11347 |
+ if (check_only) |
11348 |
+@@ -2263,8 +2265,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
11349 |
+ this->transfers[i].direction = DMA_NONE; |
11350 |
+ |
11351 |
+ ret = pm_runtime_get_sync(this->dev); |
11352 |
+- if (ret < 0) |
11353 |
++ if (ret < 0) { |
11354 |
++ pm_runtime_put_noidle(this->dev); |
11355 |
+ return ret; |
11356 |
++ } |
11357 |
+ |
11358 |
+ /* |
11359 |
+ * This driver currently supports only one NAND chip. Plus, dies share |
11360 |
+@@ -2347,22 +2351,24 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
11361 |
+ this->resources.bch_regs + HW_BCH_FLASH0LAYOUT1); |
11362 |
+ } |
11363 |
+ |
11364 |
++ desc->callback = dma_irq_callback; |
11365 |
++ desc->callback_param = this; |
11366 |
++ dma_completion = &this->dma_done; |
11367 |
++ bch_completion = NULL; |
11368 |
++ |
11369 |
++ init_completion(dma_completion); |
11370 |
++ |
11371 |
+ if (this->bch && buf_read) { |
11372 |
+ writel(BM_BCH_CTRL_COMPLETE_IRQ_EN, |
11373 |
+ this->resources.bch_regs + HW_BCH_CTRL_SET); |
11374 |
+- completion = &this->bch_done; |
11375 |
+- } else { |
11376 |
+- desc->callback = dma_irq_callback; |
11377 |
+- desc->callback_param = this; |
11378 |
+- completion = &this->dma_done; |
11379 |
++ bch_completion = &this->bch_done; |
11380 |
++ init_completion(bch_completion); |
11381 |
+ } |
11382 |
+ |
11383 |
+- init_completion(completion); |
11384 |
+- |
11385 |
+ dmaengine_submit(desc); |
11386 |
+ dma_async_issue_pending(get_dma_chan(this)); |
11387 |
+ |
11388 |
+- to = wait_for_completion_timeout(completion, msecs_to_jiffies(1000)); |
11389 |
++ to = wait_for_completion_timeout(dma_completion, msecs_to_jiffies(1000)); |
11390 |
+ if (!to) { |
11391 |
+ dev_err(this->dev, "DMA timeout, last DMA\n"); |
11392 |
+ gpmi_dump_info(this); |
11393 |
+@@ -2370,6 +2376,16 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
11394 |
+ goto unmap; |
11395 |
+ } |
11396 |
+ |
11397 |
++ if (this->bch && buf_read) { |
11398 |
++ to = wait_for_completion_timeout(bch_completion, msecs_to_jiffies(1000)); |
11399 |
++ if (!to) { |
11400 |
++ dev_err(this->dev, "BCH timeout, last DMA\n"); |
11401 |
++ gpmi_dump_info(this); |
11402 |
++ ret = -ETIMEDOUT; |
11403 |
++ goto unmap; |
11404 |
++ } |
11405 |
++ } |
11406 |
++ |
11407 |
+ writel(BM_BCH_CTRL_COMPLETE_IRQ_EN, |
11408 |
+ this->resources.bch_regs + HW_BCH_CTRL_CLR); |
11409 |
+ gpmi_clear_bch(this); |
11410 |
+diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c |
11411 |
+index 48e6dac96be6d..817bddccb775f 100644 |
11412 |
+--- a/drivers/mtd/nand/raw/meson_nand.c |
11413 |
++++ b/drivers/mtd/nand/raw/meson_nand.c |
11414 |
+@@ -510,7 +510,7 @@ static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, void *databuf, |
11415 |
+ } |
11416 |
+ |
11417 |
+ static void meson_nfc_dma_buffer_release(struct nand_chip *nand, |
11418 |
+- int infolen, int datalen, |
11419 |
++ int datalen, int infolen, |
11420 |
+ enum dma_data_direction dir) |
11421 |
+ { |
11422 |
+ struct meson_nfc *nfc = nand_get_controller_data(nand); |
11423 |
+@@ -1044,9 +1044,12 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc) |
11424 |
+ |
11425 |
+ ret = clk_set_rate(nfc->device_clk, 24000000); |
11426 |
+ if (ret) |
11427 |
+- goto err_phase_rx; |
11428 |
++ goto err_disable_rx; |
11429 |
+ |
11430 |
+ return 0; |
11431 |
++ |
11432 |
++err_disable_rx: |
11433 |
++ clk_disable_unprepare(nfc->phase_rx); |
11434 |
+ err_phase_rx: |
11435 |
+ clk_disable_unprepare(nfc->phase_tx); |
11436 |
+ err_phase_tx: |
11437 |
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
11438 |
+index 777fb0de06801..dfc17a28a06b9 100644 |
11439 |
+--- a/drivers/mtd/nand/raw/qcom_nandc.c |
11440 |
++++ b/drivers/mtd/nand/raw/qcom_nandc.c |
11441 |
+@@ -1570,6 +1570,8 @@ static int check_flash_errors(struct qcom_nand_host *host, int cw_cnt) |
11442 |
+ struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); |
11443 |
+ int i; |
11444 |
+ |
11445 |
++ nandc_read_buffer_sync(nandc, true); |
11446 |
++ |
11447 |
+ for (i = 0; i < cw_cnt; i++) { |
11448 |
+ u32 flash = le32_to_cpu(nandc->reg_read_buf[i]); |
11449 |
+ |
11450 |
+diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c |
11451 |
+index c352217946455..7900571fc85b3 100644 |
11452 |
+--- a/drivers/mtd/nand/spi/core.c |
11453 |
++++ b/drivers/mtd/nand/spi/core.c |
11454 |
+@@ -318,6 +318,10 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, |
11455 |
+ buf += ret; |
11456 |
+ } |
11457 |
+ |
11458 |
++ if (req->ooblen) |
11459 |
++ memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, |
11460 |
++ req->ooblen); |
11461 |
++ |
11462 |
+ return 0; |
11463 |
+ } |
11464 |
+ |
11465 |
+diff --git a/drivers/mtd/parsers/cmdlinepart.c b/drivers/mtd/parsers/cmdlinepart.c |
11466 |
+index a79e4d866b08a..0ddff1a4b51fb 100644 |
11467 |
+--- a/drivers/mtd/parsers/cmdlinepart.c |
11468 |
++++ b/drivers/mtd/parsers/cmdlinepart.c |
11469 |
+@@ -226,7 +226,7 @@ static int mtdpart_setup_real(char *s) |
11470 |
+ struct cmdline_mtd_partition *this_mtd; |
11471 |
+ struct mtd_partition *parts; |
11472 |
+ int mtd_id_len, num_parts; |
11473 |
+- char *p, *mtd_id, *semicol; |
11474 |
++ char *p, *mtd_id, *semicol, *open_parenth; |
11475 |
+ |
11476 |
+ /* |
11477 |
+ * Replace the first ';' by a NULL char so strrchr can work |
11478 |
+@@ -236,6 +236,14 @@ static int mtdpart_setup_real(char *s) |
11479 |
+ if (semicol) |
11480 |
+ *semicol = '\0'; |
11481 |
+ |
11482 |
++ /* |
11483 |
++ * make sure that part-names with ":" will not be handled as |
11484 |
++ * part of the mtd-id with an ":" |
11485 |
++ */ |
11486 |
++ open_parenth = strchr(s, '('); |
11487 |
++ if (open_parenth) |
11488 |
++ *open_parenth = '\0'; |
11489 |
++ |
11490 |
+ mtd_id = s; |
11491 |
+ |
11492 |
+ /* |
11493 |
+@@ -245,6 +253,10 @@ static int mtdpart_setup_real(char *s) |
11494 |
+ */ |
11495 |
+ p = strrchr(s, ':'); |
11496 |
+ |
11497 |
++ /* Restore the '(' now. */ |
11498 |
++ if (open_parenth) |
11499 |
++ *open_parenth = '('; |
11500 |
++ |
11501 |
+ /* Restore the ';' now. */ |
11502 |
+ if (semicol) |
11503 |
+ *semicol = ';'; |
11504 |
+diff --git a/drivers/mtd/spi-nor/atmel.c b/drivers/mtd/spi-nor/atmel.c |
11505 |
+index 3f5f21a473a69..deacf87a68a06 100644 |
11506 |
+--- a/drivers/mtd/spi-nor/atmel.c |
11507 |
++++ b/drivers/mtd/spi-nor/atmel.c |
11508 |
+@@ -8,39 +8,78 @@ |
11509 |
+ |
11510 |
+ #include "core.h" |
11511 |
+ |
11512 |
++/* |
11513 |
++ * The Atmel AT25FS010/AT25FS040 parts have some weird configuration for the |
11514 |
++ * block protection bits. We don't support them. But legacy behavior in linux |
11515 |
++ * is to unlock the whole flash array on startup. Therefore, we have to support |
11516 |
++ * exactly this operation. |
11517 |
++ */ |
11518 |
++static int atmel_at25fs_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) |
11519 |
++{ |
11520 |
++ return -EOPNOTSUPP; |
11521 |
++} |
11522 |
++ |
11523 |
++static int atmel_at25fs_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) |
11524 |
++{ |
11525 |
++ int ret; |
11526 |
++ |
11527 |
++ /* We only support unlocking the whole flash array */ |
11528 |
++ if (ofs || len != nor->params->size) |
11529 |
++ return -EINVAL; |
11530 |
++ |
11531 |
++ /* Write 0x00 to the status register to disable write protection */ |
11532 |
++ ret = spi_nor_write_sr_and_check(nor, 0); |
11533 |
++ if (ret) |
11534 |
++ dev_dbg(nor->dev, "unable to clear BP bits, WP# asserted?\n"); |
11535 |
++ |
11536 |
++ return ret; |
11537 |
++} |
11538 |
++ |
11539 |
++static int atmel_at25fs_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) |
11540 |
++{ |
11541 |
++ return -EOPNOTSUPP; |
11542 |
++} |
11543 |
++ |
11544 |
++static const struct spi_nor_locking_ops atmel_at25fs_locking_ops = { |
11545 |
++ .lock = atmel_at25fs_lock, |
11546 |
++ .unlock = atmel_at25fs_unlock, |
11547 |
++ .is_locked = atmel_at25fs_is_locked, |
11548 |
++}; |
11549 |
++ |
11550 |
++static void atmel_at25fs_default_init(struct spi_nor *nor) |
11551 |
++{ |
11552 |
++ nor->params->locking_ops = &atmel_at25fs_locking_ops; |
11553 |
++} |
11554 |
++ |
11555 |
++static const struct spi_nor_fixups atmel_at25fs_fixups = { |
11556 |
++ .default_init = atmel_at25fs_default_init, |
11557 |
++}; |
11558 |
++ |
11559 |
+ static const struct flash_info atmel_parts[] = { |
11560 |
+ /* Atmel -- some are (confusingly) marketed as "DataFlash" */ |
11561 |
+- { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, |
11562 |
+- { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, |
11563 |
++ { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K | SPI_NOR_HAS_LOCK) |
11564 |
++ .fixups = &atmel_at25fs_fixups }, |
11565 |
++ { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) |
11566 |
++ .fixups = &atmel_at25fs_fixups }, |
11567 |
+ |
11568 |
+- { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) }, |
11569 |
+- { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) }, |
11570 |
+- { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) }, |
11571 |
+- { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) }, |
11572 |
++ { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11573 |
++ { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11574 |
++ { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11575 |
++ { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11576 |
+ |
11577 |
+ { "at25sl321", INFO(0x1f4216, 0, 64 * 1024, 64, |
11578 |
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, |
11579 |
+ |
11580 |
+ { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) }, |
11581 |
+- { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) }, |
11582 |
+- { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) }, |
11583 |
+- { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) }, |
11584 |
++ { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11585 |
++ { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11586 |
++ { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, |
11587 |
+ |
11588 |
+ { "at45db081d", INFO(0x1f2500, 0, 64 * 1024, 16, SECT_4K) }, |
11589 |
+ }; |
11590 |
+ |
11591 |
+-static void atmel_default_init(struct spi_nor *nor) |
11592 |
+-{ |
11593 |
+- nor->flags |= SNOR_F_HAS_LOCK; |
11594 |
+-} |
11595 |
+- |
11596 |
+-static const struct spi_nor_fixups atmel_fixups = { |
11597 |
+- .default_init = atmel_default_init, |
11598 |
+-}; |
11599 |
+- |
11600 |
+ const struct spi_nor_manufacturer spi_nor_atmel = { |
11601 |
+ .name = "atmel", |
11602 |
+ .parts = atmel_parts, |
11603 |
+ .nparts = ARRAY_SIZE(atmel_parts), |
11604 |
+- .fixups = &atmel_fixups, |
11605 |
+ }; |
11606 |
+diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c |
11607 |
+index f0ae7a01703a1..ad6c79d9a7f86 100644 |
11608 |
+--- a/drivers/mtd/spi-nor/core.c |
11609 |
++++ b/drivers/mtd/spi-nor/core.c |
11610 |
+@@ -906,7 +906,7 @@ static int spi_nor_write_16bit_cr_and_check(struct spi_nor *nor, u8 cr) |
11611 |
+ * |
11612 |
+ * Return: 0 on success, -errno otherwise. |
11613 |
+ */ |
11614 |
+-static int spi_nor_write_sr_and_check(struct spi_nor *nor, u8 sr1) |
11615 |
++int spi_nor_write_sr_and_check(struct spi_nor *nor, u8 sr1) |
11616 |
+ { |
11617 |
+ if (nor->flags & SNOR_F_HAS_16BIT_SR) |
11618 |
+ return spi_nor_write_16bit_sr_and_check(nor, sr1); |
11619 |
+@@ -2915,20 +2915,27 @@ static int spi_nor_quad_enable(struct spi_nor *nor) |
11620 |
+ } |
11621 |
+ |
11622 |
+ /** |
11623 |
+- * spi_nor_unlock_all() - Unlocks the entire flash memory array. |
11624 |
++ * spi_nor_try_unlock_all() - Tries to unlock the entire flash memory array. |
11625 |
+ * @nor: pointer to a 'struct spi_nor'. |
11626 |
+ * |
11627 |
+ * Some SPI NOR flashes are write protected by default after a power-on reset |
11628 |
+ * cycle, in order to avoid inadvertent writes during power-up. Backward |
11629 |
+ * compatibility imposes to unlock the entire flash memory array at power-up |
11630 |
+ * by default. |
11631 |
++ * |
11632 |
++ * Unprotecting the entire flash array will fail for boards which are hardware |
11633 |
++ * write-protected. Thus any errors are ignored. |
11634 |
+ */ |
11635 |
+-static int spi_nor_unlock_all(struct spi_nor *nor) |
11636 |
++static void spi_nor_try_unlock_all(struct spi_nor *nor) |
11637 |
+ { |
11638 |
+- if (nor->flags & SNOR_F_HAS_LOCK) |
11639 |
+- return spi_nor_unlock(&nor->mtd, 0, nor->params->size); |
11640 |
++ int ret; |
11641 |
+ |
11642 |
+- return 0; |
11643 |
++ if (!(nor->flags & SNOR_F_HAS_LOCK)) |
11644 |
++ return; |
11645 |
++ |
11646 |
++ ret = spi_nor_unlock(&nor->mtd, 0, nor->params->size); |
11647 |
++ if (ret) |
11648 |
++ dev_dbg(nor->dev, "Failed to unlock the entire flash memory array\n"); |
11649 |
+ } |
11650 |
+ |
11651 |
+ static int spi_nor_init(struct spi_nor *nor) |
11652 |
+@@ -2941,11 +2948,7 @@ static int spi_nor_init(struct spi_nor *nor) |
11653 |
+ return err; |
11654 |
+ } |
11655 |
+ |
11656 |
+- err = spi_nor_unlock_all(nor); |
11657 |
+- if (err) { |
11658 |
+- dev_dbg(nor->dev, "Failed to unlock the entire flash memory array\n"); |
11659 |
+- return err; |
11660 |
+- } |
11661 |
++ spi_nor_try_unlock_all(nor); |
11662 |
+ |
11663 |
+ if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES)) { |
11664 |
+ /* |
11665 |
+diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h |
11666 |
+index 6f2f6b27173fd..6f62ee861231a 100644 |
11667 |
+--- a/drivers/mtd/spi-nor/core.h |
11668 |
++++ b/drivers/mtd/spi-nor/core.h |
11669 |
+@@ -409,6 +409,7 @@ void spi_nor_unlock_and_unprep(struct spi_nor *nor); |
11670 |
+ int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor); |
11671 |
+ int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor); |
11672 |
+ int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor); |
11673 |
++int spi_nor_write_sr_and_check(struct spi_nor *nor, u8 sr1); |
11674 |
+ |
11675 |
+ int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr); |
11676 |
+ ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len, |
11677 |
+diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c |
11678 |
+index e0af6d25d573b..0ab07624fb73f 100644 |
11679 |
+--- a/drivers/mtd/spi-nor/sst.c |
11680 |
++++ b/drivers/mtd/spi-nor/sst.c |
11681 |
+@@ -18,7 +18,8 @@ static const struct flash_info sst_parts[] = { |
11682 |
+ SECT_4K | SST_WRITE) }, |
11683 |
+ { "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, |
11684 |
+ SECT_4K | SST_WRITE) }, |
11685 |
+- { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, SECT_4K) }, |
11686 |
++ { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, |
11687 |
++ SECT_4K | SPI_NOR_4BIT_BP) }, |
11688 |
+ { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, |
11689 |
+ SECT_4K | SST_WRITE) }, |
11690 |
+ { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, |
11691 |
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
11692 |
+index 61a93b1920379..7fc4ac1582afc 100644 |
11693 |
+--- a/drivers/net/can/m_can/m_can.c |
11694 |
++++ b/drivers/net/can/m_can/m_can.c |
11695 |
+@@ -380,10 +380,6 @@ void m_can_config_endisable(struct m_can_classdev *cdev, bool enable) |
11696 |
+ cccr &= ~CCCR_CSR; |
11697 |
+ |
11698 |
+ if (enable) { |
11699 |
+- /* Clear the Clock stop request if it was set */ |
11700 |
+- if (cccr & CCCR_CSR) |
11701 |
+- cccr &= ~CCCR_CSR; |
11702 |
+- |
11703 |
+ /* enable m_can configuration */ |
11704 |
+ m_can_write(cdev, M_CAN_CCCR, cccr | CCCR_INIT); |
11705 |
+ udelay(5); |
11706 |
+diff --git a/drivers/net/dsa/qca/ar9331.c b/drivers/net/dsa/qca/ar9331.c |
11707 |
+index e24a99031b80f..4d49c5f2b7905 100644 |
11708 |
+--- a/drivers/net/dsa/qca/ar9331.c |
11709 |
++++ b/drivers/net/dsa/qca/ar9331.c |
11710 |
+@@ -159,6 +159,8 @@ struct ar9331_sw_priv { |
11711 |
+ struct dsa_switch ds; |
11712 |
+ struct dsa_switch_ops ops; |
11713 |
+ struct irq_domain *irqdomain; |
11714 |
++ u32 irq_mask; |
11715 |
++ struct mutex lock_irq; |
11716 |
+ struct mii_bus *mbus; /* mdio master */ |
11717 |
+ struct mii_bus *sbus; /* mdio slave */ |
11718 |
+ struct regmap *regmap; |
11719 |
+@@ -520,32 +522,44 @@ static irqreturn_t ar9331_sw_irq(int irq, void *data) |
11720 |
+ static void ar9331_sw_mask_irq(struct irq_data *d) |
11721 |
+ { |
11722 |
+ struct ar9331_sw_priv *priv = irq_data_get_irq_chip_data(d); |
11723 |
+- struct regmap *regmap = priv->regmap; |
11724 |
+- int ret; |
11725 |
+ |
11726 |
+- ret = regmap_update_bits(regmap, AR9331_SW_REG_GINT_MASK, |
11727 |
+- AR9331_SW_GINT_PHY_INT, 0); |
11728 |
+- if (ret) |
11729 |
+- dev_err(priv->dev, "could not mask IRQ\n"); |
11730 |
++ priv->irq_mask = 0; |
11731 |
+ } |
11732 |
+ |
11733 |
+ static void ar9331_sw_unmask_irq(struct irq_data *d) |
11734 |
++{ |
11735 |
++ struct ar9331_sw_priv *priv = irq_data_get_irq_chip_data(d); |
11736 |
++ |
11737 |
++ priv->irq_mask = AR9331_SW_GINT_PHY_INT; |
11738 |
++} |
11739 |
++ |
11740 |
++static void ar9331_sw_irq_bus_lock(struct irq_data *d) |
11741 |
++{ |
11742 |
++ struct ar9331_sw_priv *priv = irq_data_get_irq_chip_data(d); |
11743 |
++ |
11744 |
++ mutex_lock(&priv->lock_irq); |
11745 |
++} |
11746 |
++ |
11747 |
++static void ar9331_sw_irq_bus_sync_unlock(struct irq_data *d) |
11748 |
+ { |
11749 |
+ struct ar9331_sw_priv *priv = irq_data_get_irq_chip_data(d); |
11750 |
+ struct regmap *regmap = priv->regmap; |
11751 |
+ int ret; |
11752 |
+ |
11753 |
+ ret = regmap_update_bits(regmap, AR9331_SW_REG_GINT_MASK, |
11754 |
+- AR9331_SW_GINT_PHY_INT, |
11755 |
+- AR9331_SW_GINT_PHY_INT); |
11756 |
++ AR9331_SW_GINT_PHY_INT, priv->irq_mask); |
11757 |
+ if (ret) |
11758 |
+- dev_err(priv->dev, "could not unmask IRQ\n"); |
11759 |
++ dev_err(priv->dev, "failed to change IRQ mask\n"); |
11760 |
++ |
11761 |
++ mutex_unlock(&priv->lock_irq); |
11762 |
+ } |
11763 |
+ |
11764 |
+ static struct irq_chip ar9331_sw_irq_chip = { |
11765 |
+ .name = AR9331_SW_NAME, |
11766 |
+ .irq_mask = ar9331_sw_mask_irq, |
11767 |
+ .irq_unmask = ar9331_sw_unmask_irq, |
11768 |
++ .irq_bus_lock = ar9331_sw_irq_bus_lock, |
11769 |
++ .irq_bus_sync_unlock = ar9331_sw_irq_bus_sync_unlock, |
11770 |
+ }; |
11771 |
+ |
11772 |
+ static int ar9331_sw_irq_map(struct irq_domain *domain, unsigned int irq, |
11773 |
+@@ -584,6 +598,7 @@ static int ar9331_sw_irq_init(struct ar9331_sw_priv *priv) |
11774 |
+ return irq ? irq : -EINVAL; |
11775 |
+ } |
11776 |
+ |
11777 |
++ mutex_init(&priv->lock_irq); |
11778 |
+ ret = devm_request_threaded_irq(dev, irq, NULL, ar9331_sw_irq, |
11779 |
+ IRQF_ONESHOT, AR9331_SW_NAME, priv); |
11780 |
+ if (ret) { |
11781 |
+diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c |
11782 |
+index 862ea44beea77..5ed80d9a6b9fe 100644 |
11783 |
+--- a/drivers/net/ethernet/allwinner/sun4i-emac.c |
11784 |
++++ b/drivers/net/ethernet/allwinner/sun4i-emac.c |
11785 |
+@@ -828,13 +828,13 @@ static int emac_probe(struct platform_device *pdev) |
11786 |
+ db->clk = devm_clk_get(&pdev->dev, NULL); |
11787 |
+ if (IS_ERR(db->clk)) { |
11788 |
+ ret = PTR_ERR(db->clk); |
11789 |
+- goto out_iounmap; |
11790 |
++ goto out_dispose_mapping; |
11791 |
+ } |
11792 |
+ |
11793 |
+ ret = clk_prepare_enable(db->clk); |
11794 |
+ if (ret) { |
11795 |
+ dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret); |
11796 |
+- goto out_iounmap; |
11797 |
++ goto out_dispose_mapping; |
11798 |
+ } |
11799 |
+ |
11800 |
+ ret = sunxi_sram_claim(&pdev->dev); |
11801 |
+@@ -893,6 +893,8 @@ out_release_sram: |
11802 |
+ sunxi_sram_release(&pdev->dev); |
11803 |
+ out_clk_disable_unprepare: |
11804 |
+ clk_disable_unprepare(db->clk); |
11805 |
++out_dispose_mapping: |
11806 |
++ irq_dispose_mapping(ndev->irq); |
11807 |
+ out_iounmap: |
11808 |
+ iounmap(db->membase); |
11809 |
+ out: |
11810 |
+@@ -911,6 +913,7 @@ static int emac_remove(struct platform_device *pdev) |
11811 |
+ unregister_netdev(ndev); |
11812 |
+ sunxi_sram_release(&pdev->dev); |
11813 |
+ clk_disable_unprepare(db->clk); |
11814 |
++ irq_dispose_mapping(ndev->irq); |
11815 |
+ iounmap(db->membase); |
11816 |
+ free_netdev(ndev); |
11817 |
+ |
11818 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
11819 |
+index be85dad2e3bc4..fcca023f22e54 100644 |
11820 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
11821 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
11822 |
+@@ -4069,8 +4069,10 @@ static int bcmgenet_probe(struct platform_device *pdev) |
11823 |
+ clk_disable_unprepare(priv->clk); |
11824 |
+ |
11825 |
+ err = register_netdev(dev); |
11826 |
+- if (err) |
11827 |
++ if (err) { |
11828 |
++ bcmgenet_mii_exit(dev); |
11829 |
+ goto err; |
11830 |
++ } |
11831 |
+ |
11832 |
+ return err; |
11833 |
+ |
11834 |
+diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
11835 |
+index cf9400a9886d7..d880ab2a7d962 100644 |
11836 |
+--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
11837 |
++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
11838 |
+@@ -878,7 +878,7 @@ static int dpaa2_eth_build_sg_fd_single_buf(struct dpaa2_eth_priv *priv, |
11839 |
+ swa = (struct dpaa2_eth_swa *)sgt_buf; |
11840 |
+ swa->type = DPAA2_ETH_SWA_SINGLE; |
11841 |
+ swa->single.skb = skb; |
11842 |
+- swa->sg.sgt_size = sgt_buf_size; |
11843 |
++ swa->single.sgt_size = sgt_buf_size; |
11844 |
+ |
11845 |
+ /* Separately map the SGT buffer */ |
11846 |
+ sgt_addr = dma_map_single(dev, sgt_buf, sgt_buf_size, DMA_BIDIRECTIONAL); |
11847 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
11848 |
+index 567fd67e900ef..e402c62eb3137 100644 |
11849 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
11850 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
11851 |
+@@ -219,8 +219,11 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count) |
11852 |
+ } while (count); |
11853 |
+ |
11854 |
+ no_buffers: |
11855 |
+- if (rx_ring->next_to_use != ntu) |
11856 |
++ if (rx_ring->next_to_use != ntu) { |
11857 |
++ /* clear the status bits for the next_to_use descriptor */ |
11858 |
++ rx_desc->wb.qword1.status_error_len = 0; |
11859 |
+ i40e_release_rx_desc(rx_ring, ntu); |
11860 |
++ } |
11861 |
+ |
11862 |
+ return ok; |
11863 |
+ } |
11864 |
+diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c |
11865 |
+index 797886524054c..98101a8e2952d 100644 |
11866 |
+--- a/drivers/net/ethernet/intel/ice/ice_xsk.c |
11867 |
++++ b/drivers/net/ethernet/intel/ice/ice_xsk.c |
11868 |
+@@ -446,8 +446,11 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) |
11869 |
+ } |
11870 |
+ } while (--count); |
11871 |
+ |
11872 |
+- if (rx_ring->next_to_use != ntu) |
11873 |
++ if (rx_ring->next_to_use != ntu) { |
11874 |
++ /* clear the status bits for the next_to_use descriptor */ |
11875 |
++ rx_desc->wb.status_error0 = 0; |
11876 |
+ ice_release_rx_desc(rx_ring, ntu); |
11877 |
++ } |
11878 |
+ |
11879 |
+ return ret; |
11880 |
+ } |
11881 |
+diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c |
11882 |
+index bf48f0ded9c7d..925161959b9ba 100644 |
11883 |
+--- a/drivers/net/ethernet/korina.c |
11884 |
++++ b/drivers/net/ethernet/korina.c |
11885 |
+@@ -219,7 +219,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev) |
11886 |
+ dev_kfree_skb_any(skb); |
11887 |
+ spin_unlock_irqrestore(&lp->lock, flags); |
11888 |
+ |
11889 |
+- return NETDEV_TX_BUSY; |
11890 |
++ return NETDEV_TX_OK; |
11891 |
+ } |
11892 |
+ } |
11893 |
+ |
11894 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
11895 |
+index 8ff207aa14792..e455a2f31f070 100644 |
11896 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
11897 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
11898 |
+@@ -50,6 +50,7 @@ |
11899 |
+ #ifdef CONFIG_RFS_ACCEL |
11900 |
+ #include <linux/cpu_rmap.h> |
11901 |
+ #endif |
11902 |
++#include <linux/version.h> |
11903 |
+ #include <net/devlink.h> |
11904 |
+ #include "mlx5_core.h" |
11905 |
+ #include "lib/eq.h" |
11906 |
+@@ -233,7 +234,10 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev) |
11907 |
+ strncat(string, ",", remaining_size); |
11908 |
+ |
11909 |
+ remaining_size = max_t(int, 0, driver_ver_sz - strlen(string)); |
11910 |
+- strncat(string, DRIVER_VERSION, remaining_size); |
11911 |
++ |
11912 |
++ snprintf(string + strlen(string), remaining_size, "%u.%u.%u", |
11913 |
++ (u8)((LINUX_VERSION_CODE >> 16) & 0xff), (u8)((LINUX_VERSION_CODE >> 8) & 0xff), |
11914 |
++ (u16)(LINUX_VERSION_CODE & 0xffff)); |
11915 |
+ |
11916 |
+ /*Send the command*/ |
11917 |
+ MLX5_SET(set_driver_version_in, in, opcode, |
11918 |
+diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c |
11919 |
+index b319c22c211cd..8947c3a628109 100644 |
11920 |
+--- a/drivers/net/ethernet/microchip/lan743x_main.c |
11921 |
++++ b/drivers/net/ethernet/microchip/lan743x_main.c |
11922 |
+@@ -1962,6 +1962,14 @@ static struct sk_buff *lan743x_rx_allocate_skb(struct lan743x_rx *rx) |
11923 |
+ length, GFP_ATOMIC | GFP_DMA); |
11924 |
+ } |
11925 |
+ |
11926 |
++static void lan743x_rx_update_tail(struct lan743x_rx *rx, int index) |
11927 |
++{ |
11928 |
++ /* update the tail once per 8 descriptors */ |
11929 |
++ if ((index & 7) == 7) |
11930 |
++ lan743x_csr_write(rx->adapter, RX_TAIL(rx->channel_number), |
11931 |
++ index); |
11932 |
++} |
11933 |
++ |
11934 |
+ static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index, |
11935 |
+ struct sk_buff *skb) |
11936 |
+ { |
11937 |
+@@ -1992,6 +2000,7 @@ static int lan743x_rx_init_ring_element(struct lan743x_rx *rx, int index, |
11938 |
+ descriptor->data0 = (RX_DESC_DATA0_OWN_ | |
11939 |
+ (length & RX_DESC_DATA0_BUF_LENGTH_MASK_)); |
11940 |
+ skb_reserve(buffer_info->skb, RX_HEAD_PADDING); |
11941 |
++ lan743x_rx_update_tail(rx, index); |
11942 |
+ |
11943 |
+ return 0; |
11944 |
+ } |
11945 |
+@@ -2010,6 +2019,7 @@ static void lan743x_rx_reuse_ring_element(struct lan743x_rx *rx, int index) |
11946 |
+ descriptor->data0 = (RX_DESC_DATA0_OWN_ | |
11947 |
+ ((buffer_info->buffer_length) & |
11948 |
+ RX_DESC_DATA0_BUF_LENGTH_MASK_)); |
11949 |
++ lan743x_rx_update_tail(rx, index); |
11950 |
+ } |
11951 |
+ |
11952 |
+ static void lan743x_rx_release_ring_element(struct lan743x_rx *rx, int index) |
11953 |
+@@ -2220,6 +2230,7 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) |
11954 |
+ { |
11955 |
+ struct lan743x_rx *rx = container_of(napi, struct lan743x_rx, napi); |
11956 |
+ struct lan743x_adapter *adapter = rx->adapter; |
11957 |
++ int result = RX_PROCESS_RESULT_NOTHING_TO_DO; |
11958 |
+ u32 rx_tail_flags = 0; |
11959 |
+ int count; |
11960 |
+ |
11961 |
+@@ -2228,27 +2239,19 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) |
11962 |
+ lan743x_csr_write(adapter, DMAC_INT_STS, |
11963 |
+ DMAC_INT_BIT_RXFRM_(rx->channel_number)); |
11964 |
+ } |
11965 |
+- count = 0; |
11966 |
+- while (count < weight) { |
11967 |
+- int rx_process_result = lan743x_rx_process_packet(rx); |
11968 |
+- |
11969 |
+- if (rx_process_result == RX_PROCESS_RESULT_PACKET_RECEIVED) { |
11970 |
+- count++; |
11971 |
+- } else if (rx_process_result == |
11972 |
+- RX_PROCESS_RESULT_NOTHING_TO_DO) { |
11973 |
++ for (count = 0; count < weight; count++) { |
11974 |
++ result = lan743x_rx_process_packet(rx); |
11975 |
++ if (result == RX_PROCESS_RESULT_NOTHING_TO_DO) |
11976 |
+ break; |
11977 |
+- } else if (rx_process_result == |
11978 |
+- RX_PROCESS_RESULT_PACKET_DROPPED) { |
11979 |
+- continue; |
11980 |
+- } |
11981 |
+ } |
11982 |
+ rx->frame_count += count; |
11983 |
+- if (count == weight) |
11984 |
+- goto done; |
11985 |
++ if (count == weight || result == RX_PROCESS_RESULT_PACKET_RECEIVED) |
11986 |
++ return weight; |
11987 |
+ |
11988 |
+ if (!napi_complete_done(napi, count)) |
11989 |
+- goto done; |
11990 |
++ return count; |
11991 |
+ |
11992 |
++ /* re-arm interrupts, must write to rx tail on some chip variants */ |
11993 |
+ if (rx->vector_flags & LAN743X_VECTOR_FLAG_VECTOR_ENABLE_AUTO_SET) |
11994 |
+ rx_tail_flags |= RX_TAIL_SET_TOP_INT_VEC_EN_; |
11995 |
+ if (rx->vector_flags & LAN743X_VECTOR_FLAG_SOURCE_ENABLE_AUTO_SET) { |
11996 |
+@@ -2258,10 +2261,10 @@ static int lan743x_rx_napi_poll(struct napi_struct *napi, int weight) |
11997 |
+ INT_BIT_DMA_RX_(rx->channel_number)); |
11998 |
+ } |
11999 |
+ |
12000 |
+- /* update RX_TAIL */ |
12001 |
+- lan743x_csr_write(adapter, RX_TAIL(rx->channel_number), |
12002 |
+- rx_tail_flags | rx->last_tail); |
12003 |
+-done: |
12004 |
++ if (rx_tail_flags) |
12005 |
++ lan743x_csr_write(adapter, RX_TAIL(rx->channel_number), |
12006 |
++ rx_tail_flags | rx->last_tail); |
12007 |
++ |
12008 |
+ return count; |
12009 |
+ } |
12010 |
+ |
12011 |
+@@ -2405,7 +2408,7 @@ static int lan743x_rx_open(struct lan743x_rx *rx) |
12012 |
+ |
12013 |
+ netif_napi_add(adapter->netdev, |
12014 |
+ &rx->napi, lan743x_rx_napi_poll, |
12015 |
+- rx->ring_size - 1); |
12016 |
++ NAPI_POLL_WEIGHT); |
12017 |
+ |
12018 |
+ lan743x_csr_write(adapter, DMAC_CMD, |
12019 |
+ DMAC_CMD_RX_SWR_(rx->channel_number)); |
12020 |
+diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c |
12021 |
+index 1e7729421a825..9cf2bc5f42892 100644 |
12022 |
+--- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c |
12023 |
++++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c |
12024 |
+@@ -1267,7 +1267,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev) |
12025 |
+ |
12026 |
+ err = mscc_ocelot_init_ports(pdev, ports); |
12027 |
+ if (err) |
12028 |
+- goto out_put_ports; |
12029 |
++ goto out_ocelot_deinit; |
12030 |
+ |
12031 |
+ if (ocelot->ptp) { |
12032 |
+ err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info); |
12033 |
+@@ -1282,8 +1282,14 @@ static int mscc_ocelot_probe(struct platform_device *pdev) |
12034 |
+ register_switchdev_notifier(&ocelot_switchdev_nb); |
12035 |
+ register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); |
12036 |
+ |
12037 |
++ of_node_put(ports); |
12038 |
++ |
12039 |
+ dev_info(&pdev->dev, "Ocelot switch probed\n"); |
12040 |
+ |
12041 |
++ return 0; |
12042 |
++ |
12043 |
++out_ocelot_deinit: |
12044 |
++ ocelot_deinit(ocelot); |
12045 |
+ out_put_ports: |
12046 |
+ of_node_put(ports); |
12047 |
+ return err; |
12048 |
+diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c |
12049 |
+index bb448c82cdc28..c029950a81e20 100644 |
12050 |
+--- a/drivers/net/ethernet/netronome/nfp/flower/main.c |
12051 |
++++ b/drivers/net/ethernet/netronome/nfp/flower/main.c |
12052 |
+@@ -860,9 +860,6 @@ static void nfp_flower_clean(struct nfp_app *app) |
12053 |
+ skb_queue_purge(&app_priv->cmsg_skbs_low); |
12054 |
+ flush_work(&app_priv->cmsg_work); |
12055 |
+ |
12056 |
+- flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app, |
12057 |
+- nfp_flower_setup_indr_tc_release); |
12058 |
+- |
12059 |
+ if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM) |
12060 |
+ nfp_flower_qos_cleanup(app); |
12061 |
+ |
12062 |
+@@ -951,6 +948,9 @@ static int nfp_flower_start(struct nfp_app *app) |
12063 |
+ static void nfp_flower_stop(struct nfp_app *app) |
12064 |
+ { |
12065 |
+ nfp_tunnel_config_stop(app); |
12066 |
++ |
12067 |
++ flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app, |
12068 |
++ nfp_flower_setup_indr_tc_release); |
12069 |
+ } |
12070 |
+ |
12071 |
+ static int |
12072 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
12073 |
+index a12df3946a07c..c968c5c5a60a0 100644 |
12074 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
12075 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
12076 |
+@@ -1129,38 +1129,10 @@ static void ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode) |
12077 |
+ lif->rx_mode = rx_mode; |
12078 |
+ } |
12079 |
+ |
12080 |
+-static void _ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode, |
12081 |
+- bool from_ndo) |
12082 |
+-{ |
12083 |
+- struct ionic_deferred_work *work; |
12084 |
+- |
12085 |
+- if (from_ndo) { |
12086 |
+- work = kzalloc(sizeof(*work), GFP_ATOMIC); |
12087 |
+- if (!work) { |
12088 |
+- netdev_err(lif->netdev, "%s OOM\n", __func__); |
12089 |
+- return; |
12090 |
+- } |
12091 |
+- work->type = IONIC_DW_TYPE_RX_MODE; |
12092 |
+- work->rx_mode = rx_mode; |
12093 |
+- netdev_dbg(lif->netdev, "deferred: rx_mode\n"); |
12094 |
+- ionic_lif_deferred_enqueue(&lif->deferred, work); |
12095 |
+- } else { |
12096 |
+- ionic_lif_rx_mode(lif, rx_mode); |
12097 |
+- } |
12098 |
+-} |
12099 |
+- |
12100 |
+-static void ionic_dev_uc_sync(struct net_device *netdev, bool from_ndo) |
12101 |
+-{ |
12102 |
+- if (from_ndo) |
12103 |
+- __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); |
12104 |
+- else |
12105 |
+- __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); |
12106 |
+- |
12107 |
+-} |
12108 |
+- |
12109 |
+-static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) |
12110 |
++static void ionic_set_rx_mode(struct net_device *netdev, bool can_sleep) |
12111 |
+ { |
12112 |
+ struct ionic_lif *lif = netdev_priv(netdev); |
12113 |
++ struct ionic_deferred_work *work; |
12114 |
+ unsigned int nfilters; |
12115 |
+ unsigned int rx_mode; |
12116 |
+ |
12117 |
+@@ -1177,7 +1149,10 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) |
12118 |
+ * we remove our overflow flag and check the netdev flags |
12119 |
+ * to see if we can disable NIC PROMISC |
12120 |
+ */ |
12121 |
+- ionic_dev_uc_sync(netdev, from_ndo); |
12122 |
++ if (can_sleep) |
12123 |
++ __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); |
12124 |
++ else |
12125 |
++ __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); |
12126 |
+ nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); |
12127 |
+ if (netdev_uc_count(netdev) + 1 > nfilters) { |
12128 |
+ rx_mode |= IONIC_RX_MODE_F_PROMISC; |
12129 |
+@@ -1189,7 +1164,10 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) |
12130 |
+ } |
12131 |
+ |
12132 |
+ /* same for multicast */ |
12133 |
+- ionic_dev_uc_sync(netdev, from_ndo); |
12134 |
++ if (can_sleep) |
12135 |
++ __dev_mc_sync(netdev, ionic_addr_add, ionic_addr_del); |
12136 |
++ else |
12137 |
++ __dev_mc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); |
12138 |
+ nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); |
12139 |
+ if (netdev_mc_count(netdev) > nfilters) { |
12140 |
+ rx_mode |= IONIC_RX_MODE_F_ALLMULTI; |
12141 |
+@@ -1200,13 +1178,26 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) |
12142 |
+ rx_mode &= ~IONIC_RX_MODE_F_ALLMULTI; |
12143 |
+ } |
12144 |
+ |
12145 |
+- if (lif->rx_mode != rx_mode) |
12146 |
+- _ionic_lif_rx_mode(lif, rx_mode, from_ndo); |
12147 |
++ if (lif->rx_mode != rx_mode) { |
12148 |
++ if (!can_sleep) { |
12149 |
++ work = kzalloc(sizeof(*work), GFP_ATOMIC); |
12150 |
++ if (!work) { |
12151 |
++ netdev_err(lif->netdev, "%s OOM\n", __func__); |
12152 |
++ return; |
12153 |
++ } |
12154 |
++ work->type = IONIC_DW_TYPE_RX_MODE; |
12155 |
++ work->rx_mode = rx_mode; |
12156 |
++ netdev_dbg(lif->netdev, "deferred: rx_mode\n"); |
12157 |
++ ionic_lif_deferred_enqueue(&lif->deferred, work); |
12158 |
++ } else { |
12159 |
++ ionic_lif_rx_mode(lif, rx_mode); |
12160 |
++ } |
12161 |
++ } |
12162 |
+ } |
12163 |
+ |
12164 |
+ static void ionic_ndo_set_rx_mode(struct net_device *netdev) |
12165 |
+ { |
12166 |
+- ionic_set_rx_mode(netdev, true); |
12167 |
++ ionic_set_rx_mode(netdev, false); |
12168 |
+ } |
12169 |
+ |
12170 |
+ static __le64 ionic_netdev_features_to_nic(netdev_features_t features) |
12171 |
+@@ -1773,7 +1764,7 @@ static int ionic_txrx_init(struct ionic_lif *lif) |
12172 |
+ if (lif->netdev->features & NETIF_F_RXHASH) |
12173 |
+ ionic_lif_rss_init(lif); |
12174 |
+ |
12175 |
+- ionic_set_rx_mode(lif->netdev, false); |
12176 |
++ ionic_set_rx_mode(lif->netdev, true); |
12177 |
+ |
12178 |
+ return 0; |
12179 |
+ |
12180 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
12181 |
+index 5a7e240fd4698..c2faf96fcade8 100644 |
12182 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
12183 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |
12184 |
+@@ -2492,6 +2492,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
12185 |
+ qlcnic_sriov_vf_register_map(ahw); |
12186 |
+ break; |
12187 |
+ default: |
12188 |
++ err = -EINVAL; |
12189 |
+ goto err_out_free_hw_res; |
12190 |
+ } |
12191 |
+ |
12192 |
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
12193 |
+index 21b71148c5324..34bb95dd92392 100644 |
12194 |
+--- a/drivers/net/virtio_net.c |
12195 |
++++ b/drivers/net/virtio_net.c |
12196 |
+@@ -3072,6 +3072,7 @@ static int virtnet_probe(struct virtio_device *vdev) |
12197 |
+ dev_err(&vdev->dev, |
12198 |
+ "device MTU appears to have changed it is now %d < %d", |
12199 |
+ mtu, dev->min_mtu); |
12200 |
++ err = -EINVAL; |
12201 |
+ goto free; |
12202 |
+ } |
12203 |
+ |
12204 |
+diff --git a/drivers/net/wireless/admtek/adm8211.c b/drivers/net/wireless/admtek/adm8211.c |
12205 |
+index 5cf2045fadeff..c41e72508d3db 100644 |
12206 |
+--- a/drivers/net/wireless/admtek/adm8211.c |
12207 |
++++ b/drivers/net/wireless/admtek/adm8211.c |
12208 |
+@@ -1796,6 +1796,7 @@ static int adm8211_probe(struct pci_dev *pdev, |
12209 |
+ if (io_len < 256 || mem_len < 1024) { |
12210 |
+ printk(KERN_ERR "%s (adm8211): Too short PCI resources\n", |
12211 |
+ pci_name(pdev)); |
12212 |
++ err = -ENOMEM; |
12213 |
+ goto err_disable_pdev; |
12214 |
+ } |
12215 |
+ |
12216 |
+@@ -1805,6 +1806,7 @@ static int adm8211_probe(struct pci_dev *pdev, |
12217 |
+ if (reg != ADM8211_SIG1 && reg != ADM8211_SIG2) { |
12218 |
+ printk(KERN_ERR "%s (adm8211): Invalid signature (0x%x)\n", |
12219 |
+ pci_name(pdev), reg); |
12220 |
++ err = -EINVAL; |
12221 |
+ goto err_disable_pdev; |
12222 |
+ } |
12223 |
+ |
12224 |
+@@ -1815,8 +1817,8 @@ static int adm8211_probe(struct pci_dev *pdev, |
12225 |
+ return err; /* someone else grabbed it? don't disable it */ |
12226 |
+ } |
12227 |
+ |
12228 |
+- if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) || |
12229 |
+- dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) { |
12230 |
++ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
12231 |
++ if (err) { |
12232 |
+ printk(KERN_ERR "%s (adm8211): No suitable DMA available\n", |
12233 |
+ pci_name(pdev)); |
12234 |
+ goto err_free_reg; |
12235 |
+diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c |
12236 |
+index 05a620ff6fe2c..19b9c27e30e20 100644 |
12237 |
+--- a/drivers/net/wireless/ath/ath10k/usb.c |
12238 |
++++ b/drivers/net/wireless/ath/ath10k/usb.c |
12239 |
+@@ -997,6 +997,8 @@ static int ath10k_usb_probe(struct usb_interface *interface, |
12240 |
+ |
12241 |
+ ar_usb = ath10k_usb_priv(ar); |
12242 |
+ ret = ath10k_usb_create(ar, interface); |
12243 |
++ if (ret) |
12244 |
++ goto err; |
12245 |
+ ar_usb->ar = ar; |
12246 |
+ |
12247 |
+ ar->dev_id = product_id; |
12248 |
+@@ -1009,7 +1011,7 @@ static int ath10k_usb_probe(struct usb_interface *interface, |
12249 |
+ ret = ath10k_core_register(ar, &bus_params); |
12250 |
+ if (ret) { |
12251 |
+ ath10k_warn(ar, "failed to register driver core: %d\n", ret); |
12252 |
+- goto err; |
12253 |
++ goto err_usb_destroy; |
12254 |
+ } |
12255 |
+ |
12256 |
+ /* TODO: remove this once USB support is fully implemented */ |
12257 |
+@@ -1017,6 +1019,9 @@ static int ath10k_usb_probe(struct usb_interface *interface, |
12258 |
+ |
12259 |
+ return 0; |
12260 |
+ |
12261 |
++err_usb_destroy: |
12262 |
++ ath10k_usb_destroy(ar); |
12263 |
++ |
12264 |
+ err: |
12265 |
+ ath10k_core_destroy(ar); |
12266 |
+ |
12267 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
12268 |
+index 932266d1111bd..7b5834157fe51 100644 |
12269 |
+--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
12270 |
++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c |
12271 |
+@@ -1401,13 +1401,15 @@ static int ath10k_wmi_tlv_svc_avail_parse(struct ath10k *ar, u16 tag, u16 len, |
12272 |
+ |
12273 |
+ switch (tag) { |
12274 |
+ case WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT: |
12275 |
++ arg->service_map_ext_valid = true; |
12276 |
+ arg->service_map_ext_len = *(__le32 *)ptr; |
12277 |
+ arg->service_map_ext = ptr + sizeof(__le32); |
12278 |
+ return 0; |
12279 |
+ default: |
12280 |
+ break; |
12281 |
+ } |
12282 |
+- return -EPROTO; |
12283 |
++ |
12284 |
++ return 0; |
12285 |
+ } |
12286 |
+ |
12287 |
+ static int ath10k_wmi_tlv_op_pull_svc_avail(struct ath10k *ar, |
12288 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c |
12289 |
+index 1fa7107a50515..37b53af760d76 100644 |
12290 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.c |
12291 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.c |
12292 |
+@@ -5751,8 +5751,13 @@ void ath10k_wmi_event_service_available(struct ath10k *ar, struct sk_buff *skb) |
12293 |
+ ret); |
12294 |
+ } |
12295 |
+ |
12296 |
+- ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map, |
12297 |
+- __le32_to_cpu(arg.service_map_ext_len)); |
12298 |
++ /* |
12299 |
++ * Initialization of "arg.service_map_ext_valid" to ZERO is necessary |
12300 |
++ * for the below logic to work. |
12301 |
++ */ |
12302 |
++ if (arg.service_map_ext_valid) |
12303 |
++ ath10k_wmi_map_svc_ext(ar, arg.service_map_ext, ar->wmi.svc_map, |
12304 |
++ __le32_to_cpu(arg.service_map_ext_len)); |
12305 |
+ } |
12306 |
+ |
12307 |
+ static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb) |
12308 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h |
12309 |
+index 4898e19b0af65..66ecf09068c19 100644 |
12310 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.h |
12311 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.h |
12312 |
+@@ -6917,6 +6917,7 @@ struct wmi_svc_rdy_ev_arg { |
12313 |
+ }; |
12314 |
+ |
12315 |
+ struct wmi_svc_avail_ev_arg { |
12316 |
++ bool service_map_ext_valid; |
12317 |
+ __le32 service_map_ext_len; |
12318 |
+ const __le32 *service_map_ext; |
12319 |
+ }; |
12320 |
+diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h |
12321 |
+index 18b97420f0d8a..5a7915f75e1e2 100644 |
12322 |
+--- a/drivers/net/wireless/ath/ath11k/core.h |
12323 |
++++ b/drivers/net/wireless/ath/ath11k/core.h |
12324 |
+@@ -75,12 +75,14 @@ static inline enum wme_ac ath11k_tid_to_ac(u32 tid) |
12325 |
+ |
12326 |
+ enum ath11k_skb_flags { |
12327 |
+ ATH11K_SKB_HW_80211_ENCAP = BIT(0), |
12328 |
++ ATH11K_SKB_CIPHER_SET = BIT(1), |
12329 |
+ }; |
12330 |
+ |
12331 |
+ struct ath11k_skb_cb { |
12332 |
+ dma_addr_t paddr; |
12333 |
+ u8 eid; |
12334 |
+ u8 flags; |
12335 |
++ u32 cipher; |
12336 |
+ struct ath11k *ar; |
12337 |
+ struct ieee80211_vif *vif; |
12338 |
+ } __packed; |
12339 |
+diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c |
12340 |
+index 3d962eee4d61d..21dfd08d3debb 100644 |
12341 |
+--- a/drivers/net/wireless/ath/ath11k/dp_tx.c |
12342 |
++++ b/drivers/net/wireless/ath/ath11k/dp_tx.c |
12343 |
+@@ -84,7 +84,6 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, |
12344 |
+ struct ath11k_dp *dp = &ab->dp; |
12345 |
+ struct hal_tx_info ti = {0}; |
12346 |
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
12347 |
+- struct ieee80211_key_conf *key = info->control.hw_key; |
12348 |
+ struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB(skb); |
12349 |
+ struct hal_srng *tcl_ring; |
12350 |
+ struct ieee80211_hdr *hdr = (void *)skb->data; |
12351 |
+@@ -149,9 +148,9 @@ tcl_ring_sel: |
12352 |
+ ti.meta_data_flags = arvif->tcl_metadata; |
12353 |
+ |
12354 |
+ if (ti.encap_type == HAL_TCL_ENCAP_TYPE_RAW) { |
12355 |
+- if (key) { |
12356 |
++ if (skb_cb->flags & ATH11K_SKB_CIPHER_SET) { |
12357 |
+ ti.encrypt_type = |
12358 |
+- ath11k_dp_tx_get_encrypt_type(key->cipher); |
12359 |
++ ath11k_dp_tx_get_encrypt_type(skb_cb->cipher); |
12360 |
+ |
12361 |
+ if (ieee80211_has_protected(hdr->frame_control)) |
12362 |
+ skb_put(skb, IEEE80211_CCMP_MIC_LEN); |
12363 |
+diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/ath/ath11k/hw.c |
12364 |
+index 11a411b76fe42..66331da350129 100644 |
12365 |
+--- a/drivers/net/wireless/ath/ath11k/hw.c |
12366 |
++++ b/drivers/net/wireless/ath/ath11k/hw.c |
12367 |
+@@ -127,7 +127,7 @@ static void ath11k_init_wmi_config_ipq8074(struct ath11k_base *ab, |
12368 |
+ config->beacon_tx_offload_max_vdev = ab->num_radios * TARGET_MAX_BCN_OFFLD; |
12369 |
+ config->rx_batchmode = TARGET_RX_BATCHMODE; |
12370 |
+ config->peer_map_unmap_v2_support = 1; |
12371 |
+- config->twt_ap_pdev_count = 2; |
12372 |
++ config->twt_ap_pdev_count = ab->num_radios; |
12373 |
+ config->twt_ap_sta_count = 1000; |
12374 |
+ } |
12375 |
+ |
12376 |
+@@ -157,7 +157,7 @@ static int ath11k_hw_mac_id_to_srng_id_qca6390(struct ath11k_hw_params *hw, |
12377 |
+ |
12378 |
+ const struct ath11k_hw_ops ipq8074_ops = { |
12379 |
+ .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id, |
12380 |
+- .wmi_init_config = ath11k_init_wmi_config_qca6390, |
12381 |
++ .wmi_init_config = ath11k_init_wmi_config_ipq8074, |
12382 |
+ .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074, |
12383 |
+ .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074, |
12384 |
+ }; |
12385 |
+diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c |
12386 |
+index 7f8dd47d23333..af427d9051a07 100644 |
12387 |
+--- a/drivers/net/wireless/ath/ath11k/mac.c |
12388 |
++++ b/drivers/net/wireless/ath/ath11k/mac.c |
12389 |
+@@ -3977,21 +3977,20 @@ static void ath11k_mgmt_over_wmi_tx_purge(struct ath11k *ar) |
12390 |
+ static void ath11k_mgmt_over_wmi_tx_work(struct work_struct *work) |
12391 |
+ { |
12392 |
+ struct ath11k *ar = container_of(work, struct ath11k, wmi_mgmt_tx_work); |
12393 |
+- struct ieee80211_tx_info *info; |
12394 |
++ struct ath11k_skb_cb *skb_cb; |
12395 |
+ struct ath11k_vif *arvif; |
12396 |
+ struct sk_buff *skb; |
12397 |
+ int ret; |
12398 |
+ |
12399 |
+ while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) { |
12400 |
+- info = IEEE80211_SKB_CB(skb); |
12401 |
+- if (!info->control.vif) { |
12402 |
+- ath11k_warn(ar->ab, "no vif found for mgmt frame, flags 0x%x\n", |
12403 |
+- info->control.flags); |
12404 |
++ skb_cb = ATH11K_SKB_CB(skb); |
12405 |
++ if (!skb_cb->vif) { |
12406 |
++ ath11k_warn(ar->ab, "no vif found for mgmt frame\n"); |
12407 |
+ ieee80211_free_txskb(ar->hw, skb); |
12408 |
+ continue; |
12409 |
+ } |
12410 |
+ |
12411 |
+- arvif = ath11k_vif_to_arvif(info->control.vif); |
12412 |
++ arvif = ath11k_vif_to_arvif(skb_cb->vif); |
12413 |
+ if (ar->allocated_vdev_map & (1LL << arvif->vdev_id) && |
12414 |
+ arvif->is_started) { |
12415 |
+ ret = ath11k_mac_mgmt_tx_wmi(ar, arvif, skb); |
12416 |
+@@ -4004,8 +4003,8 @@ static void ath11k_mgmt_over_wmi_tx_work(struct work_struct *work) |
12417 |
+ } |
12418 |
+ } else { |
12419 |
+ ath11k_warn(ar->ab, |
12420 |
+- "dropping mgmt frame for vdev %d, flags 0x%x is_started %d\n", |
12421 |
+- arvif->vdev_id, info->control.flags, |
12422 |
++ "dropping mgmt frame for vdev %d, is_started %d\n", |
12423 |
++ arvif->vdev_id, |
12424 |
+ arvif->is_started); |
12425 |
+ ieee80211_free_txskb(ar->hw, skb); |
12426 |
+ } |
12427 |
+@@ -4053,10 +4052,20 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, |
12428 |
+ struct ieee80211_vif *vif = info->control.vif; |
12429 |
+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); |
12430 |
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
12431 |
++ struct ieee80211_key_conf *key = info->control.hw_key; |
12432 |
++ u32 info_flags = info->flags; |
12433 |
+ bool is_prb_rsp; |
12434 |
+ int ret; |
12435 |
+ |
12436 |
+- if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { |
12437 |
++ memset(skb_cb, 0, sizeof(*skb_cb)); |
12438 |
++ skb_cb->vif = vif; |
12439 |
++ |
12440 |
++ if (key) { |
12441 |
++ skb_cb->cipher = key->cipher; |
12442 |
++ skb_cb->flags |= ATH11K_SKB_CIPHER_SET; |
12443 |
++ } |
12444 |
++ |
12445 |
++ if (info_flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { |
12446 |
+ skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP; |
12447 |
+ } else if (ieee80211_is_mgmt(hdr->frame_control)) { |
12448 |
+ is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control); |
12449 |
+@@ -4094,7 +4103,8 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable) |
12450 |
+ |
12451 |
+ if (enable) { |
12452 |
+ tlv_filter = ath11k_mac_mon_status_filter_default; |
12453 |
+- tlv_filter.rx_filter = ath11k_debugfs_rx_filter(ar); |
12454 |
++ if (ath11k_debugfs_rx_filter(ar)) |
12455 |
++ tlv_filter.rx_filter = ath11k_debugfs_rx_filter(ar); |
12456 |
+ } |
12457 |
+ |
12458 |
+ for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { |
12459 |
+@@ -5225,20 +5235,26 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, |
12460 |
+ arvif->vdev_type != WMI_VDEV_TYPE_AP && |
12461 |
+ arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) { |
12462 |
+ memcpy(&arvif->chanctx, ctx, sizeof(*ctx)); |
12463 |
+- mutex_unlock(&ar->conf_mutex); |
12464 |
+- return 0; |
12465 |
++ ret = 0; |
12466 |
++ goto out; |
12467 |
+ } |
12468 |
+ |
12469 |
+ if (WARN_ON(arvif->is_started)) { |
12470 |
+- mutex_unlock(&ar->conf_mutex); |
12471 |
+- return -EBUSY; |
12472 |
++ ret = -EBUSY; |
12473 |
++ goto out; |
12474 |
+ } |
12475 |
+ |
12476 |
+ if (ab->hw_params.vdev_start_delay) { |
12477 |
+ param.vdev_id = arvif->vdev_id; |
12478 |
+ param.peer_type = WMI_PEER_TYPE_DEFAULT; |
12479 |
+ param.peer_addr = ar->mac_addr; |
12480 |
++ |
12481 |
+ ret = ath11k_peer_create(ar, arvif, NULL, ¶m); |
12482 |
++ if (ret) { |
12483 |
++ ath11k_warn(ab, "failed to create peer after vdev start delay: %d", |
12484 |
++ ret); |
12485 |
++ goto out; |
12486 |
++ } |
12487 |
+ } |
12488 |
+ |
12489 |
+ ret = ath11k_mac_vdev_start(arvif, &ctx->def); |
12490 |
+@@ -5246,23 +5262,21 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, |
12491 |
+ ath11k_warn(ab, "failed to start vdev %i addr %pM on freq %d: %d\n", |
12492 |
+ arvif->vdev_id, vif->addr, |
12493 |
+ ctx->def.chan->center_freq, ret); |
12494 |
+- goto err; |
12495 |
++ goto out; |
12496 |
+ } |
12497 |
+ if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { |
12498 |
+ ret = ath11k_monitor_vdev_up(ar, arvif->vdev_id); |
12499 |
+ if (ret) |
12500 |
+- goto err; |
12501 |
++ goto out; |
12502 |
+ } |
12503 |
+ |
12504 |
+ arvif->is_started = true; |
12505 |
+ |
12506 |
+ /* TODO: Setup ps and cts/rts protection */ |
12507 |
+ |
12508 |
+- mutex_unlock(&ar->conf_mutex); |
12509 |
+- |
12510 |
+- return 0; |
12511 |
++ ret = 0; |
12512 |
+ |
12513 |
+-err: |
12514 |
++out: |
12515 |
+ mutex_unlock(&ar->conf_mutex); |
12516 |
+ |
12517 |
+ return ret; |
12518 |
+diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c |
12519 |
+index c2b1651582259..99a88ca83deaa 100644 |
12520 |
+--- a/drivers/net/wireless/ath/ath11k/qmi.c |
12521 |
++++ b/drivers/net/wireless/ath/ath11k/qmi.c |
12522 |
+@@ -1585,15 +1585,17 @@ static int ath11k_qmi_fw_ind_register_send(struct ath11k_base *ab) |
12523 |
+ struct qmi_wlanfw_ind_register_resp_msg_v01 *resp; |
12524 |
+ struct qmi_handle *handle = &ab->qmi.handle; |
12525 |
+ struct qmi_txn txn; |
12526 |
+- int ret = 0; |
12527 |
++ int ret; |
12528 |
+ |
12529 |
+ req = kzalloc(sizeof(*req), GFP_KERNEL); |
12530 |
+ if (!req) |
12531 |
+ return -ENOMEM; |
12532 |
+ |
12533 |
+ resp = kzalloc(sizeof(*resp), GFP_KERNEL); |
12534 |
+- if (!resp) |
12535 |
++ if (!resp) { |
12536 |
++ ret = -ENOMEM; |
12537 |
+ goto resp_out; |
12538 |
++ } |
12539 |
+ |
12540 |
+ req->client_id_valid = 1; |
12541 |
+ req->client_id = QMI_WLANFW_CLIENT_ID; |
12542 |
+diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c |
12543 |
+index f6a1f0352989d..678d0885fcee7 100644 |
12544 |
+--- a/drivers/net/wireless/ath/ath11k/reg.c |
12545 |
++++ b/drivers/net/wireless/ath/ath11k/reg.c |
12546 |
+@@ -80,6 +80,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) |
12547 |
+ */ |
12548 |
+ init_country_param.flags = ALPHA_IS_SET; |
12549 |
+ memcpy(&init_country_param.cc_info.alpha2, request->alpha2, 2); |
12550 |
++ init_country_param.cc_info.alpha2[2] = 0; |
12551 |
+ |
12552 |
+ ret = ath11k_wmi_send_init_country_cmd(ar, init_country_param); |
12553 |
+ if (ret) |
12554 |
+@@ -584,7 +585,6 @@ ath11k_reg_build_regd(struct ath11k_base *ab, |
12555 |
+ if (!tmp_regd) |
12556 |
+ goto ret; |
12557 |
+ |
12558 |
+- tmp_regd->n_reg_rules = num_rules; |
12559 |
+ memcpy(tmp_regd->alpha2, reg_info->alpha2, REG_ALPHA2_LEN + 1); |
12560 |
+ memcpy(alpha2, reg_info->alpha2, REG_ALPHA2_LEN + 1); |
12561 |
+ alpha2[2] = '\0'; |
12562 |
+@@ -597,7 +597,7 @@ ath11k_reg_build_regd(struct ath11k_base *ab, |
12563 |
+ /* Update reg_rules[] below. Firmware is expected to |
12564 |
+ * send these rules in order(2G rules first and then 5G) |
12565 |
+ */ |
12566 |
+- for (; i < tmp_regd->n_reg_rules; i++) { |
12567 |
++ for (; i < num_rules; i++) { |
12568 |
+ if (reg_info->num_2g_reg_rules && |
12569 |
+ (i < reg_info->num_2g_reg_rules)) { |
12570 |
+ reg_rule = reg_info->reg_rules_2g_ptr + i; |
12571 |
+@@ -652,6 +652,8 @@ ath11k_reg_build_regd(struct ath11k_base *ab, |
12572 |
+ flags); |
12573 |
+ } |
12574 |
+ |
12575 |
++ tmp_regd->n_reg_rules = i; |
12576 |
++ |
12577 |
+ if (intersect) { |
12578 |
+ default_regd = ab->default_regd[reg_info->phy_id]; |
12579 |
+ |
12580 |
+diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c |
12581 |
+index 8eca92520837e..04b8b002edfe0 100644 |
12582 |
+--- a/drivers/net/wireless/ath/ath11k/wmi.c |
12583 |
++++ b/drivers/net/wireless/ath/ath11k/wmi.c |
12584 |
+@@ -2198,37 +2198,6 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, |
12585 |
+ } |
12586 |
+ } |
12587 |
+ |
12588 |
+- len = params->num_hint_s_ssid * sizeof(struct hint_short_ssid); |
12589 |
+- tlv = ptr; |
12590 |
+- tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_FIXED_STRUCT) | |
12591 |
+- FIELD_PREP(WMI_TLV_LEN, len); |
12592 |
+- ptr += TLV_HDR_SIZE; |
12593 |
+- if (params->num_hint_s_ssid) { |
12594 |
+- s_ssid = ptr; |
12595 |
+- for (i = 0; i < params->num_hint_s_ssid; ++i) { |
12596 |
+- s_ssid->freq_flags = params->hint_s_ssid[i].freq_flags; |
12597 |
+- s_ssid->short_ssid = params->hint_s_ssid[i].short_ssid; |
12598 |
+- s_ssid++; |
12599 |
+- } |
12600 |
+- } |
12601 |
+- ptr += len; |
12602 |
+- |
12603 |
+- len = params->num_hint_bssid * sizeof(struct hint_bssid); |
12604 |
+- tlv = ptr; |
12605 |
+- tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_FIXED_STRUCT) | |
12606 |
+- FIELD_PREP(WMI_TLV_LEN, len); |
12607 |
+- ptr += TLV_HDR_SIZE; |
12608 |
+- if (params->num_hint_bssid) { |
12609 |
+- hint_bssid = ptr; |
12610 |
+- for (i = 0; i < params->num_hint_bssid; ++i) { |
12611 |
+- hint_bssid->freq_flags = |
12612 |
+- params->hint_bssid[i].freq_flags; |
12613 |
+- ether_addr_copy(¶ms->hint_bssid[i].bssid.addr[0], |
12614 |
+- &hint_bssid->bssid.addr[0]); |
12615 |
+- hint_bssid++; |
12616 |
+- } |
12617 |
+- } |
12618 |
+- |
12619 |
+ ret = ath11k_wmi_cmd_send(wmi, skb, |
12620 |
+ WMI_START_SCAN_CMDID); |
12621 |
+ if (ret) { |
12622 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
12623 |
+index a2dbbb977d0cb..0ee421f30aa24 100644 |
12624 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
12625 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
12626 |
+@@ -2137,7 +2137,8 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, |
12627 |
+ BRCMF_WSEC_MAX_PSK_LEN); |
12628 |
+ else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) { |
12629 |
+ /* clean up user-space RSNE */ |
12630 |
+- if (brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0)) { |
12631 |
++ err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0); |
12632 |
++ if (err) { |
12633 |
+ bphy_err(drvr, "failed to clean up user-space RSNE\n"); |
12634 |
+ goto done; |
12635 |
+ } |
12636 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
12637 |
+index 39381cbde89e6..d8db0dbcfe091 100644 |
12638 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
12639 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
12640 |
+@@ -1936,16 +1936,18 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
12641 |
+ fwreq = brcmf_pcie_prepare_fw_request(devinfo); |
12642 |
+ if (!fwreq) { |
12643 |
+ ret = -ENOMEM; |
12644 |
+- goto fail_bus; |
12645 |
++ goto fail_brcmf; |
12646 |
+ } |
12647 |
+ |
12648 |
+ ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); |
12649 |
+ if (ret < 0) { |
12650 |
+ kfree(fwreq); |
12651 |
+- goto fail_bus; |
12652 |
++ goto fail_brcmf; |
12653 |
+ } |
12654 |
+ return 0; |
12655 |
+ |
12656 |
++fail_brcmf: |
12657 |
++ brcmf_free(&devinfo->pdev->dev); |
12658 |
+ fail_bus: |
12659 |
+ kfree(bus->msgbuf); |
12660 |
+ kfree(bus); |
12661 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
12662 |
+index 99987a789e7e3..59c2b2b6027da 100644 |
12663 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
12664 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
12665 |
+@@ -4541,6 +4541,7 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) |
12666 |
+ brcmf_sdiod_intr_unregister(bus->sdiodev); |
12667 |
+ |
12668 |
+ brcmf_detach(bus->sdiodev->dev); |
12669 |
++ brcmf_free(bus->sdiodev->dev); |
12670 |
+ |
12671 |
+ cancel_work_sync(&bus->datawork); |
12672 |
+ if (bus->brcmf_wq) |
12673 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c |
12674 |
+index 51ce93d21ffe5..8fa1c22fd96db 100644 |
12675 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c |
12676 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c |
12677 |
+@@ -808,7 +808,7 @@ static bool is_trig_data_contained(struct iwl_ucode_tlv *new, |
12678 |
+ struct iwl_fw_ini_trigger_tlv *old_trig = (void *)old->data; |
12679 |
+ __le32 *new_data = new_trig->data, *old_data = old_trig->data; |
12680 |
+ u32 new_dwords_num = iwl_tlv_array_len(new, new_trig, data); |
12681 |
+- u32 old_dwords_num = iwl_tlv_array_len(new, new_trig, data); |
12682 |
++ u32 old_dwords_num = iwl_tlv_array_len(old, old_trig, data); |
12683 |
+ int i, j; |
12684 |
+ |
12685 |
+ for (i = 0; i < new_dwords_num; i++) { |
12686 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
12687 |
+index f1c5b3a9c26f7..0d1118f66f0d5 100644 |
12688 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
12689 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c |
12690 |
+@@ -315,6 +315,12 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { |
12691 |
+ iwl_mvm_mu_mimo_grp_notif, RX_HANDLER_SYNC), |
12692 |
+ RX_HANDLER_GRP(DATA_PATH_GROUP, STA_PM_NOTIF, |
12693 |
+ iwl_mvm_sta_pm_notif, RX_HANDLER_SYNC), |
12694 |
++ RX_HANDLER_GRP(MAC_CONF_GROUP, PROBE_RESPONSE_DATA_NOTIF, |
12695 |
++ iwl_mvm_probe_resp_data_notif, |
12696 |
++ RX_HANDLER_ASYNC_LOCKED), |
12697 |
++ RX_HANDLER_GRP(MAC_CONF_GROUP, CHANNEL_SWITCH_NOA_NOTIF, |
12698 |
++ iwl_mvm_channel_switch_noa_notif, |
12699 |
++ RX_HANDLER_SYNC), |
12700 |
+ }; |
12701 |
+ #undef RX_HANDLER |
12702 |
+ #undef RX_HANDLER_GRP |
12703 |
+diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
12704 |
+index b849d27bd741e..d1fc948364c79 100644 |
12705 |
+--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
12706 |
++++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c |
12707 |
+@@ -1223,13 +1223,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) |
12708 |
+ if (skb->len < ETH_HLEN) |
12709 |
+ goto drop; |
12710 |
+ |
12711 |
+- ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); |
12712 |
+- if (!ctx) |
12713 |
+- goto busy; |
12714 |
+- |
12715 |
+- memset(ctx->buf, 0, BULK_BUF_SIZE); |
12716 |
+- buf = ctx->buf->data; |
12717 |
+- |
12718 |
+ tx_control = 0; |
12719 |
+ |
12720 |
+ err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control, |
12721 |
+@@ -1237,6 +1230,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) |
12722 |
+ if (err) |
12723 |
+ goto drop; |
12724 |
+ |
12725 |
++ ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); |
12726 |
++ if (!ctx) |
12727 |
++ goto drop; |
12728 |
++ |
12729 |
++ memset(ctx->buf, 0, BULK_BUF_SIZE); |
12730 |
++ buf = ctx->buf->data; |
12731 |
++ |
12732 |
+ { |
12733 |
+ __le16 *tx_cntl = (__le16 *)buf; |
12734 |
+ *tx_cntl = cpu_to_le16(tx_control); |
12735 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c |
12736 |
+index 9ba8a8f64976b..6283df5aaaf8b 100644 |
12737 |
+--- a/drivers/net/wireless/marvell/mwifiex/main.c |
12738 |
++++ b/drivers/net/wireless/marvell/mwifiex/main.c |
12739 |
+@@ -1471,6 +1471,8 @@ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) |
12740 |
+ priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); |
12741 |
+ mwifiex_deauthenticate(priv, NULL); |
12742 |
+ |
12743 |
++ mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); |
12744 |
++ |
12745 |
+ mwifiex_uninit_sw(adapter); |
12746 |
+ adapter->is_up = false; |
12747 |
+ |
12748 |
+diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c |
12749 |
+index 214fc95b8a33f..145e839fea4e5 100644 |
12750 |
+--- a/drivers/net/wireless/mediatek/mt76/dma.c |
12751 |
++++ b/drivers/net/wireless/mediatek/mt76/dma.c |
12752 |
+@@ -72,9 +72,11 @@ mt76_free_pending_txwi(struct mt76_dev *dev) |
12753 |
+ { |
12754 |
+ struct mt76_txwi_cache *t; |
12755 |
+ |
12756 |
++ local_bh_disable(); |
12757 |
+ while ((t = __mt76_get_txwi(dev)) != NULL) |
12758 |
+ dma_unmap_single(dev->dev, t->dma_addr, dev->drv->txwi_size, |
12759 |
+ DMA_TO_DEVICE); |
12760 |
++ local_bh_enable(); |
12761 |
+ } |
12762 |
+ |
12763 |
+ static int |
12764 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c |
12765 |
+index 4befe7f937a91..466447a5184f8 100644 |
12766 |
+--- a/drivers/net/wireless/mediatek/mt76/mac80211.c |
12767 |
++++ b/drivers/net/wireless/mediatek/mt76/mac80211.c |
12768 |
+@@ -305,6 +305,7 @@ mt76_phy_init(struct mt76_dev *dev, struct ieee80211_hw *hw) |
12769 |
+ ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); |
12770 |
+ ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS); |
12771 |
+ ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU); |
12772 |
++ ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER); |
12773 |
+ |
12774 |
+ if (!(dev->drv->drv_flags & MT_DRV_AMSDU_OFFLOAD)) { |
12775 |
+ ieee80211_hw_set(hw, TX_AMSDU); |
12776 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/pci.c b/drivers/net/wireless/mediatek/mt76/mt7603/pci.c |
12777 |
+index a5845da3547a9..06fa28f645f28 100644 |
12778 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7603/pci.c |
12779 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7603/pci.c |
12780 |
+@@ -57,7 +57,8 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
12781 |
+ |
12782 |
+ return 0; |
12783 |
+ error: |
12784 |
+- ieee80211_free_hw(mt76_hw(dev)); |
12785 |
++ mt76_free_device(&dev->mt76); |
12786 |
++ |
12787 |
+ return ret; |
12788 |
+ } |
12789 |
+ |
12790 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c |
12791 |
+index 8dc645e398fda..3d62fda067e44 100644 |
12792 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c |
12793 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c |
12794 |
+@@ -1046,15 +1046,17 @@ int mt7615_mac_wtbl_update_key(struct mt7615_dev *dev, |
12795 |
+ if (cmd == SET_KEY) { |
12796 |
+ if (cipher == MT_CIPHER_TKIP) { |
12797 |
+ /* Rx/Tx MIC keys are swapped */ |
12798 |
++ memcpy(data, key, 16); |
12799 |
+ memcpy(data + 16, key + 24, 8); |
12800 |
+ memcpy(data + 24, key + 16, 8); |
12801 |
++ } else { |
12802 |
++ if (cipher != MT_CIPHER_BIP_CMAC_128 && wcid->cipher) |
12803 |
++ memmove(data + 16, data, 16); |
12804 |
++ if (cipher != MT_CIPHER_BIP_CMAC_128 || !wcid->cipher) |
12805 |
++ memcpy(data, key, keylen); |
12806 |
++ else if (cipher == MT_CIPHER_BIP_CMAC_128) |
12807 |
++ memcpy(data + 16, key, 16); |
12808 |
+ } |
12809 |
+- if (cipher != MT_CIPHER_BIP_CMAC_128 && wcid->cipher) |
12810 |
+- memmove(data + 16, data, 16); |
12811 |
+- if (cipher != MT_CIPHER_BIP_CMAC_128 || !wcid->cipher) |
12812 |
+- memcpy(data, key, keylen); |
12813 |
+- else if (cipher == MT_CIPHER_BIP_CMAC_128) |
12814 |
+- memcpy(data + 16, key, 16); |
12815 |
+ } else { |
12816 |
+ if (wcid->cipher & ~BIT(cipher)) { |
12817 |
+ if (cipher != MT_CIPHER_BIP_CMAC_128) |
12818 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c |
12819 |
+index 6de492a4cf025..9b191307e140e 100644 |
12820 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c |
12821 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mmio.c |
12822 |
+@@ -240,7 +240,8 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, |
12823 |
+ |
12824 |
+ return 0; |
12825 |
+ error: |
12826 |
+- ieee80211_free_hw(mt76_hw(dev)); |
12827 |
++ mt76_free_device(&dev->mt76); |
12828 |
++ |
12829 |
+ return ret; |
12830 |
+ } |
12831 |
+ |
12832 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c |
12833 |
+index 2486cda3243bc..69e38f477b1e4 100644 |
12834 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c |
12835 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c |
12836 |
+@@ -150,7 +150,7 @@ static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, |
12837 |
+ return -EBUSY; |
12838 |
+ } else { |
12839 |
+ if (sdio->sched.pse_data_quota < *pse_size + pse_sz || |
12840 |
+- sdio->sched.ple_data_quota < *ple_size) |
12841 |
++ sdio->sched.ple_data_quota < *ple_size + 1) |
12842 |
+ return -EBUSY; |
12843 |
+ |
12844 |
+ *ple_size = *ple_size + 1; |
12845 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c |
12846 |
+index dda11c704abaa..b87d8e136cb9a 100644 |
12847 |
+--- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c |
12848 |
++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c |
12849 |
+@@ -194,7 +194,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
12850 |
+ return 0; |
12851 |
+ |
12852 |
+ error: |
12853 |
+- ieee80211_free_hw(mt76_hw(dev)); |
12854 |
++ mt76_free_device(&dev->mt76); |
12855 |
++ |
12856 |
+ return ret; |
12857 |
+ } |
12858 |
+ |
12859 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c |
12860 |
+index 4d50dad29ddff..ecaf85b483ac3 100644 |
12861 |
+--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c |
12862 |
++++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c |
12863 |
+@@ -90,7 +90,8 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
12864 |
+ return 0; |
12865 |
+ |
12866 |
+ error: |
12867 |
+- ieee80211_free_hw(mt76_hw(dev)); |
12868 |
++ mt76_free_device(&dev->mt76); |
12869 |
++ |
12870 |
+ return ret; |
12871 |
+ } |
12872 |
+ |
12873 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c |
12874 |
+index 1049927faf246..8f2ad32ade180 100644 |
12875 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c |
12876 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c |
12877 |
+@@ -233,6 +233,7 @@ static const struct file_operations fops_tx_stats = { |
12878 |
+ .read = seq_read, |
12879 |
+ .llseek = seq_lseek, |
12880 |
+ .release = single_release, |
12881 |
++ .owner = THIS_MODULE, |
12882 |
+ }; |
12883 |
+ |
12884 |
+ static int mt7915_read_temperature(struct seq_file *s, void *data) |
12885 |
+@@ -460,6 +461,7 @@ static const struct file_operations fops_sta_stats = { |
12886 |
+ .read = seq_read, |
12887 |
+ .llseek = seq_lseek, |
12888 |
+ .release = single_release, |
12889 |
++ .owner = THIS_MODULE, |
12890 |
+ }; |
12891 |
+ |
12892 |
+ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
12893 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c |
12894 |
+index fe62b4d853e48..3ac5bbb94d294 100644 |
12895 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c |
12896 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c |
12897 |
+@@ -140,7 +140,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev, |
12898 |
+ dev = container_of(mdev, struct mt7915_dev, mt76); |
12899 |
+ ret = mt7915_alloc_device(pdev, dev); |
12900 |
+ if (ret) |
12901 |
+- return ret; |
12902 |
++ goto error; |
12903 |
+ |
12904 |
+ mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); |
12905 |
+ mdev->rev = (mt7915_l1_rr(dev, MT_HW_CHIPID) << 16) | |
12906 |
+@@ -163,7 +163,8 @@ static int mt7915_pci_probe(struct pci_dev *pdev, |
12907 |
+ |
12908 |
+ return 0; |
12909 |
+ error: |
12910 |
+- ieee80211_free_hw(mt76_hw(dev)); |
12911 |
++ mt76_free_device(&dev->mt76); |
12912 |
++ |
12913 |
+ return ret; |
12914 |
+ } |
12915 |
+ |
12916 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
12917 |
+index 5337e67092ca6..0f328ce47fee3 100644 |
12918 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
12919 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |
12920 |
+@@ -299,19 +299,19 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
12921 |
+ sysctl_bar = qtnf_map_bar(pdev, QTN_SYSCTL_BAR); |
12922 |
+ if (IS_ERR(sysctl_bar)) { |
12923 |
+ pr_err("failed to map BAR%u\n", QTN_SYSCTL_BAR); |
12924 |
+- return ret; |
12925 |
++ return PTR_ERR(sysctl_bar); |
12926 |
+ } |
12927 |
+ |
12928 |
+ dmareg_bar = qtnf_map_bar(pdev, QTN_DMA_BAR); |
12929 |
+ if (IS_ERR(dmareg_bar)) { |
12930 |
+ pr_err("failed to map BAR%u\n", QTN_DMA_BAR); |
12931 |
+- return ret; |
12932 |
++ return PTR_ERR(dmareg_bar); |
12933 |
+ } |
12934 |
+ |
12935 |
+ epmem_bar = qtnf_map_bar(pdev, QTN_SHMEM_BAR); |
12936 |
+ if (IS_ERR(epmem_bar)) { |
12937 |
+ pr_err("failed to map BAR%u\n", QTN_SHMEM_BAR); |
12938 |
+- return ret; |
12939 |
++ return PTR_ERR(epmem_bar); |
12940 |
+ } |
12941 |
+ |
12942 |
+ chipid = qtnf_chip_id_get(sysctl_bar); |
12943 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c |
12944 |
+index a62d41c0ccbc0..00b5589847985 100644 |
12945 |
+--- a/drivers/net/wireless/rsi/rsi_91x_usb.c |
12946 |
++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c |
12947 |
+@@ -741,24 +741,24 @@ static int rsi_reset_card(struct rsi_hw *adapter) |
12948 |
+ if (ret < 0) |
12949 |
+ goto fail; |
12950 |
+ } else { |
12951 |
+- if ((rsi_usb_master_reg_write(adapter, |
12952 |
+- NWP_WWD_INTERRUPT_TIMER, |
12953 |
+- NWP_WWD_INT_TIMER_CLKS, |
12954 |
+- RSI_9116_REG_SIZE)) < 0) { |
12955 |
++ ret = rsi_usb_master_reg_write(adapter, |
12956 |
++ NWP_WWD_INTERRUPT_TIMER, |
12957 |
++ NWP_WWD_INT_TIMER_CLKS, |
12958 |
++ RSI_9116_REG_SIZE); |
12959 |
++ if (ret < 0) |
12960 |
+ goto fail; |
12961 |
+- } |
12962 |
+- if ((rsi_usb_master_reg_write(adapter, |
12963 |
+- NWP_WWD_SYSTEM_RESET_TIMER, |
12964 |
+- NWP_WWD_SYS_RESET_TIMER_CLKS, |
12965 |
+- RSI_9116_REG_SIZE)) < 0) { |
12966 |
++ ret = rsi_usb_master_reg_write(adapter, |
12967 |
++ NWP_WWD_SYSTEM_RESET_TIMER, |
12968 |
++ NWP_WWD_SYS_RESET_TIMER_CLKS, |
12969 |
++ RSI_9116_REG_SIZE); |
12970 |
++ if (ret < 0) |
12971 |
+ goto fail; |
12972 |
+- } |
12973 |
+- if ((rsi_usb_master_reg_write(adapter, |
12974 |
+- NWP_WWD_MODE_AND_RSTART, |
12975 |
+- NWP_WWD_TIMER_DISABLE, |
12976 |
+- RSI_9116_REG_SIZE)) < 0) { |
12977 |
++ ret = rsi_usb_master_reg_write(adapter, |
12978 |
++ NWP_WWD_MODE_AND_RSTART, |
12979 |
++ NWP_WWD_TIMER_DISABLE, |
12980 |
++ RSI_9116_REG_SIZE); |
12981 |
++ if (ret < 0) |
12982 |
+ goto fail; |
12983 |
+- } |
12984 |
+ } |
12985 |
+ |
12986 |
+ rsi_dbg(INFO_ZONE, "Reset card done\n"); |
12987 |
+diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c |
12988 |
+index f7fe56affbcd2..326b1cc1d2bcb 100644 |
12989 |
+--- a/drivers/net/wireless/st/cw1200/main.c |
12990 |
++++ b/drivers/net/wireless/st/cw1200/main.c |
12991 |
+@@ -381,6 +381,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
12992 |
+ CW1200_LINK_ID_MAX, |
12993 |
+ cw1200_skb_dtor, |
12994 |
+ priv)) { |
12995 |
++ destroy_workqueue(priv->workqueue); |
12996 |
+ ieee80211_free_hw(hw); |
12997 |
+ return NULL; |
12998 |
+ } |
12999 |
+@@ -392,6 +393,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
13000 |
+ for (; i > 0; i--) |
13001 |
+ cw1200_queue_deinit(&priv->tx_queue[i - 1]); |
13002 |
+ cw1200_queue_stats_deinit(&priv->tx_queue_stats); |
13003 |
++ destroy_workqueue(priv->workqueue); |
13004 |
+ ieee80211_free_hw(hw); |
13005 |
+ return NULL; |
13006 |
+ } |
13007 |
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c |
13008 |
+index f1c1624cec8f5..6f10e0998f1ce 100644 |
13009 |
+--- a/drivers/net/xen-netback/xenbus.c |
13010 |
++++ b/drivers/net/xen-netback/xenbus.c |
13011 |
+@@ -557,12 +557,14 @@ static int xen_register_credit_watch(struct xenbus_device *dev, |
13012 |
+ return -ENOMEM; |
13013 |
+ snprintf(node, maxlen, "%s/rate", dev->nodename); |
13014 |
+ vif->credit_watch.node = node; |
13015 |
++ vif->credit_watch.will_handle = NULL; |
13016 |
+ vif->credit_watch.callback = xen_net_rate_changed; |
13017 |
+ err = register_xenbus_watch(&vif->credit_watch); |
13018 |
+ if (err) { |
13019 |
+ pr_err("Failed to set watcher %s\n", vif->credit_watch.node); |
13020 |
+ kfree(node); |
13021 |
+ vif->credit_watch.node = NULL; |
13022 |
++ vif->credit_watch.will_handle = NULL; |
13023 |
+ vif->credit_watch.callback = NULL; |
13024 |
+ } |
13025 |
+ return err; |
13026 |
+@@ -609,6 +611,7 @@ static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev, |
13027 |
+ snprintf(node, maxlen, "%s/request-multicast-control", |
13028 |
+ dev->otherend); |
13029 |
+ vif->mcast_ctrl_watch.node = node; |
13030 |
++ vif->mcast_ctrl_watch.will_handle = NULL; |
13031 |
+ vif->mcast_ctrl_watch.callback = xen_mcast_ctrl_changed; |
13032 |
+ err = register_xenbus_watch(&vif->mcast_ctrl_watch); |
13033 |
+ if (err) { |
13034 |
+@@ -616,6 +619,7 @@ static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev, |
13035 |
+ vif->mcast_ctrl_watch.node); |
13036 |
+ kfree(node); |
13037 |
+ vif->mcast_ctrl_watch.node = NULL; |
13038 |
++ vif->mcast_ctrl_watch.will_handle = NULL; |
13039 |
+ vif->mcast_ctrl_watch.callback = NULL; |
13040 |
+ } |
13041 |
+ return err; |
13042 |
+@@ -820,7 +824,7 @@ static void connect(struct backend_info *be) |
13043 |
+ xenvif_carrier_on(be->vif); |
13044 |
+ |
13045 |
+ unregister_hotplug_status_watch(be); |
13046 |
+- err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, |
13047 |
++ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL, |
13048 |
+ hotplug_status_changed, |
13049 |
+ "%s/%s", dev->nodename, "hotplug-status"); |
13050 |
+ if (!err) |
13051 |
+diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c |
13052 |
+index ec930ee2c847e..64df50827642b 100644 |
13053 |
+--- a/drivers/nfc/s3fwrn5/firmware.c |
13054 |
++++ b/drivers/nfc/s3fwrn5/firmware.c |
13055 |
+@@ -293,8 +293,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info) |
13056 |
+ if (ret < 0) |
13057 |
+ return ret; |
13058 |
+ |
13059 |
+- if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) |
13060 |
++ if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) { |
13061 |
++ release_firmware(fw->fw); |
13062 |
+ return -EINVAL; |
13063 |
++ } |
13064 |
+ |
13065 |
+ memcpy(fw->date, fw->fw->data + 0x00, 12); |
13066 |
+ fw->date[12] = '\0'; |
13067 |
+diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c |
13068 |
+index 47a4828b8b310..9251441fd8a35 100644 |
13069 |
+--- a/drivers/nvdimm/label.c |
13070 |
++++ b/drivers/nvdimm/label.c |
13071 |
+@@ -980,6 +980,15 @@ static int __blk_label_update(struct nd_region *nd_region, |
13072 |
+ } |
13073 |
+ } |
13074 |
+ |
13075 |
++ /* release slots associated with any invalidated UUIDs */ |
13076 |
++ mutex_lock(&nd_mapping->lock); |
13077 |
++ list_for_each_entry_safe(label_ent, e, &nd_mapping->labels, list) |
13078 |
++ if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags)) { |
13079 |
++ reap_victim(nd_mapping, label_ent); |
13080 |
++ list_move(&label_ent->list, &list); |
13081 |
++ } |
13082 |
++ mutex_unlock(&nd_mapping->lock); |
13083 |
++ |
13084 |
+ /* |
13085 |
+ * Find the resource associated with the first label in the set |
13086 |
+ * per the v1.2 namespace specification. |
13087 |
+@@ -999,8 +1008,10 @@ static int __blk_label_update(struct nd_region *nd_region, |
13088 |
+ if (is_old_resource(res, old_res_list, old_num_resources)) |
13089 |
+ continue; /* carry-over */ |
13090 |
+ slot = nd_label_alloc_slot(ndd); |
13091 |
+- if (slot == UINT_MAX) |
13092 |
++ if (slot == UINT_MAX) { |
13093 |
++ rc = -ENXIO; |
13094 |
+ goto abort; |
13095 |
++ } |
13096 |
+ dev_dbg(ndd->dev, "allocated: %d\n", slot); |
13097 |
+ |
13098 |
+ nd_label = to_label(ndd, slot); |
13099 |
+diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c |
13100 |
+index bea86899bd5df..9c3d2982248d3 100644 |
13101 |
+--- a/drivers/pci/controller/pcie-brcmstb.c |
13102 |
++++ b/drivers/pci/controller/pcie-brcmstb.c |
13103 |
+@@ -893,6 +893,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) |
13104 |
+ burst = 0x2; /* 512 bytes */ |
13105 |
+ |
13106 |
+ /* Set SCB_MAX_BURST_SIZE, CFG_READ_UR_MODE, SCB_ACCESS_EN */ |
13107 |
++ tmp = readl(base + PCIE_MISC_MISC_CTRL); |
13108 |
+ u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK); |
13109 |
+ u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE_MASK); |
13110 |
+ u32p_replace_bits(&tmp, burst, PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_MASK); |
13111 |
+diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c |
13112 |
+index 905e938082432..cc5b7823edeb7 100644 |
13113 |
+--- a/drivers/pci/controller/pcie-iproc.c |
13114 |
++++ b/drivers/pci/controller/pcie-iproc.c |
13115 |
+@@ -192,8 +192,15 @@ static const struct iproc_pcie_ib_map paxb_v2_ib_map[] = { |
13116 |
+ .imap_window_offset = 0x4, |
13117 |
+ }, |
13118 |
+ { |
13119 |
+- /* IARR1/IMAP1 (currently unused) */ |
13120 |
+- .type = IPROC_PCIE_IB_MAP_INVALID, |
13121 |
++ /* IARR1/IMAP1 */ |
13122 |
++ .type = IPROC_PCIE_IB_MAP_MEM, |
13123 |
++ .size_unit = SZ_1M, |
13124 |
++ .region_sizes = { 8 }, |
13125 |
++ .nr_sizes = 1, |
13126 |
++ .nr_windows = 8, |
13127 |
++ .imap_addr_offset = 0x4, |
13128 |
++ .imap_window_offset = 0x8, |
13129 |
++ |
13130 |
+ }, |
13131 |
+ { |
13132 |
+ /* IARR2/IMAP2 */ |
13133 |
+@@ -307,7 +314,7 @@ enum iproc_pcie_reg { |
13134 |
+ }; |
13135 |
+ |
13136 |
+ /* iProc PCIe PAXB BCMA registers */ |
13137 |
+-static const u16 iproc_pcie_reg_paxb_bcma[] = { |
13138 |
++static const u16 iproc_pcie_reg_paxb_bcma[IPROC_PCIE_MAX_NUM_REG] = { |
13139 |
+ [IPROC_PCIE_CLK_CTRL] = 0x000, |
13140 |
+ [IPROC_PCIE_CFG_IND_ADDR] = 0x120, |
13141 |
+ [IPROC_PCIE_CFG_IND_DATA] = 0x124, |
13142 |
+@@ -318,7 +325,7 @@ static const u16 iproc_pcie_reg_paxb_bcma[] = { |
13143 |
+ }; |
13144 |
+ |
13145 |
+ /* iProc PCIe PAXB registers */ |
13146 |
+-static const u16 iproc_pcie_reg_paxb[] = { |
13147 |
++static const u16 iproc_pcie_reg_paxb[IPROC_PCIE_MAX_NUM_REG] = { |
13148 |
+ [IPROC_PCIE_CLK_CTRL] = 0x000, |
13149 |
+ [IPROC_PCIE_CFG_IND_ADDR] = 0x120, |
13150 |
+ [IPROC_PCIE_CFG_IND_DATA] = 0x124, |
13151 |
+@@ -334,7 +341,7 @@ static const u16 iproc_pcie_reg_paxb[] = { |
13152 |
+ }; |
13153 |
+ |
13154 |
+ /* iProc PCIe PAXB v2 registers */ |
13155 |
+-static const u16 iproc_pcie_reg_paxb_v2[] = { |
13156 |
++static const u16 iproc_pcie_reg_paxb_v2[IPROC_PCIE_MAX_NUM_REG] = { |
13157 |
+ [IPROC_PCIE_CLK_CTRL] = 0x000, |
13158 |
+ [IPROC_PCIE_CFG_IND_ADDR] = 0x120, |
13159 |
+ [IPROC_PCIE_CFG_IND_DATA] = 0x124, |
13160 |
+@@ -351,6 +358,8 @@ static const u16 iproc_pcie_reg_paxb_v2[] = { |
13161 |
+ [IPROC_PCIE_OMAP3] = 0xdf8, |
13162 |
+ [IPROC_PCIE_IARR0] = 0xd00, |
13163 |
+ [IPROC_PCIE_IMAP0] = 0xc00, |
13164 |
++ [IPROC_PCIE_IARR1] = 0xd08, |
13165 |
++ [IPROC_PCIE_IMAP1] = 0xd70, |
13166 |
+ [IPROC_PCIE_IARR2] = 0xd10, |
13167 |
+ [IPROC_PCIE_IMAP2] = 0xcc0, |
13168 |
+ [IPROC_PCIE_IARR3] = 0xe00, |
13169 |
+@@ -363,7 +372,7 @@ static const u16 iproc_pcie_reg_paxb_v2[] = { |
13170 |
+ }; |
13171 |
+ |
13172 |
+ /* iProc PCIe PAXC v1 registers */ |
13173 |
+-static const u16 iproc_pcie_reg_paxc[] = { |
13174 |
++static const u16 iproc_pcie_reg_paxc[IPROC_PCIE_MAX_NUM_REG] = { |
13175 |
+ [IPROC_PCIE_CLK_CTRL] = 0x000, |
13176 |
+ [IPROC_PCIE_CFG_IND_ADDR] = 0x1f0, |
13177 |
+ [IPROC_PCIE_CFG_IND_DATA] = 0x1f4, |
13178 |
+@@ -372,7 +381,7 @@ static const u16 iproc_pcie_reg_paxc[] = { |
13179 |
+ }; |
13180 |
+ |
13181 |
+ /* iProc PCIe PAXC v2 registers */ |
13182 |
+-static const u16 iproc_pcie_reg_paxc_v2[] = { |
13183 |
++static const u16 iproc_pcie_reg_paxc_v2[IPROC_PCIE_MAX_NUM_REG] = { |
13184 |
+ [IPROC_PCIE_MSI_GIC_MODE] = 0x050, |
13185 |
+ [IPROC_PCIE_MSI_BASE_ADDR] = 0x074, |
13186 |
+ [IPROC_PCIE_MSI_WINDOW_SIZE] = 0x078, |
13187 |
+diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c |
13188 |
+index bf03648c20723..745a4e0c4994f 100644 |
13189 |
+--- a/drivers/pci/pci-acpi.c |
13190 |
++++ b/drivers/pci/pci-acpi.c |
13191 |
+@@ -1060,7 +1060,7 @@ static int acpi_pci_propagate_wakeup(struct pci_bus *bus, bool enable) |
13192 |
+ { |
13193 |
+ while (bus->parent) { |
13194 |
+ if (acpi_pm_device_can_wakeup(&bus->self->dev)) |
13195 |
+- return acpi_pm_set_bridge_wakeup(&bus->self->dev, enable); |
13196 |
++ return acpi_pm_set_device_wakeup(&bus->self->dev, enable); |
13197 |
+ |
13198 |
+ bus = bus->parent; |
13199 |
+ } |
13200 |
+@@ -1068,7 +1068,7 @@ static int acpi_pci_propagate_wakeup(struct pci_bus *bus, bool enable) |
13201 |
+ /* We have reached the root bus. */ |
13202 |
+ if (bus->bridge) { |
13203 |
+ if (acpi_pm_device_can_wakeup(bus->bridge)) |
13204 |
+- return acpi_pm_set_bridge_wakeup(bus->bridge, enable); |
13205 |
++ return acpi_pm_set_device_wakeup(bus->bridge, enable); |
13206 |
+ } |
13207 |
+ return 0; |
13208 |
+ } |
13209 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
13210 |
+index e578d34095e91..6427cbd0a5be2 100644 |
13211 |
+--- a/drivers/pci/pci.c |
13212 |
++++ b/drivers/pci/pci.c |
13213 |
+@@ -6202,19 +6202,21 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev, |
13214 |
+ while (*p) { |
13215 |
+ count = 0; |
13216 |
+ if (sscanf(p, "%d%n", &align_order, &count) == 1 && |
13217 |
+- p[count] == '@') { |
13218 |
++ p[count] == '@') { |
13219 |
+ p += count + 1; |
13220 |
++ if (align_order > 63) { |
13221 |
++ pr_err("PCI: Invalid requested alignment (order %d)\n", |
13222 |
++ align_order); |
13223 |
++ align_order = PAGE_SHIFT; |
13224 |
++ } |
13225 |
+ } else { |
13226 |
+- align_order = -1; |
13227 |
++ align_order = PAGE_SHIFT; |
13228 |
+ } |
13229 |
+ |
13230 |
+ ret = pci_dev_str_match(dev, p, &p); |
13231 |
+ if (ret == 1) { |
13232 |
+ *resize = true; |
13233 |
+- if (align_order == -1) |
13234 |
+- align = PAGE_SIZE; |
13235 |
+- else |
13236 |
+- align = 1 << align_order; |
13237 |
++ align = 1ULL << align_order; |
13238 |
+ break; |
13239 |
+ } else if (ret < 0) { |
13240 |
+ pr_err("PCI: Can't parse resource_alignment parameter: %s\n", |
13241 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
13242 |
+index f70692ac79c56..fb1dc11e7cc52 100644 |
13243 |
+--- a/drivers/pci/quirks.c |
13244 |
++++ b/drivers/pci/quirks.c |
13245 |
+@@ -5567,17 +5567,26 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev) |
13246 |
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme); |
13247 |
+ |
13248 |
+ /* |
13249 |
+- * Device [12d8:0x400e] and [12d8:0x400f] |
13250 |
++ * Device 12d8:0x400e [OHCI] and 12d8:0x400f [EHCI] |
13251 |
++ * |
13252 |
+ * These devices advertise PME# support in all power states but don't |
13253 |
+ * reliably assert it. |
13254 |
++ * |
13255 |
++ * These devices also advertise MSI, but documentation (PI7C9X440SL.pdf) |
13256 |
++ * says "The MSI Function is not implemented on this device" in chapters |
13257 |
++ * 7.3.27, 7.3.29-7.3.31. |
13258 |
+ */ |
13259 |
+-static void pci_fixup_no_pme(struct pci_dev *dev) |
13260 |
++static void pci_fixup_no_msi_no_pme(struct pci_dev *dev) |
13261 |
+ { |
13262 |
++#ifdef CONFIG_PCI_MSI |
13263 |
++ pci_info(dev, "MSI is not implemented on this device, disabling it\n"); |
13264 |
++ dev->no_msi = 1; |
13265 |
++#endif |
13266 |
+ pci_info(dev, "PME# is unreliable, disabling it\n"); |
13267 |
+ dev->pme_support = 0; |
13268 |
+ } |
13269 |
+-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_pme); |
13270 |
+-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_pme); |
13271 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_msi_no_pme); |
13272 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_msi_no_pme); |
13273 |
+ |
13274 |
+ static void apex_pci_fixup_class(struct pci_dev *pdev) |
13275 |
+ { |
13276 |
+diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c |
13277 |
+index 3861505741e6d..ed2077e7470ae 100644 |
13278 |
+--- a/drivers/pci/slot.c |
13279 |
++++ b/drivers/pci/slot.c |
13280 |
+@@ -272,6 +272,9 @@ placeholder: |
13281 |
+ goto err; |
13282 |
+ } |
13283 |
+ |
13284 |
++ INIT_LIST_HEAD(&slot->list); |
13285 |
++ list_add(&slot->list, &parent->slots); |
13286 |
++ |
13287 |
+ err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL, |
13288 |
+ "%s", slot_name); |
13289 |
+ if (err) { |
13290 |
+@@ -279,9 +282,6 @@ placeholder: |
13291 |
+ goto err; |
13292 |
+ } |
13293 |
+ |
13294 |
+- INIT_LIST_HEAD(&slot->list); |
13295 |
+- list_add(&slot->list, &parent->slots); |
13296 |
+- |
13297 |
+ down_read(&pci_bus_sem); |
13298 |
+ list_for_each_entry(dev, &parent->devices, bus_list) |
13299 |
+ if (PCI_SLOT(dev->devfn) == slot_nr) |
13300 |
+diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig |
13301 |
+index c8126bde9d7cc..43150608d8b62 100644 |
13302 |
+--- a/drivers/phy/mediatek/Kconfig |
13303 |
++++ b/drivers/phy/mediatek/Kconfig |
13304 |
+@@ -38,7 +38,9 @@ config PHY_MTK_XSPHY |
13305 |
+ |
13306 |
+ config PHY_MTK_HDMI |
13307 |
+ tristate "MediaTek HDMI-PHY Driver" |
13308 |
+- depends on ARCH_MEDIATEK && OF |
13309 |
++ depends on ARCH_MEDIATEK || COMPILE_TEST |
13310 |
++ depends on COMMON_CLK |
13311 |
++ depends on OF |
13312 |
+ select GENERIC_PHY |
13313 |
+ help |
13314 |
+ Support HDMI PHY for Mediatek SoCs. |
13315 |
+diff --git a/drivers/phy/mediatek/phy-mtk-hdmi.c b/drivers/phy/mediatek/phy-mtk-hdmi.c |
13316 |
+index 47c029d4b270b..206cc34687223 100644 |
13317 |
+--- a/drivers/phy/mediatek/phy-mtk-hdmi.c |
13318 |
++++ b/drivers/phy/mediatek/phy-mtk-hdmi.c |
13319 |
+@@ -84,8 +84,9 @@ mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy) |
13320 |
+ hdmi_phy->conf->hdmi_phy_disable_tmds) |
13321 |
+ return &mtk_hdmi_phy_dev_ops; |
13322 |
+ |
13323 |
+- dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); |
13324 |
+- return NULL; |
13325 |
++ if (hdmi_phy) |
13326 |
++ dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); |
13327 |
++ return NULL; |
13328 |
+ } |
13329 |
+ |
13330 |
+ static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy, |
13331 |
+diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
13332 |
+index e34e4475027ca..2cb949f931b69 100644 |
13333 |
+--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
13334 |
++++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c |
13335 |
+@@ -656,8 +656,10 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) |
13336 |
+ */ |
13337 |
+ pm_runtime_enable(dev); |
13338 |
+ phy_usb2_ops = of_device_get_match_data(dev); |
13339 |
+- if (!phy_usb2_ops) |
13340 |
+- return -EINVAL; |
13341 |
++ if (!phy_usb2_ops) { |
13342 |
++ ret = -EINVAL; |
13343 |
++ goto error; |
13344 |
++ } |
13345 |
+ |
13346 |
+ mutex_init(&channel->lock); |
13347 |
+ for (i = 0; i < NUM_OF_PHYS; i++) { |
13348 |
+diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c |
13349 |
+index ad88d74c18842..181a1be5f4917 100644 |
13350 |
+--- a/drivers/phy/tegra/xusb.c |
13351 |
++++ b/drivers/phy/tegra/xusb.c |
13352 |
+@@ -688,7 +688,7 @@ static int tegra_xusb_setup_usb_role_switch(struct tegra_xusb_port *port) |
13353 |
+ * reference to retrieve usb-phy details. |
13354 |
+ */ |
13355 |
+ port->usb_phy.dev = &lane->pad->lanes[port->index]->dev; |
13356 |
+- port->usb_phy.dev->driver = port->padctl->dev->driver; |
13357 |
++ port->usb_phy.dev->driver = port->dev.driver; |
13358 |
+ port->usb_phy.otg->usb_phy = &port->usb_phy; |
13359 |
+ port->usb_phy.otg->set_peripheral = tegra_xusb_set_peripheral; |
13360 |
+ port->usb_phy.otg->set_host = tegra_xusb_set_host; |
13361 |
+diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c |
13362 |
+index 3663d87f51a01..9fc4433fece4f 100644 |
13363 |
+--- a/drivers/pinctrl/core.c |
13364 |
++++ b/drivers/pinctrl/core.c |
13365 |
+@@ -1602,9 +1602,11 @@ static int pinctrl_pins_show(struct seq_file *s, void *what) |
13366 |
+ struct pinctrl_dev *pctldev = s->private; |
13367 |
+ const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
13368 |
+ unsigned i, pin; |
13369 |
++#ifdef CONFIG_GPIOLIB |
13370 |
+ struct pinctrl_gpio_range *range; |
13371 |
+ unsigned int gpio_num; |
13372 |
+ struct gpio_chip *chip; |
13373 |
++#endif |
13374 |
+ |
13375 |
+ seq_printf(s, "registered pins: %d\n", pctldev->desc->npins); |
13376 |
+ |
13377 |
+diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c |
13378 |
+index 62c02b969327f..7521a924dffb0 100644 |
13379 |
+--- a/drivers/pinctrl/pinctrl-falcon.c |
13380 |
++++ b/drivers/pinctrl/pinctrl-falcon.c |
13381 |
+@@ -431,24 +431,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) |
13382 |
+ |
13383 |
+ /* load and remap the pad resources of the different banks */ |
13384 |
+ for_each_compatible_node(np, NULL, "lantiq,pad-falcon") { |
13385 |
+- struct platform_device *ppdev = of_find_device_by_node(np); |
13386 |
+ const __be32 *bank = of_get_property(np, "lantiq,bank", NULL); |
13387 |
+ struct resource res; |
13388 |
++ struct platform_device *ppdev; |
13389 |
+ u32 avail; |
13390 |
+ int pins; |
13391 |
+ |
13392 |
+ if (!of_device_is_available(np)) |
13393 |
+ continue; |
13394 |
+ |
13395 |
+- if (!ppdev) { |
13396 |
+- dev_err(&pdev->dev, "failed to find pad pdev\n"); |
13397 |
+- continue; |
13398 |
+- } |
13399 |
+ if (!bank || *bank >= PORTS) |
13400 |
+ continue; |
13401 |
+ if (of_address_to_resource(np, 0, &res)) |
13402 |
+ continue; |
13403 |
++ |
13404 |
++ ppdev = of_find_device_by_node(np); |
13405 |
++ if (!ppdev) { |
13406 |
++ dev_err(&pdev->dev, "failed to find pad pdev\n"); |
13407 |
++ continue; |
13408 |
++ } |
13409 |
++ |
13410 |
+ falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL); |
13411 |
++ put_device(&ppdev->dev); |
13412 |
+ if (IS_ERR(falcon_info.clk[*bank])) { |
13413 |
+ dev_err(&ppdev->dev, "failed to get clock\n"); |
13414 |
+ of_node_put(np); |
13415 |
+diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c |
13416 |
+index 19cfd1e76ee2c..e69f6da40dc0a 100644 |
13417 |
+--- a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c |
13418 |
++++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100.c |
13419 |
+@@ -677,7 +677,7 @@ static const struct sunxi_desc_pin a100_pins[] = { |
13420 |
+ SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 19)), |
13421 |
+ }; |
13422 |
+ |
13423 |
+-static const unsigned int a100_irq_bank_map[] = { 0, 1, 2, 3, 4, 5, 6}; |
13424 |
++static const unsigned int a100_irq_bank_map[] = { 1, 2, 3, 4, 5, 6, 7}; |
13425 |
+ |
13426 |
+ static const struct sunxi_pinctrl_desc a100_pinctrl_data = { |
13427 |
+ .pins = a100_pins, |
13428 |
+diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
13429 |
+index 8e792f8e2dc9a..e42a3a0005a72 100644 |
13430 |
+--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
13431 |
++++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c |
13432 |
+@@ -1142,20 +1142,22 @@ static void sunxi_pinctrl_irq_handler(struct irq_desc *desc) |
13433 |
+ if (bank == pctl->desc->irq_banks) |
13434 |
+ return; |
13435 |
+ |
13436 |
++ chained_irq_enter(chip, desc); |
13437 |
++ |
13438 |
+ reg = sunxi_irq_status_reg_from_bank(pctl->desc, bank); |
13439 |
+ val = readl(pctl->membase + reg); |
13440 |
+ |
13441 |
+ if (val) { |
13442 |
+ int irqoffset; |
13443 |
+ |
13444 |
+- chained_irq_enter(chip, desc); |
13445 |
+ for_each_set_bit(irqoffset, &val, IRQ_PER_BANK) { |
13446 |
+ int pin_irq = irq_find_mapping(pctl->domain, |
13447 |
+ bank * IRQ_PER_BANK + irqoffset); |
13448 |
+ generic_handle_irq(pin_irq); |
13449 |
+ } |
13450 |
+- chained_irq_exit(chip, desc); |
13451 |
+ } |
13452 |
++ |
13453 |
++ chained_irq_exit(chip, desc); |
13454 |
+ } |
13455 |
+ |
13456 |
+ static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl, |
13457 |
+diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c |
13458 |
+index dfa1f816a45f4..f9df218fc2bbe 100644 |
13459 |
+--- a/drivers/platform/chrome/cros_ec_spi.c |
13460 |
++++ b/drivers/platform/chrome/cros_ec_spi.c |
13461 |
+@@ -742,7 +742,6 @@ static int cros_ec_spi_probe(struct spi_device *spi) |
13462 |
+ int err; |
13463 |
+ |
13464 |
+ spi->bits_per_word = 8; |
13465 |
+- spi->mode = SPI_MODE_0; |
13466 |
+ spi->rt = true; |
13467 |
+ err = spi_setup(spi); |
13468 |
+ if (err < 0) |
13469 |
+diff --git a/drivers/platform/x86/dell-smbios-base.c b/drivers/platform/x86/dell-smbios-base.c |
13470 |
+index 2e2cd565926aa..3a1dbf1994413 100644 |
13471 |
+--- a/drivers/platform/x86/dell-smbios-base.c |
13472 |
++++ b/drivers/platform/x86/dell-smbios-base.c |
13473 |
+@@ -594,6 +594,7 @@ static int __init dell_smbios_init(void) |
13474 |
+ if (wmi && smm) { |
13475 |
+ pr_err("No SMBIOS backends available (wmi: %d, smm: %d)\n", |
13476 |
+ wmi, smm); |
13477 |
++ ret = -ENODEV; |
13478 |
+ goto fail_create_group; |
13479 |
+ } |
13480 |
+ |
13481 |
+diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c |
13482 |
+index 0419c8001fe33..3b49a1f4061bc 100644 |
13483 |
+--- a/drivers/platform/x86/intel-vbtn.c |
13484 |
++++ b/drivers/platform/x86/intel-vbtn.c |
13485 |
+@@ -15,9 +15,13 @@ |
13486 |
+ #include <linux/platform_device.h> |
13487 |
+ #include <linux/suspend.h> |
13488 |
+ |
13489 |
++/* Returned when NOT in tablet mode on some HP Stream x360 11 models */ |
13490 |
++#define VGBS_TABLET_MODE_FLAG_ALT 0x10 |
13491 |
+ /* When NOT in tablet mode, VGBS returns with the flag 0x40 */ |
13492 |
+-#define TABLET_MODE_FLAG 0x40 |
13493 |
+-#define DOCK_MODE_FLAG 0x80 |
13494 |
++#define VGBS_TABLET_MODE_FLAG 0x40 |
13495 |
++#define VGBS_DOCK_MODE_FLAG 0x80 |
13496 |
++ |
13497 |
++#define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT) |
13498 |
+ |
13499 |
+ MODULE_LICENSE("GPL"); |
13500 |
+ MODULE_AUTHOR("AceLan Kao"); |
13501 |
+@@ -72,9 +76,9 @@ static void detect_tablet_mode(struct platform_device *device) |
13502 |
+ if (ACPI_FAILURE(status)) |
13503 |
+ return; |
13504 |
+ |
13505 |
+- m = !(vgbs & TABLET_MODE_FLAG); |
13506 |
++ m = !(vgbs & VGBS_TABLET_MODE_FLAGS); |
13507 |
+ input_report_switch(priv->input_dev, SW_TABLET_MODE, m); |
13508 |
+- m = (vgbs & DOCK_MODE_FLAG) ? 1 : 0; |
13509 |
++ m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0; |
13510 |
+ input_report_switch(priv->input_dev, SW_DOCK, m); |
13511 |
+ } |
13512 |
+ |
13513 |
+@@ -212,6 +216,12 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { |
13514 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion 13 x360 PC"), |
13515 |
+ }, |
13516 |
+ }, |
13517 |
++ { |
13518 |
++ .matches = { |
13519 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
13520 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271"), |
13521 |
++ }, |
13522 |
++ }, |
13523 |
+ {} /* Array terminator */ |
13524 |
+ }; |
13525 |
+ |
13526 |
+diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c |
13527 |
+index 986ad3dda1c10..8bce3da32a42b 100644 |
13528 |
+--- a/drivers/platform/x86/mlx-platform.c |
13529 |
++++ b/drivers/platform/x86/mlx-platform.c |
13530 |
+@@ -319,15 +319,6 @@ static struct i2c_mux_reg_platform_data mlxplat_extended_mux_data[] = { |
13531 |
+ }; |
13532 |
+ |
13533 |
+ /* Platform hotplug devices */ |
13534 |
+-static struct i2c_board_info mlxplat_mlxcpld_psu[] = { |
13535 |
+- { |
13536 |
+- I2C_BOARD_INFO("24c02", 0x51), |
13537 |
+- }, |
13538 |
+- { |
13539 |
+- I2C_BOARD_INFO("24c02", 0x50), |
13540 |
+- }, |
13541 |
+-}; |
13542 |
+- |
13543 |
+ static struct i2c_board_info mlxplat_mlxcpld_pwr[] = { |
13544 |
+ { |
13545 |
+ I2C_BOARD_INFO("dps460", 0x59), |
13546 |
+@@ -383,15 +374,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_psu_items_data[] = { |
13547 |
+ .label = "psu1", |
13548 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
13549 |
+ .mask = BIT(0), |
13550 |
+- .hpdev.brdinfo = &mlxplat_mlxcpld_psu[0], |
13551 |
+- .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, |
13552 |
++ .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
13553 |
+ }, |
13554 |
+ { |
13555 |
+ .label = "psu2", |
13556 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
13557 |
+ .mask = BIT(1), |
13558 |
+- .hpdev.brdinfo = &mlxplat_mlxcpld_psu[1], |
13559 |
+- .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, |
13560 |
++ .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
13561 |
+ }, |
13562 |
+ }; |
13563 |
+ |
13564 |
+@@ -458,7 +447,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { |
13565 |
+ .aggr_mask = MLXPLAT_CPLD_AGGR_PSU_MASK_DEF, |
13566 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
13567 |
+ .mask = MLXPLAT_CPLD_PSU_MASK, |
13568 |
+- .count = ARRAY_SIZE(mlxplat_mlxcpld_psu), |
13569 |
++ .count = ARRAY_SIZE(mlxplat_mlxcpld_default_psu_items_data), |
13570 |
+ .inversed = 1, |
13571 |
+ .health = false, |
13572 |
+ }, |
13573 |
+@@ -467,7 +456,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { |
13574 |
+ .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, |
13575 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, |
13576 |
+ .mask = MLXPLAT_CPLD_PWR_MASK, |
13577 |
+- .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr), |
13578 |
++ .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), |
13579 |
+ .inversed = 0, |
13580 |
+ .health = false, |
13581 |
+ }, |
13582 |
+@@ -476,7 +465,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { |
13583 |
+ .aggr_mask = MLXPLAT_CPLD_AGGR_FAN_MASK_DEF, |
13584 |
+ .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, |
13585 |
+ .mask = MLXPLAT_CPLD_FAN_MASK, |
13586 |
+- .count = ARRAY_SIZE(mlxplat_mlxcpld_fan), |
13587 |
++ .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), |
13588 |
+ .inversed = 1, |
13589 |
+ .health = false, |
13590 |
+ }, |
13591 |
+@@ -497,7 +486,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { |
13592 |
+ .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, |
13593 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
13594 |
+ .mask = MLXPLAT_CPLD_PSU_MASK, |
13595 |
+- .count = ARRAY_SIZE(mlxplat_mlxcpld_psu), |
13596 |
++ .count = ARRAY_SIZE(mlxplat_mlxcpld_default_psu_items_data), |
13597 |
+ .inversed = 1, |
13598 |
+ .health = false, |
13599 |
+ }, |
13600 |
+@@ -506,7 +495,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { |
13601 |
+ .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, |
13602 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, |
13603 |
+ .mask = MLXPLAT_CPLD_PWR_MASK, |
13604 |
+- .count = ARRAY_SIZE(mlxplat_mlxcpld_pwr), |
13605 |
++ .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), |
13606 |
+ .inversed = 0, |
13607 |
+ .health = false, |
13608 |
+ }, |
13609 |
+@@ -515,7 +504,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { |
13610 |
+ .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, |
13611 |
+ .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, |
13612 |
+ .mask = MLXPLAT_CPLD_FAN_MASK, |
13613 |
+- .count = ARRAY_SIZE(mlxplat_mlxcpld_fan), |
13614 |
++ .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), |
13615 |
+ .inversed = 1, |
13616 |
+ .health = false, |
13617 |
+ }, |
13618 |
+@@ -603,15 +592,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_msn274x_psu_items_data[] = { |
13619 |
+ .label = "psu1", |
13620 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
13621 |
+ .mask = BIT(0), |
13622 |
+- .hpdev.brdinfo = &mlxplat_mlxcpld_psu[0], |
13623 |
+- .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, |
13624 |
++ .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
13625 |
+ }, |
13626 |
+ { |
13627 |
+ .label = "psu2", |
13628 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
13629 |
+ .mask = BIT(1), |
13630 |
+- .hpdev.brdinfo = &mlxplat_mlxcpld_psu[1], |
13631 |
+- .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, |
13632 |
++ .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
13633 |
+ }, |
13634 |
+ }; |
13635 |
+ |
13636 |
+diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c |
13637 |
+index 9d981b76c1e72..a4df1ea923864 100644 |
13638 |
+--- a/drivers/power/supply/axp288_charger.c |
13639 |
++++ b/drivers/power/supply/axp288_charger.c |
13640 |
+@@ -548,14 +548,15 @@ out: |
13641 |
+ |
13642 |
+ /* |
13643 |
+ * The HP Pavilion x2 10 series comes in a number of variants: |
13644 |
+- * Bay Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "815D" |
13645 |
+- * Cherry Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "813E" |
13646 |
+- * Cherry Trail SoC + TI PMIC, DMI_BOARD_NAME: "827C" or "82F4" |
13647 |
++ * Bay Trail SoC + AXP288 PMIC, Micro-USB, DMI_BOARD_NAME: "8021" |
13648 |
++ * Bay Trail SoC + AXP288 PMIC, Type-C, DMI_BOARD_NAME: "815D" |
13649 |
++ * Cherry Trail SoC + AXP288 PMIC, Type-C, DMI_BOARD_NAME: "813E" |
13650 |
++ * Cherry Trail SoC + TI PMIC, Type-C, DMI_BOARD_NAME: "827C" or "82F4" |
13651 |
+ * |
13652 |
+- * The variants with the AXP288 PMIC are all kinds of special: |
13653 |
++ * The variants with the AXP288 + Type-C connector are all kinds of special: |
13654 |
+ * |
13655 |
+- * 1. All variants use a Type-C connector which the AXP288 does not support, so |
13656 |
+- * when using a Type-C charger it is not recognized. Unlike most AXP288 devices, |
13657 |
++ * 1. They use a Type-C connector which the AXP288 does not support, so when |
13658 |
++ * using a Type-C charger it is not recognized. Unlike most AXP288 devices, |
13659 |
+ * this model actually has mostly working ACPI AC / Battery code, the ACPI code |
13660 |
+ * "solves" this by simply setting the input_current_limit to 3A. |
13661 |
+ * There are still some issues with the ACPI code, so we use this native driver, |
13662 |
+@@ -578,12 +579,17 @@ out: |
13663 |
+ */ |
13664 |
+ static const struct dmi_system_id axp288_hp_x2_dmi_ids[] = { |
13665 |
+ { |
13666 |
+- /* |
13667 |
+- * Bay Trail model has "Hewlett-Packard" as sys_vendor, Cherry |
13668 |
+- * Trail model has "HP", so we only match on product_name. |
13669 |
+- */ |
13670 |
+ .matches = { |
13671 |
+- DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), |
13672 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
13673 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), |
13674 |
++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "815D"), |
13675 |
++ }, |
13676 |
++ }, |
13677 |
++ { |
13678 |
++ .matches = { |
13679 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "HP"), |
13680 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), |
13681 |
++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "813E"), |
13682 |
+ }, |
13683 |
+ }, |
13684 |
+ {} /* Terminating entry */ |
13685 |
+diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c |
13686 |
+index d14186525e1e9..845af0f44c022 100644 |
13687 |
+--- a/drivers/power/supply/bq24190_charger.c |
13688 |
++++ b/drivers/power/supply/bq24190_charger.c |
13689 |
+@@ -448,8 +448,10 @@ static ssize_t bq24190_sysfs_show(struct device *dev, |
13690 |
+ return -EINVAL; |
13691 |
+ |
13692 |
+ ret = pm_runtime_get_sync(bdi->dev); |
13693 |
+- if (ret < 0) |
13694 |
++ if (ret < 0) { |
13695 |
++ pm_runtime_put_noidle(bdi->dev); |
13696 |
+ return ret; |
13697 |
++ } |
13698 |
+ |
13699 |
+ ret = bq24190_read_mask(bdi, info->reg, info->mask, info->shift, &v); |
13700 |
+ if (ret) |
13701 |
+@@ -1077,8 +1079,10 @@ static int bq24190_charger_get_property(struct power_supply *psy, |
13702 |
+ dev_dbg(bdi->dev, "prop: %d\n", psp); |
13703 |
+ |
13704 |
+ ret = pm_runtime_get_sync(bdi->dev); |
13705 |
+- if (ret < 0) |
13706 |
++ if (ret < 0) { |
13707 |
++ pm_runtime_put_noidle(bdi->dev); |
13708 |
+ return ret; |
13709 |
++ } |
13710 |
+ |
13711 |
+ switch (psp) { |
13712 |
+ case POWER_SUPPLY_PROP_CHARGE_TYPE: |
13713 |
+@@ -1149,8 +1153,10 @@ static int bq24190_charger_set_property(struct power_supply *psy, |
13714 |
+ dev_dbg(bdi->dev, "prop: %d\n", psp); |
13715 |
+ |
13716 |
+ ret = pm_runtime_get_sync(bdi->dev); |
13717 |
+- if (ret < 0) |
13718 |
++ if (ret < 0) { |
13719 |
++ pm_runtime_put_noidle(bdi->dev); |
13720 |
+ return ret; |
13721 |
++ } |
13722 |
+ |
13723 |
+ switch (psp) { |
13724 |
+ case POWER_SUPPLY_PROP_ONLINE: |
13725 |
+@@ -1410,8 +1416,10 @@ static int bq24190_battery_get_property(struct power_supply *psy, |
13726 |
+ dev_dbg(bdi->dev, "prop: %d\n", psp); |
13727 |
+ |
13728 |
+ ret = pm_runtime_get_sync(bdi->dev); |
13729 |
+- if (ret < 0) |
13730 |
++ if (ret < 0) { |
13731 |
++ pm_runtime_put_noidle(bdi->dev); |
13732 |
+ return ret; |
13733 |
++ } |
13734 |
+ |
13735 |
+ switch (psp) { |
13736 |
+ case POWER_SUPPLY_PROP_STATUS: |
13737 |
+@@ -1456,8 +1464,10 @@ static int bq24190_battery_set_property(struct power_supply *psy, |
13738 |
+ dev_dbg(bdi->dev, "prop: %d\n", psp); |
13739 |
+ |
13740 |
+ ret = pm_runtime_get_sync(bdi->dev); |
13741 |
+- if (ret < 0) |
13742 |
++ if (ret < 0) { |
13743 |
++ pm_runtime_put_noidle(bdi->dev); |
13744 |
+ return ret; |
13745 |
++ } |
13746 |
+ |
13747 |
+ switch (psp) { |
13748 |
+ case POWER_SUPPLY_PROP_ONLINE: |
13749 |
+diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c |
13750 |
+index 34c21c51bac10..945c3257ca931 100644 |
13751 |
+--- a/drivers/power/supply/bq25890_charger.c |
13752 |
++++ b/drivers/power/supply/bq25890_charger.c |
13753 |
+@@ -299,7 +299,7 @@ static const union { |
13754 |
+ /* TODO: BQ25896 has max ICHG 3008 mA */ |
13755 |
+ [TBL_ICHG] = { .rt = {0, 5056000, 64000} }, /* uA */ |
13756 |
+ [TBL_ITERM] = { .rt = {64000, 1024000, 64000} }, /* uA */ |
13757 |
+- [TBL_IILIM] = { .rt = {50000, 3200000, 50000} }, /* uA */ |
13758 |
++ [TBL_IILIM] = { .rt = {100000, 3250000, 50000} }, /* uA */ |
13759 |
+ [TBL_VREG] = { .rt = {3840000, 4608000, 16000} }, /* uV */ |
13760 |
+ [TBL_BOOSTV] = { .rt = {4550000, 5510000, 64000} }, /* uV */ |
13761 |
+ [TBL_SYSVMIN] = { .rt = {3000000, 3700000, 100000} }, /* uV */ |
13762 |
+diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c |
13763 |
+index f284547913d6f..2e9672fe4df1f 100644 |
13764 |
+--- a/drivers/power/supply/max17042_battery.c |
13765 |
++++ b/drivers/power/supply/max17042_battery.c |
13766 |
+@@ -85,9 +85,10 @@ static enum power_supply_property max17042_battery_props[] = { |
13767 |
+ POWER_SUPPLY_PROP_TEMP_MAX, |
13768 |
+ POWER_SUPPLY_PROP_HEALTH, |
13769 |
+ POWER_SUPPLY_PROP_SCOPE, |
13770 |
++ POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, |
13771 |
++ // these two have to be at the end on the list |
13772 |
+ POWER_SUPPLY_PROP_CURRENT_NOW, |
13773 |
+ POWER_SUPPLY_PROP_CURRENT_AVG, |
13774 |
+- POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, |
13775 |
+ }; |
13776 |
+ |
13777 |
+ static int max17042_get_temperature(struct max17042_chip *chip, int *temp) |
13778 |
+diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c |
13779 |
+index 333ba83006e48..a12a1ad9b5fe3 100644 |
13780 |
+--- a/drivers/ps3/ps3stor_lib.c |
13781 |
++++ b/drivers/ps3/ps3stor_lib.c |
13782 |
+@@ -189,7 +189,7 @@ int ps3stor_setup(struct ps3_storage_device *dev, irq_handler_t handler) |
13783 |
+ dev->bounce_lpar = ps3_mm_phys_to_lpar(__pa(dev->bounce_buf)); |
13784 |
+ dev->bounce_dma = dma_map_single(&dev->sbd.core, dev->bounce_buf, |
13785 |
+ dev->bounce_size, DMA_BIDIRECTIONAL); |
13786 |
+- if (!dev->bounce_dma) { |
13787 |
++ if (dma_mapping_error(&dev->sbd.core, dev->bounce_dma)) { |
13788 |
+ dev_err(&dev->sbd.core, "%s:%u: map DMA region failed\n", |
13789 |
+ __func__, __LINE__); |
13790 |
+ error = -ENODEV; |
13791 |
+diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c |
13792 |
+index c50d453552bd4..86bcafd23e4f6 100644 |
13793 |
+--- a/drivers/pwm/pwm-imx27.c |
13794 |
++++ b/drivers/pwm/pwm-imx27.c |
13795 |
+@@ -235,8 +235,9 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
13796 |
+ |
13797 |
+ period_cycles /= prescale; |
13798 |
+ c = clkrate * state->duty_cycle; |
13799 |
+- do_div(c, NSEC_PER_SEC * prescale); |
13800 |
++ do_div(c, NSEC_PER_SEC); |
13801 |
+ duty_cycles = c; |
13802 |
++ duty_cycles /= prescale; |
13803 |
+ |
13804 |
+ /* |
13805 |
+ * according to imx pwm RM, the real period value should be PERIOD |
13806 |
+diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c |
13807 |
+index 7551253ada32b..bf3f14fb5f244 100644 |
13808 |
+--- a/drivers/pwm/pwm-lp3943.c |
13809 |
++++ b/drivers/pwm/pwm-lp3943.c |
13810 |
+@@ -275,6 +275,7 @@ static int lp3943_pwm_probe(struct platform_device *pdev) |
13811 |
+ lp3943_pwm->chip.dev = &pdev->dev; |
13812 |
+ lp3943_pwm->chip.ops = &lp3943_pwm_ops; |
13813 |
+ lp3943_pwm->chip.npwm = LP3943_NUM_PWMS; |
13814 |
++ lp3943_pwm->chip.base = -1; |
13815 |
+ |
13816 |
+ platform_set_drvdata(pdev, lp3943_pwm); |
13817 |
+ |
13818 |
+diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c |
13819 |
+index 38a4c5c1317b2..482d5b9cec1fb 100644 |
13820 |
+--- a/drivers/pwm/pwm-sun4i.c |
13821 |
++++ b/drivers/pwm/pwm-sun4i.c |
13822 |
+@@ -294,12 +294,8 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
13823 |
+ |
13824 |
+ ctrl |= BIT_CH(PWM_CLK_GATING, pwm->hwpwm); |
13825 |
+ |
13826 |
+- if (state->enabled) { |
13827 |
++ if (state->enabled) |
13828 |
+ ctrl |= BIT_CH(PWM_EN, pwm->hwpwm); |
13829 |
+- } else { |
13830 |
+- ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm); |
13831 |
+- ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm); |
13832 |
+- } |
13833 |
+ |
13834 |
+ sun4i_pwm_writel(sun4i_pwm, ctrl, PWM_CTRL_REG); |
13835 |
+ |
13836 |
+diff --git a/drivers/pwm/pwm-zx.c b/drivers/pwm/pwm-zx.c |
13837 |
+index e2c21cc34a96a..3763ce5311ac2 100644 |
13838 |
+--- a/drivers/pwm/pwm-zx.c |
13839 |
++++ b/drivers/pwm/pwm-zx.c |
13840 |
+@@ -238,6 +238,7 @@ static int zx_pwm_probe(struct platform_device *pdev) |
13841 |
+ ret = pwmchip_add(&zpc->chip); |
13842 |
+ if (ret < 0) { |
13843 |
+ dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret); |
13844 |
++ clk_disable_unprepare(zpc->pclk); |
13845 |
+ return ret; |
13846 |
+ } |
13847 |
+ |
13848 |
+diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c |
13849 |
+index cd1224182ad74..90cb8445f7216 100644 |
13850 |
+--- a/drivers/regulator/axp20x-regulator.c |
13851 |
++++ b/drivers/regulator/axp20x-regulator.c |
13852 |
+@@ -594,7 +594,7 @@ static const struct regulator_desc axp22x_regulators[] = { |
13853 |
+ AXP22X_DLDO1_V_OUT, AXP22X_DLDO1_V_OUT_MASK, |
13854 |
+ AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_DLDO1_MASK), |
13855 |
+ AXP_DESC(AXP22X, DLDO2, "dldo2", "dldoin", 700, 3300, 100, |
13856 |
+- AXP22X_DLDO2_V_OUT, AXP22X_PWR_OUT_DLDO2_MASK, |
13857 |
++ AXP22X_DLDO2_V_OUT, AXP22X_DLDO2_V_OUT_MASK, |
13858 |
+ AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_DLDO2_MASK), |
13859 |
+ AXP_DESC(AXP22X, DLDO3, "dldo3", "dldoin", 700, 3300, 100, |
13860 |
+ AXP22X_DLDO3_V_OUT, AXP22X_DLDO3_V_OUT_MASK, |
13861 |
+diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h |
13862 |
+index 47b4561443a94..f2bcc9d9fda65 100644 |
13863 |
+--- a/drivers/remoteproc/mtk_common.h |
13864 |
++++ b/drivers/remoteproc/mtk_common.h |
13865 |
+@@ -32,22 +32,22 @@ |
13866 |
+ #define MT8183_SCP_CACHESIZE_8KB BIT(8) |
13867 |
+ #define MT8183_SCP_CACHE_CON_WAYEN BIT(10) |
13868 |
+ |
13869 |
+-#define MT8192_L2TCM_SRAM_PD_0 0x210C0 |
13870 |
+-#define MT8192_L2TCM_SRAM_PD_1 0x210C4 |
13871 |
+-#define MT8192_L2TCM_SRAM_PD_2 0x210C8 |
13872 |
+-#define MT8192_L1TCM_SRAM_PDN 0x2102C |
13873 |
+-#define MT8192_CPU0_SRAM_PD 0x21080 |
13874 |
+- |
13875 |
+-#define MT8192_SCP2APMCU_IPC_SET 0x24080 |
13876 |
+-#define MT8192_SCP2APMCU_IPC_CLR 0x24084 |
13877 |
++#define MT8192_L2TCM_SRAM_PD_0 0x10C0 |
13878 |
++#define MT8192_L2TCM_SRAM_PD_1 0x10C4 |
13879 |
++#define MT8192_L2TCM_SRAM_PD_2 0x10C8 |
13880 |
++#define MT8192_L1TCM_SRAM_PDN 0x102C |
13881 |
++#define MT8192_CPU0_SRAM_PD 0x1080 |
13882 |
++ |
13883 |
++#define MT8192_SCP2APMCU_IPC_SET 0x4080 |
13884 |
++#define MT8192_SCP2APMCU_IPC_CLR 0x4084 |
13885 |
+ #define MT8192_SCP_IPC_INT_BIT BIT(0) |
13886 |
+-#define MT8192_SCP2SPM_IPC_CLR 0x24094 |
13887 |
+-#define MT8192_GIPC_IN_SET 0x24098 |
13888 |
++#define MT8192_SCP2SPM_IPC_CLR 0x4094 |
13889 |
++#define MT8192_GIPC_IN_SET 0x4098 |
13890 |
+ #define MT8192_HOST_IPC_INT_BIT BIT(0) |
13891 |
+ |
13892 |
+-#define MT8192_CORE0_SW_RSTN_CLR 0x30000 |
13893 |
+-#define MT8192_CORE0_SW_RSTN_SET 0x30004 |
13894 |
+-#define MT8192_CORE0_WDT_CFG 0x30034 |
13895 |
++#define MT8192_CORE0_SW_RSTN_CLR 0x10000 |
13896 |
++#define MT8192_CORE0_SW_RSTN_SET 0x10004 |
13897 |
++#define MT8192_CORE0_WDT_CFG 0x10034 |
13898 |
+ |
13899 |
+ #define SCP_FW_VER_LEN 32 |
13900 |
+ #define SCP_SHARE_BUFFER_SIZE 288 |
13901 |
+diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c |
13902 |
+index 577cbd5d421ec..52fa01d67c18e 100644 |
13903 |
+--- a/drivers/remoteproc/mtk_scp.c |
13904 |
++++ b/drivers/remoteproc/mtk_scp.c |
13905 |
+@@ -350,9 +350,10 @@ static int scp_load(struct rproc *rproc, const struct firmware *fw) |
13906 |
+ |
13907 |
+ ret = scp->data->scp_before_load(scp); |
13908 |
+ if (ret < 0) |
13909 |
+- return ret; |
13910 |
++ goto leave; |
13911 |
+ |
13912 |
+ ret = scp_elf_load_segments(rproc, fw); |
13913 |
++leave: |
13914 |
+ clk_disable_unprepare(scp->clk); |
13915 |
+ |
13916 |
+ return ret; |
13917 |
+@@ -772,12 +773,14 @@ static const struct mtk_scp_of_data mt8192_of_data = { |
13918 |
+ .host_to_scp_int_bit = MT8192_HOST_IPC_INT_BIT, |
13919 |
+ }; |
13920 |
+ |
13921 |
++#if defined(CONFIG_OF) |
13922 |
+ static const struct of_device_id mtk_scp_of_match[] = { |
13923 |
+ { .compatible = "mediatek,mt8183-scp", .data = &mt8183_of_data }, |
13924 |
+ { .compatible = "mediatek,mt8192-scp", .data = &mt8192_of_data }, |
13925 |
+ {}, |
13926 |
+ }; |
13927 |
+ MODULE_DEVICE_TABLE(of, mtk_scp_of_match); |
13928 |
++#endif |
13929 |
+ |
13930 |
+ static struct platform_driver mtk_scp_driver = { |
13931 |
+ .probe = scp_probe, |
13932 |
+diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c |
13933 |
+index efb2c1aa80a3c..9eb599701f9b0 100644 |
13934 |
+--- a/drivers/remoteproc/qcom_q6v5_adsp.c |
13935 |
++++ b/drivers/remoteproc/qcom_q6v5_adsp.c |
13936 |
+@@ -193,8 +193,10 @@ static int adsp_start(struct rproc *rproc) |
13937 |
+ |
13938 |
+ dev_pm_genpd_set_performance_state(adsp->dev, INT_MAX); |
13939 |
+ ret = pm_runtime_get_sync(adsp->dev); |
13940 |
+- if (ret) |
13941 |
++ if (ret) { |
13942 |
++ pm_runtime_put_noidle(adsp->dev); |
13943 |
+ goto disable_xo_clk; |
13944 |
++ } |
13945 |
+ |
13946 |
+ ret = clk_bulk_prepare_enable(adsp->num_clks, adsp->clks); |
13947 |
+ if (ret) { |
13948 |
+@@ -362,15 +364,12 @@ static int adsp_init_mmio(struct qcom_adsp *adsp, |
13949 |
+ struct platform_device *pdev) |
13950 |
+ { |
13951 |
+ struct device_node *syscon; |
13952 |
+- struct resource *res; |
13953 |
+ int ret; |
13954 |
+ |
13955 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
13956 |
+- adsp->qdsp6ss_base = devm_ioremap(&pdev->dev, res->start, |
13957 |
+- resource_size(res)); |
13958 |
+- if (!adsp->qdsp6ss_base) { |
13959 |
++ adsp->qdsp6ss_base = devm_platform_ioremap_resource(pdev, 0); |
13960 |
++ if (IS_ERR(adsp->qdsp6ss_base)) { |
13961 |
+ dev_err(adsp->dev, "failed to map QDSP6SS registers\n"); |
13962 |
+- return -ENOMEM; |
13963 |
++ return PTR_ERR(adsp->qdsp6ss_base); |
13964 |
+ } |
13965 |
+ |
13966 |
+ syscon = of_parse_phandle(pdev->dev.of_node, "qcom,halt-regs", 0); |
13967 |
+diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c |
13968 |
+index eb3457a6c3b73..ba6f7551242de 100644 |
13969 |
+--- a/drivers/remoteproc/qcom_q6v5_mss.c |
13970 |
++++ b/drivers/remoteproc/qcom_q6v5_mss.c |
13971 |
+@@ -349,8 +349,11 @@ static int q6v5_pds_enable(struct q6v5 *qproc, struct device **pds, |
13972 |
+ for (i = 0; i < pd_count; i++) { |
13973 |
+ dev_pm_genpd_set_performance_state(pds[i], INT_MAX); |
13974 |
+ ret = pm_runtime_get_sync(pds[i]); |
13975 |
+- if (ret < 0) |
13976 |
++ if (ret < 0) { |
13977 |
++ pm_runtime_put_noidle(pds[i]); |
13978 |
++ dev_pm_genpd_set_performance_state(pds[i], 0); |
13979 |
+ goto unroll_pd_votes; |
13980 |
++ } |
13981 |
+ } |
13982 |
+ |
13983 |
+ return 0; |
13984 |
+diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c |
13985 |
+index 3837f23995e05..0678b417707ef 100644 |
13986 |
+--- a/drivers/remoteproc/qcom_q6v5_pas.c |
13987 |
++++ b/drivers/remoteproc/qcom_q6v5_pas.c |
13988 |
+@@ -90,8 +90,11 @@ static int adsp_pds_enable(struct qcom_adsp *adsp, struct device **pds, |
13989 |
+ for (i = 0; i < pd_count; i++) { |
13990 |
+ dev_pm_genpd_set_performance_state(pds[i], INT_MAX); |
13991 |
+ ret = pm_runtime_get_sync(pds[i]); |
13992 |
+- if (ret < 0) |
13993 |
++ if (ret < 0) { |
13994 |
++ pm_runtime_put_noidle(pds[i]); |
13995 |
++ dev_pm_genpd_set_performance_state(pds[i], 0); |
13996 |
+ goto unroll_pd_votes; |
13997 |
++ } |
13998 |
+ } |
13999 |
+ |
14000 |
+ return 0; |
14001 |
+diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c |
14002 |
+index 9eb2f6bccea63..b37b111b15b39 100644 |
14003 |
+--- a/drivers/remoteproc/qcom_sysmon.c |
14004 |
++++ b/drivers/remoteproc/qcom_sysmon.c |
14005 |
+@@ -22,6 +22,9 @@ struct qcom_sysmon { |
14006 |
+ struct rproc_subdev subdev; |
14007 |
+ struct rproc *rproc; |
14008 |
+ |
14009 |
++ int state; |
14010 |
++ struct mutex state_lock; |
14011 |
++ |
14012 |
+ struct list_head node; |
14013 |
+ |
14014 |
+ const char *name; |
14015 |
+@@ -448,7 +451,10 @@ static int sysmon_prepare(struct rproc_subdev *subdev) |
14016 |
+ .ssr_event = SSCTL_SSR_EVENT_BEFORE_POWERUP |
14017 |
+ }; |
14018 |
+ |
14019 |
++ mutex_lock(&sysmon->state_lock); |
14020 |
++ sysmon->state = SSCTL_SSR_EVENT_BEFORE_POWERUP; |
14021 |
+ blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); |
14022 |
++ mutex_unlock(&sysmon->state_lock); |
14023 |
+ |
14024 |
+ return 0; |
14025 |
+ } |
14026 |
+@@ -472,20 +478,25 @@ static int sysmon_start(struct rproc_subdev *subdev) |
14027 |
+ .ssr_event = SSCTL_SSR_EVENT_AFTER_POWERUP |
14028 |
+ }; |
14029 |
+ |
14030 |
++ mutex_lock(&sysmon->state_lock); |
14031 |
++ sysmon->state = SSCTL_SSR_EVENT_AFTER_POWERUP; |
14032 |
+ blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); |
14033 |
++ mutex_unlock(&sysmon->state_lock); |
14034 |
+ |
14035 |
+ mutex_lock(&sysmon_lock); |
14036 |
+ list_for_each_entry(target, &sysmon_list, node) { |
14037 |
+- if (target == sysmon || |
14038 |
+- target->rproc->state != RPROC_RUNNING) |
14039 |
++ if (target == sysmon) |
14040 |
+ continue; |
14041 |
+ |
14042 |
++ mutex_lock(&target->state_lock); |
14043 |
+ event.subsys_name = target->name; |
14044 |
++ event.ssr_event = target->state; |
14045 |
+ |
14046 |
+ if (sysmon->ssctl_version == 2) |
14047 |
+ ssctl_send_event(sysmon, &event); |
14048 |
+ else if (sysmon->ept) |
14049 |
+ sysmon_send_event(sysmon, &event); |
14050 |
++ mutex_unlock(&target->state_lock); |
14051 |
+ } |
14052 |
+ mutex_unlock(&sysmon_lock); |
14053 |
+ |
14054 |
+@@ -500,7 +511,10 @@ static void sysmon_stop(struct rproc_subdev *subdev, bool crashed) |
14055 |
+ .ssr_event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN |
14056 |
+ }; |
14057 |
+ |
14058 |
++ mutex_lock(&sysmon->state_lock); |
14059 |
++ sysmon->state = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN; |
14060 |
+ blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); |
14061 |
++ mutex_unlock(&sysmon->state_lock); |
14062 |
+ |
14063 |
+ /* Don't request graceful shutdown if we've crashed */ |
14064 |
+ if (crashed) |
14065 |
+@@ -521,7 +535,10 @@ static void sysmon_unprepare(struct rproc_subdev *subdev) |
14066 |
+ .ssr_event = SSCTL_SSR_EVENT_AFTER_SHUTDOWN |
14067 |
+ }; |
14068 |
+ |
14069 |
++ mutex_lock(&sysmon->state_lock); |
14070 |
++ sysmon->state = SSCTL_SSR_EVENT_AFTER_SHUTDOWN; |
14071 |
+ blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); |
14072 |
++ mutex_unlock(&sysmon->state_lock); |
14073 |
+ } |
14074 |
+ |
14075 |
+ /** |
14076 |
+@@ -534,11 +551,10 @@ static int sysmon_notify(struct notifier_block *nb, unsigned long event, |
14077 |
+ void *data) |
14078 |
+ { |
14079 |
+ struct qcom_sysmon *sysmon = container_of(nb, struct qcom_sysmon, nb); |
14080 |
+- struct rproc *rproc = sysmon->rproc; |
14081 |
+ struct sysmon_event *sysmon_event = data; |
14082 |
+ |
14083 |
+ /* Skip non-running rprocs and the originating instance */ |
14084 |
+- if (rproc->state != RPROC_RUNNING || |
14085 |
++ if (sysmon->state != SSCTL_SSR_EVENT_AFTER_POWERUP || |
14086 |
+ !strcmp(sysmon_event->subsys_name, sysmon->name)) { |
14087 |
+ dev_dbg(sysmon->dev, "not notifying %s\n", sysmon->name); |
14088 |
+ return NOTIFY_DONE; |
14089 |
+@@ -591,6 +607,7 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc, |
14090 |
+ init_completion(&sysmon->ind_comp); |
14091 |
+ init_completion(&sysmon->shutdown_comp); |
14092 |
+ mutex_init(&sysmon->lock); |
14093 |
++ mutex_init(&sysmon->state_lock); |
14094 |
+ |
14095 |
+ sysmon->shutdown_irq = of_irq_get_byname(sysmon->dev->of_node, |
14096 |
+ "shutdown-ack"); |
14097 |
+diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c |
14098 |
+index 9011e477290ce..863c0214e0a8e 100644 |
14099 |
+--- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c |
14100 |
++++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c |
14101 |
+@@ -445,10 +445,10 @@ static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev, |
14102 |
+ |
14103 |
+ kproc->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start, |
14104 |
+ resource_size(res)); |
14105 |
+- if (IS_ERR(kproc->mem[i].cpu_addr)) { |
14106 |
++ if (!kproc->mem[i].cpu_addr) { |
14107 |
+ dev_err(dev, "failed to map %s memory\n", |
14108 |
+ data->mems[i].name); |
14109 |
+- return PTR_ERR(kproc->mem[i].cpu_addr); |
14110 |
++ return -ENOMEM; |
14111 |
+ } |
14112 |
+ kproc->mem[i].bus_addr = res->start; |
14113 |
+ kproc->mem[i].dev_addr = data->mems[i].dev_addr; |
14114 |
+diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c |
14115 |
+index 8ec9ea1ca72e1..6f90b85a58140 100644 |
14116 |
+--- a/drivers/rtc/rtc-ep93xx.c |
14117 |
++++ b/drivers/rtc/rtc-ep93xx.c |
14118 |
+@@ -33,7 +33,7 @@ struct ep93xx_rtc { |
14119 |
+ static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, |
14120 |
+ unsigned short *delete) |
14121 |
+ { |
14122 |
+- struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); |
14123 |
++ struct ep93xx_rtc *ep93xx_rtc = dev_get_drvdata(dev); |
14124 |
+ unsigned long comp; |
14125 |
+ |
14126 |
+ comp = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_SWCOMP); |
14127 |
+@@ -51,7 +51,7 @@ static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, |
14128 |
+ |
14129 |
+ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
14130 |
+ { |
14131 |
+- struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); |
14132 |
++ struct ep93xx_rtc *ep93xx_rtc = dev_get_drvdata(dev); |
14133 |
+ unsigned long time; |
14134 |
+ |
14135 |
+ time = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_DATA); |
14136 |
+@@ -62,7 +62,7 @@ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
14137 |
+ |
14138 |
+ static int ep93xx_rtc_set_time(struct device *dev, struct rtc_time *tm) |
14139 |
+ { |
14140 |
+- struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev); |
14141 |
++ struct ep93xx_rtc *ep93xx_rtc = dev_get_drvdata(dev); |
14142 |
+ unsigned long secs = rtc_tm_to_time64(tm); |
14143 |
+ |
14144 |
+ writel(secs + 1, ep93xx_rtc->mmio_base + EP93XX_RTC_LOAD); |
14145 |
+diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c |
14146 |
+index 07a5630ec841f..4d9711d51f8f3 100644 |
14147 |
+--- a/drivers/rtc/rtc-pcf2127.c |
14148 |
++++ b/drivers/rtc/rtc-pcf2127.c |
14149 |
+@@ -243,10 +243,8 @@ static int pcf2127_nvmem_read(void *priv, unsigned int offset, |
14150 |
+ if (ret) |
14151 |
+ return ret; |
14152 |
+ |
14153 |
+- ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, |
14154 |
+- val, bytes); |
14155 |
+- |
14156 |
+- return ret ?: bytes; |
14157 |
++ return regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, |
14158 |
++ val, bytes); |
14159 |
+ } |
14160 |
+ |
14161 |
+ static int pcf2127_nvmem_write(void *priv, unsigned int offset, |
14162 |
+@@ -261,10 +259,8 @@ static int pcf2127_nvmem_write(void *priv, unsigned int offset, |
14163 |
+ if (ret) |
14164 |
+ return ret; |
14165 |
+ |
14166 |
+- ret = regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, |
14167 |
+- val, bytes); |
14168 |
+- |
14169 |
+- return ret ?: bytes; |
14170 |
++ return regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, |
14171 |
++ val, bytes); |
14172 |
+ } |
14173 |
+ |
14174 |
+ /* watchdog driver */ |
14175 |
+diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c |
14176 |
+index 99f86612f7751..dc78a523a69f2 100644 |
14177 |
+--- a/drivers/s390/block/dasd_alias.c |
14178 |
++++ b/drivers/s390/block/dasd_alias.c |
14179 |
+@@ -256,7 +256,6 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) |
14180 |
+ return; |
14181 |
+ device->discipline->get_uid(device, &uid); |
14182 |
+ spin_lock_irqsave(&lcu->lock, flags); |
14183 |
+- list_del_init(&device->alias_list); |
14184 |
+ /* make sure that the workers don't use this device */ |
14185 |
+ if (device == lcu->suc_data.device) { |
14186 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
14187 |
+@@ -283,6 +282,7 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) |
14188 |
+ |
14189 |
+ spin_lock_irqsave(&aliastree.lock, flags); |
14190 |
+ spin_lock(&lcu->lock); |
14191 |
++ list_del_init(&device->alias_list); |
14192 |
+ if (list_empty(&lcu->grouplist) && |
14193 |
+ list_empty(&lcu->active_devices) && |
14194 |
+ list_empty(&lcu->inactive_devices)) { |
14195 |
+@@ -462,11 +462,19 @@ static int read_unit_address_configuration(struct dasd_device *device, |
14196 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
14197 |
+ |
14198 |
+ rc = dasd_sleep_on(cqr); |
14199 |
+- if (rc && !suborder_not_supported(cqr)) { |
14200 |
++ if (!rc) |
14201 |
++ goto out; |
14202 |
++ |
14203 |
++ if (suborder_not_supported(cqr)) { |
14204 |
++ /* suborder not supported or device unusable for IO */ |
14205 |
++ rc = -EOPNOTSUPP; |
14206 |
++ } else { |
14207 |
++ /* IO failed but should be retried */ |
14208 |
+ spin_lock_irqsave(&lcu->lock, flags); |
14209 |
+ lcu->flags |= NEED_UAC_UPDATE; |
14210 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
14211 |
+ } |
14212 |
++out: |
14213 |
+ dasd_sfree_request(cqr, cqr->memdev); |
14214 |
+ return rc; |
14215 |
+ } |
14216 |
+@@ -503,6 +511,14 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu) |
14217 |
+ return rc; |
14218 |
+ |
14219 |
+ spin_lock_irqsave(&lcu->lock, flags); |
14220 |
++ /* |
14221 |
++ * there is another update needed skip the remaining handling |
14222 |
++ * the data might already be outdated |
14223 |
++ * but especially do not add the device to an LCU with pending |
14224 |
++ * update |
14225 |
++ */ |
14226 |
++ if (lcu->flags & NEED_UAC_UPDATE) |
14227 |
++ goto out; |
14228 |
+ lcu->pav = NO_PAV; |
14229 |
+ for (i = 0; i < MAX_DEVICES_PER_LCU; ++i) { |
14230 |
+ switch (lcu->uac->unit[i].ua_type) { |
14231 |
+@@ -521,6 +537,7 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu) |
14232 |
+ alias_list) { |
14233 |
+ _add_device_to_lcu(lcu, device, refdev); |
14234 |
+ } |
14235 |
++out: |
14236 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
14237 |
+ return 0; |
14238 |
+ } |
14239 |
+@@ -625,6 +642,7 @@ int dasd_alias_add_device(struct dasd_device *device) |
14240 |
+ } |
14241 |
+ if (lcu->flags & UPDATE_PENDING) { |
14242 |
+ list_move(&device->alias_list, &lcu->active_devices); |
14243 |
++ private->pavgroup = NULL; |
14244 |
+ _schedule_lcu_update(lcu, device); |
14245 |
+ } |
14246 |
+ spin_unlock_irqrestore(&lcu->lock, flags); |
14247 |
+diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c |
14248 |
+index b29fe8d50baf2..33280ca181e95 100644 |
14249 |
+--- a/drivers/s390/cio/device.c |
14250 |
++++ b/drivers/s390/cio/device.c |
14251 |
+@@ -1664,10 +1664,10 @@ void __init ccw_device_destroy_console(struct ccw_device *cdev) |
14252 |
+ struct io_subchannel_private *io_priv = to_io_private(sch); |
14253 |
+ |
14254 |
+ set_io_private(sch, NULL); |
14255 |
+- put_device(&sch->dev); |
14256 |
+- put_device(&cdev->dev); |
14257 |
+ dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), |
14258 |
+ io_priv->dma_area, io_priv->dma_area_dma); |
14259 |
++ put_device(&sch->dev); |
14260 |
++ put_device(&cdev->dev); |
14261 |
+ kfree(io_priv); |
14262 |
+ } |
14263 |
+ |
14264 |
+diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c |
14265 |
+index e3e157a749880..1b1da162f5f6b 100644 |
14266 |
+--- a/drivers/scsi/aacraid/commctrl.c |
14267 |
++++ b/drivers/scsi/aacraid/commctrl.c |
14268 |
+@@ -25,6 +25,7 @@ |
14269 |
+ #include <linux/completion.h> |
14270 |
+ #include <linux/dma-mapping.h> |
14271 |
+ #include <linux/blkdev.h> |
14272 |
++#include <linux/compat.h> |
14273 |
+ #include <linux/delay.h> /* ssleep prototype */ |
14274 |
+ #include <linux/kthread.h> |
14275 |
+ #include <linux/uaccess.h> |
14276 |
+@@ -226,6 +227,12 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) |
14277 |
+ return status; |
14278 |
+ } |
14279 |
+ |
14280 |
++struct compat_fib_ioctl { |
14281 |
++ u32 fibctx; |
14282 |
++ s32 wait; |
14283 |
++ compat_uptr_t fib; |
14284 |
++}; |
14285 |
++ |
14286 |
+ /** |
14287 |
+ * next_getadapter_fib - get the next fib |
14288 |
+ * @dev: adapter to use |
14289 |
+@@ -243,8 +250,19 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) |
14290 |
+ struct list_head * entry; |
14291 |
+ unsigned long flags; |
14292 |
+ |
14293 |
+- if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl))) |
14294 |
+- return -EFAULT; |
14295 |
++ if (in_compat_syscall()) { |
14296 |
++ struct compat_fib_ioctl cf; |
14297 |
++ |
14298 |
++ if (copy_from_user(&cf, arg, sizeof(struct compat_fib_ioctl))) |
14299 |
++ return -EFAULT; |
14300 |
++ |
14301 |
++ f.fibctx = cf.fibctx; |
14302 |
++ f.wait = cf.wait; |
14303 |
++ f.fib = compat_ptr(cf.fib); |
14304 |
++ } else { |
14305 |
++ if (copy_from_user(&f, arg, sizeof(struct fib_ioctl))) |
14306 |
++ return -EFAULT; |
14307 |
++ } |
14308 |
+ /* |
14309 |
+ * Verify that the HANDLE passed in was a valid AdapterFibContext |
14310 |
+ * |
14311 |
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c |
14312 |
+index 8f3772480582c..0a82afaf40285 100644 |
14313 |
+--- a/drivers/scsi/aacraid/linit.c |
14314 |
++++ b/drivers/scsi/aacraid/linit.c |
14315 |
+@@ -1182,63 +1182,6 @@ static long aac_cfg_ioctl(struct file *file, |
14316 |
+ return aac_do_ioctl(aac, cmd, (void __user *)arg); |
14317 |
+ } |
14318 |
+ |
14319 |
+-#ifdef CONFIG_COMPAT |
14320 |
+-static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long arg) |
14321 |
+-{ |
14322 |
+- long ret; |
14323 |
+- switch (cmd) { |
14324 |
+- case FSACTL_MINIPORT_REV_CHECK: |
14325 |
+- case FSACTL_SENDFIB: |
14326 |
+- case FSACTL_OPEN_GET_ADAPTER_FIB: |
14327 |
+- case FSACTL_CLOSE_GET_ADAPTER_FIB: |
14328 |
+- case FSACTL_SEND_RAW_SRB: |
14329 |
+- case FSACTL_GET_PCI_INFO: |
14330 |
+- case FSACTL_QUERY_DISK: |
14331 |
+- case FSACTL_DELETE_DISK: |
14332 |
+- case FSACTL_FORCE_DELETE_DISK: |
14333 |
+- case FSACTL_GET_CONTAINERS: |
14334 |
+- case FSACTL_SEND_LARGE_FIB: |
14335 |
+- ret = aac_do_ioctl(dev, cmd, (void __user *)arg); |
14336 |
+- break; |
14337 |
+- |
14338 |
+- case FSACTL_GET_NEXT_ADAPTER_FIB: { |
14339 |
+- struct fib_ioctl __user *f; |
14340 |
+- |
14341 |
+- f = compat_alloc_user_space(sizeof(*f)); |
14342 |
+- ret = 0; |
14343 |
+- if (clear_user(f, sizeof(*f))) |
14344 |
+- ret = -EFAULT; |
14345 |
+- if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) |
14346 |
+- ret = -EFAULT; |
14347 |
+- if (!ret) |
14348 |
+- ret = aac_do_ioctl(dev, cmd, f); |
14349 |
+- break; |
14350 |
+- } |
14351 |
+- |
14352 |
+- default: |
14353 |
+- ret = -ENOIOCTLCMD; |
14354 |
+- break; |
14355 |
+- } |
14356 |
+- return ret; |
14357 |
+-} |
14358 |
+- |
14359 |
+-static int aac_compat_ioctl(struct scsi_device *sdev, unsigned int cmd, |
14360 |
+- void __user *arg) |
14361 |
+-{ |
14362 |
+- struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; |
14363 |
+- if (!capable(CAP_SYS_RAWIO)) |
14364 |
+- return -EPERM; |
14365 |
+- return aac_compat_do_ioctl(dev, cmd, (unsigned long)arg); |
14366 |
+-} |
14367 |
+- |
14368 |
+-static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
14369 |
+-{ |
14370 |
+- if (!capable(CAP_SYS_RAWIO)) |
14371 |
+- return -EPERM; |
14372 |
+- return aac_compat_do_ioctl(file->private_data, cmd, arg); |
14373 |
+-} |
14374 |
+-#endif |
14375 |
+- |
14376 |
+ static ssize_t aac_show_model(struct device *device, |
14377 |
+ struct device_attribute *attr, char *buf) |
14378 |
+ { |
14379 |
+@@ -1523,7 +1466,7 @@ static const struct file_operations aac_cfg_fops = { |
14380 |
+ .owner = THIS_MODULE, |
14381 |
+ .unlocked_ioctl = aac_cfg_ioctl, |
14382 |
+ #ifdef CONFIG_COMPAT |
14383 |
+- .compat_ioctl = aac_compat_cfg_ioctl, |
14384 |
++ .compat_ioctl = aac_cfg_ioctl, |
14385 |
+ #endif |
14386 |
+ .open = aac_cfg_open, |
14387 |
+ .llseek = noop_llseek, |
14388 |
+@@ -1536,7 +1479,7 @@ static struct scsi_host_template aac_driver_template = { |
14389 |
+ .info = aac_info, |
14390 |
+ .ioctl = aac_ioctl, |
14391 |
+ #ifdef CONFIG_COMPAT |
14392 |
+- .compat_ioctl = aac_compat_ioctl, |
14393 |
++ .compat_ioctl = aac_ioctl, |
14394 |
+ #endif |
14395 |
+ .queuecommand = aac_queuecommand, |
14396 |
+ .bios_param = aac_biosparm, |
14397 |
+diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c |
14398 |
+index 5f8a7ef8f6a8e..4f7befb43d604 100644 |
14399 |
+--- a/drivers/scsi/fnic/fnic_main.c |
14400 |
++++ b/drivers/scsi/fnic/fnic_main.c |
14401 |
+@@ -740,6 +740,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
14402 |
+ for (i = 0; i < FNIC_IO_LOCKS; i++) |
14403 |
+ spin_lock_init(&fnic->io_req_lock[i]); |
14404 |
+ |
14405 |
++ err = -ENOMEM; |
14406 |
+ fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache); |
14407 |
+ if (!fnic->io_req_pool) |
14408 |
+ goto err_out_free_resources; |
14409 |
+diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
14410 |
+index 960de375ce699..2cbd8a524edab 100644 |
14411 |
+--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
14412 |
++++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
14413 |
+@@ -2409,8 +2409,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) |
14414 |
+ DRV_NAME " phy", hisi_hba); |
14415 |
+ if (rc) { |
14416 |
+ dev_err(dev, "could not request phy interrupt, rc=%d\n", rc); |
14417 |
+- rc = -ENOENT; |
14418 |
+- goto free_irq_vectors; |
14419 |
++ return -ENOENT; |
14420 |
+ } |
14421 |
+ |
14422 |
+ rc = devm_request_irq(dev, pci_irq_vector(pdev, 2), |
14423 |
+@@ -2418,8 +2417,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) |
14424 |
+ DRV_NAME " channel", hisi_hba); |
14425 |
+ if (rc) { |
14426 |
+ dev_err(dev, "could not request chnl interrupt, rc=%d\n", rc); |
14427 |
+- rc = -ENOENT; |
14428 |
+- goto free_irq_vectors; |
14429 |
++ return -ENOENT; |
14430 |
+ } |
14431 |
+ |
14432 |
+ rc = devm_request_irq(dev, pci_irq_vector(pdev, 11), |
14433 |
+@@ -2427,8 +2425,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) |
14434 |
+ DRV_NAME " fatal", hisi_hba); |
14435 |
+ if (rc) { |
14436 |
+ dev_err(dev, "could not request fatal interrupt, rc=%d\n", rc); |
14437 |
+- rc = -ENOENT; |
14438 |
+- goto free_irq_vectors; |
14439 |
++ return -ENOENT; |
14440 |
+ } |
14441 |
+ |
14442 |
+ if (hisi_sas_intr_conv) |
14443 |
+@@ -2449,8 +2446,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) |
14444 |
+ if (rc) { |
14445 |
+ dev_err(dev, "could not request cq%d interrupt, rc=%d\n", |
14446 |
+ i, rc); |
14447 |
+- rc = -ENOENT; |
14448 |
+- goto free_irq_vectors; |
14449 |
++ return -ENOENT; |
14450 |
+ } |
14451 |
+ cq->irq_mask = pci_irq_get_affinity(pdev, i + BASE_VECTORS_V3_HW); |
14452 |
+ if (!cq->irq_mask) { |
14453 |
+@@ -2460,10 +2456,6 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba) |
14454 |
+ } |
14455 |
+ |
14456 |
+ return 0; |
14457 |
+- |
14458 |
+-free_irq_vectors: |
14459 |
+- pci_free_irq_vectors(pdev); |
14460 |
+- return rc; |
14461 |
+ } |
14462 |
+ |
14463 |
+ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) |
14464 |
+@@ -3317,11 +3309,11 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
14465 |
+ |
14466 |
+ rc = interrupt_preinit_v3_hw(hisi_hba); |
14467 |
+ if (rc) |
14468 |
+- goto err_out_ha; |
14469 |
++ goto err_out_debugfs; |
14470 |
+ dev_err(dev, "%d hw queues\n", shost->nr_hw_queues); |
14471 |
+ rc = scsi_add_host(shost, dev); |
14472 |
+ if (rc) |
14473 |
+- goto err_out_ha; |
14474 |
++ goto err_out_free_irq_vectors; |
14475 |
+ |
14476 |
+ rc = sas_register_ha(sha); |
14477 |
+ if (rc) |
14478 |
+@@ -3348,8 +3340,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
14479 |
+ |
14480 |
+ err_out_register_ha: |
14481 |
+ scsi_remove_host(shost); |
14482 |
+-err_out_ha: |
14483 |
++err_out_free_irq_vectors: |
14484 |
++ pci_free_irq_vectors(pdev); |
14485 |
++err_out_debugfs: |
14486 |
+ hisi_sas_debugfs_exit(hisi_hba); |
14487 |
++err_out_ha: |
14488 |
++ hisi_sas_free(hisi_hba); |
14489 |
+ scsi_host_put(shost); |
14490 |
+ err_out_regions: |
14491 |
+ pci_release_regions(pdev); |
14492 |
+diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h |
14493 |
+index 549adfaa97ce5..93e507677bdcb 100644 |
14494 |
+--- a/drivers/scsi/lpfc/lpfc.h |
14495 |
++++ b/drivers/scsi/lpfc/lpfc.h |
14496 |
+@@ -753,7 +753,7 @@ struct lpfc_hba { |
14497 |
+ #define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/ |
14498 |
+ #define HBA_POST_RECEIVE_BUFFER 0x10 /* Rcv buffers need to be posted */ |
14499 |
+ #define HBA_PERSISTENT_TOPO 0x20 /* Persistent topology support in hba */ |
14500 |
+-#define ELS_XRI_ABORT_EVENT 0x40 |
14501 |
++#define ELS_XRI_ABORT_EVENT 0x40 /* ELS_XRI abort event was queued */ |
14502 |
+ #define ASYNC_EVENT 0x80 |
14503 |
+ #define LINK_DISABLED 0x100 /* Link disabled by user */ |
14504 |
+ #define FCF_TS_INPROG 0x200 /* FCF table scan in progress */ |
14505 |
+diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h |
14506 |
+index 482e4a888daec..1437e44ade801 100644 |
14507 |
+--- a/drivers/scsi/lpfc/lpfc_disc.h |
14508 |
++++ b/drivers/scsi/lpfc/lpfc_disc.h |
14509 |
+@@ -41,6 +41,7 @@ enum lpfc_work_type { |
14510 |
+ LPFC_EVT_DEV_LOSS, |
14511 |
+ LPFC_EVT_FASTPATH_MGMT_EVT, |
14512 |
+ LPFC_EVT_RESET_HBA, |
14513 |
++ LPFC_EVT_RECOVER_PORT |
14514 |
+ }; |
14515 |
+ |
14516 |
+ /* structure used to queue event to the discovery tasklet */ |
14517 |
+@@ -128,6 +129,7 @@ struct lpfc_nodelist { |
14518 |
+ struct lpfc_vport *vport; |
14519 |
+ struct lpfc_work_evt els_retry_evt; |
14520 |
+ struct lpfc_work_evt dev_loss_evt; |
14521 |
++ struct lpfc_work_evt recovery_evt; |
14522 |
+ struct kref kref; |
14523 |
+ atomic_t cmd_pending; |
14524 |
+ uint32_t cmd_qdepth; |
14525 |
+diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c |
14526 |
+index bb02fd8bc2ddf..9746d2f4fcfad 100644 |
14527 |
+--- a/drivers/scsi/lpfc/lpfc_hbadisc.c |
14528 |
++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c |
14529 |
+@@ -552,6 +552,15 @@ lpfc_work_list_done(struct lpfc_hba *phba) |
14530 |
+ fcf_inuse, |
14531 |
+ nlp_did); |
14532 |
+ break; |
14533 |
++ case LPFC_EVT_RECOVER_PORT: |
14534 |
++ ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); |
14535 |
++ lpfc_sli_abts_recover_port(ndlp->vport, ndlp); |
14536 |
++ free_evt = 0; |
14537 |
++ /* decrement the node reference count held for |
14538 |
++ * this queued work |
14539 |
++ */ |
14540 |
++ lpfc_nlp_put(ndlp); |
14541 |
++ break; |
14542 |
+ case LPFC_EVT_ONLINE: |
14543 |
+ if (phba->link_state < LPFC_LINK_DOWN) |
14544 |
+ *(int *) (evtp->evt_arg1) = lpfc_online(phba); |
14545 |
+@@ -4515,6 +4524,8 @@ lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
14546 |
+ INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); |
14547 |
+ INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp); |
14548 |
+ timer_setup(&ndlp->nlp_delayfunc, lpfc_els_retry_delay, 0); |
14549 |
++ INIT_LIST_HEAD(&ndlp->recovery_evt.evt_listp); |
14550 |
++ |
14551 |
+ ndlp->nlp_DID = did; |
14552 |
+ ndlp->vport = vport; |
14553 |
+ ndlp->phba = vport->phba; |
14554 |
+@@ -5011,6 +5022,29 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
14555 |
+ mempool_free(mbox, phba->mbox_mem_pool); |
14556 |
+ acc_plogi = 1; |
14557 |
+ } |
14558 |
++ } else { |
14559 |
++ lpfc_printf_vlog(vport, KERN_INFO, |
14560 |
++ LOG_NODE | LOG_DISCOVERY, |
14561 |
++ "1444 Failed to allocate mempool " |
14562 |
++ "unreg_rpi UNREG x%x, " |
14563 |
++ "DID x%x, flag x%x, " |
14564 |
++ "ndlp x%px\n", |
14565 |
++ ndlp->nlp_rpi, ndlp->nlp_DID, |
14566 |
++ ndlp->nlp_flag, ndlp); |
14567 |
++ |
14568 |
++ /* Because mempool_alloc failed, we |
14569 |
++ * will issue a LOGO here and keep the rpi alive if |
14570 |
++ * not unloading. |
14571 |
++ */ |
14572 |
++ if (!(vport->load_flag & FC_UNLOADING)) { |
14573 |
++ ndlp->nlp_flag &= ~NLP_UNREG_INP; |
14574 |
++ lpfc_issue_els_logo(vport, ndlp, 0); |
14575 |
++ ndlp->nlp_prev_state = ndlp->nlp_state; |
14576 |
++ lpfc_nlp_set_state(vport, ndlp, |
14577 |
++ NLP_STE_NPR_NODE); |
14578 |
++ } |
14579 |
++ |
14580 |
++ return 1; |
14581 |
+ } |
14582 |
+ lpfc_no_rpi(phba, ndlp); |
14583 |
+ out: |
14584 |
+@@ -5214,6 +5248,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
14585 |
+ |
14586 |
+ list_del_init(&ndlp->els_retry_evt.evt_listp); |
14587 |
+ list_del_init(&ndlp->dev_loss_evt.evt_listp); |
14588 |
++ list_del_init(&ndlp->recovery_evt.evt_listp); |
14589 |
+ lpfc_cleanup_vports_rrqs(vport, ndlp); |
14590 |
+ if (phba->sli_rev == LPFC_SLI_REV4) |
14591 |
+ ndlp->nlp_flag |= NLP_RELEASE_RPI; |
14592 |
+diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
14593 |
+index ca25e54bb7824..40fe889033d43 100644 |
14594 |
+--- a/drivers/scsi/lpfc/lpfc_init.c |
14595 |
++++ b/drivers/scsi/lpfc/lpfc_init.c |
14596 |
+@@ -5958,18 +5958,21 @@ lpfc_sli4_async_grp5_evt(struct lpfc_hba *phba, |
14597 |
+ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) |
14598 |
+ { |
14599 |
+ struct lpfc_cq_event *cq_event; |
14600 |
++ unsigned long iflags; |
14601 |
+ |
14602 |
+ /* First, declare the async event has been handled */ |
14603 |
+- spin_lock_irq(&phba->hbalock); |
14604 |
++ spin_lock_irqsave(&phba->hbalock, iflags); |
14605 |
+ phba->hba_flag &= ~ASYNC_EVENT; |
14606 |
+- spin_unlock_irq(&phba->hbalock); |
14607 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
14608 |
++ |
14609 |
+ /* Now, handle all the async events */ |
14610 |
++ spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); |
14611 |
+ while (!list_empty(&phba->sli4_hba.sp_asynce_work_queue)) { |
14612 |
+- /* Get the first event from the head of the event queue */ |
14613 |
+- spin_lock_irq(&phba->hbalock); |
14614 |
+ list_remove_head(&phba->sli4_hba.sp_asynce_work_queue, |
14615 |
+ cq_event, struct lpfc_cq_event, list); |
14616 |
+- spin_unlock_irq(&phba->hbalock); |
14617 |
++ spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, |
14618 |
++ iflags); |
14619 |
++ |
14620 |
+ /* Process the asynchronous event */ |
14621 |
+ switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) { |
14622 |
+ case LPFC_TRAILER_CODE_LINK: |
14623 |
+@@ -6001,9 +6004,12 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) |
14624 |
+ &cq_event->cqe.mcqe_cmpl)); |
14625 |
+ break; |
14626 |
+ } |
14627 |
++ |
14628 |
+ /* Free the completion event processed to the free pool */ |
14629 |
+ lpfc_sli4_cq_event_release(phba, cq_event); |
14630 |
++ spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); |
14631 |
+ } |
14632 |
++ spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); |
14633 |
+ } |
14634 |
+ |
14635 |
+ /** |
14636 |
+@@ -6630,6 +6636,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) |
14637 |
+ /* This abort list used by worker thread */ |
14638 |
+ spin_lock_init(&phba->sli4_hba.sgl_list_lock); |
14639 |
+ spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock); |
14640 |
++ spin_lock_init(&phba->sli4_hba.asynce_list_lock); |
14641 |
++ spin_lock_init(&phba->sli4_hba.els_xri_abrt_list_lock); |
14642 |
+ |
14643 |
+ /* |
14644 |
+ * Initialize driver internal slow-path work queues |
14645 |
+@@ -6641,8 +6649,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) |
14646 |
+ INIT_LIST_HEAD(&phba->sli4_hba.sp_queue_event); |
14647 |
+ /* Asynchronous event CQ Event work queue list */ |
14648 |
+ INIT_LIST_HEAD(&phba->sli4_hba.sp_asynce_work_queue); |
14649 |
+- /* Fast-path XRI aborted CQ Event work queue list */ |
14650 |
+- INIT_LIST_HEAD(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue); |
14651 |
+ /* Slow-path XRI aborted CQ Event work queue list */ |
14652 |
+ INIT_LIST_HEAD(&phba->sli4_hba.sp_els_xri_aborted_work_queue); |
14653 |
+ /* Receive queue CQ Event work queue list */ |
14654 |
+@@ -10174,26 +10180,28 @@ lpfc_sli4_cq_event_release(struct lpfc_hba *phba, |
14655 |
+ static void |
14656 |
+ lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba) |
14657 |
+ { |
14658 |
+- LIST_HEAD(cqelist); |
14659 |
+- struct lpfc_cq_event *cqe; |
14660 |
++ LIST_HEAD(cq_event_list); |
14661 |
++ struct lpfc_cq_event *cq_event; |
14662 |
+ unsigned long iflags; |
14663 |
+ |
14664 |
+ /* Retrieve all the pending WCQEs from pending WCQE lists */ |
14665 |
+- spin_lock_irqsave(&phba->hbalock, iflags); |
14666 |
+- /* Pending FCP XRI abort events */ |
14667 |
+- list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue, |
14668 |
+- &cqelist); |
14669 |
++ |
14670 |
+ /* Pending ELS XRI abort events */ |
14671 |
++ spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); |
14672 |
+ list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue, |
14673 |
+- &cqelist); |
14674 |
++ &cq_event_list); |
14675 |
++ spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); |
14676 |
++ |
14677 |
+ /* Pending asynnc events */ |
14678 |
++ spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); |
14679 |
+ list_splice_init(&phba->sli4_hba.sp_asynce_work_queue, |
14680 |
+- &cqelist); |
14681 |
+- spin_unlock_irqrestore(&phba->hbalock, iflags); |
14682 |
++ &cq_event_list); |
14683 |
++ spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); |
14684 |
+ |
14685 |
+- while (!list_empty(&cqelist)) { |
14686 |
+- list_remove_head(&cqelist, cqe, struct lpfc_cq_event, list); |
14687 |
+- lpfc_sli4_cq_event_release(phba, cqe); |
14688 |
++ while (!list_empty(&cq_event_list)) { |
14689 |
++ list_remove_head(&cq_event_list, cq_event, |
14690 |
++ struct lpfc_cq_event, list); |
14691 |
++ lpfc_sli4_cq_event_release(phba, cq_event); |
14692 |
+ } |
14693 |
+ } |
14694 |
+ |
14695 |
+diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c |
14696 |
+index 27ff67e9edae7..be54fbf5146f1 100644 |
14697 |
+--- a/drivers/scsi/lpfc/lpfc_mem.c |
14698 |
++++ b/drivers/scsi/lpfc/lpfc_mem.c |
14699 |
+@@ -46,6 +46,7 @@ |
14700 |
+ #define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ |
14701 |
+ #define LPFC_DEVICE_DATA_POOL_SIZE 64 /* max elements in device data pool */ |
14702 |
+ #define LPFC_RRQ_POOL_SIZE 256 /* max elements in non-DMA pool */ |
14703 |
++#define LPFC_MBX_POOL_SIZE 256 /* max elements in MBX non-DMA pool */ |
14704 |
+ |
14705 |
+ int |
14706 |
+ lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *phba) { |
14707 |
+@@ -111,8 +112,8 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align) |
14708 |
+ pool->current_count++; |
14709 |
+ } |
14710 |
+ |
14711 |
+- phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, |
14712 |
+- sizeof(LPFC_MBOXQ_t)); |
14713 |
++ phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MBX_POOL_SIZE, |
14714 |
++ sizeof(LPFC_MBOXQ_t)); |
14715 |
+ if (!phba->mbox_mem_pool) |
14716 |
+ goto fail_free_mbuf_pool; |
14717 |
+ |
14718 |
+@@ -588,8 +589,6 @@ lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab) |
14719 |
+ * Description: Allocates a DMA-mapped receive buffer from the lpfc_hrb_pool PCI |
14720 |
+ * pool along a non-DMA-mapped container for it. |
14721 |
+ * |
14722 |
+- * Notes: Not interrupt-safe. Must be called with no locks held. |
14723 |
+- * |
14724 |
+ * Returns: |
14725 |
+ * pointer to HBQ on success |
14726 |
+ * NULL on failure |
14727 |
+@@ -599,7 +598,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) |
14728 |
+ { |
14729 |
+ struct rqb_dmabuf *dma_buf; |
14730 |
+ |
14731 |
+- dma_buf = kzalloc(sizeof(struct rqb_dmabuf), GFP_KERNEL); |
14732 |
++ dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL); |
14733 |
+ if (!dma_buf) |
14734 |
+ return NULL; |
14735 |
+ |
14736 |
+@@ -722,7 +721,6 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) |
14737 |
+ drqe.address_hi = putPaddrHigh(rqb_entry->dbuf.phys); |
14738 |
+ rc = lpfc_sli4_rq_put(rqb_entry->hrq, rqb_entry->drq, &hrqe, &drqe); |
14739 |
+ if (rc < 0) { |
14740 |
+- (rqbp->rqb_free_buffer)(phba, rqb_entry); |
14741 |
+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
14742 |
+ "6409 Cannot post to HRQ %d: %x %x %x " |
14743 |
+ "DRQ %x %x\n", |
14744 |
+@@ -732,6 +730,7 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) |
14745 |
+ rqb_entry->hrq->entry_count, |
14746 |
+ rqb_entry->drq->host_index, |
14747 |
+ rqb_entry->drq->hba_index); |
14748 |
++ (rqbp->rqb_free_buffer)(phba, rqb_entry); |
14749 |
+ } else { |
14750 |
+ list_add_tail(&rqb_entry->hbuf.list, &rqbp->rqb_buffer_list); |
14751 |
+ rqbp->buffer_count++; |
14752 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
14753 |
+index 0c39ed50998c8..69f1a0457f51e 100644 |
14754 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
14755 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
14756 |
+@@ -2280,6 +2280,8 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, |
14757 |
+ int ret, i, pending = 0; |
14758 |
+ struct lpfc_sli_ring *pring; |
14759 |
+ struct lpfc_hba *phba = vport->phba; |
14760 |
++ struct lpfc_sli4_hdw_queue *qp; |
14761 |
++ int abts_scsi, abts_nvme; |
14762 |
+ |
14763 |
+ /* Host transport has to clean up and confirm requiring an indefinite |
14764 |
+ * wait. Print a message if a 10 second wait expires and renew the |
14765 |
+@@ -2290,17 +2292,23 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, |
14766 |
+ ret = wait_for_completion_timeout(lport_unreg_cmp, wait_tmo); |
14767 |
+ if (unlikely(!ret)) { |
14768 |
+ pending = 0; |
14769 |
++ abts_scsi = 0; |
14770 |
++ abts_nvme = 0; |
14771 |
+ for (i = 0; i < phba->cfg_hdw_queue; i++) { |
14772 |
+- pring = phba->sli4_hba.hdwq[i].io_wq->pring; |
14773 |
++ qp = &phba->sli4_hba.hdwq[i]; |
14774 |
++ pring = qp->io_wq->pring; |
14775 |
+ if (!pring) |
14776 |
+ continue; |
14777 |
+- if (pring->txcmplq_cnt) |
14778 |
+- pending += pring->txcmplq_cnt; |
14779 |
++ pending += pring->txcmplq_cnt; |
14780 |
++ abts_scsi += qp->abts_scsi_io_bufs; |
14781 |
++ abts_nvme += qp->abts_nvme_io_bufs; |
14782 |
+ } |
14783 |
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
14784 |
+ "6176 Lport x%px Localport x%px wait " |
14785 |
+- "timed out. Pending %d. Renewing.\n", |
14786 |
+- lport, vport->localport, pending); |
14787 |
++ "timed out. Pending %d [%d:%d]. " |
14788 |
++ "Renewing.\n", |
14789 |
++ lport, vport->localport, pending, |
14790 |
++ abts_scsi, abts_nvme); |
14791 |
+ continue; |
14792 |
+ } |
14793 |
+ break; |
14794 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
14795 |
+index e158cd77d387f..fcaafa564dfcd 100644 |
14796 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
14797 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
14798 |
+@@ -7248,12 +7248,16 @@ lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, |
14799 |
+ struct rqb_dmabuf *rqb_buffer; |
14800 |
+ LIST_HEAD(rqb_buf_list); |
14801 |
+ |
14802 |
+- spin_lock_irqsave(&phba->hbalock, flags); |
14803 |
+ rqbp = hrq->rqbp; |
14804 |
+ for (i = 0; i < count; i++) { |
14805 |
++ spin_lock_irqsave(&phba->hbalock, flags); |
14806 |
+ /* IF RQ is already full, don't bother */ |
14807 |
+- if (rqbp->buffer_count + i >= rqbp->entry_count - 1) |
14808 |
++ if (rqbp->buffer_count + i >= rqbp->entry_count - 1) { |
14809 |
++ spin_unlock_irqrestore(&phba->hbalock, flags); |
14810 |
+ break; |
14811 |
++ } |
14812 |
++ spin_unlock_irqrestore(&phba->hbalock, flags); |
14813 |
++ |
14814 |
+ rqb_buffer = rqbp->rqb_alloc_buffer(phba); |
14815 |
+ if (!rqb_buffer) |
14816 |
+ break; |
14817 |
+@@ -7262,6 +7266,8 @@ lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, |
14818 |
+ rqb_buffer->idx = idx; |
14819 |
+ list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list); |
14820 |
+ } |
14821 |
++ |
14822 |
++ spin_lock_irqsave(&phba->hbalock, flags); |
14823 |
+ while (!list_empty(&rqb_buf_list)) { |
14824 |
+ list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf, |
14825 |
+ hbuf.list); |
14826 |
+@@ -10364,6 +10370,32 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba) |
14827 |
+ return 0; |
14828 |
+ } |
14829 |
+ |
14830 |
++static void |
14831 |
++lpfc_sli_post_recovery_event(struct lpfc_hba *phba, |
14832 |
++ struct lpfc_nodelist *ndlp) |
14833 |
++{ |
14834 |
++ unsigned long iflags; |
14835 |
++ struct lpfc_work_evt *evtp = &ndlp->recovery_evt; |
14836 |
++ |
14837 |
++ spin_lock_irqsave(&phba->hbalock, iflags); |
14838 |
++ if (!list_empty(&evtp->evt_listp)) { |
14839 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
14840 |
++ return; |
14841 |
++ } |
14842 |
++ |
14843 |
++ /* Incrementing the reference count until the queued work is done. */ |
14844 |
++ evtp->evt_arg1 = lpfc_nlp_get(ndlp); |
14845 |
++ if (!evtp->evt_arg1) { |
14846 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
14847 |
++ return; |
14848 |
++ } |
14849 |
++ evtp->evt = LPFC_EVT_RECOVER_PORT; |
14850 |
++ list_add_tail(&evtp->evt_listp, &phba->work_list); |
14851 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
14852 |
++ |
14853 |
++ lpfc_worker_wake_up(phba); |
14854 |
++} |
14855 |
++ |
14856 |
+ /* lpfc_sli_abts_err_handler - handle a failed ABTS request from an SLI3 port. |
14857 |
+ * @phba: Pointer to HBA context object. |
14858 |
+ * @iocbq: Pointer to iocb object. |
14859 |
+@@ -10454,7 +10486,7 @@ lpfc_sli4_abts_err_handler(struct lpfc_hba *phba, |
14860 |
+ ext_status = axri->parameter & IOERR_PARAM_MASK; |
14861 |
+ if ((bf_get(lpfc_wcqe_xa_status, axri) == IOSTAT_LOCAL_REJECT) && |
14862 |
+ ((ext_status == IOERR_SEQUENCE_TIMEOUT) || (ext_status == 0))) |
14863 |
+- lpfc_sli_abts_recover_port(vport, ndlp); |
14864 |
++ lpfc_sli_post_recovery_event(phba, ndlp); |
14865 |
+ } |
14866 |
+ |
14867 |
+ /** |
14868 |
+@@ -13062,23 +13094,30 @@ lpfc_sli_intr_handler(int irq, void *dev_id) |
14869 |
+ void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba) |
14870 |
+ { |
14871 |
+ struct lpfc_cq_event *cq_event; |
14872 |
++ unsigned long iflags; |
14873 |
+ |
14874 |
+ /* First, declare the els xri abort event has been handled */ |
14875 |
+- spin_lock_irq(&phba->hbalock); |
14876 |
++ spin_lock_irqsave(&phba->hbalock, iflags); |
14877 |
+ phba->hba_flag &= ~ELS_XRI_ABORT_EVENT; |
14878 |
+- spin_unlock_irq(&phba->hbalock); |
14879 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
14880 |
++ |
14881 |
+ /* Now, handle all the els xri abort events */ |
14882 |
++ spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); |
14883 |
+ while (!list_empty(&phba->sli4_hba.sp_els_xri_aborted_work_queue)) { |
14884 |
+ /* Get the first event from the head of the event queue */ |
14885 |
+- spin_lock_irq(&phba->hbalock); |
14886 |
+ list_remove_head(&phba->sli4_hba.sp_els_xri_aborted_work_queue, |
14887 |
+ cq_event, struct lpfc_cq_event, list); |
14888 |
+- spin_unlock_irq(&phba->hbalock); |
14889 |
++ spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, |
14890 |
++ iflags); |
14891 |
+ /* Notify aborted XRI for ELS work queue */ |
14892 |
+ lpfc_sli4_els_xri_aborted(phba, &cq_event->cqe.wcqe_axri); |
14893 |
++ |
14894 |
+ /* Free the event processed back to the free pool */ |
14895 |
+ lpfc_sli4_cq_event_release(phba, cq_event); |
14896 |
++ spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, |
14897 |
++ iflags); |
14898 |
+ } |
14899 |
++ spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, iflags); |
14900 |
+ } |
14901 |
+ |
14902 |
+ /** |
14903 |
+@@ -13289,9 +13328,13 @@ lpfc_sli4_sp_handle_async_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) |
14904 |
+ cq_event = lpfc_cq_event_setup(phba, mcqe, sizeof(struct lpfc_mcqe)); |
14905 |
+ if (!cq_event) |
14906 |
+ return false; |
14907 |
+- spin_lock_irqsave(&phba->hbalock, iflags); |
14908 |
++ |
14909 |
++ spin_lock_irqsave(&phba->sli4_hba.asynce_list_lock, iflags); |
14910 |
+ list_add_tail(&cq_event->list, &phba->sli4_hba.sp_asynce_work_queue); |
14911 |
++ spin_unlock_irqrestore(&phba->sli4_hba.asynce_list_lock, iflags); |
14912 |
++ |
14913 |
+ /* Set the async event flag */ |
14914 |
++ spin_lock_irqsave(&phba->hbalock, iflags); |
14915 |
+ phba->hba_flag |= ASYNC_EVENT; |
14916 |
+ spin_unlock_irqrestore(&phba->hbalock, iflags); |
14917 |
+ |
14918 |
+@@ -13566,17 +13609,20 @@ lpfc_sli4_sp_handle_abort_xri_wcqe(struct lpfc_hba *phba, |
14919 |
+ break; |
14920 |
+ case LPFC_NVME_LS: /* NVME LS uses ELS resources */ |
14921 |
+ case LPFC_ELS: |
14922 |
+- cq_event = lpfc_cq_event_setup( |
14923 |
+- phba, wcqe, sizeof(struct sli4_wcqe_xri_aborted)); |
14924 |
+- if (!cq_event) |
14925 |
+- return false; |
14926 |
++ cq_event = lpfc_cq_event_setup(phba, wcqe, sizeof(*wcqe)); |
14927 |
++ if (!cq_event) { |
14928 |
++ workposted = false; |
14929 |
++ break; |
14930 |
++ } |
14931 |
+ cq_event->hdwq = cq->hdwq; |
14932 |
+- spin_lock_irqsave(&phba->hbalock, iflags); |
14933 |
++ spin_lock_irqsave(&phba->sli4_hba.els_xri_abrt_list_lock, |
14934 |
++ iflags); |
14935 |
+ list_add_tail(&cq_event->list, |
14936 |
+ &phba->sli4_hba.sp_els_xri_aborted_work_queue); |
14937 |
+ /* Set the els xri abort event flag */ |
14938 |
+ phba->hba_flag |= ELS_XRI_ABORT_EVENT; |
14939 |
+- spin_unlock_irqrestore(&phba->hbalock, iflags); |
14940 |
++ spin_unlock_irqrestore(&phba->sli4_hba.els_xri_abrt_list_lock, |
14941 |
++ iflags); |
14942 |
+ workposted = true; |
14943 |
+ break; |
14944 |
+ default: |
14945 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h |
14946 |
+index a966cdeb52ee7..100cb1a94811b 100644 |
14947 |
+--- a/drivers/scsi/lpfc/lpfc_sli4.h |
14948 |
++++ b/drivers/scsi/lpfc/lpfc_sli4.h |
14949 |
+@@ -920,8 +920,9 @@ struct lpfc_sli4_hba { |
14950 |
+ struct list_head sp_queue_event; |
14951 |
+ struct list_head sp_cqe_event_pool; |
14952 |
+ struct list_head sp_asynce_work_queue; |
14953 |
+- struct list_head sp_fcp_xri_aborted_work_queue; |
14954 |
++ spinlock_t asynce_list_lock; /* protect sp_asynce_work_queue list */ |
14955 |
+ struct list_head sp_els_xri_aborted_work_queue; |
14956 |
++ spinlock_t els_xri_abrt_list_lock; /* protect els_xri_aborted list */ |
14957 |
+ struct list_head sp_unsol_work_queue; |
14958 |
+ struct lpfc_sli4_link link_state; |
14959 |
+ struct lpfc_sli4_lnk_info lnk_info; |
14960 |
+@@ -1103,8 +1104,7 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *); |
14961 |
+ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); |
14962 |
+ int lpfc_sli4_resume_rpi(struct lpfc_nodelist *, |
14963 |
+ void (*)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *); |
14964 |
+-void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *); |
14965 |
+-void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *); |
14966 |
++void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba); |
14967 |
+ void lpfc_sli4_nvme_xri_aborted(struct lpfc_hba *phba, |
14968 |
+ struct sli4_wcqe_xri_aborted *axri, |
14969 |
+ struct lpfc_io_buf *lpfc_ncmd); |
14970 |
+diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c |
14971 |
+index 3cf3e58b69799..2025361b36e96 100644 |
14972 |
+--- a/drivers/scsi/pm8001/pm8001_init.c |
14973 |
++++ b/drivers/scsi/pm8001/pm8001_init.c |
14974 |
+@@ -1131,7 +1131,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev, |
14975 |
+ |
14976 |
+ pm8001_init_sas_add(pm8001_ha); |
14977 |
+ /* phy setting support for motherboard controller */ |
14978 |
+- if (pm8001_configure_phy_settings(pm8001_ha)) |
14979 |
++ rc = pm8001_configure_phy_settings(pm8001_ha); |
14980 |
++ if (rc) |
14981 |
+ goto err_out_shost; |
14982 |
+ |
14983 |
+ pm8001_post_sas_ha_init(shost, chip); |
14984 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
14985 |
+index 7593f248afb2c..155382ce84698 100644 |
14986 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.c |
14987 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
14988 |
+@@ -3363,7 +3363,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) |
14989 |
+ pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); |
14990 |
+ spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); |
14991 |
+ if (pm8001_ha->flags == PM8001F_RUN_TIME) |
14992 |
+- msleep(200);/*delay a moment to wait disk to spinup*/ |
14993 |
++ mdelay(200); /* delay a moment to wait for disk to spin up */ |
14994 |
+ pm8001_bytes_dmaed(pm8001_ha, phy_id); |
14995 |
+ } |
14996 |
+ |
14997 |
+diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c |
14998 |
+index 61fab01d2d527..f5fc7f518f8af 100644 |
14999 |
+--- a/drivers/scsi/qedi/qedi_main.c |
15000 |
++++ b/drivers/scsi/qedi/qedi_main.c |
15001 |
+@@ -2766,7 +2766,7 @@ retry_probe: |
15002 |
+ QEDI_ERR(&qedi->dbg_ctx, |
15003 |
+ "Unable to start offload thread!\n"); |
15004 |
+ rc = -ENODEV; |
15005 |
+- goto free_cid_que; |
15006 |
++ goto free_tmf_thread; |
15007 |
+ } |
15008 |
+ |
15009 |
+ INIT_DELAYED_WORK(&qedi->recovery_work, qedi_recovery_handler); |
15010 |
+@@ -2790,6 +2790,8 @@ retry_probe: |
15011 |
+ |
15012 |
+ return 0; |
15013 |
+ |
15014 |
++free_tmf_thread: |
15015 |
++ destroy_workqueue(qedi->tmf_thread); |
15016 |
+ free_cid_que: |
15017 |
+ qedi_release_cid_que(qedi); |
15018 |
+ free_uio: |
15019 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
15020 |
+index 898c70b8ebbf6..52e8b555bd1dc 100644 |
15021 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
15022 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
15023 |
+@@ -1268,9 +1268,10 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport) |
15024 |
+ lio->u.logio.flags |= SRB_LOGIN_NVME_PRLI; |
15025 |
+ |
15026 |
+ ql_dbg(ql_dbg_disc, vha, 0x211b, |
15027 |
+- "Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d %s.\n", |
15028 |
++ "Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d fc4type %x priority %x %s.\n", |
15029 |
+ fcport->port_name, sp->handle, fcport->loop_id, fcport->d_id.b24, |
15030 |
+- fcport->login_retry, NVME_TARGET(vha->hw, fcport) ? "nvme" : "fc"); |
15031 |
++ fcport->login_retry, fcport->fc4_type, vha->hw->fc4_type_priority, |
15032 |
++ NVME_TARGET(vha->hw, fcport) ? "nvme" : "fcp"); |
15033 |
+ |
15034 |
+ rval = qla2x00_start_sp(sp); |
15035 |
+ if (rval != QLA_SUCCESS) { |
15036 |
+@@ -1932,26 +1933,58 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea) |
15037 |
+ break; |
15038 |
+ } |
15039 |
+ |
15040 |
+- /* |
15041 |
+- * Retry PRLI with other FC-4 type if failure occurred on dual |
15042 |
+- * FCP/NVMe port |
15043 |
+- */ |
15044 |
+- if (NVME_FCP_TARGET(ea->fcport)) { |
15045 |
+- ql_dbg(ql_dbg_disc, vha, 0x2118, |
15046 |
+- "%s %d %8phC post %s prli\n", |
15047 |
+- __func__, __LINE__, ea->fcport->port_name, |
15048 |
+- (ea->fcport->fc4_type & FS_FC4TYPE_NVME) ? |
15049 |
+- "NVMe" : "FCP"); |
15050 |
+- if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME) |
15051 |
++ ql_dbg(ql_dbg_disc, vha, 0x2118, |
15052 |
++ "%s %d %8phC priority %s, fc4type %x\n", |
15053 |
++ __func__, __LINE__, ea->fcport->port_name, |
15054 |
++ vha->hw->fc4_type_priority == FC4_PRIORITY_FCP ? |
15055 |
++ "FCP" : "NVMe", ea->fcport->fc4_type); |
15056 |
++ |
15057 |
++ if (N2N_TOPO(vha->hw)) { |
15058 |
++ if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME) { |
15059 |
+ ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME; |
15060 |
+- else |
15061 |
++ ea->fcport->fc4_type |= FS_FC4TYPE_FCP; |
15062 |
++ } else { |
15063 |
+ ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP; |
15064 |
+- } |
15065 |
++ ea->fcport->fc4_type |= FS_FC4TYPE_NVME; |
15066 |
++ } |
15067 |
+ |
15068 |
+- ea->fcport->flags &= ~FCF_ASYNC_SENT; |
15069 |
+- ea->fcport->keep_nport_handle = 0; |
15070 |
+- ea->fcport->logout_on_delete = 1; |
15071 |
+- qlt_schedule_sess_for_deletion(ea->fcport); |
15072 |
++ if (ea->fcport->n2n_link_reset_cnt < 3) { |
15073 |
++ ea->fcport->n2n_link_reset_cnt++; |
15074 |
++ vha->relogin_jif = jiffies + 2 * HZ; |
15075 |
++ /* |
15076 |
++ * PRLI failed. Reset link to kick start |
15077 |
++ * state machine |
15078 |
++ */ |
15079 |
++ set_bit(N2N_LINK_RESET, &vha->dpc_flags); |
15080 |
++ } else { |
15081 |
++ ql_log(ql_log_warn, vha, 0x2119, |
15082 |
++ "%s %d %8phC Unable to reconnect\n", |
15083 |
++ __func__, __LINE__, |
15084 |
++ ea->fcport->port_name); |
15085 |
++ } |
15086 |
++ } else { |
15087 |
++ /* |
15088 |
++ * switch connect. login failed. Take connection down |
15089 |
++ * and allow relogin to retrigger |
15090 |
++ */ |
15091 |
++ if (NVME_FCP_TARGET(ea->fcport)) { |
15092 |
++ ql_dbg(ql_dbg_disc, vha, 0x2118, |
15093 |
++ "%s %d %8phC post %s prli\n", |
15094 |
++ __func__, __LINE__, |
15095 |
++ ea->fcport->port_name, |
15096 |
++ (ea->fcport->fc4_type & FS_FC4TYPE_NVME) |
15097 |
++ ? "NVMe" : "FCP"); |
15098 |
++ if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME) |
15099 |
++ ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME; |
15100 |
++ else |
15101 |
++ ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP; |
15102 |
++ } |
15103 |
++ |
15104 |
++ ea->fcport->flags &= ~FCF_ASYNC_SENT; |
15105 |
++ ea->fcport->keep_nport_handle = 0; |
15106 |
++ ea->fcport->logout_on_delete = 1; |
15107 |
++ qlt_schedule_sess_for_deletion(ea->fcport); |
15108 |
++ } |
15109 |
+ break; |
15110 |
+ } |
15111 |
+ } |
15112 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
15113 |
+index 07afd0d8a8f3e..d6325fb2ef73b 100644 |
15114 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
15115 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
15116 |
+@@ -1129,7 +1129,7 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha) |
15117 |
+ if (ha->flags.scm_supported_a && |
15118 |
+ (ha->fw_attributes_ext[0] & FW_ATTR_EXT0_SCM_SUPPORTED)) { |
15119 |
+ ha->flags.scm_supported_f = 1; |
15120 |
+- ha->sf_init_cb->flags |= BIT_13; |
15121 |
++ ha->sf_init_cb->flags |= cpu_to_le16(BIT_13); |
15122 |
+ } |
15123 |
+ ql_log(ql_log_info, vha, 0x11a3, "SCM in FW: %s\n", |
15124 |
+ (ha->flags.scm_supported_f) ? "Supported" : |
15125 |
+@@ -1137,9 +1137,9 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha) |
15126 |
+ |
15127 |
+ if (vha->flags.nvme2_enabled) { |
15128 |
+ /* set BIT_15 of special feature control block for SLER */ |
15129 |
+- ha->sf_init_cb->flags |= BIT_15; |
15130 |
++ ha->sf_init_cb->flags |= cpu_to_le16(BIT_15); |
15131 |
+ /* set BIT_14 of special feature control block for PI CTRL*/ |
15132 |
+- ha->sf_init_cb->flags |= BIT_14; |
15133 |
++ ha->sf_init_cb->flags |= cpu_to_le16(BIT_14); |
15134 |
+ } |
15135 |
+ } |
15136 |
+ |
15137 |
+@@ -3998,9 +3998,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, |
15138 |
+ fcport->scan_state = QLA_FCPORT_FOUND; |
15139 |
+ fcport->n2n_flag = 1; |
15140 |
+ fcport->keep_nport_handle = 1; |
15141 |
+- fcport->fc4_type = FS_FC4TYPE_FCP; |
15142 |
+- if (vha->flags.nvme_enabled) |
15143 |
+- fcport->fc4_type |= FS_FC4TYPE_NVME; |
15144 |
+ |
15145 |
+ if (wwn_to_u64(vha->port_name) > |
15146 |
+ wwn_to_u64(fcport->port_name)) { |
15147 |
+diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c |
15148 |
+index bd8623ee156a6..26c13a953b975 100644 |
15149 |
+--- a/drivers/scsi/qla2xxx/qla_tmpl.c |
15150 |
++++ b/drivers/scsi/qla2xxx/qla_tmpl.c |
15151 |
+@@ -928,7 +928,8 @@ qla27xx_template_checksum(void *p, ulong size) |
15152 |
+ static inline int |
15153 |
+ qla27xx_verify_template_checksum(struct qla27xx_fwdt_template *tmp) |
15154 |
+ { |
15155 |
+- return qla27xx_template_checksum(tmp, tmp->template_size) == 0; |
15156 |
++ return qla27xx_template_checksum(tmp, |
15157 |
++ le32_to_cpu(tmp->template_size)) == 0; |
15158 |
+ } |
15159 |
+ |
15160 |
+ static inline int |
15161 |
+@@ -944,7 +945,7 @@ qla27xx_execute_fwdt_template(struct scsi_qla_host *vha, |
15162 |
+ ulong len = 0; |
15163 |
+ |
15164 |
+ if (qla27xx_fwdt_template_valid(tmp)) { |
15165 |
+- len = tmp->template_size; |
15166 |
++ len = le32_to_cpu(tmp->template_size); |
15167 |
+ tmp = memcpy(buf, tmp, len); |
15168 |
+ ql27xx_edit_template(vha, tmp); |
15169 |
+ qla27xx_walk_template(vha, tmp, buf, &len); |
15170 |
+@@ -960,7 +961,7 @@ qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *vha, void *p) |
15171 |
+ ulong len = 0; |
15172 |
+ |
15173 |
+ if (qla27xx_fwdt_template_valid(tmp)) { |
15174 |
+- len = tmp->template_size; |
15175 |
++ len = le32_to_cpu(tmp->template_size); |
15176 |
+ qla27xx_walk_template(vha, tmp, NULL, &len); |
15177 |
+ } |
15178 |
+ |
15179 |
+@@ -972,7 +973,7 @@ qla27xx_fwdt_template_size(void *p) |
15180 |
+ { |
15181 |
+ struct qla27xx_fwdt_template *tmp = p; |
15182 |
+ |
15183 |
+- return tmp->template_size; |
15184 |
++ return le32_to_cpu(tmp->template_size); |
15185 |
+ } |
15186 |
+ |
15187 |
+ int |
15188 |
+diff --git a/drivers/scsi/qla2xxx/qla_tmpl.h b/drivers/scsi/qla2xxx/qla_tmpl.h |
15189 |
+index c47184db50813..6e0987edfcebc 100644 |
15190 |
+--- a/drivers/scsi/qla2xxx/qla_tmpl.h |
15191 |
++++ b/drivers/scsi/qla2xxx/qla_tmpl.h |
15192 |
+@@ -12,7 +12,7 @@ |
15193 |
+ struct __packed qla27xx_fwdt_template { |
15194 |
+ __le32 template_type; |
15195 |
+ __le32 entry_offset; |
15196 |
+- uint32_t template_size; |
15197 |
++ __le32 template_size; |
15198 |
+ uint32_t count; /* borrow field for running/residual count */ |
15199 |
+ |
15200 |
+ __le32 entry_count; |
15201 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
15202 |
+index 03c6d0620bfd0..2d17137f8ff3b 100644 |
15203 |
+--- a/drivers/scsi/scsi_lib.c |
15204 |
++++ b/drivers/scsi/scsi_lib.c |
15205 |
+@@ -2948,6 +2948,78 @@ void sdev_enable_disk_events(struct scsi_device *sdev) |
15206 |
+ } |
15207 |
+ EXPORT_SYMBOL(sdev_enable_disk_events); |
15208 |
+ |
15209 |
++static unsigned char designator_prio(const unsigned char *d) |
15210 |
++{ |
15211 |
++ if (d[1] & 0x30) |
15212 |
++ /* not associated with LUN */ |
15213 |
++ return 0; |
15214 |
++ |
15215 |
++ if (d[3] == 0) |
15216 |
++ /* invalid length */ |
15217 |
++ return 0; |
15218 |
++ |
15219 |
++ /* |
15220 |
++ * Order of preference for lun descriptor: |
15221 |
++ * - SCSI name string |
15222 |
++ * - NAA IEEE Registered Extended |
15223 |
++ * - EUI-64 based 16-byte |
15224 |
++ * - EUI-64 based 12-byte |
15225 |
++ * - NAA IEEE Registered |
15226 |
++ * - NAA IEEE Extended |
15227 |
++ * - EUI-64 based 8-byte |
15228 |
++ * - SCSI name string (truncated) |
15229 |
++ * - T10 Vendor ID |
15230 |
++ * as longer descriptors reduce the likelyhood |
15231 |
++ * of identification clashes. |
15232 |
++ */ |
15233 |
++ |
15234 |
++ switch (d[1] & 0xf) { |
15235 |
++ case 8: |
15236 |
++ /* SCSI name string, variable-length UTF-8 */ |
15237 |
++ return 9; |
15238 |
++ case 3: |
15239 |
++ switch (d[4] >> 4) { |
15240 |
++ case 6: |
15241 |
++ /* NAA registered extended */ |
15242 |
++ return 8; |
15243 |
++ case 5: |
15244 |
++ /* NAA registered */ |
15245 |
++ return 5; |
15246 |
++ case 4: |
15247 |
++ /* NAA extended */ |
15248 |
++ return 4; |
15249 |
++ case 3: |
15250 |
++ /* NAA locally assigned */ |
15251 |
++ return 1; |
15252 |
++ default: |
15253 |
++ break; |
15254 |
++ } |
15255 |
++ break; |
15256 |
++ case 2: |
15257 |
++ switch (d[3]) { |
15258 |
++ case 16: |
15259 |
++ /* EUI64-based, 16 byte */ |
15260 |
++ return 7; |
15261 |
++ case 12: |
15262 |
++ /* EUI64-based, 12 byte */ |
15263 |
++ return 6; |
15264 |
++ case 8: |
15265 |
++ /* EUI64-based, 8 byte */ |
15266 |
++ return 3; |
15267 |
++ default: |
15268 |
++ break; |
15269 |
++ } |
15270 |
++ break; |
15271 |
++ case 1: |
15272 |
++ /* T10 vendor ID */ |
15273 |
++ return 1; |
15274 |
++ default: |
15275 |
++ break; |
15276 |
++ } |
15277 |
++ |
15278 |
++ return 0; |
15279 |
++} |
15280 |
++ |
15281 |
+ /** |
15282 |
+ * scsi_vpd_lun_id - return a unique device identification |
15283 |
+ * @sdev: SCSI device |
15284 |
+@@ -2964,7 +3036,7 @@ EXPORT_SYMBOL(sdev_enable_disk_events); |
15285 |
+ */ |
15286 |
+ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
15287 |
+ { |
15288 |
+- u8 cur_id_type = 0xff; |
15289 |
++ u8 cur_id_prio = 0; |
15290 |
+ u8 cur_id_size = 0; |
15291 |
+ const unsigned char *d, *cur_id_str; |
15292 |
+ const struct scsi_vpd *vpd_pg83; |
15293 |
+@@ -2977,20 +3049,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
15294 |
+ return -ENXIO; |
15295 |
+ } |
15296 |
+ |
15297 |
+- /* |
15298 |
+- * Look for the correct descriptor. |
15299 |
+- * Order of preference for lun descriptor: |
15300 |
+- * - SCSI name string |
15301 |
+- * - NAA IEEE Registered Extended |
15302 |
+- * - EUI-64 based 16-byte |
15303 |
+- * - EUI-64 based 12-byte |
15304 |
+- * - NAA IEEE Registered |
15305 |
+- * - NAA IEEE Extended |
15306 |
+- * - T10 Vendor ID |
15307 |
+- * as longer descriptors reduce the likelyhood |
15308 |
+- * of identification clashes. |
15309 |
+- */ |
15310 |
+- |
15311 |
+ /* The id string must be at least 20 bytes + terminating NULL byte */ |
15312 |
+ if (id_len < 21) { |
15313 |
+ rcu_read_unlock(); |
15314 |
+@@ -3000,8 +3058,9 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
15315 |
+ memset(id, 0, id_len); |
15316 |
+ d = vpd_pg83->data + 4; |
15317 |
+ while (d < vpd_pg83->data + vpd_pg83->len) { |
15318 |
+- /* Skip designators not referring to the LUN */ |
15319 |
+- if ((d[1] & 0x30) != 0x00) |
15320 |
++ u8 prio = designator_prio(d); |
15321 |
++ |
15322 |
++ if (prio == 0 || cur_id_prio > prio) |
15323 |
+ goto next_desig; |
15324 |
+ |
15325 |
+ switch (d[1] & 0xf) { |
15326 |
+@@ -3009,28 +3068,19 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
15327 |
+ /* T10 Vendor ID */ |
15328 |
+ if (cur_id_size > d[3]) |
15329 |
+ break; |
15330 |
+- /* Prefer anything */ |
15331 |
+- if (cur_id_type > 0x01 && cur_id_type != 0xff) |
15332 |
+- break; |
15333 |
++ cur_id_prio = prio; |
15334 |
+ cur_id_size = d[3]; |
15335 |
+ if (cur_id_size + 4 > id_len) |
15336 |
+ cur_id_size = id_len - 4; |
15337 |
+ cur_id_str = d + 4; |
15338 |
+- cur_id_type = d[1] & 0xf; |
15339 |
+ id_size = snprintf(id, id_len, "t10.%*pE", |
15340 |
+ cur_id_size, cur_id_str); |
15341 |
+ break; |
15342 |
+ case 0x2: |
15343 |
+ /* EUI-64 */ |
15344 |
+- if (cur_id_size > d[3]) |
15345 |
+- break; |
15346 |
+- /* Prefer NAA IEEE Registered Extended */ |
15347 |
+- if (cur_id_type == 0x3 && |
15348 |
+- cur_id_size == d[3]) |
15349 |
+- break; |
15350 |
++ cur_id_prio = prio; |
15351 |
+ cur_id_size = d[3]; |
15352 |
+ cur_id_str = d + 4; |
15353 |
+- cur_id_type = d[1] & 0xf; |
15354 |
+ switch (cur_id_size) { |
15355 |
+ case 8: |
15356 |
+ id_size = snprintf(id, id_len, |
15357 |
+@@ -3048,17 +3098,14 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
15358 |
+ cur_id_str); |
15359 |
+ break; |
15360 |
+ default: |
15361 |
+- cur_id_size = 0; |
15362 |
+ break; |
15363 |
+ } |
15364 |
+ break; |
15365 |
+ case 0x3: |
15366 |
+ /* NAA */ |
15367 |
+- if (cur_id_size > d[3]) |
15368 |
+- break; |
15369 |
++ cur_id_prio = prio; |
15370 |
+ cur_id_size = d[3]; |
15371 |
+ cur_id_str = d + 4; |
15372 |
+- cur_id_type = d[1] & 0xf; |
15373 |
+ switch (cur_id_size) { |
15374 |
+ case 8: |
15375 |
+ id_size = snprintf(id, id_len, |
15376 |
+@@ -3071,26 +3118,25 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) |
15377 |
+ cur_id_str); |
15378 |
+ break; |
15379 |
+ default: |
15380 |
+- cur_id_size = 0; |
15381 |
+ break; |
15382 |
+ } |
15383 |
+ break; |
15384 |
+ case 0x8: |
15385 |
+ /* SCSI name string */ |
15386 |
+- if (cur_id_size + 4 > d[3]) |
15387 |
++ if (cur_id_size > d[3]) |
15388 |
+ break; |
15389 |
+ /* Prefer others for truncated descriptor */ |
15390 |
+- if (cur_id_size && d[3] > id_len) |
15391 |
+- break; |
15392 |
++ if (d[3] > id_len) { |
15393 |
++ prio = 2; |
15394 |
++ if (cur_id_prio > prio) |
15395 |
++ break; |
15396 |
++ } |
15397 |
++ cur_id_prio = prio; |
15398 |
+ cur_id_size = id_size = d[3]; |
15399 |
+ cur_id_str = d + 4; |
15400 |
+- cur_id_type = d[1] & 0xf; |
15401 |
+ if (cur_id_size >= id_len) |
15402 |
+ cur_id_size = id_len - 1; |
15403 |
+ memcpy(id, cur_id_str, cur_id_size); |
15404 |
+- /* Decrease priority for truncated descriptor */ |
15405 |
+- if (cur_id_size != id_size) |
15406 |
+- cur_id_size = 6; |
15407 |
+ break; |
15408 |
+ default: |
15409 |
+ break; |
15410 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
15411 |
+index 2eb3e4f9375a5..2e68c0a876986 100644 |
15412 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
15413 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
15414 |
+@@ -2313,7 +2313,9 @@ iscsi_create_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid) |
15415 |
+ return conn; |
15416 |
+ |
15417 |
+ release_conn_ref: |
15418 |
+- put_device(&conn->dev); |
15419 |
++ device_unregister(&conn->dev); |
15420 |
++ put_device(&session->dev); |
15421 |
++ return NULL; |
15422 |
+ release_parent_ref: |
15423 |
+ put_device(&session->dev); |
15424 |
+ free_conn: |
15425 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
15426 |
+index 0c148fcd24deb..911aba3e7675c 100644 |
15427 |
+--- a/drivers/scsi/ufs/ufshcd.c |
15428 |
++++ b/drivers/scsi/ufs/ufshcd.c |
15429 |
+@@ -1751,8 +1751,9 @@ static void __ufshcd_release(struct ufs_hba *hba) |
15430 |
+ |
15431 |
+ if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended || |
15432 |
+ hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL || |
15433 |
+- ufshcd_any_tag_in_use(hba) || hba->outstanding_tasks || |
15434 |
+- hba->active_uic_cmd || hba->uic_async_done) |
15435 |
++ hba->outstanding_tasks || |
15436 |
++ hba->active_uic_cmd || hba->uic_async_done || |
15437 |
++ hba->clk_gating.state == CLKS_OFF) |
15438 |
+ return; |
15439 |
+ |
15440 |
+ hba->clk_gating.state = REQ_CLKS_OFF; |
15441 |
+diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c |
15442 |
+index 4aad2566f52d2..f04b961b96cd4 100644 |
15443 |
+--- a/drivers/slimbus/qcom-ctrl.c |
15444 |
++++ b/drivers/slimbus/qcom-ctrl.c |
15445 |
+@@ -472,15 +472,10 @@ static void qcom_slim_rxwq(struct work_struct *work) |
15446 |
+ static void qcom_slim_prg_slew(struct platform_device *pdev, |
15447 |
+ struct qcom_slim_ctrl *ctrl) |
15448 |
+ { |
15449 |
+- struct resource *slew_mem; |
15450 |
+- |
15451 |
+ if (!ctrl->slew_reg) { |
15452 |
+ /* SLEW RATE register for this SLIMbus */ |
15453 |
+- slew_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
15454 |
+- "slew"); |
15455 |
+- ctrl->slew_reg = devm_ioremap(&pdev->dev, slew_mem->start, |
15456 |
+- resource_size(slew_mem)); |
15457 |
+- if (!ctrl->slew_reg) |
15458 |
++ ctrl->slew_reg = devm_platform_ioremap_resource_byname(pdev, "slew"); |
15459 |
++ if (IS_ERR(ctrl->slew_reg)) |
15460 |
+ return; |
15461 |
+ } |
15462 |
+ |
15463 |
+diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
15464 |
+index 218aefc3531cd..50cfd67c2871e 100644 |
15465 |
+--- a/drivers/slimbus/qcom-ngd-ctrl.c |
15466 |
++++ b/drivers/slimbus/qcom-ngd-ctrl.c |
15467 |
+@@ -1205,6 +1205,9 @@ static int qcom_slim_ngd_runtime_resume(struct device *dev) |
15468 |
+ struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); |
15469 |
+ int ret = 0; |
15470 |
+ |
15471 |
++ if (!ctrl->qmi.handle) |
15472 |
++ return 0; |
15473 |
++ |
15474 |
+ if (ctrl->state >= QCOM_SLIM_NGD_CTRL_ASLEEP) |
15475 |
+ ret = qcom_slim_ngd_power_up(ctrl); |
15476 |
+ if (ret) { |
15477 |
+@@ -1503,6 +1506,9 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev) |
15478 |
+ struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); |
15479 |
+ int ret = 0; |
15480 |
+ |
15481 |
++ if (!ctrl->qmi.handle) |
15482 |
++ return 0; |
15483 |
++ |
15484 |
+ ret = qcom_slim_qmi_power_request(ctrl, false); |
15485 |
+ if (ret && ret != -EBUSY) |
15486 |
+ dev_info(ctrl->dev, "slim resource not idle:%d\n", ret); |
15487 |
+diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c |
15488 |
+index c655f5f92b124..d0329ad170d13 100644 |
15489 |
+--- a/drivers/soc/amlogic/meson-canvas.c |
15490 |
++++ b/drivers/soc/amlogic/meson-canvas.c |
15491 |
+@@ -72,8 +72,10 @@ struct meson_canvas *meson_canvas_get(struct device *dev) |
15492 |
+ * current state, this driver probe cannot return -EPROBE_DEFER |
15493 |
+ */ |
15494 |
+ canvas = dev_get_drvdata(&canvas_pdev->dev); |
15495 |
+- if (!canvas) |
15496 |
++ if (!canvas) { |
15497 |
++ put_device(&canvas_pdev->dev); |
15498 |
+ return ERR_PTR(-EINVAL); |
15499 |
++ } |
15500 |
+ |
15501 |
+ return canvas; |
15502 |
+ } |
15503 |
+diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c |
15504 |
+index f669d3754627d..ca75b14931ec9 100644 |
15505 |
+--- a/drivers/soc/mediatek/mtk-scpsys.c |
15506 |
++++ b/drivers/soc/mediatek/mtk-scpsys.c |
15507 |
+@@ -524,6 +524,7 @@ static void mtk_register_power_domains(struct platform_device *pdev, |
15508 |
+ for (i = 0; i < num; i++) { |
15509 |
+ struct scp_domain *scpd = &scp->domains[i]; |
15510 |
+ struct generic_pm_domain *genpd = &scpd->genpd; |
15511 |
++ bool on; |
15512 |
+ |
15513 |
+ /* |
15514 |
+ * Initially turn on all domains to make the domains usable |
15515 |
+@@ -531,9 +532,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, |
15516 |
+ * software. The unused domains will be switched off during |
15517 |
+ * late_init time. |
15518 |
+ */ |
15519 |
+- genpd->power_on(genpd); |
15520 |
++ on = !WARN_ON(genpd->power_on(genpd) < 0); |
15521 |
+ |
15522 |
+- pm_genpd_init(genpd, NULL, false); |
15523 |
++ pm_genpd_init(genpd, NULL, !on); |
15524 |
+ } |
15525 |
+ |
15526 |
+ /* |
15527 |
+diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c |
15528 |
+index 088dc99f77f3f..f63135c09667f 100644 |
15529 |
+--- a/drivers/soc/qcom/pdr_interface.c |
15530 |
++++ b/drivers/soc/qcom/pdr_interface.c |
15531 |
+@@ -569,7 +569,7 @@ EXPORT_SYMBOL(pdr_add_lookup); |
15532 |
+ int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds) |
15533 |
+ { |
15534 |
+ struct servreg_restart_pd_resp resp; |
15535 |
+- struct servreg_restart_pd_req req; |
15536 |
++ struct servreg_restart_pd_req req = { 0 }; |
15537 |
+ struct sockaddr_qrtr addr; |
15538 |
+ struct pdr_service *tmp; |
15539 |
+ struct qmi_txn txn; |
15540 |
+diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c |
15541 |
+index d0e4f520cff8c..751a49f6534f4 100644 |
15542 |
+--- a/drivers/soc/qcom/qcom-geni-se.c |
15543 |
++++ b/drivers/soc/qcom/qcom-geni-se.c |
15544 |
+@@ -289,10 +289,23 @@ static void geni_se_select_fifo_mode(struct geni_se *se) |
15545 |
+ |
15546 |
+ static void geni_se_select_dma_mode(struct geni_se *se) |
15547 |
+ { |
15548 |
++ u32 proto = geni_se_read_proto(se); |
15549 |
+ u32 val; |
15550 |
+ |
15551 |
+ geni_se_irq_clear(se); |
15552 |
+ |
15553 |
++ val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN); |
15554 |
++ if (proto != GENI_SE_UART) { |
15555 |
++ val &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN); |
15556 |
++ val &= ~(M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN); |
15557 |
++ } |
15558 |
++ writel_relaxed(val, se->base + SE_GENI_M_IRQ_EN); |
15559 |
++ |
15560 |
++ val = readl_relaxed(se->base + SE_GENI_S_IRQ_EN); |
15561 |
++ if (proto != GENI_SE_UART) |
15562 |
++ val &= ~S_CMD_DONE_EN; |
15563 |
++ writel_relaxed(val, se->base + SE_GENI_S_IRQ_EN); |
15564 |
++ |
15565 |
+ val = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN); |
15566 |
+ val |= GENI_DMA_MODE_EN; |
15567 |
+ writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN); |
15568 |
+@@ -651,7 +664,7 @@ int geni_se_tx_dma_prep(struct geni_se *se, void *buf, size_t len, |
15569 |
+ writel_relaxed(lower_32_bits(*iova), se->base + SE_DMA_TX_PTR_L); |
15570 |
+ writel_relaxed(upper_32_bits(*iova), se->base + SE_DMA_TX_PTR_H); |
15571 |
+ writel_relaxed(GENI_SE_DMA_EOT_BUF, se->base + SE_DMA_TX_ATTR); |
15572 |
+- writel_relaxed(len, se->base + SE_DMA_TX_LEN); |
15573 |
++ writel(len, se->base + SE_DMA_TX_LEN); |
15574 |
+ return 0; |
15575 |
+ } |
15576 |
+ EXPORT_SYMBOL(geni_se_tx_dma_prep); |
15577 |
+@@ -688,7 +701,7 @@ int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len, |
15578 |
+ writel_relaxed(upper_32_bits(*iova), se->base + SE_DMA_RX_PTR_H); |
15579 |
+ /* RX does not have EOT buffer type bit. So just reset RX_ATTR */ |
15580 |
+ writel_relaxed(0, se->base + SE_DMA_RX_ATTR); |
15581 |
+- writel_relaxed(len, se->base + SE_DMA_RX_LEN); |
15582 |
++ writel(len, se->base + SE_DMA_RX_LEN); |
15583 |
+ return 0; |
15584 |
+ } |
15585 |
+ EXPORT_SYMBOL(geni_se_rx_dma_prep); |
15586 |
+diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c |
15587 |
+index 07183d731d747..a9709aae54abb 100644 |
15588 |
+--- a/drivers/soc/qcom/smp2p.c |
15589 |
++++ b/drivers/soc/qcom/smp2p.c |
15590 |
+@@ -318,15 +318,16 @@ static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p, |
15591 |
+ static int smp2p_update_bits(void *data, u32 mask, u32 value) |
15592 |
+ { |
15593 |
+ struct smp2p_entry *entry = data; |
15594 |
++ unsigned long flags; |
15595 |
+ u32 orig; |
15596 |
+ u32 val; |
15597 |
+ |
15598 |
+- spin_lock(&entry->lock); |
15599 |
++ spin_lock_irqsave(&entry->lock, flags); |
15600 |
+ val = orig = readl(entry->value); |
15601 |
+ val &= ~mask; |
15602 |
+ val |= value; |
15603 |
+ writel(val, entry->value); |
15604 |
+- spin_unlock(&entry->lock); |
15605 |
++ spin_unlock_irqrestore(&entry->lock, flags); |
15606 |
+ |
15607 |
+ if (val != orig) |
15608 |
+ qcom_smp2p_kick(entry->smp2p); |
15609 |
+diff --git a/drivers/soc/renesas/rmobile-sysc.c b/drivers/soc/renesas/rmobile-sysc.c |
15610 |
+index 54b616ad4a62a..beb1c7211c3d6 100644 |
15611 |
+--- a/drivers/soc/renesas/rmobile-sysc.c |
15612 |
++++ b/drivers/soc/renesas/rmobile-sysc.c |
15613 |
+@@ -327,6 +327,7 @@ static int __init rmobile_init_pm_domains(void) |
15614 |
+ |
15615 |
+ pmd = of_get_child_by_name(np, "pm-domains"); |
15616 |
+ if (!pmd) { |
15617 |
++ iounmap(base); |
15618 |
+ pr_warn("%pOF lacks pm-domains node\n", np); |
15619 |
+ continue; |
15620 |
+ } |
15621 |
+diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c |
15622 |
+index eece97f97ef8f..b29e829e815e5 100644 |
15623 |
+--- a/drivers/soc/rockchip/io-domain.c |
15624 |
++++ b/drivers/soc/rockchip/io-domain.c |
15625 |
+@@ -547,6 +547,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev) |
15626 |
+ if (uV < 0) { |
15627 |
+ dev_err(iod->dev, "Can't determine voltage: %s\n", |
15628 |
+ supply_name); |
15629 |
++ ret = uV; |
15630 |
+ goto unreg_notify; |
15631 |
+ } |
15632 |
+ |
15633 |
+diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c |
15634 |
+index 8c863ecb1c605..56597f6ea666a 100644 |
15635 |
+--- a/drivers/soc/ti/knav_dma.c |
15636 |
++++ b/drivers/soc/ti/knav_dma.c |
15637 |
+@@ -749,8 +749,9 @@ static int knav_dma_probe(struct platform_device *pdev) |
15638 |
+ pm_runtime_enable(kdev->dev); |
15639 |
+ ret = pm_runtime_get_sync(kdev->dev); |
15640 |
+ if (ret < 0) { |
15641 |
++ pm_runtime_put_noidle(kdev->dev); |
15642 |
+ dev_err(kdev->dev, "unable to enable pktdma, err %d\n", ret); |
15643 |
+- return ret; |
15644 |
++ goto err_pm_disable; |
15645 |
+ } |
15646 |
+ |
15647 |
+ /* Initialise all packet dmas */ |
15648 |
+@@ -764,7 +765,8 @@ static int knav_dma_probe(struct platform_device *pdev) |
15649 |
+ |
15650 |
+ if (list_empty(&kdev->list)) { |
15651 |
+ dev_err(dev, "no valid dma instance\n"); |
15652 |
+- return -ENODEV; |
15653 |
++ ret = -ENODEV; |
15654 |
++ goto err_put_sync; |
15655 |
+ } |
15656 |
+ |
15657 |
+ debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL, |
15658 |
+@@ -772,6 +774,13 @@ static int knav_dma_probe(struct platform_device *pdev) |
15659 |
+ |
15660 |
+ device_ready = true; |
15661 |
+ return ret; |
15662 |
++ |
15663 |
++err_put_sync: |
15664 |
++ pm_runtime_put_sync(kdev->dev); |
15665 |
++err_pm_disable: |
15666 |
++ pm_runtime_disable(kdev->dev); |
15667 |
++ |
15668 |
++ return ret; |
15669 |
+ } |
15670 |
+ |
15671 |
+ static int knav_dma_remove(struct platform_device *pdev) |
15672 |
+diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c |
15673 |
+index a460f201bf8e7..53e36d4328d1e 100644 |
15674 |
+--- a/drivers/soc/ti/knav_qmss_queue.c |
15675 |
++++ b/drivers/soc/ti/knav_qmss_queue.c |
15676 |
+@@ -1784,6 +1784,7 @@ static int knav_queue_probe(struct platform_device *pdev) |
15677 |
+ pm_runtime_enable(&pdev->dev); |
15678 |
+ ret = pm_runtime_get_sync(&pdev->dev); |
15679 |
+ if (ret < 0) { |
15680 |
++ pm_runtime_put_noidle(&pdev->dev); |
15681 |
+ dev_err(dev, "Failed to enable QMSS\n"); |
15682 |
+ return ret; |
15683 |
+ } |
15684 |
+@@ -1851,9 +1852,10 @@ static int knav_queue_probe(struct platform_device *pdev) |
15685 |
+ if (ret) |
15686 |
+ goto err; |
15687 |
+ |
15688 |
+- regions = of_get_child_by_name(node, "descriptor-regions"); |
15689 |
++ regions = of_get_child_by_name(node, "descriptor-regions"); |
15690 |
+ if (!regions) { |
15691 |
+ dev_err(dev, "descriptor-regions not specified\n"); |
15692 |
++ ret = -ENODEV; |
15693 |
+ goto err; |
15694 |
+ } |
15695 |
+ ret = knav_queue_setup_regions(kdev, regions); |
15696 |
+diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c |
15697 |
+index 980b04c38fd94..4d41dc3cdce1f 100644 |
15698 |
+--- a/drivers/soc/ti/omap_prm.c |
15699 |
++++ b/drivers/soc/ti/omap_prm.c |
15700 |
+@@ -484,6 +484,10 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev, |
15701 |
+ struct ti_prm_platform_data *pdata = dev_get_platdata(reset->dev); |
15702 |
+ int ret = 0; |
15703 |
+ |
15704 |
++ /* Nothing to do if the reset is already deasserted */ |
15705 |
++ if (!omap_reset_status(rcdev, id)) |
15706 |
++ return 0; |
15707 |
++ |
15708 |
+ has_rstst = reset->prm->data->rstst || |
15709 |
+ (reset->prm->data->flags & OMAP_PRM_HAS_RSTST); |
15710 |
+ |
15711 |
+diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c |
15712 |
+index 3488bb824e845..9b05c9e25ebe4 100644 |
15713 |
+--- a/drivers/soundwire/master.c |
15714 |
++++ b/drivers/soundwire/master.c |
15715 |
+@@ -8,6 +8,15 @@ |
15716 |
+ #include <linux/soundwire/sdw_type.h> |
15717 |
+ #include "bus.h" |
15718 |
+ |
15719 |
++/* |
15720 |
++ * The 3s value for autosuspend will only be used if there are no |
15721 |
++ * devices physically attached on a bus segment. In practice enabling |
15722 |
++ * the bus operation will result in children devices become active and |
15723 |
++ * the master device will only suspend when all its children are no |
15724 |
++ * longer active. |
15725 |
++ */ |
15726 |
++#define SDW_MASTER_SUSPEND_DELAY_MS 3000 |
15727 |
++ |
15728 |
+ /* |
15729 |
+ * The sysfs for properties reflects the MIPI description as given |
15730 |
+ * in the MIPI DisCo spec |
15731 |
+@@ -154,7 +163,12 @@ int sdw_master_device_add(struct sdw_bus *bus, struct device *parent, |
15732 |
+ bus->dev = &md->dev; |
15733 |
+ bus->md = md; |
15734 |
+ |
15735 |
++ pm_runtime_set_autosuspend_delay(&bus->md->dev, SDW_MASTER_SUSPEND_DELAY_MS); |
15736 |
++ pm_runtime_use_autosuspend(&bus->md->dev); |
15737 |
++ pm_runtime_mark_last_busy(&bus->md->dev); |
15738 |
++ pm_runtime_set_active(&bus->md->dev); |
15739 |
+ pm_runtime_enable(&bus->md->dev); |
15740 |
++ pm_runtime_idle(&bus->md->dev); |
15741 |
+ device_register_err: |
15742 |
+ return ret; |
15743 |
+ } |
15744 |
+diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c |
15745 |
+index fbca4ebf63e92..6d22df01f3547 100644 |
15746 |
+--- a/drivers/soundwire/qcom.c |
15747 |
++++ b/drivers/soundwire/qcom.c |
15748 |
+@@ -799,7 +799,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) |
15749 |
+ data = of_device_get_match_data(dev); |
15750 |
+ ctrl->rows_index = sdw_find_row_index(data->default_rows); |
15751 |
+ ctrl->cols_index = sdw_find_col_index(data->default_cols); |
15752 |
+-#if IS_ENABLED(CONFIG_SLIMBUS) |
15753 |
++#if IS_REACHABLE(CONFIG_SLIMBUS) |
15754 |
+ if (dev->parent->bus == &slimbus_bus) { |
15755 |
+ #else |
15756 |
+ if (false) { |
15757 |
+diff --git a/drivers/soundwire/sysfs_slave_dpn.c b/drivers/soundwire/sysfs_slave_dpn.c |
15758 |
+index 05a721ea9830a..c4b6543c09fd6 100644 |
15759 |
+--- a/drivers/soundwire/sysfs_slave_dpn.c |
15760 |
++++ b/drivers/soundwire/sysfs_slave_dpn.c |
15761 |
+@@ -37,6 +37,7 @@ static int field##_attribute_alloc(struct device *dev, \ |
15762 |
+ return -ENOMEM; \ |
15763 |
+ dpn_attr->N = N; \ |
15764 |
+ dpn_attr->dir = dir; \ |
15765 |
++ sysfs_attr_init(&dpn_attr->dev_attr.attr); \ |
15766 |
+ dpn_attr->format_string = format_string; \ |
15767 |
+ dpn_attr->dev_attr.attr.name = __stringify(field); \ |
15768 |
+ dpn_attr->dev_attr.attr.mode = 0444; \ |
15769 |
+diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig |
15770 |
+index 5cff60de8e834..3fd16b7f61507 100644 |
15771 |
+--- a/drivers/spi/Kconfig |
15772 |
++++ b/drivers/spi/Kconfig |
15773 |
+@@ -255,6 +255,7 @@ config SPI_DW_MMIO |
15774 |
+ config SPI_DW_BT1 |
15775 |
+ tristate "Baikal-T1 SPI driver for DW SPI core" |
15776 |
+ depends on MIPS_BAIKAL_T1 || COMPILE_TEST |
15777 |
++ select MULTIPLEXER |
15778 |
+ help |
15779 |
+ Baikal-T1 SoC is equipped with three DW APB SSI-based MMIO SPI |
15780 |
+ controllers. Two of them are pretty much normal: with IRQ, DMA, |
15781 |
+diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c |
15782 |
+index 8c009c175f2c4..1e63fd4821f96 100644 |
15783 |
+--- a/drivers/spi/atmel-quadspi.c |
15784 |
++++ b/drivers/spi/atmel-quadspi.c |
15785 |
+@@ -365,10 +365,14 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, |
15786 |
+ if (dummy_cycles) |
15787 |
+ ifr |= QSPI_IFR_NBDUM(dummy_cycles); |
15788 |
+ |
15789 |
+- /* Set data enable */ |
15790 |
+- if (op->data.nbytes) |
15791 |
++ /* Set data enable and data transfer type. */ |
15792 |
++ if (op->data.nbytes) { |
15793 |
+ ifr |= QSPI_IFR_DATAEN; |
15794 |
+ |
15795 |
++ if (op->addr.nbytes) |
15796 |
++ ifr |= QSPI_IFR_TFRTYP_MEM; |
15797 |
++ } |
15798 |
++ |
15799 |
+ /* |
15800 |
+ * If the QSPI controller is set in regular SPI mode, set it in |
15801 |
+ * Serial Memory Mode (SMM). |
15802 |
+@@ -393,7 +397,7 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, |
15803 |
+ atmel_qspi_write(icr, aq, QSPI_WICR); |
15804 |
+ atmel_qspi_write(ifr, aq, QSPI_IFR); |
15805 |
+ } else { |
15806 |
+- if (op->data.dir == SPI_MEM_DATA_OUT) |
15807 |
++ if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) |
15808 |
+ ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; |
15809 |
+ |
15810 |
+ /* Set QSPI Instruction Frame registers */ |
15811 |
+@@ -535,7 +539,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
15812 |
+ struct resource *res; |
15813 |
+ int irq, err = 0; |
15814 |
+ |
15815 |
+- ctrl = spi_alloc_master(&pdev->dev, sizeof(*aq)); |
15816 |
++ ctrl = devm_spi_alloc_master(&pdev->dev, sizeof(*aq)); |
15817 |
+ if (!ctrl) |
15818 |
+ return -ENOMEM; |
15819 |
+ |
15820 |
+@@ -557,8 +561,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
15821 |
+ aq->regs = devm_ioremap_resource(&pdev->dev, res); |
15822 |
+ if (IS_ERR(aq->regs)) { |
15823 |
+ dev_err(&pdev->dev, "missing registers\n"); |
15824 |
+- err = PTR_ERR(aq->regs); |
15825 |
+- goto exit; |
15826 |
++ return PTR_ERR(aq->regs); |
15827 |
+ } |
15828 |
+ |
15829 |
+ /* Map the AHB memory */ |
15830 |
+@@ -566,8 +569,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
15831 |
+ aq->mem = devm_ioremap_resource(&pdev->dev, res); |
15832 |
+ if (IS_ERR(aq->mem)) { |
15833 |
+ dev_err(&pdev->dev, "missing AHB memory\n"); |
15834 |
+- err = PTR_ERR(aq->mem); |
15835 |
+- goto exit; |
15836 |
++ return PTR_ERR(aq->mem); |
15837 |
+ } |
15838 |
+ |
15839 |
+ aq->mmap_size = resource_size(res); |
15840 |
+@@ -579,22 +581,21 @@ static int atmel_qspi_probe(struct platform_device *pdev) |
15841 |
+ |
15842 |
+ if (IS_ERR(aq->pclk)) { |
15843 |
+ dev_err(&pdev->dev, "missing peripheral clock\n"); |
15844 |
+- err = PTR_ERR(aq->pclk); |
15845 |
+- goto exit; |
15846 |
++ return PTR_ERR(aq->pclk); |
15847 |
+ } |
15848 |
+ |
15849 |
+ /* Enable the peripheral clock */ |
15850 |
+ err = clk_prepare_enable(aq->pclk); |
15851 |
+ if (err) { |
15852 |
+ dev_err(&pdev->dev, "failed to enable the peripheral clock\n"); |
15853 |
+- goto exit; |
15854 |
++ return err; |
15855 |
+ } |
15856 |
+ |
15857 |
+ aq->caps = of_device_get_match_data(&pdev->dev); |
15858 |
+ if (!aq->caps) { |
15859 |
+ dev_err(&pdev->dev, "Could not retrieve QSPI caps\n"); |
15860 |
+ err = -EINVAL; |
15861 |
+- goto exit; |
15862 |
++ goto disable_pclk; |
15863 |
+ } |
15864 |
+ |
15865 |
+ if (aq->caps->has_qspick) { |
15866 |
+@@ -638,8 +639,6 @@ disable_qspick: |
15867 |
+ clk_disable_unprepare(aq->qspick); |
15868 |
+ disable_pclk: |
15869 |
+ clk_disable_unprepare(aq->pclk); |
15870 |
+-exit: |
15871 |
+- spi_controller_put(ctrl); |
15872 |
+ |
15873 |
+ return err; |
15874 |
+ } |
15875 |
+diff --git a/drivers/spi/spi-ar934x.c b/drivers/spi/spi-ar934x.c |
15876 |
+index d08dec09d423d..def32e0aaefe3 100644 |
15877 |
+--- a/drivers/spi/spi-ar934x.c |
15878 |
++++ b/drivers/spi/spi-ar934x.c |
15879 |
+@@ -176,10 +176,11 @@ static int ar934x_spi_probe(struct platform_device *pdev) |
15880 |
+ if (ret) |
15881 |
+ return ret; |
15882 |
+ |
15883 |
+- ctlr = spi_alloc_master(&pdev->dev, sizeof(*sp)); |
15884 |
++ ctlr = devm_spi_alloc_master(&pdev->dev, sizeof(*sp)); |
15885 |
+ if (!ctlr) { |
15886 |
+ dev_info(&pdev->dev, "failed to allocate spi controller\n"); |
15887 |
+- return -ENOMEM; |
15888 |
++ ret = -ENOMEM; |
15889 |
++ goto err_clk_disable; |
15890 |
+ } |
15891 |
+ |
15892 |
+ /* disable flash mapping and expose spi controller registers */ |
15893 |
+@@ -202,7 +203,13 @@ static int ar934x_spi_probe(struct platform_device *pdev) |
15894 |
+ sp->clk_freq = clk_get_rate(clk); |
15895 |
+ sp->ctlr = ctlr; |
15896 |
+ |
15897 |
+- return devm_spi_register_controller(&pdev->dev, ctlr); |
15898 |
++ ret = spi_register_controller(ctlr); |
15899 |
++ if (!ret) |
15900 |
++ return 0; |
15901 |
++ |
15902 |
++err_clk_disable: |
15903 |
++ clk_disable_unprepare(clk); |
15904 |
++ return ret; |
15905 |
+ } |
15906 |
+ |
15907 |
+ static int ar934x_spi_remove(struct platform_device *pdev) |
15908 |
+@@ -213,6 +220,7 @@ static int ar934x_spi_remove(struct platform_device *pdev) |
15909 |
+ ctlr = dev_get_drvdata(&pdev->dev); |
15910 |
+ sp = spi_controller_get_devdata(ctlr); |
15911 |
+ |
15912 |
++ spi_unregister_controller(ctlr); |
15913 |
+ clk_disable_unprepare(sp->clk); |
15914 |
+ |
15915 |
+ return 0; |
15916 |
+diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c |
15917 |
+index 9909b18f3c5a5..1f08d7553f079 100644 |
15918 |
+--- a/drivers/spi/spi-bcm63xx-hsspi.c |
15919 |
++++ b/drivers/spi/spi-bcm63xx-hsspi.c |
15920 |
+@@ -494,8 +494,10 @@ static int bcm63xx_hsspi_resume(struct device *dev) |
15921 |
+ |
15922 |
+ if (bs->pll_clk) { |
15923 |
+ ret = clk_prepare_enable(bs->pll_clk); |
15924 |
+- if (ret) |
15925 |
++ if (ret) { |
15926 |
++ clk_disable_unprepare(bs->clk); |
15927 |
+ return ret; |
15928 |
++ } |
15929 |
+ } |
15930 |
+ |
15931 |
+ spi_master_resume(master); |
15932 |
+diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c |
15933 |
+index 818f2b22875d2..7453a1dbbc061 100644 |
15934 |
+--- a/drivers/spi/spi-davinci.c |
15935 |
++++ b/drivers/spi/spi-davinci.c |
15936 |
+@@ -1040,13 +1040,13 @@ static int davinci_spi_remove(struct platform_device *pdev) |
15937 |
+ spi_bitbang_stop(&dspi->bitbang); |
15938 |
+ |
15939 |
+ clk_disable_unprepare(dspi->clk); |
15940 |
+- spi_master_put(master); |
15941 |
+ |
15942 |
+ if (dspi->dma_rx) { |
15943 |
+ dma_release_channel(dspi->dma_rx); |
15944 |
+ dma_release_channel(dspi->dma_tx); |
15945 |
+ } |
15946 |
+ |
15947 |
++ spi_master_put(master); |
15948 |
+ return 0; |
15949 |
+ } |
15950 |
+ |
15951 |
+diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c |
15952 |
+index f382dfad78421..c279b7891e3ac 100644 |
15953 |
+--- a/drivers/spi/spi-dw-bt1.c |
15954 |
++++ b/drivers/spi/spi-dw-bt1.c |
15955 |
+@@ -280,8 +280,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) |
15956 |
+ dws->bus_num = pdev->id; |
15957 |
+ dws->reg_io_width = 4; |
15958 |
+ dws->max_freq = clk_get_rate(dwsbt1->clk); |
15959 |
+- if (!dws->max_freq) |
15960 |
++ if (!dws->max_freq) { |
15961 |
++ ret = -EINVAL; |
15962 |
+ goto err_disable_clk; |
15963 |
++ } |
15964 |
+ |
15965 |
+ init_func = device_get_match_data(&pdev->dev); |
15966 |
+ ret = init_func(pdev, dwsbt1); |
15967 |
+diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c |
15968 |
+index 1a08c1d584abe..0287366874882 100644 |
15969 |
+--- a/drivers/spi/spi-fsl-dspi.c |
15970 |
++++ b/drivers/spi/spi-fsl-dspi.c |
15971 |
+@@ -1165,7 +1165,7 @@ static int dspi_init(struct fsl_dspi *dspi) |
15972 |
+ unsigned int mcr; |
15973 |
+ |
15974 |
+ /* Set idle states for all chip select signals to high */ |
15975 |
+- mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->num_chipselect - 1, 0)); |
15976 |
++ mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->max_native_cs - 1, 0)); |
15977 |
+ |
15978 |
+ if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) |
15979 |
+ mcr |= SPI_MCR_XSPI; |
15980 |
+@@ -1250,7 +1250,7 @@ static int dspi_probe(struct platform_device *pdev) |
15981 |
+ |
15982 |
+ pdata = dev_get_platdata(&pdev->dev); |
15983 |
+ if (pdata) { |
15984 |
+- ctlr->num_chipselect = pdata->cs_num; |
15985 |
++ ctlr->num_chipselect = ctlr->max_native_cs = pdata->cs_num; |
15986 |
+ ctlr->bus_num = pdata->bus_num; |
15987 |
+ |
15988 |
+ /* Only Coldfire uses platform data */ |
15989 |
+@@ -1263,7 +1263,7 @@ static int dspi_probe(struct platform_device *pdev) |
15990 |
+ dev_err(&pdev->dev, "can't get spi-num-chipselects\n"); |
15991 |
+ goto out_ctlr_put; |
15992 |
+ } |
15993 |
+- ctlr->num_chipselect = cs_num; |
15994 |
++ ctlr->num_chipselect = ctlr->max_native_cs = cs_num; |
15995 |
+ |
15996 |
+ of_property_read_u32(np, "bus-num", &bus_num); |
15997 |
+ ctlr->bus_num = bus_num; |
15998 |
+diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c |
15999 |
+index 299e9870cf58d..9494257e1c33f 100644 |
16000 |
+--- a/drivers/spi/spi-fsl-spi.c |
16001 |
++++ b/drivers/spi/spi-fsl-spi.c |
16002 |
+@@ -716,10 +716,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
16003 |
+ type = fsl_spi_get_type(&ofdev->dev); |
16004 |
+ if (type == TYPE_FSL) { |
16005 |
+ struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); |
16006 |
++ bool spisel_boot = false; |
16007 |
+ #if IS_ENABLED(CONFIG_FSL_SOC) |
16008 |
+ struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); |
16009 |
+- bool spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); |
16010 |
+ |
16011 |
++ spisel_boot = of_property_read_bool(np, "fsl,spisel_boot"); |
16012 |
+ if (spisel_boot) { |
16013 |
+ pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4); |
16014 |
+ if (!pinfo->immr_spi_cs) |
16015 |
+@@ -734,10 +735,14 @@ static int of_fsl_spi_probe(struct platform_device *ofdev) |
16016 |
+ * supported on the GRLIB variant. |
16017 |
+ */ |
16018 |
+ ret = gpiod_count(dev, "cs"); |
16019 |
+- if (ret <= 0) |
16020 |
++ if (ret < 0) |
16021 |
++ ret = 0; |
16022 |
++ if (ret == 0 && !spisel_boot) { |
16023 |
+ pdata->max_chipselect = 1; |
16024 |
+- else |
16025 |
++ } else { |
16026 |
++ pdata->max_chipselect = ret + spisel_boot; |
16027 |
+ pdata->cs_control = fsl_spi_cs_control; |
16028 |
++ } |
16029 |
+ } |
16030 |
+ |
16031 |
+ ret = of_address_to_resource(np, 0, &mem); |
16032 |
+diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c |
16033 |
+index 25810a7eef101..0e3d8e6c08f42 100644 |
16034 |
+--- a/drivers/spi/spi-geni-qcom.c |
16035 |
++++ b/drivers/spi/spi-geni-qcom.c |
16036 |
+@@ -603,7 +603,7 @@ static int spi_geni_probe(struct platform_device *pdev) |
16037 |
+ if (IS_ERR(clk)) |
16038 |
+ return PTR_ERR(clk); |
16039 |
+ |
16040 |
+- spi = spi_alloc_master(dev, sizeof(*mas)); |
16041 |
++ spi = devm_spi_alloc_master(dev, sizeof(*mas)); |
16042 |
+ if (!spi) |
16043 |
+ return -ENOMEM; |
16044 |
+ |
16045 |
+@@ -673,7 +673,6 @@ spi_geni_probe_free_irq: |
16046 |
+ free_irq(mas->irq, spi); |
16047 |
+ spi_geni_probe_runtime_disable: |
16048 |
+ pm_runtime_disable(dev); |
16049 |
+- spi_master_put(spi); |
16050 |
+ dev_pm_opp_of_remove_table(&pdev->dev); |
16051 |
+ put_clkname: |
16052 |
+ dev_pm_opp_put_clkname(mas->se.opp_table); |
16053 |
+diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c |
16054 |
+index 7ceb0ba27b755..0584f4d2fde29 100644 |
16055 |
+--- a/drivers/spi/spi-gpio.c |
16056 |
++++ b/drivers/spi/spi-gpio.c |
16057 |
+@@ -350,11 +350,6 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev, |
16058 |
+ return 0; |
16059 |
+ } |
16060 |
+ |
16061 |
+-static void spi_gpio_put(void *data) |
16062 |
+-{ |
16063 |
+- spi_master_put(data); |
16064 |
+-} |
16065 |
+- |
16066 |
+ static int spi_gpio_probe(struct platform_device *pdev) |
16067 |
+ { |
16068 |
+ int status; |
16069 |
+@@ -363,16 +358,10 @@ static int spi_gpio_probe(struct platform_device *pdev) |
16070 |
+ struct device *dev = &pdev->dev; |
16071 |
+ struct spi_bitbang *bb; |
16072 |
+ |
16073 |
+- master = spi_alloc_master(dev, sizeof(*spi_gpio)); |
16074 |
++ master = devm_spi_alloc_master(dev, sizeof(*spi_gpio)); |
16075 |
+ if (!master) |
16076 |
+ return -ENOMEM; |
16077 |
+ |
16078 |
+- status = devm_add_action_or_reset(&pdev->dev, spi_gpio_put, master); |
16079 |
+- if (status) { |
16080 |
+- spi_master_put(master); |
16081 |
+- return status; |
16082 |
+- } |
16083 |
+- |
16084 |
+ if (pdev->dev.of_node) |
16085 |
+ status = spi_gpio_probe_dt(pdev, master); |
16086 |
+ else |
16087 |
+@@ -432,7 +421,7 @@ static int spi_gpio_probe(struct platform_device *pdev) |
16088 |
+ if (status) |
16089 |
+ return status; |
16090 |
+ |
16091 |
+- return devm_spi_register_master(&pdev->dev, spi_master_get(master)); |
16092 |
++ return devm_spi_register_master(&pdev->dev, master); |
16093 |
+ } |
16094 |
+ |
16095 |
+ MODULE_ALIAS("platform:" DRIVER_NAME); |
16096 |
+diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c |
16097 |
+index b068537375d60..5f05d519fbbd0 100644 |
16098 |
+--- a/drivers/spi/spi-img-spfi.c |
16099 |
++++ b/drivers/spi/spi-img-spfi.c |
16100 |
+@@ -731,8 +731,10 @@ static int img_spfi_resume(struct device *dev) |
16101 |
+ int ret; |
16102 |
+ |
16103 |
+ ret = pm_runtime_get_sync(dev); |
16104 |
+- if (ret) |
16105 |
++ if (ret) { |
16106 |
++ pm_runtime_put_noidle(dev); |
16107 |
+ return ret; |
16108 |
++ } |
16109 |
+ spfi_reset(spfi); |
16110 |
+ pm_runtime_put(dev); |
16111 |
+ |
16112 |
+diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c |
16113 |
+index 0b597905ee72c..8df5e973404f0 100644 |
16114 |
+--- a/drivers/spi/spi-imx.c |
16115 |
++++ b/drivers/spi/spi-imx.c |
16116 |
+@@ -1538,6 +1538,7 @@ spi_imx_prepare_message(struct spi_master *master, struct spi_message *msg) |
16117 |
+ |
16118 |
+ ret = pm_runtime_get_sync(spi_imx->dev); |
16119 |
+ if (ret < 0) { |
16120 |
++ pm_runtime_put_noidle(spi_imx->dev); |
16121 |
+ dev_err(spi_imx->dev, "failed to enable clock\n"); |
16122 |
+ return ret; |
16123 |
+ } |
16124 |
+@@ -1748,6 +1749,7 @@ static int spi_imx_remove(struct platform_device *pdev) |
16125 |
+ |
16126 |
+ ret = pm_runtime_get_sync(spi_imx->dev); |
16127 |
+ if (ret < 0) { |
16128 |
++ pm_runtime_put_noidle(spi_imx->dev); |
16129 |
+ dev_err(spi_imx->dev, "failed to enable clock\n"); |
16130 |
+ return ret; |
16131 |
+ } |
16132 |
+diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c |
16133 |
+index ef53290b7d24d..4682f49dc7330 100644 |
16134 |
+--- a/drivers/spi/spi-mem.c |
16135 |
++++ b/drivers/spi/spi-mem.c |
16136 |
+@@ -243,6 +243,7 @@ static int spi_mem_access_start(struct spi_mem *mem) |
16137 |
+ |
16138 |
+ ret = pm_runtime_get_sync(ctlr->dev.parent); |
16139 |
+ if (ret < 0) { |
16140 |
++ pm_runtime_put_noidle(ctlr->dev.parent); |
16141 |
+ dev_err(&ctlr->dev, "Failed to power device: %d\n", |
16142 |
+ ret); |
16143 |
+ return ret; |
16144 |
+diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c |
16145 |
+index 2c3b7a2a1ec77..b4b9b7309b5e9 100644 |
16146 |
+--- a/drivers/spi/spi-mt7621.c |
16147 |
++++ b/drivers/spi/spi-mt7621.c |
16148 |
+@@ -350,9 +350,10 @@ static int mt7621_spi_probe(struct platform_device *pdev) |
16149 |
+ if (status) |
16150 |
+ return status; |
16151 |
+ |
16152 |
+- master = spi_alloc_master(&pdev->dev, sizeof(*rs)); |
16153 |
++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*rs)); |
16154 |
+ if (!master) { |
16155 |
+ dev_info(&pdev->dev, "master allocation failed\n"); |
16156 |
++ clk_disable_unprepare(clk); |
16157 |
+ return -ENOMEM; |
16158 |
+ } |
16159 |
+ |
16160 |
+@@ -377,10 +378,15 @@ static int mt7621_spi_probe(struct platform_device *pdev) |
16161 |
+ ret = device_reset(&pdev->dev); |
16162 |
+ if (ret) { |
16163 |
+ dev_err(&pdev->dev, "SPI reset failed!\n"); |
16164 |
++ clk_disable_unprepare(clk); |
16165 |
+ return ret; |
16166 |
+ } |
16167 |
+ |
16168 |
+- return devm_spi_register_controller(&pdev->dev, master); |
16169 |
++ ret = spi_register_controller(master); |
16170 |
++ if (ret) |
16171 |
++ clk_disable_unprepare(clk); |
16172 |
++ |
16173 |
++ return ret; |
16174 |
+ } |
16175 |
+ |
16176 |
+ static int mt7621_spi_remove(struct platform_device *pdev) |
16177 |
+@@ -391,6 +397,7 @@ static int mt7621_spi_remove(struct platform_device *pdev) |
16178 |
+ master = dev_get_drvdata(&pdev->dev); |
16179 |
+ rs = spi_controller_get_devdata(master); |
16180 |
+ |
16181 |
++ spi_unregister_controller(master); |
16182 |
+ clk_disable_unprepare(rs->clk); |
16183 |
+ |
16184 |
+ return 0; |
16185 |
+diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c |
16186 |
+index b97f26a60cbef..288f6c2bbd573 100644 |
16187 |
+--- a/drivers/spi/spi-mtk-nor.c |
16188 |
++++ b/drivers/spi/spi-mtk-nor.c |
16189 |
+@@ -768,7 +768,7 @@ static int mtk_nor_probe(struct platform_device *pdev) |
16190 |
+ return -EINVAL; |
16191 |
+ } |
16192 |
+ |
16193 |
+- ctlr = spi_alloc_master(&pdev->dev, sizeof(*sp)); |
16194 |
++ ctlr = devm_spi_alloc_master(&pdev->dev, sizeof(*sp)); |
16195 |
+ if (!ctlr) { |
16196 |
+ dev_err(&pdev->dev, "failed to allocate spi controller\n"); |
16197 |
+ return -ENOMEM; |
16198 |
+diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c |
16199 |
+index 8c630acb0110b..96b418293bf2a 100644 |
16200 |
+--- a/drivers/spi/spi-mxic.c |
16201 |
++++ b/drivers/spi/spi-mxic.c |
16202 |
+@@ -529,7 +529,7 @@ static int mxic_spi_probe(struct platform_device *pdev) |
16203 |
+ struct mxic_spi *mxic; |
16204 |
+ int ret; |
16205 |
+ |
16206 |
+- master = spi_alloc_master(&pdev->dev, sizeof(struct mxic_spi)); |
16207 |
++ master = devm_spi_alloc_master(&pdev->dev, sizeof(struct mxic_spi)); |
16208 |
+ if (!master) |
16209 |
+ return -ENOMEM; |
16210 |
+ |
16211 |
+@@ -574,15 +574,9 @@ static int mxic_spi_probe(struct platform_device *pdev) |
16212 |
+ ret = spi_register_master(master); |
16213 |
+ if (ret) { |
16214 |
+ dev_err(&pdev->dev, "spi_register_master failed\n"); |
16215 |
+- goto err_put_master; |
16216 |
++ pm_runtime_disable(&pdev->dev); |
16217 |
+ } |
16218 |
+ |
16219 |
+- return 0; |
16220 |
+- |
16221 |
+-err_put_master: |
16222 |
+- spi_master_put(master); |
16223 |
+- pm_runtime_disable(&pdev->dev); |
16224 |
+- |
16225 |
+ return ret; |
16226 |
+ } |
16227 |
+ |
16228 |
+diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c |
16229 |
+index 918918a9e0491..435309b09227e 100644 |
16230 |
+--- a/drivers/spi/spi-mxs.c |
16231 |
++++ b/drivers/spi/spi-mxs.c |
16232 |
+@@ -607,6 +607,7 @@ static int mxs_spi_probe(struct platform_device *pdev) |
16233 |
+ |
16234 |
+ ret = pm_runtime_get_sync(ssp->dev); |
16235 |
+ if (ret < 0) { |
16236 |
++ pm_runtime_put_noidle(ssp->dev); |
16237 |
+ dev_err(ssp->dev, "runtime_get_sync failed\n"); |
16238 |
+ goto out_pm_runtime_disable; |
16239 |
+ } |
16240 |
+diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c |
16241 |
+index 1cb9329de945e..b62471ab6d7f2 100644 |
16242 |
+--- a/drivers/spi/spi-npcm-fiu.c |
16243 |
++++ b/drivers/spi/spi-npcm-fiu.c |
16244 |
+@@ -677,7 +677,7 @@ static int npcm_fiu_probe(struct platform_device *pdev) |
16245 |
+ struct npcm_fiu_spi *fiu; |
16246 |
+ void __iomem *regbase; |
16247 |
+ struct resource *res; |
16248 |
+- int id; |
16249 |
++ int id, ret; |
16250 |
+ |
16251 |
+ ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); |
16252 |
+ if (!ctrl) |
16253 |
+@@ -735,7 +735,11 @@ static int npcm_fiu_probe(struct platform_device *pdev) |
16254 |
+ ctrl->num_chipselect = fiu->info->max_cs; |
16255 |
+ ctrl->dev.of_node = dev->of_node; |
16256 |
+ |
16257 |
+- return devm_spi_register_master(dev, ctrl); |
16258 |
++ ret = devm_spi_register_master(dev, ctrl); |
16259 |
++ if (ret) |
16260 |
++ clk_disable_unprepare(fiu->clk); |
16261 |
++ |
16262 |
++ return ret; |
16263 |
+ } |
16264 |
+ |
16265 |
+ static int npcm_fiu_remove(struct platform_device *pdev) |
16266 |
+diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c |
16267 |
+index 156961b4ca86f..104bde153efd2 100644 |
16268 |
+--- a/drivers/spi/spi-pic32.c |
16269 |
++++ b/drivers/spi/spi-pic32.c |
16270 |
+@@ -839,6 +839,7 @@ static int pic32_spi_probe(struct platform_device *pdev) |
16271 |
+ return 0; |
16272 |
+ |
16273 |
+ err_bailout: |
16274 |
++ pic32_spi_dma_unprep(pic32s); |
16275 |
+ clk_disable_unprepare(pic32s->clk); |
16276 |
+ err_master: |
16277 |
+ spi_master_put(master); |
16278 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
16279 |
+index 814268405ab0b..d6b534d38e5da 100644 |
16280 |
+--- a/drivers/spi/spi-pxa2xx.c |
16281 |
++++ b/drivers/spi/spi-pxa2xx.c |
16282 |
+@@ -1686,9 +1686,9 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) |
16283 |
+ } |
16284 |
+ |
16285 |
+ if (platform_info->is_slave) |
16286 |
+- controller = spi_alloc_slave(dev, sizeof(struct driver_data)); |
16287 |
++ controller = devm_spi_alloc_slave(dev, sizeof(*drv_data)); |
16288 |
+ else |
16289 |
+- controller = spi_alloc_master(dev, sizeof(struct driver_data)); |
16290 |
++ controller = devm_spi_alloc_master(dev, sizeof(*drv_data)); |
16291 |
+ |
16292 |
+ if (!controller) { |
16293 |
+ dev_err(&pdev->dev, "cannot alloc spi_controller\n"); |
16294 |
+@@ -1911,7 +1911,6 @@ out_error_dma_irq_alloc: |
16295 |
+ free_irq(ssp->irq, drv_data); |
16296 |
+ |
16297 |
+ out_error_controller_alloc: |
16298 |
+- spi_controller_put(controller); |
16299 |
+ pxa_ssp_free(ssp); |
16300 |
+ return status; |
16301 |
+ } |
16302 |
+diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c |
16303 |
+index 5eed88af6899b..8863be3708845 100644 |
16304 |
+--- a/drivers/spi/spi-qcom-qspi.c |
16305 |
++++ b/drivers/spi/spi-qcom-qspi.c |
16306 |
+@@ -462,7 +462,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) |
16307 |
+ |
16308 |
+ dev = &pdev->dev; |
16309 |
+ |
16310 |
+- master = spi_alloc_master(dev, sizeof(*ctrl)); |
16311 |
++ master = devm_spi_alloc_master(dev, sizeof(*ctrl)); |
16312 |
+ if (!master) |
16313 |
+ return -ENOMEM; |
16314 |
+ |
16315 |
+@@ -473,54 +473,49 @@ static int qcom_qspi_probe(struct platform_device *pdev) |
16316 |
+ spin_lock_init(&ctrl->lock); |
16317 |
+ ctrl->dev = dev; |
16318 |
+ ctrl->base = devm_platform_ioremap_resource(pdev, 0); |
16319 |
+- if (IS_ERR(ctrl->base)) { |
16320 |
+- ret = PTR_ERR(ctrl->base); |
16321 |
+- goto exit_probe_master_put; |
16322 |
+- } |
16323 |
++ if (IS_ERR(ctrl->base)) |
16324 |
++ return PTR_ERR(ctrl->base); |
16325 |
+ |
16326 |
+ ctrl->clks = devm_kcalloc(dev, QSPI_NUM_CLKS, |
16327 |
+ sizeof(*ctrl->clks), GFP_KERNEL); |
16328 |
+- if (!ctrl->clks) { |
16329 |
+- ret = -ENOMEM; |
16330 |
+- goto exit_probe_master_put; |
16331 |
+- } |
16332 |
++ if (!ctrl->clks) |
16333 |
++ return -ENOMEM; |
16334 |
+ |
16335 |
+ ctrl->clks[QSPI_CLK_CORE].id = "core"; |
16336 |
+ ctrl->clks[QSPI_CLK_IFACE].id = "iface"; |
16337 |
+ ret = devm_clk_bulk_get(dev, QSPI_NUM_CLKS, ctrl->clks); |
16338 |
+ if (ret) |
16339 |
+- goto exit_probe_master_put; |
16340 |
++ return ret; |
16341 |
+ |
16342 |
+ ctrl->icc_path_cpu_to_qspi = devm_of_icc_get(dev, "qspi-config"); |
16343 |
+- if (IS_ERR(ctrl->icc_path_cpu_to_qspi)) { |
16344 |
+- ret = dev_err_probe(dev, PTR_ERR(ctrl->icc_path_cpu_to_qspi), |
16345 |
+- "Failed to get cpu path\n"); |
16346 |
+- goto exit_probe_master_put; |
16347 |
+- } |
16348 |
++ if (IS_ERR(ctrl->icc_path_cpu_to_qspi)) |
16349 |
++ return dev_err_probe(dev, PTR_ERR(ctrl->icc_path_cpu_to_qspi), |
16350 |
++ "Failed to get cpu path\n"); |
16351 |
++ |
16352 |
+ /* Set BW vote for register access */ |
16353 |
+ ret = icc_set_bw(ctrl->icc_path_cpu_to_qspi, Bps_to_icc(1000), |
16354 |
+ Bps_to_icc(1000)); |
16355 |
+ if (ret) { |
16356 |
+ dev_err(ctrl->dev, "%s: ICC BW voting failed for cpu: %d\n", |
16357 |
+ __func__, ret); |
16358 |
+- goto exit_probe_master_put; |
16359 |
++ return ret; |
16360 |
+ } |
16361 |
+ |
16362 |
+ ret = icc_disable(ctrl->icc_path_cpu_to_qspi); |
16363 |
+ if (ret) { |
16364 |
+ dev_err(ctrl->dev, "%s: ICC disable failed for cpu: %d\n", |
16365 |
+ __func__, ret); |
16366 |
+- goto exit_probe_master_put; |
16367 |
++ return ret; |
16368 |
+ } |
16369 |
+ |
16370 |
+ ret = platform_get_irq(pdev, 0); |
16371 |
+ if (ret < 0) |
16372 |
+- goto exit_probe_master_put; |
16373 |
++ return ret; |
16374 |
+ ret = devm_request_irq(dev, ret, qcom_qspi_irq, |
16375 |
+ IRQF_TRIGGER_HIGH, dev_name(dev), ctrl); |
16376 |
+ if (ret) { |
16377 |
+ dev_err(dev, "Failed to request irq %d\n", ret); |
16378 |
+- goto exit_probe_master_put; |
16379 |
++ return ret; |
16380 |
+ } |
16381 |
+ |
16382 |
+ master->max_speed_hz = 300000000; |
16383 |
+@@ -537,10 +532,8 @@ static int qcom_qspi_probe(struct platform_device *pdev) |
16384 |
+ master->auto_runtime_pm = true; |
16385 |
+ |
16386 |
+ ctrl->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core"); |
16387 |
+- if (IS_ERR(ctrl->opp_table)) { |
16388 |
+- ret = PTR_ERR(ctrl->opp_table); |
16389 |
+- goto exit_probe_master_put; |
16390 |
+- } |
16391 |
++ if (IS_ERR(ctrl->opp_table)) |
16392 |
++ return PTR_ERR(ctrl->opp_table); |
16393 |
+ /* OPP table is optional */ |
16394 |
+ ret = dev_pm_opp_of_add_table(&pdev->dev); |
16395 |
+ if (ret && ret != -ENODEV) { |
16396 |
+@@ -562,9 +555,6 @@ static int qcom_qspi_probe(struct platform_device *pdev) |
16397 |
+ exit_probe_put_clkname: |
16398 |
+ dev_pm_opp_put_clkname(ctrl->opp_table); |
16399 |
+ |
16400 |
+-exit_probe_master_put: |
16401 |
+- spi_master_put(master); |
16402 |
+- |
16403 |
+ return ret; |
16404 |
+ } |
16405 |
+ |
16406 |
+diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c |
16407 |
+index 8aa51beb4ff3e..9f97d18a05c10 100644 |
16408 |
+--- a/drivers/spi/spi-rb4xx.c |
16409 |
++++ b/drivers/spi/spi-rb4xx.c |
16410 |
+@@ -143,7 +143,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev) |
16411 |
+ if (IS_ERR(spi_base)) |
16412 |
+ return PTR_ERR(spi_base); |
16413 |
+ |
16414 |
+- master = spi_alloc_master(&pdev->dev, sizeof(*rbspi)); |
16415 |
++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*rbspi)); |
16416 |
+ if (!master) |
16417 |
+ return -ENOMEM; |
16418 |
+ |
16419 |
+diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c |
16420 |
+index ed3e548227f47..3579675485a5e 100644 |
16421 |
+--- a/drivers/spi/spi-rpc-if.c |
16422 |
++++ b/drivers/spi/spi-rpc-if.c |
16423 |
+@@ -134,7 +134,7 @@ static int rpcif_spi_probe(struct platform_device *pdev) |
16424 |
+ struct rpcif *rpc; |
16425 |
+ int error; |
16426 |
+ |
16427 |
+- ctlr = spi_alloc_master(&pdev->dev, sizeof(*rpc)); |
16428 |
++ ctlr = devm_spi_alloc_master(&pdev->dev, sizeof(*rpc)); |
16429 |
+ if (!ctlr) |
16430 |
+ return -ENOMEM; |
16431 |
+ |
16432 |
+@@ -159,13 +159,8 @@ static int rpcif_spi_probe(struct platform_device *pdev) |
16433 |
+ error = spi_register_controller(ctlr); |
16434 |
+ if (error) { |
16435 |
+ dev_err(&pdev->dev, "spi_register_controller failed\n"); |
16436 |
+- goto err_put_ctlr; |
16437 |
++ rpcif_disable_rpm(rpc); |
16438 |
+ } |
16439 |
+- return 0; |
16440 |
+- |
16441 |
+-err_put_ctlr: |
16442 |
+- rpcif_disable_rpm(rpc); |
16443 |
+- spi_controller_put(ctlr); |
16444 |
+ |
16445 |
+ return error; |
16446 |
+ } |
16447 |
+diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c |
16448 |
+index ee0f3edf49cdb..297c512069a57 100644 |
16449 |
+--- a/drivers/spi/spi-sc18is602.c |
16450 |
++++ b/drivers/spi/spi-sc18is602.c |
16451 |
+@@ -238,13 +238,12 @@ static int sc18is602_probe(struct i2c_client *client, |
16452 |
+ struct sc18is602_platform_data *pdata = dev_get_platdata(dev); |
16453 |
+ struct sc18is602 *hw; |
16454 |
+ struct spi_master *master; |
16455 |
+- int error; |
16456 |
+ |
16457 |
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | |
16458 |
+ I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) |
16459 |
+ return -EINVAL; |
16460 |
+ |
16461 |
+- master = spi_alloc_master(dev, sizeof(struct sc18is602)); |
16462 |
++ master = devm_spi_alloc_master(dev, sizeof(struct sc18is602)); |
16463 |
+ if (!master) |
16464 |
+ return -ENOMEM; |
16465 |
+ |
16466 |
+@@ -298,15 +297,7 @@ static int sc18is602_probe(struct i2c_client *client, |
16467 |
+ master->min_speed_hz = hw->freq / 128; |
16468 |
+ master->max_speed_hz = hw->freq / 4; |
16469 |
+ |
16470 |
+- error = devm_spi_register_master(dev, master); |
16471 |
+- if (error) |
16472 |
+- goto error_reg; |
16473 |
+- |
16474 |
+- return 0; |
16475 |
+- |
16476 |
+-error_reg: |
16477 |
+- spi_master_put(master); |
16478 |
+- return error; |
16479 |
++ return devm_spi_register_master(dev, master); |
16480 |
+ } |
16481 |
+ |
16482 |
+ static const struct i2c_device_id sc18is602_id[] = { |
16483 |
+diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c |
16484 |
+index 20bdae5fdf3b8..15123a8f41e1e 100644 |
16485 |
+--- a/drivers/spi/spi-sh.c |
16486 |
++++ b/drivers/spi/spi-sh.c |
16487 |
+@@ -440,7 +440,7 @@ static int spi_sh_probe(struct platform_device *pdev) |
16488 |
+ if (irq < 0) |
16489 |
+ return irq; |
16490 |
+ |
16491 |
+- master = spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data)); |
16492 |
++ master = devm_spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data)); |
16493 |
+ if (master == NULL) { |
16494 |
+ dev_err(&pdev->dev, "spi_alloc_master error.\n"); |
16495 |
+ return -ENOMEM; |
16496 |
+@@ -458,16 +458,14 @@ static int spi_sh_probe(struct platform_device *pdev) |
16497 |
+ break; |
16498 |
+ default: |
16499 |
+ dev_err(&pdev->dev, "No support width\n"); |
16500 |
+- ret = -ENODEV; |
16501 |
+- goto error1; |
16502 |
++ return -ENODEV; |
16503 |
+ } |
16504 |
+ ss->irq = irq; |
16505 |
+ ss->master = master; |
16506 |
+ ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
16507 |
+ if (ss->addr == NULL) { |
16508 |
+ dev_err(&pdev->dev, "ioremap error.\n"); |
16509 |
+- ret = -ENOMEM; |
16510 |
+- goto error1; |
16511 |
++ return -ENOMEM; |
16512 |
+ } |
16513 |
+ INIT_LIST_HEAD(&ss->queue); |
16514 |
+ spin_lock_init(&ss->lock); |
16515 |
+@@ -477,7 +475,7 @@ static int spi_sh_probe(struct platform_device *pdev) |
16516 |
+ ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss); |
16517 |
+ if (ret < 0) { |
16518 |
+ dev_err(&pdev->dev, "request_irq error\n"); |
16519 |
+- goto error1; |
16520 |
++ return ret; |
16521 |
+ } |
16522 |
+ |
16523 |
+ master->num_chipselect = 2; |
16524 |
+@@ -496,9 +494,6 @@ static int spi_sh_probe(struct platform_device *pdev) |
16525 |
+ |
16526 |
+ error3: |
16527 |
+ free_irq(irq, ss); |
16528 |
+- error1: |
16529 |
+- spi_master_put(master); |
16530 |
+- |
16531 |
+ return ret; |
16532 |
+ } |
16533 |
+ |
16534 |
+diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c |
16535 |
+index 635738f54c731..b41a75749b498 100644 |
16536 |
+--- a/drivers/spi/spi-sprd.c |
16537 |
++++ b/drivers/spi/spi-sprd.c |
16538 |
+@@ -1010,6 +1010,7 @@ static int sprd_spi_remove(struct platform_device *pdev) |
16539 |
+ |
16540 |
+ ret = pm_runtime_get_sync(ss->dev); |
16541 |
+ if (ret < 0) { |
16542 |
++ pm_runtime_put_noidle(ss->dev); |
16543 |
+ dev_err(ss->dev, "failed to resume SPI controller\n"); |
16544 |
+ return ret; |
16545 |
+ } |
16546 |
+diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c |
16547 |
+index 77d26d64541a5..6c44dda9ee8c5 100644 |
16548 |
+--- a/drivers/spi/spi-st-ssc4.c |
16549 |
++++ b/drivers/spi/spi-st-ssc4.c |
16550 |
+@@ -375,13 +375,14 @@ static int spi_st_probe(struct platform_device *pdev) |
16551 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
16552 |
+ if (ret) { |
16553 |
+ dev_err(&pdev->dev, "Failed to register master\n"); |
16554 |
+- goto clk_disable; |
16555 |
++ goto rpm_disable; |
16556 |
+ } |
16557 |
+ |
16558 |
+ return 0; |
16559 |
+ |
16560 |
+-clk_disable: |
16561 |
++rpm_disable: |
16562 |
+ pm_runtime_disable(&pdev->dev); |
16563 |
++clk_disable: |
16564 |
+ clk_disable_unprepare(spi_st->clk); |
16565 |
+ put_master: |
16566 |
+ spi_master_put(master); |
16567 |
+diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c |
16568 |
+index a900962b4336e..947e6b9dc9f4d 100644 |
16569 |
+--- a/drivers/spi/spi-stm32-qspi.c |
16570 |
++++ b/drivers/spi/spi-stm32-qspi.c |
16571 |
+@@ -434,8 +434,10 @@ static int stm32_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) |
16572 |
+ int ret; |
16573 |
+ |
16574 |
+ ret = pm_runtime_get_sync(qspi->dev); |
16575 |
+- if (ret < 0) |
16576 |
++ if (ret < 0) { |
16577 |
++ pm_runtime_put_noidle(qspi->dev); |
16578 |
+ return ret; |
16579 |
++ } |
16580 |
+ |
16581 |
+ mutex_lock(&qspi->lock); |
16582 |
+ ret = stm32_qspi_send(mem, op); |
16583 |
+@@ -462,8 +464,10 @@ static int stm32_qspi_setup(struct spi_device *spi) |
16584 |
+ return -EINVAL; |
16585 |
+ |
16586 |
+ ret = pm_runtime_get_sync(qspi->dev); |
16587 |
+- if (ret < 0) |
16588 |
++ if (ret < 0) { |
16589 |
++ pm_runtime_put_noidle(qspi->dev); |
16590 |
+ return ret; |
16591 |
++ } |
16592 |
+ |
16593 |
+ presc = DIV_ROUND_UP(qspi->clk_rate, spi->max_speed_hz) - 1; |
16594 |
+ |
16595 |
+diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c |
16596 |
+index 2cc850eb8922d..471dedf3d3392 100644 |
16597 |
+--- a/drivers/spi/spi-stm32.c |
16598 |
++++ b/drivers/spi/spi-stm32.c |
16599 |
+@@ -2062,6 +2062,7 @@ static int stm32_spi_resume(struct device *dev) |
16600 |
+ |
16601 |
+ ret = pm_runtime_get_sync(dev); |
16602 |
+ if (ret < 0) { |
16603 |
++ pm_runtime_put_noidle(dev); |
16604 |
+ dev_err(dev, "Unable to power device:%d\n", ret); |
16605 |
+ return ret; |
16606 |
+ } |
16607 |
+diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c |
16608 |
+index 42e82dbe3d410..8cdca6ab80989 100644 |
16609 |
+--- a/drivers/spi/spi-synquacer.c |
16610 |
++++ b/drivers/spi/spi-synquacer.c |
16611 |
+@@ -657,7 +657,8 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
16612 |
+ |
16613 |
+ if (!master->max_speed_hz) { |
16614 |
+ dev_err(&pdev->dev, "missing clock source\n"); |
16615 |
+- return -EINVAL; |
16616 |
++ ret = -EINVAL; |
16617 |
++ goto disable_clk; |
16618 |
+ } |
16619 |
+ master->min_speed_hz = master->max_speed_hz / 254; |
16620 |
+ |
16621 |
+@@ -670,7 +671,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
16622 |
+ rx_irq = platform_get_irq(pdev, 0); |
16623 |
+ if (rx_irq <= 0) { |
16624 |
+ ret = rx_irq; |
16625 |
+- goto put_spi; |
16626 |
++ goto disable_clk; |
16627 |
+ } |
16628 |
+ snprintf(sspi->rx_irq_name, SYNQUACER_HSSPI_IRQ_NAME_MAX, "%s-rx", |
16629 |
+ dev_name(&pdev->dev)); |
16630 |
+@@ -678,13 +679,13 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
16631 |
+ 0, sspi->rx_irq_name, sspi); |
16632 |
+ if (ret) { |
16633 |
+ dev_err(&pdev->dev, "request rx_irq failed (%d)\n", ret); |
16634 |
+- goto put_spi; |
16635 |
++ goto disable_clk; |
16636 |
+ } |
16637 |
+ |
16638 |
+ tx_irq = platform_get_irq(pdev, 1); |
16639 |
+ if (tx_irq <= 0) { |
16640 |
+ ret = tx_irq; |
16641 |
+- goto put_spi; |
16642 |
++ goto disable_clk; |
16643 |
+ } |
16644 |
+ snprintf(sspi->tx_irq_name, SYNQUACER_HSSPI_IRQ_NAME_MAX, "%s-tx", |
16645 |
+ dev_name(&pdev->dev)); |
16646 |
+@@ -692,7 +693,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
16647 |
+ 0, sspi->tx_irq_name, sspi); |
16648 |
+ if (ret) { |
16649 |
+ dev_err(&pdev->dev, "request tx_irq failed (%d)\n", ret); |
16650 |
+- goto put_spi; |
16651 |
++ goto disable_clk; |
16652 |
+ } |
16653 |
+ |
16654 |
+ master->dev.of_node = np; |
16655 |
+@@ -710,7 +711,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
16656 |
+ |
16657 |
+ ret = synquacer_spi_enable(master); |
16658 |
+ if (ret) |
16659 |
+- goto fail_enable; |
16660 |
++ goto disable_clk; |
16661 |
+ |
16662 |
+ pm_runtime_set_active(sspi->dev); |
16663 |
+ pm_runtime_enable(sspi->dev); |
16664 |
+@@ -723,7 +724,7 @@ static int synquacer_spi_probe(struct platform_device *pdev) |
16665 |
+ |
16666 |
+ disable_pm: |
16667 |
+ pm_runtime_disable(sspi->dev); |
16668 |
+-fail_enable: |
16669 |
++disable_clk: |
16670 |
+ clk_disable_unprepare(sspi->clk); |
16671 |
+ put_spi: |
16672 |
+ spi_master_put(master); |
16673 |
+diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
16674 |
+index ca6886aaa5197..a2e5907276e7f 100644 |
16675 |
+--- a/drivers/spi/spi-tegra114.c |
16676 |
++++ b/drivers/spi/spi-tegra114.c |
16677 |
+@@ -966,6 +966,7 @@ static int tegra_spi_setup(struct spi_device *spi) |
16678 |
+ |
16679 |
+ ret = pm_runtime_get_sync(tspi->dev); |
16680 |
+ if (ret < 0) { |
16681 |
++ pm_runtime_put_noidle(tspi->dev); |
16682 |
+ dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); |
16683 |
+ if (cdata) |
16684 |
+ tegra_spi_cleanup(spi); |
16685 |
+@@ -1474,6 +1475,7 @@ static int tegra_spi_resume(struct device *dev) |
16686 |
+ |
16687 |
+ ret = pm_runtime_get_sync(dev); |
16688 |
+ if (ret < 0) { |
16689 |
++ pm_runtime_put_noidle(dev); |
16690 |
+ dev_err(dev, "pm runtime failed, e = %d\n", ret); |
16691 |
+ return ret; |
16692 |
+ } |
16693 |
+diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c |
16694 |
+index b59015c7c8a80..cfb7de7379376 100644 |
16695 |
+--- a/drivers/spi/spi-tegra20-sflash.c |
16696 |
++++ b/drivers/spi/spi-tegra20-sflash.c |
16697 |
+@@ -552,6 +552,7 @@ static int tegra_sflash_resume(struct device *dev) |
16698 |
+ |
16699 |
+ ret = pm_runtime_get_sync(dev); |
16700 |
+ if (ret < 0) { |
16701 |
++ pm_runtime_put_noidle(dev); |
16702 |
+ dev_err(dev, "pm runtime failed, e = %d\n", ret); |
16703 |
+ return ret; |
16704 |
+ } |
16705 |
+diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
16706 |
+index a0810765d4e52..f7c832fd40036 100644 |
16707 |
+--- a/drivers/spi/spi-tegra20-slink.c |
16708 |
++++ b/drivers/spi/spi-tegra20-slink.c |
16709 |
+@@ -751,6 +751,7 @@ static int tegra_slink_setup(struct spi_device *spi) |
16710 |
+ |
16711 |
+ ret = pm_runtime_get_sync(tspi->dev); |
16712 |
+ if (ret < 0) { |
16713 |
++ pm_runtime_put_noidle(tspi->dev); |
16714 |
+ dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); |
16715 |
+ return ret; |
16716 |
+ } |
16717 |
+@@ -1188,6 +1189,7 @@ static int tegra_slink_resume(struct device *dev) |
16718 |
+ |
16719 |
+ ret = pm_runtime_get_sync(dev); |
16720 |
+ if (ret < 0) { |
16721 |
++ pm_runtime_put_noidle(dev); |
16722 |
+ dev_err(dev, "pm runtime failed, e = %d\n", ret); |
16723 |
+ return ret; |
16724 |
+ } |
16725 |
+diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c |
16726 |
+index 3c41649698a5b..9417385c09217 100644 |
16727 |
+--- a/drivers/spi/spi-ti-qspi.c |
16728 |
++++ b/drivers/spi/spi-ti-qspi.c |
16729 |
+@@ -174,6 +174,7 @@ static int ti_qspi_setup(struct spi_device *spi) |
16730 |
+ |
16731 |
+ ret = pm_runtime_get_sync(qspi->dev); |
16732 |
+ if (ret < 0) { |
16733 |
++ pm_runtime_put_noidle(qspi->dev); |
16734 |
+ dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); |
16735 |
+ return ret; |
16736 |
+ } |
16737 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
16738 |
+index fc9a59788d2ea..2eaa7dbb70108 100644 |
16739 |
+--- a/drivers/spi/spi.c |
16740 |
++++ b/drivers/spi/spi.c |
16741 |
+@@ -405,9 +405,11 @@ static int spi_drv_probe(struct device *dev) |
16742 |
+ if (ret) |
16743 |
+ return ret; |
16744 |
+ |
16745 |
+- ret = sdrv->probe(spi); |
16746 |
+- if (ret) |
16747 |
+- dev_pm_domain_detach(dev, true); |
16748 |
++ if (sdrv->probe) { |
16749 |
++ ret = sdrv->probe(spi); |
16750 |
++ if (ret) |
16751 |
++ dev_pm_domain_detach(dev, true); |
16752 |
++ } |
16753 |
+ |
16754 |
+ return ret; |
16755 |
+ } |
16756 |
+@@ -415,9 +417,10 @@ static int spi_drv_probe(struct device *dev) |
16757 |
+ static int spi_drv_remove(struct device *dev) |
16758 |
+ { |
16759 |
+ const struct spi_driver *sdrv = to_spi_driver(dev->driver); |
16760 |
+- int ret; |
16761 |
++ int ret = 0; |
16762 |
+ |
16763 |
+- ret = sdrv->remove(to_spi_device(dev)); |
16764 |
++ if (sdrv->remove) |
16765 |
++ ret = sdrv->remove(to_spi_device(dev)); |
16766 |
+ dev_pm_domain_detach(dev, true); |
16767 |
+ |
16768 |
+ return ret; |
16769 |
+@@ -442,10 +445,8 @@ int __spi_register_driver(struct module *owner, struct spi_driver *sdrv) |
16770 |
+ { |
16771 |
+ sdrv->driver.owner = owner; |
16772 |
+ sdrv->driver.bus = &spi_bus_type; |
16773 |
+- if (sdrv->probe) |
16774 |
+- sdrv->driver.probe = spi_drv_probe; |
16775 |
+- if (sdrv->remove) |
16776 |
+- sdrv->driver.remove = spi_drv_remove; |
16777 |
++ sdrv->driver.probe = spi_drv_probe; |
16778 |
++ sdrv->driver.remove = spi_drv_remove; |
16779 |
+ if (sdrv->shutdown) |
16780 |
+ sdrv->driver.shutdown = spi_drv_shutdown; |
16781 |
+ return driver_register(&sdrv->driver); |
16782 |
+diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c |
16783 |
+index ea430237efa7f..9da8dd748078d 100644 |
16784 |
+--- a/drivers/staging/comedi/drivers/mf6x4.c |
16785 |
++++ b/drivers/staging/comedi/drivers/mf6x4.c |
16786 |
+@@ -112,8 +112,9 @@ static int mf6x4_ai_eoc(struct comedi_device *dev, |
16787 |
+ struct mf6x4_private *devpriv = dev->private; |
16788 |
+ unsigned int status; |
16789 |
+ |
16790 |
++ /* EOLC goes low at end of conversion. */ |
16791 |
+ status = ioread32(devpriv->gpioc_reg); |
16792 |
+- if (status & MF6X4_GPIOC_EOLC) |
16793 |
++ if ((status & MF6X4_GPIOC_EOLC) == 0) |
16794 |
+ return 0; |
16795 |
+ return -EBUSY; |
16796 |
+ } |
16797 |
+diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c |
16798 |
+index 2d6195f7300e9..864342acfd86e 100644 |
16799 |
+--- a/drivers/staging/gasket/gasket_interrupt.c |
16800 |
++++ b/drivers/staging/gasket/gasket_interrupt.c |
16801 |
+@@ -487,14 +487,16 @@ int gasket_interrupt_system_status(struct gasket_dev *gasket_dev) |
16802 |
+ int gasket_interrupt_set_eventfd(struct gasket_interrupt_data *interrupt_data, |
16803 |
+ int interrupt, int event_fd) |
16804 |
+ { |
16805 |
+- struct eventfd_ctx *ctx = eventfd_ctx_fdget(event_fd); |
16806 |
+- |
16807 |
+- if (IS_ERR(ctx)) |
16808 |
+- return PTR_ERR(ctx); |
16809 |
++ struct eventfd_ctx *ctx; |
16810 |
+ |
16811 |
+ if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) |
16812 |
+ return -EINVAL; |
16813 |
+ |
16814 |
++ ctx = eventfd_ctx_fdget(event_fd); |
16815 |
++ |
16816 |
++ if (IS_ERR(ctx)) |
16817 |
++ return PTR_ERR(ctx); |
16818 |
++ |
16819 |
+ interrupt_data->eventfd_ctxs[interrupt] = ctx; |
16820 |
+ return 0; |
16821 |
+ } |
16822 |
+@@ -505,6 +507,9 @@ int gasket_interrupt_clear_eventfd(struct gasket_interrupt_data *interrupt_data, |
16823 |
+ if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) |
16824 |
+ return -EINVAL; |
16825 |
+ |
16826 |
+- interrupt_data->eventfd_ctxs[interrupt] = NULL; |
16827 |
++ if (interrupt_data->eventfd_ctxs[interrupt]) { |
16828 |
++ eventfd_ctx_put(interrupt_data->eventfd_ctxs[interrupt]); |
16829 |
++ interrupt_data->eventfd_ctxs[interrupt] = NULL; |
16830 |
++ } |
16831 |
+ return 0; |
16832 |
+ } |
16833 |
+diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c |
16834 |
+index 494aa823e9984..42ce6c88ea753 100644 |
16835 |
+--- a/drivers/staging/greybus/audio_codec.c |
16836 |
++++ b/drivers/staging/greybus/audio_codec.c |
16837 |
+@@ -490,6 +490,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream, |
16838 |
+ if (ret) { |
16839 |
+ dev_err_ratelimited(dai->dev, "%d: Error during set_config\n", |
16840 |
+ ret); |
16841 |
++ gb_pm_runtime_put_noidle(bundle); |
16842 |
+ mutex_unlock(&codec->lock); |
16843 |
+ return ret; |
16844 |
+ } |
16845 |
+@@ -566,6 +567,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream, |
16846 |
+ break; |
16847 |
+ } |
16848 |
+ if (ret) { |
16849 |
++ gb_pm_runtime_put_noidle(bundle); |
16850 |
+ mutex_unlock(&codec->lock); |
16851 |
+ dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n", |
16852 |
+ ret); |
16853 |
+diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c |
16854 |
+index 237531ba60f30..3011b8abce389 100644 |
16855 |
+--- a/drivers/staging/greybus/audio_helper.c |
16856 |
++++ b/drivers/staging/greybus/audio_helper.c |
16857 |
+@@ -135,7 +135,8 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, |
16858 |
+ if (!w) { |
16859 |
+ dev_err(dapm->dev, "%s: widget not found\n", |
16860 |
+ widget->name); |
16861 |
+- return -EINVAL; |
16862 |
++ widget++; |
16863 |
++ continue; |
16864 |
+ } |
16865 |
+ widget++; |
16866 |
+ #ifdef CONFIG_DEBUG_FS |
16867 |
+diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c |
16868 |
+index 64b30d263c8d0..4f34a52829700 100644 |
16869 |
+--- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c |
16870 |
++++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c |
16871 |
+@@ -262,8 +262,10 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) |
16872 |
+ hi6421_spmi_pmic_irq_prc(pmic); |
16873 |
+ |
16874 |
+ pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL); |
16875 |
+- if (!pmic->irqs) |
16876 |
++ if (!pmic->irqs) { |
16877 |
++ ret = -ENOMEM; |
16878 |
+ goto irq_malloc; |
16879 |
++ } |
16880 |
+ |
16881 |
+ pmic->domain = irq_domain_add_simple(np, HISI_IRQ_NUM, 0, |
16882 |
+ &hi6421_spmi_domain_ops, pmic); |
16883 |
+diff --git a/drivers/staging/media/rkisp1/rkisp1-capture.c b/drivers/staging/media/rkisp1/rkisp1-capture.c |
16884 |
+index b6f497ce3e95c..0c934ca5adaa3 100644 |
16885 |
+--- a/drivers/staging/media/rkisp1/rkisp1-capture.c |
16886 |
++++ b/drivers/staging/media/rkisp1/rkisp1-capture.c |
16887 |
+@@ -992,6 +992,7 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) |
16888 |
+ |
16889 |
+ ret = pm_runtime_get_sync(cap->rkisp1->dev); |
16890 |
+ if (ret < 0) { |
16891 |
++ pm_runtime_put_noidle(cap->rkisp1->dev); |
16892 |
+ dev_err(cap->rkisp1->dev, "power up failed %d\n", ret); |
16893 |
+ goto err_destroy_dummy; |
16894 |
+ } |
16895 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c |
16896 |
+index 667b86dde1ee8..911f607d9b092 100644 |
16897 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c |
16898 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c |
16899 |
+@@ -479,8 +479,10 @@ static int cedrus_start_streaming(struct vb2_queue *vq, unsigned int count) |
16900 |
+ |
16901 |
+ if (V4L2_TYPE_IS_OUTPUT(vq->type)) { |
16902 |
+ ret = pm_runtime_get_sync(dev->dev); |
16903 |
+- if (ret < 0) |
16904 |
++ if (ret < 0) { |
16905 |
++ pm_runtime_put_noidle(dev->dev); |
16906 |
+ goto err_cleanup; |
16907 |
++ } |
16908 |
+ |
16909 |
+ if (dev->dec_ops[ctx->current_codec]->start) { |
16910 |
+ ret = dev->dec_ops[ctx->current_codec]->start(ctx); |
16911 |
+diff --git a/drivers/staging/vc04_services/vchiq-mmal/Kconfig b/drivers/staging/vc04_services/vchiq-mmal/Kconfig |
16912 |
+index 500c0d12e4ff2..c99525a0bb452 100644 |
16913 |
+--- a/drivers/staging/vc04_services/vchiq-mmal/Kconfig |
16914 |
++++ b/drivers/staging/vc04_services/vchiq-mmal/Kconfig |
16915 |
+@@ -1,6 +1,6 @@ |
16916 |
+ config BCM2835_VCHIQ_MMAL |
16917 |
+ tristate "BCM2835 MMAL VCHIQ service" |
16918 |
+- depends on (ARCH_BCM2835 || COMPILE_TEST) |
16919 |
++ depends on BCM2835_VCHIQ |
16920 |
+ help |
16921 |
+ Enables the MMAL API over VCHIQ interface as used for the |
16922 |
+ majority of the multimedia services on VideoCore. |
16923 |
+diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c |
16924 |
+index cc2959f22f01a..612f063c1cfcd 100644 |
16925 |
+--- a/drivers/thermal/cpufreq_cooling.c |
16926 |
++++ b/drivers/thermal/cpufreq_cooling.c |
16927 |
+@@ -438,13 +438,11 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, |
16928 |
+ if (cpufreq_cdev->cpufreq_state == state) |
16929 |
+ return 0; |
16930 |
+ |
16931 |
+- cpufreq_cdev->cpufreq_state = state; |
16932 |
+- |
16933 |
+ frequency = get_state_freq(cpufreq_cdev, state); |
16934 |
+ |
16935 |
+ ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency); |
16936 |
+- |
16937 |
+ if (ret > 0) { |
16938 |
++ cpufreq_cdev->cpufreq_state = state; |
16939 |
+ cpus = cpufreq_cdev->policy->cpus; |
16940 |
+ max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus)); |
16941 |
+ capacity = frequency * max_capacity; |
16942 |
+diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c |
16943 |
+index fa876e2c13e5d..f7d3023f860f0 100644 |
16944 |
+--- a/drivers/tty/serial/8250/8250_mtk.c |
16945 |
++++ b/drivers/tty/serial/8250/8250_mtk.c |
16946 |
+@@ -572,15 +572,22 @@ static int mtk8250_probe(struct platform_device *pdev) |
16947 |
+ pm_runtime_enable(&pdev->dev); |
16948 |
+ err = mtk8250_runtime_resume(&pdev->dev); |
16949 |
+ if (err) |
16950 |
+- return err; |
16951 |
++ goto err_pm_disable; |
16952 |
+ |
16953 |
+ data->line = serial8250_register_8250_port(&uart); |
16954 |
+- if (data->line < 0) |
16955 |
+- return data->line; |
16956 |
++ if (data->line < 0) { |
16957 |
++ err = data->line; |
16958 |
++ goto err_pm_disable; |
16959 |
++ } |
16960 |
+ |
16961 |
+ data->rx_wakeup_irq = platform_get_irq_optional(pdev, 1); |
16962 |
+ |
16963 |
+ return 0; |
16964 |
++ |
16965 |
++err_pm_disable: |
16966 |
++ pm_runtime_disable(&pdev->dev); |
16967 |
++ |
16968 |
++ return err; |
16969 |
+ } |
16970 |
+ |
16971 |
+ static int mtk8250_remove(struct platform_device *pdev) |
16972 |
+diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c |
16973 |
+index 063484b22523a..d6aef8a1f0a48 100644 |
16974 |
+--- a/drivers/tty/serial/pmac_zilog.c |
16975 |
++++ b/drivers/tty/serial/pmac_zilog.c |
16976 |
+@@ -1693,22 +1693,26 @@ static int __init pmz_probe(void) |
16977 |
+ |
16978 |
+ #else |
16979 |
+ |
16980 |
++/* On PCI PowerMacs, pmz_probe() does an explicit search of the OpenFirmware |
16981 |
++ * tree to obtain the device_nodes needed to start the console before the |
16982 |
++ * macio driver. On Macs without OpenFirmware, global platform_devices take |
16983 |
++ * the place of those device_nodes. |
16984 |
++ */ |
16985 |
+ extern struct platform_device scc_a_pdev, scc_b_pdev; |
16986 |
+ |
16987 |
+ static int __init pmz_init_port(struct uart_pmac_port *uap) |
16988 |
+ { |
16989 |
+- struct resource *r_ports; |
16990 |
+- int irq; |
16991 |
++ struct resource *r_ports, *r_irq; |
16992 |
+ |
16993 |
+ r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0); |
16994 |
+- irq = platform_get_irq(uap->pdev, 0); |
16995 |
+- if (!r_ports || irq <= 0) |
16996 |
++ r_irq = platform_get_resource(uap->pdev, IORESOURCE_IRQ, 0); |
16997 |
++ if (!r_ports || !r_irq) |
16998 |
+ return -ENODEV; |
16999 |
+ |
17000 |
+ uap->port.mapbase = r_ports->start; |
17001 |
+ uap->port.membase = (unsigned char __iomem *) r_ports->start; |
17002 |
+ uap->port.iotype = UPIO_MEM; |
17003 |
+- uap->port.irq = irq; |
17004 |
++ uap->port.irq = r_irq->start; |
17005 |
+ uap->port.uartclk = ZS_CLOCK; |
17006 |
+ uap->port.fifosize = 1; |
17007 |
+ uap->port.ops = &pmz_pops; |
17008 |
+diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c |
17009 |
+index 8771a2ed69268..7f4a03e8647af 100644 |
17010 |
+--- a/drivers/usb/host/ehci-omap.c |
17011 |
++++ b/drivers/usb/host/ehci-omap.c |
17012 |
+@@ -220,6 +220,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) |
17013 |
+ |
17014 |
+ err_pm_runtime: |
17015 |
+ pm_runtime_put_sync(dev); |
17016 |
++ pm_runtime_disable(dev); |
17017 |
+ |
17018 |
+ err_phy: |
17019 |
+ for (i = 0; i < omap->nports; i++) { |
17020 |
+diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c |
17021 |
+index 0894f6caccb2c..ebb8180b52ab1 100644 |
17022 |
+--- a/drivers/usb/host/max3421-hcd.c |
17023 |
++++ b/drivers/usb/host/max3421-hcd.c |
17024 |
+@@ -1847,7 +1847,7 @@ max3421_probe(struct spi_device *spi) |
17025 |
+ struct max3421_hcd *max3421_hcd; |
17026 |
+ struct usb_hcd *hcd = NULL; |
17027 |
+ struct max3421_hcd_platform_data *pdata = NULL; |
17028 |
+- int retval = -ENOMEM; |
17029 |
++ int retval; |
17030 |
+ |
17031 |
+ if (spi_setup(spi) < 0) { |
17032 |
+ dev_err(&spi->dev, "Unable to setup SPI bus"); |
17033 |
+@@ -1889,6 +1889,7 @@ max3421_probe(struct spi_device *spi) |
17034 |
+ goto error; |
17035 |
+ } |
17036 |
+ |
17037 |
++ retval = -ENOMEM; |
17038 |
+ hcd = usb_create_hcd(&max3421_hcd_desc, &spi->dev, |
17039 |
+ dev_name(&spi->dev)); |
17040 |
+ if (!hcd) { |
17041 |
+diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c |
17042 |
+index 27dbbe1b28b12..e832909a924fa 100644 |
17043 |
+--- a/drivers/usb/host/oxu210hp-hcd.c |
17044 |
++++ b/drivers/usb/host/oxu210hp-hcd.c |
17045 |
+@@ -4151,8 +4151,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev, |
17046 |
+ oxu->is_otg = otg; |
17047 |
+ |
17048 |
+ ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
17049 |
+- if (ret < 0) |
17050 |
++ if (ret < 0) { |
17051 |
++ usb_put_hcd(hcd); |
17052 |
+ return ERR_PTR(ret); |
17053 |
++ } |
17054 |
+ |
17055 |
+ device_wakeup_enable(hcd->self.controller); |
17056 |
+ return hcd; |
17057 |
+diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c |
17058 |
+index 91055a191995f..0d606fa9fdca1 100644 |
17059 |
+--- a/drivers/usb/serial/digi_acceleport.c |
17060 |
++++ b/drivers/usb/serial/digi_acceleport.c |
17061 |
+@@ -19,7 +19,6 @@ |
17062 |
+ #include <linux/tty_flip.h> |
17063 |
+ #include <linux/module.h> |
17064 |
+ #include <linux/spinlock.h> |
17065 |
+-#include <linux/workqueue.h> |
17066 |
+ #include <linux/uaccess.h> |
17067 |
+ #include <linux/usb.h> |
17068 |
+ #include <linux/wait.h> |
17069 |
+@@ -198,14 +197,12 @@ struct digi_port { |
17070 |
+ int dp_throttle_restart; |
17071 |
+ wait_queue_head_t dp_flush_wait; |
17072 |
+ wait_queue_head_t dp_close_wait; /* wait queue for close */ |
17073 |
+- struct work_struct dp_wakeup_work; |
17074 |
+ struct usb_serial_port *dp_port; |
17075 |
+ }; |
17076 |
+ |
17077 |
+ |
17078 |
+ /* Local Function Declarations */ |
17079 |
+ |
17080 |
+-static void digi_wakeup_write_lock(struct work_struct *work); |
17081 |
+ static int digi_write_oob_command(struct usb_serial_port *port, |
17082 |
+ unsigned char *buf, int count, int interruptible); |
17083 |
+ static int digi_write_inb_command(struct usb_serial_port *port, |
17084 |
+@@ -356,26 +353,6 @@ __releases(lock) |
17085 |
+ return timeout; |
17086 |
+ } |
17087 |
+ |
17088 |
+- |
17089 |
+-/* |
17090 |
+- * Digi Wakeup Write |
17091 |
+- * |
17092 |
+- * Wake up port, line discipline, and tty processes sleeping |
17093 |
+- * on writes. |
17094 |
+- */ |
17095 |
+- |
17096 |
+-static void digi_wakeup_write_lock(struct work_struct *work) |
17097 |
+-{ |
17098 |
+- struct digi_port *priv = |
17099 |
+- container_of(work, struct digi_port, dp_wakeup_work); |
17100 |
+- struct usb_serial_port *port = priv->dp_port; |
17101 |
+- unsigned long flags; |
17102 |
+- |
17103 |
+- spin_lock_irqsave(&priv->dp_port_lock, flags); |
17104 |
+- tty_port_tty_wakeup(&port->port); |
17105 |
+- spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
17106 |
+-} |
17107 |
+- |
17108 |
+ /* |
17109 |
+ * Digi Write OOB Command |
17110 |
+ * |
17111 |
+@@ -986,6 +963,7 @@ static void digi_write_bulk_callback(struct urb *urb) |
17112 |
+ unsigned long flags; |
17113 |
+ int ret = 0; |
17114 |
+ int status = urb->status; |
17115 |
++ bool wakeup; |
17116 |
+ |
17117 |
+ /* port and serial sanity check */ |
17118 |
+ if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
17119 |
+@@ -1012,6 +990,7 @@ static void digi_write_bulk_callback(struct urb *urb) |
17120 |
+ } |
17121 |
+ |
17122 |
+ /* try to send any buffered data on this port */ |
17123 |
++ wakeup = true; |
17124 |
+ spin_lock_irqsave(&priv->dp_port_lock, flags); |
17125 |
+ priv->dp_write_urb_in_use = 0; |
17126 |
+ if (priv->dp_out_buf_len > 0) { |
17127 |
+@@ -1027,19 +1006,18 @@ static void digi_write_bulk_callback(struct urb *urb) |
17128 |
+ if (ret == 0) { |
17129 |
+ priv->dp_write_urb_in_use = 1; |
17130 |
+ priv->dp_out_buf_len = 0; |
17131 |
++ wakeup = false; |
17132 |
+ } |
17133 |
+ } |
17134 |
+- /* wake up processes sleeping on writes immediately */ |
17135 |
+- tty_port_tty_wakeup(&port->port); |
17136 |
+- /* also queue up a wakeup at scheduler time, in case we */ |
17137 |
+- /* lost the race in write_chan(). */ |
17138 |
+- schedule_work(&priv->dp_wakeup_work); |
17139 |
+- |
17140 |
+ spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
17141 |
++ |
17142 |
+ if (ret && ret != -EPERM) |
17143 |
+ dev_err_console(port, |
17144 |
+ "%s: usb_submit_urb failed, ret=%d, port=%d\n", |
17145 |
+ __func__, ret, priv->dp_port_num); |
17146 |
++ |
17147 |
++ if (wakeup) |
17148 |
++ tty_port_tty_wakeup(&port->port); |
17149 |
+ } |
17150 |
+ |
17151 |
+ static int digi_write_room(struct tty_struct *tty) |
17152 |
+@@ -1239,7 +1217,6 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num) |
17153 |
+ init_waitqueue_head(&priv->dp_transmit_idle_wait); |
17154 |
+ init_waitqueue_head(&priv->dp_flush_wait); |
17155 |
+ init_waitqueue_head(&priv->dp_close_wait); |
17156 |
+- INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
17157 |
+ priv->dp_port = port; |
17158 |
+ |
17159 |
+ init_waitqueue_head(&port->write_wait); |
17160 |
+@@ -1508,13 +1485,14 @@ static int digi_read_oob_callback(struct urb *urb) |
17161 |
+ rts = C_CRTSCTS(tty); |
17162 |
+ |
17163 |
+ if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
17164 |
++ bool wakeup = false; |
17165 |
++ |
17166 |
+ spin_lock_irqsave(&priv->dp_port_lock, flags); |
17167 |
+ /* convert from digi flags to termiox flags */ |
17168 |
+ if (val & DIGI_READ_INPUT_SIGNALS_CTS) { |
17169 |
+ priv->dp_modem_signals |= TIOCM_CTS; |
17170 |
+- /* port must be open to use tty struct */ |
17171 |
+ if (rts) |
17172 |
+- tty_port_tty_wakeup(&port->port); |
17173 |
++ wakeup = true; |
17174 |
+ } else { |
17175 |
+ priv->dp_modem_signals &= ~TIOCM_CTS; |
17176 |
+ /* port must be open to use tty struct */ |
17177 |
+@@ -1533,6 +1511,9 @@ static int digi_read_oob_callback(struct urb *urb) |
17178 |
+ priv->dp_modem_signals &= ~TIOCM_CD; |
17179 |
+ |
17180 |
+ spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
17181 |
++ |
17182 |
++ if (wakeup) |
17183 |
++ tty_port_tty_wakeup(&port->port); |
17184 |
+ } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) { |
17185 |
+ spin_lock_irqsave(&priv->dp_port_lock, flags); |
17186 |
+ priv->dp_transmit_idle = 1; |
17187 |
+diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c |
17188 |
+index c1333919716b6..39ed3ad323651 100644 |
17189 |
+--- a/drivers/usb/serial/keyspan_pda.c |
17190 |
++++ b/drivers/usb/serial/keyspan_pda.c |
17191 |
+@@ -40,11 +40,12 @@ |
17192 |
+ #define DRIVER_AUTHOR "Brian Warner <warner@××××××.com>" |
17193 |
+ #define DRIVER_DESC "USB Keyspan PDA Converter driver" |
17194 |
+ |
17195 |
++#define KEYSPAN_TX_THRESHOLD 16 |
17196 |
++ |
17197 |
+ struct keyspan_pda_private { |
17198 |
+ int tx_room; |
17199 |
+ int tx_throttled; |
17200 |
+- struct work_struct wakeup_work; |
17201 |
+- struct work_struct unthrottle_work; |
17202 |
++ struct work_struct unthrottle_work; |
17203 |
+ struct usb_serial *serial; |
17204 |
+ struct usb_serial_port *port; |
17205 |
+ }; |
17206 |
+@@ -97,15 +98,6 @@ static const struct usb_device_id id_table_fake_xircom[] = { |
17207 |
+ }; |
17208 |
+ #endif |
17209 |
+ |
17210 |
+-static void keyspan_pda_wakeup_write(struct work_struct *work) |
17211 |
+-{ |
17212 |
+- struct keyspan_pda_private *priv = |
17213 |
+- container_of(work, struct keyspan_pda_private, wakeup_work); |
17214 |
+- struct usb_serial_port *port = priv->port; |
17215 |
+- |
17216 |
+- tty_port_tty_wakeup(&port->port); |
17217 |
+-} |
17218 |
+- |
17219 |
+ static void keyspan_pda_request_unthrottle(struct work_struct *work) |
17220 |
+ { |
17221 |
+ struct keyspan_pda_private *priv = |
17222 |
+@@ -120,7 +112,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) |
17223 |
+ 7, /* request_unthrottle */ |
17224 |
+ USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
17225 |
+ | USB_DIR_OUT, |
17226 |
+- 16, /* value: threshold */ |
17227 |
++ KEYSPAN_TX_THRESHOLD, |
17228 |
+ 0, /* index */ |
17229 |
+ NULL, |
17230 |
+ 0, |
17231 |
+@@ -139,6 +131,8 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) |
17232 |
+ int retval; |
17233 |
+ int status = urb->status; |
17234 |
+ struct keyspan_pda_private *priv; |
17235 |
++ unsigned long flags; |
17236 |
++ |
17237 |
+ priv = usb_get_serial_port_data(port); |
17238 |
+ |
17239 |
+ switch (status) { |
17240 |
+@@ -172,18 +166,21 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) |
17241 |
+ break; |
17242 |
+ case 1: |
17243 |
+ /* status interrupt */ |
17244 |
+- if (len < 3) { |
17245 |
++ if (len < 2) { |
17246 |
+ dev_warn(&port->dev, "short interrupt message received\n"); |
17247 |
+ break; |
17248 |
+ } |
17249 |
+- dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]); |
17250 |
++ dev_dbg(&port->dev, "rx int, d1=%d\n", data[1]); |
17251 |
+ switch (data[1]) { |
17252 |
+ case 1: /* modemline change */ |
17253 |
+ break; |
17254 |
+ case 2: /* tx unthrottle interrupt */ |
17255 |
++ spin_lock_irqsave(&port->lock, flags); |
17256 |
+ priv->tx_throttled = 0; |
17257 |
++ priv->tx_room = max(priv->tx_room, KEYSPAN_TX_THRESHOLD); |
17258 |
++ spin_unlock_irqrestore(&port->lock, flags); |
17259 |
+ /* queue up a wakeup at scheduler time */ |
17260 |
+- schedule_work(&priv->wakeup_work); |
17261 |
++ usb_serial_port_softint(port); |
17262 |
+ break; |
17263 |
+ default: |
17264 |
+ break; |
17265 |
+@@ -443,6 +440,7 @@ static int keyspan_pda_write(struct tty_struct *tty, |
17266 |
+ int request_unthrottle = 0; |
17267 |
+ int rc = 0; |
17268 |
+ struct keyspan_pda_private *priv; |
17269 |
++ unsigned long flags; |
17270 |
+ |
17271 |
+ priv = usb_get_serial_port_data(port); |
17272 |
+ /* guess how much room is left in the device's ring buffer, and if we |
17273 |
+@@ -462,13 +460,13 @@ static int keyspan_pda_write(struct tty_struct *tty, |
17274 |
+ the TX urb is in-flight (wait until it completes) |
17275 |
+ the device is full (wait until it says there is room) |
17276 |
+ */ |
17277 |
+- spin_lock_bh(&port->lock); |
17278 |
++ spin_lock_irqsave(&port->lock, flags); |
17279 |
+ if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) { |
17280 |
+- spin_unlock_bh(&port->lock); |
17281 |
++ spin_unlock_irqrestore(&port->lock, flags); |
17282 |
+ return 0; |
17283 |
+ } |
17284 |
+ clear_bit(0, &port->write_urbs_free); |
17285 |
+- spin_unlock_bh(&port->lock); |
17286 |
++ spin_unlock_irqrestore(&port->lock, flags); |
17287 |
+ |
17288 |
+ /* At this point the URB is in our control, nobody else can submit it |
17289 |
+ again (the only sudden transition was the one from EINPROGRESS to |
17290 |
+@@ -514,7 +512,8 @@ static int keyspan_pda_write(struct tty_struct *tty, |
17291 |
+ goto exit; |
17292 |
+ } |
17293 |
+ } |
17294 |
+- if (count > priv->tx_room) { |
17295 |
++ |
17296 |
++ if (count >= priv->tx_room) { |
17297 |
+ /* we're about to completely fill the Tx buffer, so |
17298 |
+ we'll be throttled afterwards. */ |
17299 |
+ count = priv->tx_room; |
17300 |
+@@ -547,7 +546,7 @@ static int keyspan_pda_write(struct tty_struct *tty, |
17301 |
+ |
17302 |
+ rc = count; |
17303 |
+ exit: |
17304 |
+- if (rc < 0) |
17305 |
++ if (rc <= 0) |
17306 |
+ set_bit(0, &port->write_urbs_free); |
17307 |
+ return rc; |
17308 |
+ } |
17309 |
+@@ -562,21 +561,24 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb) |
17310 |
+ priv = usb_get_serial_port_data(port); |
17311 |
+ |
17312 |
+ /* queue up a wakeup at scheduler time */ |
17313 |
+- schedule_work(&priv->wakeup_work); |
17314 |
++ usb_serial_port_softint(port); |
17315 |
+ } |
17316 |
+ |
17317 |
+ |
17318 |
+ static int keyspan_pda_write_room(struct tty_struct *tty) |
17319 |
+ { |
17320 |
+ struct usb_serial_port *port = tty->driver_data; |
17321 |
+- struct keyspan_pda_private *priv; |
17322 |
+- priv = usb_get_serial_port_data(port); |
17323 |
+- /* used by n_tty.c for processing of tabs and such. Giving it our |
17324 |
+- conservative guess is probably good enough, but needs testing by |
17325 |
+- running a console through the device. */ |
17326 |
+- return priv->tx_room; |
17327 |
+-} |
17328 |
++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port); |
17329 |
++ unsigned long flags; |
17330 |
++ int room = 0; |
17331 |
+ |
17332 |
++ spin_lock_irqsave(&port->lock, flags); |
17333 |
++ if (test_bit(0, &port->write_urbs_free) && !priv->tx_throttled) |
17334 |
++ room = priv->tx_room; |
17335 |
++ spin_unlock_irqrestore(&port->lock, flags); |
17336 |
++ |
17337 |
++ return room; |
17338 |
++} |
17339 |
+ |
17340 |
+ static int keyspan_pda_chars_in_buffer(struct tty_struct *tty) |
17341 |
+ { |
17342 |
+@@ -656,8 +658,12 @@ error: |
17343 |
+ } |
17344 |
+ static void keyspan_pda_close(struct usb_serial_port *port) |
17345 |
+ { |
17346 |
++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port); |
17347 |
++ |
17348 |
+ usb_kill_urb(port->write_urb); |
17349 |
+ usb_kill_urb(port->interrupt_in_urb); |
17350 |
++ |
17351 |
++ cancel_work_sync(&priv->unthrottle_work); |
17352 |
+ } |
17353 |
+ |
17354 |
+ |
17355 |
+@@ -714,7 +720,6 @@ static int keyspan_pda_port_probe(struct usb_serial_port *port) |
17356 |
+ if (!priv) |
17357 |
+ return -ENOMEM; |
17358 |
+ |
17359 |
+- INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write); |
17360 |
+ INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle); |
17361 |
+ priv->serial = port->serial; |
17362 |
+ priv->port = port; |
17363 |
+diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
17364 |
+index 5eed1078fac87..5a5d2a95070ed 100644 |
17365 |
+--- a/drivers/usb/serial/mos7720.c |
17366 |
++++ b/drivers/usb/serial/mos7720.c |
17367 |
+@@ -639,6 +639,8 @@ static void parport_mos7715_restore_state(struct parport *pp, |
17368 |
+ spin_unlock(&release_lock); |
17369 |
+ return; |
17370 |
+ } |
17371 |
++ mos_parport->shadowDCR = s->u.pc.ctr; |
17372 |
++ mos_parport->shadowECR = s->u.pc.ecr; |
17373 |
+ write_parport_reg_nonblock(mos_parport, MOS7720_DCR, |
17374 |
+ mos_parport->shadowDCR); |
17375 |
+ write_parport_reg_nonblock(mos_parport, MOS7720_ECR, |
17376 |
+diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c |
17377 |
+index 1fa6fcac82992..81b932f72e103 100644 |
17378 |
+--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c |
17379 |
++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c |
17380 |
+@@ -464,6 +464,11 @@ static int mlx5_vdpa_poll_one(struct mlx5_vdpa_cq *vcq) |
17381 |
+ static void mlx5_vdpa_handle_completions(struct mlx5_vdpa_virtqueue *mvq, int num) |
17382 |
+ { |
17383 |
+ mlx5_cq_set_ci(&mvq->cq.mcq); |
17384 |
++ |
17385 |
++ /* make sure CQ cosumer update is visible to the hardware before updating |
17386 |
++ * RX doorbell record. |
17387 |
++ */ |
17388 |
++ dma_wmb(); |
17389 |
+ rx_post(&mvq->vqqp, num); |
17390 |
+ if (mvq->event_cb.callback) |
17391 |
+ mvq->event_cb.callback(mvq->event_cb.private); |
17392 |
+diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c |
17393 |
+index e6190173482c7..706de3ef94bbf 100644 |
17394 |
+--- a/drivers/vfio/pci/vfio_pci.c |
17395 |
++++ b/drivers/vfio/pci/vfio_pci.c |
17396 |
+@@ -161,8 +161,6 @@ static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev) |
17397 |
+ int i; |
17398 |
+ struct vfio_pci_dummy_resource *dummy_res; |
17399 |
+ |
17400 |
+- INIT_LIST_HEAD(&vdev->dummy_resources_list); |
17401 |
+- |
17402 |
+ for (i = 0; i < PCI_STD_NUM_BARS; i++) { |
17403 |
+ int bar = i + PCI_STD_RESOURCES; |
17404 |
+ |
17405 |
+@@ -1635,8 +1633,8 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) |
17406 |
+ |
17407 |
+ mutex_unlock(&vdev->vma_lock); |
17408 |
+ |
17409 |
+- if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
17410 |
+- vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
17411 |
++ if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
17412 |
++ vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
17413 |
+ ret = VM_FAULT_SIGBUS; |
17414 |
+ |
17415 |
+ up_out: |
17416 |
+@@ -1966,6 +1964,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
17417 |
+ mutex_init(&vdev->igate); |
17418 |
+ spin_lock_init(&vdev->irqlock); |
17419 |
+ mutex_init(&vdev->ioeventfds_lock); |
17420 |
++ INIT_LIST_HEAD(&vdev->dummy_resources_list); |
17421 |
+ INIT_LIST_HEAD(&vdev->ioeventfds_list); |
17422 |
+ mutex_init(&vdev->vma_lock); |
17423 |
+ INIT_LIST_HEAD(&vdev->vma_list); |
17424 |
+diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c |
17425 |
+index 65c61710c0e9a..9adcf6a8f8885 100644 |
17426 |
+--- a/drivers/vfio/pci/vfio_pci_nvlink2.c |
17427 |
++++ b/drivers/vfio/pci/vfio_pci_nvlink2.c |
17428 |
+@@ -231,7 +231,7 @@ int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev) |
17429 |
+ return -EINVAL; |
17430 |
+ |
17431 |
+ if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) |
17432 |
+- return -EINVAL; |
17433 |
++ return -ENODEV; |
17434 |
+ |
17435 |
+ mem_node = of_find_node_by_phandle(mem_phandle); |
17436 |
+ if (!mem_node) |
17437 |
+@@ -393,7 +393,7 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev) |
17438 |
+ int ret; |
17439 |
+ struct vfio_pci_npu2_data *data; |
17440 |
+ struct device_node *nvlink_dn; |
17441 |
+- u32 nvlink_index = 0; |
17442 |
++ u32 nvlink_index = 0, mem_phandle = 0; |
17443 |
+ struct pci_dev *npdev = vdev->pdev; |
17444 |
+ struct device_node *npu_node = pci_device_to_OF_node(npdev); |
17445 |
+ struct pci_controller *hose = pci_bus_to_host(npdev->bus); |
17446 |
+@@ -408,6 +408,9 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev) |
17447 |
+ if (!pnv_pci_get_gpu_dev(vdev->pdev)) |
17448 |
+ return -ENODEV; |
17449 |
+ |
17450 |
++ if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) |
17451 |
++ return -ENODEV; |
17452 |
++ |
17453 |
+ /* |
17454 |
+ * NPU2 normally has 8 ATSD registers (for concurrency) and 6 links |
17455 |
+ * so we can allocate one register per link, using nvlink index as |
17456 |
+diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
17457 |
+index 6ff8a50966915..4ce9f00ae10e8 100644 |
17458 |
+--- a/drivers/vhost/scsi.c |
17459 |
++++ b/drivers/vhost/scsi.c |
17460 |
+@@ -1643,7 +1643,8 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, |
17461 |
+ if (!vhost_vq_is_setup(vq)) |
17462 |
+ continue; |
17463 |
+ |
17464 |
+- if (vhost_scsi_setup_vq_cmds(vq, vq->num)) |
17465 |
++ ret = vhost_scsi_setup_vq_cmds(vq, vq->num); |
17466 |
++ if (ret) |
17467 |
+ goto destroy_vq_cmds; |
17468 |
+ } |
17469 |
+ |
17470 |
+diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c |
17471 |
+index 8c1d47e52b1a6..355b6120dc4f0 100644 |
17472 |
+--- a/drivers/video/fbdev/atmel_lcdfb.c |
17473 |
++++ b/drivers/video/fbdev/atmel_lcdfb.c |
17474 |
+@@ -987,8 +987,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) |
17475 |
+ } |
17476 |
+ |
17477 |
+ INIT_LIST_HEAD(&pdata->pwr_gpios); |
17478 |
+- ret = -ENOMEM; |
17479 |
+ for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) { |
17480 |
++ ret = -ENOMEM; |
17481 |
+ gpiod = devm_gpiod_get_index(dev, "atmel,power-control", |
17482 |
+ i, GPIOD_ASIS); |
17483 |
+ if (IS_ERR(gpiod)) |
17484 |
+diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c |
17485 |
+index becc776979602..71e16b53e9c18 100644 |
17486 |
+--- a/drivers/virtio/virtio_ring.c |
17487 |
++++ b/drivers/virtio/virtio_ring.c |
17488 |
+@@ -1608,7 +1608,6 @@ static struct virtqueue *vring_create_virtqueue_packed( |
17489 |
+ vq->num_added = 0; |
17490 |
+ vq->packed_ring = true; |
17491 |
+ vq->use_dma_api = vring_use_dma_api(vdev); |
17492 |
+- list_add_tail(&vq->vq.list, &vdev->vqs); |
17493 |
+ #ifdef DEBUG |
17494 |
+ vq->in_use = false; |
17495 |
+ vq->last_add_time_valid = false; |
17496 |
+@@ -1669,6 +1668,7 @@ static struct virtqueue *vring_create_virtqueue_packed( |
17497 |
+ cpu_to_le16(vq->packed.event_flags_shadow); |
17498 |
+ } |
17499 |
+ |
17500 |
++ list_add_tail(&vq->vq.list, &vdev->vqs); |
17501 |
+ return &vq->vq; |
17502 |
+ |
17503 |
+ err_desc_extra: |
17504 |
+@@ -1676,9 +1676,9 @@ err_desc_extra: |
17505 |
+ err_desc_state: |
17506 |
+ kfree(vq); |
17507 |
+ err_vq: |
17508 |
+- vring_free_queue(vdev, event_size_in_bytes, device, ring_dma_addr); |
17509 |
++ vring_free_queue(vdev, event_size_in_bytes, device, device_event_dma_addr); |
17510 |
+ err_device: |
17511 |
+- vring_free_queue(vdev, event_size_in_bytes, driver, ring_dma_addr); |
17512 |
++ vring_free_queue(vdev, event_size_in_bytes, driver, driver_event_dma_addr); |
17513 |
+ err_driver: |
17514 |
+ vring_free_queue(vdev, ring_size_in_bytes, ring, ring_dma_addr); |
17515 |
+ err_ring: |
17516 |
+@@ -2085,7 +2085,6 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, |
17517 |
+ vq->last_used_idx = 0; |
17518 |
+ vq->num_added = 0; |
17519 |
+ vq->use_dma_api = vring_use_dma_api(vdev); |
17520 |
+- list_add_tail(&vq->vq.list, &vdev->vqs); |
17521 |
+ #ifdef DEBUG |
17522 |
+ vq->in_use = false; |
17523 |
+ vq->last_add_time_valid = false; |
17524 |
+@@ -2127,6 +2126,7 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, |
17525 |
+ memset(vq->split.desc_state, 0, vring.num * |
17526 |
+ sizeof(struct vring_desc_state_split)); |
17527 |
+ |
17528 |
++ list_add_tail(&vq->vq.list, &vdev->vqs); |
17529 |
+ return &vq->vq; |
17530 |
+ } |
17531 |
+ EXPORT_SYMBOL_GPL(__vring_new_virtqueue); |
17532 |
+diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig |
17533 |
+index fd7968635e6df..db935d6b10c27 100644 |
17534 |
+--- a/drivers/watchdog/Kconfig |
17535 |
++++ b/drivers/watchdog/Kconfig |
17536 |
+@@ -386,6 +386,7 @@ config ARM_SBSA_WATCHDOG |
17537 |
+ config ARMADA_37XX_WATCHDOG |
17538 |
+ tristate "Armada 37xx watchdog" |
17539 |
+ depends on ARCH_MVEBU || COMPILE_TEST |
17540 |
++ depends on HAS_IOMEM |
17541 |
+ select MFD_SYSCON |
17542 |
+ select WATCHDOG_CORE |
17543 |
+ help |
17544 |
+@@ -631,7 +632,7 @@ config SUNXI_WATCHDOG |
17545 |
+ |
17546 |
+ config COH901327_WATCHDOG |
17547 |
+ bool "ST-Ericsson COH 901 327 watchdog" |
17548 |
+- depends on ARCH_U300 || (ARM && COMPILE_TEST) |
17549 |
++ depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST) |
17550 |
+ default y if MACH_U300 |
17551 |
+ select WATCHDOG_CORE |
17552 |
+ help |
17553 |
+@@ -789,6 +790,7 @@ config MOXART_WDT |
17554 |
+ |
17555 |
+ config SIRFSOC_WATCHDOG |
17556 |
+ tristate "SiRFSOC watchdog" |
17557 |
++ depends on HAS_IOMEM |
17558 |
+ depends on ARCH_SIRF || COMPILE_TEST |
17559 |
+ select WATCHDOG_CORE |
17560 |
+ default y |
17561 |
+diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c |
17562 |
+index ab7465d186fda..cdf754233e53d 100644 |
17563 |
+--- a/drivers/watchdog/qcom-wdt.c |
17564 |
++++ b/drivers/watchdog/qcom-wdt.c |
17565 |
+@@ -148,7 +148,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action, |
17566 |
+ */ |
17567 |
+ wmb(); |
17568 |
+ |
17569 |
+- msleep(150); |
17570 |
++ mdelay(150); |
17571 |
+ return 0; |
17572 |
+ } |
17573 |
+ |
17574 |
+diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c |
17575 |
+index 65cb55f3916fc..b9b1daa9e2a4c 100644 |
17576 |
+--- a/drivers/watchdog/sprd_wdt.c |
17577 |
++++ b/drivers/watchdog/sprd_wdt.c |
17578 |
+@@ -108,18 +108,6 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout, |
17579 |
+ u32 tmr_step = timeout * SPRD_WDT_CNT_STEP; |
17580 |
+ u32 prtmr_step = pretimeout * SPRD_WDT_CNT_STEP; |
17581 |
+ |
17582 |
+- sprd_wdt_unlock(wdt->base); |
17583 |
+- writel_relaxed((tmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
17584 |
+- SPRD_WDT_LOW_VALUE_MASK, wdt->base + SPRD_WDT_LOAD_HIGH); |
17585 |
+- writel_relaxed((tmr_step & SPRD_WDT_LOW_VALUE_MASK), |
17586 |
+- wdt->base + SPRD_WDT_LOAD_LOW); |
17587 |
+- writel_relaxed((prtmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
17588 |
+- SPRD_WDT_LOW_VALUE_MASK, |
17589 |
+- wdt->base + SPRD_WDT_IRQ_LOAD_HIGH); |
17590 |
+- writel_relaxed(prtmr_step & SPRD_WDT_LOW_VALUE_MASK, |
17591 |
+- wdt->base + SPRD_WDT_IRQ_LOAD_LOW); |
17592 |
+- sprd_wdt_lock(wdt->base); |
17593 |
+- |
17594 |
+ /* |
17595 |
+ * Waiting the load value operation done, |
17596 |
+ * it needs two or three RTC clock cycles. |
17597 |
+@@ -134,6 +122,19 @@ static int sprd_wdt_load_value(struct sprd_wdt *wdt, u32 timeout, |
17598 |
+ |
17599 |
+ if (delay_cnt >= SPRD_WDT_LOAD_TIMEOUT) |
17600 |
+ return -EBUSY; |
17601 |
++ |
17602 |
++ sprd_wdt_unlock(wdt->base); |
17603 |
++ writel_relaxed((tmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
17604 |
++ SPRD_WDT_LOW_VALUE_MASK, wdt->base + SPRD_WDT_LOAD_HIGH); |
17605 |
++ writel_relaxed((tmr_step & SPRD_WDT_LOW_VALUE_MASK), |
17606 |
++ wdt->base + SPRD_WDT_LOAD_LOW); |
17607 |
++ writel_relaxed((prtmr_step >> SPRD_WDT_CNT_HIGH_SHIFT) & |
17608 |
++ SPRD_WDT_LOW_VALUE_MASK, |
17609 |
++ wdt->base + SPRD_WDT_IRQ_LOAD_HIGH); |
17610 |
++ writel_relaxed(prtmr_step & SPRD_WDT_LOW_VALUE_MASK, |
17611 |
++ wdt->base + SPRD_WDT_IRQ_LOAD_LOW); |
17612 |
++ sprd_wdt_lock(wdt->base); |
17613 |
++ |
17614 |
+ return 0; |
17615 |
+ } |
17616 |
+ |
17617 |
+@@ -345,15 +346,10 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev) |
17618 |
+ if (ret) |
17619 |
+ return ret; |
17620 |
+ |
17621 |
+- if (watchdog_active(&wdt->wdd)) { |
17622 |
++ if (watchdog_active(&wdt->wdd)) |
17623 |
+ ret = sprd_wdt_start(&wdt->wdd); |
17624 |
+- if (ret) { |
17625 |
+- sprd_wdt_disable(wdt); |
17626 |
+- return ret; |
17627 |
+- } |
17628 |
+- } |
17629 |
+ |
17630 |
+- return 0; |
17631 |
++ return ret; |
17632 |
+ } |
17633 |
+ |
17634 |
+ static const struct dev_pm_ops sprd_wdt_pm_ops = { |
17635 |
+diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c |
17636 |
+index 4238447578128..0e9a99559609c 100644 |
17637 |
+--- a/drivers/watchdog/watchdog_core.c |
17638 |
++++ b/drivers/watchdog/watchdog_core.c |
17639 |
+@@ -267,15 +267,19 @@ static int __watchdog_register_device(struct watchdog_device *wdd) |
17640 |
+ } |
17641 |
+ |
17642 |
+ if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) { |
17643 |
+- wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; |
17644 |
+- |
17645 |
+- ret = register_reboot_notifier(&wdd->reboot_nb); |
17646 |
+- if (ret) { |
17647 |
+- pr_err("watchdog%d: Cannot register reboot notifier (%d)\n", |
17648 |
+- wdd->id, ret); |
17649 |
+- watchdog_dev_unregister(wdd); |
17650 |
+- ida_simple_remove(&watchdog_ida, id); |
17651 |
+- return ret; |
17652 |
++ if (!wdd->ops->stop) |
17653 |
++ pr_warn("watchdog%d: stop_on_reboot not supported\n", wdd->id); |
17654 |
++ else { |
17655 |
++ wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; |
17656 |
++ |
17657 |
++ ret = register_reboot_notifier(&wdd->reboot_nb); |
17658 |
++ if (ret) { |
17659 |
++ pr_err("watchdog%d: Cannot register reboot notifier (%d)\n", |
17660 |
++ wdd->id, ret); |
17661 |
++ watchdog_dev_unregister(wdd); |
17662 |
++ ida_simple_remove(&watchdog_ida, id); |
17663 |
++ return ret; |
17664 |
++ } |
17665 |
+ } |
17666 |
+ } |
17667 |
+ |
17668 |
+diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c |
17669 |
+index 4b99ec3dec58a..e7c692cfb2cf8 100644 |
17670 |
+--- a/drivers/xen/xen-pciback/xenbus.c |
17671 |
++++ b/drivers/xen/xen-pciback/xenbus.c |
17672 |
+@@ -689,7 +689,7 @@ static int xen_pcibk_xenbus_probe(struct xenbus_device *dev, |
17673 |
+ |
17674 |
+ /* watch the backend node for backend configuration information */ |
17675 |
+ err = xenbus_watch_path(dev, dev->nodename, &pdev->be_watch, |
17676 |
+- xen_pcibk_be_watch); |
17677 |
++ NULL, xen_pcibk_be_watch); |
17678 |
+ if (err) |
17679 |
+ goto out; |
17680 |
+ |
17681 |
+diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h |
17682 |
+index 5f5b8a7d5b80b..2a93b7c9c1599 100644 |
17683 |
+--- a/drivers/xen/xenbus/xenbus.h |
17684 |
++++ b/drivers/xen/xenbus/xenbus.h |
17685 |
+@@ -44,6 +44,8 @@ struct xen_bus_type { |
17686 |
+ int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); |
17687 |
+ int (*probe)(struct xen_bus_type *bus, const char *type, |
17688 |
+ const char *dir); |
17689 |
++ bool (*otherend_will_handle)(struct xenbus_watch *watch, |
17690 |
++ const char *path, const char *token); |
17691 |
+ void (*otherend_changed)(struct xenbus_watch *watch, const char *path, |
17692 |
+ const char *token); |
17693 |
+ struct bus_type bus; |
17694 |
+diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c |
17695 |
+index fd80e318b99cc..0cd728961fce9 100644 |
17696 |
+--- a/drivers/xen/xenbus/xenbus_client.c |
17697 |
++++ b/drivers/xen/xenbus/xenbus_client.c |
17698 |
+@@ -127,18 +127,22 @@ EXPORT_SYMBOL_GPL(xenbus_strstate); |
17699 |
+ */ |
17700 |
+ int xenbus_watch_path(struct xenbus_device *dev, const char *path, |
17701 |
+ struct xenbus_watch *watch, |
17702 |
++ bool (*will_handle)(struct xenbus_watch *, |
17703 |
++ const char *, const char *), |
17704 |
+ void (*callback)(struct xenbus_watch *, |
17705 |
+ const char *, const char *)) |
17706 |
+ { |
17707 |
+ int err; |
17708 |
+ |
17709 |
+ watch->node = path; |
17710 |
++ watch->will_handle = will_handle; |
17711 |
+ watch->callback = callback; |
17712 |
+ |
17713 |
+ err = register_xenbus_watch(watch); |
17714 |
+ |
17715 |
+ if (err) { |
17716 |
+ watch->node = NULL; |
17717 |
++ watch->will_handle = NULL; |
17718 |
+ watch->callback = NULL; |
17719 |
+ xenbus_dev_fatal(dev, err, "adding watch on %s", path); |
17720 |
+ } |
17721 |
+@@ -165,6 +169,8 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path); |
17722 |
+ */ |
17723 |
+ int xenbus_watch_pathfmt(struct xenbus_device *dev, |
17724 |
+ struct xenbus_watch *watch, |
17725 |
++ bool (*will_handle)(struct xenbus_watch *, |
17726 |
++ const char *, const char *), |
17727 |
+ void (*callback)(struct xenbus_watch *, |
17728 |
+ const char *, const char *), |
17729 |
+ const char *pathfmt, ...) |
17730 |
+@@ -181,7 +187,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev, |
17731 |
+ xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch"); |
17732 |
+ return -ENOMEM; |
17733 |
+ } |
17734 |
+- err = xenbus_watch_path(dev, path, watch, callback); |
17735 |
++ err = xenbus_watch_path(dev, path, watch, will_handle, callback); |
17736 |
+ |
17737 |
+ if (err) |
17738 |
+ kfree(path); |
17739 |
+diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c |
17740 |
+index 38725d97d9093..44634d970a5ca 100644 |
17741 |
+--- a/drivers/xen/xenbus/xenbus_probe.c |
17742 |
++++ b/drivers/xen/xenbus/xenbus_probe.c |
17743 |
+@@ -136,6 +136,7 @@ static int watch_otherend(struct xenbus_device *dev) |
17744 |
+ container_of(dev->dev.bus, struct xen_bus_type, bus); |
17745 |
+ |
17746 |
+ return xenbus_watch_pathfmt(dev, &dev->otherend_watch, |
17747 |
++ bus->otherend_will_handle, |
17748 |
+ bus->otherend_changed, |
17749 |
+ "%s/%s", dev->otherend, "state"); |
17750 |
+ } |
17751 |
+diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c |
17752 |
+index 2ba699897e6dd..5abded97e1a7e 100644 |
17753 |
+--- a/drivers/xen/xenbus/xenbus_probe_backend.c |
17754 |
++++ b/drivers/xen/xenbus/xenbus_probe_backend.c |
17755 |
+@@ -180,6 +180,12 @@ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type, |
17756 |
+ return err; |
17757 |
+ } |
17758 |
+ |
17759 |
++static bool frontend_will_handle(struct xenbus_watch *watch, |
17760 |
++ const char *path, const char *token) |
17761 |
++{ |
17762 |
++ return watch->nr_pending == 0; |
17763 |
++} |
17764 |
++ |
17765 |
+ static void frontend_changed(struct xenbus_watch *watch, |
17766 |
+ const char *path, const char *token) |
17767 |
+ { |
17768 |
+@@ -191,6 +197,7 @@ static struct xen_bus_type xenbus_backend = { |
17769 |
+ .levels = 3, /* backend/type/<frontend>/<id> */ |
17770 |
+ .get_bus_id = backend_bus_id, |
17771 |
+ .probe = xenbus_probe_backend, |
17772 |
++ .otherend_will_handle = frontend_will_handle, |
17773 |
+ .otherend_changed = frontend_changed, |
17774 |
+ .bus = { |
17775 |
+ .name = "xen-backend", |
17776 |
+diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c |
17777 |
+index 3a06eb699f333..12e02eb01f599 100644 |
17778 |
+--- a/drivers/xen/xenbus/xenbus_xs.c |
17779 |
++++ b/drivers/xen/xenbus/xenbus_xs.c |
17780 |
+@@ -705,9 +705,13 @@ int xs_watch_msg(struct xs_watch_event *event) |
17781 |
+ |
17782 |
+ spin_lock(&watches_lock); |
17783 |
+ event->handle = find_watch(event->token); |
17784 |
+- if (event->handle != NULL) { |
17785 |
++ if (event->handle != NULL && |
17786 |
++ (!event->handle->will_handle || |
17787 |
++ event->handle->will_handle(event->handle, |
17788 |
++ event->path, event->token))) { |
17789 |
+ spin_lock(&watch_events_lock); |
17790 |
+ list_add_tail(&event->list, &watch_events); |
17791 |
++ event->handle->nr_pending++; |
17792 |
+ wake_up(&watch_events_waitq); |
17793 |
+ spin_unlock(&watch_events_lock); |
17794 |
+ } else |
17795 |
+@@ -765,6 +769,8 @@ int register_xenbus_watch(struct xenbus_watch *watch) |
17796 |
+ |
17797 |
+ sprintf(token, "%lX", (long)watch); |
17798 |
+ |
17799 |
++ watch->nr_pending = 0; |
17800 |
++ |
17801 |
+ down_read(&xs_watch_rwsem); |
17802 |
+ |
17803 |
+ spin_lock(&watches_lock); |
17804 |
+@@ -814,11 +820,14 @@ void unregister_xenbus_watch(struct xenbus_watch *watch) |
17805 |
+ |
17806 |
+ /* Cancel pending watch events. */ |
17807 |
+ spin_lock(&watch_events_lock); |
17808 |
+- list_for_each_entry_safe(event, tmp, &watch_events, list) { |
17809 |
+- if (event->handle != watch) |
17810 |
+- continue; |
17811 |
+- list_del(&event->list); |
17812 |
+- kfree(event); |
17813 |
++ if (watch->nr_pending) { |
17814 |
++ list_for_each_entry_safe(event, tmp, &watch_events, list) { |
17815 |
++ if (event->handle != watch) |
17816 |
++ continue; |
17817 |
++ list_del(&event->list); |
17818 |
++ kfree(event); |
17819 |
++ } |
17820 |
++ watch->nr_pending = 0; |
17821 |
+ } |
17822 |
+ spin_unlock(&watch_events_lock); |
17823 |
+ |
17824 |
+@@ -865,7 +874,6 @@ void xs_suspend_cancel(void) |
17825 |
+ |
17826 |
+ static int xenwatch_thread(void *unused) |
17827 |
+ { |
17828 |
+- struct list_head *ent; |
17829 |
+ struct xs_watch_event *event; |
17830 |
+ |
17831 |
+ xenwatch_pid = current->pid; |
17832 |
+@@ -880,13 +888,15 @@ static int xenwatch_thread(void *unused) |
17833 |
+ mutex_lock(&xenwatch_mutex); |
17834 |
+ |
17835 |
+ spin_lock(&watch_events_lock); |
17836 |
+- ent = watch_events.next; |
17837 |
+- if (ent != &watch_events) |
17838 |
+- list_del(ent); |
17839 |
++ event = list_first_entry_or_null(&watch_events, |
17840 |
++ struct xs_watch_event, list); |
17841 |
++ if (event) { |
17842 |
++ list_del(&event->list); |
17843 |
++ event->handle->nr_pending--; |
17844 |
++ } |
17845 |
+ spin_unlock(&watch_events_lock); |
17846 |
+ |
17847 |
+- if (ent != &watch_events) { |
17848 |
+- event = list_entry(ent, struct xs_watch_event, list); |
17849 |
++ if (event) { |
17850 |
+ event->handle->callback(event->handle, event->path, |
17851 |
+ event->token); |
17852 |
+ kfree(event); |
17853 |
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
17854 |
+index 0b29bdb251050..62461239600fc 100644 |
17855 |
+--- a/fs/btrfs/ctree.h |
17856 |
++++ b/fs/btrfs/ctree.h |
17857 |
+@@ -2593,7 +2593,6 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info, |
17858 |
+ u64 start, u64 len, int delalloc); |
17859 |
+ int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start, |
17860 |
+ u64 len); |
17861 |
+-void btrfs_prepare_extent_commit(struct btrfs_fs_info *fs_info); |
17862 |
+ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans); |
17863 |
+ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, |
17864 |
+ struct btrfs_ref *generic_ref); |
17865 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
17866 |
+index 5fd60b13f4f83..4209dbd6286e4 100644 |
17867 |
+--- a/fs/btrfs/extent-tree.c |
17868 |
++++ b/fs/btrfs/extent-tree.c |
17869 |
+@@ -2730,31 +2730,6 @@ btrfs_inc_block_group_reservations(struct btrfs_block_group *bg) |
17870 |
+ atomic_inc(&bg->reservations); |
17871 |
+ } |
17872 |
+ |
17873 |
+-void btrfs_prepare_extent_commit(struct btrfs_fs_info *fs_info) |
17874 |
+-{ |
17875 |
+- struct btrfs_caching_control *next; |
17876 |
+- struct btrfs_caching_control *caching_ctl; |
17877 |
+- struct btrfs_block_group *cache; |
17878 |
+- |
17879 |
+- down_write(&fs_info->commit_root_sem); |
17880 |
+- |
17881 |
+- list_for_each_entry_safe(caching_ctl, next, |
17882 |
+- &fs_info->caching_block_groups, list) { |
17883 |
+- cache = caching_ctl->block_group; |
17884 |
+- if (btrfs_block_group_done(cache)) { |
17885 |
+- cache->last_byte_to_unpin = (u64)-1; |
17886 |
+- list_del_init(&caching_ctl->list); |
17887 |
+- btrfs_put_caching_control(caching_ctl); |
17888 |
+- } else { |
17889 |
+- cache->last_byte_to_unpin = caching_ctl->progress; |
17890 |
+- } |
17891 |
+- } |
17892 |
+- |
17893 |
+- up_write(&fs_info->commit_root_sem); |
17894 |
+- |
17895 |
+- btrfs_update_global_block_rsv(fs_info); |
17896 |
+-} |
17897 |
+- |
17898 |
+ /* |
17899 |
+ * Returns the free cluster for the given space info and sets empty_cluster to |
17900 |
+ * what it should be based on the mount options. |
17901 |
+@@ -2816,10 +2791,10 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, |
17902 |
+ len = cache->start + cache->length - start; |
17903 |
+ len = min(len, end + 1 - start); |
17904 |
+ |
17905 |
+- if (start < cache->last_byte_to_unpin) { |
17906 |
+- len = min(len, cache->last_byte_to_unpin - start); |
17907 |
+- if (return_free_space) |
17908 |
+- btrfs_add_free_space(cache, start, len); |
17909 |
++ if (start < cache->last_byte_to_unpin && return_free_space) { |
17910 |
++ u64 add_len = min(len, cache->last_byte_to_unpin - start); |
17911 |
++ |
17912 |
++ btrfs_add_free_space(cache, start, add_len); |
17913 |
+ } |
17914 |
+ |
17915 |
+ start += len; |
17916 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
17917 |
+index 69a384145dc6f..e8ca229a216be 100644 |
17918 |
+--- a/fs/btrfs/ioctl.c |
17919 |
++++ b/fs/btrfs/ioctl.c |
17920 |
+@@ -1275,6 +1275,7 @@ static int cluster_pages_for_defrag(struct inode *inode, |
17921 |
+ u64 page_end; |
17922 |
+ u64 page_cnt; |
17923 |
+ u64 start = (u64)start_index << PAGE_SHIFT; |
17924 |
++ u64 search_start; |
17925 |
+ int ret; |
17926 |
+ int i; |
17927 |
+ int i_done; |
17928 |
+@@ -1371,6 +1372,40 @@ again: |
17929 |
+ |
17930 |
+ lock_extent_bits(&BTRFS_I(inode)->io_tree, |
17931 |
+ page_start, page_end - 1, &cached_state); |
17932 |
++ |
17933 |
++ /* |
17934 |
++ * When defragmenting we skip ranges that have holes or inline extents, |
17935 |
++ * (check should_defrag_range()), to avoid unnecessary IO and wasting |
17936 |
++ * space. At btrfs_defrag_file(), we check if a range should be defragged |
17937 |
++ * before locking the inode and then, if it should, we trigger a sync |
17938 |
++ * page cache readahead - we lock the inode only after that to avoid |
17939 |
++ * blocking for too long other tasks that possibly want to operate on |
17940 |
++ * other file ranges. But before we were able to get the inode lock, |
17941 |
++ * some other task may have punched a hole in the range, or we may have |
17942 |
++ * now an inline extent, in which case we should not defrag. So check |
17943 |
++ * for that here, where we have the inode and the range locked, and bail |
17944 |
++ * out if that happened. |
17945 |
++ */ |
17946 |
++ search_start = page_start; |
17947 |
++ while (search_start < page_end) { |
17948 |
++ struct extent_map *em; |
17949 |
++ |
17950 |
++ em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, search_start, |
17951 |
++ page_end - search_start); |
17952 |
++ if (IS_ERR(em)) { |
17953 |
++ ret = PTR_ERR(em); |
17954 |
++ goto out_unlock_range; |
17955 |
++ } |
17956 |
++ if (em->block_start >= EXTENT_MAP_LAST_BYTE) { |
17957 |
++ free_extent_map(em); |
17958 |
++ /* Ok, 0 means we did not defrag anything */ |
17959 |
++ ret = 0; |
17960 |
++ goto out_unlock_range; |
17961 |
++ } |
17962 |
++ search_start = extent_map_end(em); |
17963 |
++ free_extent_map(em); |
17964 |
++ } |
17965 |
++ |
17966 |
+ clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, |
17967 |
+ page_end - 1, EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | |
17968 |
+ EXTENT_DEFRAG, 0, 0, &cached_state); |
17969 |
+@@ -1401,6 +1436,10 @@ again: |
17970 |
+ btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT); |
17971 |
+ extent_changeset_free(data_reserved); |
17972 |
+ return i_done; |
17973 |
++ |
17974 |
++out_unlock_range: |
17975 |
++ unlock_extent_cached(&BTRFS_I(inode)->io_tree, |
17976 |
++ page_start, page_end - 1, &cached_state); |
17977 |
+ out: |
17978 |
+ for (i = 0; i < i_done; i++) { |
17979 |
+ unlock_page(pages[i]); |
17980 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
17981 |
+index 52ada47aff50d..96dbfc011f45d 100644 |
17982 |
+--- a/fs/btrfs/transaction.c |
17983 |
++++ b/fs/btrfs/transaction.c |
17984 |
+@@ -155,6 +155,7 @@ static noinline void switch_commit_roots(struct btrfs_trans_handle *trans) |
17985 |
+ struct btrfs_transaction *cur_trans = trans->transaction; |
17986 |
+ struct btrfs_fs_info *fs_info = trans->fs_info; |
17987 |
+ struct btrfs_root *root, *tmp; |
17988 |
++ struct btrfs_caching_control *caching_ctl, *next; |
17989 |
+ |
17990 |
+ down_write(&fs_info->commit_root_sem); |
17991 |
+ list_for_each_entry_safe(root, tmp, &cur_trans->switch_commits, |
17992 |
+@@ -180,6 +181,45 @@ static noinline void switch_commit_roots(struct btrfs_trans_handle *trans) |
17993 |
+ spin_lock(&cur_trans->dropped_roots_lock); |
17994 |
+ } |
17995 |
+ spin_unlock(&cur_trans->dropped_roots_lock); |
17996 |
++ |
17997 |
++ /* |
17998 |
++ * We have to update the last_byte_to_unpin under the commit_root_sem, |
17999 |
++ * at the same time we swap out the commit roots. |
18000 |
++ * |
18001 |
++ * This is because we must have a real view of the last spot the caching |
18002 |
++ * kthreads were while caching. Consider the following views of the |
18003 |
++ * extent tree for a block group |
18004 |
++ * |
18005 |
++ * commit root |
18006 |
++ * +----+----+----+----+----+----+----+ |
18007 |
++ * |\\\\| |\\\\|\\\\| |\\\\|\\\\| |
18008 |
++ * +----+----+----+----+----+----+----+ |
18009 |
++ * 0 1 2 3 4 5 6 7 |
18010 |
++ * |
18011 |
++ * new commit root |
18012 |
++ * +----+----+----+----+----+----+----+ |
18013 |
++ * | | | |\\\\| | |\\\\| |
18014 |
++ * +----+----+----+----+----+----+----+ |
18015 |
++ * 0 1 2 3 4 5 6 7 |
18016 |
++ * |
18017 |
++ * If the cache_ctl->progress was at 3, then we are only allowed to |
18018 |
++ * unpin [0,1) and [2,3], because the caching thread has already |
18019 |
++ * processed those extents. We are not allowed to unpin [5,6), because |
18020 |
++ * the caching thread will re-start it's search from 3, and thus find |
18021 |
++ * the hole from [4,6) to add to the free space cache. |
18022 |
++ */ |
18023 |
++ list_for_each_entry_safe(caching_ctl, next, |
18024 |
++ &fs_info->caching_block_groups, list) { |
18025 |
++ struct btrfs_block_group *cache = caching_ctl->block_group; |
18026 |
++ |
18027 |
++ if (btrfs_block_group_done(cache)) { |
18028 |
++ cache->last_byte_to_unpin = (u64)-1; |
18029 |
++ list_del_init(&caching_ctl->list); |
18030 |
++ btrfs_put_caching_control(caching_ctl); |
18031 |
++ } else { |
18032 |
++ cache->last_byte_to_unpin = caching_ctl->progress; |
18033 |
++ } |
18034 |
++ } |
18035 |
+ up_write(&fs_info->commit_root_sem); |
18036 |
+ } |
18037 |
+ |
18038 |
+@@ -2293,8 +2333,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) |
18039 |
+ goto unlock_tree_log; |
18040 |
+ } |
18041 |
+ |
18042 |
+- btrfs_prepare_extent_commit(fs_info); |
18043 |
+- |
18044 |
+ cur_trans = fs_info->running_transaction; |
18045 |
+ |
18046 |
+ btrfs_set_root_node(&fs_info->tree_root->root_item, |
18047 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
18048 |
+index ded4229c314a0..2b200b5a44c3a 100644 |
18049 |
+--- a/fs/ceph/caps.c |
18050 |
++++ b/fs/ceph/caps.c |
18051 |
+@@ -1140,12 +1140,19 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) |
18052 |
+ { |
18053 |
+ struct ceph_mds_session *session = cap->session; |
18054 |
+ struct ceph_inode_info *ci = cap->ci; |
18055 |
+- struct ceph_mds_client *mdsc = |
18056 |
+- ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; |
18057 |
++ struct ceph_mds_client *mdsc; |
18058 |
+ int removed = 0; |
18059 |
+ |
18060 |
++ /* 'ci' being NULL means the remove have already occurred */ |
18061 |
++ if (!ci) { |
18062 |
++ dout("%s: cap inode is NULL\n", __func__); |
18063 |
++ return; |
18064 |
++ } |
18065 |
++ |
18066 |
+ dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); |
18067 |
+ |
18068 |
++ mdsc = ceph_inode_to_client(&ci->vfs_inode)->mdsc; |
18069 |
++ |
18070 |
+ /* remove from inode's cap rbtree, and clear auth cap */ |
18071 |
+ rb_erase(&cap->ci_node, &ci->i_caps); |
18072 |
+ if (ci->i_auth_cap == cap) { |
18073 |
+diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c |
18074 |
+index d88e2683626e7..2da6b41cb5526 100644 |
18075 |
+--- a/fs/cifs/smb2misc.c |
18076 |
++++ b/fs/cifs/smb2misc.c |
18077 |
+@@ -94,6 +94,8 @@ static const __le16 smb2_rsp_struct_sizes[NUMBER_OF_SMB2_COMMANDS] = { |
18078 |
+ /* SMB2_OPLOCK_BREAK */ cpu_to_le16(24) |
18079 |
+ }; |
18080 |
+ |
18081 |
++#define SMB311_NEGPROT_BASE_SIZE (sizeof(struct smb2_sync_hdr) + sizeof(struct smb2_negotiate_rsp)) |
18082 |
++ |
18083 |
+ static __u32 get_neg_ctxt_len(struct smb2_sync_hdr *hdr, __u32 len, |
18084 |
+ __u32 non_ctxlen) |
18085 |
+ { |
18086 |
+@@ -109,11 +111,17 @@ static __u32 get_neg_ctxt_len(struct smb2_sync_hdr *hdr, __u32 len, |
18087 |
+ |
18088 |
+ /* Make sure that negotiate contexts start after gss security blob */ |
18089 |
+ nc_offset = le32_to_cpu(pneg_rsp->NegotiateContextOffset); |
18090 |
+- if (nc_offset < non_ctxlen) { |
18091 |
+- pr_warn_once("Invalid negotiate context offset\n"); |
18092 |
++ if (nc_offset + 1 < non_ctxlen) { |
18093 |
++ pr_warn_once("Invalid negotiate context offset %d\n", nc_offset); |
18094 |
+ return 0; |
18095 |
+- } |
18096 |
+- size_of_pad_before_neg_ctxts = nc_offset - non_ctxlen; |
18097 |
++ } else if (nc_offset + 1 == non_ctxlen) { |
18098 |
++ cifs_dbg(FYI, "no SPNEGO security blob in negprot rsp\n"); |
18099 |
++ size_of_pad_before_neg_ctxts = 0; |
18100 |
++ } else if (non_ctxlen == SMB311_NEGPROT_BASE_SIZE) |
18101 |
++ /* has padding, but no SPNEGO blob */ |
18102 |
++ size_of_pad_before_neg_ctxts = nc_offset - non_ctxlen + 1; |
18103 |
++ else |
18104 |
++ size_of_pad_before_neg_ctxts = nc_offset - non_ctxlen; |
18105 |
+ |
18106 |
+ /* Verify that at least minimal negotiate contexts fit within frame */ |
18107 |
+ if (len < nc_offset + (neg_count * sizeof(struct smb2_neg_context))) { |
18108 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
18109 |
+index 3d914d7d0d110..22f1d8dc12b00 100644 |
18110 |
+--- a/fs/cifs/smb2ops.c |
18111 |
++++ b/fs/cifs/smb2ops.c |
18112 |
+@@ -477,7 +477,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, |
18113 |
+ goto out; |
18114 |
+ } |
18115 |
+ |
18116 |
+- if (bytes_left || p->Next) |
18117 |
++ /* Azure rounds the buffer size up 8, to a 16 byte boundary */ |
18118 |
++ if ((bytes_left > 8) || p->Next) |
18119 |
+ cifs_dbg(VFS, "%s: incomplete interface info\n", __func__); |
18120 |
+ |
18121 |
+ |
18122 |
+diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c |
18123 |
+index acb72705062dd..fc06c762fbbf6 100644 |
18124 |
+--- a/fs/cifs/smb2pdu.c |
18125 |
++++ b/fs/cifs/smb2pdu.c |
18126 |
+@@ -427,8 +427,8 @@ build_preauth_ctxt(struct smb2_preauth_neg_context *pneg_ctxt) |
18127 |
+ pneg_ctxt->ContextType = SMB2_PREAUTH_INTEGRITY_CAPABILITIES; |
18128 |
+ pneg_ctxt->DataLength = cpu_to_le16(38); |
18129 |
+ pneg_ctxt->HashAlgorithmCount = cpu_to_le16(1); |
18130 |
+- pneg_ctxt->SaltLength = cpu_to_le16(SMB311_SALT_SIZE); |
18131 |
+- get_random_bytes(pneg_ctxt->Salt, SMB311_SALT_SIZE); |
18132 |
++ pneg_ctxt->SaltLength = cpu_to_le16(SMB311_LINUX_CLIENT_SALT_SIZE); |
18133 |
++ get_random_bytes(pneg_ctxt->Salt, SMB311_LINUX_CLIENT_SALT_SIZE); |
18134 |
+ pneg_ctxt->HashAlgorithms = SMB2_PREAUTH_INTEGRITY_SHA512; |
18135 |
+ } |
18136 |
+ |
18137 |
+@@ -566,6 +566,9 @@ static void decode_preauth_context(struct smb2_preauth_neg_context *ctxt) |
18138 |
+ if (len < MIN_PREAUTH_CTXT_DATA_LEN) { |
18139 |
+ pr_warn_once("server sent bad preauth context\n"); |
18140 |
+ return; |
18141 |
++ } else if (len < MIN_PREAUTH_CTXT_DATA_LEN + le16_to_cpu(ctxt->SaltLength)) { |
18142 |
++ pr_warn_once("server sent invalid SaltLength\n"); |
18143 |
++ return; |
18144 |
+ } |
18145 |
+ if (le16_to_cpu(ctxt->HashAlgorithmCount) != 1) |
18146 |
+ pr_warn_once("Invalid SMB3 hash algorithm count\n"); |
18147 |
+diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h |
18148 |
+index fa57b03ca98c4..204a622b89ed3 100644 |
18149 |
+--- a/fs/cifs/smb2pdu.h |
18150 |
++++ b/fs/cifs/smb2pdu.h |
18151 |
+@@ -333,12 +333,20 @@ struct smb2_neg_context { |
18152 |
+ /* Followed by array of data */ |
18153 |
+ } __packed; |
18154 |
+ |
18155 |
+-#define SMB311_SALT_SIZE 32 |
18156 |
++#define SMB311_LINUX_CLIENT_SALT_SIZE 32 |
18157 |
+ /* Hash Algorithm Types */ |
18158 |
+ #define SMB2_PREAUTH_INTEGRITY_SHA512 cpu_to_le16(0x0001) |
18159 |
+ #define SMB2_PREAUTH_HASH_SIZE 64 |
18160 |
+ |
18161 |
+-#define MIN_PREAUTH_CTXT_DATA_LEN (SMB311_SALT_SIZE + 6) |
18162 |
++/* |
18163 |
++ * SaltLength that the server send can be zero, so the only three required |
18164 |
++ * fields (all __le16) end up six bytes total, so the minimum context data len |
18165 |
++ * in the response is six bytes which accounts for |
18166 |
++ * |
18167 |
++ * HashAlgorithmCount, SaltLength, and 1 HashAlgorithm. |
18168 |
++ */ |
18169 |
++#define MIN_PREAUTH_CTXT_DATA_LEN 6 |
18170 |
++ |
18171 |
+ struct smb2_preauth_neg_context { |
18172 |
+ __le16 ContextType; /* 1 */ |
18173 |
+ __le16 DataLength; |
18174 |
+@@ -346,7 +354,7 @@ struct smb2_preauth_neg_context { |
18175 |
+ __le16 HashAlgorithmCount; /* 1 */ |
18176 |
+ __le16 SaltLength; |
18177 |
+ __le16 HashAlgorithms; /* HashAlgorithms[0] since only one defined */ |
18178 |
+- __u8 Salt[SMB311_SALT_SIZE]; |
18179 |
++ __u8 Salt[SMB311_LINUX_CLIENT_SALT_SIZE]; |
18180 |
+ } __packed; |
18181 |
+ |
18182 |
+ /* Encryption Algorithms Ciphers */ |
18183 |
+diff --git a/fs/erofs/data.c b/fs/erofs/data.c |
18184 |
+index 347be146884c3..ea4f693bee224 100644 |
18185 |
+--- a/fs/erofs/data.c |
18186 |
++++ b/fs/erofs/data.c |
18187 |
+@@ -312,27 +312,12 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) |
18188 |
+ submit_bio(bio); |
18189 |
+ } |
18190 |
+ |
18191 |
+-static int erofs_get_block(struct inode *inode, sector_t iblock, |
18192 |
+- struct buffer_head *bh, int create) |
18193 |
+-{ |
18194 |
+- struct erofs_map_blocks map = { |
18195 |
+- .m_la = iblock << 9, |
18196 |
+- }; |
18197 |
+- int err; |
18198 |
+- |
18199 |
+- err = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); |
18200 |
+- if (err) |
18201 |
+- return err; |
18202 |
+- |
18203 |
+- if (map.m_flags & EROFS_MAP_MAPPED) |
18204 |
+- bh->b_blocknr = erofs_blknr(map.m_pa); |
18205 |
+- |
18206 |
+- return err; |
18207 |
+-} |
18208 |
+- |
18209 |
+ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) |
18210 |
+ { |
18211 |
+ struct inode *inode = mapping->host; |
18212 |
++ struct erofs_map_blocks map = { |
18213 |
++ .m_la = blknr_to_addr(block), |
18214 |
++ }; |
18215 |
+ |
18216 |
+ if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) { |
18217 |
+ erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE; |
18218 |
+@@ -341,7 +326,10 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) |
18219 |
+ return 0; |
18220 |
+ } |
18221 |
+ |
18222 |
+- return generic_block_bmap(mapping, block, erofs_get_block); |
18223 |
++ if (!erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW)) |
18224 |
++ return erofs_blknr(map.m_pa); |
18225 |
++ |
18226 |
++ return 0; |
18227 |
+ } |
18228 |
+ |
18229 |
+ /* for uncompressed (aligned) files and raw access for other files */ |
18230 |
+diff --git a/fs/eventpoll.c b/fs/eventpoll.c |
18231 |
+index 4df61129566d4..117b1c395ae4a 100644 |
18232 |
+--- a/fs/eventpoll.c |
18233 |
++++ b/fs/eventpoll.c |
18234 |
+@@ -1902,23 +1902,30 @@ fetch_events: |
18235 |
+ } |
18236 |
+ write_unlock_irq(&ep->lock); |
18237 |
+ |
18238 |
+- if (eavail || res) |
18239 |
+- break; |
18240 |
++ if (!eavail && !res) |
18241 |
++ timed_out = !schedule_hrtimeout_range(to, slack, |
18242 |
++ HRTIMER_MODE_ABS); |
18243 |
+ |
18244 |
+- if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) { |
18245 |
+- timed_out = 1; |
18246 |
+- break; |
18247 |
+- } |
18248 |
+- |
18249 |
+- /* We were woken up, thus go and try to harvest some events */ |
18250 |
++ /* |
18251 |
++ * We were woken up, thus go and try to harvest some events. |
18252 |
++ * If timed out and still on the wait queue, recheck eavail |
18253 |
++ * carefully under lock, below. |
18254 |
++ */ |
18255 |
+ eavail = 1; |
18256 |
+- |
18257 |
+ } while (0); |
18258 |
+ |
18259 |
+ __set_current_state(TASK_RUNNING); |
18260 |
+ |
18261 |
+ if (!list_empty_careful(&wait.entry)) { |
18262 |
+ write_lock_irq(&ep->lock); |
18263 |
++ /* |
18264 |
++ * If the thread timed out and is not on the wait queue, it |
18265 |
++ * means that the thread was woken up after its timeout expired |
18266 |
++ * before it could reacquire the lock. Thus, when wait.entry is |
18267 |
++ * empty, it needs to harvest events. |
18268 |
++ */ |
18269 |
++ if (timed_out) |
18270 |
++ eavail = list_empty(&wait.entry); |
18271 |
+ __remove_wait_queue(&ep->wq, &wait); |
18272 |
+ write_unlock_irq(&ep->lock); |
18273 |
+ } |
18274 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
18275 |
+index 17d7096b3212d..12eac88373032 100644 |
18276 |
+--- a/fs/ext4/extents.c |
18277 |
++++ b/fs/ext4/extents.c |
18278 |
+@@ -5815,8 +5815,8 @@ int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start, |
18279 |
+ int ret; |
18280 |
+ |
18281 |
+ path = ext4_find_extent(inode, start, NULL, 0); |
18282 |
+- if (!path) |
18283 |
+- return -EINVAL; |
18284 |
++ if (IS_ERR(path)) |
18285 |
++ return PTR_ERR(path); |
18286 |
+ ex = path[path->p_depth].p_ext; |
18287 |
+ if (!ex) { |
18288 |
+ ret = -EFSCORRUPTED; |
18289 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
18290 |
+index 0d8385aea8981..0afab6d5c65bd 100644 |
18291 |
+--- a/fs/ext4/inode.c |
18292 |
++++ b/fs/ext4/inode.c |
18293 |
+@@ -175,6 +175,7 @@ void ext4_evict_inode(struct inode *inode) |
18294 |
+ */ |
18295 |
+ int extra_credits = 6; |
18296 |
+ struct ext4_xattr_inode_array *ea_inode_array = NULL; |
18297 |
++ bool freeze_protected = false; |
18298 |
+ |
18299 |
+ trace_ext4_evict_inode(inode); |
18300 |
+ |
18301 |
+@@ -232,9 +233,14 @@ void ext4_evict_inode(struct inode *inode) |
18302 |
+ |
18303 |
+ /* |
18304 |
+ * Protect us against freezing - iput() caller didn't have to have any |
18305 |
+- * protection against it |
18306 |
++ * protection against it. When we are in a running transaction though, |
18307 |
++ * we are already protected against freezing and we cannot grab further |
18308 |
++ * protection due to lock ordering constraints. |
18309 |
+ */ |
18310 |
+- sb_start_intwrite(inode->i_sb); |
18311 |
++ if (!ext4_journal_current_handle()) { |
18312 |
++ sb_start_intwrite(inode->i_sb); |
18313 |
++ freeze_protected = true; |
18314 |
++ } |
18315 |
+ |
18316 |
+ if (!IS_NOQUOTA(inode)) |
18317 |
+ extra_credits += EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb); |
18318 |
+@@ -253,7 +259,8 @@ void ext4_evict_inode(struct inode *inode) |
18319 |
+ * cleaned up. |
18320 |
+ */ |
18321 |
+ ext4_orphan_del(NULL, inode); |
18322 |
+- sb_end_intwrite(inode->i_sb); |
18323 |
++ if (freeze_protected) |
18324 |
++ sb_end_intwrite(inode->i_sb); |
18325 |
+ goto no_delete; |
18326 |
+ } |
18327 |
+ |
18328 |
+@@ -294,7 +301,8 @@ void ext4_evict_inode(struct inode *inode) |
18329 |
+ stop_handle: |
18330 |
+ ext4_journal_stop(handle); |
18331 |
+ ext4_orphan_del(NULL, inode); |
18332 |
+- sb_end_intwrite(inode->i_sb); |
18333 |
++ if (freeze_protected) |
18334 |
++ sb_end_intwrite(inode->i_sb); |
18335 |
+ ext4_xattr_inode_array_free(ea_inode_array); |
18336 |
+ goto no_delete; |
18337 |
+ } |
18338 |
+@@ -323,7 +331,8 @@ stop_handle: |
18339 |
+ else |
18340 |
+ ext4_free_inode(handle, inode); |
18341 |
+ ext4_journal_stop(handle); |
18342 |
+- sb_end_intwrite(inode->i_sb); |
18343 |
++ if (freeze_protected) |
18344 |
++ sb_end_intwrite(inode->i_sb); |
18345 |
+ ext4_xattr_inode_array_free(ea_inode_array); |
18346 |
+ return; |
18347 |
+ no_delete: |
18348 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
18349 |
+index 24af9ed5c3e52..37a619bf1ac7c 100644 |
18350 |
+--- a/fs/ext4/mballoc.c |
18351 |
++++ b/fs/ext4/mballoc.c |
18352 |
+@@ -5126,6 +5126,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b, |
18353 |
+ ext4_group_first_block_no(sb, group) + |
18354 |
+ EXT4_C2B(sbi, cluster), |
18355 |
+ "Block already on to-be-freed list"); |
18356 |
++ kmem_cache_free(ext4_free_data_cachep, new_entry); |
18357 |
+ return 0; |
18358 |
+ } |
18359 |
+ } |
18360 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
18361 |
+index 94472044f4c1d..2b08b162075c3 100644 |
18362 |
+--- a/fs/ext4/super.c |
18363 |
++++ b/fs/ext4/super.c |
18364 |
+@@ -666,19 +666,17 @@ static bool system_going_down(void) |
18365 |
+ |
18366 |
+ static void ext4_handle_error(struct super_block *sb) |
18367 |
+ { |
18368 |
++ journal_t *journal = EXT4_SB(sb)->s_journal; |
18369 |
++ |
18370 |
+ if (test_opt(sb, WARN_ON_ERROR)) |
18371 |
+ WARN_ON_ONCE(1); |
18372 |
+ |
18373 |
+- if (sb_rdonly(sb)) |
18374 |
++ if (sb_rdonly(sb) || test_opt(sb, ERRORS_CONT)) |
18375 |
+ return; |
18376 |
+ |
18377 |
+- if (!test_opt(sb, ERRORS_CONT)) { |
18378 |
+- journal_t *journal = EXT4_SB(sb)->s_journal; |
18379 |
+- |
18380 |
+- ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED); |
18381 |
+- if (journal) |
18382 |
+- jbd2_journal_abort(journal, -EIO); |
18383 |
+- } |
18384 |
++ ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED); |
18385 |
++ if (journal) |
18386 |
++ jbd2_journal_abort(journal, -EIO); |
18387 |
+ /* |
18388 |
+ * We force ERRORS_RO behavior when system is rebooting. Otherwise we |
18389 |
+ * could panic during 'reboot -f' as the underlying device got already |
18390 |
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
18391 |
+index d5d8ce077f295..42394de6c7eb1 100644 |
18392 |
+--- a/fs/f2fs/node.c |
18393 |
++++ b/fs/f2fs/node.c |
18394 |
+@@ -109,7 +109,7 @@ static void clear_node_page_dirty(struct page *page) |
18395 |
+ |
18396 |
+ static struct page *get_current_nat_page(struct f2fs_sb_info *sbi, nid_t nid) |
18397 |
+ { |
18398 |
+- return f2fs_get_meta_page(sbi, current_nat_addr(sbi, nid)); |
18399 |
++ return f2fs_get_meta_page_retry(sbi, current_nat_addr(sbi, nid)); |
18400 |
+ } |
18401 |
+ |
18402 |
+ static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid) |
18403 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
18404 |
+index 00eff2f518079..fef22e476c526 100644 |
18405 |
+--- a/fs/f2fs/super.c |
18406 |
++++ b/fs/f2fs/super.c |
18407 |
+@@ -3918,6 +3918,7 @@ free_bio_info: |
18408 |
+ |
18409 |
+ #ifdef CONFIG_UNICODE |
18410 |
+ utf8_unload(sb->s_encoding); |
18411 |
++ sb->s_encoding = NULL; |
18412 |
+ #endif |
18413 |
+ free_options: |
18414 |
+ #ifdef CONFIG_QUOTA |
18415 |
+diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c |
18416 |
+index 21a9e534417c0..d2c0e58c6416f 100644 |
18417 |
+--- a/fs/fuse/virtio_fs.c |
18418 |
++++ b/fs/fuse/virtio_fs.c |
18419 |
+@@ -1464,6 +1464,8 @@ static int virtio_fs_get_tree(struct fs_context *fsc) |
18420 |
+ if (!sb->s_root) { |
18421 |
+ err = virtio_fs_fill_super(sb, fsc); |
18422 |
+ if (err) { |
18423 |
++ fuse_mount_put(fm); |
18424 |
++ sb->s_fs_info = NULL; |
18425 |
+ deactivate_locked_super(sb); |
18426 |
+ return err; |
18427 |
+ } |
18428 |
+diff --git a/fs/inode.c b/fs/inode.c |
18429 |
+index 9d78c37b00b81..5eea9912a0b9d 100644 |
18430 |
+--- a/fs/inode.c |
18431 |
++++ b/fs/inode.c |
18432 |
+@@ -1627,7 +1627,9 @@ static void iput_final(struct inode *inode) |
18433 |
+ else |
18434 |
+ drop = generic_drop_inode(inode); |
18435 |
+ |
18436 |
+- if (!drop && (sb->s_flags & SB_ACTIVE)) { |
18437 |
++ if (!drop && |
18438 |
++ !(inode->i_state & I_DONTCACHE) && |
18439 |
++ (sb->s_flags & SB_ACTIVE)) { |
18440 |
+ inode_add_lru(inode); |
18441 |
+ spin_unlock(&inode->i_lock); |
18442 |
+ return; |
18443 |
+diff --git a/fs/io-wq.h b/fs/io-wq.h |
18444 |
+index cba36f03c3555..aaa363f358916 100644 |
18445 |
+--- a/fs/io-wq.h |
18446 |
++++ b/fs/io-wq.h |
18447 |
+@@ -59,6 +59,7 @@ static inline void wq_list_add_tail(struct io_wq_work_node *node, |
18448 |
+ list->last->next = node; |
18449 |
+ list->last = node; |
18450 |
+ } |
18451 |
++ node->next = NULL; |
18452 |
+ } |
18453 |
+ |
18454 |
+ static inline void wq_list_cut(struct io_wq_work_list *list, |
18455 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
18456 |
+index 86dac2b2e2763..0fcd065baa760 100644 |
18457 |
+--- a/fs/io_uring.c |
18458 |
++++ b/fs/io_uring.c |
18459 |
+@@ -1641,10 +1641,6 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force, |
18460 |
+ |
18461 |
+ spin_lock_irqsave(&ctx->completion_lock, flags); |
18462 |
+ |
18463 |
+- /* if force is set, the ring is going away. always drop after that */ |
18464 |
+- if (force) |
18465 |
+- ctx->cq_overflow_flushed = 1; |
18466 |
+- |
18467 |
+ cqe = NULL; |
18468 |
+ list_for_each_entry_safe(req, tmp, &ctx->cq_overflow_list, compl.list) { |
18469 |
+ if (tsk && req->task != tsk) |
18470 |
+@@ -2246,7 +2242,7 @@ static unsigned io_cqring_events(struct io_ring_ctx *ctx, bool noflush) |
18471 |
+ * we wake up the task, and the next invocation will flush the |
18472 |
+ * entries. We cannot safely to it from here. |
18473 |
+ */ |
18474 |
+- if (noflush && !list_empty(&ctx->cq_overflow_list)) |
18475 |
++ if (noflush) |
18476 |
+ return -1U; |
18477 |
+ |
18478 |
+ io_cqring_overflow_flush(ctx, false, NULL, NULL); |
18479 |
+@@ -3052,9 +3048,7 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov, |
18480 |
+ iov[0].iov_len = kbuf->len; |
18481 |
+ return 0; |
18482 |
+ } |
18483 |
+- if (!req->rw.len) |
18484 |
+- return 0; |
18485 |
+- else if (req->rw.len > 1) |
18486 |
++ if (req->rw.len != 1) |
18487 |
+ return -EINVAL; |
18488 |
+ |
18489 |
+ #ifdef CONFIG_COMPAT |
18490 |
+@@ -3948,11 +3942,17 @@ static int io_remove_buffers(struct io_kiocb *req, bool force_nonblock, |
18491 |
+ head = idr_find(&ctx->io_buffer_idr, p->bgid); |
18492 |
+ if (head) |
18493 |
+ ret = __io_remove_buffers(ctx, head, p->bgid, p->nbufs); |
18494 |
+- |
18495 |
+- io_ring_submit_lock(ctx, !force_nonblock); |
18496 |
+ if (ret < 0) |
18497 |
+ req_set_fail_links(req); |
18498 |
+- __io_req_complete(req, ret, 0, cs); |
18499 |
++ |
18500 |
++ /* need to hold the lock to complete IOPOLL requests */ |
18501 |
++ if (ctx->flags & IORING_SETUP_IOPOLL) { |
18502 |
++ __io_req_complete(req, ret, 0, cs); |
18503 |
++ io_ring_submit_unlock(ctx, !force_nonblock); |
18504 |
++ } else { |
18505 |
++ io_ring_submit_unlock(ctx, !force_nonblock); |
18506 |
++ __io_req_complete(req, ret, 0, cs); |
18507 |
++ } |
18508 |
+ return 0; |
18509 |
+ } |
18510 |
+ |
18511 |
+@@ -4037,10 +4037,17 @@ static int io_provide_buffers(struct io_kiocb *req, bool force_nonblock, |
18512 |
+ } |
18513 |
+ } |
18514 |
+ out: |
18515 |
+- io_ring_submit_unlock(ctx, !force_nonblock); |
18516 |
+ if (ret < 0) |
18517 |
+ req_set_fail_links(req); |
18518 |
+- __io_req_complete(req, ret, 0, cs); |
18519 |
++ |
18520 |
++ /* need to hold the lock to complete IOPOLL requests */ |
18521 |
++ if (ctx->flags & IORING_SETUP_IOPOLL) { |
18522 |
++ __io_req_complete(req, ret, 0, cs); |
18523 |
++ io_ring_submit_unlock(ctx, !force_nonblock); |
18524 |
++ } else { |
18525 |
++ io_ring_submit_unlock(ctx, !force_nonblock); |
18526 |
++ __io_req_complete(req, ret, 0, cs); |
18527 |
++ } |
18528 |
+ return 0; |
18529 |
+ } |
18530 |
+ |
18531 |
+@@ -6074,8 +6081,28 @@ static struct io_wq_work *io_wq_submit_work(struct io_wq_work *work) |
18532 |
+ } |
18533 |
+ |
18534 |
+ if (ret) { |
18535 |
++ struct io_ring_ctx *lock_ctx = NULL; |
18536 |
++ |
18537 |
++ if (req->ctx->flags & IORING_SETUP_IOPOLL) |
18538 |
++ lock_ctx = req->ctx; |
18539 |
++ |
18540 |
++ /* |
18541 |
++ * io_iopoll_complete() does not hold completion_lock to |
18542 |
++ * complete polled io, so here for polled io, we can not call |
18543 |
++ * io_req_complete() directly, otherwise there maybe concurrent |
18544 |
++ * access to cqring, defer_list, etc, which is not safe. Given |
18545 |
++ * that io_iopoll_complete() is always called under uring_lock, |
18546 |
++ * so here for polled io, we also get uring_lock to complete |
18547 |
++ * it. |
18548 |
++ */ |
18549 |
++ if (lock_ctx) |
18550 |
++ mutex_lock(&lock_ctx->uring_lock); |
18551 |
++ |
18552 |
+ req_set_fail_links(req); |
18553 |
+ io_req_complete(req, ret); |
18554 |
++ |
18555 |
++ if (lock_ctx) |
18556 |
++ mutex_unlock(&lock_ctx->uring_lock); |
18557 |
+ } |
18558 |
+ |
18559 |
+ return io_steal_work(req); |
18560 |
+@@ -8369,28 +8396,35 @@ static void io_ring_exit_work(struct work_struct *work) |
18561 |
+ * as nobody else will be looking for them. |
18562 |
+ */ |
18563 |
+ do { |
18564 |
+- if (ctx->rings) |
18565 |
+- io_cqring_overflow_flush(ctx, true, NULL, NULL); |
18566 |
+ io_iopoll_try_reap_events(ctx); |
18567 |
+ } while (!wait_for_completion_timeout(&ctx->ref_comp, HZ/20)); |
18568 |
+ io_ring_ctx_free(ctx); |
18569 |
+ } |
18570 |
+ |
18571 |
++static bool io_cancel_ctx_cb(struct io_wq_work *work, void *data) |
18572 |
++{ |
18573 |
++ struct io_kiocb *req = container_of(work, struct io_kiocb, work); |
18574 |
++ |
18575 |
++ return req->ctx == data; |
18576 |
++} |
18577 |
++ |
18578 |
+ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) |
18579 |
+ { |
18580 |
+ mutex_lock(&ctx->uring_lock); |
18581 |
+ percpu_ref_kill(&ctx->refs); |
18582 |
++ /* if force is set, the ring is going away. always drop after that */ |
18583 |
++ ctx->cq_overflow_flushed = 1; |
18584 |
++ if (ctx->rings) |
18585 |
++ io_cqring_overflow_flush(ctx, true, NULL, NULL); |
18586 |
+ mutex_unlock(&ctx->uring_lock); |
18587 |
+ |
18588 |
+ io_kill_timeouts(ctx, NULL); |
18589 |
+ io_poll_remove_all(ctx, NULL); |
18590 |
+ |
18591 |
+ if (ctx->io_wq) |
18592 |
+- io_wq_cancel_all(ctx->io_wq); |
18593 |
++ io_wq_cancel_cb(ctx->io_wq, io_cancel_ctx_cb, ctx, true); |
18594 |
+ |
18595 |
+ /* if we failed setting up the ctx, we might not have any rings */ |
18596 |
+- if (ctx->rings) |
18597 |
+- io_cqring_overflow_flush(ctx, true, NULL, NULL); |
18598 |
+ io_iopoll_try_reap_events(ctx); |
18599 |
+ idr_for_each(&ctx->personality_idr, io_remove_personalities, ctx); |
18600 |
+ |
18601 |
+@@ -8421,14 +8455,6 @@ static int io_uring_release(struct inode *inode, struct file *file) |
18602 |
+ return 0; |
18603 |
+ } |
18604 |
+ |
18605 |
+-static bool io_wq_files_match(struct io_wq_work *work, void *data) |
18606 |
+-{ |
18607 |
+- struct files_struct *files = data; |
18608 |
+- |
18609 |
+- return !files || ((work->flags & IO_WQ_WORK_FILES) && |
18610 |
+- work->identity->files == files); |
18611 |
+-} |
18612 |
+- |
18613 |
+ /* |
18614 |
+ * Returns true if 'preq' is the link parent of 'req' |
18615 |
+ */ |
18616 |
+@@ -8566,21 +8592,20 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, |
18617 |
+ * Returns true if we found and killed one or more files pinning requests |
18618 |
+ */ |
18619 |
+ static bool io_uring_cancel_files(struct io_ring_ctx *ctx, |
18620 |
++ struct task_struct *task, |
18621 |
+ struct files_struct *files) |
18622 |
+ { |
18623 |
+ if (list_empty_careful(&ctx->inflight_list)) |
18624 |
+ return false; |
18625 |
+ |
18626 |
+- /* cancel all at once, should be faster than doing it one by one*/ |
18627 |
+- io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true); |
18628 |
+- |
18629 |
+ while (!list_empty_careful(&ctx->inflight_list)) { |
18630 |
+ struct io_kiocb *cancel_req = NULL, *req; |
18631 |
+ DEFINE_WAIT(wait); |
18632 |
+ |
18633 |
+ spin_lock_irq(&ctx->inflight_lock); |
18634 |
+ list_for_each_entry(req, &ctx->inflight_list, inflight_entry) { |
18635 |
+- if (files && (req->work.flags & IO_WQ_WORK_FILES) && |
18636 |
++ if (req->task == task && |
18637 |
++ (req->work.flags & IO_WQ_WORK_FILES) && |
18638 |
+ req->work.identity->files != files) |
18639 |
+ continue; |
18640 |
+ /* req is being completed, ignore */ |
18641 |
+@@ -8623,7 +8648,7 @@ static bool __io_uring_cancel_task_requests(struct io_ring_ctx *ctx, |
18642 |
+ { |
18643 |
+ bool ret; |
18644 |
+ |
18645 |
+- ret = io_uring_cancel_files(ctx, files); |
18646 |
++ ret = io_uring_cancel_files(ctx, task, files); |
18647 |
+ if (!files) { |
18648 |
+ enum io_wq_cancel cret; |
18649 |
+ |
18650 |
+@@ -8662,12 +8687,10 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx, |
18651 |
+ io_sq_thread_park(ctx->sq_data); |
18652 |
+ } |
18653 |
+ |
18654 |
+- if (files) |
18655 |
+- io_cancel_defer_files(ctx, NULL, files); |
18656 |
+- else |
18657 |
+- io_cancel_defer_files(ctx, task, NULL); |
18658 |
+- |
18659 |
++ io_cancel_defer_files(ctx, task, files); |
18660 |
++ io_ring_submit_lock(ctx, (ctx->flags & IORING_SETUP_IOPOLL)); |
18661 |
+ io_cqring_overflow_flush(ctx, true, task, files); |
18662 |
++ io_ring_submit_unlock(ctx, (ctx->flags & IORING_SETUP_IOPOLL)); |
18663 |
+ |
18664 |
+ while (__io_uring_cancel_task_requests(ctx, task, files)) { |
18665 |
+ io_run_task_work(); |
18666 |
+@@ -8692,10 +8715,9 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx, |
18667 |
+ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) |
18668 |
+ { |
18669 |
+ struct io_uring_task *tctx = current->io_uring; |
18670 |
++ int ret; |
18671 |
+ |
18672 |
+ if (unlikely(!tctx)) { |
18673 |
+- int ret; |
18674 |
+- |
18675 |
+ ret = io_uring_alloc_task_context(current); |
18676 |
+ if (unlikely(ret)) |
18677 |
+ return ret; |
18678 |
+@@ -8706,7 +8728,12 @@ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) |
18679 |
+ |
18680 |
+ if (!old) { |
18681 |
+ get_file(file); |
18682 |
+- xa_store(&tctx->xa, (unsigned long)file, file, GFP_KERNEL); |
18683 |
++ ret = xa_err(xa_store(&tctx->xa, (unsigned long)file, |
18684 |
++ file, GFP_KERNEL)); |
18685 |
++ if (ret) { |
18686 |
++ fput(file); |
18687 |
++ return ret; |
18688 |
++ } |
18689 |
+ } |
18690 |
+ tctx->last = file; |
18691 |
+ } |
18692 |
+@@ -8969,8 +8996,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, |
18693 |
+ */ |
18694 |
+ ret = 0; |
18695 |
+ if (ctx->flags & IORING_SETUP_SQPOLL) { |
18696 |
++ io_ring_submit_lock(ctx, (ctx->flags & IORING_SETUP_IOPOLL)); |
18697 |
+ if (!list_empty_careful(&ctx->cq_overflow_list)) |
18698 |
+ io_cqring_overflow_flush(ctx, false, NULL, NULL); |
18699 |
++ io_ring_submit_unlock(ctx, (ctx->flags & IORING_SETUP_IOPOLL)); |
18700 |
+ if (flags & IORING_ENTER_SQ_WAKEUP) |
18701 |
+ wake_up(&ctx->sq_data->wait); |
18702 |
+ if (flags & IORING_ENTER_SQ_WAIT) |
18703 |
+@@ -9173,55 +9202,52 @@ static int io_allocate_scq_urings(struct io_ring_ctx *ctx, |
18704 |
+ return 0; |
18705 |
+ } |
18706 |
+ |
18707 |
++static int io_uring_install_fd(struct io_ring_ctx *ctx, struct file *file) |
18708 |
++{ |
18709 |
++ int ret, fd; |
18710 |
++ |
18711 |
++ fd = get_unused_fd_flags(O_RDWR | O_CLOEXEC); |
18712 |
++ if (fd < 0) |
18713 |
++ return fd; |
18714 |
++ |
18715 |
++ ret = io_uring_add_task_file(ctx, file); |
18716 |
++ if (ret) { |
18717 |
++ put_unused_fd(fd); |
18718 |
++ return ret; |
18719 |
++ } |
18720 |
++ fd_install(fd, file); |
18721 |
++ return fd; |
18722 |
++} |
18723 |
++ |
18724 |
+ /* |
18725 |
+ * Allocate an anonymous fd, this is what constitutes the application |
18726 |
+ * visible backing of an io_uring instance. The application mmaps this |
18727 |
+ * fd to gain access to the SQ/CQ ring details. If UNIX sockets are enabled, |
18728 |
+ * we have to tie this fd to a socket for file garbage collection purposes. |
18729 |
+ */ |
18730 |
+-static int io_uring_get_fd(struct io_ring_ctx *ctx) |
18731 |
++static struct file *io_uring_get_file(struct io_ring_ctx *ctx) |
18732 |
+ { |
18733 |
+ struct file *file; |
18734 |
++#if defined(CONFIG_UNIX) |
18735 |
+ int ret; |
18736 |
+- int fd; |
18737 |
+ |
18738 |
+-#if defined(CONFIG_UNIX) |
18739 |
+ ret = sock_create_kern(&init_net, PF_UNIX, SOCK_RAW, IPPROTO_IP, |
18740 |
+ &ctx->ring_sock); |
18741 |
+ if (ret) |
18742 |
+- return ret; |
18743 |
++ return ERR_PTR(ret); |
18744 |
+ #endif |
18745 |
+ |
18746 |
+- ret = get_unused_fd_flags(O_RDWR | O_CLOEXEC); |
18747 |
+- if (ret < 0) |
18748 |
+- goto err; |
18749 |
+- fd = ret; |
18750 |
+- |
18751 |
+ file = anon_inode_getfile("[io_uring]", &io_uring_fops, ctx, |
18752 |
+ O_RDWR | O_CLOEXEC); |
18753 |
+- if (IS_ERR(file)) { |
18754 |
+- put_unused_fd(fd); |
18755 |
+- ret = PTR_ERR(file); |
18756 |
+- goto err; |
18757 |
+- } |
18758 |
+- |
18759 |
+ #if defined(CONFIG_UNIX) |
18760 |
+- ctx->ring_sock->file = file; |
18761 |
+-#endif |
18762 |
+- ret = io_uring_add_task_file(ctx, file); |
18763 |
+- if (ret) { |
18764 |
+- fput(file); |
18765 |
+- put_unused_fd(fd); |
18766 |
+- goto err; |
18767 |
++ if (IS_ERR(file)) { |
18768 |
++ sock_release(ctx->ring_sock); |
18769 |
++ ctx->ring_sock = NULL; |
18770 |
++ } else { |
18771 |
++ ctx->ring_sock->file = file; |
18772 |
+ } |
18773 |
+- fd_install(fd, file); |
18774 |
+- return fd; |
18775 |
+-err: |
18776 |
+-#if defined(CONFIG_UNIX) |
18777 |
+- sock_release(ctx->ring_sock); |
18778 |
+- ctx->ring_sock = NULL; |
18779 |
+ #endif |
18780 |
+- return ret; |
18781 |
++ return file; |
18782 |
+ } |
18783 |
+ |
18784 |
+ static int io_uring_create(unsigned entries, struct io_uring_params *p, |
18785 |
+@@ -9229,6 +9255,7 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, |
18786 |
+ { |
18787 |
+ struct user_struct *user = NULL; |
18788 |
+ struct io_ring_ctx *ctx; |
18789 |
++ struct file *file; |
18790 |
+ bool limit_mem; |
18791 |
+ int ret; |
18792 |
+ |
18793 |
+@@ -9375,13 +9402,22 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, |
18794 |
+ goto err; |
18795 |
+ } |
18796 |
+ |
18797 |
++ file = io_uring_get_file(ctx); |
18798 |
++ if (IS_ERR(file)) { |
18799 |
++ ret = PTR_ERR(file); |
18800 |
++ goto err; |
18801 |
++ } |
18802 |
++ |
18803 |
+ /* |
18804 |
+ * Install ring fd as the very last thing, so we don't risk someone |
18805 |
+ * having closed it before we finish setup |
18806 |
+ */ |
18807 |
+- ret = io_uring_get_fd(ctx); |
18808 |
+- if (ret < 0) |
18809 |
+- goto err; |
18810 |
++ ret = io_uring_install_fd(ctx, file); |
18811 |
++ if (ret < 0) { |
18812 |
++ /* fput will clean it up */ |
18813 |
++ fput(file); |
18814 |
++ return ret; |
18815 |
++ } |
18816 |
+ |
18817 |
+ trace_io_uring_create(ret, ctx, p->sq_entries, p->cq_entries, p->flags); |
18818 |
+ return ret; |
18819 |
+diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c |
18820 |
+index 2f6f0b140c05a..03b4f99614bef 100644 |
18821 |
+--- a/fs/jffs2/readinode.c |
18822 |
++++ b/fs/jffs2/readinode.c |
18823 |
+@@ -672,6 +672,22 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r |
18824 |
+ jffs2_free_full_dirent(fd); |
18825 |
+ return -EIO; |
18826 |
+ } |
18827 |
++ |
18828 |
++#ifdef CONFIG_JFFS2_SUMMARY |
18829 |
++ /* |
18830 |
++ * we use CONFIG_JFFS2_SUMMARY because without it, we |
18831 |
++ * have checked it while mounting |
18832 |
++ */ |
18833 |
++ crc = crc32(0, fd->name, rd->nsize); |
18834 |
++ if (unlikely(crc != je32_to_cpu(rd->name_crc))) { |
18835 |
++ JFFS2_NOTICE("name CRC failed on dirent node at" |
18836 |
++ "%#08x: read %#08x,calculated %#08x\n", |
18837 |
++ ref_offset(ref), je32_to_cpu(rd->node_crc), crc); |
18838 |
++ jffs2_mark_node_obsolete(c, ref); |
18839 |
++ jffs2_free_full_dirent(fd); |
18840 |
++ return 0; |
18841 |
++ } |
18842 |
++#endif |
18843 |
+ } |
18844 |
+ |
18845 |
+ fd->nhash = full_name_hash(NULL, fd->name, rd->nsize); |
18846 |
+diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c |
18847 |
+index 05d7878dfad15..4fd297bdf0f3f 100644 |
18848 |
+--- a/fs/jffs2/super.c |
18849 |
++++ b/fs/jffs2/super.c |
18850 |
+@@ -215,11 +215,28 @@ static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) |
18851 |
+ return 0; |
18852 |
+ } |
18853 |
+ |
18854 |
++static inline void jffs2_update_mount_opts(struct fs_context *fc) |
18855 |
++{ |
18856 |
++ struct jffs2_sb_info *new_c = fc->s_fs_info; |
18857 |
++ struct jffs2_sb_info *c = JFFS2_SB_INFO(fc->root->d_sb); |
18858 |
++ |
18859 |
++ mutex_lock(&c->alloc_sem); |
18860 |
++ if (new_c->mount_opts.override_compr) { |
18861 |
++ c->mount_opts.override_compr = new_c->mount_opts.override_compr; |
18862 |
++ c->mount_opts.compr = new_c->mount_opts.compr; |
18863 |
++ } |
18864 |
++ if (new_c->mount_opts.rp_size) |
18865 |
++ c->mount_opts.rp_size = new_c->mount_opts.rp_size; |
18866 |
++ mutex_unlock(&c->alloc_sem); |
18867 |
++} |
18868 |
++ |
18869 |
+ static int jffs2_reconfigure(struct fs_context *fc) |
18870 |
+ { |
18871 |
+ struct super_block *sb = fc->root->d_sb; |
18872 |
+ |
18873 |
+ sync_filesystem(sb); |
18874 |
++ jffs2_update_mount_opts(fc); |
18875 |
++ |
18876 |
+ return jffs2_do_remount_fs(sb, fc); |
18877 |
+ } |
18878 |
+ |
18879 |
+diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h |
18880 |
+index 29891fad3f095..aa03a904d5ab2 100644 |
18881 |
+--- a/fs/jfs/jfs_dmap.h |
18882 |
++++ b/fs/jfs/jfs_dmap.h |
18883 |
+@@ -183,7 +183,7 @@ typedef union dmtree { |
18884 |
+ #define dmt_leafidx t1.leafidx |
18885 |
+ #define dmt_height t1.height |
18886 |
+ #define dmt_budmin t1.budmin |
18887 |
+-#define dmt_stree t1.stree |
18888 |
++#define dmt_stree t2.stree |
18889 |
+ |
18890 |
+ /* |
18891 |
+ * on-disk aggregate disk allocation map descriptor. |
18892 |
+diff --git a/fs/lockd/host.c b/fs/lockd/host.c |
18893 |
+index 0afb6d59bad03..771c289f6df7f 100644 |
18894 |
+--- a/fs/lockd/host.c |
18895 |
++++ b/fs/lockd/host.c |
18896 |
+@@ -439,12 +439,7 @@ nlm_bind_host(struct nlm_host *host) |
18897 |
+ * RPC rebind is required |
18898 |
+ */ |
18899 |
+ if ((clnt = host->h_rpcclnt) != NULL) { |
18900 |
+- if (time_after_eq(jiffies, host->h_nextrebind)) { |
18901 |
+- rpc_force_rebind(clnt); |
18902 |
+- host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
18903 |
+- dprintk("lockd: next rebind in %lu jiffies\n", |
18904 |
+- host->h_nextrebind - jiffies); |
18905 |
+- } |
18906 |
++ nlm_rebind_host(host); |
18907 |
+ } else { |
18908 |
+ unsigned long increment = nlmsvc_timeout; |
18909 |
+ struct rpc_timeout timeparms = { |
18910 |
+@@ -494,13 +489,20 @@ nlm_bind_host(struct nlm_host *host) |
18911 |
+ return clnt; |
18912 |
+ } |
18913 |
+ |
18914 |
+-/* |
18915 |
+- * Force a portmap lookup of the remote lockd port |
18916 |
++/** |
18917 |
++ * nlm_rebind_host - If needed, force a portmap lookup of the peer's lockd port |
18918 |
++ * @host: NLM host handle for peer |
18919 |
++ * |
18920 |
++ * This is not needed when using a connection-oriented protocol, such as TCP. |
18921 |
++ * The existing autobind mechanism is sufficient to force a rebind when |
18922 |
++ * required, e.g. on connection state transitions. |
18923 |
+ */ |
18924 |
+ void |
18925 |
+ nlm_rebind_host(struct nlm_host *host) |
18926 |
+ { |
18927 |
+- dprintk("lockd: rebind host %s\n", host->h_name); |
18928 |
++ if (host->h_proto != IPPROTO_UDP) |
18929 |
++ return; |
18930 |
++ |
18931 |
+ if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) { |
18932 |
+ rpc_force_rebind(host->h_rpcclnt); |
18933 |
+ host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
18934 |
+diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c |
18935 |
+index 24bf5797f88ae..fd0eda328943b 100644 |
18936 |
+--- a/fs/nfs/flexfilelayout/flexfilelayout.c |
18937 |
++++ b/fs/nfs/flexfilelayout/flexfilelayout.c |
18938 |
+@@ -1056,7 +1056,7 @@ static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr) |
18939 |
+ u32 idx = hdr->pgio_mirror_idx + 1; |
18940 |
+ u32 new_idx = 0; |
18941 |
+ |
18942 |
+- if (ff_layout_choose_any_ds_for_read(hdr->lseg, idx + 1, &new_idx)) |
18943 |
++ if (ff_layout_choose_any_ds_for_read(hdr->lseg, idx, &new_idx)) |
18944 |
+ ff_layout_send_layouterror(hdr->lseg); |
18945 |
+ else |
18946 |
+ pnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg); |
18947 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
18948 |
+index aa6493905bbe8..43af053f467a7 100644 |
18949 |
+--- a/fs/nfs/inode.c |
18950 |
++++ b/fs/nfs/inode.c |
18951 |
+@@ -2180,7 +2180,7 @@ static int nfsiod_start(void) |
18952 |
+ { |
18953 |
+ struct workqueue_struct *wq; |
18954 |
+ dprintk("RPC: creating workqueue nfsiod\n"); |
18955 |
+- wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM, 0); |
18956 |
++ wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0); |
18957 |
+ if (wq == NULL) |
18958 |
+ return -ENOMEM; |
18959 |
+ nfsiod_workqueue = wq; |
18960 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
18961 |
+index e89468678ae16..6858b4bb556d5 100644 |
18962 |
+--- a/fs/nfs/nfs4proc.c |
18963 |
++++ b/fs/nfs/nfs4proc.c |
18964 |
+@@ -4961,12 +4961,12 @@ static int _nfs4_proc_readdir(struct dentry *dentry, const struct cred *cred, |
18965 |
+ u64 cookie, struct page **pages, unsigned int count, bool plus) |
18966 |
+ { |
18967 |
+ struct inode *dir = d_inode(dentry); |
18968 |
++ struct nfs_server *server = NFS_SERVER(dir); |
18969 |
+ struct nfs4_readdir_arg args = { |
18970 |
+ .fh = NFS_FH(dir), |
18971 |
+ .pages = pages, |
18972 |
+ .pgbase = 0, |
18973 |
+ .count = count, |
18974 |
+- .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask, |
18975 |
+ .plus = plus, |
18976 |
+ }; |
18977 |
+ struct nfs4_readdir_res res; |
18978 |
+@@ -4981,9 +4981,15 @@ static int _nfs4_proc_readdir(struct dentry *dentry, const struct cred *cred, |
18979 |
+ dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__, |
18980 |
+ dentry, |
18981 |
+ (unsigned long long)cookie); |
18982 |
++ if (!(server->caps & NFS_CAP_SECURITY_LABEL)) |
18983 |
++ args.bitmask = server->attr_bitmask_nl; |
18984 |
++ else |
18985 |
++ args.bitmask = server->attr_bitmask; |
18986 |
++ |
18987 |
+ nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args); |
18988 |
+ res.pgbase = args.pgbase; |
18989 |
+- status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0); |
18990 |
++ status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, |
18991 |
++ &res.seq_res, 0); |
18992 |
+ if (status >= 0) { |
18993 |
+ memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE); |
18994 |
+ status += args.pgbase; |
18995 |
+diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c |
18996 |
+index c6dbfcae75171..c16b93df1bc14 100644 |
18997 |
+--- a/fs/nfs/nfs4xdr.c |
18998 |
++++ b/fs/nfs/nfs4xdr.c |
18999 |
+@@ -3009,15 +3009,19 @@ static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, |
19000 |
+ struct compound_hdr hdr = { |
19001 |
+ .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
19002 |
+ }; |
19003 |
++ uint32_t replen; |
19004 |
+ |
19005 |
+ encode_compound_hdr(xdr, req, &hdr); |
19006 |
+ encode_sequence(xdr, &args->seq_args, &hdr); |
19007 |
++ |
19008 |
++ replen = hdr.replen + op_decode_hdr_maxsz; |
19009 |
++ |
19010 |
+ encode_getdeviceinfo(xdr, args, &hdr); |
19011 |
+ |
19012 |
+- /* set up reply kvec. Subtract notification bitmap max size (2) |
19013 |
+- * so that notification bitmap is put in xdr_buf tail */ |
19014 |
++ /* set up reply kvec. device_addr4 opaque data is read into the |
19015 |
++ * pages */ |
19016 |
+ rpc_prepare_reply_pages(req, args->pdev->pages, args->pdev->pgbase, |
19017 |
+- args->pdev->pglen, hdr.replen - 2); |
19018 |
++ args->pdev->pglen, replen + 2 + 1); |
19019 |
+ encode_nops(&hdr); |
19020 |
+ } |
19021 |
+ |
19022 |
+diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c |
19023 |
+index b73d9dd37f73c..26f2a50eceac9 100644 |
19024 |
+--- a/fs/nfs_common/grace.c |
19025 |
++++ b/fs/nfs_common/grace.c |
19026 |
+@@ -69,10 +69,14 @@ __state_in_grace(struct net *net, bool open) |
19027 |
+ if (!open) |
19028 |
+ return !list_empty(grace_list); |
19029 |
+ |
19030 |
++ spin_lock(&grace_lock); |
19031 |
+ list_for_each_entry(lm, grace_list, list) { |
19032 |
+- if (lm->block_opens) |
19033 |
++ if (lm->block_opens) { |
19034 |
++ spin_unlock(&grace_lock); |
19035 |
+ return true; |
19036 |
++ } |
19037 |
+ } |
19038 |
++ spin_unlock(&grace_lock); |
19039 |
+ return false; |
19040 |
+ } |
19041 |
+ |
19042 |
+diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c |
19043 |
+index 3c6c2f7d1688b..5849c1bd88f17 100644 |
19044 |
+--- a/fs/nfsd/filecache.c |
19045 |
++++ b/fs/nfsd/filecache.c |
19046 |
+@@ -600,7 +600,7 @@ static struct notifier_block nfsd_file_lease_notifier = { |
19047 |
+ static int |
19048 |
+ nfsd_file_fsnotify_handle_event(struct fsnotify_mark *mark, u32 mask, |
19049 |
+ struct inode *inode, struct inode *dir, |
19050 |
+- const struct qstr *name) |
19051 |
++ const struct qstr *name, u32 cookie) |
19052 |
+ { |
19053 |
+ trace_nfsd_file_fsnotify_handle_event(inode, mask); |
19054 |
+ |
19055 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
19056 |
+index d7f27ed6b7941..47006eec724e6 100644 |
19057 |
+--- a/fs/nfsd/nfs4state.c |
19058 |
++++ b/fs/nfsd/nfs4state.c |
19059 |
+@@ -769,6 +769,7 @@ static int nfs4_init_cp_state(struct nfsd_net *nn, copy_stateid_t *stid, |
19060 |
+ spin_lock(&nn->s2s_cp_lock); |
19061 |
+ new_id = idr_alloc_cyclic(&nn->s2s_cp_stateids, stid, 0, 0, GFP_NOWAIT); |
19062 |
+ stid->stid.si_opaque.so_id = new_id; |
19063 |
++ stid->stid.si_generation = 1; |
19064 |
+ spin_unlock(&nn->s2s_cp_lock); |
19065 |
+ idr_preload_end(); |
19066 |
+ if (new_id < 0) |
19067 |
+diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c |
19068 |
+index 27b1ad1361508..9323e30a7eafe 100644 |
19069 |
+--- a/fs/nfsd/nfssvc.c |
19070 |
++++ b/fs/nfsd/nfssvc.c |
19071 |
+@@ -527,8 +527,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net) |
19072 |
+ return; |
19073 |
+ |
19074 |
+ nfsd_shutdown_net(net); |
19075 |
+- printk(KERN_WARNING "nfsd: last server has exited, flushing export " |
19076 |
+- "cache\n"); |
19077 |
++ pr_info("nfsd: last server has exited, flushing export cache\n"); |
19078 |
+ nfsd_export_flush(net); |
19079 |
+ } |
19080 |
+ |
19081 |
+diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c |
19082 |
+index 5dcda8f20c04f..e45ca6ecba959 100644 |
19083 |
+--- a/fs/notify/dnotify/dnotify.c |
19084 |
++++ b/fs/notify/dnotify/dnotify.c |
19085 |
+@@ -72,7 +72,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark) |
19086 |
+ */ |
19087 |
+ static int dnotify_handle_event(struct fsnotify_mark *inode_mark, u32 mask, |
19088 |
+ struct inode *inode, struct inode *dir, |
19089 |
+- const struct qstr *name) |
19090 |
++ const struct qstr *name, u32 cookie) |
19091 |
+ { |
19092 |
+ struct dnotify_mark *dn_mark; |
19093 |
+ struct dnotify_struct *dn; |
19094 |
+diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c |
19095 |
+index 9167884a61eca..1192c99536200 100644 |
19096 |
+--- a/fs/notify/fanotify/fanotify.c |
19097 |
++++ b/fs/notify/fanotify/fanotify.c |
19098 |
+@@ -268,12 +268,11 @@ static u32 fanotify_group_event_mask(struct fsnotify_group *group, |
19099 |
+ continue; |
19100 |
+ |
19101 |
+ /* |
19102 |
+- * If the event is for a child and this mark is on a parent not |
19103 |
++ * If the event is on a child and this mark is on a parent not |
19104 |
+ * watching children, don't send it! |
19105 |
+ */ |
19106 |
+- if (event_mask & FS_EVENT_ON_CHILD && |
19107 |
+- type == FSNOTIFY_OBJ_TYPE_INODE && |
19108 |
+- !(mark->mask & FS_EVENT_ON_CHILD)) |
19109 |
++ if (type == FSNOTIFY_OBJ_TYPE_PARENT && |
19110 |
++ !(mark->mask & FS_EVENT_ON_CHILD)) |
19111 |
+ continue; |
19112 |
+ |
19113 |
+ marks_mask |= mark->mask; |
19114 |
+diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c |
19115 |
+index 8d3ad5ef29258..30d422b8c0fc7 100644 |
19116 |
+--- a/fs/notify/fsnotify.c |
19117 |
++++ b/fs/notify/fsnotify.c |
19118 |
+@@ -152,6 +152,13 @@ static bool fsnotify_event_needs_parent(struct inode *inode, struct mount *mnt, |
19119 |
+ if (mask & FS_ISDIR) |
19120 |
+ return false; |
19121 |
+ |
19122 |
++ /* |
19123 |
++ * All events that are possible on child can also may be reported with |
19124 |
++ * parent/name info to inode/sb/mount. Otherwise, a watching parent |
19125 |
++ * could result in events reported with unexpected name info to sb/mount. |
19126 |
++ */ |
19127 |
++ BUILD_BUG_ON(FS_EVENTS_POSS_ON_CHILD & ~FS_EVENTS_POSS_TO_PARENT); |
19128 |
++ |
19129 |
+ /* Did either inode/sb/mount subscribe for events with parent/name? */ |
19130 |
+ marks_mask |= fsnotify_parent_needed_mask(inode->i_fsnotify_mask); |
19131 |
+ marks_mask |= fsnotify_parent_needed_mask(inode->i_sb->s_fsnotify_mask); |
19132 |
+@@ -232,47 +239,76 @@ notify: |
19133 |
+ } |
19134 |
+ EXPORT_SYMBOL_GPL(__fsnotify_parent); |
19135 |
+ |
19136 |
++static int fsnotify_handle_inode_event(struct fsnotify_group *group, |
19137 |
++ struct fsnotify_mark *inode_mark, |
19138 |
++ u32 mask, const void *data, int data_type, |
19139 |
++ struct inode *dir, const struct qstr *name, |
19140 |
++ u32 cookie) |
19141 |
++{ |
19142 |
++ const struct path *path = fsnotify_data_path(data, data_type); |
19143 |
++ struct inode *inode = fsnotify_data_inode(data, data_type); |
19144 |
++ const struct fsnotify_ops *ops = group->ops; |
19145 |
++ |
19146 |
++ if (WARN_ON_ONCE(!ops->handle_inode_event)) |
19147 |
++ return 0; |
19148 |
++ |
19149 |
++ if ((inode_mark->mask & FS_EXCL_UNLINK) && |
19150 |
++ path && d_unlinked(path->dentry)) |
19151 |
++ return 0; |
19152 |
++ |
19153 |
++ /* Check interest of this mark in case event was sent with two marks */ |
19154 |
++ if (!(mask & inode_mark->mask & ALL_FSNOTIFY_EVENTS)) |
19155 |
++ return 0; |
19156 |
++ |
19157 |
++ return ops->handle_inode_event(inode_mark, mask, inode, dir, name, cookie); |
19158 |
++} |
19159 |
++ |
19160 |
+ static int fsnotify_handle_event(struct fsnotify_group *group, __u32 mask, |
19161 |
+ const void *data, int data_type, |
19162 |
+ struct inode *dir, const struct qstr *name, |
19163 |
+ u32 cookie, struct fsnotify_iter_info *iter_info) |
19164 |
+ { |
19165 |
+ struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); |
19166 |
+- struct fsnotify_mark *child_mark = fsnotify_iter_child_mark(iter_info); |
19167 |
+- struct inode *inode = fsnotify_data_inode(data, data_type); |
19168 |
+- const struct fsnotify_ops *ops = group->ops; |
19169 |
++ struct fsnotify_mark *parent_mark = fsnotify_iter_parent_mark(iter_info); |
19170 |
+ int ret; |
19171 |
+ |
19172 |
+- if (WARN_ON_ONCE(!ops->handle_inode_event)) |
19173 |
+- return 0; |
19174 |
+- |
19175 |
+ if (WARN_ON_ONCE(fsnotify_iter_sb_mark(iter_info)) || |
19176 |
+ WARN_ON_ONCE(fsnotify_iter_vfsmount_mark(iter_info))) |
19177 |
+ return 0; |
19178 |
+ |
19179 |
+- /* |
19180 |
+- * An event can be sent on child mark iterator instead of inode mark |
19181 |
+- * iterator because of other groups that have interest of this inode |
19182 |
+- * and have marks on both parent and child. We can simplify this case. |
19183 |
+- */ |
19184 |
+- if (!inode_mark) { |
19185 |
+- inode_mark = child_mark; |
19186 |
+- child_mark = NULL; |
19187 |
++ if (parent_mark) { |
19188 |
++ /* |
19189 |
++ * parent_mark indicates that the parent inode is watching |
19190 |
++ * children and interested in this event, which is an event |
19191 |
++ * possible on child. But is *this mark* watching children and |
19192 |
++ * interested in this event? |
19193 |
++ */ |
19194 |
++ if (parent_mark->mask & FS_EVENT_ON_CHILD) { |
19195 |
++ ret = fsnotify_handle_inode_event(group, parent_mark, mask, |
19196 |
++ data, data_type, dir, name, 0); |
19197 |
++ if (ret) |
19198 |
++ return ret; |
19199 |
++ } |
19200 |
++ if (!inode_mark) |
19201 |
++ return 0; |
19202 |
++ } |
19203 |
++ |
19204 |
++ if (mask & FS_EVENT_ON_CHILD) { |
19205 |
++ /* |
19206 |
++ * Some events can be sent on both parent dir and child marks |
19207 |
++ * (e.g. FS_ATTRIB). If both parent dir and child are |
19208 |
++ * watching, report the event once to parent dir with name (if |
19209 |
++ * interested) and once to child without name (if interested). |
19210 |
++ * The child watcher is expecting an event without a file name |
19211 |
++ * and without the FS_EVENT_ON_CHILD flag. |
19212 |
++ */ |
19213 |
++ mask &= ~FS_EVENT_ON_CHILD; |
19214 |
+ dir = NULL; |
19215 |
+ name = NULL; |
19216 |
+ } |
19217 |
+ |
19218 |
+- ret = ops->handle_inode_event(inode_mark, mask, inode, dir, name); |
19219 |
+- if (ret || !child_mark) |
19220 |
+- return ret; |
19221 |
+- |
19222 |
+- /* |
19223 |
+- * Some events can be sent on both parent dir and child marks |
19224 |
+- * (e.g. FS_ATTRIB). If both parent dir and child are watching, |
19225 |
+- * report the event once to parent dir with name and once to child |
19226 |
+- * without name. |
19227 |
+- */ |
19228 |
+- return ops->handle_inode_event(child_mark, mask, inode, NULL, NULL); |
19229 |
++ return fsnotify_handle_inode_event(group, inode_mark, mask, data, data_type, |
19230 |
++ dir, name, cookie); |
19231 |
+ } |
19232 |
+ |
19233 |
+ static int send_to_group(__u32 mask, const void *data, int data_type, |
19234 |
+@@ -430,7 +466,7 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir, |
19235 |
+ struct fsnotify_iter_info iter_info = {}; |
19236 |
+ struct super_block *sb; |
19237 |
+ struct mount *mnt = NULL; |
19238 |
+- struct inode *child = NULL; |
19239 |
++ struct inode *parent = NULL; |
19240 |
+ int ret = 0; |
19241 |
+ __u32 test_mask, marks_mask; |
19242 |
+ |
19243 |
+@@ -442,11 +478,10 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir, |
19244 |
+ inode = dir; |
19245 |
+ } else if (mask & FS_EVENT_ON_CHILD) { |
19246 |
+ /* |
19247 |
+- * Event on child - report on TYPE_INODE to dir if it is |
19248 |
+- * watching children and on TYPE_CHILD to child. |
19249 |
++ * Event on child - report on TYPE_PARENT to dir if it is |
19250 |
++ * watching children and on TYPE_INODE to child. |
19251 |
+ */ |
19252 |
+- child = inode; |
19253 |
+- inode = dir; |
19254 |
++ parent = dir; |
19255 |
+ } |
19256 |
+ sb = inode->i_sb; |
19257 |
+ |
19258 |
+@@ -460,7 +495,7 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir, |
19259 |
+ if (!sb->s_fsnotify_marks && |
19260 |
+ (!mnt || !mnt->mnt_fsnotify_marks) && |
19261 |
+ (!inode || !inode->i_fsnotify_marks) && |
19262 |
+- (!child || !child->i_fsnotify_marks)) |
19263 |
++ (!parent || !parent->i_fsnotify_marks)) |
19264 |
+ return 0; |
19265 |
+ |
19266 |
+ marks_mask = sb->s_fsnotify_mask; |
19267 |
+@@ -468,8 +503,8 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir, |
19268 |
+ marks_mask |= mnt->mnt_fsnotify_mask; |
19269 |
+ if (inode) |
19270 |
+ marks_mask |= inode->i_fsnotify_mask; |
19271 |
+- if (child) |
19272 |
+- marks_mask |= child->i_fsnotify_mask; |
19273 |
++ if (parent) |
19274 |
++ marks_mask |= parent->i_fsnotify_mask; |
19275 |
+ |
19276 |
+ |
19277 |
+ /* |
19278 |
+@@ -492,9 +527,9 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir, |
19279 |
+ iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = |
19280 |
+ fsnotify_first_mark(&inode->i_fsnotify_marks); |
19281 |
+ } |
19282 |
+- if (child) { |
19283 |
+- iter_info.marks[FSNOTIFY_OBJ_TYPE_CHILD] = |
19284 |
+- fsnotify_first_mark(&child->i_fsnotify_marks); |
19285 |
++ if (parent) { |
19286 |
++ iter_info.marks[FSNOTIFY_OBJ_TYPE_PARENT] = |
19287 |
++ fsnotify_first_mark(&parent->i_fsnotify_marks); |
19288 |
+ } |
19289 |
+ |
19290 |
+ /* |
19291 |
+diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h |
19292 |
+index 4327d0e9c3645..2007e37119160 100644 |
19293 |
+--- a/fs/notify/inotify/inotify.h |
19294 |
++++ b/fs/notify/inotify/inotify.h |
19295 |
+@@ -24,11 +24,10 @@ static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse) |
19296 |
+ |
19297 |
+ extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, |
19298 |
+ struct fsnotify_group *group); |
19299 |
+-extern int inotify_handle_event(struct fsnotify_group *group, u32 mask, |
19300 |
+- const void *data, int data_type, |
19301 |
+- struct inode *dir, |
19302 |
+- const struct qstr *file_name, u32 cookie, |
19303 |
+- struct fsnotify_iter_info *iter_info); |
19304 |
++extern int inotify_handle_inode_event(struct fsnotify_mark *inode_mark, |
19305 |
++ u32 mask, struct inode *inode, |
19306 |
++ struct inode *dir, |
19307 |
++ const struct qstr *name, u32 cookie); |
19308 |
+ |
19309 |
+ extern const struct fsnotify_ops inotify_fsnotify_ops; |
19310 |
+ extern struct kmem_cache *inotify_inode_mark_cachep; |
19311 |
+diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c |
19312 |
+index 9ddcbadc98e29..1901d799909b8 100644 |
19313 |
+--- a/fs/notify/inotify/inotify_fsnotify.c |
19314 |
++++ b/fs/notify/inotify/inotify_fsnotify.c |
19315 |
+@@ -55,25 +55,21 @@ static int inotify_merge(struct list_head *list, |
19316 |
+ return event_compare(last_event, event); |
19317 |
+ } |
19318 |
+ |
19319 |
+-static int inotify_one_event(struct fsnotify_group *group, u32 mask, |
19320 |
+- struct fsnotify_mark *inode_mark, |
19321 |
+- const struct path *path, |
19322 |
+- const struct qstr *file_name, u32 cookie) |
19323 |
++int inotify_handle_inode_event(struct fsnotify_mark *inode_mark, u32 mask, |
19324 |
++ struct inode *inode, struct inode *dir, |
19325 |
++ const struct qstr *name, u32 cookie) |
19326 |
+ { |
19327 |
+ struct inotify_inode_mark *i_mark; |
19328 |
+ struct inotify_event_info *event; |
19329 |
+ struct fsnotify_event *fsn_event; |
19330 |
++ struct fsnotify_group *group = inode_mark->group; |
19331 |
+ int ret; |
19332 |
+ int len = 0; |
19333 |
+ int alloc_len = sizeof(struct inotify_event_info); |
19334 |
+ struct mem_cgroup *old_memcg; |
19335 |
+ |
19336 |
+- if ((inode_mark->mask & FS_EXCL_UNLINK) && |
19337 |
+- path && d_unlinked(path->dentry)) |
19338 |
+- return 0; |
19339 |
+- |
19340 |
+- if (file_name) { |
19341 |
+- len = file_name->len; |
19342 |
++ if (name) { |
19343 |
++ len = name->len; |
19344 |
+ alloc_len += len + 1; |
19345 |
+ } |
19346 |
+ |
19347 |
+@@ -117,7 +113,7 @@ static int inotify_one_event(struct fsnotify_group *group, u32 mask, |
19348 |
+ event->sync_cookie = cookie; |
19349 |
+ event->name_len = len; |
19350 |
+ if (len) |
19351 |
+- strcpy(event->name, file_name->name); |
19352 |
++ strcpy(event->name, name->name); |
19353 |
+ |
19354 |
+ ret = fsnotify_add_event(group, fsn_event, inotify_merge); |
19355 |
+ if (ret) { |
19356 |
+@@ -131,37 +127,6 @@ static int inotify_one_event(struct fsnotify_group *group, u32 mask, |
19357 |
+ return 0; |
19358 |
+ } |
19359 |
+ |
19360 |
+-int inotify_handle_event(struct fsnotify_group *group, u32 mask, |
19361 |
+- const void *data, int data_type, struct inode *dir, |
19362 |
+- const struct qstr *file_name, u32 cookie, |
19363 |
+- struct fsnotify_iter_info *iter_info) |
19364 |
+-{ |
19365 |
+- const struct path *path = fsnotify_data_path(data, data_type); |
19366 |
+- struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); |
19367 |
+- struct fsnotify_mark *child_mark = fsnotify_iter_child_mark(iter_info); |
19368 |
+- int ret = 0; |
19369 |
+- |
19370 |
+- if (WARN_ON(fsnotify_iter_vfsmount_mark(iter_info))) |
19371 |
+- return 0; |
19372 |
+- |
19373 |
+- /* |
19374 |
+- * Some events cannot be sent on both parent and child marks |
19375 |
+- * (e.g. IN_CREATE). Those events are always sent on inode_mark. |
19376 |
+- * For events that are possible on both parent and child (e.g. IN_OPEN), |
19377 |
+- * event is sent on inode_mark with name if the parent is watching and |
19378 |
+- * is sent on child_mark without name if child is watching. |
19379 |
+- * If both parent and child are watching, report the event with child's |
19380 |
+- * name here and report another event without child's name below. |
19381 |
+- */ |
19382 |
+- if (inode_mark) |
19383 |
+- ret = inotify_one_event(group, mask, inode_mark, path, |
19384 |
+- file_name, cookie); |
19385 |
+- if (ret || !child_mark) |
19386 |
+- return ret; |
19387 |
+- |
19388 |
+- return inotify_one_event(group, mask, child_mark, path, NULL, 0); |
19389 |
+-} |
19390 |
+- |
19391 |
+ static void inotify_freeing_mark(struct fsnotify_mark *fsn_mark, struct fsnotify_group *group) |
19392 |
+ { |
19393 |
+ inotify_ignored_and_remove_idr(fsn_mark, group); |
19394 |
+@@ -227,7 +192,7 @@ static void inotify_free_mark(struct fsnotify_mark *fsn_mark) |
19395 |
+ } |
19396 |
+ |
19397 |
+ const struct fsnotify_ops inotify_fsnotify_ops = { |
19398 |
+- .handle_event = inotify_handle_event, |
19399 |
++ .handle_inode_event = inotify_handle_inode_event, |
19400 |
+ .free_group_priv = inotify_free_group_priv, |
19401 |
+ .free_event = inotify_free_event, |
19402 |
+ .freeing_mark = inotify_freeing_mark, |
19403 |
+diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c |
19404 |
+index 186722ba38947..5f6c6bf65909c 100644 |
19405 |
+--- a/fs/notify/inotify/inotify_user.c |
19406 |
++++ b/fs/notify/inotify/inotify_user.c |
19407 |
+@@ -486,14 +486,10 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, |
19408 |
+ struct fsnotify_group *group) |
19409 |
+ { |
19410 |
+ struct inotify_inode_mark *i_mark; |
19411 |
+- struct fsnotify_iter_info iter_info = { }; |
19412 |
+- |
19413 |
+- fsnotify_iter_set_report_type_mark(&iter_info, FSNOTIFY_OBJ_TYPE_INODE, |
19414 |
+- fsn_mark); |
19415 |
+ |
19416 |
+ /* Queue ignore event for the watch */ |
19417 |
+- inotify_handle_event(group, FS_IN_IGNORED, NULL, FSNOTIFY_EVENT_NONE, |
19418 |
+- NULL, NULL, 0, &iter_info); |
19419 |
++ inotify_handle_inode_event(fsn_mark, FS_IN_IGNORED, NULL, NULL, NULL, |
19420 |
++ 0); |
19421 |
+ |
19422 |
+ i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); |
19423 |
+ /* remove this mark from the idr */ |
19424 |
+diff --git a/fs/open.c b/fs/open.c |
19425 |
+index 9af548fb841b0..4d7537ae59df5 100644 |
19426 |
+--- a/fs/open.c |
19427 |
++++ b/fs/open.c |
19428 |
+@@ -1010,6 +1010,10 @@ inline int build_open_flags(const struct open_how *how, struct open_flags *op) |
19429 |
+ if (how->resolve & ~VALID_RESOLVE_FLAGS) |
19430 |
+ return -EINVAL; |
19431 |
+ |
19432 |
++ /* Scoping flags are mutually exclusive. */ |
19433 |
++ if ((how->resolve & RESOLVE_BENEATH) && (how->resolve & RESOLVE_IN_ROOT)) |
19434 |
++ return -EINVAL; |
19435 |
++ |
19436 |
+ /* Deal with the mode. */ |
19437 |
+ if (WILL_CREATE(flags)) { |
19438 |
+ if (how->mode & ~S_IALLUGO) |
19439 |
+diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c |
19440 |
+index efccb7c1f9bc5..a1f72ac053e5f 100644 |
19441 |
+--- a/fs/overlayfs/file.c |
19442 |
++++ b/fs/overlayfs/file.c |
19443 |
+@@ -541,46 +541,31 @@ static long ovl_real_ioctl(struct file *file, unsigned int cmd, |
19444 |
+ unsigned long arg) |
19445 |
+ { |
19446 |
+ struct fd real; |
19447 |
+- const struct cred *old_cred; |
19448 |
+ long ret; |
19449 |
+ |
19450 |
+ ret = ovl_real_fdget(file, &real); |
19451 |
+ if (ret) |
19452 |
+ return ret; |
19453 |
+ |
19454 |
+- old_cred = ovl_override_creds(file_inode(file)->i_sb); |
19455 |
+ ret = security_file_ioctl(real.file, cmd, arg); |
19456 |
+- if (!ret) |
19457 |
++ if (!ret) { |
19458 |
++ /* |
19459 |
++ * Don't override creds, since we currently can't safely check |
19460 |
++ * permissions before doing so. |
19461 |
++ */ |
19462 |
+ ret = vfs_ioctl(real.file, cmd, arg); |
19463 |
+- revert_creds(old_cred); |
19464 |
++ } |
19465 |
+ |
19466 |
+ fdput(real); |
19467 |
+ |
19468 |
+ return ret; |
19469 |
+ } |
19470 |
+ |
19471 |
+-static unsigned int ovl_iflags_to_fsflags(unsigned int iflags) |
19472 |
+-{ |
19473 |
+- unsigned int flags = 0; |
19474 |
+- |
19475 |
+- if (iflags & S_SYNC) |
19476 |
+- flags |= FS_SYNC_FL; |
19477 |
+- if (iflags & S_APPEND) |
19478 |
+- flags |= FS_APPEND_FL; |
19479 |
+- if (iflags & S_IMMUTABLE) |
19480 |
+- flags |= FS_IMMUTABLE_FL; |
19481 |
+- if (iflags & S_NOATIME) |
19482 |
+- flags |= FS_NOATIME_FL; |
19483 |
+- |
19484 |
+- return flags; |
19485 |
+-} |
19486 |
+- |
19487 |
+ static long ovl_ioctl_set_flags(struct file *file, unsigned int cmd, |
19488 |
+- unsigned long arg, unsigned int flags) |
19489 |
++ unsigned long arg) |
19490 |
+ { |
19491 |
+ long ret; |
19492 |
+ struct inode *inode = file_inode(file); |
19493 |
+- unsigned int oldflags; |
19494 |
+ |
19495 |
+ if (!inode_owner_or_capable(inode)) |
19496 |
+ return -EACCES; |
19497 |
+@@ -591,10 +576,13 @@ static long ovl_ioctl_set_flags(struct file *file, unsigned int cmd, |
19498 |
+ |
19499 |
+ inode_lock(inode); |
19500 |
+ |
19501 |
+- /* Check the capability before cred override */ |
19502 |
+- oldflags = ovl_iflags_to_fsflags(READ_ONCE(inode->i_flags)); |
19503 |
+- ret = vfs_ioc_setflags_prepare(inode, oldflags, flags); |
19504 |
+- if (ret) |
19505 |
++ /* |
19506 |
++ * Prevent copy up if immutable and has no CAP_LINUX_IMMUTABLE |
19507 |
++ * capability. |
19508 |
++ */ |
19509 |
++ ret = -EPERM; |
19510 |
++ if (!ovl_has_upperdata(inode) && IS_IMMUTABLE(inode) && |
19511 |
++ !capable(CAP_LINUX_IMMUTABLE)) |
19512 |
+ goto unlock; |
19513 |
+ |
19514 |
+ ret = ovl_maybe_copy_up(file_dentry(file), O_WRONLY); |
19515 |
+@@ -613,46 +601,6 @@ unlock: |
19516 |
+ |
19517 |
+ } |
19518 |
+ |
19519 |
+-static long ovl_ioctl_set_fsflags(struct file *file, unsigned int cmd, |
19520 |
+- unsigned long arg) |
19521 |
+-{ |
19522 |
+- unsigned int flags; |
19523 |
+- |
19524 |
+- if (get_user(flags, (int __user *) arg)) |
19525 |
+- return -EFAULT; |
19526 |
+- |
19527 |
+- return ovl_ioctl_set_flags(file, cmd, arg, flags); |
19528 |
+-} |
19529 |
+- |
19530 |
+-static unsigned int ovl_fsxflags_to_fsflags(unsigned int xflags) |
19531 |
+-{ |
19532 |
+- unsigned int flags = 0; |
19533 |
+- |
19534 |
+- if (xflags & FS_XFLAG_SYNC) |
19535 |
+- flags |= FS_SYNC_FL; |
19536 |
+- if (xflags & FS_XFLAG_APPEND) |
19537 |
+- flags |= FS_APPEND_FL; |
19538 |
+- if (xflags & FS_XFLAG_IMMUTABLE) |
19539 |
+- flags |= FS_IMMUTABLE_FL; |
19540 |
+- if (xflags & FS_XFLAG_NOATIME) |
19541 |
+- flags |= FS_NOATIME_FL; |
19542 |
+- |
19543 |
+- return flags; |
19544 |
+-} |
19545 |
+- |
19546 |
+-static long ovl_ioctl_set_fsxflags(struct file *file, unsigned int cmd, |
19547 |
+- unsigned long arg) |
19548 |
+-{ |
19549 |
+- struct fsxattr fa; |
19550 |
+- |
19551 |
+- memset(&fa, 0, sizeof(fa)); |
19552 |
+- if (copy_from_user(&fa, (void __user *) arg, sizeof(fa))) |
19553 |
+- return -EFAULT; |
19554 |
+- |
19555 |
+- return ovl_ioctl_set_flags(file, cmd, arg, |
19556 |
+- ovl_fsxflags_to_fsflags(fa.fsx_xflags)); |
19557 |
+-} |
19558 |
+- |
19559 |
+ long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
19560 |
+ { |
19561 |
+ long ret; |
19562 |
+@@ -663,12 +611,9 @@ long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
19563 |
+ ret = ovl_real_ioctl(file, cmd, arg); |
19564 |
+ break; |
19565 |
+ |
19566 |
+- case FS_IOC_SETFLAGS: |
19567 |
+- ret = ovl_ioctl_set_fsflags(file, cmd, arg); |
19568 |
+- break; |
19569 |
+- |
19570 |
+ case FS_IOC_FSSETXATTR: |
19571 |
+- ret = ovl_ioctl_set_fsxflags(file, cmd, arg); |
19572 |
++ case FS_IOC_SETFLAGS: |
19573 |
++ ret = ovl_ioctl_set_flags(file, cmd, arg); |
19574 |
+ break; |
19575 |
+ |
19576 |
+ default: |
19577 |
+diff --git a/fs/proc/generic.c b/fs/proc/generic.c |
19578 |
+index b84663252adda..6c0a05f55d6b1 100644 |
19579 |
+--- a/fs/proc/generic.c |
19580 |
++++ b/fs/proc/generic.c |
19581 |
+@@ -349,6 +349,16 @@ static const struct file_operations proc_dir_operations = { |
19582 |
+ .iterate_shared = proc_readdir, |
19583 |
+ }; |
19584 |
+ |
19585 |
++static int proc_net_d_revalidate(struct dentry *dentry, unsigned int flags) |
19586 |
++{ |
19587 |
++ return 0; |
19588 |
++} |
19589 |
++ |
19590 |
++const struct dentry_operations proc_net_dentry_ops = { |
19591 |
++ .d_revalidate = proc_net_d_revalidate, |
19592 |
++ .d_delete = always_delete_dentry, |
19593 |
++}; |
19594 |
++ |
19595 |
+ /* |
19596 |
+ * proc directories can do almost nothing.. |
19597 |
+ */ |
19598 |
+@@ -471,8 +481,8 @@ struct proc_dir_entry *proc_symlink(const char *name, |
19599 |
+ } |
19600 |
+ EXPORT_SYMBOL(proc_symlink); |
19601 |
+ |
19602 |
+-struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, |
19603 |
+- struct proc_dir_entry *parent, void *data) |
19604 |
++struct proc_dir_entry *_proc_mkdir(const char *name, umode_t mode, |
19605 |
++ struct proc_dir_entry *parent, void *data, bool force_lookup) |
19606 |
+ { |
19607 |
+ struct proc_dir_entry *ent; |
19608 |
+ |
19609 |
+@@ -484,10 +494,20 @@ struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, |
19610 |
+ ent->data = data; |
19611 |
+ ent->proc_dir_ops = &proc_dir_operations; |
19612 |
+ ent->proc_iops = &proc_dir_inode_operations; |
19613 |
++ if (force_lookup) { |
19614 |
++ pde_force_lookup(ent); |
19615 |
++ } |
19616 |
+ ent = proc_register(parent, ent); |
19617 |
+ } |
19618 |
+ return ent; |
19619 |
+ } |
19620 |
++EXPORT_SYMBOL_GPL(_proc_mkdir); |
19621 |
++ |
19622 |
++struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, |
19623 |
++ struct proc_dir_entry *parent, void *data) |
19624 |
++{ |
19625 |
++ return _proc_mkdir(name, mode, parent, data, false); |
19626 |
++} |
19627 |
+ EXPORT_SYMBOL_GPL(proc_mkdir_data); |
19628 |
+ |
19629 |
+ struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, |
19630 |
+diff --git a/fs/proc/internal.h b/fs/proc/internal.h |
19631 |
+index 917cc85e34663..afbe96b6bf77d 100644 |
19632 |
+--- a/fs/proc/internal.h |
19633 |
++++ b/fs/proc/internal.h |
19634 |
+@@ -310,3 +310,10 @@ extern unsigned long task_statm(struct mm_struct *, |
19635 |
+ unsigned long *, unsigned long *, |
19636 |
+ unsigned long *, unsigned long *); |
19637 |
+ extern void task_mem(struct seq_file *, struct mm_struct *); |
19638 |
++ |
19639 |
++extern const struct dentry_operations proc_net_dentry_ops; |
19640 |
++static inline void pde_force_lookup(struct proc_dir_entry *pde) |
19641 |
++{ |
19642 |
++ /* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */ |
19643 |
++ pde->proc_dops = &proc_net_dentry_ops; |
19644 |
++} |
19645 |
+diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c |
19646 |
+index ed8a6306990c4..1aa9236bf1af5 100644 |
19647 |
+--- a/fs/proc/proc_net.c |
19648 |
++++ b/fs/proc/proc_net.c |
19649 |
+@@ -39,22 +39,6 @@ static struct net *get_proc_net(const struct inode *inode) |
19650 |
+ return maybe_get_net(PDE_NET(PDE(inode))); |
19651 |
+ } |
19652 |
+ |
19653 |
+-static int proc_net_d_revalidate(struct dentry *dentry, unsigned int flags) |
19654 |
+-{ |
19655 |
+- return 0; |
19656 |
+-} |
19657 |
+- |
19658 |
+-static const struct dentry_operations proc_net_dentry_ops = { |
19659 |
+- .d_revalidate = proc_net_d_revalidate, |
19660 |
+- .d_delete = always_delete_dentry, |
19661 |
+-}; |
19662 |
+- |
19663 |
+-static void pde_force_lookup(struct proc_dir_entry *pde) |
19664 |
+-{ |
19665 |
+- /* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */ |
19666 |
+- pde->proc_dops = &proc_net_dentry_ops; |
19667 |
+-} |
19668 |
+- |
19669 |
+ static int seq_open_net(struct inode *inode, struct file *file) |
19670 |
+ { |
19671 |
+ unsigned int state_size = PDE(inode)->state_size; |
19672 |
+diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c |
19673 |
+index e59d4bb3a89e4..eafb75755fa37 100644 |
19674 |
+--- a/fs/proc_namespace.c |
19675 |
++++ b/fs/proc_namespace.c |
19676 |
+@@ -320,7 +320,8 @@ static int mountstats_open(struct inode *inode, struct file *file) |
19677 |
+ |
19678 |
+ const struct file_operations proc_mounts_operations = { |
19679 |
+ .open = mounts_open, |
19680 |
+- .read = seq_read, |
19681 |
++ .read_iter = seq_read_iter, |
19682 |
++ .splice_read = generic_file_splice_read, |
19683 |
+ .llseek = seq_lseek, |
19684 |
+ .release = mounts_release, |
19685 |
+ .poll = mounts_poll, |
19686 |
+@@ -328,7 +329,8 @@ const struct file_operations proc_mounts_operations = { |
19687 |
+ |
19688 |
+ const struct file_operations proc_mountinfo_operations = { |
19689 |
+ .open = mountinfo_open, |
19690 |
+- .read = seq_read, |
19691 |
++ .read_iter = seq_read_iter, |
19692 |
++ .splice_read = generic_file_splice_read, |
19693 |
+ .llseek = seq_lseek, |
19694 |
+ .release = mounts_release, |
19695 |
+ .poll = mounts_poll, |
19696 |
+@@ -336,7 +338,8 @@ const struct file_operations proc_mountinfo_operations = { |
19697 |
+ |
19698 |
+ const struct file_operations proc_mountstats_operations = { |
19699 |
+ .open = mountstats_open, |
19700 |
+- .read = seq_read, |
19701 |
++ .read_iter = seq_read_iter, |
19702 |
++ .splice_read = generic_file_splice_read, |
19703 |
+ .llseek = seq_lseek, |
19704 |
+ .release = mounts_release, |
19705 |
+ }; |
19706 |
+diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c |
19707 |
+index b93b3cd10bfd3..8c50de693e1d4 100644 |
19708 |
+--- a/fs/ubifs/auth.c |
19709 |
++++ b/fs/ubifs/auth.c |
19710 |
+@@ -338,8 +338,10 @@ int ubifs_init_authentication(struct ubifs_info *c) |
19711 |
+ c->authenticated = true; |
19712 |
+ |
19713 |
+ c->log_hash = ubifs_hash_get_desc(c); |
19714 |
+- if (IS_ERR(c->log_hash)) |
19715 |
++ if (IS_ERR(c->log_hash)) { |
19716 |
++ err = PTR_ERR(c->log_hash); |
19717 |
+ goto out_free_hmac; |
19718 |
++ } |
19719 |
+ |
19720 |
+ err = 0; |
19721 |
+ |
19722 |
+diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c |
19723 |
+index 7e4bfaf2871fa..eae9cf5a57b05 100644 |
19724 |
+--- a/fs/ubifs/io.c |
19725 |
++++ b/fs/ubifs/io.c |
19726 |
+@@ -319,7 +319,7 @@ void ubifs_pad(const struct ubifs_info *c, void *buf, int pad) |
19727 |
+ { |
19728 |
+ uint32_t crc; |
19729 |
+ |
19730 |
+- ubifs_assert(c, pad >= 0 && !(pad & 7)); |
19731 |
++ ubifs_assert(c, pad >= 0); |
19732 |
+ |
19733 |
+ if (pad >= UBIFS_PAD_NODE_SZ) { |
19734 |
+ struct ubifs_ch *ch = buf; |
19735 |
+@@ -764,6 +764,10 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) |
19736 |
+ * write-buffer. |
19737 |
+ */ |
19738 |
+ memcpy(wbuf->buf + wbuf->used, buf, len); |
19739 |
++ if (aligned_len > len) { |
19740 |
++ ubifs_assert(c, aligned_len - len < 8); |
19741 |
++ ubifs_pad(c, wbuf->buf + wbuf->used + len, aligned_len - len); |
19742 |
++ } |
19743 |
+ |
19744 |
+ if (aligned_len == wbuf->avail) { |
19745 |
+ dbg_io("flush jhead %s wbuf to LEB %d:%d", |
19746 |
+@@ -856,13 +860,18 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) |
19747 |
+ } |
19748 |
+ |
19749 |
+ spin_lock(&wbuf->lock); |
19750 |
+- if (aligned_len) |
19751 |
++ if (aligned_len) { |
19752 |
+ /* |
19753 |
+ * And now we have what's left and what does not take whole |
19754 |
+ * max. write unit, so write it to the write-buffer and we are |
19755 |
+ * done. |
19756 |
+ */ |
19757 |
+ memcpy(wbuf->buf, buf + written, len); |
19758 |
++ if (aligned_len > len) { |
19759 |
++ ubifs_assert(c, aligned_len - len < 8); |
19760 |
++ ubifs_pad(c, wbuf->buf + len, aligned_len - len); |
19761 |
++ } |
19762 |
++ } |
19763 |
+ |
19764 |
+ if (c->leb_size - wbuf->offs >= c->max_write_size) |
19765 |
+ wbuf->size = c->max_write_size; |
19766 |
+diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h |
19767 |
+index a3abcc4b7d9ff..6d1879bf94403 100644 |
19768 |
+--- a/include/acpi/acpi_bus.h |
19769 |
++++ b/include/acpi/acpi_bus.h |
19770 |
+@@ -620,7 +620,6 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev); |
19771 |
+ bool acpi_pm_device_can_wakeup(struct device *dev); |
19772 |
+ int acpi_pm_device_sleep_state(struct device *, int *, int); |
19773 |
+ int acpi_pm_set_device_wakeup(struct device *dev, bool enable); |
19774 |
+-int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable); |
19775 |
+ #else |
19776 |
+ static inline void acpi_pm_wakeup_event(struct device *dev) |
19777 |
+ { |
19778 |
+@@ -651,10 +650,6 @@ static inline int acpi_pm_set_device_wakeup(struct device *dev, bool enable) |
19779 |
+ { |
19780 |
+ return -ENODEV; |
19781 |
+ } |
19782 |
+-static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) |
19783 |
+-{ |
19784 |
+- return -ENODEV; |
19785 |
+-} |
19786 |
+ #endif |
19787 |
+ |
19788 |
+ #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT |
19789 |
+diff --git a/include/linux/fs.h b/include/linux/fs.h |
19790 |
+index 8667d0cdc71e7..8bde32cf97115 100644 |
19791 |
+--- a/include/linux/fs.h |
19792 |
++++ b/include/linux/fs.h |
19793 |
+@@ -2878,8 +2878,7 @@ extern int inode_needs_sync(struct inode *inode); |
19794 |
+ extern int generic_delete_inode(struct inode *inode); |
19795 |
+ static inline int generic_drop_inode(struct inode *inode) |
19796 |
+ { |
19797 |
+- return !inode->i_nlink || inode_unhashed(inode) || |
19798 |
+- (inode->i_state & I_DONTCACHE); |
19799 |
++ return !inode->i_nlink || inode_unhashed(inode); |
19800 |
+ } |
19801 |
+ extern void d_mark_dontcache(struct inode *inode); |
19802 |
+ |
19803 |
+diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h |
19804 |
+index f8529a3a29234..a2e42d3cd87cf 100644 |
19805 |
+--- a/include/linux/fsnotify_backend.h |
19806 |
++++ b/include/linux/fsnotify_backend.h |
19807 |
+@@ -137,6 +137,7 @@ struct mem_cgroup; |
19808 |
+ * if @file_name is not NULL, this is the directory that |
19809 |
+ * @file_name is relative to. |
19810 |
+ * @file_name: optional file name associated with event |
19811 |
++ * @cookie: inotify rename cookie |
19812 |
+ * |
19813 |
+ * free_group_priv - called when a group refcnt hits 0 to clean up the private union |
19814 |
+ * freeing_mark - called when a mark is being destroyed for some reason. The group |
19815 |
+@@ -151,7 +152,7 @@ struct fsnotify_ops { |
19816 |
+ struct fsnotify_iter_info *iter_info); |
19817 |
+ int (*handle_inode_event)(struct fsnotify_mark *mark, u32 mask, |
19818 |
+ struct inode *inode, struct inode *dir, |
19819 |
+- const struct qstr *file_name); |
19820 |
++ const struct qstr *file_name, u32 cookie); |
19821 |
+ void (*free_group_priv)(struct fsnotify_group *group); |
19822 |
+ void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); |
19823 |
+ void (*free_event)(struct fsnotify_event *event); |
19824 |
+@@ -277,7 +278,7 @@ static inline const struct path *fsnotify_data_path(const void *data, |
19825 |
+ |
19826 |
+ enum fsnotify_obj_type { |
19827 |
+ FSNOTIFY_OBJ_TYPE_INODE, |
19828 |
+- FSNOTIFY_OBJ_TYPE_CHILD, |
19829 |
++ FSNOTIFY_OBJ_TYPE_PARENT, |
19830 |
+ FSNOTIFY_OBJ_TYPE_VFSMOUNT, |
19831 |
+ FSNOTIFY_OBJ_TYPE_SB, |
19832 |
+ FSNOTIFY_OBJ_TYPE_COUNT, |
19833 |
+@@ -285,7 +286,7 @@ enum fsnotify_obj_type { |
19834 |
+ }; |
19835 |
+ |
19836 |
+ #define FSNOTIFY_OBJ_TYPE_INODE_FL (1U << FSNOTIFY_OBJ_TYPE_INODE) |
19837 |
+-#define FSNOTIFY_OBJ_TYPE_CHILD_FL (1U << FSNOTIFY_OBJ_TYPE_CHILD) |
19838 |
++#define FSNOTIFY_OBJ_TYPE_PARENT_FL (1U << FSNOTIFY_OBJ_TYPE_PARENT) |
19839 |
+ #define FSNOTIFY_OBJ_TYPE_VFSMOUNT_FL (1U << FSNOTIFY_OBJ_TYPE_VFSMOUNT) |
19840 |
+ #define FSNOTIFY_OBJ_TYPE_SB_FL (1U << FSNOTIFY_OBJ_TYPE_SB) |
19841 |
+ #define FSNOTIFY_OBJ_ALL_TYPES_MASK ((1U << FSNOTIFY_OBJ_TYPE_COUNT) - 1) |
19842 |
+@@ -330,7 +331,7 @@ static inline struct fsnotify_mark *fsnotify_iter_##name##_mark( \ |
19843 |
+ } |
19844 |
+ |
19845 |
+ FSNOTIFY_ITER_FUNCS(inode, INODE) |
19846 |
+-FSNOTIFY_ITER_FUNCS(child, CHILD) |
19847 |
++FSNOTIFY_ITER_FUNCS(parent, PARENT) |
19848 |
+ FSNOTIFY_ITER_FUNCS(vfsmount, VFSMOUNT) |
19849 |
+ FSNOTIFY_ITER_FUNCS(sb, SB) |
19850 |
+ |
19851 |
+diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h |
19852 |
+index a3a838dcf8e4a..7199280d89ca4 100644 |
19853 |
+--- a/include/linux/iio/adc/ad_sigma_delta.h |
19854 |
++++ b/include/linux/iio/adc/ad_sigma_delta.h |
19855 |
+@@ -79,8 +79,12 @@ struct ad_sigma_delta { |
19856 |
+ /* |
19857 |
+ * DMA (thus cache coherency maintenance) requires the |
19858 |
+ * transfer buffers to live in their own cache lines. |
19859 |
++ * 'tx_buf' is up to 32 bits. |
19860 |
++ * 'rx_buf' is up to 32 bits per sample + 64 bit timestamp, |
19861 |
++ * rounded to 16 bytes to take into account padding. |
19862 |
+ */ |
19863 |
+- uint8_t data[4] ____cacheline_aligned; |
19864 |
++ uint8_t tx_buf[4] ____cacheline_aligned; |
19865 |
++ uint8_t rx_buf[16] __aligned(8); |
19866 |
+ }; |
19867 |
+ |
19868 |
+ static inline int ad_sigma_delta_set_channel(struct ad_sigma_delta *sd, |
19869 |
+diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h |
19870 |
+index 5a9238f6caad9..915f4f100383b 100644 |
19871 |
+--- a/include/linux/mm_types.h |
19872 |
++++ b/include/linux/mm_types.h |
19873 |
+@@ -14,6 +14,7 @@ |
19874 |
+ #include <linux/uprobes.h> |
19875 |
+ #include <linux/page-flags-layout.h> |
19876 |
+ #include <linux/workqueue.h> |
19877 |
++#include <linux/seqlock.h> |
19878 |
+ |
19879 |
+ #include <asm/mmu.h> |
19880 |
+ |
19881 |
+@@ -446,6 +447,13 @@ struct mm_struct { |
19882 |
+ */ |
19883 |
+ atomic_t has_pinned; |
19884 |
+ |
19885 |
++ /** |
19886 |
++ * @write_protect_seq: Locked when any thread is write |
19887 |
++ * protecting pages mapped by this mm to enforce a later COW, |
19888 |
++ * for instance during page table copying for fork(). |
19889 |
++ */ |
19890 |
++ seqcount_t write_protect_seq; |
19891 |
++ |
19892 |
+ #ifdef CONFIG_MMU |
19893 |
+ atomic_long_t pgtables_bytes; /* PTE page table pages */ |
19894 |
+ #endif |
19895 |
+diff --git a/include/linux/of.h b/include/linux/of.h |
19896 |
+index 5d51891cbf1a6..af655d264f10f 100644 |
19897 |
+--- a/include/linux/of.h |
19898 |
++++ b/include/linux/of.h |
19899 |
+@@ -1300,6 +1300,7 @@ static inline int of_get_available_child_count(const struct device_node *np) |
19900 |
+ #define _OF_DECLARE(table, name, compat, fn, fn_type) \ |
19901 |
+ static const struct of_device_id __of_table_##name \ |
19902 |
+ __used __section("__" #table "_of_table") \ |
19903 |
++ __aligned(__alignof__(struct of_device_id)) \ |
19904 |
+ = { .compatible = compat, \ |
19905 |
+ .data = (fn == (fn_type)NULL) ? fn : fn } |
19906 |
+ #else |
19907 |
+diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h |
19908 |
+index 270cab43ca3da..000cc0533c336 100644 |
19909 |
+--- a/include/linux/proc_fs.h |
19910 |
++++ b/include/linux/proc_fs.h |
19911 |
+@@ -80,6 +80,7 @@ extern void proc_flush_pid(struct pid *); |
19912 |
+ |
19913 |
+ extern struct proc_dir_entry *proc_symlink(const char *, |
19914 |
+ struct proc_dir_entry *, const char *); |
19915 |
++struct proc_dir_entry *_proc_mkdir(const char *, umode_t, struct proc_dir_entry *, void *, bool); |
19916 |
+ extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); |
19917 |
+ extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, |
19918 |
+ struct proc_dir_entry *, void *); |
19919 |
+@@ -162,6 +163,11 @@ static inline struct proc_dir_entry *proc_symlink(const char *name, |
19920 |
+ static inline struct proc_dir_entry *proc_mkdir(const char *name, |
19921 |
+ struct proc_dir_entry *parent) {return NULL;} |
19922 |
+ static inline struct proc_dir_entry *proc_create_mount_point(const char *name) { return NULL; } |
19923 |
++static inline struct proc_dir_entry *_proc_mkdir(const char *name, umode_t mode, |
19924 |
++ struct proc_dir_entry *parent, void *data, bool force_lookup) |
19925 |
++{ |
19926 |
++ return NULL; |
19927 |
++} |
19928 |
+ static inline struct proc_dir_entry *proc_mkdir_data(const char *name, |
19929 |
+ umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } |
19930 |
+ static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
19931 |
+@@ -199,7 +205,7 @@ struct net; |
19932 |
+ static inline struct proc_dir_entry *proc_net_mkdir( |
19933 |
+ struct net *net, const char *name, struct proc_dir_entry *parent) |
19934 |
+ { |
19935 |
+- return proc_mkdir_data(name, 0, parent, net); |
19936 |
++ return _proc_mkdir(name, 0, parent, net, true); |
19937 |
+ } |
19938 |
+ |
19939 |
+ struct ns_common; |
19940 |
+diff --git a/include/linux/rmap.h b/include/linux/rmap.h |
19941 |
+index 3a6adfa70fb0e..70085ca1a3fc9 100644 |
19942 |
+--- a/include/linux/rmap.h |
19943 |
++++ b/include/linux/rmap.h |
19944 |
+@@ -91,7 +91,6 @@ enum ttu_flags { |
19945 |
+ |
19946 |
+ TTU_SPLIT_HUGE_PMD = 0x4, /* split huge PMD if any */ |
19947 |
+ TTU_IGNORE_MLOCK = 0x8, /* ignore mlock */ |
19948 |
+- TTU_IGNORE_ACCESS = 0x10, /* don't age */ |
19949 |
+ TTU_IGNORE_HWPOISON = 0x20, /* corrupted page is recoverable */ |
19950 |
+ TTU_BATCH_FLUSH = 0x40, /* Batch TLB flushes where possible |
19951 |
+ * and caller guarantees they will |
19952 |
+diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h |
19953 |
+index fb0205d87d3c1..9d6c28cc4d8f2 100644 |
19954 |
+--- a/include/linux/seq_buf.h |
19955 |
++++ b/include/linux/seq_buf.h |
19956 |
+@@ -30,7 +30,7 @@ static inline void seq_buf_clear(struct seq_buf *s) |
19957 |
+ } |
19958 |
+ |
19959 |
+ static inline void |
19960 |
+-seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size) |
19961 |
++seq_buf_init(struct seq_buf *s, char *buf, unsigned int size) |
19962 |
+ { |
19963 |
+ s->buffer = buf; |
19964 |
+ s->size = size; |
19965 |
+diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h |
19966 |
+index a603d48d2b2cd..3ac5037d1c3da 100644 |
19967 |
+--- a/include/linux/sunrpc/xprt.h |
19968 |
++++ b/include/linux/sunrpc/xprt.h |
19969 |
+@@ -330,6 +330,7 @@ struct xprt_class { |
19970 |
+ struct rpc_xprt * (*setup)(struct xprt_create *); |
19971 |
+ struct module *owner; |
19972 |
+ char name[32]; |
19973 |
++ const char * netid[]; |
19974 |
+ }; |
19975 |
+ |
19976 |
+ /* |
19977 |
+diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h |
19978 |
+index 6c30508fca198..5a2c650d9e1c1 100644 |
19979 |
+--- a/include/linux/trace_seq.h |
19980 |
++++ b/include/linux/trace_seq.h |
19981 |
+@@ -12,7 +12,7 @@ |
19982 |
+ */ |
19983 |
+ |
19984 |
+ struct trace_seq { |
19985 |
+- unsigned char buffer[PAGE_SIZE]; |
19986 |
++ char buffer[PAGE_SIZE]; |
19987 |
+ struct seq_buf seq; |
19988 |
+ int full; |
19989 |
+ }; |
19990 |
+@@ -51,7 +51,7 @@ static inline int trace_seq_used(struct trace_seq *s) |
19991 |
+ * that is about to be written to and then return the result |
19992 |
+ * of that write. |
19993 |
+ */ |
19994 |
+-static inline unsigned char * |
19995 |
++static inline char * |
19996 |
+ trace_seq_buffer_ptr(struct trace_seq *s) |
19997 |
+ { |
19998 |
+ return s->buffer + seq_buf_used(&s->seq); |
19999 |
+diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h |
20000 |
+index c090742765431..ed0840f3d5dff 100644 |
20001 |
+--- a/include/media/v4l2-fwnode.h |
20002 |
++++ b/include/media/v4l2-fwnode.h |
20003 |
+@@ -231,6 +231,9 @@ struct v4l2_fwnode_connector { |
20004 |
+ * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is |
20005 |
+ * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS! |
20006 |
+ * |
20007 |
++ * The caller is required to initialise all fields of @vep, either with |
20008 |
++ * explicitly values, or by zeroing them. |
20009 |
++ * |
20010 |
+ * The function does not change the V4L2 fwnode endpoint state if it fails. |
20011 |
+ * |
20012 |
+ * NOTE: This function does not parse properties the size of which is variable |
20013 |
+@@ -273,6 +276,9 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep); |
20014 |
+ * guessing @vep.bus_type between CSI-2 D-PHY, parallel and BT.656 busses is |
20015 |
+ * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS! |
20016 |
+ * |
20017 |
++ * The caller is required to initialise all fields of @vep, either with |
20018 |
++ * explicitly values, or by zeroing them. |
20019 |
++ * |
20020 |
+ * The function does not change the V4L2 fwnode endpoint state if it fails. |
20021 |
+ * |
20022 |
+ * v4l2_fwnode_endpoint_alloc_parse() has two important differences to |
20023 |
+diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h |
20024 |
+index 59b1de1971142..c20e2dc6d4320 100644 |
20025 |
+--- a/include/media/v4l2-mediabus.h |
20026 |
++++ b/include/media/v4l2-mediabus.h |
20027 |
+@@ -103,6 +103,7 @@ |
20028 |
+ * @V4L2_MBUS_CCP2: CCP2 (Compact Camera Port 2) |
20029 |
+ * @V4L2_MBUS_CSI2_DPHY: MIPI CSI-2 serial interface, with D-PHY |
20030 |
+ * @V4L2_MBUS_CSI2_CPHY: MIPI CSI-2 serial interface, with C-PHY |
20031 |
++ * @V4L2_MBUS_INVALID: invalid bus type (keep as last) |
20032 |
+ */ |
20033 |
+ enum v4l2_mbus_type { |
20034 |
+ V4L2_MBUS_UNKNOWN, |
20035 |
+@@ -112,6 +113,7 @@ enum v4l2_mbus_type { |
20036 |
+ V4L2_MBUS_CCP2, |
20037 |
+ V4L2_MBUS_CSI2_DPHY, |
20038 |
+ V4L2_MBUS_CSI2_CPHY, |
20039 |
++ V4L2_MBUS_INVALID, |
20040 |
+ }; |
20041 |
+ |
20042 |
+ /** |
20043 |
+diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h |
20044 |
+index b00270c72740f..94fac55772f57 100644 |
20045 |
+--- a/include/rdma/uverbs_ioctl.h |
20046 |
++++ b/include/rdma/uverbs_ioctl.h |
20047 |
+@@ -862,6 +862,16 @@ static inline __malloc void *uverbs_zalloc(struct uverbs_attr_bundle *bundle, |
20048 |
+ { |
20049 |
+ return _uverbs_alloc(bundle, size, GFP_KERNEL | __GFP_ZERO); |
20050 |
+ } |
20051 |
++ |
20052 |
++static inline __malloc void *uverbs_kcalloc(struct uverbs_attr_bundle *bundle, |
20053 |
++ size_t n, size_t size) |
20054 |
++{ |
20055 |
++ size_t bytes; |
20056 |
++ |
20057 |
++ if (unlikely(check_mul_overflow(n, size, &bytes))) |
20058 |
++ return ERR_PTR(-EOVERFLOW); |
20059 |
++ return uverbs_zalloc(bundle, bytes); |
20060 |
++} |
20061 |
+ int _uverbs_get_const(s64 *to, const struct uverbs_attr_bundle *attrs_bundle, |
20062 |
+ size_t idx, s64 lower_bound, u64 upper_bound, |
20063 |
+ s64 *def_val); |
20064 |
+diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h |
20065 |
+index f1ce2c4c077e2..ec84ad1065683 100644 |
20066 |
+--- a/include/uapi/linux/android/binder.h |
20067 |
++++ b/include/uapi/linux/android/binder.h |
20068 |
+@@ -248,6 +248,7 @@ enum transaction_flags { |
20069 |
+ TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ |
20070 |
+ TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ |
20071 |
+ TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ |
20072 |
++ TF_CLEAR_BUF = 0x20, /* clear buffer on txn complete */ |
20073 |
+ }; |
20074 |
+ |
20075 |
+ struct binder_transaction_data { |
20076 |
+diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h |
20077 |
+index 5203f54a2be1c..cf89c318f2ac9 100644 |
20078 |
+--- a/include/uapi/linux/devlink.h |
20079 |
++++ b/include/uapi/linux/devlink.h |
20080 |
+@@ -322,7 +322,7 @@ enum devlink_reload_limit { |
20081 |
+ DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1 |
20082 |
+ }; |
20083 |
+ |
20084 |
+-#define DEVLINK_RELOAD_LIMITS_VALID_MASK (BIT(__DEVLINK_RELOAD_LIMIT_MAX) - 1) |
20085 |
++#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1) |
20086 |
+ |
20087 |
+ enum devlink_attr { |
20088 |
+ /* don't change the order or add anything between, this is ABI! */ |
20089 |
+diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h |
20090 |
+index 5a8315e6d8a60..00c7235ae93e7 100644 |
20091 |
+--- a/include/xen/xenbus.h |
20092 |
++++ b/include/xen/xenbus.h |
20093 |
+@@ -61,6 +61,15 @@ struct xenbus_watch |
20094 |
+ /* Path being watched. */ |
20095 |
+ const char *node; |
20096 |
+ |
20097 |
++ unsigned int nr_pending; |
20098 |
++ |
20099 |
++ /* |
20100 |
++ * Called just before enqueing new event while a spinlock is held. |
20101 |
++ * The event will be discarded if this callback returns false. |
20102 |
++ */ |
20103 |
++ bool (*will_handle)(struct xenbus_watch *, |
20104 |
++ const char *path, const char *token); |
20105 |
++ |
20106 |
+ /* Callback (executed in a process context with no locks held). */ |
20107 |
+ void (*callback)(struct xenbus_watch *, |
20108 |
+ const char *path, const char *token); |
20109 |
+@@ -197,10 +206,14 @@ void xenbus_probe(struct work_struct *); |
20110 |
+ |
20111 |
+ int xenbus_watch_path(struct xenbus_device *dev, const char *path, |
20112 |
+ struct xenbus_watch *watch, |
20113 |
++ bool (*will_handle)(struct xenbus_watch *, |
20114 |
++ const char *, const char *), |
20115 |
+ void (*callback)(struct xenbus_watch *, |
20116 |
+ const char *, const char *)); |
20117 |
+-__printf(4, 5) |
20118 |
++__printf(5, 6) |
20119 |
+ int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch, |
20120 |
++ bool (*will_handle)(struct xenbus_watch *, |
20121 |
++ const char *, const char *), |
20122 |
+ void (*callback)(struct xenbus_watch *, |
20123 |
+ const char *, const char *), |
20124 |
+ const char *pathfmt, ...); |
20125 |
+diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c |
20126 |
+index bfcfcd61adb64..5b3f01da172bc 100644 |
20127 |
+--- a/kernel/audit_fsnotify.c |
20128 |
++++ b/kernel/audit_fsnotify.c |
20129 |
+@@ -154,7 +154,7 @@ static void audit_autoremove_mark_rule(struct audit_fsnotify_mark *audit_mark) |
20130 |
+ /* Update mark data in audit rules based on fsnotify events. */ |
20131 |
+ static int audit_mark_handle_event(struct fsnotify_mark *inode_mark, u32 mask, |
20132 |
+ struct inode *inode, struct inode *dir, |
20133 |
+- const struct qstr *dname) |
20134 |
++ const struct qstr *dname, u32 cookie) |
20135 |
+ { |
20136 |
+ struct audit_fsnotify_mark *audit_mark; |
20137 |
+ |
20138 |
+diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c |
20139 |
+index 83e1c07fc99e1..6c91902f4f455 100644 |
20140 |
+--- a/kernel/audit_tree.c |
20141 |
++++ b/kernel/audit_tree.c |
20142 |
+@@ -1037,7 +1037,7 @@ static void evict_chunk(struct audit_chunk *chunk) |
20143 |
+ |
20144 |
+ static int audit_tree_handle_event(struct fsnotify_mark *mark, u32 mask, |
20145 |
+ struct inode *inode, struct inode *dir, |
20146 |
+- const struct qstr *file_name) |
20147 |
++ const struct qstr *file_name, u32 cookie) |
20148 |
+ { |
20149 |
+ return 0; |
20150 |
+ } |
20151 |
+diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c |
20152 |
+index 246e5ba704c00..2acf7ca491542 100644 |
20153 |
+--- a/kernel/audit_watch.c |
20154 |
++++ b/kernel/audit_watch.c |
20155 |
+@@ -466,7 +466,7 @@ void audit_remove_watch_rule(struct audit_krule *krule) |
20156 |
+ /* Update watch data in audit rules based on fsnotify events. */ |
20157 |
+ static int audit_watch_handle_event(struct fsnotify_mark *inode_mark, u32 mask, |
20158 |
+ struct inode *inode, struct inode *dir, |
20159 |
+- const struct qstr *dname) |
20160 |
++ const struct qstr *dname, u32 cookie) |
20161 |
+ { |
20162 |
+ struct audit_parent *parent; |
20163 |
+ |
20164 |
+diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
20165 |
+index 57b5b5d0a5fdd..53c70c470a38d 100644 |
20166 |
+--- a/kernel/cgroup/cpuset.c |
20167 |
++++ b/kernel/cgroup/cpuset.c |
20168 |
+@@ -983,25 +983,48 @@ partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[], |
20169 |
+ */ |
20170 |
+ static void rebuild_sched_domains_locked(void) |
20171 |
+ { |
20172 |
++ struct cgroup_subsys_state *pos_css; |
20173 |
+ struct sched_domain_attr *attr; |
20174 |
+ cpumask_var_t *doms; |
20175 |
++ struct cpuset *cs; |
20176 |
+ int ndoms; |
20177 |
+ |
20178 |
+ lockdep_assert_cpus_held(); |
20179 |
+ percpu_rwsem_assert_held(&cpuset_rwsem); |
20180 |
+ |
20181 |
+ /* |
20182 |
+- * We have raced with CPU hotplug. Don't do anything to avoid |
20183 |
++ * If we have raced with CPU hotplug, return early to avoid |
20184 |
+ * passing doms with offlined cpu to partition_sched_domains(). |
20185 |
+- * Anyways, hotplug work item will rebuild sched domains. |
20186 |
++ * Anyways, cpuset_hotplug_workfn() will rebuild sched domains. |
20187 |
++ * |
20188 |
++ * With no CPUs in any subpartitions, top_cpuset's effective CPUs |
20189 |
++ * should be the same as the active CPUs, so checking only top_cpuset |
20190 |
++ * is enough to detect racing CPU offlines. |
20191 |
+ */ |
20192 |
+ if (!top_cpuset.nr_subparts_cpus && |
20193 |
+ !cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) |
20194 |
+ return; |
20195 |
+ |
20196 |
+- if (top_cpuset.nr_subparts_cpus && |
20197 |
+- !cpumask_subset(top_cpuset.effective_cpus, cpu_active_mask)) |
20198 |
+- return; |
20199 |
++ /* |
20200 |
++ * With subpartition CPUs, however, the effective CPUs of a partition |
20201 |
++ * root should be only a subset of the active CPUs. Since a CPU in any |
20202 |
++ * partition root could be offlined, all must be checked. |
20203 |
++ */ |
20204 |
++ if (top_cpuset.nr_subparts_cpus) { |
20205 |
++ rcu_read_lock(); |
20206 |
++ cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { |
20207 |
++ if (!is_partition_root(cs)) { |
20208 |
++ pos_css = css_rightmost_descendant(pos_css); |
20209 |
++ continue; |
20210 |
++ } |
20211 |
++ if (!cpumask_subset(cs->effective_cpus, |
20212 |
++ cpu_active_mask)) { |
20213 |
++ rcu_read_unlock(); |
20214 |
++ return; |
20215 |
++ } |
20216 |
++ } |
20217 |
++ rcu_read_unlock(); |
20218 |
++ } |
20219 |
+ |
20220 |
+ /* Generate domain masks and attrs */ |
20221 |
+ ndoms = generate_sched_domains(&doms, &attr); |
20222 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
20223 |
+index 6d266388d3804..dc55f68a6ee36 100644 |
20224 |
+--- a/kernel/fork.c |
20225 |
++++ b/kernel/fork.c |
20226 |
+@@ -1007,6 +1007,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, |
20227 |
+ mm->vmacache_seqnum = 0; |
20228 |
+ atomic_set(&mm->mm_users, 1); |
20229 |
+ atomic_set(&mm->mm_count, 1); |
20230 |
++ seqcount_init(&mm->write_protect_seq); |
20231 |
+ mmap_init_lock(mm); |
20232 |
+ INIT_LIST_HEAD(&mm->mmlist); |
20233 |
+ mm->core_state = NULL; |
20234 |
+diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c |
20235 |
+index e4ca69608f3b8..c6b419db68efc 100644 |
20236 |
+--- a/kernel/irq/irqdomain.c |
20237 |
++++ b/kernel/irq/irqdomain.c |
20238 |
+@@ -1373,8 +1373,15 @@ static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain, |
20239 |
+ unsigned int irq_base, |
20240 |
+ unsigned int nr_irqs) |
20241 |
+ { |
20242 |
+- if (domain->ops->free) |
20243 |
+- domain->ops->free(domain, irq_base, nr_irqs); |
20244 |
++ unsigned int i; |
20245 |
++ |
20246 |
++ if (!domain->ops->free) |
20247 |
++ return; |
20248 |
++ |
20249 |
++ for (i = 0; i < nr_irqs; i++) { |
20250 |
++ if (irq_domain_get_irq_data(domain, irq_base + i)) |
20251 |
++ domain->ops->free(domain, irq_base + i, 1); |
20252 |
++ } |
20253 |
+ } |
20254 |
+ |
20255 |
+ int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain, |
20256 |
+diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c |
20257 |
+index bd04b09b84b32..593df7edfe97f 100644 |
20258 |
+--- a/kernel/rcu/tree.c |
20259 |
++++ b/kernel/rcu/tree.c |
20260 |
+@@ -177,7 +177,7 @@ module_param(rcu_unlock_delay, int, 0444); |
20261 |
+ * per-CPU. Object size is equal to one page. This value |
20262 |
+ * can be changed at boot time. |
20263 |
+ */ |
20264 |
+-static int rcu_min_cached_objs = 2; |
20265 |
++static int rcu_min_cached_objs = 5; |
20266 |
+ module_param(rcu_min_cached_objs, int, 0444); |
20267 |
+ |
20268 |
+ /* Retrieve RCU kthreads priority for rcutorture */ |
20269 |
+@@ -928,8 +928,8 @@ void __rcu_irq_enter_check_tick(void) |
20270 |
+ { |
20271 |
+ struct rcu_data *rdp = this_cpu_ptr(&rcu_data); |
20272 |
+ |
20273 |
+- // Enabling the tick is unsafe in NMI handlers. |
20274 |
+- if (WARN_ON_ONCE(in_nmi())) |
20275 |
++ // If we're here from NMI there's nothing to do. |
20276 |
++ if (in_nmi()) |
20277 |
+ return; |
20278 |
+ |
20279 |
+ RCU_LOCKDEP_WARN(rcu_dynticks_curr_cpu_in_eqs(), |
20280 |
+@@ -1093,8 +1093,11 @@ static void rcu_disable_urgency_upon_qs(struct rcu_data *rdp) |
20281 |
+ * CPU can safely enter RCU read-side critical sections. In other words, |
20282 |
+ * if the current CPU is not in its idle loop or is in an interrupt or |
20283 |
+ * NMI handler, return true. |
20284 |
++ * |
20285 |
++ * Make notrace because it can be called by the internal functions of |
20286 |
++ * ftrace, and making this notrace removes unnecessary recursion calls. |
20287 |
+ */ |
20288 |
+-bool rcu_is_watching(void) |
20289 |
++notrace bool rcu_is_watching(void) |
20290 |
+ { |
20291 |
+ bool ret; |
20292 |
+ |
20293 |
+@@ -3084,6 +3087,9 @@ struct kfree_rcu_cpu_work { |
20294 |
+ * In order to save some per-cpu space the list is singular. |
20295 |
+ * Even though it is lockless an access has to be protected by the |
20296 |
+ * per-cpu lock. |
20297 |
++ * @page_cache_work: A work to refill the cache when it is empty |
20298 |
++ * @work_in_progress: Indicates that page_cache_work is running |
20299 |
++ * @hrtimer: A hrtimer for scheduling a page_cache_work |
20300 |
+ * @nr_bkv_objs: number of allocated objects at @bkvcache. |
20301 |
+ * |
20302 |
+ * This is a per-CPU structure. The reason that it is not included in |
20303 |
+@@ -3100,6 +3106,11 @@ struct kfree_rcu_cpu { |
20304 |
+ bool monitor_todo; |
20305 |
+ bool initialized; |
20306 |
+ int count; |
20307 |
++ |
20308 |
++ struct work_struct page_cache_work; |
20309 |
++ atomic_t work_in_progress; |
20310 |
++ struct hrtimer hrtimer; |
20311 |
++ |
20312 |
+ struct llist_head bkvcache; |
20313 |
+ int nr_bkv_objs; |
20314 |
+ }; |
20315 |
+@@ -3217,10 +3228,10 @@ static void kfree_rcu_work(struct work_struct *work) |
20316 |
+ } |
20317 |
+ rcu_lock_release(&rcu_callback_map); |
20318 |
+ |
20319 |
+- krcp = krc_this_cpu_lock(&flags); |
20320 |
++ raw_spin_lock_irqsave(&krcp->lock, flags); |
20321 |
+ if (put_cached_bnode(krcp, bkvhead[i])) |
20322 |
+ bkvhead[i] = NULL; |
20323 |
+- krc_this_cpu_unlock(krcp, flags); |
20324 |
++ raw_spin_unlock_irqrestore(&krcp->lock, flags); |
20325 |
+ |
20326 |
+ if (bkvhead[i]) |
20327 |
+ free_page((unsigned long) bkvhead[i]); |
20328 |
+@@ -3347,6 +3358,57 @@ static void kfree_rcu_monitor(struct work_struct *work) |
20329 |
+ raw_spin_unlock_irqrestore(&krcp->lock, flags); |
20330 |
+ } |
20331 |
+ |
20332 |
++static enum hrtimer_restart |
20333 |
++schedule_page_work_fn(struct hrtimer *t) |
20334 |
++{ |
20335 |
++ struct kfree_rcu_cpu *krcp = |
20336 |
++ container_of(t, struct kfree_rcu_cpu, hrtimer); |
20337 |
++ |
20338 |
++ queue_work(system_highpri_wq, &krcp->page_cache_work); |
20339 |
++ return HRTIMER_NORESTART; |
20340 |
++} |
20341 |
++ |
20342 |
++static void fill_page_cache_func(struct work_struct *work) |
20343 |
++{ |
20344 |
++ struct kvfree_rcu_bulk_data *bnode; |
20345 |
++ struct kfree_rcu_cpu *krcp = |
20346 |
++ container_of(work, struct kfree_rcu_cpu, |
20347 |
++ page_cache_work); |
20348 |
++ unsigned long flags; |
20349 |
++ bool pushed; |
20350 |
++ int i; |
20351 |
++ |
20352 |
++ for (i = 0; i < rcu_min_cached_objs; i++) { |
20353 |
++ bnode = (struct kvfree_rcu_bulk_data *) |
20354 |
++ __get_free_page(GFP_KERNEL | __GFP_NOWARN); |
20355 |
++ |
20356 |
++ if (bnode) { |
20357 |
++ raw_spin_lock_irqsave(&krcp->lock, flags); |
20358 |
++ pushed = put_cached_bnode(krcp, bnode); |
20359 |
++ raw_spin_unlock_irqrestore(&krcp->lock, flags); |
20360 |
++ |
20361 |
++ if (!pushed) { |
20362 |
++ free_page((unsigned long) bnode); |
20363 |
++ break; |
20364 |
++ } |
20365 |
++ } |
20366 |
++ } |
20367 |
++ |
20368 |
++ atomic_set(&krcp->work_in_progress, 0); |
20369 |
++} |
20370 |
++ |
20371 |
++static void |
20372 |
++run_page_cache_worker(struct kfree_rcu_cpu *krcp) |
20373 |
++{ |
20374 |
++ if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING && |
20375 |
++ !atomic_xchg(&krcp->work_in_progress, 1)) { |
20376 |
++ hrtimer_init(&krcp->hrtimer, CLOCK_MONOTONIC, |
20377 |
++ HRTIMER_MODE_REL); |
20378 |
++ krcp->hrtimer.function = schedule_page_work_fn; |
20379 |
++ hrtimer_start(&krcp->hrtimer, 0, HRTIMER_MODE_REL); |
20380 |
++ } |
20381 |
++} |
20382 |
++ |
20383 |
+ static inline bool |
20384 |
+ kvfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cpu *krcp, void *ptr) |
20385 |
+ { |
20386 |
+@@ -3363,32 +3425,8 @@ kvfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cpu *krcp, void *ptr) |
20387 |
+ if (!krcp->bkvhead[idx] || |
20388 |
+ krcp->bkvhead[idx]->nr_records == KVFREE_BULK_MAX_ENTR) { |
20389 |
+ bnode = get_cached_bnode(krcp); |
20390 |
+- if (!bnode) { |
20391 |
+- /* |
20392 |
+- * To keep this path working on raw non-preemptible |
20393 |
+- * sections, prevent the optional entry into the |
20394 |
+- * allocator as it uses sleeping locks. In fact, even |
20395 |
+- * if the caller of kfree_rcu() is preemptible, this |
20396 |
+- * path still is not, as krcp->lock is a raw spinlock. |
20397 |
+- * With additional page pre-allocation in the works, |
20398 |
+- * hitting this return is going to be much less likely. |
20399 |
+- */ |
20400 |
+- if (IS_ENABLED(CONFIG_PREEMPT_RT)) |
20401 |
+- return false; |
20402 |
+- |
20403 |
+- /* |
20404 |
+- * NOTE: For one argument of kvfree_rcu() we can |
20405 |
+- * drop the lock and get the page in sleepable |
20406 |
+- * context. That would allow to maintain an array |
20407 |
+- * for the CONFIG_PREEMPT_RT as well if no cached |
20408 |
+- * pages are available. |
20409 |
+- */ |
20410 |
+- bnode = (struct kvfree_rcu_bulk_data *) |
20411 |
+- __get_free_page(GFP_NOWAIT | __GFP_NOWARN); |
20412 |
+- } |
20413 |
+- |
20414 |
+ /* Switch to emergency path. */ |
20415 |
+- if (unlikely(!bnode)) |
20416 |
++ if (!bnode) |
20417 |
+ return false; |
20418 |
+ |
20419 |
+ /* Initialize the new block. */ |
20420 |
+@@ -3452,12 +3490,10 @@ void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func) |
20421 |
+ goto unlock_return; |
20422 |
+ } |
20423 |
+ |
20424 |
+- /* |
20425 |
+- * Under high memory pressure GFP_NOWAIT can fail, |
20426 |
+- * in that case the emergency path is maintained. |
20427 |
+- */ |
20428 |
+ success = kvfree_call_rcu_add_ptr_to_bulk(krcp, ptr); |
20429 |
+ if (!success) { |
20430 |
++ run_page_cache_worker(krcp); |
20431 |
++ |
20432 |
+ if (head == NULL) |
20433 |
+ // Inline if kvfree_rcu(one_arg) call. |
20434 |
+ goto unlock_return; |
20435 |
+@@ -4449,24 +4485,14 @@ static void __init kfree_rcu_batch_init(void) |
20436 |
+ |
20437 |
+ for_each_possible_cpu(cpu) { |
20438 |
+ struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu); |
20439 |
+- struct kvfree_rcu_bulk_data *bnode; |
20440 |
+ |
20441 |
+ for (i = 0; i < KFREE_N_BATCHES; i++) { |
20442 |
+ INIT_RCU_WORK(&krcp->krw_arr[i].rcu_work, kfree_rcu_work); |
20443 |
+ krcp->krw_arr[i].krcp = krcp; |
20444 |
+ } |
20445 |
+ |
20446 |
+- for (i = 0; i < rcu_min_cached_objs; i++) { |
20447 |
+- bnode = (struct kvfree_rcu_bulk_data *) |
20448 |
+- __get_free_page(GFP_NOWAIT | __GFP_NOWARN); |
20449 |
+- |
20450 |
+- if (bnode) |
20451 |
+- put_cached_bnode(krcp, bnode); |
20452 |
+- else |
20453 |
+- pr_err("Failed to preallocate for %d CPU!\n", cpu); |
20454 |
+- } |
20455 |
+- |
20456 |
+ INIT_DELAYED_WORK(&krcp->monitor_work, kfree_rcu_monitor); |
20457 |
++ INIT_WORK(&krcp->page_cache_work, fill_page_cache_func); |
20458 |
+ krcp->initialized = true; |
20459 |
+ } |
20460 |
+ if (register_shrinker(&kfree_rcu_shrinker)) |
20461 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
20462 |
+index e7e453492cffc..77aa0e788b9b7 100644 |
20463 |
+--- a/kernel/sched/core.c |
20464 |
++++ b/kernel/sched/core.c |
20465 |
+@@ -6100,12 +6100,8 @@ static void do_sched_yield(void) |
20466 |
+ schedstat_inc(rq->yld_count); |
20467 |
+ current->sched_class->yield_task(rq); |
20468 |
+ |
20469 |
+- /* |
20470 |
+- * Since we are going to call schedule() anyway, there's |
20471 |
+- * no need to preempt or enable interrupts: |
20472 |
+- */ |
20473 |
+ preempt_disable(); |
20474 |
+- rq_unlock(rq, &rf); |
20475 |
++ rq_unlock_irq(rq, &rf); |
20476 |
+ sched_preempt_enable_no_resched(); |
20477 |
+ |
20478 |
+ schedule(); |
20479 |
+diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c |
20480 |
+index 1d3c97268ec0d..8d06d1f4e2f7b 100644 |
20481 |
+--- a/kernel/sched/deadline.c |
20482 |
++++ b/kernel/sched/deadline.c |
20483 |
+@@ -2547,7 +2547,7 @@ int sched_dl_global_validate(void) |
20484 |
+ u64 period = global_rt_period(); |
20485 |
+ u64 new_bw = to_ratio(period, runtime); |
20486 |
+ struct dl_bw *dl_b; |
20487 |
+- int cpu, ret = 0; |
20488 |
++ int cpu, cpus, ret = 0; |
20489 |
+ unsigned long flags; |
20490 |
+ |
20491 |
+ /* |
20492 |
+@@ -2562,9 +2562,10 @@ int sched_dl_global_validate(void) |
20493 |
+ for_each_possible_cpu(cpu) { |
20494 |
+ rcu_read_lock_sched(); |
20495 |
+ dl_b = dl_bw_of(cpu); |
20496 |
++ cpus = dl_bw_cpus(cpu); |
20497 |
+ |
20498 |
+ raw_spin_lock_irqsave(&dl_b->lock, flags); |
20499 |
+- if (new_bw < dl_b->total_bw) |
20500 |
++ if (new_bw * cpus < dl_b->total_bw) |
20501 |
+ ret = -EBUSY; |
20502 |
+ raw_spin_unlock_irqrestore(&dl_b->lock, flags); |
20503 |
+ |
20504 |
+diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
20505 |
+index df80bfcea92eb..c122176c627ec 100644 |
20506 |
+--- a/kernel/sched/sched.h |
20507 |
++++ b/kernel/sched/sched.h |
20508 |
+@@ -257,30 +257,6 @@ struct rt_bandwidth { |
20509 |
+ |
20510 |
+ void __dl_clear_params(struct task_struct *p); |
20511 |
+ |
20512 |
+-/* |
20513 |
+- * To keep the bandwidth of -deadline tasks and groups under control |
20514 |
+- * we need some place where: |
20515 |
+- * - store the maximum -deadline bandwidth of the system (the group); |
20516 |
+- * - cache the fraction of that bandwidth that is currently allocated. |
20517 |
+- * |
20518 |
+- * This is all done in the data structure below. It is similar to the |
20519 |
+- * one used for RT-throttling (rt_bandwidth), with the main difference |
20520 |
+- * that, since here we are only interested in admission control, we |
20521 |
+- * do not decrease any runtime while the group "executes", neither we |
20522 |
+- * need a timer to replenish it. |
20523 |
+- * |
20524 |
+- * With respect to SMP, the bandwidth is given on a per-CPU basis, |
20525 |
+- * meaning that: |
20526 |
+- * - dl_bw (< 100%) is the bandwidth of the system (group) on each CPU; |
20527 |
+- * - dl_total_bw array contains, in the i-eth element, the currently |
20528 |
+- * allocated bandwidth on the i-eth CPU. |
20529 |
+- * Moreover, groups consume bandwidth on each CPU, while tasks only |
20530 |
+- * consume bandwidth on the CPU they're running on. |
20531 |
+- * Finally, dl_total_bw_cpu is used to cache the index of dl_total_bw |
20532 |
+- * that will be shown the next time the proc or cgroup controls will |
20533 |
+- * be red. It on its turn can be changed by writing on its own |
20534 |
+- * control. |
20535 |
+- */ |
20536 |
+ struct dl_bandwidth { |
20537 |
+ raw_spinlock_t dl_runtime_lock; |
20538 |
+ u64 dl_runtime; |
20539 |
+@@ -292,6 +268,24 @@ static inline int dl_bandwidth_enabled(void) |
20540 |
+ return sysctl_sched_rt_runtime >= 0; |
20541 |
+ } |
20542 |
+ |
20543 |
++/* |
20544 |
++ * To keep the bandwidth of -deadline tasks under control |
20545 |
++ * we need some place where: |
20546 |
++ * - store the maximum -deadline bandwidth of each cpu; |
20547 |
++ * - cache the fraction of bandwidth that is currently allocated in |
20548 |
++ * each root domain; |
20549 |
++ * |
20550 |
++ * This is all done in the data structure below. It is similar to the |
20551 |
++ * one used for RT-throttling (rt_bandwidth), with the main difference |
20552 |
++ * that, since here we are only interested in admission control, we |
20553 |
++ * do not decrease any runtime while the group "executes", neither we |
20554 |
++ * need a timer to replenish it. |
20555 |
++ * |
20556 |
++ * With respect to SMP, bandwidth is given on a per root domain basis, |
20557 |
++ * meaning that: |
20558 |
++ * - bw (< 100%) is the deadline bandwidth of each CPU; |
20559 |
++ * - total_bw is the currently allocated bandwidth in each root domain; |
20560 |
++ */ |
20561 |
+ struct dl_bw { |
20562 |
+ raw_spinlock_t lock; |
20563 |
+ u64 bw; |
20564 |
+diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c |
20565 |
+index a125ea5e04cd7..0dde84b9d29fe 100644 |
20566 |
+--- a/kernel/trace/bpf_trace.c |
20567 |
++++ b/kernel/trace/bpf_trace.c |
20568 |
+@@ -2041,10 +2041,12 @@ struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name) |
20569 |
+ |
20570 |
+ void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp) |
20571 |
+ { |
20572 |
+- struct module *mod = __module_address((unsigned long)btp); |
20573 |
++ struct module *mod; |
20574 |
+ |
20575 |
+- if (mod) |
20576 |
+- module_put(mod); |
20577 |
++ preempt_disable(); |
20578 |
++ mod = __module_address((unsigned long)btp); |
20579 |
++ module_put(mod); |
20580 |
++ preempt_enable(); |
20581 |
+ } |
20582 |
+ |
20583 |
+ static __always_inline |
20584 |
+diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c |
20585 |
+index a6268e09160a5..ddeb865706ba4 100644 |
20586 |
+--- a/kernel/trace/ring_buffer.c |
20587 |
++++ b/kernel/trace/ring_buffer.c |
20588 |
+@@ -129,7 +129,16 @@ int ring_buffer_print_entry_header(struct trace_seq *s) |
20589 |
+ #define RB_ALIGNMENT 4U |
20590 |
+ #define RB_MAX_SMALL_DATA (RB_ALIGNMENT * RINGBUF_TYPE_DATA_TYPE_LEN_MAX) |
20591 |
+ #define RB_EVNT_MIN_SIZE 8U /* two 32bit words */ |
20592 |
+-#define RB_ALIGN_DATA __aligned(RB_ALIGNMENT) |
20593 |
++ |
20594 |
++#ifndef CONFIG_HAVE_64BIT_ALIGNED_ACCESS |
20595 |
++# define RB_FORCE_8BYTE_ALIGNMENT 0 |
20596 |
++# define RB_ARCH_ALIGNMENT RB_ALIGNMENT |
20597 |
++#else |
20598 |
++# define RB_FORCE_8BYTE_ALIGNMENT 1 |
20599 |
++# define RB_ARCH_ALIGNMENT 8U |
20600 |
++#endif |
20601 |
++ |
20602 |
++#define RB_ALIGN_DATA __aligned(RB_ARCH_ALIGNMENT) |
20603 |
+ |
20604 |
+ /* define RINGBUF_TYPE_DATA for 'case RINGBUF_TYPE_DATA:' */ |
20605 |
+ #define RINGBUF_TYPE_DATA 0 ... RINGBUF_TYPE_DATA_TYPE_LEN_MAX |
20606 |
+@@ -2719,7 +2728,7 @@ rb_update_event(struct ring_buffer_per_cpu *cpu_buffer, |
20607 |
+ |
20608 |
+ event->time_delta = delta; |
20609 |
+ length -= RB_EVNT_HDR_SIZE; |
20610 |
+- if (length > RB_MAX_SMALL_DATA) { |
20611 |
++ if (length > RB_MAX_SMALL_DATA || RB_FORCE_8BYTE_ALIGNMENT) { |
20612 |
+ event->type_len = 0; |
20613 |
+ event->array[0] = length; |
20614 |
+ } else |
20615 |
+@@ -2734,11 +2743,11 @@ static unsigned rb_calculate_event_length(unsigned length) |
20616 |
+ if (!length) |
20617 |
+ length++; |
20618 |
+ |
20619 |
+- if (length > RB_MAX_SMALL_DATA) |
20620 |
++ if (length > RB_MAX_SMALL_DATA || RB_FORCE_8BYTE_ALIGNMENT) |
20621 |
+ length += sizeof(event.array[0]); |
20622 |
+ |
20623 |
+ length += RB_EVNT_HDR_SIZE; |
20624 |
+- length = ALIGN(length, RB_ALIGNMENT); |
20625 |
++ length = ALIGN(length, RB_ARCH_ALIGNMENT); |
20626 |
+ |
20627 |
+ /* |
20628 |
+ * In case the time delta is larger than the 27 bits for it |
20629 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
20630 |
+index 06134189e9a72..3119d68d012df 100644 |
20631 |
+--- a/kernel/trace/trace.c |
20632 |
++++ b/kernel/trace/trace.c |
20633 |
+@@ -68,10 +68,21 @@ bool ring_buffer_expanded; |
20634 |
+ static bool __read_mostly tracing_selftest_running; |
20635 |
+ |
20636 |
+ /* |
20637 |
+- * If a tracer is running, we do not want to run SELFTEST. |
20638 |
++ * If boot-time tracing including tracers/events via kernel cmdline |
20639 |
++ * is running, we do not want to run SELFTEST. |
20640 |
+ */ |
20641 |
+ bool __read_mostly tracing_selftest_disabled; |
20642 |
+ |
20643 |
++#ifdef CONFIG_FTRACE_STARTUP_TEST |
20644 |
++void __init disable_tracing_selftest(const char *reason) |
20645 |
++{ |
20646 |
++ if (!tracing_selftest_disabled) { |
20647 |
++ tracing_selftest_disabled = true; |
20648 |
++ pr_info("Ftrace startup test is disabled due to %s\n", reason); |
20649 |
++ } |
20650 |
++} |
20651 |
++#endif |
20652 |
++ |
20653 |
+ /* Pipe tracepoints to printk */ |
20654 |
+ struct trace_iterator *tracepoint_print_iter; |
20655 |
+ int tracepoint_printk; |
20656 |
+@@ -2113,11 +2124,7 @@ int __init register_tracer(struct tracer *type) |
20657 |
+ apply_trace_boot_options(); |
20658 |
+ |
20659 |
+ /* disable other selftests, since this will break it. */ |
20660 |
+- tracing_selftest_disabled = true; |
20661 |
+-#ifdef CONFIG_FTRACE_STARTUP_TEST |
20662 |
+- printk(KERN_INFO "Disabling FTRACE selftests due to running tracer '%s'\n", |
20663 |
+- type->name); |
20664 |
+-#endif |
20665 |
++ disable_tracing_selftest("running a tracer"); |
20666 |
+ |
20667 |
+ out_unlock: |
20668 |
+ return ret; |
20669 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
20670 |
+index 1dadef445cd1e..6784b572ce597 100644 |
20671 |
+--- a/kernel/trace/trace.h |
20672 |
++++ b/kernel/trace/trace.h |
20673 |
+@@ -896,6 +896,8 @@ extern bool ring_buffer_expanded; |
20674 |
+ extern bool tracing_selftest_disabled; |
20675 |
+ |
20676 |
+ #ifdef CONFIG_FTRACE_STARTUP_TEST |
20677 |
++extern void __init disable_tracing_selftest(const char *reason); |
20678 |
++ |
20679 |
+ extern int trace_selftest_startup_function(struct tracer *trace, |
20680 |
+ struct trace_array *tr); |
20681 |
+ extern int trace_selftest_startup_function_graph(struct tracer *trace, |
20682 |
+@@ -919,6 +921,9 @@ extern int trace_selftest_startup_branch(struct tracer *trace, |
20683 |
+ */ |
20684 |
+ #define __tracer_data __refdata |
20685 |
+ #else |
20686 |
++static inline void __init disable_tracing_selftest(const char *reason) |
20687 |
++{ |
20688 |
++} |
20689 |
+ /* Tracers are seldom changed. Optimize when selftests are disabled. */ |
20690 |
+ #define __tracer_data __read_mostly |
20691 |
+ #endif /* CONFIG_FTRACE_STARTUP_TEST */ |
20692 |
+diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c |
20693 |
+index c22a152ef0b4f..a82f03f385f89 100644 |
20694 |
+--- a/kernel/trace/trace_boot.c |
20695 |
++++ b/kernel/trace/trace_boot.c |
20696 |
+@@ -344,6 +344,8 @@ static int __init trace_boot_init(void) |
20697 |
+ trace_boot_init_one_instance(tr, trace_node); |
20698 |
+ trace_boot_init_instances(trace_node); |
20699 |
+ |
20700 |
++ disable_tracing_selftest("running boot-time tracing"); |
20701 |
++ |
20702 |
+ return 0; |
20703 |
+ } |
20704 |
+ /* |
20705 |
+diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
20706 |
+index 47a71f96e5bcc..802f3e7d8b8b5 100644 |
20707 |
+--- a/kernel/trace/trace_events.c |
20708 |
++++ b/kernel/trace/trace_events.c |
20709 |
+@@ -3201,7 +3201,7 @@ static __init int setup_trace_event(char *str) |
20710 |
+ { |
20711 |
+ strlcpy(bootup_event_buf, str, COMMAND_LINE_SIZE); |
20712 |
+ ring_buffer_expanded = true; |
20713 |
+- tracing_selftest_disabled = true; |
20714 |
++ disable_tracing_selftest("running event tracing"); |
20715 |
+ |
20716 |
+ return 1; |
20717 |
+ } |
20718 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
20719 |
+index b911e9f6d9f5c..b29f92c51b1a4 100644 |
20720 |
+--- a/kernel/trace/trace_kprobe.c |
20721 |
++++ b/kernel/trace/trace_kprobe.c |
20722 |
+@@ -25,11 +25,12 @@ |
20723 |
+ |
20724 |
+ /* Kprobe early definition from command line */ |
20725 |
+ static char kprobe_boot_events_buf[COMMAND_LINE_SIZE] __initdata; |
20726 |
+-static bool kprobe_boot_events_enabled __initdata; |
20727 |
+ |
20728 |
+ static int __init set_kprobe_boot_events(char *str) |
20729 |
+ { |
20730 |
+ strlcpy(kprobe_boot_events_buf, str, COMMAND_LINE_SIZE); |
20731 |
++ disable_tracing_selftest("running kprobe events"); |
20732 |
++ |
20733 |
+ return 0; |
20734 |
+ } |
20735 |
+ __setup("kprobe_event=", set_kprobe_boot_events); |
20736 |
+@@ -1887,8 +1888,6 @@ static __init void setup_boot_kprobe_events(void) |
20737 |
+ ret = trace_run_command(cmd, create_or_delete_trace_kprobe); |
20738 |
+ if (ret) |
20739 |
+ pr_warn("Failed to add event(%d): %s\n", ret, cmd); |
20740 |
+- else |
20741 |
+- kprobe_boot_events_enabled = true; |
20742 |
+ |
20743 |
+ cmd = p; |
20744 |
+ } |
20745 |
+@@ -1973,10 +1972,8 @@ static __init int kprobe_trace_self_tests_init(void) |
20746 |
+ if (tracing_is_disabled()) |
20747 |
+ return -ENODEV; |
20748 |
+ |
20749 |
+- if (kprobe_boot_events_enabled) { |
20750 |
+- pr_info("Skipping kprobe tests due to kprobe_event on cmdline\n"); |
20751 |
++ if (tracing_selftest_disabled) |
20752 |
+ return 0; |
20753 |
+- } |
20754 |
+ |
20755 |
+ target = kprobe_trace_selftest_target; |
20756 |
+ |
20757 |
+diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c |
20758 |
+index 4738ad48a6674..6f28b8b11ead6 100644 |
20759 |
+--- a/kernel/trace/trace_selftest.c |
20760 |
++++ b/kernel/trace/trace_selftest.c |
20761 |
+@@ -787,7 +787,7 @@ trace_selftest_startup_function_graph(struct tracer *trace, |
20762 |
+ |
20763 |
+ /* Have we just recovered from a hang? */ |
20764 |
+ if (graph_hang_thresh > GRAPH_MAX_FUNC_TEST) { |
20765 |
+- tracing_selftest_disabled = true; |
20766 |
++ disable_tracing_selftest("recovering from a hang"); |
20767 |
+ ret = -1; |
20768 |
+ goto out; |
20769 |
+ } |
20770 |
+diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
20771 |
+index bd7b3aaa93c38..c70d6347afa2b 100644 |
20772 |
+--- a/lib/dynamic_debug.c |
20773 |
++++ b/lib/dynamic_debug.c |
20774 |
+@@ -561,9 +561,14 @@ static int ddebug_exec_queries(char *query, const char *modname) |
20775 |
+ int dynamic_debug_exec_queries(const char *query, const char *modname) |
20776 |
+ { |
20777 |
+ int rc; |
20778 |
+- char *qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); |
20779 |
++ char *qry; /* writable copy of query */ |
20780 |
+ |
20781 |
+- if (!query) |
20782 |
++ if (!query) { |
20783 |
++ pr_err("non-null query/command string expected\n"); |
20784 |
++ return -EINVAL; |
20785 |
++ } |
20786 |
++ qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); |
20787 |
++ if (!qry) |
20788 |
+ return -ENOMEM; |
20789 |
+ |
20790 |
+ rc = ddebug_exec_queries(qry, modname); |
20791 |
+diff --git a/mm/gup.c b/mm/gup.c |
20792 |
+index 98eb8e6d2609c..054ff923d3d92 100644 |
20793 |
+--- a/mm/gup.c |
20794 |
++++ b/mm/gup.c |
20795 |
+@@ -123,6 +123,28 @@ static __maybe_unused struct page *try_grab_compound_head(struct page *page, |
20796 |
+ return NULL; |
20797 |
+ } |
20798 |
+ |
20799 |
++static void put_compound_head(struct page *page, int refs, unsigned int flags) |
20800 |
++{ |
20801 |
++ if (flags & FOLL_PIN) { |
20802 |
++ mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, |
20803 |
++ refs); |
20804 |
++ |
20805 |
++ if (hpage_pincount_available(page)) |
20806 |
++ hpage_pincount_sub(page, refs); |
20807 |
++ else |
20808 |
++ refs *= GUP_PIN_COUNTING_BIAS; |
20809 |
++ } |
20810 |
++ |
20811 |
++ VM_BUG_ON_PAGE(page_ref_count(page) < refs, page); |
20812 |
++ /* |
20813 |
++ * Calling put_page() for each ref is unnecessarily slow. Only the last |
20814 |
++ * ref needs a put_page(). |
20815 |
++ */ |
20816 |
++ if (refs > 1) |
20817 |
++ page_ref_sub(page, refs - 1); |
20818 |
++ put_page(page); |
20819 |
++} |
20820 |
++ |
20821 |
+ /** |
20822 |
+ * try_grab_page() - elevate a page's refcount by a flag-dependent amount |
20823 |
+ * |
20824 |
+@@ -177,41 +199,6 @@ bool __must_check try_grab_page(struct page *page, unsigned int flags) |
20825 |
+ return true; |
20826 |
+ } |
20827 |
+ |
20828 |
+-#ifdef CONFIG_DEV_PAGEMAP_OPS |
20829 |
+-static bool __unpin_devmap_managed_user_page(struct page *page) |
20830 |
+-{ |
20831 |
+- int count, refs = 1; |
20832 |
+- |
20833 |
+- if (!page_is_devmap_managed(page)) |
20834 |
+- return false; |
20835 |
+- |
20836 |
+- if (hpage_pincount_available(page)) |
20837 |
+- hpage_pincount_sub(page, 1); |
20838 |
+- else |
20839 |
+- refs = GUP_PIN_COUNTING_BIAS; |
20840 |
+- |
20841 |
+- count = page_ref_sub_return(page, refs); |
20842 |
+- |
20843 |
+- mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, 1); |
20844 |
+- /* |
20845 |
+- * devmap page refcounts are 1-based, rather than 0-based: if |
20846 |
+- * refcount is 1, then the page is free and the refcount is |
20847 |
+- * stable because nobody holds a reference on the page. |
20848 |
+- */ |
20849 |
+- if (count == 1) |
20850 |
+- free_devmap_managed_page(page); |
20851 |
+- else if (!count) |
20852 |
+- __put_page(page); |
20853 |
+- |
20854 |
+- return true; |
20855 |
+-} |
20856 |
+-#else |
20857 |
+-static bool __unpin_devmap_managed_user_page(struct page *page) |
20858 |
+-{ |
20859 |
+- return false; |
20860 |
+-} |
20861 |
+-#endif /* CONFIG_DEV_PAGEMAP_OPS */ |
20862 |
+- |
20863 |
+ /** |
20864 |
+ * unpin_user_page() - release a dma-pinned page |
20865 |
+ * @page: pointer to page to be released |
20866 |
+@@ -223,28 +210,7 @@ static bool __unpin_devmap_managed_user_page(struct page *page) |
20867 |
+ */ |
20868 |
+ void unpin_user_page(struct page *page) |
20869 |
+ { |
20870 |
+- int refs = 1; |
20871 |
+- |
20872 |
+- page = compound_head(page); |
20873 |
+- |
20874 |
+- /* |
20875 |
+- * For devmap managed pages we need to catch refcount transition from |
20876 |
+- * GUP_PIN_COUNTING_BIAS to 1, when refcount reach one it means the |
20877 |
+- * page is free and we need to inform the device driver through |
20878 |
+- * callback. See include/linux/memremap.h and HMM for details. |
20879 |
+- */ |
20880 |
+- if (__unpin_devmap_managed_user_page(page)) |
20881 |
+- return; |
20882 |
+- |
20883 |
+- if (hpage_pincount_available(page)) |
20884 |
+- hpage_pincount_sub(page, 1); |
20885 |
+- else |
20886 |
+- refs = GUP_PIN_COUNTING_BIAS; |
20887 |
+- |
20888 |
+- if (page_ref_sub_and_test(page, refs)) |
20889 |
+- __put_page(page); |
20890 |
+- |
20891 |
+- mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, 1); |
20892 |
++ put_compound_head(compound_head(page), 1, FOLL_PIN); |
20893 |
+ } |
20894 |
+ EXPORT_SYMBOL(unpin_user_page); |
20895 |
+ |
20896 |
+@@ -2062,29 +2028,6 @@ EXPORT_SYMBOL(get_user_pages_unlocked); |
20897 |
+ * This code is based heavily on the PowerPC implementation by Nick Piggin. |
20898 |
+ */ |
20899 |
+ #ifdef CONFIG_HAVE_FAST_GUP |
20900 |
+- |
20901 |
+-static void put_compound_head(struct page *page, int refs, unsigned int flags) |
20902 |
+-{ |
20903 |
+- if (flags & FOLL_PIN) { |
20904 |
+- mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, |
20905 |
+- refs); |
20906 |
+- |
20907 |
+- if (hpage_pincount_available(page)) |
20908 |
+- hpage_pincount_sub(page, refs); |
20909 |
+- else |
20910 |
+- refs *= GUP_PIN_COUNTING_BIAS; |
20911 |
+- } |
20912 |
+- |
20913 |
+- VM_BUG_ON_PAGE(page_ref_count(page) < refs, page); |
20914 |
+- /* |
20915 |
+- * Calling put_page() for each ref is unnecessarily slow. Only the last |
20916 |
+- * ref needs a put_page(). |
20917 |
+- */ |
20918 |
+- if (refs > 1) |
20919 |
+- page_ref_sub(page, refs - 1); |
20920 |
+- put_page(page); |
20921 |
+-} |
20922 |
+- |
20923 |
+ #ifdef CONFIG_GUP_GET_PTE_LOW_HIGH |
20924 |
+ |
20925 |
+ /* |
20926 |
+@@ -2677,13 +2620,61 @@ static int __gup_longterm_unlocked(unsigned long start, int nr_pages, |
20927 |
+ return ret; |
20928 |
+ } |
20929 |
+ |
20930 |
+-static int internal_get_user_pages_fast(unsigned long start, int nr_pages, |
20931 |
++static unsigned long lockless_pages_from_mm(unsigned long start, |
20932 |
++ unsigned long end, |
20933 |
++ unsigned int gup_flags, |
20934 |
++ struct page **pages) |
20935 |
++{ |
20936 |
++ unsigned long flags; |
20937 |
++ int nr_pinned = 0; |
20938 |
++ unsigned seq; |
20939 |
++ |
20940 |
++ if (!IS_ENABLED(CONFIG_HAVE_FAST_GUP) || |
20941 |
++ !gup_fast_permitted(start, end)) |
20942 |
++ return 0; |
20943 |
++ |
20944 |
++ if (gup_flags & FOLL_PIN) { |
20945 |
++ seq = raw_read_seqcount(¤t->mm->write_protect_seq); |
20946 |
++ if (seq & 1) |
20947 |
++ return 0; |
20948 |
++ } |
20949 |
++ |
20950 |
++ /* |
20951 |
++ * Disable interrupts. The nested form is used, in order to allow full, |
20952 |
++ * general purpose use of this routine. |
20953 |
++ * |
20954 |
++ * With interrupts disabled, we block page table pages from being freed |
20955 |
++ * from under us. See struct mmu_table_batch comments in |
20956 |
++ * include/asm-generic/tlb.h for more details. |
20957 |
++ * |
20958 |
++ * We do not adopt an rcu_read_lock() here as we also want to block IPIs |
20959 |
++ * that come from THPs splitting. |
20960 |
++ */ |
20961 |
++ local_irq_save(flags); |
20962 |
++ gup_pgd_range(start, end, gup_flags, pages, &nr_pinned); |
20963 |
++ local_irq_restore(flags); |
20964 |
++ |
20965 |
++ /* |
20966 |
++ * When pinning pages for DMA there could be a concurrent write protect |
20967 |
++ * from fork() via copy_page_range(), in this case always fail fast GUP. |
20968 |
++ */ |
20969 |
++ if (gup_flags & FOLL_PIN) { |
20970 |
++ if (read_seqcount_retry(¤t->mm->write_protect_seq, seq)) { |
20971 |
++ unpin_user_pages(pages, nr_pinned); |
20972 |
++ return 0; |
20973 |
++ } |
20974 |
++ } |
20975 |
++ return nr_pinned; |
20976 |
++} |
20977 |
++ |
20978 |
++static int internal_get_user_pages_fast(unsigned long start, |
20979 |
++ unsigned long nr_pages, |
20980 |
+ unsigned int gup_flags, |
20981 |
+ struct page **pages) |
20982 |
+ { |
20983 |
+- unsigned long addr, len, end; |
20984 |
+- unsigned long flags; |
20985 |
+- int nr_pinned = 0, ret = 0; |
20986 |
++ unsigned long len, end; |
20987 |
++ unsigned long nr_pinned; |
20988 |
++ int ret; |
20989 |
+ |
20990 |
+ if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM | |
20991 |
+ FOLL_FORCE | FOLL_PIN | FOLL_GET | |
20992 |
+@@ -2697,54 +2688,33 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, |
20993 |
+ might_lock_read(¤t->mm->mmap_lock); |
20994 |
+ |
20995 |
+ start = untagged_addr(start) & PAGE_MASK; |
20996 |
+- addr = start; |
20997 |
+- len = (unsigned long) nr_pages << PAGE_SHIFT; |
20998 |
+- end = start + len; |
20999 |
+- |
21000 |
+- if (end <= start) |
21001 |
++ len = nr_pages << PAGE_SHIFT; |
21002 |
++ if (check_add_overflow(start, len, &end)) |
21003 |
+ return 0; |
21004 |
+ if (unlikely(!access_ok((void __user *)start, len))) |
21005 |
+ return -EFAULT; |
21006 |
+ |
21007 |
+- /* |
21008 |
+- * Disable interrupts. The nested form is used, in order to allow |
21009 |
+- * full, general purpose use of this routine. |
21010 |
+- * |
21011 |
+- * With interrupts disabled, we block page table pages from being |
21012 |
+- * freed from under us. See struct mmu_table_batch comments in |
21013 |
+- * include/asm-generic/tlb.h for more details. |
21014 |
+- * |
21015 |
+- * We do not adopt an rcu_read_lock(.) here as we also want to |
21016 |
+- * block IPIs that come from THPs splitting. |
21017 |
+- */ |
21018 |
+- if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { |
21019 |
+- unsigned long fast_flags = gup_flags; |
21020 |
+- |
21021 |
+- local_irq_save(flags); |
21022 |
+- gup_pgd_range(addr, end, fast_flags, pages, &nr_pinned); |
21023 |
+- local_irq_restore(flags); |
21024 |
+- ret = nr_pinned; |
21025 |
+- } |
21026 |
+- |
21027 |
+- if (nr_pinned < nr_pages && !(gup_flags & FOLL_FAST_ONLY)) { |
21028 |
+- /* Try to get the remaining pages with get_user_pages */ |
21029 |
+- start += nr_pinned << PAGE_SHIFT; |
21030 |
+- pages += nr_pinned; |
21031 |
+- |
21032 |
+- ret = __gup_longterm_unlocked(start, nr_pages - nr_pinned, |
21033 |
+- gup_flags, pages); |
21034 |
++ nr_pinned = lockless_pages_from_mm(start, end, gup_flags, pages); |
21035 |
++ if (nr_pinned == nr_pages || gup_flags & FOLL_FAST_ONLY) |
21036 |
++ return nr_pinned; |
21037 |
+ |
21038 |
+- /* Have to be a bit careful with return values */ |
21039 |
+- if (nr_pinned > 0) { |
21040 |
+- if (ret < 0) |
21041 |
+- ret = nr_pinned; |
21042 |
+- else |
21043 |
+- ret += nr_pinned; |
21044 |
+- } |
21045 |
++ /* Slow path: try to get the remaining pages with get_user_pages */ |
21046 |
++ start += nr_pinned << PAGE_SHIFT; |
21047 |
++ pages += nr_pinned; |
21048 |
++ ret = __gup_longterm_unlocked(start, nr_pages - nr_pinned, gup_flags, |
21049 |
++ pages); |
21050 |
++ if (ret < 0) { |
21051 |
++ /* |
21052 |
++ * The caller has to unpin the pages we already pinned so |
21053 |
++ * returning -errno is not an option |
21054 |
++ */ |
21055 |
++ if (nr_pinned) |
21056 |
++ return nr_pinned; |
21057 |
++ return ret; |
21058 |
+ } |
21059 |
+- |
21060 |
+- return ret; |
21061 |
++ return ret + nr_pinned; |
21062 |
+ } |
21063 |
++ |
21064 |
+ /** |
21065 |
+ * get_user_pages_fast_only() - pin user pages in memory |
21066 |
+ * @start: starting user address |
21067 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
21068 |
+index ec2bb93f74314..85eda66eb625d 100644 |
21069 |
+--- a/mm/huge_memory.c |
21070 |
++++ b/mm/huge_memory.c |
21071 |
+@@ -2321,7 +2321,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, |
21072 |
+ |
21073 |
+ static void unmap_page(struct page *page) |
21074 |
+ { |
21075 |
+- enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | |
21076 |
++ enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | |
21077 |
+ TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD; |
21078 |
+ bool unmap_success; |
21079 |
+ |
21080 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
21081 |
+index d029d938d26d6..3b38ea958e954 100644 |
21082 |
+--- a/mm/hugetlb.c |
21083 |
++++ b/mm/hugetlb.c |
21084 |
+@@ -5115,6 +5115,7 @@ int hugetlb_reserve_pages(struct inode *inode, |
21085 |
+ |
21086 |
+ if (unlikely(add < 0)) { |
21087 |
+ hugetlb_acct_memory(h, -gbl_reserve); |
21088 |
++ ret = add; |
21089 |
+ goto out_put_pages; |
21090 |
+ } else if (unlikely(chg > add)) { |
21091 |
+ /* |
21092 |
+diff --git a/mm/init-mm.c b/mm/init-mm.c |
21093 |
+index 3a613c85f9ede..153162669f806 100644 |
21094 |
+--- a/mm/init-mm.c |
21095 |
++++ b/mm/init-mm.c |
21096 |
+@@ -31,6 +31,7 @@ struct mm_struct init_mm = { |
21097 |
+ .pgd = swapper_pg_dir, |
21098 |
+ .mm_users = ATOMIC_INIT(2), |
21099 |
+ .mm_count = ATOMIC_INIT(1), |
21100 |
++ .write_protect_seq = SEQCNT_ZERO(init_mm.write_protect_seq), |
21101 |
+ MMAP_LOCK_INITIALIZER(init_mm) |
21102 |
+ .page_table_lock = __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock), |
21103 |
+ .arg_lock = __SPIN_LOCK_UNLOCKED(init_mm.arg_lock), |
21104 |
+diff --git a/mm/madvise.c b/mm/madvise.c |
21105 |
+index 13f5677b93222..9abf4c5f2bce2 100644 |
21106 |
+--- a/mm/madvise.c |
21107 |
++++ b/mm/madvise.c |
21108 |
+@@ -908,14 +908,7 @@ static int madvise_inject_error(int behavior, |
21109 |
+ } else { |
21110 |
+ pr_info("Injecting memory failure for pfn %#lx at process virtual address %#lx\n", |
21111 |
+ pfn, start); |
21112 |
+- /* |
21113 |
+- * Drop the page reference taken by get_user_pages_fast(). In |
21114 |
+- * the absence of MF_COUNT_INCREASED the memory_failure() |
21115 |
+- * routine is responsible for pinning the page to prevent it |
21116 |
+- * from being released back to the page allocator. |
21117 |
+- */ |
21118 |
+- put_page(page); |
21119 |
+- ret = memory_failure(pfn, 0); |
21120 |
++ ret = memory_failure(pfn, MF_COUNT_INCREASED); |
21121 |
+ } |
21122 |
+ |
21123 |
+ if (ret) |
21124 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
21125 |
+index 29459a6ce1c7a..a717728cc7b4a 100644 |
21126 |
+--- a/mm/memcontrol.c |
21127 |
++++ b/mm/memcontrol.c |
21128 |
+@@ -2987,6 +2987,7 @@ __always_inline struct obj_cgroup *get_obj_cgroup_from_current(void) |
21129 |
+ objcg = rcu_dereference(memcg->objcg); |
21130 |
+ if (objcg && obj_cgroup_tryget(objcg)) |
21131 |
+ break; |
21132 |
++ objcg = NULL; |
21133 |
+ } |
21134 |
+ rcu_read_unlock(); |
21135 |
+ |
21136 |
+@@ -3246,8 +3247,10 @@ int obj_cgroup_charge(struct obj_cgroup *objcg, gfp_t gfp, size_t size) |
21137 |
+ * independently later. |
21138 |
+ */ |
21139 |
+ rcu_read_lock(); |
21140 |
++retry: |
21141 |
+ memcg = obj_cgroup_memcg(objcg); |
21142 |
+- css_get(&memcg->css); |
21143 |
++ if (unlikely(!css_tryget(&memcg->css))) |
21144 |
++ goto retry; |
21145 |
+ rcu_read_unlock(); |
21146 |
+ |
21147 |
+ nr_pages = size >> PAGE_SHIFT; |
21148 |
+diff --git a/mm/memory-failure.c b/mm/memory-failure.c |
21149 |
+index 5d880d4eb9a26..fd653c9953cfd 100644 |
21150 |
+--- a/mm/memory-failure.c |
21151 |
++++ b/mm/memory-failure.c |
21152 |
+@@ -989,7 +989,7 @@ static int get_hwpoison_page(struct page *page) |
21153 |
+ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, |
21154 |
+ int flags, struct page **hpagep) |
21155 |
+ { |
21156 |
+- enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; |
21157 |
++ enum ttu_flags ttu = TTU_IGNORE_MLOCK; |
21158 |
+ struct address_space *mapping; |
21159 |
+ LIST_HEAD(tokill); |
21160 |
+ bool unmap_success = true; |
21161 |
+@@ -1231,6 +1231,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags, |
21162 |
+ loff_t start; |
21163 |
+ dax_entry_t cookie; |
21164 |
+ |
21165 |
++ if (flags & MF_COUNT_INCREASED) |
21166 |
++ /* |
21167 |
++ * Drop the extra refcount in case we come from madvise(). |
21168 |
++ */ |
21169 |
++ put_page(page); |
21170 |
++ |
21171 |
+ /* |
21172 |
+ * Prevent the inode from being freed while we are interrogating |
21173 |
+ * the address_space, typically this would be handled by |
21174 |
+diff --git a/mm/memory.c b/mm/memory.c |
21175 |
+index c48f8df6e5026..50632c4366b8a 100644 |
21176 |
+--- a/mm/memory.c |
21177 |
++++ b/mm/memory.c |
21178 |
+@@ -1171,6 +1171,15 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma) |
21179 |
+ mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE, |
21180 |
+ 0, src_vma, src_mm, addr, end); |
21181 |
+ mmu_notifier_invalidate_range_start(&range); |
21182 |
++ /* |
21183 |
++ * Disabling preemption is not needed for the write side, as |
21184 |
++ * the read side doesn't spin, but goes to the mmap_lock. |
21185 |
++ * |
21186 |
++ * Use the raw variant of the seqcount_t write API to avoid |
21187 |
++ * lockdep complaining about preemptibility. |
21188 |
++ */ |
21189 |
++ mmap_assert_write_locked(src_mm); |
21190 |
++ raw_write_seqcount_begin(&src_mm->write_protect_seq); |
21191 |
+ } |
21192 |
+ |
21193 |
+ ret = 0; |
21194 |
+@@ -1187,8 +1196,10 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma) |
21195 |
+ } |
21196 |
+ } while (dst_pgd++, src_pgd++, addr = next, addr != end); |
21197 |
+ |
21198 |
+- if (is_cow) |
21199 |
++ if (is_cow) { |
21200 |
++ raw_write_seqcount_end(&src_mm->write_protect_seq); |
21201 |
+ mmu_notifier_invalidate_range_end(&range); |
21202 |
++ } |
21203 |
+ return ret; |
21204 |
+ } |
21205 |
+ |
21206 |
+diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
21207 |
+index 63b2e46b65552..0f855deea4b2d 100644 |
21208 |
+--- a/mm/memory_hotplug.c |
21209 |
++++ b/mm/memory_hotplug.c |
21210 |
+@@ -1304,7 +1304,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) |
21211 |
+ if (WARN_ON(PageLRU(page))) |
21212 |
+ isolate_lru_page(page); |
21213 |
+ if (page_mapped(page)) |
21214 |
+- try_to_unmap(page, TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS); |
21215 |
++ try_to_unmap(page, TTU_IGNORE_MLOCK); |
21216 |
+ continue; |
21217 |
+ } |
21218 |
+ |
21219 |
+diff --git a/mm/migrate.c b/mm/migrate.c |
21220 |
+index 5795cb82e27c3..8ea0c65f10756 100644 |
21221 |
+--- a/mm/migrate.c |
21222 |
++++ b/mm/migrate.c |
21223 |
+@@ -1122,8 +1122,7 @@ static int __unmap_and_move(struct page *page, struct page *newpage, |
21224 |
+ /* Establish migration ptes */ |
21225 |
+ VM_BUG_ON_PAGE(PageAnon(page) && !PageKsm(page) && !anon_vma, |
21226 |
+ page); |
21227 |
+- try_to_unmap(page, |
21228 |
+- TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS); |
21229 |
++ try_to_unmap(page, TTU_MIGRATION|TTU_IGNORE_MLOCK); |
21230 |
+ page_was_mapped = 1; |
21231 |
+ } |
21232 |
+ |
21233 |
+@@ -1329,8 +1328,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, |
21234 |
+ |
21235 |
+ if (page_mapped(hpage)) { |
21236 |
+ bool mapping_locked = false; |
21237 |
+- enum ttu_flags ttu = TTU_MIGRATION|TTU_IGNORE_MLOCK| |
21238 |
+- TTU_IGNORE_ACCESS; |
21239 |
++ enum ttu_flags ttu = TTU_MIGRATION|TTU_IGNORE_MLOCK; |
21240 |
+ |
21241 |
+ if (!PageAnon(hpage)) { |
21242 |
+ /* |
21243 |
+@@ -2688,7 +2686,7 @@ static void migrate_vma_prepare(struct migrate_vma *migrate) |
21244 |
+ */ |
21245 |
+ static void migrate_vma_unmap(struct migrate_vma *migrate) |
21246 |
+ { |
21247 |
+- int flags = TTU_MIGRATION | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; |
21248 |
++ int flags = TTU_MIGRATION | TTU_IGNORE_MLOCK; |
21249 |
+ const unsigned long npages = migrate->npages; |
21250 |
+ const unsigned long start = migrate->start; |
21251 |
+ unsigned long addr, i, restore = 0; |
21252 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
21253 |
+index eaa227a479e4a..32f783ddb5c3a 100644 |
21254 |
+--- a/mm/page_alloc.c |
21255 |
++++ b/mm/page_alloc.c |
21256 |
+@@ -2470,12 +2470,12 @@ static bool can_steal_fallback(unsigned int order, int start_mt) |
21257 |
+ return false; |
21258 |
+ } |
21259 |
+ |
21260 |
+-static inline void boost_watermark(struct zone *zone) |
21261 |
++static inline bool boost_watermark(struct zone *zone) |
21262 |
+ { |
21263 |
+ unsigned long max_boost; |
21264 |
+ |
21265 |
+ if (!watermark_boost_factor) |
21266 |
+- return; |
21267 |
++ return false; |
21268 |
+ /* |
21269 |
+ * Don't bother in zones that are unlikely to produce results. |
21270 |
+ * On small machines, including kdump capture kernels running |
21271 |
+@@ -2483,7 +2483,7 @@ static inline void boost_watermark(struct zone *zone) |
21272 |
+ * memory situation immediately. |
21273 |
+ */ |
21274 |
+ if ((pageblock_nr_pages * 4) > zone_managed_pages(zone)) |
21275 |
+- return; |
21276 |
++ return false; |
21277 |
+ |
21278 |
+ max_boost = mult_frac(zone->_watermark[WMARK_HIGH], |
21279 |
+ watermark_boost_factor, 10000); |
21280 |
+@@ -2497,12 +2497,14 @@ static inline void boost_watermark(struct zone *zone) |
21281 |
+ * boosted watermark resulting in a hang. |
21282 |
+ */ |
21283 |
+ if (!max_boost) |
21284 |
+- return; |
21285 |
++ return false; |
21286 |
+ |
21287 |
+ max_boost = max(pageblock_nr_pages, max_boost); |
21288 |
+ |
21289 |
+ zone->watermark_boost = min(zone->watermark_boost + pageblock_nr_pages, |
21290 |
+ max_boost); |
21291 |
++ |
21292 |
++ return true; |
21293 |
+ } |
21294 |
+ |
21295 |
+ /* |
21296 |
+@@ -2540,8 +2542,7 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page, |
21297 |
+ * likelihood of future fallbacks. Wake kswapd now as the node |
21298 |
+ * may be balanced overall and kswapd will not wake naturally. |
21299 |
+ */ |
21300 |
+- boost_watermark(zone); |
21301 |
+- if (alloc_flags & ALLOC_KSWAPD) |
21302 |
++ if (boost_watermark(zone) && (alloc_flags & ALLOC_KSWAPD)) |
21303 |
+ set_bit(ZONE_BOOSTED_WATERMARK, &zone->flags); |
21304 |
+ |
21305 |
+ /* We are not allowed to try stealing from the whole block */ |
21306 |
+diff --git a/mm/rmap.c b/mm/rmap.c |
21307 |
+index 31b29321adfe1..6657000b18d41 100644 |
21308 |
+--- a/mm/rmap.c |
21309 |
++++ b/mm/rmap.c |
21310 |
+@@ -1533,15 +1533,6 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, |
21311 |
+ goto discard; |
21312 |
+ } |
21313 |
+ |
21314 |
+- if (!(flags & TTU_IGNORE_ACCESS)) { |
21315 |
+- if (ptep_clear_flush_young_notify(vma, address, |
21316 |
+- pvmw.pte)) { |
21317 |
+- ret = false; |
21318 |
+- page_vma_mapped_walk_done(&pvmw); |
21319 |
+- break; |
21320 |
+- } |
21321 |
+- } |
21322 |
+- |
21323 |
+ /* Nuke the page table entry. */ |
21324 |
+ flush_cache_page(vma, address, pte_pfn(*pvmw.pte)); |
21325 |
+ if (should_defer_flush(mm, flags)) { |
21326 |
+diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
21327 |
+index 6ae491a8b210f..279dc0c96568c 100644 |
21328 |
+--- a/mm/vmalloc.c |
21329 |
++++ b/mm/vmalloc.c |
21330 |
+@@ -2256,7 +2256,7 @@ static void __vunmap(const void *addr, int deallocate_pages) |
21331 |
+ debug_check_no_locks_freed(area->addr, get_vm_area_size(area)); |
21332 |
+ debug_check_no_obj_freed(area->addr, get_vm_area_size(area)); |
21333 |
+ |
21334 |
+- kasan_poison_vmalloc(area->addr, area->size); |
21335 |
++ kasan_poison_vmalloc(area->addr, get_vm_area_size(area)); |
21336 |
+ |
21337 |
+ vm_remove_mappings(area, deallocate_pages); |
21338 |
+ |
21339 |
+@@ -3448,11 +3448,11 @@ static void *s_next(struct seq_file *m, void *p, loff_t *pos) |
21340 |
+ } |
21341 |
+ |
21342 |
+ static void s_stop(struct seq_file *m, void *p) |
21343 |
+- __releases(&vmap_purge_lock) |
21344 |
+ __releases(&vmap_area_lock) |
21345 |
++ __releases(&vmap_purge_lock) |
21346 |
+ { |
21347 |
+- mutex_unlock(&vmap_purge_lock); |
21348 |
+ spin_unlock(&vmap_area_lock); |
21349 |
++ mutex_unlock(&vmap_purge_lock); |
21350 |
+ } |
21351 |
+ |
21352 |
+ static void show_numa_info(struct seq_file *m, struct vm_struct *v) |
21353 |
+diff --git a/mm/vmscan.c b/mm/vmscan.c |
21354 |
+index 7b4e31eac2cff..0ec6321e98878 100644 |
21355 |
+--- a/mm/vmscan.c |
21356 |
++++ b/mm/vmscan.c |
21357 |
+@@ -1072,7 +1072,6 @@ static void page_check_dirty_writeback(struct page *page, |
21358 |
+ static unsigned int shrink_page_list(struct list_head *page_list, |
21359 |
+ struct pglist_data *pgdat, |
21360 |
+ struct scan_control *sc, |
21361 |
+- enum ttu_flags ttu_flags, |
21362 |
+ struct reclaim_stat *stat, |
21363 |
+ bool ignore_references) |
21364 |
+ { |
21365 |
+@@ -1297,7 +1296,7 @@ static unsigned int shrink_page_list(struct list_head *page_list, |
21366 |
+ * processes. Try to unmap it here. |
21367 |
+ */ |
21368 |
+ if (page_mapped(page)) { |
21369 |
+- enum ttu_flags flags = ttu_flags | TTU_BATCH_FLUSH; |
21370 |
++ enum ttu_flags flags = TTU_BATCH_FLUSH; |
21371 |
+ bool was_swapbacked = PageSwapBacked(page); |
21372 |
+ |
21373 |
+ if (unlikely(PageTransHuge(page))) |
21374 |
+@@ -1514,7 +1513,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone, |
21375 |
+ } |
21376 |
+ |
21377 |
+ nr_reclaimed = shrink_page_list(&clean_pages, zone->zone_pgdat, &sc, |
21378 |
+- TTU_IGNORE_ACCESS, &stat, true); |
21379 |
++ &stat, true); |
21380 |
+ list_splice(&clean_pages, page_list); |
21381 |
+ mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, |
21382 |
+ -(long)nr_reclaimed); |
21383 |
+@@ -1958,8 +1957,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, |
21384 |
+ if (nr_taken == 0) |
21385 |
+ return 0; |
21386 |
+ |
21387 |
+- nr_reclaimed = shrink_page_list(&page_list, pgdat, sc, 0, |
21388 |
+- &stat, false); |
21389 |
++ nr_reclaimed = shrink_page_list(&page_list, pgdat, sc, &stat, false); |
21390 |
+ |
21391 |
+ spin_lock_irq(&pgdat->lru_lock); |
21392 |
+ |
21393 |
+@@ -2131,8 +2129,7 @@ unsigned long reclaim_pages(struct list_head *page_list) |
21394 |
+ |
21395 |
+ nr_reclaimed += shrink_page_list(&node_page_list, |
21396 |
+ NODE_DATA(nid), |
21397 |
+- &sc, 0, |
21398 |
+- &dummy_stat, false); |
21399 |
++ &sc, &dummy_stat, false); |
21400 |
+ while (!list_empty(&node_page_list)) { |
21401 |
+ page = lru_to_page(&node_page_list); |
21402 |
+ list_del(&page->lru); |
21403 |
+@@ -2145,8 +2142,7 @@ unsigned long reclaim_pages(struct list_head *page_list) |
21404 |
+ if (!list_empty(&node_page_list)) { |
21405 |
+ nr_reclaimed += shrink_page_list(&node_page_list, |
21406 |
+ NODE_DATA(nid), |
21407 |
+- &sc, 0, |
21408 |
+- &dummy_stat, false); |
21409 |
++ &sc, &dummy_stat, false); |
21410 |
+ while (!list_empty(&node_page_list)) { |
21411 |
+ page = lru_to_page(&node_page_list); |
21412 |
+ list_del(&page->lru); |
21413 |
+diff --git a/mm/z3fold.c b/mm/z3fold.c |
21414 |
+index 18feaa0bc5377..0152ad9931a87 100644 |
21415 |
+--- a/mm/z3fold.c |
21416 |
++++ b/mm/z3fold.c |
21417 |
+@@ -90,7 +90,7 @@ struct z3fold_buddy_slots { |
21418 |
+ * be enough slots to hold all possible variants |
21419 |
+ */ |
21420 |
+ unsigned long slot[BUDDY_MASK + 1]; |
21421 |
+- unsigned long pool; /* back link + flags */ |
21422 |
++ unsigned long pool; /* back link */ |
21423 |
+ rwlock_t lock; |
21424 |
+ }; |
21425 |
+ #define HANDLE_FLAG_MASK (0x03) |
21426 |
+@@ -185,7 +185,7 @@ enum z3fold_page_flags { |
21427 |
+ * handle flags, go under HANDLE_FLAG_MASK |
21428 |
+ */ |
21429 |
+ enum z3fold_handle_flags { |
21430 |
+- HANDLES_ORPHANED = 0, |
21431 |
++ HANDLES_NOFREE = 0, |
21432 |
+ }; |
21433 |
+ |
21434 |
+ /* |
21435 |
+@@ -303,10 +303,9 @@ static inline void put_z3fold_header(struct z3fold_header *zhdr) |
21436 |
+ z3fold_page_unlock(zhdr); |
21437 |
+ } |
21438 |
+ |
21439 |
+-static inline void free_handle(unsigned long handle) |
21440 |
++static inline void free_handle(unsigned long handle, struct z3fold_header *zhdr) |
21441 |
+ { |
21442 |
+ struct z3fold_buddy_slots *slots; |
21443 |
+- struct z3fold_header *zhdr; |
21444 |
+ int i; |
21445 |
+ bool is_free; |
21446 |
+ |
21447 |
+@@ -316,22 +315,19 @@ static inline void free_handle(unsigned long handle) |
21448 |
+ if (WARN_ON(*(unsigned long *)handle == 0)) |
21449 |
+ return; |
21450 |
+ |
21451 |
+- zhdr = handle_to_z3fold_header(handle); |
21452 |
+ slots = handle_to_slots(handle); |
21453 |
+ write_lock(&slots->lock); |
21454 |
+ *(unsigned long *)handle = 0; |
21455 |
+- if (zhdr->slots == slots) { |
21456 |
++ |
21457 |
++ if (test_bit(HANDLES_NOFREE, &slots->pool)) { |
21458 |
+ write_unlock(&slots->lock); |
21459 |
+ return; /* simple case, nothing else to do */ |
21460 |
+ } |
21461 |
+ |
21462 |
+- /* we are freeing a foreign handle if we are here */ |
21463 |
+- zhdr->foreign_handles--; |
21464 |
++ if (zhdr->slots != slots) |
21465 |
++ zhdr->foreign_handles--; |
21466 |
++ |
21467 |
+ is_free = true; |
21468 |
+- if (!test_bit(HANDLES_ORPHANED, &slots->pool)) { |
21469 |
+- write_unlock(&slots->lock); |
21470 |
+- return; |
21471 |
+- } |
21472 |
+ for (i = 0; i <= BUDDY_MASK; i++) { |
21473 |
+ if (slots->slot[i]) { |
21474 |
+ is_free = false; |
21475 |
+@@ -343,6 +339,8 @@ static inline void free_handle(unsigned long handle) |
21476 |
+ if (is_free) { |
21477 |
+ struct z3fold_pool *pool = slots_to_pool(slots); |
21478 |
+ |
21479 |
++ if (zhdr->slots == slots) |
21480 |
++ zhdr->slots = NULL; |
21481 |
+ kmem_cache_free(pool->c_handle, slots); |
21482 |
+ } |
21483 |
+ } |
21484 |
+@@ -525,8 +523,6 @@ static void __release_z3fold_page(struct z3fold_header *zhdr, bool locked) |
21485 |
+ { |
21486 |
+ struct page *page = virt_to_page(zhdr); |
21487 |
+ struct z3fold_pool *pool = zhdr_to_pool(zhdr); |
21488 |
+- bool is_free = true; |
21489 |
+- int i; |
21490 |
+ |
21491 |
+ WARN_ON(!list_empty(&zhdr->buddy)); |
21492 |
+ set_bit(PAGE_STALE, &page->private); |
21493 |
+@@ -536,21 +532,6 @@ static void __release_z3fold_page(struct z3fold_header *zhdr, bool locked) |
21494 |
+ list_del_init(&page->lru); |
21495 |
+ spin_unlock(&pool->lock); |
21496 |
+ |
21497 |
+- /* If there are no foreign handles, free the handles array */ |
21498 |
+- read_lock(&zhdr->slots->lock); |
21499 |
+- for (i = 0; i <= BUDDY_MASK; i++) { |
21500 |
+- if (zhdr->slots->slot[i]) { |
21501 |
+- is_free = false; |
21502 |
+- break; |
21503 |
+- } |
21504 |
+- } |
21505 |
+- if (!is_free) |
21506 |
+- set_bit(HANDLES_ORPHANED, &zhdr->slots->pool); |
21507 |
+- read_unlock(&zhdr->slots->lock); |
21508 |
+- |
21509 |
+- if (is_free) |
21510 |
+- kmem_cache_free(pool->c_handle, zhdr->slots); |
21511 |
+- |
21512 |
+ if (locked) |
21513 |
+ z3fold_page_unlock(zhdr); |
21514 |
+ |
21515 |
+@@ -653,6 +634,28 @@ static inline void add_to_unbuddied(struct z3fold_pool *pool, |
21516 |
+ } |
21517 |
+ } |
21518 |
+ |
21519 |
++static inline enum buddy get_free_buddy(struct z3fold_header *zhdr, int chunks) |
21520 |
++{ |
21521 |
++ enum buddy bud = HEADLESS; |
21522 |
++ |
21523 |
++ if (zhdr->middle_chunks) { |
21524 |
++ if (!zhdr->first_chunks && |
21525 |
++ chunks <= zhdr->start_middle - ZHDR_CHUNKS) |
21526 |
++ bud = FIRST; |
21527 |
++ else if (!zhdr->last_chunks) |
21528 |
++ bud = LAST; |
21529 |
++ } else { |
21530 |
++ if (!zhdr->first_chunks) |
21531 |
++ bud = FIRST; |
21532 |
++ else if (!zhdr->last_chunks) |
21533 |
++ bud = LAST; |
21534 |
++ else |
21535 |
++ bud = MIDDLE; |
21536 |
++ } |
21537 |
++ |
21538 |
++ return bud; |
21539 |
++} |
21540 |
++ |
21541 |
+ static inline void *mchunk_memmove(struct z3fold_header *zhdr, |
21542 |
+ unsigned short dst_chunk) |
21543 |
+ { |
21544 |
+@@ -714,18 +717,7 @@ static struct z3fold_header *compact_single_buddy(struct z3fold_header *zhdr) |
21545 |
+ if (WARN_ON(new_zhdr == zhdr)) |
21546 |
+ goto out_fail; |
21547 |
+ |
21548 |
+- if (new_zhdr->first_chunks == 0) { |
21549 |
+- if (new_zhdr->middle_chunks != 0 && |
21550 |
+- chunks >= new_zhdr->start_middle) { |
21551 |
+- new_bud = LAST; |
21552 |
+- } else { |
21553 |
+- new_bud = FIRST; |
21554 |
+- } |
21555 |
+- } else if (new_zhdr->last_chunks == 0) { |
21556 |
+- new_bud = LAST; |
21557 |
+- } else if (new_zhdr->middle_chunks == 0) { |
21558 |
+- new_bud = MIDDLE; |
21559 |
+- } |
21560 |
++ new_bud = get_free_buddy(new_zhdr, chunks); |
21561 |
+ q = new_zhdr; |
21562 |
+ switch (new_bud) { |
21563 |
+ case FIRST: |
21564 |
+@@ -847,9 +839,8 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked) |
21565 |
+ return; |
21566 |
+ } |
21567 |
+ |
21568 |
+- if (unlikely(PageIsolated(page) || |
21569 |
+- test_bit(PAGE_CLAIMED, &page->private) || |
21570 |
+- test_bit(PAGE_STALE, &page->private))) { |
21571 |
++ if (test_bit(PAGE_STALE, &page->private) || |
21572 |
++ test_and_set_bit(PAGE_CLAIMED, &page->private)) { |
21573 |
+ z3fold_page_unlock(zhdr); |
21574 |
+ return; |
21575 |
+ } |
21576 |
+@@ -858,13 +849,16 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked) |
21577 |
+ zhdr->mapped_count == 0 && compact_single_buddy(zhdr)) { |
21578 |
+ if (kref_put(&zhdr->refcount, release_z3fold_page_locked)) |
21579 |
+ atomic64_dec(&pool->pages_nr); |
21580 |
+- else |
21581 |
++ else { |
21582 |
++ clear_bit(PAGE_CLAIMED, &page->private); |
21583 |
+ z3fold_page_unlock(zhdr); |
21584 |
++ } |
21585 |
+ return; |
21586 |
+ } |
21587 |
+ |
21588 |
+ z3fold_compact_page(zhdr); |
21589 |
+ add_to_unbuddied(pool, zhdr); |
21590 |
++ clear_bit(PAGE_CLAIMED, &page->private); |
21591 |
+ z3fold_page_unlock(zhdr); |
21592 |
+ } |
21593 |
+ |
21594 |
+@@ -973,6 +967,9 @@ lookup: |
21595 |
+ } |
21596 |
+ } |
21597 |
+ |
21598 |
++ if (zhdr && !zhdr->slots) |
21599 |
++ zhdr->slots = alloc_slots(pool, |
21600 |
++ can_sleep ? GFP_NOIO : GFP_ATOMIC); |
21601 |
+ return zhdr; |
21602 |
+ } |
21603 |
+ |
21604 |
+@@ -1109,17 +1106,8 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp, |
21605 |
+ retry: |
21606 |
+ zhdr = __z3fold_alloc(pool, size, can_sleep); |
21607 |
+ if (zhdr) { |
21608 |
+- if (zhdr->first_chunks == 0) { |
21609 |
+- if (zhdr->middle_chunks != 0 && |
21610 |
+- chunks >= zhdr->start_middle) |
21611 |
+- bud = LAST; |
21612 |
+- else |
21613 |
+- bud = FIRST; |
21614 |
+- } else if (zhdr->last_chunks == 0) |
21615 |
+- bud = LAST; |
21616 |
+- else if (zhdr->middle_chunks == 0) |
21617 |
+- bud = MIDDLE; |
21618 |
+- else { |
21619 |
++ bud = get_free_buddy(zhdr, chunks); |
21620 |
++ if (bud == HEADLESS) { |
21621 |
+ if (kref_put(&zhdr->refcount, |
21622 |
+ release_z3fold_page_locked)) |
21623 |
+ atomic64_dec(&pool->pages_nr); |
21624 |
+@@ -1265,12 +1253,11 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) |
21625 |
+ pr_err("%s: unknown bud %d\n", __func__, bud); |
21626 |
+ WARN_ON(1); |
21627 |
+ put_z3fold_header(zhdr); |
21628 |
+- clear_bit(PAGE_CLAIMED, &page->private); |
21629 |
+ return; |
21630 |
+ } |
21631 |
+ |
21632 |
+ if (!page_claimed) |
21633 |
+- free_handle(handle); |
21634 |
++ free_handle(handle, zhdr); |
21635 |
+ if (kref_put(&zhdr->refcount, release_z3fold_page_locked_list)) { |
21636 |
+ atomic64_dec(&pool->pages_nr); |
21637 |
+ return; |
21638 |
+@@ -1280,8 +1267,7 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) |
21639 |
+ z3fold_page_unlock(zhdr); |
21640 |
+ return; |
21641 |
+ } |
21642 |
+- if (unlikely(PageIsolated(page)) || |
21643 |
+- test_and_set_bit(NEEDS_COMPACTING, &page->private)) { |
21644 |
++ if (test_and_set_bit(NEEDS_COMPACTING, &page->private)) { |
21645 |
+ put_z3fold_header(zhdr); |
21646 |
+ clear_bit(PAGE_CLAIMED, &page->private); |
21647 |
+ return; |
21648 |
+@@ -1345,6 +1331,10 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) |
21649 |
+ struct page *page = NULL; |
21650 |
+ struct list_head *pos; |
21651 |
+ unsigned long first_handle = 0, middle_handle = 0, last_handle = 0; |
21652 |
++ struct z3fold_buddy_slots slots __attribute__((aligned(SLOTS_ALIGN))); |
21653 |
++ |
21654 |
++ rwlock_init(&slots.lock); |
21655 |
++ slots.pool = (unsigned long)pool | (1 << HANDLES_NOFREE); |
21656 |
+ |
21657 |
+ spin_lock(&pool->lock); |
21658 |
+ if (!pool->ops || !pool->ops->evict || retries == 0) { |
21659 |
+@@ -1359,35 +1349,36 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) |
21660 |
+ list_for_each_prev(pos, &pool->lru) { |
21661 |
+ page = list_entry(pos, struct page, lru); |
21662 |
+ |
21663 |
+- /* this bit could have been set by free, in which case |
21664 |
+- * we pass over to the next page in the pool. |
21665 |
+- */ |
21666 |
+- if (test_and_set_bit(PAGE_CLAIMED, &page->private)) { |
21667 |
+- page = NULL; |
21668 |
+- continue; |
21669 |
+- } |
21670 |
+- |
21671 |
+- if (unlikely(PageIsolated(page))) { |
21672 |
+- clear_bit(PAGE_CLAIMED, &page->private); |
21673 |
+- page = NULL; |
21674 |
+- continue; |
21675 |
+- } |
21676 |
+ zhdr = page_address(page); |
21677 |
+ if (test_bit(PAGE_HEADLESS, &page->private)) |
21678 |
+ break; |
21679 |
+ |
21680 |
++ if (kref_get_unless_zero(&zhdr->refcount) == 0) { |
21681 |
++ zhdr = NULL; |
21682 |
++ break; |
21683 |
++ } |
21684 |
+ if (!z3fold_page_trylock(zhdr)) { |
21685 |
+- clear_bit(PAGE_CLAIMED, &page->private); |
21686 |
++ if (kref_put(&zhdr->refcount, |
21687 |
++ release_z3fold_page)) |
21688 |
++ atomic64_dec(&pool->pages_nr); |
21689 |
+ zhdr = NULL; |
21690 |
+ continue; /* can't evict at this point */ |
21691 |
+ } |
21692 |
+- if (zhdr->foreign_handles) { |
21693 |
+- clear_bit(PAGE_CLAIMED, &page->private); |
21694 |
+- z3fold_page_unlock(zhdr); |
21695 |
++ |
21696 |
++ /* test_and_set_bit is of course atomic, but we still |
21697 |
++ * need to do it under page lock, otherwise checking |
21698 |
++ * that bit in __z3fold_alloc wouldn't make sense |
21699 |
++ */ |
21700 |
++ if (zhdr->foreign_handles || |
21701 |
++ test_and_set_bit(PAGE_CLAIMED, &page->private)) { |
21702 |
++ if (kref_put(&zhdr->refcount, |
21703 |
++ release_z3fold_page)) |
21704 |
++ atomic64_dec(&pool->pages_nr); |
21705 |
++ else |
21706 |
++ z3fold_page_unlock(zhdr); |
21707 |
+ zhdr = NULL; |
21708 |
+ continue; /* can't evict such page */ |
21709 |
+ } |
21710 |
+- kref_get(&zhdr->refcount); |
21711 |
+ list_del_init(&zhdr->buddy); |
21712 |
+ zhdr->cpu = -1; |
21713 |
+ break; |
21714 |
+@@ -1409,12 +1400,16 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) |
21715 |
+ first_handle = 0; |
21716 |
+ last_handle = 0; |
21717 |
+ middle_handle = 0; |
21718 |
++ memset(slots.slot, 0, sizeof(slots.slot)); |
21719 |
+ if (zhdr->first_chunks) |
21720 |
+- first_handle = encode_handle(zhdr, FIRST); |
21721 |
++ first_handle = __encode_handle(zhdr, &slots, |
21722 |
++ FIRST); |
21723 |
+ if (zhdr->middle_chunks) |
21724 |
+- middle_handle = encode_handle(zhdr, MIDDLE); |
21725 |
++ middle_handle = __encode_handle(zhdr, &slots, |
21726 |
++ MIDDLE); |
21727 |
+ if (zhdr->last_chunks) |
21728 |
+- last_handle = encode_handle(zhdr, LAST); |
21729 |
++ last_handle = __encode_handle(zhdr, &slots, |
21730 |
++ LAST); |
21731 |
+ /* |
21732 |
+ * it's safe to unlock here because we hold a |
21733 |
+ * reference to this page |
21734 |
+@@ -1429,19 +1424,16 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) |
21735 |
+ ret = pool->ops->evict(pool, middle_handle); |
21736 |
+ if (ret) |
21737 |
+ goto next; |
21738 |
+- free_handle(middle_handle); |
21739 |
+ } |
21740 |
+ if (first_handle) { |
21741 |
+ ret = pool->ops->evict(pool, first_handle); |
21742 |
+ if (ret) |
21743 |
+ goto next; |
21744 |
+- free_handle(first_handle); |
21745 |
+ } |
21746 |
+ if (last_handle) { |
21747 |
+ ret = pool->ops->evict(pool, last_handle); |
21748 |
+ if (ret) |
21749 |
+ goto next; |
21750 |
+- free_handle(last_handle); |
21751 |
+ } |
21752 |
+ next: |
21753 |
+ if (test_bit(PAGE_HEADLESS, &page->private)) { |
21754 |
+@@ -1455,9 +1447,11 @@ next: |
21755 |
+ spin_unlock(&pool->lock); |
21756 |
+ clear_bit(PAGE_CLAIMED, &page->private); |
21757 |
+ } else { |
21758 |
++ struct z3fold_buddy_slots *slots = zhdr->slots; |
21759 |
+ z3fold_page_lock(zhdr); |
21760 |
+ if (kref_put(&zhdr->refcount, |
21761 |
+ release_z3fold_page_locked)) { |
21762 |
++ kmem_cache_free(pool->c_handle, slots); |
21763 |
+ atomic64_dec(&pool->pages_nr); |
21764 |
+ return 0; |
21765 |
+ } |
21766 |
+@@ -1573,8 +1567,7 @@ static bool z3fold_page_isolate(struct page *page, isolate_mode_t mode) |
21767 |
+ VM_BUG_ON_PAGE(!PageMovable(page), page); |
21768 |
+ VM_BUG_ON_PAGE(PageIsolated(page), page); |
21769 |
+ |
21770 |
+- if (test_bit(PAGE_HEADLESS, &page->private) || |
21771 |
+- test_bit(PAGE_CLAIMED, &page->private)) |
21772 |
++ if (test_bit(PAGE_HEADLESS, &page->private)) |
21773 |
+ return false; |
21774 |
+ |
21775 |
+ zhdr = page_address(page); |
21776 |
+@@ -1586,6 +1579,8 @@ static bool z3fold_page_isolate(struct page *page, isolate_mode_t mode) |
21777 |
+ if (zhdr->mapped_count != 0 || zhdr->foreign_handles != 0) |
21778 |
+ goto out; |
21779 |
+ |
21780 |
++ if (test_and_set_bit(PAGE_CLAIMED, &page->private)) |
21781 |
++ goto out; |
21782 |
+ pool = zhdr_to_pool(zhdr); |
21783 |
+ spin_lock(&pool->lock); |
21784 |
+ if (!list_empty(&zhdr->buddy)) |
21785 |
+@@ -1612,16 +1607,17 @@ static int z3fold_page_migrate(struct address_space *mapping, struct page *newpa |
21786 |
+ |
21787 |
+ VM_BUG_ON_PAGE(!PageMovable(page), page); |
21788 |
+ VM_BUG_ON_PAGE(!PageIsolated(page), page); |
21789 |
++ VM_BUG_ON_PAGE(!test_bit(PAGE_CLAIMED, &page->private), page); |
21790 |
+ VM_BUG_ON_PAGE(!PageLocked(newpage), newpage); |
21791 |
+ |
21792 |
+ zhdr = page_address(page); |
21793 |
+ pool = zhdr_to_pool(zhdr); |
21794 |
+ |
21795 |
+- if (!z3fold_page_trylock(zhdr)) { |
21796 |
++ if (!z3fold_page_trylock(zhdr)) |
21797 |
+ return -EAGAIN; |
21798 |
+- } |
21799 |
+ if (zhdr->mapped_count != 0 || zhdr->foreign_handles != 0) { |
21800 |
+ z3fold_page_unlock(zhdr); |
21801 |
++ clear_bit(PAGE_CLAIMED, &page->private); |
21802 |
+ return -EBUSY; |
21803 |
+ } |
21804 |
+ if (work_pending(&zhdr->work)) { |
21805 |
+@@ -1663,6 +1659,7 @@ static int z3fold_page_migrate(struct address_space *mapping, struct page *newpa |
21806 |
+ queue_work_on(new_zhdr->cpu, pool->compact_wq, &new_zhdr->work); |
21807 |
+ |
21808 |
+ page_mapcount_reset(page); |
21809 |
++ clear_bit(PAGE_CLAIMED, &page->private); |
21810 |
+ put_page(page); |
21811 |
+ return 0; |
21812 |
+ } |
21813 |
+@@ -1686,6 +1683,7 @@ static void z3fold_page_putback(struct page *page) |
21814 |
+ spin_lock(&pool->lock); |
21815 |
+ list_add(&page->lru, &pool->lru); |
21816 |
+ spin_unlock(&pool->lock); |
21817 |
++ clear_bit(PAGE_CLAIMED, &page->private); |
21818 |
+ z3fold_page_unlock(zhdr); |
21819 |
+ } |
21820 |
+ |
21821 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
21822 |
+index cbdf2a5559754..17a72695865b5 100644 |
21823 |
+--- a/net/bluetooth/hci_event.c |
21824 |
++++ b/net/bluetooth/hci_event.c |
21825 |
+@@ -4941,6 +4941,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev, |
21826 |
+ return; |
21827 |
+ } |
21828 |
+ |
21829 |
++ if (!hcon->amp_mgr) { |
21830 |
++ hci_dev_unlock(hdev); |
21831 |
++ return; |
21832 |
++ } |
21833 |
++ |
21834 |
+ if (ev->status) { |
21835 |
+ hci_conn_del(hcon); |
21836 |
+ hci_dev_unlock(hdev); |
21837 |
+diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c |
21838 |
+index 6f12bab4d2fa6..610ed0817bd77 100644 |
21839 |
+--- a/net/bluetooth/hci_request.c |
21840 |
++++ b/net/bluetooth/hci_request.c |
21841 |
+@@ -698,7 +698,8 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr, |
21842 |
+ cp.bdaddr_type); |
21843 |
+ hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp); |
21844 |
+ |
21845 |
+- if (use_ll_privacy(req->hdev)) { |
21846 |
++ if (use_ll_privacy(req->hdev) && |
21847 |
++ hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) { |
21848 |
+ struct smp_irk *irk; |
21849 |
+ |
21850 |
+ irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type); |
21851 |
+@@ -732,7 +733,8 @@ static int add_to_white_list(struct hci_request *req, |
21852 |
+ return -1; |
21853 |
+ |
21854 |
+ /* White list can not be used with RPAs */ |
21855 |
+- if (!allow_rpa && !use_ll_privacy(hdev) && |
21856 |
++ if (!allow_rpa && |
21857 |
++ !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) && |
21858 |
+ hci_find_irk_by_addr(hdev, ¶ms->addr, params->addr_type)) { |
21859 |
+ return -1; |
21860 |
+ } |
21861 |
+@@ -750,7 +752,8 @@ static int add_to_white_list(struct hci_request *req, |
21862 |
+ cp.bdaddr_type); |
21863 |
+ hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp); |
21864 |
+ |
21865 |
+- if (use_ll_privacy(hdev)) { |
21866 |
++ if (use_ll_privacy(hdev) && |
21867 |
++ hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) { |
21868 |
+ struct smp_irk *irk; |
21869 |
+ |
21870 |
+ irk = hci_find_irk_by_addr(hdev, ¶ms->addr, |
21871 |
+@@ -812,7 +815,8 @@ static u8 update_white_list(struct hci_request *req) |
21872 |
+ } |
21873 |
+ |
21874 |
+ /* White list can not be used with RPAs */ |
21875 |
+- if (!allow_rpa && !use_ll_privacy(hdev) && |
21876 |
++ if (!allow_rpa && |
21877 |
++ !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) && |
21878 |
+ hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) { |
21879 |
+ return 0x00; |
21880 |
+ } |
21881 |
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c |
21882 |
+index 79ffcdef0b7ad..22a110f37abc6 100644 |
21883 |
+--- a/net/bluetooth/sco.c |
21884 |
++++ b/net/bluetooth/sco.c |
21885 |
+@@ -1003,6 +1003,11 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, |
21886 |
+ |
21887 |
+ case BT_SNDMTU: |
21888 |
+ case BT_RCVMTU: |
21889 |
++ if (sk->sk_state != BT_CONNECTED) { |
21890 |
++ err = -ENOTCONN; |
21891 |
++ break; |
21892 |
++ } |
21893 |
++ |
21894 |
+ if (put_user(sco_pi(sk)->conn->mtu, (u32 __user *)optval)) |
21895 |
+ err = -EFAULT; |
21896 |
+ break; |
21897 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
21898 |
+index 1e2e5a406d587..2a5a11f92b03e 100644 |
21899 |
+--- a/net/mac80211/rx.c |
21900 |
++++ b/net/mac80211/rx.c |
21901 |
+@@ -1758,7 +1758,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) |
21902 |
+ } else if (rx->sdata->vif.type == NL80211_IFTYPE_OCB) { |
21903 |
+ sta->rx_stats.last_rx = jiffies; |
21904 |
+ } else if (!ieee80211_is_s1g_beacon(hdr->frame_control) && |
21905 |
+- is_multicast_ether_addr(hdr->addr1)) { |
21906 |
++ !is_multicast_ether_addr(hdr->addr1)) { |
21907 |
+ /* |
21908 |
+ * Mesh beacons will update last_rx when if they are found to |
21909 |
+ * match the current local configuration when processed. |
21910 |
+diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c |
21911 |
+index fb0e3a657d2d3..c3ca973737742 100644 |
21912 |
+--- a/net/mac80211/vht.c |
21913 |
++++ b/net/mac80211/vht.c |
21914 |
+@@ -465,12 +465,18 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta) |
21915 |
+ * IEEE80211-2016 specification makes higher bandwidth operation |
21916 |
+ * possible on the TDLS link if the peers have wider bandwidth |
21917 |
+ * capability. |
21918 |
++ * |
21919 |
++ * However, in this case, and only if the TDLS peer is authorized, |
21920 |
++ * limit to the tdls_chandef so that the configuration here isn't |
21921 |
++ * wider than what's actually requested on the channel context. |
21922 |
+ */ |
21923 |
+ if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && |
21924 |
+- test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW)) |
21925 |
+- return bw; |
21926 |
+- |
21927 |
+- bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width)); |
21928 |
++ test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW) && |
21929 |
++ test_sta_flag(sta, WLAN_STA_AUTHORIZED) && |
21930 |
++ sta->tdls_chandef.chan) |
21931 |
++ bw = min(bw, ieee80211_chan_width_to_rx_bw(sta->tdls_chandef.width)); |
21932 |
++ else |
21933 |
++ bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width)); |
21934 |
+ |
21935 |
+ return bw; |
21936 |
+ } |
21937 |
+diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c |
21938 |
+index fd9bca2427242..56029e3af6ff0 100644 |
21939 |
+--- a/net/sunrpc/debugfs.c |
21940 |
++++ b/net/sunrpc/debugfs.c |
21941 |
+@@ -128,13 +128,13 @@ static int do_xprt_debugfs(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *n |
21942 |
+ return 0; |
21943 |
+ len = snprintf(name, sizeof(name), "../../rpc_xprt/%s", |
21944 |
+ xprt->debugfs->d_name.name); |
21945 |
+- if (len > sizeof(name)) |
21946 |
++ if (len >= sizeof(name)) |
21947 |
+ return -1; |
21948 |
+ if (*nump == 0) |
21949 |
+ strcpy(link, "xprt"); |
21950 |
+ else { |
21951 |
+ len = snprintf(link, sizeof(link), "xprt%d", *nump); |
21952 |
+- if (len > sizeof(link)) |
21953 |
++ if (len >= sizeof(link)) |
21954 |
+ return -1; |
21955 |
+ } |
21956 |
+ debugfs_create_symlink(link, clnt->cl_debugfs, name); |
21957 |
+diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
21958 |
+index f06d7c315017c..cf702a5f7fe5d 100644 |
21959 |
+--- a/net/sunrpc/sched.c |
21960 |
++++ b/net/sunrpc/sched.c |
21961 |
+@@ -675,6 +675,23 @@ struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *queue) |
21962 |
+ } |
21963 |
+ EXPORT_SYMBOL_GPL(rpc_wake_up_next); |
21964 |
+ |
21965 |
++/** |
21966 |
++ * rpc_wake_up_locked - wake up all rpc_tasks |
21967 |
++ * @queue: rpc_wait_queue on which the tasks are sleeping |
21968 |
++ * |
21969 |
++ */ |
21970 |
++static void rpc_wake_up_locked(struct rpc_wait_queue *queue) |
21971 |
++{ |
21972 |
++ struct rpc_task *task; |
21973 |
++ |
21974 |
++ for (;;) { |
21975 |
++ task = __rpc_find_next_queued(queue); |
21976 |
++ if (task == NULL) |
21977 |
++ break; |
21978 |
++ rpc_wake_up_task_queue_locked(queue, task); |
21979 |
++ } |
21980 |
++} |
21981 |
++ |
21982 |
+ /** |
21983 |
+ * rpc_wake_up - wake up all rpc_tasks |
21984 |
+ * @queue: rpc_wait_queue on which the tasks are sleeping |
21985 |
+@@ -683,25 +700,28 @@ EXPORT_SYMBOL_GPL(rpc_wake_up_next); |
21986 |
+ */ |
21987 |
+ void rpc_wake_up(struct rpc_wait_queue *queue) |
21988 |
+ { |
21989 |
+- struct list_head *head; |
21990 |
+- |
21991 |
+ spin_lock(&queue->lock); |
21992 |
+- head = &queue->tasks[queue->maxpriority]; |
21993 |
++ rpc_wake_up_locked(queue); |
21994 |
++ spin_unlock(&queue->lock); |
21995 |
++} |
21996 |
++EXPORT_SYMBOL_GPL(rpc_wake_up); |
21997 |
++ |
21998 |
++/** |
21999 |
++ * rpc_wake_up_status_locked - wake up all rpc_tasks and set their status value. |
22000 |
++ * @queue: rpc_wait_queue on which the tasks are sleeping |
22001 |
++ * @status: status value to set |
22002 |
++ */ |
22003 |
++static void rpc_wake_up_status_locked(struct rpc_wait_queue *queue, int status) |
22004 |
++{ |
22005 |
++ struct rpc_task *task; |
22006 |
++ |
22007 |
+ for (;;) { |
22008 |
+- while (!list_empty(head)) { |
22009 |
+- struct rpc_task *task; |
22010 |
+- task = list_first_entry(head, |
22011 |
+- struct rpc_task, |
22012 |
+- u.tk_wait.list); |
22013 |
+- rpc_wake_up_task_queue_locked(queue, task); |
22014 |
+- } |
22015 |
+- if (head == &queue->tasks[0]) |
22016 |
++ task = __rpc_find_next_queued(queue); |
22017 |
++ if (task == NULL) |
22018 |
+ break; |
22019 |
+- head--; |
22020 |
++ rpc_wake_up_task_queue_set_status_locked(queue, task, status); |
22021 |
+ } |
22022 |
+- spin_unlock(&queue->lock); |
22023 |
+ } |
22024 |
+-EXPORT_SYMBOL_GPL(rpc_wake_up); |
22025 |
+ |
22026 |
+ /** |
22027 |
+ * rpc_wake_up_status - wake up all rpc_tasks and set their status value. |
22028 |
+@@ -712,23 +732,8 @@ EXPORT_SYMBOL_GPL(rpc_wake_up); |
22029 |
+ */ |
22030 |
+ void rpc_wake_up_status(struct rpc_wait_queue *queue, int status) |
22031 |
+ { |
22032 |
+- struct list_head *head; |
22033 |
+- |
22034 |
+ spin_lock(&queue->lock); |
22035 |
+- head = &queue->tasks[queue->maxpriority]; |
22036 |
+- for (;;) { |
22037 |
+- while (!list_empty(head)) { |
22038 |
+- struct rpc_task *task; |
22039 |
+- task = list_first_entry(head, |
22040 |
+- struct rpc_task, |
22041 |
+- u.tk_wait.list); |
22042 |
+- task->tk_status = status; |
22043 |
+- rpc_wake_up_task_queue_locked(queue, task); |
22044 |
+- } |
22045 |
+- if (head == &queue->tasks[0]) |
22046 |
+- break; |
22047 |
+- head--; |
22048 |
+- } |
22049 |
++ rpc_wake_up_status_locked(queue, status); |
22050 |
+ spin_unlock(&queue->lock); |
22051 |
+ } |
22052 |
+ EXPORT_SYMBOL_GPL(rpc_wake_up_status); |
22053 |
+diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c |
22054 |
+index f6c17e75f20ed..57f09ea3ef2af 100644 |
22055 |
+--- a/net/sunrpc/xprt.c |
22056 |
++++ b/net/sunrpc/xprt.c |
22057 |
+@@ -151,31 +151,64 @@ out: |
22058 |
+ } |
22059 |
+ EXPORT_SYMBOL_GPL(xprt_unregister_transport); |
22060 |
+ |
22061 |
++static void |
22062 |
++xprt_class_release(const struct xprt_class *t) |
22063 |
++{ |
22064 |
++ module_put(t->owner); |
22065 |
++} |
22066 |
++ |
22067 |
++static const struct xprt_class * |
22068 |
++xprt_class_find_by_netid_locked(const char *netid) |
22069 |
++{ |
22070 |
++ const struct xprt_class *t; |
22071 |
++ unsigned int i; |
22072 |
++ |
22073 |
++ list_for_each_entry(t, &xprt_list, list) { |
22074 |
++ for (i = 0; t->netid[i][0] != '\0'; i++) { |
22075 |
++ if (strcmp(t->netid[i], netid) != 0) |
22076 |
++ continue; |
22077 |
++ if (!try_module_get(t->owner)) |
22078 |
++ continue; |
22079 |
++ return t; |
22080 |
++ } |
22081 |
++ } |
22082 |
++ return NULL; |
22083 |
++} |
22084 |
++ |
22085 |
++static const struct xprt_class * |
22086 |
++xprt_class_find_by_netid(const char *netid) |
22087 |
++{ |
22088 |
++ const struct xprt_class *t; |
22089 |
++ |
22090 |
++ spin_lock(&xprt_list_lock); |
22091 |
++ t = xprt_class_find_by_netid_locked(netid); |
22092 |
++ if (!t) { |
22093 |
++ spin_unlock(&xprt_list_lock); |
22094 |
++ request_module("rpc%s", netid); |
22095 |
++ spin_lock(&xprt_list_lock); |
22096 |
++ t = xprt_class_find_by_netid_locked(netid); |
22097 |
++ } |
22098 |
++ spin_unlock(&xprt_list_lock); |
22099 |
++ return t; |
22100 |
++} |
22101 |
++ |
22102 |
+ /** |
22103 |
+ * xprt_load_transport - load a transport implementation |
22104 |
+- * @transport_name: transport to load |
22105 |
++ * @netid: transport to load |
22106 |
+ * |
22107 |
+ * Returns: |
22108 |
+ * 0: transport successfully loaded |
22109 |
+ * -ENOENT: transport module not available |
22110 |
+ */ |
22111 |
+-int xprt_load_transport(const char *transport_name) |
22112 |
++int xprt_load_transport(const char *netid) |
22113 |
+ { |
22114 |
+- struct xprt_class *t; |
22115 |
+- int result; |
22116 |
++ const struct xprt_class *t; |
22117 |
+ |
22118 |
+- result = 0; |
22119 |
+- spin_lock(&xprt_list_lock); |
22120 |
+- list_for_each_entry(t, &xprt_list, list) { |
22121 |
+- if (strcmp(t->name, transport_name) == 0) { |
22122 |
+- spin_unlock(&xprt_list_lock); |
22123 |
+- goto out; |
22124 |
+- } |
22125 |
+- } |
22126 |
+- spin_unlock(&xprt_list_lock); |
22127 |
+- result = request_module("xprt%s", transport_name); |
22128 |
+-out: |
22129 |
+- return result; |
22130 |
++ t = xprt_class_find_by_netid(netid); |
22131 |
++ if (!t) |
22132 |
++ return -ENOENT; |
22133 |
++ xprt_class_release(t); |
22134 |
++ return 0; |
22135 |
+ } |
22136 |
+ EXPORT_SYMBOL_GPL(xprt_load_transport); |
22137 |
+ |
22138 |
+diff --git a/net/sunrpc/xprtrdma/module.c b/net/sunrpc/xprtrdma/module.c |
22139 |
+index 620327c01302c..45c5b41ac8dc9 100644 |
22140 |
+--- a/net/sunrpc/xprtrdma/module.c |
22141 |
++++ b/net/sunrpc/xprtrdma/module.c |
22142 |
+@@ -24,6 +24,7 @@ MODULE_DESCRIPTION("RPC/RDMA Transport"); |
22143 |
+ MODULE_LICENSE("Dual BSD/GPL"); |
22144 |
+ MODULE_ALIAS("svcrdma"); |
22145 |
+ MODULE_ALIAS("xprtrdma"); |
22146 |
++MODULE_ALIAS("rpcrdma6"); |
22147 |
+ |
22148 |
+ static void __exit rpc_rdma_cleanup(void) |
22149 |
+ { |
22150 |
+diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c |
22151 |
+index 0f5120c7668ff..c48536f2121fb 100644 |
22152 |
+--- a/net/sunrpc/xprtrdma/rpc_rdma.c |
22153 |
++++ b/net/sunrpc/xprtrdma/rpc_rdma.c |
22154 |
+@@ -179,6 +179,31 @@ rpcrdma_nonpayload_inline(const struct rpcrdma_xprt *r_xprt, |
22155 |
+ r_xprt->rx_ep->re_max_inline_recv; |
22156 |
+ } |
22157 |
+ |
22158 |
++/* ACL likes to be lazy in allocating pages. For TCP, these |
22159 |
++ * pages can be allocated during receive processing. Not true |
22160 |
++ * for RDMA, which must always provision receive buffers |
22161 |
++ * up front. |
22162 |
++ */ |
22163 |
++static noinline int |
22164 |
++rpcrdma_alloc_sparse_pages(struct xdr_buf *buf) |
22165 |
++{ |
22166 |
++ struct page **ppages; |
22167 |
++ int len; |
22168 |
++ |
22169 |
++ len = buf->page_len; |
22170 |
++ ppages = buf->pages + (buf->page_base >> PAGE_SHIFT); |
22171 |
++ while (len > 0) { |
22172 |
++ if (!*ppages) |
22173 |
++ *ppages = alloc_page(GFP_NOWAIT | __GFP_NOWARN); |
22174 |
++ if (!*ppages) |
22175 |
++ return -ENOBUFS; |
22176 |
++ ppages++; |
22177 |
++ len -= PAGE_SIZE; |
22178 |
++ } |
22179 |
++ |
22180 |
++ return 0; |
22181 |
++} |
22182 |
++ |
22183 |
+ /* Split @vec on page boundaries into SGEs. FMR registers pages, not |
22184 |
+ * a byte range. Other modes coalesce these SGEs into a single MR |
22185 |
+ * when they can. |
22186 |
+@@ -233,15 +258,6 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf, |
22187 |
+ ppages = xdrbuf->pages + (xdrbuf->page_base >> PAGE_SHIFT); |
22188 |
+ page_base = offset_in_page(xdrbuf->page_base); |
22189 |
+ while (len) { |
22190 |
+- /* ACL likes to be lazy in allocating pages - ACLs |
22191 |
+- * are small by default but can get huge. |
22192 |
+- */ |
22193 |
+- if (unlikely(xdrbuf->flags & XDRBUF_SPARSE_PAGES)) { |
22194 |
+- if (!*ppages) |
22195 |
+- *ppages = alloc_page(GFP_NOWAIT | __GFP_NOWARN); |
22196 |
+- if (!*ppages) |
22197 |
+- return -ENOBUFS; |
22198 |
+- } |
22199 |
+ seg->mr_page = *ppages; |
22200 |
+ seg->mr_offset = (char *)page_base; |
22201 |
+ seg->mr_len = min_t(u32, PAGE_SIZE - page_base, len); |
22202 |
+@@ -867,6 +883,12 @@ rpcrdma_marshal_req(struct rpcrdma_xprt *r_xprt, struct rpc_rqst *rqst) |
22203 |
+ __be32 *p; |
22204 |
+ int ret; |
22205 |
+ |
22206 |
++ if (unlikely(rqst->rq_rcv_buf.flags & XDRBUF_SPARSE_PAGES)) { |
22207 |
++ ret = rpcrdma_alloc_sparse_pages(&rqst->rq_rcv_buf); |
22208 |
++ if (ret) |
22209 |
++ return ret; |
22210 |
++ } |
22211 |
++ |
22212 |
+ rpcrdma_set_xdrlen(&req->rl_hdrbuf, 0); |
22213 |
+ xdr_init_encode(xdr, &req->rl_hdrbuf, rdmab_data(req->rl_rdmabuf), |
22214 |
+ rqst); |
22215 |
+diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c |
22216 |
+index 8915e42240d38..035060c05fd5a 100644 |
22217 |
+--- a/net/sunrpc/xprtrdma/transport.c |
22218 |
++++ b/net/sunrpc/xprtrdma/transport.c |
22219 |
+@@ -768,6 +768,7 @@ static struct xprt_class xprt_rdma = { |
22220 |
+ .owner = THIS_MODULE, |
22221 |
+ .ident = XPRT_TRANSPORT_RDMA, |
22222 |
+ .setup = xprt_setup_rdma, |
22223 |
++ .netid = { "rdma", "rdma6", "" }, |
22224 |
+ }; |
22225 |
+ |
22226 |
+ void xprt_rdma_cleanup(void) |
22227 |
+diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
22228 |
+index 7090bbee0ec59..c56a66cdf4ac8 100644 |
22229 |
+--- a/net/sunrpc/xprtsock.c |
22230 |
++++ b/net/sunrpc/xprtsock.c |
22231 |
+@@ -433,7 +433,8 @@ xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags, |
22232 |
+ if (ret <= 0) |
22233 |
+ goto sock_err; |
22234 |
+ xs_flush_bvec(buf->bvec, ret, seek + buf->page_base); |
22235 |
+- offset += ret - buf->page_base; |
22236 |
++ ret -= buf->page_base; |
22237 |
++ offset += ret; |
22238 |
+ if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC)) |
22239 |
+ goto out; |
22240 |
+ if (ret != want) |
22241 |
+@@ -3059,6 +3060,7 @@ static struct xprt_class xs_local_transport = { |
22242 |
+ .owner = THIS_MODULE, |
22243 |
+ .ident = XPRT_TRANSPORT_LOCAL, |
22244 |
+ .setup = xs_setup_local, |
22245 |
++ .netid = { "" }, |
22246 |
+ }; |
22247 |
+ |
22248 |
+ static struct xprt_class xs_udp_transport = { |
22249 |
+@@ -3067,6 +3069,7 @@ static struct xprt_class xs_udp_transport = { |
22250 |
+ .owner = THIS_MODULE, |
22251 |
+ .ident = XPRT_TRANSPORT_UDP, |
22252 |
+ .setup = xs_setup_udp, |
22253 |
++ .netid = { "udp", "udp6", "" }, |
22254 |
+ }; |
22255 |
+ |
22256 |
+ static struct xprt_class xs_tcp_transport = { |
22257 |
+@@ -3075,6 +3078,7 @@ static struct xprt_class xs_tcp_transport = { |
22258 |
+ .owner = THIS_MODULE, |
22259 |
+ .ident = XPRT_TRANSPORT_TCP, |
22260 |
+ .setup = xs_setup_tcp, |
22261 |
++ .netid = { "tcp", "tcp6", "" }, |
22262 |
+ }; |
22263 |
+ |
22264 |
+ static struct xprt_class xs_bc_tcp_transport = { |
22265 |
+@@ -3083,6 +3087,7 @@ static struct xprt_class xs_bc_tcp_transport = { |
22266 |
+ .owner = THIS_MODULE, |
22267 |
+ .ident = XPRT_TRANSPORT_BC_TCP, |
22268 |
+ .setup = xs_setup_bc_tcp, |
22269 |
++ .netid = { "" }, |
22270 |
+ }; |
22271 |
+ |
22272 |
+ /** |
22273 |
+diff --git a/net/wireless/scan.c b/net/wireless/scan.c |
22274 |
+index 8d0e49c46db37..3409f37d838b3 100644 |
22275 |
+--- a/net/wireless/scan.c |
22276 |
++++ b/net/wireless/scan.c |
22277 |
+@@ -694,7 +694,7 @@ static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request, |
22278 |
+ static bool cfg80211_find_ssid_match(struct cfg80211_colocated_ap *ap, |
22279 |
+ struct cfg80211_scan_request *request) |
22280 |
+ { |
22281 |
+- u8 i; |
22282 |
++ int i; |
22283 |
+ u32 s_ssid; |
22284 |
+ |
22285 |
+ for (i = 0; i < request->n_ssids; i++) { |
22286 |
+diff --git a/samples/bpf/lwt_len_hist.sh b/samples/bpf/lwt_len_hist.sh |
22287 |
+old mode 100644 |
22288 |
+new mode 100755 |
22289 |
+index 090b96eaf7f76..0eda9754f50b8 |
22290 |
+--- a/samples/bpf/lwt_len_hist.sh |
22291 |
++++ b/samples/bpf/lwt_len_hist.sh |
22292 |
+@@ -8,6 +8,8 @@ VETH1=tst_lwt1b |
22293 |
+ TRACE_ROOT=/sys/kernel/debug/tracing |
22294 |
+ |
22295 |
+ function cleanup { |
22296 |
++ # To reset saved histogram, remove pinned map |
22297 |
++ rm /sys/fs/bpf/tc/globals/lwt_len_hist_map |
22298 |
+ ip route del 192.168.253.2/32 dev $VETH0 2> /dev/null |
22299 |
+ ip link del $VETH0 2> /dev/null |
22300 |
+ ip link del $VETH1 2> /dev/null |
22301 |
+diff --git a/samples/bpf/test_lwt_bpf.sh b/samples/bpf/test_lwt_bpf.sh |
22302 |
+old mode 100644 |
22303 |
+new mode 100755 |
22304 |
+diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c |
22305 |
+index 1149e94ca32fd..33c58de58626c 100644 |
22306 |
+--- a/samples/bpf/xdpsock_user.c |
22307 |
++++ b/samples/bpf/xdpsock_user.c |
22308 |
+@@ -1250,6 +1250,8 @@ static void tx_only(struct xsk_socket_info *xsk, u32 *frame_nb, int batch_size) |
22309 |
+ while (xsk_ring_prod__reserve(&xsk->tx, batch_size, &idx) < |
22310 |
+ batch_size) { |
22311 |
+ complete_tx_only(xsk, batch_size); |
22312 |
++ if (benchmark_done) |
22313 |
++ return; |
22314 |
+ } |
22315 |
+ |
22316 |
+ for (i = 0; i < batch_size; i++) { |
22317 |
+diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl |
22318 |
+index fab38b493cef7..0ad235ee96f91 100755 |
22319 |
+--- a/scripts/checkpatch.pl |
22320 |
++++ b/scripts/checkpatch.pl |
22321 |
+@@ -4384,7 +4384,7 @@ sub process { |
22322 |
+ $fix) { |
22323 |
+ fix_delete_line($fixlinenr, $rawline); |
22324 |
+ my $fixed_line = $rawline; |
22325 |
+- $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/; |
22326 |
++ $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/; |
22327 |
+ my $line1 = $1; |
22328 |
+ my $line2 = $2; |
22329 |
+ fix_insert_line($fixlinenr, ltrim($line1)); |
22330 |
+diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c |
22331 |
+index 0243086fb1685..0590f86df6e40 100644 |
22332 |
+--- a/scripts/kconfig/preprocess.c |
22333 |
++++ b/scripts/kconfig/preprocess.c |
22334 |
+@@ -114,7 +114,7 @@ static char *do_error_if(int argc, char *argv[]) |
22335 |
+ if (!strcmp(argv[0], "y")) |
22336 |
+ pperror("%s", argv[1]); |
22337 |
+ |
22338 |
+- return NULL; |
22339 |
++ return xstrdup(""); |
22340 |
+ } |
22341 |
+ |
22342 |
+ static char *do_filename(int argc, char *argv[]) |
22343 |
+diff --git a/scripts/kernel-doc b/scripts/kernel-doc |
22344 |
+index f699cf05d4098..6325bec3f66f8 100755 |
22345 |
+--- a/scripts/kernel-doc |
22346 |
++++ b/scripts/kernel-doc |
22347 |
+@@ -1390,7 +1390,7 @@ sub dump_enum($$) { |
22348 |
+ $members = $2; |
22349 |
+ } |
22350 |
+ |
22351 |
+- if ($declaration_name) { |
22352 |
++ if ($members) { |
22353 |
+ my %_members; |
22354 |
+ |
22355 |
+ $members =~ s/\s+$//; |
22356 |
+@@ -1431,7 +1431,7 @@ sub dump_enum($$) { |
22357 |
+ } |
22358 |
+ } |
22359 |
+ |
22360 |
+-my $typedef_type = qr { ((?:\s+[\w\*]+){1,8})\s* }x; |
22361 |
++my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x; |
22362 |
+ my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x; |
22363 |
+ my $typedef_args = qr { \s*\((.*)\); }x; |
22364 |
+ |
22365 |
+diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c |
22366 |
+index 21989fa0c1074..f6a7e9643b546 100644 |
22367 |
+--- a/security/integrity/ima/ima_crypto.c |
22368 |
++++ b/security/integrity/ima/ima_crypto.c |
22369 |
+@@ -537,7 +537,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
22370 |
+ loff_t i_size; |
22371 |
+ int rc; |
22372 |
+ struct file *f = file; |
22373 |
+- bool new_file_instance = false, modified_mode = false; |
22374 |
++ bool new_file_instance = false; |
22375 |
+ |
22376 |
+ /* |
22377 |
+ * For consistency, fail file's opened with the O_DIRECT flag on |
22378 |
+@@ -555,18 +555,10 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
22379 |
+ O_TRUNC | O_CREAT | O_NOCTTY | O_EXCL); |
22380 |
+ flags |= O_RDONLY; |
22381 |
+ f = dentry_open(&file->f_path, flags, file->f_cred); |
22382 |
+- if (IS_ERR(f)) { |
22383 |
+- /* |
22384 |
+- * Cannot open the file again, lets modify f_mode |
22385 |
+- * of original and continue |
22386 |
+- */ |
22387 |
+- pr_info_ratelimited("Unable to reopen file for reading.\n"); |
22388 |
+- f = file; |
22389 |
+- f->f_mode |= FMODE_READ; |
22390 |
+- modified_mode = true; |
22391 |
+- } else { |
22392 |
+- new_file_instance = true; |
22393 |
+- } |
22394 |
++ if (IS_ERR(f)) |
22395 |
++ return PTR_ERR(f); |
22396 |
++ |
22397 |
++ new_file_instance = true; |
22398 |
+ } |
22399 |
+ |
22400 |
+ i_size = i_size_read(file_inode(f)); |
22401 |
+@@ -581,8 +573,6 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) |
22402 |
+ out: |
22403 |
+ if (new_file_instance) |
22404 |
+ fput(f); |
22405 |
+- else if (modified_mode) |
22406 |
+- f->f_mode &= ~FMODE_READ; |
22407 |
+ return rc; |
22408 |
+ } |
22409 |
+ |
22410 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
22411 |
+index 6b1826fc3658e..c46312710e73e 100644 |
22412 |
+--- a/security/selinux/hooks.c |
22413 |
++++ b/security/selinux/hooks.c |
22414 |
+@@ -1451,7 +1451,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
22415 |
+ * inode_doinit with a dentry, before these inodes could |
22416 |
+ * be used again by userspace. |
22417 |
+ */ |
22418 |
+- goto out; |
22419 |
++ goto out_invalid; |
22420 |
+ } |
22421 |
+ |
22422 |
+ rc = inode_doinit_use_xattr(inode, dentry, sbsec->def_sid, |
22423 |
+@@ -1508,7 +1508,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
22424 |
+ * could be used again by userspace. |
22425 |
+ */ |
22426 |
+ if (!dentry) |
22427 |
+- goto out; |
22428 |
++ goto out_invalid; |
22429 |
+ rc = selinux_genfs_get_sid(dentry, sclass, |
22430 |
+ sbsec->flags, &sid); |
22431 |
+ if (rc) { |
22432 |
+@@ -1533,11 +1533,10 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent |
22433 |
+ out: |
22434 |
+ spin_lock(&isec->lock); |
22435 |
+ if (isec->initialized == LABEL_PENDING) { |
22436 |
+- if (!sid || rc) { |
22437 |
++ if (rc) { |
22438 |
+ isec->initialized = LABEL_INVALID; |
22439 |
+ goto out_unlock; |
22440 |
+ } |
22441 |
+- |
22442 |
+ isec->initialized = LABEL_INITIALIZED; |
22443 |
+ isec->sid = sid; |
22444 |
+ } |
22445 |
+@@ -1545,6 +1544,15 @@ out: |
22446 |
+ out_unlock: |
22447 |
+ spin_unlock(&isec->lock); |
22448 |
+ return rc; |
22449 |
++ |
22450 |
++out_invalid: |
22451 |
++ spin_lock(&isec->lock); |
22452 |
++ if (isec->initialized == LABEL_PENDING) { |
22453 |
++ isec->initialized = LABEL_INVALID; |
22454 |
++ isec->sid = sid; |
22455 |
++ } |
22456 |
++ spin_unlock(&isec->lock); |
22457 |
++ return 0; |
22458 |
+ } |
22459 |
+ |
22460 |
+ /* Convert a Linux signal to an access vector. */ |
22461 |
+diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c |
22462 |
+index efe2406a39609..7eabb448acab4 100644 |
22463 |
+--- a/security/smack/smack_access.c |
22464 |
++++ b/security/smack/smack_access.c |
22465 |
+@@ -688,9 +688,10 @@ bool smack_privileged_cred(int cap, const struct cred *cred) |
22466 |
+ bool smack_privileged(int cap) |
22467 |
+ { |
22468 |
+ /* |
22469 |
+- * All kernel tasks are privileged |
22470 |
++ * Kernel threads may not have credentials we can use. |
22471 |
++ * The io_uring kernel threads do have reliable credentials. |
22472 |
+ */ |
22473 |
+- if (unlikely(current->flags & PF_KTHREAD)) |
22474 |
++ if ((current->flags & (PF_KTHREAD | PF_IO_WORKER)) == PF_KTHREAD) |
22475 |
+ return true; |
22476 |
+ |
22477 |
+ return smack_privileged_cred(cap, current_cred()); |
22478 |
+diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c |
22479 |
+index 0aeeb6244ff6c..0f335162f87c7 100644 |
22480 |
+--- a/sound/core/memalloc.c |
22481 |
++++ b/sound/core/memalloc.c |
22482 |
+@@ -77,7 +77,8 @@ static void snd_malloc_dev_iram(struct snd_dma_buffer *dmab, size_t size) |
22483 |
+ /* Assign the pool into private_data field */ |
22484 |
+ dmab->private_data = pool; |
22485 |
+ |
22486 |
+- dmab->area = gen_pool_dma_alloc(pool, size, &dmab->addr); |
22487 |
++ dmab->area = gen_pool_dma_alloc_align(pool, size, &dmab->addr, |
22488 |
++ PAGE_SIZE); |
22489 |
+ } |
22490 |
+ |
22491 |
+ /** |
22492 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
22493 |
+index de1917484647e..142fc751a8477 100644 |
22494 |
+--- a/sound/core/oss/pcm_oss.c |
22495 |
++++ b/sound/core/oss/pcm_oss.c |
22496 |
+@@ -693,6 +693,8 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, |
22497 |
+ |
22498 |
+ oss_buffer_size = snd_pcm_plug_client_size(substream, |
22499 |
+ snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size; |
22500 |
++ if (!oss_buffer_size) |
22501 |
++ return -EINVAL; |
22502 |
+ oss_buffer_size = rounddown_pow_of_two(oss_buffer_size); |
22503 |
+ if (atomic_read(&substream->mmap_count)) { |
22504 |
+ if (oss_buffer_size > runtime->oss.mmap_bytes) |
22505 |
+@@ -728,17 +730,21 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, |
22506 |
+ |
22507 |
+ min_period_size = snd_pcm_plug_client_size(substream, |
22508 |
+ snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); |
22509 |
+- min_period_size *= oss_frame_size; |
22510 |
+- min_period_size = roundup_pow_of_two(min_period_size); |
22511 |
+- if (oss_period_size < min_period_size) |
22512 |
+- oss_period_size = min_period_size; |
22513 |
++ if (min_period_size) { |
22514 |
++ min_period_size *= oss_frame_size; |
22515 |
++ min_period_size = roundup_pow_of_two(min_period_size); |
22516 |
++ if (oss_period_size < min_period_size) |
22517 |
++ oss_period_size = min_period_size; |
22518 |
++ } |
22519 |
+ |
22520 |
+ max_period_size = snd_pcm_plug_client_size(substream, |
22521 |
+ snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); |
22522 |
+- max_period_size *= oss_frame_size; |
22523 |
+- max_period_size = rounddown_pow_of_two(max_period_size); |
22524 |
+- if (oss_period_size > max_period_size) |
22525 |
+- oss_period_size = max_period_size; |
22526 |
++ if (max_period_size) { |
22527 |
++ max_period_size *= oss_frame_size; |
22528 |
++ max_period_size = rounddown_pow_of_two(max_period_size); |
22529 |
++ if (oss_period_size > max_period_size) |
22530 |
++ oss_period_size = max_period_size; |
22531 |
++ } |
22532 |
+ |
22533 |
+ oss_periods = oss_buffer_size / oss_period_size; |
22534 |
+ |
22535 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
22536 |
+index 4bb58e8b08a85..687216e745267 100644 |
22537 |
+--- a/sound/pci/hda/hda_codec.c |
22538 |
++++ b/sound/pci/hda/hda_codec.c |
22539 |
+@@ -1803,7 +1803,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) |
22540 |
+ return -EBUSY; |
22541 |
+ |
22542 |
+ /* OK, let it free */ |
22543 |
+- snd_hdac_device_unregister(&codec->core); |
22544 |
++ device_release_driver(hda_codec_dev(codec)); |
22545 |
+ |
22546 |
+ /* allow device access again */ |
22547 |
+ snd_hda_unlock_devices(bus); |
22548 |
+diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c |
22549 |
+index eb8ec109d7adb..d5ffcba794e50 100644 |
22550 |
+--- a/sound/pci/hda/hda_sysfs.c |
22551 |
++++ b/sound/pci/hda/hda_sysfs.c |
22552 |
+@@ -139,7 +139,7 @@ static int reconfig_codec(struct hda_codec *codec) |
22553 |
+ "The codec is being used, can't reconfigure.\n"); |
22554 |
+ goto error; |
22555 |
+ } |
22556 |
+- err = snd_hda_codec_configure(codec); |
22557 |
++ err = device_reprobe(hda_codec_dev(codec)); |
22558 |
+ if (err < 0) |
22559 |
+ goto error; |
22560 |
+ err = snd_card_register(codec->card); |
22561 |
+diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
22562 |
+index d8370a417e3d4..ee500e46dd4f6 100644 |
22563 |
+--- a/sound/pci/hda/patch_ca0132.c |
22564 |
++++ b/sound/pci/hda/patch_ca0132.c |
22565 |
+@@ -95,7 +95,7 @@ enum { |
22566 |
+ }; |
22567 |
+ |
22568 |
+ /* Strings for Input Source Enum Control */ |
22569 |
+-static const char *const in_src_str[3] = {"Rear Mic", "Line", "Front Mic" }; |
22570 |
++static const char *const in_src_str[3] = { "Microphone", "Line In", "Front Microphone" }; |
22571 |
+ #define IN_SRC_NUM_OF_INPUTS 3 |
22572 |
+ enum { |
22573 |
+ REAR_MIC, |
22574 |
+@@ -1223,7 +1223,7 @@ static const struct hda_pintbl ae5_pincfgs[] = { |
22575 |
+ { 0x0e, 0x01c510f0 }, /* SPDIF In */ |
22576 |
+ { 0x0f, 0x01017114 }, /* Port A -- Rear L/R. */ |
22577 |
+ { 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */ |
22578 |
+- { 0x11, 0x01a170ff }, /* Port B -- LineMicIn2 / Rear Headphone */ |
22579 |
++ { 0x11, 0x012170ff }, /* Port B -- LineMicIn2 / Rear Headphone */ |
22580 |
+ { 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */ |
22581 |
+ { 0x13, 0x908700f0 }, /* What U Hear In*/ |
22582 |
+ { 0x18, 0x50d000f0 }, /* N/A */ |
22583 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
22584 |
+index b0068f8ca46dd..2ddc27db8c012 100644 |
22585 |
+--- a/sound/pci/hda/patch_hdmi.c |
22586 |
++++ b/sound/pci/hda/patch_hdmi.c |
22587 |
+@@ -78,6 +78,7 @@ struct hdmi_spec_per_pin { |
22588 |
+ int pcm_idx; /* which pcm is attached. -1 means no pcm is attached */ |
22589 |
+ int repoll_count; |
22590 |
+ bool setup; /* the stream has been set up by prepare callback */ |
22591 |
++ bool silent_stream; |
22592 |
+ int channels; /* current number of channels */ |
22593 |
+ bool non_pcm; |
22594 |
+ bool chmap_set; /* channel-map override by ALSA API? */ |
22595 |
+@@ -979,6 +980,13 @@ static int hdmi_choose_cvt(struct hda_codec *codec, |
22596 |
+ else |
22597 |
+ per_pin = get_pin(spec, pin_idx); |
22598 |
+ |
22599 |
++ if (per_pin && per_pin->silent_stream) { |
22600 |
++ cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); |
22601 |
++ if (cvt_id) |
22602 |
++ *cvt_id = cvt_idx; |
22603 |
++ return 0; |
22604 |
++ } |
22605 |
++ |
22606 |
+ /* Dynamically assign converter to stream */ |
22607 |
+ for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { |
22608 |
+ per_cvt = get_cvt(spec, cvt_idx); |
22609 |
+@@ -1642,30 +1650,95 @@ static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, |
22610 |
+ snd_hda_power_down_pm(codec); |
22611 |
+ } |
22612 |
+ |
22613 |
++#define I915_SILENT_RATE 48000 |
22614 |
++#define I915_SILENT_CHANNELS 2 |
22615 |
++#define I915_SILENT_FORMAT SNDRV_PCM_FORMAT_S16_LE |
22616 |
++#define I915_SILENT_FORMAT_BITS 16 |
22617 |
++#define I915_SILENT_FMT_MASK 0xf |
22618 |
++ |
22619 |
+ static void silent_stream_enable(struct hda_codec *codec, |
22620 |
+- struct hdmi_spec_per_pin *per_pin) |
22621 |
++ struct hdmi_spec_per_pin *per_pin) |
22622 |
+ { |
22623 |
+- unsigned int newval, oldval; |
22624 |
+- |
22625 |
+- codec_dbg(codec, "hdmi: enabling silent stream for NID %d\n", |
22626 |
+- per_pin->pin_nid); |
22627 |
++ struct hdmi_spec *spec = codec->spec; |
22628 |
++ struct hdmi_spec_per_cvt *per_cvt; |
22629 |
++ int cvt_idx, pin_idx, err; |
22630 |
++ unsigned int format; |
22631 |
+ |
22632 |
+ mutex_lock(&per_pin->lock); |
22633 |
+ |
22634 |
+- if (!per_pin->channels) |
22635 |
+- per_pin->channels = 2; |
22636 |
++ if (per_pin->setup) { |
22637 |
++ codec_dbg(codec, "hdmi: PCM already open, no silent stream\n"); |
22638 |
++ goto unlock_out; |
22639 |
++ } |
22640 |
+ |
22641 |
+- oldval = snd_hda_codec_read(codec, per_pin->pin_nid, 0, |
22642 |
+- AC_VERB_GET_CONV, 0); |
22643 |
+- newval = (oldval & 0xF0) | 0xF; |
22644 |
+- snd_hda_codec_write(codec, per_pin->pin_nid, 0, |
22645 |
+- AC_VERB_SET_CHANNEL_STREAMID, newval); |
22646 |
++ pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); |
22647 |
++ err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); |
22648 |
++ if (err) { |
22649 |
++ codec_err(codec, "hdmi: no free converter to enable silent mode\n"); |
22650 |
++ goto unlock_out; |
22651 |
++ } |
22652 |
++ |
22653 |
++ per_cvt = get_cvt(spec, cvt_idx); |
22654 |
++ per_cvt->assigned = 1; |
22655 |
++ per_pin->cvt_nid = per_cvt->cvt_nid; |
22656 |
++ per_pin->silent_stream = true; |
22657 |
+ |
22658 |
++ codec_dbg(codec, "hdmi: enabling silent stream pin-NID=0x%x cvt-NID=0x%x\n", |
22659 |
++ per_pin->pin_nid, per_cvt->cvt_nid); |
22660 |
++ |
22661 |
++ snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); |
22662 |
++ snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, |
22663 |
++ AC_VERB_SET_CONNECT_SEL, |
22664 |
++ per_pin->mux_idx); |
22665 |
++ |
22666 |
++ /* configure unused pins to choose other converters */ |
22667 |
++ pin_cvt_fixup(codec, per_pin, 0); |
22668 |
++ |
22669 |
++ snd_hdac_sync_audio_rate(&codec->core, per_pin->pin_nid, |
22670 |
++ per_pin->dev_id, I915_SILENT_RATE); |
22671 |
++ |
22672 |
++ /* trigger silent stream generation in hw */ |
22673 |
++ format = snd_hdac_calc_stream_format(I915_SILENT_RATE, I915_SILENT_CHANNELS, |
22674 |
++ I915_SILENT_FORMAT, I915_SILENT_FORMAT_BITS, 0); |
22675 |
++ snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, |
22676 |
++ I915_SILENT_FMT_MASK, I915_SILENT_FMT_MASK, format); |
22677 |
++ usleep_range(100, 200); |
22678 |
++ snd_hda_codec_setup_stream(codec, per_pin->cvt_nid, I915_SILENT_FMT_MASK, 0, format); |
22679 |
++ |
22680 |
++ per_pin->channels = I915_SILENT_CHANNELS; |
22681 |
+ hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); |
22682 |
+ |
22683 |
++ unlock_out: |
22684 |
+ mutex_unlock(&per_pin->lock); |
22685 |
+ } |
22686 |
+ |
22687 |
++static void silent_stream_disable(struct hda_codec *codec, |
22688 |
++ struct hdmi_spec_per_pin *per_pin) |
22689 |
++{ |
22690 |
++ struct hdmi_spec *spec = codec->spec; |
22691 |
++ struct hdmi_spec_per_cvt *per_cvt; |
22692 |
++ int cvt_idx; |
22693 |
++ |
22694 |
++ mutex_lock(&per_pin->lock); |
22695 |
++ if (!per_pin->silent_stream) |
22696 |
++ goto unlock_out; |
22697 |
++ |
22698 |
++ codec_dbg(codec, "HDMI: disable silent stream on pin-NID=0x%x cvt-NID=0x%x\n", |
22699 |
++ per_pin->pin_nid, per_pin->cvt_nid); |
22700 |
++ |
22701 |
++ cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); |
22702 |
++ if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) { |
22703 |
++ per_cvt = get_cvt(spec, cvt_idx); |
22704 |
++ per_cvt->assigned = 0; |
22705 |
++ } |
22706 |
++ |
22707 |
++ per_pin->cvt_nid = 0; |
22708 |
++ per_pin->silent_stream = false; |
22709 |
++ |
22710 |
++ unlock_out: |
22711 |
++ mutex_unlock(&spec->pcm_lock); |
22712 |
++} |
22713 |
++ |
22714 |
+ /* update ELD and jack state via audio component */ |
22715 |
+ static void sync_eld_via_acomp(struct hda_codec *codec, |
22716 |
+ struct hdmi_spec_per_pin *per_pin) |
22717 |
+@@ -1701,6 +1774,7 @@ static void sync_eld_via_acomp(struct hda_codec *codec, |
22718 |
+ pm_ret); |
22719 |
+ silent_stream_enable(codec, per_pin); |
22720 |
+ } else if (monitor_prev && !monitor_next) { |
22721 |
++ silent_stream_disable(codec, per_pin); |
22722 |
+ pm_ret = snd_hda_power_down_pm(codec); |
22723 |
+ if (pm_ret < 0) |
22724 |
+ codec_err(codec, |
22725 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
22726 |
+index 8616c56248707..dde5ba2095415 100644 |
22727 |
+--- a/sound/pci/hda/patch_realtek.c |
22728 |
++++ b/sound/pci/hda/patch_realtek.c |
22729 |
+@@ -2516,6 +2516,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
22730 |
+ SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), |
22731 |
+ SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), |
22732 |
+ SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), |
22733 |
++ SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950), |
22734 |
+ SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950), |
22735 |
+ SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), |
22736 |
+ SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), |
22737 |
+@@ -3104,6 +3105,7 @@ static void alc_disable_headset_jack_key(struct hda_codec *codec) |
22738 |
+ case 0x10ec0215: |
22739 |
+ case 0x10ec0225: |
22740 |
+ case 0x10ec0285: |
22741 |
++ case 0x10ec0287: |
22742 |
+ case 0x10ec0295: |
22743 |
+ case 0x10ec0289: |
22744 |
+ case 0x10ec0299: |
22745 |
+@@ -3130,6 +3132,7 @@ static void alc_enable_headset_jack_key(struct hda_codec *codec) |
22746 |
+ case 0x10ec0215: |
22747 |
+ case 0x10ec0225: |
22748 |
+ case 0x10ec0285: |
22749 |
++ case 0x10ec0287: |
22750 |
+ case 0x10ec0295: |
22751 |
+ case 0x10ec0289: |
22752 |
+ case 0x10ec0299: |
22753 |
+@@ -6366,6 +6369,7 @@ enum { |
22754 |
+ ALC287_FIXUP_HP_GPIO_LED, |
22755 |
+ ALC256_FIXUP_HP_HEADSET_MIC, |
22756 |
+ ALC236_FIXUP_DELL_AIO_HEADSET_MIC, |
22757 |
++ ALC282_FIXUP_ACER_DISABLE_LINEOUT, |
22758 |
+ }; |
22759 |
+ |
22760 |
+ static const struct hda_fixup alc269_fixups[] = { |
22761 |
+@@ -7789,6 +7793,16 @@ static const struct hda_fixup alc269_fixups[] = { |
22762 |
+ .chained = true, |
22763 |
+ .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
22764 |
+ }, |
22765 |
++ [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = { |
22766 |
++ .type = HDA_FIXUP_PINS, |
22767 |
++ .v.pins = (const struct hda_pintbl[]) { |
22768 |
++ { 0x1b, 0x411111f0 }, |
22769 |
++ { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
22770 |
++ { }, |
22771 |
++ }, |
22772 |
++ .chained = true, |
22773 |
++ .chain_id = ALC269_FIXUP_HEADSET_MODE |
22774 |
++ }, |
22775 |
+ }; |
22776 |
+ |
22777 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
22778 |
+@@ -7803,11 +7817,14 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
22779 |
+ SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
22780 |
+ SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
22781 |
+ SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), |
22782 |
++ SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), |
22783 |
+ SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), |
22784 |
+ SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), |
22785 |
+ SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK), |
22786 |
+ SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), |
22787 |
+ SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), |
22788 |
++ SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK), |
22789 |
++ SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK), |
22790 |
+ SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), |
22791 |
+ SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), |
22792 |
+ SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE), |
22793 |
+@@ -7868,6 +7885,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
22794 |
+ SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE), |
22795 |
+ SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), |
22796 |
+ SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), |
22797 |
++ SND_PCI_QUIRK(0x1028, 0x0a58, "Dell Precision 3650 Tower", ALC255_FIXUP_DELL_HEADSET_MIC), |
22798 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
22799 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
22800 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
22801 |
+@@ -7956,6 +7974,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
22802 |
+ SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
22803 |
+ SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
22804 |
+ SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
22805 |
++ SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), |
22806 |
+ SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), |
22807 |
+ SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), |
22808 |
+ SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), |
22809 |
+@@ -7976,6 +7995,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
22810 |
+ SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
22811 |
+ SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
22812 |
+ SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
22813 |
++ SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
22814 |
+ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), |
22815 |
+ SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), |
22816 |
+ SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), |
22817 |
+@@ -8013,6 +8033,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
22818 |
+ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), |
22819 |
+ SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), |
22820 |
+ SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), |
22821 |
++ SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK), |
22822 |
+ SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
22823 |
+ SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
22824 |
+ SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
22825 |
+@@ -8560,6 +8581,22 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
22826 |
+ {0x12, 0x90a60140}, |
22827 |
+ {0x19, 0x04a11030}, |
22828 |
+ {0x21, 0x04211020}), |
22829 |
++ SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT, |
22830 |
++ ALC282_STANDARD_PINS, |
22831 |
++ {0x12, 0x90a609c0}, |
22832 |
++ {0x18, 0x03a11830}, |
22833 |
++ {0x19, 0x04a19831}, |
22834 |
++ {0x1a, 0x0481303f}, |
22835 |
++ {0x1b, 0x04211020}, |
22836 |
++ {0x21, 0x0321101f}), |
22837 |
++ SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT, |
22838 |
++ ALC282_STANDARD_PINS, |
22839 |
++ {0x12, 0x90a60940}, |
22840 |
++ {0x18, 0x03a11830}, |
22841 |
++ {0x19, 0x04a19831}, |
22842 |
++ {0x1a, 0x0481303f}, |
22843 |
++ {0x1b, 0x04211020}, |
22844 |
++ {0x21, 0x0321101f}), |
22845 |
+ SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
22846 |
+ ALC282_STANDARD_PINS, |
22847 |
+ {0x12, 0x90a60130}, |
22848 |
+@@ -8573,11 +8610,20 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
22849 |
+ {0x12, 0x90a60130}, |
22850 |
+ {0x19, 0x03a11020}, |
22851 |
+ {0x21, 0x0321101f}), |
22852 |
++ SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK, |
22853 |
++ {0x14, 0x90170110}, |
22854 |
++ {0x19, 0x04a11040}, |
22855 |
++ {0x21, 0x04211020}), |
22856 |
+ SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, |
22857 |
+ {0x12, 0x90a60130}, |
22858 |
+ {0x14, 0x90170110}, |
22859 |
+ {0x19, 0x04a11040}, |
22860 |
+ {0x21, 0x04211020}), |
22861 |
++ SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK, |
22862 |
++ {0x14, 0x90170110}, |
22863 |
++ {0x17, 0x90170111}, |
22864 |
++ {0x19, 0x03a11030}, |
22865 |
++ {0x21, 0x03211020}), |
22866 |
+ SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE, |
22867 |
+ {0x12, 0x90a60130}, |
22868 |
+ {0x17, 0x90170110}, |
22869 |
+diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c |
22870 |
+index a7702e64ec512..849288d01c6b4 100644 |
22871 |
+--- a/sound/soc/amd/acp-da7219-max98357a.c |
22872 |
++++ b/sound/soc/amd/acp-da7219-max98357a.c |
22873 |
+@@ -73,8 +73,13 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) |
22874 |
+ return ret; |
22875 |
+ } |
22876 |
+ |
22877 |
+- da7219_dai_wclk = clk_get(component->dev, "da7219-dai-wclk"); |
22878 |
+- da7219_dai_bclk = clk_get(component->dev, "da7219-dai-bclk"); |
22879 |
++ da7219_dai_wclk = devm_clk_get(component->dev, "da7219-dai-wclk"); |
22880 |
++ if (IS_ERR(da7219_dai_wclk)) |
22881 |
++ return PTR_ERR(da7219_dai_wclk); |
22882 |
++ |
22883 |
++ da7219_dai_bclk = devm_clk_get(component->dev, "da7219-dai-bclk"); |
22884 |
++ if (IS_ERR(da7219_dai_bclk)) |
22885 |
++ return PTR_ERR(da7219_dai_bclk); |
22886 |
+ |
22887 |
+ ret = snd_soc_card_jack_new(card, "Headset Jack", |
22888 |
+ SND_JACK_HEADSET | SND_JACK_LINEOUT | |
22889 |
+diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c |
22890 |
+index 31b797c8bfe64..77f2d93896067 100644 |
22891 |
+--- a/sound/soc/amd/raven/pci-acp3x.c |
22892 |
++++ b/sound/soc/amd/raven/pci-acp3x.c |
22893 |
+@@ -118,6 +118,10 @@ static int snd_acp3x_probe(struct pci_dev *pci, |
22894 |
+ int ret, i; |
22895 |
+ u32 addr, val; |
22896 |
+ |
22897 |
++ /* Raven device detection */ |
22898 |
++ if (pci->revision != 0x00) |
22899 |
++ return -ENODEV; |
22900 |
++ |
22901 |
+ if (pci_enable_device(pci)) { |
22902 |
+ dev_err(&pci->dev, "pci_enable_device failed\n"); |
22903 |
+ return -ENODEV; |
22904 |
+diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c |
22905 |
+index b943e59fc3024..338b78c514ec9 100644 |
22906 |
+--- a/sound/soc/amd/renoir/rn-pci-acp3x.c |
22907 |
++++ b/sound/soc/amd/renoir/rn-pci-acp3x.c |
22908 |
+@@ -6,6 +6,7 @@ |
22909 |
+ |
22910 |
+ #include <linux/pci.h> |
22911 |
+ #include <linux/acpi.h> |
22912 |
++#include <linux/dmi.h> |
22913 |
+ #include <linux/module.h> |
22914 |
+ #include <linux/io.h> |
22915 |
+ #include <linux/delay.h> |
22916 |
+@@ -20,14 +21,13 @@ module_param(acp_power_gating, int, 0644); |
22917 |
+ MODULE_PARM_DESC(acp_power_gating, "Enable acp power gating"); |
22918 |
+ |
22919 |
+ /** |
22920 |
+- * dmic_acpi_check = -1 - Checks ACPI method to know DMIC hardware status runtime |
22921 |
+- * = 0 - Skips the DMIC device creation and returns probe failure |
22922 |
+- * = 1 - Assumes that platform has DMIC support and skips ACPI |
22923 |
+- * method check |
22924 |
++ * dmic_acpi_check = -1 - Use ACPI/DMI method to detect the DMIC hardware presence at runtime |
22925 |
++ * = 0 - Skip the DMIC device creation and return probe failure |
22926 |
++ * = 1 - Force DMIC support |
22927 |
+ */ |
22928 |
+ static int dmic_acpi_check = ACP_DMIC_AUTO; |
22929 |
+ module_param(dmic_acpi_check, bint, 0644); |
22930 |
+-MODULE_PARM_DESC(dmic_acpi_check, "checks Dmic hardware runtime"); |
22931 |
++MODULE_PARM_DESC(dmic_acpi_check, "Digital microphone presence (-1=auto, 0=none, 1=force)"); |
22932 |
+ |
22933 |
+ struct acp_dev_data { |
22934 |
+ void __iomem *acp_base; |
22935 |
+@@ -163,6 +163,17 @@ static int rn_acp_deinit(void __iomem *acp_base) |
22936 |
+ return 0; |
22937 |
+ } |
22938 |
+ |
22939 |
++static const struct dmi_system_id rn_acp_quirk_table[] = { |
22940 |
++ { |
22941 |
++ /* Lenovo IdeaPad Flex 5 14ARE05, IdeaPad 5 15ARE05 */ |
22942 |
++ .matches = { |
22943 |
++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "LENOVO"), |
22944 |
++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "LNVNB161216"), |
22945 |
++ } |
22946 |
++ }, |
22947 |
++ {} |
22948 |
++}; |
22949 |
++ |
22950 |
+ static int snd_rn_acp_probe(struct pci_dev *pci, |
22951 |
+ const struct pci_device_id *pci_id) |
22952 |
+ { |
22953 |
+@@ -172,10 +183,15 @@ static int snd_rn_acp_probe(struct pci_dev *pci, |
22954 |
+ acpi_handle handle; |
22955 |
+ acpi_integer dmic_status; |
22956 |
+ #endif |
22957 |
++ const struct dmi_system_id *dmi_id; |
22958 |
+ unsigned int irqflags; |
22959 |
+ int ret, index; |
22960 |
+ u32 addr; |
22961 |
+ |
22962 |
++ /* Renoir device check */ |
22963 |
++ if (pci->revision != 0x01) |
22964 |
++ return -ENODEV; |
22965 |
++ |
22966 |
+ if (pci_enable_device(pci)) { |
22967 |
+ dev_err(&pci->dev, "pci_enable_device failed\n"); |
22968 |
+ return -ENODEV; |
22969 |
+@@ -232,6 +248,12 @@ static int snd_rn_acp_probe(struct pci_dev *pci, |
22970 |
+ goto de_init; |
22971 |
+ } |
22972 |
+ #endif |
22973 |
++ dmi_id = dmi_first_match(rn_acp_quirk_table); |
22974 |
++ if (dmi_id && !dmi_id->driver_data) { |
22975 |
++ dev_info(&pci->dev, "ACPI settings override using DMI (ACP mic is not present)"); |
22976 |
++ ret = -ENODEV; |
22977 |
++ goto de_init; |
22978 |
++ } |
22979 |
+ } |
22980 |
+ |
22981 |
+ adata->res = devm_kzalloc(&pci->dev, |
22982 |
+diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig |
22983 |
+index bd8854bfd2ee4..142373ec411ad 100644 |
22984 |
+--- a/sound/soc/atmel/Kconfig |
22985 |
++++ b/sound/soc/atmel/Kconfig |
22986 |
+@@ -148,6 +148,7 @@ config SND_MCHP_SOC_SPDIFTX |
22987 |
+ config SND_MCHP_SOC_SPDIFRX |
22988 |
+ tristate "Microchip ASoC driver for boards using S/PDIF RX" |
22989 |
+ depends on OF && (ARCH_AT91 || COMPILE_TEST) |
22990 |
++ depends on COMMON_CLK |
22991 |
+ select SND_SOC_GENERIC_DMAENGINE_PCM |
22992 |
+ select REGMAP_MMIO |
22993 |
+ help |
22994 |
+diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c |
22995 |
+index 28f039adfa138..5c3b7e5e55d23 100644 |
22996 |
+--- a/sound/soc/codecs/cros_ec_codec.c |
22997 |
++++ b/sound/soc/codecs/cros_ec_codec.c |
22998 |
+@@ -332,7 +332,7 @@ static int i2s_rx_event(struct snd_soc_dapm_widget *w, |
22999 |
+ snd_soc_dapm_to_component(w->dapm); |
23000 |
+ struct cros_ec_codec_priv *priv = |
23001 |
+ snd_soc_component_get_drvdata(component); |
23002 |
+- struct ec_param_ec_codec_i2s_rx p; |
23003 |
++ struct ec_param_ec_codec_i2s_rx p = {}; |
23004 |
+ |
23005 |
+ switch (event) { |
23006 |
+ case SND_SOC_DAPM_PRE_PMU: |
23007 |
+diff --git a/sound/soc/codecs/cx2072x.c b/sound/soc/codecs/cx2072x.c |
23008 |
+index 2ad00ed21bec6..2f10991a8bdb5 100644 |
23009 |
+--- a/sound/soc/codecs/cx2072x.c |
23010 |
++++ b/sound/soc/codecs/cx2072x.c |
23011 |
+@@ -1579,7 +1579,7 @@ static struct snd_soc_dai_driver soc_codec_cx2072x_dai[] = { |
23012 |
+ .id = CX2072X_DAI_DSP, |
23013 |
+ .probe = cx2072x_dsp_dai_probe, |
23014 |
+ .playback = { |
23015 |
+- .stream_name = "Playback", |
23016 |
++ .stream_name = "DSP Playback", |
23017 |
+ .channels_min = 2, |
23018 |
+ .channels_max = 2, |
23019 |
+ .rates = CX2072X_RATES_DSP, |
23020 |
+@@ -1591,7 +1591,7 @@ static struct snd_soc_dai_driver soc_codec_cx2072x_dai[] = { |
23021 |
+ .name = "cx2072x-aec", |
23022 |
+ .id = 3, |
23023 |
+ .capture = { |
23024 |
+- .stream_name = "Capture", |
23025 |
++ .stream_name = "AEC Capture", |
23026 |
+ .channels_min = 2, |
23027 |
+ .channels_max = 2, |
23028 |
+ .rates = CX2072X_RATES_DSP, |
23029 |
+diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c |
23030 |
+index ff5cc9bbec291..bb736c44e68a3 100644 |
23031 |
+--- a/sound/soc/codecs/max98390.c |
23032 |
++++ b/sound/soc/codecs/max98390.c |
23033 |
+@@ -784,6 +784,7 @@ static int max98390_dsm_init(struct snd_soc_component *component) |
23034 |
+ if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) { |
23035 |
+ dev_err(component->dev, |
23036 |
+ "param fw is invalid.\n"); |
23037 |
++ ret = -EINVAL; |
23038 |
+ goto err_alloc; |
23039 |
+ } |
23040 |
+ dsm_param = (char *)fw->data; |
23041 |
+@@ -794,6 +795,7 @@ static int max98390_dsm_init(struct snd_soc_component *component) |
23042 |
+ fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) { |
23043 |
+ dev_err(component->dev, |
23044 |
+ "param fw is invalid.\n"); |
23045 |
++ ret = -EINVAL; |
23046 |
+ goto err_alloc; |
23047 |
+ } |
23048 |
+ regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80); |
23049 |
+diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c |
23050 |
+index fc9ea198ac799..f57884113406b 100644 |
23051 |
+--- a/sound/soc/codecs/wm8994.c |
23052 |
++++ b/sound/soc/codecs/wm8994.c |
23053 |
+@@ -4645,8 +4645,12 @@ static int wm8994_probe(struct platform_device *pdev) |
23054 |
+ pm_runtime_enable(&pdev->dev); |
23055 |
+ pm_runtime_idle(&pdev->dev); |
23056 |
+ |
23057 |
+- return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994, |
23058 |
++ ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994, |
23059 |
+ wm8994_dai, ARRAY_SIZE(wm8994_dai)); |
23060 |
++ if (ret < 0) |
23061 |
++ pm_runtime_disable(&pdev->dev); |
23062 |
++ |
23063 |
++ return ret; |
23064 |
+ } |
23065 |
+ |
23066 |
+ static int wm8994_remove(struct platform_device *pdev) |
23067 |
+diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c |
23068 |
+index 37e4bb3dbd8a9..229f2986cd96b 100644 |
23069 |
+--- a/sound/soc/codecs/wm8997.c |
23070 |
++++ b/sound/soc/codecs/wm8997.c |
23071 |
+@@ -1177,6 +1177,8 @@ static int wm8997_probe(struct platform_device *pdev) |
23072 |
+ goto err_spk_irqs; |
23073 |
+ } |
23074 |
+ |
23075 |
++ return ret; |
23076 |
++ |
23077 |
+ err_spk_irqs: |
23078 |
+ arizona_free_spk_irqs(arizona); |
23079 |
+ |
23080 |
+diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c |
23081 |
+index f6c5cc80c970b..5413254295b70 100644 |
23082 |
+--- a/sound/soc/codecs/wm8998.c |
23083 |
++++ b/sound/soc/codecs/wm8998.c |
23084 |
+@@ -1375,7 +1375,7 @@ static int wm8998_probe(struct platform_device *pdev) |
23085 |
+ |
23086 |
+ ret = arizona_init_spk_irqs(arizona); |
23087 |
+ if (ret < 0) |
23088 |
+- return ret; |
23089 |
++ goto err_pm_disable; |
23090 |
+ |
23091 |
+ ret = devm_snd_soc_register_component(&pdev->dev, |
23092 |
+ &soc_component_dev_wm8998, |
23093 |
+@@ -1390,6 +1390,8 @@ static int wm8998_probe(struct platform_device *pdev) |
23094 |
+ |
23095 |
+ err_spk_irqs: |
23096 |
+ arizona_free_spk_irqs(arizona); |
23097 |
++err_pm_disable: |
23098 |
++ pm_runtime_disable(&pdev->dev); |
23099 |
+ |
23100 |
+ return ret; |
23101 |
+ } |
23102 |
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c |
23103 |
+index e61d00486c653..dec8716aa8ef5 100644 |
23104 |
+--- a/sound/soc/codecs/wm_adsp.c |
23105 |
++++ b/sound/soc/codecs/wm_adsp.c |
23106 |
+@@ -1519,7 +1519,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, |
23107 |
+ ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL); |
23108 |
+ if (!ctl_work) { |
23109 |
+ ret = -ENOMEM; |
23110 |
+- goto err_ctl_cache; |
23111 |
++ goto err_list_del; |
23112 |
+ } |
23113 |
+ |
23114 |
+ ctl_work->dsp = dsp; |
23115 |
+@@ -1529,7 +1529,8 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, |
23116 |
+ |
23117 |
+ return 0; |
23118 |
+ |
23119 |
+-err_ctl_cache: |
23120 |
++err_list_del: |
23121 |
++ list_del(&ctl->list); |
23122 |
+ kfree(ctl->cache); |
23123 |
+ err_ctl_subname: |
23124 |
+ kfree(ctl->subname); |
23125 |
+diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig |
23126 |
+index a5b446d5af19f..c1bf69a0bcfe1 100644 |
23127 |
+--- a/sound/soc/intel/Kconfig |
23128 |
++++ b/sound/soc/intel/Kconfig |
23129 |
+@@ -198,7 +198,7 @@ endif ## SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL |
23130 |
+ |
23131 |
+ config SND_SOC_INTEL_KEEMBAY |
23132 |
+ tristate "Keembay Platforms" |
23133 |
+- depends on ARM64 || COMPILE_TEST |
23134 |
++ depends on ARCH_KEEMBAY || COMPILE_TEST |
23135 |
+ depends on COMMON_CLK |
23136 |
+ help |
23137 |
+ If you have a Intel Keembay platform then enable this option |
23138 |
+diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c |
23139 |
+index b6e63ea13d64e..c2a9757181fe1 100644 |
23140 |
+--- a/sound/soc/intel/boards/sof_maxim_common.c |
23141 |
++++ b/sound/soc/intel/boards/sof_maxim_common.c |
23142 |
+@@ -49,11 +49,11 @@ static int max98373_hw_params(struct snd_pcm_substream *substream, |
23143 |
+ for_each_rtd_codec_dais(rtd, j, codec_dai) { |
23144 |
+ if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) { |
23145 |
+ /* DEV0 tdm slot configuration */ |
23146 |
+- snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 24); |
23147 |
++ snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 32); |
23148 |
+ } |
23149 |
+ if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) { |
23150 |
+ /* DEV1 tdm slot configuration */ |
23151 |
+- snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 24); |
23152 |
++ snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 32); |
23153 |
+ } |
23154 |
+ } |
23155 |
+ return 0; |
23156 |
+diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c |
23157 |
+index c7bd20104b204..0793e284d0e78 100644 |
23158 |
+--- a/sound/soc/jz4740/jz4740-i2s.c |
23159 |
++++ b/sound/soc/jz4740/jz4740-i2s.c |
23160 |
+@@ -312,10 +312,14 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
23161 |
+ switch (clk_id) { |
23162 |
+ case JZ4740_I2S_CLKSRC_EXT: |
23163 |
+ parent = clk_get(NULL, "ext"); |
23164 |
++ if (IS_ERR(parent)) |
23165 |
++ return PTR_ERR(parent); |
23166 |
+ clk_set_parent(i2s->clk_i2s, parent); |
23167 |
+ break; |
23168 |
+ case JZ4740_I2S_CLKSRC_PLL: |
23169 |
+ parent = clk_get(NULL, "pll half"); |
23170 |
++ if (IS_ERR(parent)) |
23171 |
++ return PTR_ERR(parent); |
23172 |
+ clk_set_parent(i2s->clk_i2s, parent); |
23173 |
+ ret = clk_set_rate(i2s->clk_i2s, freq); |
23174 |
+ break; |
23175 |
+diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig |
23176 |
+index 363dc3b1bbe47..ce0cbdc69b2ec 100644 |
23177 |
+--- a/sound/soc/meson/Kconfig |
23178 |
++++ b/sound/soc/meson/Kconfig |
23179 |
+@@ -1,6 +1,6 @@ |
23180 |
+ # SPDX-License-Identifier: GPL-2.0-only |
23181 |
+ menu "ASoC support for Amlogic platforms" |
23182 |
+- depends on ARCH_MESON || COMPILE_TEST |
23183 |
++ depends on ARCH_MESON || (COMPILE_TEST && COMMON_CLK) |
23184 |
+ |
23185 |
+ config SND_MESON_AIU |
23186 |
+ tristate "Amlogic AIU" |
23187 |
+diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig |
23188 |
+index 2696ffcba880f..a824f793811be 100644 |
23189 |
+--- a/sound/soc/qcom/Kconfig |
23190 |
++++ b/sound/soc/qcom/Kconfig |
23191 |
+@@ -106,6 +106,7 @@ config SND_SOC_QDSP6 |
23192 |
+ config SND_SOC_MSM8996 |
23193 |
+ tristate "SoC Machine driver for MSM8996 and APQ8096 boards" |
23194 |
+ depends on QCOM_APR |
23195 |
++ depends on COMMON_CLK |
23196 |
+ select SND_SOC_QDSP6 |
23197 |
+ select SND_SOC_QCOM_COMMON |
23198 |
+ help |
23199 |
+diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c |
23200 |
+index 54660f126d09e..09af007007007 100644 |
23201 |
+--- a/sound/soc/qcom/common.c |
23202 |
++++ b/sound/soc/qcom/common.c |
23203 |
+@@ -58,7 +58,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) |
23204 |
+ dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); |
23205 |
+ if (!dlc) { |
23206 |
+ ret = -ENOMEM; |
23207 |
+- goto err; |
23208 |
++ goto err_put_np; |
23209 |
+ } |
23210 |
+ |
23211 |
+ link->cpus = &dlc[0]; |
23212 |
+@@ -70,7 +70,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) |
23213 |
+ ret = of_property_read_string(np, "link-name", &link->name); |
23214 |
+ if (ret) { |
23215 |
+ dev_err(card->dev, "error getting codec dai_link name\n"); |
23216 |
+- goto err; |
23217 |
++ goto err_put_np; |
23218 |
+ } |
23219 |
+ |
23220 |
+ cpu = of_get_child_by_name(np, "cpu"); |
23221 |
+@@ -130,8 +130,10 @@ int qcom_snd_parse_of(struct snd_soc_card *card) |
23222 |
+ } else { |
23223 |
+ /* DPCM frontend */ |
23224 |
+ dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); |
23225 |
+- if (!dlc) |
23226 |
+- return -ENOMEM; |
23227 |
++ if (!dlc) { |
23228 |
++ ret = -ENOMEM; |
23229 |
++ goto err; |
23230 |
++ } |
23231 |
+ |
23232 |
+ link->codecs = dlc; |
23233 |
+ link->num_codecs = 1; |
23234 |
+@@ -158,10 +160,11 @@ int qcom_snd_parse_of(struct snd_soc_card *card) |
23235 |
+ |
23236 |
+ return 0; |
23237 |
+ err: |
23238 |
+- of_node_put(np); |
23239 |
+ of_node_put(cpu); |
23240 |
+ of_node_put(codec); |
23241 |
+ of_node_put(platform); |
23242 |
++err_put_np: |
23243 |
++ of_node_put(np); |
23244 |
+ return ret; |
23245 |
+ } |
23246 |
+ EXPORT_SYMBOL(qcom_snd_parse_of); |
23247 |
+diff --git a/sound/soc/qcom/lpass-hdmi.c b/sound/soc/qcom/lpass-hdmi.c |
23248 |
+index 172952d3a5d66..abfb8737a89f4 100644 |
23249 |
+--- a/sound/soc/qcom/lpass-hdmi.c |
23250 |
++++ b/sound/soc/qcom/lpass-hdmi.c |
23251 |
+@@ -24,7 +24,7 @@ static int lpass_hdmi_daiops_hw_params(struct snd_pcm_substream *substream, |
23252 |
+ unsigned int rate = params_rate(params); |
23253 |
+ unsigned int channels = params_channels(params); |
23254 |
+ unsigned int ret; |
23255 |
+- unsigned int bitwidth; |
23256 |
++ int bitwidth; |
23257 |
+ unsigned int word_length; |
23258 |
+ unsigned int ch_sts_buf0; |
23259 |
+ unsigned int ch_sts_buf1; |
23260 |
+diff --git a/sound/soc/qcom/qdsp6/q6afe-clocks.c b/sound/soc/qcom/qdsp6/q6afe-clocks.c |
23261 |
+index 2efc2eaa04243..acfc0c698f6a1 100644 |
23262 |
+--- a/sound/soc/qcom/qdsp6/q6afe-clocks.c |
23263 |
++++ b/sound/soc/qcom/qdsp6/q6afe-clocks.c |
23264 |
+@@ -16,6 +16,7 @@ |
23265 |
+ .afe_clk_id = Q6AFE_##id, \ |
23266 |
+ .name = #id, \ |
23267 |
+ .attributes = LPASS_CLK_ATTRIBUTE_COUPLE_NO, \ |
23268 |
++ .rate = 19200000, \ |
23269 |
+ .hw.init = &(struct clk_init_data) { \ |
23270 |
+ .ops = &clk_q6afe_ops, \ |
23271 |
+ .name = #id, \ |
23272 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
23273 |
+index dcab9527ba3d7..91bf339581590 100644 |
23274 |
+--- a/sound/soc/soc-pcm.c |
23275 |
++++ b/sound/soc/soc-pcm.c |
23276 |
+@@ -2231,6 +2231,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
23277 |
+ case SNDRV_PCM_TRIGGER_START: |
23278 |
+ case SNDRV_PCM_TRIGGER_RESUME: |
23279 |
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
23280 |
++ case SNDRV_PCM_TRIGGER_DRAIN: |
23281 |
+ ret = dpcm_dai_trigger_fe_be(substream, cmd, true); |
23282 |
+ break; |
23283 |
+ case SNDRV_PCM_TRIGGER_STOP: |
23284 |
+@@ -2248,6 +2249,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
23285 |
+ case SNDRV_PCM_TRIGGER_START: |
23286 |
+ case SNDRV_PCM_TRIGGER_RESUME: |
23287 |
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
23288 |
++ case SNDRV_PCM_TRIGGER_DRAIN: |
23289 |
+ ret = dpcm_dai_trigger_fe_be(substream, cmd, false); |
23290 |
+ break; |
23291 |
+ case SNDRV_PCM_TRIGGER_STOP: |
23292 |
+diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig |
23293 |
+index a066e08860cbf..5bfc2f8b13b90 100644 |
23294 |
+--- a/sound/soc/sof/intel/Kconfig |
23295 |
++++ b/sound/soc/sof/intel/Kconfig |
23296 |
+@@ -271,6 +271,7 @@ config SND_SOC_SOF_JASPERLAKE |
23297 |
+ |
23298 |
+ config SND_SOC_SOF_HDA_COMMON |
23299 |
+ tristate |
23300 |
++ select SND_INTEL_DSP_CONFIG |
23301 |
+ select SND_SOC_SOF_INTEL_COMMON |
23302 |
+ select SND_SOC_SOF_HDA_LINK_BASELINE |
23303 |
+ help |
23304 |
+@@ -330,7 +331,6 @@ config SND_SOC_SOF_HDA |
23305 |
+ tristate |
23306 |
+ select SND_HDA_EXT_CORE if SND_SOC_SOF_HDA_LINK |
23307 |
+ select SND_SOC_HDAC_HDA if SND_SOC_SOF_HDA_AUDIO_CODEC |
23308 |
+- select SND_INTEL_DSP_CONFIG |
23309 |
+ help |
23310 |
+ This option is not user-selectable but automagically handled by |
23311 |
+ 'select' statements at a higher level |
23312 |
+diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c |
23313 |
+index f23ff29e7c1d3..a994b5cf87b31 100644 |
23314 |
+--- a/sound/soc/sunxi/sun4i-i2s.c |
23315 |
++++ b/sound/soc/sunxi/sun4i-i2s.c |
23316 |
+@@ -450,11 +450,11 @@ static int sun8i_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, |
23317 |
+ switch (i2s->format & SND_SOC_DAIFMT_FORMAT_MASK) { |
23318 |
+ case SND_SOC_DAIFMT_DSP_A: |
23319 |
+ case SND_SOC_DAIFMT_DSP_B: |
23320 |
+- case SND_SOC_DAIFMT_LEFT_J: |
23321 |
+- case SND_SOC_DAIFMT_RIGHT_J: |
23322 |
+ lrck_period = params_physical_width(params) * slots; |
23323 |
+ break; |
23324 |
+ |
23325 |
++ case SND_SOC_DAIFMT_LEFT_J: |
23326 |
++ case SND_SOC_DAIFMT_RIGHT_J: |
23327 |
+ case SND_SOC_DAIFMT_I2S: |
23328 |
+ lrck_period = params_physical_width(params); |
23329 |
+ break; |
23330 |
+diff --git a/sound/usb/card.c b/sound/usb/card.c |
23331 |
+index 4457214a3ae62..57d6d4ff01e08 100644 |
23332 |
+--- a/sound/usb/card.c |
23333 |
++++ b/sound/usb/card.c |
23334 |
+@@ -382,6 +382,9 @@ static const struct usb_audio_device_name usb_audio_names[] = { |
23335 |
+ /* ASUS ROG Strix */ |
23336 |
+ PROFILE_NAME(0x0b05, 0x1917, |
23337 |
+ "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"), |
23338 |
++ /* ASUS PRIME TRX40 PRO-S */ |
23339 |
++ PROFILE_NAME(0x0b05, 0x1918, |
23340 |
++ "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"), |
23341 |
+ |
23342 |
+ /* Dell WD15 Dock */ |
23343 |
+ PROFILE_NAME(0x0bda, 0x4014, "Dell", "WD15 Dock", "Dell-WD15-Dock"), |
23344 |
+diff --git a/sound/usb/clock.c b/sound/usb/clock.c |
23345 |
+index f3ca59005d914..674e15bf98ed5 100644 |
23346 |
+--- a/sound/usb/clock.c |
23347 |
++++ b/sound/usb/clock.c |
23348 |
+@@ -531,6 +531,12 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, |
23349 |
+ } |
23350 |
+ |
23351 |
+ crate = data[0] | (data[1] << 8) | (data[2] << 16); |
23352 |
++ if (!crate) { |
23353 |
++ dev_info(&dev->dev, "failed to read current rate; disabling the check\n"); |
23354 |
++ chip->sample_rate_read_error = 3; /* three strikes, see above */ |
23355 |
++ return 0; |
23356 |
++ } |
23357 |
++ |
23358 |
+ if (crate != rate) { |
23359 |
+ dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate); |
23360 |
+ // runtime->rate = crate; |
23361 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
23362 |
+index c50be2f75f702..f82c2ab809c1d 100644 |
23363 |
+--- a/sound/usb/quirks.c |
23364 |
++++ b/sound/usb/quirks.c |
23365 |
+@@ -1799,6 +1799,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
23366 |
+ case 0x25ce: /* Mytek devices */ |
23367 |
+ case 0x278b: /* Rotel? */ |
23368 |
+ case 0x292b: /* Gustard/Ess based devices */ |
23369 |
++ case 0x2972: /* FiiO devices */ |
23370 |
+ case 0x2ab6: /* T+A devices */ |
23371 |
+ case 0x3353: /* Khadas devices */ |
23372 |
+ case 0x3842: /* EVGA */ |
23373 |
+diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile |
23374 |
+index cdde783f3018b..89ba522e377dc 100644 |
23375 |
+--- a/tools/build/feature/Makefile |
23376 |
++++ b/tools/build/feature/Makefile |
23377 |
+@@ -90,7 +90,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$( |
23378 |
+ ############################### |
23379 |
+ |
23380 |
+ $(OUTPUT)test-all.bin: |
23381 |
+- $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd |
23382 |
++ $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd -lcap |
23383 |
+ |
23384 |
+ $(OUTPUT)test-hello.bin: |
23385 |
+ $(BUILD) |
23386 |
+diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c |
23387 |
+index 28baee7ba1ca8..ad165e6e74bc0 100644 |
23388 |
+--- a/tools/lib/bpf/libbpf.c |
23389 |
++++ b/tools/lib/bpf/libbpf.c |
23390 |
+@@ -7649,6 +7649,16 @@ bool bpf_map__is_pinned(const struct bpf_map *map) |
23391 |
+ return map->pinned; |
23392 |
+ } |
23393 |
+ |
23394 |
++static void sanitize_pin_path(char *s) |
23395 |
++{ |
23396 |
++ /* bpffs disallows periods in path names */ |
23397 |
++ while (*s) { |
23398 |
++ if (*s == '.') |
23399 |
++ *s = '_'; |
23400 |
++ s++; |
23401 |
++ } |
23402 |
++} |
23403 |
++ |
23404 |
+ int bpf_object__pin_maps(struct bpf_object *obj, const char *path) |
23405 |
+ { |
23406 |
+ struct bpf_map *map; |
23407 |
+@@ -7678,6 +7688,7 @@ int bpf_object__pin_maps(struct bpf_object *obj, const char *path) |
23408 |
+ err = -ENAMETOOLONG; |
23409 |
+ goto err_unpin_maps; |
23410 |
+ } |
23411 |
++ sanitize_pin_path(buf); |
23412 |
+ pin_path = buf; |
23413 |
+ } else if (!map->pin_path) { |
23414 |
+ continue; |
23415 |
+@@ -7722,6 +7733,7 @@ int bpf_object__unpin_maps(struct bpf_object *obj, const char *path) |
23416 |
+ return -EINVAL; |
23417 |
+ else if (len >= PATH_MAX) |
23418 |
+ return -ENAMETOOLONG; |
23419 |
++ sanitize_pin_path(buf); |
23420 |
+ pin_path = buf; |
23421 |
+ } else if (!map->pin_path) { |
23422 |
+ continue; |
23423 |
+diff --git a/tools/perf/tests/expand-cgroup.c b/tools/perf/tests/expand-cgroup.c |
23424 |
+index d5771e4d094f8..4c59f3ae438fc 100644 |
23425 |
+--- a/tools/perf/tests/expand-cgroup.c |
23426 |
++++ b/tools/perf/tests/expand-cgroup.c |
23427 |
+@@ -145,7 +145,7 @@ static int expand_libpfm_events(void) |
23428 |
+ int ret; |
23429 |
+ struct evlist *evlist; |
23430 |
+ struct rblist metric_events; |
23431 |
+- const char event_str[] = "UNHALTED_CORE_CYCLES"; |
23432 |
++ const char event_str[] = "CYCLES"; |
23433 |
+ struct option opt = { |
23434 |
+ .value = &evlist, |
23435 |
+ }; |
23436 |
+diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c |
23437 |
+index d3517a74d95e3..31f987bb7ebba 100644 |
23438 |
+--- a/tools/perf/tests/pmu-events.c |
23439 |
++++ b/tools/perf/tests/pmu-events.c |
23440 |
+@@ -561,7 +561,7 @@ static int metric_parse_fake(const char *str) |
23441 |
+ } |
23442 |
+ } |
23443 |
+ |
23444 |
+- if (expr__parse(&result, &ctx, str, 1)) |
23445 |
++ if (expr__parse(&result, &ctx, str, 0)) |
23446 |
+ pr_err("expr__parse failed\n"); |
23447 |
+ else |
23448 |
+ ret = 0; |
23449 |
+diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c |
23450 |
+index e687497b3aac0..a4a100425b3a2 100644 |
23451 |
+--- a/tools/perf/util/parse-regs-options.c |
23452 |
++++ b/tools/perf/util/parse-regs-options.c |
23453 |
+@@ -54,7 +54,7 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr) |
23454 |
+ #endif |
23455 |
+ fputc('\n', stderr); |
23456 |
+ /* just printing available regs */ |
23457 |
+- return -1; |
23458 |
++ goto error; |
23459 |
+ } |
23460 |
+ #ifdef HAVE_PERF_REGS_SUPPORT |
23461 |
+ for (r = sample_reg_masks; r->name; r++) { |
23462 |
+diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c |
23463 |
+index 064b63a6a3f31..bbecb449ea944 100644 |
23464 |
+--- a/tools/perf/util/probe-file.c |
23465 |
++++ b/tools/perf/util/probe-file.c |
23466 |
+@@ -791,7 +791,7 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, |
23467 |
+ const char *sdtgrp) |
23468 |
+ { |
23469 |
+ struct strbuf buf; |
23470 |
+- char *ret = NULL, **args; |
23471 |
++ char *ret = NULL; |
23472 |
+ int i, args_count, err; |
23473 |
+ unsigned long long ref_ctr_offset; |
23474 |
+ |
23475 |
+@@ -813,12 +813,19 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note, |
23476 |
+ goto out; |
23477 |
+ |
23478 |
+ if (note->args) { |
23479 |
+- args = argv_split(note->args, &args_count); |
23480 |
++ char **args = argv_split(note->args, &args_count); |
23481 |
++ |
23482 |
++ if (args == NULL) |
23483 |
++ goto error; |
23484 |
+ |
23485 |
+ for (i = 0; i < args_count; ++i) { |
23486 |
+- if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) |
23487 |
++ if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) { |
23488 |
++ argv_free(args); |
23489 |
+ goto error; |
23490 |
++ } |
23491 |
+ } |
23492 |
++ |
23493 |
++ argv_free(args); |
23494 |
+ } |
23495 |
+ |
23496 |
+ out: |
23497 |
+diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile |
23498 |
+index 542768f5195b7..136df8c102812 100644 |
23499 |
+--- a/tools/testing/selftests/bpf/Makefile |
23500 |
++++ b/tools/testing/selftests/bpf/Makefile |
23501 |
+@@ -220,7 +220,8 @@ $(RESOLVE_BTFIDS): $(BPFOBJ) | $(BUILD_DIR)/resolve_btfids \ |
23502 |
+ # build would have failed anyways. |
23503 |
+ define get_sys_includes |
23504 |
+ $(shell $(1) -v -E - </dev/null 2>&1 \ |
23505 |
+- | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') |
23506 |
++ | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ |
23507 |
++$(shell $(1) -dM -E - </dev/null | grep '#define __riscv_xlen ' | sed 's/#define /-D/' | sed 's/ /=/') |
23508 |
+ endef |
23509 |
+ |
23510 |
+ # Determine target endianness. |
23511 |
+diff --git a/tools/testing/selftests/bpf/progs/local_storage.c b/tools/testing/selftests/bpf/progs/local_storage.c |
23512 |
+index 0758ba229ae0e..09529e33be982 100644 |
23513 |
+--- a/tools/testing/selftests/bpf/progs/local_storage.c |
23514 |
++++ b/tools/testing/selftests/bpf/progs/local_storage.c |
23515 |
+@@ -58,20 +58,22 @@ int BPF_PROG(unlink_hook, struct inode *dir, struct dentry *victim) |
23516 |
+ { |
23517 |
+ __u32 pid = bpf_get_current_pid_tgid() >> 32; |
23518 |
+ struct dummy_storage *storage; |
23519 |
++ int err; |
23520 |
+ |
23521 |
+ if (pid != monitored_pid) |
23522 |
+ return 0; |
23523 |
+ |
23524 |
+ storage = bpf_inode_storage_get(&inode_storage_map, victim->d_inode, 0, |
23525 |
+- BPF_SK_STORAGE_GET_F_CREATE); |
23526 |
++ BPF_LOCAL_STORAGE_GET_F_CREATE); |
23527 |
+ if (!storage) |
23528 |
+ return 0; |
23529 |
+ |
23530 |
+- if (storage->value == DUMMY_STORAGE_VALUE) |
23531 |
++ if (storage->value != DUMMY_STORAGE_VALUE) |
23532 |
+ inode_storage_result = -1; |
23533 |
+ |
23534 |
+- inode_storage_result = |
23535 |
+- bpf_inode_storage_delete(&inode_storage_map, victim->d_inode); |
23536 |
++ err = bpf_inode_storage_delete(&inode_storage_map, victim->d_inode); |
23537 |
++ if (!err) |
23538 |
++ inode_storage_result = err; |
23539 |
+ |
23540 |
+ return 0; |
23541 |
+ } |
23542 |
+@@ -82,19 +84,23 @@ int BPF_PROG(socket_bind, struct socket *sock, struct sockaddr *address, |
23543 |
+ { |
23544 |
+ __u32 pid = bpf_get_current_pid_tgid() >> 32; |
23545 |
+ struct dummy_storage *storage; |
23546 |
++ int err; |
23547 |
+ |
23548 |
+ if (pid != monitored_pid) |
23549 |
+ return 0; |
23550 |
+ |
23551 |
+ storage = bpf_sk_storage_get(&sk_storage_map, sock->sk, 0, |
23552 |
+- BPF_SK_STORAGE_GET_F_CREATE); |
23553 |
++ BPF_LOCAL_STORAGE_GET_F_CREATE); |
23554 |
+ if (!storage) |
23555 |
+ return 0; |
23556 |
+ |
23557 |
+- if (storage->value == DUMMY_STORAGE_VALUE) |
23558 |
++ if (storage->value != DUMMY_STORAGE_VALUE) |
23559 |
+ sk_storage_result = -1; |
23560 |
+ |
23561 |
+- sk_storage_result = bpf_sk_storage_delete(&sk_storage_map, sock->sk); |
23562 |
++ err = bpf_sk_storage_delete(&sk_storage_map, sock->sk); |
23563 |
++ if (!err) |
23564 |
++ sk_storage_result = err; |
23565 |
++ |
23566 |
+ return 0; |
23567 |
+ } |
23568 |
+ |
23569 |
+@@ -109,7 +115,7 @@ int BPF_PROG(socket_post_create, struct socket *sock, int family, int type, |
23570 |
+ return 0; |
23571 |
+ |
23572 |
+ storage = bpf_sk_storage_get(&sk_storage_map, sock->sk, 0, |
23573 |
+- BPF_SK_STORAGE_GET_F_CREATE); |
23574 |
++ BPF_LOCAL_STORAGE_GET_F_CREATE); |
23575 |
+ if (!storage) |
23576 |
+ return 0; |
23577 |
+ |
23578 |
+@@ -131,7 +137,7 @@ int BPF_PROG(file_open, struct file *file) |
23579 |
+ return 0; |
23580 |
+ |
23581 |
+ storage = bpf_inode_storage_get(&inode_storage_map, file->f_inode, 0, |
23582 |
+- BPF_LOCAL_STORAGE_GET_F_CREATE); |
23583 |
++ BPF_LOCAL_STORAGE_GET_F_CREATE); |
23584 |
+ if (!storage) |
23585 |
+ return 0; |
23586 |
+ |
23587 |
+diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c |
23588 |
+index f48dbfe24ddc8..a621b58ab079d 100644 |
23589 |
+--- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c |
23590 |
++++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c |
23591 |
+@@ -15,7 +15,6 @@ |
23592 |
+ #include <linux/ip.h> |
23593 |
+ #include <linux/ipv6.h> |
23594 |
+ #include <linux/types.h> |
23595 |
+-#include <linux/tcp.h> |
23596 |
+ #include <linux/socket.h> |
23597 |
+ #include <linux/pkt_cls.h> |
23598 |
+ #include <linux/erspan.h> |
23599 |
+@@ -528,12 +527,11 @@ int _ipip_set_tunnel(struct __sk_buff *skb) |
23600 |
+ struct bpf_tunnel_key key = {}; |
23601 |
+ void *data = (void *)(long)skb->data; |
23602 |
+ struct iphdr *iph = data; |
23603 |
+- struct tcphdr *tcp = data + sizeof(*iph); |
23604 |
+ void *data_end = (void *)(long)skb->data_end; |
23605 |
+ int ret; |
23606 |
+ |
23607 |
+ /* single length check */ |
23608 |
+- if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { |
23609 |
++ if (data + sizeof(*iph) > data_end) { |
23610 |
+ ERROR(1); |
23611 |
+ return TC_ACT_SHOT; |
23612 |
+ } |
23613 |
+@@ -541,16 +539,6 @@ int _ipip_set_tunnel(struct __sk_buff *skb) |
23614 |
+ key.tunnel_ttl = 64; |
23615 |
+ if (iph->protocol == IPPROTO_ICMP) { |
23616 |
+ key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ |
23617 |
+- } else { |
23618 |
+- if (iph->protocol != IPPROTO_TCP || iph->ihl != 5) |
23619 |
+- return TC_ACT_SHOT; |
23620 |
+- |
23621 |
+- if (tcp->dest == bpf_htons(5200)) |
23622 |
+- key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ |
23623 |
+- else if (tcp->dest == bpf_htons(5201)) |
23624 |
+- key.remote_ipv4 = 0xac100165; /* 172.16.1.101 */ |
23625 |
+- else |
23626 |
+- return TC_ACT_SHOT; |
23627 |
+ } |
23628 |
+ |
23629 |
+ ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); |
23630 |
+@@ -585,19 +573,20 @@ int _ipip6_set_tunnel(struct __sk_buff *skb) |
23631 |
+ struct bpf_tunnel_key key = {}; |
23632 |
+ void *data = (void *)(long)skb->data; |
23633 |
+ struct iphdr *iph = data; |
23634 |
+- struct tcphdr *tcp = data + sizeof(*iph); |
23635 |
+ void *data_end = (void *)(long)skb->data_end; |
23636 |
+ int ret; |
23637 |
+ |
23638 |
+ /* single length check */ |
23639 |
+- if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { |
23640 |
++ if (data + sizeof(*iph) > data_end) { |
23641 |
+ ERROR(1); |
23642 |
+ return TC_ACT_SHOT; |
23643 |
+ } |
23644 |
+ |
23645 |
+ __builtin_memset(&key, 0x0, sizeof(key)); |
23646 |
+- key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ |
23647 |
+ key.tunnel_ttl = 64; |
23648 |
++ if (iph->protocol == IPPROTO_ICMP) { |
23649 |
++ key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ |
23650 |
++ } |
23651 |
+ |
23652 |
+ ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), |
23653 |
+ BPF_F_TUNINFO_IPV6); |
23654 |
+@@ -634,35 +623,18 @@ int _ip6ip6_set_tunnel(struct __sk_buff *skb) |
23655 |
+ struct bpf_tunnel_key key = {}; |
23656 |
+ void *data = (void *)(long)skb->data; |
23657 |
+ struct ipv6hdr *iph = data; |
23658 |
+- struct tcphdr *tcp = data + sizeof(*iph); |
23659 |
+ void *data_end = (void *)(long)skb->data_end; |
23660 |
+ int ret; |
23661 |
+ |
23662 |
+ /* single length check */ |
23663 |
+- if (data + sizeof(*iph) + sizeof(*tcp) > data_end) { |
23664 |
++ if (data + sizeof(*iph) > data_end) { |
23665 |
+ ERROR(1); |
23666 |
+ return TC_ACT_SHOT; |
23667 |
+ } |
23668 |
+ |
23669 |
+- key.remote_ipv6[0] = bpf_htonl(0x2401db00); |
23670 |
+ key.tunnel_ttl = 64; |
23671 |
+- |
23672 |
+ if (iph->nexthdr == 58 /* NEXTHDR_ICMP */) { |
23673 |
+- key.remote_ipv6[3] = bpf_htonl(1); |
23674 |
+- } else { |
23675 |
+- if (iph->nexthdr != 6 /* NEXTHDR_TCP */) { |
23676 |
+- ERROR(iph->nexthdr); |
23677 |
+- return TC_ACT_SHOT; |
23678 |
+- } |
23679 |
+- |
23680 |
+- if (tcp->dest == bpf_htons(5200)) { |
23681 |
+- key.remote_ipv6[3] = bpf_htonl(1); |
23682 |
+- } else if (tcp->dest == bpf_htons(5201)) { |
23683 |
+- key.remote_ipv6[3] = bpf_htonl(2); |
23684 |
+- } else { |
23685 |
+- ERROR(tcp->dest); |
23686 |
+- return TC_ACT_SHOT; |
23687 |
+- } |
23688 |
++ key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ |
23689 |
+ } |
23690 |
+ |
23691 |
+ ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), |
23692 |
+diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c |
23693 |
+index 0fa1e421c3d7a..427ca00a32177 100644 |
23694 |
+--- a/tools/testing/selftests/bpf/test_sockmap.c |
23695 |
++++ b/tools/testing/selftests/bpf/test_sockmap.c |
23696 |
+@@ -1273,6 +1273,16 @@ static char *test_to_str(int test) |
23697 |
+ return "unknown"; |
23698 |
+ } |
23699 |
+ |
23700 |
++static void append_str(char *dst, const char *src, size_t dst_cap) |
23701 |
++{ |
23702 |
++ size_t avail = dst_cap - strlen(dst); |
23703 |
++ |
23704 |
++ if (avail <= 1) /* just zero byte could be written */ |
23705 |
++ return; |
23706 |
++ |
23707 |
++ strncat(dst, src, avail - 1); /* strncat() adds + 1 for zero byte */ |
23708 |
++} |
23709 |
++ |
23710 |
+ #define OPTSTRING 60 |
23711 |
+ static void test_options(char *options) |
23712 |
+ { |
23713 |
+@@ -1281,42 +1291,42 @@ static void test_options(char *options) |
23714 |
+ memset(options, 0, OPTSTRING); |
23715 |
+ |
23716 |
+ if (txmsg_pass) |
23717 |
+- strncat(options, "pass,", OPTSTRING); |
23718 |
++ append_str(options, "pass,", OPTSTRING); |
23719 |
+ if (txmsg_redir) |
23720 |
+- strncat(options, "redir,", OPTSTRING); |
23721 |
++ append_str(options, "redir,", OPTSTRING); |
23722 |
+ if (txmsg_drop) |
23723 |
+- strncat(options, "drop,", OPTSTRING); |
23724 |
++ append_str(options, "drop,", OPTSTRING); |
23725 |
+ if (txmsg_apply) { |
23726 |
+ snprintf(tstr, OPTSTRING, "apply %d,", txmsg_apply); |
23727 |
+- strncat(options, tstr, OPTSTRING); |
23728 |
++ append_str(options, tstr, OPTSTRING); |
23729 |
+ } |
23730 |
+ if (txmsg_cork) { |
23731 |
+ snprintf(tstr, OPTSTRING, "cork %d,", txmsg_cork); |
23732 |
+- strncat(options, tstr, OPTSTRING); |
23733 |
++ append_str(options, tstr, OPTSTRING); |
23734 |
+ } |
23735 |
+ if (txmsg_start) { |
23736 |
+ snprintf(tstr, OPTSTRING, "start %d,", txmsg_start); |
23737 |
+- strncat(options, tstr, OPTSTRING); |
23738 |
++ append_str(options, tstr, OPTSTRING); |
23739 |
+ } |
23740 |
+ if (txmsg_end) { |
23741 |
+ snprintf(tstr, OPTSTRING, "end %d,", txmsg_end); |
23742 |
+- strncat(options, tstr, OPTSTRING); |
23743 |
++ append_str(options, tstr, OPTSTRING); |
23744 |
+ } |
23745 |
+ if (txmsg_start_pop) { |
23746 |
+ snprintf(tstr, OPTSTRING, "pop (%d,%d),", |
23747 |
+ txmsg_start_pop, txmsg_start_pop + txmsg_pop); |
23748 |
+- strncat(options, tstr, OPTSTRING); |
23749 |
++ append_str(options, tstr, OPTSTRING); |
23750 |
+ } |
23751 |
+ if (txmsg_ingress) |
23752 |
+- strncat(options, "ingress,", OPTSTRING); |
23753 |
++ append_str(options, "ingress,", OPTSTRING); |
23754 |
+ if (txmsg_redir_skb) |
23755 |
+- strncat(options, "redir_skb,", OPTSTRING); |
23756 |
++ append_str(options, "redir_skb,", OPTSTRING); |
23757 |
+ if (txmsg_ktls_skb) |
23758 |
+- strncat(options, "ktls_skb,", OPTSTRING); |
23759 |
++ append_str(options, "ktls_skb,", OPTSTRING); |
23760 |
+ if (ktls) |
23761 |
+- strncat(options, "ktls,", OPTSTRING); |
23762 |
++ append_str(options, "ktls,", OPTSTRING); |
23763 |
+ if (peek_flag) |
23764 |
+- strncat(options, "peek,", OPTSTRING); |
23765 |
++ append_str(options, "peek,", OPTSTRING); |
23766 |
+ } |
23767 |
+ |
23768 |
+ static int __test_exec(int cgrp, int test, struct sockmap_options *opt) |
23769 |
+diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh |
23770 |
+index bd12ec97a44df..1ccbe804e8e1c 100755 |
23771 |
+--- a/tools/testing/selftests/bpf/test_tunnel.sh |
23772 |
++++ b/tools/testing/selftests/bpf/test_tunnel.sh |
23773 |
+@@ -24,12 +24,12 @@ |
23774 |
+ # Root namespace with metadata-mode tunnel + BPF |
23775 |
+ # Device names and addresses: |
23776 |
+ # veth1 IP: 172.16.1.200, IPv6: 00::22 (underlay) |
23777 |
+-# tunnel dev <type>11, ex: gre11, IPv4: 10.1.1.200 (overlay) |
23778 |
++# tunnel dev <type>11, ex: gre11, IPv4: 10.1.1.200, IPv6: 1::22 (overlay) |
23779 |
+ # |
23780 |
+ # Namespace at_ns0 with native tunnel |
23781 |
+ # Device names and addresses: |
23782 |
+ # veth0 IPv4: 172.16.1.100, IPv6: 00::11 (underlay) |
23783 |
+-# tunnel dev <type>00, ex: gre00, IPv4: 10.1.1.100 (overlay) |
23784 |
++# tunnel dev <type>00, ex: gre00, IPv4: 10.1.1.100, IPv6: 1::11 (overlay) |
23785 |
+ # |
23786 |
+ # |
23787 |
+ # End-to-end ping packet flow |
23788 |
+@@ -250,7 +250,7 @@ add_ipip_tunnel() |
23789 |
+ ip addr add dev $DEV 10.1.1.200/24 |
23790 |
+ } |
23791 |
+ |
23792 |
+-add_ipip6tnl_tunnel() |
23793 |
++add_ip6tnl_tunnel() |
23794 |
+ { |
23795 |
+ ip netns exec at_ns0 ip addr add ::11/96 dev veth0 |
23796 |
+ ip netns exec at_ns0 ip link set dev veth0 up |
23797 |
+@@ -262,11 +262,13 @@ add_ipip6tnl_tunnel() |
23798 |
+ ip link add dev $DEV_NS type $TYPE \ |
23799 |
+ local ::11 remote ::22 |
23800 |
+ ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24 |
23801 |
++ ip netns exec at_ns0 ip addr add dev $DEV_NS 1::11/96 |
23802 |
+ ip netns exec at_ns0 ip link set dev $DEV_NS up |
23803 |
+ |
23804 |
+ # root namespace |
23805 |
+ ip link add dev $DEV type $TYPE external |
23806 |
+ ip addr add dev $DEV 10.1.1.200/24 |
23807 |
++ ip addr add dev $DEV 1::22/96 |
23808 |
+ ip link set dev $DEV up |
23809 |
+ } |
23810 |
+ |
23811 |
+@@ -534,7 +536,7 @@ test_ipip6() |
23812 |
+ |
23813 |
+ check $TYPE |
23814 |
+ config_device |
23815 |
+- add_ipip6tnl_tunnel |
23816 |
++ add_ip6tnl_tunnel |
23817 |
+ ip link set dev veth1 mtu 1500 |
23818 |
+ attach_bpf $DEV ipip6_set_tunnel ipip6_get_tunnel |
23819 |
+ # underlay |
23820 |
+@@ -553,6 +555,34 @@ test_ipip6() |
23821 |
+ echo -e ${GREEN}"PASS: $TYPE"${NC} |
23822 |
+ } |
23823 |
+ |
23824 |
++test_ip6ip6() |
23825 |
++{ |
23826 |
++ TYPE=ip6tnl |
23827 |
++ DEV_NS=ip6ip6tnl00 |
23828 |
++ DEV=ip6ip6tnl11 |
23829 |
++ ret=0 |
23830 |
++ |
23831 |
++ check $TYPE |
23832 |
++ config_device |
23833 |
++ add_ip6tnl_tunnel |
23834 |
++ ip link set dev veth1 mtu 1500 |
23835 |
++ attach_bpf $DEV ip6ip6_set_tunnel ip6ip6_get_tunnel |
23836 |
++ # underlay |
23837 |
++ ping6 $PING_ARG ::11 |
23838 |
++ # ip6 over ip6 |
23839 |
++ ping6 $PING_ARG 1::11 |
23840 |
++ check_err $? |
23841 |
++ ip netns exec at_ns0 ping6 $PING_ARG 1::22 |
23842 |
++ check_err $? |
23843 |
++ cleanup |
23844 |
++ |
23845 |
++ if [ $ret -ne 0 ]; then |
23846 |
++ echo -e ${RED}"FAIL: ip6$TYPE"${NC} |
23847 |
++ return 1 |
23848 |
++ fi |
23849 |
++ echo -e ${GREEN}"PASS: ip6$TYPE"${NC} |
23850 |
++} |
23851 |
++ |
23852 |
+ setup_xfrm_tunnel() |
23853 |
+ { |
23854 |
+ auth=0x$(printf '1%.0s' {1..40}) |
23855 |
+@@ -646,6 +676,7 @@ cleanup() |
23856 |
+ ip link del veth1 2> /dev/null |
23857 |
+ ip link del ipip11 2> /dev/null |
23858 |
+ ip link del ipip6tnl11 2> /dev/null |
23859 |
++ ip link del ip6ip6tnl11 2> /dev/null |
23860 |
+ ip link del gretap11 2> /dev/null |
23861 |
+ ip link del ip6gre11 2> /dev/null |
23862 |
+ ip link del ip6gretap11 2> /dev/null |
23863 |
+@@ -742,6 +773,10 @@ bpf_tunnel_test() |
23864 |
+ test_ipip6 |
23865 |
+ errors=$(( $errors + $? )) |
23866 |
+ |
23867 |
++ echo "Testing IP6IP6 tunnel..." |
23868 |
++ test_ip6ip6 |
23869 |
++ errors=$(( $errors + $? )) |
23870 |
++ |
23871 |
+ echo "Testing IPSec tunnel..." |
23872 |
+ test_xfrm_tunnel |
23873 |
+ errors=$(( $errors + $? )) |
23874 |
+diff --git a/tools/testing/selftests/run_kselftest.sh b/tools/testing/selftests/run_kselftest.sh |
23875 |
+index 609a4ef9300e3..97165a83df632 100755 |
23876 |
+--- a/tools/testing/selftests/run_kselftest.sh |
23877 |
++++ b/tools/testing/selftests/run_kselftest.sh |
23878 |
+@@ -48,7 +48,7 @@ while true; do |
23879 |
+ -l | --list) |
23880 |
+ echo "$available" |
23881 |
+ exit 0 ;; |
23882 |
+- -n | --dry-run) |
23883 |
++ -d | --dry-run) |
23884 |
+ dryrun="echo" |
23885 |
+ shift ;; |
23886 |
+ -h | --help) |
23887 |
+diff --git a/tools/testing/selftests/seccomp/config b/tools/testing/selftests/seccomp/config |
23888 |
+index 64c19d8eba795..ad431a5178fbe 100644 |
23889 |
+--- a/tools/testing/selftests/seccomp/config |
23890 |
++++ b/tools/testing/selftests/seccomp/config |
23891 |
+@@ -1,3 +1,4 @@ |
23892 |
++CONFIG_PID_NS=y |
23893 |
+ CONFIG_SECCOMP=y |
23894 |
+ CONFIG_SECCOMP_FILTER=y |
23895 |
+ CONFIG_USER_NS=y |