1 |
commit: d74b195b5da2b0ed808dfa000ab302de53abfcbc |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 3 11:48:16 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 3 11:48:16 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d74b195b |
7 |
|
8 |
Linux patch 5.7.6 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1005_linux-5.7.6.patch | 20870 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 20874 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 4ed3bb4..ba2f389 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -63,6 +63,10 @@ Patch: 1004_linux-5.8.5.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.8.5 |
23 |
|
24 |
+Patch: 1005_linux-5.8.6.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.8.6 |
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/1005_linux-5.7.6.patch b/1005_linux-5.7.6.patch |
33 |
new file mode 100644 |
34 |
index 0000000..9939e08 |
35 |
--- /dev/null |
36 |
+++ b/1005_linux-5.7.6.patch |
37 |
@@ -0,0 +1,20870 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index c48d489f82bc..f928cd1dfdc1 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 7 |
46 |
+-SUBLEVEL = 5 |
47 |
++SUBLEVEL = 6 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
52 |
+index 5d7cbd9164d4..669980c690f9 100644 |
53 |
+--- a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
54 |
++++ b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
55 |
+@@ -112,13 +112,13 @@ |
56 |
+ &kcs2 { |
57 |
+ // BMC KCS channel 2 |
58 |
+ status = "okay"; |
59 |
+- kcs_addr = <0xca8>; |
60 |
++ aspeed,lpc-io-reg = <0xca8>; |
61 |
+ }; |
62 |
+ |
63 |
+ &kcs3 { |
64 |
+ // BMC KCS channel 3 |
65 |
+ status = "okay"; |
66 |
+- kcs_addr = <0xca2>; |
67 |
++ aspeed,lpc-io-reg = <0xca2>; |
68 |
+ }; |
69 |
+ |
70 |
+ &mac0 { |
71 |
+diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi |
72 |
+index f12ec04d3cbc..bc92d3db7b78 100644 |
73 |
+--- a/arch/arm/boot/dts/aspeed-g5.dtsi |
74 |
++++ b/arch/arm/boot/dts/aspeed-g5.dtsi |
75 |
+@@ -426,22 +426,22 @@ |
76 |
+ #size-cells = <1>; |
77 |
+ ranges = <0x0 0x0 0x80>; |
78 |
+ |
79 |
+- kcs1: kcs1@0 { |
80 |
+- compatible = "aspeed,ast2500-kcs-bmc"; |
81 |
++ kcs1: kcs@24 { |
82 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
83 |
++ reg = <0x24 0x1>, <0x30 0x1>, <0x3c 0x1>; |
84 |
+ interrupts = <8>; |
85 |
+- kcs_chan = <1>; |
86 |
+ status = "disabled"; |
87 |
+ }; |
88 |
+- kcs2: kcs2@0 { |
89 |
+- compatible = "aspeed,ast2500-kcs-bmc"; |
90 |
++ kcs2: kcs@28 { |
91 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
92 |
++ reg = <0x28 0x1>, <0x34 0x1>, <0x40 0x1>; |
93 |
+ interrupts = <8>; |
94 |
+- kcs_chan = <2>; |
95 |
+ status = "disabled"; |
96 |
+ }; |
97 |
+- kcs3: kcs3@0 { |
98 |
+- compatible = "aspeed,ast2500-kcs-bmc"; |
99 |
++ kcs3: kcs@2c { |
100 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
101 |
++ reg = <0x2c 0x1>, <0x38 0x1>, <0x44 0x1>; |
102 |
+ interrupts = <8>; |
103 |
+- kcs_chan = <3>; |
104 |
+ status = "disabled"; |
105 |
+ }; |
106 |
+ }; |
107 |
+@@ -455,10 +455,10 @@ |
108 |
+ #size-cells = <1>; |
109 |
+ ranges = <0x0 0x80 0x1e0>; |
110 |
+ |
111 |
+- kcs4: kcs4@0 { |
112 |
+- compatible = "aspeed,ast2500-kcs-bmc"; |
113 |
++ kcs4: kcs@94 { |
114 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
115 |
++ reg = <0x94 0x1>, <0x98 0x1>, <0x9c 0x1>; |
116 |
+ interrupts = <8>; |
117 |
+- kcs_chan = <4>; |
118 |
+ status = "disabled"; |
119 |
+ }; |
120 |
+ |
121 |
+diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi |
122 |
+index 0a29b3b57a9d..a2d2ac720a51 100644 |
123 |
+--- a/arch/arm/boot/dts/aspeed-g6.dtsi |
124 |
++++ b/arch/arm/boot/dts/aspeed-g6.dtsi |
125 |
+@@ -65,6 +65,7 @@ |
126 |
+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
127 |
+ clocks = <&syscon ASPEED_CLK_HPLL>; |
128 |
+ arm,cpu-registers-not-fw-configured; |
129 |
++ always-on; |
130 |
+ }; |
131 |
+ |
132 |
+ ahb { |
133 |
+@@ -368,6 +369,7 @@ |
134 |
+ <&gic GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; |
135 |
+ clocks = <&syscon ASPEED_CLK_APB1>; |
136 |
+ clock-names = "PCLK"; |
137 |
++ status = "disabled"; |
138 |
+ }; |
139 |
+ |
140 |
+ uart1: serial@1e783000 { |
141 |
+@@ -433,22 +435,23 @@ |
142 |
+ #size-cells = <1>; |
143 |
+ ranges = <0x0 0x0 0x80>; |
144 |
+ |
145 |
+- kcs1: kcs1@0 { |
146 |
+- compatible = "aspeed,ast2600-kcs-bmc"; |
147 |
++ kcs1: kcs@24 { |
148 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
149 |
++ reg = <0x24 0x1>, <0x30 0x1>, <0x3c 0x1>; |
150 |
+ interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>; |
151 |
+ kcs_chan = <1>; |
152 |
+ status = "disabled"; |
153 |
+ }; |
154 |
+- kcs2: kcs2@0 { |
155 |
+- compatible = "aspeed,ast2600-kcs-bmc"; |
156 |
++ kcs2: kcs@28 { |
157 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
158 |
++ reg = <0x28 0x1>, <0x34 0x1>, <0x40 0x1>; |
159 |
+ interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
160 |
+- kcs_chan = <2>; |
161 |
+ status = "disabled"; |
162 |
+ }; |
163 |
+- kcs3: kcs3@0 { |
164 |
+- compatible = "aspeed,ast2600-kcs-bmc"; |
165 |
++ kcs3: kcs@2c { |
166 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
167 |
++ reg = <0x2c 0x1>, <0x38 0x1>, <0x44 0x1>; |
168 |
+ interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; |
169 |
+- kcs_chan = <3>; |
170 |
+ status = "disabled"; |
171 |
+ }; |
172 |
+ }; |
173 |
+@@ -462,10 +465,10 @@ |
174 |
+ #size-cells = <1>; |
175 |
+ ranges = <0x0 0x80 0x1e0>; |
176 |
+ |
177 |
+- kcs4: kcs4@0 { |
178 |
+- compatible = "aspeed,ast2600-kcs-bmc"; |
179 |
++ kcs4: kcs@94 { |
180 |
++ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
181 |
++ reg = <0x94 0x1>, <0x98 0x1>, <0x9c 0x1>; |
182 |
+ interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; |
183 |
+- kcs_chan = <4>; |
184 |
+ status = "disabled"; |
185 |
+ }; |
186 |
+ |
187 |
+diff --git a/arch/arm/boot/dts/bcm2835-common.dtsi b/arch/arm/boot/dts/bcm2835-common.dtsi |
188 |
+index 2b1d9d4c0cde..4119271c979d 100644 |
189 |
+--- a/arch/arm/boot/dts/bcm2835-common.dtsi |
190 |
++++ b/arch/arm/boot/dts/bcm2835-common.dtsi |
191 |
+@@ -130,7 +130,6 @@ |
192 |
+ compatible = "brcm,bcm2835-v3d"; |
193 |
+ reg = <0x7ec00000 0x1000>; |
194 |
+ interrupts = <1 10>; |
195 |
+- power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>; |
196 |
+ }; |
197 |
+ |
198 |
+ vc4: gpu { |
199 |
+diff --git a/arch/arm/boot/dts/bcm2835-rpi-common.dtsi b/arch/arm/boot/dts/bcm2835-rpi-common.dtsi |
200 |
+new file mode 100644 |
201 |
+index 000000000000..8a55b6cded59 |
202 |
+--- /dev/null |
203 |
++++ b/arch/arm/boot/dts/bcm2835-rpi-common.dtsi |
204 |
+@@ -0,0 +1,12 @@ |
205 |
++// SPDX-License-Identifier: GPL-2.0 |
206 |
++/* |
207 |
++ * This include file covers the common peripherals and configuration between |
208 |
++ * bcm2835, bcm2836 and bcm2837 implementations that interact with RPi's |
209 |
++ * firmware interface. |
210 |
++ */ |
211 |
++ |
212 |
++#include <dt-bindings/power/raspberrypi-power.h> |
213 |
++ |
214 |
++&v3d { |
215 |
++ power-domains = <&power RPI_POWER_DOMAIN_V3D>; |
216 |
++}; |
217 |
+diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi |
218 |
+index 53bf4579cc22..0549686134ea 100644 |
219 |
+--- a/arch/arm/boot/dts/bcm2835.dtsi |
220 |
++++ b/arch/arm/boot/dts/bcm2835.dtsi |
221 |
+@@ -1,6 +1,7 @@ |
222 |
+ // SPDX-License-Identifier: GPL-2.0 |
223 |
+ #include "bcm283x.dtsi" |
224 |
+ #include "bcm2835-common.dtsi" |
225 |
++#include "bcm2835-rpi-common.dtsi" |
226 |
+ |
227 |
+ / { |
228 |
+ compatible = "brcm,bcm2835"; |
229 |
+diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi |
230 |
+index 82d6c4662ae4..b390006aef79 100644 |
231 |
+--- a/arch/arm/boot/dts/bcm2836.dtsi |
232 |
++++ b/arch/arm/boot/dts/bcm2836.dtsi |
233 |
+@@ -1,6 +1,7 @@ |
234 |
+ // SPDX-License-Identifier: GPL-2.0 |
235 |
+ #include "bcm283x.dtsi" |
236 |
+ #include "bcm2835-common.dtsi" |
237 |
++#include "bcm2835-rpi-common.dtsi" |
238 |
+ |
239 |
+ / { |
240 |
+ compatible = "brcm,bcm2836"; |
241 |
+diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi |
242 |
+index 9e95fee78e19..0199ec98cd61 100644 |
243 |
+--- a/arch/arm/boot/dts/bcm2837.dtsi |
244 |
++++ b/arch/arm/boot/dts/bcm2837.dtsi |
245 |
+@@ -1,5 +1,6 @@ |
246 |
+ #include "bcm283x.dtsi" |
247 |
+ #include "bcm2835-common.dtsi" |
248 |
++#include "bcm2835-rpi-common.dtsi" |
249 |
+ |
250 |
+ / { |
251 |
+ compatible = "brcm,bcm2837"; |
252 |
+diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi |
253 |
+index e8b340bb99bc..fff123753b85 100644 |
254 |
+--- a/arch/arm/boot/dts/r8a7743.dtsi |
255 |
++++ b/arch/arm/boot/dts/r8a7743.dtsi |
256 |
+@@ -338,7 +338,7 @@ |
257 |
+ #thermal-sensor-cells = <0>; |
258 |
+ }; |
259 |
+ |
260 |
+- ipmmu_sy0: mmu@e6280000 { |
261 |
++ ipmmu_sy0: iommu@e6280000 { |
262 |
+ compatible = "renesas,ipmmu-r8a7743", |
263 |
+ "renesas,ipmmu-vmsa"; |
264 |
+ reg = <0 0xe6280000 0 0x1000>; |
265 |
+@@ -348,7 +348,7 @@ |
266 |
+ status = "disabled"; |
267 |
+ }; |
268 |
+ |
269 |
+- ipmmu_sy1: mmu@e6290000 { |
270 |
++ ipmmu_sy1: iommu@e6290000 { |
271 |
+ compatible = "renesas,ipmmu-r8a7743", |
272 |
+ "renesas,ipmmu-vmsa"; |
273 |
+ reg = <0 0xe6290000 0 0x1000>; |
274 |
+@@ -357,7 +357,7 @@ |
275 |
+ status = "disabled"; |
276 |
+ }; |
277 |
+ |
278 |
+- ipmmu_ds: mmu@e6740000 { |
279 |
++ ipmmu_ds: iommu@e6740000 { |
280 |
+ compatible = "renesas,ipmmu-r8a7743", |
281 |
+ "renesas,ipmmu-vmsa"; |
282 |
+ reg = <0 0xe6740000 0 0x1000>; |
283 |
+@@ -367,7 +367,7 @@ |
284 |
+ status = "disabled"; |
285 |
+ }; |
286 |
+ |
287 |
+- ipmmu_mp: mmu@ec680000 { |
288 |
++ ipmmu_mp: iommu@ec680000 { |
289 |
+ compatible = "renesas,ipmmu-r8a7743", |
290 |
+ "renesas,ipmmu-vmsa"; |
291 |
+ reg = <0 0xec680000 0 0x1000>; |
292 |
+@@ -376,7 +376,7 @@ |
293 |
+ status = "disabled"; |
294 |
+ }; |
295 |
+ |
296 |
+- ipmmu_mx: mmu@fe951000 { |
297 |
++ ipmmu_mx: iommu@fe951000 { |
298 |
+ compatible = "renesas,ipmmu-r8a7743", |
299 |
+ "renesas,ipmmu-vmsa"; |
300 |
+ reg = <0 0xfe951000 0 0x1000>; |
301 |
+@@ -386,7 +386,7 @@ |
302 |
+ status = "disabled"; |
303 |
+ }; |
304 |
+ |
305 |
+- ipmmu_gp: mmu@e62a0000 { |
306 |
++ ipmmu_gp: iommu@e62a0000 { |
307 |
+ compatible = "renesas,ipmmu-r8a7743", |
308 |
+ "renesas,ipmmu-vmsa"; |
309 |
+ reg = <0 0xe62a0000 0 0x1000>; |
310 |
+diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi |
311 |
+index def840b8b2d3..5050ac19041d 100644 |
312 |
+--- a/arch/arm/boot/dts/r8a7744.dtsi |
313 |
++++ b/arch/arm/boot/dts/r8a7744.dtsi |
314 |
+@@ -338,7 +338,7 @@ |
315 |
+ #thermal-sensor-cells = <0>; |
316 |
+ }; |
317 |
+ |
318 |
+- ipmmu_sy0: mmu@e6280000 { |
319 |
++ ipmmu_sy0: iommu@e6280000 { |
320 |
+ compatible = "renesas,ipmmu-r8a7744", |
321 |
+ "renesas,ipmmu-vmsa"; |
322 |
+ reg = <0 0xe6280000 0 0x1000>; |
323 |
+@@ -348,7 +348,7 @@ |
324 |
+ status = "disabled"; |
325 |
+ }; |
326 |
+ |
327 |
+- ipmmu_sy1: mmu@e6290000 { |
328 |
++ ipmmu_sy1: iommu@e6290000 { |
329 |
+ compatible = "renesas,ipmmu-r8a7744", |
330 |
+ "renesas,ipmmu-vmsa"; |
331 |
+ reg = <0 0xe6290000 0 0x1000>; |
332 |
+@@ -357,7 +357,7 @@ |
333 |
+ status = "disabled"; |
334 |
+ }; |
335 |
+ |
336 |
+- ipmmu_ds: mmu@e6740000 { |
337 |
++ ipmmu_ds: iommu@e6740000 { |
338 |
+ compatible = "renesas,ipmmu-r8a7744", |
339 |
+ "renesas,ipmmu-vmsa"; |
340 |
+ reg = <0 0xe6740000 0 0x1000>; |
341 |
+@@ -367,7 +367,7 @@ |
342 |
+ status = "disabled"; |
343 |
+ }; |
344 |
+ |
345 |
+- ipmmu_mp: mmu@ec680000 { |
346 |
++ ipmmu_mp: iommu@ec680000 { |
347 |
+ compatible = "renesas,ipmmu-r8a7744", |
348 |
+ "renesas,ipmmu-vmsa"; |
349 |
+ reg = <0 0xec680000 0 0x1000>; |
350 |
+@@ -376,7 +376,7 @@ |
351 |
+ status = "disabled"; |
352 |
+ }; |
353 |
+ |
354 |
+- ipmmu_mx: mmu@fe951000 { |
355 |
++ ipmmu_mx: iommu@fe951000 { |
356 |
+ compatible = "renesas,ipmmu-r8a7744", |
357 |
+ "renesas,ipmmu-vmsa"; |
358 |
+ reg = <0 0xfe951000 0 0x1000>; |
359 |
+@@ -386,7 +386,7 @@ |
360 |
+ status = "disabled"; |
361 |
+ }; |
362 |
+ |
363 |
+- ipmmu_gp: mmu@e62a0000 { |
364 |
++ ipmmu_gp: iommu@e62a0000 { |
365 |
+ compatible = "renesas,ipmmu-r8a7744", |
366 |
+ "renesas,ipmmu-vmsa"; |
367 |
+ reg = <0 0xe62a0000 0 0x1000>; |
368 |
+diff --git a/arch/arm/boot/dts/r8a7745.dtsi b/arch/arm/boot/dts/r8a7745.dtsi |
369 |
+index 7ab58d8bb740..b0d1fc24e97e 100644 |
370 |
+--- a/arch/arm/boot/dts/r8a7745.dtsi |
371 |
++++ b/arch/arm/boot/dts/r8a7745.dtsi |
372 |
+@@ -302,7 +302,7 @@ |
373 |
+ resets = <&cpg 407>; |
374 |
+ }; |
375 |
+ |
376 |
+- ipmmu_sy0: mmu@e6280000 { |
377 |
++ ipmmu_sy0: iommu@e6280000 { |
378 |
+ compatible = "renesas,ipmmu-r8a7745", |
379 |
+ "renesas,ipmmu-vmsa"; |
380 |
+ reg = <0 0xe6280000 0 0x1000>; |
381 |
+@@ -312,7 +312,7 @@ |
382 |
+ status = "disabled"; |
383 |
+ }; |
384 |
+ |
385 |
+- ipmmu_sy1: mmu@e6290000 { |
386 |
++ ipmmu_sy1: iommu@e6290000 { |
387 |
+ compatible = "renesas,ipmmu-r8a7745", |
388 |
+ "renesas,ipmmu-vmsa"; |
389 |
+ reg = <0 0xe6290000 0 0x1000>; |
390 |
+@@ -321,7 +321,7 @@ |
391 |
+ status = "disabled"; |
392 |
+ }; |
393 |
+ |
394 |
+- ipmmu_ds: mmu@e6740000 { |
395 |
++ ipmmu_ds: iommu@e6740000 { |
396 |
+ compatible = "renesas,ipmmu-r8a7745", |
397 |
+ "renesas,ipmmu-vmsa"; |
398 |
+ reg = <0 0xe6740000 0 0x1000>; |
399 |
+@@ -331,7 +331,7 @@ |
400 |
+ status = "disabled"; |
401 |
+ }; |
402 |
+ |
403 |
+- ipmmu_mp: mmu@ec680000 { |
404 |
++ ipmmu_mp: iommu@ec680000 { |
405 |
+ compatible = "renesas,ipmmu-r8a7745", |
406 |
+ "renesas,ipmmu-vmsa"; |
407 |
+ reg = <0 0xec680000 0 0x1000>; |
408 |
+@@ -340,7 +340,7 @@ |
409 |
+ status = "disabled"; |
410 |
+ }; |
411 |
+ |
412 |
+- ipmmu_mx: mmu@fe951000 { |
413 |
++ ipmmu_mx: iommu@fe951000 { |
414 |
+ compatible = "renesas,ipmmu-r8a7745", |
415 |
+ "renesas,ipmmu-vmsa"; |
416 |
+ reg = <0 0xfe951000 0 0x1000>; |
417 |
+@@ -350,7 +350,7 @@ |
418 |
+ status = "disabled"; |
419 |
+ }; |
420 |
+ |
421 |
+- ipmmu_gp: mmu@e62a0000 { |
422 |
++ ipmmu_gp: iommu@e62a0000 { |
423 |
+ compatible = "renesas,ipmmu-r8a7745", |
424 |
+ "renesas,ipmmu-vmsa"; |
425 |
+ reg = <0 0xe62a0000 0 0x1000>; |
426 |
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi |
427 |
+index e5ef9fd4284a..166d5566229d 100644 |
428 |
+--- a/arch/arm/boot/dts/r8a7790.dtsi |
429 |
++++ b/arch/arm/boot/dts/r8a7790.dtsi |
430 |
+@@ -427,7 +427,7 @@ |
431 |
+ #thermal-sensor-cells = <0>; |
432 |
+ }; |
433 |
+ |
434 |
+- ipmmu_sy0: mmu@e6280000 { |
435 |
++ ipmmu_sy0: iommu@e6280000 { |
436 |
+ compatible = "renesas,ipmmu-r8a7790", |
437 |
+ "renesas,ipmmu-vmsa"; |
438 |
+ reg = <0 0xe6280000 0 0x1000>; |
439 |
+@@ -437,7 +437,7 @@ |
440 |
+ status = "disabled"; |
441 |
+ }; |
442 |
+ |
443 |
+- ipmmu_sy1: mmu@e6290000 { |
444 |
++ ipmmu_sy1: iommu@e6290000 { |
445 |
+ compatible = "renesas,ipmmu-r8a7790", |
446 |
+ "renesas,ipmmu-vmsa"; |
447 |
+ reg = <0 0xe6290000 0 0x1000>; |
448 |
+@@ -446,7 +446,7 @@ |
449 |
+ status = "disabled"; |
450 |
+ }; |
451 |
+ |
452 |
+- ipmmu_ds: mmu@e6740000 { |
453 |
++ ipmmu_ds: iommu@e6740000 { |
454 |
+ compatible = "renesas,ipmmu-r8a7790", |
455 |
+ "renesas,ipmmu-vmsa"; |
456 |
+ reg = <0 0xe6740000 0 0x1000>; |
457 |
+@@ -456,7 +456,7 @@ |
458 |
+ status = "disabled"; |
459 |
+ }; |
460 |
+ |
461 |
+- ipmmu_mp: mmu@ec680000 { |
462 |
++ ipmmu_mp: iommu@ec680000 { |
463 |
+ compatible = "renesas,ipmmu-r8a7790", |
464 |
+ "renesas,ipmmu-vmsa"; |
465 |
+ reg = <0 0xec680000 0 0x1000>; |
466 |
+@@ -465,7 +465,7 @@ |
467 |
+ status = "disabled"; |
468 |
+ }; |
469 |
+ |
470 |
+- ipmmu_mx: mmu@fe951000 { |
471 |
++ ipmmu_mx: iommu@fe951000 { |
472 |
+ compatible = "renesas,ipmmu-r8a7790", |
473 |
+ "renesas,ipmmu-vmsa"; |
474 |
+ reg = <0 0xfe951000 0 0x1000>; |
475 |
+@@ -475,7 +475,7 @@ |
476 |
+ status = "disabled"; |
477 |
+ }; |
478 |
+ |
479 |
+- ipmmu_rt: mmu@ffc80000 { |
480 |
++ ipmmu_rt: iommu@ffc80000 { |
481 |
+ compatible = "renesas,ipmmu-r8a7790", |
482 |
+ "renesas,ipmmu-vmsa"; |
483 |
+ reg = <0 0xffc80000 0 0x1000>; |
484 |
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi |
485 |
+index 6e5bd86731cd..09e47cc17765 100644 |
486 |
+--- a/arch/arm/boot/dts/r8a7791.dtsi |
487 |
++++ b/arch/arm/boot/dts/r8a7791.dtsi |
488 |
+@@ -350,7 +350,7 @@ |
489 |
+ #thermal-sensor-cells = <0>; |
490 |
+ }; |
491 |
+ |
492 |
+- ipmmu_sy0: mmu@e6280000 { |
493 |
++ ipmmu_sy0: iommu@e6280000 { |
494 |
+ compatible = "renesas,ipmmu-r8a7791", |
495 |
+ "renesas,ipmmu-vmsa"; |
496 |
+ reg = <0 0xe6280000 0 0x1000>; |
497 |
+@@ -360,7 +360,7 @@ |
498 |
+ status = "disabled"; |
499 |
+ }; |
500 |
+ |
501 |
+- ipmmu_sy1: mmu@e6290000 { |
502 |
++ ipmmu_sy1: iommu@e6290000 { |
503 |
+ compatible = "renesas,ipmmu-r8a7791", |
504 |
+ "renesas,ipmmu-vmsa"; |
505 |
+ reg = <0 0xe6290000 0 0x1000>; |
506 |
+@@ -369,7 +369,7 @@ |
507 |
+ status = "disabled"; |
508 |
+ }; |
509 |
+ |
510 |
+- ipmmu_ds: mmu@e6740000 { |
511 |
++ ipmmu_ds: iommu@e6740000 { |
512 |
+ compatible = "renesas,ipmmu-r8a7791", |
513 |
+ "renesas,ipmmu-vmsa"; |
514 |
+ reg = <0 0xe6740000 0 0x1000>; |
515 |
+@@ -379,7 +379,7 @@ |
516 |
+ status = "disabled"; |
517 |
+ }; |
518 |
+ |
519 |
+- ipmmu_mp: mmu@ec680000 { |
520 |
++ ipmmu_mp: iommu@ec680000 { |
521 |
+ compatible = "renesas,ipmmu-r8a7791", |
522 |
+ "renesas,ipmmu-vmsa"; |
523 |
+ reg = <0 0xec680000 0 0x1000>; |
524 |
+@@ -388,7 +388,7 @@ |
525 |
+ status = "disabled"; |
526 |
+ }; |
527 |
+ |
528 |
+- ipmmu_mx: mmu@fe951000 { |
529 |
++ ipmmu_mx: iommu@fe951000 { |
530 |
+ compatible = "renesas,ipmmu-r8a7791", |
531 |
+ "renesas,ipmmu-vmsa"; |
532 |
+ reg = <0 0xfe951000 0 0x1000>; |
533 |
+@@ -398,7 +398,7 @@ |
534 |
+ status = "disabled"; |
535 |
+ }; |
536 |
+ |
537 |
+- ipmmu_rt: mmu@ffc80000 { |
538 |
++ ipmmu_rt: iommu@ffc80000 { |
539 |
+ compatible = "renesas,ipmmu-r8a7791", |
540 |
+ "renesas,ipmmu-vmsa"; |
541 |
+ reg = <0 0xffc80000 0 0x1000>; |
542 |
+@@ -407,7 +407,7 @@ |
543 |
+ status = "disabled"; |
544 |
+ }; |
545 |
+ |
546 |
+- ipmmu_gp: mmu@e62a0000 { |
547 |
++ ipmmu_gp: iommu@e62a0000 { |
548 |
+ compatible = "renesas,ipmmu-r8a7791", |
549 |
+ "renesas,ipmmu-vmsa"; |
550 |
+ reg = <0 0xe62a0000 0 0x1000>; |
551 |
+diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi |
552 |
+index dadbda16161b..1b62a7e06b42 100644 |
553 |
+--- a/arch/arm/boot/dts/r8a7793.dtsi |
554 |
++++ b/arch/arm/boot/dts/r8a7793.dtsi |
555 |
+@@ -336,7 +336,7 @@ |
556 |
+ #thermal-sensor-cells = <0>; |
557 |
+ }; |
558 |
+ |
559 |
+- ipmmu_sy0: mmu@e6280000 { |
560 |
++ ipmmu_sy0: iommu@e6280000 { |
561 |
+ compatible = "renesas,ipmmu-r8a7793", |
562 |
+ "renesas,ipmmu-vmsa"; |
563 |
+ reg = <0 0xe6280000 0 0x1000>; |
564 |
+@@ -346,7 +346,7 @@ |
565 |
+ status = "disabled"; |
566 |
+ }; |
567 |
+ |
568 |
+- ipmmu_sy1: mmu@e6290000 { |
569 |
++ ipmmu_sy1: iommu@e6290000 { |
570 |
+ compatible = "renesas,ipmmu-r8a7793", |
571 |
+ "renesas,ipmmu-vmsa"; |
572 |
+ reg = <0 0xe6290000 0 0x1000>; |
573 |
+@@ -355,7 +355,7 @@ |
574 |
+ status = "disabled"; |
575 |
+ }; |
576 |
+ |
577 |
+- ipmmu_ds: mmu@e6740000 { |
578 |
++ ipmmu_ds: iommu@e6740000 { |
579 |
+ compatible = "renesas,ipmmu-r8a7793", |
580 |
+ "renesas,ipmmu-vmsa"; |
581 |
+ reg = <0 0xe6740000 0 0x1000>; |
582 |
+@@ -365,7 +365,7 @@ |
583 |
+ status = "disabled"; |
584 |
+ }; |
585 |
+ |
586 |
+- ipmmu_mp: mmu@ec680000 { |
587 |
++ ipmmu_mp: iommu@ec680000 { |
588 |
+ compatible = "renesas,ipmmu-r8a7793", |
589 |
+ "renesas,ipmmu-vmsa"; |
590 |
+ reg = <0 0xec680000 0 0x1000>; |
591 |
+@@ -374,7 +374,7 @@ |
592 |
+ status = "disabled"; |
593 |
+ }; |
594 |
+ |
595 |
+- ipmmu_mx: mmu@fe951000 { |
596 |
++ ipmmu_mx: iommu@fe951000 { |
597 |
+ compatible = "renesas,ipmmu-r8a7793", |
598 |
+ "renesas,ipmmu-vmsa"; |
599 |
+ reg = <0 0xfe951000 0 0x1000>; |
600 |
+@@ -384,7 +384,7 @@ |
601 |
+ status = "disabled"; |
602 |
+ }; |
603 |
+ |
604 |
+- ipmmu_rt: mmu@ffc80000 { |
605 |
++ ipmmu_rt: iommu@ffc80000 { |
606 |
+ compatible = "renesas,ipmmu-r8a7793", |
607 |
+ "renesas,ipmmu-vmsa"; |
608 |
+ reg = <0 0xffc80000 0 0x1000>; |
609 |
+@@ -393,7 +393,7 @@ |
610 |
+ status = "disabled"; |
611 |
+ }; |
612 |
+ |
613 |
+- ipmmu_gp: mmu@e62a0000 { |
614 |
++ ipmmu_gp: iommu@e62a0000 { |
615 |
+ compatible = "renesas,ipmmu-r8a7793", |
616 |
+ "renesas,ipmmu-vmsa"; |
617 |
+ reg = <0 0xe62a0000 0 0x1000>; |
618 |
+diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi |
619 |
+index 2c9e7a1ebfec..8d7f8798628a 100644 |
620 |
+--- a/arch/arm/boot/dts/r8a7794.dtsi |
621 |
++++ b/arch/arm/boot/dts/r8a7794.dtsi |
622 |
+@@ -290,7 +290,7 @@ |
623 |
+ resets = <&cpg 407>; |
624 |
+ }; |
625 |
+ |
626 |
+- ipmmu_sy0: mmu@e6280000 { |
627 |
++ ipmmu_sy0: iommu@e6280000 { |
628 |
+ compatible = "renesas,ipmmu-r8a7794", |
629 |
+ "renesas,ipmmu-vmsa"; |
630 |
+ reg = <0 0xe6280000 0 0x1000>; |
631 |
+@@ -300,7 +300,7 @@ |
632 |
+ status = "disabled"; |
633 |
+ }; |
634 |
+ |
635 |
+- ipmmu_sy1: mmu@e6290000 { |
636 |
++ ipmmu_sy1: iommu@e6290000 { |
637 |
+ compatible = "renesas,ipmmu-r8a7794", |
638 |
+ "renesas,ipmmu-vmsa"; |
639 |
+ reg = <0 0xe6290000 0 0x1000>; |
640 |
+@@ -309,7 +309,7 @@ |
641 |
+ status = "disabled"; |
642 |
+ }; |
643 |
+ |
644 |
+- ipmmu_ds: mmu@e6740000 { |
645 |
++ ipmmu_ds: iommu@e6740000 { |
646 |
+ compatible = "renesas,ipmmu-r8a7794", |
647 |
+ "renesas,ipmmu-vmsa"; |
648 |
+ reg = <0 0xe6740000 0 0x1000>; |
649 |
+@@ -319,7 +319,7 @@ |
650 |
+ status = "disabled"; |
651 |
+ }; |
652 |
+ |
653 |
+- ipmmu_mp: mmu@ec680000 { |
654 |
++ ipmmu_mp: iommu@ec680000 { |
655 |
+ compatible = "renesas,ipmmu-r8a7794", |
656 |
+ "renesas,ipmmu-vmsa"; |
657 |
+ reg = <0 0xec680000 0 0x1000>; |
658 |
+@@ -328,7 +328,7 @@ |
659 |
+ status = "disabled"; |
660 |
+ }; |
661 |
+ |
662 |
+- ipmmu_mx: mmu@fe951000 { |
663 |
++ ipmmu_mx: iommu@fe951000 { |
664 |
+ compatible = "renesas,ipmmu-r8a7794", |
665 |
+ "renesas,ipmmu-vmsa"; |
666 |
+ reg = <0 0xfe951000 0 0x1000>; |
667 |
+@@ -338,7 +338,7 @@ |
668 |
+ status = "disabled"; |
669 |
+ }; |
670 |
+ |
671 |
+- ipmmu_gp: mmu@e62a0000 { |
672 |
++ ipmmu_gp: iommu@e62a0000 { |
673 |
+ compatible = "renesas,ipmmu-r8a7794", |
674 |
+ "renesas,ipmmu-vmsa"; |
675 |
+ reg = <0 0xe62a0000 0 0x1000>; |
676 |
+diff --git a/arch/arm/boot/dts/stm32mp157a-avenger96.dts b/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
677 |
+index 425175f7d83c..081037b510bc 100644 |
678 |
+--- a/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
679 |
++++ b/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
680 |
+@@ -92,6 +92,9 @@ |
681 |
+ #address-cells = <1>; |
682 |
+ #size-cells = <0>; |
683 |
+ compatible = "snps,dwmac-mdio"; |
684 |
++ reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>; |
685 |
++ reset-delay-us = <1000>; |
686 |
++ |
687 |
+ phy0: ethernet-phy@7 { |
688 |
+ reg = <7>; |
689 |
+ }; |
690 |
+diff --git a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
691 |
+index d277d043031b..4c6704e4c57e 100644 |
692 |
+--- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
693 |
++++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
694 |
+@@ -31,7 +31,7 @@ |
695 |
+ |
696 |
+ pwr_led { |
697 |
+ label = "bananapi-m2-zero:red:pwr"; |
698 |
+- gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */ |
699 |
++ gpios = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ |
700 |
+ default-state = "on"; |
701 |
+ }; |
702 |
+ }; |
703 |
+diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
704 |
+index 5c183483ec3b..8010cdcdb37a 100644 |
705 |
+--- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
706 |
++++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
707 |
+@@ -31,7 +31,7 @@ |
708 |
+ #interrupt-cells = <1>; |
709 |
+ ranges; |
710 |
+ |
711 |
+- nor_flash: flash@0,00000000 { |
712 |
++ nor_flash: flash@0 { |
713 |
+ compatible = "arm,vexpress-flash", "cfi-flash"; |
714 |
+ reg = <0 0x00000000 0x04000000>, |
715 |
+ <4 0x00000000 0x04000000>; |
716 |
+@@ -41,13 +41,13 @@ |
717 |
+ }; |
718 |
+ }; |
719 |
+ |
720 |
+- psram@1,00000000 { |
721 |
++ psram@100000000 { |
722 |
+ compatible = "arm,vexpress-psram", "mtd-ram"; |
723 |
+ reg = <1 0x00000000 0x02000000>; |
724 |
+ bank-width = <4>; |
725 |
+ }; |
726 |
+ |
727 |
+- ethernet@2,02000000 { |
728 |
++ ethernet@202000000 { |
729 |
+ compatible = "smsc,lan9118", "smsc,lan9115"; |
730 |
+ reg = <2 0x02000000 0x10000>; |
731 |
+ interrupts = <15>; |
732 |
+@@ -59,14 +59,14 @@ |
733 |
+ vddvario-supply = <&v2m_fixed_3v3>; |
734 |
+ }; |
735 |
+ |
736 |
+- usb@2,03000000 { |
737 |
++ usb@203000000 { |
738 |
+ compatible = "nxp,usb-isp1761"; |
739 |
+ reg = <2 0x03000000 0x20000>; |
740 |
+ interrupts = <16>; |
741 |
+ port1-otg; |
742 |
+ }; |
743 |
+ |
744 |
+- iofpga@3,00000000 { |
745 |
++ iofpga@300000000 { |
746 |
+ compatible = "simple-bus"; |
747 |
+ #address-cells = <1>; |
748 |
+ #size-cells = <1>; |
749 |
+diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c |
750 |
+index 3461d12bbfc0..a5d3708fedf6 100644 |
751 |
+--- a/arch/arm/mach-davinci/board-dm644x-evm.c |
752 |
++++ b/arch/arm/mach-davinci/board-dm644x-evm.c |
753 |
+@@ -655,19 +655,6 @@ static struct i2c_board_info __initdata i2c_info[] = { |
754 |
+ }, |
755 |
+ }; |
756 |
+ |
757 |
+-/* Fixed regulator support */ |
758 |
+-static struct regulator_consumer_supply fixed_supplies_3_3v[] = { |
759 |
+- /* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */ |
760 |
+- REGULATOR_SUPPLY("AVDD", "1-001b"), |
761 |
+- REGULATOR_SUPPLY("DRVDD", "1-001b"), |
762 |
+-}; |
763 |
+- |
764 |
+-static struct regulator_consumer_supply fixed_supplies_1_8v[] = { |
765 |
+- /* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */ |
766 |
+- REGULATOR_SUPPLY("IOVDD", "1-001b"), |
767 |
+- REGULATOR_SUPPLY("DVDD", "1-001b"), |
768 |
+-}; |
769 |
+- |
770 |
+ #define DM644X_I2C_SDA_PIN GPIO_TO_PIN(2, 12) |
771 |
+ #define DM644X_I2C_SCL_PIN GPIO_TO_PIN(2, 11) |
772 |
+ |
773 |
+@@ -700,6 +687,19 @@ static void __init evm_init_i2c(void) |
774 |
+ } |
775 |
+ #endif |
776 |
+ |
777 |
++/* Fixed regulator support */ |
778 |
++static struct regulator_consumer_supply fixed_supplies_3_3v[] = { |
779 |
++ /* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */ |
780 |
++ REGULATOR_SUPPLY("AVDD", "1-001b"), |
781 |
++ REGULATOR_SUPPLY("DRVDD", "1-001b"), |
782 |
++}; |
783 |
++ |
784 |
++static struct regulator_consumer_supply fixed_supplies_1_8v[] = { |
785 |
++ /* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */ |
786 |
++ REGULATOR_SUPPLY("IOVDD", "1-001b"), |
787 |
++ REGULATOR_SUPPLY("DVDD", "1-001b"), |
788 |
++}; |
789 |
++ |
790 |
+ #define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) |
791 |
+ |
792 |
+ /* venc standard timings */ |
793 |
+diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig |
794 |
+index 982eabc36163..2406cab73835 100644 |
795 |
+--- a/arch/arm/mach-integrator/Kconfig |
796 |
++++ b/arch/arm/mach-integrator/Kconfig |
797 |
+@@ -4,6 +4,8 @@ menuconfig ARCH_INTEGRATOR |
798 |
+ depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 |
799 |
+ select ARM_AMBA |
800 |
+ select COMMON_CLK_VERSATILE |
801 |
++ select CMA |
802 |
++ select DMA_CMA |
803 |
+ select HAVE_TCM |
804 |
+ select ICST |
805 |
+ select MFD_SYSCON |
806 |
+@@ -35,14 +37,13 @@ config INTEGRATOR_IMPD1 |
807 |
+ select ARM_VIC |
808 |
+ select GPIO_PL061 |
809 |
+ select GPIOLIB |
810 |
++ select REGULATOR |
811 |
++ select REGULATOR_FIXED_VOLTAGE |
812 |
+ help |
813 |
+ The IM-PD1 is an add-on logic module for the Integrator which |
814 |
+ allows ARM(R) Ltd PrimeCells to be developed and evaluated. |
815 |
+ The IM-PD1 can be found on the Integrator/PP2 platform. |
816 |
+ |
817 |
+- To compile this driver as a module, choose M here: the |
818 |
+- module will be called impd1. |
819 |
+- |
820 |
+ config INTEGRATOR_CM7TDMI |
821 |
+ bool "Integrator/CM7TDMI core module" |
822 |
+ depends on ARCH_INTEGRATOR_AP |
823 |
+diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms |
824 |
+index 55d70cfe0f9e..3c7e310fd8bf 100644 |
825 |
+--- a/arch/arm64/Kconfig.platforms |
826 |
++++ b/arch/arm64/Kconfig.platforms |
827 |
+@@ -248,7 +248,7 @@ config ARCH_TEGRA |
828 |
+ This enables support for the NVIDIA Tegra SoC family. |
829 |
+ |
830 |
+ config ARCH_SPRD |
831 |
+- tristate "Spreadtrum SoC platform" |
832 |
++ bool "Spreadtrum SoC platform" |
833 |
+ help |
834 |
+ Support for Spreadtrum ARM based SoCs |
835 |
+ |
836 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
837 |
+index aace3d32a3df..8e6281c685fa 100644 |
838 |
+--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
839 |
++++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
840 |
+@@ -1735,18 +1735,18 @@ |
841 |
+ }; |
842 |
+ |
843 |
+ sram: sram@fffc0000 { |
844 |
+- compatible = "amlogic,meson-axg-sram", "mmio-sram"; |
845 |
++ compatible = "mmio-sram"; |
846 |
+ reg = <0x0 0xfffc0000 0x0 0x20000>; |
847 |
+ #address-cells = <1>; |
848 |
+ #size-cells = <1>; |
849 |
+ ranges = <0 0x0 0xfffc0000 0x20000>; |
850 |
+ |
851 |
+- cpu_scp_lpri: scp-shmem@13000 { |
852 |
++ cpu_scp_lpri: scp-sram@13000 { |
853 |
+ compatible = "amlogic,meson-axg-scp-shmem"; |
854 |
+ reg = <0x13000 0x400>; |
855 |
+ }; |
856 |
+ |
857 |
+- cpu_scp_hpri: scp-shmem@13400 { |
858 |
++ cpu_scp_hpri: scp-sram@13400 { |
859 |
+ compatible = "amlogic,meson-axg-scp-shmem"; |
860 |
+ reg = <0x13400 0x400>; |
861 |
+ }; |
862 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts |
863 |
+index 06c5430eb92d..fdaacfd96b97 100644 |
864 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts |
865 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts |
866 |
+@@ -14,7 +14,7 @@ |
867 |
+ #include <dt-bindings/sound/meson-g12a-tohdmitx.h> |
868 |
+ |
869 |
+ / { |
870 |
+- compatible = "ugoos,am6", "amlogic,g12b"; |
871 |
++ compatible = "ugoos,am6", "amlogic,s922x", "amlogic,g12b"; |
872 |
+ model = "Ugoos AM6"; |
873 |
+ |
874 |
+ aliases { |
875 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi |
876 |
+index 248b018c83d5..b1da36fdeac6 100644 |
877 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi |
878 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi |
879 |
+@@ -96,14 +96,14 @@ |
880 |
+ leds { |
881 |
+ compatible = "gpio-leds"; |
882 |
+ |
883 |
+- green { |
884 |
++ led-green { |
885 |
+ color = <LED_COLOR_ID_GREEN>; |
886 |
+ function = LED_FUNCTION_DISK_ACTIVITY; |
887 |
+ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; |
888 |
+ linux,default-trigger = "disk-activity"; |
889 |
+ }; |
890 |
+ |
891 |
+- blue { |
892 |
++ led-blue { |
893 |
+ color = <LED_COLOR_ID_BLUE>; |
894 |
+ function = LED_FUNCTION_STATUS; |
895 |
+ gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; |
896 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
897 |
+index 03f79fe045b7..e2bb68ec8502 100644 |
898 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
899 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
900 |
+@@ -398,20 +398,20 @@ |
901 |
+ }; |
902 |
+ |
903 |
+ sram: sram@c8000000 { |
904 |
+- compatible = "amlogic,meson-gx-sram", "amlogic,meson-gxbb-sram", "mmio-sram"; |
905 |
++ compatible = "mmio-sram"; |
906 |
+ reg = <0x0 0xc8000000 0x0 0x14000>; |
907 |
+ |
908 |
+ #address-cells = <1>; |
909 |
+ #size-cells = <1>; |
910 |
+ ranges = <0 0x0 0xc8000000 0x14000>; |
911 |
+ |
912 |
+- cpu_scp_lpri: scp-shmem@0 { |
913 |
+- compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem"; |
914 |
++ cpu_scp_lpri: scp-sram@0 { |
915 |
++ compatible = "amlogic,meson-gxbb-scp-shmem"; |
916 |
+ reg = <0x13000 0x400>; |
917 |
+ }; |
918 |
+ |
919 |
+- cpu_scp_hpri: scp-shmem@200 { |
920 |
+- compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem"; |
921 |
++ cpu_scp_hpri: scp-sram@200 { |
922 |
++ compatible = "amlogic,meson-gxbb-scp-shmem"; |
923 |
+ reg = <0x13400 0x400>; |
924 |
+ }; |
925 |
+ }; |
926 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts |
927 |
+index 6c9cc45fb417..e8394a8269ee 100644 |
928 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts |
929 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts |
930 |
+@@ -11,7 +11,7 @@ |
931 |
+ #include <dt-bindings/input/input.h> |
932 |
+ #include <dt-bindings/leds/common.h> |
933 |
+ / { |
934 |
+- compatible = "videostrong,kii-pro", "amlogic,p201", "amlogic,s905", "amlogic,meson-gxbb"; |
935 |
++ compatible = "videostrong,kii-pro", "amlogic,meson-gxbb"; |
936 |
+ model = "Videostrong KII Pro"; |
937 |
+ |
938 |
+ leds { |
939 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
940 |
+index d6ca684e0e61..7be3e354093b 100644 |
941 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
942 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
943 |
+@@ -29,7 +29,7 @@ |
944 |
+ leds { |
945 |
+ compatible = "gpio-leds"; |
946 |
+ |
947 |
+- stat { |
948 |
++ led-stat { |
949 |
+ label = "nanopi-k2:blue:stat"; |
950 |
+ gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; |
951 |
+ default-state = "on"; |
952 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |
953 |
+index 65ec7dea828c..67d901ed2fa3 100644 |
954 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |
955 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |
956 |
+@@ -31,7 +31,7 @@ |
957 |
+ |
958 |
+ leds { |
959 |
+ compatible = "gpio-leds"; |
960 |
+- blue { |
961 |
++ led-blue { |
962 |
+ label = "a95x:system-status"; |
963 |
+ gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; |
964 |
+ linux,default-trigger = "heartbeat"; |
965 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
966 |
+index b46ef985bb44..70fcfb7b0683 100644 |
967 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
968 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
969 |
+@@ -49,7 +49,7 @@ |
970 |
+ |
971 |
+ leds { |
972 |
+ compatible = "gpio-leds"; |
973 |
+- blue { |
974 |
++ led-blue { |
975 |
+ label = "c2:blue:alive"; |
976 |
+ gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; |
977 |
+ linux,default-trigger = "heartbeat"; |
978 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
979 |
+index 45cb83625951..222ee8069cfa 100644 |
980 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
981 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
982 |
+@@ -20,7 +20,7 @@ |
983 |
+ leds { |
984 |
+ compatible = "gpio-leds"; |
985 |
+ |
986 |
+- blue { |
987 |
++ led-blue { |
988 |
+ label = "vega-s95:blue:on"; |
989 |
+ gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; |
990 |
+ default-state = "on"; |
991 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts |
992 |
+index 1d32d1f6d032..2ab8a3d10079 100644 |
993 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts |
994 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts |
995 |
+@@ -14,13 +14,13 @@ |
996 |
+ model = "WeTek Play 2"; |
997 |
+ |
998 |
+ leds { |
999 |
+- wifi { |
1000 |
++ led-wifi { |
1001 |
+ label = "wetek-play:wifi-status"; |
1002 |
+ gpios = <&gpio GPIODV_26 GPIO_ACTIVE_HIGH>; |
1003 |
+ default-state = "off"; |
1004 |
+ }; |
1005 |
+ |
1006 |
+- ethernet { |
1007 |
++ led-ethernet { |
1008 |
+ label = "wetek-play:ethernet-status"; |
1009 |
+ gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; |
1010 |
+ default-state = "off"; |
1011 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
1012 |
+index dee51cf95223..d6133af09d64 100644 |
1013 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
1014 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
1015 |
+@@ -25,7 +25,7 @@ |
1016 |
+ leds { |
1017 |
+ compatible = "gpio-leds"; |
1018 |
+ |
1019 |
+- system { |
1020 |
++ led-system { |
1021 |
+ label = "wetek-play:system-status"; |
1022 |
+ gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; |
1023 |
+ default-state = "on"; |
1024 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
1025 |
+index e8348b2728db..a4a71c13891b 100644 |
1026 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
1027 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
1028 |
+@@ -54,14 +54,14 @@ |
1029 |
+ leds { |
1030 |
+ compatible = "gpio-leds"; |
1031 |
+ |
1032 |
+- system { |
1033 |
++ led-system { |
1034 |
+ label = "librecomputer:system-status"; |
1035 |
+ gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; |
1036 |
+ default-state = "on"; |
1037 |
+ panic-indicator; |
1038 |
+ }; |
1039 |
+ |
1040 |
+- blue { |
1041 |
++ led-blue { |
1042 |
+ label = "librecomputer:blue"; |
1043 |
+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; |
1044 |
+ linux,default-trigger = "heartbeat"; |
1045 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
1046 |
+index 420a88e9a195..c89c9f846fb1 100644 |
1047 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
1048 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
1049 |
+@@ -36,13 +36,13 @@ |
1050 |
+ leds { |
1051 |
+ compatible = "gpio-leds"; |
1052 |
+ |
1053 |
+- blue { |
1054 |
++ led-blue { |
1055 |
+ label = "rbox-pro:blue:on"; |
1056 |
+ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; |
1057 |
+ default-state = "on"; |
1058 |
+ }; |
1059 |
+ |
1060 |
+- red { |
1061 |
++ led-red { |
1062 |
+ label = "rbox-pro:red:standby"; |
1063 |
+ gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; |
1064 |
+ default-state = "off"; |
1065 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
1066 |
+index 094ecf2222bb..1ef1e3672b96 100644 |
1067 |
+--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
1068 |
++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
1069 |
+@@ -39,13 +39,13 @@ |
1070 |
+ leds { |
1071 |
+ compatible = "gpio-leds"; |
1072 |
+ |
1073 |
+- white { |
1074 |
++ led-white { |
1075 |
+ label = "vim3:white:sys"; |
1076 |
+ gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; |
1077 |
+ linux,default-trigger = "heartbeat"; |
1078 |
+ }; |
1079 |
+ |
1080 |
+- red { |
1081 |
++ led-red { |
1082 |
+ label = "vim3:red"; |
1083 |
+ gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; |
1084 |
+ }; |
1085 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
1086 |
+index dfb2438851c0..5ab139a34c01 100644 |
1087 |
+--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
1088 |
++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
1089 |
+@@ -104,7 +104,7 @@ |
1090 |
+ leds { |
1091 |
+ compatible = "gpio-leds"; |
1092 |
+ |
1093 |
+- bluetooth { |
1094 |
++ led-bluetooth { |
1095 |
+ label = "sei610:blue:bt"; |
1096 |
+ gpios = <&gpio GPIOC_7 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; |
1097 |
+ default-state = "off"; |
1098 |
+diff --git a/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi b/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
1099 |
+index 15fe81738e94..dfb23dfc0b0f 100644 |
1100 |
+--- a/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
1101 |
++++ b/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
1102 |
+@@ -8,7 +8,7 @@ |
1103 |
+ gic: interrupt-controller@2c001000 { |
1104 |
+ compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; |
1105 |
+ #interrupt-cells = <3>; |
1106 |
+- #address-cells = <2>; |
1107 |
++ #address-cells = <1>; |
1108 |
+ interrupt-controller; |
1109 |
+ reg = <0x0 0x2c001000 0 0x1000>, |
1110 |
+ <0x0 0x2c002000 0 0x2000>, |
1111 |
+diff --git a/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi b/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
1112 |
+index f2c75c756039..906f51935b36 100644 |
1113 |
+--- a/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
1114 |
++++ b/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
1115 |
+@@ -8,9 +8,9 @@ |
1116 |
+ gic: interrupt-controller@2f000000 { |
1117 |
+ compatible = "arm,gic-v3"; |
1118 |
+ #interrupt-cells = <3>; |
1119 |
+- #address-cells = <2>; |
1120 |
+- #size-cells = <2>; |
1121 |
+- ranges; |
1122 |
++ #address-cells = <1>; |
1123 |
++ #size-cells = <1>; |
1124 |
++ ranges = <0x0 0x0 0x2f000000 0x100000>; |
1125 |
+ interrupt-controller; |
1126 |
+ reg = <0x0 0x2f000000 0x0 0x10000>, |
1127 |
+ <0x0 0x2f100000 0x0 0x200000>, |
1128 |
+@@ -22,7 +22,7 @@ |
1129 |
+ its: its@2f020000 { |
1130 |
+ compatible = "arm,gic-v3-its"; |
1131 |
+ msi-controller; |
1132 |
+- reg = <0x0 0x2f020000 0x0 0x20000>; |
1133 |
++ reg = <0x20000 0x20000>; |
1134 |
+ }; |
1135 |
+ }; |
1136 |
+ }; |
1137 |
+diff --git a/arch/arm64/boot/dts/arm/foundation-v8.dtsi b/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
1138 |
+index 12f039fa3dad..e2da63f78298 100644 |
1139 |
+--- a/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
1140 |
++++ b/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
1141 |
+@@ -107,51 +107,51 @@ |
1142 |
+ |
1143 |
+ #interrupt-cells = <1>; |
1144 |
+ interrupt-map-mask = <0 0 63>; |
1145 |
+- interrupt-map = <0 0 0 &gic 0 0 GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, |
1146 |
+- <0 0 1 &gic 0 0 GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, |
1147 |
+- <0 0 2 &gic 0 0 GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, |
1148 |
+- <0 0 3 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, |
1149 |
+- <0 0 4 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, |
1150 |
+- <0 0 5 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, |
1151 |
+- <0 0 6 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, |
1152 |
+- <0 0 7 &gic 0 0 GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, |
1153 |
+- <0 0 8 &gic 0 0 GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, |
1154 |
+- <0 0 9 &gic 0 0 GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
1155 |
+- <0 0 10 &gic 0 0 GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, |
1156 |
+- <0 0 11 &gic 0 0 GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
1157 |
+- <0 0 12 &gic 0 0 GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, |
1158 |
+- <0 0 13 &gic 0 0 GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, |
1159 |
+- <0 0 14 &gic 0 0 GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
1160 |
+- <0 0 15 &gic 0 0 GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, |
1161 |
+- <0 0 16 &gic 0 0 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, |
1162 |
+- <0 0 17 &gic 0 0 GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
1163 |
+- <0 0 18 &gic 0 0 GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, |
1164 |
+- <0 0 19 &gic 0 0 GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, |
1165 |
+- <0 0 20 &gic 0 0 GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, |
1166 |
+- <0 0 21 &gic 0 0 GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, |
1167 |
+- <0 0 22 &gic 0 0 GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, |
1168 |
+- <0 0 23 &gic 0 0 GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, |
1169 |
+- <0 0 24 &gic 0 0 GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, |
1170 |
+- <0 0 25 &gic 0 0 GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, |
1171 |
+- <0 0 26 &gic 0 0 GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, |
1172 |
+- <0 0 27 &gic 0 0 GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, |
1173 |
+- <0 0 28 &gic 0 0 GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, |
1174 |
+- <0 0 29 &gic 0 0 GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, |
1175 |
+- <0 0 30 &gic 0 0 GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, |
1176 |
+- <0 0 31 &gic 0 0 GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, |
1177 |
+- <0 0 32 &gic 0 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, |
1178 |
+- <0 0 33 &gic 0 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, |
1179 |
+- <0 0 34 &gic 0 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, |
1180 |
+- <0 0 35 &gic 0 0 GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, |
1181 |
+- <0 0 36 &gic 0 0 GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, |
1182 |
+- <0 0 37 &gic 0 0 GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, |
1183 |
+- <0 0 38 &gic 0 0 GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, |
1184 |
+- <0 0 39 &gic 0 0 GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, |
1185 |
+- <0 0 40 &gic 0 0 GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, |
1186 |
+- <0 0 41 &gic 0 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, |
1187 |
+- <0 0 42 &gic 0 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
1188 |
+- |
1189 |
+- ethernet@2,02000000 { |
1190 |
++ interrupt-map = <0 0 0 &gic 0 GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, |
1191 |
++ <0 0 1 &gic 0 GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, |
1192 |
++ <0 0 2 &gic 0 GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, |
1193 |
++ <0 0 3 &gic 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, |
1194 |
++ <0 0 4 &gic 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, |
1195 |
++ <0 0 5 &gic 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, |
1196 |
++ <0 0 6 &gic 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, |
1197 |
++ <0 0 7 &gic 0 GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, |
1198 |
++ <0 0 8 &gic 0 GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, |
1199 |
++ <0 0 9 &gic 0 GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
1200 |
++ <0 0 10 &gic 0 GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, |
1201 |
++ <0 0 11 &gic 0 GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
1202 |
++ <0 0 12 &gic 0 GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, |
1203 |
++ <0 0 13 &gic 0 GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, |
1204 |
++ <0 0 14 &gic 0 GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
1205 |
++ <0 0 15 &gic 0 GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, |
1206 |
++ <0 0 16 &gic 0 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, |
1207 |
++ <0 0 17 &gic 0 GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
1208 |
++ <0 0 18 &gic 0 GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, |
1209 |
++ <0 0 19 &gic 0 GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, |
1210 |
++ <0 0 20 &gic 0 GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, |
1211 |
++ <0 0 21 &gic 0 GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, |
1212 |
++ <0 0 22 &gic 0 GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, |
1213 |
++ <0 0 23 &gic 0 GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, |
1214 |
++ <0 0 24 &gic 0 GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, |
1215 |
++ <0 0 25 &gic 0 GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, |
1216 |
++ <0 0 26 &gic 0 GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, |
1217 |
++ <0 0 27 &gic 0 GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, |
1218 |
++ <0 0 28 &gic 0 GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, |
1219 |
++ <0 0 29 &gic 0 GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, |
1220 |
++ <0 0 30 &gic 0 GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, |
1221 |
++ <0 0 31 &gic 0 GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, |
1222 |
++ <0 0 32 &gic 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, |
1223 |
++ <0 0 33 &gic 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, |
1224 |
++ <0 0 34 &gic 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, |
1225 |
++ <0 0 35 &gic 0 GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, |
1226 |
++ <0 0 36 &gic 0 GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, |
1227 |
++ <0 0 37 &gic 0 GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, |
1228 |
++ <0 0 38 &gic 0 GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, |
1229 |
++ <0 0 39 &gic 0 GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, |
1230 |
++ <0 0 40 &gic 0 GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, |
1231 |
++ <0 0 41 &gic 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, |
1232 |
++ <0 0 42 &gic 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
1233 |
++ |
1234 |
++ ethernet@202000000 { |
1235 |
+ compatible = "smsc,lan91c111"; |
1236 |
+ reg = <2 0x02000000 0x10000>; |
1237 |
+ interrupts = <15>; |
1238 |
+@@ -178,7 +178,7 @@ |
1239 |
+ clock-output-names = "v2m:refclk32khz"; |
1240 |
+ }; |
1241 |
+ |
1242 |
+- iofpga@3,00000000 { |
1243 |
++ iofpga@300000000 { |
1244 |
+ compatible = "simple-bus"; |
1245 |
+ #address-cells = <1>; |
1246 |
+ #size-cells = <1>; |
1247 |
+diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi |
1248 |
+index f5889281545f..59b6ac0b828a 100644 |
1249 |
+--- a/arch/arm64/boot/dts/arm/juno-base.dtsi |
1250 |
++++ b/arch/arm64/boot/dts/arm/juno-base.dtsi |
1251 |
+@@ -74,35 +74,35 @@ |
1252 |
+ <0x0 0x2c02f000 0 0x2000>, |
1253 |
+ <0x0 0x2c04f000 0 0x2000>, |
1254 |
+ <0x0 0x2c06f000 0 0x2000>; |
1255 |
+- #address-cells = <2>; |
1256 |
++ #address-cells = <1>; |
1257 |
+ #interrupt-cells = <3>; |
1258 |
+- #size-cells = <2>; |
1259 |
++ #size-cells = <1>; |
1260 |
+ interrupt-controller; |
1261 |
+ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_HIGH)>; |
1262 |
+- ranges = <0 0 0 0x2c1c0000 0 0x40000>; |
1263 |
++ ranges = <0 0 0x2c1c0000 0x40000>; |
1264 |
+ |
1265 |
+ v2m_0: v2m@0 { |
1266 |
+ compatible = "arm,gic-v2m-frame"; |
1267 |
+ msi-controller; |
1268 |
+- reg = <0 0 0 0x10000>; |
1269 |
++ reg = <0 0x10000>; |
1270 |
+ }; |
1271 |
+ |
1272 |
+ v2m@10000 { |
1273 |
+ compatible = "arm,gic-v2m-frame"; |
1274 |
+ msi-controller; |
1275 |
+- reg = <0 0x10000 0 0x10000>; |
1276 |
++ reg = <0x10000 0x10000>; |
1277 |
+ }; |
1278 |
+ |
1279 |
+ v2m@20000 { |
1280 |
+ compatible = "arm,gic-v2m-frame"; |
1281 |
+ msi-controller; |
1282 |
+- reg = <0 0x20000 0 0x10000>; |
1283 |
++ reg = <0x20000 0x10000>; |
1284 |
+ }; |
1285 |
+ |
1286 |
+ v2m@30000 { |
1287 |
+ compatible = "arm,gic-v2m-frame"; |
1288 |
+ msi-controller; |
1289 |
+- reg = <0 0x30000 0 0x10000>; |
1290 |
++ reg = <0x30000 0x10000>; |
1291 |
+ }; |
1292 |
+ }; |
1293 |
+ |
1294 |
+@@ -546,10 +546,10 @@ |
1295 |
+ <0x42000000 0x40 0x00000000 0x40 0x00000000 0x1 0x00000000>; |
1296 |
+ #interrupt-cells = <1>; |
1297 |
+ interrupt-map-mask = <0 0 0 7>; |
1298 |
+- interrupt-map = <0 0 0 1 &gic 0 0 GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, |
1299 |
+- <0 0 0 2 &gic 0 0 GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, |
1300 |
+- <0 0 0 3 &gic 0 0 GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
1301 |
+- <0 0 0 4 &gic 0 0 GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
1302 |
++ interrupt-map = <0 0 0 1 &gic 0 GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, |
1303 |
++ <0 0 0 2 &gic 0 GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, |
1304 |
++ <0 0 0 3 &gic 0 GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
1305 |
++ <0 0 0 4 &gic 0 GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
1306 |
+ msi-parent = <&v2m_0>; |
1307 |
+ status = "disabled"; |
1308 |
+ iommu-map-mask = <0x0>; /* RC has no means to output PCI RID */ |
1309 |
+@@ -813,19 +813,19 @@ |
1310 |
+ |
1311 |
+ #interrupt-cells = <1>; |
1312 |
+ interrupt-map-mask = <0 0 15>; |
1313 |
+- interrupt-map = <0 0 0 &gic 0 0 GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, |
1314 |
+- <0 0 1 &gic 0 0 GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, |
1315 |
+- <0 0 2 &gic 0 0 GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, |
1316 |
+- <0 0 3 &gic 0 0 GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, |
1317 |
+- <0 0 4 &gic 0 0 GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, |
1318 |
+- <0 0 5 &gic 0 0 GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, |
1319 |
+- <0 0 6 &gic 0 0 GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, |
1320 |
+- <0 0 7 &gic 0 0 GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, |
1321 |
+- <0 0 8 &gic 0 0 GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, |
1322 |
+- <0 0 9 &gic 0 0 GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, |
1323 |
+- <0 0 10 &gic 0 0 GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
1324 |
+- <0 0 11 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
1325 |
+- <0 0 12 &gic 0 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
1326 |
++ interrupt-map = <0 0 0 &gic 0 GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, |
1327 |
++ <0 0 1 &gic 0 GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, |
1328 |
++ <0 0 2 &gic 0 GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, |
1329 |
++ <0 0 3 &gic 0 GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, |
1330 |
++ <0 0 4 &gic 0 GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, |
1331 |
++ <0 0 5 &gic 0 GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, |
1332 |
++ <0 0 6 &gic 0 GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, |
1333 |
++ <0 0 7 &gic 0 GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, |
1334 |
++ <0 0 8 &gic 0 GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, |
1335 |
++ <0 0 9 &gic 0 GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, |
1336 |
++ <0 0 10 &gic 0 GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
1337 |
++ <0 0 11 &gic 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
1338 |
++ <0 0 12 &gic 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
1339 |
+ }; |
1340 |
+ |
1341 |
+ site2: tlx@60000000 { |
1342 |
+@@ -835,6 +835,6 @@ |
1343 |
+ ranges = <0 0 0x60000000 0x10000000>; |
1344 |
+ #interrupt-cells = <1>; |
1345 |
+ interrupt-map-mask = <0 0>; |
1346 |
+- interrupt-map = <0 0 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
1347 |
++ interrupt-map = <0 0 &gic 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
1348 |
+ }; |
1349 |
+ }; |
1350 |
+diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
1351 |
+index e3983ded3c3c..d5cefddde08c 100644 |
1352 |
+--- a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
1353 |
++++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
1354 |
+@@ -103,7 +103,7 @@ |
1355 |
+ }; |
1356 |
+ }; |
1357 |
+ |
1358 |
+- flash@0,00000000 { |
1359 |
++ flash@0 { |
1360 |
+ /* 2 * 32MiB NOR Flash memory mounted on CS0 */ |
1361 |
+ compatible = "arm,vexpress-flash", "cfi-flash"; |
1362 |
+ reg = <0 0x00000000 0x04000000>; |
1363 |
+@@ -120,7 +120,7 @@ |
1364 |
+ }; |
1365 |
+ }; |
1366 |
+ |
1367 |
+- ethernet@2,00000000 { |
1368 |
++ ethernet@200000000 { |
1369 |
+ compatible = "smsc,lan9118", "smsc,lan9115"; |
1370 |
+ reg = <2 0x00000000 0x10000>; |
1371 |
+ interrupts = <3>; |
1372 |
+@@ -133,7 +133,7 @@ |
1373 |
+ vddvario-supply = <&mb_fixed_3v3>; |
1374 |
+ }; |
1375 |
+ |
1376 |
+- iofpga@3,00000000 { |
1377 |
++ iofpga@300000000 { |
1378 |
+ compatible = "simple-bus"; |
1379 |
+ #address-cells = <1>; |
1380 |
+ #size-cells = <1>; |
1381 |
+diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
1382 |
+index 60703b5763c6..350cbf17e8b4 100644 |
1383 |
+--- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
1384 |
++++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
1385 |
+@@ -9,7 +9,7 @@ |
1386 |
+ motherboard { |
1387 |
+ arm,v2m-memory-map = "rs2"; |
1388 |
+ |
1389 |
+- iofpga@3,00000000 { |
1390 |
++ iofpga@300000000 { |
1391 |
+ virtio-p9@140000 { |
1392 |
+ compatible = "virtio,mmio"; |
1393 |
+ reg = <0x140000 0x200>; |
1394 |
+diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
1395 |
+index e333c8d2d0e4..d1bfa62ca073 100644 |
1396 |
+--- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
1397 |
++++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
1398 |
+@@ -17,14 +17,14 @@ |
1399 |
+ #interrupt-cells = <1>; |
1400 |
+ ranges; |
1401 |
+ |
1402 |
+- flash@0,00000000 { |
1403 |
++ flash@0 { |
1404 |
+ compatible = "arm,vexpress-flash", "cfi-flash"; |
1405 |
+ reg = <0 0x00000000 0x04000000>, |
1406 |
+ <4 0x00000000 0x04000000>; |
1407 |
+ bank-width = <4>; |
1408 |
+ }; |
1409 |
+ |
1410 |
+- ethernet@2,02000000 { |
1411 |
++ ethernet@202000000 { |
1412 |
+ compatible = "smsc,lan91c111"; |
1413 |
+ reg = <2 0x02000000 0x10000>; |
1414 |
+ interrupts = <15>; |
1415 |
+@@ -51,7 +51,7 @@ |
1416 |
+ clock-output-names = "v2m:refclk32khz"; |
1417 |
+ }; |
1418 |
+ |
1419 |
+- iofpga@3,00000000 { |
1420 |
++ iofpga@300000000 { |
1421 |
+ compatible = "simple-bus"; |
1422 |
+ #address-cells = <1>; |
1423 |
+ #size-cells = <1>; |
1424 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-3720-db.dts b/arch/arm64/boot/dts/marvell/armada-3720-db.dts |
1425 |
+index f2cc00594d64..3e5789f37206 100644 |
1426 |
+--- a/arch/arm64/boot/dts/marvell/armada-3720-db.dts |
1427 |
++++ b/arch/arm64/boot/dts/marvell/armada-3720-db.dts |
1428 |
+@@ -128,6 +128,9 @@ |
1429 |
+ |
1430 |
+ /* CON15(V2.0)/CON17(V1.4) : PCIe / CON15(V2.0)/CON12(V1.4) :mini-PCIe */ |
1431 |
+ &pcie0 { |
1432 |
++ pinctrl-names = "default"; |
1433 |
++ pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; |
1434 |
++ reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; |
1435 |
+ status = "okay"; |
1436 |
+ }; |
1437 |
+ |
1438 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
1439 |
+index 42e992f9c8a5..c92ad664cb0e 100644 |
1440 |
+--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
1441 |
++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
1442 |
+@@ -47,6 +47,7 @@ |
1443 |
+ phys = <&comphy1 0>; |
1444 |
+ pinctrl-names = "default"; |
1445 |
+ pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; |
1446 |
++ reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; |
1447 |
+ }; |
1448 |
+ |
1449 |
+ /* J6 */ |
1450 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1451 |
+index bb42d1e6a4e9..1452c821f8c0 100644 |
1452 |
+--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1453 |
++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1454 |
+@@ -95,7 +95,7 @@ |
1455 |
+ }; |
1456 |
+ |
1457 |
+ sfp: sfp { |
1458 |
+- compatible = "sff,sfp+"; |
1459 |
++ compatible = "sff,sfp"; |
1460 |
+ i2c-bus = <&i2c0>; |
1461 |
+ los-gpio = <&moxtet_sfp 0 GPIO_ACTIVE_HIGH>; |
1462 |
+ tx-fault-gpio = <&moxtet_sfp 1 GPIO_ACTIVE_HIGH>; |
1463 |
+@@ -128,10 +128,6 @@ |
1464 |
+ }; |
1465 |
+ }; |
1466 |
+ |
1467 |
+-&pcie_reset_pins { |
1468 |
+- function = "gpio"; |
1469 |
+-}; |
1470 |
+- |
1471 |
+ &pcie0 { |
1472 |
+ pinctrl-names = "default"; |
1473 |
+ pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; |
1474 |
+@@ -179,6 +175,8 @@ |
1475 |
+ marvell,pad-type = "sd"; |
1476 |
+ vqmmc-supply = <&vsdio_reg>; |
1477 |
+ mmc-pwrseq = <&sdhci1_pwrseq>; |
1478 |
++ /* forbid SDR104 for FCC purposes */ |
1479 |
++ sdhci-caps-mask = <0x2 0x0>; |
1480 |
+ status = "okay"; |
1481 |
+ }; |
1482 |
+ |
1483 |
+diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
1484 |
+index 000c135e39b7..7909c146eabf 100644 |
1485 |
+--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
1486 |
++++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
1487 |
+@@ -317,7 +317,7 @@ |
1488 |
+ |
1489 |
+ pcie_reset_pins: pcie-reset-pins { |
1490 |
+ groups = "pcie1"; |
1491 |
+- function = "pcie"; |
1492 |
++ function = "gpio"; |
1493 |
+ }; |
1494 |
+ |
1495 |
+ pcie_clkreq_pins: pcie-clkreq-pins { |
1496 |
+diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
1497 |
+index d819e44d94a8..6ad1053afd27 100644 |
1498 |
+--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
1499 |
++++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
1500 |
+@@ -242,21 +242,21 @@ |
1501 |
+ cpu_on = <0x84000003>; |
1502 |
+ }; |
1503 |
+ |
1504 |
+- clk26m: oscillator@0 { |
1505 |
++ clk26m: oscillator0 { |
1506 |
+ compatible = "fixed-clock"; |
1507 |
+ #clock-cells = <0>; |
1508 |
+ clock-frequency = <26000000>; |
1509 |
+ clock-output-names = "clk26m"; |
1510 |
+ }; |
1511 |
+ |
1512 |
+- clk32k: oscillator@1 { |
1513 |
++ clk32k: oscillator1 { |
1514 |
+ compatible = "fixed-clock"; |
1515 |
+ #clock-cells = <0>; |
1516 |
+ clock-frequency = <32000>; |
1517 |
+ clock-output-names = "clk32k"; |
1518 |
+ }; |
1519 |
+ |
1520 |
+- cpum_ck: oscillator@2 { |
1521 |
++ cpum_ck: oscillator2 { |
1522 |
+ compatible = "fixed-clock"; |
1523 |
+ #clock-cells = <0>; |
1524 |
+ clock-frequency = <0>; |
1525 |
+@@ -272,19 +272,19 @@ |
1526 |
+ sustainable-power = <1500>; /* milliwatts */ |
1527 |
+ |
1528 |
+ trips { |
1529 |
+- threshold: trip-point@0 { |
1530 |
++ threshold: trip-point0 { |
1531 |
+ temperature = <68000>; |
1532 |
+ hysteresis = <2000>; |
1533 |
+ type = "passive"; |
1534 |
+ }; |
1535 |
+ |
1536 |
+- target: trip-point@1 { |
1537 |
++ target: trip-point1 { |
1538 |
+ temperature = <85000>; |
1539 |
+ hysteresis = <2000>; |
1540 |
+ type = "passive"; |
1541 |
+ }; |
1542 |
+ |
1543 |
+- cpu_crit: cpu_crit@0 { |
1544 |
++ cpu_crit: cpu_crit0 { |
1545 |
+ temperature = <115000>; |
1546 |
+ hysteresis = <2000>; |
1547 |
+ type = "critical"; |
1548 |
+@@ -292,13 +292,13 @@ |
1549 |
+ }; |
1550 |
+ |
1551 |
+ cooling-maps { |
1552 |
+- map@0 { |
1553 |
++ map0 { |
1554 |
+ trip = <&target>; |
1555 |
+ cooling-device = <&cpu0 0 0>, |
1556 |
+ <&cpu1 0 0>; |
1557 |
+ contribution = <3072>; |
1558 |
+ }; |
1559 |
+- map@1 { |
1560 |
++ map1 { |
1561 |
+ trip = <&target>; |
1562 |
+ cooling-device = <&cpu2 0 0>, |
1563 |
+ <&cpu3 0 0>; |
1564 |
+@@ -312,7 +312,7 @@ |
1565 |
+ #address-cells = <2>; |
1566 |
+ #size-cells = <2>; |
1567 |
+ ranges; |
1568 |
+- vpu_dma_reserved: vpu_dma_mem_region { |
1569 |
++ vpu_dma_reserved: vpu_dma_mem_region@b7000000 { |
1570 |
+ compatible = "shared-dma-pool"; |
1571 |
+ reg = <0 0xb7000000 0 0x500000>; |
1572 |
+ alignment = <0x1000>; |
1573 |
+@@ -365,7 +365,7 @@ |
1574 |
+ reg = <0 0x10005000 0 0x1000>; |
1575 |
+ }; |
1576 |
+ |
1577 |
+- pio: pinctrl@10005000 { |
1578 |
++ pio: pinctrl@1000b000 { |
1579 |
+ compatible = "mediatek,mt8173-pinctrl"; |
1580 |
+ reg = <0 0x1000b000 0 0x1000>; |
1581 |
+ mediatek,pctl-regmap = <&syscfg_pctl_a>; |
1582 |
+@@ -572,7 +572,7 @@ |
1583 |
+ status = "disabled"; |
1584 |
+ }; |
1585 |
+ |
1586 |
+- gic: interrupt-controller@10220000 { |
1587 |
++ gic: interrupt-controller@10221000 { |
1588 |
+ compatible = "arm,gic-400"; |
1589 |
+ #interrupt-cells = <3>; |
1590 |
+ interrupt-parent = <&gic>; |
1591 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1592 |
+index 623f7d7d216b..8e3136dfdd62 100644 |
1593 |
+--- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1594 |
++++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1595 |
+@@ -33,7 +33,7 @@ |
1596 |
+ |
1597 |
+ phy-reset-gpios = <&gpio TEGRA194_MAIN_GPIO(G, 5) GPIO_ACTIVE_LOW>; |
1598 |
+ phy-handle = <&phy>; |
1599 |
+- phy-mode = "rgmii"; |
1600 |
++ phy-mode = "rgmii-id"; |
1601 |
+ |
1602 |
+ mdio { |
1603 |
+ #address-cells = <1>; |
1604 |
+diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1605 |
+index f4ede86e32b4..3c928360f4ed 100644 |
1606 |
+--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1607 |
++++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1608 |
+@@ -1387,7 +1387,7 @@ |
1609 |
+ |
1610 |
+ bus-range = <0x0 0xff>; |
1611 |
+ ranges = <0x81000000 0x0 0x30100000 0x0 0x30100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1612 |
+- 0xc2000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1613 |
++ 0xc3000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1614 |
+ 0x82000000 0x0 0x40000000 0x12 0x30000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1615 |
+ }; |
1616 |
+ |
1617 |
+@@ -1432,7 +1432,7 @@ |
1618 |
+ |
1619 |
+ bus-range = <0x0 0xff>; |
1620 |
+ ranges = <0x81000000 0x0 0x32100000 0x0 0x32100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1621 |
+- 0xc2000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1622 |
++ 0xc3000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1623 |
+ 0x82000000 0x0 0x40000000 0x12 0x70000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1624 |
+ }; |
1625 |
+ |
1626 |
+@@ -1477,7 +1477,7 @@ |
1627 |
+ |
1628 |
+ bus-range = <0x0 0xff>; |
1629 |
+ ranges = <0x81000000 0x0 0x34100000 0x0 0x34100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1630 |
+- 0xc2000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1631 |
++ 0xc3000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1632 |
+ 0x82000000 0x0 0x40000000 0x12 0xb0000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1633 |
+ }; |
1634 |
+ |
1635 |
+@@ -1522,7 +1522,7 @@ |
1636 |
+ |
1637 |
+ bus-range = <0x0 0xff>; |
1638 |
+ ranges = <0x81000000 0x0 0x36100000 0x0 0x36100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1639 |
+- 0xc2000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1640 |
++ 0xc3000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1641 |
+ 0x82000000 0x0 0x40000000 0x17 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1642 |
+ }; |
1643 |
+ |
1644 |
+@@ -1567,7 +1567,7 @@ |
1645 |
+ |
1646 |
+ bus-range = <0x0 0xff>; |
1647 |
+ ranges = <0x81000000 0x0 0x38100000 0x0 0x38100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1648 |
+- 0xc2000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1649 |
++ 0xc3000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1650 |
+ 0x82000000 0x0 0x40000000 0x1b 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1651 |
+ }; |
1652 |
+ |
1653 |
+@@ -1616,7 +1616,7 @@ |
1654 |
+ |
1655 |
+ bus-range = <0x0 0xff>; |
1656 |
+ ranges = <0x81000000 0x0 0x3a100000 0x0 0x3a100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1657 |
+- 0xc2000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1658 |
++ 0xc3000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1659 |
+ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1660 |
+ }; |
1661 |
+ |
1662 |
+diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |
1663 |
+index c4abbccf2bed..eaa1eb70b455 100644 |
1664 |
+--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |
1665 |
++++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |
1666 |
+@@ -117,16 +117,6 @@ |
1667 |
+ regulator-max-microvolt = <3700000>; |
1668 |
+ }; |
1669 |
+ |
1670 |
+- vreg_s8a_l3a_input: vreg-s8a-l3a-input { |
1671 |
+- compatible = "regulator-fixed"; |
1672 |
+- regulator-name = "vreg_s8a_l3a_input"; |
1673 |
+- regulator-always-on; |
1674 |
+- regulator-boot-on; |
1675 |
+- |
1676 |
+- regulator-min-microvolt = <0>; |
1677 |
+- regulator-max-microvolt = <0>; |
1678 |
+- }; |
1679 |
+- |
1680 |
+ wlan_en: wlan-en-1-8v { |
1681 |
+ pinctrl-names = "default"; |
1682 |
+ pinctrl-0 = <&wlan_en_gpios>; |
1683 |
+@@ -705,14 +695,14 @@ |
1684 |
+ vdd_s11-supply = <&vph_pwr>; |
1685 |
+ vdd_s12-supply = <&vph_pwr>; |
1686 |
+ vdd_l2_l26_l28-supply = <&vreg_s3a_1p3>; |
1687 |
+- vdd_l3_l11-supply = <&vreg_s8a_l3a_input>; |
1688 |
++ vdd_l3_l11-supply = <&vreg_s3a_1p3>; |
1689 |
+ vdd_l4_l27_l31-supply = <&vreg_s3a_1p3>; |
1690 |
+ vdd_l5_l7-supply = <&vreg_s5a_2p15>; |
1691 |
+ vdd_l6_l12_l32-supply = <&vreg_s5a_2p15>; |
1692 |
+ vdd_l8_l16_l30-supply = <&vph_pwr>; |
1693 |
+ vdd_l14_l15-supply = <&vreg_s5a_2p15>; |
1694 |
+ vdd_l25-supply = <&vreg_s3a_1p3>; |
1695 |
+- vdd_lvs1_2-supply = <&vreg_s4a_1p8>; |
1696 |
++ vdd_lvs1_lvs2-supply = <&vreg_s4a_1p8>; |
1697 |
+ |
1698 |
+ vreg_s3a_1p3: s3 { |
1699 |
+ regulator-name = "vreg_s3a_1p3"; |
1700 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1701 |
+index a88a15f2352b..5548d7b5096c 100644 |
1702 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1703 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1704 |
+@@ -261,7 +261,7 @@ |
1705 |
+ thermal-sensors = <&tsens 4>; |
1706 |
+ |
1707 |
+ trips { |
1708 |
+- cpu2_3_alert0: trip-point@0 { |
1709 |
++ cpu2_3_alert0: trip-point0 { |
1710 |
+ temperature = <75000>; |
1711 |
+ hysteresis = <2000>; |
1712 |
+ type = "passive"; |
1713 |
+@@ -291,7 +291,7 @@ |
1714 |
+ thermal-sensors = <&tsens 2>; |
1715 |
+ |
1716 |
+ trips { |
1717 |
+- gpu_alert0: trip-point@0 { |
1718 |
++ gpu_alert0: trip-point0 { |
1719 |
+ temperature = <75000>; |
1720 |
+ hysteresis = <2000>; |
1721 |
+ type = "passive"; |
1722 |
+@@ -311,7 +311,7 @@ |
1723 |
+ thermal-sensors = <&tsens 1>; |
1724 |
+ |
1725 |
+ trips { |
1726 |
+- cam_alert0: trip-point@0 { |
1727 |
++ cam_alert0: trip-point0 { |
1728 |
+ temperature = <75000>; |
1729 |
+ hysteresis = <2000>; |
1730 |
+ type = "hot"; |
1731 |
+@@ -326,7 +326,7 @@ |
1732 |
+ thermal-sensors = <&tsens 0>; |
1733 |
+ |
1734 |
+ trips { |
1735 |
+- modem_alert0: trip-point@0 { |
1736 |
++ modem_alert0: trip-point0 { |
1737 |
+ temperature = <85000>; |
1738 |
+ hysteresis = <2000>; |
1739 |
+ type = "hot"; |
1740 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1741 |
+index 98634d5c4440..d22c364b520a 100644 |
1742 |
+--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1743 |
++++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1744 |
+@@ -989,16 +989,16 @@ |
1745 |
+ "csi_clk_mux", |
1746 |
+ "vfe0", |
1747 |
+ "vfe1"; |
1748 |
+- interrupts = <GIC_SPI 78 0>, |
1749 |
+- <GIC_SPI 79 0>, |
1750 |
+- <GIC_SPI 80 0>, |
1751 |
+- <GIC_SPI 296 0>, |
1752 |
+- <GIC_SPI 297 0>, |
1753 |
+- <GIC_SPI 298 0>, |
1754 |
+- <GIC_SPI 299 0>, |
1755 |
+- <GIC_SPI 309 0>, |
1756 |
+- <GIC_SPI 314 0>, |
1757 |
+- <GIC_SPI 315 0>; |
1758 |
++ interrupts = <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>, |
1759 |
++ <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>, |
1760 |
++ <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>, |
1761 |
++ <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>, |
1762 |
++ <GIC_SPI 297 IRQ_TYPE_EDGE_RISING>, |
1763 |
++ <GIC_SPI 298 IRQ_TYPE_EDGE_RISING>, |
1764 |
++ <GIC_SPI 299 IRQ_TYPE_EDGE_RISING>, |
1765 |
++ <GIC_SPI 309 IRQ_TYPE_EDGE_RISING>, |
1766 |
++ <GIC_SPI 314 IRQ_TYPE_EDGE_RISING>, |
1767 |
++ <GIC_SPI 315 IRQ_TYPE_EDGE_RISING>; |
1768 |
+ interrupt-names = "csiphy0", |
1769 |
+ "csiphy1", |
1770 |
+ "csiphy2", |
1771 |
+diff --git a/arch/arm64/boot/dts/qcom/pm8150.dtsi b/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1772 |
+index b6e304748a57..c0b197458665 100644 |
1773 |
+--- a/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1774 |
++++ b/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1775 |
+@@ -73,18 +73,8 @@ |
1776 |
+ reg = <0xc000>; |
1777 |
+ gpio-controller; |
1778 |
+ #gpio-cells = <2>; |
1779 |
+- interrupts = <0x0 0xc0 0x0 IRQ_TYPE_NONE>, |
1780 |
+- <0x0 0xc1 0x0 IRQ_TYPE_NONE>, |
1781 |
+- <0x0 0xc2 0x0 IRQ_TYPE_NONE>, |
1782 |
+- <0x0 0xc3 0x0 IRQ_TYPE_NONE>, |
1783 |
+- <0x0 0xc4 0x0 IRQ_TYPE_NONE>, |
1784 |
+- <0x0 0xc5 0x0 IRQ_TYPE_NONE>, |
1785 |
+- <0x0 0xc6 0x0 IRQ_TYPE_NONE>, |
1786 |
+- <0x0 0xc7 0x0 IRQ_TYPE_NONE>, |
1787 |
+- <0x0 0xc8 0x0 IRQ_TYPE_NONE>, |
1788 |
+- <0x0 0xc9 0x0 IRQ_TYPE_NONE>, |
1789 |
+- <0x0 0xca 0x0 IRQ_TYPE_NONE>, |
1790 |
+- <0x0 0xcb 0x0 IRQ_TYPE_NONE>; |
1791 |
++ interrupt-controller; |
1792 |
++ #interrupt-cells = <2>; |
1793 |
+ }; |
1794 |
+ }; |
1795 |
+ |
1796 |
+diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1797 |
+index 322379d5c31f..40b5d75a4a1d 100644 |
1798 |
+--- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1799 |
++++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1800 |
+@@ -62,18 +62,8 @@ |
1801 |
+ reg = <0xc000>; |
1802 |
+ gpio-controller; |
1803 |
+ #gpio-cells = <2>; |
1804 |
+- interrupts = <0x2 0xc0 0x0 IRQ_TYPE_NONE>, |
1805 |
+- <0x2 0xc1 0x0 IRQ_TYPE_NONE>, |
1806 |
+- <0x2 0xc2 0x0 IRQ_TYPE_NONE>, |
1807 |
+- <0x2 0xc3 0x0 IRQ_TYPE_NONE>, |
1808 |
+- <0x2 0xc4 0x0 IRQ_TYPE_NONE>, |
1809 |
+- <0x2 0xc5 0x0 IRQ_TYPE_NONE>, |
1810 |
+- <0x2 0xc6 0x0 IRQ_TYPE_NONE>, |
1811 |
+- <0x2 0xc7 0x0 IRQ_TYPE_NONE>, |
1812 |
+- <0x2 0xc8 0x0 IRQ_TYPE_NONE>, |
1813 |
+- <0x2 0xc9 0x0 IRQ_TYPE_NONE>, |
1814 |
+- <0x2 0xca 0x0 IRQ_TYPE_NONE>, |
1815 |
+- <0x2 0xcb 0x0 IRQ_TYPE_NONE>; |
1816 |
++ interrupt-controller; |
1817 |
++ #interrupt-cells = <2>; |
1818 |
+ }; |
1819 |
+ }; |
1820 |
+ |
1821 |
+diff --git a/arch/arm64/boot/dts/qcom/pm8150l.dtsi b/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1822 |
+index eb0e9a090e42..cf05e0685d10 100644 |
1823 |
+--- a/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1824 |
++++ b/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1825 |
+@@ -56,18 +56,8 @@ |
1826 |
+ reg = <0xc000>; |
1827 |
+ gpio-controller; |
1828 |
+ #gpio-cells = <2>; |
1829 |
+- interrupts = <0x4 0xc0 0x0 IRQ_TYPE_NONE>, |
1830 |
+- <0x4 0xc1 0x0 IRQ_TYPE_NONE>, |
1831 |
+- <0x4 0xc2 0x0 IRQ_TYPE_NONE>, |
1832 |
+- <0x4 0xc3 0x0 IRQ_TYPE_NONE>, |
1833 |
+- <0x4 0xc4 0x0 IRQ_TYPE_NONE>, |
1834 |
+- <0x4 0xc5 0x0 IRQ_TYPE_NONE>, |
1835 |
+- <0x4 0xc6 0x0 IRQ_TYPE_NONE>, |
1836 |
+- <0x4 0xc7 0x0 IRQ_TYPE_NONE>, |
1837 |
+- <0x4 0xc8 0x0 IRQ_TYPE_NONE>, |
1838 |
+- <0x4 0xc9 0x0 IRQ_TYPE_NONE>, |
1839 |
+- <0x4 0xca 0x0 IRQ_TYPE_NONE>, |
1840 |
+- <0x4 0xcb 0x0 IRQ_TYPE_NONE>; |
1841 |
++ interrupt-controller; |
1842 |
++ #interrupt-cells = <2>; |
1843 |
+ }; |
1844 |
+ }; |
1845 |
+ |
1846 |
+diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1847 |
+index 998f101ad623..eea92b314fc6 100644 |
1848 |
+--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1849 |
++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1850 |
+@@ -1657,8 +1657,7 @@ |
1851 |
+ pdc: interrupt-controller@b220000 { |
1852 |
+ compatible = "qcom,sc7180-pdc", "qcom,pdc"; |
1853 |
+ reg = <0 0x0b220000 0 0x30000>; |
1854 |
+- qcom,pdc-ranges = <0 480 15>, <17 497 98>, |
1855 |
+- <119 634 4>, <124 639 1>; |
1856 |
++ qcom,pdc-ranges = <0 480 94>, <94 609 31>, <125 63 1>; |
1857 |
+ #interrupt-cells = <2>; |
1858 |
+ interrupt-parent = <&intc>; |
1859 |
+ interrupt-controller; |
1860 |
+diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1861 |
+index 51a670ad15b2..4b9860a2c8eb 100644 |
1862 |
+--- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1863 |
++++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1864 |
+@@ -577,3 +577,14 @@ |
1865 |
+ }; |
1866 |
+ }; |
1867 |
+ }; |
1868 |
++ |
1869 |
++&wifi { |
1870 |
++ status = "okay"; |
1871 |
++ |
1872 |
++ vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>; |
1873 |
++ vdd-1.8-xo-supply = <&vreg_l7a_1p8>; |
1874 |
++ vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; |
1875 |
++ vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; |
1876 |
++ |
1877 |
++ qcom,snoc-host-cap-8bit-quirk; |
1878 |
++}; |
1879 |
+diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi |
1880 |
+index 891d83b2afea..2a7eaefd221d 100644 |
1881 |
+--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi |
1882 |
++++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi |
1883 |
+@@ -314,8 +314,8 @@ |
1884 |
+ }; |
1885 |
+ |
1886 |
+ pdc: interrupt-controller@b220000 { |
1887 |
+- compatible = "qcom,sm8250-pdc"; |
1888 |
+- reg = <0x0b220000 0x30000>, <0x17c000f0 0x60>; |
1889 |
++ compatible = "qcom,sm8250-pdc", "qcom,pdc"; |
1890 |
++ reg = <0 0x0b220000 0 0x30000>, <0 0x17c000f0 0 0x60>; |
1891 |
+ qcom,pdc-ranges = <0 480 94>, <94 609 31>, |
1892 |
+ <125 63 1>, <126 716 12>; |
1893 |
+ #interrupt-cells = <2>; |
1894 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts b/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts |
1895 |
+index b2dd583146b4..b2e44c6c2d22 100644 |
1896 |
+--- a/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts |
1897 |
++++ b/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts |
1898 |
+@@ -1,6 +1,6 @@ |
1899 |
+ // SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) |
1900 |
+ /* |
1901 |
+- * Copyright (c) 2017 Andreas Färber |
1902 |
++ * Copyright (c) 2017-2019 Andreas Färber |
1903 |
+ */ |
1904 |
+ |
1905 |
+ /dts-v1/; |
1906 |
+@@ -11,9 +11,9 @@ |
1907 |
+ compatible = "synology,ds418j", "realtek,rtd1293"; |
1908 |
+ model = "Synology DiskStation DS418j"; |
1909 |
+ |
1910 |
+- memory@0 { |
1911 |
++ memory@1f000 { |
1912 |
+ device_type = "memory"; |
1913 |
+- reg = <0x0 0x40000000>; |
1914 |
++ reg = <0x1f000 0x3ffe1000>; /* boot ROM to 1 GiB */ |
1915 |
+ }; |
1916 |
+ |
1917 |
+ aliases { |
1918 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1293.dtsi b/arch/arm64/boot/dts/realtek/rtd1293.dtsi |
1919 |
+index bd4e22723f7b..2d92b56ac94d 100644 |
1920 |
+--- a/arch/arm64/boot/dts/realtek/rtd1293.dtsi |
1921 |
++++ b/arch/arm64/boot/dts/realtek/rtd1293.dtsi |
1922 |
+@@ -36,16 +36,20 @@ |
1923 |
+ timer { |
1924 |
+ compatible = "arm,armv8-timer"; |
1925 |
+ interrupts = <GIC_PPI 13 |
1926 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
1927 |
++ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
1928 |
+ <GIC_PPI 14 |
1929 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
1930 |
++ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
1931 |
+ <GIC_PPI 11 |
1932 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
1933 |
++ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
1934 |
+ <GIC_PPI 10 |
1935 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>; |
1936 |
++ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
1937 |
+ }; |
1938 |
+ }; |
1939 |
+ |
1940 |
+ &arm_pmu { |
1941 |
+ interrupt-affinity = <&cpu0>, <&cpu1>; |
1942 |
+ }; |
1943 |
++ |
1944 |
++&gic { |
1945 |
++ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
1946 |
++}; |
1947 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts b/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts |
1948 |
+index bd584e99fff9..cf4a57c012a8 100644 |
1949 |
+--- a/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts |
1950 |
++++ b/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts |
1951 |
+@@ -1,5 +1,5 @@ |
1952 |
+ /* |
1953 |
+- * Copyright (c) 2017 Andreas Färber |
1954 |
++ * Copyright (c) 2017-2019 Andreas Färber |
1955 |
+ * |
1956 |
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
1957 |
+ */ |
1958 |
+@@ -12,9 +12,9 @@ |
1959 |
+ compatible = "mele,v9", "realtek,rtd1295"; |
1960 |
+ model = "MeLE V9"; |
1961 |
+ |
1962 |
+- memory@0 { |
1963 |
++ memory@1f000 { |
1964 |
+ device_type = "memory"; |
1965 |
+- reg = <0x0 0x80000000>; |
1966 |
++ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
1967 |
+ }; |
1968 |
+ |
1969 |
+ aliases { |
1970 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts b/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts |
1971 |
+index 8e2b0e75298a..14161c3f304d 100644 |
1972 |
+--- a/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts |
1973 |
++++ b/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts |
1974 |
+@@ -1,5 +1,5 @@ |
1975 |
+ /* |
1976 |
+- * Copyright (c) 2017 Andreas Färber |
1977 |
++ * Copyright (c) 2017-2019 Andreas Färber |
1978 |
+ * |
1979 |
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
1980 |
+ */ |
1981 |
+@@ -12,9 +12,9 @@ |
1982 |
+ compatible = "probox2,ava", "realtek,rtd1295"; |
1983 |
+ model = "PROBOX2 AVA"; |
1984 |
+ |
1985 |
+- memory@0 { |
1986 |
++ memory@1f000 { |
1987 |
+ device_type = "memory"; |
1988 |
+- reg = <0x0 0x80000000>; |
1989 |
++ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
1990 |
+ }; |
1991 |
+ |
1992 |
+ aliases { |
1993 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts |
1994 |
+index e98e508b9514..4beb37bb9522 100644 |
1995 |
+--- a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts |
1996 |
++++ b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts |
1997 |
+@@ -11,9 +11,9 @@ |
1998 |
+ compatible = "zidoo,x9s", "realtek,rtd1295"; |
1999 |
+ model = "Zidoo X9S"; |
2000 |
+ |
2001 |
+- memory@0 { |
2002 |
++ memory@1f000 { |
2003 |
+ device_type = "memory"; |
2004 |
+- reg = <0x0 0x80000000>; |
2005 |
++ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
2006 |
+ }; |
2007 |
+ |
2008 |
+ aliases { |
2009 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1295.dtsi b/arch/arm64/boot/dts/realtek/rtd1295.dtsi |
2010 |
+index 93f0e1d97721..1402abe80ea1 100644 |
2011 |
+--- a/arch/arm64/boot/dts/realtek/rtd1295.dtsi |
2012 |
++++ b/arch/arm64/boot/dts/realtek/rtd1295.dtsi |
2013 |
+@@ -2,7 +2,7 @@ |
2014 |
+ /* |
2015 |
+ * Realtek RTD1295 SoC |
2016 |
+ * |
2017 |
+- * Copyright (c) 2016-2017 Andreas Färber |
2018 |
++ * Copyright (c) 2016-2019 Andreas Färber |
2019 |
+ */ |
2020 |
+ |
2021 |
+ #include "rtd129x.dtsi" |
2022 |
+@@ -47,27 +47,16 @@ |
2023 |
+ }; |
2024 |
+ }; |
2025 |
+ |
2026 |
+- reserved-memory { |
2027 |
+- #address-cells = <1>; |
2028 |
+- #size-cells = <1>; |
2029 |
+- ranges; |
2030 |
+- |
2031 |
+- tee@10100000 { |
2032 |
+- reg = <0x10100000 0xf00000>; |
2033 |
+- no-map; |
2034 |
+- }; |
2035 |
+- }; |
2036 |
+- |
2037 |
+ timer { |
2038 |
+ compatible = "arm,armv8-timer"; |
2039 |
+ interrupts = <GIC_PPI 13 |
2040 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2041 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2042 |
+ <GIC_PPI 14 |
2043 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2044 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2045 |
+ <GIC_PPI 11 |
2046 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2047 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2048 |
+ <GIC_PPI 10 |
2049 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>; |
2050 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
2051 |
+ }; |
2052 |
+ }; |
2053 |
+ |
2054 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts b/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts |
2055 |
+index 5a051a52bf88..cc706d13da8b 100644 |
2056 |
+--- a/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts |
2057 |
++++ b/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts |
2058 |
+@@ -11,9 +11,9 @@ |
2059 |
+ compatible = "synology,ds418", "realtek,rtd1296"; |
2060 |
+ model = "Synology DiskStation DS418"; |
2061 |
+ |
2062 |
+- memory@0 { |
2063 |
++ memory@1f000 { |
2064 |
+ device_type = "memory"; |
2065 |
+- reg = <0x0 0x80000000>; |
2066 |
++ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
2067 |
+ }; |
2068 |
+ |
2069 |
+ aliases { |
2070 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd1296.dtsi b/arch/arm64/boot/dts/realtek/rtd1296.dtsi |
2071 |
+index 0f9e59cac086..fb864a139c97 100644 |
2072 |
+--- a/arch/arm64/boot/dts/realtek/rtd1296.dtsi |
2073 |
++++ b/arch/arm64/boot/dts/realtek/rtd1296.dtsi |
2074 |
+@@ -50,13 +50,13 @@ |
2075 |
+ timer { |
2076 |
+ compatible = "arm,armv8-timer"; |
2077 |
+ interrupts = <GIC_PPI 13 |
2078 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2079 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2080 |
+ <GIC_PPI 14 |
2081 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2082 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2083 |
+ <GIC_PPI 11 |
2084 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2085 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2086 |
+ <GIC_PPI 10 |
2087 |
+- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>; |
2088 |
++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
2089 |
+ }; |
2090 |
+ }; |
2091 |
+ |
2092 |
+diff --git a/arch/arm64/boot/dts/realtek/rtd129x.dtsi b/arch/arm64/boot/dts/realtek/rtd129x.dtsi |
2093 |
+index 4433114476f5..b63d0c03597a 100644 |
2094 |
+--- a/arch/arm64/boot/dts/realtek/rtd129x.dtsi |
2095 |
++++ b/arch/arm64/boot/dts/realtek/rtd129x.dtsi |
2096 |
+@@ -2,14 +2,12 @@ |
2097 |
+ /* |
2098 |
+ * Realtek RTD1293/RTD1295/RTD1296 SoC |
2099 |
+ * |
2100 |
+- * Copyright (c) 2016-2017 Andreas Färber |
2101 |
++ * Copyright (c) 2016-2019 Andreas Färber |
2102 |
+ */ |
2103 |
+ |
2104 |
+-/memreserve/ 0x0000000000000000 0x0000000000030000; |
2105 |
+-/memreserve/ 0x000000000001f000 0x0000000000001000; |
2106 |
+-/memreserve/ 0x0000000000030000 0x00000000000d0000; |
2107 |
++/memreserve/ 0x0000000000000000 0x000000000001f000; |
2108 |
++/memreserve/ 0x000000000001f000 0x00000000000e1000; |
2109 |
+ /memreserve/ 0x0000000001b00000 0x00000000004be000; |
2110 |
+-/memreserve/ 0x0000000001ffe000 0x0000000000004000; |
2111 |
+ |
2112 |
+ #include <dt-bindings/interrupt-controller/arm-gic.h> |
2113 |
+ #include <dt-bindings/reset/realtek,rtd1295.h> |
2114 |
+@@ -19,6 +17,25 @@ |
2115 |
+ #address-cells = <1>; |
2116 |
+ #size-cells = <1>; |
2117 |
+ |
2118 |
++ reserved-memory { |
2119 |
++ #address-cells = <1>; |
2120 |
++ #size-cells = <1>; |
2121 |
++ ranges; |
2122 |
++ |
2123 |
++ rpc_comm: rpc@1f000 { |
2124 |
++ reg = <0x1f000 0x1000>; |
2125 |
++ }; |
2126 |
++ |
2127 |
++ rpc_ringbuf: rpc@1ffe000 { |
2128 |
++ reg = <0x1ffe000 0x4000>; |
2129 |
++ }; |
2130 |
++ |
2131 |
++ tee: tee@10100000 { |
2132 |
++ reg = <0x10100000 0xf00000>; |
2133 |
++ no-map; |
2134 |
++ }; |
2135 |
++ }; |
2136 |
++ |
2137 |
+ arm_pmu: arm-pmu { |
2138 |
+ compatible = "arm,cortex-a53-pmu"; |
2139 |
+ interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; |
2140 |
+@@ -35,8 +52,9 @@ |
2141 |
+ compatible = "simple-bus"; |
2142 |
+ #address-cells = <1>; |
2143 |
+ #size-cells = <1>; |
2144 |
+- /* Exclude up to 2 GiB of RAM */ |
2145 |
+- ranges = <0x80000000 0x80000000 0x80000000>; |
2146 |
++ ranges = <0x00000000 0x00000000 0x0001f000>, /* boot ROM */ |
2147 |
++ /* Exclude up to 2 GiB of RAM */ |
2148 |
++ <0x80000000 0x80000000 0x80000000>; |
2149 |
+ |
2150 |
+ reset1: reset-controller@98000000 { |
2151 |
+ compatible = "snps,dw-low-reset"; |
2152 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
2153 |
+index 79023433a740..a603d947970e 100644 |
2154 |
+--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
2155 |
++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
2156 |
+@@ -1000,7 +1000,7 @@ |
2157 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2158 |
+ }; |
2159 |
+ |
2160 |
+- ipmmu_ds0: mmu@e6740000 { |
2161 |
++ ipmmu_ds0: iommu@e6740000 { |
2162 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2163 |
+ reg = <0 0xe6740000 0 0x1000>; |
2164 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2165 |
+@@ -1008,7 +1008,7 @@ |
2166 |
+ #iommu-cells = <1>; |
2167 |
+ }; |
2168 |
+ |
2169 |
+- ipmmu_ds1: mmu@e7740000 { |
2170 |
++ ipmmu_ds1: iommu@e7740000 { |
2171 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2172 |
+ reg = <0 0xe7740000 0 0x1000>; |
2173 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2174 |
+@@ -1016,7 +1016,7 @@ |
2175 |
+ #iommu-cells = <1>; |
2176 |
+ }; |
2177 |
+ |
2178 |
+- ipmmu_hc: mmu@e6570000 { |
2179 |
++ ipmmu_hc: iommu@e6570000 { |
2180 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2181 |
+ reg = <0 0xe6570000 0 0x1000>; |
2182 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2183 |
+@@ -1024,7 +1024,7 @@ |
2184 |
+ #iommu-cells = <1>; |
2185 |
+ }; |
2186 |
+ |
2187 |
+- ipmmu_mm: mmu@e67b0000 { |
2188 |
++ ipmmu_mm: iommu@e67b0000 { |
2189 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2190 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2191 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2192 |
+@@ -1033,7 +1033,7 @@ |
2193 |
+ #iommu-cells = <1>; |
2194 |
+ }; |
2195 |
+ |
2196 |
+- ipmmu_mp: mmu@ec670000 { |
2197 |
++ ipmmu_mp: iommu@ec670000 { |
2198 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2199 |
+ reg = <0 0xec670000 0 0x1000>; |
2200 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2201 |
+@@ -1041,7 +1041,7 @@ |
2202 |
+ #iommu-cells = <1>; |
2203 |
+ }; |
2204 |
+ |
2205 |
+- ipmmu_pv0: mmu@fd800000 { |
2206 |
++ ipmmu_pv0: iommu@fd800000 { |
2207 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2208 |
+ reg = <0 0xfd800000 0 0x1000>; |
2209 |
+ renesas,ipmmu-main = <&ipmmu_mm 5>; |
2210 |
+@@ -1049,7 +1049,7 @@ |
2211 |
+ #iommu-cells = <1>; |
2212 |
+ }; |
2213 |
+ |
2214 |
+- ipmmu_pv1: mmu@fd950000 { |
2215 |
++ ipmmu_pv1: iommu@fd950000 { |
2216 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2217 |
+ reg = <0 0xfd950000 0 0x1000>; |
2218 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2219 |
+@@ -1057,7 +1057,7 @@ |
2220 |
+ #iommu-cells = <1>; |
2221 |
+ }; |
2222 |
+ |
2223 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2224 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2225 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2226 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
2227 |
+ renesas,ipmmu-main = <&ipmmu_mm 8>; |
2228 |
+@@ -1065,7 +1065,7 @@ |
2229 |
+ #iommu-cells = <1>; |
2230 |
+ }; |
2231 |
+ |
2232 |
+- ipmmu_vi0: mmu@febd0000 { |
2233 |
++ ipmmu_vi0: iommu@febd0000 { |
2234 |
+ compatible = "renesas,ipmmu-r8a774a1"; |
2235 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2236 |
+ renesas,ipmmu-main = <&ipmmu_mm 9>; |
2237 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
2238 |
+index 3137f735974b..1e51855c7cd3 100644 |
2239 |
+--- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
2240 |
++++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
2241 |
+@@ -874,7 +874,7 @@ |
2242 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2243 |
+ }; |
2244 |
+ |
2245 |
+- ipmmu_ds0: mmu@e6740000 { |
2246 |
++ ipmmu_ds0: iommu@e6740000 { |
2247 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2248 |
+ reg = <0 0xe6740000 0 0x1000>; |
2249 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2250 |
+@@ -882,7 +882,7 @@ |
2251 |
+ #iommu-cells = <1>; |
2252 |
+ }; |
2253 |
+ |
2254 |
+- ipmmu_ds1: mmu@e7740000 { |
2255 |
++ ipmmu_ds1: iommu@e7740000 { |
2256 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2257 |
+ reg = <0 0xe7740000 0 0x1000>; |
2258 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2259 |
+@@ -890,7 +890,7 @@ |
2260 |
+ #iommu-cells = <1>; |
2261 |
+ }; |
2262 |
+ |
2263 |
+- ipmmu_hc: mmu@e6570000 { |
2264 |
++ ipmmu_hc: iommu@e6570000 { |
2265 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2266 |
+ reg = <0 0xe6570000 0 0x1000>; |
2267 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2268 |
+@@ -898,7 +898,7 @@ |
2269 |
+ #iommu-cells = <1>; |
2270 |
+ }; |
2271 |
+ |
2272 |
+- ipmmu_mm: mmu@e67b0000 { |
2273 |
++ ipmmu_mm: iommu@e67b0000 { |
2274 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2275 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2276 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2277 |
+@@ -907,7 +907,7 @@ |
2278 |
+ #iommu-cells = <1>; |
2279 |
+ }; |
2280 |
+ |
2281 |
+- ipmmu_mp: mmu@ec670000 { |
2282 |
++ ipmmu_mp: iommu@ec670000 { |
2283 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2284 |
+ reg = <0 0xec670000 0 0x1000>; |
2285 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2286 |
+@@ -915,7 +915,7 @@ |
2287 |
+ #iommu-cells = <1>; |
2288 |
+ }; |
2289 |
+ |
2290 |
+- ipmmu_pv0: mmu@fd800000 { |
2291 |
++ ipmmu_pv0: iommu@fd800000 { |
2292 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2293 |
+ reg = <0 0xfd800000 0 0x1000>; |
2294 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2295 |
+@@ -923,7 +923,7 @@ |
2296 |
+ #iommu-cells = <1>; |
2297 |
+ }; |
2298 |
+ |
2299 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2300 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2301 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2302 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
2303 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
2304 |
+@@ -931,7 +931,7 @@ |
2305 |
+ #iommu-cells = <1>; |
2306 |
+ }; |
2307 |
+ |
2308 |
+- ipmmu_vi0: mmu@febd0000 { |
2309 |
++ ipmmu_vi0: iommu@febd0000 { |
2310 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2311 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2312 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
2313 |
+@@ -939,7 +939,7 @@ |
2314 |
+ #iommu-cells = <1>; |
2315 |
+ }; |
2316 |
+ |
2317 |
+- ipmmu_vp0: mmu@fe990000 { |
2318 |
++ ipmmu_vp0: iommu@fe990000 { |
2319 |
+ compatible = "renesas,ipmmu-r8a774b1"; |
2320 |
+ reg = <0 0xfe990000 0 0x1000>; |
2321 |
+ renesas,ipmmu-main = <&ipmmu_mm 16>; |
2322 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
2323 |
+index 22785cbddff5..5c72a7efbb03 100644 |
2324 |
+--- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
2325 |
++++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
2326 |
+@@ -847,7 +847,7 @@ |
2327 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2328 |
+ }; |
2329 |
+ |
2330 |
+- ipmmu_ds0: mmu@e6740000 { |
2331 |
++ ipmmu_ds0: iommu@e6740000 { |
2332 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2333 |
+ reg = <0 0xe6740000 0 0x1000>; |
2334 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2335 |
+@@ -855,7 +855,7 @@ |
2336 |
+ #iommu-cells = <1>; |
2337 |
+ }; |
2338 |
+ |
2339 |
+- ipmmu_ds1: mmu@e7740000 { |
2340 |
++ ipmmu_ds1: iommu@e7740000 { |
2341 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2342 |
+ reg = <0 0xe7740000 0 0x1000>; |
2343 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2344 |
+@@ -863,7 +863,7 @@ |
2345 |
+ #iommu-cells = <1>; |
2346 |
+ }; |
2347 |
+ |
2348 |
+- ipmmu_hc: mmu@e6570000 { |
2349 |
++ ipmmu_hc: iommu@e6570000 { |
2350 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2351 |
+ reg = <0 0xe6570000 0 0x1000>; |
2352 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2353 |
+@@ -871,7 +871,7 @@ |
2354 |
+ #iommu-cells = <1>; |
2355 |
+ }; |
2356 |
+ |
2357 |
+- ipmmu_mm: mmu@e67b0000 { |
2358 |
++ ipmmu_mm: iommu@e67b0000 { |
2359 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2360 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2361 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2362 |
+@@ -880,7 +880,7 @@ |
2363 |
+ #iommu-cells = <1>; |
2364 |
+ }; |
2365 |
+ |
2366 |
+- ipmmu_mp: mmu@ec670000 { |
2367 |
++ ipmmu_mp: iommu@ec670000 { |
2368 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2369 |
+ reg = <0 0xec670000 0 0x1000>; |
2370 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2371 |
+@@ -888,7 +888,7 @@ |
2372 |
+ #iommu-cells = <1>; |
2373 |
+ }; |
2374 |
+ |
2375 |
+- ipmmu_pv0: mmu@fd800000 { |
2376 |
++ ipmmu_pv0: iommu@fd800000 { |
2377 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2378 |
+ reg = <0 0xfd800000 0 0x1000>; |
2379 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2380 |
+@@ -896,7 +896,7 @@ |
2381 |
+ #iommu-cells = <1>; |
2382 |
+ }; |
2383 |
+ |
2384 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2385 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2386 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2387 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
2388 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
2389 |
+@@ -904,7 +904,7 @@ |
2390 |
+ #iommu-cells = <1>; |
2391 |
+ }; |
2392 |
+ |
2393 |
+- ipmmu_vi0: mmu@febd0000 { |
2394 |
++ ipmmu_vi0: iommu@febd0000 { |
2395 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2396 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2397 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
2398 |
+@@ -912,7 +912,7 @@ |
2399 |
+ #iommu-cells = <1>; |
2400 |
+ }; |
2401 |
+ |
2402 |
+- ipmmu_vp0: mmu@fe990000 { |
2403 |
++ ipmmu_vp0: iommu@fe990000 { |
2404 |
+ compatible = "renesas,ipmmu-r8a774c0"; |
2405 |
+ reg = <0 0xfe990000 0 0x1000>; |
2406 |
+ renesas,ipmmu-main = <&ipmmu_mm 16>; |
2407 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77950.dtsi b/arch/arm64/boot/dts/renesas/r8a77950.dtsi |
2408 |
+index 3975eecd50c4..d716c4386ae9 100644 |
2409 |
+--- a/arch/arm64/boot/dts/renesas/r8a77950.dtsi |
2410 |
++++ b/arch/arm64/boot/dts/renesas/r8a77950.dtsi |
2411 |
+@@ -77,7 +77,7 @@ |
2412 |
+ /delete-node/ dma-controller@e6460000; |
2413 |
+ /delete-node/ dma-controller@e6470000; |
2414 |
+ |
2415 |
+- ipmmu_mp1: mmu@ec680000 { |
2416 |
++ ipmmu_mp1: iommu@ec680000 { |
2417 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2418 |
+ reg = <0 0xec680000 0 0x1000>; |
2419 |
+ renesas,ipmmu-main = <&ipmmu_mm 5>; |
2420 |
+@@ -85,7 +85,7 @@ |
2421 |
+ #iommu-cells = <1>; |
2422 |
+ }; |
2423 |
+ |
2424 |
+- ipmmu_sy: mmu@e7730000 { |
2425 |
++ ipmmu_sy: iommu@e7730000 { |
2426 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2427 |
+ reg = <0 0xe7730000 0 0x1000>; |
2428 |
+ renesas,ipmmu-main = <&ipmmu_mm 8>; |
2429 |
+@@ -93,11 +93,11 @@ |
2430 |
+ #iommu-cells = <1>; |
2431 |
+ }; |
2432 |
+ |
2433 |
+- /delete-node/ mmu@fd950000; |
2434 |
+- /delete-node/ mmu@fd960000; |
2435 |
+- /delete-node/ mmu@fd970000; |
2436 |
+- /delete-node/ mmu@febe0000; |
2437 |
+- /delete-node/ mmu@fe980000; |
2438 |
++ /delete-node/ iommu@fd950000; |
2439 |
++ /delete-node/ iommu@fd960000; |
2440 |
++ /delete-node/ iommu@fd970000; |
2441 |
++ /delete-node/ iommu@febe0000; |
2442 |
++ /delete-node/ iommu@fe980000; |
2443 |
+ |
2444 |
+ xhci1: usb@ee040000 { |
2445 |
+ compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci"; |
2446 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77951.dtsi b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
2447 |
+index 52229546454c..61d67d9714ab 100644 |
2448 |
+--- a/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
2449 |
++++ b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
2450 |
+@@ -1073,7 +1073,7 @@ |
2451 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2452 |
+ }; |
2453 |
+ |
2454 |
+- ipmmu_ds0: mmu@e6740000 { |
2455 |
++ ipmmu_ds0: iommu@e6740000 { |
2456 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2457 |
+ reg = <0 0xe6740000 0 0x1000>; |
2458 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2459 |
+@@ -1081,7 +1081,7 @@ |
2460 |
+ #iommu-cells = <1>; |
2461 |
+ }; |
2462 |
+ |
2463 |
+- ipmmu_ds1: mmu@e7740000 { |
2464 |
++ ipmmu_ds1: iommu@e7740000 { |
2465 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2466 |
+ reg = <0 0xe7740000 0 0x1000>; |
2467 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2468 |
+@@ -1089,7 +1089,7 @@ |
2469 |
+ #iommu-cells = <1>; |
2470 |
+ }; |
2471 |
+ |
2472 |
+- ipmmu_hc: mmu@e6570000 { |
2473 |
++ ipmmu_hc: iommu@e6570000 { |
2474 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2475 |
+ reg = <0 0xe6570000 0 0x1000>; |
2476 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2477 |
+@@ -1097,7 +1097,7 @@ |
2478 |
+ #iommu-cells = <1>; |
2479 |
+ }; |
2480 |
+ |
2481 |
+- ipmmu_ir: mmu@ff8b0000 { |
2482 |
++ ipmmu_ir: iommu@ff8b0000 { |
2483 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2484 |
+ reg = <0 0xff8b0000 0 0x1000>; |
2485 |
+ renesas,ipmmu-main = <&ipmmu_mm 3>; |
2486 |
+@@ -1105,7 +1105,7 @@ |
2487 |
+ #iommu-cells = <1>; |
2488 |
+ }; |
2489 |
+ |
2490 |
+- ipmmu_mm: mmu@e67b0000 { |
2491 |
++ ipmmu_mm: iommu@e67b0000 { |
2492 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2493 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2494 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2495 |
+@@ -1114,7 +1114,7 @@ |
2496 |
+ #iommu-cells = <1>; |
2497 |
+ }; |
2498 |
+ |
2499 |
+- ipmmu_mp0: mmu@ec670000 { |
2500 |
++ ipmmu_mp0: iommu@ec670000 { |
2501 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2502 |
+ reg = <0 0xec670000 0 0x1000>; |
2503 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2504 |
+@@ -1122,7 +1122,7 @@ |
2505 |
+ #iommu-cells = <1>; |
2506 |
+ }; |
2507 |
+ |
2508 |
+- ipmmu_pv0: mmu@fd800000 { |
2509 |
++ ipmmu_pv0: iommu@fd800000 { |
2510 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2511 |
+ reg = <0 0xfd800000 0 0x1000>; |
2512 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2513 |
+@@ -1130,7 +1130,7 @@ |
2514 |
+ #iommu-cells = <1>; |
2515 |
+ }; |
2516 |
+ |
2517 |
+- ipmmu_pv1: mmu@fd950000 { |
2518 |
++ ipmmu_pv1: iommu@fd950000 { |
2519 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2520 |
+ reg = <0 0xfd950000 0 0x1000>; |
2521 |
+ renesas,ipmmu-main = <&ipmmu_mm 7>; |
2522 |
+@@ -1138,7 +1138,7 @@ |
2523 |
+ #iommu-cells = <1>; |
2524 |
+ }; |
2525 |
+ |
2526 |
+- ipmmu_pv2: mmu@fd960000 { |
2527 |
++ ipmmu_pv2: iommu@fd960000 { |
2528 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2529 |
+ reg = <0 0xfd960000 0 0x1000>; |
2530 |
+ renesas,ipmmu-main = <&ipmmu_mm 8>; |
2531 |
+@@ -1146,7 +1146,7 @@ |
2532 |
+ #iommu-cells = <1>; |
2533 |
+ }; |
2534 |
+ |
2535 |
+- ipmmu_pv3: mmu@fd970000 { |
2536 |
++ ipmmu_pv3: iommu@fd970000 { |
2537 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2538 |
+ reg = <0 0xfd970000 0 0x1000>; |
2539 |
+ renesas,ipmmu-main = <&ipmmu_mm 9>; |
2540 |
+@@ -1154,7 +1154,7 @@ |
2541 |
+ #iommu-cells = <1>; |
2542 |
+ }; |
2543 |
+ |
2544 |
+- ipmmu_rt: mmu@ffc80000 { |
2545 |
++ ipmmu_rt: iommu@ffc80000 { |
2546 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2547 |
+ reg = <0 0xffc80000 0 0x1000>; |
2548 |
+ renesas,ipmmu-main = <&ipmmu_mm 10>; |
2549 |
+@@ -1162,7 +1162,7 @@ |
2550 |
+ #iommu-cells = <1>; |
2551 |
+ }; |
2552 |
+ |
2553 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2554 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2555 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2556 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
2557 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
2558 |
+@@ -1170,7 +1170,7 @@ |
2559 |
+ #iommu-cells = <1>; |
2560 |
+ }; |
2561 |
+ |
2562 |
+- ipmmu_vc1: mmu@fe6f0000 { |
2563 |
++ ipmmu_vc1: iommu@fe6f0000 { |
2564 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2565 |
+ reg = <0 0xfe6f0000 0 0x1000>; |
2566 |
+ renesas,ipmmu-main = <&ipmmu_mm 13>; |
2567 |
+@@ -1178,7 +1178,7 @@ |
2568 |
+ #iommu-cells = <1>; |
2569 |
+ }; |
2570 |
+ |
2571 |
+- ipmmu_vi0: mmu@febd0000 { |
2572 |
++ ipmmu_vi0: iommu@febd0000 { |
2573 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2574 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2575 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
2576 |
+@@ -1186,7 +1186,7 @@ |
2577 |
+ #iommu-cells = <1>; |
2578 |
+ }; |
2579 |
+ |
2580 |
+- ipmmu_vi1: mmu@febe0000 { |
2581 |
++ ipmmu_vi1: iommu@febe0000 { |
2582 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2583 |
+ reg = <0 0xfebe0000 0 0x1000>; |
2584 |
+ renesas,ipmmu-main = <&ipmmu_mm 15>; |
2585 |
+@@ -1194,7 +1194,7 @@ |
2586 |
+ #iommu-cells = <1>; |
2587 |
+ }; |
2588 |
+ |
2589 |
+- ipmmu_vp0: mmu@fe990000 { |
2590 |
++ ipmmu_vp0: iommu@fe990000 { |
2591 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2592 |
+ reg = <0 0xfe990000 0 0x1000>; |
2593 |
+ renesas,ipmmu-main = <&ipmmu_mm 16>; |
2594 |
+@@ -1202,7 +1202,7 @@ |
2595 |
+ #iommu-cells = <1>; |
2596 |
+ }; |
2597 |
+ |
2598 |
+- ipmmu_vp1: mmu@fe980000 { |
2599 |
++ ipmmu_vp1: iommu@fe980000 { |
2600 |
+ compatible = "renesas,ipmmu-r8a7795"; |
2601 |
+ reg = <0 0xfe980000 0 0x1000>; |
2602 |
+ renesas,ipmmu-main = <&ipmmu_mm 17>; |
2603 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
2604 |
+index 31282367d3ac..33bf62acffbb 100644 |
2605 |
+--- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
2606 |
++++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
2607 |
+@@ -997,7 +997,7 @@ |
2608 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2609 |
+ }; |
2610 |
+ |
2611 |
+- ipmmu_ds0: mmu@e6740000 { |
2612 |
++ ipmmu_ds0: iommu@e6740000 { |
2613 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2614 |
+ reg = <0 0xe6740000 0 0x1000>; |
2615 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2616 |
+@@ -1005,7 +1005,7 @@ |
2617 |
+ #iommu-cells = <1>; |
2618 |
+ }; |
2619 |
+ |
2620 |
+- ipmmu_ds1: mmu@e7740000 { |
2621 |
++ ipmmu_ds1: iommu@e7740000 { |
2622 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2623 |
+ reg = <0 0xe7740000 0 0x1000>; |
2624 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2625 |
+@@ -1013,7 +1013,7 @@ |
2626 |
+ #iommu-cells = <1>; |
2627 |
+ }; |
2628 |
+ |
2629 |
+- ipmmu_hc: mmu@e6570000 { |
2630 |
++ ipmmu_hc: iommu@e6570000 { |
2631 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2632 |
+ reg = <0 0xe6570000 0 0x1000>; |
2633 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2634 |
+@@ -1021,7 +1021,7 @@ |
2635 |
+ #iommu-cells = <1>; |
2636 |
+ }; |
2637 |
+ |
2638 |
+- ipmmu_ir: mmu@ff8b0000 { |
2639 |
++ ipmmu_ir: iommu@ff8b0000 { |
2640 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2641 |
+ reg = <0 0xff8b0000 0 0x1000>; |
2642 |
+ renesas,ipmmu-main = <&ipmmu_mm 3>; |
2643 |
+@@ -1029,7 +1029,7 @@ |
2644 |
+ #iommu-cells = <1>; |
2645 |
+ }; |
2646 |
+ |
2647 |
+- ipmmu_mm: mmu@e67b0000 { |
2648 |
++ ipmmu_mm: iommu@e67b0000 { |
2649 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2650 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2651 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2652 |
+@@ -1038,7 +1038,7 @@ |
2653 |
+ #iommu-cells = <1>; |
2654 |
+ }; |
2655 |
+ |
2656 |
+- ipmmu_mp: mmu@ec670000 { |
2657 |
++ ipmmu_mp: iommu@ec670000 { |
2658 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2659 |
+ reg = <0 0xec670000 0 0x1000>; |
2660 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2661 |
+@@ -1046,7 +1046,7 @@ |
2662 |
+ #iommu-cells = <1>; |
2663 |
+ }; |
2664 |
+ |
2665 |
+- ipmmu_pv0: mmu@fd800000 { |
2666 |
++ ipmmu_pv0: iommu@fd800000 { |
2667 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2668 |
+ reg = <0 0xfd800000 0 0x1000>; |
2669 |
+ renesas,ipmmu-main = <&ipmmu_mm 5>; |
2670 |
+@@ -1054,7 +1054,7 @@ |
2671 |
+ #iommu-cells = <1>; |
2672 |
+ }; |
2673 |
+ |
2674 |
+- ipmmu_pv1: mmu@fd950000 { |
2675 |
++ ipmmu_pv1: iommu@fd950000 { |
2676 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2677 |
+ reg = <0 0xfd950000 0 0x1000>; |
2678 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2679 |
+@@ -1062,7 +1062,7 @@ |
2680 |
+ #iommu-cells = <1>; |
2681 |
+ }; |
2682 |
+ |
2683 |
+- ipmmu_rt: mmu@ffc80000 { |
2684 |
++ ipmmu_rt: iommu@ffc80000 { |
2685 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2686 |
+ reg = <0 0xffc80000 0 0x1000>; |
2687 |
+ renesas,ipmmu-main = <&ipmmu_mm 7>; |
2688 |
+@@ -1070,7 +1070,7 @@ |
2689 |
+ #iommu-cells = <1>; |
2690 |
+ }; |
2691 |
+ |
2692 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2693 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2694 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2695 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
2696 |
+ renesas,ipmmu-main = <&ipmmu_mm 8>; |
2697 |
+@@ -1078,7 +1078,7 @@ |
2698 |
+ #iommu-cells = <1>; |
2699 |
+ }; |
2700 |
+ |
2701 |
+- ipmmu_vi0: mmu@febd0000 { |
2702 |
++ ipmmu_vi0: iommu@febd0000 { |
2703 |
+ compatible = "renesas,ipmmu-r8a7796"; |
2704 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2705 |
+ renesas,ipmmu-main = <&ipmmu_mm 9>; |
2706 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
2707 |
+index d82dd4e67b62..6f7ab39fd282 100644 |
2708 |
+--- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
2709 |
++++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
2710 |
+@@ -867,7 +867,7 @@ |
2711 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2712 |
+ }; |
2713 |
+ |
2714 |
+- ipmmu_ds0: mmu@e6740000 { |
2715 |
++ ipmmu_ds0: iommu@e6740000 { |
2716 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2717 |
+ reg = <0 0xe6740000 0 0x1000>; |
2718 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2719 |
+@@ -875,7 +875,7 @@ |
2720 |
+ #iommu-cells = <1>; |
2721 |
+ }; |
2722 |
+ |
2723 |
+- ipmmu_ds1: mmu@e7740000 { |
2724 |
++ ipmmu_ds1: iommu@e7740000 { |
2725 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2726 |
+ reg = <0 0xe7740000 0 0x1000>; |
2727 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2728 |
+@@ -883,7 +883,7 @@ |
2729 |
+ #iommu-cells = <1>; |
2730 |
+ }; |
2731 |
+ |
2732 |
+- ipmmu_hc: mmu@e6570000 { |
2733 |
++ ipmmu_hc: iommu@e6570000 { |
2734 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2735 |
+ reg = <0 0xe6570000 0 0x1000>; |
2736 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2737 |
+@@ -891,7 +891,7 @@ |
2738 |
+ #iommu-cells = <1>; |
2739 |
+ }; |
2740 |
+ |
2741 |
+- ipmmu_mm: mmu@e67b0000 { |
2742 |
++ ipmmu_mm: iommu@e67b0000 { |
2743 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2744 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2745 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2746 |
+@@ -900,7 +900,7 @@ |
2747 |
+ #iommu-cells = <1>; |
2748 |
+ }; |
2749 |
+ |
2750 |
+- ipmmu_mp: mmu@ec670000 { |
2751 |
++ ipmmu_mp: iommu@ec670000 { |
2752 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2753 |
+ reg = <0 0xec670000 0 0x1000>; |
2754 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2755 |
+@@ -908,7 +908,7 @@ |
2756 |
+ #iommu-cells = <1>; |
2757 |
+ }; |
2758 |
+ |
2759 |
+- ipmmu_pv0: mmu@fd800000 { |
2760 |
++ ipmmu_pv0: iommu@fd800000 { |
2761 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2762 |
+ reg = <0 0xfd800000 0 0x1000>; |
2763 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2764 |
+@@ -916,7 +916,7 @@ |
2765 |
+ #iommu-cells = <1>; |
2766 |
+ }; |
2767 |
+ |
2768 |
+- ipmmu_rt: mmu@ffc80000 { |
2769 |
++ ipmmu_rt: iommu@ffc80000 { |
2770 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2771 |
+ reg = <0 0xffc80000 0 0x1000>; |
2772 |
+ renesas,ipmmu-main = <&ipmmu_mm 10>; |
2773 |
+@@ -924,7 +924,7 @@ |
2774 |
+ #iommu-cells = <1>; |
2775 |
+ }; |
2776 |
+ |
2777 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2778 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2779 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2780 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
2781 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
2782 |
+@@ -932,7 +932,7 @@ |
2783 |
+ #iommu-cells = <1>; |
2784 |
+ }; |
2785 |
+ |
2786 |
+- ipmmu_vi0: mmu@febd0000 { |
2787 |
++ ipmmu_vi0: iommu@febd0000 { |
2788 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2789 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2790 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
2791 |
+@@ -940,7 +940,7 @@ |
2792 |
+ #iommu-cells = <1>; |
2793 |
+ }; |
2794 |
+ |
2795 |
+- ipmmu_vp0: mmu@fe990000 { |
2796 |
++ ipmmu_vp0: iommu@fe990000 { |
2797 |
+ compatible = "renesas,ipmmu-r8a77965"; |
2798 |
+ reg = <0 0xfe990000 0 0x1000>; |
2799 |
+ renesas,ipmmu-main = <&ipmmu_mm 16>; |
2800 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77970.dtsi b/arch/arm64/boot/dts/renesas/r8a77970.dtsi |
2801 |
+index a009c0ebc8b4..bd95ecb1b40d 100644 |
2802 |
+--- a/arch/arm64/boot/dts/renesas/r8a77970.dtsi |
2803 |
++++ b/arch/arm64/boot/dts/renesas/r8a77970.dtsi |
2804 |
+@@ -985,7 +985,7 @@ |
2805 |
+ <&ipmmu_ds1 22>, <&ipmmu_ds1 23>; |
2806 |
+ }; |
2807 |
+ |
2808 |
+- ipmmu_ds1: mmu@e7740000 { |
2809 |
++ ipmmu_ds1: iommu@e7740000 { |
2810 |
+ compatible = "renesas,ipmmu-r8a77970"; |
2811 |
+ reg = <0 0xe7740000 0 0x1000>; |
2812 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2813 |
+@@ -993,7 +993,7 @@ |
2814 |
+ #iommu-cells = <1>; |
2815 |
+ }; |
2816 |
+ |
2817 |
+- ipmmu_ir: mmu@ff8b0000 { |
2818 |
++ ipmmu_ir: iommu@ff8b0000 { |
2819 |
+ compatible = "renesas,ipmmu-r8a77970"; |
2820 |
+ reg = <0 0xff8b0000 0 0x1000>; |
2821 |
+ renesas,ipmmu-main = <&ipmmu_mm 3>; |
2822 |
+@@ -1001,7 +1001,7 @@ |
2823 |
+ #iommu-cells = <1>; |
2824 |
+ }; |
2825 |
+ |
2826 |
+- ipmmu_mm: mmu@e67b0000 { |
2827 |
++ ipmmu_mm: iommu@e67b0000 { |
2828 |
+ compatible = "renesas,ipmmu-r8a77970"; |
2829 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2830 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2831 |
+@@ -1010,7 +1010,7 @@ |
2832 |
+ #iommu-cells = <1>; |
2833 |
+ }; |
2834 |
+ |
2835 |
+- ipmmu_rt: mmu@ffc80000 { |
2836 |
++ ipmmu_rt: iommu@ffc80000 { |
2837 |
+ compatible = "renesas,ipmmu-r8a77970"; |
2838 |
+ reg = <0 0xffc80000 0 0x1000>; |
2839 |
+ renesas,ipmmu-main = <&ipmmu_mm 7>; |
2840 |
+@@ -1018,7 +1018,7 @@ |
2841 |
+ #iommu-cells = <1>; |
2842 |
+ }; |
2843 |
+ |
2844 |
+- ipmmu_vi0: mmu@febd0000 { |
2845 |
++ ipmmu_vi0: iommu@febd0000 { |
2846 |
+ compatible = "renesas,ipmmu-r8a77970"; |
2847 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2848 |
+ renesas,ipmmu-main = <&ipmmu_mm 9>; |
2849 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77980.dtsi b/arch/arm64/boot/dts/renesas/r8a77980.dtsi |
2850 |
+index d672b320bc14..387e6d99f2f3 100644 |
2851 |
+--- a/arch/arm64/boot/dts/renesas/r8a77980.dtsi |
2852 |
++++ b/arch/arm64/boot/dts/renesas/r8a77980.dtsi |
2853 |
+@@ -1266,7 +1266,7 @@ |
2854 |
+ status = "disabled"; |
2855 |
+ }; |
2856 |
+ |
2857 |
+- ipmmu_ds1: mmu@e7740000 { |
2858 |
++ ipmmu_ds1: iommu@e7740000 { |
2859 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2860 |
+ reg = <0 0xe7740000 0 0x1000>; |
2861 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2862 |
+@@ -1274,7 +1274,7 @@ |
2863 |
+ #iommu-cells = <1>; |
2864 |
+ }; |
2865 |
+ |
2866 |
+- ipmmu_ir: mmu@ff8b0000 { |
2867 |
++ ipmmu_ir: iommu@ff8b0000 { |
2868 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2869 |
+ reg = <0 0xff8b0000 0 0x1000>; |
2870 |
+ renesas,ipmmu-main = <&ipmmu_mm 3>; |
2871 |
+@@ -1282,7 +1282,7 @@ |
2872 |
+ #iommu-cells = <1>; |
2873 |
+ }; |
2874 |
+ |
2875 |
+- ipmmu_mm: mmu@e67b0000 { |
2876 |
++ ipmmu_mm: iommu@e67b0000 { |
2877 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2878 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2879 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2880 |
+@@ -1291,7 +1291,7 @@ |
2881 |
+ #iommu-cells = <1>; |
2882 |
+ }; |
2883 |
+ |
2884 |
+- ipmmu_rt: mmu@ffc80000 { |
2885 |
++ ipmmu_rt: iommu@ffc80000 { |
2886 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2887 |
+ reg = <0 0xffc80000 0 0x1000>; |
2888 |
+ renesas,ipmmu-main = <&ipmmu_mm 10>; |
2889 |
+@@ -1299,7 +1299,7 @@ |
2890 |
+ #iommu-cells = <1>; |
2891 |
+ }; |
2892 |
+ |
2893 |
+- ipmmu_vc0: mmu@fe990000 { |
2894 |
++ ipmmu_vc0: iommu@fe990000 { |
2895 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2896 |
+ reg = <0 0xfe990000 0 0x1000>; |
2897 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
2898 |
+@@ -1307,7 +1307,7 @@ |
2899 |
+ #iommu-cells = <1>; |
2900 |
+ }; |
2901 |
+ |
2902 |
+- ipmmu_vi0: mmu@febd0000 { |
2903 |
++ ipmmu_vi0: iommu@febd0000 { |
2904 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2905 |
+ reg = <0 0xfebd0000 0 0x1000>; |
2906 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
2907 |
+@@ -1315,7 +1315,7 @@ |
2908 |
+ #iommu-cells = <1>; |
2909 |
+ }; |
2910 |
+ |
2911 |
+- ipmmu_vip0: mmu@e7b00000 { |
2912 |
++ ipmmu_vip0: iommu@e7b00000 { |
2913 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2914 |
+ reg = <0 0xe7b00000 0 0x1000>; |
2915 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2916 |
+@@ -1323,7 +1323,7 @@ |
2917 |
+ #iommu-cells = <1>; |
2918 |
+ }; |
2919 |
+ |
2920 |
+- ipmmu_vip1: mmu@e7960000 { |
2921 |
++ ipmmu_vip1: iommu@e7960000 { |
2922 |
+ compatible = "renesas,ipmmu-r8a77980"; |
2923 |
+ reg = <0 0xe7960000 0 0x1000>; |
2924 |
+ renesas,ipmmu-main = <&ipmmu_mm 11>; |
2925 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
2926 |
+index 1543f18e834f..cd11f24744d4 100644 |
2927 |
+--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
2928 |
++++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
2929 |
+@@ -817,7 +817,7 @@ |
2930 |
+ <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2931 |
+ }; |
2932 |
+ |
2933 |
+- ipmmu_ds0: mmu@e6740000 { |
2934 |
++ ipmmu_ds0: iommu@e6740000 { |
2935 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2936 |
+ reg = <0 0xe6740000 0 0x1000>; |
2937 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
2938 |
+@@ -825,7 +825,7 @@ |
2939 |
+ #iommu-cells = <1>; |
2940 |
+ }; |
2941 |
+ |
2942 |
+- ipmmu_ds1: mmu@e7740000 { |
2943 |
++ ipmmu_ds1: iommu@e7740000 { |
2944 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2945 |
+ reg = <0 0xe7740000 0 0x1000>; |
2946 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
2947 |
+@@ -833,7 +833,7 @@ |
2948 |
+ #iommu-cells = <1>; |
2949 |
+ }; |
2950 |
+ |
2951 |
+- ipmmu_hc: mmu@e6570000 { |
2952 |
++ ipmmu_hc: iommu@e6570000 { |
2953 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2954 |
+ reg = <0 0xe6570000 0 0x1000>; |
2955 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
2956 |
+@@ -841,7 +841,7 @@ |
2957 |
+ #iommu-cells = <1>; |
2958 |
+ }; |
2959 |
+ |
2960 |
+- ipmmu_mm: mmu@e67b0000 { |
2961 |
++ ipmmu_mm: iommu@e67b0000 { |
2962 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2963 |
+ reg = <0 0xe67b0000 0 0x1000>; |
2964 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2965 |
+@@ -850,7 +850,7 @@ |
2966 |
+ #iommu-cells = <1>; |
2967 |
+ }; |
2968 |
+ |
2969 |
+- ipmmu_mp: mmu@ec670000 { |
2970 |
++ ipmmu_mp: iommu@ec670000 { |
2971 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2972 |
+ reg = <0 0xec670000 0 0x1000>; |
2973 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
2974 |
+@@ -858,7 +858,7 @@ |
2975 |
+ #iommu-cells = <1>; |
2976 |
+ }; |
2977 |
+ |
2978 |
+- ipmmu_pv0: mmu@fd800000 { |
2979 |
++ ipmmu_pv0: iommu@fd800000 { |
2980 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2981 |
+ reg = <0 0xfd800000 0 0x1000>; |
2982 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
2983 |
+@@ -866,7 +866,7 @@ |
2984 |
+ #iommu-cells = <1>; |
2985 |
+ }; |
2986 |
+ |
2987 |
+- ipmmu_rt: mmu@ffc80000 { |
2988 |
++ ipmmu_rt: iommu@ffc80000 { |
2989 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2990 |
+ reg = <0 0xffc80000 0 0x1000>; |
2991 |
+ renesas,ipmmu-main = <&ipmmu_mm 10>; |
2992 |
+@@ -874,7 +874,7 @@ |
2993 |
+ #iommu-cells = <1>; |
2994 |
+ }; |
2995 |
+ |
2996 |
+- ipmmu_vc0: mmu@fe6b0000 { |
2997 |
++ ipmmu_vc0: iommu@fe6b0000 { |
2998 |
+ compatible = "renesas,ipmmu-r8a77990"; |
2999 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
3000 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
3001 |
+@@ -882,7 +882,7 @@ |
3002 |
+ #iommu-cells = <1>; |
3003 |
+ }; |
3004 |
+ |
3005 |
+- ipmmu_vi0: mmu@febd0000 { |
3006 |
++ ipmmu_vi0: iommu@febd0000 { |
3007 |
+ compatible = "renesas,ipmmu-r8a77990"; |
3008 |
+ reg = <0 0xfebd0000 0 0x1000>; |
3009 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
3010 |
+@@ -890,7 +890,7 @@ |
3011 |
+ #iommu-cells = <1>; |
3012 |
+ }; |
3013 |
+ |
3014 |
+- ipmmu_vp0: mmu@fe990000 { |
3015 |
++ ipmmu_vp0: iommu@fe990000 { |
3016 |
+ compatible = "renesas,ipmmu-r8a77990"; |
3017 |
+ reg = <0 0xfe990000 0 0x1000>; |
3018 |
+ renesas,ipmmu-main = <&ipmmu_mm 16>; |
3019 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
3020 |
+index e8d2290fe79d..e5617ec0f49c 100644 |
3021 |
+--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
3022 |
++++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
3023 |
+@@ -507,7 +507,7 @@ |
3024 |
+ <&ipmmu_ds1 22>, <&ipmmu_ds1 23>; |
3025 |
+ }; |
3026 |
+ |
3027 |
+- ipmmu_ds0: mmu@e6740000 { |
3028 |
++ ipmmu_ds0: iommu@e6740000 { |
3029 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3030 |
+ reg = <0 0xe6740000 0 0x1000>; |
3031 |
+ renesas,ipmmu-main = <&ipmmu_mm 0>; |
3032 |
+@@ -515,7 +515,7 @@ |
3033 |
+ #iommu-cells = <1>; |
3034 |
+ }; |
3035 |
+ |
3036 |
+- ipmmu_ds1: mmu@e7740000 { |
3037 |
++ ipmmu_ds1: iommu@e7740000 { |
3038 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3039 |
+ reg = <0 0xe7740000 0 0x1000>; |
3040 |
+ renesas,ipmmu-main = <&ipmmu_mm 1>; |
3041 |
+@@ -523,7 +523,7 @@ |
3042 |
+ #iommu-cells = <1>; |
3043 |
+ }; |
3044 |
+ |
3045 |
+- ipmmu_hc: mmu@e6570000 { |
3046 |
++ ipmmu_hc: iommu@e6570000 { |
3047 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3048 |
+ reg = <0 0xe6570000 0 0x1000>; |
3049 |
+ renesas,ipmmu-main = <&ipmmu_mm 2>; |
3050 |
+@@ -531,7 +531,7 @@ |
3051 |
+ #iommu-cells = <1>; |
3052 |
+ }; |
3053 |
+ |
3054 |
+- ipmmu_mm: mmu@e67b0000 { |
3055 |
++ ipmmu_mm: iommu@e67b0000 { |
3056 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3057 |
+ reg = <0 0xe67b0000 0 0x1000>; |
3058 |
+ interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
3059 |
+@@ -540,7 +540,7 @@ |
3060 |
+ #iommu-cells = <1>; |
3061 |
+ }; |
3062 |
+ |
3063 |
+- ipmmu_mp: mmu@ec670000 { |
3064 |
++ ipmmu_mp: iommu@ec670000 { |
3065 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3066 |
+ reg = <0 0xec670000 0 0x1000>; |
3067 |
+ renesas,ipmmu-main = <&ipmmu_mm 4>; |
3068 |
+@@ -548,7 +548,7 @@ |
3069 |
+ #iommu-cells = <1>; |
3070 |
+ }; |
3071 |
+ |
3072 |
+- ipmmu_pv0: mmu@fd800000 { |
3073 |
++ ipmmu_pv0: iommu@fd800000 { |
3074 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3075 |
+ reg = <0 0xfd800000 0 0x1000>; |
3076 |
+ renesas,ipmmu-main = <&ipmmu_mm 6>; |
3077 |
+@@ -556,7 +556,7 @@ |
3078 |
+ #iommu-cells = <1>; |
3079 |
+ }; |
3080 |
+ |
3081 |
+- ipmmu_rt: mmu@ffc80000 { |
3082 |
++ ipmmu_rt: iommu@ffc80000 { |
3083 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3084 |
+ reg = <0 0xffc80000 0 0x1000>; |
3085 |
+ renesas,ipmmu-main = <&ipmmu_mm 10>; |
3086 |
+@@ -564,7 +564,7 @@ |
3087 |
+ #iommu-cells = <1>; |
3088 |
+ }; |
3089 |
+ |
3090 |
+- ipmmu_vc0: mmu@fe6b0000 { |
3091 |
++ ipmmu_vc0: iommu@fe6b0000 { |
3092 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3093 |
+ reg = <0 0xfe6b0000 0 0x1000>; |
3094 |
+ renesas,ipmmu-main = <&ipmmu_mm 12>; |
3095 |
+@@ -572,7 +572,7 @@ |
3096 |
+ #iommu-cells = <1>; |
3097 |
+ }; |
3098 |
+ |
3099 |
+- ipmmu_vi0: mmu@febd0000 { |
3100 |
++ ipmmu_vi0: iommu@febd0000 { |
3101 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3102 |
+ reg = <0 0xfebd0000 0 0x1000>; |
3103 |
+ renesas,ipmmu-main = <&ipmmu_mm 14>; |
3104 |
+@@ -580,7 +580,7 @@ |
3105 |
+ #iommu-cells = <1>; |
3106 |
+ }; |
3107 |
+ |
3108 |
+- ipmmu_vp0: mmu@fe990000 { |
3109 |
++ ipmmu_vp0: iommu@fe990000 { |
3110 |
+ compatible = "renesas,ipmmu-r8a77995"; |
3111 |
+ reg = <0 0xfe990000 0 0x1000>; |
3112 |
+ renesas,ipmmu-main = <&ipmmu_mm 16>; |
3113 |
+diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c |
3114 |
+index 8618faa82e6d..86a5cf9bc19a 100644 |
3115 |
+--- a/arch/arm64/kernel/ftrace.c |
3116 |
++++ b/arch/arm64/kernel/ftrace.c |
3117 |
+@@ -69,7 +69,8 @@ static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr) |
3118 |
+ |
3119 |
+ if (addr == FTRACE_ADDR) |
3120 |
+ return &plt[FTRACE_PLT_IDX]; |
3121 |
+- if (addr == FTRACE_REGS_ADDR && IS_ENABLED(CONFIG_FTRACE_WITH_REGS)) |
3122 |
++ if (addr == FTRACE_REGS_ADDR && |
3123 |
++ IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS)) |
3124 |
+ return &plt[FTRACE_REGS_PLT_IDX]; |
3125 |
+ #endif |
3126 |
+ return NULL; |
3127 |
+diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c |
3128 |
+index 0b727edf4104..af234a1e08b7 100644 |
3129 |
+--- a/arch/arm64/kernel/hw_breakpoint.c |
3130 |
++++ b/arch/arm64/kernel/hw_breakpoint.c |
3131 |
+@@ -730,6 +730,27 @@ static u64 get_distance_from_watchpoint(unsigned long addr, u64 val, |
3132 |
+ return 0; |
3133 |
+ } |
3134 |
+ |
3135 |
++static int watchpoint_report(struct perf_event *wp, unsigned long addr, |
3136 |
++ struct pt_regs *regs) |
3137 |
++{ |
3138 |
++ int step = is_default_overflow_handler(wp); |
3139 |
++ struct arch_hw_breakpoint *info = counter_arch_bp(wp); |
3140 |
++ |
3141 |
++ info->trigger = addr; |
3142 |
++ |
3143 |
++ /* |
3144 |
++ * If we triggered a user watchpoint from a uaccess routine, then |
3145 |
++ * handle the stepping ourselves since userspace really can't help |
3146 |
++ * us with this. |
3147 |
++ */ |
3148 |
++ if (!user_mode(regs) && info->ctrl.privilege == AARCH64_BREAKPOINT_EL0) |
3149 |
++ step = 1; |
3150 |
++ else |
3151 |
++ perf_bp_event(wp, regs); |
3152 |
++ |
3153 |
++ return step; |
3154 |
++} |
3155 |
++ |
3156 |
+ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
3157 |
+ struct pt_regs *regs) |
3158 |
+ { |
3159 |
+@@ -739,7 +760,6 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
3160 |
+ u64 val; |
3161 |
+ struct perf_event *wp, **slots; |
3162 |
+ struct debug_info *debug_info; |
3163 |
+- struct arch_hw_breakpoint *info; |
3164 |
+ struct arch_hw_breakpoint_ctrl ctrl; |
3165 |
+ |
3166 |
+ slots = this_cpu_ptr(wp_on_reg); |
3167 |
+@@ -777,25 +797,13 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
3168 |
+ if (dist != 0) |
3169 |
+ continue; |
3170 |
+ |
3171 |
+- info = counter_arch_bp(wp); |
3172 |
+- info->trigger = addr; |
3173 |
+- perf_bp_event(wp, regs); |
3174 |
+- |
3175 |
+- /* Do we need to handle the stepping? */ |
3176 |
+- if (is_default_overflow_handler(wp)) |
3177 |
+- step = 1; |
3178 |
++ step = watchpoint_report(wp, addr, regs); |
3179 |
+ } |
3180 |
+- if (min_dist > 0 && min_dist != -1) { |
3181 |
+- /* No exact match found. */ |
3182 |
+- wp = slots[closest_match]; |
3183 |
+- info = counter_arch_bp(wp); |
3184 |
+- info->trigger = addr; |
3185 |
+- perf_bp_event(wp, regs); |
3186 |
+ |
3187 |
+- /* Do we need to handle the stepping? */ |
3188 |
+- if (is_default_overflow_handler(wp)) |
3189 |
+- step = 1; |
3190 |
+- } |
3191 |
++ /* No exact match found? */ |
3192 |
++ if (min_dist > 0 && min_dist != -1) |
3193 |
++ step = watchpoint_report(slots[closest_match], addr, regs); |
3194 |
++ |
3195 |
+ rcu_read_unlock(); |
3196 |
+ |
3197 |
+ if (!step) |
3198 |
+diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c |
3199 |
+index e42727e3568e..3f9010167468 100644 |
3200 |
+--- a/arch/arm64/mm/init.c |
3201 |
++++ b/arch/arm64/mm/init.c |
3202 |
+@@ -458,11 +458,6 @@ void __init arm64_memblock_init(void) |
3203 |
+ high_memory = __va(memblock_end_of_DRAM() - 1) + 1; |
3204 |
+ |
3205 |
+ dma_contiguous_reserve(arm64_dma32_phys_limit); |
3206 |
+- |
3207 |
+-#ifdef CONFIG_ARM64_4K_PAGES |
3208 |
+- hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); |
3209 |
+-#endif |
3210 |
+- |
3211 |
+ } |
3212 |
+ |
3213 |
+ void __init bootmem_init(void) |
3214 |
+@@ -478,6 +473,16 @@ void __init bootmem_init(void) |
3215 |
+ min_low_pfn = min; |
3216 |
+ |
3217 |
+ arm64_numa_init(); |
3218 |
++ |
3219 |
++ /* |
3220 |
++ * must be done after arm64_numa_init() which calls numa_init() to |
3221 |
++ * initialize node_online_map that gets used in hugetlb_cma_reserve() |
3222 |
++ * while allocating required CMA size across online nodes. |
3223 |
++ */ |
3224 |
++#ifdef CONFIG_ARM64_4K_PAGES |
3225 |
++ hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); |
3226 |
++#endif |
3227 |
++ |
3228 |
+ /* |
3229 |
+ * Sparsemem tries to allocate bootmem in memory_present(), so must be |
3230 |
+ * done after the fixed reservations. |
3231 |
+diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c |
3232 |
+index 62b0eb6cf69a..84eab0f5e00a 100644 |
3233 |
+--- a/arch/m68k/coldfire/pci.c |
3234 |
++++ b/arch/m68k/coldfire/pci.c |
3235 |
+@@ -216,8 +216,10 @@ static int __init mcf_pci_init(void) |
3236 |
+ |
3237 |
+ /* Keep a virtual mapping to IO/config space active */ |
3238 |
+ iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE); |
3239 |
+- if (iospace == 0) |
3240 |
++ if (iospace == 0) { |
3241 |
++ pci_free_host_bridge(bridge); |
3242 |
+ return -ENODEV; |
3243 |
++ } |
3244 |
+ pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n", |
3245 |
+ (u32) iospace); |
3246 |
+ |
3247 |
+diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S |
3248 |
+index e4a78571f883..c6481cfc5220 100644 |
3249 |
+--- a/arch/openrisc/kernel/entry.S |
3250 |
++++ b/arch/openrisc/kernel/entry.S |
3251 |
+@@ -1166,13 +1166,13 @@ ENTRY(__sys_clone) |
3252 |
+ l.movhi r29,hi(sys_clone) |
3253 |
+ l.ori r29,r29,lo(sys_clone) |
3254 |
+ l.j _fork_save_extra_regs_and_call |
3255 |
+- l.addi r7,r1,0 |
3256 |
++ l.nop |
3257 |
+ |
3258 |
+ ENTRY(__sys_fork) |
3259 |
+ l.movhi r29,hi(sys_fork) |
3260 |
+ l.ori r29,r29,lo(sys_fork) |
3261 |
+ l.j _fork_save_extra_regs_and_call |
3262 |
+- l.addi r3,r1,0 |
3263 |
++ l.nop |
3264 |
+ |
3265 |
+ ENTRY(sys_rt_sigreturn) |
3266 |
+ l.jal _sys_rt_sigreturn |
3267 |
+diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig |
3268 |
+index 62aca9efbbbe..310957b988e3 100644 |
3269 |
+--- a/arch/powerpc/Kconfig |
3270 |
++++ b/arch/powerpc/Kconfig |
3271 |
+@@ -773,6 +773,7 @@ config THREAD_SHIFT |
3272 |
+ range 13 15 |
3273 |
+ default "15" if PPC_256K_PAGES |
3274 |
+ default "14" if PPC64 |
3275 |
++ default "14" if KASAN |
3276 |
+ default "13" |
3277 |
+ help |
3278 |
+ Used to define the stack size. The default is almost always what you |
3279 |
+diff --git a/arch/powerpc/configs/adder875_defconfig b/arch/powerpc/configs/adder875_defconfig |
3280 |
+index f55e23cb176c..5326bc739279 100644 |
3281 |
+--- a/arch/powerpc/configs/adder875_defconfig |
3282 |
++++ b/arch/powerpc/configs/adder875_defconfig |
3283 |
+@@ -10,7 +10,6 @@ CONFIG_EXPERT=y |
3284 |
+ # CONFIG_BLK_DEV_BSG is not set |
3285 |
+ CONFIG_PARTITION_ADVANCED=y |
3286 |
+ CONFIG_PPC_ADDER875=y |
3287 |
+-CONFIG_8xx_COPYBACK=y |
3288 |
+ CONFIG_GEN_RTC=y |
3289 |
+ CONFIG_HZ_1000=y |
3290 |
+ # CONFIG_SECCOMP is not set |
3291 |
+diff --git a/arch/powerpc/configs/ep88xc_defconfig b/arch/powerpc/configs/ep88xc_defconfig |
3292 |
+index 0e2e5e81a359..f5c3e72da719 100644 |
3293 |
+--- a/arch/powerpc/configs/ep88xc_defconfig |
3294 |
++++ b/arch/powerpc/configs/ep88xc_defconfig |
3295 |
+@@ -12,7 +12,6 @@ CONFIG_EXPERT=y |
3296 |
+ # CONFIG_BLK_DEV_BSG is not set |
3297 |
+ CONFIG_PARTITION_ADVANCED=y |
3298 |
+ CONFIG_PPC_EP88XC=y |
3299 |
+-CONFIG_8xx_COPYBACK=y |
3300 |
+ CONFIG_GEN_RTC=y |
3301 |
+ CONFIG_HZ_100=y |
3302 |
+ # CONFIG_SECCOMP is not set |
3303 |
+diff --git a/arch/powerpc/configs/mpc866_ads_defconfig b/arch/powerpc/configs/mpc866_ads_defconfig |
3304 |
+index 5320735395e7..5c56d36cdfc5 100644 |
3305 |
+--- a/arch/powerpc/configs/mpc866_ads_defconfig |
3306 |
++++ b/arch/powerpc/configs/mpc866_ads_defconfig |
3307 |
+@@ -12,7 +12,6 @@ CONFIG_EXPERT=y |
3308 |
+ # CONFIG_BLK_DEV_BSG is not set |
3309 |
+ CONFIG_PARTITION_ADVANCED=y |
3310 |
+ CONFIG_MPC86XADS=y |
3311 |
+-CONFIG_8xx_COPYBACK=y |
3312 |
+ CONFIG_GEN_RTC=y |
3313 |
+ CONFIG_HZ_1000=y |
3314 |
+ CONFIG_MATH_EMULATION=y |
3315 |
+diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig |
3316 |
+index 82a008c04eae..949ff9ccda5e 100644 |
3317 |
+--- a/arch/powerpc/configs/mpc885_ads_defconfig |
3318 |
++++ b/arch/powerpc/configs/mpc885_ads_defconfig |
3319 |
+@@ -11,7 +11,6 @@ CONFIG_EXPERT=y |
3320 |
+ # CONFIG_VM_EVENT_COUNTERS is not set |
3321 |
+ # CONFIG_BLK_DEV_BSG is not set |
3322 |
+ CONFIG_PARTITION_ADVANCED=y |
3323 |
+-CONFIG_8xx_COPYBACK=y |
3324 |
+ CONFIG_GEN_RTC=y |
3325 |
+ CONFIG_HZ_100=y |
3326 |
+ # CONFIG_SECCOMP is not set |
3327 |
+diff --git a/arch/powerpc/configs/tqm8xx_defconfig b/arch/powerpc/configs/tqm8xx_defconfig |
3328 |
+index eda8bfb2d0a3..77857d513022 100644 |
3329 |
+--- a/arch/powerpc/configs/tqm8xx_defconfig |
3330 |
++++ b/arch/powerpc/configs/tqm8xx_defconfig |
3331 |
+@@ -15,7 +15,6 @@ CONFIG_MODULE_SRCVERSION_ALL=y |
3332 |
+ # CONFIG_BLK_DEV_BSG is not set |
3333 |
+ CONFIG_PARTITION_ADVANCED=y |
3334 |
+ CONFIG_TQM8XX=y |
3335 |
+-CONFIG_8xx_COPYBACK=y |
3336 |
+ # CONFIG_8xx_CPU15 is not set |
3337 |
+ CONFIG_GEN_RTC=y |
3338 |
+ CONFIG_HZ_100=y |
3339 |
+diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h |
3340 |
+index 3bcef989a35d..101d60f16d46 100644 |
3341 |
+--- a/arch/powerpc/include/asm/book3s/64/kup-radix.h |
3342 |
++++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h |
3343 |
+@@ -16,7 +16,9 @@ |
3344 |
+ #ifdef CONFIG_PPC_KUAP |
3345 |
+ BEGIN_MMU_FTR_SECTION_NESTED(67) |
3346 |
+ ld \gpr, STACK_REGS_KUAP(r1) |
3347 |
++ isync |
3348 |
+ mtspr SPRN_AMR, \gpr |
3349 |
++ /* No isync required, see kuap_restore_amr() */ |
3350 |
+ END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67) |
3351 |
+ #endif |
3352 |
+ .endm |
3353 |
+@@ -62,8 +64,15 @@ |
3354 |
+ |
3355 |
+ static inline void kuap_restore_amr(struct pt_regs *regs) |
3356 |
+ { |
3357 |
+- if (mmu_has_feature(MMU_FTR_RADIX_KUAP)) |
3358 |
++ if (mmu_has_feature(MMU_FTR_RADIX_KUAP)) { |
3359 |
++ isync(); |
3360 |
+ mtspr(SPRN_AMR, regs->kuap); |
3361 |
++ /* |
3362 |
++ * No isync required here because we are about to RFI back to |
3363 |
++ * previous context before any user accesses would be made, |
3364 |
++ * which is a CSI. |
3365 |
++ */ |
3366 |
++ } |
3367 |
+ } |
3368 |
+ |
3369 |
+ static inline void kuap_check_amr(void) |
3370 |
+diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h |
3371 |
+index 368b136517e0..2838b98bc6df 100644 |
3372 |
+--- a/arch/powerpc/include/asm/book3s/64/pgtable.h |
3373 |
++++ b/arch/powerpc/include/asm/book3s/64/pgtable.h |
3374 |
+@@ -998,10 +998,25 @@ extern struct page *pgd_page(pgd_t pgd); |
3375 |
+ #define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS) |
3376 |
+ #define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS) |
3377 |
+ |
3378 |
+-#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1)) |
3379 |
+-#define pud_index(address) (((address) >> (PUD_SHIFT)) & (PTRS_PER_PUD - 1)) |
3380 |
+-#define pmd_index(address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1)) |
3381 |
+-#define pte_index(address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1)) |
3382 |
++static inline unsigned long pgd_index(unsigned long address) |
3383 |
++{ |
3384 |
++ return (address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1); |
3385 |
++} |
3386 |
++ |
3387 |
++static inline unsigned long pud_index(unsigned long address) |
3388 |
++{ |
3389 |
++ return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1); |
3390 |
++} |
3391 |
++ |
3392 |
++static inline unsigned long pmd_index(unsigned long address) |
3393 |
++{ |
3394 |
++ return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); |
3395 |
++} |
3396 |
++ |
3397 |
++static inline unsigned long pte_index(unsigned long address) |
3398 |
++{ |
3399 |
++ return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); |
3400 |
++} |
3401 |
+ |
3402 |
+ /* |
3403 |
+ * Find an entry in a page-table-directory. We combine the address region |
3404 |
+diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h |
3405 |
+index 76af5b0cb16e..26b7cee34dfe 100644 |
3406 |
+--- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h |
3407 |
++++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h |
3408 |
+@@ -19,7 +19,6 @@ |
3409 |
+ #define MI_RSV4I 0x08000000 /* Reserve 4 TLB entries */ |
3410 |
+ #define MI_PPCS 0x02000000 /* Use MI_RPN prob/priv state */ |
3411 |
+ #define MI_IDXMASK 0x00001f00 /* TLB index to be loaded */ |
3412 |
+-#define MI_RESETVAL 0x00000000 /* Value of register at reset */ |
3413 |
+ |
3414 |
+ /* These are the Ks and Kp from the PowerPC books. For proper operation, |
3415 |
+ * Ks = 0, Kp = 1. |
3416 |
+@@ -95,7 +94,6 @@ |
3417 |
+ #define MD_TWAM 0x04000000 /* Use 4K page hardware assist */ |
3418 |
+ #define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */ |
3419 |
+ #define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */ |
3420 |
+-#define MD_RESETVAL 0x04000000 /* Value of register at reset */ |
3421 |
+ |
3422 |
+ #define SPRN_M_CASID 793 /* Address space ID (context) to match */ |
3423 |
+ #define MC_ASIDMASK 0x0000000f /* Bits used for ASID value */ |
3424 |
+diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h |
3425 |
+index eedcbfb9a6ff..c220cb9eccad 100644 |
3426 |
+--- a/arch/powerpc/include/asm/processor.h |
3427 |
++++ b/arch/powerpc/include/asm/processor.h |
3428 |
+@@ -301,7 +301,6 @@ struct thread_struct { |
3429 |
+ #else |
3430 |
+ #define INIT_THREAD { \ |
3431 |
+ .ksp = INIT_SP, \ |
3432 |
+- .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \ |
3433 |
+ .addr_limit = KERNEL_DS, \ |
3434 |
+ .fpexc_mode = 0, \ |
3435 |
+ .fscr = FSCR_TAR | FSCR_EBB \ |
3436 |
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S |
3437 |
+index ebeebab74b56..d9ddce40bed8 100644 |
3438 |
+--- a/arch/powerpc/kernel/exceptions-64s.S |
3439 |
++++ b/arch/powerpc/kernel/exceptions-64s.S |
3440 |
+@@ -270,7 +270,7 @@ BEGIN_FTR_SECTION |
3441 |
+ END_FTR_SECTION_IFSET(CPU_FTR_CFAR) |
3442 |
+ .endif |
3443 |
+ |
3444 |
+- ld r10,PACA_EXGEN+EX_CTR(r13) |
3445 |
++ ld r10,IAREA+EX_CTR(r13) |
3446 |
+ mtctr r10 |
3447 |
+ BEGIN_FTR_SECTION |
3448 |
+ ld r10,IAREA+EX_PPR(r13) |
3449 |
+@@ -298,7 +298,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) |
3450 |
+ |
3451 |
+ .if IKVM_SKIP |
3452 |
+ 89: mtocrf 0x80,r9 |
3453 |
+- ld r10,PACA_EXGEN+EX_CTR(r13) |
3454 |
++ ld r10,IAREA+EX_CTR(r13) |
3455 |
+ mtctr r10 |
3456 |
+ ld r9,IAREA+EX_R9(r13) |
3457 |
+ ld r10,IAREA+EX_R10(r13) |
3458 |
+@@ -1117,11 +1117,30 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) |
3459 |
+ li r10,MSR_RI |
3460 |
+ mtmsrd r10,1 |
3461 |
+ |
3462 |
++ /* |
3463 |
++ * Set IRQS_ALL_DISABLED and save PACAIRQHAPPENED (see |
3464 |
++ * system_reset_common) |
3465 |
++ */ |
3466 |
++ li r10,IRQS_ALL_DISABLED |
3467 |
++ stb r10,PACAIRQSOFTMASK(r13) |
3468 |
++ lbz r10,PACAIRQHAPPENED(r13) |
3469 |
++ std r10,RESULT(r1) |
3470 |
++ ori r10,r10,PACA_IRQ_HARD_DIS |
3471 |
++ stb r10,PACAIRQHAPPENED(r13) |
3472 |
++ |
3473 |
+ addi r3,r1,STACK_FRAME_OVERHEAD |
3474 |
+ bl machine_check_early |
3475 |
+ std r3,RESULT(r1) /* Save result */ |
3476 |
+ ld r12,_MSR(r1) |
3477 |
+ |
3478 |
++ /* |
3479 |
++ * Restore soft mask settings. |
3480 |
++ */ |
3481 |
++ ld r10,RESULT(r1) |
3482 |
++ stb r10,PACAIRQHAPPENED(r13) |
3483 |
++ ld r10,SOFTE(r1) |
3484 |
++ stb r10,PACAIRQSOFTMASK(r13) |
3485 |
++ |
3486 |
+ #ifdef CONFIG_PPC_P7_NAP |
3487 |
+ /* |
3488 |
+ * Check if thread was in power saving mode. We come here when any |
3489 |
+@@ -1225,17 +1244,19 @@ EXC_COMMON_BEGIN(machine_check_idle_common) |
3490 |
+ bl machine_check_queue_event |
3491 |
+ |
3492 |
+ /* |
3493 |
+- * We have not used any non-volatile GPRs here, and as a rule |
3494 |
+- * most exception code including machine check does not. |
3495 |
+- * Therefore PACA_NAPSTATELOST does not need to be set. Idle |
3496 |
+- * wakeup will restore volatile registers. |
3497 |
++ * GPR-loss wakeups are relatively straightforward, because the |
3498 |
++ * idle sleep code has saved all non-volatile registers on its |
3499 |
++ * own stack, and r1 in PACAR1. |
3500 |
+ * |
3501 |
+- * Load the original SRR1 into r3 for pnv_powersave_wakeup_mce. |
3502 |
++ * For no-loss wakeups the r1 and lr registers used by the |
3503 |
++ * early machine check handler have to be restored first. r2 is |
3504 |
++ * the kernel TOC, so no need to restore it. |
3505 |
+ * |
3506 |
+ * Then decrement MCE nesting after finishing with the stack. |
3507 |
+ */ |
3508 |
+ ld r3,_MSR(r1) |
3509 |
+ ld r4,_LINK(r1) |
3510 |
++ ld r1,GPR1(r1) |
3511 |
+ |
3512 |
+ lhz r11,PACA_IN_MCE(r13) |
3513 |
+ subi r11,r11,1 |
3514 |
+@@ -1244,7 +1265,7 @@ EXC_COMMON_BEGIN(machine_check_idle_common) |
3515 |
+ mtlr r4 |
3516 |
+ rlwinm r10,r3,47-31,30,31 |
3517 |
+ cmpwi cr1,r10,2 |
3518 |
+- bltlr cr1 /* no state loss, return to idle caller */ |
3519 |
++ bltlr cr1 /* no state loss, return to idle caller with r3=SRR1 */ |
3520 |
+ b idle_return_gpr_loss |
3521 |
+ #endif |
3522 |
+ |
3523 |
+diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
3524 |
+index ddfbd02140d9..0e05a9a47a4b 100644 |
3525 |
+--- a/arch/powerpc/kernel/head_64.S |
3526 |
++++ b/arch/powerpc/kernel/head_64.S |
3527 |
+@@ -947,15 +947,8 @@ start_here_multiplatform: |
3528 |
+ std r0,0(r4) |
3529 |
+ #endif |
3530 |
+ |
3531 |
+- /* The following gets the stack set up with the regs */ |
3532 |
+- /* pointing to the real addr of the kernel stack. This is */ |
3533 |
+- /* all done to support the C function call below which sets */ |
3534 |
+- /* up the htab. This is done because we have relocated the */ |
3535 |
+- /* kernel but are still running in real mode. */ |
3536 |
+- |
3537 |
+- LOAD_REG_ADDR(r3,init_thread_union) |
3538 |
+- |
3539 |
+ /* set up a stack pointer */ |
3540 |
++ LOAD_REG_ADDR(r3,init_thread_union) |
3541 |
+ LOAD_REG_IMMEDIATE(r1,THREAD_SIZE) |
3542 |
+ add r1,r3,r1 |
3543 |
+ li r0,0 |
3544 |
+diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S |
3545 |
+index 073a651787df..905205c79a25 100644 |
3546 |
+--- a/arch/powerpc/kernel/head_8xx.S |
3547 |
++++ b/arch/powerpc/kernel/head_8xx.S |
3548 |
+@@ -779,10 +779,7 @@ start_here: |
3549 |
+ initial_mmu: |
3550 |
+ li r8, 0 |
3551 |
+ mtspr SPRN_MI_CTR, r8 /* remove PINNED ITLB entries */ |
3552 |
+- lis r10, MD_RESETVAL@h |
3553 |
+-#ifndef CONFIG_8xx_COPYBACK |
3554 |
+- oris r10, r10, MD_WTDEF@h |
3555 |
+-#endif |
3556 |
++ lis r10, MD_TWAM@h |
3557 |
+ mtspr SPRN_MD_CTR, r10 /* remove PINNED DTLB entries */ |
3558 |
+ |
3559 |
+ tlbia /* Invalidate all TLB entries */ |
3560 |
+@@ -857,17 +854,7 @@ initial_mmu: |
3561 |
+ mtspr SPRN_DC_CST, r8 |
3562 |
+ lis r8, IDC_ENABLE@h |
3563 |
+ mtspr SPRN_IC_CST, r8 |
3564 |
+-#ifdef CONFIG_8xx_COPYBACK |
3565 |
+- mtspr SPRN_DC_CST, r8 |
3566 |
+-#else |
3567 |
+- /* For a debug option, I left this here to easily enable |
3568 |
+- * the write through cache mode |
3569 |
+- */ |
3570 |
+- lis r8, DC_SFWT@h |
3571 |
+ mtspr SPRN_DC_CST, r8 |
3572 |
+- lis r8, IDC_ENABLE@h |
3573 |
+- mtspr SPRN_DC_CST, r8 |
3574 |
+-#endif |
3575 |
+ /* Disable debug mode entry on breakpoints */ |
3576 |
+ mfspr r8, SPRN_DER |
3577 |
+ #ifdef CONFIG_PERF_EVENTS |
3578 |
+diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
3579 |
+index 9c21288f8645..774476be591b 100644 |
3580 |
+--- a/arch/powerpc/kernel/process.c |
3581 |
++++ b/arch/powerpc/kernel/process.c |
3582 |
+@@ -1241,29 +1241,31 @@ struct task_struct *__switch_to(struct task_struct *prev, |
3583 |
+ static void show_instructions(struct pt_regs *regs) |
3584 |
+ { |
3585 |
+ int i; |
3586 |
++ unsigned long nip = regs->nip; |
3587 |
+ unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); |
3588 |
+ |
3589 |
+ printk("Instruction dump:"); |
3590 |
+ |
3591 |
++ /* |
3592 |
++ * If we were executing with the MMU off for instructions, adjust pc |
3593 |
++ * rather than printing XXXXXXXX. |
3594 |
++ */ |
3595 |
++ if (!IS_ENABLED(CONFIG_BOOKE) && !(regs->msr & MSR_IR)) { |
3596 |
++ pc = (unsigned long)phys_to_virt(pc); |
3597 |
++ nip = (unsigned long)phys_to_virt(regs->nip); |
3598 |
++ } |
3599 |
++ |
3600 |
+ for (i = 0; i < NR_INSN_TO_PRINT; i++) { |
3601 |
+ int instr; |
3602 |
+ |
3603 |
+ if (!(i % 8)) |
3604 |
+ pr_cont("\n"); |
3605 |
+ |
3606 |
+-#if !defined(CONFIG_BOOKE) |
3607 |
+- /* If executing with the IMMU off, adjust pc rather |
3608 |
+- * than print XXXXXXXX. |
3609 |
+- */ |
3610 |
+- if (!(regs->msr & MSR_IR)) |
3611 |
+- pc = (unsigned long)phys_to_virt(pc); |
3612 |
+-#endif |
3613 |
+- |
3614 |
+ if (!__kernel_text_address(pc) || |
3615 |
+ probe_kernel_address((const void *)pc, instr)) { |
3616 |
+ pr_cont("XXXXXXXX "); |
3617 |
+ } else { |
3618 |
+- if (regs->nip == pc) |
3619 |
++ if (nip == pc) |
3620 |
+ pr_cont("<%08x> ", instr); |
3621 |
+ else |
3622 |
+ pr_cont("%08x ", instr); |
3623 |
+diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c |
3624 |
+index 078fe3d76feb..56da5eb2b923 100644 |
3625 |
+--- a/arch/powerpc/kexec/core.c |
3626 |
++++ b/arch/powerpc/kexec/core.c |
3627 |
+@@ -115,11 +115,12 @@ void machine_kexec(struct kimage *image) |
3628 |
+ |
3629 |
+ void __init reserve_crashkernel(void) |
3630 |
+ { |
3631 |
+- unsigned long long crash_size, crash_base; |
3632 |
++ unsigned long long crash_size, crash_base, total_mem_sz; |
3633 |
+ int ret; |
3634 |
+ |
3635 |
++ total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size(); |
3636 |
+ /* use common parsing */ |
3637 |
+- ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), |
3638 |
++ ret = parse_crashkernel(boot_command_line, total_mem_sz, |
3639 |
+ &crash_size, &crash_base); |
3640 |
+ if (ret == 0 && crash_size > 0) { |
3641 |
+ crashk_res.start = crash_base; |
3642 |
+@@ -178,6 +179,7 @@ void __init reserve_crashkernel(void) |
3643 |
+ /* Crash kernel trumps memory limit */ |
3644 |
+ if (memory_limit && memory_limit <= crashk_res.end) { |
3645 |
+ memory_limit = crashk_res.end + 1; |
3646 |
++ total_mem_sz = memory_limit; |
3647 |
+ printk("Adjusted memory limit for crashkernel, now 0x%llx\n", |
3648 |
+ memory_limit); |
3649 |
+ } |
3650 |
+@@ -186,7 +188,7 @@ void __init reserve_crashkernel(void) |
3651 |
+ "for crashkernel (System RAM: %ldMB)\n", |
3652 |
+ (unsigned long)(crash_size >> 20), |
3653 |
+ (unsigned long)(crashk_res.start >> 20), |
3654 |
+- (unsigned long)(memblock_phys_mem_size() >> 20)); |
3655 |
++ (unsigned long)(total_mem_sz >> 20)); |
3656 |
+ |
3657 |
+ if (!memblock_is_region_memory(crashk_res.start, crash_size) || |
3658 |
+ memblock_reserve(crashk_res.start, crash_size)) { |
3659 |
+diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
3660 |
+index aa12cd4078b3..bc6c1aa3d0e9 100644 |
3661 |
+--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c |
3662 |
++++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
3663 |
+@@ -353,7 +353,13 @@ static struct kmem_cache *kvm_pmd_cache; |
3664 |
+ |
3665 |
+ static pte_t *kvmppc_pte_alloc(void) |
3666 |
+ { |
3667 |
+- return kmem_cache_alloc(kvm_pte_cache, GFP_KERNEL); |
3668 |
++ pte_t *pte; |
3669 |
++ |
3670 |
++ pte = kmem_cache_alloc(kvm_pte_cache, GFP_KERNEL); |
3671 |
++ /* pmd_populate() will only reference _pa(pte). */ |
3672 |
++ kmemleak_ignore(pte); |
3673 |
++ |
3674 |
++ return pte; |
3675 |
+ } |
3676 |
+ |
3677 |
+ static void kvmppc_pte_free(pte_t *ptep) |
3678 |
+@@ -363,7 +369,13 @@ static void kvmppc_pte_free(pte_t *ptep) |
3679 |
+ |
3680 |
+ static pmd_t *kvmppc_pmd_alloc(void) |
3681 |
+ { |
3682 |
+- return kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); |
3683 |
++ pmd_t *pmd; |
3684 |
++ |
3685 |
++ pmd = kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); |
3686 |
++ /* pud_populate() will only reference _pa(pmd). */ |
3687 |
++ kmemleak_ignore(pmd); |
3688 |
++ |
3689 |
++ return pmd; |
3690 |
+ } |
3691 |
+ |
3692 |
+ static void kvmppc_pmd_free(pmd_t *pmdp) |
3693 |
+diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c |
3694 |
+index 50555ad1db93..1a529df0ab44 100644 |
3695 |
+--- a/arch/powerpc/kvm/book3s_64_vio.c |
3696 |
++++ b/arch/powerpc/kvm/book3s_64_vio.c |
3697 |
+@@ -73,6 +73,7 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
3698 |
+ struct kvmppc_spapr_tce_iommu_table *stit, *tmp; |
3699 |
+ struct iommu_table_group *table_group = NULL; |
3700 |
+ |
3701 |
++ rcu_read_lock(); |
3702 |
+ list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) { |
3703 |
+ |
3704 |
+ table_group = iommu_group_get_iommudata(grp); |
3705 |
+@@ -87,7 +88,9 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
3706 |
+ kref_put(&stit->kref, kvm_spapr_tce_liobn_put); |
3707 |
+ } |
3708 |
+ } |
3709 |
++ cond_resched_rcu(); |
3710 |
+ } |
3711 |
++ rcu_read_unlock(); |
3712 |
+ } |
3713 |
+ |
3714 |
+ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3715 |
+@@ -105,12 +108,14 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3716 |
+ if (!f.file) |
3717 |
+ return -EBADF; |
3718 |
+ |
3719 |
++ rcu_read_lock(); |
3720 |
+ list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) { |
3721 |
+ if (stt == f.file->private_data) { |
3722 |
+ found = true; |
3723 |
+ break; |
3724 |
+ } |
3725 |
+ } |
3726 |
++ rcu_read_unlock(); |
3727 |
+ |
3728 |
+ fdput(f); |
3729 |
+ |
3730 |
+@@ -143,6 +148,7 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3731 |
+ if (!tbl) |
3732 |
+ return -EINVAL; |
3733 |
+ |
3734 |
++ rcu_read_lock(); |
3735 |
+ list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { |
3736 |
+ if (tbl != stit->tbl) |
3737 |
+ continue; |
3738 |
+@@ -150,14 +156,17 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3739 |
+ if (!kref_get_unless_zero(&stit->kref)) { |
3740 |
+ /* stit is being destroyed */ |
3741 |
+ iommu_tce_table_put(tbl); |
3742 |
++ rcu_read_unlock(); |
3743 |
+ return -ENOTTY; |
3744 |
+ } |
3745 |
+ /* |
3746 |
+ * The table is already known to this KVM, we just increased |
3747 |
+ * its KVM reference counter and can return. |
3748 |
+ */ |
3749 |
++ rcu_read_unlock(); |
3750 |
+ return 0; |
3751 |
+ } |
3752 |
++ rcu_read_unlock(); |
3753 |
+ |
3754 |
+ stit = kzalloc(sizeof(*stit), GFP_KERNEL); |
3755 |
+ if (!stit) { |
3756 |
+@@ -365,18 +374,19 @@ static long kvmppc_tce_validate(struct kvmppc_spapr_tce_table *stt, |
3757 |
+ if (kvmppc_tce_to_ua(stt->kvm, tce, &ua)) |
3758 |
+ return H_TOO_HARD; |
3759 |
+ |
3760 |
++ rcu_read_lock(); |
3761 |
+ list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { |
3762 |
+ unsigned long hpa = 0; |
3763 |
+ struct mm_iommu_table_group_mem_t *mem; |
3764 |
+ long shift = stit->tbl->it_page_shift; |
3765 |
+ |
3766 |
+ mem = mm_iommu_lookup(stt->kvm->mm, ua, 1ULL << shift); |
3767 |
+- if (!mem) |
3768 |
+- return H_TOO_HARD; |
3769 |
+- |
3770 |
+- if (mm_iommu_ua_to_hpa(mem, ua, shift, &hpa)) |
3771 |
++ if (!mem || mm_iommu_ua_to_hpa(mem, ua, shift, &hpa)) { |
3772 |
++ rcu_read_unlock(); |
3773 |
+ return H_TOO_HARD; |
3774 |
++ } |
3775 |
+ } |
3776 |
++ rcu_read_unlock(); |
3777 |
+ |
3778 |
+ return H_SUCCESS; |
3779 |
+ } |
3780 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
3781 |
+index 93493f0cbfe8..ee581cde4878 100644 |
3782 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
3783 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
3784 |
+@@ -1099,9 +1099,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) |
3785 |
+ ret = kvmppc_h_svm_init_done(vcpu->kvm); |
3786 |
+ break; |
3787 |
+ case H_SVM_INIT_ABORT: |
3788 |
+- ret = H_UNSUPPORTED; |
3789 |
+- if (kvmppc_get_srr1(vcpu) & MSR_S) |
3790 |
+- ret = kvmppc_h_svm_init_abort(vcpu->kvm); |
3791 |
++ /* |
3792 |
++ * Even if that call is made by the Ultravisor, the SSR1 value |
3793 |
++ * is the guest context one, with the secure bit clear as it has |
3794 |
++ * not yet been secured. So we can't check it here. |
3795 |
++ * Instead the kvm->arch.secure_guest flag is checked inside |
3796 |
++ * kvmppc_h_svm_init_abort(). |
3797 |
++ */ |
3798 |
++ ret = kvmppc_h_svm_init_abort(vcpu->kvm); |
3799 |
+ break; |
3800 |
+ |
3801 |
+ default: |
3802 |
+diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c |
3803 |
+index 39ba53ca5bb5..a9b2cbc74797 100644 |
3804 |
+--- a/arch/powerpc/mm/book3s32/mmu.c |
3805 |
++++ b/arch/powerpc/mm/book3s32/mmu.c |
3806 |
+@@ -187,6 +187,7 @@ void mmu_mark_initmem_nx(void) |
3807 |
+ int i; |
3808 |
+ unsigned long base = (unsigned long)_stext - PAGE_OFFSET; |
3809 |
+ unsigned long top = (unsigned long)_etext - PAGE_OFFSET; |
3810 |
++ unsigned long border = (unsigned long)__init_begin - PAGE_OFFSET; |
3811 |
+ unsigned long size; |
3812 |
+ |
3813 |
+ if (IS_ENABLED(CONFIG_PPC_BOOK3S_601)) |
3814 |
+@@ -201,9 +202,10 @@ void mmu_mark_initmem_nx(void) |
3815 |
+ size = block_size(base, top); |
3816 |
+ size = max(size, 128UL << 10); |
3817 |
+ if ((top - base) > size) { |
3818 |
+- if (strict_kernel_rwx_enabled()) |
3819 |
+- pr_warn("Kernel _etext not properly aligned\n"); |
3820 |
+ size <<= 1; |
3821 |
++ if (strict_kernel_rwx_enabled() && base + size > border) |
3822 |
++ pr_warn("Some RW data is getting mapped X. " |
3823 |
++ "Adjust CONFIG_DATA_SHIFT to avoid that.\n"); |
3824 |
+ } |
3825 |
+ setibat(i++, PAGE_OFFSET + base, base, size, PAGE_KERNEL_TEXT); |
3826 |
+ base += size; |
3827 |
+diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c |
3828 |
+index 758ade2c2b6e..b5cc9b23cf02 100644 |
3829 |
+--- a/arch/powerpc/mm/book3s64/radix_tlb.c |
3830 |
++++ b/arch/powerpc/mm/book3s64/radix_tlb.c |
3831 |
+@@ -884,9 +884,7 @@ is_local: |
3832 |
+ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { |
3833 |
+ hstart = (start + PMD_SIZE - 1) & PMD_MASK; |
3834 |
+ hend = end & PMD_MASK; |
3835 |
+- if (hstart == hend) |
3836 |
+- hflush = false; |
3837 |
+- else |
3838 |
++ if (hstart < hend) |
3839 |
+ hflush = true; |
3840 |
+ } |
3841 |
+ |
3842 |
+diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c |
3843 |
+index 59e49c0e8154..b7c287adfd59 100644 |
3844 |
+--- a/arch/powerpc/mm/kasan/kasan_init_32.c |
3845 |
++++ b/arch/powerpc/mm/kasan/kasan_init_32.c |
3846 |
+@@ -76,15 +76,14 @@ static int __init kasan_init_region(void *start, size_t size) |
3847 |
+ return ret; |
3848 |
+ |
3849 |
+ block = memblock_alloc(k_end - k_start, PAGE_SIZE); |
3850 |
++ if (!block) |
3851 |
++ return -ENOMEM; |
3852 |
+ |
3853 |
+ for (k_cur = k_start & PAGE_MASK; k_cur < k_end; k_cur += PAGE_SIZE) { |
3854 |
+ pmd_t *pmd = pmd_ptr_k(k_cur); |
3855 |
+ void *va = block + k_cur - k_start; |
3856 |
+ pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL); |
3857 |
+ |
3858 |
+- if (!va) |
3859 |
+- return -ENOMEM; |
3860 |
+- |
3861 |
+ __set_pte_at(&init_mm, k_cur, pte_offset_kernel(pmd, k_cur), pte, 0); |
3862 |
+ } |
3863 |
+ flush_tlb_kernel_range(k_start, k_end); |
3864 |
+diff --git a/arch/powerpc/mm/ptdump/shared.c b/arch/powerpc/mm/ptdump/shared.c |
3865 |
+index f7ed2f187cb0..784f8df17f73 100644 |
3866 |
+--- a/arch/powerpc/mm/ptdump/shared.c |
3867 |
++++ b/arch/powerpc/mm/ptdump/shared.c |
3868 |
+@@ -30,6 +30,11 @@ static const struct flag_info flag_array[] = { |
3869 |
+ .val = _PAGE_PRESENT, |
3870 |
+ .set = "present", |
3871 |
+ .clear = " ", |
3872 |
++ }, { |
3873 |
++ .mask = _PAGE_COHERENT, |
3874 |
++ .val = _PAGE_COHERENT, |
3875 |
++ .set = "coherent", |
3876 |
++ .clear = " ", |
3877 |
+ }, { |
3878 |
+ .mask = _PAGE_GUARDED, |
3879 |
+ .val = _PAGE_GUARDED, |
3880 |
+diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c |
3881 |
+index 573e0b309c0c..48e8f4b17b91 100644 |
3882 |
+--- a/arch/powerpc/perf/hv-24x7.c |
3883 |
++++ b/arch/powerpc/perf/hv-24x7.c |
3884 |
+@@ -1400,16 +1400,6 @@ static void h_24x7_event_read(struct perf_event *event) |
3885 |
+ h24x7hw = &get_cpu_var(hv_24x7_hw); |
3886 |
+ h24x7hw->events[i] = event; |
3887 |
+ put_cpu_var(h24x7hw); |
3888 |
+- /* |
3889 |
+- * Clear the event count so we can compute the _change_ |
3890 |
+- * in the 24x7 raw counter value at the end of the txn. |
3891 |
+- * |
3892 |
+- * Note that we could alternatively read the 24x7 value |
3893 |
+- * now and save its value in event->hw.prev_count. But |
3894 |
+- * that would require issuing a hcall, which would then |
3895 |
+- * defeat the purpose of using the txn interface. |
3896 |
+- */ |
3897 |
+- local64_set(&event->count, 0); |
3898 |
+ } |
3899 |
+ |
3900 |
+ put_cpu_var(hv_24x7_reqb); |
3901 |
+diff --git a/arch/powerpc/platforms/4xx/pci.c b/arch/powerpc/platforms/4xx/pci.c |
3902 |
+index e6e2adcc7b64..c13d64c3b019 100644 |
3903 |
+--- a/arch/powerpc/platforms/4xx/pci.c |
3904 |
++++ b/arch/powerpc/platforms/4xx/pci.c |
3905 |
+@@ -1242,7 +1242,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) |
3906 |
+ if (mbase == NULL) { |
3907 |
+ printk(KERN_ERR "%pOF: Can't map internal config space !", |
3908 |
+ port->node); |
3909 |
+- goto done; |
3910 |
++ return; |
3911 |
+ } |
3912 |
+ |
3913 |
+ while (attempt && (0 == (in_le32(mbase + PECFG_460SX_DLLSTA) |
3914 |
+@@ -1252,9 +1252,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) |
3915 |
+ } |
3916 |
+ if (attempt) |
3917 |
+ port->link = 1; |
3918 |
+-done: |
3919 |
+ iounmap(mbase); |
3920 |
+- |
3921 |
+ } |
3922 |
+ |
3923 |
+ static struct ppc4xx_pciex_hwops ppc460sx_pcie_hwops __initdata = { |
3924 |
+diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig |
3925 |
+index e0fe670f06f6..b37de62d7e7f 100644 |
3926 |
+--- a/arch/powerpc/platforms/8xx/Kconfig |
3927 |
++++ b/arch/powerpc/platforms/8xx/Kconfig |
3928 |
+@@ -98,15 +98,6 @@ menu "MPC8xx CPM Options" |
3929 |
+ # 8xx specific questions. |
3930 |
+ comment "Generic MPC8xx Options" |
3931 |
+ |
3932 |
+-config 8xx_COPYBACK |
3933 |
+- bool "Copy-Back Data Cache (else Writethrough)" |
3934 |
+- help |
3935 |
+- Saying Y here will cause the cache on an MPC8xx processor to be used |
3936 |
+- in Copy-Back mode. If you say N here, it is used in Writethrough |
3937 |
+- mode. |
3938 |
+- |
3939 |
+- If in doubt, say Y here. |
3940 |
+- |
3941 |
+ config 8xx_GPIO |
3942 |
+ bool "GPIO API Support" |
3943 |
+ select GPIOLIB |
3944 |
+diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c |
3945 |
+index 2b3dfd0b6cdd..d95954ad4c0a 100644 |
3946 |
+--- a/arch/powerpc/platforms/powernv/opal.c |
3947 |
++++ b/arch/powerpc/platforms/powernv/opal.c |
3948 |
+@@ -811,6 +811,10 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name, |
3949 |
+ goto out; |
3950 |
+ |
3951 |
+ attr = kzalloc(sizeof(*attr), GFP_KERNEL); |
3952 |
++ if (!attr) { |
3953 |
++ rc = -ENOMEM; |
3954 |
++ goto out; |
3955 |
++ } |
3956 |
+ name = kstrdup(export_name, GFP_KERNEL); |
3957 |
+ if (!name) { |
3958 |
+ rc = -ENOMEM; |
3959 |
+diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c |
3960 |
+index 423be34f0f5f..f42fe4e86ce5 100644 |
3961 |
+--- a/arch/powerpc/platforms/ps3/mm.c |
3962 |
++++ b/arch/powerpc/platforms/ps3/mm.c |
3963 |
+@@ -200,13 +200,14 @@ void ps3_mm_vas_destroy(void) |
3964 |
+ { |
3965 |
+ int result; |
3966 |
+ |
3967 |
+- DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id); |
3968 |
+- |
3969 |
+ if (map.vas_id) { |
3970 |
+ result = lv1_select_virtual_address_space(0); |
3971 |
+- BUG_ON(result); |
3972 |
+- result = lv1_destruct_virtual_address_space(map.vas_id); |
3973 |
+- BUG_ON(result); |
3974 |
++ result += lv1_destruct_virtual_address_space(map.vas_id); |
3975 |
++ |
3976 |
++ if (result) { |
3977 |
++ lv1_panic(0); |
3978 |
++ } |
3979 |
++ |
3980 |
+ map.vas_id = 0; |
3981 |
+ } |
3982 |
+ } |
3983 |
+@@ -304,19 +305,20 @@ static void ps3_mm_region_destroy(struct mem_region *r) |
3984 |
+ int result; |
3985 |
+ |
3986 |
+ if (!r->destroy) { |
3987 |
+- pr_info("%s:%d: Not destroying high region: %llxh %llxh\n", |
3988 |
+- __func__, __LINE__, r->base, r->size); |
3989 |
+ return; |
3990 |
+ } |
3991 |
+ |
3992 |
+- DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base); |
3993 |
+- |
3994 |
+ if (r->base) { |
3995 |
+ result = lv1_release_memory(r->base); |
3996 |
+- BUG_ON(result); |
3997 |
++ |
3998 |
++ if (result) { |
3999 |
++ lv1_panic(0); |
4000 |
++ } |
4001 |
++ |
4002 |
+ r->size = r->base = r->offset = 0; |
4003 |
+ map.total = map.rm.size; |
4004 |
+ } |
4005 |
++ |
4006 |
+ ps3_mm_set_repository_highmem(NULL); |
4007 |
+ } |
4008 |
+ |
4009 |
+diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c |
4010 |
+index 1d1da639b8b7..16ba5c542e55 100644 |
4011 |
+--- a/arch/powerpc/platforms/pseries/ras.c |
4012 |
++++ b/arch/powerpc/platforms/pseries/ras.c |
4013 |
+@@ -395,10 +395,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id) |
4014 |
+ /* |
4015 |
+ * Some versions of FWNMI place the buffer inside the 4kB page starting at |
4016 |
+ * 0x7000. Other versions place it inside the rtas buffer. We check both. |
4017 |
++ * Minimum size of the buffer is 16 bytes. |
4018 |
+ */ |
4019 |
+ #define VALID_FWNMI_BUFFER(A) \ |
4020 |
+- ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ |
4021 |
+- (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) |
4022 |
++ ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ |
4023 |
++ (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16)))) |
4024 |
+ |
4025 |
+ static inline struct rtas_error_log *fwnmi_get_errlog(void) |
4026 |
+ { |
4027 |
+diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig |
4028 |
+index 2167bce993ff..ae01be202204 100644 |
4029 |
+--- a/arch/s390/Kconfig |
4030 |
++++ b/arch/s390/Kconfig |
4031 |
+@@ -462,6 +462,7 @@ config NUMA |
4032 |
+ |
4033 |
+ config NODES_SHIFT |
4034 |
+ int |
4035 |
++ depends on NEED_MULTIPLE_NODES |
4036 |
+ default "1" |
4037 |
+ |
4038 |
+ config SCHED_SMT |
4039 |
+diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h |
4040 |
+index f073292e9fdb..d9d5de0f67ff 100644 |
4041 |
+--- a/arch/s390/include/asm/syscall.h |
4042 |
++++ b/arch/s390/include/asm/syscall.h |
4043 |
+@@ -33,7 +33,17 @@ static inline void syscall_rollback(struct task_struct *task, |
4044 |
+ static inline long syscall_get_error(struct task_struct *task, |
4045 |
+ struct pt_regs *regs) |
4046 |
+ { |
4047 |
+- return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0; |
4048 |
++ unsigned long error = regs->gprs[2]; |
4049 |
++#ifdef CONFIG_COMPAT |
4050 |
++ if (test_tsk_thread_flag(task, TIF_31BIT)) { |
4051 |
++ /* |
4052 |
++ * Sign-extend the value so (int)-EFOO becomes (long)-EFOO |
4053 |
++ * and will match correctly in comparisons. |
4054 |
++ */ |
4055 |
++ error = (long)(int)error; |
4056 |
++ } |
4057 |
++#endif |
4058 |
++ return IS_ERR_VALUE(error) ? error : 0; |
4059 |
+ } |
4060 |
+ |
4061 |
+ static inline long syscall_get_return_value(struct task_struct *task, |
4062 |
+diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h |
4063 |
+index 39c9ead489e5..b42228906eaf 100644 |
4064 |
+--- a/arch/sh/include/asm/io.h |
4065 |
++++ b/arch/sh/include/asm/io.h |
4066 |
+@@ -328,7 +328,7 @@ __ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot) |
4067 |
+ #else |
4068 |
+ #define __ioremap(offset, size, prot) ((void __iomem *)(offset)) |
4069 |
+ #define __ioremap_mode(offset, size, prot) ((void __iomem *)(offset)) |
4070 |
+-#define iounmap(addr) do { } while (0) |
4071 |
++static inline void iounmap(void __iomem *addr) {} |
4072 |
+ #endif /* CONFIG_MMU */ |
4073 |
+ |
4074 |
+ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) |
4075 |
+diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c |
4076 |
+index a8c2f2615fc6..ecc9e8786d57 100644 |
4077 |
+--- a/arch/sparc/mm/srmmu.c |
4078 |
++++ b/arch/sparc/mm/srmmu.c |
4079 |
+@@ -383,7 +383,6 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) |
4080 |
+ return NULL; |
4081 |
+ page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); |
4082 |
+ if (!pgtable_pte_page_ctor(page)) { |
4083 |
+- __free_page(page); |
4084 |
+ return NULL; |
4085 |
+ } |
4086 |
+ return page; |
4087 |
+diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile |
4088 |
+index a290821e355c..2a249f619467 100644 |
4089 |
+--- a/arch/um/drivers/Makefile |
4090 |
++++ b/arch/um/drivers/Makefile |
4091 |
+@@ -18,9 +18,9 @@ ubd-objs := ubd_kern.o ubd_user.o |
4092 |
+ port-objs := port_kern.o port_user.o |
4093 |
+ harddog-objs := harddog_kern.o harddog_user.o |
4094 |
+ |
4095 |
+-LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) |
4096 |
++LDFLAGS_pcap.o = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) |
4097 |
+ |
4098 |
+-LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) |
4099 |
++LDFLAGS_vde.o = $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) |
4100 |
+ |
4101 |
+ targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o |
4102 |
+ |
4103 |
+diff --git a/arch/unicore32/lib/Makefile b/arch/unicore32/lib/Makefile |
4104 |
+index 098981a01841..5af06645b8f0 100644 |
4105 |
+--- a/arch/unicore32/lib/Makefile |
4106 |
++++ b/arch/unicore32/lib/Makefile |
4107 |
+@@ -10,12 +10,12 @@ lib-y += strncpy_from_user.o strnlen_user.o |
4108 |
+ lib-y += clear_user.o copy_page.o |
4109 |
+ lib-y += copy_from_user.o copy_to_user.o |
4110 |
+ |
4111 |
+-GNU_LIBC_A := $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libc.a) |
4112 |
++GNU_LIBC_A = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libc.a) |
4113 |
+ GNU_LIBC_A_OBJS := memchr.o memcpy.o memmove.o memset.o |
4114 |
+ GNU_LIBC_A_OBJS += strchr.o strrchr.o |
4115 |
+ GNU_LIBC_A_OBJS += rawmemchr.o # needed by strrchr.o |
4116 |
+ |
4117 |
+-GNU_LIBGCC_A := $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) |
4118 |
++GNU_LIBGCC_A = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) |
4119 |
+ GNU_LIBGCC_A_OBJS := _ashldi3.o _ashrdi3.o _lshrdi3.o |
4120 |
+ GNU_LIBGCC_A_OBJS += _divsi3.o _modsi3.o _ucmpdi2.o _umodsi3.o _udivsi3.o |
4121 |
+ |
4122 |
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
4123 |
+index e53dda210cd7..21d2f1de1057 100644 |
4124 |
+--- a/arch/x86/kernel/apic/apic.c |
4125 |
++++ b/arch/x86/kernel/apic/apic.c |
4126 |
+@@ -2093,7 +2093,7 @@ void __init init_apic_mappings(void) |
4127 |
+ unsigned int new_apicid; |
4128 |
+ |
4129 |
+ if (apic_validate_deadline_timer()) |
4130 |
+- pr_debug("TSC deadline timer available\n"); |
4131 |
++ pr_info("TSC deadline timer available\n"); |
4132 |
+ |
4133 |
+ if (x2apic_mode) { |
4134 |
+ boot_cpu_physical_apicid = read_apic_id(); |
4135 |
+diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c |
4136 |
+index d089567a9ce8..bcb379b2fd42 100644 |
4137 |
+--- a/arch/x86/kernel/cpu/mce/dev-mcelog.c |
4138 |
++++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c |
4139 |
+@@ -343,7 +343,7 @@ static __init int dev_mcelog_init_device(void) |
4140 |
+ if (!mcelog) |
4141 |
+ return -ENOMEM; |
4142 |
+ |
4143 |
+- strncpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature)); |
4144 |
++ memcpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature)); |
4145 |
+ mcelog->len = mce_log_len; |
4146 |
+ mcelog->recordlen = sizeof(struct mce); |
4147 |
+ |
4148 |
+diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c |
4149 |
+index 87ef69a72c52..7bb4c3cbf4dc 100644 |
4150 |
+--- a/arch/x86/kernel/idt.c |
4151 |
++++ b/arch/x86/kernel/idt.c |
4152 |
+@@ -318,7 +318,11 @@ void __init idt_setup_apic_and_irq_gates(void) |
4153 |
+ |
4154 |
+ #ifdef CONFIG_X86_LOCAL_APIC |
4155 |
+ for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { |
4156 |
+- set_bit(i, system_vectors); |
4157 |
++ /* |
4158 |
++ * Don't set the non assigned system vectors in the |
4159 |
++ * system_vectors bitmap. Otherwise they show up in |
4160 |
++ * /proc/interrupts. |
4161 |
++ */ |
4162 |
+ entry = spurious_entries_start + 8 * (i - FIRST_SYSTEM_VECTOR); |
4163 |
+ set_intr_gate(i, entry); |
4164 |
+ } |
4165 |
+diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
4166 |
+index 4d7022a740ab..a12adbe1559d 100644 |
4167 |
+--- a/arch/x86/kernel/kprobes/core.c |
4168 |
++++ b/arch/x86/kernel/kprobes/core.c |
4169 |
+@@ -753,16 +753,11 @@ asm( |
4170 |
+ NOKPROBE_SYMBOL(kretprobe_trampoline); |
4171 |
+ STACK_FRAME_NON_STANDARD(kretprobe_trampoline); |
4172 |
+ |
4173 |
+-static struct kprobe kretprobe_kprobe = { |
4174 |
+- .addr = (void *)kretprobe_trampoline, |
4175 |
+-}; |
4176 |
+- |
4177 |
+ /* |
4178 |
+ * Called from kretprobe_trampoline |
4179 |
+ */ |
4180 |
+ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4181 |
+ { |
4182 |
+- struct kprobe_ctlblk *kcb; |
4183 |
+ struct kretprobe_instance *ri = NULL; |
4184 |
+ struct hlist_head *head, empty_rp; |
4185 |
+ struct hlist_node *tmp; |
4186 |
+@@ -772,16 +767,12 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4187 |
+ void *frame_pointer; |
4188 |
+ bool skipped = false; |
4189 |
+ |
4190 |
+- preempt_disable(); |
4191 |
+- |
4192 |
+ /* |
4193 |
+ * Set a dummy kprobe for avoiding kretprobe recursion. |
4194 |
+ * Since kretprobe never run in kprobe handler, kprobe must not |
4195 |
+ * be running at this point. |
4196 |
+ */ |
4197 |
+- kcb = get_kprobe_ctlblk(); |
4198 |
+- __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
4199 |
+- kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
4200 |
++ kprobe_busy_begin(); |
4201 |
+ |
4202 |
+ INIT_HLIST_HEAD(&empty_rp); |
4203 |
+ kretprobe_hash_lock(current, &head, &flags); |
4204 |
+@@ -857,7 +848,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4205 |
+ __this_cpu_write(current_kprobe, &ri->rp->kp); |
4206 |
+ ri->ret_addr = correct_ret_addr; |
4207 |
+ ri->rp->handler(ri, regs); |
4208 |
+- __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
4209 |
++ __this_cpu_write(current_kprobe, &kprobe_busy); |
4210 |
+ } |
4211 |
+ |
4212 |
+ recycle_rp_inst(ri, &empty_rp); |
4213 |
+@@ -873,8 +864,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4214 |
+ |
4215 |
+ kretprobe_hash_unlock(current, &flags); |
4216 |
+ |
4217 |
+- __this_cpu_write(current_kprobe, NULL); |
4218 |
+- preempt_enable(); |
4219 |
++ kprobe_busy_end(); |
4220 |
+ |
4221 |
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { |
4222 |
+ hlist_del(&ri->hlist); |
4223 |
+diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile |
4224 |
+index fb4ee5444379..9733d1cc791d 100644 |
4225 |
+--- a/arch/x86/purgatory/Makefile |
4226 |
++++ b/arch/x86/purgatory/Makefile |
4227 |
+@@ -17,7 +17,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS |
4228 |
+ LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib |
4229 |
+ targets += purgatory.ro |
4230 |
+ |
4231 |
++# Sanitizer, etc. runtimes are unavailable and cannot be linked here. |
4232 |
++GCOV_PROFILE := n |
4233 |
+ KASAN_SANITIZE := n |
4234 |
++UBSAN_SANITIZE := n |
4235 |
+ KCOV_INSTRUMENT := n |
4236 |
+ |
4237 |
+ # These are adjustments to the compiler flags used for objects that |
4238 |
+@@ -25,7 +28,7 @@ KCOV_INSTRUMENT := n |
4239 |
+ |
4240 |
+ PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel |
4241 |
+ PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss |
4242 |
+-PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) |
4243 |
++PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING |
4244 |
+ |
4245 |
+ # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That |
4246 |
+ # in turn leaves some undefined symbols like __fentry__ in purgatory and not |
4247 |
+diff --git a/crypto/algboss.c b/crypto/algboss.c |
4248 |
+index 535f1f87e6c1..5ebccbd6b74e 100644 |
4249 |
+--- a/crypto/algboss.c |
4250 |
++++ b/crypto/algboss.c |
4251 |
+@@ -178,8 +178,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) |
4252 |
+ if (IS_ERR(thread)) |
4253 |
+ goto err_put_larval; |
4254 |
+ |
4255 |
+- wait_for_completion_interruptible(&larval->completion); |
4256 |
+- |
4257 |
+ return NOTIFY_STOP; |
4258 |
+ |
4259 |
+ err_put_larval: |
4260 |
+diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c |
4261 |
+index e2c8ab408bed..4c3bdffe0c3a 100644 |
4262 |
+--- a/crypto/algif_skcipher.c |
4263 |
++++ b/crypto/algif_skcipher.c |
4264 |
+@@ -74,14 +74,10 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg, |
4265 |
+ return PTR_ERR(areq); |
4266 |
+ |
4267 |
+ /* convert iovecs of output buffers into RX SGL */ |
4268 |
+- err = af_alg_get_rsgl(sk, msg, flags, areq, -1, &len); |
4269 |
++ err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len); |
4270 |
+ if (err) |
4271 |
+ goto free; |
4272 |
+ |
4273 |
+- /* Process only as much RX buffers for which we have TX data */ |
4274 |
+- if (len > ctx->used) |
4275 |
+- len = ctx->used; |
4276 |
+- |
4277 |
+ /* |
4278 |
+ * If more buffers are to be expected to be processed, process only |
4279 |
+ * full block size buffers. |
4280 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
4281 |
+index beca5f91bb4c..e74c8fe2a5fd 100644 |
4282 |
+--- a/drivers/ata/libata-core.c |
4283 |
++++ b/drivers/ata/libata-core.c |
4284 |
+@@ -42,7 +42,6 @@ |
4285 |
+ #include <linux/workqueue.h> |
4286 |
+ #include <linux/scatterlist.h> |
4287 |
+ #include <linux/io.h> |
4288 |
+-#include <linux/async.h> |
4289 |
+ #include <linux/log2.h> |
4290 |
+ #include <linux/slab.h> |
4291 |
+ #include <linux/glob.h> |
4292 |
+@@ -5778,7 +5777,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) |
4293 |
+ /* perform each probe asynchronously */ |
4294 |
+ for (i = 0; i < host->n_ports; i++) { |
4295 |
+ struct ata_port *ap = host->ports[i]; |
4296 |
+- async_schedule(async_port_probe, ap); |
4297 |
++ ap->cookie = async_schedule(async_port_probe, ap); |
4298 |
+ } |
4299 |
+ |
4300 |
+ return 0; |
4301 |
+@@ -5920,11 +5919,11 @@ void ata_host_detach(struct ata_host *host) |
4302 |
+ { |
4303 |
+ int i; |
4304 |
+ |
4305 |
+- /* Ensure ata_port probe has completed */ |
4306 |
+- async_synchronize_full(); |
4307 |
+- |
4308 |
+- for (i = 0; i < host->n_ports; i++) |
4309 |
++ for (i = 0; i < host->n_ports; i++) { |
4310 |
++ /* Ensure ata_port probe has completed */ |
4311 |
++ async_synchronize_cookie(host->ports[i]->cookie + 1); |
4312 |
+ ata_port_detach(host->ports[i]); |
4313 |
++ } |
4314 |
+ |
4315 |
+ /* the host is dead now, dissociate ACPI */ |
4316 |
+ ata_acpi_dissociate(host); |
4317 |
+diff --git a/drivers/base/platform.c b/drivers/base/platform.c |
4318 |
+index b27d0f6c18c9..f5d485166fd3 100644 |
4319 |
+--- a/drivers/base/platform.c |
4320 |
++++ b/drivers/base/platform.c |
4321 |
+@@ -851,6 +851,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, |
4322 |
+ /* temporary section violation during probe() */ |
4323 |
+ drv->probe = probe; |
4324 |
+ retval = code = __platform_driver_register(drv, module); |
4325 |
++ if (retval) |
4326 |
++ return retval; |
4327 |
+ |
4328 |
+ /* |
4329 |
+ * Fixup that section violation, being paranoid about code scanning |
4330 |
+diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c |
4331 |
+index c5c6487a19d5..7b55811c2a81 100644 |
4332 |
+--- a/drivers/block/ps3disk.c |
4333 |
++++ b/drivers/block/ps3disk.c |
4334 |
+@@ -454,7 +454,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev) |
4335 |
+ queue->queuedata = dev; |
4336 |
+ |
4337 |
+ blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9); |
4338 |
+- blk_queue_segment_boundary(queue, -1UL); |
4339 |
+ blk_queue_dma_alignment(queue, dev->blk_size-1); |
4340 |
+ blk_queue_logical_block_size(queue, dev->blk_size); |
4341 |
+ |
4342 |
+diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c |
4343 |
+index 97e06cc586e4..8be3d0fb0614 100644 |
4344 |
+--- a/drivers/bus/mhi/core/main.c |
4345 |
++++ b/drivers/bus/mhi/core/main.c |
4346 |
+@@ -513,7 +513,10 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl, |
4347 |
+ mhi_cntrl->unmap_single(mhi_cntrl, buf_info); |
4348 |
+ |
4349 |
+ result.buf_addr = buf_info->cb_buf; |
4350 |
+- result.bytes_xferd = xfer_len; |
4351 |
++ |
4352 |
++ /* truncate to buf len if xfer_len is larger */ |
4353 |
++ result.bytes_xferd = |
4354 |
++ min_t(u16, xfer_len, buf_info->len); |
4355 |
+ mhi_del_ring_element(mhi_cntrl, buf_ring); |
4356 |
+ mhi_del_ring_element(mhi_cntrl, tre_ring); |
4357 |
+ local_rp = tre_ring->rp; |
4358 |
+@@ -597,7 +600,9 @@ static int parse_rsc_event(struct mhi_controller *mhi_cntrl, |
4359 |
+ |
4360 |
+ result.transaction_status = (ev_code == MHI_EV_CC_OVERFLOW) ? |
4361 |
+ -EOVERFLOW : 0; |
4362 |
+- result.bytes_xferd = xfer_len; |
4363 |
++ |
4364 |
++ /* truncate to buf len if xfer_len is larger */ |
4365 |
++ result.bytes_xferd = min_t(u16, xfer_len, buf_info->len); |
4366 |
+ result.buf_addr = buf_info->cb_buf; |
4367 |
+ result.dir = mhi_chan->dir; |
4368 |
+ |
4369 |
+diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
4370 |
+index c48d8f086382..9afd220cd824 100644 |
4371 |
+--- a/drivers/char/ipmi/ipmi_msghandler.c |
4372 |
++++ b/drivers/char/ipmi/ipmi_msghandler.c |
4373 |
+@@ -33,6 +33,7 @@ |
4374 |
+ #include <linux/workqueue.h> |
4375 |
+ #include <linux/uuid.h> |
4376 |
+ #include <linux/nospec.h> |
4377 |
++#include <linux/vmalloc.h> |
4378 |
+ |
4379 |
+ #define IPMI_DRIVER_VERSION "39.2" |
4380 |
+ |
4381 |
+@@ -1153,7 +1154,7 @@ static void free_user_work(struct work_struct *work) |
4382 |
+ remove_work); |
4383 |
+ |
4384 |
+ cleanup_srcu_struct(&user->release_barrier); |
4385 |
+- kfree(user); |
4386 |
++ vfree(user); |
4387 |
+ } |
4388 |
+ |
4389 |
+ int ipmi_create_user(unsigned int if_num, |
4390 |
+@@ -1185,7 +1186,7 @@ int ipmi_create_user(unsigned int if_num, |
4391 |
+ if (rv) |
4392 |
+ return rv; |
4393 |
+ |
4394 |
+- new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
4395 |
++ new_user = vzalloc(sizeof(*new_user)); |
4396 |
+ if (!new_user) |
4397 |
+ return -ENOMEM; |
4398 |
+ |
4399 |
+@@ -1232,7 +1233,7 @@ int ipmi_create_user(unsigned int if_num, |
4400 |
+ |
4401 |
+ out_kfree: |
4402 |
+ srcu_read_unlock(&ipmi_interfaces_srcu, index); |
4403 |
+- kfree(new_user); |
4404 |
++ vfree(new_user); |
4405 |
+ return rv; |
4406 |
+ } |
4407 |
+ EXPORT_SYMBOL(ipmi_create_user); |
4408 |
+diff --git a/drivers/char/mem.c b/drivers/char/mem.c |
4409 |
+index 43dd0891ca1e..31cae88a730b 100644 |
4410 |
+--- a/drivers/char/mem.c |
4411 |
++++ b/drivers/char/mem.c |
4412 |
+@@ -31,11 +31,15 @@ |
4413 |
+ #include <linux/uio.h> |
4414 |
+ #include <linux/uaccess.h> |
4415 |
+ #include <linux/security.h> |
4416 |
++#include <linux/pseudo_fs.h> |
4417 |
++#include <uapi/linux/magic.h> |
4418 |
++#include <linux/mount.h> |
4419 |
+ |
4420 |
+ #ifdef CONFIG_IA64 |
4421 |
+ # include <linux/efi.h> |
4422 |
+ #endif |
4423 |
+ |
4424 |
++#define DEVMEM_MINOR 1 |
4425 |
+ #define DEVPORT_MINOR 4 |
4426 |
+ |
4427 |
+ static inline unsigned long size_inside_page(unsigned long start, |
4428 |
+@@ -805,12 +809,64 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) |
4429 |
+ return ret; |
4430 |
+ } |
4431 |
+ |
4432 |
++static struct inode *devmem_inode; |
4433 |
++ |
4434 |
++#ifdef CONFIG_IO_STRICT_DEVMEM |
4435 |
++void revoke_devmem(struct resource *res) |
4436 |
++{ |
4437 |
++ struct inode *inode = READ_ONCE(devmem_inode); |
4438 |
++ |
4439 |
++ /* |
4440 |
++ * Check that the initialization has completed. Losing the race |
4441 |
++ * is ok because it means drivers are claiming resources before |
4442 |
++ * the fs_initcall level of init and prevent /dev/mem from |
4443 |
++ * establishing mappings. |
4444 |
++ */ |
4445 |
++ if (!inode) |
4446 |
++ return; |
4447 |
++ |
4448 |
++ /* |
4449 |
++ * The expectation is that the driver has successfully marked |
4450 |
++ * the resource busy by this point, so devmem_is_allowed() |
4451 |
++ * should start returning false, however for performance this |
4452 |
++ * does not iterate the entire resource range. |
4453 |
++ */ |
4454 |
++ if (devmem_is_allowed(PHYS_PFN(res->start)) && |
4455 |
++ devmem_is_allowed(PHYS_PFN(res->end))) { |
4456 |
++ /* |
4457 |
++ * *cringe* iomem=relaxed says "go ahead, what's the |
4458 |
++ * worst that can happen?" |
4459 |
++ */ |
4460 |
++ return; |
4461 |
++ } |
4462 |
++ |
4463 |
++ unmap_mapping_range(inode->i_mapping, res->start, resource_size(res), 1); |
4464 |
++} |
4465 |
++#endif |
4466 |
++ |
4467 |
+ static int open_port(struct inode *inode, struct file *filp) |
4468 |
+ { |
4469 |
++ int rc; |
4470 |
++ |
4471 |
+ if (!capable(CAP_SYS_RAWIO)) |
4472 |
+ return -EPERM; |
4473 |
+ |
4474 |
+- return security_locked_down(LOCKDOWN_DEV_MEM); |
4475 |
++ rc = security_locked_down(LOCKDOWN_DEV_MEM); |
4476 |
++ if (rc) |
4477 |
++ return rc; |
4478 |
++ |
4479 |
++ if (iminor(inode) != DEVMEM_MINOR) |
4480 |
++ return 0; |
4481 |
++ |
4482 |
++ /* |
4483 |
++ * Use a unified address space to have a single point to manage |
4484 |
++ * revocations when drivers want to take over a /dev/mem mapped |
4485 |
++ * range. |
4486 |
++ */ |
4487 |
++ inode->i_mapping = devmem_inode->i_mapping; |
4488 |
++ filp->f_mapping = inode->i_mapping; |
4489 |
++ |
4490 |
++ return 0; |
4491 |
+ } |
4492 |
+ |
4493 |
+ #define zero_lseek null_lseek |
4494 |
+@@ -885,7 +941,7 @@ static const struct memdev { |
4495 |
+ fmode_t fmode; |
4496 |
+ } devlist[] = { |
4497 |
+ #ifdef CONFIG_DEVMEM |
4498 |
+- [1] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET }, |
4499 |
++ [DEVMEM_MINOR] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET }, |
4500 |
+ #endif |
4501 |
+ #ifdef CONFIG_DEVKMEM |
4502 |
+ [2] = { "kmem", 0, &kmem_fops, FMODE_UNSIGNED_OFFSET }, |
4503 |
+@@ -939,6 +995,45 @@ static char *mem_devnode(struct device *dev, umode_t *mode) |
4504 |
+ |
4505 |
+ static struct class *mem_class; |
4506 |
+ |
4507 |
++static int devmem_fs_init_fs_context(struct fs_context *fc) |
4508 |
++{ |
4509 |
++ return init_pseudo(fc, DEVMEM_MAGIC) ? 0 : -ENOMEM; |
4510 |
++} |
4511 |
++ |
4512 |
++static struct file_system_type devmem_fs_type = { |
4513 |
++ .name = "devmem", |
4514 |
++ .owner = THIS_MODULE, |
4515 |
++ .init_fs_context = devmem_fs_init_fs_context, |
4516 |
++ .kill_sb = kill_anon_super, |
4517 |
++}; |
4518 |
++ |
4519 |
++static int devmem_init_inode(void) |
4520 |
++{ |
4521 |
++ static struct vfsmount *devmem_vfs_mount; |
4522 |
++ static int devmem_fs_cnt; |
4523 |
++ struct inode *inode; |
4524 |
++ int rc; |
4525 |
++ |
4526 |
++ rc = simple_pin_fs(&devmem_fs_type, &devmem_vfs_mount, &devmem_fs_cnt); |
4527 |
++ if (rc < 0) { |
4528 |
++ pr_err("Cannot mount /dev/mem pseudo filesystem: %d\n", rc); |
4529 |
++ return rc; |
4530 |
++ } |
4531 |
++ |
4532 |
++ inode = alloc_anon_inode(devmem_vfs_mount->mnt_sb); |
4533 |
++ if (IS_ERR(inode)) { |
4534 |
++ rc = PTR_ERR(inode); |
4535 |
++ pr_err("Cannot allocate inode for /dev/mem: %d\n", rc); |
4536 |
++ simple_release_fs(&devmem_vfs_mount, &devmem_fs_cnt); |
4537 |
++ return rc; |
4538 |
++ } |
4539 |
++ |
4540 |
++ /* publish /dev/mem initialized */ |
4541 |
++ WRITE_ONCE(devmem_inode, inode); |
4542 |
++ |
4543 |
++ return 0; |
4544 |
++} |
4545 |
++ |
4546 |
+ static int __init chr_dev_init(void) |
4547 |
+ { |
4548 |
+ int minor; |
4549 |
+@@ -960,6 +1055,8 @@ static int __init chr_dev_init(void) |
4550 |
+ */ |
4551 |
+ if ((minor == DEVPORT_MINOR) && !arch_has_dev_port()) |
4552 |
+ continue; |
4553 |
++ if ((minor == DEVMEM_MINOR) && devmem_init_inode() != 0) |
4554 |
++ continue; |
4555 |
+ |
4556 |
+ device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor), |
4557 |
+ NULL, devlist[minor].name); |
4558 |
+diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile |
4559 |
+index f4169cc2fd31..60e811d3f226 100644 |
4560 |
+--- a/drivers/clk/Makefile |
4561 |
++++ b/drivers/clk/Makefile |
4562 |
+@@ -105,7 +105,7 @@ obj-$(CONFIG_CLK_SIFIVE) += sifive/ |
4563 |
+ obj-$(CONFIG_ARCH_SIRF) += sirf/ |
4564 |
+ obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/ |
4565 |
+ obj-$(CONFIG_PLAT_SPEAR) += spear/ |
4566 |
+-obj-$(CONFIG_ARCH_SPRD) += sprd/ |
4567 |
++obj-y += sprd/ |
4568 |
+ obj-$(CONFIG_ARCH_STI) += st/ |
4569 |
+ obj-$(CONFIG_ARCH_STRATIX10) += socfpga/ |
4570 |
+ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ |
4571 |
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
4572 |
+index ded13ccf768e..7c845c293af0 100644 |
4573 |
+--- a/drivers/clk/bcm/clk-bcm2835.c |
4574 |
++++ b/drivers/clk/bcm/clk-bcm2835.c |
4575 |
+@@ -1448,13 +1448,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, |
4576 |
+ return &clock->hw; |
4577 |
+ } |
4578 |
+ |
4579 |
+-static struct clk *bcm2835_register_gate(struct bcm2835_cprman *cprman, |
4580 |
++static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman, |
4581 |
+ const struct bcm2835_gate_data *data) |
4582 |
+ { |
4583 |
+- return clk_register_gate(cprman->dev, data->name, data->parent, |
4584 |
+- CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
4585 |
+- cprman->regs + data->ctl_reg, |
4586 |
+- CM_GATE_BIT, 0, &cprman->regs_lock); |
4587 |
++ return clk_hw_register_gate(cprman->dev, data->name, data->parent, |
4588 |
++ CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
4589 |
++ cprman->regs + data->ctl_reg, |
4590 |
++ CM_GATE_BIT, 0, &cprman->regs_lock); |
4591 |
+ } |
4592 |
+ |
4593 |
+ typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman, |
4594 |
+diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c |
4595 |
+index 392d01705b97..99afc949925f 100644 |
4596 |
+--- a/drivers/clk/clk-ast2600.c |
4597 |
++++ b/drivers/clk/clk-ast2600.c |
4598 |
+@@ -642,14 +642,22 @@ static const u32 ast2600_a0_axi_ahb_div_table[] = { |
4599 |
+ 2, 2, 3, 5, |
4600 |
+ }; |
4601 |
+ |
4602 |
+-static const u32 ast2600_a1_axi_ahb_div_table[] = { |
4603 |
+- 4, 6, 2, 4, |
4604 |
++static const u32 ast2600_a1_axi_ahb_div0_tbl[] = { |
4605 |
++ 3, 2, 3, 4, |
4606 |
++}; |
4607 |
++ |
4608 |
++static const u32 ast2600_a1_axi_ahb_div1_tbl[] = { |
4609 |
++ 3, 4, 6, 8, |
4610 |
++}; |
4611 |
++ |
4612 |
++static const u32 ast2600_a1_axi_ahb200_tbl[] = { |
4613 |
++ 3, 4, 3, 4, 2, 2, 2, 2, |
4614 |
+ }; |
4615 |
+ |
4616 |
+ static void __init aspeed_g6_cc(struct regmap *map) |
4617 |
+ { |
4618 |
+ struct clk_hw *hw; |
4619 |
+- u32 val, div, chip_id, axi_div, ahb_div; |
4620 |
++ u32 val, div, divbits, chip_id, axi_div, ahb_div; |
4621 |
+ |
4622 |
+ clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, 25000000); |
4623 |
+ |
4624 |
+@@ -679,11 +687,22 @@ static void __init aspeed_g6_cc(struct regmap *map) |
4625 |
+ else |
4626 |
+ axi_div = 2; |
4627 |
+ |
4628 |
++ divbits = (val >> 11) & 0x3; |
4629 |
+ regmap_read(map, ASPEED_G6_SILICON_REV, &chip_id); |
4630 |
+- if (chip_id & BIT(16)) |
4631 |
+- ahb_div = ast2600_a1_axi_ahb_div_table[(val >> 11) & 0x3]; |
4632 |
+- else |
4633 |
++ if (chip_id & BIT(16)) { |
4634 |
++ if (!divbits) { |
4635 |
++ ahb_div = ast2600_a1_axi_ahb200_tbl[(val >> 8) & 0x3]; |
4636 |
++ if (val & BIT(16)) |
4637 |
++ ahb_div *= 2; |
4638 |
++ } else { |
4639 |
++ if (val & BIT(16)) |
4640 |
++ ahb_div = ast2600_a1_axi_ahb_div1_tbl[divbits]; |
4641 |
++ else |
4642 |
++ ahb_div = ast2600_a1_axi_ahb_div0_tbl[divbits]; |
4643 |
++ } |
4644 |
++ } else { |
4645 |
+ ahb_div = ast2600_a0_axi_ahb_div_table[(val >> 11) & 0x3]; |
4646 |
++ } |
4647 |
+ |
4648 |
+ hw = clk_hw_register_fixed_factor(NULL, "ahb", "hpll", 0, 1, axi_div * ahb_div); |
4649 |
+ aspeed_g6_clk_data->hws[ASPEED_CLK_AHB] = hw; |
4650 |
+diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c |
4651 |
+index 34a70c4b4899..11f6b868cf2b 100644 |
4652 |
+--- a/drivers/clk/meson/meson8b.c |
4653 |
++++ b/drivers/clk/meson/meson8b.c |
4654 |
+@@ -1077,7 +1077,7 @@ static struct clk_regmap meson8b_vid_pll_in_sel = { |
4655 |
+ * Meson8m2: vid2_pll |
4656 |
+ */ |
4657 |
+ .parent_hws = (const struct clk_hw *[]) { |
4658 |
+- &meson8b_hdmi_pll_dco.hw |
4659 |
++ &meson8b_hdmi_pll_lvds_out.hw |
4660 |
+ }, |
4661 |
+ .num_parents = 1, |
4662 |
+ .flags = CLK_SET_RATE_PARENT, |
4663 |
+@@ -1213,7 +1213,7 @@ static struct clk_regmap meson8b_vclk_in_en = { |
4664 |
+ |
4665 |
+ static struct clk_regmap meson8b_vclk_div1_gate = { |
4666 |
+ .data = &(struct clk_regmap_gate_data){ |
4667 |
+- .offset = HHI_VID_CLK_DIV, |
4668 |
++ .offset = HHI_VID_CLK_CNTL, |
4669 |
+ .bit_idx = 0, |
4670 |
+ }, |
4671 |
+ .hw.init = &(struct clk_init_data){ |
4672 |
+@@ -1243,7 +1243,7 @@ static struct clk_fixed_factor meson8b_vclk_div2_div = { |
4673 |
+ |
4674 |
+ static struct clk_regmap meson8b_vclk_div2_div_gate = { |
4675 |
+ .data = &(struct clk_regmap_gate_data){ |
4676 |
+- .offset = HHI_VID_CLK_DIV, |
4677 |
++ .offset = HHI_VID_CLK_CNTL, |
4678 |
+ .bit_idx = 1, |
4679 |
+ }, |
4680 |
+ .hw.init = &(struct clk_init_data){ |
4681 |
+@@ -1273,7 +1273,7 @@ static struct clk_fixed_factor meson8b_vclk_div4_div = { |
4682 |
+ |
4683 |
+ static struct clk_regmap meson8b_vclk_div4_div_gate = { |
4684 |
+ .data = &(struct clk_regmap_gate_data){ |
4685 |
+- .offset = HHI_VID_CLK_DIV, |
4686 |
++ .offset = HHI_VID_CLK_CNTL, |
4687 |
+ .bit_idx = 2, |
4688 |
+ }, |
4689 |
+ .hw.init = &(struct clk_init_data){ |
4690 |
+@@ -1303,7 +1303,7 @@ static struct clk_fixed_factor meson8b_vclk_div6_div = { |
4691 |
+ |
4692 |
+ static struct clk_regmap meson8b_vclk_div6_div_gate = { |
4693 |
+ .data = &(struct clk_regmap_gate_data){ |
4694 |
+- .offset = HHI_VID_CLK_DIV, |
4695 |
++ .offset = HHI_VID_CLK_CNTL, |
4696 |
+ .bit_idx = 3, |
4697 |
+ }, |
4698 |
+ .hw.init = &(struct clk_init_data){ |
4699 |
+@@ -1333,7 +1333,7 @@ static struct clk_fixed_factor meson8b_vclk_div12_div = { |
4700 |
+ |
4701 |
+ static struct clk_regmap meson8b_vclk_div12_div_gate = { |
4702 |
+ .data = &(struct clk_regmap_gate_data){ |
4703 |
+- .offset = HHI_VID_CLK_DIV, |
4704 |
++ .offset = HHI_VID_CLK_CNTL, |
4705 |
+ .bit_idx = 4, |
4706 |
+ }, |
4707 |
+ .hw.init = &(struct clk_init_data){ |
4708 |
+@@ -1918,6 +1918,13 @@ static struct clk_regmap meson8b_mali = { |
4709 |
+ }, |
4710 |
+ }; |
4711 |
+ |
4712 |
++static const struct reg_sequence meson8m2_gp_pll_init_regs[] = { |
4713 |
++ { .reg = HHI_GP_PLL_CNTL2, .def = 0x59c88000 }, |
4714 |
++ { .reg = HHI_GP_PLL_CNTL3, .def = 0xca463823 }, |
4715 |
++ { .reg = HHI_GP_PLL_CNTL4, .def = 0x0286a027 }, |
4716 |
++ { .reg = HHI_GP_PLL_CNTL5, .def = 0x00003000 }, |
4717 |
++}; |
4718 |
++ |
4719 |
+ static const struct pll_params_table meson8m2_gp_pll_params_table[] = { |
4720 |
+ PLL_PARAMS(182, 3), |
4721 |
+ { /* sentinel */ }, |
4722 |
+@@ -1951,6 +1958,8 @@ static struct clk_regmap meson8m2_gp_pll_dco = { |
4723 |
+ .width = 1, |
4724 |
+ }, |
4725 |
+ .table = meson8m2_gp_pll_params_table, |
4726 |
++ .init_regs = meson8m2_gp_pll_init_regs, |
4727 |
++ .init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs), |
4728 |
+ }, |
4729 |
+ .hw.init = &(struct clk_init_data){ |
4730 |
+ .name = "gp_pll_dco", |
4731 |
+@@ -3506,54 +3515,87 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { |
4732 |
+ static const struct meson8b_clk_reset_line { |
4733 |
+ u32 reg; |
4734 |
+ u8 bit_idx; |
4735 |
++ bool active_low; |
4736 |
+ } meson8b_clk_reset_bits[] = { |
4737 |
+ [CLKC_RESET_L2_CACHE_SOFT_RESET] = { |
4738 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30 |
4739 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4740 |
++ .bit_idx = 30, |
4741 |
++ .active_low = false, |
4742 |
+ }, |
4743 |
+ [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = { |
4744 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29 |
4745 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4746 |
++ .bit_idx = 29, |
4747 |
++ .active_low = false, |
4748 |
+ }, |
4749 |
+ [CLKC_RESET_SCU_SOFT_RESET] = { |
4750 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28 |
4751 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4752 |
++ .bit_idx = 28, |
4753 |
++ .active_low = false, |
4754 |
+ }, |
4755 |
+ [CLKC_RESET_CPU3_SOFT_RESET] = { |
4756 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27 |
4757 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4758 |
++ .bit_idx = 27, |
4759 |
++ .active_low = false, |
4760 |
+ }, |
4761 |
+ [CLKC_RESET_CPU2_SOFT_RESET] = { |
4762 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26 |
4763 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4764 |
++ .bit_idx = 26, |
4765 |
++ .active_low = false, |
4766 |
+ }, |
4767 |
+ [CLKC_RESET_CPU1_SOFT_RESET] = { |
4768 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25 |
4769 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4770 |
++ .bit_idx = 25, |
4771 |
++ .active_low = false, |
4772 |
+ }, |
4773 |
+ [CLKC_RESET_CPU0_SOFT_RESET] = { |
4774 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24 |
4775 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4776 |
++ .bit_idx = 24, |
4777 |
++ .active_low = false, |
4778 |
+ }, |
4779 |
+ [CLKC_RESET_A5_GLOBAL_RESET] = { |
4780 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18 |
4781 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4782 |
++ .bit_idx = 18, |
4783 |
++ .active_low = false, |
4784 |
+ }, |
4785 |
+ [CLKC_RESET_A5_AXI_SOFT_RESET] = { |
4786 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17 |
4787 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4788 |
++ .bit_idx = 17, |
4789 |
++ .active_low = false, |
4790 |
+ }, |
4791 |
+ [CLKC_RESET_A5_ABP_SOFT_RESET] = { |
4792 |
+- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16 |
4793 |
++ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4794 |
++ .bit_idx = 16, |
4795 |
++ .active_low = false, |
4796 |
+ }, |
4797 |
+ [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = { |
4798 |
+- .reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30 |
4799 |
++ .reg = HHI_SYS_CPU_CLK_CNTL1, |
4800 |
++ .bit_idx = 30, |
4801 |
++ .active_low = false, |
4802 |
+ }, |
4803 |
+ [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = { |
4804 |
+- .reg = HHI_VID_CLK_CNTL, .bit_idx = 15 |
4805 |
++ .reg = HHI_VID_CLK_CNTL, |
4806 |
++ .bit_idx = 15, |
4807 |
++ .active_low = false, |
4808 |
+ }, |
4809 |
+ [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = { |
4810 |
+- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7 |
4811 |
++ .reg = HHI_VID_DIVIDER_CNTL, |
4812 |
++ .bit_idx = 7, |
4813 |
++ .active_low = false, |
4814 |
+ }, |
4815 |
+ [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = { |
4816 |
+- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3 |
4817 |
++ .reg = HHI_VID_DIVIDER_CNTL, |
4818 |
++ .bit_idx = 3, |
4819 |
++ .active_low = false, |
4820 |
+ }, |
4821 |
+ [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = { |
4822 |
+- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1 |
4823 |
++ .reg = HHI_VID_DIVIDER_CNTL, |
4824 |
++ .bit_idx = 1, |
4825 |
++ .active_low = true, |
4826 |
+ }, |
4827 |
+ [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = { |
4828 |
+- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0 |
4829 |
++ .reg = HHI_VID_DIVIDER_CNTL, |
4830 |
++ .bit_idx = 0, |
4831 |
++ .active_low = true, |
4832 |
+ }, |
4833 |
+ }; |
4834 |
+ |
4835 |
+@@ -3562,22 +3604,22 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev, |
4836 |
+ { |
4837 |
+ struct meson8b_clk_reset *meson8b_clk_reset = |
4838 |
+ container_of(rcdev, struct meson8b_clk_reset, reset); |
4839 |
+- unsigned long flags; |
4840 |
+ const struct meson8b_clk_reset_line *reset; |
4841 |
++ unsigned int value = 0; |
4842 |
++ unsigned long flags; |
4843 |
+ |
4844 |
+ if (id >= ARRAY_SIZE(meson8b_clk_reset_bits)) |
4845 |
+ return -EINVAL; |
4846 |
+ |
4847 |
+ reset = &meson8b_clk_reset_bits[id]; |
4848 |
+ |
4849 |
++ if (assert != reset->active_low) |
4850 |
++ value = BIT(reset->bit_idx); |
4851 |
++ |
4852 |
+ spin_lock_irqsave(&meson_clk_lock, flags); |
4853 |
+ |
4854 |
+- if (assert) |
4855 |
+- regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
4856 |
+- BIT(reset->bit_idx), BIT(reset->bit_idx)); |
4857 |
+- else |
4858 |
+- regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
4859 |
+- BIT(reset->bit_idx), 0); |
4860 |
++ regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
4861 |
++ BIT(reset->bit_idx), value); |
4862 |
+ |
4863 |
+ spin_unlock_irqrestore(&meson_clk_lock, flags); |
4864 |
+ |
4865 |
+diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h |
4866 |
+index c889fbeec30f..c91fb07fcb65 100644 |
4867 |
+--- a/drivers/clk/meson/meson8b.h |
4868 |
++++ b/drivers/clk/meson/meson8b.h |
4869 |
+@@ -20,6 +20,10 @@ |
4870 |
+ * [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf |
4871 |
+ */ |
4872 |
+ #define HHI_GP_PLL_CNTL 0x40 /* 0x10 offset in data sheet */ |
4873 |
++#define HHI_GP_PLL_CNTL2 0x44 /* 0x11 offset in data sheet */ |
4874 |
++#define HHI_GP_PLL_CNTL3 0x48 /* 0x12 offset in data sheet */ |
4875 |
++#define HHI_GP_PLL_CNTL4 0x4C /* 0x13 offset in data sheet */ |
4876 |
++#define HHI_GP_PLL_CNTL5 0x50 /* 0x14 offset in data sheet */ |
4877 |
+ #define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */ |
4878 |
+ #define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */ |
4879 |
+ #define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */ |
4880 |
+diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c |
4881 |
+index 4e329a7baf2b..17e4a5a2a9fd 100644 |
4882 |
+--- a/drivers/clk/qcom/gcc-msm8916.c |
4883 |
++++ b/drivers/clk/qcom/gcc-msm8916.c |
4884 |
+@@ -260,7 +260,7 @@ static struct clk_pll gpll0 = { |
4885 |
+ .l_reg = 0x21004, |
4886 |
+ .m_reg = 0x21008, |
4887 |
+ .n_reg = 0x2100c, |
4888 |
+- .config_reg = 0x21014, |
4889 |
++ .config_reg = 0x21010, |
4890 |
+ .mode_reg = 0x21000, |
4891 |
+ .status_reg = 0x2101c, |
4892 |
+ .status_bit = 17, |
4893 |
+@@ -287,7 +287,7 @@ static struct clk_pll gpll1 = { |
4894 |
+ .l_reg = 0x20004, |
4895 |
+ .m_reg = 0x20008, |
4896 |
+ .n_reg = 0x2000c, |
4897 |
+- .config_reg = 0x20014, |
4898 |
++ .config_reg = 0x20010, |
4899 |
+ .mode_reg = 0x20000, |
4900 |
+ .status_reg = 0x2001c, |
4901 |
+ .status_bit = 17, |
4902 |
+@@ -314,7 +314,7 @@ static struct clk_pll gpll2 = { |
4903 |
+ .l_reg = 0x4a004, |
4904 |
+ .m_reg = 0x4a008, |
4905 |
+ .n_reg = 0x4a00c, |
4906 |
+- .config_reg = 0x4a014, |
4907 |
++ .config_reg = 0x4a010, |
4908 |
+ .mode_reg = 0x4a000, |
4909 |
+ .status_reg = 0x4a01c, |
4910 |
+ .status_bit = 17, |
4911 |
+@@ -341,7 +341,7 @@ static struct clk_pll bimc_pll = { |
4912 |
+ .l_reg = 0x23004, |
4913 |
+ .m_reg = 0x23008, |
4914 |
+ .n_reg = 0x2300c, |
4915 |
+- .config_reg = 0x23014, |
4916 |
++ .config_reg = 0x23010, |
4917 |
+ .mode_reg = 0x23000, |
4918 |
+ .status_reg = 0x2301c, |
4919 |
+ .status_bit = 17, |
4920 |
+diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c |
4921 |
+index a2663fbbd7a5..d6a53c99b114 100644 |
4922 |
+--- a/drivers/clk/renesas/renesas-cpg-mssr.c |
4923 |
++++ b/drivers/clk/renesas/renesas-cpg-mssr.c |
4924 |
+@@ -812,7 +812,8 @@ static int cpg_mssr_suspend_noirq(struct device *dev) |
4925 |
+ /* Save module registers with bits under our control */ |
4926 |
+ for (reg = 0; reg < ARRAY_SIZE(priv->smstpcr_saved); reg++) { |
4927 |
+ if (priv->smstpcr_saved[reg].mask) |
4928 |
+- priv->smstpcr_saved[reg].val = |
4929 |
++ priv->smstpcr_saved[reg].val = priv->stbyctrl ? |
4930 |
++ readb(priv->base + STBCR(reg)) : |
4931 |
+ readl(priv->base + SMSTPCR(reg)); |
4932 |
+ } |
4933 |
+ |
4934 |
+@@ -872,8 +873,9 @@ static int cpg_mssr_resume_noirq(struct device *dev) |
4935 |
+ } |
4936 |
+ |
4937 |
+ if (!i) |
4938 |
+- dev_warn(dev, "Failed to enable SMSTP %p[0x%x]\n", |
4939 |
+- priv->base + SMSTPCR(reg), oldval & mask); |
4940 |
++ dev_warn(dev, "Failed to enable %s%u[0x%x]\n", |
4941 |
++ priv->stbyctrl ? "STB" : "SMSTP", reg, |
4942 |
++ oldval & mask); |
4943 |
+ } |
4944 |
+ |
4945 |
+ return 0; |
4946 |
+diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c |
4947 |
+index c9e5a1fb6653..edb2363c735a 100644 |
4948 |
+--- a/drivers/clk/samsung/clk-exynos5420.c |
4949 |
++++ b/drivers/clk/samsung/clk-exynos5420.c |
4950 |
+@@ -540,7 +540,7 @@ static const struct samsung_div_clock exynos5800_div_clks[] __initconst = { |
4951 |
+ |
4952 |
+ static const struct samsung_gate_clock exynos5800_gate_clks[] __initconst = { |
4953 |
+ GATE(CLK_ACLK550_CAM, "aclk550_cam", "mout_user_aclk550_cam", |
4954 |
+- GATE_BUS_TOP, 24, 0, 0), |
4955 |
++ GATE_BUS_TOP, 24, CLK_IS_CRITICAL, 0), |
4956 |
+ GATE(CLK_ACLK432_SCALER, "aclk432_scaler", "mout_user_aclk432_scaler", |
4957 |
+ GATE_BUS_TOP, 27, CLK_IS_CRITICAL, 0), |
4958 |
+ }; |
4959 |
+@@ -943,25 +943,25 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { |
4960 |
+ GATE(0, "aclk300_jpeg", "mout_user_aclk300_jpeg", |
4961 |
+ GATE_BUS_TOP, 4, CLK_IGNORE_UNUSED, 0), |
4962 |
+ GATE(0, "aclk333_432_isp0", "mout_user_aclk333_432_isp0", |
4963 |
+- GATE_BUS_TOP, 5, 0, 0), |
4964 |
++ GATE_BUS_TOP, 5, CLK_IS_CRITICAL, 0), |
4965 |
+ GATE(0, "aclk300_gscl", "mout_user_aclk300_gscl", |
4966 |
+ GATE_BUS_TOP, 6, CLK_IS_CRITICAL, 0), |
4967 |
+ GATE(0, "aclk333_432_gscl", "mout_user_aclk333_432_gscl", |
4968 |
+ GATE_BUS_TOP, 7, CLK_IGNORE_UNUSED, 0), |
4969 |
+ GATE(0, "aclk333_432_isp", "mout_user_aclk333_432_isp", |
4970 |
+- GATE_BUS_TOP, 8, 0, 0), |
4971 |
++ GATE_BUS_TOP, 8, CLK_IS_CRITICAL, 0), |
4972 |
+ GATE(CLK_PCLK66_GPIO, "pclk66_gpio", "mout_user_pclk66_gpio", |
4973 |
+ GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), |
4974 |
+ GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", |
4975 |
+ GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), |
4976 |
+ GATE(0, "aclk266_isp", "mout_user_aclk266_isp", |
4977 |
+- GATE_BUS_TOP, 13, 0, 0), |
4978 |
++ GATE_BUS_TOP, 13, CLK_IS_CRITICAL, 0), |
4979 |
+ GATE(0, "aclk166", "mout_user_aclk166", |
4980 |
+ GATE_BUS_TOP, 14, CLK_IGNORE_UNUSED, 0), |
4981 |
+ GATE(CLK_ACLK333, "aclk333", "mout_user_aclk333", |
4982 |
+ GATE_BUS_TOP, 15, CLK_IS_CRITICAL, 0), |
4983 |
+ GATE(0, "aclk400_isp", "mout_user_aclk400_isp", |
4984 |
+- GATE_BUS_TOP, 16, 0, 0), |
4985 |
++ GATE_BUS_TOP, 16, CLK_IS_CRITICAL, 0), |
4986 |
+ GATE(0, "aclk400_mscl", "mout_user_aclk400_mscl", |
4987 |
+ GATE_BUS_TOP, 17, CLK_IS_CRITICAL, 0), |
4988 |
+ GATE(0, "aclk200_disp1", "mout_user_aclk200_disp1", |
4989 |
+@@ -1161,8 +1161,10 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { |
4990 |
+ GATE_IP_GSCL1, 3, 0, 0), |
4991 |
+ GATE(CLK_SMMU_FIMCL1, "smmu_fimcl1", "dout_gscl_blk_333", |
4992 |
+ GATE_IP_GSCL1, 4, 0, 0), |
4993 |
+- GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, 0, 0), |
4994 |
+- GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, 0, 0), |
4995 |
++ GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, |
4996 |
++ CLK_IS_CRITICAL, 0), |
4997 |
++ GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, |
4998 |
++ CLK_IS_CRITICAL, 0), |
4999 |
+ GATE(CLK_SMMU_FIMCL3, "smmu_fimcl3,", "dout_gscl_blk_333", |
5000 |
+ GATE_IP_GSCL1, 16, 0, 0), |
5001 |
+ GATE(CLK_FIMC_LITE3, "fimc_lite3", "aclk333_432_gscl", |
5002 |
+diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c |
5003 |
+index 4b1aa9382ad2..6f29ecd0442e 100644 |
5004 |
+--- a/drivers/clk/samsung/clk-exynos5433.c |
5005 |
++++ b/drivers/clk/samsung/clk-exynos5433.c |
5006 |
+@@ -1706,7 +1706,8 @@ static const struct samsung_gate_clock peric_gate_clks[] __initconst = { |
5007 |
+ GATE(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_pcm1_peric", |
5008 |
+ ENABLE_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0), |
5009 |
+ GATE(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_i2s1_peric", |
5010 |
+- ENABLE_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0), |
5011 |
++ ENABLE_SCLK_PERIC, 6, |
5012 |
++ CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0), |
5013 |
+ GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC, |
5014 |
+ 5, CLK_SET_RATE_PARENT, 0), |
5015 |
+ GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC, |
5016 |
+diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c |
5017 |
+index 15791484388f..13a322b2535a 100644 |
5018 |
+--- a/drivers/clk/sprd/pll.c |
5019 |
++++ b/drivers/clk/sprd/pll.c |
5020 |
+@@ -106,7 +106,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, |
5021 |
+ |
5022 |
+ cfg = kcalloc(regs_num, sizeof(*cfg), GFP_KERNEL); |
5023 |
+ if (!cfg) |
5024 |
+- return -ENOMEM; |
5025 |
++ return parent_rate; |
5026 |
+ |
5027 |
+ for (i = 0; i < regs_num; i++) |
5028 |
+ cfg[i] = sprd_pll_read(pll, i); |
5029 |
+diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c |
5030 |
+index 4413b6e04a8e..55873d4b7603 100644 |
5031 |
+--- a/drivers/clk/st/clk-flexgen.c |
5032 |
++++ b/drivers/clk/st/clk-flexgen.c |
5033 |
+@@ -375,6 +375,7 @@ static void __init st_of_flexgen_setup(struct device_node *np) |
5034 |
+ break; |
5035 |
+ } |
5036 |
+ |
5037 |
++ flex_flags &= ~CLK_IS_CRITICAL; |
5038 |
+ of_clk_detect_critical(np, i, &flex_flags); |
5039 |
+ |
5040 |
+ /* |
5041 |
+diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c |
5042 |
+index 27201fd26e44..e1aa1fbac48a 100644 |
5043 |
+--- a/drivers/clk/sunxi/clk-sunxi.c |
5044 |
++++ b/drivers/clk/sunxi/clk-sunxi.c |
5045 |
+@@ -90,7 +90,7 @@ static void sun6i_a31_get_pll1_factors(struct factors_request *req) |
5046 |
+ * Round down the frequency to the closest multiple of either |
5047 |
+ * 6 or 16 |
5048 |
+ */ |
5049 |
+- u32 round_freq_6 = round_down(freq_mhz, 6); |
5050 |
++ u32 round_freq_6 = rounddown(freq_mhz, 6); |
5051 |
+ u32 round_freq_16 = round_down(freq_mhz, 16); |
5052 |
+ |
5053 |
+ if (round_freq_6 > round_freq_16) |
5054 |
+diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c |
5055 |
+index 6a89936ba03a..eaa43575cfa5 100644 |
5056 |
+--- a/drivers/clk/ti/composite.c |
5057 |
++++ b/drivers/clk/ti/composite.c |
5058 |
+@@ -196,6 +196,7 @@ cleanup: |
5059 |
+ if (!cclk->comp_clks[i]) |
5060 |
+ continue; |
5061 |
+ list_del(&cclk->comp_clks[i]->link); |
5062 |
++ kfree(cclk->comp_clks[i]->parent_names); |
5063 |
+ kfree(cclk->comp_clks[i]); |
5064 |
+ } |
5065 |
+ |
5066 |
+diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c |
5067 |
+index 10e89f23880b..b66c3a62233a 100644 |
5068 |
+--- a/drivers/clk/zynqmp/clkc.c |
5069 |
++++ b/drivers/clk/zynqmp/clkc.c |
5070 |
+@@ -558,7 +558,7 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
5071 |
+ { |
5072 |
+ int j; |
5073 |
+ u32 num_nodes, clk_dev_id; |
5074 |
+- char *clk_out = NULL; |
5075 |
++ char *clk_out[MAX_NODES]; |
5076 |
+ struct clock_topology *nodes; |
5077 |
+ struct clk_hw *hw = NULL; |
5078 |
+ |
5079 |
+@@ -572,16 +572,16 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
5080 |
+ * Intermediate clock names are postfixed with type of clock. |
5081 |
+ */ |
5082 |
+ if (j != (num_nodes - 1)) { |
5083 |
+- clk_out = kasprintf(GFP_KERNEL, "%s%s", clk_name, |
5084 |
++ clk_out[j] = kasprintf(GFP_KERNEL, "%s%s", clk_name, |
5085 |
+ clk_type_postfix[nodes[j].type]); |
5086 |
+ } else { |
5087 |
+- clk_out = kasprintf(GFP_KERNEL, "%s", clk_name); |
5088 |
++ clk_out[j] = kasprintf(GFP_KERNEL, "%s", clk_name); |
5089 |
+ } |
5090 |
+ |
5091 |
+ if (!clk_topology[nodes[j].type]) |
5092 |
+ continue; |
5093 |
+ |
5094 |
+- hw = (*clk_topology[nodes[j].type])(clk_out, clk_dev_id, |
5095 |
++ hw = (*clk_topology[nodes[j].type])(clk_out[j], clk_dev_id, |
5096 |
+ parent_names, |
5097 |
+ num_parents, |
5098 |
+ &nodes[j]); |
5099 |
+@@ -590,9 +590,12 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
5100 |
+ __func__, clk_dev_id, clk_name, |
5101 |
+ PTR_ERR(hw)); |
5102 |
+ |
5103 |
+- parent_names[0] = clk_out; |
5104 |
++ parent_names[0] = clk_out[j]; |
5105 |
+ } |
5106 |
+- kfree(clk_out); |
5107 |
++ |
5108 |
++ for (j = 0; j < num_nodes; j++) |
5109 |
++ kfree(clk_out[j]); |
5110 |
++ |
5111 |
+ return hw; |
5112 |
+ } |
5113 |
+ |
5114 |
+diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c |
5115 |
+index 4be2cc76aa2e..9bc4f9409aea 100644 |
5116 |
+--- a/drivers/clk/zynqmp/divider.c |
5117 |
++++ b/drivers/clk/zynqmp/divider.c |
5118 |
+@@ -111,23 +111,30 @@ static unsigned long zynqmp_clk_divider_recalc_rate(struct clk_hw *hw, |
5119 |
+ |
5120 |
+ static void zynqmp_get_divider2_val(struct clk_hw *hw, |
5121 |
+ unsigned long rate, |
5122 |
+- unsigned long parent_rate, |
5123 |
+ struct zynqmp_clk_divider *divider, |
5124 |
+ int *bestdiv) |
5125 |
+ { |
5126 |
+ int div1; |
5127 |
+ int div2; |
5128 |
+ long error = LONG_MAX; |
5129 |
+- struct clk_hw *parent_hw = clk_hw_get_parent(hw); |
5130 |
+- struct zynqmp_clk_divider *pdivider = to_zynqmp_clk_divider(parent_hw); |
5131 |
++ unsigned long div1_prate; |
5132 |
++ struct clk_hw *div1_parent_hw; |
5133 |
++ struct clk_hw *div2_parent_hw = clk_hw_get_parent(hw); |
5134 |
++ struct zynqmp_clk_divider *pdivider = |
5135 |
++ to_zynqmp_clk_divider(div2_parent_hw); |
5136 |
+ |
5137 |
+ if (!pdivider) |
5138 |
+ return; |
5139 |
+ |
5140 |
++ div1_parent_hw = clk_hw_get_parent(div2_parent_hw); |
5141 |
++ if (!div1_parent_hw) |
5142 |
++ return; |
5143 |
++ |
5144 |
++ div1_prate = clk_hw_get_rate(div1_parent_hw); |
5145 |
+ *bestdiv = 1; |
5146 |
+ for (div1 = 1; div1 <= pdivider->max_div;) { |
5147 |
+ for (div2 = 1; div2 <= divider->max_div;) { |
5148 |
+- long new_error = ((parent_rate / div1) / div2) - rate; |
5149 |
++ long new_error = ((div1_prate / div1) / div2) - rate; |
5150 |
+ |
5151 |
+ if (abs(new_error) < abs(error)) { |
5152 |
+ *bestdiv = div2; |
5153 |
+@@ -192,7 +199,7 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw, |
5154 |
+ */ |
5155 |
+ if (div_type == TYPE_DIV2 && |
5156 |
+ (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) { |
5157 |
+- zynqmp_get_divider2_val(hw, rate, *prate, divider, &bestdiv); |
5158 |
++ zynqmp_get_divider2_val(hw, rate, divider, &bestdiv); |
5159 |
+ } |
5160 |
+ |
5161 |
+ if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac) |
5162 |
+diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c |
5163 |
+index 0e8c7e324fb4..725a739800b0 100644 |
5164 |
+--- a/drivers/crypto/hisilicon/sgl.c |
5165 |
++++ b/drivers/crypto/hisilicon/sgl.c |
5166 |
+@@ -66,7 +66,8 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev, |
5167 |
+ |
5168 |
+ sgl_size = sizeof(struct acc_hw_sge) * sge_nr + |
5169 |
+ sizeof(struct hisi_acc_hw_sgl); |
5170 |
+- block_size = PAGE_SIZE * (1 << (MAX_ORDER - 1)); |
5171 |
++ block_size = 1 << (PAGE_SHIFT + MAX_ORDER <= 32 ? |
5172 |
++ PAGE_SHIFT + MAX_ORDER - 1 : 31); |
5173 |
+ sgl_num_per_block = block_size / sgl_size; |
5174 |
+ block_num = count / sgl_num_per_block; |
5175 |
+ remain_sgl = count % sgl_num_per_block; |
5176 |
+diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |
5177 |
+index 06202bcffb33..a370c99ecf4c 100644 |
5178 |
+--- a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |
5179 |
++++ b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |
5180 |
+@@ -118,6 +118,9 @@ static void otx_cpt_aead_callback(int status, void *arg1, void *arg2) |
5181 |
+ struct otx_cpt_req_info *cpt_req; |
5182 |
+ struct pci_dev *pdev; |
5183 |
+ |
5184 |
++ if (!cpt_info) |
5185 |
++ goto complete; |
5186 |
++ |
5187 |
+ cpt_req = cpt_info->req; |
5188 |
+ if (!status) { |
5189 |
+ /* |
5190 |
+@@ -129,10 +132,10 @@ static void otx_cpt_aead_callback(int status, void *arg1, void *arg2) |
5191 |
+ !cpt_req->is_enc) |
5192 |
+ status = validate_hmac_cipher_null(cpt_req); |
5193 |
+ } |
5194 |
+- if (cpt_info) { |
5195 |
+- pdev = cpt_info->pdev; |
5196 |
+- do_request_cleanup(pdev, cpt_info); |
5197 |
+- } |
5198 |
++ pdev = cpt_info->pdev; |
5199 |
++ do_request_cleanup(pdev, cpt_info); |
5200 |
++ |
5201 |
++complete: |
5202 |
+ if (areq) |
5203 |
+ areq->complete(areq, status); |
5204 |
+ } |
5205 |
+diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
5206 |
+index e4072cd38585..a82a3596dca3 100644 |
5207 |
+--- a/drivers/crypto/omap-sham.c |
5208 |
++++ b/drivers/crypto/omap-sham.c |
5209 |
+@@ -169,8 +169,6 @@ struct omap_sham_hmac_ctx { |
5210 |
+ }; |
5211 |
+ |
5212 |
+ struct omap_sham_ctx { |
5213 |
+- struct omap_sham_dev *dd; |
5214 |
+- |
5215 |
+ unsigned long flags; |
5216 |
+ |
5217 |
+ /* fallback stuff */ |
5218 |
+@@ -751,8 +749,15 @@ static int omap_sham_align_sgs(struct scatterlist *sg, |
5219 |
+ int offset = rctx->offset; |
5220 |
+ int bufcnt = rctx->bufcnt; |
5221 |
+ |
5222 |
+- if (!sg || !sg->length || !nbytes) |
5223 |
++ if (!sg || !sg->length || !nbytes) { |
5224 |
++ if (bufcnt) { |
5225 |
++ sg_init_table(rctx->sgl, 1); |
5226 |
++ sg_set_buf(rctx->sgl, rctx->dd->xmit_buf, bufcnt); |
5227 |
++ rctx->sg = rctx->sgl; |
5228 |
++ } |
5229 |
++ |
5230 |
+ return 0; |
5231 |
++ } |
5232 |
+ |
5233 |
+ new_len = nbytes; |
5234 |
+ |
5235 |
+@@ -896,7 +901,7 @@ static int omap_sham_prepare_request(struct ahash_request *req, bool update) |
5236 |
+ if (hash_later < 0) |
5237 |
+ hash_later = 0; |
5238 |
+ |
5239 |
+- if (hash_later) { |
5240 |
++ if (hash_later && hash_later <= rctx->buflen) { |
5241 |
+ scatterwalk_map_and_copy(rctx->buffer, |
5242 |
+ req->src, |
5243 |
+ req->nbytes - hash_later, |
5244 |
+@@ -926,27 +931,35 @@ static int omap_sham_update_dma_stop(struct omap_sham_dev *dd) |
5245 |
+ return 0; |
5246 |
+ } |
5247 |
+ |
5248 |
++struct omap_sham_dev *omap_sham_find_dev(struct omap_sham_reqctx *ctx) |
5249 |
++{ |
5250 |
++ struct omap_sham_dev *dd; |
5251 |
++ |
5252 |
++ if (ctx->dd) |
5253 |
++ return ctx->dd; |
5254 |
++ |
5255 |
++ spin_lock_bh(&sham.lock); |
5256 |
++ dd = list_first_entry(&sham.dev_list, struct omap_sham_dev, list); |
5257 |
++ list_move_tail(&dd->list, &sham.dev_list); |
5258 |
++ ctx->dd = dd; |
5259 |
++ spin_unlock_bh(&sham.lock); |
5260 |
++ |
5261 |
++ return dd; |
5262 |
++} |
5263 |
++ |
5264 |
+ static int omap_sham_init(struct ahash_request *req) |
5265 |
+ { |
5266 |
+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
5267 |
+ struct omap_sham_ctx *tctx = crypto_ahash_ctx(tfm); |
5268 |
+ struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
5269 |
+- struct omap_sham_dev *dd = NULL, *tmp; |
5270 |
++ struct omap_sham_dev *dd; |
5271 |
+ int bs = 0; |
5272 |
+ |
5273 |
+- spin_lock_bh(&sham.lock); |
5274 |
+- if (!tctx->dd) { |
5275 |
+- list_for_each_entry(tmp, &sham.dev_list, list) { |
5276 |
+- dd = tmp; |
5277 |
+- break; |
5278 |
+- } |
5279 |
+- tctx->dd = dd; |
5280 |
+- } else { |
5281 |
+- dd = tctx->dd; |
5282 |
+- } |
5283 |
+- spin_unlock_bh(&sham.lock); |
5284 |
++ ctx->dd = NULL; |
5285 |
+ |
5286 |
+- ctx->dd = dd; |
5287 |
++ dd = omap_sham_find_dev(ctx); |
5288 |
++ if (!dd) |
5289 |
++ return -ENODEV; |
5290 |
+ |
5291 |
+ ctx->flags = 0; |
5292 |
+ |
5293 |
+@@ -1216,8 +1229,7 @@ err1: |
5294 |
+ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) |
5295 |
+ { |
5296 |
+ struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
5297 |
+- struct omap_sham_ctx *tctx = crypto_tfm_ctx(req->base.tfm); |
5298 |
+- struct omap_sham_dev *dd = tctx->dd; |
5299 |
++ struct omap_sham_dev *dd = ctx->dd; |
5300 |
+ |
5301 |
+ ctx->op = op; |
5302 |
+ |
5303 |
+@@ -1227,7 +1239,7 @@ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) |
5304 |
+ static int omap_sham_update(struct ahash_request *req) |
5305 |
+ { |
5306 |
+ struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
5307 |
+- struct omap_sham_dev *dd = ctx->dd; |
5308 |
++ struct omap_sham_dev *dd = omap_sham_find_dev(ctx); |
5309 |
+ |
5310 |
+ if (!req->nbytes) |
5311 |
+ return 0; |
5312 |
+@@ -1331,21 +1343,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, |
5313 |
+ struct omap_sham_hmac_ctx *bctx = tctx->base; |
5314 |
+ int bs = crypto_shash_blocksize(bctx->shash); |
5315 |
+ int ds = crypto_shash_digestsize(bctx->shash); |
5316 |
+- struct omap_sham_dev *dd = NULL, *tmp; |
5317 |
+ int err, i; |
5318 |
+ |
5319 |
+- spin_lock_bh(&sham.lock); |
5320 |
+- if (!tctx->dd) { |
5321 |
+- list_for_each_entry(tmp, &sham.dev_list, list) { |
5322 |
+- dd = tmp; |
5323 |
+- break; |
5324 |
+- } |
5325 |
+- tctx->dd = dd; |
5326 |
+- } else { |
5327 |
+- dd = tctx->dd; |
5328 |
+- } |
5329 |
+- spin_unlock_bh(&sham.lock); |
5330 |
+- |
5331 |
+ err = crypto_shash_setkey(tctx->fallback, key, keylen); |
5332 |
+ if (err) |
5333 |
+ return err; |
5334 |
+@@ -1363,7 +1362,7 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, |
5335 |
+ |
5336 |
+ memset(bctx->ipad + keylen, 0, bs - keylen); |
5337 |
+ |
5338 |
+- if (!test_bit(FLAGS_AUTO_XOR, &dd->flags)) { |
5339 |
++ if (!test_bit(FLAGS_AUTO_XOR, &sham.flags)) { |
5340 |
+ memcpy(bctx->opad, bctx->ipad, bs); |
5341 |
+ |
5342 |
+ for (i = 0; i < bs; i++) { |
5343 |
+@@ -2167,6 +2166,7 @@ static int omap_sham_probe(struct platform_device *pdev) |
5344 |
+ } |
5345 |
+ |
5346 |
+ dd->flags |= dd->pdata->flags; |
5347 |
++ sham.flags |= dd->pdata->flags; |
5348 |
+ |
5349 |
+ pm_runtime_use_autosuspend(dev); |
5350 |
+ pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); |
5351 |
+@@ -2194,6 +2194,9 @@ static int omap_sham_probe(struct platform_device *pdev) |
5352 |
+ spin_unlock(&sham.lock); |
5353 |
+ |
5354 |
+ for (i = 0; i < dd->pdata->algs_info_size; i++) { |
5355 |
++ if (dd->pdata->algs_info[i].registered) |
5356 |
++ break; |
5357 |
++ |
5358 |
+ for (j = 0; j < dd->pdata->algs_info[i].size; j++) { |
5359 |
+ struct ahash_alg *alg; |
5360 |
+ |
5361 |
+@@ -2245,9 +2248,11 @@ static int omap_sham_remove(struct platform_device *pdev) |
5362 |
+ list_del(&dd->list); |
5363 |
+ spin_unlock(&sham.lock); |
5364 |
+ for (i = dd->pdata->algs_info_size - 1; i >= 0; i--) |
5365 |
+- for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) |
5366 |
++ for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) { |
5367 |
+ crypto_unregister_ahash( |
5368 |
+ &dd->pdata->algs_info[i].algs_list[j]); |
5369 |
++ dd->pdata->algs_info[i].registered--; |
5370 |
++ } |
5371 |
+ tasklet_kill(&dd->done_task); |
5372 |
+ pm_runtime_disable(&pdev->dev); |
5373 |
+ |
5374 |
+diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c |
5375 |
+index ad02dc6747a4..0317b614b680 100644 |
5376 |
+--- a/drivers/extcon/extcon-adc-jack.c |
5377 |
++++ b/drivers/extcon/extcon-adc-jack.c |
5378 |
+@@ -124,7 +124,7 @@ static int adc_jack_probe(struct platform_device *pdev) |
5379 |
+ for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); |
5380 |
+ data->num_conditions = i; |
5381 |
+ |
5382 |
+- data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); |
5383 |
++ data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); |
5384 |
+ if (IS_ERR(data->chan)) |
5385 |
+ return PTR_ERR(data->chan); |
5386 |
+ |
5387 |
+@@ -164,7 +164,6 @@ static int adc_jack_remove(struct platform_device *pdev) |
5388 |
+ |
5389 |
+ free_irq(data->irq, data); |
5390 |
+ cancel_work_sync(&data->handler.work); |
5391 |
+- iio_channel_release(data->chan); |
5392 |
+ |
5393 |
+ return 0; |
5394 |
+ } |
5395 |
+diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c |
5396 |
+index b3da2e193ad2..176ddd151375 100644 |
5397 |
+--- a/drivers/firmware/imx/imx-scu.c |
5398 |
++++ b/drivers/firmware/imx/imx-scu.c |
5399 |
+@@ -314,6 +314,7 @@ static int imx_scu_probe(struct platform_device *pdev) |
5400 |
+ if (ret != -EPROBE_DEFER) |
5401 |
+ dev_err(dev, "Failed to request mbox chan %s ret %d\n", |
5402 |
+ chan_name, ret); |
5403 |
++ kfree(chan_name); |
5404 |
+ return ret; |
5405 |
+ } |
5406 |
+ |
5407 |
+diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c |
5408 |
+index 059bb0fbae9e..4701487573f7 100644 |
5409 |
+--- a/drivers/firmware/qcom_scm.c |
5410 |
++++ b/drivers/firmware/qcom_scm.c |
5411 |
+@@ -6,7 +6,6 @@ |
5412 |
+ #include <linux/init.h> |
5413 |
+ #include <linux/cpumask.h> |
5414 |
+ #include <linux/export.h> |
5415 |
+-#include <linux/dma-direct.h> |
5416 |
+ #include <linux/dma-mapping.h> |
5417 |
+ #include <linux/module.h> |
5418 |
+ #include <linux/types.h> |
5419 |
+@@ -806,8 +805,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
5420 |
+ struct qcom_scm_mem_map_info *mem_to_map; |
5421 |
+ phys_addr_t mem_to_map_phys; |
5422 |
+ phys_addr_t dest_phys; |
5423 |
+- phys_addr_t ptr_phys; |
5424 |
+- dma_addr_t ptr_dma; |
5425 |
++ dma_addr_t ptr_phys; |
5426 |
+ size_t mem_to_map_sz; |
5427 |
+ size_t dest_sz; |
5428 |
+ size_t src_sz; |
5429 |
+@@ -824,10 +822,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
5430 |
+ ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) + |
5431 |
+ ALIGN(dest_sz, SZ_64); |
5432 |
+ |
5433 |
+- ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_dma, GFP_KERNEL); |
5434 |
++ ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL); |
5435 |
+ if (!ptr) |
5436 |
+ return -ENOMEM; |
5437 |
+- ptr_phys = dma_to_phys(__scm->dev, ptr_dma); |
5438 |
+ |
5439 |
+ /* Fill source vmid detail */ |
5440 |
+ src = ptr; |
5441 |
+@@ -855,7 +852,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
5442 |
+ |
5443 |
+ ret = __qcom_scm_assign_mem(__scm->dev, mem_to_map_phys, mem_to_map_sz, |
5444 |
+ ptr_phys, src_sz, dest_phys, dest_sz); |
5445 |
+- dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_dma); |
5446 |
++ dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_phys); |
5447 |
+ if (ret) { |
5448 |
+ dev_err(__scm->dev, |
5449 |
+ "Assign memory protection call failed %d\n", ret); |
5450 |
+diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c |
5451 |
+index 62f924489db5..5942343a5d6e 100644 |
5452 |
+--- a/drivers/fpga/dfl-afu-dma-region.c |
5453 |
++++ b/drivers/fpga/dfl-afu-dma-region.c |
5454 |
+@@ -61,10 +61,10 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata, |
5455 |
+ region->pages); |
5456 |
+ if (pinned < 0) { |
5457 |
+ ret = pinned; |
5458 |
+- goto put_pages; |
5459 |
++ goto free_pages; |
5460 |
+ } else if (pinned != npages) { |
5461 |
+ ret = -EFAULT; |
5462 |
+- goto free_pages; |
5463 |
++ goto put_pages; |
5464 |
+ } |
5465 |
+ |
5466 |
+ dev_dbg(dev, "%d pages pinned\n", pinned); |
5467 |
+diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c |
5468 |
+index 92e127e74813..ed6061b5cca1 100644 |
5469 |
+--- a/drivers/gpio/gpio-dwapb.c |
5470 |
++++ b/drivers/gpio/gpio-dwapb.c |
5471 |
+@@ -49,7 +49,9 @@ |
5472 |
+ #define GPIO_EXT_PORTC 0x58 |
5473 |
+ #define GPIO_EXT_PORTD 0x5c |
5474 |
+ |
5475 |
++#define DWAPB_DRIVER_NAME "gpio-dwapb" |
5476 |
+ #define DWAPB_MAX_PORTS 4 |
5477 |
++ |
5478 |
+ #define GPIO_EXT_PORT_STRIDE 0x04 /* register stride 32 bits */ |
5479 |
+ #define GPIO_SWPORT_DR_STRIDE 0x0c /* register stride 3*32 bits */ |
5480 |
+ #define GPIO_SWPORT_DDR_STRIDE 0x0c /* register stride 3*32 bits */ |
5481 |
+@@ -398,7 +400,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, |
5482 |
+ return; |
5483 |
+ |
5484 |
+ err = irq_alloc_domain_generic_chips(gpio->domain, ngpio, 2, |
5485 |
+- "gpio-dwapb", handle_level_irq, |
5486 |
++ DWAPB_DRIVER_NAME, handle_level_irq, |
5487 |
+ IRQ_NOREQUEST, 0, |
5488 |
+ IRQ_GC_INIT_NESTED_LOCK); |
5489 |
+ if (err) { |
5490 |
+@@ -455,7 +457,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, |
5491 |
+ */ |
5492 |
+ err = devm_request_irq(gpio->dev, pp->irq[0], |
5493 |
+ dwapb_irq_handler_mfd, |
5494 |
+- IRQF_SHARED, "gpio-dwapb-mfd", gpio); |
5495 |
++ IRQF_SHARED, DWAPB_DRIVER_NAME, gpio); |
5496 |
+ if (err) { |
5497 |
+ dev_err(gpio->dev, "error requesting IRQ\n"); |
5498 |
+ irq_domain_remove(gpio->domain); |
5499 |
+@@ -533,26 +535,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, |
5500 |
+ dwapb_configure_irqs(gpio, port, pp); |
5501 |
+ |
5502 |
+ err = gpiochip_add_data(&port->gc, port); |
5503 |
+- if (err) |
5504 |
++ if (err) { |
5505 |
+ dev_err(gpio->dev, "failed to register gpiochip for port%d\n", |
5506 |
+ port->idx); |
5507 |
+- else |
5508 |
+- port->is_registered = true; |
5509 |
++ return err; |
5510 |
++ } |
5511 |
+ |
5512 |
+ /* Add GPIO-signaled ACPI event support */ |
5513 |
+- if (pp->has_irq) |
5514 |
+- acpi_gpiochip_request_interrupts(&port->gc); |
5515 |
++ acpi_gpiochip_request_interrupts(&port->gc); |
5516 |
+ |
5517 |
+- return err; |
5518 |
++ port->is_registered = true; |
5519 |
++ |
5520 |
++ return 0; |
5521 |
+ } |
5522 |
+ |
5523 |
+ static void dwapb_gpio_unregister(struct dwapb_gpio *gpio) |
5524 |
+ { |
5525 |
+ unsigned int m; |
5526 |
+ |
5527 |
+- for (m = 0; m < gpio->nr_ports; ++m) |
5528 |
+- if (gpio->ports[m].is_registered) |
5529 |
+- gpiochip_remove(&gpio->ports[m].gc); |
5530 |
++ for (m = 0; m < gpio->nr_ports; ++m) { |
5531 |
++ struct dwapb_gpio_port *port = &gpio->ports[m]; |
5532 |
++ |
5533 |
++ if (!port->is_registered) |
5534 |
++ continue; |
5535 |
++ |
5536 |
++ acpi_gpiochip_free_interrupts(&port->gc); |
5537 |
++ gpiochip_remove(&port->gc); |
5538 |
++ } |
5539 |
+ } |
5540 |
+ |
5541 |
+ static struct dwapb_platform_data * |
5542 |
+@@ -836,7 +845,7 @@ static SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops, dwapb_gpio_suspend, |
5543 |
+ |
5544 |
+ static struct platform_driver dwapb_gpio_driver = { |
5545 |
+ .driver = { |
5546 |
+- .name = "gpio-dwapb", |
5547 |
++ .name = DWAPB_DRIVER_NAME, |
5548 |
+ .pm = &dwapb_gpio_pm_ops, |
5549 |
+ .of_match_table = of_match_ptr(dwapb_of_match), |
5550 |
+ .acpi_match_table = ACPI_PTR(dwapb_acpi_match), |
5551 |
+@@ -850,3 +859,4 @@ module_platform_driver(dwapb_gpio_driver); |
5552 |
+ MODULE_LICENSE("GPL"); |
5553 |
+ MODULE_AUTHOR("Jamie Iles"); |
5554 |
+ MODULE_DESCRIPTION("Synopsys DesignWare APB GPIO driver"); |
5555 |
++MODULE_ALIAS("platform:" DWAPB_DRIVER_NAME); |
5556 |
+diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c |
5557 |
+index da570e63589d..cc0dd8593a4b 100644 |
5558 |
+--- a/drivers/gpio/gpio-mlxbf2.c |
5559 |
++++ b/drivers/gpio/gpio-mlxbf2.c |
5560 |
+@@ -110,8 +110,8 @@ static int mlxbf2_gpio_get_lock_res(struct platform_device *pdev) |
5561 |
+ } |
5562 |
+ |
5563 |
+ yu_arm_gpio_lock_param.io = devm_ioremap(dev, res->start, size); |
5564 |
+- if (IS_ERR(yu_arm_gpio_lock_param.io)) |
5565 |
+- ret = PTR_ERR(yu_arm_gpio_lock_param.io); |
5566 |
++ if (!yu_arm_gpio_lock_param.io) |
5567 |
++ ret = -ENOMEM; |
5568 |
+ |
5569 |
+ exit: |
5570 |
+ mutex_unlock(yu_arm_gpio_lock_param.lock); |
5571 |
+diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
5572 |
+index 4269ea9a817e..01011a780688 100644 |
5573 |
+--- a/drivers/gpio/gpio-pca953x.c |
5574 |
++++ b/drivers/gpio/gpio-pca953x.c |
5575 |
+@@ -307,8 +307,22 @@ static const struct regmap_config pca953x_i2c_regmap = { |
5576 |
+ .volatile_reg = pca953x_volatile_register, |
5577 |
+ |
5578 |
+ .cache_type = REGCACHE_RBTREE, |
5579 |
+- /* REVISIT: should be 0x7f but some 24 bit chips use REG_ADDR_AI */ |
5580 |
+- .max_register = 0xff, |
5581 |
++ .max_register = 0x7f, |
5582 |
++}; |
5583 |
++ |
5584 |
++static const struct regmap_config pca953x_ai_i2c_regmap = { |
5585 |
++ .reg_bits = 8, |
5586 |
++ .val_bits = 8, |
5587 |
++ |
5588 |
++ .read_flag_mask = REG_ADDR_AI, |
5589 |
++ .write_flag_mask = REG_ADDR_AI, |
5590 |
++ |
5591 |
++ .readable_reg = pca953x_readable_register, |
5592 |
++ .writeable_reg = pca953x_writeable_register, |
5593 |
++ .volatile_reg = pca953x_volatile_register, |
5594 |
++ |
5595 |
++ .cache_type = REGCACHE_RBTREE, |
5596 |
++ .max_register = 0x7f, |
5597 |
+ }; |
5598 |
+ |
5599 |
+ static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, |
5600 |
+@@ -319,18 +333,6 @@ static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, |
5601 |
+ int pinctrl = (reg & PCAL_PINCTRL_MASK) << 1; |
5602 |
+ u8 regaddr = pinctrl | addr | (off / BANK_SZ); |
5603 |
+ |
5604 |
+- /* Single byte read doesn't need AI bit set. */ |
5605 |
+- if (!addrinc) |
5606 |
+- return regaddr; |
5607 |
+- |
5608 |
+- /* Chips with 24 and more GPIOs always support Auto Increment */ |
5609 |
+- if (write && NBANK(chip) > 2) |
5610 |
+- regaddr |= REG_ADDR_AI; |
5611 |
+- |
5612 |
+- /* PCA9575 needs address-increment on multi-byte writes */ |
5613 |
+- if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) |
5614 |
+- regaddr |= REG_ADDR_AI; |
5615 |
+- |
5616 |
+ return regaddr; |
5617 |
+ } |
5618 |
+ |
5619 |
+@@ -863,6 +865,7 @@ static int pca953x_probe(struct i2c_client *client, |
5620 |
+ int ret; |
5621 |
+ u32 invert = 0; |
5622 |
+ struct regulator *reg; |
5623 |
++ const struct regmap_config *regmap_config; |
5624 |
+ |
5625 |
+ chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
5626 |
+ if (chip == NULL) |
5627 |
+@@ -925,7 +928,17 @@ static int pca953x_probe(struct i2c_client *client, |
5628 |
+ |
5629 |
+ i2c_set_clientdata(client, chip); |
5630 |
+ |
5631 |
+- chip->regmap = devm_regmap_init_i2c(client, &pca953x_i2c_regmap); |
5632 |
++ pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK); |
5633 |
++ |
5634 |
++ if (NBANK(chip) > 2 || PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) { |
5635 |
++ dev_info(&client->dev, "using AI\n"); |
5636 |
++ regmap_config = &pca953x_ai_i2c_regmap; |
5637 |
++ } else { |
5638 |
++ dev_info(&client->dev, "using no AI\n"); |
5639 |
++ regmap_config = &pca953x_i2c_regmap; |
5640 |
++ } |
5641 |
++ |
5642 |
++ chip->regmap = devm_regmap_init_i2c(client, regmap_config); |
5643 |
+ if (IS_ERR(chip->regmap)) { |
5644 |
+ ret = PTR_ERR(chip->regmap); |
5645 |
+ goto err_exit; |
5646 |
+@@ -956,7 +969,6 @@ static int pca953x_probe(struct i2c_client *client, |
5647 |
+ /* initialize cached registers from their original values. |
5648 |
+ * we can't share this chip with another i2c master. |
5649 |
+ */ |
5650 |
+- pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK); |
5651 |
+ |
5652 |
+ if (PCA_CHIP_TYPE(chip->driver_data) == PCA953X_TYPE) { |
5653 |
+ chip->regs = &pca953x_regs; |
5654 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
5655 |
+index c24cad3c64ed..f7cfb8180b71 100644 |
5656 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
5657 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
5658 |
+@@ -40,6 +40,7 @@ |
5659 |
+ #include <drm/drm_file.h> |
5660 |
+ #include <drm/drm_drv.h> |
5661 |
+ #include <drm/drm_device.h> |
5662 |
++#include <drm/drm_ioctl.h> |
5663 |
+ #include <kgd_kfd_interface.h> |
5664 |
+ #include <linux/swap.h> |
5665 |
+ |
5666 |
+@@ -1053,7 +1054,7 @@ static inline int kfd_devcgroup_check_permission(struct kfd_dev *kfd) |
5667 |
+ #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF) |
5668 |
+ struct drm_device *ddev = kfd->ddev; |
5669 |
+ |
5670 |
+- return devcgroup_check_permission(DEVCG_DEV_CHAR, ddev->driver->major, |
5671 |
++ return devcgroup_check_permission(DEVCG_DEV_CHAR, DRM_MAJOR, |
5672 |
+ ddev->render->index, |
5673 |
+ DEVCG_ACC_WRITE | DEVCG_ACC_READ); |
5674 |
+ #else |
5675 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5676 |
+index 7fc15b82fe48..f9f02e08054b 100644 |
5677 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5678 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5679 |
+@@ -1334,7 +1334,7 @@ static int dm_late_init(void *handle) |
5680 |
+ unsigned int linear_lut[16]; |
5681 |
+ int i; |
5682 |
+ struct dmcu *dmcu = adev->dm.dc->res_pool->dmcu; |
5683 |
+- bool ret = false; |
5684 |
++ bool ret; |
5685 |
+ |
5686 |
+ for (i = 0; i < 16; i++) |
5687 |
+ linear_lut[i] = 0xFFFF * i / 15; |
5688 |
+@@ -1350,13 +1350,10 @@ static int dm_late_init(void *handle) |
5689 |
+ */ |
5690 |
+ params.min_abm_backlight = 0x28F; |
5691 |
+ |
5692 |
+- /* todo will enable for navi10 */ |
5693 |
+- if (adev->asic_type <= CHIP_RAVEN) { |
5694 |
+- ret = dmcu_load_iram(dmcu, params); |
5695 |
++ ret = dmcu_load_iram(dmcu, params); |
5696 |
+ |
5697 |
+- if (!ret) |
5698 |
+- return -EINVAL; |
5699 |
+- } |
5700 |
++ if (!ret) |
5701 |
++ return -EINVAL; |
5702 |
+ |
5703 |
+ return detect_mst_link_for_all_connectors(adev->ddev); |
5704 |
+ } |
5705 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
5706 |
+index 47431ca6986d..4acaf4be8a81 100644 |
5707 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
5708 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
5709 |
+@@ -1011,9 +1011,17 @@ static void program_timing_sync( |
5710 |
+ } |
5711 |
+ } |
5712 |
+ |
5713 |
+- /* set first pipe with plane as master */ |
5714 |
++ /* set first unblanked pipe as master */ |
5715 |
+ for (j = 0; j < group_size; j++) { |
5716 |
+- if (pipe_set[j]->plane_state) { |
5717 |
++ bool is_blanked; |
5718 |
++ |
5719 |
++ if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) |
5720 |
++ is_blanked = |
5721 |
++ pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); |
5722 |
++ else |
5723 |
++ is_blanked = |
5724 |
++ pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); |
5725 |
++ if (!is_blanked) { |
5726 |
+ if (j == 0) |
5727 |
+ break; |
5728 |
+ |
5729 |
+@@ -1034,9 +1042,17 @@ static void program_timing_sync( |
5730 |
+ status->timing_sync_info.master = false; |
5731 |
+ |
5732 |
+ } |
5733 |
+- /* remove any other pipes with plane as they have already been synced */ |
5734 |
++ /* remove any other unblanked pipes as they have already been synced */ |
5735 |
+ for (j = j + 1; j < group_size; j++) { |
5736 |
+- if (pipe_set[j]->plane_state) { |
5737 |
++ bool is_blanked; |
5738 |
++ |
5739 |
++ if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) |
5740 |
++ is_blanked = |
5741 |
++ pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); |
5742 |
++ else |
5743 |
++ is_blanked = |
5744 |
++ pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); |
5745 |
++ if (!is_blanked) { |
5746 |
+ group_size--; |
5747 |
+ pipe_set[j] = pipe_set[group_size]; |
5748 |
+ j--; |
5749 |
+@@ -2517,6 +2533,12 @@ void dc_commit_updates_for_stream(struct dc *dc, |
5750 |
+ |
5751 |
+ copy_stream_update_to_stream(dc, context, stream, stream_update); |
5752 |
+ |
5753 |
++ if (!dc->res_pool->funcs->validate_bandwidth(dc, context, false)) { |
5754 |
++ DC_ERROR("Mode validation failed for stream update!\n"); |
5755 |
++ dc_release_state(context); |
5756 |
++ return; |
5757 |
++ } |
5758 |
++ |
5759 |
+ commit_planes_for_stream( |
5760 |
+ dc, |
5761 |
+ srf_updates, |
5762 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5763 |
+index cac09d500fda..e89694eb90b4 100644 |
5764 |
+--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5765 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5766 |
+@@ -843,7 +843,7 @@ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, |
5767 |
+ pow_buffer_ptr = -1; // reset back to no optimize |
5768 |
+ ret = true; |
5769 |
+ release: |
5770 |
+- kfree(coeff); |
5771 |
++ kvfree(coeff); |
5772 |
+ return ret; |
5773 |
+ } |
5774 |
+ |
5775 |
+diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
5776 |
+index 868e2d5f6e62..7c3e903230ca 100644 |
5777 |
+--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
5778 |
++++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
5779 |
+@@ -239,7 +239,7 @@ static void ci_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) |
5780 |
+ |
5781 |
+ switch (dev_id) { |
5782 |
+ case 0x67BA: |
5783 |
+- case 0x66B1: |
5784 |
++ case 0x67B1: |
5785 |
+ smu_data->power_tune_defaults = &defaults_hawaii_pro; |
5786 |
+ break; |
5787 |
+ case 0x67B8: |
5788 |
+diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c |
5789 |
+index 7a9f20a2fd30..e7ba0b6f46d8 100644 |
5790 |
+--- a/drivers/gpu/drm/ast/ast_mode.c |
5791 |
++++ b/drivers/gpu/drm/ast/ast_mode.c |
5792 |
+@@ -226,6 +226,7 @@ static void ast_set_vbios_color_reg(struct ast_private *ast, |
5793 |
+ case 3: |
5794 |
+ case 4: |
5795 |
+ color_index = TrueCModeIndex; |
5796 |
++ break; |
5797 |
+ default: |
5798 |
+ return; |
5799 |
+ } |
5800 |
+@@ -801,6 +802,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, |
5801 |
+ return -EINVAL; |
5802 |
+ } |
5803 |
+ |
5804 |
++ if (!state->enable) |
5805 |
++ return 0; /* no mode checks if CRTC is being disabled */ |
5806 |
++ |
5807 |
+ ast_state = to_ast_crtc_state(state); |
5808 |
+ |
5809 |
+ format = ast_state->format; |
5810 |
+diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c |
5811 |
+index 644f0ad10671..ac9fd96c4c66 100644 |
5812 |
+--- a/drivers/gpu/drm/drm_connector.c |
5813 |
++++ b/drivers/gpu/drm/drm_connector.c |
5814 |
+@@ -27,6 +27,7 @@ |
5815 |
+ #include <drm/drm_print.h> |
5816 |
+ #include <drm/drm_drv.h> |
5817 |
+ #include <drm/drm_file.h> |
5818 |
++#include <drm/drm_sysfs.h> |
5819 |
+ |
5820 |
+ #include <linux/uaccess.h> |
5821 |
+ |
5822 |
+@@ -523,6 +524,10 @@ int drm_connector_register(struct drm_connector *connector) |
5823 |
+ drm_mode_object_register(connector->dev, &connector->base); |
5824 |
+ |
5825 |
+ connector->registration_state = DRM_CONNECTOR_REGISTERED; |
5826 |
++ |
5827 |
++ /* Let userspace know we have a new connector */ |
5828 |
++ drm_sysfs_hotplug_event(connector->dev); |
5829 |
++ |
5830 |
+ goto unlock; |
5831 |
+ |
5832 |
+ err_debugfs: |
5833 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
5834 |
+index 9d89ebf3a749..abb1f358ec6d 100644 |
5835 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
5836 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
5837 |
+@@ -27,6 +27,7 @@ |
5838 |
+ #include <linux/kernel.h> |
5839 |
+ #include <linux/sched.h> |
5840 |
+ #include <linux/seq_file.h> |
5841 |
++#include <linux/iopoll.h> |
5842 |
+ |
5843 |
+ #if IS_ENABLED(CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS) |
5844 |
+ #include <linux/stacktrace.h> |
5845 |
+@@ -4448,6 +4449,17 @@ fail: |
5846 |
+ return ret; |
5847 |
+ } |
5848 |
+ |
5849 |
++static int do_get_act_status(struct drm_dp_aux *aux) |
5850 |
++{ |
5851 |
++ int ret; |
5852 |
++ u8 status; |
5853 |
++ |
5854 |
++ ret = drm_dp_dpcd_readb(aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); |
5855 |
++ if (ret < 0) |
5856 |
++ return ret; |
5857 |
++ |
5858 |
++ return status; |
5859 |
++} |
5860 |
+ |
5861 |
+ /** |
5862 |
+ * drm_dp_check_act_status() - Check ACT handled status. |
5863 |
+@@ -4457,33 +4469,29 @@ fail: |
5864 |
+ */ |
5865 |
+ int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr) |
5866 |
+ { |
5867 |
+- u8 status; |
5868 |
+- int ret; |
5869 |
+- int count = 0; |
5870 |
+- |
5871 |
+- do { |
5872 |
+- ret = drm_dp_dpcd_readb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); |
5873 |
+- |
5874 |
+- if (ret < 0) { |
5875 |
+- DRM_DEBUG_KMS("failed to read payload table status %d\n", ret); |
5876 |
+- goto fail; |
5877 |
+- } |
5878 |
+- |
5879 |
+- if (status & DP_PAYLOAD_ACT_HANDLED) |
5880 |
+- break; |
5881 |
+- count++; |
5882 |
+- udelay(100); |
5883 |
+- |
5884 |
+- } while (count < 30); |
5885 |
+- |
5886 |
+- if (!(status & DP_PAYLOAD_ACT_HANDLED)) { |
5887 |
+- DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n", status, count); |
5888 |
+- ret = -EINVAL; |
5889 |
+- goto fail; |
5890 |
++ /* |
5891 |
++ * There doesn't seem to be any recommended retry count or timeout in |
5892 |
++ * the MST specification. Since some hubs have been observed to take |
5893 |
++ * over 1 second to update their payload allocations under certain |
5894 |
++ * conditions, we use a rather large timeout value. |
5895 |
++ */ |
5896 |
++ const int timeout_ms = 3000; |
5897 |
++ int ret, status; |
5898 |
++ |
5899 |
++ ret = readx_poll_timeout(do_get_act_status, mgr->aux, status, |
5900 |
++ status & DP_PAYLOAD_ACT_HANDLED || status < 0, |
5901 |
++ 200, timeout_ms * USEC_PER_MSEC); |
5902 |
++ if (ret < 0 && status >= 0) { |
5903 |
++ DRM_DEBUG_KMS("Failed to get ACT after %dms, last status: %02x\n", |
5904 |
++ timeout_ms, status); |
5905 |
++ return -EINVAL; |
5906 |
++ } else if (status < 0) { |
5907 |
++ DRM_DEBUG_KMS("Failed to read payload table status: %d\n", |
5908 |
++ status); |
5909 |
++ return status; |
5910 |
+ } |
5911 |
++ |
5912 |
+ return 0; |
5913 |
+-fail: |
5914 |
+- return ret; |
5915 |
+ } |
5916 |
+ EXPORT_SYMBOL(drm_dp_check_act_status); |
5917 |
+ |
5918 |
+diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c |
5919 |
+index cf804389f5ec..d50a7884e69e 100644 |
5920 |
+--- a/drivers/gpu/drm/drm_encoder_slave.c |
5921 |
++++ b/drivers/gpu/drm/drm_encoder_slave.c |
5922 |
+@@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, |
5923 |
+ |
5924 |
+ err = encoder_drv->encoder_init(client, dev, encoder); |
5925 |
+ if (err) |
5926 |
+- goto fail_unregister; |
5927 |
++ goto fail_module_put; |
5928 |
+ |
5929 |
+ if (info->platform_data) |
5930 |
+ encoder->slave_funcs->set_config(&encoder->base, |
5931 |
+@@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev, |
5932 |
+ |
5933 |
+ return 0; |
5934 |
+ |
5935 |
++fail_module_put: |
5936 |
++ module_put(module); |
5937 |
+ fail_unregister: |
5938 |
+ i2c_unregister_device(client); |
5939 |
+- module_put(module); |
5940 |
+ fail: |
5941 |
+ return err; |
5942 |
+ } |
5943 |
+diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c |
5944 |
+index 939f0032aab1..f0336c804639 100644 |
5945 |
+--- a/drivers/gpu/drm/drm_sysfs.c |
5946 |
++++ b/drivers/gpu/drm/drm_sysfs.c |
5947 |
+@@ -291,9 +291,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector) |
5948 |
+ return PTR_ERR(connector->kdev); |
5949 |
+ } |
5950 |
+ |
5951 |
+- /* Let userspace know we have a new connector */ |
5952 |
+- drm_sysfs_hotplug_event(dev); |
5953 |
+- |
5954 |
+ if (connector->ddc) |
5955 |
+ return sysfs_create_link(&connector->kdev->kobj, |
5956 |
+ &connector->ddc->dev.kobj, "ddc"); |
5957 |
+diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c |
5958 |
+index 52db7852827b..647412da733e 100644 |
5959 |
+--- a/drivers/gpu/drm/i915/display/intel_ddi.c |
5960 |
++++ b/drivers/gpu/drm/i915/display/intel_ddi.c |
5961 |
+@@ -2866,7 +2866,7 @@ icl_program_mg_dp_mode(struct intel_digital_port *intel_dig_port, |
5962 |
+ ln1 = intel_de_read(dev_priv, MG_DP_MODE(1, tc_port)); |
5963 |
+ } |
5964 |
+ |
5965 |
+- ln0 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X1_MODE); |
5966 |
++ ln0 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE); |
5967 |
+ ln1 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE); |
5968 |
+ |
5969 |
+ /* DPPATC */ |
5970 |
+diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c |
5971 |
+index a2fafd4499f2..5e228d202e4d 100644 |
5972 |
+--- a/drivers/gpu/drm/i915/display/intel_dp.c |
5973 |
++++ b/drivers/gpu/drm/i915/display/intel_dp.c |
5974 |
+@@ -1343,8 +1343,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, |
5975 |
+ bool is_tc_port = intel_phy_is_tc(i915, phy); |
5976 |
+ i915_reg_t ch_ctl, ch_data[5]; |
5977 |
+ u32 aux_clock_divider; |
5978 |
+- enum intel_display_power_domain aux_domain = |
5979 |
+- intel_aux_power_domain(intel_dig_port); |
5980 |
++ enum intel_display_power_domain aux_domain; |
5981 |
+ intel_wakeref_t aux_wakeref; |
5982 |
+ intel_wakeref_t pps_wakeref; |
5983 |
+ int i, ret, recv_bytes; |
5984 |
+@@ -1359,6 +1358,8 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, |
5985 |
+ if (is_tc_port) |
5986 |
+ intel_tc_port_lock(intel_dig_port); |
5987 |
+ |
5988 |
++ aux_domain = intel_aux_power_domain(intel_dig_port); |
5989 |
++ |
5990 |
+ aux_wakeref = intel_display_power_get(i915, aux_domain); |
5991 |
+ pps_wakeref = pps_lock(intel_dp); |
5992 |
+ |
5993 |
+diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
5994 |
+index 5d5d7eef3f43..7aff3514d97a 100644 |
5995 |
+--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
5996 |
++++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
5997 |
+@@ -39,7 +39,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) |
5998 |
+ unsigned long last_pfn = 0; /* suppress gcc warning */ |
5999 |
+ unsigned int max_segment = i915_sg_segment_size(); |
6000 |
+ unsigned int sg_page_sizes; |
6001 |
+- struct pagevec pvec; |
6002 |
+ gfp_t noreclaim; |
6003 |
+ int ret; |
6004 |
+ |
6005 |
+@@ -192,13 +191,17 @@ err_sg: |
6006 |
+ sg_mark_end(sg); |
6007 |
+ err_pages: |
6008 |
+ mapping_clear_unevictable(mapping); |
6009 |
+- pagevec_init(&pvec); |
6010 |
+- for_each_sgt_page(page, sgt_iter, st) { |
6011 |
+- if (!pagevec_add(&pvec, page)) |
6012 |
++ if (sg != st->sgl) { |
6013 |
++ struct pagevec pvec; |
6014 |
++ |
6015 |
++ pagevec_init(&pvec); |
6016 |
++ for_each_sgt_page(page, sgt_iter, st) { |
6017 |
++ if (!pagevec_add(&pvec, page)) |
6018 |
++ check_release_pagevec(&pvec); |
6019 |
++ } |
6020 |
++ if (pagevec_count(&pvec)) |
6021 |
+ check_release_pagevec(&pvec); |
6022 |
+ } |
6023 |
+- if (pagevec_count(&pvec)) |
6024 |
+- check_release_pagevec(&pvec); |
6025 |
+ sg_free_table(st); |
6026 |
+ kfree(st); |
6027 |
+ |
6028 |
+diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c |
6029 |
+index 883a9b7fe88d..55b9165e7533 100644 |
6030 |
+--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c |
6031 |
++++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c |
6032 |
+@@ -639,7 +639,7 @@ static int engine_setup_common(struct intel_engine_cs *engine) |
6033 |
+ struct measure_breadcrumb { |
6034 |
+ struct i915_request rq; |
6035 |
+ struct intel_ring ring; |
6036 |
+- u32 cs[1024]; |
6037 |
++ u32 cs[2048]; |
6038 |
+ }; |
6039 |
+ |
6040 |
+ static int measure_breadcrumb_dw(struct intel_context *ce) |
6041 |
+@@ -661,6 +661,8 @@ static int measure_breadcrumb_dw(struct intel_context *ce) |
6042 |
+ |
6043 |
+ frame->ring.vaddr = frame->cs; |
6044 |
+ frame->ring.size = sizeof(frame->cs); |
6045 |
++ frame->ring.wrap = |
6046 |
++ BITS_PER_TYPE(frame->ring.size) - ilog2(frame->ring.size); |
6047 |
+ frame->ring.effective_size = frame->ring.size; |
6048 |
+ intel_ring_update_space(&frame->ring); |
6049 |
+ frame->rq.ring = &frame->ring; |
6050 |
+diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c |
6051 |
+index 2dfaddb8811e..ba82193b4e31 100644 |
6052 |
+--- a/drivers/gpu/drm/i915/gt/intel_lrc.c |
6053 |
++++ b/drivers/gpu/drm/i915/gt/intel_lrc.c |
6054 |
+@@ -972,6 +972,13 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine) |
6055 |
+ list_move(&rq->sched.link, pl); |
6056 |
+ set_bit(I915_FENCE_FLAG_PQUEUE, &rq->fence.flags); |
6057 |
+ |
6058 |
++ /* Check in case we rollback so far we wrap [size/2] */ |
6059 |
++ if (intel_ring_direction(rq->ring, |
6060 |
++ intel_ring_wrap(rq->ring, |
6061 |
++ rq->tail), |
6062 |
++ rq->ring->tail) > 0) |
6063 |
++ rq->context->lrc.desc |= CTX_DESC_FORCE_RESTORE; |
6064 |
++ |
6065 |
+ active = rq; |
6066 |
+ } else { |
6067 |
+ struct intel_engine_cs *owner = rq->context->engine; |
6068 |
+@@ -1383,8 +1390,9 @@ static u64 execlists_update_context(struct i915_request *rq) |
6069 |
+ * HW has a tendency to ignore us rewinding the TAIL to the end of |
6070 |
+ * an earlier request. |
6071 |
+ */ |
6072 |
++ GEM_BUG_ON(ce->lrc_reg_state[CTX_RING_TAIL] != rq->ring->tail); |
6073 |
++ prev = rq->ring->tail; |
6074 |
+ tail = intel_ring_set_tail(rq->ring, rq->tail); |
6075 |
+- prev = ce->lrc_reg_state[CTX_RING_TAIL]; |
6076 |
+ if (unlikely(intel_ring_direction(rq->ring, tail, prev) <= 0)) |
6077 |
+ desc |= CTX_DESC_FORCE_RESTORE; |
6078 |
+ ce->lrc_reg_state[CTX_RING_TAIL] = tail; |
6079 |
+@@ -4213,6 +4221,14 @@ static int gen12_emit_flush_render(struct i915_request *request, |
6080 |
+ return 0; |
6081 |
+ } |
6082 |
+ |
6083 |
++static void assert_request_valid(struct i915_request *rq) |
6084 |
++{ |
6085 |
++ struct intel_ring *ring __maybe_unused = rq->ring; |
6086 |
++ |
6087 |
++ /* Can we unwind this request without appearing to go forwards? */ |
6088 |
++ GEM_BUG_ON(intel_ring_direction(ring, rq->wa_tail, rq->head) <= 0); |
6089 |
++} |
6090 |
++ |
6091 |
+ /* |
6092 |
+ * Reserve space for 2 NOOPs at the end of each request to be |
6093 |
+ * used as a workaround for not being allowed to do lite |
6094 |
+@@ -4225,6 +4241,9 @@ static u32 *gen8_emit_wa_tail(struct i915_request *request, u32 *cs) |
6095 |
+ *cs++ = MI_NOOP; |
6096 |
+ request->wa_tail = intel_ring_offset(request, cs); |
6097 |
+ |
6098 |
++ /* Check that entire request is less than half the ring */ |
6099 |
++ assert_request_valid(request); |
6100 |
++ |
6101 |
+ return cs; |
6102 |
+ } |
6103 |
+ |
6104 |
+diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c |
6105 |
+index 8cda1b7e17ba..bdb324167ef3 100644 |
6106 |
+--- a/drivers/gpu/drm/i915/gt/intel_ring.c |
6107 |
++++ b/drivers/gpu/drm/i915/gt/intel_ring.c |
6108 |
+@@ -315,3 +315,7 @@ int intel_ring_cacheline_align(struct i915_request *rq) |
6109 |
+ GEM_BUG_ON(rq->ring->emit & (CACHELINE_BYTES - 1)); |
6110 |
+ return 0; |
6111 |
+ } |
6112 |
++ |
6113 |
++#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) |
6114 |
++#include "selftest_ring.c" |
6115 |
++#endif |
6116 |
+diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c |
6117 |
+index 5176ad1a3976..bb100872cd07 100644 |
6118 |
+--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c |
6119 |
++++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c |
6120 |
+@@ -178,6 +178,12 @@ wa_write_or(struct i915_wa_list *wal, i915_reg_t reg, u32 set) |
6121 |
+ wa_write_masked_or(wal, reg, set, set); |
6122 |
+ } |
6123 |
+ |
6124 |
++static void |
6125 |
++wa_write_clr(struct i915_wa_list *wal, i915_reg_t reg, u32 clr) |
6126 |
++{ |
6127 |
++ wa_write_masked_or(wal, reg, clr, 0); |
6128 |
++} |
6129 |
++ |
6130 |
+ static void |
6131 |
+ wa_masked_en(struct i915_wa_list *wal, i915_reg_t reg, u32 val) |
6132 |
+ { |
6133 |
+@@ -697,6 +703,227 @@ int intel_engine_emit_ctx_wa(struct i915_request *rq) |
6134 |
+ return 0; |
6135 |
+ } |
6136 |
+ |
6137 |
++static void |
6138 |
++gen4_gt_workarounds_init(struct drm_i915_private *i915, |
6139 |
++ struct i915_wa_list *wal) |
6140 |
++{ |
6141 |
++ /* WaDisable_RenderCache_OperationalFlush:gen4,ilk */ |
6142 |
++ wa_masked_dis(wal, CACHE_MODE_0, RC_OP_FLUSH_ENABLE); |
6143 |
++} |
6144 |
++ |
6145 |
++static void |
6146 |
++g4x_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6147 |
++{ |
6148 |
++ gen4_gt_workarounds_init(i915, wal); |
6149 |
++ |
6150 |
++ /* WaDisableRenderCachePipelinedFlush:g4x,ilk */ |
6151 |
++ wa_masked_en(wal, CACHE_MODE_0, CM0_PIPELINED_RENDER_FLUSH_DISABLE); |
6152 |
++} |
6153 |
++ |
6154 |
++static void |
6155 |
++ilk_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6156 |
++{ |
6157 |
++ g4x_gt_workarounds_init(i915, wal); |
6158 |
++ |
6159 |
++ wa_masked_en(wal, _3D_CHICKEN2, _3D_CHICKEN2_WM_READ_PIPELINED); |
6160 |
++} |
6161 |
++ |
6162 |
++static void |
6163 |
++snb_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6164 |
++{ |
6165 |
++ /* WaDisableHiZPlanesWhenMSAAEnabled:snb */ |
6166 |
++ wa_masked_en(wal, |
6167 |
++ _3D_CHICKEN, |
6168 |
++ _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB); |
6169 |
++ |
6170 |
++ /* WaDisable_RenderCache_OperationalFlush:snb */ |
6171 |
++ wa_masked_dis(wal, CACHE_MODE_0, RC_OP_FLUSH_ENABLE); |
6172 |
++ |
6173 |
++ /* |
6174 |
++ * BSpec recommends 8x4 when MSAA is used, |
6175 |
++ * however in practice 16x4 seems fastest. |
6176 |
++ * |
6177 |
++ * Note that PS/WM thread counts depend on the WIZ hashing |
6178 |
++ * disable bit, which we don't touch here, but it's good |
6179 |
++ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6180 |
++ */ |
6181 |
++ wa_add(wal, |
6182 |
++ GEN6_GT_MODE, 0, |
6183 |
++ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6184 |
++ GEN6_WIZ_HASHING_16x4); |
6185 |
++ |
6186 |
++ wa_masked_dis(wal, CACHE_MODE_0, CM0_STC_EVICT_DISABLE_LRA_SNB); |
6187 |
++ |
6188 |
++ wa_masked_en(wal, |
6189 |
++ _3D_CHICKEN3, |
6190 |
++ /* WaStripsFansDisableFastClipPerformanceFix:snb */ |
6191 |
++ _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL | |
6192 |
++ /* |
6193 |
++ * Bspec says: |
6194 |
++ * "This bit must be set if 3DSTATE_CLIP clip mode is set |
6195 |
++ * to normal and 3DSTATE_SF number of SF output attributes |
6196 |
++ * is more than 16." |
6197 |
++ */ |
6198 |
++ _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH); |
6199 |
++} |
6200 |
++ |
6201 |
++static void |
6202 |
++ivb_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6203 |
++{ |
6204 |
++ /* WaDisableEarlyCull:ivb */ |
6205 |
++ wa_masked_en(wal, _3D_CHICKEN3, _3D_CHICKEN_SF_DISABLE_OBJEND_CULL); |
6206 |
++ |
6207 |
++ /* WaDisablePSDDualDispatchEnable:ivb */ |
6208 |
++ if (IS_IVB_GT1(i915)) |
6209 |
++ wa_masked_en(wal, |
6210 |
++ GEN7_HALF_SLICE_CHICKEN1, |
6211 |
++ GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE); |
6212 |
++ |
6213 |
++ /* WaDisable_RenderCache_OperationalFlush:ivb */ |
6214 |
++ wa_masked_dis(wal, CACHE_MODE_0_GEN7, RC_OP_FLUSH_ENABLE); |
6215 |
++ |
6216 |
++ /* Apply the WaDisableRHWOOptimizationForRenderHang:ivb workaround. */ |
6217 |
++ wa_masked_dis(wal, |
6218 |
++ GEN7_COMMON_SLICE_CHICKEN1, |
6219 |
++ GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC); |
6220 |
++ |
6221 |
++ /* WaApplyL3ControlAndL3ChickenMode:ivb */ |
6222 |
++ wa_write(wal, GEN7_L3CNTLREG1, GEN7_WA_FOR_GEN7_L3_CONTROL); |
6223 |
++ wa_write(wal, GEN7_L3_CHICKEN_MODE_REGISTER, GEN7_WA_L3_CHICKEN_MODE); |
6224 |
++ |
6225 |
++ /* WaForceL3Serialization:ivb */ |
6226 |
++ wa_write_clr(wal, GEN7_L3SQCREG4, L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6227 |
++ |
6228 |
++ /* |
6229 |
++ * WaVSThreadDispatchOverride:ivb,vlv |
6230 |
++ * |
6231 |
++ * This actually overrides the dispatch |
6232 |
++ * mode for all thread types. |
6233 |
++ */ |
6234 |
++ wa_write_masked_or(wal, GEN7_FF_THREAD_MODE, |
6235 |
++ GEN7_FF_SCHED_MASK, |
6236 |
++ GEN7_FF_TS_SCHED_HW | |
6237 |
++ GEN7_FF_VS_SCHED_HW | |
6238 |
++ GEN7_FF_DS_SCHED_HW); |
6239 |
++ |
6240 |
++ if (0) { /* causes HiZ corruption on ivb:gt1 */ |
6241 |
++ /* enable HiZ Raw Stall Optimization */ |
6242 |
++ wa_masked_dis(wal, CACHE_MODE_0_GEN7, HIZ_RAW_STALL_OPT_DISABLE); |
6243 |
++ } |
6244 |
++ |
6245 |
++ /* WaDisable4x2SubspanOptimization:ivb */ |
6246 |
++ wa_masked_en(wal, CACHE_MODE_1, PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
6247 |
++ |
6248 |
++ /* |
6249 |
++ * BSpec recommends 8x4 when MSAA is used, |
6250 |
++ * however in practice 16x4 seems fastest. |
6251 |
++ * |
6252 |
++ * Note that PS/WM thread counts depend on the WIZ hashing |
6253 |
++ * disable bit, which we don't touch here, but it's good |
6254 |
++ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6255 |
++ */ |
6256 |
++ wa_add(wal, GEN7_GT_MODE, 0, |
6257 |
++ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6258 |
++ GEN6_WIZ_HASHING_16x4); |
6259 |
++} |
6260 |
++ |
6261 |
++static void |
6262 |
++vlv_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6263 |
++{ |
6264 |
++ /* WaDisableEarlyCull:vlv */ |
6265 |
++ wa_masked_en(wal, _3D_CHICKEN3, _3D_CHICKEN_SF_DISABLE_OBJEND_CULL); |
6266 |
++ |
6267 |
++ /* WaPsdDispatchEnable:vlv */ |
6268 |
++ /* WaDisablePSDDualDispatchEnable:vlv */ |
6269 |
++ wa_masked_en(wal, |
6270 |
++ GEN7_HALF_SLICE_CHICKEN1, |
6271 |
++ GEN7_MAX_PS_THREAD_DEP | |
6272 |
++ GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE); |
6273 |
++ |
6274 |
++ /* WaDisable_RenderCache_OperationalFlush:vlv */ |
6275 |
++ wa_masked_dis(wal, CACHE_MODE_0_GEN7, RC_OP_FLUSH_ENABLE); |
6276 |
++ |
6277 |
++ /* WaForceL3Serialization:vlv */ |
6278 |
++ wa_write_clr(wal, GEN7_L3SQCREG4, L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6279 |
++ |
6280 |
++ /* |
6281 |
++ * WaVSThreadDispatchOverride:ivb,vlv |
6282 |
++ * |
6283 |
++ * This actually overrides the dispatch |
6284 |
++ * mode for all thread types. |
6285 |
++ */ |
6286 |
++ wa_write_masked_or(wal, |
6287 |
++ GEN7_FF_THREAD_MODE, |
6288 |
++ GEN7_FF_SCHED_MASK, |
6289 |
++ GEN7_FF_TS_SCHED_HW | |
6290 |
++ GEN7_FF_VS_SCHED_HW | |
6291 |
++ GEN7_FF_DS_SCHED_HW); |
6292 |
++ |
6293 |
++ /* |
6294 |
++ * BSpec says this must be set, even though |
6295 |
++ * WaDisable4x2SubspanOptimization isn't listed for VLV. |
6296 |
++ */ |
6297 |
++ wa_masked_en(wal, CACHE_MODE_1, PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
6298 |
++ |
6299 |
++ /* |
6300 |
++ * BSpec recommends 8x4 when MSAA is used, |
6301 |
++ * however in practice 16x4 seems fastest. |
6302 |
++ * |
6303 |
++ * Note that PS/WM thread counts depend on the WIZ hashing |
6304 |
++ * disable bit, which we don't touch here, but it's good |
6305 |
++ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6306 |
++ */ |
6307 |
++ wa_add(wal, GEN7_GT_MODE, 0, |
6308 |
++ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6309 |
++ GEN6_WIZ_HASHING_16x4); |
6310 |
++ |
6311 |
++ /* |
6312 |
++ * WaIncreaseL3CreditsForVLVB0:vlv |
6313 |
++ * This is the hardware default actually. |
6314 |
++ */ |
6315 |
++ wa_write(wal, GEN7_L3SQCREG1, VLV_B0_WA_L3SQCREG1_VALUE); |
6316 |
++} |
6317 |
++ |
6318 |
++static void |
6319 |
++hsw_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6320 |
++{ |
6321 |
++ /* L3 caching of data atomics doesn't work -- disable it. */ |
6322 |
++ wa_write(wal, HSW_SCRATCH1, HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE); |
6323 |
++ |
6324 |
++ wa_add(wal, |
6325 |
++ HSW_ROW_CHICKEN3, 0, |
6326 |
++ _MASKED_BIT_ENABLE(HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE), |
6327 |
++ 0 /* XXX does this reg exist? */); |
6328 |
++ |
6329 |
++ /* WaVSRefCountFullforceMissDisable:hsw */ |
6330 |
++ wa_write_clr(wal, GEN7_FF_THREAD_MODE, GEN7_FF_VS_REF_CNT_FFME); |
6331 |
++ |
6332 |
++ wa_masked_dis(wal, |
6333 |
++ CACHE_MODE_0_GEN7, |
6334 |
++ /* WaDisable_RenderCache_OperationalFlush:hsw */ |
6335 |
++ RC_OP_FLUSH_ENABLE | |
6336 |
++ /* enable HiZ Raw Stall Optimization */ |
6337 |
++ HIZ_RAW_STALL_OPT_DISABLE); |
6338 |
++ |
6339 |
++ /* WaDisable4x2SubspanOptimization:hsw */ |
6340 |
++ wa_masked_en(wal, CACHE_MODE_1, PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
6341 |
++ |
6342 |
++ /* |
6343 |
++ * BSpec recommends 8x4 when MSAA is used, |
6344 |
++ * however in practice 16x4 seems fastest. |
6345 |
++ * |
6346 |
++ * Note that PS/WM thread counts depend on the WIZ hashing |
6347 |
++ * disable bit, which we don't touch here, but it's good |
6348 |
++ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6349 |
++ */ |
6350 |
++ wa_add(wal, GEN7_GT_MODE, 0, |
6351 |
++ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6352 |
++ GEN6_WIZ_HASHING_16x4); |
6353 |
++ |
6354 |
++ /* WaSampleCChickenBitEnable:hsw */ |
6355 |
++ wa_masked_en(wal, HALF_SLICE_CHICKEN3, HSW_SAMPLE_C_PERFORMANCE); |
6356 |
++} |
6357 |
++ |
6358 |
+ static void |
6359 |
+ gen9_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6360 |
+ { |
6361 |
+@@ -974,6 +1201,20 @@ gt_init_workarounds(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6362 |
+ bxt_gt_workarounds_init(i915, wal); |
6363 |
+ else if (IS_SKYLAKE(i915)) |
6364 |
+ skl_gt_workarounds_init(i915, wal); |
6365 |
++ else if (IS_HASWELL(i915)) |
6366 |
++ hsw_gt_workarounds_init(i915, wal); |
6367 |
++ else if (IS_VALLEYVIEW(i915)) |
6368 |
++ vlv_gt_workarounds_init(i915, wal); |
6369 |
++ else if (IS_IVYBRIDGE(i915)) |
6370 |
++ ivb_gt_workarounds_init(i915, wal); |
6371 |
++ else if (IS_GEN(i915, 6)) |
6372 |
++ snb_gt_workarounds_init(i915, wal); |
6373 |
++ else if (IS_GEN(i915, 5)) |
6374 |
++ ilk_gt_workarounds_init(i915, wal); |
6375 |
++ else if (IS_G4X(i915)) |
6376 |
++ g4x_gt_workarounds_init(i915, wal); |
6377 |
++ else if (IS_GEN(i915, 4)) |
6378 |
++ gen4_gt_workarounds_init(i915, wal); |
6379 |
+ else if (INTEL_GEN(i915) <= 8) |
6380 |
+ return; |
6381 |
+ else |
6382 |
+@@ -1379,12 +1620,6 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) |
6383 |
+ GEN7_FF_THREAD_MODE, |
6384 |
+ GEN12_FF_TESSELATION_DOP_GATE_DISABLE); |
6385 |
+ |
6386 |
+- /* |
6387 |
+- * Wa_1409085225:tgl |
6388 |
+- * Wa_14010229206:tgl |
6389 |
+- */ |
6390 |
+- wa_masked_en(wal, GEN9_ROW_CHICKEN4, GEN12_DISABLE_TDL_PUSH); |
6391 |
+- |
6392 |
+ /* Wa_1408615072:tgl */ |
6393 |
+ wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2, |
6394 |
+ VSUNIT_CLKGATE_DIS_TGL); |
6395 |
+@@ -1402,6 +1637,12 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) |
6396 |
+ wa_masked_en(wal, |
6397 |
+ GEN9_CS_DEBUG_MODE1, |
6398 |
+ FF_DOP_CLOCK_GATE_DISABLE); |
6399 |
++ |
6400 |
++ /* |
6401 |
++ * Wa_1409085225:tgl |
6402 |
++ * Wa_14010229206:tgl |
6403 |
++ */ |
6404 |
++ wa_masked_en(wal, GEN9_ROW_CHICKEN4, GEN12_DISABLE_TDL_PUSH); |
6405 |
+ } |
6406 |
+ |
6407 |
+ if (IS_GEN(i915, 11)) { |
6408 |
+diff --git a/drivers/gpu/drm/i915/gt/selftest_mocs.c b/drivers/gpu/drm/i915/gt/selftest_mocs.c |
6409 |
+index 8831ffee2061..63f87d8608c3 100644 |
6410 |
+--- a/drivers/gpu/drm/i915/gt/selftest_mocs.c |
6411 |
++++ b/drivers/gpu/drm/i915/gt/selftest_mocs.c |
6412 |
+@@ -18,6 +18,20 @@ struct live_mocs { |
6413 |
+ void *vaddr; |
6414 |
+ }; |
6415 |
+ |
6416 |
++static struct intel_context *mocs_context_create(struct intel_engine_cs *engine) |
6417 |
++{ |
6418 |
++ struct intel_context *ce; |
6419 |
++ |
6420 |
++ ce = intel_context_create(engine); |
6421 |
++ if (IS_ERR(ce)) |
6422 |
++ return ce; |
6423 |
++ |
6424 |
++ /* We build large requests to read the registers from the ring */ |
6425 |
++ ce->ring = __intel_context_ring_size(SZ_16K); |
6426 |
++ |
6427 |
++ return ce; |
6428 |
++} |
6429 |
++ |
6430 |
+ static int request_add_sync(struct i915_request *rq, int err) |
6431 |
+ { |
6432 |
+ i915_request_get(rq); |
6433 |
+@@ -301,7 +315,7 @@ static int live_mocs_clean(void *arg) |
6434 |
+ for_each_engine(engine, gt, id) { |
6435 |
+ struct intel_context *ce; |
6436 |
+ |
6437 |
+- ce = intel_context_create(engine); |
6438 |
++ ce = mocs_context_create(engine); |
6439 |
+ if (IS_ERR(ce)) { |
6440 |
+ err = PTR_ERR(ce); |
6441 |
+ break; |
6442 |
+@@ -395,7 +409,7 @@ static int live_mocs_reset(void *arg) |
6443 |
+ for_each_engine(engine, gt, id) { |
6444 |
+ struct intel_context *ce; |
6445 |
+ |
6446 |
+- ce = intel_context_create(engine); |
6447 |
++ ce = mocs_context_create(engine); |
6448 |
+ if (IS_ERR(ce)) { |
6449 |
+ err = PTR_ERR(ce); |
6450 |
+ break; |
6451 |
+diff --git a/drivers/gpu/drm/i915/gt/selftest_ring.c b/drivers/gpu/drm/i915/gt/selftest_ring.c |
6452 |
+new file mode 100644 |
6453 |
+index 000000000000..2a8c534dc125 |
6454 |
+--- /dev/null |
6455 |
++++ b/drivers/gpu/drm/i915/gt/selftest_ring.c |
6456 |
+@@ -0,0 +1,110 @@ |
6457 |
++// SPDX-License-Identifier: GPL-2.0 |
6458 |
++/* |
6459 |
++ * Copyright © 2020 Intel Corporation |
6460 |
++ */ |
6461 |
++ |
6462 |
++static struct intel_ring *mock_ring(unsigned long sz) |
6463 |
++{ |
6464 |
++ struct intel_ring *ring; |
6465 |
++ |
6466 |
++ ring = kzalloc(sizeof(*ring) + sz, GFP_KERNEL); |
6467 |
++ if (!ring) |
6468 |
++ return NULL; |
6469 |
++ |
6470 |
++ kref_init(&ring->ref); |
6471 |
++ ring->size = sz; |
6472 |
++ ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(sz); |
6473 |
++ ring->effective_size = sz; |
6474 |
++ ring->vaddr = (void *)(ring + 1); |
6475 |
++ atomic_set(&ring->pin_count, 1); |
6476 |
++ |
6477 |
++ intel_ring_update_space(ring); |
6478 |
++ |
6479 |
++ return ring; |
6480 |
++} |
6481 |
++ |
6482 |
++static void mock_ring_free(struct intel_ring *ring) |
6483 |
++{ |
6484 |
++ kfree(ring); |
6485 |
++} |
6486 |
++ |
6487 |
++static int check_ring_direction(struct intel_ring *ring, |
6488 |
++ u32 next, u32 prev, |
6489 |
++ int expected) |
6490 |
++{ |
6491 |
++ int result; |
6492 |
++ |
6493 |
++ result = intel_ring_direction(ring, next, prev); |
6494 |
++ if (result < 0) |
6495 |
++ result = -1; |
6496 |
++ else if (result > 0) |
6497 |
++ result = 1; |
6498 |
++ |
6499 |
++ if (result != expected) { |
6500 |
++ pr_err("intel_ring_direction(%u, %u):%d != %d\n", |
6501 |
++ next, prev, result, expected); |
6502 |
++ return -EINVAL; |
6503 |
++ } |
6504 |
++ |
6505 |
++ return 0; |
6506 |
++} |
6507 |
++ |
6508 |
++static int check_ring_step(struct intel_ring *ring, u32 x, u32 step) |
6509 |
++{ |
6510 |
++ u32 prev = x, next = intel_ring_wrap(ring, x + step); |
6511 |
++ int err = 0; |
6512 |
++ |
6513 |
++ err |= check_ring_direction(ring, next, next, 0); |
6514 |
++ err |= check_ring_direction(ring, prev, prev, 0); |
6515 |
++ err |= check_ring_direction(ring, next, prev, 1); |
6516 |
++ err |= check_ring_direction(ring, prev, next, -1); |
6517 |
++ |
6518 |
++ return err; |
6519 |
++} |
6520 |
++ |
6521 |
++static int check_ring_offset(struct intel_ring *ring, u32 x, u32 step) |
6522 |
++{ |
6523 |
++ int err = 0; |
6524 |
++ |
6525 |
++ err |= check_ring_step(ring, x, step); |
6526 |
++ err |= check_ring_step(ring, intel_ring_wrap(ring, x + 1), step); |
6527 |
++ err |= check_ring_step(ring, intel_ring_wrap(ring, x - 1), step); |
6528 |
++ |
6529 |
++ return err; |
6530 |
++} |
6531 |
++ |
6532 |
++static int igt_ring_direction(void *dummy) |
6533 |
++{ |
6534 |
++ struct intel_ring *ring; |
6535 |
++ unsigned int half = 2048; |
6536 |
++ int step, err = 0; |
6537 |
++ |
6538 |
++ ring = mock_ring(2 * half); |
6539 |
++ if (!ring) |
6540 |
++ return -ENOMEM; |
6541 |
++ |
6542 |
++ GEM_BUG_ON(ring->size != 2 * half); |
6543 |
++ |
6544 |
++ /* Precision of wrap detection is limited to ring->size / 2 */ |
6545 |
++ for (step = 1; step < half; step <<= 1) { |
6546 |
++ err |= check_ring_offset(ring, 0, step); |
6547 |
++ err |= check_ring_offset(ring, half, step); |
6548 |
++ } |
6549 |
++ err |= check_ring_step(ring, 0, half - 64); |
6550 |
++ |
6551 |
++ /* And check unwrapped handling for good measure */ |
6552 |
++ err |= check_ring_offset(ring, 0, 2 * half + 64); |
6553 |
++ err |= check_ring_offset(ring, 3 * half, 1); |
6554 |
++ |
6555 |
++ mock_ring_free(ring); |
6556 |
++ return err; |
6557 |
++} |
6558 |
++ |
6559 |
++int intel_ring_mock_selftests(void) |
6560 |
++{ |
6561 |
++ static const struct i915_subtest tests[] = { |
6562 |
++ SUBTEST(igt_ring_direction), |
6563 |
++ }; |
6564 |
++ |
6565 |
++ return i915_subtests(tests, NULL); |
6566 |
++} |
6567 |
+diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c |
6568 |
+index 189b573d02be..372354d33f55 100644 |
6569 |
+--- a/drivers/gpu/drm/i915/i915_cmd_parser.c |
6570 |
++++ b/drivers/gpu/drm/i915/i915_cmd_parser.c |
6571 |
+@@ -572,6 +572,9 @@ struct drm_i915_reg_descriptor { |
6572 |
+ #define REG32(_reg, ...) \ |
6573 |
+ { .addr = (_reg), __VA_ARGS__ } |
6574 |
+ |
6575 |
++#define REG32_IDX(_reg, idx) \ |
6576 |
++ { .addr = _reg(idx) } |
6577 |
++ |
6578 |
+ /* |
6579 |
+ * Convenience macro for adding 64-bit registers. |
6580 |
+ * |
6581 |
+@@ -669,6 +672,7 @@ static const struct drm_i915_reg_descriptor gen9_blt_regs[] = { |
6582 |
+ REG64_IDX(RING_TIMESTAMP, BSD_RING_BASE), |
6583 |
+ REG32(BCS_SWCTRL), |
6584 |
+ REG64_IDX(RING_TIMESTAMP, BLT_RING_BASE), |
6585 |
++ REG32_IDX(RING_CTX_TIMESTAMP, BLT_RING_BASE), |
6586 |
+ REG64_IDX(BCS_GPR, 0), |
6587 |
+ REG64_IDX(BCS_GPR, 1), |
6588 |
+ REG64_IDX(BCS_GPR, 2), |
6589 |
+diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
6590 |
+index 8a2b83807ffc..bd042725a678 100644 |
6591 |
+--- a/drivers/gpu/drm/i915/i915_irq.c |
6592 |
++++ b/drivers/gpu/drm/i915/i915_irq.c |
6593 |
+@@ -3092,6 +3092,7 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv) |
6594 |
+ |
6595 |
+ val = I915_READ(GEN11_DE_HPD_IMR); |
6596 |
+ val &= ~hotplug_irqs; |
6597 |
++ val |= ~enabled_irqs & hotplug_irqs; |
6598 |
+ I915_WRITE(GEN11_DE_HPD_IMR, val); |
6599 |
+ POSTING_READ(GEN11_DE_HPD_IMR); |
6600 |
+ |
6601 |
+diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
6602 |
+index 6e12000c4b6b..a41be9357d15 100644 |
6603 |
+--- a/drivers/gpu/drm/i915/i915_reg.h |
6604 |
++++ b/drivers/gpu/drm/i915/i915_reg.h |
6605 |
+@@ -7819,7 +7819,7 @@ enum { |
6606 |
+ |
6607 |
+ /* GEN7 chicken */ |
6608 |
+ #define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010) |
6609 |
+- #define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC ((1 << 10) | (1 << 26)) |
6610 |
++ #define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC (1 << 10) |
6611 |
+ #define GEN9_RHWO_OPTIMIZATION_DISABLE (1 << 14) |
6612 |
+ |
6613 |
+ #define COMMON_SLICE_CHICKEN2 _MMIO(0x7014) |
6614 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
6615 |
+index a52986a9e7a6..20c1683fda24 100644 |
6616 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
6617 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
6618 |
+@@ -6593,16 +6593,6 @@ static void ilk_init_clock_gating(struct drm_i915_private *dev_priv) |
6619 |
+ I915_WRITE(ILK_DISPLAY_CHICKEN2, |
6620 |
+ I915_READ(ILK_DISPLAY_CHICKEN2) | |
6621 |
+ ILK_ELPIN_409_SELECT); |
6622 |
+- I915_WRITE(_3D_CHICKEN2, |
6623 |
+- _3D_CHICKEN2_WM_READ_PIPELINED << 16 | |
6624 |
+- _3D_CHICKEN2_WM_READ_PIPELINED); |
6625 |
+- |
6626 |
+- /* WaDisableRenderCachePipelinedFlush:ilk */ |
6627 |
+- I915_WRITE(CACHE_MODE_0, |
6628 |
+- _MASKED_BIT_ENABLE(CM0_PIPELINED_RENDER_FLUSH_DISABLE)); |
6629 |
+- |
6630 |
+- /* WaDisable_RenderCache_OperationalFlush:ilk */ |
6631 |
+- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6632 |
+ |
6633 |
+ g4x_disable_trickle_feed(dev_priv); |
6634 |
+ |
6635 |
+@@ -6665,27 +6655,6 @@ static void gen6_init_clock_gating(struct drm_i915_private *dev_priv) |
6636 |
+ I915_READ(ILK_DISPLAY_CHICKEN2) | |
6637 |
+ ILK_ELPIN_409_SELECT); |
6638 |
+ |
6639 |
+- /* WaDisableHiZPlanesWhenMSAAEnabled:snb */ |
6640 |
+- I915_WRITE(_3D_CHICKEN, |
6641 |
+- _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); |
6642 |
+- |
6643 |
+- /* WaDisable_RenderCache_OperationalFlush:snb */ |
6644 |
+- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6645 |
+- |
6646 |
+- /* |
6647 |
+- * BSpec recoomends 8x4 when MSAA is used, |
6648 |
+- * however in practice 16x4 seems fastest. |
6649 |
+- * |
6650 |
+- * Note that PS/WM thread counts depend on the WIZ hashing |
6651 |
+- * disable bit, which we don't touch here, but it's good |
6652 |
+- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6653 |
+- */ |
6654 |
+- I915_WRITE(GEN6_GT_MODE, |
6655 |
+- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6656 |
+- |
6657 |
+- I915_WRITE(CACHE_MODE_0, |
6658 |
+- _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB)); |
6659 |
+- |
6660 |
+ I915_WRITE(GEN6_UCGCTL1, |
6661 |
+ I915_READ(GEN6_UCGCTL1) | |
6662 |
+ GEN6_BLBUNIT_CLOCK_GATE_DISABLE | |
6663 |
+@@ -6708,18 +6677,6 @@ static void gen6_init_clock_gating(struct drm_i915_private *dev_priv) |
6664 |
+ GEN6_RCPBUNIT_CLOCK_GATE_DISABLE | |
6665 |
+ GEN6_RCCUNIT_CLOCK_GATE_DISABLE); |
6666 |
+ |
6667 |
+- /* WaStripsFansDisableFastClipPerformanceFix:snb */ |
6668 |
+- I915_WRITE(_3D_CHICKEN3, |
6669 |
+- _MASKED_BIT_ENABLE(_3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL)); |
6670 |
+- |
6671 |
+- /* |
6672 |
+- * Bspec says: |
6673 |
+- * "This bit must be set if 3DSTATE_CLIP clip mode is set to normal and |
6674 |
+- * 3DSTATE_SF number of SF output attributes is more than 16." |
6675 |
+- */ |
6676 |
+- I915_WRITE(_3D_CHICKEN3, |
6677 |
+- _MASKED_BIT_ENABLE(_3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH)); |
6678 |
+- |
6679 |
+ /* |
6680 |
+ * According to the spec the following bits should be |
6681 |
+ * set in order to enable memory self-refresh and fbc: |
6682 |
+@@ -6749,24 +6706,6 @@ static void gen6_init_clock_gating(struct drm_i915_private *dev_priv) |
6683 |
+ gen6_check_mch_setup(dev_priv); |
6684 |
+ } |
6685 |
+ |
6686 |
+-static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv) |
6687 |
+-{ |
6688 |
+- u32 reg = I915_READ(GEN7_FF_THREAD_MODE); |
6689 |
+- |
6690 |
+- /* |
6691 |
+- * WaVSThreadDispatchOverride:ivb,vlv |
6692 |
+- * |
6693 |
+- * This actually overrides the dispatch |
6694 |
+- * mode for all thread types. |
6695 |
+- */ |
6696 |
+- reg &= ~GEN7_FF_SCHED_MASK; |
6697 |
+- reg |= GEN7_FF_TS_SCHED_HW; |
6698 |
+- reg |= GEN7_FF_VS_SCHED_HW; |
6699 |
+- reg |= GEN7_FF_DS_SCHED_HW; |
6700 |
+- |
6701 |
+- I915_WRITE(GEN7_FF_THREAD_MODE, reg); |
6702 |
+-} |
6703 |
+- |
6704 |
+ static void lpt_init_clock_gating(struct drm_i915_private *dev_priv) |
6705 |
+ { |
6706 |
+ /* |
6707 |
+@@ -6992,45 +6931,10 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) |
6708 |
+ |
6709 |
+ static void hsw_init_clock_gating(struct drm_i915_private *dev_priv) |
6710 |
+ { |
6711 |
+- /* L3 caching of data atomics doesn't work -- disable it. */ |
6712 |
+- I915_WRITE(HSW_SCRATCH1, HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE); |
6713 |
+- I915_WRITE(HSW_ROW_CHICKEN3, |
6714 |
+- _MASKED_BIT_ENABLE(HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE)); |
6715 |
+- |
6716 |
+ /* This is required by WaCatErrorRejectionIssue:hsw */ |
6717 |
+ I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, |
6718 |
+- I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
6719 |
+- GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); |
6720 |
+- |
6721 |
+- /* WaVSRefCountFullforceMissDisable:hsw */ |
6722 |
+- I915_WRITE(GEN7_FF_THREAD_MODE, |
6723 |
+- I915_READ(GEN7_FF_THREAD_MODE) & ~GEN7_FF_VS_REF_CNT_FFME); |
6724 |
+- |
6725 |
+- /* WaDisable_RenderCache_OperationalFlush:hsw */ |
6726 |
+- I915_WRITE(CACHE_MODE_0_GEN7, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6727 |
+- |
6728 |
+- /* enable HiZ Raw Stall Optimization */ |
6729 |
+- I915_WRITE(CACHE_MODE_0_GEN7, |
6730 |
+- _MASKED_BIT_DISABLE(HIZ_RAW_STALL_OPT_DISABLE)); |
6731 |
+- |
6732 |
+- /* WaDisable4x2SubspanOptimization:hsw */ |
6733 |
+- I915_WRITE(CACHE_MODE_1, |
6734 |
+- _MASKED_BIT_ENABLE(PIXEL_SUBSPAN_COLLECT_OPT_DISABLE)); |
6735 |
+- |
6736 |
+- /* |
6737 |
+- * BSpec recommends 8x4 when MSAA is used, |
6738 |
+- * however in practice 16x4 seems fastest. |
6739 |
+- * |
6740 |
+- * Note that PS/WM thread counts depend on the WIZ hashing |
6741 |
+- * disable bit, which we don't touch here, but it's good |
6742 |
+- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6743 |
+- */ |
6744 |
+- I915_WRITE(GEN7_GT_MODE, |
6745 |
+- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6746 |
+- |
6747 |
+- /* WaSampleCChickenBitEnable:hsw */ |
6748 |
+- I915_WRITE(HALF_SLICE_CHICKEN3, |
6749 |
+- _MASKED_BIT_ENABLE(HSW_SAMPLE_C_PERFORMANCE)); |
6750 |
++ I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
6751 |
++ GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); |
6752 |
+ |
6753 |
+ /* WaSwitchSolVfFArbitrationPriority:hsw */ |
6754 |
+ I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL); |
6755 |
+@@ -7044,32 +6948,11 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6756 |
+ |
6757 |
+ I915_WRITE(ILK_DSPCLK_GATE_D, ILK_VRHUNIT_CLOCK_GATE_DISABLE); |
6758 |
+ |
6759 |
+- /* WaDisableEarlyCull:ivb */ |
6760 |
+- I915_WRITE(_3D_CHICKEN3, |
6761 |
+- _MASKED_BIT_ENABLE(_3D_CHICKEN_SF_DISABLE_OBJEND_CULL)); |
6762 |
+- |
6763 |
+ /* WaDisableBackToBackFlipFix:ivb */ |
6764 |
+ I915_WRITE(IVB_CHICKEN3, |
6765 |
+ CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
6766 |
+ CHICKEN3_DGMG_DONE_FIX_DISABLE); |
6767 |
+ |
6768 |
+- /* WaDisablePSDDualDispatchEnable:ivb */ |
6769 |
+- if (IS_IVB_GT1(dev_priv)) |
6770 |
+- I915_WRITE(GEN7_HALF_SLICE_CHICKEN1, |
6771 |
+- _MASKED_BIT_ENABLE(GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE)); |
6772 |
+- |
6773 |
+- /* WaDisable_RenderCache_OperationalFlush:ivb */ |
6774 |
+- I915_WRITE(CACHE_MODE_0_GEN7, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6775 |
+- |
6776 |
+- /* Apply the WaDisableRHWOOptimizationForRenderHang:ivb workaround. */ |
6777 |
+- I915_WRITE(GEN7_COMMON_SLICE_CHICKEN1, |
6778 |
+- GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC); |
6779 |
+- |
6780 |
+- /* WaApplyL3ControlAndL3ChickenMode:ivb */ |
6781 |
+- I915_WRITE(GEN7_L3CNTLREG1, |
6782 |
+- GEN7_WA_FOR_GEN7_L3_CONTROL); |
6783 |
+- I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, |
6784 |
+- GEN7_WA_L3_CHICKEN_MODE); |
6785 |
+ if (IS_IVB_GT1(dev_priv)) |
6786 |
+ I915_WRITE(GEN7_ROW_CHICKEN2, |
6787 |
+ _MASKED_BIT_ENABLE(DOP_CLOCK_GATING_DISABLE)); |
6788 |
+@@ -7081,10 +6964,6 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6789 |
+ _MASKED_BIT_ENABLE(DOP_CLOCK_GATING_DISABLE)); |
6790 |
+ } |
6791 |
+ |
6792 |
+- /* WaForceL3Serialization:ivb */ |
6793 |
+- I915_WRITE(GEN7_L3SQCREG4, I915_READ(GEN7_L3SQCREG4) & |
6794 |
+- ~L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6795 |
+- |
6796 |
+ /* |
6797 |
+ * According to the spec, bit 13 (RCZUNIT) must be set on IVB. |
6798 |
+ * This implements the WaDisableRCZUnitClockGating:ivb workaround. |
6799 |
+@@ -7099,29 +6978,6 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6800 |
+ |
6801 |
+ g4x_disable_trickle_feed(dev_priv); |
6802 |
+ |
6803 |
+- gen7_setup_fixed_func_scheduler(dev_priv); |
6804 |
+- |
6805 |
+- if (0) { /* causes HiZ corruption on ivb:gt1 */ |
6806 |
+- /* enable HiZ Raw Stall Optimization */ |
6807 |
+- I915_WRITE(CACHE_MODE_0_GEN7, |
6808 |
+- _MASKED_BIT_DISABLE(HIZ_RAW_STALL_OPT_DISABLE)); |
6809 |
+- } |
6810 |
+- |
6811 |
+- /* WaDisable4x2SubspanOptimization:ivb */ |
6812 |
+- I915_WRITE(CACHE_MODE_1, |
6813 |
+- _MASKED_BIT_ENABLE(PIXEL_SUBSPAN_COLLECT_OPT_DISABLE)); |
6814 |
+- |
6815 |
+- /* |
6816 |
+- * BSpec recommends 8x4 when MSAA is used, |
6817 |
+- * however in practice 16x4 seems fastest. |
6818 |
+- * |
6819 |
+- * Note that PS/WM thread counts depend on the WIZ hashing |
6820 |
+- * disable bit, which we don't touch here, but it's good |
6821 |
+- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6822 |
+- */ |
6823 |
+- I915_WRITE(GEN7_GT_MODE, |
6824 |
+- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6825 |
+- |
6826 |
+ snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); |
6827 |
+ snpcr &= ~GEN6_MBC_SNPCR_MASK; |
6828 |
+ snpcr |= GEN6_MBC_SNPCR_MED; |
6829 |
+@@ -7135,28 +6991,11 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6830 |
+ |
6831 |
+ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv) |
6832 |
+ { |
6833 |
+- /* WaDisableEarlyCull:vlv */ |
6834 |
+- I915_WRITE(_3D_CHICKEN3, |
6835 |
+- _MASKED_BIT_ENABLE(_3D_CHICKEN_SF_DISABLE_OBJEND_CULL)); |
6836 |
+- |
6837 |
+ /* WaDisableBackToBackFlipFix:vlv */ |
6838 |
+ I915_WRITE(IVB_CHICKEN3, |
6839 |
+ CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
6840 |
+ CHICKEN3_DGMG_DONE_FIX_DISABLE); |
6841 |
+ |
6842 |
+- /* WaPsdDispatchEnable:vlv */ |
6843 |
+- /* WaDisablePSDDualDispatchEnable:vlv */ |
6844 |
+- I915_WRITE(GEN7_HALF_SLICE_CHICKEN1, |
6845 |
+- _MASKED_BIT_ENABLE(GEN7_MAX_PS_THREAD_DEP | |
6846 |
+- GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE)); |
6847 |
+- |
6848 |
+- /* WaDisable_RenderCache_OperationalFlush:vlv */ |
6849 |
+- I915_WRITE(CACHE_MODE_0_GEN7, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6850 |
+- |
6851 |
+- /* WaForceL3Serialization:vlv */ |
6852 |
+- I915_WRITE(GEN7_L3SQCREG4, I915_READ(GEN7_L3SQCREG4) & |
6853 |
+- ~L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6854 |
+- |
6855 |
+ /* WaDisableDopClockGating:vlv */ |
6856 |
+ I915_WRITE(GEN7_ROW_CHICKEN2, |
6857 |
+ _MASKED_BIT_ENABLE(DOP_CLOCK_GATING_DISABLE)); |
6858 |
+@@ -7166,8 +7005,6 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv) |
6859 |
+ I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
6860 |
+ GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); |
6861 |
+ |
6862 |
+- gen7_setup_fixed_func_scheduler(dev_priv); |
6863 |
+- |
6864 |
+ /* |
6865 |
+ * According to the spec, bit 13 (RCZUNIT) must be set on IVB. |
6866 |
+ * This implements the WaDisableRCZUnitClockGating:vlv workaround. |
6867 |
+@@ -7181,30 +7018,6 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv) |
6868 |
+ I915_WRITE(GEN7_UCGCTL4, |
6869 |
+ I915_READ(GEN7_UCGCTL4) | GEN7_L3BANK2X_CLOCK_GATE_DISABLE); |
6870 |
+ |
6871 |
+- /* |
6872 |
+- * BSpec says this must be set, even though |
6873 |
+- * WaDisable4x2SubspanOptimization isn't listed for VLV. |
6874 |
+- */ |
6875 |
+- I915_WRITE(CACHE_MODE_1, |
6876 |
+- _MASKED_BIT_ENABLE(PIXEL_SUBSPAN_COLLECT_OPT_DISABLE)); |
6877 |
+- |
6878 |
+- /* |
6879 |
+- * BSpec recommends 8x4 when MSAA is used, |
6880 |
+- * however in practice 16x4 seems fastest. |
6881 |
+- * |
6882 |
+- * Note that PS/WM thread counts depend on the WIZ hashing |
6883 |
+- * disable bit, which we don't touch here, but it's good |
6884 |
+- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6885 |
+- */ |
6886 |
+- I915_WRITE(GEN7_GT_MODE, |
6887 |
+- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6888 |
+- |
6889 |
+- /* |
6890 |
+- * WaIncreaseL3CreditsForVLVB0:vlv |
6891 |
+- * This is the hardware default actually. |
6892 |
+- */ |
6893 |
+- I915_WRITE(GEN7_L3SQCREG1, VLV_B0_WA_L3SQCREG1_VALUE); |
6894 |
+- |
6895 |
+ /* |
6896 |
+ * WaDisableVLVClockGating_VBIIssue:vlv |
6897 |
+ * Disable clock gating on th GCFG unit to prevent a delay |
6898 |
+@@ -7257,13 +7070,6 @@ static void g4x_init_clock_gating(struct drm_i915_private *dev_priv) |
6899 |
+ dspclk_gate |= DSSUNIT_CLOCK_GATE_DISABLE; |
6900 |
+ I915_WRITE(DSPCLK_GATE_D, dspclk_gate); |
6901 |
+ |
6902 |
+- /* WaDisableRenderCachePipelinedFlush */ |
6903 |
+- I915_WRITE(CACHE_MODE_0, |
6904 |
+- _MASKED_BIT_ENABLE(CM0_PIPELINED_RENDER_FLUSH_DISABLE)); |
6905 |
+- |
6906 |
+- /* WaDisable_RenderCache_OperationalFlush:g4x */ |
6907 |
+- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6908 |
+- |
6909 |
+ g4x_disable_trickle_feed(dev_priv); |
6910 |
+ } |
6911 |
+ |
6912 |
+@@ -7279,11 +7085,6 @@ static void i965gm_init_clock_gating(struct drm_i915_private *dev_priv) |
6913 |
+ intel_uncore_write(uncore, |
6914 |
+ MI_ARB_STATE, |
6915 |
+ _MASKED_BIT_ENABLE(MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE)); |
6916 |
+- |
6917 |
+- /* WaDisable_RenderCache_OperationalFlush:gen4 */ |
6918 |
+- intel_uncore_write(uncore, |
6919 |
+- CACHE_MODE_0, |
6920 |
+- _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6921 |
+ } |
6922 |
+ |
6923 |
+ static void i965g_init_clock_gating(struct drm_i915_private *dev_priv) |
6924 |
+@@ -7296,9 +7097,6 @@ static void i965g_init_clock_gating(struct drm_i915_private *dev_priv) |
6925 |
+ I915_WRITE(RENCLK_GATE_D2, 0); |
6926 |
+ I915_WRITE(MI_ARB_STATE, |
6927 |
+ _MASKED_BIT_ENABLE(MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE)); |
6928 |
+- |
6929 |
+- /* WaDisable_RenderCache_OperationalFlush:gen4 */ |
6930 |
+- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6931 |
+ } |
6932 |
+ |
6933 |
+ static void gen3_init_clock_gating(struct drm_i915_private *dev_priv) |
6934 |
+diff --git a/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h b/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h |
6935 |
+index 5b39bab4da1d..86baed226b53 100644 |
6936 |
+--- a/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h |
6937 |
++++ b/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h |
6938 |
+@@ -20,6 +20,7 @@ selftest(fence, i915_sw_fence_mock_selftests) |
6939 |
+ selftest(scatterlist, scatterlist_mock_selftests) |
6940 |
+ selftest(syncmap, i915_syncmap_mock_selftests) |
6941 |
+ selftest(uncore, intel_uncore_mock_selftests) |
6942 |
++selftest(ring, intel_ring_mock_selftests) |
6943 |
+ selftest(engine, intel_engine_cs_mock_selftests) |
6944 |
+ selftest(timelines, intel_timeline_mock_selftests) |
6945 |
+ selftest(requests, i915_request_mock_selftests) |
6946 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6947 |
+index 724024a2243a..662d02289533 100644 |
6948 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6949 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6950 |
+@@ -1404,6 +1404,10 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) |
6951 |
+ { |
6952 |
+ u64 busy_cycles, busy_time; |
6953 |
+ |
6954 |
++ /* Only read the gpu busy if the hardware is already active */ |
6955 |
++ if (pm_runtime_get_if_in_use(&gpu->pdev->dev) == 0) |
6956 |
++ return 0; |
6957 |
++ |
6958 |
+ busy_cycles = gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_0_LO, |
6959 |
+ REG_A5XX_RBBM_PERFCTR_RBBM_0_HI); |
6960 |
+ |
6961 |
+@@ -1412,6 +1416,8 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) |
6962 |
+ |
6963 |
+ gpu->devfreq.busy_cycles = busy_cycles; |
6964 |
+ |
6965 |
++ pm_runtime_put(&gpu->pdev->dev); |
6966 |
++ |
6967 |
+ if (WARN_ON(busy_time > ~0LU)) |
6968 |
+ return ~0LU; |
6969 |
+ |
6970 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6971 |
+index c4e71abbdd53..34607a98cc7c 100644 |
6972 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6973 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6974 |
+@@ -108,6 +108,13 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) |
6975 |
+ struct msm_gpu *gpu = &adreno_gpu->base; |
6976 |
+ int ret; |
6977 |
+ |
6978 |
++ /* |
6979 |
++ * This can get called from devfreq while the hardware is idle. Don't |
6980 |
++ * bring up the power if it isn't already active |
6981 |
++ */ |
6982 |
++ if (pm_runtime_get_if_in_use(gmu->dev) == 0) |
6983 |
++ return; |
6984 |
++ |
6985 |
+ gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0); |
6986 |
+ |
6987 |
+ gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING, |
6988 |
+@@ -134,6 +141,7 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) |
6989 |
+ * for now leave it at max so that the performance is nominal. |
6990 |
+ */ |
6991 |
+ icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216)); |
6992 |
++ pm_runtime_put(gmu->dev); |
6993 |
+ } |
6994 |
+ |
6995 |
+ void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq) |
6996 |
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6997 |
+index 68af24150de5..2c09d2c21773 100644 |
6998 |
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6999 |
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
7000 |
+@@ -810,6 +810,11 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) |
7001 |
+ struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); |
7002 |
+ u64 busy_cycles, busy_time; |
7003 |
+ |
7004 |
++ |
7005 |
++ /* Only read the gpu busy if the hardware is already active */ |
7006 |
++ if (pm_runtime_get_if_in_use(a6xx_gpu->gmu.dev) == 0) |
7007 |
++ return 0; |
7008 |
++ |
7009 |
+ busy_cycles = gmu_read64(&a6xx_gpu->gmu, |
7010 |
+ REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L, |
7011 |
+ REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H); |
7012 |
+@@ -819,6 +824,8 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) |
7013 |
+ |
7014 |
+ gpu->devfreq.busy_cycles = busy_cycles; |
7015 |
+ |
7016 |
++ pm_runtime_put(a6xx_gpu->gmu.dev); |
7017 |
++ |
7018 |
+ if (WARN_ON(busy_time > ~0LU)) |
7019 |
+ return ~0LU; |
7020 |
+ |
7021 |
+diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
7022 |
+index 47b989834af1..c23a2fa13fb9 100644 |
7023 |
+--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
7024 |
++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
7025 |
+@@ -943,7 +943,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) |
7026 |
+ |
7027 |
+ return 0; |
7028 |
+ fail: |
7029 |
+- mdp5_destroy(pdev); |
7030 |
++ if (mdp5_kms) |
7031 |
++ mdp5_destroy(pdev); |
7032 |
+ return ret; |
7033 |
+ } |
7034 |
+ |
7035 |
+diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c |
7036 |
+index 732f65df5c4f..fea30e7aa9e8 100644 |
7037 |
+--- a/drivers/gpu/drm/msm/msm_rd.c |
7038 |
++++ b/drivers/gpu/drm/msm/msm_rd.c |
7039 |
+@@ -29,8 +29,6 @@ |
7040 |
+ * or shader programs (if not emitted inline in cmdstream). |
7041 |
+ */ |
7042 |
+ |
7043 |
+-#ifdef CONFIG_DEBUG_FS |
7044 |
+- |
7045 |
+ #include <linux/circ_buf.h> |
7046 |
+ #include <linux/debugfs.h> |
7047 |
+ #include <linux/kfifo.h> |
7048 |
+@@ -47,6 +45,8 @@ bool rd_full = false; |
7049 |
+ MODULE_PARM_DESC(rd_full, "If true, $debugfs/.../rd will snapshot all buffer contents"); |
7050 |
+ module_param_named(rd_full, rd_full, bool, 0600); |
7051 |
+ |
7052 |
++#ifdef CONFIG_DEBUG_FS |
7053 |
++ |
7054 |
+ enum rd_sect_type { |
7055 |
+ RD_NONE, |
7056 |
+ RD_TEST, /* ascii text */ |
7057 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
7058 |
+index 6be9df1820c5..2625ed84fc44 100644 |
7059 |
+--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c |
7060 |
++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
7061 |
+@@ -482,15 +482,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe) |
7062 |
+ * audio component binding for ELD notification |
7063 |
+ */ |
7064 |
+ static void |
7065 |
+-nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port) |
7066 |
++nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port, |
7067 |
++ int dev_id) |
7068 |
+ { |
7069 |
+ if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) |
7070 |
+ acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, |
7071 |
+- port, -1); |
7072 |
++ port, dev_id); |
7073 |
+ } |
7074 |
+ |
7075 |
+ static int |
7076 |
+-nv50_audio_component_get_eld(struct device *kdev, int port, int pipe, |
7077 |
++nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id, |
7078 |
+ bool *enabled, unsigned char *buf, int max_bytes) |
7079 |
+ { |
7080 |
+ struct drm_device *drm_dev = dev_get_drvdata(kdev); |
7081 |
+@@ -506,7 +507,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe, |
7082 |
+ nv_encoder = nouveau_encoder(encoder); |
7083 |
+ nv_connector = nouveau_encoder_connector_get(nv_encoder); |
7084 |
+ nv_crtc = nouveau_crtc(encoder->crtc); |
7085 |
+- if (!nv_connector || !nv_crtc || nv_crtc->index != port) |
7086 |
++ if (!nv_connector || !nv_crtc || nv_encoder->or != port || |
7087 |
++ nv_crtc->index != dev_id) |
7088 |
+ continue; |
7089 |
+ *enabled = drm_detect_monitor_audio(nv_connector->edid); |
7090 |
+ if (*enabled) { |
7091 |
+@@ -600,7 +602,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc) |
7092 |
+ |
7093 |
+ nvif_mthd(&disp->disp->object, 0, &args, sizeof(args)); |
7094 |
+ |
7095 |
+- nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index); |
7096 |
++ nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or, |
7097 |
++ nv_crtc->index); |
7098 |
+ } |
7099 |
+ |
7100 |
+ static void |
7101 |
+@@ -634,7 +637,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) |
7102 |
+ nvif_mthd(&disp->disp->object, 0, &args, |
7103 |
+ sizeof(args.base) + drm_eld_size(args.data)); |
7104 |
+ |
7105 |
+- nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index); |
7106 |
++ nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or, |
7107 |
++ nv_crtc->index); |
7108 |
+ } |
7109 |
+ |
7110 |
+ /****************************************************************************** |
7111 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
7112 |
+index 9b16a08eb4d9..bf6d41fb0c9f 100644 |
7113 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
7114 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
7115 |
+@@ -27,10 +27,10 @@ void |
7116 |
+ gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc) |
7117 |
+ { |
7118 |
+ struct nvkm_device *device = ior->disp->engine.subdev.device; |
7119 |
+- const u32 hoff = head * 0x800; |
7120 |
++ const u32 soff = nv50_ior_base(ior); |
7121 |
+ const u32 ctrl = scdc & 0x3; |
7122 |
+ |
7123 |
+- nvkm_mask(device, 0x61c5bc + hoff, 0x00000003, ctrl); |
7124 |
++ nvkm_mask(device, 0x61c5bc + soff, 0x00000003, ctrl); |
7125 |
+ |
7126 |
+ ior->tmds.high_speed = !!(scdc & 0x2); |
7127 |
+ } |
7128 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c |
7129 |
+index 4209b24a46d7..bf6b65257852 100644 |
7130 |
+--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c |
7131 |
++++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c |
7132 |
+@@ -341,7 +341,7 @@ gk20a_gr_load(struct gf100_gr *gr, int ver, const struct gf100_gr_fwif *fwif) |
7133 |
+ |
7134 |
+ static const struct gf100_gr_fwif |
7135 |
+ gk20a_gr_fwif[] = { |
7136 |
+- { -1, gk20a_gr_load, &gk20a_gr }, |
7137 |
++ { 0, gk20a_gr_load, &gk20a_gr }, |
7138 |
+ {} |
7139 |
+ }; |
7140 |
+ |
7141 |
+diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c |
7142 |
+index 70b20ee4741a..41ef6a9ca8cc 100644 |
7143 |
+--- a/drivers/gpu/drm/qxl/qxl_kms.c |
7144 |
++++ b/drivers/gpu/drm/qxl/qxl_kms.c |
7145 |
+@@ -218,7 +218,7 @@ int qxl_device_init(struct qxl_device *qdev, |
7146 |
+ &(qdev->ram_header->cursor_ring_hdr), |
7147 |
+ sizeof(struct qxl_command), |
7148 |
+ QXL_CURSOR_RING_SIZE, |
7149 |
+- qdev->io_base + QXL_IO_NOTIFY_CMD, |
7150 |
++ qdev->io_base + QXL_IO_NOTIFY_CURSOR, |
7151 |
+ false, |
7152 |
+ &qdev->cursor_event); |
7153 |
+ |
7154 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
7155 |
+index 7ad3f06c127e..00ca35f07ba5 100644 |
7156 |
+--- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
7157 |
++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
7158 |
+@@ -148,7 +148,7 @@ |
7159 |
+ #define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE 3 |
7160 |
+ |
7161 |
+ #define SUN4I_HDMI_DDC_CLK_REG 0x528 |
7162 |
+-#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0x7) << 3) |
7163 |
++#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0xf) << 3) |
7164 |
+ #define SUN4I_HDMI_DDC_CLK_N(n) ((n) & 0x7) |
7165 |
+ |
7166 |
+ #define SUN4I_HDMI_DDC_LINE_CTRL_REG 0x540 |
7167 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
7168 |
+index 2ff780114106..12430b9d4e93 100644 |
7169 |
+--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
7170 |
++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
7171 |
+@@ -33,7 +33,7 @@ static unsigned long sun4i_ddc_calc_divider(unsigned long rate, |
7172 |
+ unsigned long best_rate = 0; |
7173 |
+ u8 best_m = 0, best_n = 0, _m, _n; |
7174 |
+ |
7175 |
+- for (_m = 0; _m < 8; _m++) { |
7176 |
++ for (_m = 0; _m < 16; _m++) { |
7177 |
+ for (_n = 0; _n < 8; _n++) { |
7178 |
+ unsigned long tmp_rate; |
7179 |
+ |
7180 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
7181 |
+index 1c71a1aa76b2..f03f1cc913ce 100644 |
7182 |
+--- a/drivers/hid/hid-ids.h |
7183 |
++++ b/drivers/hid/hid-ids.h |
7184 |
+@@ -1157,6 +1157,9 @@ |
7185 |
+ #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882 |
7186 |
+ #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 |
7187 |
+ |
7188 |
++#define USB_VENDOR_ID_TRUST 0x145f |
7189 |
++#define USB_DEVICE_ID_TRUST_PANORA_TABLET 0x0212 |
7190 |
++ |
7191 |
+ #define USB_VENDOR_ID_TURBOX 0x062a |
7192 |
+ #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 |
7193 |
+ #define USB_DEVICE_ID_ASUS_MD_5110 0x5110 |
7194 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
7195 |
+index e4cb543de0cd..ca8b5c261c7c 100644 |
7196 |
+--- a/drivers/hid/hid-quirks.c |
7197 |
++++ b/drivers/hid/hid-quirks.c |
7198 |
+@@ -168,6 +168,7 @@ static const struct hid_device_id hid_quirks[] = { |
7199 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, |
7200 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, |
7201 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883), HID_QUIRK_NOGET }, |
7202 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_TRUST, USB_DEVICE_ID_TRUST_PANORA_TABLET), HID_QUIRK_MULTI_INPUT | HID_QUIRK_HIDINPUT_FORCE }, |
7203 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, |
7204 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, |
7205 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT }, |
7206 |
+diff --git a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
7207 |
+index aa2dbed30fc3..6cf59fd26ad7 100644 |
7208 |
+--- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
7209 |
++++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
7210 |
+@@ -480,6 +480,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, |
7211 |
+ sizeof(ldr_xfer_query_resp)); |
7212 |
+ if (rv < 0) { |
7213 |
+ client_data->flag_retry = true; |
7214 |
++ *fw_info = (struct shim_fw_info){}; |
7215 |
+ return rv; |
7216 |
+ } |
7217 |
+ |
7218 |
+@@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, |
7219 |
+ "data size %d is not equal to size of loader_xfer_query_response %zu\n", |
7220 |
+ rv, sizeof(struct loader_xfer_query_response)); |
7221 |
+ client_data->flag_retry = true; |
7222 |
++ *fw_info = (struct shim_fw_info){}; |
7223 |
+ return -EMSGSIZE; |
7224 |
+ } |
7225 |
+ |
7226 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c |
7227 |
+index a90d757f7043..a6d6c7a3abcb 100644 |
7228 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x.c |
7229 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x.c |
7230 |
+@@ -1527,6 +1527,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) |
7231 |
+ return 0; |
7232 |
+ |
7233 |
+ err_arch_supported: |
7234 |
++ etmdrvdata[drvdata->cpu] = NULL; |
7235 |
+ if (--etm4_count == 0) { |
7236 |
+ etm4_cpu_pm_unregister(); |
7237 |
+ |
7238 |
+diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c |
7239 |
+index 43418a2126ff..471f34e40c74 100644 |
7240 |
+--- a/drivers/hwtracing/coresight/coresight-platform.c |
7241 |
++++ b/drivers/hwtracing/coresight/coresight-platform.c |
7242 |
+@@ -87,6 +87,7 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, |
7243 |
+ int *nr_inport, int *nr_outport) |
7244 |
+ { |
7245 |
+ struct device_node *ep = NULL; |
7246 |
++ struct of_endpoint endpoint; |
7247 |
+ int in = 0, out = 0; |
7248 |
+ |
7249 |
+ do { |
7250 |
+@@ -94,10 +95,16 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, |
7251 |
+ if (!ep) |
7252 |
+ break; |
7253 |
+ |
7254 |
+- if (of_coresight_legacy_ep_is_input(ep)) |
7255 |
+- in++; |
7256 |
+- else |
7257 |
+- out++; |
7258 |
++ if (of_graph_parse_endpoint(ep, &endpoint)) |
7259 |
++ continue; |
7260 |
++ |
7261 |
++ if (of_coresight_legacy_ep_is_input(ep)) { |
7262 |
++ in = (endpoint.port + 1 > in) ? |
7263 |
++ endpoint.port + 1 : in; |
7264 |
++ } else { |
7265 |
++ out = (endpoint.port + 1) > out ? |
7266 |
++ endpoint.port + 1 : out; |
7267 |
++ } |
7268 |
+ |
7269 |
+ } while (ep); |
7270 |
+ |
7271 |
+@@ -137,9 +144,16 @@ of_coresight_count_ports(struct device_node *port_parent) |
7272 |
+ { |
7273 |
+ int i = 0; |
7274 |
+ struct device_node *ep = NULL; |
7275 |
++ struct of_endpoint endpoint; |
7276 |
++ |
7277 |
++ while ((ep = of_graph_get_next_endpoint(port_parent, ep))) { |
7278 |
++ /* Defer error handling to parsing */ |
7279 |
++ if (of_graph_parse_endpoint(ep, &endpoint)) |
7280 |
++ continue; |
7281 |
++ if (endpoint.port + 1 > i) |
7282 |
++ i = endpoint.port + 1; |
7283 |
++ } |
7284 |
+ |
7285 |
+- while ((ep = of_graph_get_next_endpoint(port_parent, ep))) |
7286 |
+- i++; |
7287 |
+ return i; |
7288 |
+ } |
7289 |
+ |
7290 |
+@@ -191,14 +205,12 @@ static int of_coresight_get_cpu(struct device *dev) |
7291 |
+ * Parses the local port, remote device name and the remote port. |
7292 |
+ * |
7293 |
+ * Returns : |
7294 |
+- * 1 - If the parsing is successful and a connection record |
7295 |
+- * was created for an output connection. |
7296 |
+ * 0 - If the parsing completed without any fatal errors. |
7297 |
+ * -Errno - Fatal error, abort the scanning. |
7298 |
+ */ |
7299 |
+ static int of_coresight_parse_endpoint(struct device *dev, |
7300 |
+ struct device_node *ep, |
7301 |
+- struct coresight_connection *conn) |
7302 |
++ struct coresight_platform_data *pdata) |
7303 |
+ { |
7304 |
+ int ret = 0; |
7305 |
+ struct of_endpoint endpoint, rendpoint; |
7306 |
+@@ -206,6 +218,7 @@ static int of_coresight_parse_endpoint(struct device *dev, |
7307 |
+ struct device_node *rep = NULL; |
7308 |
+ struct device *rdev = NULL; |
7309 |
+ struct fwnode_handle *rdev_fwnode; |
7310 |
++ struct coresight_connection *conn; |
7311 |
+ |
7312 |
+ do { |
7313 |
+ /* Parse the local port details */ |
7314 |
+@@ -232,6 +245,13 @@ static int of_coresight_parse_endpoint(struct device *dev, |
7315 |
+ break; |
7316 |
+ } |
7317 |
+ |
7318 |
++ conn = &pdata->conns[endpoint.port]; |
7319 |
++ if (conn->child_fwnode) { |
7320 |
++ dev_warn(dev, "Duplicate output port %d\n", |
7321 |
++ endpoint.port); |
7322 |
++ ret = -EINVAL; |
7323 |
++ break; |
7324 |
++ } |
7325 |
+ conn->outport = endpoint.port; |
7326 |
+ /* |
7327 |
+ * Hold the refcount to the target device. This could be |
7328 |
+@@ -244,7 +264,6 @@ static int of_coresight_parse_endpoint(struct device *dev, |
7329 |
+ conn->child_fwnode = fwnode_handle_get(rdev_fwnode); |
7330 |
+ conn->child_port = rendpoint.port; |
7331 |
+ /* Connection record updated */ |
7332 |
+- ret = 1; |
7333 |
+ } while (0); |
7334 |
+ |
7335 |
+ of_node_put(rparent); |
7336 |
+@@ -258,7 +277,6 @@ static int of_get_coresight_platform_data(struct device *dev, |
7337 |
+ struct coresight_platform_data *pdata) |
7338 |
+ { |
7339 |
+ int ret = 0; |
7340 |
+- struct coresight_connection *conn; |
7341 |
+ struct device_node *ep = NULL; |
7342 |
+ const struct device_node *parent = NULL; |
7343 |
+ bool legacy_binding = false; |
7344 |
+@@ -287,8 +305,6 @@ static int of_get_coresight_platform_data(struct device *dev, |
7345 |
+ dev_warn_once(dev, "Uses obsolete Coresight DT bindings\n"); |
7346 |
+ } |
7347 |
+ |
7348 |
+- conn = pdata->conns; |
7349 |
+- |
7350 |
+ /* Iterate through each output port to discover topology */ |
7351 |
+ while ((ep = of_graph_get_next_endpoint(parent, ep))) { |
7352 |
+ /* |
7353 |
+@@ -300,15 +316,9 @@ static int of_get_coresight_platform_data(struct device *dev, |
7354 |
+ if (legacy_binding && of_coresight_legacy_ep_is_input(ep)) |
7355 |
+ continue; |
7356 |
+ |
7357 |
+- ret = of_coresight_parse_endpoint(dev, ep, conn); |
7358 |
+- switch (ret) { |
7359 |
+- case 1: |
7360 |
+- conn++; /* Fall through */ |
7361 |
+- case 0: |
7362 |
+- break; |
7363 |
+- default: |
7364 |
++ ret = of_coresight_parse_endpoint(dev, ep, pdata); |
7365 |
++ if (ret) |
7366 |
+ return ret; |
7367 |
+- } |
7368 |
+ } |
7369 |
+ |
7370 |
+ return 0; |
7371 |
+@@ -647,6 +657,16 @@ static int acpi_coresight_parse_link(struct acpi_device *adev, |
7372 |
+ * coresight_remove_match(). |
7373 |
+ */ |
7374 |
+ conn->child_fwnode = fwnode_handle_get(&r_adev->fwnode); |
7375 |
++ } else if (dir == ACPI_CORESIGHT_LINK_SLAVE) { |
7376 |
++ /* |
7377 |
++ * We are only interested in the port number |
7378 |
++ * for the input ports at this component. |
7379 |
++ * Store the port number in child_port. |
7380 |
++ */ |
7381 |
++ conn->child_port = fields[0].integer.value; |
7382 |
++ } else { |
7383 |
++ /* Invalid direction */ |
7384 |
++ return -EINVAL; |
7385 |
+ } |
7386 |
+ |
7387 |
+ return dir; |
7388 |
+@@ -692,10 +712,20 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, |
7389 |
+ return dir; |
7390 |
+ |
7391 |
+ if (dir == ACPI_CORESIGHT_LINK_MASTER) { |
7392 |
+- pdata->nr_outport++; |
7393 |
++ if (ptr->outport > pdata->nr_outport) |
7394 |
++ pdata->nr_outport = ptr->outport; |
7395 |
+ ptr++; |
7396 |
+ } else { |
7397 |
+- pdata->nr_inport++; |
7398 |
++ WARN_ON(pdata->nr_inport == ptr->child_port); |
7399 |
++ /* |
7400 |
++ * We do not track input port connections for a device. |
7401 |
++ * However we need the highest port number described, |
7402 |
++ * which can be recorded now and reuse this connection |
7403 |
++ * record for an output connection. Hence, do not move |
7404 |
++ * the ptr for input connections |
7405 |
++ */ |
7406 |
++ if (ptr->child_port > pdata->nr_inport) |
7407 |
++ pdata->nr_inport = ptr->child_port; |
7408 |
+ } |
7409 |
+ } |
7410 |
+ |
7411 |
+@@ -704,8 +734,13 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, |
7412 |
+ return rc; |
7413 |
+ |
7414 |
+ /* Copy the connection information to the final location */ |
7415 |
+- for (i = 0; i < pdata->nr_outport; i++) |
7416 |
+- pdata->conns[i] = conns[i]; |
7417 |
++ for (i = 0; conns + i < ptr; i++) { |
7418 |
++ int port = conns[i].outport; |
7419 |
++ |
7420 |
++ /* Duplicate output port */ |
7421 |
++ WARN_ON(pdata->conns[port].child_fwnode); |
7422 |
++ pdata->conns[port] = conns[i]; |
7423 |
++ } |
7424 |
+ |
7425 |
+ devm_kfree(&adev->dev, conns); |
7426 |
+ return 0; |
7427 |
+diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
7428 |
+index d0cc3985b72a..36cce2bfb744 100644 |
7429 |
+--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
7430 |
++++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
7431 |
+@@ -596,13 +596,6 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) |
7432 |
+ goto out; |
7433 |
+ } |
7434 |
+ |
7435 |
+- /* There is no point in reading a TMC in HW FIFO mode */ |
7436 |
+- mode = readl_relaxed(drvdata->base + TMC_MODE); |
7437 |
+- if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
7438 |
+- ret = -EINVAL; |
7439 |
+- goto out; |
7440 |
+- } |
7441 |
+- |
7442 |
+ /* Don't interfere if operated from Perf */ |
7443 |
+ if (drvdata->mode == CS_MODE_PERF) { |
7444 |
+ ret = -EINVAL; |
7445 |
+@@ -616,8 +609,15 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) |
7446 |
+ } |
7447 |
+ |
7448 |
+ /* Disable the TMC if need be */ |
7449 |
+- if (drvdata->mode == CS_MODE_SYSFS) |
7450 |
++ if (drvdata->mode == CS_MODE_SYSFS) { |
7451 |
++ /* There is no point in reading a TMC in HW FIFO mode */ |
7452 |
++ mode = readl_relaxed(drvdata->base + TMC_MODE); |
7453 |
++ if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
7454 |
++ ret = -EINVAL; |
7455 |
++ goto out; |
7456 |
++ } |
7457 |
+ __tmc_etb_disable_hw(drvdata); |
7458 |
++ } |
7459 |
+ |
7460 |
+ drvdata->reading = true; |
7461 |
+ out: |
7462 |
+diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c |
7463 |
+index c71553c09f8e..8f5e62f02444 100644 |
7464 |
+--- a/drivers/hwtracing/coresight/coresight.c |
7465 |
++++ b/drivers/hwtracing/coresight/coresight.c |
7466 |
+@@ -1053,6 +1053,9 @@ static int coresight_orphan_match(struct device *dev, void *data) |
7467 |
+ for (i = 0; i < i_csdev->pdata->nr_outport; i++) { |
7468 |
+ conn = &i_csdev->pdata->conns[i]; |
7469 |
+ |
7470 |
++ /* Skip the port if FW doesn't describe it */ |
7471 |
++ if (!conn->child_fwnode) |
7472 |
++ continue; |
7473 |
+ /* We have found at least one orphan connection */ |
7474 |
+ if (conn->child_dev == NULL) { |
7475 |
+ /* Does it match this newly added device? */ |
7476 |
+@@ -1091,6 +1094,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) |
7477 |
+ for (i = 0; i < csdev->pdata->nr_outport; i++) { |
7478 |
+ struct coresight_connection *conn = &csdev->pdata->conns[i]; |
7479 |
+ |
7480 |
++ if (!conn->child_fwnode) |
7481 |
++ continue; |
7482 |
+ conn->child_dev = |
7483 |
+ coresight_find_csdev_by_fwnode(conn->child_fwnode); |
7484 |
+ if (!conn->child_dev) |
7485 |
+@@ -1118,7 +1123,7 @@ static int coresight_remove_match(struct device *dev, void *data) |
7486 |
+ for (i = 0; i < iterator->pdata->nr_outport; i++) { |
7487 |
+ conn = &iterator->pdata->conns[i]; |
7488 |
+ |
7489 |
+- if (conn->child_dev == NULL) |
7490 |
++ if (conn->child_dev == NULL || conn->child_fwnode == NULL) |
7491 |
+ continue; |
7492 |
+ |
7493 |
+ if (csdev->dev.fwnode == conn->child_fwnode) { |
7494 |
+diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c |
7495 |
+index 271470f4d8a9..66c9923fc766 100644 |
7496 |
+--- a/drivers/i2c/busses/i2c-icy.c |
7497 |
++++ b/drivers/i2c/busses/i2c-icy.c |
7498 |
+@@ -43,6 +43,7 @@ |
7499 |
+ #include <linux/i2c.h> |
7500 |
+ #include <linux/i2c-algo-pcf.h> |
7501 |
+ |
7502 |
++#include <asm/amigahw.h> |
7503 |
+ #include <asm/amigaints.h> |
7504 |
+ #include <linux/zorro.h> |
7505 |
+ |
7506 |
+diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c |
7507 |
+index 30ded6422e7b..69740a4ff1db 100644 |
7508 |
+--- a/drivers/i2c/busses/i2c-piix4.c |
7509 |
++++ b/drivers/i2c/busses/i2c-piix4.c |
7510 |
+@@ -977,7 +977,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) |
7511 |
+ } |
7512 |
+ |
7513 |
+ if (dev->vendor == PCI_VENDOR_ID_AMD && |
7514 |
+- dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) { |
7515 |
++ (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS || |
7516 |
++ dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) { |
7517 |
+ retval = piix4_setup_sb800(dev, id, 1); |
7518 |
+ } |
7519 |
+ |
7520 |
+diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c |
7521 |
+index 466e4f681d7a..f537a37ac1d5 100644 |
7522 |
+--- a/drivers/i2c/busses/i2c-pxa.c |
7523 |
++++ b/drivers/i2c/busses/i2c-pxa.c |
7524 |
+@@ -311,11 +311,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) |
7525 |
+ dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n", |
7526 |
+ readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)), |
7527 |
+ readl(_ISR(i2c))); |
7528 |
+- dev_dbg(dev, "log: "); |
7529 |
++ dev_err(dev, "log:"); |
7530 |
+ for (i = 0; i < i2c->irqlogidx; i++) |
7531 |
+- pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]); |
7532 |
+- |
7533 |
+- pr_debug("\n"); |
7534 |
++ pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]); |
7535 |
++ pr_cont("\n"); |
7536 |
+ } |
7537 |
+ |
7538 |
+ #else /* ifdef DEBUG */ |
7539 |
+@@ -747,11 +746,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) |
7540 |
+ { |
7541 |
+ u32 icr; |
7542 |
+ |
7543 |
+- /* |
7544 |
+- * Clear the STOP and ACK flags |
7545 |
+- */ |
7546 |
++ /* Clear the START, STOP, ACK, TB and MA flags */ |
7547 |
+ icr = readl(_ICR(i2c)); |
7548 |
+- icr &= ~(ICR_STOP | ICR_ACKNAK); |
7549 |
++ icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA); |
7550 |
+ writel(icr, _ICR(i2c)); |
7551 |
+ } |
7552 |
+ |
7553 |
+diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c |
7554 |
+index b129693af0fd..94da3b1ca3a2 100644 |
7555 |
+--- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c |
7556 |
++++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c |
7557 |
+@@ -134,7 +134,7 @@ static ssize_t iio_dmaengine_buffer_get_length_align(struct device *dev, |
7558 |
+ struct dmaengine_buffer *dmaengine_buffer = |
7559 |
+ iio_buffer_to_dmaengine_buffer(indio_dev->buffer); |
7560 |
+ |
7561 |
+- return sprintf(buf, "%u\n", dmaengine_buffer->align); |
7562 |
++ return sprintf(buf, "%zu\n", dmaengine_buffer->align); |
7563 |
+ } |
7564 |
+ |
7565 |
+ static IIO_DEVICE_ATTR(length_align_bytes, 0444, |
7566 |
+diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c |
7567 |
+index b7ef16b28280..7a2679bdc987 100644 |
7568 |
+--- a/drivers/iio/light/gp2ap002.c |
7569 |
++++ b/drivers/iio/light/gp2ap002.c |
7570 |
+@@ -158,6 +158,9 @@ static irqreturn_t gp2ap002_prox_irq(int irq, void *d) |
7571 |
+ int val; |
7572 |
+ int ret; |
7573 |
+ |
7574 |
++ if (!gp2ap002->enabled) |
7575 |
++ goto err_retrig; |
7576 |
++ |
7577 |
+ ret = regmap_read(gp2ap002->map, GP2AP002_PROX, &val); |
7578 |
+ if (ret) { |
7579 |
+ dev_err(gp2ap002->dev, "error reading proximity\n"); |
7580 |
+@@ -247,6 +250,8 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev, |
7581 |
+ struct gp2ap002 *gp2ap002 = iio_priv(indio_dev); |
7582 |
+ int ret; |
7583 |
+ |
7584 |
++ pm_runtime_get_sync(gp2ap002->dev); |
7585 |
++ |
7586 |
+ switch (mask) { |
7587 |
+ case IIO_CHAN_INFO_RAW: |
7588 |
+ switch (chan->type) { |
7589 |
+@@ -255,13 +260,21 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev, |
7590 |
+ if (ret < 0) |
7591 |
+ return ret; |
7592 |
+ *val = ret; |
7593 |
+- return IIO_VAL_INT; |
7594 |
++ ret = IIO_VAL_INT; |
7595 |
++ goto out; |
7596 |
+ default: |
7597 |
+- return -EINVAL; |
7598 |
++ ret = -EINVAL; |
7599 |
++ goto out; |
7600 |
+ } |
7601 |
+ default: |
7602 |
+- return -EINVAL; |
7603 |
++ ret = -EINVAL; |
7604 |
+ } |
7605 |
++ |
7606 |
++out: |
7607 |
++ pm_runtime_mark_last_busy(gp2ap002->dev); |
7608 |
++ pm_runtime_put_autosuspend(gp2ap002->dev); |
7609 |
++ |
7610 |
++ return ret; |
7611 |
+ } |
7612 |
+ |
7613 |
+ static int gp2ap002_init(struct gp2ap002 *gp2ap002) |
7614 |
+diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c |
7615 |
+index 29c209cc1108..973264a088f9 100644 |
7616 |
+--- a/drivers/iio/pressure/bmp280-core.c |
7617 |
++++ b/drivers/iio/pressure/bmp280-core.c |
7618 |
+@@ -271,6 +271,8 @@ static u32 bmp280_compensate_humidity(struct bmp280_data *data, |
7619 |
+ + (s32)2097152) * calib->H2 + 8192) >> 14); |
7620 |
+ var -= ((((var >> 15) * (var >> 15)) >> 7) * (s32)calib->H1) >> 4; |
7621 |
+ |
7622 |
++ var = clamp_val(var, 0, 419430400); |
7623 |
++ |
7624 |
+ return var >> 12; |
7625 |
+ }; |
7626 |
+ |
7627 |
+@@ -713,7 +715,7 @@ static int bmp180_measure(struct bmp280_data *data, u8 ctrl_meas) |
7628 |
+ unsigned int ctrl; |
7629 |
+ |
7630 |
+ if (data->use_eoc) |
7631 |
+- init_completion(&data->done); |
7632 |
++ reinit_completion(&data->done); |
7633 |
+ |
7634 |
+ ret = regmap_write(data->regmap, BMP280_REG_CTRL_MEAS, ctrl_meas); |
7635 |
+ if (ret) |
7636 |
+@@ -969,6 +971,9 @@ static int bmp085_fetch_eoc_irq(struct device *dev, |
7637 |
+ "trying to enforce it\n"); |
7638 |
+ irq_trig = IRQF_TRIGGER_RISING; |
7639 |
+ } |
7640 |
++ |
7641 |
++ init_completion(&data->done); |
7642 |
++ |
7643 |
+ ret = devm_request_threaded_irq(dev, |
7644 |
+ irq, |
7645 |
+ bmp085_eoc_irq, |
7646 |
+diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c |
7647 |
+index 17f14e0eafe4..1c2bf18cda9f 100644 |
7648 |
+--- a/drivers/infiniband/core/cm.c |
7649 |
++++ b/drivers/infiniband/core/cm.c |
7650 |
+@@ -1076,7 +1076,9 @@ retest: |
7651 |
+ case IB_CM_REP_SENT: |
7652 |
+ case IB_CM_MRA_REP_RCVD: |
7653 |
+ ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
7654 |
+- /* Fall through */ |
7655 |
++ cm_send_rej_locked(cm_id_priv, IB_CM_REJ_CONSUMER_DEFINED, NULL, |
7656 |
++ 0, NULL, 0); |
7657 |
++ goto retest; |
7658 |
+ case IB_CM_MRA_REQ_SENT: |
7659 |
+ case IB_CM_REP_RCVD: |
7660 |
+ case IB_CM_MRA_REP_SENT: |
7661 |
+diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c |
7662 |
+index c672a4978bfd..3c1e2ca564fe 100644 |
7663 |
+--- a/drivers/infiniband/core/cma_configfs.c |
7664 |
++++ b/drivers/infiniband/core/cma_configfs.c |
7665 |
+@@ -322,8 +322,21 @@ fail: |
7666 |
+ return ERR_PTR(err); |
7667 |
+ } |
7668 |
+ |
7669 |
++static void drop_cma_dev(struct config_group *cgroup, struct config_item *item) |
7670 |
++{ |
7671 |
++ struct config_group *group = |
7672 |
++ container_of(item, struct config_group, cg_item); |
7673 |
++ struct cma_dev_group *cma_dev_group = |
7674 |
++ container_of(group, struct cma_dev_group, device_group); |
7675 |
++ |
7676 |
++ configfs_remove_default_groups(&cma_dev_group->ports_group); |
7677 |
++ configfs_remove_default_groups(&cma_dev_group->device_group); |
7678 |
++ config_item_put(item); |
7679 |
++} |
7680 |
++ |
7681 |
+ static struct configfs_group_operations cma_subsys_group_ops = { |
7682 |
+ .make_group = make_cma_dev, |
7683 |
++ .drop_item = drop_cma_dev, |
7684 |
+ }; |
7685 |
+ |
7686 |
+ static const struct config_item_type cma_subsys_type = { |
7687 |
+diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c |
7688 |
+index 087682e6969e..defe9cd4c5ee 100644 |
7689 |
+--- a/drivers/infiniband/core/sysfs.c |
7690 |
++++ b/drivers/infiniband/core/sysfs.c |
7691 |
+@@ -1058,8 +1058,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) |
7692 |
+ coredev->ports_kobj, |
7693 |
+ "%d", port_num); |
7694 |
+ if (ret) { |
7695 |
+- kfree(p); |
7696 |
+- return ret; |
7697 |
++ goto err_put; |
7698 |
+ } |
7699 |
+ |
7700 |
+ p->gid_attr_group = kzalloc(sizeof(*p->gid_attr_group), GFP_KERNEL); |
7701 |
+@@ -1072,8 +1071,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) |
7702 |
+ ret = kobject_init_and_add(&p->gid_attr_group->kobj, &gid_attr_type, |
7703 |
+ &p->kobj, "gid_attrs"); |
7704 |
+ if (ret) { |
7705 |
+- kfree(p->gid_attr_group); |
7706 |
+- goto err_put; |
7707 |
++ goto err_put_gid_attrs; |
7708 |
+ } |
7709 |
+ |
7710 |
+ if (device->ops.process_mad && is_full_dev) { |
7711 |
+@@ -1404,8 +1402,10 @@ int ib_port_register_module_stat(struct ib_device *device, u8 port_num, |
7712 |
+ |
7713 |
+ ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s", |
7714 |
+ name); |
7715 |
+- if (ret) |
7716 |
++ if (ret) { |
7717 |
++ kobject_put(kobj); |
7718 |
+ return ret; |
7719 |
++ } |
7720 |
+ } |
7721 |
+ |
7722 |
+ return 0; |
7723 |
+diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
7724 |
+index 060b4ebbd2ba..d6e9cc94dd90 100644 |
7725 |
+--- a/drivers/infiniband/core/uverbs_cmd.c |
7726 |
++++ b/drivers/infiniband/core/uverbs_cmd.c |
7727 |
+@@ -2959,6 +2959,7 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs) |
7728 |
+ wq_init_attr.event_handler = ib_uverbs_wq_event_handler; |
7729 |
+ wq_init_attr.create_flags = cmd.create_flags; |
7730 |
+ INIT_LIST_HEAD(&obj->uevent.event_list); |
7731 |
++ obj->uevent.uobject.user_handle = cmd.user_handle; |
7732 |
+ |
7733 |
+ wq = pd->device->ops.create_wq(pd, &wq_init_attr, &attrs->driver_udata); |
7734 |
+ if (IS_ERR(wq)) { |
7735 |
+@@ -2976,8 +2977,6 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs) |
7736 |
+ atomic_set(&wq->usecnt, 0); |
7737 |
+ atomic_inc(&pd->usecnt); |
7738 |
+ atomic_inc(&cq->usecnt); |
7739 |
+- wq->uobject = obj; |
7740 |
+- obj->uevent.uobject.object = wq; |
7741 |
+ |
7742 |
+ memset(&resp, 0, sizeof(resp)); |
7743 |
+ resp.wq_handle = obj->uevent.uobject.id; |
7744 |
+diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c |
7745 |
+index 599340c1f0b8..541dbcf22d0e 100644 |
7746 |
+--- a/drivers/infiniband/hw/cxgb4/device.c |
7747 |
++++ b/drivers/infiniband/hw/cxgb4/device.c |
7748 |
+@@ -953,6 +953,7 @@ void c4iw_dealloc(struct uld_ctx *ctx) |
7749 |
+ static void c4iw_remove(struct uld_ctx *ctx) |
7750 |
+ { |
7751 |
+ pr_debug("c4iw_dev %p\n", ctx->dev); |
7752 |
++ debugfs_remove_recursive(ctx->dev->debugfs_root); |
7753 |
+ c4iw_unregister_device(ctx->dev); |
7754 |
+ c4iw_dealloc(ctx); |
7755 |
+ } |
7756 |
+diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c |
7757 |
+index eea5574a62e8..69f842c92ff6 100644 |
7758 |
+--- a/drivers/infiniband/hw/efa/efa_com_cmd.c |
7759 |
++++ b/drivers/infiniband/hw/efa/efa_com_cmd.c |
7760 |
+@@ -388,7 +388,7 @@ static int efa_com_get_feature_ex(struct efa_com_dev *edev, |
7761 |
+ |
7762 |
+ if (control_buff_size) |
7763 |
+ EFA_SET(&get_cmd.aq_common_descriptor.flags, |
7764 |
+- EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT, 1); |
7765 |
++ EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA, 1); |
7766 |
+ |
7767 |
+ efa_com_set_dma_addr(control_buf_dma_addr, |
7768 |
+ &get_cmd.control_buffer.address.mem_addr_high, |
7769 |
+@@ -540,7 +540,7 @@ static int efa_com_set_feature_ex(struct efa_com_dev *edev, |
7770 |
+ if (control_buff_size) { |
7771 |
+ set_cmd->aq_common_descriptor.flags = 0; |
7772 |
+ EFA_SET(&set_cmd->aq_common_descriptor.flags, |
7773 |
+- EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT, 1); |
7774 |
++ EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA, 1); |
7775 |
+ efa_com_set_dma_addr(control_buf_dma_addr, |
7776 |
+ &set_cmd->control_buffer.address.mem_addr_high, |
7777 |
+ &set_cmd->control_buffer.address.mem_addr_low); |
7778 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7779 |
+index c3316672b70e..f9fa80ae5560 100644 |
7780 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7781 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7782 |
+@@ -1349,34 +1349,26 @@ static int hns_roce_query_pf_resource(struct hns_roce_dev *hr_dev) |
7783 |
+ static int hns_roce_query_pf_timer_resource(struct hns_roce_dev *hr_dev) |
7784 |
+ { |
7785 |
+ struct hns_roce_pf_timer_res_a *req_a; |
7786 |
+- struct hns_roce_cmq_desc desc[2]; |
7787 |
+- int ret, i; |
7788 |
++ struct hns_roce_cmq_desc desc; |
7789 |
++ int ret; |
7790 |
+ |
7791 |
+- for (i = 0; i < 2; i++) { |
7792 |
+- hns_roce_cmq_setup_basic_desc(&desc[i], |
7793 |
+- HNS_ROCE_OPC_QUERY_PF_TIMER_RES, |
7794 |
+- true); |
7795 |
++ hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_QUERY_PF_TIMER_RES, |
7796 |
++ true); |
7797 |
+ |
7798 |
+- if (i == 0) |
7799 |
+- desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT); |
7800 |
+- else |
7801 |
+- desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT); |
7802 |
+- } |
7803 |
+- |
7804 |
+- ret = hns_roce_cmq_send(hr_dev, desc, 2); |
7805 |
++ ret = hns_roce_cmq_send(hr_dev, &desc, 1); |
7806 |
+ if (ret) |
7807 |
+ return ret; |
7808 |
+ |
7809 |
+- req_a = (struct hns_roce_pf_timer_res_a *)desc[0].data; |
7810 |
++ req_a = (struct hns_roce_pf_timer_res_a *)desc.data; |
7811 |
+ |
7812 |
+ hr_dev->caps.qpc_timer_bt_num = |
7813 |
+- roce_get_field(req_a->qpc_timer_bt_idx_num, |
7814 |
+- PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_M, |
7815 |
+- PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_S); |
7816 |
++ roce_get_field(req_a->qpc_timer_bt_idx_num, |
7817 |
++ PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_M, |
7818 |
++ PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_S); |
7819 |
+ hr_dev->caps.cqc_timer_bt_num = |
7820 |
+- roce_get_field(req_a->cqc_timer_bt_idx_num, |
7821 |
+- PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_M, |
7822 |
+- PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_S); |
7823 |
++ roce_get_field(req_a->cqc_timer_bt_idx_num, |
7824 |
++ PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_M, |
7825 |
++ PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_S); |
7826 |
+ |
7827 |
+ return 0; |
7828 |
+ } |
7829 |
+@@ -4639,7 +4631,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, |
7830 |
+ qp_attr->path_mig_state = IB_MIG_ARMED; |
7831 |
+ qp_attr->ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE; |
7832 |
+ if (hr_qp->ibqp.qp_type == IB_QPT_UD) |
7833 |
+- qp_attr->qkey = V2_QKEY_VAL; |
7834 |
++ qp_attr->qkey = le32_to_cpu(context.qkey_xrcd); |
7835 |
+ |
7836 |
+ qp_attr->rq_psn = roce_get_field(context.byte_108_rx_reqepsn, |
7837 |
+ V2_QPC_BYTE_108_RX_REQ_EPSN_M, |
7838 |
+diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c |
7839 |
+index 46e1ab771f10..ed10e2f32aab 100644 |
7840 |
+--- a/drivers/infiniband/hw/mlx5/devx.c |
7841 |
++++ b/drivers/infiniband/hw/mlx5/devx.c |
7842 |
+@@ -494,6 +494,10 @@ static u64 devx_get_obj_id(const void *in) |
7843 |
+ obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
7844 |
+ MLX5_GET(rst2init_qp_in, in, qpn)); |
7845 |
+ break; |
7846 |
++ case MLX5_CMD_OP_INIT2INIT_QP: |
7847 |
++ obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
7848 |
++ MLX5_GET(init2init_qp_in, in, qpn)); |
7849 |
++ break; |
7850 |
+ case MLX5_CMD_OP_INIT2RTR_QP: |
7851 |
+ obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
7852 |
+ MLX5_GET(init2rtr_qp_in, in, qpn)); |
7853 |
+@@ -819,6 +823,7 @@ static bool devx_is_obj_modify_cmd(const void *in) |
7854 |
+ case MLX5_CMD_OP_SET_L2_TABLE_ENTRY: |
7855 |
+ case MLX5_CMD_OP_RST2INIT_QP: |
7856 |
+ case MLX5_CMD_OP_INIT2RTR_QP: |
7857 |
++ case MLX5_CMD_OP_INIT2INIT_QP: |
7858 |
+ case MLX5_CMD_OP_RTR2RTS_QP: |
7859 |
+ case MLX5_CMD_OP_RTS2RTS_QP: |
7860 |
+ case MLX5_CMD_OP_SQERR2RTS_QP: |
7861 |
+diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c |
7862 |
+index b1a8a9175040..6d1ff13d2283 100644 |
7863 |
+--- a/drivers/infiniband/hw/mlx5/srq.c |
7864 |
++++ b/drivers/infiniband/hw/mlx5/srq.c |
7865 |
+@@ -310,12 +310,18 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq, |
7866 |
+ srq->msrq.event = mlx5_ib_srq_event; |
7867 |
+ srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn; |
7868 |
+ |
7869 |
+- if (udata) |
7870 |
+- if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof(__u32))) { |
7871 |
++ if (udata) { |
7872 |
++ struct mlx5_ib_create_srq_resp resp = { |
7873 |
++ .srqn = srq->msrq.srqn, |
7874 |
++ }; |
7875 |
++ |
7876 |
++ if (ib_copy_to_udata(udata, &resp, min(udata->outlen, |
7877 |
++ sizeof(resp)))) { |
7878 |
+ mlx5_ib_dbg(dev, "copy to user failed\n"); |
7879 |
+ err = -EFAULT; |
7880 |
+ goto err_core; |
7881 |
+ } |
7882 |
++ } |
7883 |
+ |
7884 |
+ init_attr->attr.max_wr = srq->msrq.max - 1; |
7885 |
+ |
7886 |
+diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c |
7887 |
+index 98552749d71c..fcf982c60db6 100644 |
7888 |
+--- a/drivers/infiniband/ulp/srpt/ib_srpt.c |
7889 |
++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c |
7890 |
+@@ -610,6 +610,11 @@ static int srpt_refresh_port(struct srpt_port *sport) |
7891 |
+ dev_name(&sport->sdev->device->dev), sport->port, |
7892 |
+ PTR_ERR(sport->mad_agent)); |
7893 |
+ sport->mad_agent = NULL; |
7894 |
++ memset(&port_modify, 0, sizeof(port_modify)); |
7895 |
++ port_modify.clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP; |
7896 |
++ ib_modify_port(sport->sdev->device, sport->port, 0, |
7897 |
++ &port_modify); |
7898 |
++ |
7899 |
+ } |
7900 |
+ } |
7901 |
+ |
7902 |
+@@ -633,9 +638,8 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) |
7903 |
+ for (i = 1; i <= sdev->device->phys_port_cnt; i++) { |
7904 |
+ sport = &sdev->port[i - 1]; |
7905 |
+ WARN_ON(sport->port != i); |
7906 |
+- if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0) |
7907 |
+- pr_err("disabling MAD processing failed.\n"); |
7908 |
+ if (sport->mad_agent) { |
7909 |
++ ib_modify_port(sdev->device, i, 0, &port_modify); |
7910 |
+ ib_unregister_mad_agent(sport->mad_agent); |
7911 |
+ sport->mad_agent = NULL; |
7912 |
+ } |
7913 |
+diff --git a/drivers/input/serio/i8042-ppcio.h b/drivers/input/serio/i8042-ppcio.h |
7914 |
+deleted file mode 100644 |
7915 |
+index 391f94d9e47d..000000000000 |
7916 |
+--- a/drivers/input/serio/i8042-ppcio.h |
7917 |
++++ /dev/null |
7918 |
+@@ -1,57 +0,0 @@ |
7919 |
+-/* SPDX-License-Identifier: GPL-2.0-only */ |
7920 |
+-#ifndef _I8042_PPCIO_H |
7921 |
+-#define _I8042_PPCIO_H |
7922 |
+- |
7923 |
+- |
7924 |
+-#if defined(CONFIG_WALNUT) |
7925 |
+- |
7926 |
+-#define I8042_KBD_IRQ 25 |
7927 |
+-#define I8042_AUX_IRQ 26 |
7928 |
+- |
7929 |
+-#define I8042_KBD_PHYS_DESC "walnutps2/serio0" |
7930 |
+-#define I8042_AUX_PHYS_DESC "walnutps2/serio1" |
7931 |
+-#define I8042_MUX_PHYS_DESC "walnutps2/serio%d" |
7932 |
+- |
7933 |
+-extern void *kb_cs; |
7934 |
+-extern void *kb_data; |
7935 |
+- |
7936 |
+-#define I8042_COMMAND_REG (*(int *)kb_cs) |
7937 |
+-#define I8042_DATA_REG (*(int *)kb_data) |
7938 |
+- |
7939 |
+-static inline int i8042_read_data(void) |
7940 |
+-{ |
7941 |
+- return readb(kb_data); |
7942 |
+-} |
7943 |
+- |
7944 |
+-static inline int i8042_read_status(void) |
7945 |
+-{ |
7946 |
+- return readb(kb_cs); |
7947 |
+-} |
7948 |
+- |
7949 |
+-static inline void i8042_write_data(int val) |
7950 |
+-{ |
7951 |
+- writeb(val, kb_data); |
7952 |
+-} |
7953 |
+- |
7954 |
+-static inline void i8042_write_command(int val) |
7955 |
+-{ |
7956 |
+- writeb(val, kb_cs); |
7957 |
+-} |
7958 |
+- |
7959 |
+-static inline int i8042_platform_init(void) |
7960 |
+-{ |
7961 |
+- i8042_reset = I8042_RESET_ALWAYS; |
7962 |
+- return 0; |
7963 |
+-} |
7964 |
+- |
7965 |
+-static inline void i8042_platform_exit(void) |
7966 |
+-{ |
7967 |
+-} |
7968 |
+- |
7969 |
+-#else |
7970 |
+- |
7971 |
+-#include "i8042-io.h" |
7972 |
+- |
7973 |
+-#endif |
7974 |
+- |
7975 |
+-#endif /* _I8042_PPCIO_H */ |
7976 |
+diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h |
7977 |
+index 38dc27ad3c18..eb376700dfff 100644 |
7978 |
+--- a/drivers/input/serio/i8042.h |
7979 |
++++ b/drivers/input/serio/i8042.h |
7980 |
+@@ -17,8 +17,6 @@ |
7981 |
+ #include "i8042-ip22io.h" |
7982 |
+ #elif defined(CONFIG_SNI_RM) |
7983 |
+ #include "i8042-snirm.h" |
7984 |
+-#elif defined(CONFIG_PPC) |
7985 |
+-#include "i8042-ppcio.h" |
7986 |
+ #elif defined(CONFIG_SPARC) |
7987 |
+ #include "i8042-sparcio.h" |
7988 |
+ #elif defined(CONFIG_X86) || defined(CONFIG_IA64) |
7989 |
+diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c |
7990 |
+index d2587724c52a..9b8450794a8a 100644 |
7991 |
+--- a/drivers/input/touchscreen/edt-ft5x06.c |
7992 |
++++ b/drivers/input/touchscreen/edt-ft5x06.c |
7993 |
+@@ -938,19 +938,25 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev, |
7994 |
+ |
7995 |
+ error = device_property_read_u32(dev, "offset", &val); |
7996 |
+ if (!error) { |
7997 |
+- edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val); |
7998 |
++ if (reg_addr->reg_offset != NO_REGISTER) |
7999 |
++ edt_ft5x06_register_write(tsdata, |
8000 |
++ reg_addr->reg_offset, val); |
8001 |
+ tsdata->offset = val; |
8002 |
+ } |
8003 |
+ |
8004 |
+ error = device_property_read_u32(dev, "offset-x", &val); |
8005 |
+ if (!error) { |
8006 |
+- edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_x, val); |
8007 |
++ if (reg_addr->reg_offset_x != NO_REGISTER) |
8008 |
++ edt_ft5x06_register_write(tsdata, |
8009 |
++ reg_addr->reg_offset_x, val); |
8010 |
+ tsdata->offset_x = val; |
8011 |
+ } |
8012 |
+ |
8013 |
+ error = device_property_read_u32(dev, "offset-y", &val); |
8014 |
+ if (!error) { |
8015 |
+- edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_y, val); |
8016 |
++ if (reg_addr->reg_offset_y != NO_REGISTER) |
8017 |
++ edt_ft5x06_register_write(tsdata, |
8018 |
++ reg_addr->reg_offset_y, val); |
8019 |
+ tsdata->offset_y = val; |
8020 |
+ } |
8021 |
+ } |
8022 |
+diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c |
8023 |
+index 82508730feb7..af21d24a09e8 100644 |
8024 |
+--- a/drivers/iommu/arm-smmu-v3.c |
8025 |
++++ b/drivers/iommu/arm-smmu-v3.c |
8026 |
+@@ -171,6 +171,8 @@ |
8027 |
+ #define ARM_SMMU_PRIQ_IRQ_CFG1 0xd8 |
8028 |
+ #define ARM_SMMU_PRIQ_IRQ_CFG2 0xdc |
8029 |
+ |
8030 |
++#define ARM_SMMU_REG_SZ 0xe00 |
8031 |
++ |
8032 |
+ /* Common MSI config fields */ |
8033 |
+ #define MSI_CFG0_ADDR_MASK GENMASK_ULL(51, 2) |
8034 |
+ #define MSI_CFG2_SH GENMASK(5, 4) |
8035 |
+@@ -628,6 +630,7 @@ struct arm_smmu_strtab_cfg { |
8036 |
+ struct arm_smmu_device { |
8037 |
+ struct device *dev; |
8038 |
+ void __iomem *base; |
8039 |
++ void __iomem *page1; |
8040 |
+ |
8041 |
+ #define ARM_SMMU_FEAT_2_LVL_STRTAB (1 << 0) |
8042 |
+ #define ARM_SMMU_FEAT_2_LVL_CDTAB (1 << 1) |
8043 |
+@@ -733,9 +736,8 @@ static struct arm_smmu_option_prop arm_smmu_options[] = { |
8044 |
+ static inline void __iomem *arm_smmu_page1_fixup(unsigned long offset, |
8045 |
+ struct arm_smmu_device *smmu) |
8046 |
+ { |
8047 |
+- if ((offset > SZ_64K) && |
8048 |
+- (smmu->options & ARM_SMMU_OPT_PAGE0_REGS_ONLY)) |
8049 |
+- offset -= SZ_64K; |
8050 |
++ if (offset > SZ_64K) |
8051 |
++ return smmu->page1 + offset - SZ_64K; |
8052 |
+ |
8053 |
+ return smmu->base + offset; |
8054 |
+ } |
8055 |
+@@ -4021,6 +4023,18 @@ err_reset_pci_ops: __maybe_unused; |
8056 |
+ return err; |
8057 |
+ } |
8058 |
+ |
8059 |
++static void __iomem *arm_smmu_ioremap(struct device *dev, resource_size_t start, |
8060 |
++ resource_size_t size) |
8061 |
++{ |
8062 |
++ struct resource res = { |
8063 |
++ .flags = IORESOURCE_MEM, |
8064 |
++ .start = start, |
8065 |
++ .end = start + size - 1, |
8066 |
++ }; |
8067 |
++ |
8068 |
++ return devm_ioremap_resource(dev, &res); |
8069 |
++} |
8070 |
++ |
8071 |
+ static int arm_smmu_device_probe(struct platform_device *pdev) |
8072 |
+ { |
8073 |
+ int irq, ret; |
8074 |
+@@ -4056,10 +4070,23 @@ static int arm_smmu_device_probe(struct platform_device *pdev) |
8075 |
+ } |
8076 |
+ ioaddr = res->start; |
8077 |
+ |
8078 |
+- smmu->base = devm_ioremap_resource(dev, res); |
8079 |
++ /* |
8080 |
++ * Don't map the IMPLEMENTATION DEFINED regions, since they may contain |
8081 |
++ * the PMCG registers which are reserved by the PMU driver. |
8082 |
++ */ |
8083 |
++ smmu->base = arm_smmu_ioremap(dev, ioaddr, ARM_SMMU_REG_SZ); |
8084 |
+ if (IS_ERR(smmu->base)) |
8085 |
+ return PTR_ERR(smmu->base); |
8086 |
+ |
8087 |
++ if (arm_smmu_resource_size(smmu) > SZ_64K) { |
8088 |
++ smmu->page1 = arm_smmu_ioremap(dev, ioaddr + SZ_64K, |
8089 |
++ ARM_SMMU_REG_SZ); |
8090 |
++ if (IS_ERR(smmu->page1)) |
8091 |
++ return PTR_ERR(smmu->page1); |
8092 |
++ } else { |
8093 |
++ smmu->page1 = smmu->base; |
8094 |
++ } |
8095 |
++ |
8096 |
+ /* Interrupt lines */ |
8097 |
+ |
8098 |
+ irq = platform_get_irq_byname_optional(pdev, "combined"); |
8099 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
8100 |
+index 11ed871dd255..fde7aba49b74 100644 |
8101 |
+--- a/drivers/iommu/intel-iommu.c |
8102 |
++++ b/drivers/iommu/intel-iommu.c |
8103 |
+@@ -2518,9 +2518,6 @@ struct dmar_domain *find_domain(struct device *dev) |
8104 |
+ if (unlikely(attach_deferred(dev) || iommu_dummy(dev))) |
8105 |
+ return NULL; |
8106 |
+ |
8107 |
+- if (dev_is_pci(dev)) |
8108 |
+- dev = &pci_real_dma_dev(to_pci_dev(dev))->dev; |
8109 |
+- |
8110 |
+ /* No lock here, assumes no domain exit in normal case */ |
8111 |
+ info = dev->archdata.iommu; |
8112 |
+ if (likely(info)) |
8113 |
+diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c |
8114 |
+index 7906624a731c..478308fb82cc 100644 |
8115 |
+--- a/drivers/mailbox/imx-mailbox.c |
8116 |
++++ b/drivers/mailbox/imx-mailbox.c |
8117 |
+@@ -66,6 +66,8 @@ struct imx_mu_priv { |
8118 |
+ struct clk *clk; |
8119 |
+ int irq; |
8120 |
+ |
8121 |
++ u32 xcr; |
8122 |
++ |
8123 |
+ bool side_b; |
8124 |
+ }; |
8125 |
+ |
8126 |
+@@ -374,7 +376,7 @@ static struct mbox_chan *imx_mu_scu_xlate(struct mbox_controller *mbox, |
8127 |
+ break; |
8128 |
+ default: |
8129 |
+ dev_err(mbox->dev, "Invalid chan type: %d\n", type); |
8130 |
+- return NULL; |
8131 |
++ return ERR_PTR(-EINVAL); |
8132 |
+ } |
8133 |
+ |
8134 |
+ if (chan >= mbox->num_chans) { |
8135 |
+@@ -558,12 +560,45 @@ static const struct of_device_id imx_mu_dt_ids[] = { |
8136 |
+ }; |
8137 |
+ MODULE_DEVICE_TABLE(of, imx_mu_dt_ids); |
8138 |
+ |
8139 |
++static int imx_mu_suspend_noirq(struct device *dev) |
8140 |
++{ |
8141 |
++ struct imx_mu_priv *priv = dev_get_drvdata(dev); |
8142 |
++ |
8143 |
++ priv->xcr = imx_mu_read(priv, priv->dcfg->xCR); |
8144 |
++ |
8145 |
++ return 0; |
8146 |
++} |
8147 |
++ |
8148 |
++static int imx_mu_resume_noirq(struct device *dev) |
8149 |
++{ |
8150 |
++ struct imx_mu_priv *priv = dev_get_drvdata(dev); |
8151 |
++ |
8152 |
++ /* |
8153 |
++ * ONLY restore MU when context lost, the TIE could |
8154 |
++ * be set during noirq resume as there is MU data |
8155 |
++ * communication going on, and restore the saved |
8156 |
++ * value will overwrite the TIE and cause MU data |
8157 |
++ * send failed, may lead to system freeze. This issue |
8158 |
++ * is observed by testing freeze mode suspend. |
8159 |
++ */ |
8160 |
++ if (!imx_mu_read(priv, priv->dcfg->xCR)) |
8161 |
++ imx_mu_write(priv, priv->xcr, priv->dcfg->xCR); |
8162 |
++ |
8163 |
++ return 0; |
8164 |
++} |
8165 |
++ |
8166 |
++static const struct dev_pm_ops imx_mu_pm_ops = { |
8167 |
++ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_mu_suspend_noirq, |
8168 |
++ imx_mu_resume_noirq) |
8169 |
++}; |
8170 |
++ |
8171 |
+ static struct platform_driver imx_mu_driver = { |
8172 |
+ .probe = imx_mu_probe, |
8173 |
+ .remove = imx_mu_remove, |
8174 |
+ .driver = { |
8175 |
+ .name = "imx_mu", |
8176 |
+ .of_match_table = imx_mu_dt_ids, |
8177 |
++ .pm = &imx_mu_pm_ops, |
8178 |
+ }, |
8179 |
+ }; |
8180 |
+ module_platform_driver(imx_mu_driver); |
8181 |
+diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c |
8182 |
+index 86887c9a349a..f9cc674ba9b7 100644 |
8183 |
+--- a/drivers/mailbox/zynqmp-ipi-mailbox.c |
8184 |
++++ b/drivers/mailbox/zynqmp-ipi-mailbox.c |
8185 |
+@@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8186 |
+ mchan->req_buf_size = resource_size(&res); |
8187 |
+ mchan->req_buf = devm_ioremap(mdev, res.start, |
8188 |
+ mchan->req_buf_size); |
8189 |
+- if (IS_ERR(mchan->req_buf)) { |
8190 |
++ if (!mchan->req_buf) { |
8191 |
+ dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8192 |
+- ret = PTR_ERR(mchan->req_buf); |
8193 |
+- return ret; |
8194 |
++ return -ENOMEM; |
8195 |
+ } |
8196 |
+ } else if (ret != -ENODEV) { |
8197 |
+ dev_err(mdev, "Unmatched resource %s, %d.\n", name, ret); |
8198 |
+@@ -520,10 +519,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8199 |
+ mchan->resp_buf_size = resource_size(&res); |
8200 |
+ mchan->resp_buf = devm_ioremap(mdev, res.start, |
8201 |
+ mchan->resp_buf_size); |
8202 |
+- if (IS_ERR(mchan->resp_buf)) { |
8203 |
++ if (!mchan->resp_buf) { |
8204 |
+ dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8205 |
+- ret = PTR_ERR(mchan->resp_buf); |
8206 |
+- return ret; |
8207 |
++ return -ENOMEM; |
8208 |
+ } |
8209 |
+ } else if (ret != -ENODEV) { |
8210 |
+ dev_err(mdev, "Unmatched resource %s.\n", name); |
8211 |
+@@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8212 |
+ mchan->req_buf_size = resource_size(&res); |
8213 |
+ mchan->req_buf = devm_ioremap(mdev, res.start, |
8214 |
+ mchan->req_buf_size); |
8215 |
+- if (IS_ERR(mchan->req_buf)) { |
8216 |
++ if (!mchan->req_buf) { |
8217 |
+ dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8218 |
+- ret = PTR_ERR(mchan->req_buf); |
8219 |
+- return ret; |
8220 |
++ return -ENOMEM; |
8221 |
+ } |
8222 |
+ } else if (ret != -ENODEV) { |
8223 |
+ dev_err(mdev, "Unmatched resource %s.\n", name); |
8224 |
+@@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8225 |
+ mchan->resp_buf_size = resource_size(&res); |
8226 |
+ mchan->resp_buf = devm_ioremap(mdev, res.start, |
8227 |
+ mchan->resp_buf_size); |
8228 |
+- if (IS_ERR(mchan->resp_buf)) { |
8229 |
++ if (!mchan->resp_buf) { |
8230 |
+ dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8231 |
+- ret = PTR_ERR(mchan->resp_buf); |
8232 |
+- return ret; |
8233 |
++ return -ENOMEM; |
8234 |
+ } |
8235 |
+ } else if (ret != -ENODEV) { |
8236 |
+ dev_err(mdev, "Unmatched resource %s.\n", name); |
8237 |
+diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
8238 |
+index 72856e5f23a3..fd1f288fd801 100644 |
8239 |
+--- a/drivers/md/bcache/btree.c |
8240 |
++++ b/drivers/md/bcache/btree.c |
8241 |
+@@ -1389,7 +1389,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
8242 |
+ if (__set_blocks(n1, n1->keys + n2->keys, |
8243 |
+ block_bytes(b->c)) > |
8244 |
+ btree_blocks(new_nodes[i])) |
8245 |
+- goto out_nocoalesce; |
8246 |
++ goto out_unlock_nocoalesce; |
8247 |
+ |
8248 |
+ keys = n2->keys; |
8249 |
+ /* Take the key of the node we're getting rid of */ |
8250 |
+@@ -1418,7 +1418,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
8251 |
+ |
8252 |
+ if (__bch_keylist_realloc(&keylist, |
8253 |
+ bkey_u64s(&new_nodes[i]->key))) |
8254 |
+- goto out_nocoalesce; |
8255 |
++ goto out_unlock_nocoalesce; |
8256 |
+ |
8257 |
+ bch_btree_node_write(new_nodes[i], &cl); |
8258 |
+ bch_keylist_add(&keylist, &new_nodes[i]->key); |
8259 |
+@@ -1464,6 +1464,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
8260 |
+ /* Invalidated our iterator */ |
8261 |
+ return -EINTR; |
8262 |
+ |
8263 |
++out_unlock_nocoalesce: |
8264 |
++ for (i = 0; i < nodes; i++) |
8265 |
++ mutex_unlock(&new_nodes[i]->write_lock); |
8266 |
++ |
8267 |
+ out_nocoalesce: |
8268 |
+ closure_sync(&cl); |
8269 |
+ |
8270 |
+diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
8271 |
+index 3e500098132f..e0c800cf87a9 100644 |
8272 |
+--- a/drivers/md/dm-mpath.c |
8273 |
++++ b/drivers/md/dm-mpath.c |
8274 |
+@@ -1918,7 +1918,7 @@ static int multipath_prepare_ioctl(struct dm_target *ti, |
8275 |
+ int r; |
8276 |
+ |
8277 |
+ current_pgpath = READ_ONCE(m->current_pgpath); |
8278 |
+- if (!current_pgpath) |
8279 |
++ if (!current_pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) |
8280 |
+ current_pgpath = choose_pgpath(m, 0); |
8281 |
+ |
8282 |
+ if (current_pgpath) { |
8283 |
+diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c |
8284 |
+index 369de15c4e80..61b7d7b7e5a6 100644 |
8285 |
+--- a/drivers/md/dm-zoned-metadata.c |
8286 |
++++ b/drivers/md/dm-zoned-metadata.c |
8287 |
+@@ -1554,7 +1554,7 @@ static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd) |
8288 |
+ return dzone; |
8289 |
+ } |
8290 |
+ |
8291 |
+- return ERR_PTR(-EBUSY); |
8292 |
++ return NULL; |
8293 |
+ } |
8294 |
+ |
8295 |
+ /* |
8296 |
+@@ -1574,7 +1574,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd) |
8297 |
+ return zone; |
8298 |
+ } |
8299 |
+ |
8300 |
+- return ERR_PTR(-EBUSY); |
8301 |
++ return NULL; |
8302 |
+ } |
8303 |
+ |
8304 |
+ /* |
8305 |
+diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c |
8306 |
+index e7ace908a9b7..d50817320e8e 100644 |
8307 |
+--- a/drivers/md/dm-zoned-reclaim.c |
8308 |
++++ b/drivers/md/dm-zoned-reclaim.c |
8309 |
+@@ -349,8 +349,8 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc) |
8310 |
+ |
8311 |
+ /* Get a data zone */ |
8312 |
+ dzone = dmz_get_zone_for_reclaim(zmd); |
8313 |
+- if (IS_ERR(dzone)) |
8314 |
+- return PTR_ERR(dzone); |
8315 |
++ if (!dzone) |
8316 |
++ return -EBUSY; |
8317 |
+ |
8318 |
+ start = jiffies; |
8319 |
+ |
8320 |
+diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
8321 |
+index 5c2a23b953a4..eba2b9f040df 100644 |
8322 |
+--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c |
8323 |
++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
8324 |
+@@ -1089,6 +1089,10 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, |
8325 |
+ child->coherent_dma_mask = dev->coherent_dma_mask; |
8326 |
+ child->dma_mask = dev->dma_mask; |
8327 |
+ child->release = s5p_mfc_memdev_release; |
8328 |
++ child->dma_parms = devm_kzalloc(dev, sizeof(*child->dma_parms), |
8329 |
++ GFP_KERNEL); |
8330 |
++ if (!child->dma_parms) |
8331 |
++ goto err; |
8332 |
+ |
8333 |
+ /* |
8334 |
+ * The memdevs are not proper OF platform devices, so in order for them |
8335 |
+@@ -1104,7 +1108,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, |
8336 |
+ return child; |
8337 |
+ device_del(child); |
8338 |
+ } |
8339 |
+- |
8340 |
++err: |
8341 |
+ put_device(child); |
8342 |
+ return NULL; |
8343 |
+ } |
8344 |
+diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c |
8345 |
+index 452edd06d67d..99fd377f9b81 100644 |
8346 |
+--- a/drivers/media/v4l2-core/v4l2-ctrls.c |
8347 |
++++ b/drivers/media/v4l2-core/v4l2-ctrls.c |
8348 |
+@@ -1825,7 +1825,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, |
8349 |
+ sizeof(p_hevc_pps->row_height_minus1)); |
8350 |
+ |
8351 |
+ p_hevc_pps->flags &= |
8352 |
+- ~V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED; |
8353 |
++ ~V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED; |
8354 |
+ } |
8355 |
+ |
8356 |
+ if (p_hevc_pps->flags & |
8357 |
+diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c |
8358 |
+index 857991cb3cbb..711979afd90a 100644 |
8359 |
+--- a/drivers/mfd/stmfx.c |
8360 |
++++ b/drivers/mfd/stmfx.c |
8361 |
+@@ -287,14 +287,21 @@ static int stmfx_irq_init(struct i2c_client *client) |
8362 |
+ |
8363 |
+ ret = regmap_write(stmfx->map, STMFX_REG_IRQ_OUT_PIN, irqoutpin); |
8364 |
+ if (ret) |
8365 |
+- return ret; |
8366 |
++ goto irq_exit; |
8367 |
+ |
8368 |
+ ret = devm_request_threaded_irq(stmfx->dev, client->irq, |
8369 |
+ NULL, stmfx_irq_handler, |
8370 |
+ irqtrigger | IRQF_ONESHOT, |
8371 |
+ "stmfx", stmfx); |
8372 |
+ if (ret) |
8373 |
+- stmfx_irq_exit(client); |
8374 |
++ goto irq_exit; |
8375 |
++ |
8376 |
++ stmfx->irq = client->irq; |
8377 |
++ |
8378 |
++ return 0; |
8379 |
++ |
8380 |
++irq_exit: |
8381 |
++ stmfx_irq_exit(client); |
8382 |
+ |
8383 |
+ return ret; |
8384 |
+ } |
8385 |
+@@ -481,6 +488,8 @@ static int stmfx_suspend(struct device *dev) |
8386 |
+ if (ret) |
8387 |
+ return ret; |
8388 |
+ |
8389 |
++ disable_irq(stmfx->irq); |
8390 |
++ |
8391 |
+ if (stmfx->vdd) |
8392 |
+ return regulator_disable(stmfx->vdd); |
8393 |
+ |
8394 |
+@@ -501,6 +510,13 @@ static int stmfx_resume(struct device *dev) |
8395 |
+ } |
8396 |
+ } |
8397 |
+ |
8398 |
++ /* Reset STMFX - supply has been stopped during suspend */ |
8399 |
++ ret = stmfx_chip_reset(stmfx); |
8400 |
++ if (ret) { |
8401 |
++ dev_err(stmfx->dev, "Failed to reset chip: %d\n", ret); |
8402 |
++ return ret; |
8403 |
++ } |
8404 |
++ |
8405 |
+ ret = regmap_raw_write(stmfx->map, STMFX_REG_SYS_CTRL, |
8406 |
+ &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl)); |
8407 |
+ if (ret) |
8408 |
+@@ -517,6 +533,8 @@ static int stmfx_resume(struct device *dev) |
8409 |
+ if (ret) |
8410 |
+ return ret; |
8411 |
+ |
8412 |
++ enable_irq(stmfx->irq); |
8413 |
++ |
8414 |
+ return 0; |
8415 |
+ } |
8416 |
+ #endif |
8417 |
+diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c |
8418 |
+index 90341f3c6810..da910302d51a 100644 |
8419 |
+--- a/drivers/mfd/wcd934x.c |
8420 |
++++ b/drivers/mfd/wcd934x.c |
8421 |
+@@ -280,7 +280,6 @@ static void wcd934x_slim_remove(struct slim_device *sdev) |
8422 |
+ |
8423 |
+ regulator_bulk_disable(WCD934X_MAX_SUPPLY, ddata->supplies); |
8424 |
+ mfd_remove_devices(&sdev->dev); |
8425 |
+- kfree(ddata); |
8426 |
+ } |
8427 |
+ |
8428 |
+ static const struct slim_device_id wcd934x_slim_id[] = { |
8429 |
+diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c |
8430 |
+index 1e9fe7d92597..737dede4a95c 100644 |
8431 |
+--- a/drivers/mfd/wm8994-core.c |
8432 |
++++ b/drivers/mfd/wm8994-core.c |
8433 |
+@@ -690,3 +690,4 @@ module_i2c_driver(wm8994_i2c_driver); |
8434 |
+ MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC"); |
8435 |
+ MODULE_LICENSE("GPL"); |
8436 |
+ MODULE_AUTHOR("Mark Brown <broonie@×××××××××××××××××××××××.com>"); |
8437 |
++MODULE_SOFTDEP("pre: wm8994_regulator"); |
8438 |
+diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
8439 |
+index e3e085e33d46..7939c55daceb 100644 |
8440 |
+--- a/drivers/misc/fastrpc.c |
8441 |
++++ b/drivers/misc/fastrpc.c |
8442 |
+@@ -904,6 +904,7 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, |
8443 |
+ struct fastrpc_channel_ctx *cctx; |
8444 |
+ struct fastrpc_user *fl = ctx->fl; |
8445 |
+ struct fastrpc_msg *msg = &ctx->msg; |
8446 |
++ int ret; |
8447 |
+ |
8448 |
+ cctx = fl->cctx; |
8449 |
+ msg->pid = fl->tgid; |
8450 |
+@@ -919,7 +920,13 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, |
8451 |
+ msg->size = roundup(ctx->msg_sz, PAGE_SIZE); |
8452 |
+ fastrpc_context_get(ctx); |
8453 |
+ |
8454 |
+- return rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); |
8455 |
++ ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); |
8456 |
++ |
8457 |
++ if (ret) |
8458 |
++ fastrpc_context_put(ctx); |
8459 |
++ |
8460 |
++ return ret; |
8461 |
++ |
8462 |
+ } |
8463 |
+ |
8464 |
+ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, |
8465 |
+@@ -1613,8 +1620,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) |
8466 |
+ domains[domain_id]); |
8467 |
+ data->miscdev.fops = &fastrpc_fops; |
8468 |
+ err = misc_register(&data->miscdev); |
8469 |
+- if (err) |
8470 |
++ if (err) { |
8471 |
++ kfree(data); |
8472 |
+ return err; |
8473 |
++ } |
8474 |
+ |
8475 |
+ kref_init(&data->refcount); |
8476 |
+ |
8477 |
+diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c |
8478 |
+index aef4de36b7aa..6d9c298e02c7 100644 |
8479 |
+--- a/drivers/misc/habanalabs/device.c |
8480 |
++++ b/drivers/misc/habanalabs/device.c |
8481 |
+@@ -718,7 +718,7 @@ disable_device: |
8482 |
+ return rc; |
8483 |
+ } |
8484 |
+ |
8485 |
+-static void device_kill_open_processes(struct hl_device *hdev) |
8486 |
++static int device_kill_open_processes(struct hl_device *hdev) |
8487 |
+ { |
8488 |
+ u16 pending_total, pending_cnt; |
8489 |
+ struct hl_fpriv *hpriv; |
8490 |
+@@ -771,9 +771,7 @@ static void device_kill_open_processes(struct hl_device *hdev) |
8491 |
+ ssleep(1); |
8492 |
+ } |
8493 |
+ |
8494 |
+- if (!list_empty(&hdev->fpriv_list)) |
8495 |
+- dev_crit(hdev->dev, |
8496 |
+- "Going to hard reset with open user contexts\n"); |
8497 |
++ return list_empty(&hdev->fpriv_list) ? 0 : -EBUSY; |
8498 |
+ } |
8499 |
+ |
8500 |
+ static void device_hard_reset_pending(struct work_struct *work) |
8501 |
+@@ -894,7 +892,12 @@ again: |
8502 |
+ * process can't really exit until all its CSs are done, which |
8503 |
+ * is what we do in cs rollback |
8504 |
+ */ |
8505 |
+- device_kill_open_processes(hdev); |
8506 |
++ rc = device_kill_open_processes(hdev); |
8507 |
++ if (rc) { |
8508 |
++ dev_crit(hdev->dev, |
8509 |
++ "Failed to kill all open processes, stopping hard reset\n"); |
8510 |
++ goto out_err; |
8511 |
++ } |
8512 |
+ |
8513 |
+ /* Flush the Event queue workers to make sure no other thread is |
8514 |
+ * reading or writing to registers during the reset |
8515 |
+@@ -1375,7 +1378,9 @@ void hl_device_fini(struct hl_device *hdev) |
8516 |
+ * can't really exit until all its CSs are done, which is what we |
8517 |
+ * do in cs rollback |
8518 |
+ */ |
8519 |
+- device_kill_open_processes(hdev); |
8520 |
++ rc = device_kill_open_processes(hdev); |
8521 |
++ if (rc) |
8522 |
++ dev_crit(hdev->dev, "Failed to kill all open processes\n"); |
8523 |
+ |
8524 |
+ hl_cb_pool_fini(hdev); |
8525 |
+ |
8526 |
+diff --git a/drivers/misc/habanalabs/habanalabs.h b/drivers/misc/habanalabs/habanalabs.h |
8527 |
+index 31ebcf9458fe..a6dd8e6ca594 100644 |
8528 |
+--- a/drivers/misc/habanalabs/habanalabs.h |
8529 |
++++ b/drivers/misc/habanalabs/habanalabs.h |
8530 |
+@@ -23,7 +23,7 @@ |
8531 |
+ |
8532 |
+ #define HL_MMAP_CB_MASK (0x8000000000000000ull >> PAGE_SHIFT) |
8533 |
+ |
8534 |
+-#define HL_PENDING_RESET_PER_SEC 5 |
8535 |
++#define HL_PENDING_RESET_PER_SEC 30 |
8536 |
+ |
8537 |
+ #define HL_DEVICE_TIMEOUT_USEC 1000000 /* 1 s */ |
8538 |
+ |
8539 |
+diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c |
8540 |
+index 71bbaa56bdb5..e2766aad9e14 100644 |
8541 |
+--- a/drivers/misc/xilinx_sdfec.c |
8542 |
++++ b/drivers/misc/xilinx_sdfec.c |
8543 |
+@@ -602,10 +602,10 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
8544 |
+ const u32 depth) |
8545 |
+ { |
8546 |
+ u32 reg = 0; |
8547 |
+- u32 res; |
8548 |
+- u32 n, i; |
8549 |
++ int res, i, nr_pages; |
8550 |
++ u32 n; |
8551 |
+ u32 *addr = NULL; |
8552 |
+- struct page *page[MAX_NUM_PAGES]; |
8553 |
++ struct page *pages[MAX_NUM_PAGES]; |
8554 |
+ |
8555 |
+ /* |
8556 |
+ * Writes that go beyond the length of |
8557 |
+@@ -622,15 +622,22 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
8558 |
+ if ((len * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE) |
8559 |
+ n += 1; |
8560 |
+ |
8561 |
+- res = get_user_pages_fast((unsigned long)src_ptr, n, 0, page); |
8562 |
+- if (res < n) { |
8563 |
+- for (i = 0; i < res; i++) |
8564 |
+- put_page(page[i]); |
8565 |
++ if (WARN_ON_ONCE(n > INT_MAX)) |
8566 |
++ return -EINVAL; |
8567 |
++ |
8568 |
++ nr_pages = n; |
8569 |
++ |
8570 |
++ res = get_user_pages_fast((unsigned long)src_ptr, nr_pages, 0, pages); |
8571 |
++ if (res < nr_pages) { |
8572 |
++ if (res > 0) { |
8573 |
++ for (i = 0; i < res; i++) |
8574 |
++ put_page(pages[i]); |
8575 |
++ } |
8576 |
+ return -EINVAL; |
8577 |
+ } |
8578 |
+ |
8579 |
+- for (i = 0; i < n; i++) { |
8580 |
+- addr = kmap(page[i]); |
8581 |
++ for (i = 0; i < nr_pages; i++) { |
8582 |
++ addr = kmap(pages[i]); |
8583 |
+ do { |
8584 |
+ xsdfec_regwrite(xsdfec, |
8585 |
+ base_addr + ((offset + reg) * |
8586 |
+@@ -639,7 +646,7 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
8587 |
+ reg++; |
8588 |
+ } while ((reg < len) && |
8589 |
+ ((reg * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE)); |
8590 |
+- put_page(page[i]); |
8591 |
++ put_page(pages[i]); |
8592 |
+ } |
8593 |
+ return reg; |
8594 |
+ } |
8595 |
+diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c |
8596 |
+index efd1a1d1f35e..5d3c691a1c66 100644 |
8597 |
+--- a/drivers/net/bareudp.c |
8598 |
++++ b/drivers/net/bareudp.c |
8599 |
+@@ -552,6 +552,8 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[], |
8600 |
+ static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf, |
8601 |
+ struct netlink_ext_ack *extack) |
8602 |
+ { |
8603 |
++ memset(conf, 0, sizeof(*conf)); |
8604 |
++ |
8605 |
+ if (!data[IFLA_BAREUDP_PORT]) { |
8606 |
+ NL_SET_ERR_MSG(extack, "port not specified"); |
8607 |
+ return -EINVAL; |
8608 |
+diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c |
8609 |
+index cf6fa8fede33..521ebc072903 100644 |
8610 |
+--- a/drivers/net/dsa/lantiq_gswip.c |
8611 |
++++ b/drivers/net/dsa/lantiq_gswip.c |
8612 |
+@@ -1452,7 +1452,8 @@ static void gswip_phylink_validate(struct dsa_switch *ds, int port, |
8613 |
+ |
8614 |
+ unsupported: |
8615 |
+ bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); |
8616 |
+- dev_err(ds->dev, "Unsupported interface: %d\n", state->interface); |
8617 |
++ dev_err(ds->dev, "Unsupported interface '%s' for port %d\n", |
8618 |
++ phy_modes(state->interface), port); |
8619 |
+ return; |
8620 |
+ } |
8621 |
+ |
8622 |
+diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c |
8623 |
+index bc0e47c1dbb9..177134596458 100644 |
8624 |
+--- a/drivers/net/dsa/sja1105/sja1105_ptp.c |
8625 |
++++ b/drivers/net/dsa/sja1105/sja1105_ptp.c |
8626 |
+@@ -891,16 +891,16 @@ void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int port, |
8627 |
+ |
8628 |
+ mutex_lock(&ptp_data->lock); |
8629 |
+ |
8630 |
+- rc = sja1105_ptpclkval_read(priv, &ticks, NULL); |
8631 |
++ rc = sja1105_ptpegr_ts_poll(ds, port, &ts); |
8632 |
+ if (rc < 0) { |
8633 |
+- dev_err(ds->dev, "Failed to read PTP clock: %d\n", rc); |
8634 |
++ dev_err(ds->dev, "timed out polling for tstamp\n"); |
8635 |
+ kfree_skb(skb); |
8636 |
+ goto out; |
8637 |
+ } |
8638 |
+ |
8639 |
+- rc = sja1105_ptpegr_ts_poll(ds, port, &ts); |
8640 |
++ rc = sja1105_ptpclkval_read(priv, &ticks, NULL); |
8641 |
+ if (rc < 0) { |
8642 |
+- dev_err(ds->dev, "timed out polling for tstamp\n"); |
8643 |
++ dev_err(ds->dev, "Failed to read PTP clock: %d\n", rc); |
8644 |
+ kfree_skb(skb); |
8645 |
+ goto out; |
8646 |
+ } |
8647 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
8648 |
+index 58e0d9a781e9..19c4a0a5727a 100644 |
8649 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
8650 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
8651 |
+@@ -10014,7 +10014,7 @@ static void bnxt_timer(struct timer_list *t) |
8652 |
+ struct bnxt *bp = from_timer(bp, t, timer); |
8653 |
+ struct net_device *dev = bp->dev; |
8654 |
+ |
8655 |
+- if (!netif_running(dev)) |
8656 |
++ if (!netif_running(dev) || !test_bit(BNXT_STATE_OPEN, &bp->state)) |
8657 |
+ return; |
8658 |
+ |
8659 |
+ if (atomic_read(&bp->intr_sem) != 0) |
8660 |
+@@ -12097,19 +12097,9 @@ static int bnxt_resume(struct device *device) |
8661 |
+ goto resume_exit; |
8662 |
+ } |
8663 |
+ |
8664 |
+- if (bnxt_hwrm_queue_qportcfg(bp)) { |
8665 |
+- rc = -ENODEV; |
8666 |
++ rc = bnxt_hwrm_func_qcaps(bp); |
8667 |
++ if (rc) |
8668 |
+ goto resume_exit; |
8669 |
+- } |
8670 |
+- |
8671 |
+- if (bp->hwrm_spec_code >= 0x10803) { |
8672 |
+- if (bnxt_alloc_ctx_mem(bp)) { |
8673 |
+- rc = -ENODEV; |
8674 |
+- goto resume_exit; |
8675 |
+- } |
8676 |
+- } |
8677 |
+- if (BNXT_NEW_RM(bp)) |
8678 |
+- bnxt_hwrm_func_resc_qcaps(bp, false); |
8679 |
+ |
8680 |
+ if (bnxt_hwrm_func_drv_rgtr(bp, NULL, 0, false)) { |
8681 |
+ rc = -ENODEV; |
8682 |
+@@ -12125,6 +12115,8 @@ static int bnxt_resume(struct device *device) |
8683 |
+ |
8684 |
+ resume_exit: |
8685 |
+ bnxt_ulp_start(bp, rc); |
8686 |
++ if (!rc) |
8687 |
++ bnxt_reenable_sriov(bp); |
8688 |
+ rtnl_unlock(); |
8689 |
+ return rc; |
8690 |
+ } |
8691 |
+@@ -12168,6 +12160,9 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, |
8692 |
+ bnxt_close(netdev); |
8693 |
+ |
8694 |
+ pci_disable_device(pdev); |
8695 |
++ bnxt_free_ctx_mem(bp); |
8696 |
++ kfree(bp->ctx); |
8697 |
++ bp->ctx = NULL; |
8698 |
+ rtnl_unlock(); |
8699 |
+ |
8700 |
+ /* Request a slot slot reset. */ |
8701 |
+@@ -12201,12 +12196,16 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) |
8702 |
+ pci_set_master(pdev); |
8703 |
+ |
8704 |
+ err = bnxt_hwrm_func_reset(bp); |
8705 |
+- if (!err && netif_running(netdev)) |
8706 |
+- err = bnxt_open(netdev); |
8707 |
+- |
8708 |
+- if (!err) |
8709 |
+- result = PCI_ERS_RESULT_RECOVERED; |
8710 |
++ if (!err) { |
8711 |
++ err = bnxt_hwrm_func_qcaps(bp); |
8712 |
++ if (!err && netif_running(netdev)) |
8713 |
++ err = bnxt_open(netdev); |
8714 |
++ } |
8715 |
+ bnxt_ulp_start(bp, err); |
8716 |
++ if (!err) { |
8717 |
++ bnxt_reenable_sriov(bp); |
8718 |
++ result = PCI_ERS_RESULT_RECOVERED; |
8719 |
++ } |
8720 |
+ } |
8721 |
+ |
8722 |
+ if (result != PCI_ERS_RESULT_RECOVERED) { |
8723 |
+diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
8724 |
+index 9d868403d86c..cbaa1924afbe 100644 |
8725 |
+--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
8726 |
++++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
8727 |
+@@ -234,6 +234,11 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) |
8728 |
+ |
8729 |
+ /* Put it in the ring. */ |
8730 |
+ p->rx_ring[p->rx_next_fill] = re.d64; |
8731 |
++ /* Make sure there is no reorder of filling the ring and ringing |
8732 |
++ * the bell |
8733 |
++ */ |
8734 |
++ wmb(); |
8735 |
++ |
8736 |
+ dma_sync_single_for_device(p->dev, p->rx_ring_handle, |
8737 |
+ ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), |
8738 |
+ DMA_BIDIRECTIONAL); |
8739 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
8740 |
+index 197dc5b2c090..1b4d04e4474b 100644 |
8741 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
8742 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
8743 |
+@@ -5184,6 +5184,9 @@ static int ibmvnic_remove(struct vio_dev *dev) |
8744 |
+ adapter->state = VNIC_REMOVING; |
8745 |
+ spin_unlock_irqrestore(&adapter->state_lock, flags); |
8746 |
+ |
8747 |
++ flush_work(&adapter->ibmvnic_reset); |
8748 |
++ flush_delayed_work(&adapter->ibmvnic_delayed_reset); |
8749 |
++ |
8750 |
+ rtnl_lock(); |
8751 |
+ unregister_netdevice(netdev); |
8752 |
+ |
8753 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
8754 |
+index df3d50e759de..5e388d4a97a1 100644 |
8755 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
8756 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
8757 |
+@@ -6518,11 +6518,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
8758 |
+ struct net_device *netdev = pci_get_drvdata(pdev); |
8759 |
+ struct e1000_adapter *adapter = netdev_priv(netdev); |
8760 |
+ struct e1000_hw *hw = &adapter->hw; |
8761 |
+- u32 ctrl, ctrl_ext, rctl, status; |
8762 |
+- /* Runtime suspend should only enable wakeup for link changes */ |
8763 |
+- u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
8764 |
++ u32 ctrl, ctrl_ext, rctl, status, wufc; |
8765 |
+ int retval = 0; |
8766 |
+ |
8767 |
++ /* Runtime suspend should only enable wakeup for link changes */ |
8768 |
++ if (runtime) |
8769 |
++ wufc = E1000_WUFC_LNKC; |
8770 |
++ else if (device_may_wakeup(&pdev->dev)) |
8771 |
++ wufc = adapter->wol; |
8772 |
++ else |
8773 |
++ wufc = 0; |
8774 |
++ |
8775 |
+ status = er32(STATUS); |
8776 |
+ if (status & E1000_STATUS_LU) |
8777 |
+ wufc &= ~E1000_WUFC_LNKC; |
8778 |
+@@ -6579,7 +6585,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
8779 |
+ if (adapter->hw.phy.type == e1000_phy_igp_3) { |
8780 |
+ e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); |
8781 |
+ } else if (hw->mac.type >= e1000_pch_lpt) { |
8782 |
+- if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) |
8783 |
++ if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) |
8784 |
+ /* ULP does not support wake from unicast, multicast |
8785 |
+ * or broadcast. |
8786 |
+ */ |
8787 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h |
8788 |
+index bcd11b4b29df..2d4ce6fdba1a 100644 |
8789 |
+--- a/drivers/net/ethernet/intel/iavf/iavf.h |
8790 |
++++ b/drivers/net/ethernet/intel/iavf/iavf.h |
8791 |
+@@ -87,6 +87,10 @@ struct iavf_vsi { |
8792 |
+ #define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4) |
8793 |
+ #define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */ |
8794 |
+ |
8795 |
++#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \ |
8796 |
++ (IAVF_MAX_VF_VSI * \ |
8797 |
++ sizeof(struct virtchnl_vsi_resource))) |
8798 |
++ |
8799 |
+ /* MAX_MSIX_Q_VECTORS of these are allocated, |
8800 |
+ * but we only use one per queue-specific vector. |
8801 |
+ */ |
8802 |
+@@ -306,6 +310,14 @@ struct iavf_adapter { |
8803 |
+ bool netdev_registered; |
8804 |
+ bool link_up; |
8805 |
+ enum virtchnl_link_speed link_speed; |
8806 |
++ /* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set |
8807 |
++ * in vf_res->vf_cap_flags. Use ADV_LINK_SUPPORT macro to determine if |
8808 |
++ * this field is valid. This field should be used going forward and the |
8809 |
++ * enum virtchnl_link_speed above should be considered the legacy way of |
8810 |
++ * storing/communicating link speeds. |
8811 |
++ */ |
8812 |
++ u32 link_speed_mbps; |
8813 |
++ |
8814 |
+ enum virtchnl_ops current_op; |
8815 |
+ #define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \ |
8816 |
+ (_a)->vf_res->vf_cap_flags & \ |
8817 |
+@@ -322,6 +334,8 @@ struct iavf_adapter { |
8818 |
+ VIRTCHNL_VF_OFFLOAD_RSS_PF))) |
8819 |
+ #define VLAN_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \ |
8820 |
+ VIRTCHNL_VF_OFFLOAD_VLAN) |
8821 |
++#define ADV_LINK_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \ |
8822 |
++ VIRTCHNL_VF_CAP_ADV_LINK_SPEED) |
8823 |
+ struct virtchnl_vf_resource *vf_res; /* incl. all VSIs */ |
8824 |
+ struct virtchnl_vsi_resource *vsi_res; /* our LAN VSI */ |
8825 |
+ struct virtchnl_version_info pf_version; |
8826 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
8827 |
+index 2c39d46b6138..40a3fc7c5ea5 100644 |
8828 |
+--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
8829 |
++++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
8830 |
+@@ -278,7 +278,18 @@ static int iavf_get_link_ksettings(struct net_device *netdev, |
8831 |
+ ethtool_link_ksettings_zero_link_mode(cmd, supported); |
8832 |
+ cmd->base.autoneg = AUTONEG_DISABLE; |
8833 |
+ cmd->base.port = PORT_NONE; |
8834 |
+- /* Set speed and duplex */ |
8835 |
++ cmd->base.duplex = DUPLEX_FULL; |
8836 |
++ |
8837 |
++ if (ADV_LINK_SUPPORT(adapter)) { |
8838 |
++ if (adapter->link_speed_mbps && |
8839 |
++ adapter->link_speed_mbps < U32_MAX) |
8840 |
++ cmd->base.speed = adapter->link_speed_mbps; |
8841 |
++ else |
8842 |
++ cmd->base.speed = SPEED_UNKNOWN; |
8843 |
++ |
8844 |
++ return 0; |
8845 |
++ } |
8846 |
++ |
8847 |
+ switch (adapter->link_speed) { |
8848 |
+ case IAVF_LINK_SPEED_40GB: |
8849 |
+ cmd->base.speed = SPEED_40000; |
8850 |
+@@ -306,7 +317,6 @@ static int iavf_get_link_ksettings(struct net_device *netdev, |
8851 |
+ default: |
8852 |
+ break; |
8853 |
+ } |
8854 |
+- cmd->base.duplex = DUPLEX_FULL; |
8855 |
+ |
8856 |
+ return 0; |
8857 |
+ } |
8858 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
8859 |
+index 2050649848ba..a21ae74bcd1b 100644 |
8860 |
+--- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
8861 |
++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
8862 |
+@@ -1756,17 +1756,17 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) |
8863 |
+ struct net_device *netdev = adapter->netdev; |
8864 |
+ struct pci_dev *pdev = adapter->pdev; |
8865 |
+ struct iavf_hw *hw = &adapter->hw; |
8866 |
+- int err = 0, bufsz; |
8867 |
++ int err; |
8868 |
+ |
8869 |
+ WARN_ON(adapter->state != __IAVF_INIT_GET_RESOURCES); |
8870 |
+ /* aq msg sent, awaiting reply */ |
8871 |
+ if (!adapter->vf_res) { |
8872 |
+- bufsz = sizeof(struct virtchnl_vf_resource) + |
8873 |
+- (IAVF_MAX_VF_VSI * |
8874 |
+- sizeof(struct virtchnl_vsi_resource)); |
8875 |
+- adapter->vf_res = kzalloc(bufsz, GFP_KERNEL); |
8876 |
+- if (!adapter->vf_res) |
8877 |
++ adapter->vf_res = kzalloc(IAVF_VIRTCHNL_VF_RESOURCE_SIZE, |
8878 |
++ GFP_KERNEL); |
8879 |
++ if (!adapter->vf_res) { |
8880 |
++ err = -ENOMEM; |
8881 |
+ goto err; |
8882 |
++ } |
8883 |
+ } |
8884 |
+ err = iavf_get_vf_config(adapter); |
8885 |
+ if (err == IAVF_ERR_ADMIN_QUEUE_NO_WORK) { |
8886 |
+@@ -2036,7 +2036,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) |
8887 |
+ iavf_reset_interrupt_capability(adapter); |
8888 |
+ iavf_free_queues(adapter); |
8889 |
+ iavf_free_q_vectors(adapter); |
8890 |
+- kfree(adapter->vf_res); |
8891 |
++ memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE); |
8892 |
+ iavf_shutdown_adminq(&adapter->hw); |
8893 |
+ adapter->netdev->flags &= ~IFF_UP; |
8894 |
+ clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); |
8895 |
+@@ -2487,6 +2487,16 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, |
8896 |
+ { |
8897 |
+ int speed = 0, ret = 0; |
8898 |
+ |
8899 |
++ if (ADV_LINK_SUPPORT(adapter)) { |
8900 |
++ if (adapter->link_speed_mbps < U32_MAX) { |
8901 |
++ speed = adapter->link_speed_mbps; |
8902 |
++ goto validate_bw; |
8903 |
++ } else { |
8904 |
++ dev_err(&adapter->pdev->dev, "Unknown link speed\n"); |
8905 |
++ return -EINVAL; |
8906 |
++ } |
8907 |
++ } |
8908 |
++ |
8909 |
+ switch (adapter->link_speed) { |
8910 |
+ case IAVF_LINK_SPEED_40GB: |
8911 |
+ speed = 40000; |
8912 |
+@@ -2510,6 +2520,7 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, |
8913 |
+ break; |
8914 |
+ } |
8915 |
+ |
8916 |
++validate_bw: |
8917 |
+ if (max_tx_rate > speed) { |
8918 |
+ dev_err(&adapter->pdev->dev, |
8919 |
+ "Invalid tx rate specified\n"); |
8920 |
+diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
8921 |
+index d58374c2c33d..ca79bec4ebd9 100644 |
8922 |
+--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
8923 |
++++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
8924 |
+@@ -139,7 +139,8 @@ int iavf_send_vf_config_msg(struct iavf_adapter *adapter) |
8925 |
+ VIRTCHNL_VF_OFFLOAD_ENCAP | |
8926 |
+ VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM | |
8927 |
+ VIRTCHNL_VF_OFFLOAD_REQ_QUEUES | |
8928 |
+- VIRTCHNL_VF_OFFLOAD_ADQ; |
8929 |
++ VIRTCHNL_VF_OFFLOAD_ADQ | |
8930 |
++ VIRTCHNL_VF_CAP_ADV_LINK_SPEED; |
8931 |
+ |
8932 |
+ adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; |
8933 |
+ adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; |
8934 |
+@@ -891,6 +892,8 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) |
8935 |
+ iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); |
8936 |
+ } |
8937 |
+ |
8938 |
++#define IAVF_MAX_SPEED_STRLEN 13 |
8939 |
++ |
8940 |
+ /** |
8941 |
+ * iavf_print_link_message - print link up or down |
8942 |
+ * @adapter: adapter structure |
8943 |
+@@ -900,37 +903,99 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) |
8944 |
+ static void iavf_print_link_message(struct iavf_adapter *adapter) |
8945 |
+ { |
8946 |
+ struct net_device *netdev = adapter->netdev; |
8947 |
+- char *speed = "Unknown "; |
8948 |
++ int link_speed_mbps; |
8949 |
++ char *speed; |
8950 |
+ |
8951 |
+ if (!adapter->link_up) { |
8952 |
+ netdev_info(netdev, "NIC Link is Down\n"); |
8953 |
+ return; |
8954 |
+ } |
8955 |
+ |
8956 |
++ speed = kcalloc(1, IAVF_MAX_SPEED_STRLEN, GFP_KERNEL); |
8957 |
++ if (!speed) |
8958 |
++ return; |
8959 |
++ |
8960 |
++ if (ADV_LINK_SUPPORT(adapter)) { |
8961 |
++ link_speed_mbps = adapter->link_speed_mbps; |
8962 |
++ goto print_link_msg; |
8963 |
++ } |
8964 |
++ |
8965 |
+ switch (adapter->link_speed) { |
8966 |
+ case IAVF_LINK_SPEED_40GB: |
8967 |
+- speed = "40 G"; |
8968 |
++ link_speed_mbps = SPEED_40000; |
8969 |
+ break; |
8970 |
+ case IAVF_LINK_SPEED_25GB: |
8971 |
+- speed = "25 G"; |
8972 |
++ link_speed_mbps = SPEED_25000; |
8973 |
+ break; |
8974 |
+ case IAVF_LINK_SPEED_20GB: |
8975 |
+- speed = "20 G"; |
8976 |
++ link_speed_mbps = SPEED_20000; |
8977 |
+ break; |
8978 |
+ case IAVF_LINK_SPEED_10GB: |
8979 |
+- speed = "10 G"; |
8980 |
++ link_speed_mbps = SPEED_10000; |
8981 |
+ break; |
8982 |
+ case IAVF_LINK_SPEED_1GB: |
8983 |
+- speed = "1000 M"; |
8984 |
++ link_speed_mbps = SPEED_1000; |
8985 |
+ break; |
8986 |
+ case IAVF_LINK_SPEED_100MB: |
8987 |
+- speed = "100 M"; |
8988 |
++ link_speed_mbps = SPEED_100; |
8989 |
+ break; |
8990 |
+ default: |
8991 |
++ link_speed_mbps = SPEED_UNKNOWN; |
8992 |
+ break; |
8993 |
+ } |
8994 |
+ |
8995 |
+- netdev_info(netdev, "NIC Link is Up %sbps Full Duplex\n", speed); |
8996 |
++print_link_msg: |
8997 |
++ if (link_speed_mbps > SPEED_1000) { |
8998 |
++ if (link_speed_mbps == SPEED_2500) |
8999 |
++ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "2.5 Gbps"); |
9000 |
++ else |
9001 |
++ /* convert to Gbps inline */ |
9002 |
++ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s", |
9003 |
++ link_speed_mbps / 1000, "Gbps"); |
9004 |
++ } else if (link_speed_mbps == SPEED_UNKNOWN) { |
9005 |
++ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%s", "Unknown Mbps"); |
9006 |
++ } else { |
9007 |
++ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%u %s", |
9008 |
++ link_speed_mbps, "Mbps"); |
9009 |
++ } |
9010 |
++ |
9011 |
++ netdev_info(netdev, "NIC Link is Up Speed is %s Full Duplex\n", speed); |
9012 |
++ kfree(speed); |
9013 |
++} |
9014 |
++ |
9015 |
++/** |
9016 |
++ * iavf_get_vpe_link_status |
9017 |
++ * @adapter: adapter structure |
9018 |
++ * @vpe: virtchnl_pf_event structure |
9019 |
++ * |
9020 |
++ * Helper function for determining the link status |
9021 |
++ **/ |
9022 |
++static bool |
9023 |
++iavf_get_vpe_link_status(struct iavf_adapter *adapter, |
9024 |
++ struct virtchnl_pf_event *vpe) |
9025 |
++{ |
9026 |
++ if (ADV_LINK_SUPPORT(adapter)) |
9027 |
++ return vpe->event_data.link_event_adv.link_status; |
9028 |
++ else |
9029 |
++ return vpe->event_data.link_event.link_status; |
9030 |
++} |
9031 |
++ |
9032 |
++/** |
9033 |
++ * iavf_set_adapter_link_speed_from_vpe |
9034 |
++ * @adapter: adapter structure for which we are setting the link speed |
9035 |
++ * @vpe: virtchnl_pf_event structure that contains the link speed we are setting |
9036 |
++ * |
9037 |
++ * Helper function for setting iavf_adapter link speed |
9038 |
++ **/ |
9039 |
++static void |
9040 |
++iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, |
9041 |
++ struct virtchnl_pf_event *vpe) |
9042 |
++{ |
9043 |
++ if (ADV_LINK_SUPPORT(adapter)) |
9044 |
++ adapter->link_speed_mbps = |
9045 |
++ vpe->event_data.link_event_adv.link_speed; |
9046 |
++ else |
9047 |
++ adapter->link_speed = vpe->event_data.link_event.link_speed; |
9048 |
+ } |
9049 |
+ |
9050 |
+ /** |
9051 |
+@@ -1160,12 +1225,11 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, |
9052 |
+ if (v_opcode == VIRTCHNL_OP_EVENT) { |
9053 |
+ struct virtchnl_pf_event *vpe = |
9054 |
+ (struct virtchnl_pf_event *)msg; |
9055 |
+- bool link_up = vpe->event_data.link_event.link_status; |
9056 |
++ bool link_up = iavf_get_vpe_link_status(adapter, vpe); |
9057 |
+ |
9058 |
+ switch (vpe->event) { |
9059 |
+ case VIRTCHNL_EVENT_LINK_CHANGE: |
9060 |
+- adapter->link_speed = |
9061 |
+- vpe->event_data.link_event.link_speed; |
9062 |
++ iavf_set_adapter_link_speed_from_vpe(adapter, vpe); |
9063 |
+ |
9064 |
+ /* we've already got the right link status, bail */ |
9065 |
+ if (adapter->link_up == link_up) |
9066 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9067 |
+index 2b5dad2ec650..b7b553602ea9 100644 |
9068 |
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9069 |
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9070 |
+@@ -5983,8 +5983,8 @@ static int mvpp2_remove(struct platform_device *pdev) |
9071 |
+ { |
9072 |
+ struct mvpp2 *priv = platform_get_drvdata(pdev); |
9073 |
+ struct fwnode_handle *fwnode = pdev->dev.fwnode; |
9074 |
++ int i = 0, poolnum = MVPP2_BM_POOLS_NUM; |
9075 |
+ struct fwnode_handle *port_fwnode; |
9076 |
+- int i = 0; |
9077 |
+ |
9078 |
+ mvpp2_dbgfs_cleanup(priv); |
9079 |
+ |
9080 |
+@@ -5998,7 +5998,10 @@ static int mvpp2_remove(struct platform_device *pdev) |
9081 |
+ |
9082 |
+ destroy_workqueue(priv->stats_queue); |
9083 |
+ |
9084 |
+- for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { |
9085 |
++ if (priv->percpu_pools) |
9086 |
++ poolnum = mvpp2_get_nrxqs(priv) * 2; |
9087 |
++ |
9088 |
++ for (i = 0; i < poolnum; i++) { |
9089 |
+ struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i]; |
9090 |
+ |
9091 |
+ mvpp2_bm_pool_destroy(&pdev->dev, priv, bm_pool); |
9092 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
9093 |
+index 18719acb7e54..eff8bb64899d 100644 |
9094 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
9095 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
9096 |
+@@ -181,7 +181,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, |
9097 |
+ in, pas)); |
9098 |
+ |
9099 |
+ err = mlx5_core_create_qp(mdev, &dr_qp->mqp, in, inlen); |
9100 |
+- kfree(in); |
9101 |
++ kvfree(in); |
9102 |
+ |
9103 |
+ if (err) { |
9104 |
+ mlx5_core_warn(mdev, " Can't create QP\n"); |
9105 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9106 |
+index 6b39978acd07..3e4199246a18 100644 |
9107 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9108 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9109 |
+@@ -990,8 +990,10 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu, |
9110 |
+ |
9111 |
+ lossy = !(pfc || pause_en); |
9112 |
+ thres_cells = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu); |
9113 |
++ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, &thres_cells); |
9114 |
+ delay_cells = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay, |
9115 |
+ pfc, pause_en); |
9116 |
++ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, &delay_cells); |
9117 |
+ total_cells = thres_cells + delay_cells; |
9118 |
+ |
9119 |
+ taken_headroom_cells += total_cells; |
9120 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
9121 |
+index ca56e72cb4b7..e28ecb84b816 100644 |
9122 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
9123 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
9124 |
+@@ -395,6 +395,19 @@ mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port, |
9125 |
+ return NULL; |
9126 |
+ } |
9127 |
+ |
9128 |
++static inline void |
9129 |
++mlxsw_sp_port_headroom_8x_adjust(const struct mlxsw_sp_port *mlxsw_sp_port, |
9130 |
++ u16 *p_size) |
9131 |
++{ |
9132 |
++ /* Ports with eight lanes use two headroom buffers between which the |
9133 |
++ * configured headroom size is split. Therefore, multiply the calculated |
9134 |
++ * headroom size by two. |
9135 |
++ */ |
9136 |
++ if (mlxsw_sp_port->mapping.width != 8) |
9137 |
++ return; |
9138 |
++ *p_size *= 2; |
9139 |
++} |
9140 |
++ |
9141 |
+ enum mlxsw_sp_flood_type { |
9142 |
+ MLXSW_SP_FLOOD_TYPE_UC, |
9143 |
+ MLXSW_SP_FLOOD_TYPE_BC, |
9144 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c |
9145 |
+index 968f0902e4fe..19bf0768ed78 100644 |
9146 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c |
9147 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c |
9148 |
+@@ -312,6 +312,7 @@ static int mlxsw_sp_port_pb_init(struct mlxsw_sp_port *mlxsw_sp_port) |
9149 |
+ |
9150 |
+ if (i == MLXSW_SP_PB_UNUSED) |
9151 |
+ continue; |
9152 |
++ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, &size); |
9153 |
+ mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, i, size); |
9154 |
+ } |
9155 |
+ mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, |
9156 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c |
9157 |
+index 9fb2e9d93929..7c5032f9c8ff 100644 |
9158 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c |
9159 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c |
9160 |
+@@ -776,6 +776,7 @@ mlxsw_sp_span_port_buffsize_update(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) |
9161 |
+ speed = 0; |
9162 |
+ |
9163 |
+ buffsize = mlxsw_sp_span_buffsize_get(mlxsw_sp, speed, mtu); |
9164 |
++ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize); |
9165 |
+ mlxsw_reg_sbib_pack(sbib_pl, mlxsw_sp_port->local_port, buffsize); |
9166 |
+ return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); |
9167 |
+ } |
9168 |
+diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
9169 |
+index 6b461be1820b..75266580b586 100644 |
9170 |
+--- a/drivers/net/geneve.c |
9171 |
++++ b/drivers/net/geneve.c |
9172 |
+@@ -987,9 +987,10 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) |
9173 |
+ if (geneve->collect_md) { |
9174 |
+ info = skb_tunnel_info(skb); |
9175 |
+ if (unlikely(!info || !(info->mode & IP_TUNNEL_INFO_TX))) { |
9176 |
+- err = -EINVAL; |
9177 |
+ netdev_dbg(dev, "no tunnel metadata\n"); |
9178 |
+- goto tx_error; |
9179 |
++ dev_kfree_skb(skb); |
9180 |
++ dev->stats.tx_dropped++; |
9181 |
++ return NETDEV_TX_OK; |
9182 |
+ } |
9183 |
+ } else { |
9184 |
+ info = &geneve->info; |
9185 |
+@@ -1006,7 +1007,7 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) |
9186 |
+ |
9187 |
+ if (likely(!err)) |
9188 |
+ return NETDEV_TX_OK; |
9189 |
+-tx_error: |
9190 |
++ |
9191 |
+ dev_kfree_skb(skb); |
9192 |
+ |
9193 |
+ if (err == -ELOOP) |
9194 |
+diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c |
9195 |
+index 71cdef9fb56b..5ab53e9942f3 100644 |
9196 |
+--- a/drivers/net/hamradio/yam.c |
9197 |
++++ b/drivers/net/hamradio/yam.c |
9198 |
+@@ -1133,6 +1133,7 @@ static int __init yam_init_driver(void) |
9199 |
+ err = register_netdev(dev); |
9200 |
+ if (err) { |
9201 |
+ printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name); |
9202 |
++ free_netdev(dev); |
9203 |
+ goto error; |
9204 |
+ } |
9205 |
+ yam_devs[i] = dev; |
9206 |
+diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c |
9207 |
+index a21534f1462f..1d823ac0f6d6 100644 |
9208 |
+--- a/drivers/net/ipa/ipa_endpoint.c |
9209 |
++++ b/drivers/net/ipa/ipa_endpoint.c |
9210 |
+@@ -669,10 +669,12 @@ static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) |
9211 |
+ u32 seq_type = endpoint->seq_type; |
9212 |
+ u32 val = 0; |
9213 |
+ |
9214 |
++ /* Sequencer type is made up of four nibbles */ |
9215 |
+ val |= u32_encode_bits(seq_type & 0xf, HPS_SEQ_TYPE_FMASK); |
9216 |
+ val |= u32_encode_bits((seq_type >> 4) & 0xf, DPS_SEQ_TYPE_FMASK); |
9217 |
+- /* HPS_REP_SEQ_TYPE is 0 */ |
9218 |
+- /* DPS_REP_SEQ_TYPE is 0 */ |
9219 |
++ /* The second two apply to replicated packets */ |
9220 |
++ val |= u32_encode_bits((seq_type >> 8) & 0xf, HPS_REP_SEQ_TYPE_FMASK); |
9221 |
++ val |= u32_encode_bits((seq_type >> 12) & 0xf, DPS_REP_SEQ_TYPE_FMASK); |
9222 |
+ |
9223 |
+ iowrite32(val, endpoint->ipa->reg_virt + offset); |
9224 |
+ } |
9225 |
+diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h |
9226 |
+index 3b8106aa277a..0a688d8c1d7c 100644 |
9227 |
+--- a/drivers/net/ipa/ipa_reg.h |
9228 |
++++ b/drivers/net/ipa/ipa_reg.h |
9229 |
+@@ -455,6 +455,8 @@ enum ipa_mode { |
9230 |
+ * second packet processing pass + no decipher + microcontroller |
9231 |
+ * @IPA_SEQ_DMA_DEC: DMA + cipher/decipher |
9232 |
+ * @IPA_SEQ_DMA_COMP_DECOMP: DMA + compression/decompression |
9233 |
++ * @IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP: |
9234 |
++ * packet processing + no decipher + no uCP + HPS REP DMA parser |
9235 |
+ * @IPA_SEQ_INVALID: invalid sequencer type |
9236 |
+ * |
9237 |
+ * The values defined here are broken into 4-bit nibbles that are written |
9238 |
+diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c |
9239 |
+index b55e3c0403ed..ddac79960ea7 100644 |
9240 |
+--- a/drivers/net/phy/dp83867.c |
9241 |
++++ b/drivers/net/phy/dp83867.c |
9242 |
+@@ -488,7 +488,7 @@ static int dp83867_verify_rgmii_cfg(struct phy_device *phydev) |
9243 |
+ return 0; |
9244 |
+ } |
9245 |
+ |
9246 |
+-#ifdef CONFIG_OF_MDIO |
9247 |
++#if IS_ENABLED(CONFIG_OF_MDIO) |
9248 |
+ static int dp83867_of_init(struct phy_device *phydev) |
9249 |
+ { |
9250 |
+ struct dp83867_private *dp83867 = phydev->priv; |
9251 |
+diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
9252 |
+index 7fc8e10c5f33..a435f7352cfb 100644 |
9253 |
+--- a/drivers/net/phy/marvell.c |
9254 |
++++ b/drivers/net/phy/marvell.c |
9255 |
+@@ -337,7 +337,7 @@ static int m88e1101_config_aneg(struct phy_device *phydev) |
9256 |
+ return marvell_config_aneg(phydev); |
9257 |
+ } |
9258 |
+ |
9259 |
+-#ifdef CONFIG_OF_MDIO |
9260 |
++#if IS_ENABLED(CONFIG_OF_MDIO) |
9261 |
+ /* Set and/or override some configuration registers based on the |
9262 |
+ * marvell,reg-init property stored in the of_node for the phydev. |
9263 |
+ * |
9264 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
9265 |
+index 7a4eb3f2cb74..a1a4dee2a033 100644 |
9266 |
+--- a/drivers/net/phy/mdio_bus.c |
9267 |
++++ b/drivers/net/phy/mdio_bus.c |
9268 |
+@@ -757,6 +757,7 @@ EXPORT_SYMBOL(mdiobus_scan); |
9269 |
+ |
9270 |
+ static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) |
9271 |
+ { |
9272 |
++ preempt_disable(); |
9273 |
+ u64_stats_update_begin(&stats->syncp); |
9274 |
+ |
9275 |
+ u64_stats_inc(&stats->transfers); |
9276 |
+@@ -771,6 +772,7 @@ static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) |
9277 |
+ u64_stats_inc(&stats->writes); |
9278 |
+ out: |
9279 |
+ u64_stats_update_end(&stats->syncp); |
9280 |
++ preempt_enable(); |
9281 |
+ } |
9282 |
+ |
9283 |
+ /** |
9284 |
+diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h |
9285 |
+index 414e3b31bb1f..132f9bf49198 100644 |
9286 |
+--- a/drivers/net/phy/mscc/mscc.h |
9287 |
++++ b/drivers/net/phy/mscc/mscc.h |
9288 |
+@@ -375,7 +375,7 @@ struct vsc8531_private { |
9289 |
+ #endif |
9290 |
+ }; |
9291 |
+ |
9292 |
+-#ifdef CONFIG_OF_MDIO |
9293 |
++#if IS_ENABLED(CONFIG_OF_MDIO) |
9294 |
+ struct vsc8531_edge_rate_table { |
9295 |
+ u32 vddmac; |
9296 |
+ u32 slowdown[8]; |
9297 |
+diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c |
9298 |
+index c8aa6d905d8e..485a4f8a6a9a 100644 |
9299 |
+--- a/drivers/net/phy/mscc/mscc_main.c |
9300 |
++++ b/drivers/net/phy/mscc/mscc_main.c |
9301 |
+@@ -98,7 +98,7 @@ static const struct vsc85xx_hw_stat vsc8584_hw_stats[] = { |
9302 |
+ }, |
9303 |
+ }; |
9304 |
+ |
9305 |
+-#ifdef CONFIG_OF_MDIO |
9306 |
++#if IS_ENABLED(CONFIG_OF_MDIO) |
9307 |
+ static const struct vsc8531_edge_rate_table edge_table[] = { |
9308 |
+ {MSCC_VDDMAC_3300, { 0, 2, 4, 7, 10, 17, 29, 53} }, |
9309 |
+ {MSCC_VDDMAC_2500, { 0, 3, 6, 10, 14, 23, 37, 63} }, |
9310 |
+@@ -382,7 +382,7 @@ out_unlock: |
9311 |
+ mutex_unlock(&phydev->lock); |
9312 |
+ } |
9313 |
+ |
9314 |
+-#ifdef CONFIG_OF_MDIO |
9315 |
++#if IS_ENABLED(CONFIG_OF_MDIO) |
9316 |
+ static int vsc85xx_edge_rate_magic_get(struct phy_device *phydev) |
9317 |
+ { |
9318 |
+ u32 vdd, sd; |
9319 |
+diff --git a/drivers/ntb/core.c b/drivers/ntb/core.c |
9320 |
+index 2581ab724c34..f8f75a504a58 100644 |
9321 |
+--- a/drivers/ntb/core.c |
9322 |
++++ b/drivers/ntb/core.c |
9323 |
+@@ -214,10 +214,8 @@ int ntb_default_port_number(struct ntb_dev *ntb) |
9324 |
+ case NTB_TOPO_B2B_DSD: |
9325 |
+ return NTB_PORT_SEC_DSD; |
9326 |
+ default: |
9327 |
+- break; |
9328 |
++ return 0; |
9329 |
+ } |
9330 |
+- |
9331 |
+- return -EINVAL; |
9332 |
+ } |
9333 |
+ EXPORT_SYMBOL(ntb_default_port_number); |
9334 |
+ |
9335 |
+@@ -240,10 +238,8 @@ int ntb_default_peer_port_number(struct ntb_dev *ntb, int pidx) |
9336 |
+ case NTB_TOPO_B2B_DSD: |
9337 |
+ return NTB_PORT_PRI_USD; |
9338 |
+ default: |
9339 |
+- break; |
9340 |
++ return 0; |
9341 |
+ } |
9342 |
+- |
9343 |
+- return -EINVAL; |
9344 |
+ } |
9345 |
+ EXPORT_SYMBOL(ntb_default_peer_port_number); |
9346 |
+ |
9347 |
+@@ -315,4 +311,3 @@ static void __exit ntb_driver_exit(void) |
9348 |
+ bus_unregister(&ntb_bus); |
9349 |
+ } |
9350 |
+ module_exit(ntb_driver_exit); |
9351 |
+- |
9352 |
+diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c |
9353 |
+index 972f6d984f6d..528751803419 100644 |
9354 |
+--- a/drivers/ntb/test/ntb_perf.c |
9355 |
++++ b/drivers/ntb/test/ntb_perf.c |
9356 |
+@@ -159,6 +159,8 @@ struct perf_peer { |
9357 |
+ /* NTB connection setup service */ |
9358 |
+ struct work_struct service; |
9359 |
+ unsigned long sts; |
9360 |
++ |
9361 |
++ struct completion init_comp; |
9362 |
+ }; |
9363 |
+ #define to_peer_service(__work) \ |
9364 |
+ container_of(__work, struct perf_peer, service) |
9365 |
+@@ -547,6 +549,7 @@ static int perf_setup_outbuf(struct perf_peer *peer) |
9366 |
+ |
9367 |
+ /* Initialization is finally done */ |
9368 |
+ set_bit(PERF_STS_DONE, &peer->sts); |
9369 |
++ complete_all(&peer->init_comp); |
9370 |
+ |
9371 |
+ return 0; |
9372 |
+ } |
9373 |
+@@ -557,7 +560,7 @@ static void perf_free_inbuf(struct perf_peer *peer) |
9374 |
+ return; |
9375 |
+ |
9376 |
+ (void)ntb_mw_clear_trans(peer->perf->ntb, peer->pidx, peer->gidx); |
9377 |
+- dma_free_coherent(&peer->perf->ntb->dev, peer->inbuf_size, |
9378 |
++ dma_free_coherent(&peer->perf->ntb->pdev->dev, peer->inbuf_size, |
9379 |
+ peer->inbuf, peer->inbuf_xlat); |
9380 |
+ peer->inbuf = NULL; |
9381 |
+ } |
9382 |
+@@ -586,8 +589,9 @@ static int perf_setup_inbuf(struct perf_peer *peer) |
9383 |
+ |
9384 |
+ perf_free_inbuf(peer); |
9385 |
+ |
9386 |
+- peer->inbuf = dma_alloc_coherent(&perf->ntb->dev, peer->inbuf_size, |
9387 |
+- &peer->inbuf_xlat, GFP_KERNEL); |
9388 |
++ peer->inbuf = dma_alloc_coherent(&perf->ntb->pdev->dev, |
9389 |
++ peer->inbuf_size, &peer->inbuf_xlat, |
9390 |
++ GFP_KERNEL); |
9391 |
+ if (!peer->inbuf) { |
9392 |
+ dev_err(&perf->ntb->dev, "Failed to alloc inbuf of %pa\n", |
9393 |
+ &peer->inbuf_size); |
9394 |
+@@ -637,6 +641,7 @@ static void perf_service_work(struct work_struct *work) |
9395 |
+ perf_setup_outbuf(peer); |
9396 |
+ |
9397 |
+ if (test_and_clear_bit(PERF_CMD_CLEAR, &peer->sts)) { |
9398 |
++ init_completion(&peer->init_comp); |
9399 |
+ clear_bit(PERF_STS_DONE, &peer->sts); |
9400 |
+ if (test_bit(0, &peer->perf->busy_flag) && |
9401 |
+ peer == peer->perf->test_peer) { |
9402 |
+@@ -653,7 +658,7 @@ static int perf_init_service(struct perf_ctx *perf) |
9403 |
+ { |
9404 |
+ u64 mask; |
9405 |
+ |
9406 |
+- if (ntb_peer_mw_count(perf->ntb) < perf->pcnt + 1) { |
9407 |
++ if (ntb_peer_mw_count(perf->ntb) < perf->pcnt) { |
9408 |
+ dev_err(&perf->ntb->dev, "Not enough memory windows\n"); |
9409 |
+ return -EINVAL; |
9410 |
+ } |
9411 |
+@@ -1083,8 +1088,9 @@ static int perf_submit_test(struct perf_peer *peer) |
9412 |
+ struct perf_thread *pthr; |
9413 |
+ int tidx, ret; |
9414 |
+ |
9415 |
+- if (!test_bit(PERF_STS_DONE, &peer->sts)) |
9416 |
+- return -ENOLINK; |
9417 |
++ ret = wait_for_completion_interruptible(&peer->init_comp); |
9418 |
++ if (ret < 0) |
9419 |
++ return ret; |
9420 |
+ |
9421 |
+ if (test_and_set_bit_lock(0, &perf->busy_flag)) |
9422 |
+ return -EBUSY; |
9423 |
+@@ -1455,10 +1461,21 @@ static int perf_init_peers(struct perf_ctx *perf) |
9424 |
+ peer->gidx = pidx; |
9425 |
+ } |
9426 |
+ INIT_WORK(&peer->service, perf_service_work); |
9427 |
++ init_completion(&peer->init_comp); |
9428 |
+ } |
9429 |
+ if (perf->gidx == -1) |
9430 |
+ perf->gidx = pidx; |
9431 |
+ |
9432 |
++ /* |
9433 |
++ * Hardware with only two ports may not have unique port |
9434 |
++ * numbers. In this case, the gidxs should all be zero. |
9435 |
++ */ |
9436 |
++ if (perf->pcnt == 1 && ntb_port_number(perf->ntb) == 0 && |
9437 |
++ ntb_peer_port_number(perf->ntb, 0) == 0) { |
9438 |
++ perf->gidx = 0; |
9439 |
++ perf->peers[0].gidx = 0; |
9440 |
++ } |
9441 |
++ |
9442 |
+ for (pidx = 0; pidx < perf->pcnt; pidx++) { |
9443 |
+ ret = perf_setup_peer_mw(&perf->peers[pidx]); |
9444 |
+ if (ret) |
9445 |
+@@ -1554,4 +1571,3 @@ static void __exit perf_exit(void) |
9446 |
+ destroy_workqueue(perf_wq); |
9447 |
+ } |
9448 |
+ module_exit(perf_exit); |
9449 |
+- |
9450 |
+diff --git a/drivers/ntb/test/ntb_pingpong.c b/drivers/ntb/test/ntb_pingpong.c |
9451 |
+index 04dd46647db3..2164e8492772 100644 |
9452 |
+--- a/drivers/ntb/test/ntb_pingpong.c |
9453 |
++++ b/drivers/ntb/test/ntb_pingpong.c |
9454 |
+@@ -121,15 +121,14 @@ static int pp_find_next_peer(struct pp_ctx *pp) |
9455 |
+ link = ntb_link_is_up(pp->ntb, NULL, NULL); |
9456 |
+ |
9457 |
+ /* Find next available peer */ |
9458 |
+- if (link & pp->nmask) { |
9459 |
++ if (link & pp->nmask) |
9460 |
+ pidx = __ffs64(link & pp->nmask); |
9461 |
+- out_db = BIT_ULL(pidx + 1); |
9462 |
+- } else if (link & pp->pmask) { |
9463 |
++ else if (link & pp->pmask) |
9464 |
+ pidx = __ffs64(link & pp->pmask); |
9465 |
+- out_db = BIT_ULL(pidx); |
9466 |
+- } else { |
9467 |
++ else |
9468 |
+ return -ENODEV; |
9469 |
+- } |
9470 |
++ |
9471 |
++ out_db = BIT_ULL(ntb_peer_port_number(pp->ntb, pidx)); |
9472 |
+ |
9473 |
+ spin_lock(&pp->lock); |
9474 |
+ pp->out_pidx = pidx; |
9475 |
+@@ -303,7 +302,7 @@ static void pp_init_flds(struct pp_ctx *pp) |
9476 |
+ break; |
9477 |
+ } |
9478 |
+ |
9479 |
+- pp->in_db = BIT_ULL(pidx); |
9480 |
++ pp->in_db = BIT_ULL(lport); |
9481 |
+ pp->pmask = GENMASK_ULL(pidx, 0) >> 1; |
9482 |
+ pp->nmask = GENMASK_ULL(pcnt - 1, pidx); |
9483 |
+ |
9484 |
+@@ -432,4 +431,3 @@ static void __exit pp_exit(void) |
9485 |
+ debugfs_remove_recursive(pp_dbgfs_topdir); |
9486 |
+ } |
9487 |
+ module_exit(pp_exit); |
9488 |
+- |
9489 |
+diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c |
9490 |
+index 69da758fe64c..b7bf3f863d79 100644 |
9491 |
+--- a/drivers/ntb/test/ntb_tool.c |
9492 |
++++ b/drivers/ntb/test/ntb_tool.c |
9493 |
+@@ -504,7 +504,7 @@ static ssize_t tool_peer_link_read(struct file *filep, char __user *ubuf, |
9494 |
+ buf[1] = '\n'; |
9495 |
+ buf[2] = '\0'; |
9496 |
+ |
9497 |
+- return simple_read_from_buffer(ubuf, size, offp, buf, 3); |
9498 |
++ return simple_read_from_buffer(ubuf, size, offp, buf, 2); |
9499 |
+ } |
9500 |
+ |
9501 |
+ static TOOL_FOPS_RDWR(tool_peer_link_fops, |
9502 |
+@@ -590,7 +590,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, |
9503 |
+ inmw->size = min_t(resource_size_t, req_size, size); |
9504 |
+ inmw->size = round_up(inmw->size, addr_align); |
9505 |
+ inmw->size = round_up(inmw->size, size_align); |
9506 |
+- inmw->mm_base = dma_alloc_coherent(&tc->ntb->dev, inmw->size, |
9507 |
++ inmw->mm_base = dma_alloc_coherent(&tc->ntb->pdev->dev, inmw->size, |
9508 |
+ &inmw->dma_base, GFP_KERNEL); |
9509 |
+ if (!inmw->mm_base) |
9510 |
+ return -ENOMEM; |
9511 |
+@@ -612,7 +612,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, |
9512 |
+ return 0; |
9513 |
+ |
9514 |
+ err_free_dma: |
9515 |
+- dma_free_coherent(&tc->ntb->dev, inmw->size, inmw->mm_base, |
9516 |
++ dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, |
9517 |
+ inmw->dma_base); |
9518 |
+ inmw->mm_base = NULL; |
9519 |
+ inmw->dma_base = 0; |
9520 |
+@@ -629,7 +629,7 @@ static void tool_free_mw(struct tool_ctx *tc, int pidx, int widx) |
9521 |
+ |
9522 |
+ if (inmw->mm_base != NULL) { |
9523 |
+ ntb_mw_clear_trans(tc->ntb, pidx, widx); |
9524 |
+- dma_free_coherent(&tc->ntb->dev, inmw->size, |
9525 |
++ dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, |
9526 |
+ inmw->mm_base, inmw->dma_base); |
9527 |
+ } |
9528 |
+ |
9529 |
+@@ -1690,4 +1690,3 @@ static void __exit tool_exit(void) |
9530 |
+ debugfs_remove_recursive(tool_dbgfs_topdir); |
9531 |
+ } |
9532 |
+ module_exit(tool_exit); |
9533 |
+- |
9534 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
9535 |
+index 5ef4a84c442a..564e3f220ac7 100644 |
9536 |
+--- a/drivers/nvme/host/fc.c |
9537 |
++++ b/drivers/nvme/host/fc.c |
9538 |
+@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, |
9539 |
+ opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE); |
9540 |
+ __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); |
9541 |
+ |
9542 |
+- if (!(op->flags & FCOP_FLAGS_AEN)) |
9543 |
++ if (!(op->flags & FCOP_FLAGS_AEN)) { |
9544 |
+ nvme_fc_unmap_data(ctrl, op->rq, op); |
9545 |
++ nvme_cleanup_cmd(op->rq); |
9546 |
++ } |
9547 |
+ |
9548 |
+- nvme_cleanup_cmd(op->rq); |
9549 |
+ nvme_fc_ctrl_put(ctrl); |
9550 |
+ |
9551 |
+ if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE && |
9552 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
9553 |
+index 076bdd90c922..4ad629eb3bc6 100644 |
9554 |
+--- a/drivers/nvme/host/pci.c |
9555 |
++++ b/drivers/nvme/host/pci.c |
9556 |
+@@ -2958,9 +2958,15 @@ static int nvme_suspend(struct device *dev) |
9557 |
+ * the PCI bus layer to put it into D3 in order to take the PCIe link |
9558 |
+ * down, so as to allow the platform to achieve its minimum low-power |
9559 |
+ * state (which may not be possible if the link is up). |
9560 |
++ * |
9561 |
++ * If a host memory buffer is enabled, shut down the device as the NVMe |
9562 |
++ * specification allows the device to access the host memory buffer in |
9563 |
++ * host DRAM from all power states, but hosts will fail access to DRAM |
9564 |
++ * during S3. |
9565 |
+ */ |
9566 |
+ if (pm_suspend_via_firmware() || !ctrl->npss || |
9567 |
+ !pcie_aspm_enabled(pdev) || |
9568 |
++ ndev->nr_host_mem_descs || |
9569 |
+ (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) |
9570 |
+ return nvme_disable_prepare_reset(ndev, true); |
9571 |
+ |
9572 |
+diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c |
9573 |
+index 05c6ae4b0b97..a8300202a7fb 100644 |
9574 |
+--- a/drivers/nvmem/core.c |
9575 |
++++ b/drivers/nvmem/core.c |
9576 |
+@@ -66,6 +66,30 @@ static LIST_HEAD(nvmem_lookup_list); |
9577 |
+ |
9578 |
+ static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); |
9579 |
+ |
9580 |
++static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, |
9581 |
++ void *val, size_t bytes) |
9582 |
++{ |
9583 |
++ if (nvmem->reg_read) |
9584 |
++ return nvmem->reg_read(nvmem->priv, offset, val, bytes); |
9585 |
++ |
9586 |
++ return -EINVAL; |
9587 |
++} |
9588 |
++ |
9589 |
++static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, |
9590 |
++ void *val, size_t bytes) |
9591 |
++{ |
9592 |
++ int ret; |
9593 |
++ |
9594 |
++ if (nvmem->reg_write) { |
9595 |
++ gpiod_set_value_cansleep(nvmem->wp_gpio, 0); |
9596 |
++ ret = nvmem->reg_write(nvmem->priv, offset, val, bytes); |
9597 |
++ gpiod_set_value_cansleep(nvmem->wp_gpio, 1); |
9598 |
++ return ret; |
9599 |
++ } |
9600 |
++ |
9601 |
++ return -EINVAL; |
9602 |
++} |
9603 |
++ |
9604 |
+ #ifdef CONFIG_NVMEM_SYSFS |
9605 |
+ static const char * const nvmem_type_str[] = { |
9606 |
+ [NVMEM_TYPE_UNKNOWN] = "Unknown", |
9607 |
+@@ -122,7 +146,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj, |
9608 |
+ if (!nvmem->reg_read) |
9609 |
+ return -EPERM; |
9610 |
+ |
9611 |
+- rc = nvmem->reg_read(nvmem->priv, pos, buf, count); |
9612 |
++ rc = nvmem_reg_read(nvmem, pos, buf, count); |
9613 |
+ |
9614 |
+ if (rc) |
9615 |
+ return rc; |
9616 |
+@@ -159,7 +183,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj, |
9617 |
+ if (!nvmem->reg_write) |
9618 |
+ return -EPERM; |
9619 |
+ |
9620 |
+- rc = nvmem->reg_write(nvmem->priv, pos, buf, count); |
9621 |
++ rc = nvmem_reg_write(nvmem, pos, buf, count); |
9622 |
+ |
9623 |
+ if (rc) |
9624 |
+ return rc; |
9625 |
+@@ -311,30 +335,6 @@ static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem, |
9626 |
+ |
9627 |
+ #endif /* CONFIG_NVMEM_SYSFS */ |
9628 |
+ |
9629 |
+-static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, |
9630 |
+- void *val, size_t bytes) |
9631 |
+-{ |
9632 |
+- if (nvmem->reg_read) |
9633 |
+- return nvmem->reg_read(nvmem->priv, offset, val, bytes); |
9634 |
+- |
9635 |
+- return -EINVAL; |
9636 |
+-} |
9637 |
+- |
9638 |
+-static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, |
9639 |
+- void *val, size_t bytes) |
9640 |
+-{ |
9641 |
+- int ret; |
9642 |
+- |
9643 |
+- if (nvmem->reg_write) { |
9644 |
+- gpiod_set_value_cansleep(nvmem->wp_gpio, 0); |
9645 |
+- ret = nvmem->reg_write(nvmem->priv, offset, val, bytes); |
9646 |
+- gpiod_set_value_cansleep(nvmem->wp_gpio, 1); |
9647 |
+- return ret; |
9648 |
+- } |
9649 |
+- |
9650 |
+- return -EINVAL; |
9651 |
+-} |
9652 |
+- |
9653 |
+ static void nvmem_release(struct device *dev) |
9654 |
+ { |
9655 |
+ struct nvmem_device *nvmem = to_nvmem_device(dev); |
9656 |
+diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c |
9657 |
+index c72eef988041..a32e60b024b8 100644 |
9658 |
+--- a/drivers/of/kobj.c |
9659 |
++++ b/drivers/of/kobj.c |
9660 |
+@@ -134,8 +134,6 @@ int __of_attach_node_sysfs(struct device_node *np) |
9661 |
+ if (!name) |
9662 |
+ return -ENOMEM; |
9663 |
+ |
9664 |
+- of_node_get(np); |
9665 |
+- |
9666 |
+ rc = kobject_add(&np->kobj, parent, "%s", name); |
9667 |
+ kfree(name); |
9668 |
+ if (rc) |
9669 |
+@@ -144,6 +142,7 @@ int __of_attach_node_sysfs(struct device_node *np) |
9670 |
+ for_each_property_of_node(np, pp) |
9671 |
+ __of_add_property_sysfs(np, pp); |
9672 |
+ |
9673 |
++ of_node_get(np); |
9674 |
+ return 0; |
9675 |
+ } |
9676 |
+ |
9677 |
+diff --git a/drivers/of/property.c b/drivers/of/property.c |
9678 |
+index b4916dcc9e72..6dc542af5a70 100644 |
9679 |
+--- a/drivers/of/property.c |
9680 |
++++ b/drivers/of/property.c |
9681 |
+@@ -1045,8 +1045,20 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, |
9682 |
+ * Find the device node that contains the supplier phandle. It may be |
9683 |
+ * @sup_np or it may be an ancestor of @sup_np. |
9684 |
+ */ |
9685 |
+- while (sup_np && !of_find_property(sup_np, "compatible", NULL)) |
9686 |
++ while (sup_np) { |
9687 |
++ |
9688 |
++ /* Don't allow linking to a disabled supplier */ |
9689 |
++ if (!of_device_is_available(sup_np)) { |
9690 |
++ of_node_put(sup_np); |
9691 |
++ sup_np = NULL; |
9692 |
++ } |
9693 |
++ |
9694 |
++ if (of_find_property(sup_np, "compatible", NULL)) |
9695 |
++ break; |
9696 |
++ |
9697 |
+ sup_np = of_get_next_parent(sup_np); |
9698 |
++ } |
9699 |
++ |
9700 |
+ if (!sup_np) { |
9701 |
+ dev_dbg(dev, "Not linking to %pOFP - No device\n", tmp_np); |
9702 |
+ return -ENODEV; |
9703 |
+@@ -1296,7 +1308,7 @@ static int of_link_to_suppliers(struct device *dev, |
9704 |
+ if (of_link_property(dev, con_np, p->name)) |
9705 |
+ ret = -ENODEV; |
9706 |
+ |
9707 |
+- for_each_child_of_node(con_np, child) |
9708 |
++ for_each_available_child_of_node(con_np, child) |
9709 |
+ if (of_link_to_suppliers(dev, child) && !ret) |
9710 |
+ ret = -EAGAIN; |
9711 |
+ |
9712 |
+diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c |
9713 |
+index 3b0e58f2de58..6184ebc9392d 100644 |
9714 |
+--- a/drivers/pci/controller/dwc/pci-dra7xx.c |
9715 |
++++ b/drivers/pci/controller/dwc/pci-dra7xx.c |
9716 |
+@@ -840,7 +840,6 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) |
9717 |
+ struct phy **phy; |
9718 |
+ struct device_link **link; |
9719 |
+ void __iomem *base; |
9720 |
+- struct resource *res; |
9721 |
+ struct dw_pcie *pci; |
9722 |
+ struct dra7xx_pcie *dra7xx; |
9723 |
+ struct device *dev = &pdev->dev; |
9724 |
+@@ -877,10 +876,9 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) |
9725 |
+ return irq; |
9726 |
+ } |
9727 |
+ |
9728 |
+- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ti_conf"); |
9729 |
+- base = devm_ioremap(dev, res->start, resource_size(res)); |
9730 |
+- if (!base) |
9731 |
+- return -ENOMEM; |
9732 |
++ base = devm_platform_ioremap_resource_byname(pdev, "ti_conf"); |
9733 |
++ if (IS_ERR(base)) |
9734 |
++ return PTR_ERR(base); |
9735 |
+ |
9736 |
+ phy_count = of_property_count_strings(np, "phy-names"); |
9737 |
+ if (phy_count < 0) { |
9738 |
+diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c |
9739 |
+index 3715dceca1bf..ca59ba9e0ecd 100644 |
9740 |
+--- a/drivers/pci/controller/dwc/pci-meson.c |
9741 |
++++ b/drivers/pci/controller/dwc/pci-meson.c |
9742 |
+@@ -289,11 +289,11 @@ static void meson_pcie_init_dw(struct meson_pcie *mp) |
9743 |
+ meson_cfg_writel(mp, val, PCIE_CFG0); |
9744 |
+ |
9745 |
+ val = meson_elb_readl(mp, PCIE_PORT_LINK_CTRL_OFF); |
9746 |
+- val &= ~LINK_CAPABLE_MASK; |
9747 |
++ val &= ~(LINK_CAPABLE_MASK | FAST_LINK_MODE); |
9748 |
+ meson_elb_writel(mp, val, PCIE_PORT_LINK_CTRL_OFF); |
9749 |
+ |
9750 |
+ val = meson_elb_readl(mp, PCIE_PORT_LINK_CTRL_OFF); |
9751 |
+- val |= LINK_CAPABLE_X1 | FAST_LINK_MODE; |
9752 |
++ val |= LINK_CAPABLE_X1; |
9753 |
+ meson_elb_writel(mp, val, PCIE_PORT_LINK_CTRL_OFF); |
9754 |
+ |
9755 |
+ val = meson_elb_readl(mp, PCIE_GEN2_CTRL_OFF); |
9756 |
+diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c |
9757 |
+index 395feb8ca051..3c43311bb95c 100644 |
9758 |
+--- a/drivers/pci/controller/dwc/pcie-designware-host.c |
9759 |
++++ b/drivers/pci/controller/dwc/pcie-designware-host.c |
9760 |
+@@ -264,6 +264,8 @@ int dw_pcie_allocate_domains(struct pcie_port *pp) |
9761 |
+ return -ENOMEM; |
9762 |
+ } |
9763 |
+ |
9764 |
++ irq_domain_update_bus_token(pp->irq_domain, DOMAIN_BUS_NEXUS); |
9765 |
++ |
9766 |
+ pp->msi_domain = pci_msi_create_irq_domain(fwnode, |
9767 |
+ &dw_pcie_msi_domain_info, |
9768 |
+ pp->irq_domain); |
9769 |
+diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
9770 |
+index 2a20b649f40c..2ecc79c03ade 100644 |
9771 |
+--- a/drivers/pci/controller/pci-aardvark.c |
9772 |
++++ b/drivers/pci/controller/pci-aardvark.c |
9773 |
+@@ -9,6 +9,7 @@ |
9774 |
+ */ |
9775 |
+ |
9776 |
+ #include <linux/delay.h> |
9777 |
++#include <linux/gpio.h> |
9778 |
+ #include <linux/interrupt.h> |
9779 |
+ #include <linux/irq.h> |
9780 |
+ #include <linux/irqdomain.h> |
9781 |
+@@ -18,6 +19,7 @@ |
9782 |
+ #include <linux/platform_device.h> |
9783 |
+ #include <linux/msi.h> |
9784 |
+ #include <linux/of_address.h> |
9785 |
++#include <linux/of_gpio.h> |
9786 |
+ #include <linux/of_pci.h> |
9787 |
+ |
9788 |
+ #include "../pci.h" |
9789 |
+@@ -40,6 +42,7 @@ |
9790 |
+ #define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0 |
9791 |
+ #define PCIE_CORE_LINK_L0S_ENTRY BIT(0) |
9792 |
+ #define PCIE_CORE_LINK_TRAINING BIT(5) |
9793 |
++#define PCIE_CORE_LINK_SPEED_SHIFT 16 |
9794 |
+ #define PCIE_CORE_LINK_WIDTH_SHIFT 20 |
9795 |
+ #define PCIE_CORE_ERR_CAPCTL_REG 0x118 |
9796 |
+ #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5) |
9797 |
+@@ -201,7 +204,9 @@ struct advk_pcie { |
9798 |
+ struct mutex msi_used_lock; |
9799 |
+ u16 msi_msg; |
9800 |
+ int root_bus_nr; |
9801 |
++ int link_gen; |
9802 |
+ struct pci_bridge_emul bridge; |
9803 |
++ struct gpio_desc *reset_gpio; |
9804 |
+ }; |
9805 |
+ |
9806 |
+ static inline void advk_writel(struct advk_pcie *pcie, u32 val, u64 reg) |
9807 |
+@@ -225,20 +230,16 @@ static int advk_pcie_link_up(struct advk_pcie *pcie) |
9808 |
+ |
9809 |
+ static int advk_pcie_wait_for_link(struct advk_pcie *pcie) |
9810 |
+ { |
9811 |
+- struct device *dev = &pcie->pdev->dev; |
9812 |
+ int retries; |
9813 |
+ |
9814 |
+ /* check if the link is up or not */ |
9815 |
+ for (retries = 0; retries < LINK_WAIT_MAX_RETRIES; retries++) { |
9816 |
+- if (advk_pcie_link_up(pcie)) { |
9817 |
+- dev_info(dev, "link up\n"); |
9818 |
++ if (advk_pcie_link_up(pcie)) |
9819 |
+ return 0; |
9820 |
+- } |
9821 |
+ |
9822 |
+ usleep_range(LINK_WAIT_USLEEP_MIN, LINK_WAIT_USLEEP_MAX); |
9823 |
+ } |
9824 |
+ |
9825 |
+- dev_err(dev, "link never came up\n"); |
9826 |
+ return -ETIMEDOUT; |
9827 |
+ } |
9828 |
+ |
9829 |
+@@ -253,10 +254,110 @@ static void advk_pcie_wait_for_retrain(struct advk_pcie *pcie) |
9830 |
+ } |
9831 |
+ } |
9832 |
+ |
9833 |
++static int advk_pcie_train_at_gen(struct advk_pcie *pcie, int gen) |
9834 |
++{ |
9835 |
++ int ret, neg_gen; |
9836 |
++ u32 reg; |
9837 |
++ |
9838 |
++ /* Setup link speed */ |
9839 |
++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9840 |
++ reg &= ~PCIE_GEN_SEL_MSK; |
9841 |
++ if (gen == 3) |
9842 |
++ reg |= SPEED_GEN_3; |
9843 |
++ else if (gen == 2) |
9844 |
++ reg |= SPEED_GEN_2; |
9845 |
++ else |
9846 |
++ reg |= SPEED_GEN_1; |
9847 |
++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9848 |
++ |
9849 |
++ /* |
9850 |
++ * Enable link training. This is not needed in every call to this |
9851 |
++ * function, just once suffices, but it does not break anything either. |
9852 |
++ */ |
9853 |
++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9854 |
++ reg |= LINK_TRAINING_EN; |
9855 |
++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9856 |
++ |
9857 |
++ /* |
9858 |
++ * Start link training immediately after enabling it. |
9859 |
++ * This solves problems for some buggy cards. |
9860 |
++ */ |
9861 |
++ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); |
9862 |
++ reg |= PCIE_CORE_LINK_TRAINING; |
9863 |
++ advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
9864 |
++ |
9865 |
++ ret = advk_pcie_wait_for_link(pcie); |
9866 |
++ if (ret) |
9867 |
++ return ret; |
9868 |
++ |
9869 |
++ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); |
9870 |
++ neg_gen = (reg >> PCIE_CORE_LINK_SPEED_SHIFT) & 0xf; |
9871 |
++ |
9872 |
++ return neg_gen; |
9873 |
++} |
9874 |
++ |
9875 |
++static void advk_pcie_train_link(struct advk_pcie *pcie) |
9876 |
++{ |
9877 |
++ struct device *dev = &pcie->pdev->dev; |
9878 |
++ int neg_gen = -1, gen; |
9879 |
++ |
9880 |
++ /* |
9881 |
++ * Try link training at link gen specified by device tree property |
9882 |
++ * 'max-link-speed'. If this fails, iteratively train at lower gen. |
9883 |
++ */ |
9884 |
++ for (gen = pcie->link_gen; gen > 0; --gen) { |
9885 |
++ neg_gen = advk_pcie_train_at_gen(pcie, gen); |
9886 |
++ if (neg_gen > 0) |
9887 |
++ break; |
9888 |
++ } |
9889 |
++ |
9890 |
++ if (neg_gen < 0) |
9891 |
++ goto err; |
9892 |
++ |
9893 |
++ /* |
9894 |
++ * After successful training if negotiated gen is lower than requested, |
9895 |
++ * train again on negotiated gen. This solves some stability issues for |
9896 |
++ * some buggy gen1 cards. |
9897 |
++ */ |
9898 |
++ if (neg_gen < gen) { |
9899 |
++ gen = neg_gen; |
9900 |
++ neg_gen = advk_pcie_train_at_gen(pcie, gen); |
9901 |
++ } |
9902 |
++ |
9903 |
++ if (neg_gen == gen) { |
9904 |
++ dev_info(dev, "link up at gen %i\n", gen); |
9905 |
++ return; |
9906 |
++ } |
9907 |
++ |
9908 |
++err: |
9909 |
++ dev_err(dev, "link never came up\n"); |
9910 |
++} |
9911 |
++ |
9912 |
++static void advk_pcie_issue_perst(struct advk_pcie *pcie) |
9913 |
++{ |
9914 |
++ u32 reg; |
9915 |
++ |
9916 |
++ if (!pcie->reset_gpio) |
9917 |
++ return; |
9918 |
++ |
9919 |
++ /* PERST does not work for some cards when link training is enabled */ |
9920 |
++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9921 |
++ reg &= ~LINK_TRAINING_EN; |
9922 |
++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9923 |
++ |
9924 |
++ /* 10ms delay is needed for some cards */ |
9925 |
++ dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 10ms\n"); |
9926 |
++ gpiod_set_value_cansleep(pcie->reset_gpio, 1); |
9927 |
++ usleep_range(10000, 11000); |
9928 |
++ gpiod_set_value_cansleep(pcie->reset_gpio, 0); |
9929 |
++} |
9930 |
++ |
9931 |
+ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
9932 |
+ { |
9933 |
+ u32 reg; |
9934 |
+ |
9935 |
++ advk_pcie_issue_perst(pcie); |
9936 |
++ |
9937 |
+ /* Set to Direct mode */ |
9938 |
+ reg = advk_readl(pcie, CTRL_CONFIG_REG); |
9939 |
+ reg &= ~(CTRL_MODE_MASK << CTRL_MODE_SHIFT); |
9940 |
+@@ -288,23 +389,12 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
9941 |
+ PCIE_CORE_CTRL2_TD_ENABLE; |
9942 |
+ advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); |
9943 |
+ |
9944 |
+- /* Set GEN2 */ |
9945 |
+- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9946 |
+- reg &= ~PCIE_GEN_SEL_MSK; |
9947 |
+- reg |= SPEED_GEN_2; |
9948 |
+- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9949 |
+- |
9950 |
+ /* Set lane X1 */ |
9951 |
+ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9952 |
+ reg &= ~LANE_CNT_MSK; |
9953 |
+ reg |= LANE_COUNT_1; |
9954 |
+ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9955 |
+ |
9956 |
+- /* Enable link training */ |
9957 |
+- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9958 |
+- reg |= LINK_TRAINING_EN; |
9959 |
+- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9960 |
+- |
9961 |
+ /* Enable MSI */ |
9962 |
+ reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); |
9963 |
+ reg |= PCIE_CORE_CTRL2_MSI_ENABLE; |
9964 |
+@@ -340,22 +430,14 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
9965 |
+ |
9966 |
+ /* |
9967 |
+ * PERST# signal could have been asserted by pinctrl subsystem before |
9968 |
+- * probe() callback has been called, making the endpoint going into |
9969 |
++ * probe() callback has been called or issued explicitly by reset gpio |
9970 |
++ * function advk_pcie_issue_perst(), making the endpoint going into |
9971 |
+ * fundamental reset. As required by PCI Express spec a delay for at |
9972 |
+ * least 100ms after such a reset before link training is needed. |
9973 |
+ */ |
9974 |
+ msleep(PCI_PM_D3COLD_WAIT); |
9975 |
+ |
9976 |
+- /* Start link training */ |
9977 |
+- reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); |
9978 |
+- reg |= PCIE_CORE_LINK_TRAINING; |
9979 |
+- advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
9980 |
+- |
9981 |
+- advk_pcie_wait_for_link(pcie); |
9982 |
+- |
9983 |
+- reg = PCIE_CORE_LINK_L0S_ENTRY | |
9984 |
+- (1 << PCIE_CORE_LINK_WIDTH_SHIFT); |
9985 |
+- advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
9986 |
++ advk_pcie_train_link(pcie); |
9987 |
+ |
9988 |
+ reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); |
9989 |
+ reg |= PCIE_CORE_CMD_MEM_ACCESS_EN | |
9990 |
+@@ -989,6 +1071,28 @@ static int advk_pcie_probe(struct platform_device *pdev) |
9991 |
+ } |
9992 |
+ pcie->root_bus_nr = bus->start; |
9993 |
+ |
9994 |
++ pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node, |
9995 |
++ "reset-gpios", 0, |
9996 |
++ GPIOD_OUT_LOW, |
9997 |
++ "pcie1-reset"); |
9998 |
++ ret = PTR_ERR_OR_ZERO(pcie->reset_gpio); |
9999 |
++ if (ret) { |
10000 |
++ if (ret == -ENOENT) { |
10001 |
++ pcie->reset_gpio = NULL; |
10002 |
++ } else { |
10003 |
++ if (ret != -EPROBE_DEFER) |
10004 |
++ dev_err(dev, "Failed to get reset-gpio: %i\n", |
10005 |
++ ret); |
10006 |
++ return ret; |
10007 |
++ } |
10008 |
++ } |
10009 |
++ |
10010 |
++ ret = of_pci_get_max_link_speed(dev->of_node); |
10011 |
++ if (ret <= 0 || ret > 3) |
10012 |
++ pcie->link_gen = 3; |
10013 |
++ else |
10014 |
++ pcie->link_gen = ret; |
10015 |
++ |
10016 |
+ advk_pcie_setup_hw(pcie); |
10017 |
+ |
10018 |
+ advk_sw_pci_bridge_init(pcie); |
10019 |
+diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c |
10020 |
+index bd05221f5a22..ddcb4571a79b 100644 |
10021 |
+--- a/drivers/pci/controller/pci-v3-semi.c |
10022 |
++++ b/drivers/pci/controller/pci-v3-semi.c |
10023 |
+@@ -720,7 +720,7 @@ static int v3_pci_probe(struct platform_device *pdev) |
10024 |
+ int irq; |
10025 |
+ int ret; |
10026 |
+ |
10027 |
+- host = pci_alloc_host_bridge(sizeof(*v3)); |
10028 |
++ host = devm_pci_alloc_host_bridge(dev, sizeof(*v3)); |
10029 |
+ if (!host) |
10030 |
+ return -ENOMEM; |
10031 |
+ |
10032 |
+diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c |
10033 |
+index 6d79d14527a6..2297910bf6e4 100644 |
10034 |
+--- a/drivers/pci/controller/pcie-brcmstb.c |
10035 |
++++ b/drivers/pci/controller/pcie-brcmstb.c |
10036 |
+@@ -54,11 +54,11 @@ |
10037 |
+ |
10038 |
+ #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO 0x400c |
10039 |
+ #define PCIE_MEM_WIN0_LO(win) \ |
10040 |
+- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 4) |
10041 |
++ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 8) |
10042 |
+ |
10043 |
+ #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI 0x4010 |
10044 |
+ #define PCIE_MEM_WIN0_HI(win) \ |
10045 |
+- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 4) |
10046 |
++ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8) |
10047 |
+ |
10048 |
+ #define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c |
10049 |
+ #define PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f |
10050 |
+@@ -697,6 +697,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) |
10051 |
+ |
10052 |
+ /* Reset the bridge */ |
10053 |
+ brcm_pcie_bridge_sw_init_set(pcie, 1); |
10054 |
++ brcm_pcie_perst_set(pcie, 1); |
10055 |
+ |
10056 |
+ usleep_range(100, 200); |
10057 |
+ |
10058 |
+diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c |
10059 |
+index 759c6542c5c8..1bae6a4abaae 100644 |
10060 |
+--- a/drivers/pci/controller/pcie-rcar.c |
10061 |
++++ b/drivers/pci/controller/pcie-rcar.c |
10062 |
+@@ -333,11 +333,12 @@ static struct pci_ops rcar_pcie_ops = { |
10063 |
+ }; |
10064 |
+ |
10065 |
+ static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, |
10066 |
+- struct resource *res) |
10067 |
++ struct resource_entry *window) |
10068 |
+ { |
10069 |
+ /* Setup PCIe address space mappings for each resource */ |
10070 |
+ resource_size_t size; |
10071 |
+ resource_size_t res_start; |
10072 |
++ struct resource *res = window->res; |
10073 |
+ u32 mask; |
10074 |
+ |
10075 |
+ rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win)); |
10076 |
+@@ -351,9 +352,9 @@ static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, |
10077 |
+ rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); |
10078 |
+ |
10079 |
+ if (res->flags & IORESOURCE_IO) |
10080 |
+- res_start = pci_pio_to_address(res->start); |
10081 |
++ res_start = pci_pio_to_address(res->start) - window->offset; |
10082 |
+ else |
10083 |
+- res_start = res->start; |
10084 |
++ res_start = res->start - window->offset; |
10085 |
+ |
10086 |
+ rcar_pci_write_reg(pcie, upper_32_bits(res_start), PCIEPAUR(win)); |
10087 |
+ rcar_pci_write_reg(pcie, lower_32_bits(res_start) & ~0x7F, |
10088 |
+@@ -382,7 +383,7 @@ static int rcar_pcie_setup(struct list_head *resource, struct rcar_pcie *pci) |
10089 |
+ switch (resource_type(res)) { |
10090 |
+ case IORESOURCE_IO: |
10091 |
+ case IORESOURCE_MEM: |
10092 |
+- rcar_pcie_setup_window(i, pci, res); |
10093 |
++ rcar_pcie_setup_window(i, pci, win); |
10094 |
+ i++; |
10095 |
+ break; |
10096 |
+ case IORESOURCE_BUS: |
10097 |
+diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c |
10098 |
+index dac91d60701d..e386d4eac407 100644 |
10099 |
+--- a/drivers/pci/controller/vmd.c |
10100 |
++++ b/drivers/pci/controller/vmd.c |
10101 |
+@@ -445,9 +445,11 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) |
10102 |
+ if (!membar2) |
10103 |
+ return -ENOMEM; |
10104 |
+ offset[0] = vmd->dev->resource[VMD_MEMBAR1].start - |
10105 |
+- readq(membar2 + MB2_SHADOW_OFFSET); |
10106 |
++ (readq(membar2 + MB2_SHADOW_OFFSET) & |
10107 |
++ PCI_BASE_ADDRESS_MEM_MASK); |
10108 |
+ offset[1] = vmd->dev->resource[VMD_MEMBAR2].start - |
10109 |
+- readq(membar2 + MB2_SHADOW_OFFSET + 8); |
10110 |
++ (readq(membar2 + MB2_SHADOW_OFFSET + 8) & |
10111 |
++ PCI_BASE_ADDRESS_MEM_MASK); |
10112 |
+ pci_iounmap(vmd->dev, membar2); |
10113 |
+ } |
10114 |
+ } |
10115 |
+diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c |
10116 |
+index 60330f3e3751..c89a9561439f 100644 |
10117 |
+--- a/drivers/pci/endpoint/functions/pci-epf-test.c |
10118 |
++++ b/drivers/pci/endpoint/functions/pci-epf-test.c |
10119 |
+@@ -187,6 +187,9 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) |
10120 |
+ */ |
10121 |
+ static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test) |
10122 |
+ { |
10123 |
++ if (!epf_test->dma_supported) |
10124 |
++ return; |
10125 |
++ |
10126 |
+ dma_release_channel(epf_test->dma_chan); |
10127 |
+ epf_test->dma_chan = NULL; |
10128 |
+ } |
10129 |
+diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c |
10130 |
+index 4f4f54bc732e..faa414655f33 100644 |
10131 |
+--- a/drivers/pci/pci-bridge-emul.c |
10132 |
++++ b/drivers/pci/pci-bridge-emul.c |
10133 |
+@@ -185,8 +185,8 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { |
10134 |
+ * RO, the rest is reserved |
10135 |
+ */ |
10136 |
+ .w1c = GENMASK(19, 16), |
10137 |
+- .ro = GENMASK(20, 19), |
10138 |
+- .rsvd = GENMASK(31, 21), |
10139 |
++ .ro = GENMASK(21, 20), |
10140 |
++ .rsvd = GENMASK(31, 22), |
10141 |
+ }, |
10142 |
+ |
10143 |
+ [PCI_EXP_LNKCAP / 4] = { |
10144 |
+@@ -226,7 +226,7 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { |
10145 |
+ PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC) << 16, |
10146 |
+ .ro = (PCI_EXP_SLTSTA_MRLSS | PCI_EXP_SLTSTA_PDS | |
10147 |
+ PCI_EXP_SLTSTA_EIS) << 16, |
10148 |
+- .rsvd = GENMASK(15, 12) | (GENMASK(15, 9) << 16), |
10149 |
++ .rsvd = GENMASK(15, 13) | (GENMASK(15, 9) << 16), |
10150 |
+ }, |
10151 |
+ |
10152 |
+ [PCI_EXP_RTCTL / 4] = { |
10153 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
10154 |
+index 6d3234f75692..809f2584e338 100644 |
10155 |
+--- a/drivers/pci/pci.c |
10156 |
++++ b/drivers/pci/pci.c |
10157 |
+@@ -4660,7 +4660,8 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) |
10158 |
+ * pcie_wait_for_link_delay - Wait until link is active or inactive |
10159 |
+ * @pdev: Bridge device |
10160 |
+ * @active: waiting for active or inactive? |
10161 |
+- * @delay: Delay to wait after link has become active (in ms) |
10162 |
++ * @delay: Delay to wait after link has become active (in ms). Specify %0 |
10163 |
++ * for no delay. |
10164 |
+ * |
10165 |
+ * Use this to wait till link becomes active or inactive. |
10166 |
+ */ |
10167 |
+@@ -4701,7 +4702,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, |
10168 |
+ msleep(10); |
10169 |
+ timeout -= 10; |
10170 |
+ } |
10171 |
+- if (active && ret) |
10172 |
++ if (active && ret && delay) |
10173 |
+ msleep(delay); |
10174 |
+ else if (ret != active) |
10175 |
+ pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", |
10176 |
+@@ -4822,17 +4823,28 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) |
10177 |
+ if (!pcie_downstream_port(dev)) |
10178 |
+ return; |
10179 |
+ |
10180 |
+- if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { |
10181 |
+- pci_dbg(dev, "waiting %d ms for downstream link\n", delay); |
10182 |
+- msleep(delay); |
10183 |
+- } else { |
10184 |
+- pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", |
10185 |
+- delay); |
10186 |
+- if (!pcie_wait_for_link_delay(dev, true, delay)) { |
10187 |
++ /* |
10188 |
++ * Per PCIe r5.0, sec 6.6.1, for downstream ports that support |
10189 |
++ * speeds > 5 GT/s, we must wait for link training to complete |
10190 |
++ * before the mandatory delay. |
10191 |
++ * |
10192 |
++ * We can only tell when link training completes via DLL Link |
10193 |
++ * Active, which is required for downstream ports that support |
10194 |
++ * speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common |
10195 |
++ * devices do not implement Link Active reporting even when it's |
10196 |
++ * required, so we'll check for that directly instead of checking |
10197 |
++ * the supported link speed. We assume devices without Link Active |
10198 |
++ * reporting can train in 100 ms regardless of speed. |
10199 |
++ */ |
10200 |
++ if (dev->link_active_reporting) { |
10201 |
++ pci_dbg(dev, "waiting for link to train\n"); |
10202 |
++ if (!pcie_wait_for_link_delay(dev, true, 0)) { |
10203 |
+ /* Did not train, no need to wait any further */ |
10204 |
+ return; |
10205 |
+ } |
10206 |
+ } |
10207 |
++ pci_dbg(child, "waiting %d ms to become accessible\n", delay); |
10208 |
++ msleep(delay); |
10209 |
+ |
10210 |
+ if (!pci_device_is_present(child)) { |
10211 |
+ pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); |
10212 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
10213 |
+index 2378ed692534..b17e5ffd31b1 100644 |
10214 |
+--- a/drivers/pci/pcie/aspm.c |
10215 |
++++ b/drivers/pci/pcie/aspm.c |
10216 |
+@@ -628,16 +628,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) |
10217 |
+ |
10218 |
+ /* Setup initial capable state. Will be updated later */ |
10219 |
+ link->aspm_capable = link->aspm_support; |
10220 |
+- /* |
10221 |
+- * If the downstream component has pci bridge function, don't |
10222 |
+- * do ASPM for now. |
10223 |
+- */ |
10224 |
+- list_for_each_entry(child, &linkbus->devices, bus_list) { |
10225 |
+- if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) { |
10226 |
+- link->aspm_disable = ASPM_STATE_ALL; |
10227 |
+- break; |
10228 |
+- } |
10229 |
+- } |
10230 |
+ |
10231 |
+ /* Get and check endpoint acceptable latencies */ |
10232 |
+ list_for_each_entry(child, &linkbus->devices, bus_list) { |
10233 |
+diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c |
10234 |
+index 9361f3aa26ab..357a454cafa0 100644 |
10235 |
+--- a/drivers/pci/pcie/ptm.c |
10236 |
++++ b/drivers/pci/pcie/ptm.c |
10237 |
+@@ -39,10 +39,6 @@ void pci_ptm_init(struct pci_dev *dev) |
10238 |
+ if (!pci_is_pcie(dev)) |
10239 |
+ return; |
10240 |
+ |
10241 |
+- pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); |
10242 |
+- if (!pos) |
10243 |
+- return; |
10244 |
+- |
10245 |
+ /* |
10246 |
+ * Enable PTM only on interior devices (root ports, switch ports, |
10247 |
+ * etc.) on the assumption that it causes no link traffic until an |
10248 |
+@@ -52,6 +48,23 @@ void pci_ptm_init(struct pci_dev *dev) |
10249 |
+ pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END)) |
10250 |
+ return; |
10251 |
+ |
10252 |
++ /* |
10253 |
++ * Switch Downstream Ports are not permitted to have a PTM |
10254 |
++ * capability; their PTM behavior is controlled by the Upstream |
10255 |
++ * Port (PCIe r5.0, sec 7.9.16). |
10256 |
++ */ |
10257 |
++ ups = pci_upstream_bridge(dev); |
10258 |
++ if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM && |
10259 |
++ ups && ups->ptm_enabled) { |
10260 |
++ dev->ptm_granularity = ups->ptm_granularity; |
10261 |
++ dev->ptm_enabled = 1; |
10262 |
++ return; |
10263 |
++ } |
10264 |
++ |
10265 |
++ pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); |
10266 |
++ if (!pos) |
10267 |
++ return; |
10268 |
++ |
10269 |
+ pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); |
10270 |
+ local_clock = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; |
10271 |
+ |
10272 |
+@@ -61,7 +74,6 @@ void pci_ptm_init(struct pci_dev *dev) |
10273 |
+ * the spec recommendation (PCIe r3.1, sec 7.32.3), select the |
10274 |
+ * furthest upstream Time Source as the PTM Root. |
10275 |
+ */ |
10276 |
+- ups = pci_upstream_bridge(dev); |
10277 |
+ if (ups && ups->ptm_enabled) { |
10278 |
+ ctrl = PCI_PTM_CTRL_ENABLE; |
10279 |
+ if (ups->ptm_granularity == 0) |
10280 |
+diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
10281 |
+index c7e3a8267521..b59a4b0f5f16 100644 |
10282 |
+--- a/drivers/pci/probe.c |
10283 |
++++ b/drivers/pci/probe.c |
10284 |
+@@ -909,9 +909,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
10285 |
+ goto free; |
10286 |
+ |
10287 |
+ err = device_register(&bridge->dev); |
10288 |
+- if (err) |
10289 |
++ if (err) { |
10290 |
+ put_device(&bridge->dev); |
10291 |
+- |
10292 |
++ goto free; |
10293 |
++ } |
10294 |
+ bus->bridge = get_device(&bridge->dev); |
10295 |
+ device_enable_async_suspend(bus->bridge); |
10296 |
+ pci_set_bus_of_node(bus); |
10297 |
+diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c |
10298 |
+index d8ca40a97693..d21fa04fa44d 100644 |
10299 |
+--- a/drivers/pci/setup-res.c |
10300 |
++++ b/drivers/pci/setup-res.c |
10301 |
+@@ -439,10 +439,11 @@ int pci_resize_resource(struct pci_dev *dev, int resno, int size) |
10302 |
+ res->end = res->start + pci_rebar_size_to_bytes(size) - 1; |
10303 |
+ |
10304 |
+ /* Check if the new config works by trying to assign everything. */ |
10305 |
+- ret = pci_reassign_bridge_resources(dev->bus->self, res->flags); |
10306 |
+- if (ret) |
10307 |
+- goto error_resize; |
10308 |
+- |
10309 |
++ if (dev->bus->self) { |
10310 |
++ ret = pci_reassign_bridge_resources(dev->bus->self, res->flags); |
10311 |
++ if (ret) |
10312 |
++ goto error_resize; |
10313 |
++ } |
10314 |
+ return 0; |
10315 |
+ |
10316 |
+ error_resize: |
10317 |
+diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
10318 |
+index 1151e99b241c..479de4be99eb 100644 |
10319 |
+--- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
10320 |
++++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
10321 |
+@@ -35,7 +35,7 @@ |
10322 |
+ /* L3C has 8-counters */ |
10323 |
+ #define L3C_NR_COUNTERS 0x8 |
10324 |
+ |
10325 |
+-#define L3C_PERF_CTRL_EN 0x20000 |
10326 |
++#define L3C_PERF_CTRL_EN 0x10000 |
10327 |
+ #define L3C_EVTYPE_NONE 0xff |
10328 |
+ |
10329 |
+ /* |
10330 |
+diff --git a/drivers/phy/broadcom/phy-bcm-sr-usb.c b/drivers/phy/broadcom/phy-bcm-sr-usb.c |
10331 |
+index fe6c58910e4c..7c7862b4f41f 100644 |
10332 |
+--- a/drivers/phy/broadcom/phy-bcm-sr-usb.c |
10333 |
++++ b/drivers/phy/broadcom/phy-bcm-sr-usb.c |
10334 |
+@@ -16,8 +16,6 @@ enum bcm_usb_phy_version { |
10335 |
+ }; |
10336 |
+ |
10337 |
+ enum bcm_usb_phy_reg { |
10338 |
+- PLL_NDIV_FRAC, |
10339 |
+- PLL_NDIV_INT, |
10340 |
+ PLL_CTRL, |
10341 |
+ PHY_CTRL, |
10342 |
+ PHY_PLL_CTRL, |
10343 |
+@@ -31,18 +29,11 @@ static const u8 bcm_usb_combo_phy_ss[] = { |
10344 |
+ }; |
10345 |
+ |
10346 |
+ static const u8 bcm_usb_combo_phy_hs[] = { |
10347 |
+- [PLL_NDIV_FRAC] = 0x04, |
10348 |
+- [PLL_NDIV_INT] = 0x08, |
10349 |
+ [PLL_CTRL] = 0x0c, |
10350 |
+ [PHY_CTRL] = 0x10, |
10351 |
+ }; |
10352 |
+ |
10353 |
+-#define HSPLL_NDIV_INT_VAL 0x13 |
10354 |
+-#define HSPLL_NDIV_FRAC_VAL 0x1005 |
10355 |
+- |
10356 |
+ static const u8 bcm_usb_hs_phy[] = { |
10357 |
+- [PLL_NDIV_FRAC] = 0x0, |
10358 |
+- [PLL_NDIV_INT] = 0x4, |
10359 |
+ [PLL_CTRL] = 0x8, |
10360 |
+ [PHY_CTRL] = 0xc, |
10361 |
+ }; |
10362 |
+@@ -52,7 +43,6 @@ enum pll_ctrl_bits { |
10363 |
+ SSPLL_SUSPEND_EN, |
10364 |
+ PLL_SEQ_START, |
10365 |
+ PLL_LOCK, |
10366 |
+- PLL_PDIV, |
10367 |
+ }; |
10368 |
+ |
10369 |
+ static const u8 u3pll_ctrl[] = { |
10370 |
+@@ -66,29 +56,17 @@ static const u8 u3pll_ctrl[] = { |
10371 |
+ #define HSPLL_PDIV_VAL 0x1 |
10372 |
+ |
10373 |
+ static const u8 u2pll_ctrl[] = { |
10374 |
+- [PLL_PDIV] = 1, |
10375 |
+ [PLL_RESETB] = 5, |
10376 |
+ [PLL_LOCK] = 6, |
10377 |
+ }; |
10378 |
+ |
10379 |
+ enum bcm_usb_phy_ctrl_bits { |
10380 |
+ CORERDY, |
10381 |
+- AFE_LDO_PWRDWNB, |
10382 |
+- AFE_PLL_PWRDWNB, |
10383 |
+- AFE_BG_PWRDWNB, |
10384 |
+- PHY_ISO, |
10385 |
+ PHY_RESETB, |
10386 |
+ PHY_PCTL, |
10387 |
+ }; |
10388 |
+ |
10389 |
+ #define PHY_PCTL_MASK 0xffff |
10390 |
+-/* |
10391 |
+- * 0x0806 of PCTL_VAL has below bits set |
10392 |
+- * BIT-8 : refclk divider 1 |
10393 |
+- * BIT-3:2: device mode; mode is not effect |
10394 |
+- * BIT-1: soft reset active low |
10395 |
+- */ |
10396 |
+-#define HSPHY_PCTL_VAL 0x0806 |
10397 |
+ #define SSPHY_PCTL_VAL 0x0006 |
10398 |
+ |
10399 |
+ static const u8 u3phy_ctrl[] = { |
10400 |
+@@ -98,10 +76,6 @@ static const u8 u3phy_ctrl[] = { |
10401 |
+ |
10402 |
+ static const u8 u2phy_ctrl[] = { |
10403 |
+ [CORERDY] = 0, |
10404 |
+- [AFE_LDO_PWRDWNB] = 1, |
10405 |
+- [AFE_PLL_PWRDWNB] = 2, |
10406 |
+- [AFE_BG_PWRDWNB] = 3, |
10407 |
+- [PHY_ISO] = 4, |
10408 |
+ [PHY_RESETB] = 5, |
10409 |
+ [PHY_PCTL] = 6, |
10410 |
+ }; |
10411 |
+@@ -186,38 +160,13 @@ static int bcm_usb_hs_phy_init(struct bcm_usb_phy_cfg *phy_cfg) |
10412 |
+ int ret = 0; |
10413 |
+ void __iomem *regs = phy_cfg->regs; |
10414 |
+ const u8 *offset; |
10415 |
+- u32 rd_data; |
10416 |
+ |
10417 |
+ offset = phy_cfg->offset; |
10418 |
+ |
10419 |
+- writel(HSPLL_NDIV_INT_VAL, regs + offset[PLL_NDIV_INT]); |
10420 |
+- writel(HSPLL_NDIV_FRAC_VAL, regs + offset[PLL_NDIV_FRAC]); |
10421 |
+- |
10422 |
+- rd_data = readl(regs + offset[PLL_CTRL]); |
10423 |
+- rd_data &= ~(HSPLL_PDIV_MASK << u2pll_ctrl[PLL_PDIV]); |
10424 |
+- rd_data |= (HSPLL_PDIV_VAL << u2pll_ctrl[PLL_PDIV]); |
10425 |
+- writel(rd_data, regs + offset[PLL_CTRL]); |
10426 |
+- |
10427 |
+- /* Set Core Ready high */ |
10428 |
+- bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], |
10429 |
+- BIT(u2phy_ctrl[CORERDY])); |
10430 |
+- |
10431 |
+- /* Maximum timeout for Core Ready done */ |
10432 |
+- msleep(30); |
10433 |
+- |
10434 |
++ bcm_usb_reg32_clrbits(regs + offset[PLL_CTRL], |
10435 |
++ BIT(u2pll_ctrl[PLL_RESETB])); |
10436 |
+ bcm_usb_reg32_setbits(regs + offset[PLL_CTRL], |
10437 |
+ BIT(u2pll_ctrl[PLL_RESETB])); |
10438 |
+- bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], |
10439 |
+- BIT(u2phy_ctrl[PHY_RESETB])); |
10440 |
+- |
10441 |
+- |
10442 |
+- rd_data = readl(regs + offset[PHY_CTRL]); |
10443 |
+- rd_data &= ~(PHY_PCTL_MASK << u2phy_ctrl[PHY_PCTL]); |
10444 |
+- rd_data |= (HSPHY_PCTL_VAL << u2phy_ctrl[PHY_PCTL]); |
10445 |
+- writel(rd_data, regs + offset[PHY_CTRL]); |
10446 |
+- |
10447 |
+- /* Maximum timeout for PLL reset done */ |
10448 |
+- msleep(30); |
10449 |
+ |
10450 |
+ ret = bcm_usb_pll_lock_check(regs + offset[PLL_CTRL], |
10451 |
+ BIT(u2pll_ctrl[PLL_LOCK])); |
10452 |
+diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c |
10453 |
+index a5c08e5bd2bf..faed652b73f7 100644 |
10454 |
+--- a/drivers/phy/cadence/phy-cadence-sierra.c |
10455 |
++++ b/drivers/phy/cadence/phy-cadence-sierra.c |
10456 |
+@@ -685,10 +685,10 @@ static struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = { |
10457 |
+ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10458 |
+ {0xFE0A, SIERRA_DET_STANDEC_A_PREG}, |
10459 |
+ {0x000F, SIERRA_DET_STANDEC_B_PREG}, |
10460 |
+- {0x00A5, SIERRA_DET_STANDEC_C_PREG}, |
10461 |
++ {0x55A5, SIERRA_DET_STANDEC_C_PREG}, |
10462 |
+ {0x69ad, SIERRA_DET_STANDEC_D_PREG}, |
10463 |
+ {0x0241, SIERRA_DET_STANDEC_E_PREG}, |
10464 |
+- {0x0010, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, |
10465 |
++ {0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, |
10466 |
+ {0x0014, SIERRA_PSM_A0IN_TMR_PREG}, |
10467 |
+ {0xCF00, SIERRA_PSM_DIAG_PREG}, |
10468 |
+ {0x001F, SIERRA_PSC_TX_A0_PREG}, |
10469 |
+@@ -696,7 +696,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10470 |
+ {0x0003, SIERRA_PSC_TX_A2_PREG}, |
10471 |
+ {0x0003, SIERRA_PSC_TX_A3_PREG}, |
10472 |
+ {0x0FFF, SIERRA_PSC_RX_A0_PREG}, |
10473 |
+- {0x0619, SIERRA_PSC_RX_A1_PREG}, |
10474 |
++ {0x0003, SIERRA_PSC_RX_A1_PREG}, |
10475 |
+ {0x0003, SIERRA_PSC_RX_A2_PREG}, |
10476 |
+ {0x0001, SIERRA_PSC_RX_A3_PREG}, |
10477 |
+ {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG}, |
10478 |
+@@ -705,19 +705,19 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10479 |
+ {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG}, |
10480 |
+ {0x2512, SIERRA_DFE_BIASTRIM_PREG}, |
10481 |
+ {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, |
10482 |
+- {0x873E, SIERRA_CLKPATHCTRL_TMR_PREG}, |
10483 |
+- {0x03CF, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, |
10484 |
+- {0x01CE, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, |
10485 |
++ {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, |
10486 |
++ {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, |
10487 |
++ {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, |
10488 |
+ {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, |
10489 |
+- {0x033F, SIERRA_RX_CTLE_MAINTENANCE_PREG}, |
10490 |
++ {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, |
10491 |
+ {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, |
10492 |
+ {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, |
10493 |
+- {0x8000, SIERRA_CREQ_SPARE_PREG}, |
10494 |
++ {0x0000, SIERRA_CREQ_SPARE_PREG}, |
10495 |
+ {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, |
10496 |
+- {0x8453, SIERRA_CTLELUT_CTRL_PREG}, |
10497 |
+- {0x4110, SIERRA_DFE_ECMP_RATESEL_PREG}, |
10498 |
+- {0x4110, SIERRA_DFE_SMP_RATESEL_PREG}, |
10499 |
+- {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, |
10500 |
++ {0x8452, SIERRA_CTLELUT_CTRL_PREG}, |
10501 |
++ {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, |
10502 |
++ {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, |
10503 |
++ {0x0003, SIERRA_DEQ_PHALIGN_CTRL}, |
10504 |
+ {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG}, |
10505 |
+ {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG}, |
10506 |
+ {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, |
10507 |
+@@ -725,7 +725,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10508 |
+ {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG}, |
10509 |
+ {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG}, |
10510 |
+ {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG}, |
10511 |
+- {0x9A8A, SIERRA_DEQ_VGATUNE_CTRL_PREG}, |
10512 |
++ {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, |
10513 |
+ {0x0014, SIERRA_DEQ_GLUT0}, |
10514 |
+ {0x0014, SIERRA_DEQ_GLUT1}, |
10515 |
+ {0x0014, SIERRA_DEQ_GLUT2}, |
10516 |
+@@ -772,6 +772,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10517 |
+ {0x000F, SIERRA_LFPSFILT_NS_PREG}, |
10518 |
+ {0x0009, SIERRA_LFPSFILT_RD_PREG}, |
10519 |
+ {0x0001, SIERRA_LFPSFILT_MP_PREG}, |
10520 |
++ {0x6013, SIERRA_SIGDET_SUPPORT_PREG}, |
10521 |
+ {0x8013, SIERRA_SDFILT_H2L_A_PREG}, |
10522 |
+ {0x8009, SIERRA_SDFILT_L2H_PREG}, |
10523 |
+ {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG}, |
10524 |
+diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c |
10525 |
+index 7b51045df783..c8e4ff341cef 100644 |
10526 |
+--- a/drivers/phy/ti/phy-j721e-wiz.c |
10527 |
++++ b/drivers/phy/ti/phy-j721e-wiz.c |
10528 |
+@@ -794,8 +794,10 @@ static int wiz_probe(struct platform_device *pdev) |
10529 |
+ } |
10530 |
+ |
10531 |
+ base = devm_ioremap(dev, res.start, resource_size(&res)); |
10532 |
+- if (!base) |
10533 |
++ if (!base) { |
10534 |
++ ret = -ENOMEM; |
10535 |
+ goto err_addr_to_resource; |
10536 |
++ } |
10537 |
+ |
10538 |
+ regmap = devm_regmap_init_mmio(dev, base, &wiz_regmap_config); |
10539 |
+ if (IS_ERR(regmap)) { |
10540 |
+@@ -812,6 +814,7 @@ static int wiz_probe(struct platform_device *pdev) |
10541 |
+ |
10542 |
+ if (num_lanes > WIZ_MAX_LANES) { |
10543 |
+ dev_err(dev, "Cannot support %d lanes\n", num_lanes); |
10544 |
++ ret = -ENODEV; |
10545 |
+ goto err_addr_to_resource; |
10546 |
+ } |
10547 |
+ |
10548 |
+@@ -897,6 +900,7 @@ static int wiz_probe(struct platform_device *pdev) |
10549 |
+ serdes_pdev = of_platform_device_create(child_node, NULL, dev); |
10550 |
+ if (!serdes_pdev) { |
10551 |
+ dev_WARN(dev, "Unable to create SERDES platform device\n"); |
10552 |
++ ret = -ENOMEM; |
10553 |
+ goto err_pdev_create; |
10554 |
+ } |
10555 |
+ wiz->serdes_pdev = serdes_pdev; |
10556 |
+diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c |
10557 |
+index f690fc5cd688..71e666178300 100644 |
10558 |
+--- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c |
10559 |
++++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c |
10560 |
+@@ -1406,7 +1406,7 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev) |
10561 |
+ pdata->reg_base = devm_platform_ioremap_resource(pdev, 0); |
10562 |
+ if (IS_ERR(pdata->reg_base)) { |
10563 |
+ dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); |
10564 |
+- return -ENODEV; |
10565 |
++ return PTR_ERR(pdata->reg_base); |
10566 |
+ } |
10567 |
+ |
10568 |
+ /* Initialize the dynamic part of pinctrl_desc */ |
10569 |
+diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c |
10570 |
+index 9f42036c5fbb..1f81569c7ae3 100644 |
10571 |
+--- a/drivers/pinctrl/freescale/pinctrl-imx.c |
10572 |
++++ b/drivers/pinctrl/freescale/pinctrl-imx.c |
10573 |
+@@ -774,16 +774,6 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, |
10574 |
+ return 0; |
10575 |
+ } |
10576 |
+ |
10577 |
+-/* |
10578 |
+- * imx_free_resources() - free memory used by this driver |
10579 |
+- * @info: info driver instance |
10580 |
+- */ |
10581 |
+-static void imx_free_resources(struct imx_pinctrl *ipctl) |
10582 |
+-{ |
10583 |
+- if (ipctl->pctl) |
10584 |
+- pinctrl_unregister(ipctl->pctl); |
10585 |
+-} |
10586 |
+- |
10587 |
+ int imx_pinctrl_probe(struct platform_device *pdev, |
10588 |
+ const struct imx_pinctrl_soc_info *info) |
10589 |
+ { |
10590 |
+@@ -874,23 +864,18 @@ int imx_pinctrl_probe(struct platform_device *pdev, |
10591 |
+ &ipctl->pctl); |
10592 |
+ if (ret) { |
10593 |
+ dev_err(&pdev->dev, "could not register IMX pinctrl driver\n"); |
10594 |
+- goto free; |
10595 |
++ return ret; |
10596 |
+ } |
10597 |
+ |
10598 |
+ ret = imx_pinctrl_probe_dt(pdev, ipctl); |
10599 |
+ if (ret) { |
10600 |
+ dev_err(&pdev->dev, "fail to probe dt properties\n"); |
10601 |
+- goto free; |
10602 |
++ return ret; |
10603 |
+ } |
10604 |
+ |
10605 |
+ dev_info(&pdev->dev, "initialized IMX pinctrl driver\n"); |
10606 |
+ |
10607 |
+ return pinctrl_enable(ipctl->pctl); |
10608 |
+- |
10609 |
+-free: |
10610 |
+- imx_free_resources(ipctl); |
10611 |
+- |
10612 |
+- return ret; |
10613 |
+ } |
10614 |
+ |
10615 |
+ static int __maybe_unused imx_pinctrl_suspend(struct device *dev) |
10616 |
+diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
10617 |
+index c00d0022d311..421f7d1886e5 100644 |
10618 |
+--- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
10619 |
++++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
10620 |
+@@ -638,7 +638,6 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, |
10621 |
+ |
10622 |
+ ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); |
10623 |
+ if (ret) { |
10624 |
+- pinctrl_unregister(ipctl->pctl); |
10625 |
+ dev_err(&pdev->dev, "Failed to populate subdevices\n"); |
10626 |
+ return ret; |
10627 |
+ } |
10628 |
+diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c |
10629 |
+index 694912409fd9..54222ccddfb1 100644 |
10630 |
+--- a/drivers/pinctrl/pinctrl-at91-pio4.c |
10631 |
++++ b/drivers/pinctrl/pinctrl-at91-pio4.c |
10632 |
+@@ -1019,7 +1019,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) |
10633 |
+ |
10634 |
+ atmel_pioctrl->reg_base = devm_platform_ioremap_resource(pdev, 0); |
10635 |
+ if (IS_ERR(atmel_pioctrl->reg_base)) |
10636 |
+- return -EINVAL; |
10637 |
++ return PTR_ERR(atmel_pioctrl->reg_base); |
10638 |
+ |
10639 |
+ atmel_pioctrl->clk = devm_clk_get(dev, NULL); |
10640 |
+ if (IS_ERR(atmel_pioctrl->clk)) { |
10641 |
+diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c |
10642 |
+index ed8eac6c1494..b1bf46ec207f 100644 |
10643 |
+--- a/drivers/pinctrl/pinctrl-ocelot.c |
10644 |
++++ b/drivers/pinctrl/pinctrl-ocelot.c |
10645 |
+@@ -714,11 +714,12 @@ static void ocelot_irq_handler(struct irq_desc *desc) |
10646 |
+ struct irq_chip *parent_chip = irq_desc_get_chip(desc); |
10647 |
+ struct gpio_chip *chip = irq_desc_get_handler_data(desc); |
10648 |
+ struct ocelot_pinctrl *info = gpiochip_get_data(chip); |
10649 |
++ unsigned int id_reg = OCELOT_GPIO_INTR_IDENT * info->stride; |
10650 |
+ unsigned int reg = 0, irq, i; |
10651 |
+ unsigned long irqs; |
10652 |
+ |
10653 |
+ for (i = 0; i < info->stride; i++) { |
10654 |
+- regmap_read(info->map, OCELOT_GPIO_INTR_IDENT + 4 * i, ®); |
10655 |
++ regmap_read(info->map, id_reg + 4 * i, ®); |
10656 |
+ if (!reg) |
10657 |
+ continue; |
10658 |
+ |
10659 |
+@@ -751,21 +752,21 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, |
10660 |
+ gc->of_node = info->dev->of_node; |
10661 |
+ gc->label = "ocelot-gpio"; |
10662 |
+ |
10663 |
+- irq = irq_of_parse_and_map(pdev->dev.of_node, 0); |
10664 |
+- if (irq <= 0) |
10665 |
+- return irq; |
10666 |
+- |
10667 |
+- girq = &gc->irq; |
10668 |
+- girq->chip = &ocelot_irqchip; |
10669 |
+- girq->parent_handler = ocelot_irq_handler; |
10670 |
+- girq->num_parents = 1; |
10671 |
+- girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), |
10672 |
+- GFP_KERNEL); |
10673 |
+- if (!girq->parents) |
10674 |
+- return -ENOMEM; |
10675 |
+- girq->parents[0] = irq; |
10676 |
+- girq->default_type = IRQ_TYPE_NONE; |
10677 |
+- girq->handler = handle_edge_irq; |
10678 |
++ irq = irq_of_parse_and_map(gc->of_node, 0); |
10679 |
++ if (irq) { |
10680 |
++ girq = &gc->irq; |
10681 |
++ girq->chip = &ocelot_irqchip; |
10682 |
++ girq->parent_handler = ocelot_irq_handler; |
10683 |
++ girq->num_parents = 1; |
10684 |
++ girq->parents = devm_kcalloc(&pdev->dev, 1, |
10685 |
++ sizeof(*girq->parents), |
10686 |
++ GFP_KERNEL); |
10687 |
++ if (!girq->parents) |
10688 |
++ return -ENOMEM; |
10689 |
++ girq->parents[0] = irq; |
10690 |
++ girq->default_type = IRQ_TYPE_NONE; |
10691 |
++ girq->handler = handle_edge_irq; |
10692 |
++ } |
10693 |
+ |
10694 |
+ ret = devm_gpiochip_add_data(&pdev->dev, gc, info); |
10695 |
+ if (ret) |
10696 |
+diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
10697 |
+index 098951346339..d7869b636889 100644 |
10698 |
+--- a/drivers/pinctrl/pinctrl-rockchip.c |
10699 |
++++ b/drivers/pinctrl/pinctrl-rockchip.c |
10700 |
+@@ -508,8 +508,8 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
10701 |
+ } |
10702 |
+ |
10703 |
+ map_num += grp->npins; |
10704 |
+- new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), |
10705 |
+- GFP_KERNEL); |
10706 |
++ |
10707 |
++ new_map = kcalloc(map_num, sizeof(*new_map), GFP_KERNEL); |
10708 |
+ if (!new_map) |
10709 |
+ return -ENOMEM; |
10710 |
+ |
10711 |
+@@ -519,7 +519,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
10712 |
+ /* create mux map */ |
10713 |
+ parent = of_get_parent(np); |
10714 |
+ if (!parent) { |
10715 |
+- devm_kfree(pctldev->dev, new_map); |
10716 |
++ kfree(new_map); |
10717 |
+ return -EINVAL; |
10718 |
+ } |
10719 |
+ new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; |
10720 |
+@@ -546,6 +546,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
10721 |
+ static void rockchip_dt_free_map(struct pinctrl_dev *pctldev, |
10722 |
+ struct pinctrl_map *map, unsigned num_maps) |
10723 |
+ { |
10724 |
++ kfree(map); |
10725 |
+ } |
10726 |
+ |
10727 |
+ static const struct pinctrl_ops rockchip_pctrl_ops = { |
10728 |
+diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c |
10729 |
+index da2d8365c690..ff4a7fb518bb 100644 |
10730 |
+--- a/drivers/pinctrl/pinctrl-rza1.c |
10731 |
++++ b/drivers/pinctrl/pinctrl-rza1.c |
10732 |
+@@ -418,7 +418,7 @@ static const struct rza1_bidir_entry rza1l_bidir_entries[RZA1_NPORTS] = { |
10733 |
+ }; |
10734 |
+ |
10735 |
+ static const struct rza1_swio_entry rza1l_swio_entries[] = { |
10736 |
+- [0] = { ARRAY_SIZE(rza1h_swio_pins), rza1h_swio_pins }, |
10737 |
++ [0] = { ARRAY_SIZE(rza1l_swio_pins), rza1l_swio_pins }, |
10738 |
+ }; |
10739 |
+ |
10740 |
+ /* RZ/A1L (r7s72102x) pinmux flags table */ |
10741 |
+diff --git a/drivers/pinctrl/qcom/pinctrl-ipq6018.c b/drivers/pinctrl/qcom/pinctrl-ipq6018.c |
10742 |
+index 38c33a778cb8..ec50a3b4bd16 100644 |
10743 |
+--- a/drivers/pinctrl/qcom/pinctrl-ipq6018.c |
10744 |
++++ b/drivers/pinctrl/qcom/pinctrl-ipq6018.c |
10745 |
+@@ -367,7 +367,8 @@ static const char * const wci20_groups[] = { |
10746 |
+ |
10747 |
+ static const char * const qpic_pad_groups[] = { |
10748 |
+ "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio9", "gpio10", |
10749 |
+- "gpio11", "gpio17", |
10750 |
++ "gpio11", "gpio17", "gpio15", "gpio12", "gpio13", "gpio14", "gpio5", |
10751 |
++ "gpio6", "gpio7", "gpio8", |
10752 |
+ }; |
10753 |
+ |
10754 |
+ static const char * const burn0_groups[] = { |
10755 |
+diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c |
10756 |
+index 1ebcb957c654..63a287d5795f 100644 |
10757 |
+--- a/drivers/pinctrl/sirf/pinctrl-sirf.c |
10758 |
++++ b/drivers/pinctrl/sirf/pinctrl-sirf.c |
10759 |
+@@ -794,13 +794,17 @@ static int sirfsoc_gpio_probe(struct device_node *np) |
10760 |
+ return -ENODEV; |
10761 |
+ |
10762 |
+ sgpio = devm_kzalloc(&pdev->dev, sizeof(*sgpio), GFP_KERNEL); |
10763 |
+- if (!sgpio) |
10764 |
+- return -ENOMEM; |
10765 |
++ if (!sgpio) { |
10766 |
++ err = -ENOMEM; |
10767 |
++ goto out_put_device; |
10768 |
++ } |
10769 |
+ spin_lock_init(&sgpio->lock); |
10770 |
+ |
10771 |
+ regs = of_iomap(np, 0); |
10772 |
+- if (!regs) |
10773 |
+- return -ENOMEM; |
10774 |
++ if (!regs) { |
10775 |
++ err = -ENOMEM; |
10776 |
++ goto out_put_device; |
10777 |
++ } |
10778 |
+ |
10779 |
+ sgpio->chip.gc.request = sirfsoc_gpio_request; |
10780 |
+ sgpio->chip.gc.free = sirfsoc_gpio_free; |
10781 |
+@@ -824,8 +828,10 @@ static int sirfsoc_gpio_probe(struct device_node *np) |
10782 |
+ girq->parents = devm_kcalloc(&pdev->dev, SIRFSOC_GPIO_NO_OF_BANKS, |
10783 |
+ sizeof(*girq->parents), |
10784 |
+ GFP_KERNEL); |
10785 |
+- if (!girq->parents) |
10786 |
+- return -ENOMEM; |
10787 |
++ if (!girq->parents) { |
10788 |
++ err = -ENOMEM; |
10789 |
++ goto out_put_device; |
10790 |
++ } |
10791 |
+ for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { |
10792 |
+ bank = &sgpio->sgpio_bank[i]; |
10793 |
+ spin_lock_init(&bank->lock); |
10794 |
+@@ -868,6 +874,8 @@ out_no_range: |
10795 |
+ gpiochip_remove(&sgpio->chip.gc); |
10796 |
+ out: |
10797 |
+ iounmap(regs); |
10798 |
++out_put_device: |
10799 |
++ put_device(&pdev->dev); |
10800 |
+ return err; |
10801 |
+ } |
10802 |
+ |
10803 |
+diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig |
10804 |
+index f3424fdce341..d37ec0d03237 100644 |
10805 |
+--- a/drivers/power/supply/Kconfig |
10806 |
++++ b/drivers/power/supply/Kconfig |
10807 |
+@@ -577,7 +577,7 @@ config CHARGER_BQ24257 |
10808 |
+ tristate "TI BQ24250/24251/24257 battery charger driver" |
10809 |
+ depends on I2C |
10810 |
+ depends on GPIOLIB || COMPILE_TEST |
10811 |
+- depends on REGMAP_I2C |
10812 |
++ select REGMAP_I2C |
10813 |
+ help |
10814 |
+ Say Y to enable support for the TI BQ24250, BQ24251, and BQ24257 battery |
10815 |
+ chargers. |
10816 |
+diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c |
10817 |
+index 84a206f42a8e..e7931ffb7151 100644 |
10818 |
+--- a/drivers/power/supply/lp8788-charger.c |
10819 |
++++ b/drivers/power/supply/lp8788-charger.c |
10820 |
+@@ -572,27 +572,14 @@ static void lp8788_setup_adc_channel(struct device *dev, |
10821 |
+ return; |
10822 |
+ |
10823 |
+ /* ADC channel for battery voltage */ |
10824 |
+- chan = iio_channel_get(dev, pdata->adc_vbatt); |
10825 |
++ chan = devm_iio_channel_get(dev, pdata->adc_vbatt); |
10826 |
+ pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan; |
10827 |
+ |
10828 |
+ /* ADC channel for battery temperature */ |
10829 |
+- chan = iio_channel_get(dev, pdata->adc_batt_temp); |
10830 |
++ chan = devm_iio_channel_get(dev, pdata->adc_batt_temp); |
10831 |
+ pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan; |
10832 |
+ } |
10833 |
+ |
10834 |
+-static void lp8788_release_adc_channel(struct lp8788_charger *pchg) |
10835 |
+-{ |
10836 |
+- int i; |
10837 |
+- |
10838 |
+- for (i = 0; i < LP8788_NUM_CHG_ADC; i++) { |
10839 |
+- if (!pchg->chan[i]) |
10840 |
+- continue; |
10841 |
+- |
10842 |
+- iio_channel_release(pchg->chan[i]); |
10843 |
+- pchg->chan[i] = NULL; |
10844 |
+- } |
10845 |
+-} |
10846 |
+- |
10847 |
+ static ssize_t lp8788_show_charger_status(struct device *dev, |
10848 |
+ struct device_attribute *attr, char *buf) |
10849 |
+ { |
10850 |
+@@ -735,7 +722,6 @@ static int lp8788_charger_remove(struct platform_device *pdev) |
10851 |
+ flush_work(&pchg->charger_work); |
10852 |
+ lp8788_irq_unregister(pdev, pchg); |
10853 |
+ lp8788_psy_unregister(pchg); |
10854 |
+- lp8788_release_adc_channel(pchg); |
10855 |
+ |
10856 |
+ return 0; |
10857 |
+ } |
10858 |
+diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c |
10859 |
+index c1d124b8be0c..d102921b3ab2 100644 |
10860 |
+--- a/drivers/power/supply/smb347-charger.c |
10861 |
++++ b/drivers/power/supply/smb347-charger.c |
10862 |
+@@ -1138,6 +1138,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg) |
10863 |
+ switch (reg) { |
10864 |
+ case IRQSTAT_A: |
10865 |
+ case IRQSTAT_C: |
10866 |
++ case IRQSTAT_D: |
10867 |
+ case IRQSTAT_E: |
10868 |
+ case IRQSTAT_F: |
10869 |
+ case STAT_A: |
10870 |
+diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c |
10871 |
+index 9973c442b455..6b3cbc0490c6 100644 |
10872 |
+--- a/drivers/pwm/core.c |
10873 |
++++ b/drivers/pwm/core.c |
10874 |
+@@ -121,7 +121,7 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) |
10875 |
+ pwm->chip->ops->get_state(pwm->chip, pwm, &pwm->state); |
10876 |
+ trace_pwm_get(pwm, &pwm->state); |
10877 |
+ |
10878 |
+- if (IS_ENABLED(PWM_DEBUG)) |
10879 |
++ if (IS_ENABLED(CONFIG_PWM_DEBUG)) |
10880 |
+ pwm->last = pwm->state; |
10881 |
+ } |
10882 |
+ |
10883 |
+diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c |
10884 |
+index c9e57bd109fb..599a0f66a384 100644 |
10885 |
+--- a/drivers/pwm/pwm-img.c |
10886 |
++++ b/drivers/pwm/pwm-img.c |
10887 |
+@@ -129,8 +129,10 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
10888 |
+ duty = DIV_ROUND_UP(timebase * duty_ns, period_ns); |
10889 |
+ |
10890 |
+ ret = pm_runtime_get_sync(chip->dev); |
10891 |
+- if (ret < 0) |
10892 |
++ if (ret < 0) { |
10893 |
++ pm_runtime_put_autosuspend(chip->dev); |
10894 |
+ return ret; |
10895 |
++ } |
10896 |
+ |
10897 |
+ val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); |
10898 |
+ val &= ~(PWM_CTRL_CFG_DIV_MASK << PWM_CTRL_CFG_DIV_SHIFT(pwm->hwpwm)); |
10899 |
+@@ -331,8 +333,10 @@ static int img_pwm_remove(struct platform_device *pdev) |
10900 |
+ int ret; |
10901 |
+ |
10902 |
+ ret = pm_runtime_get_sync(&pdev->dev); |
10903 |
+- if (ret < 0) |
10904 |
++ if (ret < 0) { |
10905 |
++ pm_runtime_put(&pdev->dev); |
10906 |
+ return ret; |
10907 |
++ } |
10908 |
+ |
10909 |
+ for (i = 0; i < pwm_chip->chip.npwm; i++) { |
10910 |
+ val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); |
10911 |
+diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c |
10912 |
+index a6e40d4c485f..732a6f3701e8 100644 |
10913 |
+--- a/drivers/pwm/pwm-imx27.c |
10914 |
++++ b/drivers/pwm/pwm-imx27.c |
10915 |
+@@ -150,13 +150,12 @@ static void pwm_imx27_get_state(struct pwm_chip *chip, |
10916 |
+ |
10917 |
+ prescaler = MX3_PWMCR_PRESCALER_GET(val); |
10918 |
+ pwm_clk = clk_get_rate(imx->clk_per); |
10919 |
+- pwm_clk = DIV_ROUND_CLOSEST_ULL(pwm_clk, prescaler); |
10920 |
+ val = readl(imx->mmio_base + MX3_PWMPR); |
10921 |
+ period = val >= MX3_PWMPR_MAX ? MX3_PWMPR_MAX : val; |
10922 |
+ |
10923 |
+ /* PWMOUT (Hz) = PWMCLK / (PWMPR + 2) */ |
10924 |
+- tmp = NSEC_PER_SEC * (u64)(period + 2); |
10925 |
+- state->period = DIV_ROUND_CLOSEST_ULL(tmp, pwm_clk); |
10926 |
++ tmp = NSEC_PER_SEC * (u64)(period + 2) * prescaler; |
10927 |
++ state->period = DIV_ROUND_UP_ULL(tmp, pwm_clk); |
10928 |
+ |
10929 |
+ /* |
10930 |
+ * PWMSAR can be read only if PWM is enabled. If the PWM is disabled, |
10931 |
+@@ -167,8 +166,8 @@ static void pwm_imx27_get_state(struct pwm_chip *chip, |
10932 |
+ else |
10933 |
+ val = imx->duty_cycle; |
10934 |
+ |
10935 |
+- tmp = NSEC_PER_SEC * (u64)(val); |
10936 |
+- state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, pwm_clk); |
10937 |
++ tmp = NSEC_PER_SEC * (u64)(val) * prescaler; |
10938 |
++ state->duty_cycle = DIV_ROUND_UP_ULL(tmp, pwm_clk); |
10939 |
+ |
10940 |
+ pwm_imx27_clk_disable_unprepare(imx); |
10941 |
+ } |
10942 |
+@@ -220,22 +219,23 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
10943 |
+ struct pwm_imx27_chip *imx = to_pwm_imx27_chip(chip); |
10944 |
+ struct pwm_state cstate; |
10945 |
+ unsigned long long c; |
10946 |
++ unsigned long long clkrate; |
10947 |
+ int ret; |
10948 |
+ u32 cr; |
10949 |
+ |
10950 |
+ pwm_get_state(pwm, &cstate); |
10951 |
+ |
10952 |
+- c = clk_get_rate(imx->clk_per); |
10953 |
+- c *= state->period; |
10954 |
++ clkrate = clk_get_rate(imx->clk_per); |
10955 |
++ c = clkrate * state->period; |
10956 |
+ |
10957 |
+- do_div(c, 1000000000); |
10958 |
++ do_div(c, NSEC_PER_SEC); |
10959 |
+ period_cycles = c; |
10960 |
+ |
10961 |
+ prescale = period_cycles / 0x10000 + 1; |
10962 |
+ |
10963 |
+ period_cycles /= prescale; |
10964 |
+- c = (unsigned long long)period_cycles * state->duty_cycle; |
10965 |
+- do_div(c, state->period); |
10966 |
++ c = clkrate * state->duty_cycle; |
10967 |
++ do_div(c, NSEC_PER_SEC * prescale); |
10968 |
+ duty_cycles = c; |
10969 |
+ |
10970 |
+ /* |
10971 |
+diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c |
10972 |
+index 2bead57c9cf9..ac13e7b046a6 100644 |
10973 |
+--- a/drivers/remoteproc/mtk_scp.c |
10974 |
++++ b/drivers/remoteproc/mtk_scp.c |
10975 |
+@@ -132,8 +132,8 @@ static int scp_ipi_init(struct mtk_scp *scp) |
10976 |
+ (struct mtk_share_obj __iomem *)(scp->sram_base + recv_offset); |
10977 |
+ scp->send_buf = |
10978 |
+ (struct mtk_share_obj __iomem *)(scp->sram_base + send_offset); |
10979 |
+- memset_io(scp->recv_buf, 0, sizeof(scp->recv_buf)); |
10980 |
+- memset_io(scp->send_buf, 0, sizeof(scp->send_buf)); |
10981 |
++ memset_io(scp->recv_buf, 0, sizeof(*scp->recv_buf)); |
10982 |
++ memset_io(scp->send_buf, 0, sizeof(*scp->send_buf)); |
10983 |
+ |
10984 |
+ return 0; |
10985 |
+ } |
10986 |
+diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c |
10987 |
+index 5475d4f808a8..629abcee2c1d 100644 |
10988 |
+--- a/drivers/remoteproc/qcom_q6v5_mss.c |
10989 |
++++ b/drivers/remoteproc/qcom_q6v5_mss.c |
10990 |
+@@ -69,13 +69,9 @@ |
10991 |
+ #define AXI_HALTREQ_REG 0x0 |
10992 |
+ #define AXI_HALTACK_REG 0x4 |
10993 |
+ #define AXI_IDLE_REG 0x8 |
10994 |
+-#define NAV_AXI_HALTREQ_BIT BIT(0) |
10995 |
+-#define NAV_AXI_HALTACK_BIT BIT(1) |
10996 |
+-#define NAV_AXI_IDLE_BIT BIT(2) |
10997 |
+ #define AXI_GATING_VALID_OVERRIDE BIT(0) |
10998 |
+ |
10999 |
+ #define HALT_ACK_TIMEOUT_US 100000 |
11000 |
+-#define NAV_HALT_ACK_TIMEOUT_US 200 |
11001 |
+ |
11002 |
+ /* QDSP6SS_RESET */ |
11003 |
+ #define Q6SS_STOP_CORE BIT(0) |
11004 |
+@@ -143,7 +139,7 @@ struct rproc_hexagon_res { |
11005 |
+ int version; |
11006 |
+ bool need_mem_protection; |
11007 |
+ bool has_alt_reset; |
11008 |
+- bool has_halt_nav; |
11009 |
++ bool has_spare_reg; |
11010 |
+ }; |
11011 |
+ |
11012 |
+ struct q6v5 { |
11013 |
+@@ -154,13 +150,11 @@ struct q6v5 { |
11014 |
+ void __iomem *rmb_base; |
11015 |
+ |
11016 |
+ struct regmap *halt_map; |
11017 |
+- struct regmap *halt_nav_map; |
11018 |
+ struct regmap *conn_map; |
11019 |
+ |
11020 |
+ u32 halt_q6; |
11021 |
+ u32 halt_modem; |
11022 |
+ u32 halt_nc; |
11023 |
+- u32 halt_nav; |
11024 |
+ u32 conn_box; |
11025 |
+ |
11026 |
+ struct reset_control *mss_restart; |
11027 |
+@@ -206,7 +200,7 @@ struct q6v5 { |
11028 |
+ struct qcom_sysmon *sysmon; |
11029 |
+ bool need_mem_protection; |
11030 |
+ bool has_alt_reset; |
11031 |
+- bool has_halt_nav; |
11032 |
++ bool has_spare_reg; |
11033 |
+ int mpss_perm; |
11034 |
+ int mba_perm; |
11035 |
+ const char *hexagon_mdt_image; |
11036 |
+@@ -427,21 +421,19 @@ static int q6v5_reset_assert(struct q6v5 *qproc) |
11037 |
+ reset_control_assert(qproc->pdc_reset); |
11038 |
+ ret = reset_control_reset(qproc->mss_restart); |
11039 |
+ reset_control_deassert(qproc->pdc_reset); |
11040 |
+- } else if (qproc->has_halt_nav) { |
11041 |
++ } else if (qproc->has_spare_reg) { |
11042 |
+ /* |
11043 |
+ * When the AXI pipeline is being reset with the Q6 modem partly |
11044 |
+ * operational there is possibility of AXI valid signal to |
11045 |
+ * glitch, leading to spurious transactions and Q6 hangs. A work |
11046 |
+ * around is employed by asserting the AXI_GATING_VALID_OVERRIDE |
11047 |
+- * BIT before triggering Q6 MSS reset. Both the HALTREQ and |
11048 |
+- * AXI_GATING_VALID_OVERRIDE are withdrawn post MSS assert |
11049 |
+- * followed by a MSS deassert, while holding the PDC reset. |
11050 |
++ * BIT before triggering Q6 MSS reset. AXI_GATING_VALID_OVERRIDE |
11051 |
++ * is withdrawn post MSS assert followed by a MSS deassert, |
11052 |
++ * while holding the PDC reset. |
11053 |
+ */ |
11054 |
+ reset_control_assert(qproc->pdc_reset); |
11055 |
+ regmap_update_bits(qproc->conn_map, qproc->conn_box, |
11056 |
+ AXI_GATING_VALID_OVERRIDE, 1); |
11057 |
+- regmap_update_bits(qproc->halt_nav_map, qproc->halt_nav, |
11058 |
+- NAV_AXI_HALTREQ_BIT, 0); |
11059 |
+ reset_control_assert(qproc->mss_restart); |
11060 |
+ reset_control_deassert(qproc->pdc_reset); |
11061 |
+ regmap_update_bits(qproc->conn_map, qproc->conn_box, |
11062 |
+@@ -464,7 +456,7 @@ static int q6v5_reset_deassert(struct q6v5 *qproc) |
11063 |
+ ret = reset_control_reset(qproc->mss_restart); |
11064 |
+ writel(0, qproc->rmb_base + RMB_MBA_ALT_RESET); |
11065 |
+ reset_control_deassert(qproc->pdc_reset); |
11066 |
+- } else if (qproc->has_halt_nav) { |
11067 |
++ } else if (qproc->has_spare_reg) { |
11068 |
+ ret = reset_control_reset(qproc->mss_restart); |
11069 |
+ } else { |
11070 |
+ ret = reset_control_deassert(qproc->mss_restart); |
11071 |
+@@ -761,32 +753,6 @@ static void q6v5proc_halt_axi_port(struct q6v5 *qproc, |
11072 |
+ regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); |
11073 |
+ } |
11074 |
+ |
11075 |
+-static void q6v5proc_halt_nav_axi_port(struct q6v5 *qproc, |
11076 |
+- struct regmap *halt_map, |
11077 |
+- u32 offset) |
11078 |
+-{ |
11079 |
+- unsigned int val; |
11080 |
+- int ret; |
11081 |
+- |
11082 |
+- /* Check if we're already idle */ |
11083 |
+- ret = regmap_read(halt_map, offset, &val); |
11084 |
+- if (!ret && (val & NAV_AXI_IDLE_BIT)) |
11085 |
+- return; |
11086 |
+- |
11087 |
+- /* Assert halt request */ |
11088 |
+- regmap_update_bits(halt_map, offset, NAV_AXI_HALTREQ_BIT, |
11089 |
+- NAV_AXI_HALTREQ_BIT); |
11090 |
+- |
11091 |
+- /* Wait for halt ack*/ |
11092 |
+- regmap_read_poll_timeout(halt_map, offset, val, |
11093 |
+- (val & NAV_AXI_HALTACK_BIT), |
11094 |
+- 5, NAV_HALT_ACK_TIMEOUT_US); |
11095 |
+- |
11096 |
+- ret = regmap_read(halt_map, offset, &val); |
11097 |
+- if (ret || !(val & NAV_AXI_IDLE_BIT)) |
11098 |
+- dev_err(qproc->dev, "port failed halt\n"); |
11099 |
+-} |
11100 |
+- |
11101 |
+ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw) |
11102 |
+ { |
11103 |
+ unsigned long dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS; |
11104 |
+@@ -951,9 +917,6 @@ static int q6v5_mba_load(struct q6v5 *qproc) |
11105 |
+ halt_axi_ports: |
11106 |
+ q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6); |
11107 |
+ q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem); |
11108 |
+- if (qproc->has_halt_nav) |
11109 |
+- q6v5proc_halt_nav_axi_port(qproc, qproc->halt_nav_map, |
11110 |
+- qproc->halt_nav); |
11111 |
+ q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc); |
11112 |
+ |
11113 |
+ reclaim_mba: |
11114 |
+@@ -1001,9 +964,6 @@ static void q6v5_mba_reclaim(struct q6v5 *qproc) |
11115 |
+ |
11116 |
+ q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6); |
11117 |
+ q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem); |
11118 |
+- if (qproc->has_halt_nav) |
11119 |
+- q6v5proc_halt_nav_axi_port(qproc, qproc->halt_nav_map, |
11120 |
+- qproc->halt_nav); |
11121 |
+ q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc); |
11122 |
+ if (qproc->version == MSS_MSM8996) { |
11123 |
+ /* |
11124 |
+@@ -1156,7 +1116,13 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11125 |
+ goto release_firmware; |
11126 |
+ } |
11127 |
+ |
11128 |
+- ptr = qproc->mpss_region + offset; |
11129 |
++ ptr = ioremap_wc(qproc->mpss_phys + offset, phdr->p_memsz); |
11130 |
++ if (!ptr) { |
11131 |
++ dev_err(qproc->dev, |
11132 |
++ "unable to map memory region: %pa+%zx-%x\n", |
11133 |
++ &qproc->mpss_phys, offset, phdr->p_memsz); |
11134 |
++ goto release_firmware; |
11135 |
++ } |
11136 |
+ |
11137 |
+ if (phdr->p_filesz && phdr->p_offset < fw->size) { |
11138 |
+ /* Firmware is large enough to be non-split */ |
11139 |
+@@ -1165,6 +1131,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11140 |
+ "failed to load segment %d from truncated file %s\n", |
11141 |
+ i, fw_name); |
11142 |
+ ret = -EINVAL; |
11143 |
++ iounmap(ptr); |
11144 |
+ goto release_firmware; |
11145 |
+ } |
11146 |
+ |
11147 |
+@@ -1175,6 +1142,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11148 |
+ ret = request_firmware(&seg_fw, fw_name, qproc->dev); |
11149 |
+ if (ret) { |
11150 |
+ dev_err(qproc->dev, "failed to load %s\n", fw_name); |
11151 |
++ iounmap(ptr); |
11152 |
+ goto release_firmware; |
11153 |
+ } |
11154 |
+ |
11155 |
+@@ -1187,6 +1155,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11156 |
+ memset(ptr + phdr->p_filesz, 0, |
11157 |
+ phdr->p_memsz - phdr->p_filesz); |
11158 |
+ } |
11159 |
++ iounmap(ptr); |
11160 |
+ size += phdr->p_memsz; |
11161 |
+ |
11162 |
+ code_length = readl(qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); |
11163 |
+@@ -1236,7 +1205,8 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, |
11164 |
+ int ret = 0; |
11165 |
+ struct q6v5 *qproc = rproc->priv; |
11166 |
+ unsigned long mask = BIT((unsigned long)segment->priv); |
11167 |
+- void *ptr = rproc_da_to_va(rproc, segment->da, segment->size); |
11168 |
++ int offset = segment->da - qproc->mpss_reloc; |
11169 |
++ void *ptr = NULL; |
11170 |
+ |
11171 |
+ /* Unlock mba before copying segments */ |
11172 |
+ if (!qproc->dump_mba_loaded) { |
11173 |
+@@ -1250,10 +1220,15 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, |
11174 |
+ } |
11175 |
+ } |
11176 |
+ |
11177 |
+- if (!ptr || ret) |
11178 |
+- memset(dest, 0xff, segment->size); |
11179 |
+- else |
11180 |
++ if (!ret) |
11181 |
++ ptr = ioremap_wc(qproc->mpss_phys + offset, segment->size); |
11182 |
++ |
11183 |
++ if (ptr) { |
11184 |
+ memcpy(dest, ptr, segment->size); |
11185 |
++ iounmap(ptr); |
11186 |
++ } else { |
11187 |
++ memset(dest, 0xff, segment->size); |
11188 |
++ } |
11189 |
+ |
11190 |
+ qproc->dump_segment_mask |= mask; |
11191 |
+ |
11192 |
+@@ -1432,36 +1407,12 @@ static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev) |
11193 |
+ qproc->halt_modem = args.args[1]; |
11194 |
+ qproc->halt_nc = args.args[2]; |
11195 |
+ |
11196 |
+- if (qproc->has_halt_nav) { |
11197 |
+- struct platform_device *nav_pdev; |
11198 |
+- |
11199 |
++ if (qproc->has_spare_reg) { |
11200 |
+ ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node, |
11201 |
+- "qcom,halt-nav-regs", |
11202 |
++ "qcom,spare-regs", |
11203 |
+ 1, 0, &args); |
11204 |
+ if (ret < 0) { |
11205 |
+- dev_err(&pdev->dev, "failed to parse halt-nav-regs\n"); |
11206 |
+- return -EINVAL; |
11207 |
+- } |
11208 |
+- |
11209 |
+- nav_pdev = of_find_device_by_node(args.np); |
11210 |
+- of_node_put(args.np); |
11211 |
+- if (!nav_pdev) { |
11212 |
+- dev_err(&pdev->dev, "failed to get mss clock device\n"); |
11213 |
+- return -EPROBE_DEFER; |
11214 |
+- } |
11215 |
+- |
11216 |
+- qproc->halt_nav_map = dev_get_regmap(&nav_pdev->dev, NULL); |
11217 |
+- if (!qproc->halt_nav_map) { |
11218 |
+- dev_err(&pdev->dev, "failed to get map from device\n"); |
11219 |
+- return -EINVAL; |
11220 |
+- } |
11221 |
+- qproc->halt_nav = args.args[0]; |
11222 |
+- |
11223 |
+- ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node, |
11224 |
+- "qcom,halt-nav-regs", |
11225 |
+- 1, 1, &args); |
11226 |
+- if (ret < 0) { |
11227 |
+- dev_err(&pdev->dev, "failed to parse halt-nav-regs\n"); |
11228 |
++ dev_err(&pdev->dev, "failed to parse spare-regs\n"); |
11229 |
+ return -EINVAL; |
11230 |
+ } |
11231 |
+ |
11232 |
+@@ -1547,7 +1498,7 @@ static int q6v5_init_reset(struct q6v5 *qproc) |
11233 |
+ return PTR_ERR(qproc->mss_restart); |
11234 |
+ } |
11235 |
+ |
11236 |
+- if (qproc->has_alt_reset || qproc->has_halt_nav) { |
11237 |
++ if (qproc->has_alt_reset || qproc->has_spare_reg) { |
11238 |
+ qproc->pdc_reset = devm_reset_control_get_exclusive(qproc->dev, |
11239 |
+ "pdc_reset"); |
11240 |
+ if (IS_ERR(qproc->pdc_reset)) { |
11241 |
+@@ -1595,12 +1546,6 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) |
11242 |
+ |
11243 |
+ qproc->mpss_phys = qproc->mpss_reloc = r.start; |
11244 |
+ qproc->mpss_size = resource_size(&r); |
11245 |
+- qproc->mpss_region = devm_ioremap_wc(qproc->dev, qproc->mpss_phys, qproc->mpss_size); |
11246 |
+- if (!qproc->mpss_region) { |
11247 |
+- dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n", |
11248 |
+- &r.start, qproc->mpss_size); |
11249 |
+- return -EBUSY; |
11250 |
+- } |
11251 |
+ |
11252 |
+ return 0; |
11253 |
+ } |
11254 |
+@@ -1679,7 +1624,7 @@ static int q6v5_probe(struct platform_device *pdev) |
11255 |
+ |
11256 |
+ platform_set_drvdata(pdev, qproc); |
11257 |
+ |
11258 |
+- qproc->has_halt_nav = desc->has_halt_nav; |
11259 |
++ qproc->has_spare_reg = desc->has_spare_reg; |
11260 |
+ ret = q6v5_init_mem(qproc, pdev); |
11261 |
+ if (ret) |
11262 |
+ goto free_rproc; |
11263 |
+@@ -1828,8 +1773,6 @@ static const struct rproc_hexagon_res sc7180_mss = { |
11264 |
+ .active_clk_names = (char*[]){ |
11265 |
+ "mnoc_axi", |
11266 |
+ "nav", |
11267 |
+- "mss_nav", |
11268 |
+- "mss_crypto", |
11269 |
+ NULL |
11270 |
+ }, |
11271 |
+ .active_pd_names = (char*[]){ |
11272 |
+@@ -1844,7 +1787,7 @@ static const struct rproc_hexagon_res sc7180_mss = { |
11273 |
+ }, |
11274 |
+ .need_mem_protection = true, |
11275 |
+ .has_alt_reset = false, |
11276 |
+- .has_halt_nav = true, |
11277 |
++ .has_spare_reg = true, |
11278 |
+ .version = MSS_SC7180, |
11279 |
+ }; |
11280 |
+ |
11281 |
+@@ -1879,7 +1822,7 @@ static const struct rproc_hexagon_res sdm845_mss = { |
11282 |
+ }, |
11283 |
+ .need_mem_protection = true, |
11284 |
+ .has_alt_reset = true, |
11285 |
+- .has_halt_nav = false, |
11286 |
++ .has_spare_reg = false, |
11287 |
+ .version = MSS_SDM845, |
11288 |
+ }; |
11289 |
+ |
11290 |
+@@ -1906,7 +1849,7 @@ static const struct rproc_hexagon_res msm8998_mss = { |
11291 |
+ }, |
11292 |
+ .need_mem_protection = true, |
11293 |
+ .has_alt_reset = false, |
11294 |
+- .has_halt_nav = false, |
11295 |
++ .has_spare_reg = false, |
11296 |
+ .version = MSS_MSM8998, |
11297 |
+ }; |
11298 |
+ |
11299 |
+@@ -1936,7 +1879,7 @@ static const struct rproc_hexagon_res msm8996_mss = { |
11300 |
+ }, |
11301 |
+ .need_mem_protection = true, |
11302 |
+ .has_alt_reset = false, |
11303 |
+- .has_halt_nav = false, |
11304 |
++ .has_spare_reg = false, |
11305 |
+ .version = MSS_MSM8996, |
11306 |
+ }; |
11307 |
+ |
11308 |
+@@ -1969,7 +1912,7 @@ static const struct rproc_hexagon_res msm8916_mss = { |
11309 |
+ }, |
11310 |
+ .need_mem_protection = false, |
11311 |
+ .has_alt_reset = false, |
11312 |
+- .has_halt_nav = false, |
11313 |
++ .has_spare_reg = false, |
11314 |
+ .version = MSS_MSM8916, |
11315 |
+ }; |
11316 |
+ |
11317 |
+@@ -2010,7 +1953,7 @@ static const struct rproc_hexagon_res msm8974_mss = { |
11318 |
+ }, |
11319 |
+ .need_mem_protection = false, |
11320 |
+ .has_alt_reset = false, |
11321 |
+- .has_halt_nav = false, |
11322 |
++ .has_spare_reg = false, |
11323 |
+ .version = MSS_MSM8974, |
11324 |
+ }; |
11325 |
+ |
11326 |
+diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c |
11327 |
+index be15aace9b3c..8f79cfd2e467 100644 |
11328 |
+--- a/drivers/remoteproc/remoteproc_core.c |
11329 |
++++ b/drivers/remoteproc/remoteproc_core.c |
11330 |
+@@ -2053,6 +2053,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, |
11331 |
+ rproc->dev.type = &rproc_type; |
11332 |
+ rproc->dev.class = &rproc_class; |
11333 |
+ rproc->dev.driver_data = rproc; |
11334 |
++ idr_init(&rproc->notifyids); |
11335 |
+ |
11336 |
+ /* Assign a unique device index and name */ |
11337 |
+ rproc->index = ida_simple_get(&rproc_dev_index, 0, 0, GFP_KERNEL); |
11338 |
+@@ -2078,8 +2079,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, |
11339 |
+ |
11340 |
+ mutex_init(&rproc->lock); |
11341 |
+ |
11342 |
+- idr_init(&rproc->notifyids); |
11343 |
+- |
11344 |
+ INIT_LIST_HEAD(&rproc->carveouts); |
11345 |
+ INIT_LIST_HEAD(&rproc->mappings); |
11346 |
+ INIT_LIST_HEAD(&rproc->traces); |
11347 |
+diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c |
11348 |
+index afce2c0b4bd6..d6802e6191cb 100644 |
11349 |
+--- a/drivers/rtc/rtc-mc13xxx.c |
11350 |
++++ b/drivers/rtc/rtc-mc13xxx.c |
11351 |
+@@ -308,8 +308,10 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) |
11352 |
+ mc13xxx_unlock(mc13xxx); |
11353 |
+ |
11354 |
+ ret = rtc_register_device(priv->rtc); |
11355 |
+- if (ret) |
11356 |
++ if (ret) { |
11357 |
++ mc13xxx_lock(mc13xxx); |
11358 |
+ goto err_irq_request; |
11359 |
++ } |
11360 |
+ |
11361 |
+ return 0; |
11362 |
+ |
11363 |
+diff --git a/drivers/rtc/rtc-rc5t619.c b/drivers/rtc/rtc-rc5t619.c |
11364 |
+index 24e386ecbc7e..dd1a20977478 100644 |
11365 |
+--- a/drivers/rtc/rtc-rc5t619.c |
11366 |
++++ b/drivers/rtc/rtc-rc5t619.c |
11367 |
+@@ -356,10 +356,8 @@ static int rc5t619_rtc_probe(struct platform_device *pdev) |
11368 |
+ int err; |
11369 |
+ |
11370 |
+ rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); |
11371 |
+- if (IS_ERR(rtc)) { |
11372 |
+- err = PTR_ERR(rtc); |
11373 |
++ if (!rtc) |
11374 |
+ return -ENOMEM; |
11375 |
+- } |
11376 |
+ |
11377 |
+ rtc->rn5t618 = rn5t618; |
11378 |
+ |
11379 |
+diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c |
11380 |
+index a0ddc86c975a..ec84db0b3d7a 100644 |
11381 |
+--- a/drivers/rtc/rtc-rv3028.c |
11382 |
++++ b/drivers/rtc/rtc-rv3028.c |
11383 |
+@@ -755,6 +755,8 @@ static int rv3028_probe(struct i2c_client *client) |
11384 |
+ return -ENOMEM; |
11385 |
+ |
11386 |
+ rv3028->regmap = devm_regmap_init_i2c(client, ®map_config); |
11387 |
++ if (IS_ERR(rv3028->regmap)) |
11388 |
++ return PTR_ERR(rv3028->regmap); |
11389 |
+ |
11390 |
+ i2c_set_clientdata(client, rv3028); |
11391 |
+ |
11392 |
+diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h |
11393 |
+index b8453b594679..a2afd7bc100b 100644 |
11394 |
+--- a/drivers/s390/cio/qdio.h |
11395 |
++++ b/drivers/s390/cio/qdio.h |
11396 |
+@@ -364,7 +364,6 @@ static inline int multicast_outbound(struct qdio_q *q) |
11397 |
+ extern u64 last_ai_time; |
11398 |
+ |
11399 |
+ /* prototypes for thin interrupt */ |
11400 |
+-void qdio_setup_thinint(struct qdio_irq *irq_ptr); |
11401 |
+ int qdio_establish_thinint(struct qdio_irq *irq_ptr); |
11402 |
+ void qdio_shutdown_thinint(struct qdio_irq *irq_ptr); |
11403 |
+ void tiqdio_add_device(struct qdio_irq *irq_ptr); |
11404 |
+@@ -389,6 +388,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr, |
11405 |
+ struct subchannel_id *schid, |
11406 |
+ struct qdio_ssqd_desc *data); |
11407 |
+ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data); |
11408 |
++void qdio_shutdown_irq(struct qdio_irq *irq); |
11409 |
+ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr); |
11410 |
+ void qdio_release_memory(struct qdio_irq *irq_ptr); |
11411 |
+ int qdio_setup_init(void); |
11412 |
+diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c |
11413 |
+index bcc3ab14e72d..80cc811bd2e0 100644 |
11414 |
+--- a/drivers/s390/cio/qdio_main.c |
11415 |
++++ b/drivers/s390/cio/qdio_main.c |
11416 |
+@@ -1154,35 +1154,27 @@ int qdio_shutdown(struct ccw_device *cdev, int how) |
11417 |
+ |
11418 |
+ /* cleanup subchannel */ |
11419 |
+ spin_lock_irq(get_ccwdev_lock(cdev)); |
11420 |
+- |
11421 |
++ qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP); |
11422 |
+ if (how & QDIO_FLAG_CLEANUP_USING_CLEAR) |
11423 |
+ rc = ccw_device_clear(cdev, QDIO_DOING_CLEANUP); |
11424 |
+ else |
11425 |
+ /* default behaviour is halt */ |
11426 |
+ rc = ccw_device_halt(cdev, QDIO_DOING_CLEANUP); |
11427 |
++ spin_unlock_irq(get_ccwdev_lock(cdev)); |
11428 |
+ if (rc) { |
11429 |
+ DBF_ERROR("%4x SHUTD ERR", irq_ptr->schid.sch_no); |
11430 |
+ DBF_ERROR("rc:%4d", rc); |
11431 |
+ goto no_cleanup; |
11432 |
+ } |
11433 |
+ |
11434 |
+- qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP); |
11435 |
+- spin_unlock_irq(get_ccwdev_lock(cdev)); |
11436 |
+ wait_event_interruptible_timeout(cdev->private->wait_q, |
11437 |
+ irq_ptr->state == QDIO_IRQ_STATE_INACTIVE || |
11438 |
+ irq_ptr->state == QDIO_IRQ_STATE_ERR, |
11439 |
+ 10 * HZ); |
11440 |
+- spin_lock_irq(get_ccwdev_lock(cdev)); |
11441 |
+ |
11442 |
+ no_cleanup: |
11443 |
+ qdio_shutdown_thinint(irq_ptr); |
11444 |
+- |
11445 |
+- /* restore interrupt handler */ |
11446 |
+- if ((void *)cdev->handler == (void *)qdio_int_handler) { |
11447 |
+- cdev->handler = irq_ptr->orig_handler; |
11448 |
+- cdev->private->intparm = 0; |
11449 |
+- } |
11450 |
+- spin_unlock_irq(get_ccwdev_lock(cdev)); |
11451 |
++ qdio_shutdown_irq(irq_ptr); |
11452 |
+ |
11453 |
+ qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); |
11454 |
+ mutex_unlock(&irq_ptr->setup_mutex); |
11455 |
+@@ -1352,8 +1344,8 @@ int qdio_establish(struct ccw_device *cdev, |
11456 |
+ |
11457 |
+ rc = qdio_establish_thinint(irq_ptr); |
11458 |
+ if (rc) { |
11459 |
++ qdio_shutdown_irq(irq_ptr); |
11460 |
+ mutex_unlock(&irq_ptr->setup_mutex); |
11461 |
+- qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR); |
11462 |
+ return rc; |
11463 |
+ } |
11464 |
+ |
11465 |
+@@ -1371,8 +1363,9 @@ int qdio_establish(struct ccw_device *cdev, |
11466 |
+ if (rc) { |
11467 |
+ DBF_ERROR("%4x est IO ERR", irq_ptr->schid.sch_no); |
11468 |
+ DBF_ERROR("rc:%4x", rc); |
11469 |
++ qdio_shutdown_thinint(irq_ptr); |
11470 |
++ qdio_shutdown_irq(irq_ptr); |
11471 |
+ mutex_unlock(&irq_ptr->setup_mutex); |
11472 |
+- qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR); |
11473 |
+ return rc; |
11474 |
+ } |
11475 |
+ |
11476 |
+diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c |
11477 |
+index 3083edd61f0c..8edfa0982221 100644 |
11478 |
+--- a/drivers/s390/cio/qdio_setup.c |
11479 |
++++ b/drivers/s390/cio/qdio_setup.c |
11480 |
+@@ -480,7 +480,6 @@ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data) |
11481 |
+ } |
11482 |
+ |
11483 |
+ setup_qib(irq_ptr, init_data); |
11484 |
+- qdio_setup_thinint(irq_ptr); |
11485 |
+ set_impl_params(irq_ptr, init_data->qib_param_field_format, |
11486 |
+ init_data->qib_param_field, |
11487 |
+ init_data->input_slib_elements, |
11488 |
+@@ -491,6 +490,12 @@ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data) |
11489 |
+ |
11490 |
+ /* qdr, qib, sls, slsbs, slibs, sbales are filled now */ |
11491 |
+ |
11492 |
++ /* set our IRQ handler */ |
11493 |
++ spin_lock_irq(get_ccwdev_lock(cdev)); |
11494 |
++ irq_ptr->orig_handler = cdev->handler; |
11495 |
++ cdev->handler = qdio_int_handler; |
11496 |
++ spin_unlock_irq(get_ccwdev_lock(cdev)); |
11497 |
++ |
11498 |
+ /* get qdio commands */ |
11499 |
+ ciw = ccw_device_get_ciw(cdev, CIW_TYPE_EQUEUE); |
11500 |
+ if (!ciw) { |
11501 |
+@@ -506,12 +511,18 @@ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data) |
11502 |
+ } |
11503 |
+ irq_ptr->aqueue = *ciw; |
11504 |
+ |
11505 |
+- /* set new interrupt handler */ |
11506 |
++ return 0; |
11507 |
++} |
11508 |
++ |
11509 |
++void qdio_shutdown_irq(struct qdio_irq *irq) |
11510 |
++{ |
11511 |
++ struct ccw_device *cdev = irq->cdev; |
11512 |
++ |
11513 |
++ /* restore IRQ handler */ |
11514 |
+ spin_lock_irq(get_ccwdev_lock(cdev)); |
11515 |
+- irq_ptr->orig_handler = cdev->handler; |
11516 |
+- cdev->handler = qdio_int_handler; |
11517 |
++ cdev->handler = irq->orig_handler; |
11518 |
++ cdev->private->intparm = 0; |
11519 |
+ spin_unlock_irq(get_ccwdev_lock(cdev)); |
11520 |
+- return 0; |
11521 |
+ } |
11522 |
+ |
11523 |
+ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr) |
11524 |
+diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c |
11525 |
+index ae50373617cd..0faa0ad21732 100644 |
11526 |
+--- a/drivers/s390/cio/qdio_thinint.c |
11527 |
++++ b/drivers/s390/cio/qdio_thinint.c |
11528 |
+@@ -227,17 +227,19 @@ int __init tiqdio_register_thinints(void) |
11529 |
+ |
11530 |
+ int qdio_establish_thinint(struct qdio_irq *irq_ptr) |
11531 |
+ { |
11532 |
++ int rc; |
11533 |
++ |
11534 |
+ if (!is_thinint_irq(irq_ptr)) |
11535 |
+ return 0; |
11536 |
+- return set_subchannel_ind(irq_ptr, 0); |
11537 |
+-} |
11538 |
+ |
11539 |
+-void qdio_setup_thinint(struct qdio_irq *irq_ptr) |
11540 |
+-{ |
11541 |
+- if (!is_thinint_irq(irq_ptr)) |
11542 |
+- return; |
11543 |
+ irq_ptr->dsci = get_indicator(); |
11544 |
+ DBF_HEX(&irq_ptr->dsci, sizeof(void *)); |
11545 |
++ |
11546 |
++ rc = set_subchannel_ind(irq_ptr, 0); |
11547 |
++ if (rc) |
11548 |
++ put_indicator(irq_ptr->dsci); |
11549 |
++ |
11550 |
++ return rc; |
11551 |
+ } |
11552 |
+ |
11553 |
+ void qdio_shutdown_thinint(struct qdio_irq *irq_ptr) |
11554 |
+diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c |
11555 |
+index ddb52e7ba622..9a912fd0f70b 100644 |
11556 |
+--- a/drivers/scsi/arm/acornscsi.c |
11557 |
++++ b/drivers/scsi/arm/acornscsi.c |
11558 |
+@@ -2911,8 +2911,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) |
11559 |
+ |
11560 |
+ ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
11561 |
+ ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
11562 |
+- if (!ashost->base || !ashost->fast) |
11563 |
++ if (!ashost->base || !ashost->fast) { |
11564 |
++ ret = -ENOMEM; |
11565 |
+ goto out_put; |
11566 |
++ } |
11567 |
+ |
11568 |
+ host->irq = ec->irq; |
11569 |
+ ashost->host = host; |
11570 |
+diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
11571 |
+index 524cdbcd29aa..ec7d01f6e2d5 100644 |
11572 |
+--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
11573 |
++++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
11574 |
+@@ -959,6 +959,7 @@ static int init_act_open(struct cxgbi_sock *csk) |
11575 |
+ struct net_device *ndev = cdev->ports[csk->port_id]; |
11576 |
+ struct cxgbi_hba *chba = cdev->hbas[csk->port_id]; |
11577 |
+ struct sk_buff *skb = NULL; |
11578 |
++ int ret; |
11579 |
+ |
11580 |
+ log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
11581 |
+ "csk 0x%p,%u,0x%lx.\n", csk, csk->state, csk->flags); |
11582 |
+@@ -979,16 +980,16 @@ static int init_act_open(struct cxgbi_sock *csk) |
11583 |
+ csk->atid = cxgb3_alloc_atid(t3dev, &t3_client, csk); |
11584 |
+ if (csk->atid < 0) { |
11585 |
+ pr_err("NO atid available.\n"); |
11586 |
+- return -EINVAL; |
11587 |
++ ret = -EINVAL; |
11588 |
++ goto put_sock; |
11589 |
+ } |
11590 |
+ cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); |
11591 |
+ cxgbi_sock_get(csk); |
11592 |
+ |
11593 |
+ skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL); |
11594 |
+ if (!skb) { |
11595 |
+- cxgb3_free_atid(t3dev, csk->atid); |
11596 |
+- cxgbi_sock_put(csk); |
11597 |
+- return -ENOMEM; |
11598 |
++ ret = -ENOMEM; |
11599 |
++ goto free_atid; |
11600 |
+ } |
11601 |
+ skb->sk = (struct sock *)csk; |
11602 |
+ set_arp_failure_handler(skb, act_open_arp_failure); |
11603 |
+@@ -1010,6 +1011,15 @@ static int init_act_open(struct cxgbi_sock *csk) |
11604 |
+ cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); |
11605 |
+ send_act_open_req(csk, skb, csk->l2t); |
11606 |
+ return 0; |
11607 |
++ |
11608 |
++free_atid: |
11609 |
++ cxgb3_free_atid(t3dev, csk->atid); |
11610 |
++put_sock: |
11611 |
++ cxgbi_sock_put(csk); |
11612 |
++ l2t_release(t3dev, csk->l2t); |
11613 |
++ csk->l2t = NULL; |
11614 |
++ |
11615 |
++ return ret; |
11616 |
+ } |
11617 |
+ |
11618 |
+ cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS] = { |
11619 |
+diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c |
11620 |
+index 9a6deb21fe4d..11caa4b0d797 100644 |
11621 |
+--- a/drivers/scsi/hisi_sas/hisi_sas_main.c |
11622 |
++++ b/drivers/scsi/hisi_sas/hisi_sas_main.c |
11623 |
+@@ -898,8 +898,11 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no) |
11624 |
+ struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; |
11625 |
+ struct device *dev = hisi_hba->dev; |
11626 |
+ |
11627 |
++ dev_dbg(dev, "phy%d OOB ready\n", phy_no); |
11628 |
++ if (phy->phy_attached) |
11629 |
++ return; |
11630 |
++ |
11631 |
+ if (!timer_pending(&phy->timer)) { |
11632 |
+- dev_dbg(dev, "phy%d OOB ready\n", phy_no); |
11633 |
+ phy->timer.expires = jiffies + HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; |
11634 |
+ add_timer(&phy->timer); |
11635 |
+ } |
11636 |
+diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c |
11637 |
+index 59f0f1030c54..c5711c659b51 100644 |
11638 |
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.c |
11639 |
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c |
11640 |
+@@ -415,6 +415,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, |
11641 |
+ int rc = 0; |
11642 |
+ struct vio_dev *vdev = to_vio_dev(hostdata->dev); |
11643 |
+ |
11644 |
++ set_adapter_info(hostdata); |
11645 |
++ |
11646 |
+ /* Re-enable the CRQ */ |
11647 |
+ do { |
11648 |
+ if (rc) |
11649 |
+diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c |
11650 |
+index e4857b728033..a64abe38db2d 100644 |
11651 |
+--- a/drivers/scsi/iscsi_boot_sysfs.c |
11652 |
++++ b/drivers/scsi/iscsi_boot_sysfs.c |
11653 |
+@@ -352,7 +352,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset, |
11654 |
+ boot_kobj->kobj.kset = boot_kset->kset; |
11655 |
+ if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype, |
11656 |
+ NULL, name, index)) { |
11657 |
+- kfree(boot_kobj); |
11658 |
++ kobject_put(&boot_kobj->kobj); |
11659 |
+ return NULL; |
11660 |
+ } |
11661 |
+ boot_kobj->data = data; |
11662 |
+diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
11663 |
+index 80d1e661b0d4..35fbcb4d52eb 100644 |
11664 |
+--- a/drivers/scsi/lpfc/lpfc_els.c |
11665 |
++++ b/drivers/scsi/lpfc/lpfc_els.c |
11666 |
+@@ -8514,6 +8514,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
11667 |
+ spin_lock_irq(shost->host_lock); |
11668 |
+ if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) { |
11669 |
+ spin_unlock_irq(shost->host_lock); |
11670 |
++ if (newnode) |
11671 |
++ lpfc_nlp_put(ndlp); |
11672 |
+ goto dropit; |
11673 |
+ } |
11674 |
+ spin_unlock_irq(shost->host_lock); |
11675 |
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
11676 |
+index 663782bb790d..39d233262039 100644 |
11677 |
+--- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
11678 |
++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
11679 |
+@@ -4915,7 +4915,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) |
11680 |
+ } |
11681 |
+ |
11682 |
+ kfree(ioc->hpr_lookup); |
11683 |
++ ioc->hpr_lookup = NULL; |
11684 |
+ kfree(ioc->internal_lookup); |
11685 |
++ ioc->internal_lookup = NULL; |
11686 |
+ if (ioc->chain_lookup) { |
11687 |
+ for (i = 0; i < ioc->scsiio_depth; i++) { |
11688 |
+ for (j = ioc->chains_per_prp_buffer; |
11689 |
+diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h |
11690 |
+index f3f399fe10c8..0da4e16fb23a 100644 |
11691 |
+--- a/drivers/scsi/qedf/qedf.h |
11692 |
++++ b/drivers/scsi/qedf/qedf.h |
11693 |
+@@ -355,6 +355,7 @@ struct qedf_ctx { |
11694 |
+ #define QEDF_GRCDUMP_CAPTURE 4 |
11695 |
+ #define QEDF_IN_RECOVERY 5 |
11696 |
+ #define QEDF_DBG_STOP_IO 6 |
11697 |
++#define QEDF_PROBING 8 |
11698 |
+ unsigned long flags; /* Miscellaneous state flags */ |
11699 |
+ int fipvlan_retries; |
11700 |
+ u8 num_queues; |
11701 |
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c |
11702 |
+index 5b19f5175c5c..3a7d03472922 100644 |
11703 |
+--- a/drivers/scsi/qedf/qedf_main.c |
11704 |
++++ b/drivers/scsi/qedf/qedf_main.c |
11705 |
+@@ -3153,7 +3153,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11706 |
+ { |
11707 |
+ int rc = -EINVAL; |
11708 |
+ struct fc_lport *lport; |
11709 |
+- struct qedf_ctx *qedf; |
11710 |
++ struct qedf_ctx *qedf = NULL; |
11711 |
+ struct Scsi_Host *host; |
11712 |
+ bool is_vf = false; |
11713 |
+ struct qed_ll2_params params; |
11714 |
+@@ -3183,6 +3183,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11715 |
+ |
11716 |
+ /* Initialize qedf_ctx */ |
11717 |
+ qedf = lport_priv(lport); |
11718 |
++ set_bit(QEDF_PROBING, &qedf->flags); |
11719 |
+ qedf->lport = lport; |
11720 |
+ qedf->ctlr.lp = lport; |
11721 |
+ qedf->pdev = pdev; |
11722 |
+@@ -3206,9 +3207,12 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11723 |
+ } else { |
11724 |
+ /* Init pointers during recovery */ |
11725 |
+ qedf = pci_get_drvdata(pdev); |
11726 |
++ set_bit(QEDF_PROBING, &qedf->flags); |
11727 |
+ lport = qedf->lport; |
11728 |
+ } |
11729 |
+ |
11730 |
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe started.\n"); |
11731 |
++ |
11732 |
+ host = lport->host; |
11733 |
+ |
11734 |
+ /* Allocate mempool for qedf_io_work structs */ |
11735 |
+@@ -3513,6 +3517,10 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11736 |
+ else |
11737 |
+ fc_fabric_login(lport); |
11738 |
+ |
11739 |
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); |
11740 |
++ |
11741 |
++ clear_bit(QEDF_PROBING, &qedf->flags); |
11742 |
++ |
11743 |
+ /* All good */ |
11744 |
+ return 0; |
11745 |
+ |
11746 |
+@@ -3538,6 +3546,11 @@ err2: |
11747 |
+ err1: |
11748 |
+ scsi_host_put(lport->host); |
11749 |
+ err0: |
11750 |
++ if (qedf) { |
11751 |
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); |
11752 |
++ |
11753 |
++ clear_bit(QEDF_PROBING, &qedf->flags); |
11754 |
++ } |
11755 |
+ return rc; |
11756 |
+ } |
11757 |
+ |
11758 |
+@@ -3687,11 +3700,25 @@ void qedf_get_protocol_tlv_data(void *dev, void *data) |
11759 |
+ { |
11760 |
+ struct qedf_ctx *qedf = dev; |
11761 |
+ struct qed_mfw_tlv_fcoe *fcoe = data; |
11762 |
+- struct fc_lport *lport = qedf->lport; |
11763 |
+- struct Scsi_Host *host = lport->host; |
11764 |
+- struct fc_host_attrs *fc_host = shost_to_fc_host(host); |
11765 |
++ struct fc_lport *lport; |
11766 |
++ struct Scsi_Host *host; |
11767 |
++ struct fc_host_attrs *fc_host; |
11768 |
+ struct fc_host_statistics *hst; |
11769 |
+ |
11770 |
++ if (!qedf) { |
11771 |
++ QEDF_ERR(NULL, "qedf is null.\n"); |
11772 |
++ return; |
11773 |
++ } |
11774 |
++ |
11775 |
++ if (test_bit(QEDF_PROBING, &qedf->flags)) { |
11776 |
++ QEDF_ERR(&qedf->dbg_ctx, "Function is still probing.\n"); |
11777 |
++ return; |
11778 |
++ } |
11779 |
++ |
11780 |
++ lport = qedf->lport; |
11781 |
++ host = lport->host; |
11782 |
++ fc_host = shost_to_fc_host(host); |
11783 |
++ |
11784 |
+ /* Force a refresh of the fc_host stats including offload stats */ |
11785 |
+ hst = qedf_fc_get_host_stats(host); |
11786 |
+ |
11787 |
+diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c |
11788 |
+index 1f4a5fb00a05..366c65b295a5 100644 |
11789 |
+--- a/drivers/scsi/qedi/qedi_iscsi.c |
11790 |
++++ b/drivers/scsi/qedi/qedi_iscsi.c |
11791 |
+@@ -1001,7 +1001,8 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) |
11792 |
+ if (qedi_ep->state == EP_STATE_OFLDCONN_START) |
11793 |
+ goto ep_exit_recover; |
11794 |
+ |
11795 |
+- flush_work(&qedi_ep->offload_work); |
11796 |
++ if (qedi_ep->state != EP_STATE_OFLDCONN_NONE) |
11797 |
++ flush_work(&qedi_ep->offload_work); |
11798 |
+ |
11799 |
+ if (qedi_ep->conn) { |
11800 |
+ qedi_conn = qedi_ep->conn; |
11801 |
+@@ -1218,6 +1219,10 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data) |
11802 |
+ } |
11803 |
+ |
11804 |
+ iscsi_cid = (u32)path_data->handle; |
11805 |
++ if (iscsi_cid >= qedi->max_active_conns) { |
11806 |
++ ret = -EINVAL; |
11807 |
++ goto set_path_exit; |
11808 |
++ } |
11809 |
+ qedi_ep = qedi->ep_tbl[iscsi_cid]; |
11810 |
+ QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, |
11811 |
+ "iscsi_cid=0x%x, qedi_ep=%p\n", iscsi_cid, qedi_ep); |
11812 |
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
11813 |
+index 1d9a4866f9a7..9179bb4caed8 100644 |
11814 |
+--- a/drivers/scsi/qla2xxx/qla_os.c |
11815 |
++++ b/drivers/scsi/qla2xxx/qla_os.c |
11816 |
+@@ -6871,6 +6871,7 @@ qla2x00_do_dpc(void *data) |
11817 |
+ |
11818 |
+ if (do_reset && !(test_and_set_bit(ABORT_ISP_ACTIVE, |
11819 |
+ &base_vha->dpc_flags))) { |
11820 |
++ base_vha->flags.online = 1; |
11821 |
+ ql_dbg(ql_dbg_dpc, base_vha, 0x4007, |
11822 |
+ "ISP abort scheduled.\n"); |
11823 |
+ if (ha->isp_ops->abort_isp(base_vha)) { |
11824 |
+diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
11825 |
+index 1f0a185b2a95..bf00ae16b487 100644 |
11826 |
+--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
11827 |
++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
11828 |
+@@ -949,6 +949,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, |
11829 |
+ |
11830 |
+ atomic_set(&tpg->lport_tpg_enabled, 0); |
11831 |
+ qlt_stop_phase1(vha->vha_tgt.qla_tgt); |
11832 |
++ qlt_stop_phase2(vha->vha_tgt.qla_tgt); |
11833 |
+ } |
11834 |
+ |
11835 |
+ return count; |
11836 |
+@@ -1111,6 +1112,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, |
11837 |
+ |
11838 |
+ atomic_set(&tpg->lport_tpg_enabled, 0); |
11839 |
+ qlt_stop_phase1(vha->vha_tgt.qla_tgt); |
11840 |
++ qlt_stop_phase2(vha->vha_tgt.qla_tgt); |
11841 |
+ } |
11842 |
+ |
11843 |
+ return count; |
11844 |
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c |
11845 |
+index 978be1602f71..927b1e641842 100644 |
11846 |
+--- a/drivers/scsi/scsi_error.c |
11847 |
++++ b/drivers/scsi/scsi_error.c |
11848 |
+@@ -1412,6 +1412,7 @@ static int scsi_eh_stu(struct Scsi_Host *shost, |
11849 |
+ sdev_printk(KERN_INFO, sdev, |
11850 |
+ "%s: skip START_UNIT, past eh deadline\n", |
11851 |
+ current->comm)); |
11852 |
++ scsi_device_put(sdev); |
11853 |
+ break; |
11854 |
+ } |
11855 |
+ stu_scmd = NULL; |
11856 |
+@@ -1478,6 +1479,7 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, |
11857 |
+ sdev_printk(KERN_INFO, sdev, |
11858 |
+ "%s: skip BDR, past eh deadline\n", |
11859 |
+ current->comm)); |
11860 |
++ scsi_device_put(sdev); |
11861 |
+ break; |
11862 |
+ } |
11863 |
+ bdr_scmd = NULL; |
11864 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
11865 |
+index 06c260f6cdae..b8b4366f1200 100644 |
11866 |
+--- a/drivers/scsi/scsi_lib.c |
11867 |
++++ b/drivers/scsi/scsi_lib.c |
11868 |
+@@ -548,7 +548,7 @@ static void scsi_uninit_cmd(struct scsi_cmnd *cmd) |
11869 |
+ } |
11870 |
+ } |
11871 |
+ |
11872 |
+-static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) |
11873 |
++static void scsi_free_sgtables(struct scsi_cmnd *cmd) |
11874 |
+ { |
11875 |
+ if (cmd->sdb.table.nents) |
11876 |
+ sg_free_table_chained(&cmd->sdb.table, |
11877 |
+@@ -560,7 +560,7 @@ static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) |
11878 |
+ |
11879 |
+ static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) |
11880 |
+ { |
11881 |
+- scsi_mq_free_sgtables(cmd); |
11882 |
++ scsi_free_sgtables(cmd); |
11883 |
+ scsi_uninit_cmd(cmd); |
11884 |
+ } |
11885 |
+ |
11886 |
+@@ -1059,7 +1059,7 @@ blk_status_t scsi_init_io(struct scsi_cmnd *cmd) |
11887 |
+ |
11888 |
+ return BLK_STS_OK; |
11889 |
+ out_free_sgtables: |
11890 |
+- scsi_mq_free_sgtables(cmd); |
11891 |
++ scsi_free_sgtables(cmd); |
11892 |
+ return ret; |
11893 |
+ } |
11894 |
+ EXPORT_SYMBOL(scsi_init_io); |
11895 |
+@@ -1190,6 +1190,7 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev, |
11896 |
+ struct request *req) |
11897 |
+ { |
11898 |
+ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); |
11899 |
++ blk_status_t ret; |
11900 |
+ |
11901 |
+ if (!blk_rq_bytes(req)) |
11902 |
+ cmd->sc_data_direction = DMA_NONE; |
11903 |
+@@ -1199,9 +1200,14 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev, |
11904 |
+ cmd->sc_data_direction = DMA_FROM_DEVICE; |
11905 |
+ |
11906 |
+ if (blk_rq_is_scsi(req)) |
11907 |
+- return scsi_setup_scsi_cmnd(sdev, req); |
11908 |
++ ret = scsi_setup_scsi_cmnd(sdev, req); |
11909 |
+ else |
11910 |
+- return scsi_setup_fs_cmnd(sdev, req); |
11911 |
++ ret = scsi_setup_fs_cmnd(sdev, req); |
11912 |
++ |
11913 |
++ if (ret != BLK_STS_OK) |
11914 |
++ scsi_free_sgtables(cmd); |
11915 |
++ |
11916 |
++ return ret; |
11917 |
+ } |
11918 |
+ |
11919 |
+ static blk_status_t |
11920 |
+@@ -2859,8 +2865,10 @@ scsi_host_unblock(struct Scsi_Host *shost, int new_state) |
11921 |
+ |
11922 |
+ shost_for_each_device(sdev, shost) { |
11923 |
+ ret = scsi_internal_device_unblock(sdev, new_state); |
11924 |
+- if (ret) |
11925 |
++ if (ret) { |
11926 |
++ scsi_device_put(sdev); |
11927 |
+ break; |
11928 |
++ } |
11929 |
+ } |
11930 |
+ return ret; |
11931 |
+ } |
11932 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
11933 |
+index b2a803c51288..ea6d498fa923 100644 |
11934 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
11935 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
11936 |
+@@ -1616,6 +1616,12 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class, |
11937 |
+ static struct sock *nls; |
11938 |
+ static DEFINE_MUTEX(rx_queue_mutex); |
11939 |
+ |
11940 |
++/* |
11941 |
++ * conn_mutex protects the {start,bind,stop,destroy}_conn from racing |
11942 |
++ * against the kernel stop_connection recovery mechanism |
11943 |
++ */ |
11944 |
++static DEFINE_MUTEX(conn_mutex); |
11945 |
++ |
11946 |
+ static LIST_HEAD(sesslist); |
11947 |
+ static LIST_HEAD(sessdestroylist); |
11948 |
+ static DEFINE_SPINLOCK(sesslock); |
11949 |
+@@ -2445,6 +2451,32 @@ int iscsi_offload_mesg(struct Scsi_Host *shost, |
11950 |
+ } |
11951 |
+ EXPORT_SYMBOL_GPL(iscsi_offload_mesg); |
11952 |
+ |
11953 |
++/* |
11954 |
++ * This can be called without the rx_queue_mutex, if invoked by the kernel |
11955 |
++ * stop work. But, in that case, it is guaranteed not to race with |
11956 |
++ * iscsi_destroy by conn_mutex. |
11957 |
++ */ |
11958 |
++static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) |
11959 |
++{ |
11960 |
++ /* |
11961 |
++ * It is important that this path doesn't rely on |
11962 |
++ * rx_queue_mutex, otherwise, a thread doing allocation on a |
11963 |
++ * start_session/start_connection could sleep waiting on a |
11964 |
++ * writeback to a failed iscsi device, that cannot be recovered |
11965 |
++ * because the lock is held. If we don't hold it here, the |
11966 |
++ * kernel stop_conn_work_fn has a chance to stop the broken |
11967 |
++ * session and resolve the allocation. |
11968 |
++ * |
11969 |
++ * Still, the user invoked .stop_conn() needs to be serialized |
11970 |
++ * with stop_conn_work_fn by a private mutex. Not pretty, but |
11971 |
++ * it works. |
11972 |
++ */ |
11973 |
++ mutex_lock(&conn_mutex); |
11974 |
++ conn->transport->stop_conn(conn, flag); |
11975 |
++ mutex_unlock(&conn_mutex); |
11976 |
++ |
11977 |
++} |
11978 |
++ |
11979 |
+ static void stop_conn_work_fn(struct work_struct *work) |
11980 |
+ { |
11981 |
+ struct iscsi_cls_conn *conn, *tmp; |
11982 |
+@@ -2463,30 +2495,17 @@ static void stop_conn_work_fn(struct work_struct *work) |
11983 |
+ uint32_t sid = iscsi_conn_get_sid(conn); |
11984 |
+ struct iscsi_cls_session *session; |
11985 |
+ |
11986 |
+- mutex_lock(&rx_queue_mutex); |
11987 |
+- |
11988 |
+ session = iscsi_session_lookup(sid); |
11989 |
+ if (session) { |
11990 |
+ if (system_state != SYSTEM_RUNNING) { |
11991 |
+ session->recovery_tmo = 0; |
11992 |
+- conn->transport->stop_conn(conn, |
11993 |
+- STOP_CONN_TERM); |
11994 |
++ iscsi_if_stop_conn(conn, STOP_CONN_TERM); |
11995 |
+ } else { |
11996 |
+- conn->transport->stop_conn(conn, |
11997 |
+- STOP_CONN_RECOVER); |
11998 |
++ iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); |
11999 |
+ } |
12000 |
+ } |
12001 |
+ |
12002 |
+ list_del_init(&conn->conn_list_err); |
12003 |
+- |
12004 |
+- mutex_unlock(&rx_queue_mutex); |
12005 |
+- |
12006 |
+- /* we don't want to hold rx_queue_mutex for too long, |
12007 |
+- * for instance if many conns failed at the same time, |
12008 |
+- * since this stall other iscsi maintenance operations. |
12009 |
+- * Give other users a chance to proceed. |
12010 |
+- */ |
12011 |
+- cond_resched(); |
12012 |
+ } |
12013 |
+ } |
12014 |
+ |
12015 |
+@@ -2846,8 +2865,11 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev |
12016 |
+ spin_unlock_irqrestore(&connlock, flags); |
12017 |
+ |
12018 |
+ ISCSI_DBG_TRANS_CONN(conn, "Destroying transport conn\n"); |
12019 |
++ |
12020 |
++ mutex_lock(&conn_mutex); |
12021 |
+ if (transport->destroy_conn) |
12022 |
+ transport->destroy_conn(conn); |
12023 |
++ mutex_unlock(&conn_mutex); |
12024 |
+ |
12025 |
+ return 0; |
12026 |
+ } |
12027 |
+@@ -3689,9 +3711,12 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
12028 |
+ break; |
12029 |
+ } |
12030 |
+ |
12031 |
++ mutex_lock(&conn_mutex); |
12032 |
+ ev->r.retcode = transport->bind_conn(session, conn, |
12033 |
+ ev->u.b_conn.transport_eph, |
12034 |
+ ev->u.b_conn.is_leading); |
12035 |
++ mutex_unlock(&conn_mutex); |
12036 |
++ |
12037 |
+ if (ev->r.retcode || !transport->ep_connect) |
12038 |
+ break; |
12039 |
+ |
12040 |
+@@ -3713,9 +3738,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
12041 |
+ case ISCSI_UEVENT_START_CONN: |
12042 |
+ conn = iscsi_conn_lookup(ev->u.start_conn.sid, ev->u.start_conn.cid); |
12043 |
+ if (conn) { |
12044 |
++ mutex_lock(&conn_mutex); |
12045 |
+ ev->r.retcode = transport->start_conn(conn); |
12046 |
+ if (!ev->r.retcode) |
12047 |
+ conn->state = ISCSI_CONN_UP; |
12048 |
++ mutex_unlock(&conn_mutex); |
12049 |
+ } |
12050 |
+ else |
12051 |
+ err = -EINVAL; |
12052 |
+@@ -3723,17 +3750,20 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
12053 |
+ case ISCSI_UEVENT_STOP_CONN: |
12054 |
+ conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); |
12055 |
+ if (conn) |
12056 |
+- transport->stop_conn(conn, ev->u.stop_conn.flag); |
12057 |
++ iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); |
12058 |
+ else |
12059 |
+ err = -EINVAL; |
12060 |
+ break; |
12061 |
+ case ISCSI_UEVENT_SEND_PDU: |
12062 |
+ conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid); |
12063 |
+- if (conn) |
12064 |
++ if (conn) { |
12065 |
++ mutex_lock(&conn_mutex); |
12066 |
+ ev->r.retcode = transport->send_pdu(conn, |
12067 |
+ (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), |
12068 |
+ (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, |
12069 |
+ ev->u.send_pdu.data_size); |
12070 |
++ mutex_unlock(&conn_mutex); |
12071 |
++ } |
12072 |
+ else |
12073 |
+ err = -EINVAL; |
12074 |
+ break; |
12075 |
+diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
12076 |
+index d2fe3fa470f9..1e13c6a0f0ca 100644 |
12077 |
+--- a/drivers/scsi/sr.c |
12078 |
++++ b/drivers/scsi/sr.c |
12079 |
+@@ -797,7 +797,7 @@ static int sr_probe(struct device *dev) |
12080 |
+ cd->cdi.disk = disk; |
12081 |
+ |
12082 |
+ if (register_cdrom(&cd->cdi)) |
12083 |
+- goto fail_put; |
12084 |
++ goto fail_minor; |
12085 |
+ |
12086 |
+ /* |
12087 |
+ * Initialize block layer runtime PM stuffs before the |
12088 |
+@@ -815,8 +815,13 @@ static int sr_probe(struct device *dev) |
12089 |
+ |
12090 |
+ return 0; |
12091 |
+ |
12092 |
++fail_minor: |
12093 |
++ spin_lock(&sr_index_lock); |
12094 |
++ clear_bit(minor, sr_index_bits); |
12095 |
++ spin_unlock(&sr_index_lock); |
12096 |
+ fail_put: |
12097 |
+ put_disk(disk); |
12098 |
++ mutex_destroy(&cd->lock); |
12099 |
+ fail_free: |
12100 |
+ kfree(cd); |
12101 |
+ fail: |
12102 |
+diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/scsi/ufs/ti-j721e-ufs.c |
12103 |
+index 5216d228cdd9..46bb905b4d6a 100644 |
12104 |
+--- a/drivers/scsi/ufs/ti-j721e-ufs.c |
12105 |
++++ b/drivers/scsi/ufs/ti-j721e-ufs.c |
12106 |
+@@ -32,14 +32,14 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev) |
12107 |
+ ret = pm_runtime_get_sync(dev); |
12108 |
+ if (ret < 0) { |
12109 |
+ pm_runtime_put_noidle(dev); |
12110 |
+- return ret; |
12111 |
++ goto disable_pm; |
12112 |
+ } |
12113 |
+ |
12114 |
+ /* Select MPHY refclk frequency */ |
12115 |
+ clk = devm_clk_get(dev, NULL); |
12116 |
+ if (IS_ERR(clk)) { |
12117 |
+ dev_err(dev, "Cannot claim MPHY clock.\n"); |
12118 |
+- return PTR_ERR(clk); |
12119 |
++ goto clk_err; |
12120 |
+ } |
12121 |
+ clk_rate = clk_get_rate(clk); |
12122 |
+ if (clk_rate == 26000000) |
12123 |
+@@ -54,16 +54,23 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev) |
12124 |
+ dev); |
12125 |
+ if (ret) { |
12126 |
+ dev_err(dev, "failed to populate child nodes %d\n", ret); |
12127 |
+- pm_runtime_put_sync(dev); |
12128 |
++ goto clk_err; |
12129 |
+ } |
12130 |
+ |
12131 |
+ return ret; |
12132 |
++ |
12133 |
++clk_err: |
12134 |
++ pm_runtime_put_sync(dev); |
12135 |
++disable_pm: |
12136 |
++ pm_runtime_disable(dev); |
12137 |
++ return ret; |
12138 |
+ } |
12139 |
+ |
12140 |
+ static int ti_j721e_ufs_remove(struct platform_device *pdev) |
12141 |
+ { |
12142 |
+ of_platform_depopulate(&pdev->dev); |
12143 |
+ pm_runtime_put_sync(&pdev->dev); |
12144 |
++ pm_runtime_disable(&pdev->dev); |
12145 |
+ |
12146 |
+ return 0; |
12147 |
+ } |
12148 |
+diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c |
12149 |
+index 19aa5c44e0da..f938867301a0 100644 |
12150 |
+--- a/drivers/scsi/ufs/ufs-qcom.c |
12151 |
++++ b/drivers/scsi/ufs/ufs-qcom.c |
12152 |
+@@ -1658,11 +1658,11 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba) |
12153 |
+ |
12154 |
+ /* sleep a bit intermittently as we are dumping too much data */ |
12155 |
+ ufs_qcom_print_hw_debug_reg_all(hba, NULL, ufs_qcom_dump_regs_wrapper); |
12156 |
+- usleep_range(1000, 1100); |
12157 |
++ udelay(1000); |
12158 |
+ ufs_qcom_testbus_read(hba); |
12159 |
+- usleep_range(1000, 1100); |
12160 |
++ udelay(1000); |
12161 |
+ ufs_qcom_print_unipro_testbus(hba); |
12162 |
+- usleep_range(1000, 1100); |
12163 |
++ udelay(1000); |
12164 |
+ } |
12165 |
+ |
12166 |
+ /** |
12167 |
+diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c |
12168 |
+index 53dd87628cbe..516a7f573942 100644 |
12169 |
+--- a/drivers/scsi/ufs/ufs_bsg.c |
12170 |
++++ b/drivers/scsi/ufs/ufs_bsg.c |
12171 |
+@@ -106,8 +106,10 @@ static int ufs_bsg_request(struct bsg_job *job) |
12172 |
+ desc_op = bsg_request->upiu_req.qr.opcode; |
12173 |
+ ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff, |
12174 |
+ &desc_len, desc_op); |
12175 |
+- if (ret) |
12176 |
++ if (ret) { |
12177 |
++ pm_runtime_put_sync(hba->dev); |
12178 |
+ goto out; |
12179 |
++ } |
12180 |
+ |
12181 |
+ /* fall through */ |
12182 |
+ case UPIU_TRANSACTION_NOP_OUT: |
12183 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
12184 |
+index 698e8d20b4ba..52740b60d786 100644 |
12185 |
+--- a/drivers/scsi/ufs/ufshcd.c |
12186 |
++++ b/drivers/scsi/ufs/ufshcd.c |
12187 |
+@@ -5098,7 +5098,6 @@ static int ufshcd_bkops_ctrl(struct ufs_hba *hba, |
12188 |
+ err = ufshcd_enable_auto_bkops(hba); |
12189 |
+ else |
12190 |
+ err = ufshcd_disable_auto_bkops(hba); |
12191 |
+- hba->urgent_bkops_lvl = curr_status; |
12192 |
+ out: |
12193 |
+ return err; |
12194 |
+ } |
12195 |
+diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
12196 |
+index fc2575fef51b..7426b5884218 100644 |
12197 |
+--- a/drivers/slimbus/qcom-ngd-ctrl.c |
12198 |
++++ b/drivers/slimbus/qcom-ngd-ctrl.c |
12199 |
+@@ -1361,7 +1361,6 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
12200 |
+ ngd->pdev->driver_override = QCOM_SLIM_NGD_DRV_NAME; |
12201 |
+ ngd->pdev->dev.of_node = node; |
12202 |
+ ctrl->ngd = ngd; |
12203 |
+- platform_set_drvdata(ngd->pdev, ctrl); |
12204 |
+ |
12205 |
+ platform_device_add(ngd->pdev); |
12206 |
+ ngd->base = ctrl->base + ngd->id * data->offset + |
12207 |
+@@ -1376,12 +1375,13 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
12208 |
+ |
12209 |
+ static int qcom_slim_ngd_probe(struct platform_device *pdev) |
12210 |
+ { |
12211 |
+- struct qcom_slim_ngd_ctrl *ctrl = platform_get_drvdata(pdev); |
12212 |
+ struct device *dev = &pdev->dev; |
12213 |
++ struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev->parent); |
12214 |
+ int ret; |
12215 |
+ |
12216 |
+ ctrl->ctrl.dev = dev; |
12217 |
+ |
12218 |
++ platform_set_drvdata(pdev, ctrl); |
12219 |
+ pm_runtime_use_autosuspend(dev); |
12220 |
+ pm_runtime_set_autosuspend_delay(dev, QCOM_SLIM_NGD_AUTOSUSPEND); |
12221 |
+ pm_runtime_set_suspended(dev); |
12222 |
+diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c |
12223 |
+index aace57fae7f8..4bacdb187eab 100644 |
12224 |
+--- a/drivers/soundwire/slave.c |
12225 |
++++ b/drivers/soundwire/slave.c |
12226 |
+@@ -68,6 +68,8 @@ static int sdw_slave_add(struct sdw_bus *bus, |
12227 |
+ list_del(&slave->node); |
12228 |
+ mutex_unlock(&bus->bus_lock); |
12229 |
+ put_device(&slave->dev); |
12230 |
++ |
12231 |
++ return ret; |
12232 |
+ } |
12233 |
+ sdw_slave_debugfs_init(slave); |
12234 |
+ |
12235 |
+diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c |
12236 |
+index 5f0e089573a2..af26bc9f184a 100644 |
12237 |
+--- a/drivers/staging/gasket/gasket_sysfs.c |
12238 |
++++ b/drivers/staging/gasket/gasket_sysfs.c |
12239 |
+@@ -339,6 +339,7 @@ void gasket_sysfs_put_attr(struct device *device, |
12240 |
+ |
12241 |
+ dev_err(device, "Unable to put unknown attribute: %s\n", |
12242 |
+ attr->attr.attr.name); |
12243 |
++ put_mapping(mapping); |
12244 |
+ } |
12245 |
+ EXPORT_SYMBOL(gasket_sysfs_put_attr); |
12246 |
+ |
12247 |
+@@ -372,6 +373,7 @@ ssize_t gasket_sysfs_register_store(struct device *device, |
12248 |
+ gasket_dev = mapping->gasket_dev; |
12249 |
+ if (!gasket_dev) { |
12250 |
+ dev_err(device, "Device driver may have been removed\n"); |
12251 |
++ put_mapping(mapping); |
12252 |
+ return 0; |
12253 |
+ } |
12254 |
+ |
12255 |
+diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c |
12256 |
+index d6ba25f21d80..d2672b65c3f4 100644 |
12257 |
+--- a/drivers/staging/greybus/light.c |
12258 |
++++ b/drivers/staging/greybus/light.c |
12259 |
+@@ -1026,7 +1026,8 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) |
12260 |
+ |
12261 |
+ light->channels_count = conf.channel_count; |
12262 |
+ light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); |
12263 |
+- |
12264 |
++ if (!light->name) |
12265 |
++ return -ENOMEM; |
12266 |
+ light->channels = kcalloc(light->channels_count, |
12267 |
+ sizeof(struct gb_channel), GFP_KERNEL); |
12268 |
+ if (!light->channels) |
12269 |
+diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi |
12270 |
+index 9e5cf68731bb..82aa93634eda 100644 |
12271 |
+--- a/drivers/staging/mt7621-dts/mt7621.dtsi |
12272 |
++++ b/drivers/staging/mt7621-dts/mt7621.dtsi |
12273 |
+@@ -523,11 +523,10 @@ |
12274 |
+ 0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */ |
12275 |
+ >; |
12276 |
+ |
12277 |
+- #interrupt-cells = <1>; |
12278 |
+- interrupt-map-mask = <0xF0000 0 0 1>; |
12279 |
+- interrupt-map = <0x10000 0 0 1 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>, |
12280 |
+- <0x20000 0 0 1 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>, |
12281 |
+- <0x30000 0 0 1 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; |
12282 |
++ interrupt-parent = <&gic>; |
12283 |
++ interrupts = <GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH |
12284 |
++ GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH |
12285 |
++ GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; |
12286 |
+ |
12287 |
+ status = "disabled"; |
12288 |
+ |
12289 |
+diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c |
12290 |
+index b9d460a9c041..36207243a71b 100644 |
12291 |
+--- a/drivers/staging/mt7621-pci/pci-mt7621.c |
12292 |
++++ b/drivers/staging/mt7621-pci/pci-mt7621.c |
12293 |
+@@ -97,6 +97,7 @@ |
12294 |
+ * @pcie_rst: pointer to port reset control |
12295 |
+ * @gpio_rst: gpio reset |
12296 |
+ * @slot: port slot |
12297 |
++ * @irq: GIC irq |
12298 |
+ * @enabled: indicates if port is enabled |
12299 |
+ */ |
12300 |
+ struct mt7621_pcie_port { |
12301 |
+@@ -107,6 +108,7 @@ struct mt7621_pcie_port { |
12302 |
+ struct reset_control *pcie_rst; |
12303 |
+ struct gpio_desc *gpio_rst; |
12304 |
+ u32 slot; |
12305 |
++ int irq; |
12306 |
+ bool enabled; |
12307 |
+ }; |
12308 |
+ |
12309 |
+@@ -120,6 +122,7 @@ struct mt7621_pcie_port { |
12310 |
+ * @dev: Pointer to PCIe device |
12311 |
+ * @io_map_base: virtual memory base address for io |
12312 |
+ * @ports: pointer to PCIe port information |
12313 |
++ * @irq_map: irq mapping info according pcie link status |
12314 |
+ * @resets_inverted: depends on chip revision |
12315 |
+ * reset lines are inverted. |
12316 |
+ */ |
12317 |
+@@ -135,6 +138,7 @@ struct mt7621_pcie { |
12318 |
+ } offset; |
12319 |
+ unsigned long io_map_base; |
12320 |
+ struct list_head ports; |
12321 |
++ int irq_map[PCIE_P2P_MAX]; |
12322 |
+ bool resets_inverted; |
12323 |
+ }; |
12324 |
+ |
12325 |
+@@ -279,6 +283,16 @@ static void setup_cm_memory_region(struct mt7621_pcie *pcie) |
12326 |
+ } |
12327 |
+ } |
12328 |
+ |
12329 |
++static int mt7621_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
12330 |
++{ |
12331 |
++ struct mt7621_pcie *pcie = pdev->bus->sysdata; |
12332 |
++ struct device *dev = pcie->dev; |
12333 |
++ int irq = pcie->irq_map[slot]; |
12334 |
++ |
12335 |
++ dev_info(dev, "bus=%d slot=%d irq=%d\n", pdev->bus->number, slot, irq); |
12336 |
++ return irq; |
12337 |
++} |
12338 |
++ |
12339 |
+ static int mt7621_pci_parse_request_of_pci_ranges(struct mt7621_pcie *pcie) |
12340 |
+ { |
12341 |
+ struct device *dev = pcie->dev; |
12342 |
+@@ -330,6 +344,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, |
12343 |
+ { |
12344 |
+ struct mt7621_pcie_port *port; |
12345 |
+ struct device *dev = pcie->dev; |
12346 |
++ struct platform_device *pdev = to_platform_device(dev); |
12347 |
+ struct device_node *pnode = dev->of_node; |
12348 |
+ struct resource regs; |
12349 |
+ char name[10]; |
12350 |
+@@ -371,6 +386,12 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, |
12351 |
+ port->slot = slot; |
12352 |
+ port->pcie = pcie; |
12353 |
+ |
12354 |
++ port->irq = platform_get_irq(pdev, slot); |
12355 |
++ if (port->irq < 0) { |
12356 |
++ dev_err(dev, "Failed to get IRQ for PCIe%d\n", slot); |
12357 |
++ return -ENXIO; |
12358 |
++ } |
12359 |
++ |
12360 |
+ INIT_LIST_HEAD(&port->list); |
12361 |
+ list_add_tail(&port->list, &pcie->ports); |
12362 |
+ |
12363 |
+@@ -585,13 +606,15 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) |
12364 |
+ { |
12365 |
+ u32 pcie_link_status = 0; |
12366 |
+ u32 n; |
12367 |
+- int i; |
12368 |
++ int i = 0; |
12369 |
+ u32 p2p_br_devnum[PCIE_P2P_MAX]; |
12370 |
++ int irqs[PCIE_P2P_MAX]; |
12371 |
+ struct mt7621_pcie_port *port; |
12372 |
+ |
12373 |
+ list_for_each_entry(port, &pcie->ports, list) { |
12374 |
+ u32 slot = port->slot; |
12375 |
+ |
12376 |
++ irqs[i++] = port->irq; |
12377 |
+ if (port->enabled) |
12378 |
+ pcie_link_status |= BIT(slot); |
12379 |
+ } |
12380 |
+@@ -614,6 +637,15 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) |
12381 |
+ (p2p_br_devnum[1] << PCIE_P2P_BR_DEVNUM1_SHIFT) | |
12382 |
+ (p2p_br_devnum[2] << PCIE_P2P_BR_DEVNUM2_SHIFT)); |
12383 |
+ |
12384 |
++ /* Assign IRQs */ |
12385 |
++ n = 0; |
12386 |
++ for (i = 0; i < PCIE_P2P_MAX; i++) |
12387 |
++ if (pcie_link_status & BIT(i)) |
12388 |
++ pcie->irq_map[n++] = irqs[i]; |
12389 |
++ |
12390 |
++ for (i = n; i < PCIE_P2P_MAX; i++) |
12391 |
++ pcie->irq_map[i] = -1; |
12392 |
++ |
12393 |
+ return 0; |
12394 |
+ } |
12395 |
+ |
12396 |
+@@ -638,7 +670,7 @@ static int mt7621_pcie_register_host(struct pci_host_bridge *host, |
12397 |
+ host->busnr = pcie->busn.start; |
12398 |
+ host->dev.parent = pcie->dev; |
12399 |
+ host->ops = &mt7621_pci_ops; |
12400 |
+- host->map_irq = of_irq_parse_and_map_pci; |
12401 |
++ host->map_irq = mt7621_map_irq; |
12402 |
+ host->swizzle_irq = pci_common_swizzle; |
12403 |
+ host->sysdata = pcie; |
12404 |
+ |
12405 |
+diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c |
12406 |
+index 59568d18ce23..5b72aa81d94c 100644 |
12407 |
+--- a/drivers/staging/sm750fb/sm750.c |
12408 |
++++ b/drivers/staging/sm750fb/sm750.c |
12409 |
+@@ -898,6 +898,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) |
12410 |
+ fix->visual = FB_VISUAL_PSEUDOCOLOR; |
12411 |
+ break; |
12412 |
+ case 16: |
12413 |
++ case 24: |
12414 |
+ case 32: |
12415 |
+ fix->visual = FB_VISUAL_TRUECOLOR; |
12416 |
+ break; |
12417 |
+diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c |
12418 |
+index dedc3ff58d3e..c2e4bd1e3b0a 100644 |
12419 |
+--- a/drivers/staging/wfx/bus_sdio.c |
12420 |
++++ b/drivers/staging/wfx/bus_sdio.c |
12421 |
+@@ -156,7 +156,13 @@ static const struct hwbus_ops wfx_sdio_hwbus_ops = { |
12422 |
+ .align_size = wfx_sdio_align_size, |
12423 |
+ }; |
12424 |
+ |
12425 |
+-static const struct of_device_id wfx_sdio_of_match[]; |
12426 |
++static const struct of_device_id wfx_sdio_of_match[] = { |
12427 |
++ { .compatible = "silabs,wfx-sdio" }, |
12428 |
++ { .compatible = "silabs,wf200" }, |
12429 |
++ { }, |
12430 |
++}; |
12431 |
++MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); |
12432 |
++ |
12433 |
+ static int wfx_sdio_probe(struct sdio_func *func, |
12434 |
+ const struct sdio_device_id *id) |
12435 |
+ { |
12436 |
+@@ -248,15 +254,6 @@ static const struct sdio_device_id wfx_sdio_ids[] = { |
12437 |
+ }; |
12438 |
+ MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); |
12439 |
+ |
12440 |
+-#ifdef CONFIG_OF |
12441 |
+-static const struct of_device_id wfx_sdio_of_match[] = { |
12442 |
+- { .compatible = "silabs,wfx-sdio" }, |
12443 |
+- { .compatible = "silabs,wf200" }, |
12444 |
+- { }, |
12445 |
+-}; |
12446 |
+-MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); |
12447 |
+-#endif |
12448 |
+- |
12449 |
+ struct sdio_driver wfx_sdio_driver = { |
12450 |
+ .name = "wfx-sdio", |
12451 |
+ .id_table = wfx_sdio_ids, |
12452 |
+@@ -264,6 +261,6 @@ struct sdio_driver wfx_sdio_driver = { |
12453 |
+ .remove = wfx_sdio_remove, |
12454 |
+ .drv = { |
12455 |
+ .owner = THIS_MODULE, |
12456 |
+- .of_match_table = of_match_ptr(wfx_sdio_of_match), |
12457 |
++ .of_match_table = wfx_sdio_of_match, |
12458 |
+ } |
12459 |
+ }; |
12460 |
+diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c |
12461 |
+index 1164aba118a1..a73b5bbb578e 100644 |
12462 |
+--- a/drivers/staging/wfx/debug.c |
12463 |
++++ b/drivers/staging/wfx/debug.c |
12464 |
+@@ -142,7 +142,7 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v) |
12465 |
+ mutex_lock(&wdev->rx_stats_lock); |
12466 |
+ seq_printf(seq, "Timestamp: %dus\n", st->date); |
12467 |
+ seq_printf(seq, "Low power clock: frequency %uHz, external %s\n", |
12468 |
+- st->pwr_clk_freq, |
12469 |
++ le32_to_cpu(st->pwr_clk_freq), |
12470 |
+ st->is_ext_pwr_clk ? "yes" : "no"); |
12471 |
+ seq_printf(seq, |
12472 |
+ "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n", |
12473 |
+@@ -152,9 +152,12 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v) |
12474 |
+ for (i = 0; i < ARRAY_SIZE(channel_names); i++) { |
12475 |
+ if (channel_names[i]) |
12476 |
+ seq_printf(seq, "%5s %8d %8d %8d %8d %8d\n", |
12477 |
+- channel_names[i], st->nb_rx_by_rate[i], |
12478 |
+- st->per[i], st->rssi[i] / 100, |
12479 |
+- st->snr[i] / 100, st->cfo[i]); |
12480 |
++ channel_names[i], |
12481 |
++ le32_to_cpu(st->nb_rx_by_rate[i]), |
12482 |
++ le16_to_cpu(st->per[i]), |
12483 |
++ (s16)le16_to_cpu(st->rssi[i]) / 100, |
12484 |
++ (s16)le16_to_cpu(st->snr[i]) / 100, |
12485 |
++ (s16)le16_to_cpu(st->cfo[i])); |
12486 |
+ } |
12487 |
+ mutex_unlock(&wdev->rx_stats_lock); |
12488 |
+ |
12489 |
+diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c |
12490 |
+index 77bca43aca42..20b3045d7667 100644 |
12491 |
+--- a/drivers/staging/wfx/hif_tx.c |
12492 |
++++ b/drivers/staging/wfx/hif_tx.c |
12493 |
+@@ -268,7 +268,7 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, |
12494 |
+ tmo_chan_bg = le32_to_cpu(body->max_channel_time) * USEC_PER_TU; |
12495 |
+ tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; |
12496 |
+ tmo_chan_fg *= body->num_of_probe_requests; |
12497 |
+- tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg); |
12498 |
++ tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; |
12499 |
+ |
12500 |
+ wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); |
12501 |
+ ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); |
12502 |
+diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c |
12503 |
+index 39d9127ce4b9..8ae23681e29b 100644 |
12504 |
+--- a/drivers/staging/wfx/queue.c |
12505 |
++++ b/drivers/staging/wfx/queue.c |
12506 |
+@@ -35,6 +35,7 @@ void wfx_tx_flush(struct wfx_dev *wdev) |
12507 |
+ if (wdev->chip_frozen) |
12508 |
+ return; |
12509 |
+ |
12510 |
++ wfx_tx_lock(wdev); |
12511 |
+ mutex_lock(&wdev->hif_cmd.lock); |
12512 |
+ ret = wait_event_timeout(wdev->hif.tx_buffers_empty, |
12513 |
+ !wdev->hif.tx_buffers_used, |
12514 |
+@@ -47,6 +48,7 @@ void wfx_tx_flush(struct wfx_dev *wdev) |
12515 |
+ wdev->chip_frozen = 1; |
12516 |
+ } |
12517 |
+ mutex_unlock(&wdev->hif_cmd.lock); |
12518 |
++ wfx_tx_unlock(wdev); |
12519 |
+ } |
12520 |
+ |
12521 |
+ void wfx_tx_lock_flush(struct wfx_dev *wdev) |
12522 |
+diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c |
12523 |
+index 9d430346a58b..b4cd7cb1ce56 100644 |
12524 |
+--- a/drivers/staging/wfx/sta.c |
12525 |
++++ b/drivers/staging/wfx/sta.c |
12526 |
+@@ -520,7 +520,9 @@ static void wfx_do_join(struct wfx_vif *wvif) |
12527 |
+ ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); |
12528 |
+ if (ssidie) { |
12529 |
+ ssidlen = ssidie[1]; |
12530 |
+- memcpy(ssid, &ssidie[2], ssidie[1]); |
12531 |
++ if (ssidlen > IEEE80211_MAX_SSID_LEN) |
12532 |
++ ssidlen = IEEE80211_MAX_SSID_LEN; |
12533 |
++ memcpy(ssid, &ssidie[2], ssidlen); |
12534 |
+ } |
12535 |
+ rcu_read_unlock(); |
12536 |
+ |
12537 |
+@@ -1047,7 +1049,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
12538 |
+ init_completion(&wvif->scan_complete); |
12539 |
+ INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); |
12540 |
+ |
12541 |
+- INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); |
12542 |
+ mutex_unlock(&wdev->conf_mutex); |
12543 |
+ |
12544 |
+ hif_set_macaddr(wvif, vif->addr); |
12545 |
+diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h |
12546 |
+index cf99a8a74a81..ace845f9ed14 100644 |
12547 |
+--- a/drivers/staging/wfx/sta.h |
12548 |
++++ b/drivers/staging/wfx/sta.h |
12549 |
+@@ -37,7 +37,7 @@ struct wfx_grp_addr_table { |
12550 |
+ struct wfx_sta_priv { |
12551 |
+ int link_id; |
12552 |
+ int vif_id; |
12553 |
+- u8 buffered[IEEE80211_NUM_TIDS]; |
12554 |
++ int buffered[IEEE80211_NUM_TIDS]; |
12555 |
+ // Ensure atomicity of "buffered" and calls to ieee80211_sta_set_buffered() |
12556 |
+ spinlock_t lock; |
12557 |
+ }; |
12558 |
+diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c |
12559 |
+index 6c7de2f8d3f2..d025a3093015 100644 |
12560 |
+--- a/drivers/staging/wilc1000/hif.c |
12561 |
++++ b/drivers/staging/wilc1000/hif.c |
12562 |
+@@ -11,6 +11,8 @@ |
12563 |
+ |
12564 |
+ #define WILC_FALSE_FRMWR_CHANNEL 100 |
12565 |
+ |
12566 |
++#define WILC_SCAN_WID_LIST_SIZE 6 |
12567 |
++ |
12568 |
+ struct wilc_rcvd_mac_info { |
12569 |
+ u8 status; |
12570 |
+ }; |
12571 |
+@@ -151,7 +153,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, |
12572 |
+ void *user_arg, struct cfg80211_scan_request *request) |
12573 |
+ { |
12574 |
+ int result = 0; |
12575 |
+- struct wid wid_list[5]; |
12576 |
++ struct wid wid_list[WILC_SCAN_WID_LIST_SIZE]; |
12577 |
+ u32 index = 0; |
12578 |
+ u32 i, scan_timeout; |
12579 |
+ u8 *buffer; |
12580 |
+diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c |
12581 |
+index 3305b47fdf53..16d5a4e117a2 100644 |
12582 |
+--- a/drivers/target/loopback/tcm_loop.c |
12583 |
++++ b/drivers/target/loopback/tcm_loop.c |
12584 |
+@@ -545,32 +545,15 @@ static int tcm_loop_write_pending(struct se_cmd *se_cmd) |
12585 |
+ return 0; |
12586 |
+ } |
12587 |
+ |
12588 |
+-static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
12589 |
++static int tcm_loop_queue_data_or_status(const char *func, |
12590 |
++ struct se_cmd *se_cmd, u8 scsi_status) |
12591 |
+ { |
12592 |
+ struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
12593 |
+ struct tcm_loop_cmd, tl_se_cmd); |
12594 |
+ struct scsi_cmnd *sc = tl_cmd->sc; |
12595 |
+ |
12596 |
+ pr_debug("%s() called for scsi_cmnd: %p cdb: 0x%02x\n", |
12597 |
+- __func__, sc, sc->cmnd[0]); |
12598 |
+- |
12599 |
+- sc->result = SAM_STAT_GOOD; |
12600 |
+- set_host_byte(sc, DID_OK); |
12601 |
+- if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
12602 |
+- (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) |
12603 |
+- scsi_set_resid(sc, se_cmd->residual_count); |
12604 |
+- sc->scsi_done(sc); |
12605 |
+- return 0; |
12606 |
+-} |
12607 |
+- |
12608 |
+-static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12609 |
+-{ |
12610 |
+- struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
12611 |
+- struct tcm_loop_cmd, tl_se_cmd); |
12612 |
+- struct scsi_cmnd *sc = tl_cmd->sc; |
12613 |
+- |
12614 |
+- pr_debug("%s() called for scsi_cmnd: %p cdb: 0x%02x\n", |
12615 |
+- __func__, sc, sc->cmnd[0]); |
12616 |
++ func, sc, sc->cmnd[0]); |
12617 |
+ |
12618 |
+ if (se_cmd->sense_buffer && |
12619 |
+ ((se_cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) || |
12620 |
+@@ -581,7 +564,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12621 |
+ sc->result = SAM_STAT_CHECK_CONDITION; |
12622 |
+ set_driver_byte(sc, DRIVER_SENSE); |
12623 |
+ } else |
12624 |
+- sc->result = se_cmd->scsi_status; |
12625 |
++ sc->result = scsi_status; |
12626 |
+ |
12627 |
+ set_host_byte(sc, DID_OK); |
12628 |
+ if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
12629 |
+@@ -591,6 +574,17 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12630 |
+ return 0; |
12631 |
+ } |
12632 |
+ |
12633 |
++static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
12634 |
++{ |
12635 |
++ return tcm_loop_queue_data_or_status(__func__, se_cmd, SAM_STAT_GOOD); |
12636 |
++} |
12637 |
++ |
12638 |
++static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12639 |
++{ |
12640 |
++ return tcm_loop_queue_data_or_status(__func__, |
12641 |
++ se_cmd, se_cmd->scsi_status); |
12642 |
++} |
12643 |
++ |
12644 |
+ static void tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd) |
12645 |
+ { |
12646 |
+ struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
12647 |
+diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
12648 |
+index f769bb1e3735..b63a1e0c4aa6 100644 |
12649 |
+--- a/drivers/target/target_core_user.c |
12650 |
++++ b/drivers/target/target_core_user.c |
12651 |
+@@ -882,41 +882,24 @@ static inline size_t tcmu_cmd_get_cmd_size(struct tcmu_cmd *tcmu_cmd, |
12652 |
+ return command_size; |
12653 |
+ } |
12654 |
+ |
12655 |
+-static int tcmu_setup_cmd_timer(struct tcmu_cmd *tcmu_cmd, unsigned int tmo, |
12656 |
+- struct timer_list *timer) |
12657 |
++static void tcmu_setup_cmd_timer(struct tcmu_cmd *tcmu_cmd, unsigned int tmo, |
12658 |
++ struct timer_list *timer) |
12659 |
+ { |
12660 |
+- struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
12661 |
+- int cmd_id; |
12662 |
+- |
12663 |
+- if (tcmu_cmd->cmd_id) |
12664 |
+- goto setup_timer; |
12665 |
+- |
12666 |
+- cmd_id = idr_alloc(&udev->commands, tcmu_cmd, 1, USHRT_MAX, GFP_NOWAIT); |
12667 |
+- if (cmd_id < 0) { |
12668 |
+- pr_err("tcmu: Could not allocate cmd id.\n"); |
12669 |
+- return cmd_id; |
12670 |
+- } |
12671 |
+- tcmu_cmd->cmd_id = cmd_id; |
12672 |
+- |
12673 |
+- pr_debug("allocated cmd %u for dev %s tmo %lu\n", tcmu_cmd->cmd_id, |
12674 |
+- udev->name, tmo / MSEC_PER_SEC); |
12675 |
+- |
12676 |
+-setup_timer: |
12677 |
+ if (!tmo) |
12678 |
+- return 0; |
12679 |
++ return; |
12680 |
+ |
12681 |
+ tcmu_cmd->deadline = round_jiffies_up(jiffies + msecs_to_jiffies(tmo)); |
12682 |
+ if (!timer_pending(timer)) |
12683 |
+ mod_timer(timer, tcmu_cmd->deadline); |
12684 |
+ |
12685 |
+- return 0; |
12686 |
++ pr_debug("Timeout set up for cmd %p, dev = %s, tmo = %lu\n", tcmu_cmd, |
12687 |
++ tcmu_cmd->tcmu_dev->name, tmo / MSEC_PER_SEC); |
12688 |
+ } |
12689 |
+ |
12690 |
+ static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) |
12691 |
+ { |
12692 |
+ struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
12693 |
+ unsigned int tmo; |
12694 |
+- int ret; |
12695 |
+ |
12696 |
+ /* |
12697 |
+ * For backwards compat if qfull_time_out is not set use |
12698 |
+@@ -931,13 +914,11 @@ static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) |
12699 |
+ else |
12700 |
+ tmo = TCMU_TIME_OUT; |
12701 |
+ |
12702 |
+- ret = tcmu_setup_cmd_timer(tcmu_cmd, tmo, &udev->qfull_timer); |
12703 |
+- if (ret) |
12704 |
+- return ret; |
12705 |
++ tcmu_setup_cmd_timer(tcmu_cmd, tmo, &udev->qfull_timer); |
12706 |
+ |
12707 |
+ list_add_tail(&tcmu_cmd->queue_entry, &udev->qfull_queue); |
12708 |
+- pr_debug("adding cmd %u on dev %s to ring space wait queue\n", |
12709 |
+- tcmu_cmd->cmd_id, udev->name); |
12710 |
++ pr_debug("adding cmd %p on dev %s to ring space wait queue\n", |
12711 |
++ tcmu_cmd, udev->name); |
12712 |
+ return 0; |
12713 |
+ } |
12714 |
+ |
12715 |
+@@ -959,7 +940,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) |
12716 |
+ struct tcmu_mailbox *mb; |
12717 |
+ struct tcmu_cmd_entry *entry; |
12718 |
+ struct iovec *iov; |
12719 |
+- int iov_cnt, ret; |
12720 |
++ int iov_cnt, cmd_id; |
12721 |
+ uint32_t cmd_head; |
12722 |
+ uint64_t cdb_off; |
12723 |
+ bool copy_to_data_area; |
12724 |
+@@ -1060,14 +1041,21 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) |
12725 |
+ } |
12726 |
+ entry->req.iov_bidi_cnt = iov_cnt; |
12727 |
+ |
12728 |
+- ret = tcmu_setup_cmd_timer(tcmu_cmd, udev->cmd_time_out, |
12729 |
+- &udev->cmd_timer); |
12730 |
+- if (ret) { |
12731 |
+- tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt); |
12732 |
++ cmd_id = idr_alloc(&udev->commands, tcmu_cmd, 1, USHRT_MAX, GFP_NOWAIT); |
12733 |
++ if (cmd_id < 0) { |
12734 |
++ pr_err("tcmu: Could not allocate cmd id.\n"); |
12735 |
+ |
12736 |
++ tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt); |
12737 |
+ *scsi_err = TCM_OUT_OF_RESOURCES; |
12738 |
+ return -1; |
12739 |
+ } |
12740 |
++ tcmu_cmd->cmd_id = cmd_id; |
12741 |
++ |
12742 |
++ pr_debug("allocated cmd id %u for cmd %p dev %s\n", tcmu_cmd->cmd_id, |
12743 |
++ tcmu_cmd, udev->name); |
12744 |
++ |
12745 |
++ tcmu_setup_cmd_timer(tcmu_cmd, udev->cmd_time_out, &udev->cmd_timer); |
12746 |
++ |
12747 |
+ entry->hdr.cmd_id = tcmu_cmd->cmd_id; |
12748 |
+ |
12749 |
+ /* |
12750 |
+@@ -1279,50 +1267,39 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) |
12751 |
+ return handled; |
12752 |
+ } |
12753 |
+ |
12754 |
+-static int tcmu_check_expired_cmd(int id, void *p, void *data) |
12755 |
++static void tcmu_check_expired_ring_cmd(struct tcmu_cmd *cmd) |
12756 |
+ { |
12757 |
+- struct tcmu_cmd *cmd = p; |
12758 |
+- struct tcmu_dev *udev = cmd->tcmu_dev; |
12759 |
+- u8 scsi_status; |
12760 |
+ struct se_cmd *se_cmd; |
12761 |
+- bool is_running; |
12762 |
+- |
12763 |
+- if (test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) |
12764 |
+- return 0; |
12765 |
+ |
12766 |
+ if (!time_after(jiffies, cmd->deadline)) |
12767 |
+- return 0; |
12768 |
++ return; |
12769 |
+ |
12770 |
+- is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags); |
12771 |
++ set_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags); |
12772 |
++ list_del_init(&cmd->queue_entry); |
12773 |
+ se_cmd = cmd->se_cmd; |
12774 |
++ cmd->se_cmd = NULL; |
12775 |
+ |
12776 |
+- if (is_running) { |
12777 |
+- /* |
12778 |
+- * If cmd_time_out is disabled but qfull is set deadline |
12779 |
+- * will only reflect the qfull timeout. Ignore it. |
12780 |
+- */ |
12781 |
+- if (!udev->cmd_time_out) |
12782 |
+- return 0; |
12783 |
++ pr_debug("Timing out inflight cmd %u on dev %s.\n", |
12784 |
++ cmd->cmd_id, cmd->tcmu_dev->name); |
12785 |
+ |
12786 |
+- set_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags); |
12787 |
+- /* |
12788 |
+- * target_complete_cmd will translate this to LUN COMM FAILURE |
12789 |
+- */ |
12790 |
+- scsi_status = SAM_STAT_CHECK_CONDITION; |
12791 |
+- list_del_init(&cmd->queue_entry); |
12792 |
+- cmd->se_cmd = NULL; |
12793 |
+- } else { |
12794 |
+- list_del_init(&cmd->queue_entry); |
12795 |
+- idr_remove(&udev->commands, id); |
12796 |
+- tcmu_free_cmd(cmd); |
12797 |
+- scsi_status = SAM_STAT_TASK_SET_FULL; |
12798 |
+- } |
12799 |
++ target_complete_cmd(se_cmd, SAM_STAT_CHECK_CONDITION); |
12800 |
++} |
12801 |
+ |
12802 |
+- pr_debug("Timing out cmd %u on dev %s that is %s.\n", |
12803 |
+- id, udev->name, is_running ? "inflight" : "queued"); |
12804 |
++static void tcmu_check_expired_queue_cmd(struct tcmu_cmd *cmd) |
12805 |
++{ |
12806 |
++ struct se_cmd *se_cmd; |
12807 |
+ |
12808 |
+- target_complete_cmd(se_cmd, scsi_status); |
12809 |
+- return 0; |
12810 |
++ if (!time_after(jiffies, cmd->deadline)) |
12811 |
++ return; |
12812 |
++ |
12813 |
++ pr_debug("Timing out queued cmd %p on dev %s.\n", |
12814 |
++ cmd, cmd->tcmu_dev->name); |
12815 |
++ |
12816 |
++ list_del_init(&cmd->queue_entry); |
12817 |
++ se_cmd = cmd->se_cmd; |
12818 |
++ tcmu_free_cmd(cmd); |
12819 |
++ |
12820 |
++ target_complete_cmd(se_cmd, SAM_STAT_TASK_SET_FULL); |
12821 |
+ } |
12822 |
+ |
12823 |
+ static void tcmu_device_timedout(struct tcmu_dev *udev) |
12824 |
+@@ -1407,16 +1384,15 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) |
12825 |
+ return &udev->se_dev; |
12826 |
+ } |
12827 |
+ |
12828 |
+-static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12829 |
++static void run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12830 |
+ { |
12831 |
+ struct tcmu_cmd *tcmu_cmd, *tmp_cmd; |
12832 |
+ LIST_HEAD(cmds); |
12833 |
+- bool drained = true; |
12834 |
+ sense_reason_t scsi_ret; |
12835 |
+ int ret; |
12836 |
+ |
12837 |
+ if (list_empty(&udev->qfull_queue)) |
12838 |
+- return true; |
12839 |
++ return; |
12840 |
+ |
12841 |
+ pr_debug("running %s's cmdr queue forcefail %d\n", udev->name, fail); |
12842 |
+ |
12843 |
+@@ -1425,11 +1401,10 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12844 |
+ list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, queue_entry) { |
12845 |
+ list_del_init(&tcmu_cmd->queue_entry); |
12846 |
+ |
12847 |
+- pr_debug("removing cmd %u on dev %s from queue\n", |
12848 |
+- tcmu_cmd->cmd_id, udev->name); |
12849 |
++ pr_debug("removing cmd %p on dev %s from queue\n", |
12850 |
++ tcmu_cmd, udev->name); |
12851 |
+ |
12852 |
+ if (fail) { |
12853 |
+- idr_remove(&udev->commands, tcmu_cmd->cmd_id); |
12854 |
+ /* |
12855 |
+ * We were not able to even start the command, so |
12856 |
+ * fail with busy to allow a retry in case runner |
12857 |
+@@ -1444,10 +1419,8 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12858 |
+ |
12859 |
+ ret = queue_cmd_ring(tcmu_cmd, &scsi_ret); |
12860 |
+ if (ret < 0) { |
12861 |
+- pr_debug("cmd %u on dev %s failed with %u\n", |
12862 |
+- tcmu_cmd->cmd_id, udev->name, scsi_ret); |
12863 |
+- |
12864 |
+- idr_remove(&udev->commands, tcmu_cmd->cmd_id); |
12865 |
++ pr_debug("cmd %p on dev %s failed with %u\n", |
12866 |
++ tcmu_cmd, udev->name, scsi_ret); |
12867 |
+ /* |
12868 |
+ * Ignore scsi_ret for now. target_complete_cmd |
12869 |
+ * drops it. |
12870 |
+@@ -1462,13 +1435,11 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12871 |
+ * the queue |
12872 |
+ */ |
12873 |
+ list_splice_tail(&cmds, &udev->qfull_queue); |
12874 |
+- drained = false; |
12875 |
+ break; |
12876 |
+ } |
12877 |
+ } |
12878 |
+ |
12879 |
+ tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); |
12880 |
+- return drained; |
12881 |
+ } |
12882 |
+ |
12883 |
+ static int tcmu_irqcontrol(struct uio_info *info, s32 irq_on) |
12884 |
+@@ -1652,6 +1623,8 @@ static void tcmu_dev_kref_release(struct kref *kref) |
12885 |
+ if (tcmu_check_and_free_pending_cmd(cmd) != 0) |
12886 |
+ all_expired = false; |
12887 |
+ } |
12888 |
++ if (!list_empty(&udev->qfull_queue)) |
12889 |
++ all_expired = false; |
12890 |
+ idr_destroy(&udev->commands); |
12891 |
+ WARN_ON(!all_expired); |
12892 |
+ |
12893 |
+@@ -2037,9 +2010,6 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
12894 |
+ mutex_lock(&udev->cmdr_lock); |
12895 |
+ |
12896 |
+ idr_for_each_entry(&udev->commands, cmd, i) { |
12897 |
+- if (!test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags)) |
12898 |
+- continue; |
12899 |
+- |
12900 |
+ pr_debug("removing cmd %u on dev %s from ring (is expired %d)\n", |
12901 |
+ cmd->cmd_id, udev->name, |
12902 |
+ test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)); |
12903 |
+@@ -2077,6 +2047,8 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
12904 |
+ |
12905 |
+ del_timer(&udev->cmd_timer); |
12906 |
+ |
12907 |
++ run_qfull_queue(udev, false); |
12908 |
++ |
12909 |
+ mutex_unlock(&udev->cmdr_lock); |
12910 |
+ } |
12911 |
+ |
12912 |
+@@ -2698,6 +2670,7 @@ static void find_free_blocks(void) |
12913 |
+ static void check_timedout_devices(void) |
12914 |
+ { |
12915 |
+ struct tcmu_dev *udev, *tmp_dev; |
12916 |
++ struct tcmu_cmd *cmd, *tmp_cmd; |
12917 |
+ LIST_HEAD(devs); |
12918 |
+ |
12919 |
+ spin_lock_bh(&timed_out_udevs_lock); |
12920 |
+@@ -2708,9 +2681,24 @@ static void check_timedout_devices(void) |
12921 |
+ spin_unlock_bh(&timed_out_udevs_lock); |
12922 |
+ |
12923 |
+ mutex_lock(&udev->cmdr_lock); |
12924 |
+- idr_for_each(&udev->commands, tcmu_check_expired_cmd, NULL); |
12925 |
+ |
12926 |
+- tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); |
12927 |
++ /* |
12928 |
++ * If cmd_time_out is disabled but qfull is set deadline |
12929 |
++ * will only reflect the qfull timeout. Ignore it. |
12930 |
++ */ |
12931 |
++ if (udev->cmd_time_out) { |
12932 |
++ list_for_each_entry_safe(cmd, tmp_cmd, |
12933 |
++ &udev->inflight_queue, |
12934 |
++ queue_entry) { |
12935 |
++ tcmu_check_expired_ring_cmd(cmd); |
12936 |
++ } |
12937 |
++ tcmu_set_next_deadline(&udev->inflight_queue, |
12938 |
++ &udev->cmd_timer); |
12939 |
++ } |
12940 |
++ list_for_each_entry_safe(cmd, tmp_cmd, &udev->qfull_queue, |
12941 |
++ queue_entry) { |
12942 |
++ tcmu_check_expired_queue_cmd(cmd); |
12943 |
++ } |
12944 |
+ tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); |
12945 |
+ |
12946 |
+ mutex_unlock(&udev->cmdr_lock); |
12947 |
+diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
12948 |
+index d3e959d01606..85776db4bf34 100644 |
12949 |
+--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
12950 |
++++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
12951 |
+@@ -169,7 +169,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, |
12952 |
+ |
12953 |
+ data = ti_bandgap_get_sensor_data(bgp, id); |
12954 |
+ |
12955 |
+- if (!data || IS_ERR(data)) |
12956 |
++ if (!IS_ERR_OR_NULL(data)) |
12957 |
+ data = ti_thermal_build_data(bgp, id); |
12958 |
+ |
12959 |
+ if (!data) |
12960 |
+@@ -196,7 +196,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) |
12961 |
+ |
12962 |
+ data = ti_bandgap_get_sensor_data(bgp, id); |
12963 |
+ |
12964 |
+- if (data && data->ti_thermal) { |
12965 |
++ if (!IS_ERR_OR_NULL(data) && data->ti_thermal) { |
12966 |
+ if (data->our_zone) |
12967 |
+ thermal_zone_device_unregister(data->ti_thermal); |
12968 |
+ } |
12969 |
+@@ -262,7 +262,7 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) |
12970 |
+ |
12971 |
+ data = ti_bandgap_get_sensor_data(bgp, id); |
12972 |
+ |
12973 |
+- if (data) { |
12974 |
++ if (!IS_ERR_OR_NULL(data)) { |
12975 |
+ cpufreq_cooling_unregister(data->cool_dev); |
12976 |
+ if (data->policy) |
12977 |
+ cpufreq_cpu_put(data->policy); |
12978 |
+diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
12979 |
+index cdcc64ea2554..f8e43a6faea9 100644 |
12980 |
+--- a/drivers/tty/hvc/hvc_console.c |
12981 |
++++ b/drivers/tty/hvc/hvc_console.c |
12982 |
+@@ -75,6 +75,8 @@ static LIST_HEAD(hvc_structs); |
12983 |
+ */ |
12984 |
+ static DEFINE_MUTEX(hvc_structs_mutex); |
12985 |
+ |
12986 |
++/* Mutex to serialize hvc_open */ |
12987 |
++static DEFINE_MUTEX(hvc_open_mutex); |
12988 |
+ /* |
12989 |
+ * This value is used to assign a tty->index value to a hvc_struct based |
12990 |
+ * upon order of exposure via hvc_probe(), when we can not match it to |
12991 |
+@@ -346,16 +348,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty) |
12992 |
+ */ |
12993 |
+ static int hvc_open(struct tty_struct *tty, struct file * filp) |
12994 |
+ { |
12995 |
+- struct hvc_struct *hp = tty->driver_data; |
12996 |
++ struct hvc_struct *hp; |
12997 |
+ unsigned long flags; |
12998 |
+ int rc = 0; |
12999 |
+ |
13000 |
++ mutex_lock(&hvc_open_mutex); |
13001 |
++ |
13002 |
++ hp = tty->driver_data; |
13003 |
++ if (!hp) { |
13004 |
++ rc = -EIO; |
13005 |
++ goto out; |
13006 |
++ } |
13007 |
++ |
13008 |
+ spin_lock_irqsave(&hp->port.lock, flags); |
13009 |
+ /* Check and then increment for fast path open. */ |
13010 |
+ if (hp->port.count++ > 0) { |
13011 |
+ spin_unlock_irqrestore(&hp->port.lock, flags); |
13012 |
+ hvc_kick(); |
13013 |
+- return 0; |
13014 |
++ goto out; |
13015 |
+ } /* else count == 0 */ |
13016 |
+ spin_unlock_irqrestore(&hp->port.lock, flags); |
13017 |
+ |
13018 |
+@@ -383,6 +393,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) |
13019 |
+ /* Force wakeup of the polling thread */ |
13020 |
+ hvc_kick(); |
13021 |
+ |
13022 |
++out: |
13023 |
++ mutex_unlock(&hvc_open_mutex); |
13024 |
+ return rc; |
13025 |
+ } |
13026 |
+ |
13027 |
+diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
13028 |
+index d77ed82a4840..f189579db7c4 100644 |
13029 |
+--- a/drivers/tty/n_gsm.c |
13030 |
++++ b/drivers/tty/n_gsm.c |
13031 |
+@@ -673,11 +673,10 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len, |
13032 |
+ * FIXME: lock against link layer control transmissions |
13033 |
+ */ |
13034 |
+ |
13035 |
+-static void gsm_data_kick(struct gsm_mux *gsm) |
13036 |
++static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) |
13037 |
+ { |
13038 |
+ struct gsm_msg *msg, *nmsg; |
13039 |
+ int len; |
13040 |
+- int skip_sof = 0; |
13041 |
+ |
13042 |
+ list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { |
13043 |
+ if (gsm->constipated && msg->addr) |
13044 |
+@@ -699,18 +698,23 @@ static void gsm_data_kick(struct gsm_mux *gsm) |
13045 |
+ print_hex_dump_bytes("gsm_data_kick: ", |
13046 |
+ DUMP_PREFIX_OFFSET, |
13047 |
+ gsm->txframe, len); |
13048 |
+- |
13049 |
+- if (gsm->output(gsm, gsm->txframe + skip_sof, |
13050 |
+- len - skip_sof) < 0) |
13051 |
++ if (gsm->output(gsm, gsm->txframe, len) < 0) |
13052 |
+ break; |
13053 |
+ /* FIXME: Can eliminate one SOF in many more cases */ |
13054 |
+ gsm->tx_bytes -= msg->len; |
13055 |
+- /* For a burst of frames skip the extra SOF within the |
13056 |
+- burst */ |
13057 |
+- skip_sof = 1; |
13058 |
+ |
13059 |
+ list_del(&msg->list); |
13060 |
+ kfree(msg); |
13061 |
++ |
13062 |
++ if (dlci) { |
13063 |
++ tty_port_tty_wakeup(&dlci->port); |
13064 |
++ } else { |
13065 |
++ int i = 0; |
13066 |
++ |
13067 |
++ for (i = 0; i < NUM_DLCI; i++) |
13068 |
++ if (gsm->dlci[i]) |
13069 |
++ tty_port_tty_wakeup(&gsm->dlci[i]->port); |
13070 |
++ } |
13071 |
+ } |
13072 |
+ } |
13073 |
+ |
13074 |
+@@ -762,7 +766,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) |
13075 |
+ /* Add to the actual output queue */ |
13076 |
+ list_add_tail(&msg->list, &gsm->tx_list); |
13077 |
+ gsm->tx_bytes += msg->len; |
13078 |
+- gsm_data_kick(gsm); |
13079 |
++ gsm_data_kick(gsm, dlci); |
13080 |
+ } |
13081 |
+ |
13082 |
+ /** |
13083 |
+@@ -1223,7 +1227,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, |
13084 |
+ gsm_control_reply(gsm, CMD_FCON, NULL, 0); |
13085 |
+ /* Kick the link in case it is idling */ |
13086 |
+ spin_lock_irqsave(&gsm->tx_lock, flags); |
13087 |
+- gsm_data_kick(gsm); |
13088 |
++ gsm_data_kick(gsm, NULL); |
13089 |
+ spin_unlock_irqrestore(&gsm->tx_lock, flags); |
13090 |
+ break; |
13091 |
+ case CMD_FCOFF: |
13092 |
+@@ -2545,7 +2549,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty) |
13093 |
+ /* Queue poll */ |
13094 |
+ clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
13095 |
+ spin_lock_irqsave(&gsm->tx_lock, flags); |
13096 |
+- gsm_data_kick(gsm); |
13097 |
++ gsm_data_kick(gsm, NULL); |
13098 |
+ if (gsm->tx_bytes < TX_THRESH_LO) { |
13099 |
+ gsm_dlci_data_sweep(gsm); |
13100 |
+ } |
13101 |
+diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
13102 |
+index f77bf820b7a3..4d83c85a7389 100644 |
13103 |
+--- a/drivers/tty/serial/8250/8250_port.c |
13104 |
++++ b/drivers/tty/serial/8250/8250_port.c |
13105 |
+@@ -2615,6 +2615,8 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
13106 |
+ struct ktermios *termios, |
13107 |
+ struct ktermios *old) |
13108 |
+ { |
13109 |
++ unsigned int tolerance = port->uartclk / 100; |
13110 |
++ |
13111 |
+ /* |
13112 |
+ * Ask the core to calculate the divisor for us. |
13113 |
+ * Allow 1% tolerance at the upper limit so uart clks marginally |
13114 |
+@@ -2623,7 +2625,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
13115 |
+ */ |
13116 |
+ return uart_get_baud_rate(port, termios, old, |
13117 |
+ port->uartclk / 16 / UART_DIV_MAX, |
13118 |
+- port->uartclk); |
13119 |
++ (port->uartclk + tolerance) / 16); |
13120 |
+ } |
13121 |
+ |
13122 |
+ void |
13123 |
+diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c |
13124 |
+index 5685ba11480b..e701ab56b0a7 100644 |
13125 |
+--- a/drivers/usb/cdns3/cdns3-ti.c |
13126 |
++++ b/drivers/usb/cdns3/cdns3-ti.c |
13127 |
+@@ -138,7 +138,7 @@ static int cdns_ti_probe(struct platform_device *pdev) |
13128 |
+ error = pm_runtime_get_sync(dev); |
13129 |
+ if (error < 0) { |
13130 |
+ dev_err(dev, "pm_runtime_get_sync failed: %d\n", error); |
13131 |
+- goto err_get; |
13132 |
++ goto err; |
13133 |
+ } |
13134 |
+ |
13135 |
+ /* assert RESET */ |
13136 |
+@@ -185,7 +185,6 @@ static int cdns_ti_probe(struct platform_device *pdev) |
13137 |
+ |
13138 |
+ err: |
13139 |
+ pm_runtime_put_sync(data->dev); |
13140 |
+-err_get: |
13141 |
+ pm_runtime_disable(data->dev); |
13142 |
+ |
13143 |
+ return error; |
13144 |
+diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c |
13145 |
+index 0d8e3f3804a3..084c48c5848f 100644 |
13146 |
+--- a/drivers/usb/class/usblp.c |
13147 |
++++ b/drivers/usb/class/usblp.c |
13148 |
+@@ -468,7 +468,8 @@ static int usblp_release(struct inode *inode, struct file *file) |
13149 |
+ usb_autopm_put_interface(usblp->intf); |
13150 |
+ |
13151 |
+ if (!usblp->present) /* finish cleanup from disconnect */ |
13152 |
+- usblp_cleanup(usblp); |
13153 |
++ usblp_cleanup(usblp); /* any URBs must be dead */ |
13154 |
++ |
13155 |
+ mutex_unlock(&usblp_mutex); |
13156 |
+ return 0; |
13157 |
+ } |
13158 |
+@@ -1375,9 +1376,11 @@ static void usblp_disconnect(struct usb_interface *intf) |
13159 |
+ |
13160 |
+ usblp_unlink_urbs(usblp); |
13161 |
+ mutex_unlock(&usblp->mut); |
13162 |
++ usb_poison_anchored_urbs(&usblp->urbs); |
13163 |
+ |
13164 |
+ if (!usblp->used) |
13165 |
+ usblp_cleanup(usblp); |
13166 |
++ |
13167 |
+ mutex_unlock(&usblp_mutex); |
13168 |
+ } |
13169 |
+ |
13170 |
+diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c |
13171 |
+index 876ff31261d5..55f1d14fc414 100644 |
13172 |
+--- a/drivers/usb/dwc2/core_intr.c |
13173 |
++++ b/drivers/usb/dwc2/core_intr.c |
13174 |
+@@ -416,10 +416,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) |
13175 |
+ if (ret && (ret != -ENOTSUPP)) |
13176 |
+ dev_err(hsotg->dev, "exit power_down failed\n"); |
13177 |
+ |
13178 |
++ /* Change to L0 state */ |
13179 |
++ hsotg->lx_state = DWC2_L0; |
13180 |
+ call_gadget(hsotg, resume); |
13181 |
++ } else { |
13182 |
++ /* Change to L0 state */ |
13183 |
++ hsotg->lx_state = DWC2_L0; |
13184 |
+ } |
13185 |
+- /* Change to L0 state */ |
13186 |
+- hsotg->lx_state = DWC2_L0; |
13187 |
+ } else { |
13188 |
+ if (hsotg->params.power_down) |
13189 |
+ return; |
13190 |
+diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c |
13191 |
+index b81d085bc534..eabb3bb6fcaa 100644 |
13192 |
+--- a/drivers/usb/dwc3/dwc3-meson-g12a.c |
13193 |
++++ b/drivers/usb/dwc3/dwc3-meson-g12a.c |
13194 |
+@@ -505,7 +505,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
13195 |
+ if (IS_ERR(priv->reset)) { |
13196 |
+ ret = PTR_ERR(priv->reset); |
13197 |
+ dev_err(dev, "failed to get device reset, err=%d\n", ret); |
13198 |
+- return ret; |
13199 |
++ goto err_disable_clks; |
13200 |
+ } |
13201 |
+ |
13202 |
+ ret = reset_control_reset(priv->reset); |
13203 |
+@@ -525,7 +525,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
13204 |
+ /* Get dr_mode */ |
13205 |
+ priv->otg_mode = usb_get_dr_mode(dev); |
13206 |
+ |
13207 |
+- dwc3_meson_g12a_usb_init(priv); |
13208 |
++ ret = dwc3_meson_g12a_usb_init(priv); |
13209 |
++ if (ret) |
13210 |
++ goto err_disable_clks; |
13211 |
+ |
13212 |
+ /* Init PHYs */ |
13213 |
+ for (i = 0 ; i < PHY_COUNT ; ++i) { |
13214 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
13215 |
+index 585cb3deea7a..de3b92680935 100644 |
13216 |
+--- a/drivers/usb/dwc3/gadget.c |
13217 |
++++ b/drivers/usb/dwc3/gadget.c |
13218 |
+@@ -1220,6 +1220,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep) |
13219 |
+ } |
13220 |
+ } |
13221 |
+ |
13222 |
++static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep); |
13223 |
++ |
13224 |
+ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) |
13225 |
+ { |
13226 |
+ struct dwc3_gadget_ep_cmd_params params; |
13227 |
+@@ -1259,14 +1261,20 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) |
13228 |
+ |
13229 |
+ ret = dwc3_send_gadget_ep_cmd(dep, cmd, ¶ms); |
13230 |
+ if (ret < 0) { |
13231 |
+- /* |
13232 |
+- * FIXME we need to iterate over the list of requests |
13233 |
+- * here and stop, unmap, free and del each of the linked |
13234 |
+- * requests instead of what we do now. |
13235 |
+- */ |
13236 |
+- if (req->trb) |
13237 |
+- memset(req->trb, 0, sizeof(struct dwc3_trb)); |
13238 |
+- dwc3_gadget_del_and_unmap_request(dep, req, ret); |
13239 |
++ struct dwc3_request *tmp; |
13240 |
++ |
13241 |
++ if (ret == -EAGAIN) |
13242 |
++ return ret; |
13243 |
++ |
13244 |
++ dwc3_stop_active_transfer(dep, true, true); |
13245 |
++ |
13246 |
++ list_for_each_entry_safe(req, tmp, &dep->started_list, list) |
13247 |
++ dwc3_gadget_move_cancelled_request(req); |
13248 |
++ |
13249 |
++ /* If ep isn't started, then there's no end transfer pending */ |
13250 |
++ if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) |
13251 |
++ dwc3_gadget_ep_cleanup_cancelled_requests(dep); |
13252 |
++ |
13253 |
+ return ret; |
13254 |
+ } |
13255 |
+ |
13256 |
+@@ -1508,6 +1516,10 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r |
13257 |
+ { |
13258 |
+ int i; |
13259 |
+ |
13260 |
++ /* If req->trb is not set, then the request has not started */ |
13261 |
++ if (!req->trb) |
13262 |
++ return; |
13263 |
++ |
13264 |
+ /* |
13265 |
+ * If request was already started, this means we had to |
13266 |
+ * stop the transfer. With that we also need to ignore |
13267 |
+@@ -1598,6 +1610,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
13268 |
+ { |
13269 |
+ struct dwc3_gadget_ep_cmd_params params; |
13270 |
+ struct dwc3 *dwc = dep->dwc; |
13271 |
++ struct dwc3_request *req; |
13272 |
++ struct dwc3_request *tmp; |
13273 |
+ int ret; |
13274 |
+ |
13275 |
+ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { |
13276 |
+@@ -1634,13 +1648,37 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
13277 |
+ else |
13278 |
+ dep->flags |= DWC3_EP_STALL; |
13279 |
+ } else { |
13280 |
++ /* |
13281 |
++ * Don't issue CLEAR_STALL command to control endpoints. The |
13282 |
++ * controller automatically clears the STALL when it receives |
13283 |
++ * the SETUP token. |
13284 |
++ */ |
13285 |
++ if (dep->number <= 1) { |
13286 |
++ dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
13287 |
++ return 0; |
13288 |
++ } |
13289 |
+ |
13290 |
+ ret = dwc3_send_clear_stall_ep_cmd(dep); |
13291 |
+- if (ret) |
13292 |
++ if (ret) { |
13293 |
+ dev_err(dwc->dev, "failed to clear STALL on %s\n", |
13294 |
+ dep->name); |
13295 |
+- else |
13296 |
+- dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
13297 |
++ return ret; |
13298 |
++ } |
13299 |
++ |
13300 |
++ dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
13301 |
++ |
13302 |
++ dwc3_stop_active_transfer(dep, true, true); |
13303 |
++ |
13304 |
++ list_for_each_entry_safe(req, tmp, &dep->started_list, list) |
13305 |
++ dwc3_gadget_move_cancelled_request(req); |
13306 |
++ |
13307 |
++ list_for_each_entry_safe(req, tmp, &dep->pending_list, list) |
13308 |
++ dwc3_gadget_move_cancelled_request(req); |
13309 |
++ |
13310 |
++ if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) { |
13311 |
++ dep->flags &= ~DWC3_EP_DELAY_START; |
13312 |
++ dwc3_gadget_ep_cleanup_cancelled_requests(dep); |
13313 |
++ } |
13314 |
+ } |
13315 |
+ |
13316 |
+ return ret; |
13317 |
+diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
13318 |
+index cb4950cf1cdc..5c1eb96a5c57 100644 |
13319 |
+--- a/drivers/usb/gadget/composite.c |
13320 |
++++ b/drivers/usb/gadget/composite.c |
13321 |
+@@ -96,40 +96,43 @@ function_descriptors(struct usb_function *f, |
13322 |
+ } |
13323 |
+ |
13324 |
+ /** |
13325 |
+- * next_ep_desc() - advance to the next EP descriptor |
13326 |
++ * next_desc() - advance to the next desc_type descriptor |
13327 |
+ * @t: currect pointer within descriptor array |
13328 |
++ * @desc_type: descriptor type |
13329 |
+ * |
13330 |
+- * Return: next EP descriptor or NULL |
13331 |
++ * Return: next desc_type descriptor or NULL |
13332 |
+ * |
13333 |
+- * Iterate over @t until either EP descriptor found or |
13334 |
++ * Iterate over @t until either desc_type descriptor found or |
13335 |
+ * NULL (that indicates end of list) encountered |
13336 |
+ */ |
13337 |
+ static struct usb_descriptor_header** |
13338 |
+-next_ep_desc(struct usb_descriptor_header **t) |
13339 |
++next_desc(struct usb_descriptor_header **t, u8 desc_type) |
13340 |
+ { |
13341 |
+ for (; *t; t++) { |
13342 |
+- if ((*t)->bDescriptorType == USB_DT_ENDPOINT) |
13343 |
++ if ((*t)->bDescriptorType == desc_type) |
13344 |
+ return t; |
13345 |
+ } |
13346 |
+ return NULL; |
13347 |
+ } |
13348 |
+ |
13349 |
+ /* |
13350 |
+- * for_each_ep_desc()- iterate over endpoint descriptors in the |
13351 |
+- * descriptors list |
13352 |
+- * @start: pointer within descriptor array. |
13353 |
+- * @ep_desc: endpoint descriptor to use as the loop cursor |
13354 |
++ * for_each_desc() - iterate over desc_type descriptors in the |
13355 |
++ * descriptors list |
13356 |
++ * @start: pointer within descriptor array. |
13357 |
++ * @iter_desc: desc_type descriptor to use as the loop cursor |
13358 |
++ * @desc_type: wanted descriptr type |
13359 |
+ */ |
13360 |
+-#define for_each_ep_desc(start, ep_desc) \ |
13361 |
+- for (ep_desc = next_ep_desc(start); \ |
13362 |
+- ep_desc; ep_desc = next_ep_desc(ep_desc+1)) |
13363 |
++#define for_each_desc(start, iter_desc, desc_type) \ |
13364 |
++ for (iter_desc = next_desc(start, desc_type); \ |
13365 |
++ iter_desc; iter_desc = next_desc(iter_desc + 1, desc_type)) |
13366 |
+ |
13367 |
+ /** |
13368 |
+- * config_ep_by_speed() - configures the given endpoint |
13369 |
++ * config_ep_by_speed_and_alt() - configures the given endpoint |
13370 |
+ * according to gadget speed. |
13371 |
+ * @g: pointer to the gadget |
13372 |
+ * @f: usb function |
13373 |
+ * @_ep: the endpoint to configure |
13374 |
++ * @alt: alternate setting number |
13375 |
+ * |
13376 |
+ * Return: error code, 0 on success |
13377 |
+ * |
13378 |
+@@ -142,11 +145,13 @@ next_ep_desc(struct usb_descriptor_header **t) |
13379 |
+ * Note: the supplied function should hold all the descriptors |
13380 |
+ * for supported speeds |
13381 |
+ */ |
13382 |
+-int config_ep_by_speed(struct usb_gadget *g, |
13383 |
+- struct usb_function *f, |
13384 |
+- struct usb_ep *_ep) |
13385 |
++int config_ep_by_speed_and_alt(struct usb_gadget *g, |
13386 |
++ struct usb_function *f, |
13387 |
++ struct usb_ep *_ep, |
13388 |
++ u8 alt) |
13389 |
+ { |
13390 |
+ struct usb_endpoint_descriptor *chosen_desc = NULL; |
13391 |
++ struct usb_interface_descriptor *int_desc = NULL; |
13392 |
+ struct usb_descriptor_header **speed_desc = NULL; |
13393 |
+ |
13394 |
+ struct usb_ss_ep_comp_descriptor *comp_desc = NULL; |
13395 |
+@@ -182,8 +187,21 @@ int config_ep_by_speed(struct usb_gadget *g, |
13396 |
+ default: |
13397 |
+ speed_desc = f->fs_descriptors; |
13398 |
+ } |
13399 |
++ |
13400 |
++ /* find correct alternate setting descriptor */ |
13401 |
++ for_each_desc(speed_desc, d_spd, USB_DT_INTERFACE) { |
13402 |
++ int_desc = (struct usb_interface_descriptor *)*d_spd; |
13403 |
++ |
13404 |
++ if (int_desc->bAlternateSetting == alt) { |
13405 |
++ speed_desc = d_spd; |
13406 |
++ goto intf_found; |
13407 |
++ } |
13408 |
++ } |
13409 |
++ return -EIO; |
13410 |
++ |
13411 |
++intf_found: |
13412 |
+ /* find descriptors */ |
13413 |
+- for_each_ep_desc(speed_desc, d_spd) { |
13414 |
++ for_each_desc(speed_desc, d_spd, USB_DT_ENDPOINT) { |
13415 |
+ chosen_desc = (struct usb_endpoint_descriptor *)*d_spd; |
13416 |
+ if (chosen_desc->bEndpointAddress == _ep->address) |
13417 |
+ goto ep_found; |
13418 |
+@@ -237,6 +255,32 @@ ep_found: |
13419 |
+ } |
13420 |
+ return 0; |
13421 |
+ } |
13422 |
++EXPORT_SYMBOL_GPL(config_ep_by_speed_and_alt); |
13423 |
++ |
13424 |
++/** |
13425 |
++ * config_ep_by_speed() - configures the given endpoint |
13426 |
++ * according to gadget speed. |
13427 |
++ * @g: pointer to the gadget |
13428 |
++ * @f: usb function |
13429 |
++ * @_ep: the endpoint to configure |
13430 |
++ * |
13431 |
++ * Return: error code, 0 on success |
13432 |
++ * |
13433 |
++ * This function chooses the right descriptors for a given |
13434 |
++ * endpoint according to gadget speed and saves it in the |
13435 |
++ * endpoint desc field. If the endpoint already has a descriptor |
13436 |
++ * assigned to it - overwrites it with currently corresponding |
13437 |
++ * descriptor. The endpoint maxpacket field is updated according |
13438 |
++ * to the chosen descriptor. |
13439 |
++ * Note: the supplied function should hold all the descriptors |
13440 |
++ * for supported speeds |
13441 |
++ */ |
13442 |
++int config_ep_by_speed(struct usb_gadget *g, |
13443 |
++ struct usb_function *f, |
13444 |
++ struct usb_ep *_ep) |
13445 |
++{ |
13446 |
++ return config_ep_by_speed_and_alt(g, f, _ep, 0); |
13447 |
++} |
13448 |
+ EXPORT_SYMBOL_GPL(config_ep_by_speed); |
13449 |
+ |
13450 |
+ /** |
13451 |
+diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c |
13452 |
+index 9b11046480fe..2e28dde8376f 100644 |
13453 |
+--- a/drivers/usb/gadget/udc/core.c |
13454 |
++++ b/drivers/usb/gadget/udc/core.c |
13455 |
+@@ -1297,6 +1297,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) |
13456 |
+ kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); |
13457 |
+ |
13458 |
+ usb_gadget_disconnect(udc->gadget); |
13459 |
++ if (udc->gadget->irq) |
13460 |
++ synchronize_irq(udc->gadget->irq); |
13461 |
+ udc->driver->unbind(udc->gadget); |
13462 |
+ usb_gadget_udc_stop(udc); |
13463 |
+ |
13464 |
+diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c |
13465 |
+index cb997b82c008..465d0b7c6522 100644 |
13466 |
+--- a/drivers/usb/gadget/udc/lpc32xx_udc.c |
13467 |
++++ b/drivers/usb/gadget/udc/lpc32xx_udc.c |
13468 |
+@@ -1614,17 +1614,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep, |
13469 |
+ const struct usb_endpoint_descriptor *desc) |
13470 |
+ { |
13471 |
+ struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); |
13472 |
+- struct lpc32xx_udc *udc = ep->udc; |
13473 |
++ struct lpc32xx_udc *udc; |
13474 |
+ u16 maxpacket; |
13475 |
+ u32 tmp; |
13476 |
+ unsigned long flags; |
13477 |
+ |
13478 |
+ /* Verify EP data */ |
13479 |
+ if ((!_ep) || (!ep) || (!desc) || |
13480 |
+- (desc->bDescriptorType != USB_DT_ENDPOINT)) { |
13481 |
+- dev_dbg(udc->dev, "bad ep or descriptor\n"); |
13482 |
++ (desc->bDescriptorType != USB_DT_ENDPOINT)) |
13483 |
+ return -EINVAL; |
13484 |
+- } |
13485 |
++ |
13486 |
++ udc = ep->udc; |
13487 |
+ maxpacket = usb_endpoint_maxp(desc); |
13488 |
+ if ((maxpacket == 0) || (maxpacket > ep->maxpacket)) { |
13489 |
+ dev_dbg(udc->dev, "bad ep descriptor's packet size\n"); |
13490 |
+@@ -1872,7 +1872,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
13491 |
+ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) |
13492 |
+ { |
13493 |
+ struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); |
13494 |
+- struct lpc32xx_udc *udc = ep->udc; |
13495 |
++ struct lpc32xx_udc *udc; |
13496 |
+ unsigned long flags; |
13497 |
+ |
13498 |
+ if ((!ep) || (ep->hwep_num <= 1)) |
13499 |
+@@ -1882,6 +1882,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) |
13500 |
+ if (ep->is_in) |
13501 |
+ return -EAGAIN; |
13502 |
+ |
13503 |
++ udc = ep->udc; |
13504 |
+ spin_lock_irqsave(&udc->lock, flags); |
13505 |
+ |
13506 |
+ if (value == 1) { |
13507 |
+diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c |
13508 |
+index 75d16a8902e6..931e6362a13d 100644 |
13509 |
+--- a/drivers/usb/gadget/udc/m66592-udc.c |
13510 |
++++ b/drivers/usb/gadget/udc/m66592-udc.c |
13511 |
+@@ -1667,7 +1667,7 @@ static int m66592_probe(struct platform_device *pdev) |
13512 |
+ |
13513 |
+ err_add_udc: |
13514 |
+ m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); |
13515 |
+- |
13516 |
++ m66592->ep0_req = NULL; |
13517 |
+ clean_up3: |
13518 |
+ if (m66592->pdata->on_chip) { |
13519 |
+ clk_disable(m66592->clk); |
13520 |
+diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c |
13521 |
+index 0507a2ca0f55..80002d97b59d 100644 |
13522 |
+--- a/drivers/usb/gadget/udc/s3c2410_udc.c |
13523 |
++++ b/drivers/usb/gadget/udc/s3c2410_udc.c |
13524 |
+@@ -251,10 +251,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep, |
13525 |
+ static void s3c2410_udc_nuke(struct s3c2410_udc *udc, |
13526 |
+ struct s3c2410_ep *ep, int status) |
13527 |
+ { |
13528 |
+- /* Sanity check */ |
13529 |
+- if (&ep->queue == NULL) |
13530 |
+- return; |
13531 |
+- |
13532 |
+ while (!list_empty(&ep->queue)) { |
13533 |
+ struct s3c2410_request *req; |
13534 |
+ req = list_entry(ep->queue.next, struct s3c2410_request, |
13535 |
+diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c |
13536 |
+index c9f91e6c72b6..7f65c86047dd 100644 |
13537 |
+--- a/drivers/usb/host/ehci-mxc.c |
13538 |
++++ b/drivers/usb/host/ehci-mxc.c |
13539 |
+@@ -50,6 +50,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) |
13540 |
+ } |
13541 |
+ |
13542 |
+ irq = platform_get_irq(pdev, 0); |
13543 |
++ if (irq < 0) |
13544 |
++ return irq; |
13545 |
+ |
13546 |
+ hcd = usb_create_hcd(&ehci_mxc_hc_driver, dev, dev_name(dev)); |
13547 |
+ if (!hcd) |
13548 |
+diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c |
13549 |
+index e4fc3f66d43b..e9a49007cce4 100644 |
13550 |
+--- a/drivers/usb/host/ehci-platform.c |
13551 |
++++ b/drivers/usb/host/ehci-platform.c |
13552 |
+@@ -455,6 +455,10 @@ static int ehci_platform_resume(struct device *dev) |
13553 |
+ |
13554 |
+ ehci_resume(hcd, priv->reset_on_resume); |
13555 |
+ |
13556 |
++ pm_runtime_disable(dev); |
13557 |
++ pm_runtime_set_active(dev); |
13558 |
++ pm_runtime_enable(dev); |
13559 |
++ |
13560 |
+ if (priv->quirk_poll) |
13561 |
+ quirk_poll_init(priv); |
13562 |
+ |
13563 |
+diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c |
13564 |
+index 7addfc2cbadc..4a8456f12a73 100644 |
13565 |
+--- a/drivers/usb/host/ohci-platform.c |
13566 |
++++ b/drivers/usb/host/ohci-platform.c |
13567 |
+@@ -299,6 +299,11 @@ static int ohci_platform_resume(struct device *dev) |
13568 |
+ } |
13569 |
+ |
13570 |
+ ohci_resume(hcd, false); |
13571 |
++ |
13572 |
++ pm_runtime_disable(dev); |
13573 |
++ pm_runtime_set_active(dev); |
13574 |
++ pm_runtime_enable(dev); |
13575 |
++ |
13576 |
+ return 0; |
13577 |
+ } |
13578 |
+ #endif /* CONFIG_PM_SLEEP */ |
13579 |
+diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c |
13580 |
+index c158cda9e4b9..cff965240327 100644 |
13581 |
+--- a/drivers/usb/host/ohci-sm501.c |
13582 |
++++ b/drivers/usb/host/ohci-sm501.c |
13583 |
+@@ -157,9 +157,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) |
13584 |
+ * the call to usb_hcd_setup_local_mem() below does just that. |
13585 |
+ */ |
13586 |
+ |
13587 |
+- if (usb_hcd_setup_local_mem(hcd, mem->start, |
13588 |
+- mem->start - mem->parent->start, |
13589 |
+- resource_size(mem)) < 0) |
13590 |
++ retval = usb_hcd_setup_local_mem(hcd, mem->start, |
13591 |
++ mem->start - mem->parent->start, |
13592 |
++ resource_size(mem)); |
13593 |
++ if (retval < 0) |
13594 |
+ goto err5; |
13595 |
+ retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
13596 |
+ if (retval) |
13597 |
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c |
13598 |
+index ea460b9682d5..ca82e2c61ddc 100644 |
13599 |
+--- a/drivers/usb/host/xhci-plat.c |
13600 |
++++ b/drivers/usb/host/xhci-plat.c |
13601 |
+@@ -409,7 +409,15 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) |
13602 |
+ if (ret) |
13603 |
+ return ret; |
13604 |
+ |
13605 |
+- return xhci_resume(xhci, 0); |
13606 |
++ ret = xhci_resume(xhci, 0); |
13607 |
++ if (ret) |
13608 |
++ return ret; |
13609 |
++ |
13610 |
++ pm_runtime_disable(dev); |
13611 |
++ pm_runtime_set_active(dev); |
13612 |
++ pm_runtime_enable(dev); |
13613 |
++ |
13614 |
++ return 0; |
13615 |
+ } |
13616 |
+ |
13617 |
+ static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) |
13618 |
+diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c |
13619 |
+index 5b17709821df..27d92af29635 100644 |
13620 |
+--- a/drivers/usb/roles/class.c |
13621 |
++++ b/drivers/usb/roles/class.c |
13622 |
+@@ -49,8 +49,10 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role) |
13623 |
+ mutex_lock(&sw->lock); |
13624 |
+ |
13625 |
+ ret = sw->set(sw, role); |
13626 |
+- if (!ret) |
13627 |
++ if (!ret) { |
13628 |
+ sw->role = role; |
13629 |
++ kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE); |
13630 |
++ } |
13631 |
+ |
13632 |
+ mutex_unlock(&sw->lock); |
13633 |
+ |
13634 |
+diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c |
13635 |
+index 8ad14e5c02bf..917fd84c1c6f 100644 |
13636 |
+--- a/drivers/vfio/mdev/mdev_sysfs.c |
13637 |
++++ b/drivers/vfio/mdev/mdev_sysfs.c |
13638 |
+@@ -110,7 +110,7 @@ static struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent, |
13639 |
+ "%s-%s", dev_driver_string(parent->dev), |
13640 |
+ group->name); |
13641 |
+ if (ret) { |
13642 |
+- kfree(type); |
13643 |
++ kobject_put(&type->kobj); |
13644 |
+ return ERR_PTR(ret); |
13645 |
+ } |
13646 |
+ |
13647 |
+diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c |
13648 |
+index 90c0b80f8acf..814bcbe0dd4e 100644 |
13649 |
+--- a/drivers/vfio/pci/vfio_pci_config.c |
13650 |
++++ b/drivers/vfio/pci/vfio_pci_config.c |
13651 |
+@@ -1462,7 +1462,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev) |
13652 |
+ if (ret) |
13653 |
+ return ret; |
13654 |
+ |
13655 |
+- if (cap <= PCI_CAP_ID_MAX) { |
13656 |
++ /* |
13657 |
++ * ID 0 is a NULL capability, conflicting with our fake |
13658 |
++ * PCI_CAP_ID_BASIC. As it has no content, consider it |
13659 |
++ * hidden for now. |
13660 |
++ */ |
13661 |
++ if (cap && cap <= PCI_CAP_ID_MAX) { |
13662 |
+ len = pci_cap_length[cap]; |
13663 |
+ if (len == 0xFF) { /* Variable length */ |
13664 |
+ len = vfio_cap_len(vdev, cap, pos); |
13665 |
+@@ -1728,8 +1733,11 @@ void vfio_config_free(struct vfio_pci_device *vdev) |
13666 |
+ vdev->vconfig = NULL; |
13667 |
+ kfree(vdev->pci_config_map); |
13668 |
+ vdev->pci_config_map = NULL; |
13669 |
+- kfree(vdev->msi_perm); |
13670 |
+- vdev->msi_perm = NULL; |
13671 |
++ if (vdev->msi_perm) { |
13672 |
++ free_perm_bits(vdev->msi_perm); |
13673 |
++ kfree(vdev->msi_perm); |
13674 |
++ vdev->msi_perm = NULL; |
13675 |
++ } |
13676 |
+ } |
13677 |
+ |
13678 |
+ /* |
13679 |
+diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
13680 |
+index c39952243fd3..8b104f76f324 100644 |
13681 |
+--- a/drivers/vhost/scsi.c |
13682 |
++++ b/drivers/vhost/scsi.c |
13683 |
+@@ -2280,6 +2280,7 @@ static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { |
13684 |
+ static const struct target_core_fabric_ops vhost_scsi_ops = { |
13685 |
+ .module = THIS_MODULE, |
13686 |
+ .fabric_name = "vhost", |
13687 |
++ .max_data_sg_nents = VHOST_SCSI_PREALLOC_SGLS, |
13688 |
+ .tpg_get_wwn = vhost_scsi_get_fabric_wwn, |
13689 |
+ .tpg_get_tag = vhost_scsi_get_tpgt, |
13690 |
+ .tpg_check_demo_mode = vhost_scsi_check_true, |
13691 |
+diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c |
13692 |
+index f68920131a4a..e94932c69f54 100644 |
13693 |
+--- a/drivers/video/backlight/lp855x_bl.c |
13694 |
++++ b/drivers/video/backlight/lp855x_bl.c |
13695 |
+@@ -456,7 +456,7 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) |
13696 |
+ ret = regulator_enable(lp->enable); |
13697 |
+ if (ret < 0) { |
13698 |
+ dev_err(lp->dev, "failed to enable vddio: %d\n", ret); |
13699 |
+- return ret; |
13700 |
++ goto disable_supply; |
13701 |
+ } |
13702 |
+ |
13703 |
+ /* |
13704 |
+@@ -471,24 +471,34 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) |
13705 |
+ ret = lp855x_configure(lp); |
13706 |
+ if (ret) { |
13707 |
+ dev_err(lp->dev, "device config err: %d", ret); |
13708 |
+- return ret; |
13709 |
++ goto disable_vddio; |
13710 |
+ } |
13711 |
+ |
13712 |
+ ret = lp855x_backlight_register(lp); |
13713 |
+ if (ret) { |
13714 |
+ dev_err(lp->dev, |
13715 |
+ "failed to register backlight. err: %d\n", ret); |
13716 |
+- return ret; |
13717 |
++ goto disable_vddio; |
13718 |
+ } |
13719 |
+ |
13720 |
+ ret = sysfs_create_group(&lp->dev->kobj, &lp855x_attr_group); |
13721 |
+ if (ret) { |
13722 |
+ dev_err(lp->dev, "failed to register sysfs. err: %d\n", ret); |
13723 |
+- return ret; |
13724 |
++ goto disable_vddio; |
13725 |
+ } |
13726 |
+ |
13727 |
+ backlight_update_status(lp->bl); |
13728 |
++ |
13729 |
+ return 0; |
13730 |
++ |
13731 |
++disable_vddio: |
13732 |
++ if (lp->enable) |
13733 |
++ regulator_disable(lp->enable); |
13734 |
++disable_supply: |
13735 |
++ if (lp->supply) |
13736 |
++ regulator_disable(lp->supply); |
13737 |
++ |
13738 |
++ return ret; |
13739 |
+ } |
13740 |
+ |
13741 |
+ static int lp855x_remove(struct i2c_client *cl) |
13742 |
+@@ -497,6 +507,8 @@ static int lp855x_remove(struct i2c_client *cl) |
13743 |
+ |
13744 |
+ lp->bl->props.brightness = 0; |
13745 |
+ backlight_update_status(lp->bl); |
13746 |
++ if (lp->enable) |
13747 |
++ regulator_disable(lp->enable); |
13748 |
+ if (lp->supply) |
13749 |
+ regulator_disable(lp->supply); |
13750 |
+ sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); |
13751 |
+diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c |
13752 |
+index 0ad15d55071c..18dec438d518 100644 |
13753 |
+--- a/drivers/watchdog/da9062_wdt.c |
13754 |
++++ b/drivers/watchdog/da9062_wdt.c |
13755 |
+@@ -58,11 +58,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt, |
13756 |
+ unsigned int regval) |
13757 |
+ { |
13758 |
+ struct da9062 *chip = wdt->hw; |
13759 |
+- int ret; |
13760 |
+- |
13761 |
+- ret = da9062_reset_watchdog_timer(wdt); |
13762 |
+- if (ret) |
13763 |
+- return ret; |
13764 |
+ |
13765 |
+ regmap_update_bits(chip->regmap, |
13766 |
+ DA9062AA_CONTROL_D, |
13767 |
+diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c |
13768 |
+index ec975decb5de..b96b11e2b571 100644 |
13769 |
+--- a/drivers/xen/cpu_hotplug.c |
13770 |
++++ b/drivers/xen/cpu_hotplug.c |
13771 |
+@@ -93,10 +93,8 @@ static int setup_cpu_watcher(struct notifier_block *notifier, |
13772 |
+ (void)register_xenbus_watch(&cpu_watch); |
13773 |
+ |
13774 |
+ for_each_possible_cpu(cpu) { |
13775 |
+- if (vcpu_online(cpu) == 0) { |
13776 |
+- device_offline(get_cpu_device(cpu)); |
13777 |
+- set_cpu_present(cpu, false); |
13778 |
+- } |
13779 |
++ if (vcpu_online(cpu) == 0) |
13780 |
++ disable_hotplug_cpu(cpu); |
13781 |
+ } |
13782 |
+ |
13783 |
+ return NOTIFY_DONE; |
13784 |
+@@ -119,5 +117,5 @@ static int __init setup_vcpu_hotplug_event(void) |
13785 |
+ return 0; |
13786 |
+ } |
13787 |
+ |
13788 |
+-arch_initcall(setup_vcpu_hotplug_event); |
13789 |
++late_initcall(setup_vcpu_hotplug_event); |
13790 |
+ |
13791 |
+diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c |
13792 |
+index 380ad5ace7cf..3a9b8b1f5f2b 100644 |
13793 |
+--- a/fs/afs/cmservice.c |
13794 |
++++ b/fs/afs/cmservice.c |
13795 |
+@@ -305,8 +305,7 @@ static int afs_deliver_cb_callback(struct afs_call *call) |
13796 |
+ call->count = ntohl(call->tmp); |
13797 |
+ _debug("FID count: %u", call->count); |
13798 |
+ if (call->count > AFSCBMAX) |
13799 |
+- return afs_protocol_error(call, -EBADMSG, |
13800 |
+- afs_eproto_cb_fid_count); |
13801 |
++ return afs_protocol_error(call, afs_eproto_cb_fid_count); |
13802 |
+ |
13803 |
+ call->buffer = kmalloc(array3_size(call->count, 3, 4), |
13804 |
+ GFP_KERNEL); |
13805 |
+@@ -351,8 +350,7 @@ static int afs_deliver_cb_callback(struct afs_call *call) |
13806 |
+ call->count2 = ntohl(call->tmp); |
13807 |
+ _debug("CB count: %u", call->count2); |
13808 |
+ if (call->count2 != call->count && call->count2 != 0) |
13809 |
+- return afs_protocol_error(call, -EBADMSG, |
13810 |
+- afs_eproto_cb_count); |
13811 |
++ return afs_protocol_error(call, afs_eproto_cb_count); |
13812 |
+ call->iter = &call->def_iter; |
13813 |
+ iov_iter_discard(&call->def_iter, READ, call->count2 * 3 * 4); |
13814 |
+ call->unmarshall++; |
13815 |
+@@ -672,8 +670,7 @@ static int afs_deliver_yfs_cb_callback(struct afs_call *call) |
13816 |
+ call->count = ntohl(call->tmp); |
13817 |
+ _debug("FID count: %u", call->count); |
13818 |
+ if (call->count > YFSCBMAX) |
13819 |
+- return afs_protocol_error(call, -EBADMSG, |
13820 |
+- afs_eproto_cb_fid_count); |
13821 |
++ return afs_protocol_error(call, afs_eproto_cb_fid_count); |
13822 |
+ |
13823 |
+ size = array_size(call->count, sizeof(struct yfs_xdr_YFSFid)); |
13824 |
+ call->buffer = kmalloc(size, GFP_KERNEL); |
13825 |
+diff --git a/fs/afs/dir.c b/fs/afs/dir.c |
13826 |
+index d1e1caa23c8b..3c486340b220 100644 |
13827 |
+--- a/fs/afs/dir.c |
13828 |
++++ b/fs/afs/dir.c |
13829 |
+@@ -658,7 +658,8 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, |
13830 |
+ |
13831 |
+ cookie->ctx.actor = afs_lookup_filldir; |
13832 |
+ cookie->name = dentry->d_name; |
13833 |
+- cookie->nr_fids = 1; /* slot 0 is saved for the fid we actually want */ |
13834 |
++ cookie->nr_fids = 2; /* slot 0 is saved for the fid we actually want |
13835 |
++ * and slot 1 for the directory */ |
13836 |
+ |
13837 |
+ read_seqlock_excl(&dvnode->cb_lock); |
13838 |
+ dcbi = rcu_dereference_protected(dvnode->cb_interest, |
13839 |
+@@ -709,7 +710,11 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, |
13840 |
+ if (!cookie->inodes) |
13841 |
+ goto out_s; |
13842 |
+ |
13843 |
+- for (i = 1; i < cookie->nr_fids; i++) { |
13844 |
++ cookie->fids[1] = dvnode->fid; |
13845 |
++ cookie->statuses[1].cb_break = afs_calc_vnode_cb_break(dvnode); |
13846 |
++ cookie->inodes[1] = igrab(&dvnode->vfs_inode); |
13847 |
++ |
13848 |
++ for (i = 2; i < cookie->nr_fids; i++) { |
13849 |
+ scb = &cookie->statuses[i]; |
13850 |
+ |
13851 |
+ /* Find any inodes that already exist and get their |
13852 |
+diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c |
13853 |
+index d2b3798c1932..7bca0c13d0c4 100644 |
13854 |
+--- a/fs/afs/fsclient.c |
13855 |
++++ b/fs/afs/fsclient.c |
13856 |
+@@ -56,16 +56,15 @@ static void xdr_dump_bad(const __be32 *bp) |
13857 |
+ /* |
13858 |
+ * decode an AFSFetchStatus block |
13859 |
+ */ |
13860 |
+-static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13861 |
+- struct afs_call *call, |
13862 |
+- struct afs_status_cb *scb) |
13863 |
++static void xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13864 |
++ struct afs_call *call, |
13865 |
++ struct afs_status_cb *scb) |
13866 |
+ { |
13867 |
+ const struct afs_xdr_AFSFetchStatus *xdr = (const void *)*_bp; |
13868 |
+ struct afs_file_status *status = &scb->status; |
13869 |
+ bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); |
13870 |
+ u64 data_version, size; |
13871 |
+ u32 type, abort_code; |
13872 |
+- int ret; |
13873 |
+ |
13874 |
+ abort_code = ntohl(xdr->abort_code); |
13875 |
+ |
13876 |
+@@ -79,7 +78,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13877 |
+ */ |
13878 |
+ status->abort_code = abort_code; |
13879 |
+ scb->have_error = true; |
13880 |
+- goto good; |
13881 |
++ goto advance; |
13882 |
+ } |
13883 |
+ |
13884 |
+ pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); |
13885 |
+@@ -89,7 +88,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13886 |
+ if (abort_code != 0 && inline_error) { |
13887 |
+ status->abort_code = abort_code; |
13888 |
+ scb->have_error = true; |
13889 |
+- goto good; |
13890 |
++ goto advance; |
13891 |
+ } |
13892 |
+ |
13893 |
+ type = ntohl(xdr->type); |
13894 |
+@@ -125,15 +124,13 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13895 |
+ data_version |= (u64)ntohl(xdr->data_version_hi) << 32; |
13896 |
+ status->data_version = data_version; |
13897 |
+ scb->have_status = true; |
13898 |
+-good: |
13899 |
+- ret = 0; |
13900 |
+ advance: |
13901 |
+ *_bp = (const void *)*_bp + sizeof(*xdr); |
13902 |
+- return ret; |
13903 |
++ return; |
13904 |
+ |
13905 |
+ bad: |
13906 |
+ xdr_dump_bad(*_bp); |
13907 |
+- ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
13908 |
++ afs_protocol_error(call, afs_eproto_bad_status); |
13909 |
+ goto advance; |
13910 |
+ } |
13911 |
+ |
13912 |
+@@ -254,9 +251,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) |
13913 |
+ |
13914 |
+ /* unmarshall the reply once we've received all of it */ |
13915 |
+ bp = call->buffer; |
13916 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13917 |
+- if (ret < 0) |
13918 |
+- return ret; |
13919 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13920 |
+ xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
13921 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13922 |
+ |
13923 |
+@@ -419,9 +414,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) |
13924 |
+ return ret; |
13925 |
+ |
13926 |
+ bp = call->buffer; |
13927 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13928 |
+- if (ret < 0) |
13929 |
+- return ret; |
13930 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13931 |
+ xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
13932 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13933 |
+ |
13934 |
+@@ -577,12 +570,8 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call) |
13935 |
+ /* unmarshall the reply once we've received all of it */ |
13936 |
+ bp = call->buffer; |
13937 |
+ xdr_decode_AFSFid(&bp, call->out_fid); |
13938 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13939 |
+- if (ret < 0) |
13940 |
+- return ret; |
13941 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13942 |
+- if (ret < 0) |
13943 |
+- return ret; |
13944 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13945 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13946 |
+ xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
13947 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13948 |
+ |
13949 |
+@@ -691,9 +680,7 @@ static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call) |
13950 |
+ |
13951 |
+ /* unmarshall the reply once we've received all of it */ |
13952 |
+ bp = call->buffer; |
13953 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13954 |
+- if (ret < 0) |
13955 |
+- return ret; |
13956 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13957 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13958 |
+ |
13959 |
+ _leave(" = 0 [done]"); |
13960 |
+@@ -784,12 +771,8 @@ static int afs_deliver_fs_link(struct afs_call *call) |
13961 |
+ |
13962 |
+ /* unmarshall the reply once we've received all of it */ |
13963 |
+ bp = call->buffer; |
13964 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13965 |
+- if (ret < 0) |
13966 |
+- return ret; |
13967 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13968 |
+- if (ret < 0) |
13969 |
+- return ret; |
13970 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13971 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13972 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13973 |
+ |
13974 |
+ _leave(" = 0 [done]"); |
13975 |
+@@ -878,12 +861,8 @@ static int afs_deliver_fs_symlink(struct afs_call *call) |
13976 |
+ /* unmarshall the reply once we've received all of it */ |
13977 |
+ bp = call->buffer; |
13978 |
+ xdr_decode_AFSFid(&bp, call->out_fid); |
13979 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13980 |
+- if (ret < 0) |
13981 |
+- return ret; |
13982 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13983 |
+- if (ret < 0) |
13984 |
+- return ret; |
13985 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13986 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13987 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13988 |
+ |
13989 |
+ _leave(" = 0 [done]"); |
13990 |
+@@ -986,16 +965,12 @@ static int afs_deliver_fs_rename(struct afs_call *call) |
13991 |
+ if (ret < 0) |
13992 |
+ return ret; |
13993 |
+ |
13994 |
++ bp = call->buffer; |
13995 |
+ /* If the two dirs are the same, we have two copies of the same status |
13996 |
+ * report, so we just decode it twice. |
13997 |
+ */ |
13998 |
+- bp = call->buffer; |
13999 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
14000 |
+- if (ret < 0) |
14001 |
+- return ret; |
14002 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14003 |
+- if (ret < 0) |
14004 |
+- return ret; |
14005 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
14006 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14007 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14008 |
+ |
14009 |
+ _leave(" = 0 [done]"); |
14010 |
+@@ -1103,9 +1078,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call) |
14011 |
+ |
14012 |
+ /* unmarshall the reply once we've received all of it */ |
14013 |
+ bp = call->buffer; |
14014 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14015 |
+- if (ret < 0) |
14016 |
+- return ret; |
14017 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14018 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14019 |
+ |
14020 |
+ _leave(" = 0 [done]"); |
14021 |
+@@ -1283,9 +1256,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call) |
14022 |
+ |
14023 |
+ /* unmarshall the reply once we've received all of it */ |
14024 |
+ bp = call->buffer; |
14025 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14026 |
+- if (ret < 0) |
14027 |
+- return ret; |
14028 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14029 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14030 |
+ |
14031 |
+ _leave(" = 0 [done]"); |
14032 |
+@@ -1499,8 +1470,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) |
14033 |
+ call->count = ntohl(call->tmp); |
14034 |
+ _debug("volname length: %u", call->count); |
14035 |
+ if (call->count >= AFSNAMEMAX) |
14036 |
+- return afs_protocol_error(call, -EBADMSG, |
14037 |
+- afs_eproto_volname_len); |
14038 |
++ return afs_protocol_error(call, afs_eproto_volname_len); |
14039 |
+ size = (call->count + 3) & ~3; /* It's padded */ |
14040 |
+ afs_extract_to_buf(call, size); |
14041 |
+ call->unmarshall++; |
14042 |
+@@ -1529,8 +1499,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) |
14043 |
+ call->count = ntohl(call->tmp); |
14044 |
+ _debug("offline msg length: %u", call->count); |
14045 |
+ if (call->count >= AFSNAMEMAX) |
14046 |
+- return afs_protocol_error(call, -EBADMSG, |
14047 |
+- afs_eproto_offline_msg_len); |
14048 |
++ return afs_protocol_error(call, afs_eproto_offline_msg_len); |
14049 |
+ size = (call->count + 3) & ~3; /* It's padded */ |
14050 |
+ afs_extract_to_buf(call, size); |
14051 |
+ call->unmarshall++; |
14052 |
+@@ -1560,8 +1529,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) |
14053 |
+ call->count = ntohl(call->tmp); |
14054 |
+ _debug("motd length: %u", call->count); |
14055 |
+ if (call->count >= AFSNAMEMAX) |
14056 |
+- return afs_protocol_error(call, -EBADMSG, |
14057 |
+- afs_eproto_motd_len); |
14058 |
++ return afs_protocol_error(call, afs_eproto_motd_len); |
14059 |
+ size = (call->count + 3) & ~3; /* It's padded */ |
14060 |
+ afs_extract_to_buf(call, size); |
14061 |
+ call->unmarshall++; |
14062 |
+@@ -1954,9 +1922,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call) |
14063 |
+ |
14064 |
+ /* unmarshall the reply once we've received all of it */ |
14065 |
+ bp = call->buffer; |
14066 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14067 |
+- if (ret < 0) |
14068 |
+- return ret; |
14069 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14070 |
+ xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
14071 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14072 |
+ |
14073 |
+@@ -2045,8 +2011,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14074 |
+ tmp = ntohl(call->tmp); |
14075 |
+ _debug("status count: %u/%u", tmp, call->count2); |
14076 |
+ if (tmp != call->count2) |
14077 |
+- return afs_protocol_error(call, -EBADMSG, |
14078 |
+- afs_eproto_ibulkst_count); |
14079 |
++ return afs_protocol_error(call, afs_eproto_ibulkst_count); |
14080 |
+ |
14081 |
+ call->count = 0; |
14082 |
+ call->unmarshall++; |
14083 |
+@@ -2062,10 +2027,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14084 |
+ |
14085 |
+ bp = call->buffer; |
14086 |
+ scb = &call->out_scb[call->count]; |
14087 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, scb); |
14088 |
+- if (ret < 0) |
14089 |
+- return ret; |
14090 |
+- |
14091 |
++ xdr_decode_AFSFetchStatus(&bp, call, scb); |
14092 |
+ call->count++; |
14093 |
+ if (call->count < call->count2) |
14094 |
+ goto more_counts; |
14095 |
+@@ -2085,8 +2047,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14096 |
+ tmp = ntohl(call->tmp); |
14097 |
+ _debug("CB count: %u", tmp); |
14098 |
+ if (tmp != call->count2) |
14099 |
+- return afs_protocol_error(call, -EBADMSG, |
14100 |
+- afs_eproto_ibulkst_cb_count); |
14101 |
++ return afs_protocol_error(call, afs_eproto_ibulkst_cb_count); |
14102 |
+ call->count = 0; |
14103 |
+ call->unmarshall++; |
14104 |
+ more_cbs: |
14105 |
+@@ -2243,9 +2204,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call) |
14106 |
+ return ret; |
14107 |
+ |
14108 |
+ bp = call->buffer; |
14109 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14110 |
+- if (ret < 0) |
14111 |
+- return ret; |
14112 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14113 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14114 |
+ |
14115 |
+ call->unmarshall++; |
14116 |
+@@ -2326,9 +2285,7 @@ static int afs_deliver_fs_file_status_and_vol(struct afs_call *call) |
14117 |
+ return ret; |
14118 |
+ |
14119 |
+ bp = call->buffer; |
14120 |
+- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14121 |
+- if (ret < 0) |
14122 |
+- return ret; |
14123 |
++ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14124 |
+ xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14125 |
+ |
14126 |
+ _leave(" = 0 [done]"); |
14127 |
+diff --git a/fs/afs/inode.c b/fs/afs/inode.c |
14128 |
+index 281470fe1183..d7b65fad6679 100644 |
14129 |
+--- a/fs/afs/inode.c |
14130 |
++++ b/fs/afs/inode.c |
14131 |
+@@ -130,7 +130,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key, |
14132 |
+ default: |
14133 |
+ dump_vnode(vnode, parent_vnode); |
14134 |
+ write_sequnlock(&vnode->cb_lock); |
14135 |
+- return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type); |
14136 |
++ return afs_protocol_error(NULL, afs_eproto_file_type); |
14137 |
+ } |
14138 |
+ |
14139 |
+ afs_set_i_size(vnode, status->size); |
14140 |
+@@ -170,6 +170,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14141 |
+ struct timespec64 t; |
14142 |
+ umode_t mode; |
14143 |
+ bool data_changed = false; |
14144 |
++ bool change_size = false; |
14145 |
+ |
14146 |
+ BUG_ON(test_bit(AFS_VNODE_UNSET, &vnode->flags)); |
14147 |
+ |
14148 |
+@@ -179,7 +180,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14149 |
+ vnode->fid.vnode, |
14150 |
+ vnode->fid.unique, |
14151 |
+ status->type, vnode->status.type); |
14152 |
+- afs_protocol_error(NULL, -EBADMSG, afs_eproto_bad_status); |
14153 |
++ afs_protocol_error(NULL, afs_eproto_bad_status); |
14154 |
+ return; |
14155 |
+ } |
14156 |
+ |
14157 |
+@@ -225,6 +226,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14158 |
+ } else { |
14159 |
+ set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags); |
14160 |
+ } |
14161 |
++ change_size = true; |
14162 |
+ } else if (vnode->status.type == AFS_FTYPE_DIR) { |
14163 |
+ /* Expected directory change is handled elsewhere so |
14164 |
+ * that we can locally edit the directory and save on a |
14165 |
+@@ -232,11 +234,19 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14166 |
+ */ |
14167 |
+ if (test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) |
14168 |
+ data_changed = false; |
14169 |
++ change_size = true; |
14170 |
+ } |
14171 |
+ |
14172 |
+ if (data_changed) { |
14173 |
+ inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); |
14174 |
+- afs_set_i_size(vnode, status->size); |
14175 |
++ |
14176 |
++ /* Only update the size if the data version jumped. If the |
14177 |
++ * file is being modified locally, then we might have our own |
14178 |
++ * idea of what the size should be that's not the same as |
14179 |
++ * what's on the server. |
14180 |
++ */ |
14181 |
++ if (change_size) |
14182 |
++ afs_set_i_size(vnode, status->size); |
14183 |
+ } |
14184 |
+ } |
14185 |
+ |
14186 |
+diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
14187 |
+index 80255513e230..98e0cebd5e5e 100644 |
14188 |
+--- a/fs/afs/internal.h |
14189 |
++++ b/fs/afs/internal.h |
14190 |
+@@ -161,6 +161,7 @@ struct afs_call { |
14191 |
+ bool upgrade; /* T to request service upgrade */ |
14192 |
+ bool have_reply_time; /* T if have got reply_time */ |
14193 |
+ bool intr; /* T if interruptible */ |
14194 |
++ bool unmarshalling_error; /* T if an unmarshalling error occurred */ |
14195 |
+ u16 service_id; /* Actual service ID (after upgrade) */ |
14196 |
+ unsigned int debug_id; /* Trace ID */ |
14197 |
+ u32 operation_ID; /* operation ID for an incoming call */ |
14198 |
+@@ -1128,7 +1129,7 @@ extern void afs_flat_call_destructor(struct afs_call *); |
14199 |
+ extern void afs_send_empty_reply(struct afs_call *); |
14200 |
+ extern void afs_send_simple_reply(struct afs_call *, const void *, size_t); |
14201 |
+ extern int afs_extract_data(struct afs_call *, bool); |
14202 |
+-extern int afs_protocol_error(struct afs_call *, int, enum afs_eproto_cause); |
14203 |
++extern int afs_protocol_error(struct afs_call *, enum afs_eproto_cause); |
14204 |
+ |
14205 |
+ static inline void afs_set_fc_call(struct afs_call *call, struct afs_fs_cursor *fc) |
14206 |
+ { |
14207 |
+diff --git a/fs/afs/misc.c b/fs/afs/misc.c |
14208 |
+index 52b19e9c1535..5334f1bd2bca 100644 |
14209 |
+--- a/fs/afs/misc.c |
14210 |
++++ b/fs/afs/misc.c |
14211 |
+@@ -83,6 +83,7 @@ int afs_abort_to_error(u32 abort_code) |
14212 |
+ case UAENOLCK: return -ENOLCK; |
14213 |
+ case UAENOTEMPTY: return -ENOTEMPTY; |
14214 |
+ case UAELOOP: return -ELOOP; |
14215 |
++ case UAEOVERFLOW: return -EOVERFLOW; |
14216 |
+ case UAENOMEDIUM: return -ENOMEDIUM; |
14217 |
+ case UAEDQUOT: return -EDQUOT; |
14218 |
+ |
14219 |
+diff --git a/fs/afs/proc.c b/fs/afs/proc.c |
14220 |
+index 468e1713bce1..6f34c84a0fd0 100644 |
14221 |
+--- a/fs/afs/proc.c |
14222 |
++++ b/fs/afs/proc.c |
14223 |
+@@ -563,6 +563,7 @@ void afs_put_sysnames(struct afs_sysnames *sysnames) |
14224 |
+ if (sysnames->subs[i] != afs_init_sysname && |
14225 |
+ sysnames->subs[i] != sysnames->blank) |
14226 |
+ kfree(sysnames->subs[i]); |
14227 |
++ kfree(sysnames); |
14228 |
+ } |
14229 |
+ } |
14230 |
+ |
14231 |
+diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
14232 |
+index 1ecc67da6c1a..e3c2655616dc 100644 |
14233 |
+--- a/fs/afs/rxrpc.c |
14234 |
++++ b/fs/afs/rxrpc.c |
14235 |
+@@ -540,6 +540,8 @@ static void afs_deliver_to_call(struct afs_call *call) |
14236 |
+ |
14237 |
+ ret = call->type->deliver(call); |
14238 |
+ state = READ_ONCE(call->state); |
14239 |
++ if (ret == 0 && call->unmarshalling_error) |
14240 |
++ ret = -EBADMSG; |
14241 |
+ switch (ret) { |
14242 |
+ case 0: |
14243 |
+ afs_queue_call_work(call); |
14244 |
+@@ -959,9 +961,11 @@ int afs_extract_data(struct afs_call *call, bool want_more) |
14245 |
+ /* |
14246 |
+ * Log protocol error production. |
14247 |
+ */ |
14248 |
+-noinline int afs_protocol_error(struct afs_call *call, int error, |
14249 |
++noinline int afs_protocol_error(struct afs_call *call, |
14250 |
+ enum afs_eproto_cause cause) |
14251 |
+ { |
14252 |
+- trace_afs_protocol_error(call, error, cause); |
14253 |
+- return error; |
14254 |
++ trace_afs_protocol_error(call, cause); |
14255 |
++ if (call) |
14256 |
++ call->unmarshalling_error = true; |
14257 |
++ return -EBADMSG; |
14258 |
+ } |
14259 |
+diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c |
14260 |
+index 516e9a3bb5b4..e64b002c3bb3 100644 |
14261 |
+--- a/fs/afs/vlclient.c |
14262 |
++++ b/fs/afs/vlclient.c |
14263 |
+@@ -447,8 +447,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14264 |
+ call->count2 = ntohl(*bp); /* Type or next count */ |
14265 |
+ |
14266 |
+ if (call->count > YFS_MAXENDPOINTS) |
14267 |
+- return afs_protocol_error(call, -EBADMSG, |
14268 |
+- afs_eproto_yvl_fsendpt_num); |
14269 |
++ return afs_protocol_error(call, afs_eproto_yvl_fsendpt_num); |
14270 |
+ |
14271 |
+ alist = afs_alloc_addrlist(call->count, FS_SERVICE, AFS_FS_PORT); |
14272 |
+ if (!alist) |
14273 |
+@@ -468,8 +467,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14274 |
+ size = sizeof(__be32) * (1 + 4 + 1); |
14275 |
+ break; |
14276 |
+ default: |
14277 |
+- return afs_protocol_error(call, -EBADMSG, |
14278 |
+- afs_eproto_yvl_fsendpt_type); |
14279 |
++ return afs_protocol_error(call, afs_eproto_yvl_fsendpt_type); |
14280 |
+ } |
14281 |
+ |
14282 |
+ size += sizeof(__be32); |
14283 |
+@@ -487,21 +485,20 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14284 |
+ switch (call->count2) { |
14285 |
+ case YFS_ENDPOINT_IPV4: |
14286 |
+ if (ntohl(bp[0]) != sizeof(__be32) * 2) |
14287 |
+- return afs_protocol_error(call, -EBADMSG, |
14288 |
+- afs_eproto_yvl_fsendpt4_len); |
14289 |
++ return afs_protocol_error( |
14290 |
++ call, afs_eproto_yvl_fsendpt4_len); |
14291 |
+ afs_merge_fs_addr4(alist, bp[1], ntohl(bp[2])); |
14292 |
+ bp += 3; |
14293 |
+ break; |
14294 |
+ case YFS_ENDPOINT_IPV6: |
14295 |
+ if (ntohl(bp[0]) != sizeof(__be32) * 5) |
14296 |
+- return afs_protocol_error(call, -EBADMSG, |
14297 |
+- afs_eproto_yvl_fsendpt6_len); |
14298 |
++ return afs_protocol_error( |
14299 |
++ call, afs_eproto_yvl_fsendpt6_len); |
14300 |
+ afs_merge_fs_addr6(alist, bp + 1, ntohl(bp[5])); |
14301 |
+ bp += 6; |
14302 |
+ break; |
14303 |
+ default: |
14304 |
+- return afs_protocol_error(call, -EBADMSG, |
14305 |
+- afs_eproto_yvl_fsendpt_type); |
14306 |
++ return afs_protocol_error(call, afs_eproto_yvl_fsendpt_type); |
14307 |
+ } |
14308 |
+ |
14309 |
+ /* Got either the type of the next entry or the count of |
14310 |
+@@ -519,8 +516,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14311 |
+ if (!call->count) |
14312 |
+ goto end; |
14313 |
+ if (call->count > YFS_MAXENDPOINTS) |
14314 |
+- return afs_protocol_error(call, -EBADMSG, |
14315 |
+- afs_eproto_yvl_vlendpt_type); |
14316 |
++ return afs_protocol_error(call, afs_eproto_yvl_vlendpt_type); |
14317 |
+ |
14318 |
+ afs_extract_to_buf(call, 1 * sizeof(__be32)); |
14319 |
+ call->unmarshall = 3; |
14320 |
+@@ -547,8 +543,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14321 |
+ size = sizeof(__be32) * (1 + 4 + 1); |
14322 |
+ break; |
14323 |
+ default: |
14324 |
+- return afs_protocol_error(call, -EBADMSG, |
14325 |
+- afs_eproto_yvl_vlendpt_type); |
14326 |
++ return afs_protocol_error(call, afs_eproto_yvl_vlendpt_type); |
14327 |
+ } |
14328 |
+ |
14329 |
+ if (call->count > 1) |
14330 |
+@@ -566,19 +561,18 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14331 |
+ switch (call->count2) { |
14332 |
+ case YFS_ENDPOINT_IPV4: |
14333 |
+ if (ntohl(bp[0]) != sizeof(__be32) * 2) |
14334 |
+- return afs_protocol_error(call, -EBADMSG, |
14335 |
+- afs_eproto_yvl_vlendpt4_len); |
14336 |
++ return afs_protocol_error( |
14337 |
++ call, afs_eproto_yvl_vlendpt4_len); |
14338 |
+ bp += 3; |
14339 |
+ break; |
14340 |
+ case YFS_ENDPOINT_IPV6: |
14341 |
+ if (ntohl(bp[0]) != sizeof(__be32) * 5) |
14342 |
+- return afs_protocol_error(call, -EBADMSG, |
14343 |
+- afs_eproto_yvl_vlendpt6_len); |
14344 |
++ return afs_protocol_error( |
14345 |
++ call, afs_eproto_yvl_vlendpt6_len); |
14346 |
+ bp += 6; |
14347 |
+ break; |
14348 |
+ default: |
14349 |
+- return afs_protocol_error(call, -EBADMSG, |
14350 |
+- afs_eproto_yvl_vlendpt_type); |
14351 |
++ return afs_protocol_error(call, afs_eproto_yvl_vlendpt_type); |
14352 |
+ } |
14353 |
+ |
14354 |
+ /* Got either the type of the next entry or the count of |
14355 |
+diff --git a/fs/afs/write.c b/fs/afs/write.c |
14356 |
+index cb76566763db..96b042af6248 100644 |
14357 |
+--- a/fs/afs/write.c |
14358 |
++++ b/fs/afs/write.c |
14359 |
+@@ -194,11 +194,11 @@ int afs_write_end(struct file *file, struct address_space *mapping, |
14360 |
+ |
14361 |
+ i_size = i_size_read(&vnode->vfs_inode); |
14362 |
+ if (maybe_i_size > i_size) { |
14363 |
+- spin_lock(&vnode->wb_lock); |
14364 |
++ write_seqlock(&vnode->cb_lock); |
14365 |
+ i_size = i_size_read(&vnode->vfs_inode); |
14366 |
+ if (maybe_i_size > i_size) |
14367 |
+ i_size_write(&vnode->vfs_inode, maybe_i_size); |
14368 |
+- spin_unlock(&vnode->wb_lock); |
14369 |
++ write_sequnlock(&vnode->cb_lock); |
14370 |
+ } |
14371 |
+ |
14372 |
+ if (!PageUptodate(page)) { |
14373 |
+@@ -811,6 +811,7 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) |
14374 |
+ vmf->page->index, priv); |
14375 |
+ SetPagePrivate(vmf->page); |
14376 |
+ set_page_private(vmf->page, priv); |
14377 |
++ file_update_time(file); |
14378 |
+ |
14379 |
+ sb_end_pagefault(inode->i_sb); |
14380 |
+ return VM_FAULT_LOCKED; |
14381 |
+diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
14382 |
+index fe413e7a5cf4..bf74c679c02b 100644 |
14383 |
+--- a/fs/afs/yfsclient.c |
14384 |
++++ b/fs/afs/yfsclient.c |
14385 |
+@@ -179,21 +179,20 @@ static void xdr_dump_bad(const __be32 *bp) |
14386 |
+ /* |
14387 |
+ * Decode a YFSFetchStatus block |
14388 |
+ */ |
14389 |
+-static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
14390 |
+- struct afs_call *call, |
14391 |
+- struct afs_status_cb *scb) |
14392 |
++static void xdr_decode_YFSFetchStatus(const __be32 **_bp, |
14393 |
++ struct afs_call *call, |
14394 |
++ struct afs_status_cb *scb) |
14395 |
+ { |
14396 |
+ const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; |
14397 |
+ struct afs_file_status *status = &scb->status; |
14398 |
+ u32 type; |
14399 |
+- int ret; |
14400 |
+ |
14401 |
+ status->abort_code = ntohl(xdr->abort_code); |
14402 |
+ if (status->abort_code != 0) { |
14403 |
+ if (status->abort_code == VNOVNODE) |
14404 |
+ status->nlink = 0; |
14405 |
+ scb->have_error = true; |
14406 |
+- goto good; |
14407 |
++ goto advance; |
14408 |
+ } |
14409 |
+ |
14410 |
+ type = ntohl(xdr->type); |
14411 |
+@@ -221,15 +220,13 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
14412 |
+ status->size = xdr_to_u64(xdr->size); |
14413 |
+ status->data_version = xdr_to_u64(xdr->data_version); |
14414 |
+ scb->have_status = true; |
14415 |
+-good: |
14416 |
+- ret = 0; |
14417 |
+ advance: |
14418 |
+ *_bp += xdr_size(xdr); |
14419 |
+- return ret; |
14420 |
++ return; |
14421 |
+ |
14422 |
+ bad: |
14423 |
+ xdr_dump_bad(*_bp); |
14424 |
+- ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
14425 |
++ afs_protocol_error(call, afs_eproto_bad_status); |
14426 |
+ goto advance; |
14427 |
+ } |
14428 |
+ |
14429 |
+@@ -348,9 +345,7 @@ static int yfs_deliver_fs_status_cb_and_volsync(struct afs_call *call) |
14430 |
+ |
14431 |
+ /* unmarshall the reply once we've received all of it */ |
14432 |
+ bp = call->buffer; |
14433 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14434 |
+- if (ret < 0) |
14435 |
+- return ret; |
14436 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14437 |
+ xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
14438 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14439 |
+ |
14440 |
+@@ -372,9 +367,7 @@ static int yfs_deliver_status_and_volsync(struct afs_call *call) |
14441 |
+ return ret; |
14442 |
+ |
14443 |
+ bp = call->buffer; |
14444 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14445 |
+- if (ret < 0) |
14446 |
+- return ret; |
14447 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14448 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14449 |
+ |
14450 |
+ _leave(" = 0 [done]"); |
14451 |
+@@ -534,9 +527,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) |
14452 |
+ return ret; |
14453 |
+ |
14454 |
+ bp = call->buffer; |
14455 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14456 |
+- if (ret < 0) |
14457 |
+- return ret; |
14458 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14459 |
+ xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
14460 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14461 |
+ |
14462 |
+@@ -644,12 +635,8 @@ static int yfs_deliver_fs_create_vnode(struct afs_call *call) |
14463 |
+ /* unmarshall the reply once we've received all of it */ |
14464 |
+ bp = call->buffer; |
14465 |
+ xdr_decode_YFSFid(&bp, call->out_fid); |
14466 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14467 |
+- if (ret < 0) |
14468 |
+- return ret; |
14469 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14470 |
+- if (ret < 0) |
14471 |
+- return ret; |
14472 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14473 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14474 |
+ xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
14475 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14476 |
+ |
14477 |
+@@ -802,14 +789,9 @@ static int yfs_deliver_fs_remove_file2(struct afs_call *call) |
14478 |
+ return ret; |
14479 |
+ |
14480 |
+ bp = call->buffer; |
14481 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14482 |
+- if (ret < 0) |
14483 |
+- return ret; |
14484 |
+- |
14485 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14486 |
+ xdr_decode_YFSFid(&bp, &fid); |
14487 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14488 |
+- if (ret < 0) |
14489 |
+- return ret; |
14490 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14491 |
+ /* Was deleted if vnode->status.abort_code == VNOVNODE. */ |
14492 |
+ |
14493 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14494 |
+@@ -889,10 +871,7 @@ static int yfs_deliver_fs_remove(struct afs_call *call) |
14495 |
+ return ret; |
14496 |
+ |
14497 |
+ bp = call->buffer; |
14498 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14499 |
+- if (ret < 0) |
14500 |
+- return ret; |
14501 |
+- |
14502 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14503 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14504 |
+ return 0; |
14505 |
+ } |
14506 |
+@@ -974,12 +953,8 @@ static int yfs_deliver_fs_link(struct afs_call *call) |
14507 |
+ return ret; |
14508 |
+ |
14509 |
+ bp = call->buffer; |
14510 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14511 |
+- if (ret < 0) |
14512 |
+- return ret; |
14513 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14514 |
+- if (ret < 0) |
14515 |
+- return ret; |
14516 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14517 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14518 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14519 |
+ _leave(" = 0 [done]"); |
14520 |
+ return 0; |
14521 |
+@@ -1061,12 +1036,8 @@ static int yfs_deliver_fs_symlink(struct afs_call *call) |
14522 |
+ /* unmarshall the reply once we've received all of it */ |
14523 |
+ bp = call->buffer; |
14524 |
+ xdr_decode_YFSFid(&bp, call->out_fid); |
14525 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14526 |
+- if (ret < 0) |
14527 |
+- return ret; |
14528 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14529 |
+- if (ret < 0) |
14530 |
+- return ret; |
14531 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14532 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14533 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14534 |
+ |
14535 |
+ _leave(" = 0 [done]"); |
14536 |
+@@ -1154,13 +1125,11 @@ static int yfs_deliver_fs_rename(struct afs_call *call) |
14537 |
+ return ret; |
14538 |
+ |
14539 |
+ bp = call->buffer; |
14540 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14541 |
+- if (ret < 0) |
14542 |
+- return ret; |
14543 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14544 |
+- if (ret < 0) |
14545 |
+- return ret; |
14546 |
+- |
14547 |
++ /* If the two dirs are the same, we have two copies of the same status |
14548 |
++ * report, so we just decode it twice. |
14549 |
++ */ |
14550 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14551 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14552 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14553 |
+ _leave(" = 0 [done]"); |
14554 |
+ return 0; |
14555 |
+@@ -1457,8 +1426,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) |
14556 |
+ call->count = ntohl(call->tmp); |
14557 |
+ _debug("volname length: %u", call->count); |
14558 |
+ if (call->count >= AFSNAMEMAX) |
14559 |
+- return afs_protocol_error(call, -EBADMSG, |
14560 |
+- afs_eproto_volname_len); |
14561 |
++ return afs_protocol_error(call, afs_eproto_volname_len); |
14562 |
+ size = (call->count + 3) & ~3; /* It's padded */ |
14563 |
+ afs_extract_to_buf(call, size); |
14564 |
+ call->unmarshall++; |
14565 |
+@@ -1487,8 +1455,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) |
14566 |
+ call->count = ntohl(call->tmp); |
14567 |
+ _debug("offline msg length: %u", call->count); |
14568 |
+ if (call->count >= AFSNAMEMAX) |
14569 |
+- return afs_protocol_error(call, -EBADMSG, |
14570 |
+- afs_eproto_offline_msg_len); |
14571 |
++ return afs_protocol_error(call, afs_eproto_offline_msg_len); |
14572 |
+ size = (call->count + 3) & ~3; /* It's padded */ |
14573 |
+ afs_extract_to_buf(call, size); |
14574 |
+ call->unmarshall++; |
14575 |
+@@ -1518,8 +1485,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) |
14576 |
+ call->count = ntohl(call->tmp); |
14577 |
+ _debug("motd length: %u", call->count); |
14578 |
+ if (call->count >= AFSNAMEMAX) |
14579 |
+- return afs_protocol_error(call, -EBADMSG, |
14580 |
+- afs_eproto_motd_len); |
14581 |
++ return afs_protocol_error(call, afs_eproto_motd_len); |
14582 |
+ size = (call->count + 3) & ~3; /* It's padded */ |
14583 |
+ afs_extract_to_buf(call, size); |
14584 |
+ call->unmarshall++; |
14585 |
+@@ -1828,8 +1794,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14586 |
+ tmp = ntohl(call->tmp); |
14587 |
+ _debug("status count: %u/%u", tmp, call->count2); |
14588 |
+ if (tmp != call->count2) |
14589 |
+- return afs_protocol_error(call, -EBADMSG, |
14590 |
+- afs_eproto_ibulkst_count); |
14591 |
++ return afs_protocol_error(call, afs_eproto_ibulkst_count); |
14592 |
+ |
14593 |
+ call->count = 0; |
14594 |
+ call->unmarshall++; |
14595 |
+@@ -1845,9 +1810,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14596 |
+ |
14597 |
+ bp = call->buffer; |
14598 |
+ scb = &call->out_scb[call->count]; |
14599 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, scb); |
14600 |
+- if (ret < 0) |
14601 |
+- return ret; |
14602 |
++ xdr_decode_YFSFetchStatus(&bp, call, scb); |
14603 |
+ |
14604 |
+ call->count++; |
14605 |
+ if (call->count < call->count2) |
14606 |
+@@ -1868,8 +1831,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14607 |
+ tmp = ntohl(call->tmp); |
14608 |
+ _debug("CB count: %u", tmp); |
14609 |
+ if (tmp != call->count2) |
14610 |
+- return afs_protocol_error(call, -EBADMSG, |
14611 |
+- afs_eproto_ibulkst_cb_count); |
14612 |
++ return afs_protocol_error(call, afs_eproto_ibulkst_cb_count); |
14613 |
+ call->count = 0; |
14614 |
+ call->unmarshall++; |
14615 |
+ more_cbs: |
14616 |
+@@ -2067,9 +2029,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call) |
14617 |
+ bp = call->buffer; |
14618 |
+ yacl->inherit_flag = ntohl(*bp++); |
14619 |
+ yacl->num_cleaned = ntohl(*bp++); |
14620 |
+- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14621 |
+- if (ret < 0) |
14622 |
+- return ret; |
14623 |
++ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14624 |
+ xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14625 |
+ |
14626 |
+ call->unmarshall++; |
14627 |
+diff --git a/fs/block_dev.c b/fs/block_dev.c |
14628 |
+index 93672c3f1c78..313aae95818e 100644 |
14629 |
+--- a/fs/block_dev.c |
14630 |
++++ b/fs/block_dev.c |
14631 |
+@@ -1583,10 +1583,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
14632 |
+ */ |
14633 |
+ if (!for_part) { |
14634 |
+ ret = devcgroup_inode_permission(bdev->bd_inode, perm); |
14635 |
+- if (ret != 0) { |
14636 |
+- bdput(bdev); |
14637 |
++ if (ret != 0) |
14638 |
+ return ret; |
14639 |
+- } |
14640 |
+ } |
14641 |
+ |
14642 |
+ restart: |
14643 |
+@@ -1655,8 +1653,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
14644 |
+ goto out_clear; |
14645 |
+ BUG_ON(for_part); |
14646 |
+ ret = __blkdev_get(whole, mode, 1); |
14647 |
+- if (ret) |
14648 |
++ if (ret) { |
14649 |
++ bdput(whole); |
14650 |
+ goto out_clear; |
14651 |
++ } |
14652 |
+ bdev->bd_contains = whole; |
14653 |
+ bdev->bd_part = disk_get_part(disk, partno); |
14654 |
+ if (!(disk->flags & GENHD_FL_UP) || |
14655 |
+@@ -1706,7 +1706,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
14656 |
+ disk_unblock_events(disk); |
14657 |
+ put_disk_and_module(disk); |
14658 |
+ out: |
14659 |
+- bdput(bdev); |
14660 |
+ |
14661 |
+ return ret; |
14662 |
+ } |
14663 |
+@@ -1773,6 +1772,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) |
14664 |
+ bdput(whole); |
14665 |
+ } |
14666 |
+ |
14667 |
++ if (res) |
14668 |
++ bdput(bdev); |
14669 |
++ |
14670 |
+ return res; |
14671 |
+ } |
14672 |
+ EXPORT_SYMBOL(blkdev_get); |
14673 |
+diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
14674 |
+index 79dc06881e78..e088843a7734 100644 |
14675 |
+--- a/fs/ceph/export.c |
14676 |
++++ b/fs/ceph/export.c |
14677 |
+@@ -172,9 +172,16 @@ struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino) |
14678 |
+ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) |
14679 |
+ { |
14680 |
+ struct inode *inode = __lookup_inode(sb, ino); |
14681 |
++ int err; |
14682 |
++ |
14683 |
+ if (IS_ERR(inode)) |
14684 |
+ return ERR_CAST(inode); |
14685 |
+- if (inode->i_nlink == 0) { |
14686 |
++ /* We need LINK caps to reliably check i_nlink */ |
14687 |
++ err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false); |
14688 |
++ if (err) |
14689 |
++ return ERR_PTR(err); |
14690 |
++ /* -ESTALE if inode as been unlinked and no file is open */ |
14691 |
++ if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) { |
14692 |
+ iput(inode); |
14693 |
+ return ERR_PTR(-ESTALE); |
14694 |
+ } |
14695 |
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
14696 |
+index 28268ed461b8..47b9fbb70bf5 100644 |
14697 |
+--- a/fs/cifs/connect.c |
14698 |
++++ b/fs/cifs/connect.c |
14699 |
+@@ -572,26 +572,26 @@ cifs_reconnect(struct TCP_Server_Info *server) |
14700 |
+ try_to_freeze(); |
14701 |
+ |
14702 |
+ mutex_lock(&server->srv_mutex); |
14703 |
++#ifdef CONFIG_CIFS_DFS_UPCALL |
14704 |
+ /* |
14705 |
+ * Set up next DFS target server (if any) for reconnect. If DFS |
14706 |
+ * feature is disabled, then we will retry last server we |
14707 |
+ * connected to before. |
14708 |
+ */ |
14709 |
++ reconn_inval_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); |
14710 |
++#endif |
14711 |
++ rc = reconn_set_ipaddr(server); |
14712 |
++ if (rc) { |
14713 |
++ cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", |
14714 |
++ __func__, rc); |
14715 |
++ } |
14716 |
++ |
14717 |
+ if (cifs_rdma_enabled(server)) |
14718 |
+ rc = smbd_reconnect(server); |
14719 |
+ else |
14720 |
+ rc = generic_ip_connect(server); |
14721 |
+ if (rc) { |
14722 |
+ cifs_dbg(FYI, "reconnect error %d\n", rc); |
14723 |
+-#ifdef CONFIG_CIFS_DFS_UPCALL |
14724 |
+- reconn_inval_dfs_target(server, cifs_sb, &tgt_list, |
14725 |
+- &tgt_it); |
14726 |
+-#endif |
14727 |
+- rc = reconn_set_ipaddr(server); |
14728 |
+- if (rc) { |
14729 |
+- cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", |
14730 |
+- __func__, rc); |
14731 |
+- } |
14732 |
+ mutex_unlock(&server->srv_mutex); |
14733 |
+ msleep(3000); |
14734 |
+ } else { |
14735 |
+diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h |
14736 |
+index 416d9de35679..4311d01b02a8 100644 |
14737 |
+--- a/fs/dlm/dlm_internal.h |
14738 |
++++ b/fs/dlm/dlm_internal.h |
14739 |
+@@ -97,7 +97,6 @@ do { \ |
14740 |
+ __LINE__, __FILE__, #x, jiffies); \ |
14741 |
+ {do} \ |
14742 |
+ printk("\n"); \ |
14743 |
+- BUG(); \ |
14744 |
+ panic("DLM: Record message above and reboot.\n"); \ |
14745 |
+ } \ |
14746 |
+ } |
14747 |
+diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c |
14748 |
+index 8c7bbf3e566d..470be69f19aa 100644 |
14749 |
+--- a/fs/ext4/acl.c |
14750 |
++++ b/fs/ext4/acl.c |
14751 |
+@@ -256,7 +256,7 @@ retry: |
14752 |
+ if (!error && update_mode) { |
14753 |
+ inode->i_mode = mode; |
14754 |
+ inode->i_ctime = current_time(inode); |
14755 |
+- ext4_mark_inode_dirty(handle, inode); |
14756 |
++ error = ext4_mark_inode_dirty(handle, inode); |
14757 |
+ } |
14758 |
+ out_stop: |
14759 |
+ ext4_journal_stop(handle); |
14760 |
+diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
14761 |
+index c654205f648d..1d82336b1cd4 100644 |
14762 |
+--- a/fs/ext4/dir.c |
14763 |
++++ b/fs/ext4/dir.c |
14764 |
+@@ -675,6 +675,7 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len, |
14765 |
+ struct qstr qstr = {.name = str, .len = len }; |
14766 |
+ const struct dentry *parent = READ_ONCE(dentry->d_parent); |
14767 |
+ const struct inode *inode = READ_ONCE(parent->d_inode); |
14768 |
++ char strbuf[DNAME_INLINE_LEN]; |
14769 |
+ |
14770 |
+ if (!inode || !IS_CASEFOLDED(inode) || |
14771 |
+ !EXT4_SB(inode->i_sb)->s_encoding) { |
14772 |
+@@ -683,6 +684,21 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len, |
14773 |
+ return memcmp(str, name->name, len); |
14774 |
+ } |
14775 |
+ |
14776 |
++ /* |
14777 |
++ * If the dentry name is stored in-line, then it may be concurrently |
14778 |
++ * modified by a rename. If this happens, the VFS will eventually retry |
14779 |
++ * the lookup, so it doesn't matter what ->d_compare() returns. |
14780 |
++ * However, it's unsafe to call utf8_strncasecmp() with an unstable |
14781 |
++ * string. Therefore, we have to copy the name into a temporary buffer. |
14782 |
++ */ |
14783 |
++ if (len <= DNAME_INLINE_LEN - 1) { |
14784 |
++ memcpy(strbuf, str, len); |
14785 |
++ strbuf[len] = 0; |
14786 |
++ qstr.name = strbuf; |
14787 |
++ /* prevent compiler from optimizing out the temporary buffer */ |
14788 |
++ barrier(); |
14789 |
++ } |
14790 |
++ |
14791 |
+ return ext4_ci_compare(inode, name, &qstr, false); |
14792 |
+ } |
14793 |
+ |
14794 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
14795 |
+index ad2dbf6e4924..51a85b50033a 100644 |
14796 |
+--- a/fs/ext4/ext4.h |
14797 |
++++ b/fs/ext4/ext4.h |
14798 |
+@@ -3354,7 +3354,7 @@ struct ext4_extent; |
14799 |
+ */ |
14800 |
+ #define EXT_MAX_BLOCKS 0xffffffff |
14801 |
+ |
14802 |
+-extern int ext4_ext_tree_init(handle_t *handle, struct inode *); |
14803 |
++extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode); |
14804 |
+ extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents); |
14805 |
+ extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, |
14806 |
+ struct ext4_map_blocks *map, int flags); |
14807 |
+diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h |
14808 |
+index 4b9002f0e84c..3bacf76d2609 100644 |
14809 |
+--- a/fs/ext4/ext4_jbd2.h |
14810 |
++++ b/fs/ext4/ext4_jbd2.h |
14811 |
+@@ -222,7 +222,10 @@ ext4_mark_iloc_dirty(handle_t *handle, |
14812 |
+ int ext4_reserve_inode_write(handle_t *handle, struct inode *inode, |
14813 |
+ struct ext4_iloc *iloc); |
14814 |
+ |
14815 |
+-int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); |
14816 |
++#define ext4_mark_inode_dirty(__h, __i) \ |
14817 |
++ __ext4_mark_inode_dirty((__h), (__i), __func__, __LINE__) |
14818 |
++int __ext4_mark_inode_dirty(handle_t *handle, struct inode *inode, |
14819 |
++ const char *func, unsigned int line); |
14820 |
+ |
14821 |
+ int ext4_expand_extra_isize(struct inode *inode, |
14822 |
+ unsigned int new_extra_isize, |
14823 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
14824 |
+index 2b4b94542e34..d5453072eb63 100644 |
14825 |
+--- a/fs/ext4/extents.c |
14826 |
++++ b/fs/ext4/extents.c |
14827 |
+@@ -816,7 +816,7 @@ ext4_ext_binsearch(struct inode *inode, |
14828 |
+ |
14829 |
+ } |
14830 |
+ |
14831 |
+-int ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
14832 |
++void ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
14833 |
+ { |
14834 |
+ struct ext4_extent_header *eh; |
14835 |
+ |
14836 |
+@@ -826,7 +826,6 @@ int ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
14837 |
+ eh->eh_magic = EXT4_EXT_MAGIC; |
14838 |
+ eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); |
14839 |
+ ext4_mark_inode_dirty(handle, inode); |
14840 |
+- return 0; |
14841 |
+ } |
14842 |
+ |
14843 |
+ struct ext4_ext_path * |
14844 |
+@@ -1319,7 +1318,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, |
14845 |
+ ext4_idx_pblock(EXT_FIRST_INDEX(neh))); |
14846 |
+ |
14847 |
+ le16_add_cpu(&neh->eh_depth, 1); |
14848 |
+- ext4_mark_inode_dirty(handle, inode); |
14849 |
++ err = ext4_mark_inode_dirty(handle, inode); |
14850 |
+ out: |
14851 |
+ brelse(bh); |
14852 |
+ |
14853 |
+@@ -2828,7 +2827,7 @@ again: |
14854 |
+ * in use to avoid freeing it when removing blocks. |
14855 |
+ */ |
14856 |
+ if (sbi->s_cluster_ratio > 1) { |
14857 |
+- pblk = ext4_ext_pblock(ex) + end - ee_block + 2; |
14858 |
++ pblk = ext4_ext_pblock(ex) + end - ee_block + 1; |
14859 |
+ partial.pclu = EXT4_B2C(sbi, pblk); |
14860 |
+ partial.state = nofree; |
14861 |
+ } |
14862 |
+@@ -4363,7 +4362,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, |
14863 |
+ struct inode *inode = file_inode(file); |
14864 |
+ handle_t *handle; |
14865 |
+ int ret = 0; |
14866 |
+- int ret2 = 0; |
14867 |
++ int ret2 = 0, ret3 = 0; |
14868 |
+ int retries = 0; |
14869 |
+ int depth = 0; |
14870 |
+ struct ext4_map_blocks map; |
14871 |
+@@ -4423,10 +4422,11 @@ retry: |
14872 |
+ if (ext4_update_inode_size(inode, epos) & 0x1) |
14873 |
+ inode->i_mtime = inode->i_ctime; |
14874 |
+ } |
14875 |
+- ext4_mark_inode_dirty(handle, inode); |
14876 |
++ ret2 = ext4_mark_inode_dirty(handle, inode); |
14877 |
+ ext4_update_inode_fsync_trans(handle, inode, 1); |
14878 |
+- ret2 = ext4_journal_stop(handle); |
14879 |
+- if (ret2) |
14880 |
++ ret3 = ext4_journal_stop(handle); |
14881 |
++ ret2 = ret3 ? ret3 : ret2; |
14882 |
++ if (unlikely(ret2)) |
14883 |
+ break; |
14884 |
+ } |
14885 |
+ if (ret == -ENOSPC && |
14886 |
+@@ -4577,7 +4577,9 @@ static long ext4_zero_range(struct file *file, loff_t offset, |
14887 |
+ inode->i_mtime = inode->i_ctime = current_time(inode); |
14888 |
+ if (new_size) |
14889 |
+ ext4_update_inode_size(inode, new_size); |
14890 |
+- ext4_mark_inode_dirty(handle, inode); |
14891 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
14892 |
++ if (unlikely(ret)) |
14893 |
++ goto out_handle; |
14894 |
+ |
14895 |
+ /* Zero out partial block at the edges of the range */ |
14896 |
+ ret = ext4_zero_partial_blocks(handle, inode, offset, len); |
14897 |
+@@ -4587,6 +4589,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, |
14898 |
+ if (file->f_flags & O_SYNC) |
14899 |
+ ext4_handle_sync(handle); |
14900 |
+ |
14901 |
++out_handle: |
14902 |
+ ext4_journal_stop(handle); |
14903 |
+ out_mutex: |
14904 |
+ inode_unlock(inode); |
14905 |
+@@ -4700,8 +4703,7 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode, |
14906 |
+ loff_t offset, ssize_t len) |
14907 |
+ { |
14908 |
+ unsigned int max_blocks; |
14909 |
+- int ret = 0; |
14910 |
+- int ret2 = 0; |
14911 |
++ int ret = 0, ret2 = 0, ret3 = 0; |
14912 |
+ struct ext4_map_blocks map; |
14913 |
+ unsigned int blkbits = inode->i_blkbits; |
14914 |
+ unsigned int credits = 0; |
14915 |
+@@ -4734,9 +4736,13 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode, |
14916 |
+ "ext4_ext_map_blocks returned %d", |
14917 |
+ inode->i_ino, map.m_lblk, |
14918 |
+ map.m_len, ret); |
14919 |
+- ext4_mark_inode_dirty(handle, inode); |
14920 |
+- if (credits) |
14921 |
+- ret2 = ext4_journal_stop(handle); |
14922 |
++ ret2 = ext4_mark_inode_dirty(handle, inode); |
14923 |
++ if (credits) { |
14924 |
++ ret3 = ext4_journal_stop(handle); |
14925 |
++ if (unlikely(ret3)) |
14926 |
++ ret2 = ret3; |
14927 |
++ } |
14928 |
++ |
14929 |
+ if (ret <= 0 || ret2) |
14930 |
+ break; |
14931 |
+ } |
14932 |
+@@ -5304,7 +5310,7 @@ static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) |
14933 |
+ if (IS_SYNC(inode)) |
14934 |
+ ext4_handle_sync(handle); |
14935 |
+ inode->i_mtime = inode->i_ctime = current_time(inode); |
14936 |
+- ext4_mark_inode_dirty(handle, inode); |
14937 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
14938 |
+ ext4_update_inode_fsync_trans(handle, inode, 1); |
14939 |
+ |
14940 |
+ out_stop: |
14941 |
+diff --git a/fs/ext4/file.c b/fs/ext4/file.c |
14942 |
+index 0d624250a62b..2a01e31a032c 100644 |
14943 |
+--- a/fs/ext4/file.c |
14944 |
++++ b/fs/ext4/file.c |
14945 |
+@@ -287,6 +287,7 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, |
14946 |
+ bool truncate = false; |
14947 |
+ u8 blkbits = inode->i_blkbits; |
14948 |
+ ext4_lblk_t written_blk, end_blk; |
14949 |
++ int ret; |
14950 |
+ |
14951 |
+ /* |
14952 |
+ * Note that EXT4_I(inode)->i_disksize can get extended up to |
14953 |
+@@ -327,8 +328,14 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, |
14954 |
+ goto truncate; |
14955 |
+ } |
14956 |
+ |
14957 |
+- if (ext4_update_inode_size(inode, offset + written)) |
14958 |
+- ext4_mark_inode_dirty(handle, inode); |
14959 |
++ if (ext4_update_inode_size(inode, offset + written)) { |
14960 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
14961 |
++ if (unlikely(ret)) { |
14962 |
++ written = ret; |
14963 |
++ ext4_journal_stop(handle); |
14964 |
++ goto truncate; |
14965 |
++ } |
14966 |
++ } |
14967 |
+ |
14968 |
+ /* |
14969 |
+ * We may need to truncate allocated but not written blocks beyond EOF. |
14970 |
+@@ -495,6 +502,12 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from) |
14971 |
+ if (ret <= 0) |
14972 |
+ return ret; |
14973 |
+ |
14974 |
++ /* if we're going to block and IOCB_NOWAIT is set, return -EAGAIN */ |
14975 |
++ if ((iocb->ki_flags & IOCB_NOWAIT) && (unaligned_io || extend)) { |
14976 |
++ ret = -EAGAIN; |
14977 |
++ goto out; |
14978 |
++ } |
14979 |
++ |
14980 |
+ offset = iocb->ki_pos; |
14981 |
+ count = ret; |
14982 |
+ |
14983 |
+diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c |
14984 |
+index 107f0043f67f..be2b66eb65f7 100644 |
14985 |
+--- a/fs/ext4/indirect.c |
14986 |
++++ b/fs/ext4/indirect.c |
14987 |
+@@ -467,7 +467,9 @@ static int ext4_splice_branch(handle_t *handle, |
14988 |
+ /* |
14989 |
+ * OK, we spliced it into the inode itself on a direct block. |
14990 |
+ */ |
14991 |
+- ext4_mark_inode_dirty(handle, ar->inode); |
14992 |
++ err = ext4_mark_inode_dirty(handle, ar->inode); |
14993 |
++ if (unlikely(err)) |
14994 |
++ goto err_out; |
14995 |
+ jbd_debug(5, "splicing direct\n"); |
14996 |
+ } |
14997 |
+ return err; |
14998 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
14999 |
+index f35e289e17aa..c3a1ad2db122 100644 |
15000 |
+--- a/fs/ext4/inline.c |
15001 |
++++ b/fs/ext4/inline.c |
15002 |
+@@ -1260,7 +1260,7 @@ out: |
15003 |
+ int ext4_try_add_inline_entry(handle_t *handle, struct ext4_filename *fname, |
15004 |
+ struct inode *dir, struct inode *inode) |
15005 |
+ { |
15006 |
+- int ret, inline_size, no_expand; |
15007 |
++ int ret, ret2, inline_size, no_expand; |
15008 |
+ void *inline_start; |
15009 |
+ struct ext4_iloc iloc; |
15010 |
+ |
15011 |
+@@ -1314,7 +1314,9 @@ int ext4_try_add_inline_entry(handle_t *handle, struct ext4_filename *fname, |
15012 |
+ |
15013 |
+ out: |
15014 |
+ ext4_write_unlock_xattr(dir, &no_expand); |
15015 |
+- ext4_mark_inode_dirty(handle, dir); |
15016 |
++ ret2 = ext4_mark_inode_dirty(handle, dir); |
15017 |
++ if (unlikely(ret2 && !ret)) |
15018 |
++ ret = ret2; |
15019 |
+ brelse(iloc.bh); |
15020 |
+ return ret; |
15021 |
+ } |
15022 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
15023 |
+index 2a4aae6acdcb..87430d276bcc 100644 |
15024 |
+--- a/fs/ext4/inode.c |
15025 |
++++ b/fs/ext4/inode.c |
15026 |
+@@ -1296,7 +1296,7 @@ static int ext4_write_end(struct file *file, |
15027 |
+ * filesystems. |
15028 |
+ */ |
15029 |
+ if (i_size_changed || inline_data) |
15030 |
+- ext4_mark_inode_dirty(handle, inode); |
15031 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
15032 |
+ |
15033 |
+ if (pos + len > inode->i_size && !verity && ext4_can_truncate(inode)) |
15034 |
+ /* if we have allocated more blocks and copied |
15035 |
+@@ -3077,7 +3077,7 @@ static int ext4_da_write_end(struct file *file, |
15036 |
+ * new_i_size is less that inode->i_size |
15037 |
+ * bu greater than i_disksize.(hint delalloc) |
15038 |
+ */ |
15039 |
+- ext4_mark_inode_dirty(handle, inode); |
15040 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
15041 |
+ } |
15042 |
+ } |
15043 |
+ |
15044 |
+@@ -3094,7 +3094,7 @@ static int ext4_da_write_end(struct file *file, |
15045 |
+ if (ret2 < 0) |
15046 |
+ ret = ret2; |
15047 |
+ ret2 = ext4_journal_stop(handle); |
15048 |
+- if (!ret) |
15049 |
++ if (unlikely(ret2 && !ret)) |
15050 |
+ ret = ret2; |
15051 |
+ |
15052 |
+ return ret ? ret : copied; |
15053 |
+@@ -3886,6 +3886,8 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, |
15054 |
+ loff_t len) |
15055 |
+ { |
15056 |
+ handle_t *handle; |
15057 |
++ int ret; |
15058 |
++ |
15059 |
+ loff_t size = i_size_read(inode); |
15060 |
+ |
15061 |
+ WARN_ON(!inode_is_locked(inode)); |
15062 |
+@@ -3899,10 +3901,10 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, |
15063 |
+ if (IS_ERR(handle)) |
15064 |
+ return PTR_ERR(handle); |
15065 |
+ ext4_update_i_disksize(inode, size); |
15066 |
+- ext4_mark_inode_dirty(handle, inode); |
15067 |
++ ret = ext4_mark_inode_dirty(handle, inode); |
15068 |
+ ext4_journal_stop(handle); |
15069 |
+ |
15070 |
+- return 0; |
15071 |
++ return ret; |
15072 |
+ } |
15073 |
+ |
15074 |
+ static void ext4_wait_dax_page(struct ext4_inode_info *ei) |
15075 |
+@@ -3954,7 +3956,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) |
15076 |
+ loff_t first_block_offset, last_block_offset; |
15077 |
+ handle_t *handle; |
15078 |
+ unsigned int credits; |
15079 |
+- int ret = 0; |
15080 |
++ int ret = 0, ret2 = 0; |
15081 |
+ |
15082 |
+ trace_ext4_punch_hole(inode, offset, length, 0); |
15083 |
+ |
15084 |
+@@ -4077,7 +4079,9 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) |
15085 |
+ ext4_handle_sync(handle); |
15086 |
+ |
15087 |
+ inode->i_mtime = inode->i_ctime = current_time(inode); |
15088 |
+- ext4_mark_inode_dirty(handle, inode); |
15089 |
++ ret2 = ext4_mark_inode_dirty(handle, inode); |
15090 |
++ if (unlikely(ret2)) |
15091 |
++ ret = ret2; |
15092 |
+ if (ret >= 0) |
15093 |
+ ext4_update_inode_fsync_trans(handle, inode, 1); |
15094 |
+ out_stop: |
15095 |
+@@ -4146,7 +4150,7 @@ int ext4_truncate(struct inode *inode) |
15096 |
+ { |
15097 |
+ struct ext4_inode_info *ei = EXT4_I(inode); |
15098 |
+ unsigned int credits; |
15099 |
+- int err = 0; |
15100 |
++ int err = 0, err2; |
15101 |
+ handle_t *handle; |
15102 |
+ struct address_space *mapping = inode->i_mapping; |
15103 |
+ |
15104 |
+@@ -4234,7 +4238,9 @@ out_stop: |
15105 |
+ ext4_orphan_del(handle, inode); |
15106 |
+ |
15107 |
+ inode->i_mtime = inode->i_ctime = current_time(inode); |
15108 |
+- ext4_mark_inode_dirty(handle, inode); |
15109 |
++ err2 = ext4_mark_inode_dirty(handle, inode); |
15110 |
++ if (unlikely(err2 && !err)) |
15111 |
++ err = err2; |
15112 |
+ ext4_journal_stop(handle); |
15113 |
+ |
15114 |
+ trace_ext4_truncate_exit(inode); |
15115 |
+@@ -5292,6 +5298,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) |
15116 |
+ inode->i_gid = attr->ia_gid; |
15117 |
+ error = ext4_mark_inode_dirty(handle, inode); |
15118 |
+ ext4_journal_stop(handle); |
15119 |
++ if (unlikely(error)) |
15120 |
++ return error; |
15121 |
+ } |
15122 |
+ |
15123 |
+ if (attr->ia_valid & ATTR_SIZE) { |
15124 |
+@@ -5777,7 +5785,8 @@ out_unlock: |
15125 |
+ * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync) |
15126 |
+ * we start and wait on commits. |
15127 |
+ */ |
15128 |
+-int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) |
15129 |
++int __ext4_mark_inode_dirty(handle_t *handle, struct inode *inode, |
15130 |
++ const char *func, unsigned int line) |
15131 |
+ { |
15132 |
+ struct ext4_iloc iloc; |
15133 |
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
15134 |
+@@ -5787,13 +5796,18 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) |
15135 |
+ trace_ext4_mark_inode_dirty(inode, _RET_IP_); |
15136 |
+ err = ext4_reserve_inode_write(handle, inode, &iloc); |
15137 |
+ if (err) |
15138 |
+- return err; |
15139 |
++ goto out; |
15140 |
+ |
15141 |
+ if (EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize) |
15142 |
+ ext4_try_to_expand_extra_isize(inode, sbi->s_want_extra_isize, |
15143 |
+ iloc, handle); |
15144 |
+ |
15145 |
+- return ext4_mark_iloc_dirty(handle, inode, &iloc); |
15146 |
++ err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
15147 |
++out: |
15148 |
++ if (unlikely(err)) |
15149 |
++ ext4_error_inode_err(inode, func, line, 0, err, |
15150 |
++ "mark_inode_dirty error"); |
15151 |
++ return err; |
15152 |
+ } |
15153 |
+ |
15154 |
+ /* |
15155 |
+diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
15156 |
+index fb6520f37135..c5e3fc998211 100644 |
15157 |
+--- a/fs/ext4/migrate.c |
15158 |
++++ b/fs/ext4/migrate.c |
15159 |
+@@ -287,7 +287,7 @@ static int free_ind_block(handle_t *handle, struct inode *inode, __le32 *i_data) |
15160 |
+ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, |
15161 |
+ struct inode *tmp_inode) |
15162 |
+ { |
15163 |
+- int retval; |
15164 |
++ int retval, retval2 = 0; |
15165 |
+ __le32 i_data[3]; |
15166 |
+ struct ext4_inode_info *ei = EXT4_I(inode); |
15167 |
+ struct ext4_inode_info *tmp_ei = EXT4_I(tmp_inode); |
15168 |
+@@ -342,7 +342,9 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, |
15169 |
+ * i_blocks when freeing the indirect meta-data blocks |
15170 |
+ */ |
15171 |
+ retval = free_ind_block(handle, inode, i_data); |
15172 |
+- ext4_mark_inode_dirty(handle, inode); |
15173 |
++ retval2 = ext4_mark_inode_dirty(handle, inode); |
15174 |
++ if (unlikely(retval2 && !retval)) |
15175 |
++ retval = retval2; |
15176 |
+ |
15177 |
+ err_out: |
15178 |
+ return retval; |
15179 |
+@@ -601,7 +603,7 @@ int ext4_ind_migrate(struct inode *inode) |
15180 |
+ ext4_lblk_t start, end; |
15181 |
+ ext4_fsblk_t blk; |
15182 |
+ handle_t *handle; |
15183 |
+- int ret; |
15184 |
++ int ret, ret2 = 0; |
15185 |
+ |
15186 |
+ if (!ext4_has_feature_extents(inode->i_sb) || |
15187 |
+ (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) |
15188 |
+@@ -655,7 +657,9 @@ int ext4_ind_migrate(struct inode *inode) |
15189 |
+ memset(ei->i_data, 0, sizeof(ei->i_data)); |
15190 |
+ for (i = start; i <= end; i++) |
15191 |
+ ei->i_data[i] = cpu_to_le32(blk++); |
15192 |
+- ext4_mark_inode_dirty(handle, inode); |
15193 |
++ ret2 = ext4_mark_inode_dirty(handle, inode); |
15194 |
++ if (unlikely(ret2 && !ret)) |
15195 |
++ ret = ret2; |
15196 |
+ errout: |
15197 |
+ ext4_journal_stop(handle); |
15198 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
15199 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
15200 |
+index a8aca4772aaa..56738b538ddf 100644 |
15201 |
+--- a/fs/ext4/namei.c |
15202 |
++++ b/fs/ext4/namei.c |
15203 |
+@@ -1993,7 +1993,7 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname, |
15204 |
+ { |
15205 |
+ unsigned int blocksize = dir->i_sb->s_blocksize; |
15206 |
+ int csum_size = 0; |
15207 |
+- int err; |
15208 |
++ int err, err2; |
15209 |
+ |
15210 |
+ if (ext4_has_metadata_csum(inode->i_sb)) |
15211 |
+ csum_size = sizeof(struct ext4_dir_entry_tail); |
15212 |
+@@ -2028,12 +2028,12 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname, |
15213 |
+ dir->i_mtime = dir->i_ctime = current_time(dir); |
15214 |
+ ext4_update_dx_flag(dir); |
15215 |
+ inode_inc_iversion(dir); |
15216 |
+- ext4_mark_inode_dirty(handle, dir); |
15217 |
++ err2 = ext4_mark_inode_dirty(handle, dir); |
15218 |
+ BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); |
15219 |
+ err = ext4_handle_dirty_dirblock(handle, dir, bh); |
15220 |
+ if (err) |
15221 |
+ ext4_std_error(dir->i_sb, err); |
15222 |
+- return 0; |
15223 |
++ return err ? err : err2; |
15224 |
+ } |
15225 |
+ |
15226 |
+ /* |
15227 |
+@@ -2223,7 +2223,9 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, |
15228 |
+ } |
15229 |
+ ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); |
15230 |
+ dx_fallback++; |
15231 |
+- ext4_mark_inode_dirty(handle, dir); |
15232 |
++ retval = ext4_mark_inode_dirty(handle, dir); |
15233 |
++ if (unlikely(retval)) |
15234 |
++ goto out; |
15235 |
+ } |
15236 |
+ blocks = dir->i_size >> sb->s_blocksize_bits; |
15237 |
+ for (block = 0; block < blocks; block++) { |
15238 |
+@@ -2576,12 +2578,12 @@ static int ext4_add_nondir(handle_t *handle, |
15239 |
+ struct inode *inode = *inodep; |
15240 |
+ int err = ext4_add_entry(handle, dentry, inode); |
15241 |
+ if (!err) { |
15242 |
+- ext4_mark_inode_dirty(handle, inode); |
15243 |
++ err = ext4_mark_inode_dirty(handle, inode); |
15244 |
+ if (IS_DIRSYNC(dir)) |
15245 |
+ ext4_handle_sync(handle); |
15246 |
+ d_instantiate_new(dentry, inode); |
15247 |
+ *inodep = NULL; |
15248 |
+- return 0; |
15249 |
++ return err; |
15250 |
+ } |
15251 |
+ drop_nlink(inode); |
15252 |
+ ext4_orphan_add(handle, inode); |
15253 |
+@@ -2775,7 +2777,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
15254 |
+ { |
15255 |
+ handle_t *handle; |
15256 |
+ struct inode *inode; |
15257 |
+- int err, credits, retries = 0; |
15258 |
++ int err, err2 = 0, credits, retries = 0; |
15259 |
+ |
15260 |
+ if (EXT4_DIR_LINK_MAX(dir)) |
15261 |
+ return -EMLINK; |
15262 |
+@@ -2808,7 +2810,9 @@ out_clear_inode: |
15263 |
+ clear_nlink(inode); |
15264 |
+ ext4_orphan_add(handle, inode); |
15265 |
+ unlock_new_inode(inode); |
15266 |
+- ext4_mark_inode_dirty(handle, inode); |
15267 |
++ err2 = ext4_mark_inode_dirty(handle, inode); |
15268 |
++ if (unlikely(err2)) |
15269 |
++ err = err2; |
15270 |
+ ext4_journal_stop(handle); |
15271 |
+ iput(inode); |
15272 |
+ goto out_retry; |
15273 |
+@@ -3148,10 +3152,12 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) |
15274 |
+ inode->i_size = 0; |
15275 |
+ ext4_orphan_add(handle, inode); |
15276 |
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); |
15277 |
+- ext4_mark_inode_dirty(handle, inode); |
15278 |
++ retval = ext4_mark_inode_dirty(handle, inode); |
15279 |
++ if (retval) |
15280 |
++ goto end_rmdir; |
15281 |
+ ext4_dec_count(handle, dir); |
15282 |
+ ext4_update_dx_flag(dir); |
15283 |
+- ext4_mark_inode_dirty(handle, dir); |
15284 |
++ retval = ext4_mark_inode_dirty(handle, dir); |
15285 |
+ |
15286 |
+ #ifdef CONFIG_UNICODE |
15287 |
+ /* VFS negative dentries are incompatible with Encoding and |
15288 |
+@@ -3221,7 +3227,9 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) |
15289 |
+ goto end_unlink; |
15290 |
+ dir->i_ctime = dir->i_mtime = current_time(dir); |
15291 |
+ ext4_update_dx_flag(dir); |
15292 |
+- ext4_mark_inode_dirty(handle, dir); |
15293 |
++ retval = ext4_mark_inode_dirty(handle, dir); |
15294 |
++ if (retval) |
15295 |
++ goto end_unlink; |
15296 |
+ if (inode->i_nlink == 0) |
15297 |
+ ext4_warning_inode(inode, "Deleting file '%.*s' with no links", |
15298 |
+ dentry->d_name.len, dentry->d_name.name); |
15299 |
+@@ -3230,7 +3238,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) |
15300 |
+ if (!inode->i_nlink) |
15301 |
+ ext4_orphan_add(handle, inode); |
15302 |
+ inode->i_ctime = current_time(inode); |
15303 |
+- ext4_mark_inode_dirty(handle, inode); |
15304 |
++ retval = ext4_mark_inode_dirty(handle, inode); |
15305 |
+ |
15306 |
+ #ifdef CONFIG_UNICODE |
15307 |
+ /* VFS negative dentries are incompatible with Encoding and |
15308 |
+@@ -3419,7 +3427,7 @@ retry: |
15309 |
+ |
15310 |
+ err = ext4_add_entry(handle, dentry, inode); |
15311 |
+ if (!err) { |
15312 |
+- ext4_mark_inode_dirty(handle, inode); |
15313 |
++ err = ext4_mark_inode_dirty(handle, inode); |
15314 |
+ /* this can happen only for tmpfile being |
15315 |
+ * linked the first time |
15316 |
+ */ |
15317 |
+@@ -3531,7 +3539,7 @@ static int ext4_rename_dir_finish(handle_t *handle, struct ext4_renament *ent, |
15318 |
+ static int ext4_setent(handle_t *handle, struct ext4_renament *ent, |
15319 |
+ unsigned ino, unsigned file_type) |
15320 |
+ { |
15321 |
+- int retval; |
15322 |
++ int retval, retval2; |
15323 |
+ |
15324 |
+ BUFFER_TRACE(ent->bh, "get write access"); |
15325 |
+ retval = ext4_journal_get_write_access(handle, ent->bh); |
15326 |
+@@ -3543,19 +3551,19 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent, |
15327 |
+ inode_inc_iversion(ent->dir); |
15328 |
+ ent->dir->i_ctime = ent->dir->i_mtime = |
15329 |
+ current_time(ent->dir); |
15330 |
+- ext4_mark_inode_dirty(handle, ent->dir); |
15331 |
++ retval = ext4_mark_inode_dirty(handle, ent->dir); |
15332 |
+ BUFFER_TRACE(ent->bh, "call ext4_handle_dirty_metadata"); |
15333 |
+ if (!ent->inlined) { |
15334 |
+- retval = ext4_handle_dirty_dirblock(handle, ent->dir, ent->bh); |
15335 |
+- if (unlikely(retval)) { |
15336 |
+- ext4_std_error(ent->dir->i_sb, retval); |
15337 |
+- return retval; |
15338 |
++ retval2 = ext4_handle_dirty_dirblock(handle, ent->dir, ent->bh); |
15339 |
++ if (unlikely(retval2)) { |
15340 |
++ ext4_std_error(ent->dir->i_sb, retval2); |
15341 |
++ return retval2; |
15342 |
+ } |
15343 |
+ } |
15344 |
+ brelse(ent->bh); |
15345 |
+ ent->bh = NULL; |
15346 |
+ |
15347 |
+- return 0; |
15348 |
++ return retval; |
15349 |
+ } |
15350 |
+ |
15351 |
+ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, |
15352 |
+@@ -3790,7 +3798,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
15353 |
+ EXT4_FT_CHRDEV); |
15354 |
+ if (retval) |
15355 |
+ goto end_rename; |
15356 |
+- ext4_mark_inode_dirty(handle, whiteout); |
15357 |
++ retval = ext4_mark_inode_dirty(handle, whiteout); |
15358 |
++ if (unlikely(retval)) |
15359 |
++ goto end_rename; |
15360 |
+ } |
15361 |
+ if (!new.bh) { |
15362 |
+ retval = ext4_add_entry(handle, new.dentry, old.inode); |
15363 |
+@@ -3811,7 +3821,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
15364 |
+ * rename. |
15365 |
+ */ |
15366 |
+ old.inode->i_ctime = current_time(old.inode); |
15367 |
+- ext4_mark_inode_dirty(handle, old.inode); |
15368 |
++ retval = ext4_mark_inode_dirty(handle, old.inode); |
15369 |
++ if (unlikely(retval)) |
15370 |
++ goto end_rename; |
15371 |
+ |
15372 |
+ if (!whiteout) { |
15373 |
+ /* |
15374 |
+@@ -3840,12 +3852,18 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
15375 |
+ } else { |
15376 |
+ ext4_inc_count(handle, new.dir); |
15377 |
+ ext4_update_dx_flag(new.dir); |
15378 |
+- ext4_mark_inode_dirty(handle, new.dir); |
15379 |
++ retval = ext4_mark_inode_dirty(handle, new.dir); |
15380 |
++ if (unlikely(retval)) |
15381 |
++ goto end_rename; |
15382 |
+ } |
15383 |
+ } |
15384 |
+- ext4_mark_inode_dirty(handle, old.dir); |
15385 |
++ retval = ext4_mark_inode_dirty(handle, old.dir); |
15386 |
++ if (unlikely(retval)) |
15387 |
++ goto end_rename; |
15388 |
+ if (new.inode) { |
15389 |
+- ext4_mark_inode_dirty(handle, new.inode); |
15390 |
++ retval = ext4_mark_inode_dirty(handle, new.inode); |
15391 |
++ if (unlikely(retval)) |
15392 |
++ goto end_rename; |
15393 |
+ if (!new.inode->i_nlink) |
15394 |
+ ext4_orphan_add(handle, new.inode); |
15395 |
+ } |
15396 |
+@@ -3979,8 +3997,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, |
15397 |
+ ctime = current_time(old.inode); |
15398 |
+ old.inode->i_ctime = ctime; |
15399 |
+ new.inode->i_ctime = ctime; |
15400 |
+- ext4_mark_inode_dirty(handle, old.inode); |
15401 |
+- ext4_mark_inode_dirty(handle, new.inode); |
15402 |
++ retval = ext4_mark_inode_dirty(handle, old.inode); |
15403 |
++ if (unlikely(retval)) |
15404 |
++ goto end_rename; |
15405 |
++ retval = ext4_mark_inode_dirty(handle, new.inode); |
15406 |
++ if (unlikely(retval)) |
15407 |
++ goto end_rename; |
15408 |
+ |
15409 |
+ if (old.dir_bh) { |
15410 |
+ retval = ext4_rename_dir_finish(handle, &old, new.dir->i_ino); |
15411 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
15412 |
+index bf5fcb477f66..7318ca71b69e 100644 |
15413 |
+--- a/fs/ext4/super.c |
15414 |
++++ b/fs/ext4/super.c |
15415 |
+@@ -522,9 +522,6 @@ static void ext4_handle_error(struct super_block *sb) |
15416 |
+ smp_wmb(); |
15417 |
+ sb->s_flags |= SB_RDONLY; |
15418 |
+ } else if (test_opt(sb, ERRORS_PANIC)) { |
15419 |
+- if (EXT4_SB(sb)->s_journal && |
15420 |
+- !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) |
15421 |
+- return; |
15422 |
+ panic("EXT4-fs (device %s): panic forced after error\n", |
15423 |
+ sb->s_id); |
15424 |
+ } |
15425 |
+@@ -725,23 +722,20 @@ void __ext4_abort(struct super_block *sb, const char *function, |
15426 |
+ va_end(args); |
15427 |
+ |
15428 |
+ if (sb_rdonly(sb) == 0) { |
15429 |
+- ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); |
15430 |
+ EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; |
15431 |
++ if (EXT4_SB(sb)->s_journal) |
15432 |
++ jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); |
15433 |
++ |
15434 |
++ ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); |
15435 |
+ /* |
15436 |
+ * Make sure updated value of ->s_mount_flags will be visible |
15437 |
+ * before ->s_flags update |
15438 |
+ */ |
15439 |
+ smp_wmb(); |
15440 |
+ sb->s_flags |= SB_RDONLY; |
15441 |
+- if (EXT4_SB(sb)->s_journal) |
15442 |
+- jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); |
15443 |
+ } |
15444 |
+- if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) { |
15445 |
+- if (EXT4_SB(sb)->s_journal && |
15446 |
+- !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) |
15447 |
+- return; |
15448 |
++ if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) |
15449 |
+ panic("EXT4-fs panic from previous error\n"); |
15450 |
+- } |
15451 |
+ } |
15452 |
+ |
15453 |
+ void __ext4_msg(struct super_block *sb, |
15454 |
+@@ -2086,6 +2080,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, |
15455 |
+ #endif |
15456 |
+ } else if (token == Opt_dax) { |
15457 |
+ #ifdef CONFIG_FS_DAX |
15458 |
++ if (is_remount && test_opt(sb, DAX)) { |
15459 |
++ ext4_msg(sb, KERN_ERR, "can't mount with " |
15460 |
++ "both data=journal and dax"); |
15461 |
++ return -1; |
15462 |
++ } |
15463 |
++ if (is_remount && !(sbi->s_mount_opt & EXT4_MOUNT_DAX)) { |
15464 |
++ ext4_msg(sb, KERN_ERR, "can't change " |
15465 |
++ "dax mount option while remounting"); |
15466 |
++ return -1; |
15467 |
++ } |
15468 |
+ ext4_msg(sb, KERN_WARNING, |
15469 |
+ "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); |
15470 |
+ sbi->s_mount_opt |= m->mount_opt; |
15471 |
+@@ -2344,6 +2348,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, |
15472 |
+ ext4_msg(sb, KERN_ERR, "revision level too high, " |
15473 |
+ "forcing read-only mode"); |
15474 |
+ err = -EROFS; |
15475 |
++ goto done; |
15476 |
+ } |
15477 |
+ if (read_only) |
15478 |
+ goto done; |
15479 |
+@@ -5412,12 +5417,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
15480 |
+ err = -EINVAL; |
15481 |
+ goto restore_opts; |
15482 |
+ } |
15483 |
+- if (test_opt(sb, DAX)) { |
15484 |
+- ext4_msg(sb, KERN_ERR, "can't mount with " |
15485 |
+- "both data=journal and dax"); |
15486 |
+- err = -EINVAL; |
15487 |
+- goto restore_opts; |
15488 |
+- } |
15489 |
+ } else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) { |
15490 |
+ if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { |
15491 |
+ ext4_msg(sb, KERN_ERR, "can't mount with " |
15492 |
+@@ -5433,12 +5432,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
15493 |
+ goto restore_opts; |
15494 |
+ } |
15495 |
+ |
15496 |
+- if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX) { |
15497 |
+- ext4_msg(sb, KERN_WARNING, "warning: refusing change of " |
15498 |
+- "dax flag with busy inodes while remounting"); |
15499 |
+- sbi->s_mount_opt ^= EXT4_MOUNT_DAX; |
15500 |
+- } |
15501 |
+- |
15502 |
+ if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) |
15503 |
+ ext4_abort(sb, EXT4_ERR_ESHUTDOWN, "Abort forced by user"); |
15504 |
+ |
15505 |
+@@ -5885,7 +5878,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
15506 |
+ EXT4_I(inode)->i_flags |= EXT4_NOATIME_FL | EXT4_IMMUTABLE_FL; |
15507 |
+ inode_set_flags(inode, S_NOATIME | S_IMMUTABLE, |
15508 |
+ S_NOATIME | S_IMMUTABLE); |
15509 |
+- ext4_mark_inode_dirty(handle, inode); |
15510 |
++ err = ext4_mark_inode_dirty(handle, inode); |
15511 |
+ ext4_journal_stop(handle); |
15512 |
+ unlock_inode: |
15513 |
+ inode_unlock(inode); |
15514 |
+@@ -5987,12 +5980,14 @@ static int ext4_quota_off(struct super_block *sb, int type) |
15515 |
+ * this is not a hard failure and quotas are already disabled. |
15516 |
+ */ |
15517 |
+ handle = ext4_journal_start(inode, EXT4_HT_QUOTA, 1); |
15518 |
+- if (IS_ERR(handle)) |
15519 |
++ if (IS_ERR(handle)) { |
15520 |
++ err = PTR_ERR(handle); |
15521 |
+ goto out_unlock; |
15522 |
++ } |
15523 |
+ EXT4_I(inode)->i_flags &= ~(EXT4_NOATIME_FL | EXT4_IMMUTABLE_FL); |
15524 |
+ inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE); |
15525 |
+ inode->i_mtime = inode->i_ctime = current_time(inode); |
15526 |
+- ext4_mark_inode_dirty(handle, inode); |
15527 |
++ err = ext4_mark_inode_dirty(handle, inode); |
15528 |
+ ext4_journal_stop(handle); |
15529 |
+ out_unlock: |
15530 |
+ inode_unlock(inode); |
15531 |
+@@ -6050,7 +6045,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, |
15532 |
+ { |
15533 |
+ struct inode *inode = sb_dqopt(sb)->files[type]; |
15534 |
+ ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); |
15535 |
+- int err, offset = off & (sb->s_blocksize - 1); |
15536 |
++ int err = 0, err2 = 0, offset = off & (sb->s_blocksize - 1); |
15537 |
+ int retries = 0; |
15538 |
+ struct buffer_head *bh; |
15539 |
+ handle_t *handle = journal_current_handle(); |
15540 |
+@@ -6098,9 +6093,11 @@ out: |
15541 |
+ if (inode->i_size < off + len) { |
15542 |
+ i_size_write(inode, off + len); |
15543 |
+ EXT4_I(inode)->i_disksize = inode->i_size; |
15544 |
+- ext4_mark_inode_dirty(handle, inode); |
15545 |
++ err2 = ext4_mark_inode_dirty(handle, inode); |
15546 |
++ if (unlikely(err2 && !err)) |
15547 |
++ err = err2; |
15548 |
+ } |
15549 |
+- return len; |
15550 |
++ return err ? err : len; |
15551 |
+ } |
15552 |
+ #endif |
15553 |
+ |
15554 |
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c |
15555 |
+index 01ba66373e97..9b29a40738ac 100644 |
15556 |
+--- a/fs/ext4/xattr.c |
15557 |
++++ b/fs/ext4/xattr.c |
15558 |
+@@ -1327,7 +1327,7 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode, |
15559 |
+ int blocksize = ea_inode->i_sb->s_blocksize; |
15560 |
+ int max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits; |
15561 |
+ int csize, wsize = 0; |
15562 |
+- int ret = 0; |
15563 |
++ int ret = 0, ret2 = 0; |
15564 |
+ int retries = 0; |
15565 |
+ |
15566 |
+ retry: |
15567 |
+@@ -1385,7 +1385,9 @@ retry: |
15568 |
+ ext4_update_i_disksize(ea_inode, wsize); |
15569 |
+ inode_unlock(ea_inode); |
15570 |
+ |
15571 |
+- ext4_mark_inode_dirty(handle, ea_inode); |
15572 |
++ ret2 = ext4_mark_inode_dirty(handle, ea_inode); |
15573 |
++ if (unlikely(ret2 && !ret)) |
15574 |
++ ret = ret2; |
15575 |
+ |
15576 |
+ out: |
15577 |
+ brelse(bh); |
15578 |
+diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
15579 |
+index 852890b72d6a..448b3dc6f925 100644 |
15580 |
+--- a/fs/f2fs/checkpoint.c |
15581 |
++++ b/fs/f2fs/checkpoint.c |
15582 |
+@@ -889,8 +889,8 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
15583 |
+ int i; |
15584 |
+ int err; |
15585 |
+ |
15586 |
+- sbi->ckpt = f2fs_kzalloc(sbi, array_size(blk_size, cp_blks), |
15587 |
+- GFP_KERNEL); |
15588 |
++ sbi->ckpt = f2fs_kvzalloc(sbi, array_size(blk_size, cp_blks), |
15589 |
++ GFP_KERNEL); |
15590 |
+ if (!sbi->ckpt) |
15591 |
+ return -ENOMEM; |
15592 |
+ /* |
15593 |
+diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c |
15594 |
+index df7b2d15eacd..a5b2e72174bb 100644 |
15595 |
+--- a/fs/f2fs/compress.c |
15596 |
++++ b/fs/f2fs/compress.c |
15597 |
+@@ -236,7 +236,12 @@ static int lz4_init_compress_ctx(struct compress_ctx *cc) |
15598 |
+ if (!cc->private) |
15599 |
+ return -ENOMEM; |
15600 |
+ |
15601 |
+- cc->clen = LZ4_compressBound(PAGE_SIZE << cc->log_cluster_size); |
15602 |
++ /* |
15603 |
++ * we do not change cc->clen to LZ4_compressBound(inputsize) to |
15604 |
++ * adapt worst compress case, because lz4 compressor can handle |
15605 |
++ * output budget properly. |
15606 |
++ */ |
15607 |
++ cc->clen = cc->rlen - PAGE_SIZE - COMPRESS_HEADER_SIZE; |
15608 |
+ return 0; |
15609 |
+ } |
15610 |
+ |
15611 |
+@@ -252,11 +257,9 @@ static int lz4_compress_pages(struct compress_ctx *cc) |
15612 |
+ |
15613 |
+ len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, |
15614 |
+ cc->clen, cc->private); |
15615 |
+- if (!len) { |
15616 |
+- printk_ratelimited("%sF2FS-fs (%s): lz4 compress failed\n", |
15617 |
+- KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id); |
15618 |
+- return -EIO; |
15619 |
+- } |
15620 |
++ if (!len) |
15621 |
++ return -EAGAIN; |
15622 |
++ |
15623 |
+ cc->clen = len; |
15624 |
+ return 0; |
15625 |
+ } |
15626 |
+@@ -366,6 +369,13 @@ static int zstd_compress_pages(struct compress_ctx *cc) |
15627 |
+ return -EIO; |
15628 |
+ } |
15629 |
+ |
15630 |
++ /* |
15631 |
++ * there is compressed data remained in intermediate buffer due to |
15632 |
++ * no more space in cbuf.cdata |
15633 |
++ */ |
15634 |
++ if (ret) |
15635 |
++ return -EAGAIN; |
15636 |
++ |
15637 |
+ cc->clen = outbuf.pos; |
15638 |
+ return 0; |
15639 |
+ } |
15640 |
+diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
15641 |
+index cdf2f626bea7..10491ae1cb85 100644 |
15642 |
+--- a/fs/f2fs/data.c |
15643 |
++++ b/fs/f2fs/data.c |
15644 |
+@@ -2130,16 +2130,16 @@ submit_and_realloc: |
15645 |
+ page->index, for_write); |
15646 |
+ if (IS_ERR(bio)) { |
15647 |
+ ret = PTR_ERR(bio); |
15648 |
+- bio = NULL; |
15649 |
+ dic->failed = true; |
15650 |
+ if (refcount_sub_and_test(dic->nr_cpages - i, |
15651 |
+- &dic->ref)) |
15652 |
++ &dic->ref)) { |
15653 |
+ f2fs_decompress_end_io(dic->rpages, |
15654 |
+ cc->cluster_size, true, |
15655 |
+ false); |
15656 |
+- f2fs_free_dic(dic); |
15657 |
++ f2fs_free_dic(dic); |
15658 |
++ } |
15659 |
+ f2fs_put_dnode(&dn); |
15660 |
+- *bio_ret = bio; |
15661 |
++ *bio_ret = NULL; |
15662 |
+ return ret; |
15663 |
+ } |
15664 |
+ } |
15665 |
+diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c |
15666 |
+index 44bfc464df78..54e90dbb09e7 100644 |
15667 |
+--- a/fs/f2fs/dir.c |
15668 |
++++ b/fs/f2fs/dir.c |
15669 |
+@@ -107,36 +107,28 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, |
15670 |
+ /* |
15671 |
+ * Test whether a case-insensitive directory entry matches the filename |
15672 |
+ * being searched for. |
15673 |
+- * |
15674 |
+- * Returns: 0 if the directory entry matches, more than 0 if it |
15675 |
+- * doesn't match or less than zero on error. |
15676 |
+ */ |
15677 |
+-int f2fs_ci_compare(const struct inode *parent, const struct qstr *name, |
15678 |
+- const struct qstr *entry, bool quick) |
15679 |
++static bool f2fs_match_ci_name(const struct inode *dir, const struct qstr *name, |
15680 |
++ const struct qstr *entry, bool quick) |
15681 |
+ { |
15682 |
+- const struct f2fs_sb_info *sbi = F2FS_SB(parent->i_sb); |
15683 |
++ const struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); |
15684 |
+ const struct unicode_map *um = sbi->s_encoding; |
15685 |
+- int ret; |
15686 |
++ int res; |
15687 |
+ |
15688 |
+ if (quick) |
15689 |
+- ret = utf8_strncasecmp_folded(um, name, entry); |
15690 |
++ res = utf8_strncasecmp_folded(um, name, entry); |
15691 |
+ else |
15692 |
+- ret = utf8_strncasecmp(um, name, entry); |
15693 |
+- |
15694 |
+- if (ret < 0) { |
15695 |
+- /* Handle invalid character sequence as either an error |
15696 |
+- * or as an opaque byte sequence. |
15697 |
++ res = utf8_strncasecmp(um, name, entry); |
15698 |
++ if (res < 0) { |
15699 |
++ /* |
15700 |
++ * In strict mode, ignore invalid names. In non-strict mode, |
15701 |
++ * fall back to treating them as opaque byte sequences. |
15702 |
+ */ |
15703 |
+- if (f2fs_has_strict_mode(sbi)) |
15704 |
+- return -EINVAL; |
15705 |
+- |
15706 |
+- if (name->len != entry->len) |
15707 |
+- return 1; |
15708 |
+- |
15709 |
+- return !!memcmp(name->name, entry->name, name->len); |
15710 |
++ if (f2fs_has_strict_mode(sbi) || name->len != entry->len) |
15711 |
++ return false; |
15712 |
++ return !memcmp(name->name, entry->name, name->len); |
15713 |
+ } |
15714 |
+- |
15715 |
+- return ret; |
15716 |
++ return res == 0; |
15717 |
+ } |
15718 |
+ |
15719 |
+ static void f2fs_fname_setup_ci_filename(struct inode *dir, |
15720 |
+@@ -188,10 +180,10 @@ static inline bool f2fs_match_name(struct f2fs_dentry_ptr *d, |
15721 |
+ if (cf_str->name) { |
15722 |
+ struct qstr cf = {.name = cf_str->name, |
15723 |
+ .len = cf_str->len}; |
15724 |
+- return !f2fs_ci_compare(parent, &cf, &entry, true); |
15725 |
++ return f2fs_match_ci_name(parent, &cf, &entry, true); |
15726 |
+ } |
15727 |
+- return !f2fs_ci_compare(parent, fname->usr_fname, &entry, |
15728 |
+- false); |
15729 |
++ return f2fs_match_ci_name(parent, fname->usr_fname, &entry, |
15730 |
++ false); |
15731 |
+ } |
15732 |
+ #endif |
15733 |
+ if (fscrypt_match_name(fname, d->filename[bit_pos], |
15734 |
+@@ -1080,17 +1072,41 @@ const struct file_operations f2fs_dir_operations = { |
15735 |
+ static int f2fs_d_compare(const struct dentry *dentry, unsigned int len, |
15736 |
+ const char *str, const struct qstr *name) |
15737 |
+ { |
15738 |
+- struct qstr qstr = {.name = str, .len = len }; |
15739 |
+ const struct dentry *parent = READ_ONCE(dentry->d_parent); |
15740 |
+- const struct inode *inode = READ_ONCE(parent->d_inode); |
15741 |
++ const struct inode *dir = READ_ONCE(parent->d_inode); |
15742 |
++ const struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); |
15743 |
++ struct qstr entry = QSTR_INIT(str, len); |
15744 |
++ char strbuf[DNAME_INLINE_LEN]; |
15745 |
++ int res; |
15746 |
++ |
15747 |
++ if (!dir || !IS_CASEFOLDED(dir)) |
15748 |
++ goto fallback; |
15749 |
+ |
15750 |
+- if (!inode || !IS_CASEFOLDED(inode)) { |
15751 |
+- if (len != name->len) |
15752 |
+- return -1; |
15753 |
+- return memcmp(str, name->name, len); |
15754 |
++ /* |
15755 |
++ * If the dentry name is stored in-line, then it may be concurrently |
15756 |
++ * modified by a rename. If this happens, the VFS will eventually retry |
15757 |
++ * the lookup, so it doesn't matter what ->d_compare() returns. |
15758 |
++ * However, it's unsafe to call utf8_strncasecmp() with an unstable |
15759 |
++ * string. Therefore, we have to copy the name into a temporary buffer. |
15760 |
++ */ |
15761 |
++ if (len <= DNAME_INLINE_LEN - 1) { |
15762 |
++ memcpy(strbuf, str, len); |
15763 |
++ strbuf[len] = 0; |
15764 |
++ entry.name = strbuf; |
15765 |
++ /* prevent compiler from optimizing out the temporary buffer */ |
15766 |
++ barrier(); |
15767 |
+ } |
15768 |
+ |
15769 |
+- return f2fs_ci_compare(inode, name, &qstr, false); |
15770 |
++ res = utf8_strncasecmp(sbi->s_encoding, name, &entry); |
15771 |
++ if (res >= 0) |
15772 |
++ return res; |
15773 |
++ |
15774 |
++ if (f2fs_has_strict_mode(sbi)) |
15775 |
++ return -EINVAL; |
15776 |
++fallback: |
15777 |
++ if (len != name->len) |
15778 |
++ return 1; |
15779 |
++ return !!memcmp(str, name->name, len); |
15780 |
+ } |
15781 |
+ |
15782 |
+ static int f2fs_d_hash(const struct dentry *dentry, struct qstr *str) |
15783 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
15784 |
+index 7c5dd7f666a0..5a0f95dfbac2 100644 |
15785 |
+--- a/fs/f2fs/f2fs.h |
15786 |
++++ b/fs/f2fs/f2fs.h |
15787 |
+@@ -2936,18 +2936,12 @@ static inline bool f2fs_may_extent_tree(struct inode *inode) |
15788 |
+ static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, |
15789 |
+ size_t size, gfp_t flags) |
15790 |
+ { |
15791 |
+- void *ret; |
15792 |
+- |
15793 |
+ if (time_to_inject(sbi, FAULT_KMALLOC)) { |
15794 |
+ f2fs_show_injection_info(sbi, FAULT_KMALLOC); |
15795 |
+ return NULL; |
15796 |
+ } |
15797 |
+ |
15798 |
+- ret = kmalloc(size, flags); |
15799 |
+- if (ret) |
15800 |
+- return ret; |
15801 |
+- |
15802 |
+- return kvmalloc(size, flags); |
15803 |
++ return kmalloc(size, flags); |
15804 |
+ } |
15805 |
+ |
15806 |
+ static inline void *f2fs_kzalloc(struct f2fs_sb_info *sbi, |
15807 |
+@@ -3107,11 +3101,6 @@ int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, |
15808 |
+ bool hot, bool set); |
15809 |
+ struct dentry *f2fs_get_parent(struct dentry *child); |
15810 |
+ |
15811 |
+-extern int f2fs_ci_compare(const struct inode *parent, |
15812 |
+- const struct qstr *name, |
15813 |
+- const struct qstr *entry, |
15814 |
+- bool quick); |
15815 |
+- |
15816 |
+ /* |
15817 |
+ * dir.c |
15818 |
+ */ |
15819 |
+@@ -3656,7 +3645,7 @@ static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } |
15820 |
+ static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } |
15821 |
+ static inline void __init f2fs_create_root_stats(void) { } |
15822 |
+ static inline void f2fs_destroy_root_stats(void) { } |
15823 |
+-static inline void update_sit_info(struct f2fs_sb_info *sbi) {} |
15824 |
++static inline void f2fs_update_sit_info(struct f2fs_sb_info *sbi) {} |
15825 |
+ #endif |
15826 |
+ |
15827 |
+ extern const struct file_operations f2fs_dir_operations; |
15828 |
+diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
15829 |
+index 6ab8f621a3c5..30b35915fa3a 100644 |
15830 |
+--- a/fs/f2fs/file.c |
15831 |
++++ b/fs/f2fs/file.c |
15832 |
+@@ -2219,8 +2219,15 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) |
15833 |
+ |
15834 |
+ if (in != F2FS_GOING_DOWN_FULLSYNC) { |
15835 |
+ ret = mnt_want_write_file(filp); |
15836 |
+- if (ret) |
15837 |
++ if (ret) { |
15838 |
++ if (ret == -EROFS) { |
15839 |
++ ret = 0; |
15840 |
++ f2fs_stop_checkpoint(sbi, false); |
15841 |
++ set_sbi_flag(sbi, SBI_IS_SHUTDOWN); |
15842 |
++ trace_f2fs_shutdown(sbi, in, ret); |
15843 |
++ } |
15844 |
+ return ret; |
15845 |
++ } |
15846 |
+ } |
15847 |
+ |
15848 |
+ switch (in) { |
15849 |
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
15850 |
+index ecbd6bd14a49..daf531e69b67 100644 |
15851 |
+--- a/fs/f2fs/node.c |
15852 |
++++ b/fs/f2fs/node.c |
15853 |
+@@ -2928,7 +2928,7 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) |
15854 |
+ return 0; |
15855 |
+ |
15856 |
+ nm_i->nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8); |
15857 |
+- nm_i->nat_bits = f2fs_kzalloc(sbi, |
15858 |
++ nm_i->nat_bits = f2fs_kvzalloc(sbi, |
15859 |
+ nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL); |
15860 |
+ if (!nm_i->nat_bits) |
15861 |
+ return -ENOMEM; |
15862 |
+@@ -3061,9 +3061,9 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi) |
15863 |
+ int i; |
15864 |
+ |
15865 |
+ nm_i->free_nid_bitmap = |
15866 |
+- f2fs_kzalloc(sbi, array_size(sizeof(unsigned char *), |
15867 |
+- nm_i->nat_blocks), |
15868 |
+- GFP_KERNEL); |
15869 |
++ f2fs_kvzalloc(sbi, array_size(sizeof(unsigned char *), |
15870 |
++ nm_i->nat_blocks), |
15871 |
++ GFP_KERNEL); |
15872 |
+ if (!nm_i->free_nid_bitmap) |
15873 |
+ return -ENOMEM; |
15874 |
+ |
15875 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
15876 |
+index 56ccb8323e21..4696c9cb47a5 100644 |
15877 |
+--- a/fs/f2fs/super.c |
15878 |
++++ b/fs/f2fs/super.c |
15879 |
+@@ -1303,7 +1303,8 @@ static int f2fs_statfs_project(struct super_block *sb, |
15880 |
+ limit >>= sb->s_blocksize_bits; |
15881 |
+ |
15882 |
+ if (limit && buf->f_blocks > limit) { |
15883 |
+- curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; |
15884 |
++ curblock = (dquot->dq_dqb.dqb_curspace + |
15885 |
++ dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; |
15886 |
+ buf->f_blocks = limit; |
15887 |
+ buf->f_bfree = buf->f_bavail = |
15888 |
+ (buf->f_blocks > curblock) ? |
15889 |
+@@ -3038,7 +3039,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) |
15890 |
+ if (nr_sectors & (bdev_zone_sectors(bdev) - 1)) |
15891 |
+ FDEV(devi).nr_blkz++; |
15892 |
+ |
15893 |
+- FDEV(devi).blkz_seq = f2fs_kzalloc(sbi, |
15894 |
++ FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi, |
15895 |
+ BITS_TO_LONGS(FDEV(devi).nr_blkz) |
15896 |
+ * sizeof(unsigned long), |
15897 |
+ GFP_KERNEL); |
15898 |
+diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
15899 |
+index 97eec7522bf2..5c155437a455 100644 |
15900 |
+--- a/fs/fuse/dev.c |
15901 |
++++ b/fs/fuse/dev.c |
15902 |
+@@ -1977,8 +1977,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, |
15903 |
+ struct pipe_buffer *ibuf; |
15904 |
+ struct pipe_buffer *obuf; |
15905 |
+ |
15906 |
+- BUG_ON(nbuf >= pipe->ring_size); |
15907 |
+- BUG_ON(tail == head); |
15908 |
++ if (WARN_ON(nbuf >= count || tail == head)) |
15909 |
++ goto out_free; |
15910 |
++ |
15911 |
+ ibuf = &pipe->bufs[tail & mask]; |
15912 |
+ obuf = &bufs[nbuf]; |
15913 |
+ |
15914 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
15915 |
+index 9d67b830fb7a..e3afceecaa6b 100644 |
15916 |
+--- a/fs/fuse/file.c |
15917 |
++++ b/fs/fuse/file.c |
15918 |
+@@ -712,6 +712,7 @@ static ssize_t fuse_async_req_send(struct fuse_conn *fc, |
15919 |
+ spin_unlock(&io->lock); |
15920 |
+ |
15921 |
+ ia->ap.args.end = fuse_aio_complete_req; |
15922 |
++ ia->ap.args.may_block = io->should_dirty; |
15923 |
+ err = fuse_simple_background(fc, &ia->ap.args, GFP_KERNEL); |
15924 |
+ if (err) |
15925 |
+ fuse_aio_complete_req(fc, &ia->ap.args, err); |
15926 |
+@@ -3279,13 +3280,11 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
15927 |
+ if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb) |
15928 |
+ return -EXDEV; |
15929 |
+ |
15930 |
+- if (fc->writeback_cache) { |
15931 |
+- inode_lock(inode_in); |
15932 |
+- err = fuse_writeback_range(inode_in, pos_in, pos_in + len); |
15933 |
+- inode_unlock(inode_in); |
15934 |
+- if (err) |
15935 |
+- return err; |
15936 |
+- } |
15937 |
++ inode_lock(inode_in); |
15938 |
++ err = fuse_writeback_range(inode_in, pos_in, pos_in + len - 1); |
15939 |
++ inode_unlock(inode_in); |
15940 |
++ if (err) |
15941 |
++ return err; |
15942 |
+ |
15943 |
+ inode_lock(inode_out); |
15944 |
+ |
15945 |
+@@ -3293,11 +3292,27 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
15946 |
+ if (err) |
15947 |
+ goto out; |
15948 |
+ |
15949 |
+- if (fc->writeback_cache) { |
15950 |
+- err = fuse_writeback_range(inode_out, pos_out, pos_out + len); |
15951 |
+- if (err) |
15952 |
+- goto out; |
15953 |
+- } |
15954 |
++ /* |
15955 |
++ * Write out dirty pages in the destination file before sending the COPY |
15956 |
++ * request to userspace. After the request is completed, truncate off |
15957 |
++ * pages (including partial ones) from the cache that have been copied, |
15958 |
++ * since these contain stale data at that point. |
15959 |
++ * |
15960 |
++ * This should be mostly correct, but if the COPY writes to partial |
15961 |
++ * pages (at the start or end) and the parts not covered by the COPY are |
15962 |
++ * written through a memory map after calling fuse_writeback_range(), |
15963 |
++ * then these partial page modifications will be lost on truncation. |
15964 |
++ * |
15965 |
++ * It is unlikely that someone would rely on such mixed style |
15966 |
++ * modifications. Yet this does give less guarantees than if the |
15967 |
++ * copying was performed with write(2). |
15968 |
++ * |
15969 |
++ * To fix this a i_mmap_sem style lock could be used to prevent new |
15970 |
++ * faults while the copy is ongoing. |
15971 |
++ */ |
15972 |
++ err = fuse_writeback_range(inode_out, pos_out, pos_out + len - 1); |
15973 |
++ if (err) |
15974 |
++ goto out; |
15975 |
+ |
15976 |
+ if (is_unstable) |
15977 |
+ set_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state); |
15978 |
+@@ -3318,6 +3333,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
15979 |
+ if (err) |
15980 |
+ goto out; |
15981 |
+ |
15982 |
++ truncate_inode_pages_range(inode_out->i_mapping, |
15983 |
++ ALIGN_DOWN(pos_out, PAGE_SIZE), |
15984 |
++ ALIGN(pos_out + outarg.size, PAGE_SIZE) - 1); |
15985 |
++ |
15986 |
+ if (fc->writeback_cache) { |
15987 |
+ fuse_write_update_size(inode_out, pos_out + outarg.size); |
15988 |
+ file_update_time(file_out); |
15989 |
+diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
15990 |
+index ca344bf71404..d7cde216fc87 100644 |
15991 |
+--- a/fs/fuse/fuse_i.h |
15992 |
++++ b/fs/fuse/fuse_i.h |
15993 |
+@@ -249,6 +249,7 @@ struct fuse_args { |
15994 |
+ bool out_argvar:1; |
15995 |
+ bool page_zeroing:1; |
15996 |
+ bool page_replace:1; |
15997 |
++ bool may_block:1; |
15998 |
+ struct fuse_in_arg in_args[3]; |
15999 |
+ struct fuse_arg out_args[2]; |
16000 |
+ void (*end)(struct fuse_conn *fc, struct fuse_args *args, int error); |
16001 |
+diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c |
16002 |
+index bade74768903..0c6ef5d3c6ab 100644 |
16003 |
+--- a/fs/fuse/virtio_fs.c |
16004 |
++++ b/fs/fuse/virtio_fs.c |
16005 |
+@@ -60,6 +60,12 @@ struct virtio_fs_forget { |
16006 |
+ struct virtio_fs_forget_req req; |
16007 |
+ }; |
16008 |
+ |
16009 |
++struct virtio_fs_req_work { |
16010 |
++ struct fuse_req *req; |
16011 |
++ struct virtio_fs_vq *fsvq; |
16012 |
++ struct work_struct done_work; |
16013 |
++}; |
16014 |
++ |
16015 |
+ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, |
16016 |
+ struct fuse_req *req, bool in_flight); |
16017 |
+ |
16018 |
+@@ -485,19 +491,67 @@ static void copy_args_from_argbuf(struct fuse_args *args, struct fuse_req *req) |
16019 |
+ } |
16020 |
+ |
16021 |
+ /* Work function for request completion */ |
16022 |
++static void virtio_fs_request_complete(struct fuse_req *req, |
16023 |
++ struct virtio_fs_vq *fsvq) |
16024 |
++{ |
16025 |
++ struct fuse_pqueue *fpq = &fsvq->fud->pq; |
16026 |
++ struct fuse_conn *fc = fsvq->fud->fc; |
16027 |
++ struct fuse_args *args; |
16028 |
++ struct fuse_args_pages *ap; |
16029 |
++ unsigned int len, i, thislen; |
16030 |
++ struct page *page; |
16031 |
++ |
16032 |
++ /* |
16033 |
++ * TODO verify that server properly follows FUSE protocol |
16034 |
++ * (oh.uniq, oh.len) |
16035 |
++ */ |
16036 |
++ args = req->args; |
16037 |
++ copy_args_from_argbuf(args, req); |
16038 |
++ |
16039 |
++ if (args->out_pages && args->page_zeroing) { |
16040 |
++ len = args->out_args[args->out_numargs - 1].size; |
16041 |
++ ap = container_of(args, typeof(*ap), args); |
16042 |
++ for (i = 0; i < ap->num_pages; i++) { |
16043 |
++ thislen = ap->descs[i].length; |
16044 |
++ if (len < thislen) { |
16045 |
++ WARN_ON(ap->descs[i].offset); |
16046 |
++ page = ap->pages[i]; |
16047 |
++ zero_user_segment(page, len, thislen); |
16048 |
++ len = 0; |
16049 |
++ } else { |
16050 |
++ len -= thislen; |
16051 |
++ } |
16052 |
++ } |
16053 |
++ } |
16054 |
++ |
16055 |
++ spin_lock(&fpq->lock); |
16056 |
++ clear_bit(FR_SENT, &req->flags); |
16057 |
++ spin_unlock(&fpq->lock); |
16058 |
++ |
16059 |
++ fuse_request_end(fc, req); |
16060 |
++ spin_lock(&fsvq->lock); |
16061 |
++ dec_in_flight_req(fsvq); |
16062 |
++ spin_unlock(&fsvq->lock); |
16063 |
++} |
16064 |
++ |
16065 |
++static void virtio_fs_complete_req_work(struct work_struct *work) |
16066 |
++{ |
16067 |
++ struct virtio_fs_req_work *w = |
16068 |
++ container_of(work, typeof(*w), done_work); |
16069 |
++ |
16070 |
++ virtio_fs_request_complete(w->req, w->fsvq); |
16071 |
++ kfree(w); |
16072 |
++} |
16073 |
++ |
16074 |
+ static void virtio_fs_requests_done_work(struct work_struct *work) |
16075 |
+ { |
16076 |
+ struct virtio_fs_vq *fsvq = container_of(work, struct virtio_fs_vq, |
16077 |
+ done_work); |
16078 |
+ struct fuse_pqueue *fpq = &fsvq->fud->pq; |
16079 |
+- struct fuse_conn *fc = fsvq->fud->fc; |
16080 |
+ struct virtqueue *vq = fsvq->vq; |
16081 |
+ struct fuse_req *req; |
16082 |
+- struct fuse_args_pages *ap; |
16083 |
+ struct fuse_req *next; |
16084 |
+- struct fuse_args *args; |
16085 |
+- unsigned int len, i, thislen; |
16086 |
+- struct page *page; |
16087 |
++ unsigned int len; |
16088 |
+ LIST_HEAD(reqs); |
16089 |
+ |
16090 |
+ /* Collect completed requests off the virtqueue */ |
16091 |
+@@ -515,38 +569,20 @@ static void virtio_fs_requests_done_work(struct work_struct *work) |
16092 |
+ |
16093 |
+ /* End requests */ |
16094 |
+ list_for_each_entry_safe(req, next, &reqs, list) { |
16095 |
+- /* |
16096 |
+- * TODO verify that server properly follows FUSE protocol |
16097 |
+- * (oh.uniq, oh.len) |
16098 |
+- */ |
16099 |
+- args = req->args; |
16100 |
+- copy_args_from_argbuf(args, req); |
16101 |
+- |
16102 |
+- if (args->out_pages && args->page_zeroing) { |
16103 |
+- len = args->out_args[args->out_numargs - 1].size; |
16104 |
+- ap = container_of(args, typeof(*ap), args); |
16105 |
+- for (i = 0; i < ap->num_pages; i++) { |
16106 |
+- thislen = ap->descs[i].length; |
16107 |
+- if (len < thislen) { |
16108 |
+- WARN_ON(ap->descs[i].offset); |
16109 |
+- page = ap->pages[i]; |
16110 |
+- zero_user_segment(page, len, thislen); |
16111 |
+- len = 0; |
16112 |
+- } else { |
16113 |
+- len -= thislen; |
16114 |
+- } |
16115 |
+- } |
16116 |
+- } |
16117 |
+- |
16118 |
+- spin_lock(&fpq->lock); |
16119 |
+- clear_bit(FR_SENT, &req->flags); |
16120 |
+ list_del_init(&req->list); |
16121 |
+- spin_unlock(&fpq->lock); |
16122 |
+ |
16123 |
+- fuse_request_end(fc, req); |
16124 |
+- spin_lock(&fsvq->lock); |
16125 |
+- dec_in_flight_req(fsvq); |
16126 |
+- spin_unlock(&fsvq->lock); |
16127 |
++ /* blocking async request completes in a worker context */ |
16128 |
++ if (req->args->may_block) { |
16129 |
++ struct virtio_fs_req_work *w; |
16130 |
++ |
16131 |
++ w = kzalloc(sizeof(*w), GFP_NOFS | __GFP_NOFAIL); |
16132 |
++ INIT_WORK(&w->done_work, virtio_fs_complete_req_work); |
16133 |
++ w->fsvq = fsvq; |
16134 |
++ w->req = req; |
16135 |
++ schedule_work(&w->done_work); |
16136 |
++ } else { |
16137 |
++ virtio_fs_request_complete(req, fsvq); |
16138 |
++ } |
16139 |
+ } |
16140 |
+ } |
16141 |
+ |
16142 |
+diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
16143 |
+index 0644e58c6191..b7a5221bea7d 100644 |
16144 |
+--- a/fs/gfs2/log.c |
16145 |
++++ b/fs/gfs2/log.c |
16146 |
+@@ -1003,8 +1003,10 @@ out: |
16147 |
+ * @new: New transaction to be merged |
16148 |
+ */ |
16149 |
+ |
16150 |
+-static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) |
16151 |
++static void gfs2_merge_trans(struct gfs2_sbd *sdp, struct gfs2_trans *new) |
16152 |
+ { |
16153 |
++ struct gfs2_trans *old = sdp->sd_log_tr; |
16154 |
++ |
16155 |
+ WARN_ON_ONCE(!test_bit(TR_ATTACHED, &old->tr_flags)); |
16156 |
+ |
16157 |
+ old->tr_num_buf_new += new->tr_num_buf_new; |
16158 |
+@@ -1016,6 +1018,11 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) |
16159 |
+ |
16160 |
+ list_splice_tail_init(&new->tr_databuf, &old->tr_databuf); |
16161 |
+ list_splice_tail_init(&new->tr_buf, &old->tr_buf); |
16162 |
++ |
16163 |
++ spin_lock(&sdp->sd_ail_lock); |
16164 |
++ list_splice_tail_init(&new->tr_ail1_list, &old->tr_ail1_list); |
16165 |
++ list_splice_tail_init(&new->tr_ail2_list, &old->tr_ail2_list); |
16166 |
++ spin_unlock(&sdp->sd_ail_lock); |
16167 |
+ } |
16168 |
+ |
16169 |
+ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
16170 |
+@@ -1027,7 +1034,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
16171 |
+ gfs2_log_lock(sdp); |
16172 |
+ |
16173 |
+ if (sdp->sd_log_tr) { |
16174 |
+- gfs2_merge_trans(sdp->sd_log_tr, tr); |
16175 |
++ gfs2_merge_trans(sdp, tr); |
16176 |
+ } else if (tr->tr_num_buf_new || tr->tr_num_databuf_new) { |
16177 |
+ gfs2_assert_withdraw(sdp, test_bit(TR_ALLOCED, &tr->tr_flags)); |
16178 |
+ sdp->sd_log_tr = tr; |
16179 |
+diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c |
16180 |
+index e2b69ffcc6a8..094f5fe7c009 100644 |
16181 |
+--- a/fs/gfs2/ops_fstype.c |
16182 |
++++ b/fs/gfs2/ops_fstype.c |
16183 |
+@@ -880,7 +880,7 @@ fail: |
16184 |
+ } |
16185 |
+ |
16186 |
+ static const match_table_t nolock_tokens = { |
16187 |
+- { Opt_jid, "jid=%d\n", }, |
16188 |
++ { Opt_jid, "jid=%d", }, |
16189 |
+ { Opt_err, NULL }, |
16190 |
+ }; |
16191 |
+ |
16192 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
16193 |
+index 2698e9b08490..1829be7f63a3 100644 |
16194 |
+--- a/fs/io_uring.c |
16195 |
++++ b/fs/io_uring.c |
16196 |
+@@ -513,7 +513,6 @@ enum { |
16197 |
+ REQ_F_INFLIGHT_BIT, |
16198 |
+ REQ_F_CUR_POS_BIT, |
16199 |
+ REQ_F_NOWAIT_BIT, |
16200 |
+- REQ_F_IOPOLL_COMPLETED_BIT, |
16201 |
+ REQ_F_LINK_TIMEOUT_BIT, |
16202 |
+ REQ_F_TIMEOUT_BIT, |
16203 |
+ REQ_F_ISREG_BIT, |
16204 |
+@@ -556,8 +555,6 @@ enum { |
16205 |
+ REQ_F_CUR_POS = BIT(REQ_F_CUR_POS_BIT), |
16206 |
+ /* must not punt to workers */ |
16207 |
+ REQ_F_NOWAIT = BIT(REQ_F_NOWAIT_BIT), |
16208 |
+- /* polled IO has completed */ |
16209 |
+- REQ_F_IOPOLL_COMPLETED = BIT(REQ_F_IOPOLL_COMPLETED_BIT), |
16210 |
+ /* has linked timeout */ |
16211 |
+ REQ_F_LINK_TIMEOUT = BIT(REQ_F_LINK_TIMEOUT_BIT), |
16212 |
+ /* timeout request */ |
16213 |
+@@ -618,6 +615,8 @@ struct io_kiocb { |
16214 |
+ int cflags; |
16215 |
+ bool needs_fixed_file; |
16216 |
+ u8 opcode; |
16217 |
++ /* polled IO has completed */ |
16218 |
++ u8 iopoll_completed; |
16219 |
+ |
16220 |
+ u16 buf_index; |
16221 |
+ |
16222 |
+@@ -1691,6 +1690,18 @@ static int io_put_kbuf(struct io_kiocb *req) |
16223 |
+ return cflags; |
16224 |
+ } |
16225 |
+ |
16226 |
++static void io_iopoll_queue(struct list_head *again) |
16227 |
++{ |
16228 |
++ struct io_kiocb *req; |
16229 |
++ |
16230 |
++ do { |
16231 |
++ req = list_first_entry(again, struct io_kiocb, list); |
16232 |
++ list_del(&req->list); |
16233 |
++ refcount_inc(&req->refs); |
16234 |
++ io_queue_async_work(req); |
16235 |
++ } while (!list_empty(again)); |
16236 |
++} |
16237 |
++ |
16238 |
+ /* |
16239 |
+ * Find and free completed poll iocbs |
16240 |
+ */ |
16241 |
+@@ -1699,12 +1710,21 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16242 |
+ { |
16243 |
+ struct req_batch rb; |
16244 |
+ struct io_kiocb *req; |
16245 |
++ LIST_HEAD(again); |
16246 |
++ |
16247 |
++ /* order with ->result store in io_complete_rw_iopoll() */ |
16248 |
++ smp_rmb(); |
16249 |
+ |
16250 |
+ rb.to_free = rb.need_iter = 0; |
16251 |
+ while (!list_empty(done)) { |
16252 |
+ int cflags = 0; |
16253 |
+ |
16254 |
+ req = list_first_entry(done, struct io_kiocb, list); |
16255 |
++ if (READ_ONCE(req->result) == -EAGAIN) { |
16256 |
++ req->iopoll_completed = 0; |
16257 |
++ list_move_tail(&req->list, &again); |
16258 |
++ continue; |
16259 |
++ } |
16260 |
+ list_del(&req->list); |
16261 |
+ |
16262 |
+ if (req->flags & REQ_F_BUFFER_SELECTED) |
16263 |
+@@ -1722,18 +1742,9 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16264 |
+ if (ctx->flags & IORING_SETUP_SQPOLL) |
16265 |
+ io_cqring_ev_posted(ctx); |
16266 |
+ io_free_req_many(ctx, &rb); |
16267 |
+-} |
16268 |
+ |
16269 |
+-static void io_iopoll_queue(struct list_head *again) |
16270 |
+-{ |
16271 |
+- struct io_kiocb *req; |
16272 |
+- |
16273 |
+- do { |
16274 |
+- req = list_first_entry(again, struct io_kiocb, list); |
16275 |
+- list_del(&req->list); |
16276 |
+- refcount_inc(&req->refs); |
16277 |
+- io_queue_async_work(req); |
16278 |
+- } while (!list_empty(again)); |
16279 |
++ if (!list_empty(&again)) |
16280 |
++ io_iopoll_queue(&again); |
16281 |
+ } |
16282 |
+ |
16283 |
+ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16284 |
+@@ -1741,7 +1752,6 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16285 |
+ { |
16286 |
+ struct io_kiocb *req, *tmp; |
16287 |
+ LIST_HEAD(done); |
16288 |
+- LIST_HEAD(again); |
16289 |
+ bool spin; |
16290 |
+ int ret; |
16291 |
+ |
16292 |
+@@ -1760,20 +1770,13 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16293 |
+ * If we find a request that requires polling, break out |
16294 |
+ * and complete those lists first, if we have entries there. |
16295 |
+ */ |
16296 |
+- if (req->flags & REQ_F_IOPOLL_COMPLETED) { |
16297 |
++ if (READ_ONCE(req->iopoll_completed)) { |
16298 |
+ list_move_tail(&req->list, &done); |
16299 |
+ continue; |
16300 |
+ } |
16301 |
+ if (!list_empty(&done)) |
16302 |
+ break; |
16303 |
+ |
16304 |
+- if (req->result == -EAGAIN) { |
16305 |
+- list_move_tail(&req->list, &again); |
16306 |
+- continue; |
16307 |
+- } |
16308 |
+- if (!list_empty(&again)) |
16309 |
+- break; |
16310 |
+- |
16311 |
+ ret = kiocb->ki_filp->f_op->iopoll(kiocb, spin); |
16312 |
+ if (ret < 0) |
16313 |
+ break; |
16314 |
+@@ -1786,9 +1789,6 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16315 |
+ if (!list_empty(&done)) |
16316 |
+ io_iopoll_complete(ctx, nr_events, &done); |
16317 |
+ |
16318 |
+- if (!list_empty(&again)) |
16319 |
+- io_iopoll_queue(&again); |
16320 |
+- |
16321 |
+ return ret; |
16322 |
+ } |
16323 |
+ |
16324 |
+@@ -1937,11 +1937,15 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) |
16325 |
+ if (kiocb->ki_flags & IOCB_WRITE) |
16326 |
+ kiocb_end_write(req); |
16327 |
+ |
16328 |
+- if (res != req->result) |
16329 |
++ if (res != -EAGAIN && res != req->result) |
16330 |
+ req_set_fail_links(req); |
16331 |
+- req->result = res; |
16332 |
+- if (res != -EAGAIN) |
16333 |
+- req->flags |= REQ_F_IOPOLL_COMPLETED; |
16334 |
++ |
16335 |
++ WRITE_ONCE(req->result, res); |
16336 |
++ /* order with io_poll_complete() checking ->result */ |
16337 |
++ if (res != -EAGAIN) { |
16338 |
++ smp_wmb(); |
16339 |
++ WRITE_ONCE(req->iopoll_completed, 1); |
16340 |
++ } |
16341 |
+ } |
16342 |
+ |
16343 |
+ /* |
16344 |
+@@ -1974,7 +1978,7 @@ static void io_iopoll_req_issued(struct io_kiocb *req) |
16345 |
+ * For fast devices, IO may have already completed. If it has, add |
16346 |
+ * it to the front so we find it first. |
16347 |
+ */ |
16348 |
+- if (req->flags & REQ_F_IOPOLL_COMPLETED) |
16349 |
++ if (READ_ONCE(req->iopoll_completed)) |
16350 |
+ list_add(&req->list, &ctx->poll_list); |
16351 |
+ else |
16352 |
+ list_add_tail(&req->list, &ctx->poll_list); |
16353 |
+@@ -2098,6 +2102,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, |
16354 |
+ kiocb->ki_flags |= IOCB_HIPRI; |
16355 |
+ kiocb->ki_complete = io_complete_rw_iopoll; |
16356 |
+ req->result = 0; |
16357 |
++ req->iopoll_completed = 0; |
16358 |
+ } else { |
16359 |
+ if (kiocb->ki_flags & IOCB_HIPRI) |
16360 |
+ return -EINVAL; |
16361 |
+@@ -2609,8 +2614,8 @@ copy_iov: |
16362 |
+ } |
16363 |
+ } |
16364 |
+ out_free: |
16365 |
+- kfree(iovec); |
16366 |
+- req->flags &= ~REQ_F_NEED_CLEANUP; |
16367 |
++ if (!(req->flags & REQ_F_NEED_CLEANUP)) |
16368 |
++ kfree(iovec); |
16369 |
+ return ret; |
16370 |
+ } |
16371 |
+ |
16372 |
+@@ -2732,8 +2737,8 @@ copy_iov: |
16373 |
+ } |
16374 |
+ } |
16375 |
+ out_free: |
16376 |
+- req->flags &= ~REQ_F_NEED_CLEANUP; |
16377 |
+- kfree(iovec); |
16378 |
++ if (!(req->flags & REQ_F_NEED_CLEANUP)) |
16379 |
++ kfree(iovec); |
16380 |
+ return ret; |
16381 |
+ } |
16382 |
+ |
16383 |
+@@ -4297,6 +4302,28 @@ static void io_async_queue_proc(struct file *file, struct wait_queue_head *head, |
16384 |
+ __io_queue_proc(&pt->req->apoll->poll, pt, head); |
16385 |
+ } |
16386 |
+ |
16387 |
++static void io_sq_thread_drop_mm(struct io_ring_ctx *ctx) |
16388 |
++{ |
16389 |
++ struct mm_struct *mm = current->mm; |
16390 |
++ |
16391 |
++ if (mm) { |
16392 |
++ unuse_mm(mm); |
16393 |
++ mmput(mm); |
16394 |
++ } |
16395 |
++} |
16396 |
++ |
16397 |
++static int io_sq_thread_acquire_mm(struct io_ring_ctx *ctx, |
16398 |
++ struct io_kiocb *req) |
16399 |
++{ |
16400 |
++ if (io_op_defs[req->opcode].needs_mm && !current->mm) { |
16401 |
++ if (unlikely(!mmget_not_zero(ctx->sqo_mm))) |
16402 |
++ return -EFAULT; |
16403 |
++ use_mm(ctx->sqo_mm); |
16404 |
++ } |
16405 |
++ |
16406 |
++ return 0; |
16407 |
++} |
16408 |
++ |
16409 |
+ static void io_async_task_func(struct callback_head *cb) |
16410 |
+ { |
16411 |
+ struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); |
16412 |
+@@ -4328,12 +4355,17 @@ static void io_async_task_func(struct callback_head *cb) |
16413 |
+ if (canceled) { |
16414 |
+ kfree(apoll); |
16415 |
+ io_cqring_ev_posted(ctx); |
16416 |
++end_req: |
16417 |
+ req_set_fail_links(req); |
16418 |
+ io_double_put_req(req); |
16419 |
+ return; |
16420 |
+ } |
16421 |
+ |
16422 |
+ __set_current_state(TASK_RUNNING); |
16423 |
++ if (io_sq_thread_acquire_mm(ctx, req)) { |
16424 |
++ io_cqring_add_event(req, -EFAULT); |
16425 |
++ goto end_req; |
16426 |
++ } |
16427 |
+ mutex_lock(&ctx->uring_lock); |
16428 |
+ __io_queue_sqe(req, NULL); |
16429 |
+ mutex_unlock(&ctx->uring_lock); |
16430 |
+@@ -5892,11 +5924,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, |
16431 |
+ if (unlikely(req->opcode >= IORING_OP_LAST)) |
16432 |
+ return -EINVAL; |
16433 |
+ |
16434 |
+- if (io_op_defs[req->opcode].needs_mm && !current->mm) { |
16435 |
+- if (unlikely(!mmget_not_zero(ctx->sqo_mm))) |
16436 |
+- return -EFAULT; |
16437 |
+- use_mm(ctx->sqo_mm); |
16438 |
+- } |
16439 |
++ if (unlikely(io_sq_thread_acquire_mm(ctx, req))) |
16440 |
++ return -EFAULT; |
16441 |
+ |
16442 |
+ sqe_flags = READ_ONCE(sqe->flags); |
16443 |
+ /* enforce forwards compatibility on users */ |
16444 |
+@@ -6006,16 +6035,6 @@ fail_req: |
16445 |
+ return submitted; |
16446 |
+ } |
16447 |
+ |
16448 |
+-static inline void io_sq_thread_drop_mm(struct io_ring_ctx *ctx) |
16449 |
+-{ |
16450 |
+- struct mm_struct *mm = current->mm; |
16451 |
+- |
16452 |
+- if (mm) { |
16453 |
+- unuse_mm(mm); |
16454 |
+- mmput(mm); |
16455 |
+- } |
16456 |
+-} |
16457 |
+- |
16458 |
+ static int io_sq_thread(void *data) |
16459 |
+ { |
16460 |
+ struct io_ring_ctx *ctx = data; |
16461 |
+@@ -7385,7 +7404,17 @@ static void io_ring_exit_work(struct work_struct *work) |
16462 |
+ if (ctx->rings) |
16463 |
+ io_cqring_overflow_flush(ctx, true); |
16464 |
+ |
16465 |
+- wait_for_completion(&ctx->completions[0]); |
16466 |
++ /* |
16467 |
++ * If we're doing polled IO and end up having requests being |
16468 |
++ * submitted async (out-of-line), then completions can come in while |
16469 |
++ * we're waiting for refs to drop. We need to reap these manually, |
16470 |
++ * as nobody else will be looking for them. |
16471 |
++ */ |
16472 |
++ while (!wait_for_completion_timeout(&ctx->completions[0], HZ/20)) { |
16473 |
++ io_iopoll_reap_events(ctx); |
16474 |
++ if (ctx->rings) |
16475 |
++ io_cqring_overflow_flush(ctx, true); |
16476 |
++ } |
16477 |
+ io_ring_ctx_free(ctx); |
16478 |
+ } |
16479 |
+ |
16480 |
+diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
16481 |
+index a49d0e670ddf..e4944436e733 100644 |
16482 |
+--- a/fs/jbd2/journal.c |
16483 |
++++ b/fs/jbd2/journal.c |
16484 |
+@@ -1140,6 +1140,7 @@ static journal_t *journal_init_common(struct block_device *bdev, |
16485 |
+ init_waitqueue_head(&journal->j_wait_commit); |
16486 |
+ init_waitqueue_head(&journal->j_wait_updates); |
16487 |
+ init_waitqueue_head(&journal->j_wait_reserved); |
16488 |
++ mutex_init(&journal->j_abort_mutex); |
16489 |
+ mutex_init(&journal->j_barrier); |
16490 |
+ mutex_init(&journal->j_checkpoint_mutex); |
16491 |
+ spin_lock_init(&journal->j_revoke_lock); |
16492 |
+@@ -1402,7 +1403,8 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) |
16493 |
+ printk(KERN_ERR "JBD2: Error %d detected when updating " |
16494 |
+ "journal superblock for %s.\n", ret, |
16495 |
+ journal->j_devname); |
16496 |
+- jbd2_journal_abort(journal, ret); |
16497 |
++ if (!is_journal_aborted(journal)) |
16498 |
++ jbd2_journal_abort(journal, ret); |
16499 |
+ } |
16500 |
+ |
16501 |
+ return ret; |
16502 |
+@@ -2153,6 +2155,13 @@ void jbd2_journal_abort(journal_t *journal, int errno) |
16503 |
+ { |
16504 |
+ transaction_t *transaction; |
16505 |
+ |
16506 |
++ /* |
16507 |
++ * Lock the aborting procedure until everything is done, this avoid |
16508 |
++ * races between filesystem's error handling flow (e.g. ext4_abort()), |
16509 |
++ * ensure panic after the error info is written into journal's |
16510 |
++ * superblock. |
16511 |
++ */ |
16512 |
++ mutex_lock(&journal->j_abort_mutex); |
16513 |
+ /* |
16514 |
+ * ESHUTDOWN always takes precedence because a file system check |
16515 |
+ * caused by any other journal abort error is not required after |
16516 |
+@@ -2167,6 +2176,7 @@ void jbd2_journal_abort(journal_t *journal, int errno) |
16517 |
+ journal->j_errno = errno; |
16518 |
+ jbd2_journal_update_sb_errno(journal); |
16519 |
+ } |
16520 |
++ mutex_unlock(&journal->j_abort_mutex); |
16521 |
+ return; |
16522 |
+ } |
16523 |
+ |
16524 |
+@@ -2188,10 +2198,7 @@ void jbd2_journal_abort(journal_t *journal, int errno) |
16525 |
+ * layer could realise that a filesystem check is needed. |
16526 |
+ */ |
16527 |
+ jbd2_journal_update_sb_errno(journal); |
16528 |
+- |
16529 |
+- write_lock(&journal->j_state_lock); |
16530 |
+- journal->j_flags |= JBD2_REC_ERR; |
16531 |
+- write_unlock(&journal->j_state_lock); |
16532 |
++ mutex_unlock(&journal->j_abort_mutex); |
16533 |
+ } |
16534 |
+ |
16535 |
+ /** |
16536 |
+diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c |
16537 |
+index a57e7c72c7f4..d49b1d197908 100644 |
16538 |
+--- a/fs/nfs/direct.c |
16539 |
++++ b/fs/nfs/direct.c |
16540 |
+@@ -731,6 +731,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) |
16541 |
+ nfs_list_remove_request(req); |
16542 |
+ if (request_commit) { |
16543 |
+ kref_get(&req->wb_kref); |
16544 |
++ memcpy(&req->wb_verf, &hdr->verf.verifier, |
16545 |
++ sizeof(req->wb_verf)); |
16546 |
+ nfs_mark_request_commit(req, hdr->lseg, &cinfo, |
16547 |
+ hdr->ds_commit_idx); |
16548 |
+ } |
16549 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
16550 |
+index b9d0921cb4fe..0bf1f835de01 100644 |
16551 |
+--- a/fs/nfs/inode.c |
16552 |
++++ b/fs/nfs/inode.c |
16553 |
+@@ -833,6 +833,8 @@ int nfs_getattr(const struct path *path, struct kstat *stat, |
16554 |
+ do_update |= cache_validity & NFS_INO_INVALID_ATIME; |
16555 |
+ if (request_mask & (STATX_CTIME|STATX_MTIME)) |
16556 |
+ do_update |= cache_validity & NFS_INO_REVAL_PAGECACHE; |
16557 |
++ if (request_mask & STATX_BLOCKS) |
16558 |
++ do_update |= cache_validity & NFS_INO_INVALID_BLOCKS; |
16559 |
+ if (do_update) { |
16560 |
+ /* Update the attribute cache */ |
16561 |
+ if (!(server->flags & NFS_MOUNT_NOAC)) |
16562 |
+@@ -1764,7 +1766,8 @@ out_noforce: |
16563 |
+ status = nfs_post_op_update_inode_locked(inode, fattr, |
16564 |
+ NFS_INO_INVALID_CHANGE |
16565 |
+ | NFS_INO_INVALID_CTIME |
16566 |
+- | NFS_INO_INVALID_MTIME); |
16567 |
++ | NFS_INO_INVALID_MTIME |
16568 |
++ | NFS_INO_INVALID_BLOCKS); |
16569 |
+ return status; |
16570 |
+ } |
16571 |
+ |
16572 |
+@@ -1871,7 +1874,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
16573 |
+ nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR |
16574 |
+ | NFS_INO_INVALID_ATIME |
16575 |
+ | NFS_INO_REVAL_FORCED |
16576 |
+- | NFS_INO_REVAL_PAGECACHE); |
16577 |
++ | NFS_INO_REVAL_PAGECACHE |
16578 |
++ | NFS_INO_INVALID_BLOCKS); |
16579 |
+ |
16580 |
+ /* Do atomic weak cache consistency updates */ |
16581 |
+ nfs_wcc_update_inode(inode, fattr); |
16582 |
+@@ -2033,8 +2037,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
16583 |
+ inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used); |
16584 |
+ } else if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) |
16585 |
+ inode->i_blocks = fattr->du.nfs2.blocks; |
16586 |
+- else |
16587 |
++ else { |
16588 |
++ nfsi->cache_validity |= save_cache_validity & |
16589 |
++ (NFS_INO_INVALID_BLOCKS |
16590 |
++ | NFS_INO_REVAL_FORCED); |
16591 |
+ cache_revalidated = false; |
16592 |
++ } |
16593 |
+ |
16594 |
+ /* Update attrtimeo value if we're out of the unstable period */ |
16595 |
+ if (attr_changed) { |
16596 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
16597 |
+index 9056f3dd380e..e32717fd1169 100644 |
16598 |
+--- a/fs/nfs/nfs4proc.c |
16599 |
++++ b/fs/nfs/nfs4proc.c |
16600 |
+@@ -7909,7 +7909,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) |
16601 |
+ } |
16602 |
+ |
16603 |
+ static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { |
16604 |
+- .rpc_call_done = &nfs4_bind_one_conn_to_session_done, |
16605 |
++ .rpc_call_done = nfs4_bind_one_conn_to_session_done, |
16606 |
+ }; |
16607 |
+ |
16608 |
+ /* |
16609 |
+diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h |
16610 |
+index 10ec5ecdf117..65c331f75e9c 100644 |
16611 |
+--- a/fs/nfsd/cache.h |
16612 |
++++ b/fs/nfsd/cache.h |
16613 |
+@@ -78,6 +78,8 @@ enum { |
16614 |
+ /* Checksum this amount of the request */ |
16615 |
+ #define RC_CSUMLEN (256U) |
16616 |
+ |
16617 |
++int nfsd_drc_slab_create(void); |
16618 |
++void nfsd_drc_slab_free(void); |
16619 |
+ int nfsd_reply_cache_init(struct nfsd_net *); |
16620 |
+ void nfsd_reply_cache_shutdown(struct nfsd_net *); |
16621 |
+ int nfsd_cache_lookup(struct svc_rqst *); |
16622 |
+diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h |
16623 |
+index 09aa545825bd..9217cb64bf0e 100644 |
16624 |
+--- a/fs/nfsd/netns.h |
16625 |
++++ b/fs/nfsd/netns.h |
16626 |
+@@ -139,7 +139,6 @@ struct nfsd_net { |
16627 |
+ * Duplicate reply cache |
16628 |
+ */ |
16629 |
+ struct nfsd_drc_bucket *drc_hashtbl; |
16630 |
+- struct kmem_cache *drc_slab; |
16631 |
+ |
16632 |
+ /* max number of entries allowed in the cache */ |
16633 |
+ unsigned int max_drc_entries; |
16634 |
+diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c |
16635 |
+index 5cf91322de0f..07e0c6f6322f 100644 |
16636 |
+--- a/fs/nfsd/nfs4callback.c |
16637 |
++++ b/fs/nfsd/nfs4callback.c |
16638 |
+@@ -1301,6 +1301,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) |
16639 |
+ err = setup_callback_client(clp, &conn, ses); |
16640 |
+ if (err) { |
16641 |
+ nfsd4_mark_cb_down(clp, err); |
16642 |
++ if (c) |
16643 |
++ svc_xprt_put(c->cn_xprt); |
16644 |
+ return; |
16645 |
+ } |
16646 |
+ } |
16647 |
+diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c |
16648 |
+index 96352ab7bd81..4a258065188e 100644 |
16649 |
+--- a/fs/nfsd/nfscache.c |
16650 |
++++ b/fs/nfsd/nfscache.c |
16651 |
+@@ -36,6 +36,8 @@ struct nfsd_drc_bucket { |
16652 |
+ spinlock_t cache_lock; |
16653 |
+ }; |
16654 |
+ |
16655 |
++static struct kmem_cache *drc_slab; |
16656 |
++ |
16657 |
+ static int nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec); |
16658 |
+ static unsigned long nfsd_reply_cache_count(struct shrinker *shrink, |
16659 |
+ struct shrink_control *sc); |
16660 |
+@@ -95,7 +97,7 @@ nfsd_reply_cache_alloc(struct svc_rqst *rqstp, __wsum csum, |
16661 |
+ { |
16662 |
+ struct svc_cacherep *rp; |
16663 |
+ |
16664 |
+- rp = kmem_cache_alloc(nn->drc_slab, GFP_KERNEL); |
16665 |
++ rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); |
16666 |
+ if (rp) { |
16667 |
+ rp->c_state = RC_UNUSED; |
16668 |
+ rp->c_type = RC_NOCACHE; |
16669 |
+@@ -129,7 +131,7 @@ nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, |
16670 |
+ atomic_dec(&nn->num_drc_entries); |
16671 |
+ nn->drc_mem_usage -= sizeof(*rp); |
16672 |
+ } |
16673 |
+- kmem_cache_free(nn->drc_slab, rp); |
16674 |
++ kmem_cache_free(drc_slab, rp); |
16675 |
+ } |
16676 |
+ |
16677 |
+ static void |
16678 |
+@@ -141,6 +143,18 @@ nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, |
16679 |
+ spin_unlock(&b->cache_lock); |
16680 |
+ } |
16681 |
+ |
16682 |
++int nfsd_drc_slab_create(void) |
16683 |
++{ |
16684 |
++ drc_slab = kmem_cache_create("nfsd_drc", |
16685 |
++ sizeof(struct svc_cacherep), 0, 0, NULL); |
16686 |
++ return drc_slab ? 0: -ENOMEM; |
16687 |
++} |
16688 |
++ |
16689 |
++void nfsd_drc_slab_free(void) |
16690 |
++{ |
16691 |
++ kmem_cache_destroy(drc_slab); |
16692 |
++} |
16693 |
++ |
16694 |
+ int nfsd_reply_cache_init(struct nfsd_net *nn) |
16695 |
+ { |
16696 |
+ unsigned int hashsize; |
16697 |
+@@ -159,18 +173,13 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) |
16698 |
+ if (status) |
16699 |
+ goto out_nomem; |
16700 |
+ |
16701 |
+- nn->drc_slab = kmem_cache_create("nfsd_drc", |
16702 |
+- sizeof(struct svc_cacherep), 0, 0, NULL); |
16703 |
+- if (!nn->drc_slab) |
16704 |
+- goto out_shrinker; |
16705 |
+- |
16706 |
+ nn->drc_hashtbl = kcalloc(hashsize, |
16707 |
+ sizeof(*nn->drc_hashtbl), GFP_KERNEL); |
16708 |
+ if (!nn->drc_hashtbl) { |
16709 |
+ nn->drc_hashtbl = vzalloc(array_size(hashsize, |
16710 |
+ sizeof(*nn->drc_hashtbl))); |
16711 |
+ if (!nn->drc_hashtbl) |
16712 |
+- goto out_slab; |
16713 |
++ goto out_shrinker; |
16714 |
+ } |
16715 |
+ |
16716 |
+ for (i = 0; i < hashsize; i++) { |
16717 |
+@@ -180,8 +189,6 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) |
16718 |
+ nn->drc_hashsize = hashsize; |
16719 |
+ |
16720 |
+ return 0; |
16721 |
+-out_slab: |
16722 |
+- kmem_cache_destroy(nn->drc_slab); |
16723 |
+ out_shrinker: |
16724 |
+ unregister_shrinker(&nn->nfsd_reply_cache_shrinker); |
16725 |
+ out_nomem: |
16726 |
+@@ -209,8 +216,6 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn) |
16727 |
+ nn->drc_hashtbl = NULL; |
16728 |
+ nn->drc_hashsize = 0; |
16729 |
+ |
16730 |
+- kmem_cache_destroy(nn->drc_slab); |
16731 |
+- nn->drc_slab = NULL; |
16732 |
+ } |
16733 |
+ |
16734 |
+ /* |
16735 |
+@@ -464,8 +469,7 @@ found_entry: |
16736 |
+ rtn = RC_REPLY; |
16737 |
+ break; |
16738 |
+ default: |
16739 |
+- printk(KERN_WARNING "nfsd: bad repcache type %d\n", rp->c_type); |
16740 |
+- nfsd_reply_cache_free_locked(b, rp, nn); |
16741 |
++ WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type); |
16742 |
+ } |
16743 |
+ |
16744 |
+ goto out; |
16745 |
+diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c |
16746 |
+index 3bb2db947d29..71687d99b090 100644 |
16747 |
+--- a/fs/nfsd/nfsctl.c |
16748 |
++++ b/fs/nfsd/nfsctl.c |
16749 |
+@@ -1533,6 +1533,9 @@ static int __init init_nfsd(void) |
16750 |
+ goto out_free_slabs; |
16751 |
+ nfsd_fault_inject_init(); /* nfsd fault injection controls */ |
16752 |
+ nfsd_stat_init(); /* Statistics */ |
16753 |
++ retval = nfsd_drc_slab_create(); |
16754 |
++ if (retval) |
16755 |
++ goto out_free_stat; |
16756 |
+ nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
16757 |
+ retval = create_proc_exports_entry(); |
16758 |
+ if (retval) |
16759 |
+@@ -1546,6 +1549,8 @@ out_free_all: |
16760 |
+ remove_proc_entry("fs/nfs", NULL); |
16761 |
+ out_free_lockd: |
16762 |
+ nfsd_lockd_shutdown(); |
16763 |
++ nfsd_drc_slab_free(); |
16764 |
++out_free_stat: |
16765 |
+ nfsd_stat_shutdown(); |
16766 |
+ nfsd_fault_inject_cleanup(); |
16767 |
+ nfsd4_exit_pnfs(); |
16768 |
+@@ -1560,6 +1565,7 @@ out_unregister_pernet: |
16769 |
+ |
16770 |
+ static void __exit exit_nfsd(void) |
16771 |
+ { |
16772 |
++ nfsd_drc_slab_free(); |
16773 |
+ remove_proc_entry("fs/nfs/exports", NULL); |
16774 |
+ remove_proc_entry("fs/nfs", NULL); |
16775 |
+ nfsd_stat_shutdown(); |
16776 |
+diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c |
16777 |
+index 9955d75c0585..ad31ec4ad627 100644 |
16778 |
+--- a/fs/proc/bootconfig.c |
16779 |
++++ b/fs/proc/bootconfig.c |
16780 |
+@@ -26,8 +26,9 @@ static int boot_config_proc_show(struct seq_file *m, void *v) |
16781 |
+ static int __init copy_xbc_key_value_list(char *dst, size_t size) |
16782 |
+ { |
16783 |
+ struct xbc_node *leaf, *vnode; |
16784 |
+- const char *val; |
16785 |
+ char *key, *end = dst + size; |
16786 |
++ const char *val; |
16787 |
++ char q; |
16788 |
+ int ret = 0; |
16789 |
+ |
16790 |
+ key = kzalloc(XBC_KEYLEN_MAX, GFP_KERNEL); |
16791 |
+@@ -41,16 +42,20 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) |
16792 |
+ break; |
16793 |
+ dst += ret; |
16794 |
+ vnode = xbc_node_get_child(leaf); |
16795 |
+- if (vnode && xbc_node_is_array(vnode)) { |
16796 |
++ if (vnode) { |
16797 |
+ xbc_array_for_each_value(vnode, val) { |
16798 |
+- ret = snprintf(dst, rest(dst, end), "\"%s\"%s", |
16799 |
+- val, vnode->next ? ", " : "\n"); |
16800 |
++ if (strchr(val, '"')) |
16801 |
++ q = '\''; |
16802 |
++ else |
16803 |
++ q = '"'; |
16804 |
++ ret = snprintf(dst, rest(dst, end), "%c%s%c%s", |
16805 |
++ q, val, q, vnode->next ? ", " : "\n"); |
16806 |
+ if (ret < 0) |
16807 |
+ goto out; |
16808 |
+ dst += ret; |
16809 |
+ } |
16810 |
+ } else { |
16811 |
+- ret = snprintf(dst, rest(dst, end), "\"%s\"\n", val); |
16812 |
++ ret = snprintf(dst, rest(dst, end), "\"\"\n"); |
16813 |
+ if (ret < 0) |
16814 |
+ break; |
16815 |
+ dst += ret; |
16816 |
+diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
16817 |
+index d1772786af29..8845faa8161a 100644 |
16818 |
+--- a/fs/xfs/xfs_inode.c |
16819 |
++++ b/fs/xfs/xfs_inode.c |
16820 |
+@@ -2639,8 +2639,10 @@ xfs_ifree_cluster( |
16821 |
+ error = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno, |
16822 |
+ mp->m_bsize * igeo->blocks_per_cluster, |
16823 |
+ XBF_UNMAPPED, &bp); |
16824 |
+- if (error) |
16825 |
++ if (error) { |
16826 |
++ xfs_perag_put(pag); |
16827 |
+ return error; |
16828 |
++ } |
16829 |
+ |
16830 |
+ /* |
16831 |
+ * This buffer may not have been correctly initialised as we |
16832 |
+diff --git a/include/linux/bitops.h b/include/linux/bitops.h |
16833 |
+index 9acf654f0b19..99f2ac30b1d9 100644 |
16834 |
+--- a/include/linux/bitops.h |
16835 |
++++ b/include/linux/bitops.h |
16836 |
+@@ -72,7 +72,7 @@ static inline int get_bitmask_order(unsigned int count) |
16837 |
+ |
16838 |
+ static __always_inline unsigned long hweight_long(unsigned long w) |
16839 |
+ { |
16840 |
+- return sizeof(w) == 4 ? hweight32(w) : hweight64(w); |
16841 |
++ return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w); |
16842 |
+ } |
16843 |
+ |
16844 |
+ /** |
16845 |
+diff --git a/include/linux/coresight.h b/include/linux/coresight.h |
16846 |
+index 193cc9dbf448..09f0565a5de3 100644 |
16847 |
+--- a/include/linux/coresight.h |
16848 |
++++ b/include/linux/coresight.h |
16849 |
+@@ -100,10 +100,12 @@ union coresight_dev_subtype { |
16850 |
+ }; |
16851 |
+ |
16852 |
+ /** |
16853 |
+- * struct coresight_platform_data - data harvested from the DT specification |
16854 |
+- * @nr_inport: number of input ports for this component. |
16855 |
+- * @nr_outport: number of output ports for this component. |
16856 |
+- * @conns: Array of nr_outport connections from this component |
16857 |
++ * struct coresight_platform_data - data harvested from the firmware |
16858 |
++ * specification. |
16859 |
++ * |
16860 |
++ * @nr_inport: Number of elements for the input connections. |
16861 |
++ * @nr_outport: Number of elements for the output connections. |
16862 |
++ * @conns: Sparse array of nr_outport connections from this component. |
16863 |
+ */ |
16864 |
+ struct coresight_platform_data { |
16865 |
+ int nr_inport; |
16866 |
+diff --git a/include/linux/ioport.h b/include/linux/ioport.h |
16867 |
+index a9b9170b5dd2..6c3eca90cbc4 100644 |
16868 |
+--- a/include/linux/ioport.h |
16869 |
++++ b/include/linux/ioport.h |
16870 |
+@@ -301,5 +301,11 @@ struct resource *devm_request_free_mem_region(struct device *dev, |
16871 |
+ struct resource *request_free_mem_region(struct resource *base, |
16872 |
+ unsigned long size, const char *name); |
16873 |
+ |
16874 |
++#ifdef CONFIG_IO_STRICT_DEVMEM |
16875 |
++void revoke_devmem(struct resource *res); |
16876 |
++#else |
16877 |
++static inline void revoke_devmem(struct resource *res) { }; |
16878 |
++#endif |
16879 |
++ |
16880 |
+ #endif /* __ASSEMBLY__ */ |
16881 |
+ #endif /* _LINUX_IOPORT_H */ |
16882 |
+diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h |
16883 |
+index f613d8529863..d56128df2aff 100644 |
16884 |
+--- a/include/linux/jbd2.h |
16885 |
++++ b/include/linux/jbd2.h |
16886 |
+@@ -765,6 +765,11 @@ struct journal_s |
16887 |
+ */ |
16888 |
+ int j_errno; |
16889 |
+ |
16890 |
++ /** |
16891 |
++ * @j_abort_mutex: Lock the whole aborting procedure. |
16892 |
++ */ |
16893 |
++ struct mutex j_abort_mutex; |
16894 |
++ |
16895 |
+ /** |
16896 |
+ * @j_sb_buffer: The first part of the superblock buffer. |
16897 |
+ */ |
16898 |
+@@ -1247,7 +1252,6 @@ JBD2_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3) |
16899 |
+ #define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file |
16900 |
+ * data write error in ordered |
16901 |
+ * mode */ |
16902 |
+-#define JBD2_REC_ERR 0x080 /* The errno in the sb has been recorded */ |
16903 |
+ |
16904 |
+ /* |
16905 |
+ * Function declarations for the journaling transaction and buffer |
16906 |
+diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h |
16907 |
+index 04bdaf01112c..645fd401c856 100644 |
16908 |
+--- a/include/linux/kprobes.h |
16909 |
++++ b/include/linux/kprobes.h |
16910 |
+@@ -350,6 +350,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) |
16911 |
+ return this_cpu_ptr(&kprobe_ctlblk); |
16912 |
+ } |
16913 |
+ |
16914 |
++extern struct kprobe kprobe_busy; |
16915 |
++void kprobe_busy_begin(void); |
16916 |
++void kprobe_busy_end(void); |
16917 |
++ |
16918 |
+ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset); |
16919 |
+ int register_kprobe(struct kprobe *p); |
16920 |
+ void unregister_kprobe(struct kprobe *p); |
16921 |
+diff --git a/include/linux/libata.h b/include/linux/libata.h |
16922 |
+index cffa4714bfa8..ae6dfc107ea8 100644 |
16923 |
+--- a/include/linux/libata.h |
16924 |
++++ b/include/linux/libata.h |
16925 |
+@@ -22,6 +22,7 @@ |
16926 |
+ #include <linux/acpi.h> |
16927 |
+ #include <linux/cdrom.h> |
16928 |
+ #include <linux/sched.h> |
16929 |
++#include <linux/async.h> |
16930 |
+ |
16931 |
+ /* |
16932 |
+ * Define if arch has non-standard setup. This is a _PCI_ standard |
16933 |
+@@ -872,6 +873,8 @@ struct ata_port { |
16934 |
+ struct timer_list fastdrain_timer; |
16935 |
+ unsigned long fastdrain_cnt; |
16936 |
+ |
16937 |
++ async_cookie_t cookie; |
16938 |
++ |
16939 |
+ int em_message_type; |
16940 |
+ void *private_data; |
16941 |
+ |
16942 |
+diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h |
16943 |
+index 3c67983678ec..744dce63946e 100644 |
16944 |
+--- a/include/linux/mfd/stmfx.h |
16945 |
++++ b/include/linux/mfd/stmfx.h |
16946 |
+@@ -109,6 +109,7 @@ struct stmfx { |
16947 |
+ struct device *dev; |
16948 |
+ struct regmap *map; |
16949 |
+ struct regulator *vdd; |
16950 |
++ int irq; |
16951 |
+ struct irq_domain *irq_domain; |
16952 |
+ struct mutex lock; /* IRQ bus lock */ |
16953 |
+ u8 irq_src; |
16954 |
+diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h |
16955 |
+index 73eda45f1cfd..6ee9119acc5d 100644 |
16956 |
+--- a/include/linux/nfs_fs.h |
16957 |
++++ b/include/linux/nfs_fs.h |
16958 |
+@@ -230,6 +230,7 @@ struct nfs4_copy_state { |
16959 |
+ #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */ |
16960 |
+ #define NFS_INO_DATA_INVAL_DEFER \ |
16961 |
+ BIT(13) /* Deferred cache invalidation */ |
16962 |
++#define NFS_INO_INVALID_BLOCKS BIT(14) /* cached blocks are invalid */ |
16963 |
+ |
16964 |
+ #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ |
16965 |
+ | NFS_INO_INVALID_CTIME \ |
16966 |
+diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h |
16967 |
+index 8675e145ea8b..2040696d75b6 100644 |
16968 |
+--- a/include/linux/usb/composite.h |
16969 |
++++ b/include/linux/usb/composite.h |
16970 |
+@@ -249,6 +249,9 @@ int usb_function_activate(struct usb_function *); |
16971 |
+ |
16972 |
+ int usb_interface_id(struct usb_configuration *, struct usb_function *); |
16973 |
+ |
16974 |
++int config_ep_by_speed_and_alt(struct usb_gadget *g, struct usb_function *f, |
16975 |
++ struct usb_ep *_ep, u8 alt); |
16976 |
++ |
16977 |
+ int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, |
16978 |
+ struct usb_ep *_ep); |
16979 |
+ |
16980 |
+diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h |
16981 |
+index 9411c08a5c7e..73a6113322c6 100644 |
16982 |
+--- a/include/linux/usb/gadget.h |
16983 |
++++ b/include/linux/usb/gadget.h |
16984 |
+@@ -373,6 +373,7 @@ struct usb_gadget_ops { |
16985 |
+ * @connected: True if gadget is connected. |
16986 |
+ * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag |
16987 |
+ * indicates that it supports LPM as per the LPM ECN & errata. |
16988 |
++ * @irq: the interrupt number for device controller. |
16989 |
+ * |
16990 |
+ * Gadgets have a mostly-portable "gadget driver" implementing device |
16991 |
+ * functions, handling all usb configurations and interfaces. Gadget |
16992 |
+@@ -427,6 +428,7 @@ struct usb_gadget { |
16993 |
+ unsigned deactivated:1; |
16994 |
+ unsigned connected:1; |
16995 |
+ unsigned lpm_capable:1; |
16996 |
++ int irq; |
16997 |
+ }; |
16998 |
+ #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) |
16999 |
+ |
17000 |
+diff --git a/include/sound/soc.h b/include/sound/soc.h |
17001 |
+index 946f88a6c63d..8e480efeda2a 100644 |
17002 |
+--- a/include/sound/soc.h |
17003 |
++++ b/include/sound/soc.h |
17004 |
+@@ -790,9 +790,6 @@ struct snd_soc_dai_link { |
17005 |
+ const struct snd_soc_pcm_stream *params; |
17006 |
+ unsigned int num_params; |
17007 |
+ |
17008 |
+- struct snd_soc_dapm_widget *playback_widget; |
17009 |
+- struct snd_soc_dapm_widget *capture_widget; |
17010 |
+- |
17011 |
+ unsigned int dai_fmt; /* format to set on init */ |
17012 |
+ |
17013 |
+ enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ |
17014 |
+@@ -1156,6 +1153,9 @@ struct snd_soc_pcm_runtime { |
17015 |
+ struct snd_soc_dai **cpu_dais; |
17016 |
+ unsigned int num_cpus; |
17017 |
+ |
17018 |
++ struct snd_soc_dapm_widget *playback_widget; |
17019 |
++ struct snd_soc_dapm_widget *capture_widget; |
17020 |
++ |
17021 |
+ struct delayed_work delayed_work; |
17022 |
+ void (*close_delayed_work_func)(struct snd_soc_pcm_runtime *rtd); |
17023 |
+ #ifdef CONFIG_DEBUG_FS |
17024 |
+@@ -1177,7 +1177,7 @@ struct snd_soc_pcm_runtime { |
17025 |
+ #define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus] |
17026 |
+ |
17027 |
+ #define for_each_rtd_components(rtd, i, component) \ |
17028 |
+- for ((i) = 0; \ |
17029 |
++ for ((i) = 0, component = NULL; \ |
17030 |
+ ((i) < rtd->num_components) && ((component) = rtd->components[i]);\ |
17031 |
+ (i)++) |
17032 |
+ #define for_each_rtd_cpu_dais(rtd, i, dai) \ |
17033 |
+diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h |
17034 |
+index c612cabbc378..93eddd32bd74 100644 |
17035 |
+--- a/include/trace/events/afs.h |
17036 |
++++ b/include/trace/events/afs.h |
17037 |
+@@ -988,24 +988,22 @@ TRACE_EVENT(afs_edit_dir, |
17038 |
+ ); |
17039 |
+ |
17040 |
+ TRACE_EVENT(afs_protocol_error, |
17041 |
+- TP_PROTO(struct afs_call *call, int error, enum afs_eproto_cause cause), |
17042 |
++ TP_PROTO(struct afs_call *call, enum afs_eproto_cause cause), |
17043 |
+ |
17044 |
+- TP_ARGS(call, error, cause), |
17045 |
++ TP_ARGS(call, cause), |
17046 |
+ |
17047 |
+ TP_STRUCT__entry( |
17048 |
+ __field(unsigned int, call ) |
17049 |
+- __field(int, error ) |
17050 |
+ __field(enum afs_eproto_cause, cause ) |
17051 |
+ ), |
17052 |
+ |
17053 |
+ TP_fast_assign( |
17054 |
+ __entry->call = call ? call->debug_id : 0; |
17055 |
+- __entry->error = error; |
17056 |
+ __entry->cause = cause; |
17057 |
+ ), |
17058 |
+ |
17059 |
+- TP_printk("c=%08x r=%d %s", |
17060 |
+- __entry->call, __entry->error, |
17061 |
++ TP_printk("c=%08x %s", |
17062 |
++ __entry->call, |
17063 |
+ __print_symbolic(__entry->cause, afs_eproto_causes)) |
17064 |
+ ); |
17065 |
+ |
17066 |
+diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h |
17067 |
+index d78064007b17..f3956fc11de6 100644 |
17068 |
+--- a/include/uapi/linux/magic.h |
17069 |
++++ b/include/uapi/linux/magic.h |
17070 |
+@@ -94,6 +94,7 @@ |
17071 |
+ #define BALLOON_KVM_MAGIC 0x13661366 |
17072 |
+ #define ZSMALLOC_MAGIC 0x58295829 |
17073 |
+ #define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ |
17074 |
++#define DEVMEM_MAGIC 0x454d444d /* "DMEM" */ |
17075 |
+ #define Z3FOLD_MAGIC 0x33 |
17076 |
+ #define PPC_CMM_MAGIC 0xc7571590 |
17077 |
+ |
17078 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
17079 |
+index 5e52765161f9..c8acc8f37583 100644 |
17080 |
+--- a/kernel/bpf/syscall.c |
17081 |
++++ b/kernel/bpf/syscall.c |
17082 |
+@@ -2924,6 +2924,7 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog) |
17083 |
+ struct bpf_insn *insns; |
17084 |
+ u32 off, type; |
17085 |
+ u64 imm; |
17086 |
++ u8 code; |
17087 |
+ int i; |
17088 |
+ |
17089 |
+ insns = kmemdup(prog->insnsi, bpf_prog_insn_size(prog), |
17090 |
+@@ -2932,21 +2933,27 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog) |
17091 |
+ return insns; |
17092 |
+ |
17093 |
+ for (i = 0; i < prog->len; i++) { |
17094 |
+- if (insns[i].code == (BPF_JMP | BPF_TAIL_CALL)) { |
17095 |
++ code = insns[i].code; |
17096 |
++ |
17097 |
++ if (code == (BPF_JMP | BPF_TAIL_CALL)) { |
17098 |
+ insns[i].code = BPF_JMP | BPF_CALL; |
17099 |
+ insns[i].imm = BPF_FUNC_tail_call; |
17100 |
+ /* fall-through */ |
17101 |
+ } |
17102 |
+- if (insns[i].code == (BPF_JMP | BPF_CALL) || |
17103 |
+- insns[i].code == (BPF_JMP | BPF_CALL_ARGS)) { |
17104 |
+- if (insns[i].code == (BPF_JMP | BPF_CALL_ARGS)) |
17105 |
++ if (code == (BPF_JMP | BPF_CALL) || |
17106 |
++ code == (BPF_JMP | BPF_CALL_ARGS)) { |
17107 |
++ if (code == (BPF_JMP | BPF_CALL_ARGS)) |
17108 |
+ insns[i].code = BPF_JMP | BPF_CALL; |
17109 |
+ if (!bpf_dump_raw_ok()) |
17110 |
+ insns[i].imm = 0; |
17111 |
+ continue; |
17112 |
+ } |
17113 |
++ if (BPF_CLASS(code) == BPF_LDX && BPF_MODE(code) == BPF_PROBE_MEM) { |
17114 |
++ insns[i].code = BPF_LDX | BPF_SIZE(code) | BPF_MEM; |
17115 |
++ continue; |
17116 |
++ } |
17117 |
+ |
17118 |
+- if (insns[i].code != (BPF_LD | BPF_IMM | BPF_DW)) |
17119 |
++ if (code != (BPF_LD | BPF_IMM | BPF_DW)) |
17120 |
+ continue; |
17121 |
+ |
17122 |
+ imm = ((u64)insns[i + 1].imm << 32) | (u32)insns[i].imm; |
17123 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
17124 |
+index efe14cf24bc6..739d9ba3ba6b 100644 |
17125 |
+--- a/kernel/bpf/verifier.c |
17126 |
++++ b/kernel/bpf/verifier.c |
17127 |
+@@ -7366,7 +7366,7 @@ static int check_btf_func(struct bpf_verifier_env *env, |
17128 |
+ const struct btf *btf; |
17129 |
+ void __user *urecord; |
17130 |
+ u32 prev_offset = 0; |
17131 |
+- int ret = 0; |
17132 |
++ int ret = -ENOMEM; |
17133 |
+ |
17134 |
+ nfuncs = attr->func_info_cnt; |
17135 |
+ if (!nfuncs) |
17136 |
+diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
17137 |
+index 2625c241ac00..195ecb955fcc 100644 |
17138 |
+--- a/kernel/kprobes.c |
17139 |
++++ b/kernel/kprobes.c |
17140 |
+@@ -586,11 +586,12 @@ static void kprobe_optimizer(struct work_struct *work) |
17141 |
+ mutex_unlock(&module_mutex); |
17142 |
+ mutex_unlock(&text_mutex); |
17143 |
+ cpus_read_unlock(); |
17144 |
+- mutex_unlock(&kprobe_mutex); |
17145 |
+ |
17146 |
+ /* Step 5: Kick optimizer again if needed */ |
17147 |
+ if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) |
17148 |
+ kick_kprobe_optimizer(); |
17149 |
++ |
17150 |
++ mutex_unlock(&kprobe_mutex); |
17151 |
+ } |
17152 |
+ |
17153 |
+ /* Wait for completing optimization and unoptimization */ |
17154 |
+@@ -1236,6 +1237,26 @@ __releases(hlist_lock) |
17155 |
+ } |
17156 |
+ NOKPROBE_SYMBOL(kretprobe_table_unlock); |
17157 |
+ |
17158 |
++struct kprobe kprobe_busy = { |
17159 |
++ .addr = (void *) get_kprobe, |
17160 |
++}; |
17161 |
++ |
17162 |
++void kprobe_busy_begin(void) |
17163 |
++{ |
17164 |
++ struct kprobe_ctlblk *kcb; |
17165 |
++ |
17166 |
++ preempt_disable(); |
17167 |
++ __this_cpu_write(current_kprobe, &kprobe_busy); |
17168 |
++ kcb = get_kprobe_ctlblk(); |
17169 |
++ kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
17170 |
++} |
17171 |
++ |
17172 |
++void kprobe_busy_end(void) |
17173 |
++{ |
17174 |
++ __this_cpu_write(current_kprobe, NULL); |
17175 |
++ preempt_enable(); |
17176 |
++} |
17177 |
++ |
17178 |
+ /* |
17179 |
+ * This function is called from finish_task_switch when task tk becomes dead, |
17180 |
+ * so that we can recycle any function-return probe instances associated |
17181 |
+@@ -1253,6 +1274,8 @@ void kprobe_flush_task(struct task_struct *tk) |
17182 |
+ /* Early boot. kretprobe_table_locks not yet initialized. */ |
17183 |
+ return; |
17184 |
+ |
17185 |
++ kprobe_busy_begin(); |
17186 |
++ |
17187 |
+ INIT_HLIST_HEAD(&empty_rp); |
17188 |
+ hash = hash_ptr(tk, KPROBE_HASH_BITS); |
17189 |
+ head = &kretprobe_inst_table[hash]; |
17190 |
+@@ -1266,6 +1289,8 @@ void kprobe_flush_task(struct task_struct *tk) |
17191 |
+ hlist_del(&ri->hlist); |
17192 |
+ kfree(ri); |
17193 |
+ } |
17194 |
++ |
17195 |
++ kprobe_busy_end(); |
17196 |
+ } |
17197 |
+ NOKPROBE_SYMBOL(kprobe_flush_task); |
17198 |
+ |
17199 |
+diff --git a/kernel/resource.c b/kernel/resource.c |
17200 |
+index 76036a41143b..841737bbda9e 100644 |
17201 |
+--- a/kernel/resource.c |
17202 |
++++ b/kernel/resource.c |
17203 |
+@@ -1126,6 +1126,7 @@ struct resource * __request_region(struct resource *parent, |
17204 |
+ { |
17205 |
+ DECLARE_WAITQUEUE(wait, current); |
17206 |
+ struct resource *res = alloc_resource(GFP_KERNEL); |
17207 |
++ struct resource *orig_parent = parent; |
17208 |
+ |
17209 |
+ if (!res) |
17210 |
+ return NULL; |
17211 |
+@@ -1176,6 +1177,10 @@ struct resource * __request_region(struct resource *parent, |
17212 |
+ break; |
17213 |
+ } |
17214 |
+ write_unlock(&resource_lock); |
17215 |
++ |
17216 |
++ if (res && orig_parent == &iomem_resource) |
17217 |
++ revoke_devmem(res); |
17218 |
++ |
17219 |
+ return res; |
17220 |
+ } |
17221 |
+ EXPORT_SYMBOL(__request_region); |
17222 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
17223 |
+index ca39dc3230cb..35610a4be4a9 100644 |
17224 |
+--- a/kernel/trace/blktrace.c |
17225 |
++++ b/kernel/trace/blktrace.c |
17226 |
+@@ -995,8 +995,10 @@ static void blk_add_trace_split(void *ignore, |
17227 |
+ |
17228 |
+ __blk_add_trace(bt, bio->bi_iter.bi_sector, |
17229 |
+ bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, |
17230 |
+- BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu), |
17231 |
+- &rpdu, blk_trace_bio_get_cgid(q, bio)); |
17232 |
++ BLK_TA_SPLIT, |
17233 |
++ blk_status_to_errno(bio->bi_status), |
17234 |
++ sizeof(rpdu), &rpdu, |
17235 |
++ blk_trace_bio_get_cgid(q, bio)); |
17236 |
+ } |
17237 |
+ rcu_read_unlock(); |
17238 |
+ } |
17239 |
+@@ -1033,7 +1035,8 @@ static void blk_add_trace_bio_remap(void *ignore, |
17240 |
+ r.sector_from = cpu_to_be64(from); |
17241 |
+ |
17242 |
+ __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, |
17243 |
+- bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status, |
17244 |
++ bio_op(bio), bio->bi_opf, BLK_TA_REMAP, |
17245 |
++ blk_status_to_errno(bio->bi_status), |
17246 |
+ sizeof(r), &r, blk_trace_bio_get_cgid(q, bio)); |
17247 |
+ rcu_read_unlock(); |
17248 |
+ } |
17249 |
+@@ -1253,21 +1256,10 @@ static inline __u16 t_error(const struct trace_entry *ent) |
17250 |
+ |
17251 |
+ static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) |
17252 |
+ { |
17253 |
+- const __u64 *val = pdu_start(ent, has_cg); |
17254 |
++ const __be64 *val = pdu_start(ent, has_cg); |
17255 |
+ return be64_to_cpu(*val); |
17256 |
+ } |
17257 |
+ |
17258 |
+-static void get_pdu_remap(const struct trace_entry *ent, |
17259 |
+- struct blk_io_trace_remap *r, bool has_cg) |
17260 |
+-{ |
17261 |
+- const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
17262 |
+- __u64 sector_from = __r->sector_from; |
17263 |
+- |
17264 |
+- r->device_from = be32_to_cpu(__r->device_from); |
17265 |
+- r->device_to = be32_to_cpu(__r->device_to); |
17266 |
+- r->sector_from = be64_to_cpu(sector_from); |
17267 |
+-} |
17268 |
+- |
17269 |
+ typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act, |
17270 |
+ bool has_cg); |
17271 |
+ |
17272 |
+@@ -1407,13 +1399,13 @@ static void blk_log_with_error(struct trace_seq *s, |
17273 |
+ |
17274 |
+ static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
17275 |
+ { |
17276 |
+- struct blk_io_trace_remap r = { .device_from = 0, }; |
17277 |
++ const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
17278 |
+ |
17279 |
+- get_pdu_remap(ent, &r, has_cg); |
17280 |
+ trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n", |
17281 |
+ t_sector(ent), t_sec(ent), |
17282 |
+- MAJOR(r.device_from), MINOR(r.device_from), |
17283 |
+- (unsigned long long)r.sector_from); |
17284 |
++ MAJOR(be32_to_cpu(__r->device_from)), |
17285 |
++ MINOR(be32_to_cpu(__r->device_from)), |
17286 |
++ be64_to_cpu(__r->sector_from)); |
17287 |
+ } |
17288 |
+ |
17289 |
+ static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
17290 |
+diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
17291 |
+index 4eb1d004d5f2..7fb2f4c1bc49 100644 |
17292 |
+--- a/kernel/trace/trace.h |
17293 |
++++ b/kernel/trace/trace.h |
17294 |
+@@ -61,6 +61,9 @@ enum trace_type { |
17295 |
+ #undef __field_desc |
17296 |
+ #define __field_desc(type, container, item) |
17297 |
+ |
17298 |
++#undef __field_packed |
17299 |
++#define __field_packed(type, container, item) |
17300 |
++ |
17301 |
+ #undef __array |
17302 |
+ #define __array(type, item, size) type item[size]; |
17303 |
+ |
17304 |
+diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h |
17305 |
+index a523da0dae0a..18c4a58aff79 100644 |
17306 |
+--- a/kernel/trace/trace_entries.h |
17307 |
++++ b/kernel/trace/trace_entries.h |
17308 |
+@@ -78,8 +78,8 @@ FTRACE_ENTRY_PACKED(funcgraph_entry, ftrace_graph_ent_entry, |
17309 |
+ |
17310 |
+ F_STRUCT( |
17311 |
+ __field_struct( struct ftrace_graph_ent, graph_ent ) |
17312 |
+- __field_desc( unsigned long, graph_ent, func ) |
17313 |
+- __field_desc( int, graph_ent, depth ) |
17314 |
++ __field_packed( unsigned long, graph_ent, func ) |
17315 |
++ __field_packed( int, graph_ent, depth ) |
17316 |
+ ), |
17317 |
+ |
17318 |
+ F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth) |
17319 |
+@@ -92,11 +92,11 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry, |
17320 |
+ |
17321 |
+ F_STRUCT( |
17322 |
+ __field_struct( struct ftrace_graph_ret, ret ) |
17323 |
+- __field_desc( unsigned long, ret, func ) |
17324 |
+- __field_desc( unsigned long, ret, overrun ) |
17325 |
+- __field_desc( unsigned long long, ret, calltime) |
17326 |
+- __field_desc( unsigned long long, ret, rettime ) |
17327 |
+- __field_desc( int, ret, depth ) |
17328 |
++ __field_packed( unsigned long, ret, func ) |
17329 |
++ __field_packed( unsigned long, ret, overrun ) |
17330 |
++ __field_packed( unsigned long long, ret, calltime) |
17331 |
++ __field_packed( unsigned long long, ret, rettime ) |
17332 |
++ __field_packed( int, ret, depth ) |
17333 |
+ ), |
17334 |
+ |
17335 |
+ F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d", |
17336 |
+diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c |
17337 |
+index 77ce5a3b6773..70d3d0a09053 100644 |
17338 |
+--- a/kernel/trace/trace_export.c |
17339 |
++++ b/kernel/trace/trace_export.c |
17340 |
+@@ -45,6 +45,9 @@ static int ftrace_event_register(struct trace_event_call *call, |
17341 |
+ #undef __field_desc |
17342 |
+ #define __field_desc(type, container, item) type item; |
17343 |
+ |
17344 |
++#undef __field_packed |
17345 |
++#define __field_packed(type, container, item) type item; |
17346 |
++ |
17347 |
+ #undef __array |
17348 |
+ #define __array(type, item, size) type item[size]; |
17349 |
+ |
17350 |
+@@ -85,6 +88,13 @@ static void __always_unused ____ftrace_check_##name(void) \ |
17351 |
+ .size = sizeof(_type), .align = __alignof__(_type), \ |
17352 |
+ is_signed_type(_type), .filter_type = _filter_type }, |
17353 |
+ |
17354 |
++ |
17355 |
++#undef __field_ext_packed |
17356 |
++#define __field_ext_packed(_type, _item, _filter_type) { \ |
17357 |
++ .type = #_type, .name = #_item, \ |
17358 |
++ .size = sizeof(_type), .align = 1, \ |
17359 |
++ is_signed_type(_type), .filter_type = _filter_type }, |
17360 |
++ |
17361 |
+ #undef __field |
17362 |
+ #define __field(_type, _item) __field_ext(_type, _item, FILTER_OTHER) |
17363 |
+ |
17364 |
+@@ -94,6 +104,9 @@ static void __always_unused ____ftrace_check_##name(void) \ |
17365 |
+ #undef __field_desc |
17366 |
+ #define __field_desc(_type, _container, _item) __field_ext(_type, _item, FILTER_OTHER) |
17367 |
+ |
17368 |
++#undef __field_packed |
17369 |
++#define __field_packed(_type, _container, _item) __field_ext_packed(_type, _item, FILTER_OTHER) |
17370 |
++ |
17371 |
+ #undef __array |
17372 |
+ #define __array(_type, _item, _len) { \ |
17373 |
+ .type = #_type"["__stringify(_len)"]", .name = #_item, \ |
17374 |
+@@ -129,6 +142,9 @@ static struct trace_event_fields ftrace_event_fields_##name[] = { \ |
17375 |
+ #undef __field_desc |
17376 |
+ #define __field_desc(type, container, item) |
17377 |
+ |
17378 |
++#undef __field_packed |
17379 |
++#define __field_packed(type, container, item) |
17380 |
++ |
17381 |
+ #undef __array |
17382 |
+ #define __array(type, item, len) |
17383 |
+ |
17384 |
+diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
17385 |
+index 35989383ae11..8eeb95e04bf5 100644 |
17386 |
+--- a/kernel/trace/trace_kprobe.c |
17387 |
++++ b/kernel/trace/trace_kprobe.c |
17388 |
+@@ -1629,7 +1629,7 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type, |
17389 |
+ if (perf_type_tracepoint) |
17390 |
+ tk = find_trace_kprobe(pevent, group); |
17391 |
+ else |
17392 |
+- tk = event->tp_event->data; |
17393 |
++ tk = trace_kprobe_primary_from_call(event->tp_event); |
17394 |
+ if (!tk) |
17395 |
+ return -EINVAL; |
17396 |
+ |
17397 |
+diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c |
17398 |
+index ab8b6436d53f..f98d6d94cbbf 100644 |
17399 |
+--- a/kernel/trace/trace_probe.c |
17400 |
++++ b/kernel/trace/trace_probe.c |
17401 |
+@@ -639,8 +639,8 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size, |
17402 |
+ ret = -EINVAL; |
17403 |
+ goto fail; |
17404 |
+ } |
17405 |
+- if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM) || |
17406 |
+- parg->count) { |
17407 |
++ if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM || |
17408 |
++ code->op == FETCH_OP_DATA) || parg->count) { |
17409 |
+ /* |
17410 |
+ * IMM, DATA and COMM is pointing actual address, those |
17411 |
+ * must be kept, and if parg->count != 0, this is an |
17412 |
+diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c |
17413 |
+index 2a8e8e9c1c75..fdd47f99b18f 100644 |
17414 |
+--- a/kernel/trace/trace_uprobe.c |
17415 |
++++ b/kernel/trace/trace_uprobe.c |
17416 |
+@@ -1412,7 +1412,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, |
17417 |
+ if (perf_type_tracepoint) |
17418 |
+ tu = find_probe_event(pevent, group); |
17419 |
+ else |
17420 |
+- tu = event->tp_event->data; |
17421 |
++ tu = trace_uprobe_primary_from_call(event->tp_event); |
17422 |
+ if (!tu) |
17423 |
+ return -EINVAL; |
17424 |
+ |
17425 |
+diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c |
17426 |
+index 2c13ecc5bb2c..ed1f3df27260 100644 |
17427 |
+--- a/lib/zlib_inflate/inffast.c |
17428 |
++++ b/lib/zlib_inflate/inffast.c |
17429 |
+@@ -10,17 +10,6 @@ |
17430 |
+ |
17431 |
+ #ifndef ASMINF |
17432 |
+ |
17433 |
+-/* Allow machine dependent optimization for post-increment or pre-increment. |
17434 |
+- Based on testing to date, |
17435 |
+- Pre-increment preferred for: |
17436 |
+- - PowerPC G3 (Adler) |
17437 |
+- - MIPS R5000 (Randers-Pehrson) |
17438 |
+- Post-increment preferred for: |
17439 |
+- - none |
17440 |
+- No measurable difference: |
17441 |
+- - Pentium III (Anderson) |
17442 |
+- - M68060 (Nikl) |
17443 |
+- */ |
17444 |
+ union uu { |
17445 |
+ unsigned short us; |
17446 |
+ unsigned char b[2]; |
17447 |
+@@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p) |
17448 |
+ return mm.us; |
17449 |
+ } |
17450 |
+ |
17451 |
+-#ifdef POSTINC |
17452 |
+-# define OFF 0 |
17453 |
+-# define PUP(a) *(a)++ |
17454 |
+-# define UP_UNALIGNED(a) get_unaligned16((a)++) |
17455 |
+-#else |
17456 |
+-# define OFF 1 |
17457 |
+-# define PUP(a) *++(a) |
17458 |
+-# define UP_UNALIGNED(a) get_unaligned16(++(a)) |
17459 |
+-#endif |
17460 |
+- |
17461 |
+ /* |
17462 |
+ Decode literal, length, and distance codes and write out the resulting |
17463 |
+ literal and match bytes until either not enough input or output is |
17464 |
+@@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
17465 |
+ |
17466 |
+ /* copy state to local variables */ |
17467 |
+ state = (struct inflate_state *)strm->state; |
17468 |
+- in = strm->next_in - OFF; |
17469 |
++ in = strm->next_in; |
17470 |
+ last = in + (strm->avail_in - 5); |
17471 |
+- out = strm->next_out - OFF; |
17472 |
++ out = strm->next_out; |
17473 |
+ beg = out - (start - strm->avail_out); |
17474 |
+ end = out + (strm->avail_out - 257); |
17475 |
+ #ifdef INFLATE_STRICT |
17476 |
+@@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
17477 |
+ input data or output space */ |
17478 |
+ do { |
17479 |
+ if (bits < 15) { |
17480 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17481 |
++ hold += (unsigned long)(*in++) << bits; |
17482 |
+ bits += 8; |
17483 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17484 |
++ hold += (unsigned long)(*in++) << bits; |
17485 |
+ bits += 8; |
17486 |
+ } |
17487 |
+ this = lcode[hold & lmask]; |
17488 |
+@@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start) |
17489 |
+ bits -= op; |
17490 |
+ op = (unsigned)(this.op); |
17491 |
+ if (op == 0) { /* literal */ |
17492 |
+- PUP(out) = (unsigned char)(this.val); |
17493 |
++ *out++ = (unsigned char)(this.val); |
17494 |
+ } |
17495 |
+ else if (op & 16) { /* length base */ |
17496 |
+ len = (unsigned)(this.val); |
17497 |
+ op &= 15; /* number of extra bits */ |
17498 |
+ if (op) { |
17499 |
+ if (bits < op) { |
17500 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17501 |
++ hold += (unsigned long)(*in++) << bits; |
17502 |
+ bits += 8; |
17503 |
+ } |
17504 |
+ len += (unsigned)hold & ((1U << op) - 1); |
17505 |
+@@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
17506 |
+ bits -= op; |
17507 |
+ } |
17508 |
+ if (bits < 15) { |
17509 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17510 |
++ hold += (unsigned long)(*in++) << bits; |
17511 |
+ bits += 8; |
17512 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17513 |
++ hold += (unsigned long)(*in++) << bits; |
17514 |
+ bits += 8; |
17515 |
+ } |
17516 |
+ this = dcode[hold & dmask]; |
17517 |
+@@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start) |
17518 |
+ dist = (unsigned)(this.val); |
17519 |
+ op &= 15; /* number of extra bits */ |
17520 |
+ if (bits < op) { |
17521 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17522 |
++ hold += (unsigned long)(*in++) << bits; |
17523 |
+ bits += 8; |
17524 |
+ if (bits < op) { |
17525 |
+- hold += (unsigned long)(PUP(in)) << bits; |
17526 |
++ hold += (unsigned long)(*in++) << bits; |
17527 |
+ bits += 8; |
17528 |
+ } |
17529 |
+ } |
17530 |
+@@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start) |
17531 |
+ state->mode = BAD; |
17532 |
+ break; |
17533 |
+ } |
17534 |
+- from = window - OFF; |
17535 |
++ from = window; |
17536 |
+ if (write == 0) { /* very common case */ |
17537 |
+ from += wsize - op; |
17538 |
+ if (op < len) { /* some from window */ |
17539 |
+ len -= op; |
17540 |
+ do { |
17541 |
+- PUP(out) = PUP(from); |
17542 |
++ *out++ = *from++; |
17543 |
+ } while (--op); |
17544 |
+ from = out - dist; /* rest from output */ |
17545 |
+ } |
17546 |
+@@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start) |
17547 |
+ if (op < len) { /* some from end of window */ |
17548 |
+ len -= op; |
17549 |
+ do { |
17550 |
+- PUP(out) = PUP(from); |
17551 |
++ *out++ = *from++; |
17552 |
+ } while (--op); |
17553 |
+- from = window - OFF; |
17554 |
++ from = window; |
17555 |
+ if (write < len) { /* some from start of window */ |
17556 |
+ op = write; |
17557 |
+ len -= op; |
17558 |
+ do { |
17559 |
+- PUP(out) = PUP(from); |
17560 |
++ *out++ = *from++; |
17561 |
+ } while (--op); |
17562 |
+ from = out - dist; /* rest from output */ |
17563 |
+ } |
17564 |
+@@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start) |
17565 |
+ if (op < len) { /* some from window */ |
17566 |
+ len -= op; |
17567 |
+ do { |
17568 |
+- PUP(out) = PUP(from); |
17569 |
++ *out++ = *from++; |
17570 |
+ } while (--op); |
17571 |
+ from = out - dist; /* rest from output */ |
17572 |
+ } |
17573 |
+ } |
17574 |
+ while (len > 2) { |
17575 |
+- PUP(out) = PUP(from); |
17576 |
+- PUP(out) = PUP(from); |
17577 |
+- PUP(out) = PUP(from); |
17578 |
++ *out++ = *from++; |
17579 |
++ *out++ = *from++; |
17580 |
++ *out++ = *from++; |
17581 |
+ len -= 3; |
17582 |
+ } |
17583 |
+ if (len) { |
17584 |
+- PUP(out) = PUP(from); |
17585 |
++ *out++ = *from++; |
17586 |
+ if (len > 1) |
17587 |
+- PUP(out) = PUP(from); |
17588 |
++ *out++ = *from++; |
17589 |
+ } |
17590 |
+ } |
17591 |
+ else { |
17592 |
+@@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start) |
17593 |
+ from = out - dist; /* copy direct from output */ |
17594 |
+ /* minimum length is three */ |
17595 |
+ /* Align out addr */ |
17596 |
+- if (!((long)(out - 1 + OFF) & 1)) { |
17597 |
+- PUP(out) = PUP(from); |
17598 |
++ if (!((long)(out - 1) & 1)) { |
17599 |
++ *out++ = *from++; |
17600 |
+ len--; |
17601 |
+ } |
17602 |
+- sout = (unsigned short *)(out - OFF); |
17603 |
++ sout = (unsigned short *)(out); |
17604 |
+ if (dist > 2) { |
17605 |
+ unsigned short *sfrom; |
17606 |
+ |
17607 |
+- sfrom = (unsigned short *)(from - OFF); |
17608 |
++ sfrom = (unsigned short *)(from); |
17609 |
+ loops = len >> 1; |
17610 |
+ do |
17611 |
+ #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
17612 |
+- PUP(sout) = PUP(sfrom); |
17613 |
++ *sout++ = *sfrom++; |
17614 |
+ #else |
17615 |
+- PUP(sout) = UP_UNALIGNED(sfrom); |
17616 |
++ *sout++ = get_unaligned16(sfrom++); |
17617 |
+ #endif |
17618 |
+ while (--loops); |
17619 |
+- out = (unsigned char *)sout + OFF; |
17620 |
+- from = (unsigned char *)sfrom + OFF; |
17621 |
++ out = (unsigned char *)sout; |
17622 |
++ from = (unsigned char *)sfrom; |
17623 |
+ } else { /* dist == 1 or dist == 2 */ |
17624 |
+ unsigned short pat16; |
17625 |
+ |
17626 |
+- pat16 = *(sout-1+OFF); |
17627 |
++ pat16 = *(sout-1); |
17628 |
+ if (dist == 1) { |
17629 |
+ union uu mm; |
17630 |
+ /* copy one char pattern to both bytes */ |
17631 |
+@@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start) |
17632 |
+ } |
17633 |
+ loops = len >> 1; |
17634 |
+ do |
17635 |
+- PUP(sout) = pat16; |
17636 |
++ *sout++ = pat16; |
17637 |
+ while (--loops); |
17638 |
+- out = (unsigned char *)sout + OFF; |
17639 |
++ out = (unsigned char *)sout; |
17640 |
+ } |
17641 |
+ if (len & 1) |
17642 |
+- PUP(out) = PUP(from); |
17643 |
++ *out++ = *from++; |
17644 |
+ } |
17645 |
+ } |
17646 |
+ else if ((op & 64) == 0) { /* 2nd level distance code */ |
17647 |
+@@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start) |
17648 |
+ hold &= (1U << bits) - 1; |
17649 |
+ |
17650 |
+ /* update state and return */ |
17651 |
+- strm->next_in = in + OFF; |
17652 |
+- strm->next_out = out + OFF; |
17653 |
++ strm->next_in = in; |
17654 |
++ strm->next_out = out; |
17655 |
+ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); |
17656 |
+ strm->avail_out = (unsigned)(out < end ? |
17657 |
+ 257 + (end - out) : 257 - (out - end)); |
17658 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
17659 |
+index 2d8aceee4284..93a279ab4e97 100644 |
17660 |
+--- a/net/core/dev.c |
17661 |
++++ b/net/core/dev.c |
17662 |
+@@ -79,6 +79,7 @@ |
17663 |
+ #include <linux/sched.h> |
17664 |
+ #include <linux/sched/mm.h> |
17665 |
+ #include <linux/mutex.h> |
17666 |
++#include <linux/rwsem.h> |
17667 |
+ #include <linux/string.h> |
17668 |
+ #include <linux/mm.h> |
17669 |
+ #include <linux/socket.h> |
17670 |
+@@ -194,7 +195,7 @@ static DEFINE_SPINLOCK(napi_hash_lock); |
17671 |
+ static unsigned int napi_gen_id = NR_CPUS; |
17672 |
+ static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8); |
17673 |
+ |
17674 |
+-static seqcount_t devnet_rename_seq; |
17675 |
++static DECLARE_RWSEM(devnet_rename_sem); |
17676 |
+ |
17677 |
+ static inline void dev_base_seq_inc(struct net *net) |
17678 |
+ { |
17679 |
+@@ -930,33 +931,28 @@ EXPORT_SYMBOL(dev_get_by_napi_id); |
17680 |
+ * @net: network namespace |
17681 |
+ * @name: a pointer to the buffer where the name will be stored. |
17682 |
+ * @ifindex: the ifindex of the interface to get the name from. |
17683 |
+- * |
17684 |
+- * The use of raw_seqcount_begin() and cond_resched() before |
17685 |
+- * retrying is required as we want to give the writers a chance |
17686 |
+- * to complete when CONFIG_PREEMPTION is not set. |
17687 |
+ */ |
17688 |
+ int netdev_get_name(struct net *net, char *name, int ifindex) |
17689 |
+ { |
17690 |
+ struct net_device *dev; |
17691 |
+- unsigned int seq; |
17692 |
++ int ret; |
17693 |
+ |
17694 |
+-retry: |
17695 |
+- seq = raw_seqcount_begin(&devnet_rename_seq); |
17696 |
++ down_read(&devnet_rename_sem); |
17697 |
+ rcu_read_lock(); |
17698 |
++ |
17699 |
+ dev = dev_get_by_index_rcu(net, ifindex); |
17700 |
+ if (!dev) { |
17701 |
+- rcu_read_unlock(); |
17702 |
+- return -ENODEV; |
17703 |
++ ret = -ENODEV; |
17704 |
++ goto out; |
17705 |
+ } |
17706 |
+ |
17707 |
+ strcpy(name, dev->name); |
17708 |
+- rcu_read_unlock(); |
17709 |
+- if (read_seqcount_retry(&devnet_rename_seq, seq)) { |
17710 |
+- cond_resched(); |
17711 |
+- goto retry; |
17712 |
+- } |
17713 |
+ |
17714 |
+- return 0; |
17715 |
++ ret = 0; |
17716 |
++out: |
17717 |
++ rcu_read_unlock(); |
17718 |
++ up_read(&devnet_rename_sem); |
17719 |
++ return ret; |
17720 |
+ } |
17721 |
+ |
17722 |
+ /** |
17723 |
+@@ -1228,10 +1224,10 @@ int dev_change_name(struct net_device *dev, const char *newname) |
17724 |
+ likely(!(dev->priv_flags & IFF_LIVE_RENAME_OK))) |
17725 |
+ return -EBUSY; |
17726 |
+ |
17727 |
+- write_seqcount_begin(&devnet_rename_seq); |
17728 |
++ down_write(&devnet_rename_sem); |
17729 |
+ |
17730 |
+ if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { |
17731 |
+- write_seqcount_end(&devnet_rename_seq); |
17732 |
++ up_write(&devnet_rename_sem); |
17733 |
+ return 0; |
17734 |
+ } |
17735 |
+ |
17736 |
+@@ -1239,7 +1235,7 @@ int dev_change_name(struct net_device *dev, const char *newname) |
17737 |
+ |
17738 |
+ err = dev_get_valid_name(net, dev, newname); |
17739 |
+ if (err < 0) { |
17740 |
+- write_seqcount_end(&devnet_rename_seq); |
17741 |
++ up_write(&devnet_rename_sem); |
17742 |
+ return err; |
17743 |
+ } |
17744 |
+ |
17745 |
+@@ -1254,11 +1250,11 @@ rollback: |
17746 |
+ if (ret) { |
17747 |
+ memcpy(dev->name, oldname, IFNAMSIZ); |
17748 |
+ dev->name_assign_type = old_assign_type; |
17749 |
+- write_seqcount_end(&devnet_rename_seq); |
17750 |
++ up_write(&devnet_rename_sem); |
17751 |
+ return ret; |
17752 |
+ } |
17753 |
+ |
17754 |
+- write_seqcount_end(&devnet_rename_seq); |
17755 |
++ up_write(&devnet_rename_sem); |
17756 |
+ |
17757 |
+ netdev_adjacent_rename_links(dev, oldname); |
17758 |
+ |
17759 |
+@@ -1279,7 +1275,7 @@ rollback: |
17760 |
+ /* err >= 0 after dev_alloc_name() or stores the first errno */ |
17761 |
+ if (err >= 0) { |
17762 |
+ err = ret; |
17763 |
+- write_seqcount_begin(&devnet_rename_seq); |
17764 |
++ down_write(&devnet_rename_sem); |
17765 |
+ memcpy(dev->name, oldname, IFNAMSIZ); |
17766 |
+ memcpy(oldname, newname, IFNAMSIZ); |
17767 |
+ dev->name_assign_type = old_assign_type; |
17768 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
17769 |
+index 11b97c31bca5..9512a9772d69 100644 |
17770 |
+--- a/net/core/filter.c |
17771 |
++++ b/net/core/filter.c |
17772 |
+@@ -1766,25 +1766,27 @@ BPF_CALL_5(bpf_skb_load_bytes_relative, const struct sk_buff *, skb, |
17773 |
+ u32, offset, void *, to, u32, len, u32, start_header) |
17774 |
+ { |
17775 |
+ u8 *end = skb_tail_pointer(skb); |
17776 |
+- u8 *net = skb_network_header(skb); |
17777 |
+- u8 *mac = skb_mac_header(skb); |
17778 |
+- u8 *ptr; |
17779 |
++ u8 *start, *ptr; |
17780 |
+ |
17781 |
+- if (unlikely(offset > 0xffff || len > (end - mac))) |
17782 |
++ if (unlikely(offset > 0xffff)) |
17783 |
+ goto err_clear; |
17784 |
+ |
17785 |
+ switch (start_header) { |
17786 |
+ case BPF_HDR_START_MAC: |
17787 |
+- ptr = mac + offset; |
17788 |
++ if (unlikely(!skb_mac_header_was_set(skb))) |
17789 |
++ goto err_clear; |
17790 |
++ start = skb_mac_header(skb); |
17791 |
+ break; |
17792 |
+ case BPF_HDR_START_NET: |
17793 |
+- ptr = net + offset; |
17794 |
++ start = skb_network_header(skb); |
17795 |
+ break; |
17796 |
+ default: |
17797 |
+ goto err_clear; |
17798 |
+ } |
17799 |
+ |
17800 |
+- if (likely(ptr >= mac && ptr + len <= end)) { |
17801 |
++ ptr = start + offset; |
17802 |
++ |
17803 |
++ if (likely(ptr + len <= end)) { |
17804 |
+ memcpy(to, ptr, len); |
17805 |
+ return 0; |
17806 |
+ } |
17807 |
+diff --git a/net/core/sock_map.c b/net/core/sock_map.c |
17808 |
+index b08dfae10f88..591457fcbd02 100644 |
17809 |
+--- a/net/core/sock_map.c |
17810 |
++++ b/net/core/sock_map.c |
17811 |
+@@ -417,10 +417,7 @@ static int sock_map_get_next_key(struct bpf_map *map, void *key, void *next) |
17812 |
+ return 0; |
17813 |
+ } |
17814 |
+ |
17815 |
+-static bool sock_map_redirect_allowed(const struct sock *sk) |
17816 |
+-{ |
17817 |
+- return sk->sk_state != TCP_LISTEN; |
17818 |
+-} |
17819 |
++static bool sock_map_redirect_allowed(const struct sock *sk); |
17820 |
+ |
17821 |
+ static int sock_map_update_common(struct bpf_map *map, u32 idx, |
17822 |
+ struct sock *sk, u64 flags) |
17823 |
+@@ -501,6 +498,11 @@ static bool sk_is_udp(const struct sock *sk) |
17824 |
+ sk->sk_protocol == IPPROTO_UDP; |
17825 |
+ } |
17826 |
+ |
17827 |
++static bool sock_map_redirect_allowed(const struct sock *sk) |
17828 |
++{ |
17829 |
++ return sk_is_tcp(sk) && sk->sk_state != TCP_LISTEN; |
17830 |
++} |
17831 |
++ |
17832 |
+ static bool sock_map_sk_is_suitable(const struct sock *sk) |
17833 |
+ { |
17834 |
+ return sk_is_tcp(sk) || sk_is_udp(sk); |
17835 |
+@@ -982,11 +984,15 @@ static struct bpf_map *sock_hash_alloc(union bpf_attr *attr) |
17836 |
+ err = -EINVAL; |
17837 |
+ goto free_htab; |
17838 |
+ } |
17839 |
++ err = bpf_map_charge_init(&htab->map.memory, cost); |
17840 |
++ if (err) |
17841 |
++ goto free_htab; |
17842 |
+ |
17843 |
+ htab->buckets = bpf_map_area_alloc(htab->buckets_num * |
17844 |
+ sizeof(struct bpf_htab_bucket), |
17845 |
+ htab->map.numa_node); |
17846 |
+ if (!htab->buckets) { |
17847 |
++ bpf_map_charge_finish(&htab->map.memory); |
17848 |
+ err = -ENOMEM; |
17849 |
+ goto free_htab; |
17850 |
+ } |
17851 |
+@@ -1006,6 +1012,7 @@ static void sock_hash_free(struct bpf_map *map) |
17852 |
+ { |
17853 |
+ struct bpf_htab *htab = container_of(map, struct bpf_htab, map); |
17854 |
+ struct bpf_htab_bucket *bucket; |
17855 |
++ struct hlist_head unlink_list; |
17856 |
+ struct bpf_htab_elem *elem; |
17857 |
+ struct hlist_node *node; |
17858 |
+ int i; |
17859 |
+@@ -1017,13 +1024,32 @@ static void sock_hash_free(struct bpf_map *map) |
17860 |
+ synchronize_rcu(); |
17861 |
+ for (i = 0; i < htab->buckets_num; i++) { |
17862 |
+ bucket = sock_hash_select_bucket(htab, i); |
17863 |
+- hlist_for_each_entry_safe(elem, node, &bucket->head, node) { |
17864 |
+- hlist_del_rcu(&elem->node); |
17865 |
++ |
17866 |
++ /* We are racing with sock_hash_delete_from_link to |
17867 |
++ * enter the spin-lock critical section. Every socket on |
17868 |
++ * the list is still linked to sockhash. Since link |
17869 |
++ * exists, psock exists and holds a ref to socket. That |
17870 |
++ * lets us to grab a socket ref too. |
17871 |
++ */ |
17872 |
++ raw_spin_lock_bh(&bucket->lock); |
17873 |
++ hlist_for_each_entry(elem, &bucket->head, node) |
17874 |
++ sock_hold(elem->sk); |
17875 |
++ hlist_move_list(&bucket->head, &unlink_list); |
17876 |
++ raw_spin_unlock_bh(&bucket->lock); |
17877 |
++ |
17878 |
++ /* Process removed entries out of atomic context to |
17879 |
++ * block for socket lock before deleting the psock's |
17880 |
++ * link to sockhash. |
17881 |
++ */ |
17882 |
++ hlist_for_each_entry_safe(elem, node, &unlink_list, node) { |
17883 |
++ hlist_del(&elem->node); |
17884 |
+ lock_sock(elem->sk); |
17885 |
+ rcu_read_lock(); |
17886 |
+ sock_map_unref(elem->sk, elem); |
17887 |
+ rcu_read_unlock(); |
17888 |
+ release_sock(elem->sk); |
17889 |
++ sock_put(elem->sk); |
17890 |
++ sock_hash_free_elem(htab, elem); |
17891 |
+ } |
17892 |
+ } |
17893 |
+ |
17894 |
+diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
17895 |
+index 629aaa9a1eb9..7aa68f4aae6c 100644 |
17896 |
+--- a/net/ipv4/tcp_bpf.c |
17897 |
++++ b/net/ipv4/tcp_bpf.c |
17898 |
+@@ -64,6 +64,9 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock, |
17899 |
+ } while (i != msg_rx->sg.end); |
17900 |
+ |
17901 |
+ if (unlikely(peek)) { |
17902 |
++ if (msg_rx == list_last_entry(&psock->ingress_msg, |
17903 |
++ struct sk_msg, list)) |
17904 |
++ break; |
17905 |
+ msg_rx = list_next_entry(msg_rx, list); |
17906 |
+ continue; |
17907 |
+ } |
17908 |
+@@ -242,6 +245,9 @@ static int tcp_bpf_wait_data(struct sock *sk, struct sk_psock *psock, |
17909 |
+ DEFINE_WAIT_FUNC(wait, woken_wake_function); |
17910 |
+ int ret = 0; |
17911 |
+ |
17912 |
++ if (sk->sk_shutdown & RCV_SHUTDOWN) |
17913 |
++ return 1; |
17914 |
++ |
17915 |
+ if (!timeo) |
17916 |
+ return ret; |
17917 |
+ |
17918 |
+diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c |
17919 |
+index 8b5acc6910fd..8c04388296b0 100644 |
17920 |
+--- a/net/netfilter/nft_set_pipapo.c |
17921 |
++++ b/net/netfilter/nft_set_pipapo.c |
17922 |
+@@ -1242,7 +1242,9 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, |
17923 |
+ end += NFT_PIPAPO_GROUPS_PADDED_SIZE(f); |
17924 |
+ } |
17925 |
+ |
17926 |
+- if (!*this_cpu_ptr(m->scratch) || bsize_max > m->bsize_max) { |
17927 |
++ if (!*get_cpu_ptr(m->scratch) || bsize_max > m->bsize_max) { |
17928 |
++ put_cpu_ptr(m->scratch); |
17929 |
++ |
17930 |
+ err = pipapo_realloc_scratch(m, bsize_max); |
17931 |
+ if (err) |
17932 |
+ return err; |
17933 |
+@@ -1250,6 +1252,8 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, |
17934 |
+ this_cpu_write(nft_pipapo_scratch_index, false); |
17935 |
+ |
17936 |
+ m->bsize_max = bsize_max; |
17937 |
++ } else { |
17938 |
++ put_cpu_ptr(m->scratch); |
17939 |
+ } |
17940 |
+ |
17941 |
+ *ext2 = &e->ext; |
17942 |
+diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
17943 |
+index 62f416bc0579..b6aad3fc46c3 100644 |
17944 |
+--- a/net/netfilter/nft_set_rbtree.c |
17945 |
++++ b/net/netfilter/nft_set_rbtree.c |
17946 |
+@@ -271,12 +271,14 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
17947 |
+ |
17948 |
+ if (nft_rbtree_interval_start(new)) { |
17949 |
+ if (nft_rbtree_interval_end(rbe) && |
17950 |
+- nft_set_elem_active(&rbe->ext, genmask)) |
17951 |
++ nft_set_elem_active(&rbe->ext, genmask) && |
17952 |
++ !nft_set_elem_expired(&rbe->ext)) |
17953 |
+ overlap = false; |
17954 |
+ } else { |
17955 |
+ overlap = nft_rbtree_interval_end(rbe) && |
17956 |
+ nft_set_elem_active(&rbe->ext, |
17957 |
+- genmask); |
17958 |
++ genmask) && |
17959 |
++ !nft_set_elem_expired(&rbe->ext); |
17960 |
+ } |
17961 |
+ } else if (d > 0) { |
17962 |
+ p = &parent->rb_right; |
17963 |
+@@ -284,9 +286,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
17964 |
+ if (nft_rbtree_interval_end(new)) { |
17965 |
+ overlap = nft_rbtree_interval_end(rbe) && |
17966 |
+ nft_set_elem_active(&rbe->ext, |
17967 |
+- genmask); |
17968 |
++ genmask) && |
17969 |
++ !nft_set_elem_expired(&rbe->ext); |
17970 |
+ } else if (nft_rbtree_interval_end(rbe) && |
17971 |
+- nft_set_elem_active(&rbe->ext, genmask)) { |
17972 |
++ nft_set_elem_active(&rbe->ext, genmask) && |
17973 |
++ !nft_set_elem_expired(&rbe->ext)) { |
17974 |
+ overlap = true; |
17975 |
+ } |
17976 |
+ } else { |
17977 |
+@@ -294,15 +298,18 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
17978 |
+ nft_rbtree_interval_start(new)) { |
17979 |
+ p = &parent->rb_left; |
17980 |
+ |
17981 |
+- if (nft_set_elem_active(&rbe->ext, genmask)) |
17982 |
++ if (nft_set_elem_active(&rbe->ext, genmask) && |
17983 |
++ !nft_set_elem_expired(&rbe->ext)) |
17984 |
+ overlap = false; |
17985 |
+ } else if (nft_rbtree_interval_start(rbe) && |
17986 |
+ nft_rbtree_interval_end(new)) { |
17987 |
+ p = &parent->rb_right; |
17988 |
+ |
17989 |
+- if (nft_set_elem_active(&rbe->ext, genmask)) |
17990 |
++ if (nft_set_elem_active(&rbe->ext, genmask) && |
17991 |
++ !nft_set_elem_expired(&rbe->ext)) |
17992 |
+ overlap = false; |
17993 |
+- } else if (nft_set_elem_active(&rbe->ext, genmask)) { |
17994 |
++ } else if (nft_set_elem_active(&rbe->ext, genmask) && |
17995 |
++ !nft_set_elem_expired(&rbe->ext)) { |
17996 |
+ *ext = &rbe->ext; |
17997 |
+ return -EEXIST; |
17998 |
+ } else { |
17999 |
+diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c |
18000 |
+index 8b179e3c802a..543afd9bd664 100644 |
18001 |
+--- a/net/rxrpc/proc.c |
18002 |
++++ b/net/rxrpc/proc.c |
18003 |
+@@ -68,7 +68,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
18004 |
+ "Proto Local " |
18005 |
+ " Remote " |
18006 |
+ " SvID ConnID CallID End Use State Abort " |
18007 |
+- " UserID TxSeq TW RxSeq RW RxSerial RxTimo\n"); |
18008 |
++ " DebugId TxSeq TW RxSeq RW RxSerial RxTimo\n"); |
18009 |
+ return 0; |
18010 |
+ } |
18011 |
+ |
18012 |
+@@ -100,7 +100,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
18013 |
+ rx_hard_ack = READ_ONCE(call->rx_hard_ack); |
18014 |
+ seq_printf(seq, |
18015 |
+ "UDP %-47.47s %-47.47s %4x %08x %08x %s %3u" |
18016 |
+- " %-8.8s %08x %lx %08x %02x %08x %02x %08x %06lx\n", |
18017 |
++ " %-8.8s %08x %08x %08x %02x %08x %02x %08x %06lx\n", |
18018 |
+ lbuff, |
18019 |
+ rbuff, |
18020 |
+ call->service_id, |
18021 |
+@@ -110,7 +110,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
18022 |
+ atomic_read(&call->usage), |
18023 |
+ rxrpc_call_states[call->state], |
18024 |
+ call->abort_code, |
18025 |
+- call->user_call_ID, |
18026 |
++ call->debug_id, |
18027 |
+ tx_hard_ack, READ_ONCE(call->tx_top) - tx_hard_ack, |
18028 |
+ rx_hard_ack, READ_ONCE(call->rx_top) - rx_hard_ack, |
18029 |
+ call->rx_serial, |
18030 |
+diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c |
18031 |
+index 8b4d72b1a066..010dcb876f9d 100644 |
18032 |
+--- a/net/sunrpc/addr.c |
18033 |
++++ b/net/sunrpc/addr.c |
18034 |
+@@ -82,11 +82,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap, |
18035 |
+ |
18036 |
+ rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u", |
18037 |
+ IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id); |
18038 |
+- if (unlikely((size_t)rc > sizeof(scopebuf))) |
18039 |
++ if (unlikely((size_t)rc >= sizeof(scopebuf))) |
18040 |
+ return 0; |
18041 |
+ |
18042 |
+ len += rc; |
18043 |
+- if (unlikely(len > buflen)) |
18044 |
++ if (unlikely(len >= buflen)) |
18045 |
+ return 0; |
18046 |
+ |
18047 |
+ strcat(buf, scopebuf); |
18048 |
+diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
18049 |
+index c350108aa38d..a4676107fad0 100644 |
18050 |
+--- a/net/xdp/xsk.c |
18051 |
++++ b/net/xdp/xsk.c |
18052 |
+@@ -397,10 +397,8 @@ static int xsk_generic_xmit(struct sock *sk) |
18053 |
+ |
18054 |
+ len = desc.len; |
18055 |
+ skb = sock_alloc_send_skb(sk, len, 1, &err); |
18056 |
+- if (unlikely(!skb)) { |
18057 |
+- err = -EAGAIN; |
18058 |
++ if (unlikely(!skb)) |
18059 |
+ goto out; |
18060 |
+- } |
18061 |
+ |
18062 |
+ skb_put(skb, len); |
18063 |
+ addr = desc.addr; |
18064 |
+diff --git a/samples/ftrace/sample-trace-array.c b/samples/ftrace/sample-trace-array.c |
18065 |
+index d523450d73eb..6aba02a31c96 100644 |
18066 |
+--- a/samples/ftrace/sample-trace-array.c |
18067 |
++++ b/samples/ftrace/sample-trace-array.c |
18068 |
+@@ -6,6 +6,7 @@ |
18069 |
+ #include <linux/timer.h> |
18070 |
+ #include <linux/err.h> |
18071 |
+ #include <linux/jiffies.h> |
18072 |
++#include <linux/workqueue.h> |
18073 |
+ |
18074 |
+ /* |
18075 |
+ * Any file that uses trace points, must include the header. |
18076 |
+@@ -20,6 +21,16 @@ struct trace_array *tr; |
18077 |
+ static void mytimer_handler(struct timer_list *unused); |
18078 |
+ static struct task_struct *simple_tsk; |
18079 |
+ |
18080 |
++static void trace_work_fn(struct work_struct *work) |
18081 |
++{ |
18082 |
++ /* |
18083 |
++ * Disable tracing for event "sample_event". |
18084 |
++ */ |
18085 |
++ trace_array_set_clr_event(tr, "sample-subsystem", "sample_event", |
18086 |
++ false); |
18087 |
++} |
18088 |
++static DECLARE_WORK(trace_work, trace_work_fn); |
18089 |
++ |
18090 |
+ /* |
18091 |
+ * mytimer: Timer setup to disable tracing for event "sample_event". This |
18092 |
+ * timer is only for the purposes of the sample module to demonstrate access of |
18093 |
+@@ -29,11 +40,7 @@ static DEFINE_TIMER(mytimer, mytimer_handler); |
18094 |
+ |
18095 |
+ static void mytimer_handler(struct timer_list *unused) |
18096 |
+ { |
18097 |
+- /* |
18098 |
+- * Disable tracing for event "sample_event". |
18099 |
+- */ |
18100 |
+- trace_array_set_clr_event(tr, "sample-subsystem", "sample_event", |
18101 |
+- false); |
18102 |
++ schedule_work(&trace_work); |
18103 |
+ } |
18104 |
+ |
18105 |
+ static void simple_thread_func(int count) |
18106 |
+@@ -76,6 +83,7 @@ static int simple_thread(void *arg) |
18107 |
+ simple_thread_func(count++); |
18108 |
+ |
18109 |
+ del_timer(&mytimer); |
18110 |
++ cancel_work_sync(&trace_work); |
18111 |
+ |
18112 |
+ /* |
18113 |
+ * trace_array_put() decrements the reference counter associated with |
18114 |
+@@ -107,8 +115,12 @@ static int __init sample_trace_array_init(void) |
18115 |
+ trace_printk_init_buffers(); |
18116 |
+ |
18117 |
+ simple_tsk = kthread_run(simple_thread, NULL, "sample-instance"); |
18118 |
+- if (IS_ERR(simple_tsk)) |
18119 |
++ if (IS_ERR(simple_tsk)) { |
18120 |
++ trace_array_put(tr); |
18121 |
++ trace_array_destroy(tr); |
18122 |
+ return -1; |
18123 |
++ } |
18124 |
++ |
18125 |
+ return 0; |
18126 |
+ } |
18127 |
+ |
18128 |
+diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost |
18129 |
+index 957eed6a17a5..33aaa572f686 100644 |
18130 |
+--- a/scripts/Makefile.modpost |
18131 |
++++ b/scripts/Makefile.modpost |
18132 |
+@@ -66,7 +66,7 @@ __modpost: |
18133 |
+ |
18134 |
+ else |
18135 |
+ |
18136 |
+-MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - \ |
18137 |
++MODPOST += -s -T - \ |
18138 |
+ $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) |
18139 |
+ |
18140 |
+ ifeq ($(KBUILD_EXTMOD),) |
18141 |
+@@ -82,6 +82,11 @@ include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ |
18142 |
+ $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) |
18143 |
+ endif |
18144 |
+ |
18145 |
++# 'make -i -k' ignores compile errors, and builds as many modules as possible. |
18146 |
++ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) |
18147 |
++MODPOST += -n |
18148 |
++endif |
18149 |
++ |
18150 |
+ # find all modules listed in modules.order |
18151 |
+ modules := $(sort $(shell cat $(MODORDER))) |
18152 |
+ |
18153 |
+diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh |
18154 |
+index a07668a5c36b..94a833597a88 100755 |
18155 |
+--- a/scripts/headers_install.sh |
18156 |
++++ b/scripts/headers_install.sh |
18157 |
+@@ -64,7 +64,7 @@ configs=$(sed -e ' |
18158 |
+ d |
18159 |
+ ' $OUTFILE) |
18160 |
+ |
18161 |
+-# The entries in the following list are not warned. |
18162 |
++# The entries in the following list do not result in an error. |
18163 |
+ # Please do not add a new entry. This list is only for existing ones. |
18164 |
+ # The list will be reduced gradually, and deleted eventually. (hopefully) |
18165 |
+ # |
18166 |
+@@ -98,18 +98,19 @@ include/uapi/linux/raw.h:CONFIG_MAX_RAW_DEVS |
18167 |
+ |
18168 |
+ for c in $configs |
18169 |
+ do |
18170 |
+- warn=1 |
18171 |
++ leak_error=1 |
18172 |
+ |
18173 |
+ for ignore in $config_leak_ignores |
18174 |
+ do |
18175 |
+ if echo "$INFILE:$c" | grep -q "$ignore$"; then |
18176 |
+- warn= |
18177 |
++ leak_error= |
18178 |
+ break |
18179 |
+ fi |
18180 |
+ done |
18181 |
+ |
18182 |
+- if [ "$warn" = 1 ]; then |
18183 |
+- echo "warning: $INFILE: leak $c to user-space" >&2 |
18184 |
++ if [ "$leak_error" = 1 ]; then |
18185 |
++ echo "error: $INFILE: leak $c to user-space" >&2 |
18186 |
++ exit 1 |
18187 |
+ fi |
18188 |
+ done |
18189 |
+ |
18190 |
+diff --git a/scripts/mksysmap b/scripts/mksysmap |
18191 |
+index a35acc0d0b82..9aa23d15862a 100755 |
18192 |
+--- a/scripts/mksysmap |
18193 |
++++ b/scripts/mksysmap |
18194 |
+@@ -41,4 +41,4 @@ |
18195 |
+ # so we just ignore them to let readprofile continue to work. |
18196 |
+ # (At least sparc64 has __crc_ in the middle). |
18197 |
+ |
18198 |
+-$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2 |
18199 |
++$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2 |
18200 |
+diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c |
18201 |
+index a84ef030fbd7..4cfa58c07778 100644 |
18202 |
+--- a/security/apparmor/domain.c |
18203 |
++++ b/security/apparmor/domain.c |
18204 |
+@@ -929,7 +929,8 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm) |
18205 |
+ * aways results in a further reduction of permissions. |
18206 |
+ */ |
18207 |
+ if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && |
18208 |
+- !unconfined(label) && !aa_label_is_subset(new, ctx->nnp)) { |
18209 |
++ !unconfined(label) && |
18210 |
++ !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
18211 |
+ error = -EPERM; |
18212 |
+ info = "no new privs"; |
18213 |
+ goto audit; |
18214 |
+@@ -1207,7 +1208,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags) |
18215 |
+ * reduce restrictions. |
18216 |
+ */ |
18217 |
+ if (task_no_new_privs(current) && !unconfined(label) && |
18218 |
+- !aa_label_is_subset(new, ctx->nnp)) { |
18219 |
++ !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
18220 |
+ /* not an apparmor denial per se, so don't log it */ |
18221 |
+ AA_DEBUG("no_new_privs - change_hat denied"); |
18222 |
+ error = -EPERM; |
18223 |
+@@ -1228,7 +1229,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags) |
18224 |
+ * reduce restrictions. |
18225 |
+ */ |
18226 |
+ if (task_no_new_privs(current) && !unconfined(label) && |
18227 |
+- !aa_label_is_subset(previous, ctx->nnp)) { |
18228 |
++ !aa_label_is_unconfined_subset(previous, ctx->nnp)) { |
18229 |
+ /* not an apparmor denial per se, so don't log it */ |
18230 |
+ AA_DEBUG("no_new_privs - change_hat denied"); |
18231 |
+ error = -EPERM; |
18232 |
+@@ -1423,7 +1424,7 @@ check: |
18233 |
+ * reduce restrictions. |
18234 |
+ */ |
18235 |
+ if (task_no_new_privs(current) && !unconfined(label) && |
18236 |
+- !aa_label_is_subset(new, ctx->nnp)) { |
18237 |
++ !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
18238 |
+ /* not an apparmor denial per se, so don't log it */ |
18239 |
+ AA_DEBUG("no_new_privs - change_hat denied"); |
18240 |
+ error = -EPERM; |
18241 |
+diff --git a/security/apparmor/include/label.h b/security/apparmor/include/label.h |
18242 |
+index 47942c4ba7ca..255764ab06e2 100644 |
18243 |
+--- a/security/apparmor/include/label.h |
18244 |
++++ b/security/apparmor/include/label.h |
18245 |
+@@ -281,6 +281,7 @@ bool aa_label_init(struct aa_label *label, int size, gfp_t gfp); |
18246 |
+ struct aa_label *aa_label_alloc(int size, struct aa_proxy *proxy, gfp_t gfp); |
18247 |
+ |
18248 |
+ bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub); |
18249 |
++bool aa_label_is_unconfined_subset(struct aa_label *set, struct aa_label *sub); |
18250 |
+ struct aa_profile *__aa_label_next_not_in_set(struct label_it *I, |
18251 |
+ struct aa_label *set, |
18252 |
+ struct aa_label *sub); |
18253 |
+diff --git a/security/apparmor/label.c b/security/apparmor/label.c |
18254 |
+index 470693239e64..5f324d63ceaa 100644 |
18255 |
+--- a/security/apparmor/label.c |
18256 |
++++ b/security/apparmor/label.c |
18257 |
+@@ -550,6 +550,39 @@ bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub) |
18258 |
+ return __aa_label_next_not_in_set(&i, set, sub) == NULL; |
18259 |
+ } |
18260 |
+ |
18261 |
++/** |
18262 |
++ * aa_label_is_unconfined_subset - test if @sub is a subset of @set |
18263 |
++ * @set: label to test against |
18264 |
++ * @sub: label to test if is subset of @set |
18265 |
++ * |
18266 |
++ * This checks for subset but taking into account unconfined. IF |
18267 |
++ * @sub contains an unconfined profile that does not have a matching |
18268 |
++ * unconfined in @set then this will not cause the test to fail. |
18269 |
++ * Conversely we don't care about an unconfined in @set that is not in |
18270 |
++ * @sub |
18271 |
++ * |
18272 |
++ * Returns: true if @sub is special_subset of @set |
18273 |
++ * else false |
18274 |
++ */ |
18275 |
++bool aa_label_is_unconfined_subset(struct aa_label *set, struct aa_label *sub) |
18276 |
++{ |
18277 |
++ struct label_it i = { }; |
18278 |
++ struct aa_profile *p; |
18279 |
++ |
18280 |
++ AA_BUG(!set); |
18281 |
++ AA_BUG(!sub); |
18282 |
++ |
18283 |
++ if (sub == set) |
18284 |
++ return true; |
18285 |
++ |
18286 |
++ do { |
18287 |
++ p = __aa_label_next_not_in_set(&i, set, sub); |
18288 |
++ if (p && !profile_unconfined(p)) |
18289 |
++ break; |
18290 |
++ } while (p); |
18291 |
++ |
18292 |
++ return p == NULL; |
18293 |
++} |
18294 |
+ |
18295 |
+ |
18296 |
+ /** |
18297 |
+@@ -1531,13 +1564,13 @@ static const char *label_modename(struct aa_ns *ns, struct aa_label *label, |
18298 |
+ |
18299 |
+ label_for_each(i, label, profile) { |
18300 |
+ if (aa_ns_visible(ns, profile->ns, flags & FLAG_VIEW_SUBNS)) { |
18301 |
+- if (profile->mode == APPARMOR_UNCONFINED) |
18302 |
++ count++; |
18303 |
++ if (profile == profile->ns->unconfined) |
18304 |
+ /* special case unconfined so stacks with |
18305 |
+ * unconfined don't report as mixed. ie. |
18306 |
+ * profile_foo//&:ns1:unconfined (mixed) |
18307 |
+ */ |
18308 |
+ continue; |
18309 |
+- count++; |
18310 |
+ if (mode == -1) |
18311 |
+ mode = profile->mode; |
18312 |
+ else if (mode != profile->mode) |
18313 |
+diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c |
18314 |
+index b621ad74f54a..66a8504c8bea 100644 |
18315 |
+--- a/security/apparmor/lsm.c |
18316 |
++++ b/security/apparmor/lsm.c |
18317 |
+@@ -804,7 +804,12 @@ static void apparmor_sk_clone_security(const struct sock *sk, |
18318 |
+ struct aa_sk_ctx *ctx = SK_CTX(sk); |
18319 |
+ struct aa_sk_ctx *new = SK_CTX(newsk); |
18320 |
+ |
18321 |
++ if (new->label) |
18322 |
++ aa_put_label(new->label); |
18323 |
+ new->label = aa_get_label(ctx->label); |
18324 |
++ |
18325 |
++ if (new->peer) |
18326 |
++ aa_put_label(new->peer); |
18327 |
+ new->peer = aa_get_label(ctx->peer); |
18328 |
+ } |
18329 |
+ |
18330 |
+diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c |
18331 |
+index da94a1b4bfda..0cc7cdd58465 100644 |
18332 |
+--- a/security/selinux/ss/conditional.c |
18333 |
++++ b/security/selinux/ss/conditional.c |
18334 |
+@@ -27,6 +27,9 @@ static int cond_evaluate_expr(struct policydb *p, struct cond_expr *expr) |
18335 |
+ int s[COND_EXPR_MAXDEPTH]; |
18336 |
+ int sp = -1; |
18337 |
+ |
18338 |
++ if (expr->len == 0) |
18339 |
++ return -1; |
18340 |
++ |
18341 |
+ for (i = 0; i < expr->len; i++) { |
18342 |
+ struct cond_expr_node *node = &expr->nodes[i]; |
18343 |
+ |
18344 |
+@@ -392,27 +395,19 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp) |
18345 |
+ |
18346 |
+ rc = next_entry(buf, fp, sizeof(u32) * 2); |
18347 |
+ if (rc) |
18348 |
+- goto err; |
18349 |
++ return rc; |
18350 |
+ |
18351 |
+ expr->expr_type = le32_to_cpu(buf[0]); |
18352 |
+ expr->bool = le32_to_cpu(buf[1]); |
18353 |
+ |
18354 |
+- if (!expr_node_isvalid(p, expr)) { |
18355 |
+- rc = -EINVAL; |
18356 |
+- goto err; |
18357 |
+- } |
18358 |
++ if (!expr_node_isvalid(p, expr)) |
18359 |
++ return -EINVAL; |
18360 |
+ } |
18361 |
+ |
18362 |
+ rc = cond_read_av_list(p, fp, &node->true_list, NULL); |
18363 |
+ if (rc) |
18364 |
+- goto err; |
18365 |
+- rc = cond_read_av_list(p, fp, &node->false_list, &node->true_list); |
18366 |
+- if (rc) |
18367 |
+- goto err; |
18368 |
+- return 0; |
18369 |
+-err: |
18370 |
+- cond_node_destroy(node); |
18371 |
+- return rc; |
18372 |
++ return rc; |
18373 |
++ return cond_read_av_list(p, fp, &node->false_list, &node->true_list); |
18374 |
+ } |
18375 |
+ |
18376 |
+ int cond_read_list(struct policydb *p, void *fp) |
18377 |
+diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c |
18378 |
+index 8ad34fd031d1..77e591fce919 100644 |
18379 |
+--- a/security/selinux/ss/services.c |
18380 |
++++ b/security/selinux/ss/services.c |
18381 |
+@@ -2923,8 +2923,12 @@ err: |
18382 |
+ if (*names) { |
18383 |
+ for (i = 0; i < *len; i++) |
18384 |
+ kfree((*names)[i]); |
18385 |
++ kfree(*names); |
18386 |
+ } |
18387 |
+ kfree(*values); |
18388 |
++ *len = 0; |
18389 |
++ *names = NULL; |
18390 |
++ *values = NULL; |
18391 |
+ goto out; |
18392 |
+ } |
18393 |
+ |
18394 |
+diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c |
18395 |
+index 67d735e9a6a4..fea92e148790 100644 |
18396 |
+--- a/sound/firewire/amdtp-am824.c |
18397 |
++++ b/sound/firewire/amdtp-am824.c |
18398 |
+@@ -82,7 +82,8 @@ int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate, |
18399 |
+ if (err < 0) |
18400 |
+ return err; |
18401 |
+ |
18402 |
+- s->ctx_data.rx.fdf = AMDTP_FDF_AM824 | s->sfc; |
18403 |
++ if (s->direction == AMDTP_OUT_STREAM) |
18404 |
++ s->ctx_data.rx.fdf = AMDTP_FDF_AM824 | s->sfc; |
18405 |
+ |
18406 |
+ p->pcm_channels = pcm_channels; |
18407 |
+ p->midi_ports = midi_ports; |
18408 |
+diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c |
18409 |
+index c5b1d5900eed..d6420d224d09 100644 |
18410 |
+--- a/sound/isa/wavefront/wavefront_synth.c |
18411 |
++++ b/sound/isa/wavefront/wavefront_synth.c |
18412 |
+@@ -1171,7 +1171,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header) |
18413 |
+ "alias for %d\n", |
18414 |
+ header->number, |
18415 |
+ header->hdr.a.OriginalSample); |
18416 |
+- |
18417 |
++ |
18418 |
++ if (header->number >= WF_MAX_SAMPLE) |
18419 |
++ return -EINVAL; |
18420 |
++ |
18421 |
+ munge_int32 (header->number, &alias_hdr[0], 2); |
18422 |
+ munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2); |
18423 |
+ munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset), |
18424 |
+@@ -1202,6 +1205,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header) |
18425 |
+ int num_samples; |
18426 |
+ unsigned char *msample_hdr; |
18427 |
+ |
18428 |
++ if (header->number >= WF_MAX_SAMPLE) |
18429 |
++ return -EINVAL; |
18430 |
++ |
18431 |
+ msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL); |
18432 |
+ if (! msample_hdr) |
18433 |
+ return -ENOMEM; |
18434 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
18435 |
+index 2c4575909441..e057ecb5a904 100644 |
18436 |
+--- a/sound/pci/hda/patch_realtek.c |
18437 |
++++ b/sound/pci/hda/patch_realtek.c |
18438 |
+@@ -81,6 +81,7 @@ struct alc_spec { |
18439 |
+ |
18440 |
+ /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ |
18441 |
+ int mute_led_polarity; |
18442 |
++ int micmute_led_polarity; |
18443 |
+ hda_nid_t mute_led_nid; |
18444 |
+ hda_nid_t cap_mute_led_nid; |
18445 |
+ |
18446 |
+@@ -4080,11 +4081,9 @@ static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, |
18447 |
+ |
18448 |
+ /* update LED status via GPIO */ |
18449 |
+ static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, |
18450 |
+- bool enabled) |
18451 |
++ int polarity, bool enabled) |
18452 |
+ { |
18453 |
+- struct alc_spec *spec = codec->spec; |
18454 |
+- |
18455 |
+- if (spec->mute_led_polarity) |
18456 |
++ if (polarity) |
18457 |
+ enabled = !enabled; |
18458 |
+ alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ |
18459 |
+ } |
18460 |
+@@ -4095,7 +4094,8 @@ static void alc_fixup_gpio_mute_hook(void *private_data, int enabled) |
18461 |
+ struct hda_codec *codec = private_data; |
18462 |
+ struct alc_spec *spec = codec->spec; |
18463 |
+ |
18464 |
+- alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); |
18465 |
++ alc_update_gpio_led(codec, spec->gpio_mute_led_mask, |
18466 |
++ spec->mute_led_polarity, enabled); |
18467 |
+ } |
18468 |
+ |
18469 |
+ /* turn on/off mic-mute LED via GPIO per capture hook */ |
18470 |
+@@ -4104,6 +4104,7 @@ static void alc_gpio_micmute_update(struct hda_codec *codec) |
18471 |
+ struct alc_spec *spec = codec->spec; |
18472 |
+ |
18473 |
+ alc_update_gpio_led(codec, spec->gpio_mic_led_mask, |
18474 |
++ spec->micmute_led_polarity, |
18475 |
+ spec->gen.micmute_led.led_value); |
18476 |
+ } |
18477 |
+ |
18478 |
+@@ -5808,7 +5809,8 @@ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, |
18479 |
+ |
18480 |
+ snd_hda_gen_hp_automute(codec, jack); |
18481 |
+ /* mute_led_polarity is set to 0, so we pass inverted value here */ |
18482 |
+- alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); |
18483 |
++ alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, |
18484 |
++ !spec->gen.hp_jack_present); |
18485 |
+ } |
18486 |
+ |
18487 |
+ /* Manage GPIOs for HP EliteBook Folio 9480m. |
18488 |
+diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig |
18489 |
+index e60e0b6a689c..8a66f23a7b05 100644 |
18490 |
+--- a/sound/soc/codecs/Kconfig |
18491 |
++++ b/sound/soc/codecs/Kconfig |
18492 |
+@@ -1136,10 +1136,13 @@ config SND_SOC_RT5677_SPI |
18493 |
+ config SND_SOC_RT5682 |
18494 |
+ tristate |
18495 |
+ depends on I2C || SOUNDWIRE |
18496 |
++ depends on SOUNDWIRE || !SOUNDWIRE |
18497 |
++ depends on I2C || !I2C |
18498 |
+ |
18499 |
+ config SND_SOC_RT5682_SDW |
18500 |
+ tristate "Realtek RT5682 Codec - SDW" |
18501 |
+ depends on SOUNDWIRE |
18502 |
++ depends on I2C || !I2C |
18503 |
+ select SND_SOC_RT5682 |
18504 |
+ select REGMAP_SOUNDWIRE |
18505 |
+ |
18506 |
+@@ -1620,19 +1623,19 @@ config SND_SOC_WM9090 |
18507 |
+ |
18508 |
+ config SND_SOC_WM9705 |
18509 |
+ tristate |
18510 |
+- depends on SND_SOC_AC97_BUS |
18511 |
++ depends on SND_SOC_AC97_BUS || AC97_BUS_NEW |
18512 |
+ select REGMAP_AC97 |
18513 |
+ select AC97_BUS_COMPAT if AC97_BUS_NEW |
18514 |
+ |
18515 |
+ config SND_SOC_WM9712 |
18516 |
+ tristate |
18517 |
+- depends on SND_SOC_AC97_BUS |
18518 |
++ depends on SND_SOC_AC97_BUS || AC97_BUS_NEW |
18519 |
+ select REGMAP_AC97 |
18520 |
+ select AC97_BUS_COMPAT if AC97_BUS_NEW |
18521 |
+ |
18522 |
+ config SND_SOC_WM9713 |
18523 |
+ tristate |
18524 |
+- depends on SND_SOC_AC97_BUS |
18525 |
++ depends on SND_SOC_AC97_BUS || AC97_BUS_NEW |
18526 |
+ select REGMAP_AC97 |
18527 |
+ select AC97_BUS_COMPAT if AC97_BUS_NEW |
18528 |
+ |
18529 |
+diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c |
18530 |
+index cae1def8902d..96718e3a1ad0 100644 |
18531 |
+--- a/sound/soc/codecs/max98373.c |
18532 |
++++ b/sound/soc/codecs/max98373.c |
18533 |
+@@ -850,8 +850,8 @@ static int max98373_resume(struct device *dev) |
18534 |
+ { |
18535 |
+ struct max98373_priv *max98373 = dev_get_drvdata(dev); |
18536 |
+ |
18537 |
+- max98373_reset(max98373, dev); |
18538 |
+ regcache_cache_only(max98373->regmap, false); |
18539 |
++ max98373_reset(max98373, dev); |
18540 |
+ regcache_sync(max98373->regmap); |
18541 |
+ return 0; |
18542 |
+ } |
18543 |
+diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c |
18544 |
+index a5a7e46de246..a7f45191364d 100644 |
18545 |
+--- a/sound/soc/codecs/rt1308-sdw.c |
18546 |
++++ b/sound/soc/codecs/rt1308-sdw.c |
18547 |
+@@ -482,6 +482,9 @@ static int rt1308_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18548 |
+ { |
18549 |
+ struct sdw_stream_data *stream; |
18550 |
+ |
18551 |
++ if (!sdw_stream) |
18552 |
++ return 0; |
18553 |
++ |
18554 |
+ stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18555 |
+ if (!stream) |
18556 |
+ return -ENOMEM; |
18557 |
+diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c |
18558 |
+index 6ba1849a77b0..e2e1d5b03b38 100644 |
18559 |
+--- a/sound/soc/codecs/rt5645.c |
18560 |
++++ b/sound/soc/codecs/rt5645.c |
18561 |
+@@ -3625,6 +3625,12 @@ static const struct rt5645_platform_data asus_t100ha_platform_data = { |
18562 |
+ .inv_jd1_1 = true, |
18563 |
+ }; |
18564 |
+ |
18565 |
++static const struct rt5645_platform_data asus_t101ha_platform_data = { |
18566 |
++ .dmic1_data_pin = RT5645_DMIC_DATA_IN2N, |
18567 |
++ .dmic2_data_pin = RT5645_DMIC2_DISABLE, |
18568 |
++ .jd_mode = 3, |
18569 |
++}; |
18570 |
++ |
18571 |
+ static const struct rt5645_platform_data lenovo_ideapad_miix_310_pdata = { |
18572 |
+ .jd_mode = 3, |
18573 |
+ .in2_diff = true, |
18574 |
+@@ -3708,6 +3714,14 @@ static const struct dmi_system_id dmi_platform_data[] = { |
18575 |
+ }, |
18576 |
+ .driver_data = (void *)&asus_t100ha_platform_data, |
18577 |
+ }, |
18578 |
++ { |
18579 |
++ .ident = "ASUS T101HA", |
18580 |
++ .matches = { |
18581 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
18582 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"), |
18583 |
++ }, |
18584 |
++ .driver_data = (void *)&asus_t101ha_platform_data, |
18585 |
++ }, |
18586 |
+ { |
18587 |
+ .ident = "MINIX Z83-4", |
18588 |
+ .matches = { |
18589 |
+diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c |
18590 |
+index d36f560ad7a8..c4892af14850 100644 |
18591 |
+--- a/sound/soc/codecs/rt5682.c |
18592 |
++++ b/sound/soc/codecs/rt5682.c |
18593 |
+@@ -2958,6 +2958,9 @@ static int rt5682_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18594 |
+ { |
18595 |
+ struct sdw_stream_data *stream; |
18596 |
+ |
18597 |
++ if (!sdw_stream) |
18598 |
++ return 0; |
18599 |
++ |
18600 |
+ stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18601 |
+ if (!stream) |
18602 |
+ return -ENOMEM; |
18603 |
+diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c |
18604 |
+index ff68f0e4f629..687ac2153666 100644 |
18605 |
+--- a/sound/soc/codecs/rt700.c |
18606 |
++++ b/sound/soc/codecs/rt700.c |
18607 |
+@@ -860,6 +860,9 @@ static int rt700_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18608 |
+ { |
18609 |
+ struct sdw_stream_data *stream; |
18610 |
+ |
18611 |
++ if (!sdw_stream) |
18612 |
++ return 0; |
18613 |
++ |
18614 |
+ stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18615 |
+ if (!stream) |
18616 |
+ return -ENOMEM; |
18617 |
+diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c |
18618 |
+index 2daed7692a3b..65b59dbfb43c 100644 |
18619 |
+--- a/sound/soc/codecs/rt711.c |
18620 |
++++ b/sound/soc/codecs/rt711.c |
18621 |
+@@ -906,6 +906,9 @@ static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18622 |
+ { |
18623 |
+ struct sdw_stream_data *stream; |
18624 |
+ |
18625 |
++ if (!sdw_stream) |
18626 |
++ return 0; |
18627 |
++ |
18628 |
+ stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18629 |
+ if (!stream) |
18630 |
+ return -ENOMEM; |
18631 |
+diff --git a/sound/soc/codecs/rt715.c b/sound/soc/codecs/rt715.c |
18632 |
+index 2cbc57b16b13..099c8bd20006 100644 |
18633 |
+--- a/sound/soc/codecs/rt715.c |
18634 |
++++ b/sound/soc/codecs/rt715.c |
18635 |
+@@ -530,6 +530,9 @@ static int rt715_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18636 |
+ |
18637 |
+ struct sdw_stream_data *stream; |
18638 |
+ |
18639 |
++ if (!sdw_stream) |
18640 |
++ return 0; |
18641 |
++ |
18642 |
+ stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18643 |
+ if (!stream) |
18644 |
+ return -ENOMEM; |
18645 |
+diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c |
18646 |
+index e7178817d7a7..1ee10eafe3e6 100644 |
18647 |
+--- a/sound/soc/fsl/fsl_asrc_dma.c |
18648 |
++++ b/sound/soc/fsl/fsl_asrc_dma.c |
18649 |
+@@ -252,6 +252,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component, |
18650 |
+ ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be); |
18651 |
+ if (ret) { |
18652 |
+ dev_err(dev, "failed to config DMA channel for Back-End\n"); |
18653 |
++ dma_release_channel(pair->dma_chan[dir]); |
18654 |
+ return ret; |
18655 |
+ } |
18656 |
+ |
18657 |
+diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c |
18658 |
+index c7a49d03463a..84290be778f0 100644 |
18659 |
+--- a/sound/soc/fsl/fsl_esai.c |
18660 |
++++ b/sound/soc/fsl/fsl_esai.c |
18661 |
+@@ -87,6 +87,10 @@ static irqreturn_t esai_isr(int irq, void *devid) |
18662 |
+ if ((saisr & (ESAI_SAISR_TUE | ESAI_SAISR_ROE)) && |
18663 |
+ esai_priv->reset_at_xrun) { |
18664 |
+ dev_dbg(&pdev->dev, "reset module for xrun\n"); |
18665 |
++ regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, |
18666 |
++ ESAI_xCR_xEIE_MASK, 0); |
18667 |
++ regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR, |
18668 |
++ ESAI_xCR_xEIE_MASK, 0); |
18669 |
+ tasklet_schedule(&esai_priv->task); |
18670 |
+ } |
18671 |
+ |
18672 |
+diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c |
18673 |
+index a495d1050d49..e30b66b94bf6 100644 |
18674 |
+--- a/sound/soc/img/img-i2s-in.c |
18675 |
++++ b/sound/soc/img/img-i2s-in.c |
18676 |
+@@ -482,6 +482,7 @@ static int img_i2s_in_probe(struct platform_device *pdev) |
18677 |
+ if (IS_ERR(rst)) { |
18678 |
+ if (PTR_ERR(rst) == -EPROBE_DEFER) { |
18679 |
+ ret = -EPROBE_DEFER; |
18680 |
++ pm_runtime_put(&pdev->dev); |
18681 |
+ goto err_suspend; |
18682 |
+ } |
18683 |
+ |
18684 |
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
18685 |
+index 08f4ae964b02..5c1a5e2aff6f 100644 |
18686 |
+--- a/sound/soc/intel/boards/bytcr_rt5640.c |
18687 |
++++ b/sound/soc/intel/boards/bytcr_rt5640.c |
18688 |
+@@ -742,6 +742,30 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
18689 |
+ BYT_RT5640_SSP0_AIF1 | |
18690 |
+ BYT_RT5640_MCLK_EN), |
18691 |
+ }, |
18692 |
++ { /* Toshiba Encore WT8-A */ |
18693 |
++ .matches = { |
18694 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
18695 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT8-A"), |
18696 |
++ }, |
18697 |
++ .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
18698 |
++ BYT_RT5640_JD_SRC_JD2_IN4N | |
18699 |
++ BYT_RT5640_OVCD_TH_2000UA | |
18700 |
++ BYT_RT5640_OVCD_SF_0P75 | |
18701 |
++ BYT_RT5640_JD_NOT_INV | |
18702 |
++ BYT_RT5640_MCLK_EN), |
18703 |
++ }, |
18704 |
++ { /* Toshiba Encore WT10-A */ |
18705 |
++ .matches = { |
18706 |
++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
18707 |
++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A-103"), |
18708 |
++ }, |
18709 |
++ .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
18710 |
++ BYT_RT5640_JD_SRC_JD1_IN4P | |
18711 |
++ BYT_RT5640_OVCD_TH_2000UA | |
18712 |
++ BYT_RT5640_OVCD_SF_0P75 | |
18713 |
++ BYT_RT5640_SSP0_AIF2 | |
18714 |
++ BYT_RT5640_MCLK_EN), |
18715 |
++ }, |
18716 |
+ { /* Catch-all for generic Insyde tablets, must be last */ |
18717 |
+ .matches = { |
18718 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), |
18719 |
+diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c |
18720 |
+index 2e9b56b29d31..b2e867113226 100644 |
18721 |
+--- a/sound/soc/meson/axg-fifo.c |
18722 |
++++ b/sound/soc/meson/axg-fifo.c |
18723 |
+@@ -249,7 +249,7 @@ int axg_fifo_pcm_open(struct snd_soc_component *component, |
18724 |
+ /* Enable pclk to access registers and clock the fifo ip */ |
18725 |
+ ret = clk_prepare_enable(fifo->pclk); |
18726 |
+ if (ret) |
18727 |
+- return ret; |
18728 |
++ goto free_irq; |
18729 |
+ |
18730 |
+ /* Setup status2 so it reports the memory pointer */ |
18731 |
+ regmap_update_bits(fifo->map, FIFO_CTRL1, |
18732 |
+@@ -269,8 +269,14 @@ int axg_fifo_pcm_open(struct snd_soc_component *component, |
18733 |
+ /* Take memory arbitror out of reset */ |
18734 |
+ ret = reset_control_deassert(fifo->arb); |
18735 |
+ if (ret) |
18736 |
+- clk_disable_unprepare(fifo->pclk); |
18737 |
++ goto free_clk; |
18738 |
++ |
18739 |
++ return 0; |
18740 |
+ |
18741 |
++free_clk: |
18742 |
++ clk_disable_unprepare(fifo->pclk); |
18743 |
++free_irq: |
18744 |
++ free_irq(fifo->irq, ss); |
18745 |
+ return ret; |
18746 |
+ } |
18747 |
+ EXPORT_SYMBOL_GPL(axg_fifo_pcm_open); |
18748 |
+diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c |
18749 |
+index 2ca8c98e204f..5a4a91c88734 100644 |
18750 |
+--- a/sound/soc/meson/meson-card-utils.c |
18751 |
++++ b/sound/soc/meson/meson-card-utils.c |
18752 |
+@@ -49,19 +49,26 @@ int meson_card_reallocate_links(struct snd_soc_card *card, |
18753 |
+ links = krealloc(priv->card.dai_link, |
18754 |
+ num_links * sizeof(*priv->card.dai_link), |
18755 |
+ GFP_KERNEL | __GFP_ZERO); |
18756 |
++ if (!links) |
18757 |
++ goto err_links; |
18758 |
++ |
18759 |
+ ldata = krealloc(priv->link_data, |
18760 |
+ num_links * sizeof(*priv->link_data), |
18761 |
+ GFP_KERNEL | __GFP_ZERO); |
18762 |
+- |
18763 |
+- if (!links || !ldata) { |
18764 |
+- dev_err(priv->card.dev, "failed to allocate links\n"); |
18765 |
+- return -ENOMEM; |
18766 |
+- } |
18767 |
++ if (!ldata) |
18768 |
++ goto err_ldata; |
18769 |
+ |
18770 |
+ priv->card.dai_link = links; |
18771 |
+ priv->link_data = ldata; |
18772 |
+ priv->card.num_links = num_links; |
18773 |
+ return 0; |
18774 |
++ |
18775 |
++err_ldata: |
18776 |
++ kfree(links); |
18777 |
++err_links: |
18778 |
++ dev_err(priv->card.dev, "failed to allocate links\n"); |
18779 |
++ return -ENOMEM; |
18780 |
++ |
18781 |
+ } |
18782 |
+ EXPORT_SYMBOL_GPL(meson_card_reallocate_links); |
18783 |
+ |
18784 |
+diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c |
18785 |
+index 125af00bba53..4640804aab7f 100644 |
18786 |
+--- a/sound/soc/qcom/qdsp6/q6asm-dai.c |
18787 |
++++ b/sound/soc/qcom/qdsp6/q6asm-dai.c |
18788 |
+@@ -176,7 +176,7 @@ static const struct snd_compr_codec_caps q6asm_compr_caps = { |
18789 |
+ }; |
18790 |
+ |
18791 |
+ static void event_handler(uint32_t opcode, uint32_t token, |
18792 |
+- uint32_t *payload, void *priv) |
18793 |
++ void *payload, void *priv) |
18794 |
+ { |
18795 |
+ struct q6asm_dai_rtd *prtd = priv; |
18796 |
+ struct snd_pcm_substream *substream = prtd->substream; |
18797 |
+@@ -490,7 +490,7 @@ static int q6asm_dai_hw_params(struct snd_soc_component *component, |
18798 |
+ } |
18799 |
+ |
18800 |
+ static void compress_event_handler(uint32_t opcode, uint32_t token, |
18801 |
+- uint32_t *payload, void *priv) |
18802 |
++ void *payload, void *priv) |
18803 |
+ { |
18804 |
+ struct q6asm_dai_rtd *prtd = priv; |
18805 |
+ struct snd_compr_stream *substream = prtd->cstream; |
18806 |
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c |
18807 |
+index af19010b9d88..8bd49c8a9517 100644 |
18808 |
+--- a/sound/soc/sh/rcar/gen.c |
18809 |
++++ b/sound/soc/sh/rcar/gen.c |
18810 |
+@@ -224,6 +224,14 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) |
18811 |
+ RSND_GEN_S_REG(SSI_SYS_STATUS5, 0x884), |
18812 |
+ RSND_GEN_S_REG(SSI_SYS_STATUS6, 0x888), |
18813 |
+ RSND_GEN_S_REG(SSI_SYS_STATUS7, 0x88c), |
18814 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0, 0x850), |
18815 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE1, 0x854), |
18816 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2, 0x858), |
18817 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE3, 0x85c), |
18818 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE4, 0x890), |
18819 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE5, 0x894), |
18820 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE6, 0x898), |
18821 |
++ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE7, 0x89c), |
18822 |
+ RSND_GEN_S_REG(HDMI0_SEL, 0x9e0), |
18823 |
+ RSND_GEN_S_REG(HDMI1_SEL, 0x9e4), |
18824 |
+ |
18825 |
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h |
18826 |
+index ea6cbaa9743e..d47608ff5fac 100644 |
18827 |
+--- a/sound/soc/sh/rcar/rsnd.h |
18828 |
++++ b/sound/soc/sh/rcar/rsnd.h |
18829 |
+@@ -189,6 +189,14 @@ enum rsnd_reg { |
18830 |
+ SSI_SYS_STATUS5, |
18831 |
+ SSI_SYS_STATUS6, |
18832 |
+ SSI_SYS_STATUS7, |
18833 |
++ SSI_SYS_INT_ENABLE0, |
18834 |
++ SSI_SYS_INT_ENABLE1, |
18835 |
++ SSI_SYS_INT_ENABLE2, |
18836 |
++ SSI_SYS_INT_ENABLE3, |
18837 |
++ SSI_SYS_INT_ENABLE4, |
18838 |
++ SSI_SYS_INT_ENABLE5, |
18839 |
++ SSI_SYS_INT_ENABLE6, |
18840 |
++ SSI_SYS_INT_ENABLE7, |
18841 |
+ HDMI0_SEL, |
18842 |
+ HDMI1_SEL, |
18843 |
+ SSI9_BUSIF0_MODE, |
18844 |
+@@ -237,6 +245,7 @@ enum rsnd_reg { |
18845 |
+ #define SSI9_BUSIF_ADINR(i) (SSI9_BUSIF0_ADINR + (i)) |
18846 |
+ #define SSI9_BUSIF_DALIGN(i) (SSI9_BUSIF0_DALIGN + (i)) |
18847 |
+ #define SSI_SYS_STATUS(i) (SSI_SYS_STATUS0 + (i)) |
18848 |
++#define SSI_SYS_INT_ENABLE(i) (SSI_SYS_INT_ENABLE0 + (i)) |
18849 |
+ |
18850 |
+ |
18851 |
+ struct rsnd_priv; |
18852 |
+diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c |
18853 |
+index 4a7d3413917f..47d5ddb526f2 100644 |
18854 |
+--- a/sound/soc/sh/rcar/ssi.c |
18855 |
++++ b/sound/soc/sh/rcar/ssi.c |
18856 |
+@@ -372,6 +372,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, |
18857 |
+ u32 wsr = ssi->wsr; |
18858 |
+ int width; |
18859 |
+ int is_tdm, is_tdm_split; |
18860 |
++ int id = rsnd_mod_id(mod); |
18861 |
++ int i; |
18862 |
++ u32 sys_int_enable = 0; |
18863 |
+ |
18864 |
+ is_tdm = rsnd_runtime_is_tdm(io); |
18865 |
+ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18866 |
+@@ -447,6 +450,38 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, |
18867 |
+ cr_mode = DIEN; /* PIO : enable Data interrupt */ |
18868 |
+ } |
18869 |
+ |
18870 |
++ /* enable busif buffer over/under run interrupt. */ |
18871 |
++ if (is_tdm || is_tdm_split) { |
18872 |
++ switch (id) { |
18873 |
++ case 0: |
18874 |
++ case 1: |
18875 |
++ case 2: |
18876 |
++ case 3: |
18877 |
++ case 4: |
18878 |
++ for (i = 0; i < 4; i++) { |
18879 |
++ sys_int_enable = rsnd_mod_read(mod, |
18880 |
++ SSI_SYS_INT_ENABLE(i * 2)); |
18881 |
++ sys_int_enable |= 0xf << (id * 4); |
18882 |
++ rsnd_mod_write(mod, |
18883 |
++ SSI_SYS_INT_ENABLE(i * 2), |
18884 |
++ sys_int_enable); |
18885 |
++ } |
18886 |
++ |
18887 |
++ break; |
18888 |
++ case 9: |
18889 |
++ for (i = 0; i < 4; i++) { |
18890 |
++ sys_int_enable = rsnd_mod_read(mod, |
18891 |
++ SSI_SYS_INT_ENABLE((i * 2) + 1)); |
18892 |
++ sys_int_enable |= 0xf << 4; |
18893 |
++ rsnd_mod_write(mod, |
18894 |
++ SSI_SYS_INT_ENABLE((i * 2) + 1), |
18895 |
++ sys_int_enable); |
18896 |
++ } |
18897 |
++ |
18898 |
++ break; |
18899 |
++ } |
18900 |
++ } |
18901 |
++ |
18902 |
+ init_end: |
18903 |
+ ssi->cr_own = cr_own; |
18904 |
+ ssi->cr_mode = cr_mode; |
18905 |
+@@ -496,6 +531,13 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, |
18906 |
+ { |
18907 |
+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
18908 |
+ struct device *dev = rsnd_priv_to_dev(priv); |
18909 |
++ int is_tdm, is_tdm_split; |
18910 |
++ int id = rsnd_mod_id(mod); |
18911 |
++ int i; |
18912 |
++ u32 sys_int_enable = 0; |
18913 |
++ |
18914 |
++ is_tdm = rsnd_runtime_is_tdm(io); |
18915 |
++ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18916 |
+ |
18917 |
+ if (!rsnd_ssi_is_run_mods(mod, io)) |
18918 |
+ return 0; |
18919 |
+@@ -517,6 +559,38 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, |
18920 |
+ ssi->wsr = 0; |
18921 |
+ } |
18922 |
+ |
18923 |
++ /* disable busif buffer over/under run interrupt. */ |
18924 |
++ if (is_tdm || is_tdm_split) { |
18925 |
++ switch (id) { |
18926 |
++ case 0: |
18927 |
++ case 1: |
18928 |
++ case 2: |
18929 |
++ case 3: |
18930 |
++ case 4: |
18931 |
++ for (i = 0; i < 4; i++) { |
18932 |
++ sys_int_enable = rsnd_mod_read(mod, |
18933 |
++ SSI_SYS_INT_ENABLE(i * 2)); |
18934 |
++ sys_int_enable &= ~(0xf << (id * 4)); |
18935 |
++ rsnd_mod_write(mod, |
18936 |
++ SSI_SYS_INT_ENABLE(i * 2), |
18937 |
++ sys_int_enable); |
18938 |
++ } |
18939 |
++ |
18940 |
++ break; |
18941 |
++ case 9: |
18942 |
++ for (i = 0; i < 4; i++) { |
18943 |
++ sys_int_enable = rsnd_mod_read(mod, |
18944 |
++ SSI_SYS_INT_ENABLE((i * 2) + 1)); |
18945 |
++ sys_int_enable &= ~(0xf << 4); |
18946 |
++ rsnd_mod_write(mod, |
18947 |
++ SSI_SYS_INT_ENABLE((i * 2) + 1), |
18948 |
++ sys_int_enable); |
18949 |
++ } |
18950 |
++ |
18951 |
++ break; |
18952 |
++ } |
18953 |
++ } |
18954 |
++ |
18955 |
+ return 0; |
18956 |
+ } |
18957 |
+ |
18958 |
+@@ -622,6 +696,11 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, |
18959 |
+ int enable) |
18960 |
+ { |
18961 |
+ u32 val = 0; |
18962 |
++ int is_tdm, is_tdm_split; |
18963 |
++ int id = rsnd_mod_id(mod); |
18964 |
++ |
18965 |
++ is_tdm = rsnd_runtime_is_tdm(io); |
18966 |
++ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18967 |
+ |
18968 |
+ if (rsnd_is_gen1(priv)) |
18969 |
+ return 0; |
18970 |
+@@ -635,6 +714,19 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, |
18971 |
+ if (enable) |
18972 |
+ val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; |
18973 |
+ |
18974 |
++ if (is_tdm || is_tdm_split) { |
18975 |
++ switch (id) { |
18976 |
++ case 0: |
18977 |
++ case 1: |
18978 |
++ case 2: |
18979 |
++ case 3: |
18980 |
++ case 4: |
18981 |
++ case 9: |
18982 |
++ val |= 0x0000ff00; |
18983 |
++ break; |
18984 |
++ } |
18985 |
++ } |
18986 |
++ |
18987 |
+ rsnd_mod_write(mod, SSI_INT_ENABLE, val); |
18988 |
+ |
18989 |
+ return 0; |
18990 |
+@@ -651,6 +743,12 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
18991 |
+ u32 status; |
18992 |
+ bool elapsed = false; |
18993 |
+ bool stop = false; |
18994 |
++ int id = rsnd_mod_id(mod); |
18995 |
++ int i; |
18996 |
++ int is_tdm, is_tdm_split; |
18997 |
++ |
18998 |
++ is_tdm = rsnd_runtime_is_tdm(io); |
18999 |
++ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
19000 |
+ |
19001 |
+ spin_lock(&priv->lock); |
19002 |
+ |
19003 |
+@@ -672,6 +770,53 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
19004 |
+ stop = true; |
19005 |
+ } |
19006 |
+ |
19007 |
++ status = 0; |
19008 |
++ |
19009 |
++ if (is_tdm || is_tdm_split) { |
19010 |
++ switch (id) { |
19011 |
++ case 0: |
19012 |
++ case 1: |
19013 |
++ case 2: |
19014 |
++ case 3: |
19015 |
++ case 4: |
19016 |
++ for (i = 0; i < 4; i++) { |
19017 |
++ status = rsnd_mod_read(mod, |
19018 |
++ SSI_SYS_STATUS(i * 2)); |
19019 |
++ status &= 0xf << (id * 4); |
19020 |
++ |
19021 |
++ if (status) { |
19022 |
++ rsnd_dbg_irq_status(dev, |
19023 |
++ "%s err status : 0x%08x\n", |
19024 |
++ rsnd_mod_name(mod), status); |
19025 |
++ rsnd_mod_write(mod, |
19026 |
++ SSI_SYS_STATUS(i * 2), |
19027 |
++ 0xf << (id * 4)); |
19028 |
++ stop = true; |
19029 |
++ break; |
19030 |
++ } |
19031 |
++ } |
19032 |
++ break; |
19033 |
++ case 9: |
19034 |
++ for (i = 0; i < 4; i++) { |
19035 |
++ status = rsnd_mod_read(mod, |
19036 |
++ SSI_SYS_STATUS((i * 2) + 1)); |
19037 |
++ status &= 0xf << 4; |
19038 |
++ |
19039 |
++ if (status) { |
19040 |
++ rsnd_dbg_irq_status(dev, |
19041 |
++ "%s err status : 0x%08x\n", |
19042 |
++ rsnd_mod_name(mod), status); |
19043 |
++ rsnd_mod_write(mod, |
19044 |
++ SSI_SYS_STATUS((i * 2) + 1), |
19045 |
++ 0xf << 4); |
19046 |
++ stop = true; |
19047 |
++ break; |
19048 |
++ } |
19049 |
++ } |
19050 |
++ break; |
19051 |
++ } |
19052 |
++ } |
19053 |
++ |
19054 |
+ rsnd_ssi_status_clear(mod); |
19055 |
+ rsnd_ssi_interrupt_out: |
19056 |
+ spin_unlock(&priv->lock); |
19057 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
19058 |
+index 843b8b1c89d4..e5433e8fcf19 100644 |
19059 |
+--- a/sound/soc/soc-core.c |
19060 |
++++ b/sound/soc/soc-core.c |
19061 |
+@@ -1720,9 +1720,25 @@ match: |
19062 |
+ dai_link->platforms->name = component->name; |
19063 |
+ |
19064 |
+ /* convert non BE into BE */ |
19065 |
+- dai_link->no_pcm = 1; |
19066 |
+- dai_link->dpcm_playback = 1; |
19067 |
+- dai_link->dpcm_capture = 1; |
19068 |
++ if (!dai_link->no_pcm) { |
19069 |
++ dai_link->no_pcm = 1; |
19070 |
++ |
19071 |
++ if (dai_link->dpcm_playback) |
19072 |
++ dev_warn(card->dev, |
19073 |
++ "invalid configuration, dailink %s has flags no_pcm=0 and dpcm_playback=1\n", |
19074 |
++ dai_link->name); |
19075 |
++ if (dai_link->dpcm_capture) |
19076 |
++ dev_warn(card->dev, |
19077 |
++ "invalid configuration, dailink %s has flags no_pcm=0 and dpcm_capture=1\n", |
19078 |
++ dai_link->name); |
19079 |
++ |
19080 |
++ /* convert normal link into DPCM one */ |
19081 |
++ if (!(dai_link->dpcm_playback || |
19082 |
++ dai_link->dpcm_capture)) { |
19083 |
++ dai_link->dpcm_playback = !dai_link->capture_only; |
19084 |
++ dai_link->dpcm_capture = !dai_link->playback_only; |
19085 |
++ } |
19086 |
++ } |
19087 |
+ |
19088 |
+ /* override any BE fixups */ |
19089 |
+ dai_link->be_hw_params_fixup = |
19090 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
19091 |
+index e2632841b321..c0aa64ff8e32 100644 |
19092 |
+--- a/sound/soc/soc-dapm.c |
19093 |
++++ b/sound/soc/soc-dapm.c |
19094 |
+@@ -4340,16 +4340,16 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card, |
19095 |
+ codec = codec_dai->playback_widget; |
19096 |
+ |
19097 |
+ if (playback_cpu && codec) { |
19098 |
+- if (dai_link->params && !dai_link->playback_widget) { |
19099 |
++ if (dai_link->params && !rtd->playback_widget) { |
19100 |
+ substream = streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
19101 |
+ dai = snd_soc_dapm_new_dai(card, substream, "playback"); |
19102 |
+ if (IS_ERR(dai)) |
19103 |
+ goto capture; |
19104 |
+- dai_link->playback_widget = dai; |
19105 |
++ rtd->playback_widget = dai; |
19106 |
+ } |
19107 |
+ |
19108 |
+ dapm_connect_dai_routes(&card->dapm, cpu_dai, playback_cpu, |
19109 |
+- dai_link->playback_widget, |
19110 |
++ rtd->playback_widget, |
19111 |
+ codec_dai, codec); |
19112 |
+ } |
19113 |
+ |
19114 |
+@@ -4358,16 +4358,16 @@ capture: |
19115 |
+ codec = codec_dai->capture_widget; |
19116 |
+ |
19117 |
+ if (codec && capture_cpu) { |
19118 |
+- if (dai_link->params && !dai_link->capture_widget) { |
19119 |
++ if (dai_link->params && !rtd->capture_widget) { |
19120 |
+ substream = streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
19121 |
+ dai = snd_soc_dapm_new_dai(card, substream, "capture"); |
19122 |
+ if (IS_ERR(dai)) |
19123 |
+ return; |
19124 |
+- dai_link->capture_widget = dai; |
19125 |
++ rtd->capture_widget = dai; |
19126 |
+ } |
19127 |
+ |
19128 |
+ dapm_connect_dai_routes(&card->dapm, codec_dai, codec, |
19129 |
+- dai_link->capture_widget, |
19130 |
++ rtd->capture_widget, |
19131 |
+ cpu_dai, capture_cpu); |
19132 |
+ } |
19133 |
+ } |
19134 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
19135 |
+index 1f302de44052..39ce61c5b874 100644 |
19136 |
+--- a/sound/soc/soc-pcm.c |
19137 |
++++ b/sound/soc/soc-pcm.c |
19138 |
+@@ -2908,20 +2908,44 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) |
19139 |
+ struct snd_pcm *pcm; |
19140 |
+ char new_name[64]; |
19141 |
+ int ret = 0, playback = 0, capture = 0; |
19142 |
++ int stream; |
19143 |
+ int i; |
19144 |
+ |
19145 |
++ if (rtd->dai_link->dynamic && rtd->num_cpus > 1) { |
19146 |
++ dev_err(rtd->dev, |
19147 |
++ "DPCM doesn't support Multi CPU for Front-Ends yet\n"); |
19148 |
++ return -EINVAL; |
19149 |
++ } |
19150 |
++ |
19151 |
+ if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { |
19152 |
+- cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
19153 |
+- if (rtd->num_cpus > 1) { |
19154 |
+- dev_err(rtd->dev, |
19155 |
+- "DPCM doesn't support Multi CPU yet\n"); |
19156 |
+- return -EINVAL; |
19157 |
++ if (rtd->dai_link->dpcm_playback) { |
19158 |
++ stream = SNDRV_PCM_STREAM_PLAYBACK; |
19159 |
++ |
19160 |
++ for_each_rtd_cpu_dais(rtd, i, cpu_dai) |
19161 |
++ if (!snd_soc_dai_stream_valid(cpu_dai, |
19162 |
++ stream)) { |
19163 |
++ dev_err(rtd->card->dev, |
19164 |
++ "CPU DAI %s for rtd %s does not support playback\n", |
19165 |
++ cpu_dai->name, |
19166 |
++ rtd->dai_link->stream_name); |
19167 |
++ return -EINVAL; |
19168 |
++ } |
19169 |
++ playback = 1; |
19170 |
++ } |
19171 |
++ if (rtd->dai_link->dpcm_capture) { |
19172 |
++ stream = SNDRV_PCM_STREAM_CAPTURE; |
19173 |
++ |
19174 |
++ for_each_rtd_cpu_dais(rtd, i, cpu_dai) |
19175 |
++ if (!snd_soc_dai_stream_valid(cpu_dai, |
19176 |
++ stream)) { |
19177 |
++ dev_err(rtd->card->dev, |
19178 |
++ "CPU DAI %s for rtd %s does not support capture\n", |
19179 |
++ cpu_dai->name, |
19180 |
++ rtd->dai_link->stream_name); |
19181 |
++ return -EINVAL; |
19182 |
++ } |
19183 |
++ capture = 1; |
19184 |
+ } |
19185 |
+- |
19186 |
+- playback = rtd->dai_link->dpcm_playback && |
19187 |
+- snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK); |
19188 |
+- capture = rtd->dai_link->dpcm_capture && |
19189 |
+- snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE); |
19190 |
+ } else { |
19191 |
+ /* Adapt stream for codec2codec links */ |
19192 |
+ int cpu_capture = rtd->dai_link->params ? |
19193 |
+diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c |
19194 |
+index dfc412e2d956..6d63768d42aa 100644 |
19195 |
+--- a/sound/soc/sof/control.c |
19196 |
++++ b/sound/soc/sof/control.c |
19197 |
+@@ -19,8 +19,8 @@ static void update_mute_led(struct snd_sof_control *scontrol, |
19198 |
+ struct snd_kcontrol *kcontrol, |
19199 |
+ struct snd_ctl_elem_value *ucontrol) |
19200 |
+ { |
19201 |
+- unsigned int temp = 0; |
19202 |
+- unsigned int mask; |
19203 |
++ int temp = 0; |
19204 |
++ int mask; |
19205 |
+ int i; |
19206 |
+ |
19207 |
+ mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
19208 |
+diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c |
19209 |
+index 91acfae7935c..74b438216216 100644 |
19210 |
+--- a/sound/soc/sof/core.c |
19211 |
++++ b/sound/soc/sof/core.c |
19212 |
+@@ -176,6 +176,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) |
19213 |
+ /* init the IPC */ |
19214 |
+ sdev->ipc = snd_sof_ipc_init(sdev); |
19215 |
+ if (!sdev->ipc) { |
19216 |
++ ret = -ENOMEM; |
19217 |
+ dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret); |
19218 |
+ goto ipc_err; |
19219 |
+ } |
19220 |
+diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig |
19221 |
+index bae4f7bf5f75..812749064ca8 100644 |
19222 |
+--- a/sound/soc/sof/imx/Kconfig |
19223 |
++++ b/sound/soc/sof/imx/Kconfig |
19224 |
+@@ -14,7 +14,7 @@ if SND_SOC_SOF_IMX_TOPLEVEL |
19225 |
+ config SND_SOC_SOF_IMX8_SUPPORT |
19226 |
+ bool "SOF support for i.MX8" |
19227 |
+ depends on IMX_SCU |
19228 |
+- depends on IMX_DSP |
19229 |
++ select IMX_DSP |
19230 |
+ help |
19231 |
+ This adds support for Sound Open Firmware for NXP i.MX8 platforms |
19232 |
+ Say Y if you have such a device. |
19233 |
+diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c |
19234 |
+index 3041fbbb010a..ea021db697b8 100644 |
19235 |
+--- a/sound/soc/sof/intel/hda-codec.c |
19236 |
++++ b/sound/soc/sof/intel/hda-codec.c |
19237 |
+@@ -24,19 +24,44 @@ |
19238 |
+ #define IDISP_VID_INTEL 0x80860000 |
19239 |
+ |
19240 |
+ /* load the legacy HDA codec driver */ |
19241 |
+-static int hda_codec_load_module(struct hda_codec *codec) |
19242 |
++static int request_codec_module(struct hda_codec *codec) |
19243 |
+ { |
19244 |
+ #ifdef MODULE |
19245 |
+ char alias[MODULE_NAME_LEN]; |
19246 |
+- const char *module = alias; |
19247 |
++ const char *mod = NULL; |
19248 |
+ |
19249 |
+- snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias)); |
19250 |
+- dev_dbg(&codec->core.dev, "loading codec module: %s\n", module); |
19251 |
+- request_module(module); |
19252 |
++ switch (codec->probe_id) { |
19253 |
++ case HDA_CODEC_ID_GENERIC: |
19254 |
++#if IS_MODULE(CONFIG_SND_HDA_GENERIC) |
19255 |
++ mod = "snd-hda-codec-generic"; |
19256 |
+ #endif |
19257 |
++ break; |
19258 |
++ default: |
19259 |
++ snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias)); |
19260 |
++ mod = alias; |
19261 |
++ break; |
19262 |
++ } |
19263 |
++ |
19264 |
++ if (mod) { |
19265 |
++ dev_dbg(&codec->core.dev, "loading codec module: %s\n", mod); |
19266 |
++ request_module(mod); |
19267 |
++ } |
19268 |
++#endif /* MODULE */ |
19269 |
+ return device_attach(hda_codec_dev(codec)); |
19270 |
+ } |
19271 |
+ |
19272 |
++static int hda_codec_load_module(struct hda_codec *codec) |
19273 |
++{ |
19274 |
++ int ret = request_codec_module(codec); |
19275 |
++ |
19276 |
++ if (ret <= 0) { |
19277 |
++ codec->probe_id = HDA_CODEC_ID_GENERIC; |
19278 |
++ ret = request_codec_module(codec); |
19279 |
++ } |
19280 |
++ |
19281 |
++ return ret; |
19282 |
++} |
19283 |
++ |
19284 |
+ /* enable controller wake up event for all codecs with jack connectors */ |
19285 |
+ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) |
19286 |
+ { |
19287 |
+@@ -78,6 +103,13 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) {} |
19288 |
+ EXPORT_SYMBOL_NS(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC); |
19289 |
+ EXPORT_SYMBOL_NS(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC); |
19290 |
+ |
19291 |
++#if IS_ENABLED(CONFIG_SND_HDA_GENERIC) |
19292 |
++#define is_generic_config(bus) \ |
19293 |
++ ((bus)->modelname && !strcmp((bus)->modelname, "generic")) |
19294 |
++#else |
19295 |
++#define is_generic_config(x) 0 |
19296 |
++#endif |
19297 |
++ |
19298 |
+ /* probe individual codec */ |
19299 |
+ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19300 |
+ bool hda_codec_use_common_hdmi) |
19301 |
+@@ -87,6 +119,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19302 |
+ #endif |
19303 |
+ struct hda_bus *hbus = sof_to_hbus(sdev); |
19304 |
+ struct hdac_device *hdev; |
19305 |
++ struct hda_codec *codec; |
19306 |
+ u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) | |
19307 |
+ (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; |
19308 |
+ u32 resp = -1; |
19309 |
+@@ -108,6 +141,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19310 |
+ |
19311 |
+ hda_priv->codec.bus = hbus; |
19312 |
+ hdev = &hda_priv->codec.core; |
19313 |
++ codec = &hda_priv->codec; |
19314 |
+ |
19315 |
+ ret = snd_hdac_ext_bus_device_init(&hbus->core, address, hdev); |
19316 |
+ if (ret < 0) |
19317 |
+@@ -122,6 +156,11 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19318 |
+ hda_priv->need_display_power = true; |
19319 |
+ } |
19320 |
+ |
19321 |
++ if (is_generic_config(hbus)) |
19322 |
++ codec->probe_id = HDA_CODEC_ID_GENERIC; |
19323 |
++ else |
19324 |
++ codec->probe_id = 0; |
19325 |
++ |
19326 |
+ /* |
19327 |
+ * if common HDMI codec driver is not used, codec load |
19328 |
+ * is skipped here and hdac_hdmi is used instead |
19329 |
+@@ -129,7 +168,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19330 |
+ if (hda_codec_use_common_hdmi || |
19331 |
+ (resp & 0xFFFF0000) != IDISP_VID_INTEL) { |
19332 |
+ hdev->type = HDA_DEV_LEGACY; |
19333 |
+- ret = hda_codec_load_module(&hda_priv->codec); |
19334 |
++ ret = hda_codec_load_module(codec); |
19335 |
+ /* |
19336 |
+ * handle ret==0 (no driver bound) as an error, but pass |
19337 |
+ * other return codes without modification |
19338 |
+diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c |
19339 |
+index 2233146386cc..71cf5f9db79d 100644 |
19340 |
+--- a/sound/soc/sof/nocodec.c |
19341 |
++++ b/sound/soc/sof/nocodec.c |
19342 |
+@@ -52,8 +52,10 @@ static int sof_nocodec_bes_setup(struct device *dev, |
19343 |
+ links[i].platforms->name = dev_name(dev); |
19344 |
+ links[i].codecs->dai_name = "snd-soc-dummy-dai"; |
19345 |
+ links[i].codecs->name = "snd-soc-dummy"; |
19346 |
+- links[i].dpcm_playback = 1; |
19347 |
+- links[i].dpcm_capture = 1; |
19348 |
++ if (ops->drv[i].playback.channels_min) |
19349 |
++ links[i].dpcm_playback = 1; |
19350 |
++ if (ops->drv[i].capture.channels_min) |
19351 |
++ links[i].dpcm_capture = 1; |
19352 |
+ } |
19353 |
+ |
19354 |
+ card->dai_link = links; |
19355 |
+diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c |
19356 |
+index c410822d9920..01d83ddc16ba 100644 |
19357 |
+--- a/sound/soc/sof/pm.c |
19358 |
++++ b/sound/soc/sof/pm.c |
19359 |
+@@ -90,7 +90,10 @@ static int sof_resume(struct device *dev, bool runtime_resume) |
19360 |
+ int ret; |
19361 |
+ |
19362 |
+ /* do nothing if dsp resume callbacks are not set */ |
19363 |
+- if (!sof_ops(sdev)->resume || !sof_ops(sdev)->runtime_resume) |
19364 |
++ if (!runtime_resume && !sof_ops(sdev)->resume) |
19365 |
++ return 0; |
19366 |
++ |
19367 |
++ if (runtime_resume && !sof_ops(sdev)->runtime_resume) |
19368 |
+ return 0; |
19369 |
+ |
19370 |
+ /* DSP was never successfully started, nothing to resume */ |
19371 |
+@@ -175,7 +178,10 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) |
19372 |
+ int ret; |
19373 |
+ |
19374 |
+ /* do nothing if dsp suspend callback is not set */ |
19375 |
+- if (!sof_ops(sdev)->suspend) |
19376 |
++ if (!runtime_suspend && !sof_ops(sdev)->suspend) |
19377 |
++ return 0; |
19378 |
++ |
19379 |
++ if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) |
19380 |
+ return 0; |
19381 |
+ |
19382 |
+ if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) |
19383 |
+diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h |
19384 |
+index bf65f31af858..875a5fc13297 100644 |
19385 |
+--- a/sound/soc/sof/sof-audio.h |
19386 |
++++ b/sound/soc/sof/sof-audio.h |
19387 |
+@@ -56,7 +56,7 @@ struct snd_sof_pcm { |
19388 |
+ struct snd_sof_led_control { |
19389 |
+ unsigned int use_led; |
19390 |
+ unsigned int direction; |
19391 |
+- unsigned int led_value; |
19392 |
++ int led_value; |
19393 |
+ }; |
19394 |
+ |
19395 |
+ /* ALSA SOF Kcontrol device */ |
19396 |
+diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c |
19397 |
+index fe8ba3e05e08..ab2b69de1d4d 100644 |
19398 |
+--- a/sound/soc/sof/topology.c |
19399 |
++++ b/sound/soc/sof/topology.c |
19400 |
+@@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, |
19401 |
+ return ret; |
19402 |
+ } |
19403 |
+ |
19404 |
++ scontrol->led_ctl.led_value = -1; |
19405 |
++ |
19406 |
+ dobj->private = scontrol; |
19407 |
+ list_add(&scontrol->list, &sdev->kcontrol_list); |
19408 |
+ return ret; |
19409 |
+diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c |
19410 |
+index 9b5651502f12..3aca354f9e08 100644 |
19411 |
+--- a/sound/soc/tegra/tegra_wm8903.c |
19412 |
++++ b/sound/soc/tegra/tegra_wm8903.c |
19413 |
+@@ -177,6 +177,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) |
19414 |
+ struct snd_soc_component *component = codec_dai->component; |
19415 |
+ struct snd_soc_card *card = rtd->card; |
19416 |
+ struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
19417 |
++ int shrt = 0; |
19418 |
+ |
19419 |
+ if (gpio_is_valid(machine->gpio_hp_det)) { |
19420 |
+ tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; |
19421 |
+@@ -189,12 +190,15 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) |
19422 |
+ &tegra_wm8903_hp_jack_gpio); |
19423 |
+ } |
19424 |
+ |
19425 |
++ if (of_property_read_bool(card->dev->of_node, "nvidia,headset")) |
19426 |
++ shrt = SND_JACK_MICROPHONE; |
19427 |
++ |
19428 |
+ snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, |
19429 |
+ &tegra_wm8903_mic_jack, |
19430 |
+ tegra_wm8903_mic_jack_pins, |
19431 |
+ ARRAY_SIZE(tegra_wm8903_mic_jack_pins)); |
19432 |
+ wm8903_mic_detect(component, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, |
19433 |
+- 0); |
19434 |
++ shrt); |
19435 |
+ |
19436 |
+ snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS"); |
19437 |
+ |
19438 |
+diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c |
19439 |
+index 734ffe925c4d..7a7db743dc5b 100644 |
19440 |
+--- a/sound/soc/ti/davinci-mcasp.c |
19441 |
++++ b/sound/soc/ti/davinci-mcasp.c |
19442 |
+@@ -1896,8 +1896,10 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) |
19443 |
+ PTR_ERR(chan)); |
19444 |
+ return PTR_ERR(chan); |
19445 |
+ } |
19446 |
+- if (WARN_ON(!chan->device || !chan->device->dev)) |
19447 |
++ if (WARN_ON(!chan->device || !chan->device->dev)) { |
19448 |
++ dma_release_channel(chan); |
19449 |
+ return -EINVAL; |
19450 |
++ } |
19451 |
+ |
19452 |
+ if (chan->device->dev->of_node) |
19453 |
+ ret = of_property_read_string(chan->device->dev->of_node, |
19454 |
+diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c |
19455 |
+index 3d41ca2238d4..4f33ddb7b441 100644 |
19456 |
+--- a/sound/soc/ti/omap-mcbsp.c |
19457 |
++++ b/sound/soc/ti/omap-mcbsp.c |
19458 |
+@@ -686,7 +686,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
19459 |
+ mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, |
19460 |
+ SNDRV_PCM_STREAM_CAPTURE); |
19461 |
+ |
19462 |
+- mcbsp->fclk = clk_get(&pdev->dev, "fck"); |
19463 |
++ mcbsp->fclk = devm_clk_get(&pdev->dev, "fck"); |
19464 |
+ if (IS_ERR(mcbsp->fclk)) { |
19465 |
+ ret = PTR_ERR(mcbsp->fclk); |
19466 |
+ dev_err(mcbsp->dev, "unable to get fck: %d\n", ret); |
19467 |
+@@ -711,7 +711,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
19468 |
+ if (ret) { |
19469 |
+ dev_err(mcbsp->dev, |
19470 |
+ "Unable to create additional controls\n"); |
19471 |
+- goto err_thres; |
19472 |
++ return ret; |
19473 |
+ } |
19474 |
+ } |
19475 |
+ |
19476 |
+@@ -724,8 +724,6 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
19477 |
+ err_st: |
19478 |
+ if (mcbsp->pdata->buffer_size) |
19479 |
+ sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); |
19480 |
+-err_thres: |
19481 |
+- clk_put(mcbsp->fclk); |
19482 |
+ return ret; |
19483 |
+ } |
19484 |
+ |
19485 |
+@@ -1442,8 +1440,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev) |
19486 |
+ |
19487 |
+ omap_mcbsp_st_cleanup(pdev); |
19488 |
+ |
19489 |
+- clk_put(mcbsp->fclk); |
19490 |
+- |
19491 |
+ return 0; |
19492 |
+ } |
19493 |
+ |
19494 |
+diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c |
19495 |
+index 2873e8e6f02b..cdae1190b930 100644 |
19496 |
+--- a/sound/soc/ux500/mop500.c |
19497 |
++++ b/sound/soc/ux500/mop500.c |
19498 |
+@@ -63,10 +63,11 @@ static void mop500_of_node_put(void) |
19499 |
+ { |
19500 |
+ int i; |
19501 |
+ |
19502 |
+- for (i = 0; i < 2; i++) { |
19503 |
++ for (i = 0; i < 2; i++) |
19504 |
+ of_node_put(mop500_dai_links[i].cpus->of_node); |
19505 |
+- of_node_put(mop500_dai_links[i].codecs->of_node); |
19506 |
+- } |
19507 |
++ |
19508 |
++ /* Both links use the same codec, which is refcounted only once */ |
19509 |
++ of_node_put(mop500_dai_links[0].codecs->of_node); |
19510 |
+ } |
19511 |
+ |
19512 |
+ static int mop500_of_probe(struct platform_device *pdev, |
19513 |
+@@ -81,7 +82,9 @@ static int mop500_of_probe(struct platform_device *pdev, |
19514 |
+ |
19515 |
+ if (!(msp_np[0] && msp_np[1] && codec_np)) { |
19516 |
+ dev_err(&pdev->dev, "Phandle missing or invalid\n"); |
19517 |
+- mop500_of_node_put(); |
19518 |
++ for (i = 0; i < 2; i++) |
19519 |
++ of_node_put(msp_np[i]); |
19520 |
++ of_node_put(codec_np); |
19521 |
+ return -EINVAL; |
19522 |
+ } |
19523 |
+ |
19524 |
+diff --git a/sound/usb/card.h b/sound/usb/card.h |
19525 |
+index 395403a2d33f..d6219fba9699 100644 |
19526 |
+--- a/sound/usb/card.h |
19527 |
++++ b/sound/usb/card.h |
19528 |
+@@ -84,6 +84,10 @@ struct snd_usb_endpoint { |
19529 |
+ dma_addr_t sync_dma; /* DMA address of syncbuf */ |
19530 |
+ |
19531 |
+ unsigned int pipe; /* the data i/o pipe */ |
19532 |
++ unsigned int framesize[2]; /* small/large frame sizes in samples */ |
19533 |
++ unsigned int sample_rem; /* remainder from division fs/fps */ |
19534 |
++ unsigned int sample_accum; /* sample accumulator */ |
19535 |
++ unsigned int fps; /* frames per second */ |
19536 |
+ unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ |
19537 |
+ unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ |
19538 |
+ int freqshift; /* how much to shift the feedback value to get Q16.16 */ |
19539 |
+@@ -104,6 +108,7 @@ struct snd_usb_endpoint { |
19540 |
+ int iface, altsetting; |
19541 |
+ int skip_packets; /* quirks for devices to ignore the first n packets |
19542 |
+ in a stream */ |
19543 |
++ bool is_implicit_feedback; /* This endpoint is used as implicit feedback */ |
19544 |
+ |
19545 |
+ spinlock_t lock; |
19546 |
+ struct list_head list; |
19547 |
+diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c |
19548 |
+index 4a9a2f6ef5a4..9bea7d3f99f8 100644 |
19549 |
+--- a/sound/usb/endpoint.c |
19550 |
++++ b/sound/usb/endpoint.c |
19551 |
+@@ -124,12 +124,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep) |
19552 |
+ |
19553 |
+ /* |
19554 |
+ * For streaming based on information derived from sync endpoints, |
19555 |
+- * prepare_outbound_urb_sizes() will call next_packet_size() to |
19556 |
++ * prepare_outbound_urb_sizes() will call slave_next_packet_size() to |
19557 |
+ * determine the number of samples to be sent in the next packet. |
19558 |
+ * |
19559 |
+- * For implicit feedback, next_packet_size() is unused. |
19560 |
++ * For implicit feedback, slave_next_packet_size() is unused. |
19561 |
+ */ |
19562 |
+-int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
19563 |
++int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep) |
19564 |
+ { |
19565 |
+ unsigned long flags; |
19566 |
+ int ret; |
19567 |
+@@ -146,6 +146,29 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
19568 |
+ return ret; |
19569 |
+ } |
19570 |
+ |
19571 |
++/* |
19572 |
++ * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes() |
19573 |
++ * will call next_packet_size() to determine the number of samples to be |
19574 |
++ * sent in the next packet. |
19575 |
++ */ |
19576 |
++int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
19577 |
++{ |
19578 |
++ int ret; |
19579 |
++ |
19580 |
++ if (ep->fill_max) |
19581 |
++ return ep->maxframesize; |
19582 |
++ |
19583 |
++ ep->sample_accum += ep->sample_rem; |
19584 |
++ if (ep->sample_accum >= ep->fps) { |
19585 |
++ ep->sample_accum -= ep->fps; |
19586 |
++ ret = ep->framesize[1]; |
19587 |
++ } else { |
19588 |
++ ret = ep->framesize[0]; |
19589 |
++ } |
19590 |
++ |
19591 |
++ return ret; |
19592 |
++} |
19593 |
++ |
19594 |
+ static void retire_outbound_urb(struct snd_usb_endpoint *ep, |
19595 |
+ struct snd_urb_ctx *urb_ctx) |
19596 |
+ { |
19597 |
+@@ -190,6 +213,8 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep, |
19598 |
+ |
19599 |
+ if (ctx->packet_size[i]) |
19600 |
+ counts = ctx->packet_size[i]; |
19601 |
++ else if (ep->sync_master) |
19602 |
++ counts = snd_usb_endpoint_slave_next_packet_size(ep); |
19603 |
+ else |
19604 |
+ counts = snd_usb_endpoint_next_packet_size(ep); |
19605 |
+ |
19606 |
+@@ -321,17 +346,17 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep) |
19607 |
+ ep->next_packet_read_pos %= MAX_URBS; |
19608 |
+ |
19609 |
+ /* take URB out of FIFO */ |
19610 |
+- if (!list_empty(&ep->ready_playback_urbs)) |
19611 |
++ if (!list_empty(&ep->ready_playback_urbs)) { |
19612 |
+ ctx = list_first_entry(&ep->ready_playback_urbs, |
19613 |
+ struct snd_urb_ctx, ready_list); |
19614 |
++ list_del_init(&ctx->ready_list); |
19615 |
++ } |
19616 |
+ } |
19617 |
+ spin_unlock_irqrestore(&ep->lock, flags); |
19618 |
+ |
19619 |
+ if (ctx == NULL) |
19620 |
+ return; |
19621 |
+ |
19622 |
+- list_del_init(&ctx->ready_list); |
19623 |
+- |
19624 |
+ /* copy over the length information */ |
19625 |
+ for (i = 0; i < packet->packets; i++) |
19626 |
+ ctx->packet_size[i] = packet->packet_size[i]; |
19627 |
+@@ -497,6 +522,8 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, |
19628 |
+ |
19629 |
+ list_add_tail(&ep->list, &chip->ep_list); |
19630 |
+ |
19631 |
++ ep->is_implicit_feedback = 0; |
19632 |
++ |
19633 |
+ __exit_unlock: |
19634 |
+ mutex_unlock(&chip->mutex); |
19635 |
+ |
19636 |
+@@ -596,6 +623,178 @@ static void release_urbs(struct snd_usb_endpoint *ep, int force) |
19637 |
+ ep->nurbs = 0; |
19638 |
+ } |
19639 |
+ |
19640 |
++/* |
19641 |
++ * Check data endpoint for format differences |
19642 |
++ */ |
19643 |
++static bool check_ep_params(struct snd_usb_endpoint *ep, |
19644 |
++ snd_pcm_format_t pcm_format, |
19645 |
++ unsigned int channels, |
19646 |
++ unsigned int period_bytes, |
19647 |
++ unsigned int frames_per_period, |
19648 |
++ unsigned int periods_per_buffer, |
19649 |
++ struct audioformat *fmt, |
19650 |
++ struct snd_usb_endpoint *sync_ep) |
19651 |
++{ |
19652 |
++ unsigned int maxsize, minsize, packs_per_ms, max_packs_per_urb; |
19653 |
++ unsigned int max_packs_per_period, urbs_per_period, urb_packs; |
19654 |
++ unsigned int max_urbs; |
19655 |
++ int frame_bits = snd_pcm_format_physical_width(pcm_format) * channels; |
19656 |
++ int tx_length_quirk = (ep->chip->tx_length_quirk && |
19657 |
++ usb_pipeout(ep->pipe)); |
19658 |
++ bool ret = 1; |
19659 |
++ |
19660 |
++ if (pcm_format == SNDRV_PCM_FORMAT_DSD_U16_LE && fmt->dsd_dop) { |
19661 |
++ /* |
19662 |
++ * When operating in DSD DOP mode, the size of a sample frame |
19663 |
++ * in hardware differs from the actual physical format width |
19664 |
++ * because we need to make room for the DOP markers. |
19665 |
++ */ |
19666 |
++ frame_bits += channels << 3; |
19667 |
++ } |
19668 |
++ |
19669 |
++ ret = ret && (ep->datainterval == fmt->datainterval); |
19670 |
++ ret = ret && (ep->stride == frame_bits >> 3); |
19671 |
++ |
19672 |
++ switch (pcm_format) { |
19673 |
++ case SNDRV_PCM_FORMAT_U8: |
19674 |
++ ret = ret && (ep->silence_value == 0x80); |
19675 |
++ break; |
19676 |
++ case SNDRV_PCM_FORMAT_DSD_U8: |
19677 |
++ case SNDRV_PCM_FORMAT_DSD_U16_LE: |
19678 |
++ case SNDRV_PCM_FORMAT_DSD_U32_LE: |
19679 |
++ case SNDRV_PCM_FORMAT_DSD_U16_BE: |
19680 |
++ case SNDRV_PCM_FORMAT_DSD_U32_BE: |
19681 |
++ ret = ret && (ep->silence_value == 0x69); |
19682 |
++ break; |
19683 |
++ default: |
19684 |
++ ret = ret && (ep->silence_value == 0); |
19685 |
++ } |
19686 |
++ |
19687 |
++ /* assume max. frequency is 50% higher than nominal */ |
19688 |
++ ret = ret && (ep->freqmax == ep->freqn + (ep->freqn >> 1)); |
19689 |
++ /* Round up freqmax to nearest integer in order to calculate maximum |
19690 |
++ * packet size, which must represent a whole number of frames. |
19691 |
++ * This is accomplished by adding 0x0.ffff before converting the |
19692 |
++ * Q16.16 format into integer. |
19693 |
++ * In order to accurately calculate the maximum packet size when |
19694 |
++ * the data interval is more than 1 (i.e. ep->datainterval > 0), |
19695 |
++ * multiply by the data interval prior to rounding. For instance, |
19696 |
++ * a freqmax of 41 kHz will result in a max packet size of 6 (5.125) |
19697 |
++ * frames with a data interval of 1, but 11 (10.25) frames with a |
19698 |
++ * data interval of 2. |
19699 |
++ * (ep->freqmax << ep->datainterval overflows at 8.192 MHz for the |
19700 |
++ * maximum datainterval value of 3, at USB full speed, higher for |
19701 |
++ * USB high speed, noting that ep->freqmax is in units of |
19702 |
++ * frames per packet in Q16.16 format.) |
19703 |
++ */ |
19704 |
++ maxsize = (((ep->freqmax << ep->datainterval) + 0xffff) >> 16) * |
19705 |
++ (frame_bits >> 3); |
19706 |
++ if (tx_length_quirk) |
19707 |
++ maxsize += sizeof(__le32); /* Space for length descriptor */ |
19708 |
++ /* but wMaxPacketSize might reduce this */ |
19709 |
++ if (ep->maxpacksize && ep->maxpacksize < maxsize) { |
19710 |
++ /* whatever fits into a max. size packet */ |
19711 |
++ unsigned int data_maxsize = maxsize = ep->maxpacksize; |
19712 |
++ |
19713 |
++ if (tx_length_quirk) |
19714 |
++ /* Need to remove the length descriptor to calc freq */ |
19715 |
++ data_maxsize -= sizeof(__le32); |
19716 |
++ ret = ret && (ep->freqmax == (data_maxsize / (frame_bits >> 3)) |
19717 |
++ << (16 - ep->datainterval)); |
19718 |
++ } |
19719 |
++ |
19720 |
++ if (ep->fill_max) |
19721 |
++ ret = ret && (ep->curpacksize == ep->maxpacksize); |
19722 |
++ else |
19723 |
++ ret = ret && (ep->curpacksize == maxsize); |
19724 |
++ |
19725 |
++ if (snd_usb_get_speed(ep->chip->dev) != USB_SPEED_FULL) { |
19726 |
++ packs_per_ms = 8 >> ep->datainterval; |
19727 |
++ max_packs_per_urb = MAX_PACKS_HS; |
19728 |
++ } else { |
19729 |
++ packs_per_ms = 1; |
19730 |
++ max_packs_per_urb = MAX_PACKS; |
19731 |
++ } |
19732 |
++ if (sync_ep && !snd_usb_endpoint_implicit_feedback_sink(ep)) |
19733 |
++ max_packs_per_urb = min(max_packs_per_urb, |
19734 |
++ 1U << sync_ep->syncinterval); |
19735 |
++ max_packs_per_urb = max(1u, max_packs_per_urb >> ep->datainterval); |
19736 |
++ |
19737 |
++ /* |
19738 |
++ * Capture endpoints need to use small URBs because there's no way |
19739 |
++ * to tell in advance where the next period will end, and we don't |
19740 |
++ * want the next URB to complete much after the period ends. |
19741 |
++ * |
19742 |
++ * Playback endpoints with implicit sync much use the same parameters |
19743 |
++ * as their corresponding capture endpoint. |
19744 |
++ */ |
19745 |
++ if (usb_pipein(ep->pipe) || |
19746 |
++ snd_usb_endpoint_implicit_feedback_sink(ep)) { |
19747 |
++ |
19748 |
++ urb_packs = packs_per_ms; |
19749 |
++ /* |
19750 |
++ * Wireless devices can poll at a max rate of once per 4ms. |
19751 |
++ * For dataintervals less than 5, increase the packet count to |
19752 |
++ * allow the host controller to use bursting to fill in the |
19753 |
++ * gaps. |
19754 |
++ */ |
19755 |
++ if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_WIRELESS) { |
19756 |
++ int interval = ep->datainterval; |
19757 |
++ |
19758 |
++ while (interval < 5) { |
19759 |
++ urb_packs <<= 1; |
19760 |
++ ++interval; |
19761 |
++ } |
19762 |
++ } |
19763 |
++ /* make capture URBs <= 1 ms and smaller than a period */ |
19764 |
++ urb_packs = min(max_packs_per_urb, urb_packs); |
19765 |
++ while (urb_packs > 1 && urb_packs * maxsize >= period_bytes) |
19766 |
++ urb_packs >>= 1; |
19767 |
++ ret = ret && (ep->nurbs == MAX_URBS); |
19768 |
++ |
19769 |
++ /* |
19770 |
++ * Playback endpoints without implicit sync are adjusted so that |
19771 |
++ * a period fits as evenly as possible in the smallest number of |
19772 |
++ * URBs. The total number of URBs is adjusted to the size of the |
19773 |
++ * ALSA buffer, subject to the MAX_URBS and MAX_QUEUE limits. |
19774 |
++ */ |
19775 |
++ } else { |
19776 |
++ /* determine how small a packet can be */ |
19777 |
++ minsize = (ep->freqn >> (16 - ep->datainterval)) * |
19778 |
++ (frame_bits >> 3); |
19779 |
++ /* with sync from device, assume it can be 12% lower */ |
19780 |
++ if (sync_ep) |
19781 |
++ minsize -= minsize >> 3; |
19782 |
++ minsize = max(minsize, 1u); |
19783 |
++ |
19784 |
++ /* how many packets will contain an entire ALSA period? */ |
19785 |
++ max_packs_per_period = DIV_ROUND_UP(period_bytes, minsize); |
19786 |
++ |
19787 |
++ /* how many URBs will contain a period? */ |
19788 |
++ urbs_per_period = DIV_ROUND_UP(max_packs_per_period, |
19789 |
++ max_packs_per_urb); |
19790 |
++ /* how many packets are needed in each URB? */ |
19791 |
++ urb_packs = DIV_ROUND_UP(max_packs_per_period, urbs_per_period); |
19792 |
++ |
19793 |
++ /* limit the number of frames in a single URB */ |
19794 |
++ ret = ret && (ep->max_urb_frames == |
19795 |
++ DIV_ROUND_UP(frames_per_period, urbs_per_period)); |
19796 |
++ |
19797 |
++ /* try to use enough URBs to contain an entire ALSA buffer */ |
19798 |
++ max_urbs = min((unsigned) MAX_URBS, |
19799 |
++ MAX_QUEUE * packs_per_ms / urb_packs); |
19800 |
++ ret = ret && (ep->nurbs == min(max_urbs, |
19801 |
++ urbs_per_period * periods_per_buffer)); |
19802 |
++ } |
19803 |
++ |
19804 |
++ ret = ret && (ep->datainterval == fmt->datainterval); |
19805 |
++ ret = ret && (ep->maxpacksize == fmt->maxpacksize); |
19806 |
++ ret = ret && |
19807 |
++ (ep->fill_max == !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX)); |
19808 |
++ |
19809 |
++ return ret; |
19810 |
++} |
19811 |
++ |
19812 |
+ /* |
19813 |
+ * configure a data endpoint |
19814 |
+ */ |
19815 |
+@@ -861,10 +1060,23 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
19816 |
+ int err; |
19817 |
+ |
19818 |
+ if (ep->use_count != 0) { |
19819 |
+- usb_audio_warn(ep->chip, |
19820 |
+- "Unable to change format on ep #%x: already in use\n", |
19821 |
+- ep->ep_num); |
19822 |
+- return -EBUSY; |
19823 |
++ bool check = ep->is_implicit_feedback && |
19824 |
++ check_ep_params(ep, pcm_format, |
19825 |
++ channels, period_bytes, |
19826 |
++ period_frames, buffer_periods, |
19827 |
++ fmt, sync_ep); |
19828 |
++ |
19829 |
++ if (!check) { |
19830 |
++ usb_audio_warn(ep->chip, |
19831 |
++ "Unable to change format on ep #%x: already in use\n", |
19832 |
++ ep->ep_num); |
19833 |
++ return -EBUSY; |
19834 |
++ } |
19835 |
++ |
19836 |
++ usb_audio_dbg(ep->chip, |
19837 |
++ "Ep #%x already in use as implicit feedback but format not changed\n", |
19838 |
++ ep->ep_num); |
19839 |
++ return 0; |
19840 |
+ } |
19841 |
+ |
19842 |
+ /* release old buffers, if any */ |
19843 |
+@@ -874,10 +1086,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
19844 |
+ ep->maxpacksize = fmt->maxpacksize; |
19845 |
+ ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX); |
19846 |
+ |
19847 |
+- if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) |
19848 |
++ if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) { |
19849 |
+ ep->freqn = get_usb_full_speed_rate(rate); |
19850 |
+- else |
19851 |
++ ep->fps = 1000; |
19852 |
++ } else { |
19853 |
+ ep->freqn = get_usb_high_speed_rate(rate); |
19854 |
++ ep->fps = 8000; |
19855 |
++ } |
19856 |
++ |
19857 |
++ ep->sample_rem = rate % ep->fps; |
19858 |
++ ep->framesize[0] = rate / ep->fps; |
19859 |
++ ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps; |
19860 |
+ |
19861 |
+ /* calculate the frequency in 16.16 format */ |
19862 |
+ ep->freqm = ep->freqn; |
19863 |
+@@ -936,6 +1155,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) |
19864 |
+ ep->active_mask = 0; |
19865 |
+ ep->unlink_mask = 0; |
19866 |
+ ep->phase = 0; |
19867 |
++ ep->sample_accum = 0; |
19868 |
+ |
19869 |
+ snd_usb_endpoint_start_quirk(ep); |
19870 |
+ |
19871 |
+diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h |
19872 |
+index 63a39d4fa8d8..d23fa0a8c11b 100644 |
19873 |
+--- a/sound/usb/endpoint.h |
19874 |
++++ b/sound/usb/endpoint.h |
19875 |
+@@ -28,6 +28,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep); |
19876 |
+ void snd_usb_endpoint_free(struct snd_usb_endpoint *ep); |
19877 |
+ |
19878 |
+ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); |
19879 |
++int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep); |
19880 |
+ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep); |
19881 |
+ |
19882 |
+ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, |
19883 |
+diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
19884 |
+index a5f65a9a0254..aad2683ff793 100644 |
19885 |
+--- a/sound/usb/mixer_quirks.c |
19886 |
++++ b/sound/usb/mixer_quirks.c |
19887 |
+@@ -2185,6 +2185,421 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer) |
19888 |
+ return 0; |
19889 |
+ } |
19890 |
+ |
19891 |
++/* |
19892 |
++ * RME Babyface Pro (FS) |
19893 |
++ * |
19894 |
++ * These devices exposes a couple of DSP functions via request to EP0. |
19895 |
++ * Switches are available via control registers, while routing is controlled |
19896 |
++ * by controlling the volume on each possible crossing point. |
19897 |
++ * Volume control is linear, from -inf (dec. 0) to +6dB (dec. 65536) with |
19898 |
++ * 0dB being at dec. 32768. |
19899 |
++ */ |
19900 |
++enum { |
19901 |
++ SND_BBFPRO_CTL_REG1 = 0, |
19902 |
++ SND_BBFPRO_CTL_REG2 |
19903 |
++}; |
19904 |
++ |
19905 |
++#define SND_BBFPRO_CTL_REG_MASK 1 |
19906 |
++#define SND_BBFPRO_CTL_IDX_MASK 0xff |
19907 |
++#define SND_BBFPRO_CTL_IDX_SHIFT 1 |
19908 |
++#define SND_BBFPRO_CTL_VAL_MASK 1 |
19909 |
++#define SND_BBFPRO_CTL_VAL_SHIFT 9 |
19910 |
++#define SND_BBFPRO_CTL_REG1_CLK_MASTER 0 |
19911 |
++#define SND_BBFPRO_CTL_REG1_CLK_OPTICAL 1 |
19912 |
++#define SND_BBFPRO_CTL_REG1_SPDIF_PRO 7 |
19913 |
++#define SND_BBFPRO_CTL_REG1_SPDIF_EMPH 8 |
19914 |
++#define SND_BBFPRO_CTL_REG1_SPDIF_OPTICAL 10 |
19915 |
++#define SND_BBFPRO_CTL_REG2_48V_AN1 0 |
19916 |
++#define SND_BBFPRO_CTL_REG2_48V_AN2 1 |
19917 |
++#define SND_BBFPRO_CTL_REG2_SENS_IN3 2 |
19918 |
++#define SND_BBFPRO_CTL_REG2_SENS_IN4 3 |
19919 |
++#define SND_BBFPRO_CTL_REG2_PAD_AN1 4 |
19920 |
++#define SND_BBFPRO_CTL_REG2_PAD_AN2 5 |
19921 |
++ |
19922 |
++#define SND_BBFPRO_MIXER_IDX_MASK 0x1ff |
19923 |
++#define SND_BBFPRO_MIXER_VAL_MASK 0x3ffff |
19924 |
++#define SND_BBFPRO_MIXER_VAL_SHIFT 9 |
19925 |
++#define SND_BBFPRO_MIXER_VAL_MIN 0 // -inf |
19926 |
++#define SND_BBFPRO_MIXER_VAL_MAX 65536 // +6dB |
19927 |
++ |
19928 |
++#define SND_BBFPRO_USBREQ_CTL_REG1 0x10 |
19929 |
++#define SND_BBFPRO_USBREQ_CTL_REG2 0x17 |
19930 |
++#define SND_BBFPRO_USBREQ_MIXER 0x12 |
19931 |
++ |
19932 |
++static int snd_bbfpro_ctl_update(struct usb_mixer_interface *mixer, u8 reg, |
19933 |
++ u8 index, u8 value) |
19934 |
++{ |
19935 |
++ int err; |
19936 |
++ u16 usb_req, usb_idx, usb_val; |
19937 |
++ struct snd_usb_audio *chip = mixer->chip; |
19938 |
++ |
19939 |
++ err = snd_usb_lock_shutdown(chip); |
19940 |
++ if (err < 0) |
19941 |
++ return err; |
19942 |
++ |
19943 |
++ if (reg == SND_BBFPRO_CTL_REG1) { |
19944 |
++ usb_req = SND_BBFPRO_USBREQ_CTL_REG1; |
19945 |
++ if (index == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) { |
19946 |
++ usb_idx = 3; |
19947 |
++ usb_val = value ? 3 : 0; |
19948 |
++ } else { |
19949 |
++ usb_idx = 1 << index; |
19950 |
++ usb_val = value ? usb_idx : 0; |
19951 |
++ } |
19952 |
++ } else { |
19953 |
++ usb_req = SND_BBFPRO_USBREQ_CTL_REG2; |
19954 |
++ usb_idx = 1 << index; |
19955 |
++ usb_val = value ? usb_idx : 0; |
19956 |
++ } |
19957 |
++ |
19958 |
++ err = snd_usb_ctl_msg(chip->dev, |
19959 |
++ usb_sndctrlpipe(chip->dev, 0), usb_req, |
19960 |
++ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
19961 |
++ usb_val, usb_idx, 0, 0); |
19962 |
++ |
19963 |
++ snd_usb_unlock_shutdown(chip); |
19964 |
++ return err; |
19965 |
++} |
19966 |
++ |
19967 |
++static int snd_bbfpro_ctl_get(struct snd_kcontrol *kcontrol, |
19968 |
++ struct snd_ctl_elem_value *ucontrol) |
19969 |
++{ |
19970 |
++ u8 reg, idx, val; |
19971 |
++ int pv; |
19972 |
++ |
19973 |
++ pv = kcontrol->private_value; |
19974 |
++ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
19975 |
++ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
19976 |
++ val = kcontrol->private_value >> SND_BBFPRO_CTL_VAL_SHIFT; |
19977 |
++ |
19978 |
++ if ((reg == SND_BBFPRO_CTL_REG1 && |
19979 |
++ idx == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) || |
19980 |
++ (reg == SND_BBFPRO_CTL_REG2 && |
19981 |
++ (idx == SND_BBFPRO_CTL_REG2_SENS_IN3 || |
19982 |
++ idx == SND_BBFPRO_CTL_REG2_SENS_IN4))) { |
19983 |
++ ucontrol->value.enumerated.item[0] = val; |
19984 |
++ } else { |
19985 |
++ ucontrol->value.integer.value[0] = val; |
19986 |
++ } |
19987 |
++ return 0; |
19988 |
++} |
19989 |
++ |
19990 |
++static int snd_bbfpro_ctl_info(struct snd_kcontrol *kcontrol, |
19991 |
++ struct snd_ctl_elem_info *uinfo) |
19992 |
++{ |
19993 |
++ u8 reg, idx; |
19994 |
++ int pv; |
19995 |
++ |
19996 |
++ pv = kcontrol->private_value; |
19997 |
++ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
19998 |
++ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
19999 |
++ |
20000 |
++ if (reg == SND_BBFPRO_CTL_REG1 && |
20001 |
++ idx == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) { |
20002 |
++ static const char * const texts[2] = { |
20003 |
++ "AutoSync", |
20004 |
++ "Internal" |
20005 |
++ }; |
20006 |
++ return snd_ctl_enum_info(uinfo, 1, 2, texts); |
20007 |
++ } else if (reg == SND_BBFPRO_CTL_REG2 && |
20008 |
++ (idx == SND_BBFPRO_CTL_REG2_SENS_IN3 || |
20009 |
++ idx == SND_BBFPRO_CTL_REG2_SENS_IN4)) { |
20010 |
++ static const char * const texts[2] = { |
20011 |
++ "-10dBV", |
20012 |
++ "+4dBu" |
20013 |
++ }; |
20014 |
++ return snd_ctl_enum_info(uinfo, 1, 2, texts); |
20015 |
++ } |
20016 |
++ |
20017 |
++ uinfo->count = 1; |
20018 |
++ uinfo->value.integer.min = 0; |
20019 |
++ uinfo->value.integer.max = 1; |
20020 |
++ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
20021 |
++ return 0; |
20022 |
++} |
20023 |
++ |
20024 |
++static int snd_bbfpro_ctl_put(struct snd_kcontrol *kcontrol, |
20025 |
++ struct snd_ctl_elem_value *ucontrol) |
20026 |
++{ |
20027 |
++ int err; |
20028 |
++ u8 reg, idx; |
20029 |
++ int old_value, pv, val; |
20030 |
++ |
20031 |
++ struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
20032 |
++ struct usb_mixer_interface *mixer = list->mixer; |
20033 |
++ |
20034 |
++ pv = kcontrol->private_value; |
20035 |
++ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
20036 |
++ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
20037 |
++ old_value = (pv >> SND_BBFPRO_CTL_VAL_SHIFT) & SND_BBFPRO_CTL_VAL_MASK; |
20038 |
++ |
20039 |
++ if ((reg == SND_BBFPRO_CTL_REG1 && |
20040 |
++ idx == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) || |
20041 |
++ (reg == SND_BBFPRO_CTL_REG2 && |
20042 |
++ (idx == SND_BBFPRO_CTL_REG2_SENS_IN3 || |
20043 |
++ idx == SND_BBFPRO_CTL_REG2_SENS_IN4))) { |
20044 |
++ val = ucontrol->value.enumerated.item[0]; |
20045 |
++ } else { |
20046 |
++ val = ucontrol->value.integer.value[0]; |
20047 |
++ } |
20048 |
++ |
20049 |
++ if (val > 1) |
20050 |
++ return -EINVAL; |
20051 |
++ |
20052 |
++ if (val == old_value) |
20053 |
++ return 0; |
20054 |
++ |
20055 |
++ kcontrol->private_value = reg |
20056 |
++ | ((idx & SND_BBFPRO_CTL_IDX_MASK) << SND_BBFPRO_CTL_IDX_SHIFT) |
20057 |
++ | ((val & SND_BBFPRO_CTL_VAL_MASK) << SND_BBFPRO_CTL_VAL_SHIFT); |
20058 |
++ |
20059 |
++ err = snd_bbfpro_ctl_update(mixer, reg, idx, val); |
20060 |
++ return err < 0 ? err : 1; |
20061 |
++} |
20062 |
++ |
20063 |
++static int snd_bbfpro_ctl_resume(struct usb_mixer_elem_list *list) |
20064 |
++{ |
20065 |
++ u8 reg, idx; |
20066 |
++ int value, pv; |
20067 |
++ |
20068 |
++ pv = list->kctl->private_value; |
20069 |
++ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
20070 |
++ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
20071 |
++ value = (pv >> SND_BBFPRO_CTL_VAL_SHIFT) & SND_BBFPRO_CTL_VAL_MASK; |
20072 |
++ |
20073 |
++ return snd_bbfpro_ctl_update(list->mixer, reg, idx, value); |
20074 |
++} |
20075 |
++ |
20076 |
++static int snd_bbfpro_vol_update(struct usb_mixer_interface *mixer, u16 index, |
20077 |
++ u32 value) |
20078 |
++{ |
20079 |
++ struct snd_usb_audio *chip = mixer->chip; |
20080 |
++ int err; |
20081 |
++ u16 idx; |
20082 |
++ u16 usb_idx, usb_val; |
20083 |
++ u32 v; |
20084 |
++ |
20085 |
++ err = snd_usb_lock_shutdown(chip); |
20086 |
++ if (err < 0) |
20087 |
++ return err; |
20088 |
++ |
20089 |
++ idx = index & SND_BBFPRO_MIXER_IDX_MASK; |
20090 |
++ // 18 bit linear volume, split so 2 bits end up in index. |
20091 |
++ v = value & SND_BBFPRO_MIXER_VAL_MASK; |
20092 |
++ usb_idx = idx | (v & 0x3) << 14; |
20093 |
++ usb_val = (v >> 2) & 0xffff; |
20094 |
++ |
20095 |
++ err = snd_usb_ctl_msg(chip->dev, |
20096 |
++ usb_sndctrlpipe(chip->dev, 0), |
20097 |
++ SND_BBFPRO_USBREQ_MIXER, |
20098 |
++ USB_DIR_OUT | USB_TYPE_VENDOR | |
20099 |
++ USB_RECIP_DEVICE, |
20100 |
++ usb_val, usb_idx, 0, 0); |
20101 |
++ |
20102 |
++ snd_usb_unlock_shutdown(chip); |
20103 |
++ return err; |
20104 |
++} |
20105 |
++ |
20106 |
++static int snd_bbfpro_vol_get(struct snd_kcontrol *kcontrol, |
20107 |
++ struct snd_ctl_elem_value *ucontrol) |
20108 |
++{ |
20109 |
++ ucontrol->value.integer.value[0] = |
20110 |
++ kcontrol->private_value >> SND_BBFPRO_MIXER_VAL_SHIFT; |
20111 |
++ return 0; |
20112 |
++} |
20113 |
++ |
20114 |
++static int snd_bbfpro_vol_info(struct snd_kcontrol *kcontrol, |
20115 |
++ struct snd_ctl_elem_info *uinfo) |
20116 |
++{ |
20117 |
++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
20118 |
++ uinfo->count = 1; |
20119 |
++ uinfo->value.integer.min = SND_BBFPRO_MIXER_VAL_MIN; |
20120 |
++ uinfo->value.integer.max = SND_BBFPRO_MIXER_VAL_MAX; |
20121 |
++ return 0; |
20122 |
++} |
20123 |
++ |
20124 |
++static int snd_bbfpro_vol_put(struct snd_kcontrol *kcontrol, |
20125 |
++ struct snd_ctl_elem_value *ucontrol) |
20126 |
++{ |
20127 |
++ int err; |
20128 |
++ u16 idx; |
20129 |
++ u32 new_val, old_value, uvalue; |
20130 |
++ struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
20131 |
++ struct usb_mixer_interface *mixer = list->mixer; |
20132 |
++ |
20133 |
++ uvalue = ucontrol->value.integer.value[0]; |
20134 |
++ idx = kcontrol->private_value & SND_BBFPRO_MIXER_IDX_MASK; |
20135 |
++ old_value = kcontrol->private_value >> SND_BBFPRO_MIXER_VAL_SHIFT; |
20136 |
++ |
20137 |
++ if (uvalue > SND_BBFPRO_MIXER_VAL_MAX) |
20138 |
++ return -EINVAL; |
20139 |
++ |
20140 |
++ if (uvalue == old_value) |
20141 |
++ return 0; |
20142 |
++ |
20143 |
++ new_val = uvalue & SND_BBFPRO_MIXER_VAL_MASK; |
20144 |
++ |
20145 |
++ kcontrol->private_value = idx |
20146 |
++ | (new_val << SND_BBFPRO_MIXER_VAL_SHIFT); |
20147 |
++ |
20148 |
++ err = snd_bbfpro_vol_update(mixer, idx, new_val); |
20149 |
++ return err < 0 ? err : 1; |
20150 |
++} |
20151 |
++ |
20152 |
++static int snd_bbfpro_vol_resume(struct usb_mixer_elem_list *list) |
20153 |
++{ |
20154 |
++ int pv = list->kctl->private_value; |
20155 |
++ u16 idx = pv & SND_BBFPRO_MIXER_IDX_MASK; |
20156 |
++ u32 val = (pv >> SND_BBFPRO_MIXER_VAL_SHIFT) |
20157 |
++ & SND_BBFPRO_MIXER_VAL_MASK; |
20158 |
++ return snd_bbfpro_vol_update(list->mixer, idx, val); |
20159 |
++} |
20160 |
++ |
20161 |
++// Predfine elements |
20162 |
++static const struct snd_kcontrol_new snd_bbfpro_ctl_control = { |
20163 |
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
20164 |
++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, |
20165 |
++ .index = 0, |
20166 |
++ .info = snd_bbfpro_ctl_info, |
20167 |
++ .get = snd_bbfpro_ctl_get, |
20168 |
++ .put = snd_bbfpro_ctl_put |
20169 |
++}; |
20170 |
++ |
20171 |
++static const struct snd_kcontrol_new snd_bbfpro_vol_control = { |
20172 |
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
20173 |
++ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, |
20174 |
++ .index = 0, |
20175 |
++ .info = snd_bbfpro_vol_info, |
20176 |
++ .get = snd_bbfpro_vol_get, |
20177 |
++ .put = snd_bbfpro_vol_put |
20178 |
++}; |
20179 |
++ |
20180 |
++static int snd_bbfpro_ctl_add(struct usb_mixer_interface *mixer, u8 reg, |
20181 |
++ u8 index, char *name) |
20182 |
++{ |
20183 |
++ struct snd_kcontrol_new knew = snd_bbfpro_ctl_control; |
20184 |
++ |
20185 |
++ knew.name = name; |
20186 |
++ knew.private_value = (reg & SND_BBFPRO_CTL_REG_MASK) |
20187 |
++ | ((index & SND_BBFPRO_CTL_IDX_MASK) |
20188 |
++ << SND_BBFPRO_CTL_IDX_SHIFT); |
20189 |
++ |
20190 |
++ return add_single_ctl_with_resume(mixer, 0, snd_bbfpro_ctl_resume, |
20191 |
++ &knew, NULL); |
20192 |
++} |
20193 |
++ |
20194 |
++static int snd_bbfpro_vol_add(struct usb_mixer_interface *mixer, u16 index, |
20195 |
++ char *name) |
20196 |
++{ |
20197 |
++ struct snd_kcontrol_new knew = snd_bbfpro_vol_control; |
20198 |
++ |
20199 |
++ knew.name = name; |
20200 |
++ knew.private_value = index & SND_BBFPRO_MIXER_IDX_MASK; |
20201 |
++ |
20202 |
++ return add_single_ctl_with_resume(mixer, 0, snd_bbfpro_vol_resume, |
20203 |
++ &knew, NULL); |
20204 |
++} |
20205 |
++ |
20206 |
++static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer) |
20207 |
++{ |
20208 |
++ int err, i, o; |
20209 |
++ char name[48]; |
20210 |
++ |
20211 |
++ static const char * const input[] = { |
20212 |
++ "AN1", "AN2", "IN3", "IN4", "AS1", "AS2", "ADAT3", |
20213 |
++ "ADAT4", "ADAT5", "ADAT6", "ADAT7", "ADAT8"}; |
20214 |
++ |
20215 |
++ static const char * const output[] = { |
20216 |
++ "AN1", "AN2", "PH3", "PH4", "AS1", "AS2", "ADAT3", "ADAT4", |
20217 |
++ "ADAT5", "ADAT6", "ADAT7", "ADAT8"}; |
20218 |
++ |
20219 |
++ for (o = 0 ; o < 12 ; ++o) { |
20220 |
++ for (i = 0 ; i < 12 ; ++i) { |
20221 |
++ // Line routing |
20222 |
++ snprintf(name, sizeof(name), |
20223 |
++ "%s-%s-%s Playback Volume", |
20224 |
++ (i < 2 ? "Mic" : "Line"), |
20225 |
++ input[i], output[o]); |
20226 |
++ err = snd_bbfpro_vol_add(mixer, (26 * o + i), name); |
20227 |
++ if (err < 0) |
20228 |
++ return err; |
20229 |
++ |
20230 |
++ // PCM routing... yes, it is output remapping |
20231 |
++ snprintf(name, sizeof(name), |
20232 |
++ "PCM-%s-%s Playback Volume", |
20233 |
++ output[i], output[o]); |
20234 |
++ err = snd_bbfpro_vol_add(mixer, (26 * o + 12 + i), |
20235 |
++ name); |
20236 |
++ if (err < 0) |
20237 |
++ return err; |
20238 |
++ } |
20239 |
++ } |
20240 |
++ |
20241 |
++ // Control Reg 1 |
20242 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20243 |
++ SND_BBFPRO_CTL_REG1_CLK_OPTICAL, |
20244 |
++ "Sample Clock Source"); |
20245 |
++ if (err < 0) |
20246 |
++ return err; |
20247 |
++ |
20248 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20249 |
++ SND_BBFPRO_CTL_REG1_SPDIF_PRO, |
20250 |
++ "IEC958 Pro Mask"); |
20251 |
++ if (err < 0) |
20252 |
++ return err; |
20253 |
++ |
20254 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20255 |
++ SND_BBFPRO_CTL_REG1_SPDIF_EMPH, |
20256 |
++ "IEC958 Emphasis"); |
20257 |
++ if (err < 0) |
20258 |
++ return err; |
20259 |
++ |
20260 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20261 |
++ SND_BBFPRO_CTL_REG1_SPDIF_OPTICAL, |
20262 |
++ "IEC958 Switch"); |
20263 |
++ if (err < 0) |
20264 |
++ return err; |
20265 |
++ |
20266 |
++ // Control Reg 2 |
20267 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20268 |
++ SND_BBFPRO_CTL_REG2_48V_AN1, |
20269 |
++ "Mic-AN1 48V"); |
20270 |
++ if (err < 0) |
20271 |
++ return err; |
20272 |
++ |
20273 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20274 |
++ SND_BBFPRO_CTL_REG2_48V_AN2, |
20275 |
++ "Mic-AN2 48V"); |
20276 |
++ if (err < 0) |
20277 |
++ return err; |
20278 |
++ |
20279 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20280 |
++ SND_BBFPRO_CTL_REG2_SENS_IN3, |
20281 |
++ "Line-IN3 Sens."); |
20282 |
++ if (err < 0) |
20283 |
++ return err; |
20284 |
++ |
20285 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20286 |
++ SND_BBFPRO_CTL_REG2_SENS_IN4, |
20287 |
++ "Line-IN4 Sens."); |
20288 |
++ if (err < 0) |
20289 |
++ return err; |
20290 |
++ |
20291 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20292 |
++ SND_BBFPRO_CTL_REG2_PAD_AN1, |
20293 |
++ "Mic-AN1 PAD"); |
20294 |
++ if (err < 0) |
20295 |
++ return err; |
20296 |
++ |
20297 |
++ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20298 |
++ SND_BBFPRO_CTL_REG2_PAD_AN2, |
20299 |
++ "Mic-AN2 PAD"); |
20300 |
++ if (err < 0) |
20301 |
++ return err; |
20302 |
++ |
20303 |
++ return 0; |
20304 |
++} |
20305 |
++ |
20306 |
+ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
20307 |
+ { |
20308 |
+ int err = 0; |
20309 |
+@@ -2286,6 +2701,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
20310 |
+ case USB_ID(0x0194f, 0x010c): /* Presonus Studio 1810c */ |
20311 |
+ err = snd_sc1810_init_mixer(mixer); |
20312 |
+ break; |
20313 |
++ case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */ |
20314 |
++ err = snd_bbfpro_controls_create(mixer); |
20315 |
++ break; |
20316 |
+ } |
20317 |
+ |
20318 |
+ return err; |
20319 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
20320 |
+index a4e4064f9aee..d61c2f1095b5 100644 |
20321 |
+--- a/sound/usb/pcm.c |
20322 |
++++ b/sound/usb/pcm.c |
20323 |
+@@ -404,6 +404,8 @@ add_sync_ep: |
20324 |
+ if (!subs->sync_endpoint) |
20325 |
+ return -EINVAL; |
20326 |
+ |
20327 |
++ subs->sync_endpoint->is_implicit_feedback = 1; |
20328 |
++ |
20329 |
+ subs->data_endpoint->sync_master = subs->sync_endpoint; |
20330 |
+ |
20331 |
+ return 1; |
20332 |
+@@ -502,12 +504,15 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, |
20333 |
+ implicit_fb ? |
20334 |
+ SND_USB_ENDPOINT_TYPE_DATA : |
20335 |
+ SND_USB_ENDPOINT_TYPE_SYNC); |
20336 |
++ |
20337 |
+ if (!subs->sync_endpoint) { |
20338 |
+ if (is_playback && attr == USB_ENDPOINT_SYNC_NONE) |
20339 |
+ return 0; |
20340 |
+ return -EINVAL; |
20341 |
+ } |
20342 |
+ |
20343 |
++ subs->sync_endpoint->is_implicit_feedback = implicit_fb; |
20344 |
++ |
20345 |
+ subs->data_endpoint->sync_master = subs->sync_endpoint; |
20346 |
+ |
20347 |
+ return 0; |
20348 |
+@@ -1579,6 +1584,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, |
20349 |
+ for (i = 0; i < ctx->packets; i++) { |
20350 |
+ if (ctx->packet_size[i]) |
20351 |
+ counts = ctx->packet_size[i]; |
20352 |
++ else if (ep->sync_master) |
20353 |
++ counts = snd_usb_endpoint_slave_next_packet_size(ep); |
20354 |
+ else |
20355 |
+ counts = snd_usb_endpoint_next_packet_size(ep); |
20356 |
+ |
20357 |
+diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c |
20358 |
+index 0efaf45f7367..e0878f5f74b1 100644 |
20359 |
+--- a/tools/bootconfig/main.c |
20360 |
++++ b/tools/bootconfig/main.c |
20361 |
+@@ -14,13 +14,18 @@ |
20362 |
+ #include <linux/kernel.h> |
20363 |
+ #include <linux/bootconfig.h> |
20364 |
+ |
20365 |
+-static int xbc_show_array(struct xbc_node *node) |
20366 |
++static int xbc_show_value(struct xbc_node *node) |
20367 |
+ { |
20368 |
+ const char *val; |
20369 |
++ char q; |
20370 |
+ int i = 0; |
20371 |
+ |
20372 |
+ xbc_array_for_each_value(node, val) { |
20373 |
+- printf("\"%s\"%s", val, node->next ? ", " : ";\n"); |
20374 |
++ if (strchr(val, '"')) |
20375 |
++ q = '\''; |
20376 |
++ else |
20377 |
++ q = '"'; |
20378 |
++ printf("%c%s%c%s", q, val, q, node->next ? ", " : ";\n"); |
20379 |
+ i++; |
20380 |
+ } |
20381 |
+ return i; |
20382 |
+@@ -48,10 +53,7 @@ static void xbc_show_compact_tree(void) |
20383 |
+ continue; |
20384 |
+ } else if (cnode && xbc_node_is_value(cnode)) { |
20385 |
+ printf("%s = ", xbc_node_get_data(node)); |
20386 |
+- if (cnode->next) |
20387 |
+- xbc_show_array(cnode); |
20388 |
+- else |
20389 |
+- printf("\"%s\";\n", xbc_node_get_data(cnode)); |
20390 |
++ xbc_show_value(cnode); |
20391 |
+ } else { |
20392 |
+ printf("%s;\n", xbc_node_get_data(node)); |
20393 |
+ } |
20394 |
+@@ -205,11 +207,13 @@ int show_xbc(const char *path) |
20395 |
+ } |
20396 |
+ |
20397 |
+ ret = load_xbc_from_initrd(fd, &buf); |
20398 |
+- if (ret < 0) |
20399 |
++ if (ret < 0) { |
20400 |
+ pr_err("Failed to load a boot config from initrd: %d\n", ret); |
20401 |
+- else |
20402 |
+- xbc_show_compact_tree(); |
20403 |
+- |
20404 |
++ goto out; |
20405 |
++ } |
20406 |
++ xbc_show_compact_tree(); |
20407 |
++ ret = 0; |
20408 |
++out: |
20409 |
+ close(fd); |
20410 |
+ free(buf); |
20411 |
+ |
20412 |
+diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c |
20413 |
+index f8113b3646f5..f5960b48c861 100644 |
20414 |
+--- a/tools/bpf/bpftool/gen.c |
20415 |
++++ b/tools/bpf/bpftool/gen.c |
20416 |
+@@ -225,6 +225,7 @@ static int codegen(const char *template, ...) |
20417 |
+ } else { |
20418 |
+ p_err("unrecognized character at pos %td in template '%s'", |
20419 |
+ src - template - 1, template); |
20420 |
++ free(s); |
20421 |
+ return -EINVAL; |
20422 |
+ } |
20423 |
+ } |
20424 |
+@@ -235,6 +236,7 @@ static int codegen(const char *template, ...) |
20425 |
+ if (*src != '\t') { |
20426 |
+ p_err("not enough tabs at pos %td in template '%s'", |
20427 |
+ src - template - 1, template); |
20428 |
++ free(s); |
20429 |
+ return -EINVAL; |
20430 |
+ } |
20431 |
+ } |
20432 |
+diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c |
20433 |
+index 0c28ee82834b..653dbbe2e366 100644 |
20434 |
+--- a/tools/lib/bpf/btf_dump.c |
20435 |
++++ b/tools/lib/bpf/btf_dump.c |
20436 |
+@@ -1137,6 +1137,20 @@ static void btf_dump_emit_mods(struct btf_dump *d, struct id_stack *decl_stack) |
20437 |
+ } |
20438 |
+ } |
20439 |
+ |
20440 |
++static void btf_dump_drop_mods(struct btf_dump *d, struct id_stack *decl_stack) |
20441 |
++{ |
20442 |
++ const struct btf_type *t; |
20443 |
++ __u32 id; |
20444 |
++ |
20445 |
++ while (decl_stack->cnt) { |
20446 |
++ id = decl_stack->ids[decl_stack->cnt - 1]; |
20447 |
++ t = btf__type_by_id(d->btf, id); |
20448 |
++ if (!btf_is_mod(t)) |
20449 |
++ return; |
20450 |
++ decl_stack->cnt--; |
20451 |
++ } |
20452 |
++} |
20453 |
++ |
20454 |
+ static void btf_dump_emit_name(const struct btf_dump *d, |
20455 |
+ const char *name, bool last_was_ptr) |
20456 |
+ { |
20457 |
+@@ -1235,14 +1249,7 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, |
20458 |
+ * a const/volatile modifier for array, so we are |
20459 |
+ * going to silently skip them here. |
20460 |
+ */ |
20461 |
+- while (decls->cnt) { |
20462 |
+- next_id = decls->ids[decls->cnt - 1]; |
20463 |
+- next_t = btf__type_by_id(d->btf, next_id); |
20464 |
+- if (btf_is_mod(next_t)) |
20465 |
+- decls->cnt--; |
20466 |
+- else |
20467 |
+- break; |
20468 |
+- } |
20469 |
++ btf_dump_drop_mods(d, decls); |
20470 |
+ |
20471 |
+ if (decls->cnt == 0) { |
20472 |
+ btf_dump_emit_name(d, fname, last_was_ptr); |
20473 |
+@@ -1270,7 +1277,15 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, |
20474 |
+ __u16 vlen = btf_vlen(t); |
20475 |
+ int i; |
20476 |
+ |
20477 |
+- btf_dump_emit_mods(d, decls); |
20478 |
++ /* |
20479 |
++ * GCC emits extra volatile qualifier for |
20480 |
++ * __attribute__((noreturn)) function pointers. Clang |
20481 |
++ * doesn't do it. It's a GCC quirk for backwards |
20482 |
++ * compatibility with code written for GCC <2.5. So, |
20483 |
++ * similarly to extra qualifiers for array, just drop |
20484 |
++ * them, instead of handling them. |
20485 |
++ */ |
20486 |
++ btf_dump_drop_mods(d, decls); |
20487 |
+ if (decls->cnt) { |
20488 |
+ btf_dump_printf(d, " ("); |
20489 |
+ btf_dump_emit_type_chain(d, decls, fname, lvl); |
20490 |
+diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c |
20491 |
+index 0c5b4fb553fb..c417cff2cdaf 100644 |
20492 |
+--- a/tools/lib/bpf/libbpf.c |
20493 |
++++ b/tools/lib/bpf/libbpf.c |
20494 |
+@@ -3455,10 +3455,6 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) |
20495 |
+ char *cp, errmsg[STRERR_BUFSIZE]; |
20496 |
+ int err, zero = 0; |
20497 |
+ |
20498 |
+- /* kernel already zero-initializes .bss map. */ |
20499 |
+- if (map_type == LIBBPF_MAP_BSS) |
20500 |
+- return 0; |
20501 |
+- |
20502 |
+ err = bpf_map_update_elem(map->fd, &zero, map->mmaped, 0); |
20503 |
+ if (err) { |
20504 |
+ err = -errno; |
20505 |
+diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c |
20506 |
+index 26d8fc27e427..fc7855262162 100644 |
20507 |
+--- a/tools/perf/builtin-report.c |
20508 |
++++ b/tools/perf/builtin-report.c |
20509 |
+@@ -476,8 +476,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report |
20510 |
+ if (rep->time_str) |
20511 |
+ ret += fprintf(fp, " (time slices: %s)", rep->time_str); |
20512 |
+ |
20513 |
+- if (symbol_conf.show_ref_callgraph && |
20514 |
+- strstr(evname, "call-graph=no")) { |
20515 |
++ if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) { |
20516 |
+ ret += fprintf(fp, ", show reference callgraph"); |
20517 |
+ } |
20518 |
+ |
20519 |
+diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y |
20520 |
+index 94f8bcd83582..9a41247c602b 100644 |
20521 |
+--- a/tools/perf/util/parse-events.y |
20522 |
++++ b/tools/perf/util/parse-events.y |
20523 |
+@@ -348,7 +348,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc |
20524 |
+ struct list_head *list; |
20525 |
+ char pmu_name[128]; |
20526 |
+ |
20527 |
+- snprintf(&pmu_name, 128, "%s-%s", $1, $3); |
20528 |
++ snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3); |
20529 |
+ free($1); |
20530 |
+ free($3); |
20531 |
+ if (parse_events_multi_pmu_add(_parse_state, pmu_name, &list) < 0) |
20532 |
+diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c |
20533 |
+index a08f373d3305..df713a5d1e26 100644 |
20534 |
+--- a/tools/perf/util/probe-event.c |
20535 |
++++ b/tools/perf/util/probe-event.c |
20536 |
+@@ -1575,7 +1575,7 @@ static int parse_perf_probe_arg(char *str, struct perf_probe_arg *arg) |
20537 |
+ } |
20538 |
+ |
20539 |
+ tmp = strchr(str, '@'); |
20540 |
+- if (tmp && tmp != str && strcmp(tmp + 1, "user")) { /* user attr */ |
20541 |
++ if (tmp && tmp != str && !strcmp(tmp + 1, "user")) { /* user attr */ |
20542 |
+ if (!user_access_is_supported()) { |
20543 |
+ semantic_error("ftrace does not support user access\n"); |
20544 |
+ return -EINVAL; |
20545 |
+@@ -1995,7 +1995,10 @@ static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref, |
20546 |
+ if (depth < 0) |
20547 |
+ return depth; |
20548 |
+ } |
20549 |
+- err = strbuf_addf(buf, "%+ld(", ref->offset); |
20550 |
++ if (ref->user_access) |
20551 |
++ err = strbuf_addf(buf, "%s%ld(", "+u", ref->offset); |
20552 |
++ else |
20553 |
++ err = strbuf_addf(buf, "%+ld(", ref->offset); |
20554 |
+ return (err < 0) ? err : depth; |
20555 |
+ } |
20556 |
+ |
20557 |
+diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c |
20558 |
+index 8c852948513e..064b63a6a3f3 100644 |
20559 |
+--- a/tools/perf/util/probe-file.c |
20560 |
++++ b/tools/perf/util/probe-file.c |
20561 |
+@@ -1044,7 +1044,7 @@ static struct { |
20562 |
+ DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"), |
20563 |
+ DEFINE_TYPE(FTRACE_README_KRETPROBE_OFFSET, "*place (kretprobe): *"), |
20564 |
+ DEFINE_TYPE(FTRACE_README_UPROBE_REF_CTR, "*ref_ctr_offset*"), |
20565 |
+- DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*[u]<offset>*"), |
20566 |
++ DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*u]<offset>*"), |
20567 |
+ DEFINE_TYPE(FTRACE_README_MULTIPROBE_EVENT, "*Create/append/*"), |
20568 |
+ DEFINE_TYPE(FTRACE_README_IMMEDIATE_VALUE, "*\\imm-value,*"), |
20569 |
+ }; |
20570 |
+diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c |
20571 |
+index 9e757d18d713..cf393c3eea23 100644 |
20572 |
+--- a/tools/perf/util/stat-display.c |
20573 |
++++ b/tools/perf/util/stat-display.c |
20574 |
+@@ -671,7 +671,7 @@ static void print_aggr(struct perf_stat_config *config, |
20575 |
+ int s; |
20576 |
+ bool first; |
20577 |
+ |
20578 |
+- if (!(config->aggr_map || config->aggr_get_id)) |
20579 |
++ if (!config->aggr_map || !config->aggr_get_id) |
20580 |
+ return; |
20581 |
+ |
20582 |
+ aggr_update_shadow(config, evlist); |
20583 |
+@@ -1172,7 +1172,7 @@ static void print_percore(struct perf_stat_config *config, |
20584 |
+ int s; |
20585 |
+ bool first = true; |
20586 |
+ |
20587 |
+- if (!(config->aggr_map || config->aggr_get_id)) |
20588 |
++ if (!config->aggr_map || !config->aggr_get_id) |
20589 |
+ return; |
20590 |
+ |
20591 |
+ if (config->percore_show_thread) |
20592 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/skeleton.c b/tools/testing/selftests/bpf/prog_tests/skeleton.c |
20593 |
+index 9264a2736018..fa153cf67b1b 100644 |
20594 |
+--- a/tools/testing/selftests/bpf/prog_tests/skeleton.c |
20595 |
++++ b/tools/testing/selftests/bpf/prog_tests/skeleton.c |
20596 |
+@@ -15,6 +15,8 @@ void test_skeleton(void) |
20597 |
+ int duration = 0, err; |
20598 |
+ struct test_skeleton* skel; |
20599 |
+ struct test_skeleton__bss *bss; |
20600 |
++ struct test_skeleton__data *data; |
20601 |
++ struct test_skeleton__rodata *rodata; |
20602 |
+ struct test_skeleton__kconfig *kcfg; |
20603 |
+ |
20604 |
+ skel = test_skeleton__open(); |
20605 |
+@@ -24,13 +26,45 @@ void test_skeleton(void) |
20606 |
+ if (CHECK(skel->kconfig, "skel_kconfig", "kconfig is mmaped()!\n")) |
20607 |
+ goto cleanup; |
20608 |
+ |
20609 |
++ bss = skel->bss; |
20610 |
++ data = skel->data; |
20611 |
++ rodata = skel->rodata; |
20612 |
++ |
20613 |
++ /* validate values are pre-initialized correctly */ |
20614 |
++ CHECK(data->in1 != -1, "in1", "got %d != exp %d\n", data->in1, -1); |
20615 |
++ CHECK(data->out1 != -1, "out1", "got %d != exp %d\n", data->out1, -1); |
20616 |
++ CHECK(data->in2 != -1, "in2", "got %lld != exp %lld\n", data->in2, -1LL); |
20617 |
++ CHECK(data->out2 != -1, "out2", "got %lld != exp %lld\n", data->out2, -1LL); |
20618 |
++ |
20619 |
++ CHECK(bss->in3 != 0, "in3", "got %d != exp %d\n", bss->in3, 0); |
20620 |
++ CHECK(bss->out3 != 0, "out3", "got %d != exp %d\n", bss->out3, 0); |
20621 |
++ CHECK(bss->in4 != 0, "in4", "got %lld != exp %lld\n", bss->in4, 0LL); |
20622 |
++ CHECK(bss->out4 != 0, "out4", "got %lld != exp %lld\n", bss->out4, 0LL); |
20623 |
++ |
20624 |
++ CHECK(rodata->in6 != 0, "in6", "got %d != exp %d\n", rodata->in6, 0); |
20625 |
++ CHECK(bss->out6 != 0, "out6", "got %d != exp %d\n", bss->out6, 0); |
20626 |
++ |
20627 |
++ /* validate we can pre-setup global variables, even in .bss */ |
20628 |
++ data->in1 = 10; |
20629 |
++ data->in2 = 11; |
20630 |
++ bss->in3 = 12; |
20631 |
++ bss->in4 = 13; |
20632 |
++ rodata->in6 = 14; |
20633 |
++ |
20634 |
+ err = test_skeleton__load(skel); |
20635 |
+ if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err)) |
20636 |
+ goto cleanup; |
20637 |
+ |
20638 |
+- bss = skel->bss; |
20639 |
+- bss->in1 = 1; |
20640 |
+- bss->in2 = 2; |
20641 |
++ /* validate pre-setup values are still there */ |
20642 |
++ CHECK(data->in1 != 10, "in1", "got %d != exp %d\n", data->in1, 10); |
20643 |
++ CHECK(data->in2 != 11, "in2", "got %lld != exp %lld\n", data->in2, 11LL); |
20644 |
++ CHECK(bss->in3 != 12, "in3", "got %d != exp %d\n", bss->in3, 12); |
20645 |
++ CHECK(bss->in4 != 13, "in4", "got %lld != exp %lld\n", bss->in4, 13LL); |
20646 |
++ CHECK(rodata->in6 != 14, "in6", "got %d != exp %d\n", rodata->in6, 14); |
20647 |
++ |
20648 |
++ /* now set new values and attach to get them into outX variables */ |
20649 |
++ data->in1 = 1; |
20650 |
++ data->in2 = 2; |
20651 |
+ bss->in3 = 3; |
20652 |
+ bss->in4 = 4; |
20653 |
+ bss->in5.a = 5; |
20654 |
+@@ -44,14 +78,15 @@ void test_skeleton(void) |
20655 |
+ /* trigger tracepoint */ |
20656 |
+ usleep(1); |
20657 |
+ |
20658 |
+- CHECK(bss->out1 != 1, "res1", "got %d != exp %d\n", bss->out1, 1); |
20659 |
+- CHECK(bss->out2 != 2, "res2", "got %lld != exp %d\n", bss->out2, 2); |
20660 |
++ CHECK(data->out1 != 1, "res1", "got %d != exp %d\n", data->out1, 1); |
20661 |
++ CHECK(data->out2 != 2, "res2", "got %lld != exp %d\n", data->out2, 2); |
20662 |
+ CHECK(bss->out3 != 3, "res3", "got %d != exp %d\n", (int)bss->out3, 3); |
20663 |
+ CHECK(bss->out4 != 4, "res4", "got %lld != exp %d\n", bss->out4, 4); |
20664 |
+ CHECK(bss->handler_out5.a != 5, "res5", "got %d != exp %d\n", |
20665 |
+ bss->handler_out5.a, 5); |
20666 |
+ CHECK(bss->handler_out5.b != 6, "res6", "got %lld != exp %d\n", |
20667 |
+ bss->handler_out5.b, 6); |
20668 |
++ CHECK(bss->out6 != 14, "res7", "got %d != exp %d\n", bss->out6, 14); |
20669 |
+ |
20670 |
+ CHECK(bss->bpf_syscall != kcfg->CONFIG_BPF_SYSCALL, "ext1", |
20671 |
+ "got %d != exp %d\n", bss->bpf_syscall, kcfg->CONFIG_BPF_SYSCALL); |
20672 |
+diff --git a/tools/testing/selftests/bpf/progs/test_skeleton.c b/tools/testing/selftests/bpf/progs/test_skeleton.c |
20673 |
+index de03a90f78ca..77ae86f44db5 100644 |
20674 |
+--- a/tools/testing/selftests/bpf/progs/test_skeleton.c |
20675 |
++++ b/tools/testing/selftests/bpf/progs/test_skeleton.c |
20676 |
+@@ -10,16 +10,26 @@ struct s { |
20677 |
+ long long b; |
20678 |
+ } __attribute__((packed)); |
20679 |
+ |
20680 |
+-int in1 = 0; |
20681 |
+-long long in2 = 0; |
20682 |
++/* .data section */ |
20683 |
++int in1 = -1; |
20684 |
++long long in2 = -1; |
20685 |
++ |
20686 |
++/* .bss section */ |
20687 |
+ char in3 = '\0'; |
20688 |
+ long long in4 __attribute__((aligned(64))) = 0; |
20689 |
+ struct s in5 = {}; |
20690 |
+ |
20691 |
+-long long out2 = 0; |
20692 |
++/* .rodata section */ |
20693 |
++const volatile int in6 = 0; |
20694 |
++ |
20695 |
++/* .data section */ |
20696 |
++int out1 = -1; |
20697 |
++long long out2 = -1; |
20698 |
++ |
20699 |
++/* .bss section */ |
20700 |
+ char out3 = 0; |
20701 |
+ long long out4 = 0; |
20702 |
+-int out1 = 0; |
20703 |
++int out6 = 0; |
20704 |
+ |
20705 |
+ extern bool CONFIG_BPF_SYSCALL __kconfig; |
20706 |
+ extern int LINUX_KERNEL_VERSION __kconfig; |
20707 |
+@@ -36,6 +46,7 @@ int handler(const void *ctx) |
20708 |
+ out3 = in3; |
20709 |
+ out4 = in4; |
20710 |
+ out5 = in5; |
20711 |
++ out6 = in6; |
20712 |
+ |
20713 |
+ bpf_syscall = CONFIG_BPF_SYSCALL; |
20714 |
+ kern_ver = LINUX_KERNEL_VERSION; |
20715 |
+diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile |
20716 |
+index 42f4f49f2a48..2c85b9dd86f5 100644 |
20717 |
+--- a/tools/testing/selftests/kvm/Makefile |
20718 |
++++ b/tools/testing/selftests/kvm/Makefile |
20719 |
+@@ -80,7 +80,11 @@ LIBKVM += $(LIBKVM_$(UNAME_M)) |
20720 |
+ INSTALL_HDR_PATH = $(top_srcdir)/usr |
20721 |
+ LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ |
20722 |
+ LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include |
20723 |
++ifeq ($(ARCH),x86_64) |
20724 |
++LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include |
20725 |
++else |
20726 |
+ LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include |
20727 |
++endif |
20728 |
+ CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ |
20729 |
+ -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ |
20730 |
+ -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ |
20731 |
+diff --git a/tools/testing/selftests/net/timestamping.c b/tools/testing/selftests/net/timestamping.c |
20732 |
+index aca3491174a1..f4bb4fef0f39 100644 |
20733 |
+--- a/tools/testing/selftests/net/timestamping.c |
20734 |
++++ b/tools/testing/selftests/net/timestamping.c |
20735 |
+@@ -313,10 +313,16 @@ int main(int argc, char **argv) |
20736 |
+ int val; |
20737 |
+ socklen_t len; |
20738 |
+ struct timeval next; |
20739 |
++ size_t if_len; |
20740 |
+ |
20741 |
+ if (argc < 2) |
20742 |
+ usage(0); |
20743 |
+ interface = argv[1]; |
20744 |
++ if_len = strlen(interface); |
20745 |
++ if (if_len >= IFNAMSIZ) { |
20746 |
++ printf("interface name exceeds IFNAMSIZ\n"); |
20747 |
++ exit(1); |
20748 |
++ } |
20749 |
+ |
20750 |
+ for (i = 2; i < argc; i++) { |
20751 |
+ if (!strcasecmp(argv[i], "SO_TIMESTAMP")) |
20752 |
+@@ -350,12 +356,12 @@ int main(int argc, char **argv) |
20753 |
+ bail("socket"); |
20754 |
+ |
20755 |
+ memset(&device, 0, sizeof(device)); |
20756 |
+- strncpy(device.ifr_name, interface, sizeof(device.ifr_name)); |
20757 |
++ memcpy(device.ifr_name, interface, if_len + 1); |
20758 |
+ if (ioctl(sock, SIOCGIFADDR, &device) < 0) |
20759 |
+ bail("getting interface IP address"); |
20760 |
+ |
20761 |
+ memset(&hwtstamp, 0, sizeof(hwtstamp)); |
20762 |
+- strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name)); |
20763 |
++ memcpy(hwtstamp.ifr_name, interface, if_len + 1); |
20764 |
+ hwtstamp.ifr_data = (void *)&hwconfig; |
20765 |
+ memset(&hwconfig, 0, sizeof(hwconfig)); |
20766 |
+ hwconfig.tx_type = |
20767 |
+diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh |
20768 |
+index 9c60337317c6..020137b61407 100755 |
20769 |
+--- a/tools/testing/selftests/ntb/ntb_test.sh |
20770 |
++++ b/tools/testing/selftests/ntb/ntb_test.sh |
20771 |
+@@ -241,7 +241,7 @@ function get_files_count() |
20772 |
+ split_remote $LOC |
20773 |
+ |
20774 |
+ if [[ "$REMOTE" == "" ]]; then |
20775 |
+- echo $(ls -1 "$LOC"/${NAME}* 2>/dev/null | wc -l) |
20776 |
++ echo $(ls -1 "$VPATH"/${NAME}* 2>/dev/null | wc -l) |
20777 |
+ else |
20778 |
+ echo $(ssh "$REMOTE" "ls -1 \"$VPATH\"/${NAME}* | \ |
20779 |
+ wc -l" 2> /dev/null) |
20780 |
+diff --git a/tools/testing/selftests/timens/clock_nanosleep.c b/tools/testing/selftests/timens/clock_nanosleep.c |
20781 |
+index 8e7b7c72ef65..72d41b955fb2 100644 |
20782 |
+--- a/tools/testing/selftests/timens/clock_nanosleep.c |
20783 |
++++ b/tools/testing/selftests/timens/clock_nanosleep.c |
20784 |
+@@ -119,7 +119,7 @@ int main(int argc, char *argv[]) |
20785 |
+ |
20786 |
+ ksft_set_plan(4); |
20787 |
+ |
20788 |
+- check_config_posix_timers(); |
20789 |
++ check_supported_timers(); |
20790 |
+ |
20791 |
+ if (unshare_timens()) |
20792 |
+ return 1; |
20793 |
+diff --git a/tools/testing/selftests/timens/timens.c b/tools/testing/selftests/timens/timens.c |
20794 |
+index 098be7c83be3..52b6a1185f52 100644 |
20795 |
+--- a/tools/testing/selftests/timens/timens.c |
20796 |
++++ b/tools/testing/selftests/timens/timens.c |
20797 |
+@@ -155,7 +155,7 @@ int main(int argc, char *argv[]) |
20798 |
+ |
20799 |
+ nscheck(); |
20800 |
+ |
20801 |
+- check_config_posix_timers(); |
20802 |
++ check_supported_timers(); |
20803 |
+ |
20804 |
+ ksft_set_plan(ARRAY_SIZE(clocks) * 2); |
20805 |
+ |
20806 |
+diff --git a/tools/testing/selftests/timens/timens.h b/tools/testing/selftests/timens/timens.h |
20807 |
+index e09e7e39bc52..d4fc52d47146 100644 |
20808 |
+--- a/tools/testing/selftests/timens/timens.h |
20809 |
++++ b/tools/testing/selftests/timens/timens.h |
20810 |
+@@ -14,15 +14,26 @@ |
20811 |
+ #endif |
20812 |
+ |
20813 |
+ static int config_posix_timers = true; |
20814 |
++static int config_alarm_timers = true; |
20815 |
+ |
20816 |
+-static inline void check_config_posix_timers(void) |
20817 |
++static inline void check_supported_timers(void) |
20818 |
+ { |
20819 |
++ struct timespec ts; |
20820 |
++ |
20821 |
+ if (timer_create(-1, 0, 0) == -1 && errno == ENOSYS) |
20822 |
+ config_posix_timers = false; |
20823 |
++ |
20824 |
++ if (clock_gettime(CLOCK_BOOTTIME_ALARM, &ts) == -1 && errno == EINVAL) |
20825 |
++ config_alarm_timers = false; |
20826 |
+ } |
20827 |
+ |
20828 |
+ static inline bool check_skip(int clockid) |
20829 |
+ { |
20830 |
++ if (!config_alarm_timers && clockid == CLOCK_BOOTTIME_ALARM) { |
20831 |
++ ksft_test_result_skip("CLOCK_BOOTTIME_ALARM isn't supported\n"); |
20832 |
++ return true; |
20833 |
++ } |
20834 |
++ |
20835 |
+ if (config_posix_timers) |
20836 |
+ return false; |
20837 |
+ |
20838 |
+diff --git a/tools/testing/selftests/timens/timer.c b/tools/testing/selftests/timens/timer.c |
20839 |
+index 96dba11ebe44..5e7f0051bd7b 100644 |
20840 |
+--- a/tools/testing/selftests/timens/timer.c |
20841 |
++++ b/tools/testing/selftests/timens/timer.c |
20842 |
+@@ -22,6 +22,9 @@ int run_test(int clockid, struct timespec now) |
20843 |
+ timer_t fd; |
20844 |
+ int i; |
20845 |
+ |
20846 |
++ if (check_skip(clockid)) |
20847 |
++ return 0; |
20848 |
++ |
20849 |
+ for (i = 0; i < 2; i++) { |
20850 |
+ struct sigevent sevp = {.sigev_notify = SIGEV_NONE}; |
20851 |
+ int flags = 0; |
20852 |
+@@ -74,6 +77,8 @@ int main(int argc, char *argv[]) |
20853 |
+ |
20854 |
+ nscheck(); |
20855 |
+ |
20856 |
++ check_supported_timers(); |
20857 |
++ |
20858 |
+ ksft_set_plan(3); |
20859 |
+ |
20860 |
+ clock_gettime(CLOCK_MONOTONIC, &mtime_now); |
20861 |
+diff --git a/tools/testing/selftests/timens/timerfd.c b/tools/testing/selftests/timens/timerfd.c |
20862 |
+index eff1ec5ff215..9edd43d6b2c1 100644 |
20863 |
+--- a/tools/testing/selftests/timens/timerfd.c |
20864 |
++++ b/tools/testing/selftests/timens/timerfd.c |
20865 |
+@@ -28,6 +28,9 @@ int run_test(int clockid, struct timespec now) |
20866 |
+ long long elapsed; |
20867 |
+ int fd, i; |
20868 |
+ |
20869 |
++ if (check_skip(clockid)) |
20870 |
++ return 0; |
20871 |
++ |
20872 |
+ if (tclock_gettime(clockid, &now)) |
20873 |
+ return pr_perror("clock_gettime(%d)", clockid); |
20874 |
+ |
20875 |
+@@ -81,6 +84,8 @@ int main(int argc, char *argv[]) |
20876 |
+ |
20877 |
+ nscheck(); |
20878 |
+ |
20879 |
++ check_supported_timers(); |
20880 |
++ |
20881 |
+ ksft_set_plan(3); |
20882 |
+ |
20883 |
+ clock_gettime(CLOCK_MONOTONIC, &mtime_now); |
20884 |
+diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c |
20885 |
+index 480995bceefa..47191af46617 100644 |
20886 |
+--- a/tools/testing/selftests/x86/protection_keys.c |
20887 |
++++ b/tools/testing/selftests/x86/protection_keys.c |
20888 |
+@@ -24,6 +24,7 @@ |
20889 |
+ #define _GNU_SOURCE |
20890 |
+ #include <errno.h> |
20891 |
+ #include <linux/futex.h> |
20892 |
++#include <time.h> |
20893 |
+ #include <sys/time.h> |
20894 |
+ #include <sys/syscall.h> |
20895 |
+ #include <string.h> |
20896 |
+@@ -612,10 +613,10 @@ int alloc_random_pkey(void) |
20897 |
+ int nr_alloced = 0; |
20898 |
+ int random_index; |
20899 |
+ memset(alloced_pkeys, 0, sizeof(alloced_pkeys)); |
20900 |
++ srand((unsigned int)time(NULL)); |
20901 |
+ |
20902 |
+ /* allocate every possible key and make a note of which ones we got */ |
20903 |
+ max_nr_pkey_allocs = NR_PKEYS; |
20904 |
+- max_nr_pkey_allocs = 1; |
20905 |
+ for (i = 0; i < max_nr_pkey_allocs; i++) { |
20906 |
+ int new_pkey = alloc_pkey(); |
20907 |
+ if (new_pkey < 0) |