Contents of /trunk/kernel-alx/patches-5.4/0148-5.4.49-all-fixes.patch
Parent Directory | Revision Log
Revision 3529 -
(show annotations)
(download)
Thu Jun 25 11:15:00 2020 UTC (4 years, 3 months ago) by niro
File size: 389391 byte(s)
Thu Jun 25 11:15:00 2020 UTC (4 years, 3 months ago) by niro
File size: 389391 byte(s)
-linux-5.4.49
1 | diff --git a/Makefile b/Makefile |
2 | index fee4101b5d22..72230ad23299 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 48 |
10 | +SUBLEVEL = 49 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi |
15 | index de981d629bdd..fdd267819319 100644 |
16 | --- a/arch/arm/boot/dts/r8a7743.dtsi |
17 | +++ b/arch/arm/boot/dts/r8a7743.dtsi |
18 | @@ -338,7 +338,7 @@ |
19 | #thermal-sensor-cells = <0>; |
20 | }; |
21 | |
22 | - ipmmu_sy0: mmu@e6280000 { |
23 | + ipmmu_sy0: iommu@e6280000 { |
24 | compatible = "renesas,ipmmu-r8a7743", |
25 | "renesas,ipmmu-vmsa"; |
26 | reg = <0 0xe6280000 0 0x1000>; |
27 | @@ -348,7 +348,7 @@ |
28 | status = "disabled"; |
29 | }; |
30 | |
31 | - ipmmu_sy1: mmu@e6290000 { |
32 | + ipmmu_sy1: iommu@e6290000 { |
33 | compatible = "renesas,ipmmu-r8a7743", |
34 | "renesas,ipmmu-vmsa"; |
35 | reg = <0 0xe6290000 0 0x1000>; |
36 | @@ -357,7 +357,7 @@ |
37 | status = "disabled"; |
38 | }; |
39 | |
40 | - ipmmu_ds: mmu@e6740000 { |
41 | + ipmmu_ds: iommu@e6740000 { |
42 | compatible = "renesas,ipmmu-r8a7743", |
43 | "renesas,ipmmu-vmsa"; |
44 | reg = <0 0xe6740000 0 0x1000>; |
45 | @@ -367,7 +367,7 @@ |
46 | status = "disabled"; |
47 | }; |
48 | |
49 | - ipmmu_mp: mmu@ec680000 { |
50 | + ipmmu_mp: iommu@ec680000 { |
51 | compatible = "renesas,ipmmu-r8a7743", |
52 | "renesas,ipmmu-vmsa"; |
53 | reg = <0 0xec680000 0 0x1000>; |
54 | @@ -376,7 +376,7 @@ |
55 | status = "disabled"; |
56 | }; |
57 | |
58 | - ipmmu_mx: mmu@fe951000 { |
59 | + ipmmu_mx: iommu@fe951000 { |
60 | compatible = "renesas,ipmmu-r8a7743", |
61 | "renesas,ipmmu-vmsa"; |
62 | reg = <0 0xfe951000 0 0x1000>; |
63 | @@ -386,7 +386,7 @@ |
64 | status = "disabled"; |
65 | }; |
66 | |
67 | - ipmmu_gp: mmu@e62a0000 { |
68 | + ipmmu_gp: iommu@e62a0000 { |
69 | compatible = "renesas,ipmmu-r8a7743", |
70 | "renesas,ipmmu-vmsa"; |
71 | reg = <0 0xe62a0000 0 0x1000>; |
72 | diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi |
73 | index fa74a262107b..8264481bf876 100644 |
74 | --- a/arch/arm/boot/dts/r8a7744.dtsi |
75 | +++ b/arch/arm/boot/dts/r8a7744.dtsi |
76 | @@ -338,7 +338,7 @@ |
77 | #thermal-sensor-cells = <0>; |
78 | }; |
79 | |
80 | - ipmmu_sy0: mmu@e6280000 { |
81 | + ipmmu_sy0: iommu@e6280000 { |
82 | compatible = "renesas,ipmmu-r8a7744", |
83 | "renesas,ipmmu-vmsa"; |
84 | reg = <0 0xe6280000 0 0x1000>; |
85 | @@ -348,7 +348,7 @@ |
86 | status = "disabled"; |
87 | }; |
88 | |
89 | - ipmmu_sy1: mmu@e6290000 { |
90 | + ipmmu_sy1: iommu@e6290000 { |
91 | compatible = "renesas,ipmmu-r8a7744", |
92 | "renesas,ipmmu-vmsa"; |
93 | reg = <0 0xe6290000 0 0x1000>; |
94 | @@ -357,7 +357,7 @@ |
95 | status = "disabled"; |
96 | }; |
97 | |
98 | - ipmmu_ds: mmu@e6740000 { |
99 | + ipmmu_ds: iommu@e6740000 { |
100 | compatible = "renesas,ipmmu-r8a7744", |
101 | "renesas,ipmmu-vmsa"; |
102 | reg = <0 0xe6740000 0 0x1000>; |
103 | @@ -367,7 +367,7 @@ |
104 | status = "disabled"; |
105 | }; |
106 | |
107 | - ipmmu_mp: mmu@ec680000 { |
108 | + ipmmu_mp: iommu@ec680000 { |
109 | compatible = "renesas,ipmmu-r8a7744", |
110 | "renesas,ipmmu-vmsa"; |
111 | reg = <0 0xec680000 0 0x1000>; |
112 | @@ -376,7 +376,7 @@ |
113 | status = "disabled"; |
114 | }; |
115 | |
116 | - ipmmu_mx: mmu@fe951000 { |
117 | + ipmmu_mx: iommu@fe951000 { |
118 | compatible = "renesas,ipmmu-r8a7744", |
119 | "renesas,ipmmu-vmsa"; |
120 | reg = <0 0xfe951000 0 0x1000>; |
121 | @@ -386,7 +386,7 @@ |
122 | status = "disabled"; |
123 | }; |
124 | |
125 | - ipmmu_gp: mmu@e62a0000 { |
126 | + ipmmu_gp: iommu@e62a0000 { |
127 | compatible = "renesas,ipmmu-r8a7744", |
128 | "renesas,ipmmu-vmsa"; |
129 | reg = <0 0xe62a0000 0 0x1000>; |
130 | diff --git a/arch/arm/boot/dts/r8a7745.dtsi b/arch/arm/boot/dts/r8a7745.dtsi |
131 | index c53f7ff20695..c306713f2ab7 100644 |
132 | --- a/arch/arm/boot/dts/r8a7745.dtsi |
133 | +++ b/arch/arm/boot/dts/r8a7745.dtsi |
134 | @@ -302,7 +302,7 @@ |
135 | resets = <&cpg 407>; |
136 | }; |
137 | |
138 | - ipmmu_sy0: mmu@e6280000 { |
139 | + ipmmu_sy0: iommu@e6280000 { |
140 | compatible = "renesas,ipmmu-r8a7745", |
141 | "renesas,ipmmu-vmsa"; |
142 | reg = <0 0xe6280000 0 0x1000>; |
143 | @@ -312,7 +312,7 @@ |
144 | status = "disabled"; |
145 | }; |
146 | |
147 | - ipmmu_sy1: mmu@e6290000 { |
148 | + ipmmu_sy1: iommu@e6290000 { |
149 | compatible = "renesas,ipmmu-r8a7745", |
150 | "renesas,ipmmu-vmsa"; |
151 | reg = <0 0xe6290000 0 0x1000>; |
152 | @@ -321,7 +321,7 @@ |
153 | status = "disabled"; |
154 | }; |
155 | |
156 | - ipmmu_ds: mmu@e6740000 { |
157 | + ipmmu_ds: iommu@e6740000 { |
158 | compatible = "renesas,ipmmu-r8a7745", |
159 | "renesas,ipmmu-vmsa"; |
160 | reg = <0 0xe6740000 0 0x1000>; |
161 | @@ -331,7 +331,7 @@ |
162 | status = "disabled"; |
163 | }; |
164 | |
165 | - ipmmu_mp: mmu@ec680000 { |
166 | + ipmmu_mp: iommu@ec680000 { |
167 | compatible = "renesas,ipmmu-r8a7745", |
168 | "renesas,ipmmu-vmsa"; |
169 | reg = <0 0xec680000 0 0x1000>; |
170 | @@ -340,7 +340,7 @@ |
171 | status = "disabled"; |
172 | }; |
173 | |
174 | - ipmmu_mx: mmu@fe951000 { |
175 | + ipmmu_mx: iommu@fe951000 { |
176 | compatible = "renesas,ipmmu-r8a7745", |
177 | "renesas,ipmmu-vmsa"; |
178 | reg = <0 0xfe951000 0 0x1000>; |
179 | @@ -350,7 +350,7 @@ |
180 | status = "disabled"; |
181 | }; |
182 | |
183 | - ipmmu_gp: mmu@e62a0000 { |
184 | + ipmmu_gp: iommu@e62a0000 { |
185 | compatible = "renesas,ipmmu-r8a7745", |
186 | "renesas,ipmmu-vmsa"; |
187 | reg = <0 0xe62a0000 0 0x1000>; |
188 | diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi |
189 | index 5a2747758f67..e3ba00a22eeb 100644 |
190 | --- a/arch/arm/boot/dts/r8a7790.dtsi |
191 | +++ b/arch/arm/boot/dts/r8a7790.dtsi |
192 | @@ -427,7 +427,7 @@ |
193 | #thermal-sensor-cells = <0>; |
194 | }; |
195 | |
196 | - ipmmu_sy0: mmu@e6280000 { |
197 | + ipmmu_sy0: iommu@e6280000 { |
198 | compatible = "renesas,ipmmu-r8a7790", |
199 | "renesas,ipmmu-vmsa"; |
200 | reg = <0 0xe6280000 0 0x1000>; |
201 | @@ -437,7 +437,7 @@ |
202 | status = "disabled"; |
203 | }; |
204 | |
205 | - ipmmu_sy1: mmu@e6290000 { |
206 | + ipmmu_sy1: iommu@e6290000 { |
207 | compatible = "renesas,ipmmu-r8a7790", |
208 | "renesas,ipmmu-vmsa"; |
209 | reg = <0 0xe6290000 0 0x1000>; |
210 | @@ -446,7 +446,7 @@ |
211 | status = "disabled"; |
212 | }; |
213 | |
214 | - ipmmu_ds: mmu@e6740000 { |
215 | + ipmmu_ds: iommu@e6740000 { |
216 | compatible = "renesas,ipmmu-r8a7790", |
217 | "renesas,ipmmu-vmsa"; |
218 | reg = <0 0xe6740000 0 0x1000>; |
219 | @@ -456,7 +456,7 @@ |
220 | status = "disabled"; |
221 | }; |
222 | |
223 | - ipmmu_mp: mmu@ec680000 { |
224 | + ipmmu_mp: iommu@ec680000 { |
225 | compatible = "renesas,ipmmu-r8a7790", |
226 | "renesas,ipmmu-vmsa"; |
227 | reg = <0 0xec680000 0 0x1000>; |
228 | @@ -465,7 +465,7 @@ |
229 | status = "disabled"; |
230 | }; |
231 | |
232 | - ipmmu_mx: mmu@fe951000 { |
233 | + ipmmu_mx: iommu@fe951000 { |
234 | compatible = "renesas,ipmmu-r8a7790", |
235 | "renesas,ipmmu-vmsa"; |
236 | reg = <0 0xfe951000 0 0x1000>; |
237 | @@ -475,7 +475,7 @@ |
238 | status = "disabled"; |
239 | }; |
240 | |
241 | - ipmmu_rt: mmu@ffc80000 { |
242 | + ipmmu_rt: iommu@ffc80000 { |
243 | compatible = "renesas,ipmmu-r8a7790", |
244 | "renesas,ipmmu-vmsa"; |
245 | reg = <0 0xffc80000 0 0x1000>; |
246 | diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi |
247 | index 6f875502453c..a26f86ccc579 100644 |
248 | --- a/arch/arm/boot/dts/r8a7791.dtsi |
249 | +++ b/arch/arm/boot/dts/r8a7791.dtsi |
250 | @@ -350,7 +350,7 @@ |
251 | #thermal-sensor-cells = <0>; |
252 | }; |
253 | |
254 | - ipmmu_sy0: mmu@e6280000 { |
255 | + ipmmu_sy0: iommu@e6280000 { |
256 | compatible = "renesas,ipmmu-r8a7791", |
257 | "renesas,ipmmu-vmsa"; |
258 | reg = <0 0xe6280000 0 0x1000>; |
259 | @@ -360,7 +360,7 @@ |
260 | status = "disabled"; |
261 | }; |
262 | |
263 | - ipmmu_sy1: mmu@e6290000 { |
264 | + ipmmu_sy1: iommu@e6290000 { |
265 | compatible = "renesas,ipmmu-r8a7791", |
266 | "renesas,ipmmu-vmsa"; |
267 | reg = <0 0xe6290000 0 0x1000>; |
268 | @@ -369,7 +369,7 @@ |
269 | status = "disabled"; |
270 | }; |
271 | |
272 | - ipmmu_ds: mmu@e6740000 { |
273 | + ipmmu_ds: iommu@e6740000 { |
274 | compatible = "renesas,ipmmu-r8a7791", |
275 | "renesas,ipmmu-vmsa"; |
276 | reg = <0 0xe6740000 0 0x1000>; |
277 | @@ -379,7 +379,7 @@ |
278 | status = "disabled"; |
279 | }; |
280 | |
281 | - ipmmu_mp: mmu@ec680000 { |
282 | + ipmmu_mp: iommu@ec680000 { |
283 | compatible = "renesas,ipmmu-r8a7791", |
284 | "renesas,ipmmu-vmsa"; |
285 | reg = <0 0xec680000 0 0x1000>; |
286 | @@ -388,7 +388,7 @@ |
287 | status = "disabled"; |
288 | }; |
289 | |
290 | - ipmmu_mx: mmu@fe951000 { |
291 | + ipmmu_mx: iommu@fe951000 { |
292 | compatible = "renesas,ipmmu-r8a7791", |
293 | "renesas,ipmmu-vmsa"; |
294 | reg = <0 0xfe951000 0 0x1000>; |
295 | @@ -398,7 +398,7 @@ |
296 | status = "disabled"; |
297 | }; |
298 | |
299 | - ipmmu_rt: mmu@ffc80000 { |
300 | + ipmmu_rt: iommu@ffc80000 { |
301 | compatible = "renesas,ipmmu-r8a7791", |
302 | "renesas,ipmmu-vmsa"; |
303 | reg = <0 0xffc80000 0 0x1000>; |
304 | @@ -407,7 +407,7 @@ |
305 | status = "disabled"; |
306 | }; |
307 | |
308 | - ipmmu_gp: mmu@e62a0000 { |
309 | + ipmmu_gp: iommu@e62a0000 { |
310 | compatible = "renesas,ipmmu-r8a7791", |
311 | "renesas,ipmmu-vmsa"; |
312 | reg = <0 0xe62a0000 0 0x1000>; |
313 | diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi |
314 | index bf05110fac4e..fa3839795018 100644 |
315 | --- a/arch/arm/boot/dts/r8a7793.dtsi |
316 | +++ b/arch/arm/boot/dts/r8a7793.dtsi |
317 | @@ -336,7 +336,7 @@ |
318 | #thermal-sensor-cells = <0>; |
319 | }; |
320 | |
321 | - ipmmu_sy0: mmu@e6280000 { |
322 | + ipmmu_sy0: iommu@e6280000 { |
323 | compatible = "renesas,ipmmu-r8a7793", |
324 | "renesas,ipmmu-vmsa"; |
325 | reg = <0 0xe6280000 0 0x1000>; |
326 | @@ -346,7 +346,7 @@ |
327 | status = "disabled"; |
328 | }; |
329 | |
330 | - ipmmu_sy1: mmu@e6290000 { |
331 | + ipmmu_sy1: iommu@e6290000 { |
332 | compatible = "renesas,ipmmu-r8a7793", |
333 | "renesas,ipmmu-vmsa"; |
334 | reg = <0 0xe6290000 0 0x1000>; |
335 | @@ -355,7 +355,7 @@ |
336 | status = "disabled"; |
337 | }; |
338 | |
339 | - ipmmu_ds: mmu@e6740000 { |
340 | + ipmmu_ds: iommu@e6740000 { |
341 | compatible = "renesas,ipmmu-r8a7793", |
342 | "renesas,ipmmu-vmsa"; |
343 | reg = <0 0xe6740000 0 0x1000>; |
344 | @@ -365,7 +365,7 @@ |
345 | status = "disabled"; |
346 | }; |
347 | |
348 | - ipmmu_mp: mmu@ec680000 { |
349 | + ipmmu_mp: iommu@ec680000 { |
350 | compatible = "renesas,ipmmu-r8a7793", |
351 | "renesas,ipmmu-vmsa"; |
352 | reg = <0 0xec680000 0 0x1000>; |
353 | @@ -374,7 +374,7 @@ |
354 | status = "disabled"; |
355 | }; |
356 | |
357 | - ipmmu_mx: mmu@fe951000 { |
358 | + ipmmu_mx: iommu@fe951000 { |
359 | compatible = "renesas,ipmmu-r8a7793", |
360 | "renesas,ipmmu-vmsa"; |
361 | reg = <0 0xfe951000 0 0x1000>; |
362 | @@ -384,7 +384,7 @@ |
363 | status = "disabled"; |
364 | }; |
365 | |
366 | - ipmmu_rt: mmu@ffc80000 { |
367 | + ipmmu_rt: iommu@ffc80000 { |
368 | compatible = "renesas,ipmmu-r8a7793", |
369 | "renesas,ipmmu-vmsa"; |
370 | reg = <0 0xffc80000 0 0x1000>; |
371 | @@ -393,7 +393,7 @@ |
372 | status = "disabled"; |
373 | }; |
374 | |
375 | - ipmmu_gp: mmu@e62a0000 { |
376 | + ipmmu_gp: iommu@e62a0000 { |
377 | compatible = "renesas,ipmmu-r8a7793", |
378 | "renesas,ipmmu-vmsa"; |
379 | reg = <0 0xe62a0000 0 0x1000>; |
380 | diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi |
381 | index 8d797d34816e..9dd952479e68 100644 |
382 | --- a/arch/arm/boot/dts/r8a7794.dtsi |
383 | +++ b/arch/arm/boot/dts/r8a7794.dtsi |
384 | @@ -290,7 +290,7 @@ |
385 | resets = <&cpg 407>; |
386 | }; |
387 | |
388 | - ipmmu_sy0: mmu@e6280000 { |
389 | + ipmmu_sy0: iommu@e6280000 { |
390 | compatible = "renesas,ipmmu-r8a7794", |
391 | "renesas,ipmmu-vmsa"; |
392 | reg = <0 0xe6280000 0 0x1000>; |
393 | @@ -300,7 +300,7 @@ |
394 | status = "disabled"; |
395 | }; |
396 | |
397 | - ipmmu_sy1: mmu@e6290000 { |
398 | + ipmmu_sy1: iommu@e6290000 { |
399 | compatible = "renesas,ipmmu-r8a7794", |
400 | "renesas,ipmmu-vmsa"; |
401 | reg = <0 0xe6290000 0 0x1000>; |
402 | @@ -309,7 +309,7 @@ |
403 | status = "disabled"; |
404 | }; |
405 | |
406 | - ipmmu_ds: mmu@e6740000 { |
407 | + ipmmu_ds: iommu@e6740000 { |
408 | compatible = "renesas,ipmmu-r8a7794", |
409 | "renesas,ipmmu-vmsa"; |
410 | reg = <0 0xe6740000 0 0x1000>; |
411 | @@ -319,7 +319,7 @@ |
412 | status = "disabled"; |
413 | }; |
414 | |
415 | - ipmmu_mp: mmu@ec680000 { |
416 | + ipmmu_mp: iommu@ec680000 { |
417 | compatible = "renesas,ipmmu-r8a7794", |
418 | "renesas,ipmmu-vmsa"; |
419 | reg = <0 0xec680000 0 0x1000>; |
420 | @@ -328,7 +328,7 @@ |
421 | status = "disabled"; |
422 | }; |
423 | |
424 | - ipmmu_mx: mmu@fe951000 { |
425 | + ipmmu_mx: iommu@fe951000 { |
426 | compatible = "renesas,ipmmu-r8a7794", |
427 | "renesas,ipmmu-vmsa"; |
428 | reg = <0 0xfe951000 0 0x1000>; |
429 | @@ -338,7 +338,7 @@ |
430 | status = "disabled"; |
431 | }; |
432 | |
433 | - ipmmu_gp: mmu@e62a0000 { |
434 | + ipmmu_gp: iommu@e62a0000 { |
435 | compatible = "renesas,ipmmu-r8a7794", |
436 | "renesas,ipmmu-vmsa"; |
437 | reg = <0 0xe62a0000 0 0x1000>; |
438 | diff --git a/arch/arm/boot/dts/stm32mp157a-avenger96.dts b/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
439 | index 2e4742c53d04..7b8c3f25861c 100644 |
440 | --- a/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
441 | +++ b/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
442 | @@ -91,6 +91,9 @@ |
443 | #address-cells = <1>; |
444 | #size-cells = <0>; |
445 | compatible = "snps,dwmac-mdio"; |
446 | + reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>; |
447 | + reset-delay-us = <1000>; |
448 | + |
449 | phy0: ethernet-phy@7 { |
450 | reg = <7>; |
451 | }; |
452 | 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 |
453 | index d277d043031b..4c6704e4c57e 100644 |
454 | --- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
455 | +++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
456 | @@ -31,7 +31,7 @@ |
457 | |
458 | pwr_led { |
459 | label = "bananapi-m2-zero:red:pwr"; |
460 | - gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */ |
461 | + gpios = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ |
462 | default-state = "on"; |
463 | }; |
464 | }; |
465 | diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
466 | index dfae90adbb7c..ce64bfb22f22 100644 |
467 | --- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
468 | +++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
469 | @@ -31,7 +31,7 @@ |
470 | #interrupt-cells = <1>; |
471 | ranges; |
472 | |
473 | - nor_flash: flash@0,00000000 { |
474 | + nor_flash: flash@0 { |
475 | compatible = "arm,vexpress-flash", "cfi-flash"; |
476 | reg = <0 0x00000000 0x04000000>, |
477 | <4 0x00000000 0x04000000>; |
478 | @@ -41,13 +41,13 @@ |
479 | }; |
480 | }; |
481 | |
482 | - psram@1,00000000 { |
483 | + psram@100000000 { |
484 | compatible = "arm,vexpress-psram", "mtd-ram"; |
485 | reg = <1 0x00000000 0x02000000>; |
486 | bank-width = <4>; |
487 | }; |
488 | |
489 | - ethernet@2,02000000 { |
490 | + ethernet@202000000 { |
491 | compatible = "smsc,lan9118", "smsc,lan9115"; |
492 | reg = <2 0x02000000 0x10000>; |
493 | interrupts = <15>; |
494 | @@ -59,14 +59,14 @@ |
495 | vddvario-supply = <&v2m_fixed_3v3>; |
496 | }; |
497 | |
498 | - usb@2,03000000 { |
499 | + usb@203000000 { |
500 | compatible = "nxp,usb-isp1761"; |
501 | reg = <2 0x03000000 0x20000>; |
502 | interrupts = <16>; |
503 | port1-otg; |
504 | }; |
505 | |
506 | - iofpga@3,00000000 { |
507 | + iofpga@300000000 { |
508 | compatible = "simple-bus"; |
509 | #address-cells = <1>; |
510 | #size-cells = <1>; |
511 | diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig |
512 | index 982eabc36163..2406cab73835 100644 |
513 | --- a/arch/arm/mach-integrator/Kconfig |
514 | +++ b/arch/arm/mach-integrator/Kconfig |
515 | @@ -4,6 +4,8 @@ menuconfig ARCH_INTEGRATOR |
516 | depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 |
517 | select ARM_AMBA |
518 | select COMMON_CLK_VERSATILE |
519 | + select CMA |
520 | + select DMA_CMA |
521 | select HAVE_TCM |
522 | select ICST |
523 | select MFD_SYSCON |
524 | @@ -35,14 +37,13 @@ config INTEGRATOR_IMPD1 |
525 | select ARM_VIC |
526 | select GPIO_PL061 |
527 | select GPIOLIB |
528 | + select REGULATOR |
529 | + select REGULATOR_FIXED_VOLTAGE |
530 | help |
531 | The IM-PD1 is an add-on logic module for the Integrator which |
532 | allows ARM(R) Ltd PrimeCells to be developed and evaluated. |
533 | The IM-PD1 can be found on the Integrator/PP2 platform. |
534 | |
535 | - To compile this driver as a module, choose M here: the |
536 | - module will be called impd1. |
537 | - |
538 | config INTEGRATOR_CM7TDMI |
539 | bool "Integrator/CM7TDMI core module" |
540 | depends on ARCH_INTEGRATOR_AP |
541 | diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
542 | index bb4a2acb9970..502c4ac45c29 100644 |
543 | --- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
544 | +++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
545 | @@ -1728,18 +1728,18 @@ |
546 | }; |
547 | |
548 | sram: sram@fffc0000 { |
549 | - compatible = "amlogic,meson-axg-sram", "mmio-sram"; |
550 | + compatible = "mmio-sram"; |
551 | reg = <0x0 0xfffc0000 0x0 0x20000>; |
552 | #address-cells = <1>; |
553 | #size-cells = <1>; |
554 | ranges = <0 0x0 0xfffc0000 0x20000>; |
555 | |
556 | - cpu_scp_lpri: scp-shmem@13000 { |
557 | + cpu_scp_lpri: scp-sram@13000 { |
558 | compatible = "amlogic,meson-axg-scp-shmem"; |
559 | reg = <0x13000 0x400>; |
560 | }; |
561 | |
562 | - cpu_scp_hpri: scp-shmem@13400 { |
563 | + cpu_scp_hpri: scp-sram@13400 { |
564 | compatible = "amlogic,meson-axg-scp-shmem"; |
565 | reg = <0x13400 0x400>; |
566 | }; |
567 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
568 | index 6733050d735f..ce230d6ac35c 100644 |
569 | --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
570 | +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
571 | @@ -345,20 +345,20 @@ |
572 | }; |
573 | |
574 | sram: sram@c8000000 { |
575 | - compatible = "amlogic,meson-gx-sram", "amlogic,meson-gxbb-sram", "mmio-sram"; |
576 | + compatible = "mmio-sram"; |
577 | reg = <0x0 0xc8000000 0x0 0x14000>; |
578 | |
579 | #address-cells = <1>; |
580 | #size-cells = <1>; |
581 | ranges = <0 0x0 0xc8000000 0x14000>; |
582 | |
583 | - cpu_scp_lpri: scp-shmem@0 { |
584 | - compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem"; |
585 | + cpu_scp_lpri: scp-sram@0 { |
586 | + compatible = "amlogic,meson-gxbb-scp-shmem"; |
587 | reg = <0x13000 0x400>; |
588 | }; |
589 | |
590 | - cpu_scp_hpri: scp-shmem@200 { |
591 | - compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem"; |
592 | + cpu_scp_hpri: scp-sram@200 { |
593 | + compatible = "amlogic,meson-gxbb-scp-shmem"; |
594 | reg = <0x13400 0x400>; |
595 | }; |
596 | }; |
597 | diff --git a/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi b/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
598 | index 15fe81738e94..dfb23dfc0b0f 100644 |
599 | --- a/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
600 | +++ b/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
601 | @@ -8,7 +8,7 @@ |
602 | gic: interrupt-controller@2c001000 { |
603 | compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; |
604 | #interrupt-cells = <3>; |
605 | - #address-cells = <2>; |
606 | + #address-cells = <1>; |
607 | interrupt-controller; |
608 | reg = <0x0 0x2c001000 0 0x1000>, |
609 | <0x0 0x2c002000 0 0x2000>, |
610 | diff --git a/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi b/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
611 | index f2c75c756039..906f51935b36 100644 |
612 | --- a/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
613 | +++ b/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
614 | @@ -8,9 +8,9 @@ |
615 | gic: interrupt-controller@2f000000 { |
616 | compatible = "arm,gic-v3"; |
617 | #interrupt-cells = <3>; |
618 | - #address-cells = <2>; |
619 | - #size-cells = <2>; |
620 | - ranges; |
621 | + #address-cells = <1>; |
622 | + #size-cells = <1>; |
623 | + ranges = <0x0 0x0 0x2f000000 0x100000>; |
624 | interrupt-controller; |
625 | reg = <0x0 0x2f000000 0x0 0x10000>, |
626 | <0x0 0x2f100000 0x0 0x200000>, |
627 | @@ -22,7 +22,7 @@ |
628 | its: its@2f020000 { |
629 | compatible = "arm,gic-v3-its"; |
630 | msi-controller; |
631 | - reg = <0x0 0x2f020000 0x0 0x20000>; |
632 | + reg = <0x20000 0x20000>; |
633 | }; |
634 | }; |
635 | }; |
636 | diff --git a/arch/arm64/boot/dts/arm/foundation-v8.dtsi b/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
637 | index 3f78373f708a..05d1657170b4 100644 |
638 | --- a/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
639 | +++ b/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
640 | @@ -107,51 +107,51 @@ |
641 | |
642 | #interrupt-cells = <1>; |
643 | interrupt-map-mask = <0 0 63>; |
644 | - interrupt-map = <0 0 0 &gic 0 0 GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, |
645 | - <0 0 1 &gic 0 0 GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, |
646 | - <0 0 2 &gic 0 0 GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, |
647 | - <0 0 3 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, |
648 | - <0 0 4 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, |
649 | - <0 0 5 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, |
650 | - <0 0 6 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, |
651 | - <0 0 7 &gic 0 0 GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, |
652 | - <0 0 8 &gic 0 0 GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, |
653 | - <0 0 9 &gic 0 0 GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
654 | - <0 0 10 &gic 0 0 GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, |
655 | - <0 0 11 &gic 0 0 GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
656 | - <0 0 12 &gic 0 0 GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, |
657 | - <0 0 13 &gic 0 0 GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, |
658 | - <0 0 14 &gic 0 0 GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
659 | - <0 0 15 &gic 0 0 GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, |
660 | - <0 0 16 &gic 0 0 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, |
661 | - <0 0 17 &gic 0 0 GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
662 | - <0 0 18 &gic 0 0 GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, |
663 | - <0 0 19 &gic 0 0 GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, |
664 | - <0 0 20 &gic 0 0 GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, |
665 | - <0 0 21 &gic 0 0 GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, |
666 | - <0 0 22 &gic 0 0 GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, |
667 | - <0 0 23 &gic 0 0 GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, |
668 | - <0 0 24 &gic 0 0 GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, |
669 | - <0 0 25 &gic 0 0 GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, |
670 | - <0 0 26 &gic 0 0 GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, |
671 | - <0 0 27 &gic 0 0 GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, |
672 | - <0 0 28 &gic 0 0 GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, |
673 | - <0 0 29 &gic 0 0 GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, |
674 | - <0 0 30 &gic 0 0 GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, |
675 | - <0 0 31 &gic 0 0 GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, |
676 | - <0 0 32 &gic 0 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, |
677 | - <0 0 33 &gic 0 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, |
678 | - <0 0 34 &gic 0 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, |
679 | - <0 0 35 &gic 0 0 GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, |
680 | - <0 0 36 &gic 0 0 GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, |
681 | - <0 0 37 &gic 0 0 GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, |
682 | - <0 0 38 &gic 0 0 GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, |
683 | - <0 0 39 &gic 0 0 GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, |
684 | - <0 0 40 &gic 0 0 GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, |
685 | - <0 0 41 &gic 0 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, |
686 | - <0 0 42 &gic 0 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
687 | - |
688 | - ethernet@2,02000000 { |
689 | + interrupt-map = <0 0 0 &gic 0 GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, |
690 | + <0 0 1 &gic 0 GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, |
691 | + <0 0 2 &gic 0 GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, |
692 | + <0 0 3 &gic 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, |
693 | + <0 0 4 &gic 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, |
694 | + <0 0 5 &gic 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, |
695 | + <0 0 6 &gic 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, |
696 | + <0 0 7 &gic 0 GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, |
697 | + <0 0 8 &gic 0 GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, |
698 | + <0 0 9 &gic 0 GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
699 | + <0 0 10 &gic 0 GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, |
700 | + <0 0 11 &gic 0 GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
701 | + <0 0 12 &gic 0 GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, |
702 | + <0 0 13 &gic 0 GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, |
703 | + <0 0 14 &gic 0 GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
704 | + <0 0 15 &gic 0 GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, |
705 | + <0 0 16 &gic 0 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, |
706 | + <0 0 17 &gic 0 GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
707 | + <0 0 18 &gic 0 GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, |
708 | + <0 0 19 &gic 0 GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, |
709 | + <0 0 20 &gic 0 GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, |
710 | + <0 0 21 &gic 0 GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, |
711 | + <0 0 22 &gic 0 GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, |
712 | + <0 0 23 &gic 0 GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, |
713 | + <0 0 24 &gic 0 GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, |
714 | + <0 0 25 &gic 0 GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, |
715 | + <0 0 26 &gic 0 GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, |
716 | + <0 0 27 &gic 0 GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, |
717 | + <0 0 28 &gic 0 GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, |
718 | + <0 0 29 &gic 0 GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, |
719 | + <0 0 30 &gic 0 GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, |
720 | + <0 0 31 &gic 0 GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, |
721 | + <0 0 32 &gic 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, |
722 | + <0 0 33 &gic 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, |
723 | + <0 0 34 &gic 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, |
724 | + <0 0 35 &gic 0 GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, |
725 | + <0 0 36 &gic 0 GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, |
726 | + <0 0 37 &gic 0 GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, |
727 | + <0 0 38 &gic 0 GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, |
728 | + <0 0 39 &gic 0 GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, |
729 | + <0 0 40 &gic 0 GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, |
730 | + <0 0 41 &gic 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, |
731 | + <0 0 42 &gic 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
732 | + |
733 | + ethernet@202000000 { |
734 | compatible = "smsc,lan91c111"; |
735 | reg = <2 0x02000000 0x10000>; |
736 | interrupts = <15>; |
737 | @@ -178,7 +178,7 @@ |
738 | clock-output-names = "v2m:refclk32khz"; |
739 | }; |
740 | |
741 | - iofpga@3,00000000 { |
742 | + iofpga@300000000 { |
743 | compatible = "simple-bus"; |
744 | #address-cells = <1>; |
745 | #size-cells = <1>; |
746 | diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi |
747 | index 8c11660bbe40..c47f76b01c4b 100644 |
748 | --- a/arch/arm64/boot/dts/arm/juno-base.dtsi |
749 | +++ b/arch/arm64/boot/dts/arm/juno-base.dtsi |
750 | @@ -62,35 +62,35 @@ |
751 | <0x0 0x2c02f000 0 0x2000>, |
752 | <0x0 0x2c04f000 0 0x2000>, |
753 | <0x0 0x2c06f000 0 0x2000>; |
754 | - #address-cells = <2>; |
755 | + #address-cells = <1>; |
756 | #interrupt-cells = <3>; |
757 | - #size-cells = <2>; |
758 | + #size-cells = <1>; |
759 | interrupt-controller; |
760 | interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_HIGH)>; |
761 | - ranges = <0 0 0 0x2c1c0000 0 0x40000>; |
762 | + ranges = <0 0 0x2c1c0000 0x40000>; |
763 | |
764 | v2m_0: v2m@0 { |
765 | compatible = "arm,gic-v2m-frame"; |
766 | msi-controller; |
767 | - reg = <0 0 0 0x10000>; |
768 | + reg = <0 0x10000>; |
769 | }; |
770 | |
771 | v2m@10000 { |
772 | compatible = "arm,gic-v2m-frame"; |
773 | msi-controller; |
774 | - reg = <0 0x10000 0 0x10000>; |
775 | + reg = <0x10000 0x10000>; |
776 | }; |
777 | |
778 | v2m@20000 { |
779 | compatible = "arm,gic-v2m-frame"; |
780 | msi-controller; |
781 | - reg = <0 0x20000 0 0x10000>; |
782 | + reg = <0x20000 0x10000>; |
783 | }; |
784 | |
785 | v2m@30000 { |
786 | compatible = "arm,gic-v2m-frame"; |
787 | msi-controller; |
788 | - reg = <0 0x30000 0 0x10000>; |
789 | + reg = <0x30000 0x10000>; |
790 | }; |
791 | }; |
792 | |
793 | @@ -519,10 +519,10 @@ |
794 | <0x42000000 0x40 0x00000000 0x40 0x00000000 0x1 0x00000000>; |
795 | #interrupt-cells = <1>; |
796 | interrupt-map-mask = <0 0 0 7>; |
797 | - interrupt-map = <0 0 0 1 &gic 0 0 GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, |
798 | - <0 0 0 2 &gic 0 0 GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, |
799 | - <0 0 0 3 &gic 0 0 GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
800 | - <0 0 0 4 &gic 0 0 GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
801 | + interrupt-map = <0 0 0 1 &gic 0 GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, |
802 | + <0 0 0 2 &gic 0 GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, |
803 | + <0 0 0 3 &gic 0 GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
804 | + <0 0 0 4 &gic 0 GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
805 | msi-parent = <&v2m_0>; |
806 | status = "disabled"; |
807 | iommu-map-mask = <0x0>; /* RC has no means to output PCI RID */ |
808 | @@ -786,19 +786,19 @@ |
809 | |
810 | #interrupt-cells = <1>; |
811 | interrupt-map-mask = <0 0 15>; |
812 | - interrupt-map = <0 0 0 &gic 0 0 GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, |
813 | - <0 0 1 &gic 0 0 GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, |
814 | - <0 0 2 &gic 0 0 GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, |
815 | - <0 0 3 &gic 0 0 GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, |
816 | - <0 0 4 &gic 0 0 GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, |
817 | - <0 0 5 &gic 0 0 GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, |
818 | - <0 0 6 &gic 0 0 GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, |
819 | - <0 0 7 &gic 0 0 GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, |
820 | - <0 0 8 &gic 0 0 GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, |
821 | - <0 0 9 &gic 0 0 GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, |
822 | - <0 0 10 &gic 0 0 GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
823 | - <0 0 11 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
824 | - <0 0 12 &gic 0 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
825 | + interrupt-map = <0 0 0 &gic 0 GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, |
826 | + <0 0 1 &gic 0 GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, |
827 | + <0 0 2 &gic 0 GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, |
828 | + <0 0 3 &gic 0 GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, |
829 | + <0 0 4 &gic 0 GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, |
830 | + <0 0 5 &gic 0 GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, |
831 | + <0 0 6 &gic 0 GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, |
832 | + <0 0 7 &gic 0 GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, |
833 | + <0 0 8 &gic 0 GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, |
834 | + <0 0 9 &gic 0 GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, |
835 | + <0 0 10 &gic 0 GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
836 | + <0 0 11 &gic 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
837 | + <0 0 12 &gic 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
838 | }; |
839 | |
840 | site2: tlx@60000000 { |
841 | @@ -808,6 +808,6 @@ |
842 | ranges = <0 0 0x60000000 0x10000000>; |
843 | #interrupt-cells = <1>; |
844 | interrupt-map-mask = <0 0>; |
845 | - interrupt-map = <0 0 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
846 | + interrupt-map = <0 0 &gic 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
847 | }; |
848 | }; |
849 | diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
850 | index 9f60dacb4f80..1234a8cfc0a9 100644 |
851 | --- a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
852 | +++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
853 | @@ -103,7 +103,7 @@ |
854 | }; |
855 | }; |
856 | |
857 | - flash@0,00000000 { |
858 | + flash@0 { |
859 | /* 2 * 32MiB NOR Flash memory mounted on CS0 */ |
860 | compatible = "arm,vexpress-flash", "cfi-flash"; |
861 | reg = <0 0x00000000 0x04000000>; |
862 | @@ -120,7 +120,7 @@ |
863 | }; |
864 | }; |
865 | |
866 | - ethernet@2,00000000 { |
867 | + ethernet@200000000 { |
868 | compatible = "smsc,lan9118", "smsc,lan9115"; |
869 | reg = <2 0x00000000 0x10000>; |
870 | interrupts = <3>; |
871 | @@ -133,7 +133,7 @@ |
872 | vddvario-supply = <&mb_fixed_3v3>; |
873 | }; |
874 | |
875 | - iofpga@3,00000000 { |
876 | + iofpga@300000000 { |
877 | compatible = "simple-bus"; |
878 | #address-cells = <1>; |
879 | #size-cells = <1>; |
880 | diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
881 | index 57b0b9d7f3fa..29e6962c70bd 100644 |
882 | --- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
883 | +++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
884 | @@ -9,7 +9,7 @@ |
885 | motherboard { |
886 | arm,v2m-memory-map = "rs2"; |
887 | |
888 | - iofpga@3,00000000 { |
889 | + iofpga@300000000 { |
890 | virtio-p9@140000 { |
891 | compatible = "virtio,mmio"; |
892 | reg = <0x140000 0x200>; |
893 | diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
894 | index 03a7bf079c8f..ad20076357f5 100644 |
895 | --- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
896 | +++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
897 | @@ -17,14 +17,14 @@ |
898 | #interrupt-cells = <1>; |
899 | ranges; |
900 | |
901 | - flash@0,00000000 { |
902 | + flash@0 { |
903 | compatible = "arm,vexpress-flash", "cfi-flash"; |
904 | reg = <0 0x00000000 0x04000000>, |
905 | <4 0x00000000 0x04000000>; |
906 | bank-width = <4>; |
907 | }; |
908 | |
909 | - ethernet@2,02000000 { |
910 | + ethernet@202000000 { |
911 | compatible = "smsc,lan91c111"; |
912 | reg = <2 0x02000000 0x10000>; |
913 | interrupts = <15>; |
914 | @@ -51,7 +51,7 @@ |
915 | clock-output-names = "v2m:refclk32khz"; |
916 | }; |
917 | |
918 | - iofpga@3,00000000 { |
919 | + iofpga@300000000 { |
920 | compatible = "simple-bus"; |
921 | #address-cells = <1>; |
922 | #size-cells = <1>; |
923 | diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
924 | index 5f350cc71a2f..c3668187b844 100644 |
925 | --- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
926 | +++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
927 | @@ -95,7 +95,7 @@ |
928 | }; |
929 | |
930 | sfp: sfp { |
931 | - compatible = "sff,sfp+"; |
932 | + compatible = "sff,sfp"; |
933 | i2c-bus = <&i2c0>; |
934 | los-gpio = <&moxtet_sfp 0 GPIO_ACTIVE_HIGH>; |
935 | tx-fault-gpio = <&moxtet_sfp 1 GPIO_ACTIVE_HIGH>; |
936 | @@ -171,6 +171,8 @@ |
937 | marvell,pad-type = "sd"; |
938 | vqmmc-supply = <&vsdio_reg>; |
939 | mmc-pwrseq = <&sdhci1_pwrseq>; |
940 | + /* forbid SDR104 for FCC purposes */ |
941 | + sdhci-caps-mask = <0x2 0x0>; |
942 | status = "okay"; |
943 | }; |
944 | |
945 | diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
946 | index 5891b7151432..dec5e4113ce4 100644 |
947 | --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
948 | +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
949 | @@ -238,21 +238,21 @@ |
950 | cpu_on = <0x84000003>; |
951 | }; |
952 | |
953 | - clk26m: oscillator@0 { |
954 | + clk26m: oscillator0 { |
955 | compatible = "fixed-clock"; |
956 | #clock-cells = <0>; |
957 | clock-frequency = <26000000>; |
958 | clock-output-names = "clk26m"; |
959 | }; |
960 | |
961 | - clk32k: oscillator@1 { |
962 | + clk32k: oscillator1 { |
963 | compatible = "fixed-clock"; |
964 | #clock-cells = <0>; |
965 | clock-frequency = <32000>; |
966 | clock-output-names = "clk32k"; |
967 | }; |
968 | |
969 | - cpum_ck: oscillator@2 { |
970 | + cpum_ck: oscillator2 { |
971 | compatible = "fixed-clock"; |
972 | #clock-cells = <0>; |
973 | clock-frequency = <0>; |
974 | @@ -268,19 +268,19 @@ |
975 | sustainable-power = <1500>; /* milliwatts */ |
976 | |
977 | trips { |
978 | - threshold: trip-point@0 { |
979 | + threshold: trip-point0 { |
980 | temperature = <68000>; |
981 | hysteresis = <2000>; |
982 | type = "passive"; |
983 | }; |
984 | |
985 | - target: trip-point@1 { |
986 | + target: trip-point1 { |
987 | temperature = <85000>; |
988 | hysteresis = <2000>; |
989 | type = "passive"; |
990 | }; |
991 | |
992 | - cpu_crit: cpu_crit@0 { |
993 | + cpu_crit: cpu_crit0 { |
994 | temperature = <115000>; |
995 | hysteresis = <2000>; |
996 | type = "critical"; |
997 | @@ -288,13 +288,13 @@ |
998 | }; |
999 | |
1000 | cooling-maps { |
1001 | - map@0 { |
1002 | + map0 { |
1003 | trip = <&target>; |
1004 | cooling-device = <&cpu0 0 0>, |
1005 | <&cpu1 0 0>; |
1006 | contribution = <3072>; |
1007 | }; |
1008 | - map@1 { |
1009 | + map1 { |
1010 | trip = <&target>; |
1011 | cooling-device = <&cpu2 0 0>, |
1012 | <&cpu3 0 0>; |
1013 | @@ -308,7 +308,7 @@ |
1014 | #address-cells = <2>; |
1015 | #size-cells = <2>; |
1016 | ranges; |
1017 | - vpu_dma_reserved: vpu_dma_mem_region { |
1018 | + vpu_dma_reserved: vpu_dma_mem_region@b7000000 { |
1019 | compatible = "shared-dma-pool"; |
1020 | reg = <0 0xb7000000 0 0x500000>; |
1021 | alignment = <0x1000>; |
1022 | @@ -360,7 +360,7 @@ |
1023 | reg = <0 0x10005000 0 0x1000>; |
1024 | }; |
1025 | |
1026 | - pio: pinctrl@10005000 { |
1027 | + pio: pinctrl@1000b000 { |
1028 | compatible = "mediatek,mt8173-pinctrl"; |
1029 | reg = <0 0x1000b000 0 0x1000>; |
1030 | mediatek,pctl-regmap = <&syscfg_pctl_a>; |
1031 | @@ -567,7 +567,7 @@ |
1032 | status = "disabled"; |
1033 | }; |
1034 | |
1035 | - gic: interrupt-controller@10220000 { |
1036 | + gic: interrupt-controller@10221000 { |
1037 | compatible = "arm,gic-400"; |
1038 | #interrupt-cells = <3>; |
1039 | interrupt-parent = <&gic>; |
1040 | diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1041 | index 02909a48dfcd..7899759a12f8 100644 |
1042 | --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1043 | +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1044 | @@ -32,7 +32,7 @@ |
1045 | |
1046 | phy-reset-gpios = <&gpio TEGRA194_MAIN_GPIO(G, 5) GPIO_ACTIVE_LOW>; |
1047 | phy-handle = <&phy>; |
1048 | - phy-mode = "rgmii"; |
1049 | + phy-mode = "rgmii-id"; |
1050 | |
1051 | mdio { |
1052 | #address-cells = <1>; |
1053 | diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1054 | index 457b815d57f4..2f3926719434 100644 |
1055 | --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1056 | +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1057 | @@ -1192,7 +1192,7 @@ |
1058 | |
1059 | bus-range = <0x0 0xff>; |
1060 | ranges = <0x81000000 0x0 0x30100000 0x0 0x30100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1061 | - 0xc2000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1062 | + 0xc3000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1063 | 0x82000000 0x0 0x40000000 0x12 0x30000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1064 | }; |
1065 | |
1066 | @@ -1238,7 +1238,7 @@ |
1067 | |
1068 | bus-range = <0x0 0xff>; |
1069 | ranges = <0x81000000 0x0 0x32100000 0x0 0x32100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1070 | - 0xc2000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1071 | + 0xc3000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1072 | 0x82000000 0x0 0x40000000 0x12 0x70000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1073 | }; |
1074 | |
1075 | @@ -1284,7 +1284,7 @@ |
1076 | |
1077 | bus-range = <0x0 0xff>; |
1078 | ranges = <0x81000000 0x0 0x34100000 0x0 0x34100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1079 | - 0xc2000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1080 | + 0xc3000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1081 | 0x82000000 0x0 0x40000000 0x12 0xb0000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1082 | }; |
1083 | |
1084 | @@ -1330,7 +1330,7 @@ |
1085 | |
1086 | bus-range = <0x0 0xff>; |
1087 | ranges = <0x81000000 0x0 0x36100000 0x0 0x36100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1088 | - 0xc2000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1089 | + 0xc3000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1090 | 0x82000000 0x0 0x40000000 0x17 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1091 | }; |
1092 | |
1093 | @@ -1376,7 +1376,7 @@ |
1094 | |
1095 | bus-range = <0x0 0xff>; |
1096 | ranges = <0x81000000 0x0 0x38100000 0x0 0x38100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1097 | - 0xc2000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1098 | + 0xc3000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1099 | 0x82000000 0x0 0x40000000 0x1b 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1100 | }; |
1101 | |
1102 | @@ -1426,7 +1426,7 @@ |
1103 | |
1104 | bus-range = <0x0 0xff>; |
1105 | ranges = <0x81000000 0x0 0x3a100000 0x0 0x3a100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1106 | - 0xc2000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1107 | + 0xc3000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1108 | 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1109 | }; |
1110 | |
1111 | diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1112 | index 5ea9fb8f2f87..340da154d4e3 100644 |
1113 | --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1114 | +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1115 | @@ -212,7 +212,7 @@ |
1116 | thermal-sensors = <&tsens 3>; |
1117 | |
1118 | trips { |
1119 | - cpu2_3_alert0: trip-point@0 { |
1120 | + cpu2_3_alert0: trip-point0 { |
1121 | temperature = <75000>; |
1122 | hysteresis = <2000>; |
1123 | type = "passive"; |
1124 | @@ -242,7 +242,7 @@ |
1125 | thermal-sensors = <&tsens 2>; |
1126 | |
1127 | trips { |
1128 | - gpu_alert0: trip-point@0 { |
1129 | + gpu_alert0: trip-point0 { |
1130 | temperature = <75000>; |
1131 | hysteresis = <2000>; |
1132 | type = "passive"; |
1133 | @@ -262,7 +262,7 @@ |
1134 | thermal-sensors = <&tsens 1>; |
1135 | |
1136 | trips { |
1137 | - cam_alert0: trip-point@0 { |
1138 | + cam_alert0: trip-point0 { |
1139 | temperature = <75000>; |
1140 | hysteresis = <2000>; |
1141 | type = "hot"; |
1142 | @@ -277,7 +277,7 @@ |
1143 | thermal-sensors = <&tsens 0>; |
1144 | |
1145 | trips { |
1146 | - modem_alert0: trip-point@0 { |
1147 | + modem_alert0: trip-point0 { |
1148 | temperature = <85000>; |
1149 | hysteresis = <2000>; |
1150 | type = "hot"; |
1151 | diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1152 | index fbb8ce78f95b..d303df3887d9 100644 |
1153 | --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1154 | +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1155 | @@ -1681,16 +1681,16 @@ |
1156 | "csi_clk_mux", |
1157 | "vfe0", |
1158 | "vfe1"; |
1159 | - interrupts = <GIC_SPI 78 0>, |
1160 | - <GIC_SPI 79 0>, |
1161 | - <GIC_SPI 80 0>, |
1162 | - <GIC_SPI 296 0>, |
1163 | - <GIC_SPI 297 0>, |
1164 | - <GIC_SPI 298 0>, |
1165 | - <GIC_SPI 299 0>, |
1166 | - <GIC_SPI 309 0>, |
1167 | - <GIC_SPI 314 0>, |
1168 | - <GIC_SPI 315 0>; |
1169 | + interrupts = <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>, |
1170 | + <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>, |
1171 | + <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>, |
1172 | + <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>, |
1173 | + <GIC_SPI 297 IRQ_TYPE_EDGE_RISING>, |
1174 | + <GIC_SPI 298 IRQ_TYPE_EDGE_RISING>, |
1175 | + <GIC_SPI 299 IRQ_TYPE_EDGE_RISING>, |
1176 | + <GIC_SPI 309 IRQ_TYPE_EDGE_RISING>, |
1177 | + <GIC_SPI 314 IRQ_TYPE_EDGE_RISING>, |
1178 | + <GIC_SPI 315 IRQ_TYPE_EDGE_RISING>; |
1179 | interrupt-names = "csiphy0", |
1180 | "csiphy1", |
1181 | "csiphy2", |
1182 | diff --git a/arch/arm64/boot/dts/qcom/pm8150.dtsi b/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1183 | index b6e304748a57..c0b197458665 100644 |
1184 | --- a/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1185 | +++ b/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1186 | @@ -73,18 +73,8 @@ |
1187 | reg = <0xc000>; |
1188 | gpio-controller; |
1189 | #gpio-cells = <2>; |
1190 | - interrupts = <0x0 0xc0 0x0 IRQ_TYPE_NONE>, |
1191 | - <0x0 0xc1 0x0 IRQ_TYPE_NONE>, |
1192 | - <0x0 0xc2 0x0 IRQ_TYPE_NONE>, |
1193 | - <0x0 0xc3 0x0 IRQ_TYPE_NONE>, |
1194 | - <0x0 0xc4 0x0 IRQ_TYPE_NONE>, |
1195 | - <0x0 0xc5 0x0 IRQ_TYPE_NONE>, |
1196 | - <0x0 0xc6 0x0 IRQ_TYPE_NONE>, |
1197 | - <0x0 0xc7 0x0 IRQ_TYPE_NONE>, |
1198 | - <0x0 0xc8 0x0 IRQ_TYPE_NONE>, |
1199 | - <0x0 0xc9 0x0 IRQ_TYPE_NONE>, |
1200 | - <0x0 0xca 0x0 IRQ_TYPE_NONE>, |
1201 | - <0x0 0xcb 0x0 IRQ_TYPE_NONE>; |
1202 | + interrupt-controller; |
1203 | + #interrupt-cells = <2>; |
1204 | }; |
1205 | }; |
1206 | |
1207 | diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1208 | index 322379d5c31f..40b5d75a4a1d 100644 |
1209 | --- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1210 | +++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1211 | @@ -62,18 +62,8 @@ |
1212 | reg = <0xc000>; |
1213 | gpio-controller; |
1214 | #gpio-cells = <2>; |
1215 | - interrupts = <0x2 0xc0 0x0 IRQ_TYPE_NONE>, |
1216 | - <0x2 0xc1 0x0 IRQ_TYPE_NONE>, |
1217 | - <0x2 0xc2 0x0 IRQ_TYPE_NONE>, |
1218 | - <0x2 0xc3 0x0 IRQ_TYPE_NONE>, |
1219 | - <0x2 0xc4 0x0 IRQ_TYPE_NONE>, |
1220 | - <0x2 0xc5 0x0 IRQ_TYPE_NONE>, |
1221 | - <0x2 0xc6 0x0 IRQ_TYPE_NONE>, |
1222 | - <0x2 0xc7 0x0 IRQ_TYPE_NONE>, |
1223 | - <0x2 0xc8 0x0 IRQ_TYPE_NONE>, |
1224 | - <0x2 0xc9 0x0 IRQ_TYPE_NONE>, |
1225 | - <0x2 0xca 0x0 IRQ_TYPE_NONE>, |
1226 | - <0x2 0xcb 0x0 IRQ_TYPE_NONE>; |
1227 | + interrupt-controller; |
1228 | + #interrupt-cells = <2>; |
1229 | }; |
1230 | }; |
1231 | |
1232 | diff --git a/arch/arm64/boot/dts/qcom/pm8150l.dtsi b/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1233 | index eb0e9a090e42..cf05e0685d10 100644 |
1234 | --- a/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1235 | +++ b/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1236 | @@ -56,18 +56,8 @@ |
1237 | reg = <0xc000>; |
1238 | gpio-controller; |
1239 | #gpio-cells = <2>; |
1240 | - interrupts = <0x4 0xc0 0x0 IRQ_TYPE_NONE>, |
1241 | - <0x4 0xc1 0x0 IRQ_TYPE_NONE>, |
1242 | - <0x4 0xc2 0x0 IRQ_TYPE_NONE>, |
1243 | - <0x4 0xc3 0x0 IRQ_TYPE_NONE>, |
1244 | - <0x4 0xc4 0x0 IRQ_TYPE_NONE>, |
1245 | - <0x4 0xc5 0x0 IRQ_TYPE_NONE>, |
1246 | - <0x4 0xc6 0x0 IRQ_TYPE_NONE>, |
1247 | - <0x4 0xc7 0x0 IRQ_TYPE_NONE>, |
1248 | - <0x4 0xc8 0x0 IRQ_TYPE_NONE>, |
1249 | - <0x4 0xc9 0x0 IRQ_TYPE_NONE>, |
1250 | - <0x4 0xca 0x0 IRQ_TYPE_NONE>, |
1251 | - <0x4 0xcb 0x0 IRQ_TYPE_NONE>; |
1252 | + interrupt-controller; |
1253 | + #interrupt-cells = <2>; |
1254 | }; |
1255 | }; |
1256 | |
1257 | diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c |
1258 | index 38ee1514cd9c..b4a160795824 100644 |
1259 | --- a/arch/arm64/kernel/hw_breakpoint.c |
1260 | +++ b/arch/arm64/kernel/hw_breakpoint.c |
1261 | @@ -730,6 +730,27 @@ static u64 get_distance_from_watchpoint(unsigned long addr, u64 val, |
1262 | return 0; |
1263 | } |
1264 | |
1265 | +static int watchpoint_report(struct perf_event *wp, unsigned long addr, |
1266 | + struct pt_regs *regs) |
1267 | +{ |
1268 | + int step = is_default_overflow_handler(wp); |
1269 | + struct arch_hw_breakpoint *info = counter_arch_bp(wp); |
1270 | + |
1271 | + info->trigger = addr; |
1272 | + |
1273 | + /* |
1274 | + * If we triggered a user watchpoint from a uaccess routine, then |
1275 | + * handle the stepping ourselves since userspace really can't help |
1276 | + * us with this. |
1277 | + */ |
1278 | + if (!user_mode(regs) && info->ctrl.privilege == AARCH64_BREAKPOINT_EL0) |
1279 | + step = 1; |
1280 | + else |
1281 | + perf_bp_event(wp, regs); |
1282 | + |
1283 | + return step; |
1284 | +} |
1285 | + |
1286 | static int watchpoint_handler(unsigned long addr, unsigned int esr, |
1287 | struct pt_regs *regs) |
1288 | { |
1289 | @@ -739,7 +760,6 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
1290 | u64 val; |
1291 | struct perf_event *wp, **slots; |
1292 | struct debug_info *debug_info; |
1293 | - struct arch_hw_breakpoint *info; |
1294 | struct arch_hw_breakpoint_ctrl ctrl; |
1295 | |
1296 | slots = this_cpu_ptr(wp_on_reg); |
1297 | @@ -777,25 +797,13 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
1298 | if (dist != 0) |
1299 | continue; |
1300 | |
1301 | - info = counter_arch_bp(wp); |
1302 | - info->trigger = addr; |
1303 | - perf_bp_event(wp, regs); |
1304 | - |
1305 | - /* Do we need to handle the stepping? */ |
1306 | - if (is_default_overflow_handler(wp)) |
1307 | - step = 1; |
1308 | + step = watchpoint_report(wp, addr, regs); |
1309 | } |
1310 | - if (min_dist > 0 && min_dist != -1) { |
1311 | - /* No exact match found. */ |
1312 | - wp = slots[closest_match]; |
1313 | - info = counter_arch_bp(wp); |
1314 | - info->trigger = addr; |
1315 | - perf_bp_event(wp, regs); |
1316 | |
1317 | - /* Do we need to handle the stepping? */ |
1318 | - if (is_default_overflow_handler(wp)) |
1319 | - step = 1; |
1320 | - } |
1321 | + /* No exact match found? */ |
1322 | + if (min_dist > 0 && min_dist != -1) |
1323 | + step = watchpoint_report(slots[closest_match], addr, regs); |
1324 | + |
1325 | rcu_read_unlock(); |
1326 | |
1327 | if (!step) |
1328 | diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c |
1329 | index 62b0eb6cf69a..84eab0f5e00a 100644 |
1330 | --- a/arch/m68k/coldfire/pci.c |
1331 | +++ b/arch/m68k/coldfire/pci.c |
1332 | @@ -216,8 +216,10 @@ static int __init mcf_pci_init(void) |
1333 | |
1334 | /* Keep a virtual mapping to IO/config space active */ |
1335 | iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE); |
1336 | - if (iospace == 0) |
1337 | + if (iospace == 0) { |
1338 | + pci_free_host_bridge(bridge); |
1339 | return -ENODEV; |
1340 | + } |
1341 | pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n", |
1342 | (u32) iospace); |
1343 | |
1344 | diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S |
1345 | index e4a78571f883..c6481cfc5220 100644 |
1346 | --- a/arch/openrisc/kernel/entry.S |
1347 | +++ b/arch/openrisc/kernel/entry.S |
1348 | @@ -1166,13 +1166,13 @@ ENTRY(__sys_clone) |
1349 | l.movhi r29,hi(sys_clone) |
1350 | l.ori r29,r29,lo(sys_clone) |
1351 | l.j _fork_save_extra_regs_and_call |
1352 | - l.addi r7,r1,0 |
1353 | + l.nop |
1354 | |
1355 | ENTRY(__sys_fork) |
1356 | l.movhi r29,hi(sys_fork) |
1357 | l.ori r29,r29,lo(sys_fork) |
1358 | l.j _fork_save_extra_regs_and_call |
1359 | - l.addi r3,r1,0 |
1360 | + l.nop |
1361 | |
1362 | ENTRY(sys_rt_sigreturn) |
1363 | l.jal _sys_rt_sigreturn |
1364 | diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig |
1365 | index 44431dc06982..ad620637cbd1 100644 |
1366 | --- a/arch/powerpc/Kconfig |
1367 | +++ b/arch/powerpc/Kconfig |
1368 | @@ -747,6 +747,7 @@ config THREAD_SHIFT |
1369 | range 13 15 |
1370 | default "15" if PPC_256K_PAGES |
1371 | default "14" if PPC64 |
1372 | + default "14" if KASAN |
1373 | default "13" |
1374 | help |
1375 | Used to define the stack size. The default is almost always what you |
1376 | diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h |
1377 | index a143d394ff46..e1eb8aa9cfbb 100644 |
1378 | --- a/arch/powerpc/include/asm/book3s/64/pgtable.h |
1379 | +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h |
1380 | @@ -998,10 +998,25 @@ extern struct page *pgd_page(pgd_t pgd); |
1381 | #define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS) |
1382 | #define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS) |
1383 | |
1384 | -#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1)) |
1385 | -#define pud_index(address) (((address) >> (PUD_SHIFT)) & (PTRS_PER_PUD - 1)) |
1386 | -#define pmd_index(address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1)) |
1387 | -#define pte_index(address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1)) |
1388 | +static inline unsigned long pgd_index(unsigned long address) |
1389 | +{ |
1390 | + return (address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1); |
1391 | +} |
1392 | + |
1393 | +static inline unsigned long pud_index(unsigned long address) |
1394 | +{ |
1395 | + return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1); |
1396 | +} |
1397 | + |
1398 | +static inline unsigned long pmd_index(unsigned long address) |
1399 | +{ |
1400 | + return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); |
1401 | +} |
1402 | + |
1403 | +static inline unsigned long pte_index(unsigned long address) |
1404 | +{ |
1405 | + return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); |
1406 | +} |
1407 | |
1408 | /* |
1409 | * Find an entry in a page-table-directory. We combine the address region |
1410 | diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h |
1411 | index a9993e7a443b..64b998db9d3e 100644 |
1412 | --- a/arch/powerpc/include/asm/processor.h |
1413 | +++ b/arch/powerpc/include/asm/processor.h |
1414 | @@ -291,7 +291,6 @@ struct thread_struct { |
1415 | #else |
1416 | #define INIT_THREAD { \ |
1417 | .ksp = INIT_SP, \ |
1418 | - .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \ |
1419 | .addr_limit = KERNEL_DS, \ |
1420 | .fpexc_mode = 0, \ |
1421 | .fscr = FSCR_TAR | FSCR_EBB \ |
1422 | diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S |
1423 | index d0018dd17e0a..70ac8a6ba0c1 100644 |
1424 | --- a/arch/powerpc/kernel/exceptions-64s.S |
1425 | +++ b/arch/powerpc/kernel/exceptions-64s.S |
1426 | @@ -1090,17 +1090,19 @@ EXC_COMMON_BEGIN(machine_check_idle_common) |
1427 | bl machine_check_queue_event |
1428 | |
1429 | /* |
1430 | - * We have not used any non-volatile GPRs here, and as a rule |
1431 | - * most exception code including machine check does not. |
1432 | - * Therefore PACA_NAPSTATELOST does not need to be set. Idle |
1433 | - * wakeup will restore volatile registers. |
1434 | + * GPR-loss wakeups are relatively straightforward, because the |
1435 | + * idle sleep code has saved all non-volatile registers on its |
1436 | + * own stack, and r1 in PACAR1. |
1437 | * |
1438 | - * Load the original SRR1 into r3 for pnv_powersave_wakeup_mce. |
1439 | + * For no-loss wakeups the r1 and lr registers used by the |
1440 | + * early machine check handler have to be restored first. r2 is |
1441 | + * the kernel TOC, so no need to restore it. |
1442 | * |
1443 | * Then decrement MCE nesting after finishing with the stack. |
1444 | */ |
1445 | ld r3,_MSR(r1) |
1446 | ld r4,_LINK(r1) |
1447 | + ld r1,GPR1(r1) |
1448 | |
1449 | lhz r11,PACA_IN_MCE(r13) |
1450 | subi r11,r11,1 |
1451 | @@ -1109,7 +1111,7 @@ EXC_COMMON_BEGIN(machine_check_idle_common) |
1452 | mtlr r4 |
1453 | rlwinm r10,r3,47-31,30,31 |
1454 | cmpwi cr1,r10,2 |
1455 | - bltlr cr1 /* no state loss, return to idle caller */ |
1456 | + bltlr cr1 /* no state loss, return to idle caller with r3=SRR1 */ |
1457 | b idle_return_gpr_loss |
1458 | #endif |
1459 | |
1460 | diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
1461 | index ad79fddb974d..780f527eabd2 100644 |
1462 | --- a/arch/powerpc/kernel/head_64.S |
1463 | +++ b/arch/powerpc/kernel/head_64.S |
1464 | @@ -945,15 +945,8 @@ start_here_multiplatform: |
1465 | std r0,0(r4) |
1466 | #endif |
1467 | |
1468 | - /* The following gets the stack set up with the regs */ |
1469 | - /* pointing to the real addr of the kernel stack. This is */ |
1470 | - /* all done to support the C function call below which sets */ |
1471 | - /* up the htab. This is done because we have relocated the */ |
1472 | - /* kernel but are still running in real mode. */ |
1473 | - |
1474 | - LOAD_REG_ADDR(r3,init_thread_union) |
1475 | - |
1476 | /* set up a stack pointer */ |
1477 | + LOAD_REG_ADDR(r3,init_thread_union) |
1478 | LOAD_REG_IMMEDIATE(r1,THREAD_SIZE) |
1479 | add r1,r3,r1 |
1480 | li r0,0 |
1481 | diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c |
1482 | index c4ed328a7b96..7a1c11a7cba5 100644 |
1483 | --- a/arch/powerpc/kernel/machine_kexec.c |
1484 | +++ b/arch/powerpc/kernel/machine_kexec.c |
1485 | @@ -114,11 +114,12 @@ void machine_kexec(struct kimage *image) |
1486 | |
1487 | void __init reserve_crashkernel(void) |
1488 | { |
1489 | - unsigned long long crash_size, crash_base; |
1490 | + unsigned long long crash_size, crash_base, total_mem_sz; |
1491 | int ret; |
1492 | |
1493 | + total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size(); |
1494 | /* use common parsing */ |
1495 | - ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), |
1496 | + ret = parse_crashkernel(boot_command_line, total_mem_sz, |
1497 | &crash_size, &crash_base); |
1498 | if (ret == 0 && crash_size > 0) { |
1499 | crashk_res.start = crash_base; |
1500 | @@ -177,6 +178,7 @@ void __init reserve_crashkernel(void) |
1501 | /* Crash kernel trumps memory limit */ |
1502 | if (memory_limit && memory_limit <= crashk_res.end) { |
1503 | memory_limit = crashk_res.end + 1; |
1504 | + total_mem_sz = memory_limit; |
1505 | printk("Adjusted memory limit for crashkernel, now 0x%llx\n", |
1506 | memory_limit); |
1507 | } |
1508 | @@ -185,7 +187,7 @@ void __init reserve_crashkernel(void) |
1509 | "for crashkernel (System RAM: %ldMB)\n", |
1510 | (unsigned long)(crash_size >> 20), |
1511 | (unsigned long)(crashk_res.start >> 20), |
1512 | - (unsigned long)(memblock_phys_mem_size() >> 20)); |
1513 | + (unsigned long)(total_mem_sz >> 20)); |
1514 | |
1515 | if (!memblock_is_region_memory(crashk_res.start, crash_size) || |
1516 | memblock_reserve(crashk_res.start, crash_size)) { |
1517 | diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
1518 | index 639ceae7da9d..bd0c258a1d5d 100644 |
1519 | --- a/arch/powerpc/kernel/process.c |
1520 | +++ b/arch/powerpc/kernel/process.c |
1521 | @@ -1218,29 +1218,31 @@ struct task_struct *__switch_to(struct task_struct *prev, |
1522 | static void show_instructions(struct pt_regs *regs) |
1523 | { |
1524 | int i; |
1525 | + unsigned long nip = regs->nip; |
1526 | unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); |
1527 | |
1528 | printk("Instruction dump:"); |
1529 | |
1530 | + /* |
1531 | + * If we were executing with the MMU off for instructions, adjust pc |
1532 | + * rather than printing XXXXXXXX. |
1533 | + */ |
1534 | + if (!IS_ENABLED(CONFIG_BOOKE) && !(regs->msr & MSR_IR)) { |
1535 | + pc = (unsigned long)phys_to_virt(pc); |
1536 | + nip = (unsigned long)phys_to_virt(regs->nip); |
1537 | + } |
1538 | + |
1539 | for (i = 0; i < NR_INSN_TO_PRINT; i++) { |
1540 | int instr; |
1541 | |
1542 | if (!(i % 8)) |
1543 | pr_cont("\n"); |
1544 | |
1545 | -#if !defined(CONFIG_BOOKE) |
1546 | - /* If executing with the IMMU off, adjust pc rather |
1547 | - * than print XXXXXXXX. |
1548 | - */ |
1549 | - if (!(regs->msr & MSR_IR)) |
1550 | - pc = (unsigned long)phys_to_virt(pc); |
1551 | -#endif |
1552 | - |
1553 | if (!__kernel_text_address(pc) || |
1554 | probe_kernel_address((const void *)pc, instr)) { |
1555 | pr_cont("XXXXXXXX "); |
1556 | } else { |
1557 | - if (regs->nip == pc) |
1558 | + if (nip == pc) |
1559 | pr_cont("<%08x> ", instr); |
1560 | else |
1561 | pr_cont("%08x ", instr); |
1562 | diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
1563 | index 2d415c36a61d..43b56f8f6beb 100644 |
1564 | --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c |
1565 | +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
1566 | @@ -353,7 +353,13 @@ static struct kmem_cache *kvm_pmd_cache; |
1567 | |
1568 | static pte_t *kvmppc_pte_alloc(void) |
1569 | { |
1570 | - return kmem_cache_alloc(kvm_pte_cache, GFP_KERNEL); |
1571 | + pte_t *pte; |
1572 | + |
1573 | + pte = kmem_cache_alloc(kvm_pte_cache, GFP_KERNEL); |
1574 | + /* pmd_populate() will only reference _pa(pte). */ |
1575 | + kmemleak_ignore(pte); |
1576 | + |
1577 | + return pte; |
1578 | } |
1579 | |
1580 | static void kvmppc_pte_free(pte_t *ptep) |
1581 | @@ -363,7 +369,13 @@ static void kvmppc_pte_free(pte_t *ptep) |
1582 | |
1583 | static pmd_t *kvmppc_pmd_alloc(void) |
1584 | { |
1585 | - return kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); |
1586 | + pmd_t *pmd; |
1587 | + |
1588 | + pmd = kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); |
1589 | + /* pud_populate() will only reference _pa(pmd). */ |
1590 | + kmemleak_ignore(pmd); |
1591 | + |
1592 | + return pmd; |
1593 | } |
1594 | |
1595 | static void kvmppc_pmd_free(pmd_t *pmdp) |
1596 | diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c |
1597 | index 5834db0a54c6..03b947429e4d 100644 |
1598 | --- a/arch/powerpc/kvm/book3s_64_vio.c |
1599 | +++ b/arch/powerpc/kvm/book3s_64_vio.c |
1600 | @@ -74,6 +74,7 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
1601 | struct kvmppc_spapr_tce_iommu_table *stit, *tmp; |
1602 | struct iommu_table_group *table_group = NULL; |
1603 | |
1604 | + rcu_read_lock(); |
1605 | list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) { |
1606 | |
1607 | table_group = iommu_group_get_iommudata(grp); |
1608 | @@ -88,7 +89,9 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
1609 | kref_put(&stit->kref, kvm_spapr_tce_liobn_put); |
1610 | } |
1611 | } |
1612 | + cond_resched_rcu(); |
1613 | } |
1614 | + rcu_read_unlock(); |
1615 | } |
1616 | |
1617 | extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
1618 | @@ -106,12 +109,14 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
1619 | if (!f.file) |
1620 | return -EBADF; |
1621 | |
1622 | + rcu_read_lock(); |
1623 | list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) { |
1624 | if (stt == f.file->private_data) { |
1625 | found = true; |
1626 | break; |
1627 | } |
1628 | } |
1629 | + rcu_read_unlock(); |
1630 | |
1631 | fdput(f); |
1632 | |
1633 | @@ -144,6 +149,7 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
1634 | if (!tbl) |
1635 | return -EINVAL; |
1636 | |
1637 | + rcu_read_lock(); |
1638 | list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { |
1639 | if (tbl != stit->tbl) |
1640 | continue; |
1641 | @@ -151,14 +157,17 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
1642 | if (!kref_get_unless_zero(&stit->kref)) { |
1643 | /* stit is being destroyed */ |
1644 | iommu_tce_table_put(tbl); |
1645 | + rcu_read_unlock(); |
1646 | return -ENOTTY; |
1647 | } |
1648 | /* |
1649 | * The table is already known to this KVM, we just increased |
1650 | * its KVM reference counter and can return. |
1651 | */ |
1652 | + rcu_read_unlock(); |
1653 | return 0; |
1654 | } |
1655 | + rcu_read_unlock(); |
1656 | |
1657 | stit = kzalloc(sizeof(*stit), GFP_KERNEL); |
1658 | if (!stit) { |
1659 | @@ -364,18 +373,19 @@ static long kvmppc_tce_validate(struct kvmppc_spapr_tce_table *stt, |
1660 | if (kvmppc_tce_to_ua(stt->kvm, tce, &ua)) |
1661 | return H_TOO_HARD; |
1662 | |
1663 | + rcu_read_lock(); |
1664 | list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { |
1665 | unsigned long hpa = 0; |
1666 | struct mm_iommu_table_group_mem_t *mem; |
1667 | long shift = stit->tbl->it_page_shift; |
1668 | |
1669 | mem = mm_iommu_lookup(stt->kvm->mm, ua, 1ULL << shift); |
1670 | - if (!mem) |
1671 | - return H_TOO_HARD; |
1672 | - |
1673 | - if (mm_iommu_ua_to_hpa(mem, ua, shift, &hpa)) |
1674 | + if (!mem || mm_iommu_ua_to_hpa(mem, ua, shift, &hpa)) { |
1675 | + rcu_read_unlock(); |
1676 | return H_TOO_HARD; |
1677 | + } |
1678 | } |
1679 | + rcu_read_unlock(); |
1680 | |
1681 | return H_SUCCESS; |
1682 | } |
1683 | diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c |
1684 | index 84d5fab94f8f..1424a120710e 100644 |
1685 | --- a/arch/powerpc/mm/book3s32/mmu.c |
1686 | +++ b/arch/powerpc/mm/book3s32/mmu.c |
1687 | @@ -187,6 +187,7 @@ void mmu_mark_initmem_nx(void) |
1688 | int i; |
1689 | unsigned long base = (unsigned long)_stext - PAGE_OFFSET; |
1690 | unsigned long top = (unsigned long)_etext - PAGE_OFFSET; |
1691 | + unsigned long border = (unsigned long)__init_begin - PAGE_OFFSET; |
1692 | unsigned long size; |
1693 | |
1694 | if (IS_ENABLED(CONFIG_PPC_BOOK3S_601)) |
1695 | @@ -201,9 +202,10 @@ void mmu_mark_initmem_nx(void) |
1696 | size = block_size(base, top); |
1697 | size = max(size, 128UL << 10); |
1698 | if ((top - base) > size) { |
1699 | - if (strict_kernel_rwx_enabled()) |
1700 | - pr_warn("Kernel _etext not properly aligned\n"); |
1701 | size <<= 1; |
1702 | + if (strict_kernel_rwx_enabled() && base + size > border) |
1703 | + pr_warn("Some RW data is getting mapped X. " |
1704 | + "Adjust CONFIG_DATA_SHIFT to avoid that.\n"); |
1705 | } |
1706 | setibat(i++, PAGE_OFFSET + base, base, size, PAGE_KERNEL_TEXT); |
1707 | base += size; |
1708 | diff --git a/arch/powerpc/mm/ptdump/shared.c b/arch/powerpc/mm/ptdump/shared.c |
1709 | index f7ed2f187cb0..784f8df17f73 100644 |
1710 | --- a/arch/powerpc/mm/ptdump/shared.c |
1711 | +++ b/arch/powerpc/mm/ptdump/shared.c |
1712 | @@ -30,6 +30,11 @@ static const struct flag_info flag_array[] = { |
1713 | .val = _PAGE_PRESENT, |
1714 | .set = "present", |
1715 | .clear = " ", |
1716 | + }, { |
1717 | + .mask = _PAGE_COHERENT, |
1718 | + .val = _PAGE_COHERENT, |
1719 | + .set = "coherent", |
1720 | + .clear = " ", |
1721 | }, { |
1722 | .mask = _PAGE_GUARDED, |
1723 | .val = _PAGE_GUARDED, |
1724 | diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c |
1725 | index 573e0b309c0c..48e8f4b17b91 100644 |
1726 | --- a/arch/powerpc/perf/hv-24x7.c |
1727 | +++ b/arch/powerpc/perf/hv-24x7.c |
1728 | @@ -1400,16 +1400,6 @@ static void h_24x7_event_read(struct perf_event *event) |
1729 | h24x7hw = &get_cpu_var(hv_24x7_hw); |
1730 | h24x7hw->events[i] = event; |
1731 | put_cpu_var(h24x7hw); |
1732 | - /* |
1733 | - * Clear the event count so we can compute the _change_ |
1734 | - * in the 24x7 raw counter value at the end of the txn. |
1735 | - * |
1736 | - * Note that we could alternatively read the 24x7 value |
1737 | - * now and save its value in event->hw.prev_count. But |
1738 | - * that would require issuing a hcall, which would then |
1739 | - * defeat the purpose of using the txn interface. |
1740 | - */ |
1741 | - local64_set(&event->count, 0); |
1742 | } |
1743 | |
1744 | put_cpu_var(hv_24x7_reqb); |
1745 | diff --git a/arch/powerpc/platforms/4xx/pci.c b/arch/powerpc/platforms/4xx/pci.c |
1746 | index e6e2adcc7b64..c13d64c3b019 100644 |
1747 | --- a/arch/powerpc/platforms/4xx/pci.c |
1748 | +++ b/arch/powerpc/platforms/4xx/pci.c |
1749 | @@ -1242,7 +1242,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) |
1750 | if (mbase == NULL) { |
1751 | printk(KERN_ERR "%pOF: Can't map internal config space !", |
1752 | port->node); |
1753 | - goto done; |
1754 | + return; |
1755 | } |
1756 | |
1757 | while (attempt && (0 == (in_le32(mbase + PECFG_460SX_DLLSTA) |
1758 | @@ -1252,9 +1252,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) |
1759 | } |
1760 | if (attempt) |
1761 | port->link = 1; |
1762 | -done: |
1763 | iounmap(mbase); |
1764 | - |
1765 | } |
1766 | |
1767 | static struct ppc4xx_pciex_hwops ppc460sx_pcie_hwops __initdata = { |
1768 | diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c |
1769 | index 423be34f0f5f..f42fe4e86ce5 100644 |
1770 | --- a/arch/powerpc/platforms/ps3/mm.c |
1771 | +++ b/arch/powerpc/platforms/ps3/mm.c |
1772 | @@ -200,13 +200,14 @@ void ps3_mm_vas_destroy(void) |
1773 | { |
1774 | int result; |
1775 | |
1776 | - DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id); |
1777 | - |
1778 | if (map.vas_id) { |
1779 | result = lv1_select_virtual_address_space(0); |
1780 | - BUG_ON(result); |
1781 | - result = lv1_destruct_virtual_address_space(map.vas_id); |
1782 | - BUG_ON(result); |
1783 | + result += lv1_destruct_virtual_address_space(map.vas_id); |
1784 | + |
1785 | + if (result) { |
1786 | + lv1_panic(0); |
1787 | + } |
1788 | + |
1789 | map.vas_id = 0; |
1790 | } |
1791 | } |
1792 | @@ -304,19 +305,20 @@ static void ps3_mm_region_destroy(struct mem_region *r) |
1793 | int result; |
1794 | |
1795 | if (!r->destroy) { |
1796 | - pr_info("%s:%d: Not destroying high region: %llxh %llxh\n", |
1797 | - __func__, __LINE__, r->base, r->size); |
1798 | return; |
1799 | } |
1800 | |
1801 | - DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base); |
1802 | - |
1803 | if (r->base) { |
1804 | result = lv1_release_memory(r->base); |
1805 | - BUG_ON(result); |
1806 | + |
1807 | + if (result) { |
1808 | + lv1_panic(0); |
1809 | + } |
1810 | + |
1811 | r->size = r->base = r->offset = 0; |
1812 | map.total = map.rm.size; |
1813 | } |
1814 | + |
1815 | ps3_mm_set_repository_highmem(NULL); |
1816 | } |
1817 | |
1818 | diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c |
1819 | index 753adeb624f2..13ef77fd648f 100644 |
1820 | --- a/arch/powerpc/platforms/pseries/ras.c |
1821 | +++ b/arch/powerpc/platforms/pseries/ras.c |
1822 | @@ -395,10 +395,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id) |
1823 | /* |
1824 | * Some versions of FWNMI place the buffer inside the 4kB page starting at |
1825 | * 0x7000. Other versions place it inside the rtas buffer. We check both. |
1826 | + * Minimum size of the buffer is 16 bytes. |
1827 | */ |
1828 | #define VALID_FWNMI_BUFFER(A) \ |
1829 | - ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ |
1830 | - (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) |
1831 | + ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ |
1832 | + (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16)))) |
1833 | |
1834 | static inline struct rtas_error_log *fwnmi_get_errlog(void) |
1835 | { |
1836 | diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h |
1837 | index f073292e9fdb..d9d5de0f67ff 100644 |
1838 | --- a/arch/s390/include/asm/syscall.h |
1839 | +++ b/arch/s390/include/asm/syscall.h |
1840 | @@ -33,7 +33,17 @@ static inline void syscall_rollback(struct task_struct *task, |
1841 | static inline long syscall_get_error(struct task_struct *task, |
1842 | struct pt_regs *regs) |
1843 | { |
1844 | - return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0; |
1845 | + unsigned long error = regs->gprs[2]; |
1846 | +#ifdef CONFIG_COMPAT |
1847 | + if (test_tsk_thread_flag(task, TIF_31BIT)) { |
1848 | + /* |
1849 | + * Sign-extend the value so (int)-EFOO becomes (long)-EFOO |
1850 | + * and will match correctly in comparisons. |
1851 | + */ |
1852 | + error = (long)(int)error; |
1853 | + } |
1854 | +#endif |
1855 | + return IS_ERR_VALUE(error) ? error : 0; |
1856 | } |
1857 | |
1858 | static inline long syscall_get_return_value(struct task_struct *task, |
1859 | diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c |
1860 | index cc3ad64479ac..9e256d4d1f4c 100644 |
1861 | --- a/arch/sparc/mm/srmmu.c |
1862 | +++ b/arch/sparc/mm/srmmu.c |
1863 | @@ -379,7 +379,6 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) |
1864 | return NULL; |
1865 | page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); |
1866 | if (!pgtable_pte_page_ctor(page)) { |
1867 | - __free_page(page); |
1868 | return NULL; |
1869 | } |
1870 | return page; |
1871 | diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile |
1872 | index e2839b5c246c..6539c50fb9aa 100644 |
1873 | --- a/arch/x86/boot/Makefile |
1874 | +++ b/arch/x86/boot/Makefile |
1875 | @@ -87,7 +87,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE |
1876 | |
1877 | SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) |
1878 | |
1879 | -sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' |
1880 | +sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' |
1881 | |
1882 | quiet_cmd_zoffset = ZOFFSET $@ |
1883 | cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ |
1884 | diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
1885 | index 25b8c45467fc..fce94c799f01 100644 |
1886 | --- a/arch/x86/kernel/apic/apic.c |
1887 | +++ b/arch/x86/kernel/apic/apic.c |
1888 | @@ -2099,7 +2099,7 @@ void __init init_apic_mappings(void) |
1889 | unsigned int new_apicid; |
1890 | |
1891 | if (apic_validate_deadline_timer()) |
1892 | - pr_debug("TSC deadline timer available\n"); |
1893 | + pr_info("TSC deadline timer available\n"); |
1894 | |
1895 | if (x2apic_mode) { |
1896 | boot_cpu_physical_apicid = read_apic_id(); |
1897 | diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c |
1898 | index 87ef69a72c52..7bb4c3cbf4dc 100644 |
1899 | --- a/arch/x86/kernel/idt.c |
1900 | +++ b/arch/x86/kernel/idt.c |
1901 | @@ -318,7 +318,11 @@ void __init idt_setup_apic_and_irq_gates(void) |
1902 | |
1903 | #ifdef CONFIG_X86_LOCAL_APIC |
1904 | for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { |
1905 | - set_bit(i, system_vectors); |
1906 | + /* |
1907 | + * Don't set the non assigned system vectors in the |
1908 | + * system_vectors bitmap. Otherwise they show up in |
1909 | + * /proc/interrupts. |
1910 | + */ |
1911 | entry = spurious_entries_start + 8 * (i - FIRST_SYSTEM_VECTOR); |
1912 | set_intr_gate(i, entry); |
1913 | } |
1914 | diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
1915 | index 43fc13c831af..62c39baea39e 100644 |
1916 | --- a/arch/x86/kernel/kprobes/core.c |
1917 | +++ b/arch/x86/kernel/kprobes/core.c |
1918 | @@ -746,16 +746,11 @@ asm( |
1919 | NOKPROBE_SYMBOL(kretprobe_trampoline); |
1920 | STACK_FRAME_NON_STANDARD(kretprobe_trampoline); |
1921 | |
1922 | -static struct kprobe kretprobe_kprobe = { |
1923 | - .addr = (void *)kretprobe_trampoline, |
1924 | -}; |
1925 | - |
1926 | /* |
1927 | * Called from kretprobe_trampoline |
1928 | */ |
1929 | __used __visible void *trampoline_handler(struct pt_regs *regs) |
1930 | { |
1931 | - struct kprobe_ctlblk *kcb; |
1932 | struct kretprobe_instance *ri = NULL; |
1933 | struct hlist_head *head, empty_rp; |
1934 | struct hlist_node *tmp; |
1935 | @@ -765,16 +760,12 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
1936 | void *frame_pointer; |
1937 | bool skipped = false; |
1938 | |
1939 | - preempt_disable(); |
1940 | - |
1941 | /* |
1942 | * Set a dummy kprobe for avoiding kretprobe recursion. |
1943 | * Since kretprobe never run in kprobe handler, kprobe must not |
1944 | * be running at this point. |
1945 | */ |
1946 | - kcb = get_kprobe_ctlblk(); |
1947 | - __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
1948 | - kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
1949 | + kprobe_busy_begin(); |
1950 | |
1951 | INIT_HLIST_HEAD(&empty_rp); |
1952 | kretprobe_hash_lock(current, &head, &flags); |
1953 | @@ -850,7 +841,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
1954 | __this_cpu_write(current_kprobe, &ri->rp->kp); |
1955 | ri->ret_addr = correct_ret_addr; |
1956 | ri->rp->handler(ri, regs); |
1957 | - __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
1958 | + __this_cpu_write(current_kprobe, &kprobe_busy); |
1959 | } |
1960 | |
1961 | recycle_rp_inst(ri, &empty_rp); |
1962 | @@ -866,8 +857,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
1963 | |
1964 | kretprobe_hash_unlock(current, &flags); |
1965 | |
1966 | - __this_cpu_write(current_kprobe, NULL); |
1967 | - preempt_enable(); |
1968 | + kprobe_busy_end(); |
1969 | |
1970 | hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { |
1971 | hlist_del(&ri->hlist); |
1972 | diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile |
1973 | index fb4ee5444379..9733d1cc791d 100644 |
1974 | --- a/arch/x86/purgatory/Makefile |
1975 | +++ b/arch/x86/purgatory/Makefile |
1976 | @@ -17,7 +17,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS |
1977 | LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib |
1978 | targets += purgatory.ro |
1979 | |
1980 | +# Sanitizer, etc. runtimes are unavailable and cannot be linked here. |
1981 | +GCOV_PROFILE := n |
1982 | KASAN_SANITIZE := n |
1983 | +UBSAN_SANITIZE := n |
1984 | KCOV_INSTRUMENT := n |
1985 | |
1986 | # These are adjustments to the compiler flags used for objects that |
1987 | @@ -25,7 +28,7 @@ KCOV_INSTRUMENT := n |
1988 | |
1989 | PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel |
1990 | PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss |
1991 | -PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) |
1992 | +PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING |
1993 | |
1994 | # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That |
1995 | # in turn leaves some undefined symbols like __fentry__ in purgatory and not |
1996 | diff --git a/crypto/algboss.c b/crypto/algboss.c |
1997 | index a62149d6c839..2d41e67532c0 100644 |
1998 | --- a/crypto/algboss.c |
1999 | +++ b/crypto/algboss.c |
2000 | @@ -188,8 +188,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) |
2001 | if (IS_ERR(thread)) |
2002 | goto err_put_larval; |
2003 | |
2004 | - wait_for_completion_interruptible(&larval->completion); |
2005 | - |
2006 | return NOTIFY_STOP; |
2007 | |
2008 | err_put_larval: |
2009 | diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c |
2010 | index e2c8ab408bed..4c3bdffe0c3a 100644 |
2011 | --- a/crypto/algif_skcipher.c |
2012 | +++ b/crypto/algif_skcipher.c |
2013 | @@ -74,14 +74,10 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg, |
2014 | return PTR_ERR(areq); |
2015 | |
2016 | /* convert iovecs of output buffers into RX SGL */ |
2017 | - err = af_alg_get_rsgl(sk, msg, flags, areq, -1, &len); |
2018 | + err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len); |
2019 | if (err) |
2020 | goto free; |
2021 | |
2022 | - /* Process only as much RX buffers for which we have TX data */ |
2023 | - if (len > ctx->used) |
2024 | - len = ctx->used; |
2025 | - |
2026 | /* |
2027 | * If more buffers are to be expected to be processed, process only |
2028 | * full block size buffers. |
2029 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
2030 | index 581595b35573..35f75c691d7c 100644 |
2031 | --- a/drivers/ata/libata-core.c |
2032 | +++ b/drivers/ata/libata-core.c |
2033 | @@ -41,7 +41,6 @@ |
2034 | #include <linux/workqueue.h> |
2035 | #include <linux/scatterlist.h> |
2036 | #include <linux/io.h> |
2037 | -#include <linux/async.h> |
2038 | #include <linux/log2.h> |
2039 | #include <linux/slab.h> |
2040 | #include <linux/glob.h> |
2041 | @@ -6592,7 +6591,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) |
2042 | /* perform each probe asynchronously */ |
2043 | for (i = 0; i < host->n_ports; i++) { |
2044 | struct ata_port *ap = host->ports[i]; |
2045 | - async_schedule(async_port_probe, ap); |
2046 | + ap->cookie = async_schedule(async_port_probe, ap); |
2047 | } |
2048 | |
2049 | return 0; |
2050 | @@ -6732,11 +6731,11 @@ void ata_host_detach(struct ata_host *host) |
2051 | { |
2052 | int i; |
2053 | |
2054 | - /* Ensure ata_port probe has completed */ |
2055 | - async_synchronize_full(); |
2056 | - |
2057 | - for (i = 0; i < host->n_ports; i++) |
2058 | + for (i = 0; i < host->n_ports; i++) { |
2059 | + /* Ensure ata_port probe has completed */ |
2060 | + async_synchronize_cookie(host->ports[i]->cookie + 1); |
2061 | ata_port_detach(host->ports[i]); |
2062 | + } |
2063 | |
2064 | /* the host is dead now, dissociate ACPI */ |
2065 | ata_acpi_dissociate(host); |
2066 | diff --git a/drivers/base/platform.c b/drivers/base/platform.c |
2067 | index 604a461848c9..0b67d41bab8f 100644 |
2068 | --- a/drivers/base/platform.c |
2069 | +++ b/drivers/base/platform.c |
2070 | @@ -802,6 +802,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, |
2071 | /* temporary section violation during probe() */ |
2072 | drv->probe = probe; |
2073 | retval = code = __platform_driver_register(drv, module); |
2074 | + if (retval) |
2075 | + return retval; |
2076 | |
2077 | /* |
2078 | * Fixup that section violation, being paranoid about code scanning |
2079 | diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c |
2080 | index c5c6487a19d5..7b55811c2a81 100644 |
2081 | --- a/drivers/block/ps3disk.c |
2082 | +++ b/drivers/block/ps3disk.c |
2083 | @@ -454,7 +454,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev) |
2084 | queue->queuedata = dev; |
2085 | |
2086 | blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9); |
2087 | - blk_queue_segment_boundary(queue, -1UL); |
2088 | blk_queue_dma_alignment(queue, dev->blk_size-1); |
2089 | blk_queue_logical_block_size(queue, dev->blk_size); |
2090 | |
2091 | diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
2092 | index 90f5292e2051..ac656a6d5daf 100644 |
2093 | --- a/drivers/char/ipmi/ipmi_msghandler.c |
2094 | +++ b/drivers/char/ipmi/ipmi_msghandler.c |
2095 | @@ -33,6 +33,7 @@ |
2096 | #include <linux/workqueue.h> |
2097 | #include <linux/uuid.h> |
2098 | #include <linux/nospec.h> |
2099 | +#include <linux/vmalloc.h> |
2100 | |
2101 | #define IPMI_DRIVER_VERSION "39.2" |
2102 | |
2103 | @@ -1170,7 +1171,7 @@ static void free_user_work(struct work_struct *work) |
2104 | remove_work); |
2105 | |
2106 | cleanup_srcu_struct(&user->release_barrier); |
2107 | - kfree(user); |
2108 | + vfree(user); |
2109 | } |
2110 | |
2111 | int ipmi_create_user(unsigned int if_num, |
2112 | @@ -1202,7 +1203,7 @@ int ipmi_create_user(unsigned int if_num, |
2113 | if (rv) |
2114 | return rv; |
2115 | |
2116 | - new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
2117 | + new_user = vzalloc(sizeof(*new_user)); |
2118 | if (!new_user) |
2119 | return -ENOMEM; |
2120 | |
2121 | @@ -1249,7 +1250,7 @@ int ipmi_create_user(unsigned int if_num, |
2122 | |
2123 | out_kfree: |
2124 | srcu_read_unlock(&ipmi_interfaces_srcu, index); |
2125 | - kfree(new_user); |
2126 | + vfree(new_user); |
2127 | return rv; |
2128 | } |
2129 | EXPORT_SYMBOL(ipmi_create_user); |
2130 | diff --git a/drivers/char/mem.c b/drivers/char/mem.c |
2131 | index 43dd0891ca1e..31cae88a730b 100644 |
2132 | --- a/drivers/char/mem.c |
2133 | +++ b/drivers/char/mem.c |
2134 | @@ -31,11 +31,15 @@ |
2135 | #include <linux/uio.h> |
2136 | #include <linux/uaccess.h> |
2137 | #include <linux/security.h> |
2138 | +#include <linux/pseudo_fs.h> |
2139 | +#include <uapi/linux/magic.h> |
2140 | +#include <linux/mount.h> |
2141 | |
2142 | #ifdef CONFIG_IA64 |
2143 | # include <linux/efi.h> |
2144 | #endif |
2145 | |
2146 | +#define DEVMEM_MINOR 1 |
2147 | #define DEVPORT_MINOR 4 |
2148 | |
2149 | static inline unsigned long size_inside_page(unsigned long start, |
2150 | @@ -805,12 +809,64 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) |
2151 | return ret; |
2152 | } |
2153 | |
2154 | +static struct inode *devmem_inode; |
2155 | + |
2156 | +#ifdef CONFIG_IO_STRICT_DEVMEM |
2157 | +void revoke_devmem(struct resource *res) |
2158 | +{ |
2159 | + struct inode *inode = READ_ONCE(devmem_inode); |
2160 | + |
2161 | + /* |
2162 | + * Check that the initialization has completed. Losing the race |
2163 | + * is ok because it means drivers are claiming resources before |
2164 | + * the fs_initcall level of init and prevent /dev/mem from |
2165 | + * establishing mappings. |
2166 | + */ |
2167 | + if (!inode) |
2168 | + return; |
2169 | + |
2170 | + /* |
2171 | + * The expectation is that the driver has successfully marked |
2172 | + * the resource busy by this point, so devmem_is_allowed() |
2173 | + * should start returning false, however for performance this |
2174 | + * does not iterate the entire resource range. |
2175 | + */ |
2176 | + if (devmem_is_allowed(PHYS_PFN(res->start)) && |
2177 | + devmem_is_allowed(PHYS_PFN(res->end))) { |
2178 | + /* |
2179 | + * *cringe* iomem=relaxed says "go ahead, what's the |
2180 | + * worst that can happen?" |
2181 | + */ |
2182 | + return; |
2183 | + } |
2184 | + |
2185 | + unmap_mapping_range(inode->i_mapping, res->start, resource_size(res), 1); |
2186 | +} |
2187 | +#endif |
2188 | + |
2189 | static int open_port(struct inode *inode, struct file *filp) |
2190 | { |
2191 | + int rc; |
2192 | + |
2193 | if (!capable(CAP_SYS_RAWIO)) |
2194 | return -EPERM; |
2195 | |
2196 | - return security_locked_down(LOCKDOWN_DEV_MEM); |
2197 | + rc = security_locked_down(LOCKDOWN_DEV_MEM); |
2198 | + if (rc) |
2199 | + return rc; |
2200 | + |
2201 | + if (iminor(inode) != DEVMEM_MINOR) |
2202 | + return 0; |
2203 | + |
2204 | + /* |
2205 | + * Use a unified address space to have a single point to manage |
2206 | + * revocations when drivers want to take over a /dev/mem mapped |
2207 | + * range. |
2208 | + */ |
2209 | + inode->i_mapping = devmem_inode->i_mapping; |
2210 | + filp->f_mapping = inode->i_mapping; |
2211 | + |
2212 | + return 0; |
2213 | } |
2214 | |
2215 | #define zero_lseek null_lseek |
2216 | @@ -885,7 +941,7 @@ static const struct memdev { |
2217 | fmode_t fmode; |
2218 | } devlist[] = { |
2219 | #ifdef CONFIG_DEVMEM |
2220 | - [1] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET }, |
2221 | + [DEVMEM_MINOR] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET }, |
2222 | #endif |
2223 | #ifdef CONFIG_DEVKMEM |
2224 | [2] = { "kmem", 0, &kmem_fops, FMODE_UNSIGNED_OFFSET }, |
2225 | @@ -939,6 +995,45 @@ static char *mem_devnode(struct device *dev, umode_t *mode) |
2226 | |
2227 | static struct class *mem_class; |
2228 | |
2229 | +static int devmem_fs_init_fs_context(struct fs_context *fc) |
2230 | +{ |
2231 | + return init_pseudo(fc, DEVMEM_MAGIC) ? 0 : -ENOMEM; |
2232 | +} |
2233 | + |
2234 | +static struct file_system_type devmem_fs_type = { |
2235 | + .name = "devmem", |
2236 | + .owner = THIS_MODULE, |
2237 | + .init_fs_context = devmem_fs_init_fs_context, |
2238 | + .kill_sb = kill_anon_super, |
2239 | +}; |
2240 | + |
2241 | +static int devmem_init_inode(void) |
2242 | +{ |
2243 | + static struct vfsmount *devmem_vfs_mount; |
2244 | + static int devmem_fs_cnt; |
2245 | + struct inode *inode; |
2246 | + int rc; |
2247 | + |
2248 | + rc = simple_pin_fs(&devmem_fs_type, &devmem_vfs_mount, &devmem_fs_cnt); |
2249 | + if (rc < 0) { |
2250 | + pr_err("Cannot mount /dev/mem pseudo filesystem: %d\n", rc); |
2251 | + return rc; |
2252 | + } |
2253 | + |
2254 | + inode = alloc_anon_inode(devmem_vfs_mount->mnt_sb); |
2255 | + if (IS_ERR(inode)) { |
2256 | + rc = PTR_ERR(inode); |
2257 | + pr_err("Cannot allocate inode for /dev/mem: %d\n", rc); |
2258 | + simple_release_fs(&devmem_vfs_mount, &devmem_fs_cnt); |
2259 | + return rc; |
2260 | + } |
2261 | + |
2262 | + /* publish /dev/mem initialized */ |
2263 | + WRITE_ONCE(devmem_inode, inode); |
2264 | + |
2265 | + return 0; |
2266 | +} |
2267 | + |
2268 | static int __init chr_dev_init(void) |
2269 | { |
2270 | int minor; |
2271 | @@ -960,6 +1055,8 @@ static int __init chr_dev_init(void) |
2272 | */ |
2273 | if ((minor == DEVPORT_MINOR) && !arch_has_dev_port()) |
2274 | continue; |
2275 | + if ((minor == DEVMEM_MINOR) && devmem_init_inode() != 0) |
2276 | + continue; |
2277 | |
2278 | device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor), |
2279 | NULL, devlist[minor].name); |
2280 | diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
2281 | index 802e488fd3c3..6e5d635f030f 100644 |
2282 | --- a/drivers/clk/bcm/clk-bcm2835.c |
2283 | +++ b/drivers/clk/bcm/clk-bcm2835.c |
2284 | @@ -1448,13 +1448,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, |
2285 | return &clock->hw; |
2286 | } |
2287 | |
2288 | -static struct clk *bcm2835_register_gate(struct bcm2835_cprman *cprman, |
2289 | +static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman, |
2290 | const struct bcm2835_gate_data *data) |
2291 | { |
2292 | - return clk_register_gate(cprman->dev, data->name, data->parent, |
2293 | - CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
2294 | - cprman->regs + data->ctl_reg, |
2295 | - CM_GATE_BIT, 0, &cprman->regs_lock); |
2296 | + return clk_hw_register_gate(cprman->dev, data->name, data->parent, |
2297 | + CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
2298 | + cprman->regs + data->ctl_reg, |
2299 | + CM_GATE_BIT, 0, &cprman->regs_lock); |
2300 | } |
2301 | |
2302 | typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman, |
2303 | diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c |
2304 | index b1318e6b655b..675cab6fa781 100644 |
2305 | --- a/drivers/clk/clk-ast2600.c |
2306 | +++ b/drivers/clk/clk-ast2600.c |
2307 | @@ -599,14 +599,22 @@ static const u32 ast2600_a0_axi_ahb_div_table[] = { |
2308 | 2, 2, 3, 5, |
2309 | }; |
2310 | |
2311 | -static const u32 ast2600_a1_axi_ahb_div_table[] = { |
2312 | - 4, 6, 2, 4, |
2313 | +static const u32 ast2600_a1_axi_ahb_div0_tbl[] = { |
2314 | + 3, 2, 3, 4, |
2315 | +}; |
2316 | + |
2317 | +static const u32 ast2600_a1_axi_ahb_div1_tbl[] = { |
2318 | + 3, 4, 6, 8, |
2319 | +}; |
2320 | + |
2321 | +static const u32 ast2600_a1_axi_ahb200_tbl[] = { |
2322 | + 3, 4, 3, 4, 2, 2, 2, 2, |
2323 | }; |
2324 | |
2325 | static void __init aspeed_g6_cc(struct regmap *map) |
2326 | { |
2327 | struct clk_hw *hw; |
2328 | - u32 val, div, chip_id, axi_div, ahb_div; |
2329 | + u32 val, div, divbits, chip_id, axi_div, ahb_div; |
2330 | |
2331 | clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, 25000000); |
2332 | |
2333 | @@ -636,11 +644,22 @@ static void __init aspeed_g6_cc(struct regmap *map) |
2334 | else |
2335 | axi_div = 2; |
2336 | |
2337 | + divbits = (val >> 11) & 0x3; |
2338 | regmap_read(map, ASPEED_G6_SILICON_REV, &chip_id); |
2339 | - if (chip_id & BIT(16)) |
2340 | - ahb_div = ast2600_a1_axi_ahb_div_table[(val >> 11) & 0x3]; |
2341 | - else |
2342 | + if (chip_id & BIT(16)) { |
2343 | + if (!divbits) { |
2344 | + ahb_div = ast2600_a1_axi_ahb200_tbl[(val >> 8) & 0x3]; |
2345 | + if (val & BIT(16)) |
2346 | + ahb_div *= 2; |
2347 | + } else { |
2348 | + if (val & BIT(16)) |
2349 | + ahb_div = ast2600_a1_axi_ahb_div1_tbl[divbits]; |
2350 | + else |
2351 | + ahb_div = ast2600_a1_axi_ahb_div0_tbl[divbits]; |
2352 | + } |
2353 | + } else { |
2354 | ahb_div = ast2600_a0_axi_ahb_div_table[(val >> 11) & 0x3]; |
2355 | + } |
2356 | |
2357 | hw = clk_hw_register_fixed_factor(NULL, "ahb", "hpll", 0, 1, axi_div * ahb_div); |
2358 | aspeed_g6_clk_data->hws[ASPEED_CLK_AHB] = hw; |
2359 | diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c |
2360 | index 8856ce476ccf..082178a0f41a 100644 |
2361 | --- a/drivers/clk/meson/meson8b.c |
2362 | +++ b/drivers/clk/meson/meson8b.c |
2363 | @@ -1071,7 +1071,7 @@ static struct clk_regmap meson8b_vid_pll_in_sel = { |
2364 | * Meson8m2: vid2_pll |
2365 | */ |
2366 | .parent_hws = (const struct clk_hw *[]) { |
2367 | - &meson8b_hdmi_pll_dco.hw |
2368 | + &meson8b_hdmi_pll_lvds_out.hw |
2369 | }, |
2370 | .num_parents = 1, |
2371 | .flags = CLK_SET_RATE_PARENT, |
2372 | @@ -1207,7 +1207,7 @@ static struct clk_regmap meson8b_vclk_in_en = { |
2373 | |
2374 | static struct clk_regmap meson8b_vclk_div1_gate = { |
2375 | .data = &(struct clk_regmap_gate_data){ |
2376 | - .offset = HHI_VID_CLK_DIV, |
2377 | + .offset = HHI_VID_CLK_CNTL, |
2378 | .bit_idx = 0, |
2379 | }, |
2380 | .hw.init = &(struct clk_init_data){ |
2381 | @@ -1237,7 +1237,7 @@ static struct clk_fixed_factor meson8b_vclk_div2_div = { |
2382 | |
2383 | static struct clk_regmap meson8b_vclk_div2_div_gate = { |
2384 | .data = &(struct clk_regmap_gate_data){ |
2385 | - .offset = HHI_VID_CLK_DIV, |
2386 | + .offset = HHI_VID_CLK_CNTL, |
2387 | .bit_idx = 1, |
2388 | }, |
2389 | .hw.init = &(struct clk_init_data){ |
2390 | @@ -1267,7 +1267,7 @@ static struct clk_fixed_factor meson8b_vclk_div4_div = { |
2391 | |
2392 | static struct clk_regmap meson8b_vclk_div4_div_gate = { |
2393 | .data = &(struct clk_regmap_gate_data){ |
2394 | - .offset = HHI_VID_CLK_DIV, |
2395 | + .offset = HHI_VID_CLK_CNTL, |
2396 | .bit_idx = 2, |
2397 | }, |
2398 | .hw.init = &(struct clk_init_data){ |
2399 | @@ -1297,7 +1297,7 @@ static struct clk_fixed_factor meson8b_vclk_div6_div = { |
2400 | |
2401 | static struct clk_regmap meson8b_vclk_div6_div_gate = { |
2402 | .data = &(struct clk_regmap_gate_data){ |
2403 | - .offset = HHI_VID_CLK_DIV, |
2404 | + .offset = HHI_VID_CLK_CNTL, |
2405 | .bit_idx = 3, |
2406 | }, |
2407 | .hw.init = &(struct clk_init_data){ |
2408 | @@ -1327,7 +1327,7 @@ static struct clk_fixed_factor meson8b_vclk_div12_div = { |
2409 | |
2410 | static struct clk_regmap meson8b_vclk_div12_div_gate = { |
2411 | .data = &(struct clk_regmap_gate_data){ |
2412 | - .offset = HHI_VID_CLK_DIV, |
2413 | + .offset = HHI_VID_CLK_CNTL, |
2414 | .bit_idx = 4, |
2415 | }, |
2416 | .hw.init = &(struct clk_init_data){ |
2417 | @@ -1910,6 +1910,13 @@ static struct clk_regmap meson8b_mali = { |
2418 | }, |
2419 | }; |
2420 | |
2421 | +static const struct reg_sequence meson8m2_gp_pll_init_regs[] = { |
2422 | + { .reg = HHI_GP_PLL_CNTL2, .def = 0x59c88000 }, |
2423 | + { .reg = HHI_GP_PLL_CNTL3, .def = 0xca463823 }, |
2424 | + { .reg = HHI_GP_PLL_CNTL4, .def = 0x0286a027 }, |
2425 | + { .reg = HHI_GP_PLL_CNTL5, .def = 0x00003000 }, |
2426 | +}; |
2427 | + |
2428 | static const struct pll_params_table meson8m2_gp_pll_params_table[] = { |
2429 | PLL_PARAMS(182, 3), |
2430 | { /* sentinel */ }, |
2431 | @@ -1943,6 +1950,8 @@ static struct clk_regmap meson8m2_gp_pll_dco = { |
2432 | .width = 1, |
2433 | }, |
2434 | .table = meson8m2_gp_pll_params_table, |
2435 | + .init_regs = meson8m2_gp_pll_init_regs, |
2436 | + .init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs), |
2437 | }, |
2438 | .hw.init = &(struct clk_init_data){ |
2439 | .name = "gp_pll_dco", |
2440 | @@ -3491,54 +3500,87 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { |
2441 | static const struct meson8b_clk_reset_line { |
2442 | u32 reg; |
2443 | u8 bit_idx; |
2444 | + bool active_low; |
2445 | } meson8b_clk_reset_bits[] = { |
2446 | [CLKC_RESET_L2_CACHE_SOFT_RESET] = { |
2447 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30 |
2448 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2449 | + .bit_idx = 30, |
2450 | + .active_low = false, |
2451 | }, |
2452 | [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = { |
2453 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29 |
2454 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2455 | + .bit_idx = 29, |
2456 | + .active_low = false, |
2457 | }, |
2458 | [CLKC_RESET_SCU_SOFT_RESET] = { |
2459 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28 |
2460 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2461 | + .bit_idx = 28, |
2462 | + .active_low = false, |
2463 | }, |
2464 | [CLKC_RESET_CPU3_SOFT_RESET] = { |
2465 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27 |
2466 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2467 | + .bit_idx = 27, |
2468 | + .active_low = false, |
2469 | }, |
2470 | [CLKC_RESET_CPU2_SOFT_RESET] = { |
2471 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26 |
2472 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2473 | + .bit_idx = 26, |
2474 | + .active_low = false, |
2475 | }, |
2476 | [CLKC_RESET_CPU1_SOFT_RESET] = { |
2477 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25 |
2478 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2479 | + .bit_idx = 25, |
2480 | + .active_low = false, |
2481 | }, |
2482 | [CLKC_RESET_CPU0_SOFT_RESET] = { |
2483 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24 |
2484 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2485 | + .bit_idx = 24, |
2486 | + .active_low = false, |
2487 | }, |
2488 | [CLKC_RESET_A5_GLOBAL_RESET] = { |
2489 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18 |
2490 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2491 | + .bit_idx = 18, |
2492 | + .active_low = false, |
2493 | }, |
2494 | [CLKC_RESET_A5_AXI_SOFT_RESET] = { |
2495 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17 |
2496 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2497 | + .bit_idx = 17, |
2498 | + .active_low = false, |
2499 | }, |
2500 | [CLKC_RESET_A5_ABP_SOFT_RESET] = { |
2501 | - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16 |
2502 | + .reg = HHI_SYS_CPU_CLK_CNTL0, |
2503 | + .bit_idx = 16, |
2504 | + .active_low = false, |
2505 | }, |
2506 | [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = { |
2507 | - .reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30 |
2508 | + .reg = HHI_SYS_CPU_CLK_CNTL1, |
2509 | + .bit_idx = 30, |
2510 | + .active_low = false, |
2511 | }, |
2512 | [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = { |
2513 | - .reg = HHI_VID_CLK_CNTL, .bit_idx = 15 |
2514 | + .reg = HHI_VID_CLK_CNTL, |
2515 | + .bit_idx = 15, |
2516 | + .active_low = false, |
2517 | }, |
2518 | [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = { |
2519 | - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7 |
2520 | + .reg = HHI_VID_DIVIDER_CNTL, |
2521 | + .bit_idx = 7, |
2522 | + .active_low = false, |
2523 | }, |
2524 | [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = { |
2525 | - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3 |
2526 | + .reg = HHI_VID_DIVIDER_CNTL, |
2527 | + .bit_idx = 3, |
2528 | + .active_low = false, |
2529 | }, |
2530 | [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = { |
2531 | - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1 |
2532 | + .reg = HHI_VID_DIVIDER_CNTL, |
2533 | + .bit_idx = 1, |
2534 | + .active_low = true, |
2535 | }, |
2536 | [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = { |
2537 | - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0 |
2538 | + .reg = HHI_VID_DIVIDER_CNTL, |
2539 | + .bit_idx = 0, |
2540 | + .active_low = true, |
2541 | }, |
2542 | }; |
2543 | |
2544 | @@ -3547,22 +3589,22 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev, |
2545 | { |
2546 | struct meson8b_clk_reset *meson8b_clk_reset = |
2547 | container_of(rcdev, struct meson8b_clk_reset, reset); |
2548 | - unsigned long flags; |
2549 | const struct meson8b_clk_reset_line *reset; |
2550 | + unsigned int value = 0; |
2551 | + unsigned long flags; |
2552 | |
2553 | if (id >= ARRAY_SIZE(meson8b_clk_reset_bits)) |
2554 | return -EINVAL; |
2555 | |
2556 | reset = &meson8b_clk_reset_bits[id]; |
2557 | |
2558 | + if (assert != reset->active_low) |
2559 | + value = BIT(reset->bit_idx); |
2560 | + |
2561 | spin_lock_irqsave(&meson_clk_lock, flags); |
2562 | |
2563 | - if (assert) |
2564 | - regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
2565 | - BIT(reset->bit_idx), BIT(reset->bit_idx)); |
2566 | - else |
2567 | - regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
2568 | - BIT(reset->bit_idx), 0); |
2569 | + regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
2570 | + BIT(reset->bit_idx), value); |
2571 | |
2572 | spin_unlock_irqrestore(&meson_clk_lock, flags); |
2573 | |
2574 | diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h |
2575 | index c889fbeec30f..c91fb07fcb65 100644 |
2576 | --- a/drivers/clk/meson/meson8b.h |
2577 | +++ b/drivers/clk/meson/meson8b.h |
2578 | @@ -20,6 +20,10 @@ |
2579 | * [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf |
2580 | */ |
2581 | #define HHI_GP_PLL_CNTL 0x40 /* 0x10 offset in data sheet */ |
2582 | +#define HHI_GP_PLL_CNTL2 0x44 /* 0x11 offset in data sheet */ |
2583 | +#define HHI_GP_PLL_CNTL3 0x48 /* 0x12 offset in data sheet */ |
2584 | +#define HHI_GP_PLL_CNTL4 0x4C /* 0x13 offset in data sheet */ |
2585 | +#define HHI_GP_PLL_CNTL5 0x50 /* 0x14 offset in data sheet */ |
2586 | #define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */ |
2587 | #define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */ |
2588 | #define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */ |
2589 | diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c |
2590 | index 4e329a7baf2b..17e4a5a2a9fd 100644 |
2591 | --- a/drivers/clk/qcom/gcc-msm8916.c |
2592 | +++ b/drivers/clk/qcom/gcc-msm8916.c |
2593 | @@ -260,7 +260,7 @@ static struct clk_pll gpll0 = { |
2594 | .l_reg = 0x21004, |
2595 | .m_reg = 0x21008, |
2596 | .n_reg = 0x2100c, |
2597 | - .config_reg = 0x21014, |
2598 | + .config_reg = 0x21010, |
2599 | .mode_reg = 0x21000, |
2600 | .status_reg = 0x2101c, |
2601 | .status_bit = 17, |
2602 | @@ -287,7 +287,7 @@ static struct clk_pll gpll1 = { |
2603 | .l_reg = 0x20004, |
2604 | .m_reg = 0x20008, |
2605 | .n_reg = 0x2000c, |
2606 | - .config_reg = 0x20014, |
2607 | + .config_reg = 0x20010, |
2608 | .mode_reg = 0x20000, |
2609 | .status_reg = 0x2001c, |
2610 | .status_bit = 17, |
2611 | @@ -314,7 +314,7 @@ static struct clk_pll gpll2 = { |
2612 | .l_reg = 0x4a004, |
2613 | .m_reg = 0x4a008, |
2614 | .n_reg = 0x4a00c, |
2615 | - .config_reg = 0x4a014, |
2616 | + .config_reg = 0x4a010, |
2617 | .mode_reg = 0x4a000, |
2618 | .status_reg = 0x4a01c, |
2619 | .status_bit = 17, |
2620 | @@ -341,7 +341,7 @@ static struct clk_pll bimc_pll = { |
2621 | .l_reg = 0x23004, |
2622 | .m_reg = 0x23008, |
2623 | .n_reg = 0x2300c, |
2624 | - .config_reg = 0x23014, |
2625 | + .config_reg = 0x23010, |
2626 | .mode_reg = 0x23000, |
2627 | .status_reg = 0x2301c, |
2628 | .status_bit = 17, |
2629 | diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c |
2630 | index 132cc96895e3..6f9612c169af 100644 |
2631 | --- a/drivers/clk/renesas/renesas-cpg-mssr.c |
2632 | +++ b/drivers/clk/renesas/renesas-cpg-mssr.c |
2633 | @@ -800,7 +800,8 @@ static int cpg_mssr_suspend_noirq(struct device *dev) |
2634 | /* Save module registers with bits under our control */ |
2635 | for (reg = 0; reg < ARRAY_SIZE(priv->smstpcr_saved); reg++) { |
2636 | if (priv->smstpcr_saved[reg].mask) |
2637 | - priv->smstpcr_saved[reg].val = |
2638 | + priv->smstpcr_saved[reg].val = priv->stbyctrl ? |
2639 | + readb(priv->base + STBCR(reg)) : |
2640 | readl(priv->base + SMSTPCR(reg)); |
2641 | } |
2642 | |
2643 | @@ -860,8 +861,9 @@ static int cpg_mssr_resume_noirq(struct device *dev) |
2644 | } |
2645 | |
2646 | if (!i) |
2647 | - dev_warn(dev, "Failed to enable SMSTP %p[0x%x]\n", |
2648 | - priv->base + SMSTPCR(reg), oldval & mask); |
2649 | + dev_warn(dev, "Failed to enable %s%u[0x%x]\n", |
2650 | + priv->stbyctrl ? "STB" : "SMSTP", reg, |
2651 | + oldval & mask); |
2652 | } |
2653 | |
2654 | return 0; |
2655 | diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c |
2656 | index 27fd274e92f8..dfef5f0833db 100644 |
2657 | --- a/drivers/clk/samsung/clk-exynos5420.c |
2658 | +++ b/drivers/clk/samsung/clk-exynos5420.c |
2659 | @@ -540,7 +540,7 @@ static const struct samsung_div_clock exynos5800_div_clks[] __initconst = { |
2660 | |
2661 | static const struct samsung_gate_clock exynos5800_gate_clks[] __initconst = { |
2662 | GATE(CLK_ACLK550_CAM, "aclk550_cam", "mout_user_aclk550_cam", |
2663 | - GATE_BUS_TOP, 24, 0, 0), |
2664 | + GATE_BUS_TOP, 24, CLK_IS_CRITICAL, 0), |
2665 | GATE(CLK_ACLK432_SCALER, "aclk432_scaler", "mout_user_aclk432_scaler", |
2666 | GATE_BUS_TOP, 27, CLK_IS_CRITICAL, 0), |
2667 | }; |
2668 | @@ -940,25 +940,25 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { |
2669 | GATE(0, "aclk300_jpeg", "mout_user_aclk300_jpeg", |
2670 | GATE_BUS_TOP, 4, CLK_IGNORE_UNUSED, 0), |
2671 | GATE(0, "aclk333_432_isp0", "mout_user_aclk333_432_isp0", |
2672 | - GATE_BUS_TOP, 5, 0, 0), |
2673 | + GATE_BUS_TOP, 5, CLK_IS_CRITICAL, 0), |
2674 | GATE(0, "aclk300_gscl", "mout_user_aclk300_gscl", |
2675 | GATE_BUS_TOP, 6, CLK_IS_CRITICAL, 0), |
2676 | GATE(0, "aclk333_432_gscl", "mout_user_aclk333_432_gscl", |
2677 | GATE_BUS_TOP, 7, CLK_IGNORE_UNUSED, 0), |
2678 | GATE(0, "aclk333_432_isp", "mout_user_aclk333_432_isp", |
2679 | - GATE_BUS_TOP, 8, 0, 0), |
2680 | + GATE_BUS_TOP, 8, CLK_IS_CRITICAL, 0), |
2681 | GATE(CLK_PCLK66_GPIO, "pclk66_gpio", "mout_user_pclk66_gpio", |
2682 | GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), |
2683 | GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", |
2684 | GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), |
2685 | GATE(0, "aclk266_isp", "mout_user_aclk266_isp", |
2686 | - GATE_BUS_TOP, 13, 0, 0), |
2687 | + GATE_BUS_TOP, 13, CLK_IS_CRITICAL, 0), |
2688 | GATE(0, "aclk166", "mout_user_aclk166", |
2689 | GATE_BUS_TOP, 14, CLK_IGNORE_UNUSED, 0), |
2690 | GATE(CLK_ACLK333, "aclk333", "mout_user_aclk333", |
2691 | GATE_BUS_TOP, 15, CLK_IS_CRITICAL, 0), |
2692 | GATE(0, "aclk400_isp", "mout_user_aclk400_isp", |
2693 | - GATE_BUS_TOP, 16, 0, 0), |
2694 | + GATE_BUS_TOP, 16, CLK_IS_CRITICAL, 0), |
2695 | GATE(0, "aclk400_mscl", "mout_user_aclk400_mscl", |
2696 | GATE_BUS_TOP, 17, CLK_IS_CRITICAL, 0), |
2697 | GATE(0, "aclk200_disp1", "mout_user_aclk200_disp1", |
2698 | @@ -1158,8 +1158,10 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { |
2699 | GATE_IP_GSCL1, 3, 0, 0), |
2700 | GATE(CLK_SMMU_FIMCL1, "smmu_fimcl1", "dout_gscl_blk_333", |
2701 | GATE_IP_GSCL1, 4, 0, 0), |
2702 | - GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, 0, 0), |
2703 | - GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, 0, 0), |
2704 | + GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, |
2705 | + CLK_IS_CRITICAL, 0), |
2706 | + GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, |
2707 | + CLK_IS_CRITICAL, 0), |
2708 | GATE(CLK_SMMU_FIMCL3, "smmu_fimcl3,", "dout_gscl_blk_333", |
2709 | GATE_IP_GSCL1, 16, 0, 0), |
2710 | GATE(CLK_FIMC_LITE3, "fimc_lite3", "aclk333_432_gscl", |
2711 | diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c |
2712 | index 4b1aa9382ad2..6f29ecd0442e 100644 |
2713 | --- a/drivers/clk/samsung/clk-exynos5433.c |
2714 | +++ b/drivers/clk/samsung/clk-exynos5433.c |
2715 | @@ -1706,7 +1706,8 @@ static const struct samsung_gate_clock peric_gate_clks[] __initconst = { |
2716 | GATE(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_pcm1_peric", |
2717 | ENABLE_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0), |
2718 | GATE(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_i2s1_peric", |
2719 | - ENABLE_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0), |
2720 | + ENABLE_SCLK_PERIC, 6, |
2721 | + CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0), |
2722 | GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC, |
2723 | 5, CLK_SET_RATE_PARENT, 0), |
2724 | GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC, |
2725 | diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c |
2726 | index 640270f51aa5..eb8862752c2b 100644 |
2727 | --- a/drivers/clk/sprd/pll.c |
2728 | +++ b/drivers/clk/sprd/pll.c |
2729 | @@ -105,7 +105,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, |
2730 | |
2731 | cfg = kcalloc(regs_num, sizeof(*cfg), GFP_KERNEL); |
2732 | if (!cfg) |
2733 | - return -ENOMEM; |
2734 | + return parent_rate; |
2735 | |
2736 | for (i = 0; i < regs_num; i++) |
2737 | cfg[i] = sprd_pll_read(pll, i); |
2738 | diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c |
2739 | index 4413b6e04a8e..55873d4b7603 100644 |
2740 | --- a/drivers/clk/st/clk-flexgen.c |
2741 | +++ b/drivers/clk/st/clk-flexgen.c |
2742 | @@ -375,6 +375,7 @@ static void __init st_of_flexgen_setup(struct device_node *np) |
2743 | break; |
2744 | } |
2745 | |
2746 | + flex_flags &= ~CLK_IS_CRITICAL; |
2747 | of_clk_detect_critical(np, i, &flex_flags); |
2748 | |
2749 | /* |
2750 | diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c |
2751 | index 27201fd26e44..e1aa1fbac48a 100644 |
2752 | --- a/drivers/clk/sunxi/clk-sunxi.c |
2753 | +++ b/drivers/clk/sunxi/clk-sunxi.c |
2754 | @@ -90,7 +90,7 @@ static void sun6i_a31_get_pll1_factors(struct factors_request *req) |
2755 | * Round down the frequency to the closest multiple of either |
2756 | * 6 or 16 |
2757 | */ |
2758 | - u32 round_freq_6 = round_down(freq_mhz, 6); |
2759 | + u32 round_freq_6 = rounddown(freq_mhz, 6); |
2760 | u32 round_freq_16 = round_down(freq_mhz, 16); |
2761 | |
2762 | if (round_freq_6 > round_freq_16) |
2763 | diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c |
2764 | index 6a89936ba03a..eaa43575cfa5 100644 |
2765 | --- a/drivers/clk/ti/composite.c |
2766 | +++ b/drivers/clk/ti/composite.c |
2767 | @@ -196,6 +196,7 @@ cleanup: |
2768 | if (!cclk->comp_clks[i]) |
2769 | continue; |
2770 | list_del(&cclk->comp_clks[i]->link); |
2771 | + kfree(cclk->comp_clks[i]->parent_names); |
2772 | kfree(cclk->comp_clks[i]); |
2773 | } |
2774 | |
2775 | diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c |
2776 | index a11f93ecbf34..6f057ab9df03 100644 |
2777 | --- a/drivers/clk/zynqmp/clkc.c |
2778 | +++ b/drivers/clk/zynqmp/clkc.c |
2779 | @@ -558,7 +558,7 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
2780 | { |
2781 | int j; |
2782 | u32 num_nodes, clk_dev_id; |
2783 | - char *clk_out = NULL; |
2784 | + char *clk_out[MAX_NODES]; |
2785 | struct clock_topology *nodes; |
2786 | struct clk_hw *hw = NULL; |
2787 | |
2788 | @@ -572,16 +572,16 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
2789 | * Intermediate clock names are postfixed with type of clock. |
2790 | */ |
2791 | if (j != (num_nodes - 1)) { |
2792 | - clk_out = kasprintf(GFP_KERNEL, "%s%s", clk_name, |
2793 | + clk_out[j] = kasprintf(GFP_KERNEL, "%s%s", clk_name, |
2794 | clk_type_postfix[nodes[j].type]); |
2795 | } else { |
2796 | - clk_out = kasprintf(GFP_KERNEL, "%s", clk_name); |
2797 | + clk_out[j] = kasprintf(GFP_KERNEL, "%s", clk_name); |
2798 | } |
2799 | |
2800 | if (!clk_topology[nodes[j].type]) |
2801 | continue; |
2802 | |
2803 | - hw = (*clk_topology[nodes[j].type])(clk_out, clk_dev_id, |
2804 | + hw = (*clk_topology[nodes[j].type])(clk_out[j], clk_dev_id, |
2805 | parent_names, |
2806 | num_parents, |
2807 | &nodes[j]); |
2808 | @@ -590,9 +590,12 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
2809 | __func__, clk_dev_id, clk_name, |
2810 | PTR_ERR(hw)); |
2811 | |
2812 | - parent_names[0] = clk_out; |
2813 | + parent_names[0] = clk_out[j]; |
2814 | } |
2815 | - kfree(clk_out); |
2816 | + |
2817 | + for (j = 0; j < num_nodes; j++) |
2818 | + kfree(clk_out[j]); |
2819 | + |
2820 | return hw; |
2821 | } |
2822 | |
2823 | diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
2824 | index ac80bc6af093..aba5db3c0588 100644 |
2825 | --- a/drivers/crypto/omap-sham.c |
2826 | +++ b/drivers/crypto/omap-sham.c |
2827 | @@ -165,8 +165,6 @@ struct omap_sham_hmac_ctx { |
2828 | }; |
2829 | |
2830 | struct omap_sham_ctx { |
2831 | - struct omap_sham_dev *dd; |
2832 | - |
2833 | unsigned long flags; |
2834 | |
2835 | /* fallback stuff */ |
2836 | @@ -918,27 +916,35 @@ static int omap_sham_update_dma_stop(struct omap_sham_dev *dd) |
2837 | return 0; |
2838 | } |
2839 | |
2840 | +struct omap_sham_dev *omap_sham_find_dev(struct omap_sham_reqctx *ctx) |
2841 | +{ |
2842 | + struct omap_sham_dev *dd; |
2843 | + |
2844 | + if (ctx->dd) |
2845 | + return ctx->dd; |
2846 | + |
2847 | + spin_lock_bh(&sham.lock); |
2848 | + dd = list_first_entry(&sham.dev_list, struct omap_sham_dev, list); |
2849 | + list_move_tail(&dd->list, &sham.dev_list); |
2850 | + ctx->dd = dd; |
2851 | + spin_unlock_bh(&sham.lock); |
2852 | + |
2853 | + return dd; |
2854 | +} |
2855 | + |
2856 | static int omap_sham_init(struct ahash_request *req) |
2857 | { |
2858 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
2859 | struct omap_sham_ctx *tctx = crypto_ahash_ctx(tfm); |
2860 | struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
2861 | - struct omap_sham_dev *dd = NULL, *tmp; |
2862 | + struct omap_sham_dev *dd; |
2863 | int bs = 0; |
2864 | |
2865 | - spin_lock_bh(&sham.lock); |
2866 | - if (!tctx->dd) { |
2867 | - list_for_each_entry(tmp, &sham.dev_list, list) { |
2868 | - dd = tmp; |
2869 | - break; |
2870 | - } |
2871 | - tctx->dd = dd; |
2872 | - } else { |
2873 | - dd = tctx->dd; |
2874 | - } |
2875 | - spin_unlock_bh(&sham.lock); |
2876 | + ctx->dd = NULL; |
2877 | |
2878 | - ctx->dd = dd; |
2879 | + dd = omap_sham_find_dev(ctx); |
2880 | + if (!dd) |
2881 | + return -ENODEV; |
2882 | |
2883 | ctx->flags = 0; |
2884 | |
2885 | @@ -1187,8 +1193,7 @@ err1: |
2886 | static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) |
2887 | { |
2888 | struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
2889 | - struct omap_sham_ctx *tctx = crypto_tfm_ctx(req->base.tfm); |
2890 | - struct omap_sham_dev *dd = tctx->dd; |
2891 | + struct omap_sham_dev *dd = ctx->dd; |
2892 | |
2893 | ctx->op = op; |
2894 | |
2895 | @@ -1198,7 +1203,7 @@ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) |
2896 | static int omap_sham_update(struct ahash_request *req) |
2897 | { |
2898 | struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
2899 | - struct omap_sham_dev *dd = ctx->dd; |
2900 | + struct omap_sham_dev *dd = omap_sham_find_dev(ctx); |
2901 | |
2902 | if (!req->nbytes) |
2903 | return 0; |
2904 | @@ -1302,21 +1307,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, |
2905 | struct omap_sham_hmac_ctx *bctx = tctx->base; |
2906 | int bs = crypto_shash_blocksize(bctx->shash); |
2907 | int ds = crypto_shash_digestsize(bctx->shash); |
2908 | - struct omap_sham_dev *dd = NULL, *tmp; |
2909 | int err, i; |
2910 | |
2911 | - spin_lock_bh(&sham.lock); |
2912 | - if (!tctx->dd) { |
2913 | - list_for_each_entry(tmp, &sham.dev_list, list) { |
2914 | - dd = tmp; |
2915 | - break; |
2916 | - } |
2917 | - tctx->dd = dd; |
2918 | - } else { |
2919 | - dd = tctx->dd; |
2920 | - } |
2921 | - spin_unlock_bh(&sham.lock); |
2922 | - |
2923 | err = crypto_shash_setkey(tctx->fallback, key, keylen); |
2924 | if (err) |
2925 | return err; |
2926 | @@ -1334,7 +1326,7 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, |
2927 | |
2928 | memset(bctx->ipad + keylen, 0, bs - keylen); |
2929 | |
2930 | - if (!test_bit(FLAGS_AUTO_XOR, &dd->flags)) { |
2931 | + if (!test_bit(FLAGS_AUTO_XOR, &sham.flags)) { |
2932 | memcpy(bctx->opad, bctx->ipad, bs); |
2933 | |
2934 | for (i = 0; i < bs; i++) { |
2935 | @@ -2136,6 +2128,7 @@ static int omap_sham_probe(struct platform_device *pdev) |
2936 | } |
2937 | |
2938 | dd->flags |= dd->pdata->flags; |
2939 | + sham.flags |= dd->pdata->flags; |
2940 | |
2941 | pm_runtime_use_autosuspend(dev); |
2942 | pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); |
2943 | @@ -2163,6 +2156,9 @@ static int omap_sham_probe(struct platform_device *pdev) |
2944 | spin_unlock(&sham.lock); |
2945 | |
2946 | for (i = 0; i < dd->pdata->algs_info_size; i++) { |
2947 | + if (dd->pdata->algs_info[i].registered) |
2948 | + break; |
2949 | + |
2950 | for (j = 0; j < dd->pdata->algs_info[i].size; j++) { |
2951 | struct ahash_alg *alg; |
2952 | |
2953 | @@ -2214,9 +2210,11 @@ static int omap_sham_remove(struct platform_device *pdev) |
2954 | list_del(&dd->list); |
2955 | spin_unlock(&sham.lock); |
2956 | for (i = dd->pdata->algs_info_size - 1; i >= 0; i--) |
2957 | - for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) |
2958 | + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) { |
2959 | crypto_unregister_ahash( |
2960 | &dd->pdata->algs_info[i].algs_list[j]); |
2961 | + dd->pdata->algs_info[i].registered--; |
2962 | + } |
2963 | tasklet_kill(&dd->done_task); |
2964 | pm_runtime_disable(&pdev->dev); |
2965 | |
2966 | diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c |
2967 | index ad02dc6747a4..0317b614b680 100644 |
2968 | --- a/drivers/extcon/extcon-adc-jack.c |
2969 | +++ b/drivers/extcon/extcon-adc-jack.c |
2970 | @@ -124,7 +124,7 @@ static int adc_jack_probe(struct platform_device *pdev) |
2971 | for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); |
2972 | data->num_conditions = i; |
2973 | |
2974 | - data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); |
2975 | + data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); |
2976 | if (IS_ERR(data->chan)) |
2977 | return PTR_ERR(data->chan); |
2978 | |
2979 | @@ -164,7 +164,6 @@ static int adc_jack_remove(struct platform_device *pdev) |
2980 | |
2981 | free_irq(data->irq, data); |
2982 | cancel_work_sync(&data->handler.work); |
2983 | - iio_channel_release(data->chan); |
2984 | |
2985 | return 0; |
2986 | } |
2987 | diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c |
2988 | index e48d971ffb61..a3b11bc71dcb 100644 |
2989 | --- a/drivers/firmware/imx/imx-scu.c |
2990 | +++ b/drivers/firmware/imx/imx-scu.c |
2991 | @@ -300,6 +300,7 @@ static int imx_scu_probe(struct platform_device *pdev) |
2992 | if (ret != -EPROBE_DEFER) |
2993 | dev_err(dev, "Failed to request mbox chan %s ret %d\n", |
2994 | chan_name, ret); |
2995 | + kfree(chan_name); |
2996 | return ret; |
2997 | } |
2998 | |
2999 | diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c |
3000 | index 4802ab170fe5..b9fdc20b4eb9 100644 |
3001 | --- a/drivers/firmware/qcom_scm.c |
3002 | +++ b/drivers/firmware/qcom_scm.c |
3003 | @@ -9,7 +9,6 @@ |
3004 | #include <linux/init.h> |
3005 | #include <linux/cpumask.h> |
3006 | #include <linux/export.h> |
3007 | -#include <linux/dma-direct.h> |
3008 | #include <linux/dma-mapping.h> |
3009 | #include <linux/module.h> |
3010 | #include <linux/types.h> |
3011 | @@ -441,8 +440,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
3012 | struct qcom_scm_mem_map_info *mem_to_map; |
3013 | phys_addr_t mem_to_map_phys; |
3014 | phys_addr_t dest_phys; |
3015 | - phys_addr_t ptr_phys; |
3016 | - dma_addr_t ptr_dma; |
3017 | + dma_addr_t ptr_phys; |
3018 | size_t mem_to_map_sz; |
3019 | size_t dest_sz; |
3020 | size_t src_sz; |
3021 | @@ -459,10 +457,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
3022 | ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) + |
3023 | ALIGN(dest_sz, SZ_64); |
3024 | |
3025 | - ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_dma, GFP_KERNEL); |
3026 | + ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL); |
3027 | if (!ptr) |
3028 | return -ENOMEM; |
3029 | - ptr_phys = dma_to_phys(__scm->dev, ptr_dma); |
3030 | |
3031 | /* Fill source vmid detail */ |
3032 | src = ptr; |
3033 | @@ -490,7 +487,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
3034 | |
3035 | ret = __qcom_scm_assign_mem(__scm->dev, mem_to_map_phys, mem_to_map_sz, |
3036 | ptr_phys, src_sz, dest_phys, dest_sz); |
3037 | - dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_dma); |
3038 | + dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_phys); |
3039 | if (ret) { |
3040 | dev_err(__scm->dev, |
3041 | "Assign memory protection call failed %d\n", ret); |
3042 | diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c |
3043 | index 62f924489db5..5942343a5d6e 100644 |
3044 | --- a/drivers/fpga/dfl-afu-dma-region.c |
3045 | +++ b/drivers/fpga/dfl-afu-dma-region.c |
3046 | @@ -61,10 +61,10 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata, |
3047 | region->pages); |
3048 | if (pinned < 0) { |
3049 | ret = pinned; |
3050 | - goto put_pages; |
3051 | + goto free_pages; |
3052 | } else if (pinned != npages) { |
3053 | ret = -EFAULT; |
3054 | - goto free_pages; |
3055 | + goto put_pages; |
3056 | } |
3057 | |
3058 | dev_dbg(dev, "%d pages pinned\n", pinned); |
3059 | diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c |
3060 | index 92e127e74813..ed6061b5cca1 100644 |
3061 | --- a/drivers/gpio/gpio-dwapb.c |
3062 | +++ b/drivers/gpio/gpio-dwapb.c |
3063 | @@ -49,7 +49,9 @@ |
3064 | #define GPIO_EXT_PORTC 0x58 |
3065 | #define GPIO_EXT_PORTD 0x5c |
3066 | |
3067 | +#define DWAPB_DRIVER_NAME "gpio-dwapb" |
3068 | #define DWAPB_MAX_PORTS 4 |
3069 | + |
3070 | #define GPIO_EXT_PORT_STRIDE 0x04 /* register stride 32 bits */ |
3071 | #define GPIO_SWPORT_DR_STRIDE 0x0c /* register stride 3*32 bits */ |
3072 | #define GPIO_SWPORT_DDR_STRIDE 0x0c /* register stride 3*32 bits */ |
3073 | @@ -398,7 +400,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, |
3074 | return; |
3075 | |
3076 | err = irq_alloc_domain_generic_chips(gpio->domain, ngpio, 2, |
3077 | - "gpio-dwapb", handle_level_irq, |
3078 | + DWAPB_DRIVER_NAME, handle_level_irq, |
3079 | IRQ_NOREQUEST, 0, |
3080 | IRQ_GC_INIT_NESTED_LOCK); |
3081 | if (err) { |
3082 | @@ -455,7 +457,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, |
3083 | */ |
3084 | err = devm_request_irq(gpio->dev, pp->irq[0], |
3085 | dwapb_irq_handler_mfd, |
3086 | - IRQF_SHARED, "gpio-dwapb-mfd", gpio); |
3087 | + IRQF_SHARED, DWAPB_DRIVER_NAME, gpio); |
3088 | if (err) { |
3089 | dev_err(gpio->dev, "error requesting IRQ\n"); |
3090 | irq_domain_remove(gpio->domain); |
3091 | @@ -533,26 +535,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, |
3092 | dwapb_configure_irqs(gpio, port, pp); |
3093 | |
3094 | err = gpiochip_add_data(&port->gc, port); |
3095 | - if (err) |
3096 | + if (err) { |
3097 | dev_err(gpio->dev, "failed to register gpiochip for port%d\n", |
3098 | port->idx); |
3099 | - else |
3100 | - port->is_registered = true; |
3101 | + return err; |
3102 | + } |
3103 | |
3104 | /* Add GPIO-signaled ACPI event support */ |
3105 | - if (pp->has_irq) |
3106 | - acpi_gpiochip_request_interrupts(&port->gc); |
3107 | + acpi_gpiochip_request_interrupts(&port->gc); |
3108 | |
3109 | - return err; |
3110 | + port->is_registered = true; |
3111 | + |
3112 | + return 0; |
3113 | } |
3114 | |
3115 | static void dwapb_gpio_unregister(struct dwapb_gpio *gpio) |
3116 | { |
3117 | unsigned int m; |
3118 | |
3119 | - for (m = 0; m < gpio->nr_ports; ++m) |
3120 | - if (gpio->ports[m].is_registered) |
3121 | - gpiochip_remove(&gpio->ports[m].gc); |
3122 | + for (m = 0; m < gpio->nr_ports; ++m) { |
3123 | + struct dwapb_gpio_port *port = &gpio->ports[m]; |
3124 | + |
3125 | + if (!port->is_registered) |
3126 | + continue; |
3127 | + |
3128 | + acpi_gpiochip_free_interrupts(&port->gc); |
3129 | + gpiochip_remove(&port->gc); |
3130 | + } |
3131 | } |
3132 | |
3133 | static struct dwapb_platform_data * |
3134 | @@ -836,7 +845,7 @@ static SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops, dwapb_gpio_suspend, |
3135 | |
3136 | static struct platform_driver dwapb_gpio_driver = { |
3137 | .driver = { |
3138 | - .name = "gpio-dwapb", |
3139 | + .name = DWAPB_DRIVER_NAME, |
3140 | .pm = &dwapb_gpio_pm_ops, |
3141 | .of_match_table = of_match_ptr(dwapb_of_match), |
3142 | .acpi_match_table = ACPI_PTR(dwapb_acpi_match), |
3143 | @@ -850,3 +859,4 @@ module_platform_driver(dwapb_gpio_driver); |
3144 | MODULE_LICENSE("GPL"); |
3145 | MODULE_AUTHOR("Jamie Iles"); |
3146 | MODULE_DESCRIPTION("Synopsys DesignWare APB GPIO driver"); |
3147 | +MODULE_ALIAS("platform:" DWAPB_DRIVER_NAME); |
3148 | diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
3149 | index 3edc1762803a..29ba26742c8f 100644 |
3150 | --- a/drivers/gpio/gpio-pca953x.c |
3151 | +++ b/drivers/gpio/gpio-pca953x.c |
3152 | @@ -306,8 +306,22 @@ static const struct regmap_config pca953x_i2c_regmap = { |
3153 | .volatile_reg = pca953x_volatile_register, |
3154 | |
3155 | .cache_type = REGCACHE_RBTREE, |
3156 | - /* REVISIT: should be 0x7f but some 24 bit chips use REG_ADDR_AI */ |
3157 | - .max_register = 0xff, |
3158 | + .max_register = 0x7f, |
3159 | +}; |
3160 | + |
3161 | +static const struct regmap_config pca953x_ai_i2c_regmap = { |
3162 | + .reg_bits = 8, |
3163 | + .val_bits = 8, |
3164 | + |
3165 | + .read_flag_mask = REG_ADDR_AI, |
3166 | + .write_flag_mask = REG_ADDR_AI, |
3167 | + |
3168 | + .readable_reg = pca953x_readable_register, |
3169 | + .writeable_reg = pca953x_writeable_register, |
3170 | + .volatile_reg = pca953x_volatile_register, |
3171 | + |
3172 | + .cache_type = REGCACHE_RBTREE, |
3173 | + .max_register = 0x7f, |
3174 | }; |
3175 | |
3176 | static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, |
3177 | @@ -318,18 +332,6 @@ static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, |
3178 | int pinctrl = (reg & PCAL_PINCTRL_MASK) << 1; |
3179 | u8 regaddr = pinctrl | addr | (off / BANK_SZ); |
3180 | |
3181 | - /* Single byte read doesn't need AI bit set. */ |
3182 | - if (!addrinc) |
3183 | - return regaddr; |
3184 | - |
3185 | - /* Chips with 24 and more GPIOs always support Auto Increment */ |
3186 | - if (write && NBANK(chip) > 2) |
3187 | - regaddr |= REG_ADDR_AI; |
3188 | - |
3189 | - /* PCA9575 needs address-increment on multi-byte writes */ |
3190 | - if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) |
3191 | - regaddr |= REG_ADDR_AI; |
3192 | - |
3193 | return regaddr; |
3194 | } |
3195 | |
3196 | @@ -897,6 +899,7 @@ static int pca953x_probe(struct i2c_client *client, |
3197 | int ret; |
3198 | u32 invert = 0; |
3199 | struct regulator *reg; |
3200 | + const struct regmap_config *regmap_config; |
3201 | |
3202 | chip = devm_kzalloc(&client->dev, |
3203 | sizeof(struct pca953x_chip), GFP_KERNEL); |
3204 | @@ -960,7 +963,17 @@ static int pca953x_probe(struct i2c_client *client, |
3205 | |
3206 | i2c_set_clientdata(client, chip); |
3207 | |
3208 | - chip->regmap = devm_regmap_init_i2c(client, &pca953x_i2c_regmap); |
3209 | + pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK); |
3210 | + |
3211 | + if (NBANK(chip) > 2 || PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) { |
3212 | + dev_info(&client->dev, "using AI\n"); |
3213 | + regmap_config = &pca953x_ai_i2c_regmap; |
3214 | + } else { |
3215 | + dev_info(&client->dev, "using no AI\n"); |
3216 | + regmap_config = &pca953x_i2c_regmap; |
3217 | + } |
3218 | + |
3219 | + chip->regmap = devm_regmap_init_i2c(client, regmap_config); |
3220 | if (IS_ERR(chip->regmap)) { |
3221 | ret = PTR_ERR(chip->regmap); |
3222 | goto err_exit; |
3223 | @@ -991,7 +1004,6 @@ static int pca953x_probe(struct i2c_client *client, |
3224 | /* initialize cached registers from their original values. |
3225 | * we can't share this chip with another i2c master. |
3226 | */ |
3227 | - pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK); |
3228 | |
3229 | if (PCA_CHIP_TYPE(chip->driver_data) == PCA953X_TYPE) { |
3230 | chip->regs = &pca953x_regs; |
3231 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3232 | index 9fd12e108a70..4fad0b603b3a 100644 |
3233 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3234 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3235 | @@ -929,7 +929,7 @@ static int dm_late_init(void *handle) |
3236 | unsigned int linear_lut[16]; |
3237 | int i; |
3238 | struct dmcu *dmcu = adev->dm.dc->res_pool->dmcu; |
3239 | - bool ret = false; |
3240 | + bool ret; |
3241 | |
3242 | for (i = 0; i < 16; i++) |
3243 | linear_lut[i] = 0xFFFF * i / 15; |
3244 | @@ -945,13 +945,10 @@ static int dm_late_init(void *handle) |
3245 | */ |
3246 | params.min_abm_backlight = 0x28F; |
3247 | |
3248 | - /* todo will enable for navi10 */ |
3249 | - if (adev->asic_type <= CHIP_RAVEN) { |
3250 | - ret = dmcu_load_iram(dmcu, params); |
3251 | + ret = dmcu_load_iram(dmcu, params); |
3252 | |
3253 | - if (!ret) |
3254 | - return -EINVAL; |
3255 | - } |
3256 | + if (!ret) |
3257 | + return -EINVAL; |
3258 | |
3259 | return detect_mst_link_for_all_connectors(adev->ddev); |
3260 | } |
3261 | diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c |
3262 | index 221e0f56389f..823843cd2613 100644 |
3263 | --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c |
3264 | +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c |
3265 | @@ -2543,7 +2543,6 @@ static enum bp_result construct_integrated_info( |
3266 | |
3267 | /* Sort voltage table from low to high*/ |
3268 | if (result == BP_RESULT_OK) { |
3269 | - struct clock_voltage_caps temp = {0, 0}; |
3270 | uint32_t i; |
3271 | uint32_t j; |
3272 | |
3273 | @@ -2553,10 +2552,8 @@ static enum bp_result construct_integrated_info( |
3274 | info->disp_clk_voltage[j].max_supported_clk < |
3275 | info->disp_clk_voltage[j-1].max_supported_clk) { |
3276 | /* swap j and j - 1*/ |
3277 | - temp = info->disp_clk_voltage[j-1]; |
3278 | - info->disp_clk_voltage[j-1] = |
3279 | - info->disp_clk_voltage[j]; |
3280 | - info->disp_clk_voltage[j] = temp; |
3281 | + swap(info->disp_clk_voltage[j - 1], |
3282 | + info->disp_clk_voltage[j]); |
3283 | } |
3284 | } |
3285 | } |
3286 | diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c |
3287 | index dff65c0fe82f..7873abea4112 100644 |
3288 | --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c |
3289 | +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c |
3290 | @@ -1613,8 +1613,6 @@ static enum bp_result construct_integrated_info( |
3291 | |
3292 | struct atom_common_table_header *header; |
3293 | struct atom_data_revision revision; |
3294 | - |
3295 | - struct clock_voltage_caps temp = {0, 0}; |
3296 | uint32_t i; |
3297 | uint32_t j; |
3298 | |
3299 | @@ -1644,10 +1642,8 @@ static enum bp_result construct_integrated_info( |
3300 | info->disp_clk_voltage[j-1].max_supported_clk |
3301 | ) { |
3302 | /* swap j and j - 1*/ |
3303 | - temp = info->disp_clk_voltage[j-1]; |
3304 | - info->disp_clk_voltage[j-1] = |
3305 | - info->disp_clk_voltage[j]; |
3306 | - info->disp_clk_voltage[j] = temp; |
3307 | + swap(info->disp_clk_voltage[j - 1], |
3308 | + info->disp_clk_voltage[j]); |
3309 | } |
3310 | } |
3311 | } |
3312 | diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
3313 | index 2028dc017f7a..47e7d11ca0c9 100644 |
3314 | --- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
3315 | +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
3316 | @@ -907,15 +907,11 @@ static void program_timing_sync( |
3317 | |
3318 | /* set first pipe with plane as master */ |
3319 | for (j = 0; j < group_size; j++) { |
3320 | - struct pipe_ctx *temp; |
3321 | - |
3322 | if (pipe_set[j]->plane_state) { |
3323 | if (j == 0) |
3324 | break; |
3325 | |
3326 | - temp = pipe_set[0]; |
3327 | - pipe_set[0] = pipe_set[j]; |
3328 | - pipe_set[j] = temp; |
3329 | + swap(pipe_set[0], pipe_set[j]); |
3330 | break; |
3331 | } |
3332 | } |
3333 | @@ -2230,6 +2226,12 @@ void dc_commit_updates_for_stream(struct dc *dc, |
3334 | |
3335 | copy_stream_update_to_stream(dc, context, stream, stream_update); |
3336 | |
3337 | + if (!dc->res_pool->funcs->validate_bandwidth(dc, context, false)) { |
3338 | + DC_ERROR("Mode validation failed for stream update!\n"); |
3339 | + dc_release_state(context); |
3340 | + return; |
3341 | + } |
3342 | + |
3343 | commit_planes_for_stream( |
3344 | dc, |
3345 | srf_updates, |
3346 | diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
3347 | index 2d8f14b69117..207435fa4f2c 100644 |
3348 | --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
3349 | +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
3350 | @@ -799,7 +799,7 @@ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, |
3351 | pow_buffer_ptr = -1; // reset back to no optimize |
3352 | ret = true; |
3353 | release: |
3354 | - kfree(coeff); |
3355 | + kvfree(coeff); |
3356 | return ret; |
3357 | } |
3358 | |
3359 | diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
3360 | index 15590fd86ef4..2e71ca3e19f5 100644 |
3361 | --- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
3362 | +++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
3363 | @@ -239,7 +239,7 @@ static void ci_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) |
3364 | |
3365 | switch (dev_id) { |
3366 | case 0x67BA: |
3367 | - case 0x66B1: |
3368 | + case 0x67B1: |
3369 | smu_data->power_tune_defaults = &defaults_hawaii_pro; |
3370 | break; |
3371 | case 0x67B8: |
3372 | diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c |
3373 | index 4c766624b20d..2337b3827e6a 100644 |
3374 | --- a/drivers/gpu/drm/drm_connector.c |
3375 | +++ b/drivers/gpu/drm/drm_connector.c |
3376 | @@ -27,6 +27,7 @@ |
3377 | #include <drm/drm_print.h> |
3378 | #include <drm/drm_drv.h> |
3379 | #include <drm/drm_file.h> |
3380 | +#include <drm/drm_sysfs.h> |
3381 | |
3382 | #include <linux/uaccess.h> |
3383 | |
3384 | @@ -511,6 +512,10 @@ int drm_connector_register(struct drm_connector *connector) |
3385 | drm_mode_object_register(connector->dev, &connector->base); |
3386 | |
3387 | connector->registration_state = DRM_CONNECTOR_REGISTERED; |
3388 | + |
3389 | + /* Let userspace know we have a new connector */ |
3390 | + drm_sysfs_hotplug_event(connector->dev); |
3391 | + |
3392 | goto unlock; |
3393 | |
3394 | err_debugfs: |
3395 | diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
3396 | index 4b7aaad07423..006d6087700f 100644 |
3397 | --- a/drivers/gpu/drm/drm_dp_mst_topology.c |
3398 | +++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
3399 | @@ -27,6 +27,7 @@ |
3400 | #include <linux/kernel.h> |
3401 | #include <linux/sched.h> |
3402 | #include <linux/seq_file.h> |
3403 | +#include <linux/iopoll.h> |
3404 | |
3405 | #include <drm/drm_atomic.h> |
3406 | #include <drm/drm_atomic_helper.h> |
3407 | @@ -3498,6 +3499,17 @@ fail: |
3408 | return ret; |
3409 | } |
3410 | |
3411 | +static int do_get_act_status(struct drm_dp_aux *aux) |
3412 | +{ |
3413 | + int ret; |
3414 | + u8 status; |
3415 | + |
3416 | + ret = drm_dp_dpcd_readb(aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); |
3417 | + if (ret < 0) |
3418 | + return ret; |
3419 | + |
3420 | + return status; |
3421 | +} |
3422 | |
3423 | /** |
3424 | * drm_dp_check_act_status() - Check ACT handled status. |
3425 | @@ -3507,33 +3519,29 @@ fail: |
3426 | */ |
3427 | int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr) |
3428 | { |
3429 | - u8 status; |
3430 | - int ret; |
3431 | - int count = 0; |
3432 | - |
3433 | - do { |
3434 | - ret = drm_dp_dpcd_readb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); |
3435 | - |
3436 | - if (ret < 0) { |
3437 | - DRM_DEBUG_KMS("failed to read payload table status %d\n", ret); |
3438 | - goto fail; |
3439 | - } |
3440 | - |
3441 | - if (status & DP_PAYLOAD_ACT_HANDLED) |
3442 | - break; |
3443 | - count++; |
3444 | - udelay(100); |
3445 | - |
3446 | - } while (count < 30); |
3447 | - |
3448 | - if (!(status & DP_PAYLOAD_ACT_HANDLED)) { |
3449 | - DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n", status, count); |
3450 | - ret = -EINVAL; |
3451 | - goto fail; |
3452 | + /* |
3453 | + * There doesn't seem to be any recommended retry count or timeout in |
3454 | + * the MST specification. Since some hubs have been observed to take |
3455 | + * over 1 second to update their payload allocations under certain |
3456 | + * conditions, we use a rather large timeout value. |
3457 | + */ |
3458 | + const int timeout_ms = 3000; |
3459 | + int ret, status; |
3460 | + |
3461 | + ret = readx_poll_timeout(do_get_act_status, mgr->aux, status, |
3462 | + status & DP_PAYLOAD_ACT_HANDLED || status < 0, |
3463 | + 200, timeout_ms * USEC_PER_MSEC); |
3464 | + if (ret < 0 && status >= 0) { |
3465 | + DRM_DEBUG_KMS("Failed to get ACT after %dms, last status: %02x\n", |
3466 | + timeout_ms, status); |
3467 | + return -EINVAL; |
3468 | + } else if (status < 0) { |
3469 | + DRM_DEBUG_KMS("Failed to read payload table status: %d\n", |
3470 | + status); |
3471 | + return status; |
3472 | } |
3473 | + |
3474 | return 0; |
3475 | -fail: |
3476 | - return ret; |
3477 | } |
3478 | EXPORT_SYMBOL(drm_dp_check_act_status); |
3479 | |
3480 | diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c |
3481 | index cf804389f5ec..d50a7884e69e 100644 |
3482 | --- a/drivers/gpu/drm/drm_encoder_slave.c |
3483 | +++ b/drivers/gpu/drm/drm_encoder_slave.c |
3484 | @@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, |
3485 | |
3486 | err = encoder_drv->encoder_init(client, dev, encoder); |
3487 | if (err) |
3488 | - goto fail_unregister; |
3489 | + goto fail_module_put; |
3490 | |
3491 | if (info->platform_data) |
3492 | encoder->slave_funcs->set_config(&encoder->base, |
3493 | @@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev, |
3494 | |
3495 | return 0; |
3496 | |
3497 | +fail_module_put: |
3498 | + module_put(module); |
3499 | fail_unregister: |
3500 | i2c_unregister_device(client); |
3501 | - module_put(module); |
3502 | fail: |
3503 | return err; |
3504 | } |
3505 | diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c |
3506 | index dd2bc85f43cc..4fd2f6cd03c1 100644 |
3507 | --- a/drivers/gpu/drm/drm_sysfs.c |
3508 | +++ b/drivers/gpu/drm/drm_sysfs.c |
3509 | @@ -293,9 +293,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector) |
3510 | return PTR_ERR(connector->kdev); |
3511 | } |
3512 | |
3513 | - /* Let userspace know we have a new connector */ |
3514 | - drm_sysfs_hotplug_event(dev); |
3515 | - |
3516 | if (connector->ddc) |
3517 | return sysfs_create_link(&connector->kdev->kobj, |
3518 | &connector->ddc->dev.kobj, "ddc"); |
3519 | diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c |
3520 | index 4ab6531a4a74..2efc317c90df 100644 |
3521 | --- a/drivers/gpu/drm/i915/display/intel_dp.c |
3522 | +++ b/drivers/gpu/drm/i915/display/intel_dp.c |
3523 | @@ -1292,8 +1292,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, |
3524 | bool is_tc_port = intel_phy_is_tc(i915, phy); |
3525 | i915_reg_t ch_ctl, ch_data[5]; |
3526 | u32 aux_clock_divider; |
3527 | - enum intel_display_power_domain aux_domain = |
3528 | - intel_aux_power_domain(intel_dig_port); |
3529 | + enum intel_display_power_domain aux_domain; |
3530 | intel_wakeref_t aux_wakeref; |
3531 | intel_wakeref_t pps_wakeref; |
3532 | int i, ret, recv_bytes; |
3533 | @@ -1308,6 +1307,8 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, |
3534 | if (is_tc_port) |
3535 | intel_tc_port_lock(intel_dig_port); |
3536 | |
3537 | + aux_domain = intel_aux_power_domain(intel_dig_port); |
3538 | + |
3539 | aux_wakeref = intel_display_power_get(i915, aux_domain); |
3540 | pps_wakeref = pps_lock(intel_dp); |
3541 | |
3542 | diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
3543 | index 4c4954e8ce0a..3f875aebbd23 100644 |
3544 | --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
3545 | +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
3546 | @@ -36,7 +36,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) |
3547 | unsigned long last_pfn = 0; /* suppress gcc warning */ |
3548 | unsigned int max_segment = i915_sg_segment_size(); |
3549 | unsigned int sg_page_sizes; |
3550 | - struct pagevec pvec; |
3551 | gfp_t noreclaim; |
3552 | int ret; |
3553 | |
3554 | @@ -188,13 +187,17 @@ err_sg: |
3555 | sg_mark_end(sg); |
3556 | err_pages: |
3557 | mapping_clear_unevictable(mapping); |
3558 | - pagevec_init(&pvec); |
3559 | - for_each_sgt_page(page, sgt_iter, st) { |
3560 | - if (!pagevec_add(&pvec, page)) |
3561 | + if (sg != st->sgl) { |
3562 | + struct pagevec pvec; |
3563 | + |
3564 | + pagevec_init(&pvec); |
3565 | + for_each_sgt_page(page, sgt_iter, st) { |
3566 | + if (!pagevec_add(&pvec, page)) |
3567 | + check_release_pagevec(&pvec); |
3568 | + } |
3569 | + if (pagevec_count(&pvec)) |
3570 | check_release_pagevec(&pvec); |
3571 | } |
3572 | - if (pagevec_count(&pvec)) |
3573 | - check_release_pagevec(&pvec); |
3574 | sg_free_table(st); |
3575 | kfree(st); |
3576 | |
3577 | diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c |
3578 | index f24096e27bef..21417ac8e878 100644 |
3579 | --- a/drivers/gpu/drm/i915/i915_cmd_parser.c |
3580 | +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c |
3581 | @@ -572,6 +572,9 @@ struct drm_i915_reg_descriptor { |
3582 | #define REG32(_reg, ...) \ |
3583 | { .addr = (_reg), __VA_ARGS__ } |
3584 | |
3585 | +#define REG32_IDX(_reg, idx) \ |
3586 | + { .addr = _reg(idx) } |
3587 | + |
3588 | /* |
3589 | * Convenience macro for adding 64-bit registers. |
3590 | * |
3591 | @@ -669,6 +672,7 @@ static const struct drm_i915_reg_descriptor gen9_blt_regs[] = { |
3592 | REG64_IDX(RING_TIMESTAMP, BSD_RING_BASE), |
3593 | REG32(BCS_SWCTRL), |
3594 | REG64_IDX(RING_TIMESTAMP, BLT_RING_BASE), |
3595 | + REG32_IDX(RING_CTX_TIMESTAMP, BLT_RING_BASE), |
3596 | REG64_IDX(BCS_GPR, 0), |
3597 | REG64_IDX(BCS_GPR, 1), |
3598 | REG64_IDX(BCS_GPR, 2), |
3599 | diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
3600 | index 37e3dd3c1a9d..4193a9970251 100644 |
3601 | --- a/drivers/gpu/drm/i915/i915_irq.c |
3602 | +++ b/drivers/gpu/drm/i915/i915_irq.c |
3603 | @@ -3500,6 +3500,7 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv) |
3604 | |
3605 | val = I915_READ(GEN11_DE_HPD_IMR); |
3606 | val &= ~hotplug_irqs; |
3607 | + val |= ~enabled_irqs & hotplug_irqs; |
3608 | I915_WRITE(GEN11_DE_HPD_IMR, val); |
3609 | POSTING_READ(GEN11_DE_HPD_IMR); |
3610 | |
3611 | diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
3612 | index 99cd6e62a971..7829247de60e 100644 |
3613 | --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
3614 | +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
3615 | @@ -1359,6 +1359,10 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) |
3616 | { |
3617 | u64 busy_cycles, busy_time; |
3618 | |
3619 | + /* Only read the gpu busy if the hardware is already active */ |
3620 | + if (pm_runtime_get_if_in_use(&gpu->pdev->dev) == 0) |
3621 | + return 0; |
3622 | + |
3623 | busy_cycles = gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_0_LO, |
3624 | REG_A5XX_RBBM_PERFCTR_RBBM_0_HI); |
3625 | |
3626 | @@ -1367,6 +1371,8 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) |
3627 | |
3628 | gpu->devfreq.busy_cycles = busy_cycles; |
3629 | |
3630 | + pm_runtime_put(&gpu->pdev->dev); |
3631 | + |
3632 | if (WARN_ON(busy_time > ~0LU)) |
3633 | return ~0LU; |
3634 | |
3635 | diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
3636 | index 85f14feafdec..e62b286947a7 100644 |
3637 | --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
3638 | +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
3639 | @@ -107,6 +107,13 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) |
3640 | struct msm_gpu *gpu = &adreno_gpu->base; |
3641 | int ret; |
3642 | |
3643 | + /* |
3644 | + * This can get called from devfreq while the hardware is idle. Don't |
3645 | + * bring up the power if it isn't already active |
3646 | + */ |
3647 | + if (pm_runtime_get_if_in_use(gmu->dev) == 0) |
3648 | + return; |
3649 | + |
3650 | gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0); |
3651 | |
3652 | gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING, |
3653 | @@ -133,6 +140,7 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) |
3654 | * for now leave it at max so that the performance is nominal. |
3655 | */ |
3656 | icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216)); |
3657 | + pm_runtime_put(gmu->dev); |
3658 | } |
3659 | |
3660 | void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq) |
3661 | diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
3662 | index 686c34d706b0..be68d4e6551c 100644 |
3663 | --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
3664 | +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
3665 | @@ -803,6 +803,11 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) |
3666 | struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); |
3667 | u64 busy_cycles, busy_time; |
3668 | |
3669 | + |
3670 | + /* Only read the gpu busy if the hardware is already active */ |
3671 | + if (pm_runtime_get_if_in_use(a6xx_gpu->gmu.dev) == 0) |
3672 | + return 0; |
3673 | + |
3674 | busy_cycles = gmu_read64(&a6xx_gpu->gmu, |
3675 | REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L, |
3676 | REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H); |
3677 | @@ -812,6 +817,8 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) |
3678 | |
3679 | gpu->devfreq.busy_cycles = busy_cycles; |
3680 | |
3681 | + pm_runtime_put(a6xx_gpu->gmu.dev); |
3682 | + |
3683 | if (WARN_ON(busy_time > ~0LU)) |
3684 | return ~0LU; |
3685 | |
3686 | diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
3687 | index 91cd76a2bab1..77823ccdd0f8 100644 |
3688 | --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
3689 | +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
3690 | @@ -1037,7 +1037,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) |
3691 | |
3692 | return 0; |
3693 | fail: |
3694 | - mdp5_destroy(pdev); |
3695 | + if (mdp5_kms) |
3696 | + mdp5_destroy(pdev); |
3697 | return ret; |
3698 | } |
3699 | |
3700 | diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
3701 | index 9b16a08eb4d9..bf6d41fb0c9f 100644 |
3702 | --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
3703 | +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
3704 | @@ -27,10 +27,10 @@ void |
3705 | gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc) |
3706 | { |
3707 | struct nvkm_device *device = ior->disp->engine.subdev.device; |
3708 | - const u32 hoff = head * 0x800; |
3709 | + const u32 soff = nv50_ior_base(ior); |
3710 | const u32 ctrl = scdc & 0x3; |
3711 | |
3712 | - nvkm_mask(device, 0x61c5bc + hoff, 0x00000003, ctrl); |
3713 | + nvkm_mask(device, 0x61c5bc + soff, 0x00000003, ctrl); |
3714 | |
3715 | ior->tmds.high_speed = !!(scdc & 0x2); |
3716 | } |
3717 | diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c |
3718 | index bfc1631093e9..9bdbe0db8795 100644 |
3719 | --- a/drivers/gpu/drm/qxl/qxl_kms.c |
3720 | +++ b/drivers/gpu/drm/qxl/qxl_kms.c |
3721 | @@ -218,7 +218,7 @@ int qxl_device_init(struct qxl_device *qdev, |
3722 | &(qdev->ram_header->cursor_ring_hdr), |
3723 | sizeof(struct qxl_command), |
3724 | QXL_CURSOR_RING_SIZE, |
3725 | - qdev->io_base + QXL_IO_NOTIFY_CMD, |
3726 | + qdev->io_base + QXL_IO_NOTIFY_CURSOR, |
3727 | false, |
3728 | &qdev->cursor_event); |
3729 | |
3730 | diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
3731 | index 7ad3f06c127e..00ca35f07ba5 100644 |
3732 | --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
3733 | +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
3734 | @@ -148,7 +148,7 @@ |
3735 | #define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE 3 |
3736 | |
3737 | #define SUN4I_HDMI_DDC_CLK_REG 0x528 |
3738 | -#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0x7) << 3) |
3739 | +#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0xf) << 3) |
3740 | #define SUN4I_HDMI_DDC_CLK_N(n) ((n) & 0x7) |
3741 | |
3742 | #define SUN4I_HDMI_DDC_LINE_CTRL_REG 0x540 |
3743 | diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
3744 | index 2ff780114106..12430b9d4e93 100644 |
3745 | --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
3746 | +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
3747 | @@ -33,7 +33,7 @@ static unsigned long sun4i_ddc_calc_divider(unsigned long rate, |
3748 | unsigned long best_rate = 0; |
3749 | u8 best_m = 0, best_n = 0, _m, _n; |
3750 | |
3751 | - for (_m = 0; _m < 8; _m++) { |
3752 | + for (_m = 0; _m < 16; _m++) { |
3753 | for (_n = 0; _n < 8; _n++) { |
3754 | unsigned long tmp_rate; |
3755 | |
3756 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
3757 | index 13b7222ef2c9..c552a6bc627e 100644 |
3758 | --- a/drivers/hid/hid-ids.h |
3759 | +++ b/drivers/hid/hid-ids.h |
3760 | @@ -1147,6 +1147,9 @@ |
3761 | #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882 |
3762 | #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 |
3763 | |
3764 | +#define USB_VENDOR_ID_TRUST 0x145f |
3765 | +#define USB_DEVICE_ID_TRUST_PANORA_TABLET 0x0212 |
3766 | + |
3767 | #define USB_VENDOR_ID_TURBOX 0x062a |
3768 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 |
3769 | #define USB_DEVICE_ID_ASUS_MD_5110 0x5110 |
3770 | diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
3771 | index 90ec2390ef68..168fdaa1999f 100644 |
3772 | --- a/drivers/hid/hid-quirks.c |
3773 | +++ b/drivers/hid/hid-quirks.c |
3774 | @@ -168,6 +168,7 @@ static const struct hid_device_id hid_quirks[] = { |
3775 | { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, |
3776 | { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, |
3777 | { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883), HID_QUIRK_NOGET }, |
3778 | + { HID_USB_DEVICE(USB_VENDOR_ID_TRUST, USB_DEVICE_ID_TRUST_PANORA_TABLET), HID_QUIRK_MULTI_INPUT | HID_QUIRK_HIDINPUT_FORCE }, |
3779 | { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, |
3780 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, |
3781 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT }, |
3782 | diff --git a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
3783 | index aa2dbed30fc3..6cf59fd26ad7 100644 |
3784 | --- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
3785 | +++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
3786 | @@ -480,6 +480,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, |
3787 | sizeof(ldr_xfer_query_resp)); |
3788 | if (rv < 0) { |
3789 | client_data->flag_retry = true; |
3790 | + *fw_info = (struct shim_fw_info){}; |
3791 | return rv; |
3792 | } |
3793 | |
3794 | @@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, |
3795 | "data size %d is not equal to size of loader_xfer_query_response %zu\n", |
3796 | rv, sizeof(struct loader_xfer_query_response)); |
3797 | client_data->flag_retry = true; |
3798 | + *fw_info = (struct shim_fw_info){}; |
3799 | return -EMSGSIZE; |
3800 | } |
3801 | |
3802 | diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
3803 | index d0cc3985b72a..36cce2bfb744 100644 |
3804 | --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
3805 | +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
3806 | @@ -596,13 +596,6 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) |
3807 | goto out; |
3808 | } |
3809 | |
3810 | - /* There is no point in reading a TMC in HW FIFO mode */ |
3811 | - mode = readl_relaxed(drvdata->base + TMC_MODE); |
3812 | - if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
3813 | - ret = -EINVAL; |
3814 | - goto out; |
3815 | - } |
3816 | - |
3817 | /* Don't interfere if operated from Perf */ |
3818 | if (drvdata->mode == CS_MODE_PERF) { |
3819 | ret = -EINVAL; |
3820 | @@ -616,8 +609,15 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) |
3821 | } |
3822 | |
3823 | /* Disable the TMC if need be */ |
3824 | - if (drvdata->mode == CS_MODE_SYSFS) |
3825 | + if (drvdata->mode == CS_MODE_SYSFS) { |
3826 | + /* There is no point in reading a TMC in HW FIFO mode */ |
3827 | + mode = readl_relaxed(drvdata->base + TMC_MODE); |
3828 | + if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
3829 | + ret = -EINVAL; |
3830 | + goto out; |
3831 | + } |
3832 | __tmc_etb_disable_hw(drvdata); |
3833 | + } |
3834 | |
3835 | drvdata->reading = true; |
3836 | out: |
3837 | diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c |
3838 | index 8382eb64b424..d6c17506dba4 100644 |
3839 | --- a/drivers/i2c/busses/i2c-icy.c |
3840 | +++ b/drivers/i2c/busses/i2c-icy.c |
3841 | @@ -43,6 +43,7 @@ |
3842 | #include <linux/i2c.h> |
3843 | #include <linux/i2c-algo-pcf.h> |
3844 | |
3845 | +#include <asm/amigahw.h> |
3846 | #include <asm/amigaints.h> |
3847 | #include <linux/zorro.h> |
3848 | |
3849 | diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c |
3850 | index 30ded6422e7b..69740a4ff1db 100644 |
3851 | --- a/drivers/i2c/busses/i2c-piix4.c |
3852 | +++ b/drivers/i2c/busses/i2c-piix4.c |
3853 | @@ -977,7 +977,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) |
3854 | } |
3855 | |
3856 | if (dev->vendor == PCI_VENDOR_ID_AMD && |
3857 | - dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) { |
3858 | + (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS || |
3859 | + dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) { |
3860 | retval = piix4_setup_sb800(dev, id, 1); |
3861 | } |
3862 | |
3863 | diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c |
3864 | index 2c3c3d6935c0..d0c557c8d80f 100644 |
3865 | --- a/drivers/i2c/busses/i2c-pxa.c |
3866 | +++ b/drivers/i2c/busses/i2c-pxa.c |
3867 | @@ -312,11 +312,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) |
3868 | dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n", |
3869 | readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)), |
3870 | readl(_ISR(i2c))); |
3871 | - dev_dbg(dev, "log: "); |
3872 | + dev_err(dev, "log:"); |
3873 | for (i = 0; i < i2c->irqlogidx; i++) |
3874 | - pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]); |
3875 | - |
3876 | - pr_debug("\n"); |
3877 | + pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]); |
3878 | + pr_cont("\n"); |
3879 | } |
3880 | |
3881 | #else /* ifdef DEBUG */ |
3882 | @@ -706,11 +705,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) |
3883 | { |
3884 | u32 icr; |
3885 | |
3886 | - /* |
3887 | - * Clear the STOP and ACK flags |
3888 | - */ |
3889 | + /* Clear the START, STOP, ACK, TB and MA flags */ |
3890 | icr = readl(_ICR(i2c)); |
3891 | - icr &= ~(ICR_STOP | ICR_ACKNAK); |
3892 | + icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA); |
3893 | writel(icr, _ICR(i2c)); |
3894 | } |
3895 | |
3896 | diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c |
3897 | index 8d0f15f27dc5..0a95afaa48fe 100644 |
3898 | --- a/drivers/iio/pressure/bmp280-core.c |
3899 | +++ b/drivers/iio/pressure/bmp280-core.c |
3900 | @@ -264,6 +264,8 @@ static u32 bmp280_compensate_humidity(struct bmp280_data *data, |
3901 | + (s32)2097152) * calib->H2 + 8192) >> 14); |
3902 | var -= ((((var >> 15) * (var >> 15)) >> 7) * (s32)calib->H1) >> 4; |
3903 | |
3904 | + var = clamp_val(var, 0, 419430400); |
3905 | + |
3906 | return var >> 12; |
3907 | }; |
3908 | |
3909 | @@ -706,7 +708,7 @@ static int bmp180_measure(struct bmp280_data *data, u8 ctrl_meas) |
3910 | unsigned int ctrl; |
3911 | |
3912 | if (data->use_eoc) |
3913 | - init_completion(&data->done); |
3914 | + reinit_completion(&data->done); |
3915 | |
3916 | ret = regmap_write(data->regmap, BMP280_REG_CTRL_MEAS, ctrl_meas); |
3917 | if (ret) |
3918 | @@ -962,6 +964,9 @@ static int bmp085_fetch_eoc_irq(struct device *dev, |
3919 | "trying to enforce it\n"); |
3920 | irq_trig = IRQF_TRIGGER_RISING; |
3921 | } |
3922 | + |
3923 | + init_completion(&data->done); |
3924 | + |
3925 | ret = devm_request_threaded_irq(dev, |
3926 | irq, |
3927 | bmp085_eoc_irq, |
3928 | diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c |
3929 | index 8b0b5ae22e4c..726e70b68249 100644 |
3930 | --- a/drivers/infiniband/core/cma_configfs.c |
3931 | +++ b/drivers/infiniband/core/cma_configfs.c |
3932 | @@ -322,8 +322,21 @@ fail: |
3933 | return ERR_PTR(err); |
3934 | } |
3935 | |
3936 | +static void drop_cma_dev(struct config_group *cgroup, struct config_item *item) |
3937 | +{ |
3938 | + struct config_group *group = |
3939 | + container_of(item, struct config_group, cg_item); |
3940 | + struct cma_dev_group *cma_dev_group = |
3941 | + container_of(group, struct cma_dev_group, device_group); |
3942 | + |
3943 | + configfs_remove_default_groups(&cma_dev_group->ports_group); |
3944 | + configfs_remove_default_groups(&cma_dev_group->device_group); |
3945 | + config_item_put(item); |
3946 | +} |
3947 | + |
3948 | static struct configfs_group_operations cma_subsys_group_ops = { |
3949 | .make_group = make_cma_dev, |
3950 | + .drop_item = drop_cma_dev, |
3951 | }; |
3952 | |
3953 | static const struct config_item_type cma_subsys_type = { |
3954 | diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c |
3955 | index 7a50cedcef1f..091cca9d88ed 100644 |
3956 | --- a/drivers/infiniband/core/sysfs.c |
3957 | +++ b/drivers/infiniband/core/sysfs.c |
3958 | @@ -1060,8 +1060,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) |
3959 | coredev->ports_kobj, |
3960 | "%d", port_num); |
3961 | if (ret) { |
3962 | - kfree(p); |
3963 | - return ret; |
3964 | + goto err_put; |
3965 | } |
3966 | |
3967 | p->gid_attr_group = kzalloc(sizeof(*p->gid_attr_group), GFP_KERNEL); |
3968 | @@ -1074,8 +1073,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) |
3969 | ret = kobject_init_and_add(&p->gid_attr_group->kobj, &gid_attr_type, |
3970 | &p->kobj, "gid_attrs"); |
3971 | if (ret) { |
3972 | - kfree(p->gid_attr_group); |
3973 | - goto err_put; |
3974 | + goto err_put_gid_attrs; |
3975 | } |
3976 | |
3977 | if (device->ops.process_mad && is_full_dev) { |
3978 | @@ -1406,8 +1404,10 @@ int ib_port_register_module_stat(struct ib_device *device, u8 port_num, |
3979 | |
3980 | ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s", |
3981 | name); |
3982 | - if (ret) |
3983 | + if (ret) { |
3984 | + kobject_put(kobj); |
3985 | return ret; |
3986 | + } |
3987 | } |
3988 | |
3989 | return 0; |
3990 | diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c |
3991 | index 599340c1f0b8..541dbcf22d0e 100644 |
3992 | --- a/drivers/infiniband/hw/cxgb4/device.c |
3993 | +++ b/drivers/infiniband/hw/cxgb4/device.c |
3994 | @@ -953,6 +953,7 @@ void c4iw_dealloc(struct uld_ctx *ctx) |
3995 | static void c4iw_remove(struct uld_ctx *ctx) |
3996 | { |
3997 | pr_debug("c4iw_dev %p\n", ctx->dev); |
3998 | + debugfs_remove_recursive(ctx->dev->debugfs_root); |
3999 | c4iw_unregister_device(ctx->dev); |
4000 | c4iw_dealloc(ctx); |
4001 | } |
4002 | diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
4003 | index 4540b00ccee9..0502c90c83ed 100644 |
4004 | --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
4005 | +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
4006 | @@ -1349,34 +1349,26 @@ static int hns_roce_query_pf_resource(struct hns_roce_dev *hr_dev) |
4007 | static int hns_roce_query_pf_timer_resource(struct hns_roce_dev *hr_dev) |
4008 | { |
4009 | struct hns_roce_pf_timer_res_a *req_a; |
4010 | - struct hns_roce_cmq_desc desc[2]; |
4011 | - int ret, i; |
4012 | + struct hns_roce_cmq_desc desc; |
4013 | + int ret; |
4014 | |
4015 | - for (i = 0; i < 2; i++) { |
4016 | - hns_roce_cmq_setup_basic_desc(&desc[i], |
4017 | - HNS_ROCE_OPC_QUERY_PF_TIMER_RES, |
4018 | - true); |
4019 | + hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_QUERY_PF_TIMER_RES, |
4020 | + true); |
4021 | |
4022 | - if (i == 0) |
4023 | - desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT); |
4024 | - else |
4025 | - desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT); |
4026 | - } |
4027 | - |
4028 | - ret = hns_roce_cmq_send(hr_dev, desc, 2); |
4029 | + ret = hns_roce_cmq_send(hr_dev, &desc, 1); |
4030 | if (ret) |
4031 | return ret; |
4032 | |
4033 | - req_a = (struct hns_roce_pf_timer_res_a *)desc[0].data; |
4034 | + req_a = (struct hns_roce_pf_timer_res_a *)desc.data; |
4035 | |
4036 | hr_dev->caps.qpc_timer_bt_num = |
4037 | - roce_get_field(req_a->qpc_timer_bt_idx_num, |
4038 | - PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_M, |
4039 | - PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_S); |
4040 | + roce_get_field(req_a->qpc_timer_bt_idx_num, |
4041 | + PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_M, |
4042 | + PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_S); |
4043 | hr_dev->caps.cqc_timer_bt_num = |
4044 | - roce_get_field(req_a->cqc_timer_bt_idx_num, |
4045 | - PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_M, |
4046 | - PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_S); |
4047 | + roce_get_field(req_a->cqc_timer_bt_idx_num, |
4048 | + PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_M, |
4049 | + PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_S); |
4050 | |
4051 | return 0; |
4052 | } |
4053 | @@ -4564,7 +4556,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, |
4054 | qp_attr->path_mig_state = IB_MIG_ARMED; |
4055 | qp_attr->ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE; |
4056 | if (hr_qp->ibqp.qp_type == IB_QPT_UD) |
4057 | - qp_attr->qkey = V2_QKEY_VAL; |
4058 | + qp_attr->qkey = le32_to_cpu(context.qkey_xrcd); |
4059 | |
4060 | qp_attr->rq_psn = roce_get_field(context.byte_108_rx_reqepsn, |
4061 | V2_QPC_BYTE_108_RX_REQ_EPSN_M, |
4062 | diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c |
4063 | index d609f4659afb..fd75a9043bf1 100644 |
4064 | --- a/drivers/infiniband/hw/mlx5/devx.c |
4065 | +++ b/drivers/infiniband/hw/mlx5/devx.c |
4066 | @@ -489,6 +489,10 @@ static u64 devx_get_obj_id(const void *in) |
4067 | obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
4068 | MLX5_GET(rst2init_qp_in, in, qpn)); |
4069 | break; |
4070 | + case MLX5_CMD_OP_INIT2INIT_QP: |
4071 | + obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
4072 | + MLX5_GET(init2init_qp_in, in, qpn)); |
4073 | + break; |
4074 | case MLX5_CMD_OP_INIT2RTR_QP: |
4075 | obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
4076 | MLX5_GET(init2rtr_qp_in, in, qpn)); |
4077 | @@ -814,6 +818,7 @@ static bool devx_is_obj_modify_cmd(const void *in) |
4078 | case MLX5_CMD_OP_SET_L2_TABLE_ENTRY: |
4079 | case MLX5_CMD_OP_RST2INIT_QP: |
4080 | case MLX5_CMD_OP_INIT2RTR_QP: |
4081 | + case MLX5_CMD_OP_INIT2INIT_QP: |
4082 | case MLX5_CMD_OP_RTR2RTS_QP: |
4083 | case MLX5_CMD_OP_RTS2RTS_QP: |
4084 | case MLX5_CMD_OP_SQERR2RTS_QP: |
4085 | diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c |
4086 | index 4e7fde86c96b..c29c1f7da4a1 100644 |
4087 | --- a/drivers/infiniband/hw/mlx5/srq.c |
4088 | +++ b/drivers/infiniband/hw/mlx5/srq.c |
4089 | @@ -310,12 +310,18 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq, |
4090 | srq->msrq.event = mlx5_ib_srq_event; |
4091 | srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn; |
4092 | |
4093 | - if (udata) |
4094 | - if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof(__u32))) { |
4095 | + if (udata) { |
4096 | + struct mlx5_ib_create_srq_resp resp = { |
4097 | + .srqn = srq->msrq.srqn, |
4098 | + }; |
4099 | + |
4100 | + if (ib_copy_to_udata(udata, &resp, min(udata->outlen, |
4101 | + sizeof(resp)))) { |
4102 | mlx5_ib_dbg(dev, "copy to user failed\n"); |
4103 | err = -EFAULT; |
4104 | goto err_core; |
4105 | } |
4106 | + } |
4107 | |
4108 | init_attr->attr.max_wr = srq->msrq.max - 1; |
4109 | |
4110 | diff --git a/drivers/input/serio/i8042-ppcio.h b/drivers/input/serio/i8042-ppcio.h |
4111 | deleted file mode 100644 |
4112 | index 391f94d9e47d..000000000000 |
4113 | --- a/drivers/input/serio/i8042-ppcio.h |
4114 | +++ /dev/null |
4115 | @@ -1,57 +0,0 @@ |
4116 | -/* SPDX-License-Identifier: GPL-2.0-only */ |
4117 | -#ifndef _I8042_PPCIO_H |
4118 | -#define _I8042_PPCIO_H |
4119 | - |
4120 | - |
4121 | -#if defined(CONFIG_WALNUT) |
4122 | - |
4123 | -#define I8042_KBD_IRQ 25 |
4124 | -#define I8042_AUX_IRQ 26 |
4125 | - |
4126 | -#define I8042_KBD_PHYS_DESC "walnutps2/serio0" |
4127 | -#define I8042_AUX_PHYS_DESC "walnutps2/serio1" |
4128 | -#define I8042_MUX_PHYS_DESC "walnutps2/serio%d" |
4129 | - |
4130 | -extern void *kb_cs; |
4131 | -extern void *kb_data; |
4132 | - |
4133 | -#define I8042_COMMAND_REG (*(int *)kb_cs) |
4134 | -#define I8042_DATA_REG (*(int *)kb_data) |
4135 | - |
4136 | -static inline int i8042_read_data(void) |
4137 | -{ |
4138 | - return readb(kb_data); |
4139 | -} |
4140 | - |
4141 | -static inline int i8042_read_status(void) |
4142 | -{ |
4143 | - return readb(kb_cs); |
4144 | -} |
4145 | - |
4146 | -static inline void i8042_write_data(int val) |
4147 | -{ |
4148 | - writeb(val, kb_data); |
4149 | -} |
4150 | - |
4151 | -static inline void i8042_write_command(int val) |
4152 | -{ |
4153 | - writeb(val, kb_cs); |
4154 | -} |
4155 | - |
4156 | -static inline int i8042_platform_init(void) |
4157 | -{ |
4158 | - i8042_reset = I8042_RESET_ALWAYS; |
4159 | - return 0; |
4160 | -} |
4161 | - |
4162 | -static inline void i8042_platform_exit(void) |
4163 | -{ |
4164 | -} |
4165 | - |
4166 | -#else |
4167 | - |
4168 | -#include "i8042-io.h" |
4169 | - |
4170 | -#endif |
4171 | - |
4172 | -#endif /* _I8042_PPCIO_H */ |
4173 | diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h |
4174 | index 38dc27ad3c18..eb376700dfff 100644 |
4175 | --- a/drivers/input/serio/i8042.h |
4176 | +++ b/drivers/input/serio/i8042.h |
4177 | @@ -17,8 +17,6 @@ |
4178 | #include "i8042-ip22io.h" |
4179 | #elif defined(CONFIG_SNI_RM) |
4180 | #include "i8042-snirm.h" |
4181 | -#elif defined(CONFIG_PPC) |
4182 | -#include "i8042-ppcio.h" |
4183 | #elif defined(CONFIG_SPARC) |
4184 | #include "i8042-sparcio.h" |
4185 | #elif defined(CONFIG_X86) || defined(CONFIG_IA64) |
4186 | diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c |
4187 | index 240e8de24cd2..b41b97c962ed 100644 |
4188 | --- a/drivers/input/touchscreen/edt-ft5x06.c |
4189 | +++ b/drivers/input/touchscreen/edt-ft5x06.c |
4190 | @@ -935,19 +935,25 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev, |
4191 | |
4192 | error = device_property_read_u32(dev, "offset", &val); |
4193 | if (!error) { |
4194 | - edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val); |
4195 | + if (reg_addr->reg_offset != NO_REGISTER) |
4196 | + edt_ft5x06_register_write(tsdata, |
4197 | + reg_addr->reg_offset, val); |
4198 | tsdata->offset = val; |
4199 | } |
4200 | |
4201 | error = device_property_read_u32(dev, "offset-x", &val); |
4202 | if (!error) { |
4203 | - edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_x, val); |
4204 | + if (reg_addr->reg_offset_x != NO_REGISTER) |
4205 | + edt_ft5x06_register_write(tsdata, |
4206 | + reg_addr->reg_offset_x, val); |
4207 | tsdata->offset_x = val; |
4208 | } |
4209 | |
4210 | error = device_property_read_u32(dev, "offset-y", &val); |
4211 | if (!error) { |
4212 | - edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_y, val); |
4213 | + if (reg_addr->reg_offset_y != NO_REGISTER) |
4214 | + edt_ft5x06_register_write(tsdata, |
4215 | + reg_addr->reg_offset_y, val); |
4216 | tsdata->offset_y = val; |
4217 | } |
4218 | } |
4219 | diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c |
4220 | index 86887c9a349a..f9cc674ba9b7 100644 |
4221 | --- a/drivers/mailbox/zynqmp-ipi-mailbox.c |
4222 | +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c |
4223 | @@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
4224 | mchan->req_buf_size = resource_size(&res); |
4225 | mchan->req_buf = devm_ioremap(mdev, res.start, |
4226 | mchan->req_buf_size); |
4227 | - if (IS_ERR(mchan->req_buf)) { |
4228 | + if (!mchan->req_buf) { |
4229 | dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
4230 | - ret = PTR_ERR(mchan->req_buf); |
4231 | - return ret; |
4232 | + return -ENOMEM; |
4233 | } |
4234 | } else if (ret != -ENODEV) { |
4235 | dev_err(mdev, "Unmatched resource %s, %d.\n", name, ret); |
4236 | @@ -520,10 +519,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
4237 | mchan->resp_buf_size = resource_size(&res); |
4238 | mchan->resp_buf = devm_ioremap(mdev, res.start, |
4239 | mchan->resp_buf_size); |
4240 | - if (IS_ERR(mchan->resp_buf)) { |
4241 | + if (!mchan->resp_buf) { |
4242 | dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
4243 | - ret = PTR_ERR(mchan->resp_buf); |
4244 | - return ret; |
4245 | + return -ENOMEM; |
4246 | } |
4247 | } else if (ret != -ENODEV) { |
4248 | dev_err(mdev, "Unmatched resource %s.\n", name); |
4249 | @@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
4250 | mchan->req_buf_size = resource_size(&res); |
4251 | mchan->req_buf = devm_ioremap(mdev, res.start, |
4252 | mchan->req_buf_size); |
4253 | - if (IS_ERR(mchan->req_buf)) { |
4254 | + if (!mchan->req_buf) { |
4255 | dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
4256 | - ret = PTR_ERR(mchan->req_buf); |
4257 | - return ret; |
4258 | + return -ENOMEM; |
4259 | } |
4260 | } else if (ret != -ENODEV) { |
4261 | dev_err(mdev, "Unmatched resource %s.\n", name); |
4262 | @@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
4263 | mchan->resp_buf_size = resource_size(&res); |
4264 | mchan->resp_buf = devm_ioremap(mdev, res.start, |
4265 | mchan->resp_buf_size); |
4266 | - if (IS_ERR(mchan->resp_buf)) { |
4267 | + if (!mchan->resp_buf) { |
4268 | dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
4269 | - ret = PTR_ERR(mchan->resp_buf); |
4270 | - return ret; |
4271 | + return -ENOMEM; |
4272 | } |
4273 | } else if (ret != -ENODEV) { |
4274 | dev_err(mdev, "Unmatched resource %s.\n", name); |
4275 | diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
4276 | index 46a8b5a91c38..3c1109fceb2f 100644 |
4277 | --- a/drivers/md/bcache/btree.c |
4278 | +++ b/drivers/md/bcache/btree.c |
4279 | @@ -1442,7 +1442,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
4280 | if (__set_blocks(n1, n1->keys + n2->keys, |
4281 | block_bytes(b->c)) > |
4282 | btree_blocks(new_nodes[i])) |
4283 | - goto out_nocoalesce; |
4284 | + goto out_unlock_nocoalesce; |
4285 | |
4286 | keys = n2->keys; |
4287 | /* Take the key of the node we're getting rid of */ |
4288 | @@ -1471,7 +1471,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
4289 | |
4290 | if (__bch_keylist_realloc(&keylist, |
4291 | bkey_u64s(&new_nodes[i]->key))) |
4292 | - goto out_nocoalesce; |
4293 | + goto out_unlock_nocoalesce; |
4294 | |
4295 | bch_btree_node_write(new_nodes[i], &cl); |
4296 | bch_keylist_add(&keylist, &new_nodes[i]->key); |
4297 | @@ -1517,6 +1517,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
4298 | /* Invalidated our iterator */ |
4299 | return -EINTR; |
4300 | |
4301 | +out_unlock_nocoalesce: |
4302 | + for (i = 0; i < nodes; i++) |
4303 | + mutex_unlock(&new_nodes[i]->write_lock); |
4304 | + |
4305 | out_nocoalesce: |
4306 | closure_sync(&cl); |
4307 | |
4308 | diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
4309 | index 456d790c918c..f2de4c73cc8f 100644 |
4310 | --- a/drivers/md/dm-mpath.c |
4311 | +++ b/drivers/md/dm-mpath.c |
4312 | @@ -1856,7 +1856,7 @@ static int multipath_prepare_ioctl(struct dm_target *ti, |
4313 | int r; |
4314 | |
4315 | current_pgpath = READ_ONCE(m->current_pgpath); |
4316 | - if (!current_pgpath) |
4317 | + if (!current_pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) |
4318 | current_pgpath = choose_pgpath(m, 0); |
4319 | |
4320 | if (current_pgpath) { |
4321 | diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c |
4322 | index e0a6cf9239f1..e6b0039d07aa 100644 |
4323 | --- a/drivers/md/dm-zoned-metadata.c |
4324 | +++ b/drivers/md/dm-zoned-metadata.c |
4325 | @@ -1589,7 +1589,7 @@ static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd) |
4326 | return dzone; |
4327 | } |
4328 | |
4329 | - return ERR_PTR(-EBUSY); |
4330 | + return NULL; |
4331 | } |
4332 | |
4333 | /* |
4334 | @@ -1609,7 +1609,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd) |
4335 | return zone; |
4336 | } |
4337 | |
4338 | - return ERR_PTR(-EBUSY); |
4339 | + return NULL; |
4340 | } |
4341 | |
4342 | /* |
4343 | diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c |
4344 | index e7ace908a9b7..d50817320e8e 100644 |
4345 | --- a/drivers/md/dm-zoned-reclaim.c |
4346 | +++ b/drivers/md/dm-zoned-reclaim.c |
4347 | @@ -349,8 +349,8 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc) |
4348 | |
4349 | /* Get a data zone */ |
4350 | dzone = dmz_get_zone_for_reclaim(zmd); |
4351 | - if (IS_ERR(dzone)) |
4352 | - return PTR_ERR(dzone); |
4353 | + if (!dzone) |
4354 | + return -EBUSY; |
4355 | |
4356 | start = jiffies; |
4357 | |
4358 | diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c |
4359 | index 857991cb3cbb..711979afd90a 100644 |
4360 | --- a/drivers/mfd/stmfx.c |
4361 | +++ b/drivers/mfd/stmfx.c |
4362 | @@ -287,14 +287,21 @@ static int stmfx_irq_init(struct i2c_client *client) |
4363 | |
4364 | ret = regmap_write(stmfx->map, STMFX_REG_IRQ_OUT_PIN, irqoutpin); |
4365 | if (ret) |
4366 | - return ret; |
4367 | + goto irq_exit; |
4368 | |
4369 | ret = devm_request_threaded_irq(stmfx->dev, client->irq, |
4370 | NULL, stmfx_irq_handler, |
4371 | irqtrigger | IRQF_ONESHOT, |
4372 | "stmfx", stmfx); |
4373 | if (ret) |
4374 | - stmfx_irq_exit(client); |
4375 | + goto irq_exit; |
4376 | + |
4377 | + stmfx->irq = client->irq; |
4378 | + |
4379 | + return 0; |
4380 | + |
4381 | +irq_exit: |
4382 | + stmfx_irq_exit(client); |
4383 | |
4384 | return ret; |
4385 | } |
4386 | @@ -481,6 +488,8 @@ static int stmfx_suspend(struct device *dev) |
4387 | if (ret) |
4388 | return ret; |
4389 | |
4390 | + disable_irq(stmfx->irq); |
4391 | + |
4392 | if (stmfx->vdd) |
4393 | return regulator_disable(stmfx->vdd); |
4394 | |
4395 | @@ -501,6 +510,13 @@ static int stmfx_resume(struct device *dev) |
4396 | } |
4397 | } |
4398 | |
4399 | + /* Reset STMFX - supply has been stopped during suspend */ |
4400 | + ret = stmfx_chip_reset(stmfx); |
4401 | + if (ret) { |
4402 | + dev_err(stmfx->dev, "Failed to reset chip: %d\n", ret); |
4403 | + return ret; |
4404 | + } |
4405 | + |
4406 | ret = regmap_raw_write(stmfx->map, STMFX_REG_SYS_CTRL, |
4407 | &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl)); |
4408 | if (ret) |
4409 | @@ -517,6 +533,8 @@ static int stmfx_resume(struct device *dev) |
4410 | if (ret) |
4411 | return ret; |
4412 | |
4413 | + enable_irq(stmfx->irq); |
4414 | + |
4415 | return 0; |
4416 | } |
4417 | #endif |
4418 | diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c |
4419 | index 1e9fe7d92597..737dede4a95c 100644 |
4420 | --- a/drivers/mfd/wm8994-core.c |
4421 | +++ b/drivers/mfd/wm8994-core.c |
4422 | @@ -690,3 +690,4 @@ module_i2c_driver(wm8994_i2c_driver); |
4423 | MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC"); |
4424 | MODULE_LICENSE("GPL"); |
4425 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
4426 | +MODULE_SOFTDEP("pre: wm8994_regulator"); |
4427 | diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
4428 | index 842f2210dc7e..3a5d2890fe2a 100644 |
4429 | --- a/drivers/misc/fastrpc.c |
4430 | +++ b/drivers/misc/fastrpc.c |
4431 | @@ -886,6 +886,7 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, |
4432 | struct fastrpc_channel_ctx *cctx; |
4433 | struct fastrpc_user *fl = ctx->fl; |
4434 | struct fastrpc_msg *msg = &ctx->msg; |
4435 | + int ret; |
4436 | |
4437 | cctx = fl->cctx; |
4438 | msg->pid = fl->tgid; |
4439 | @@ -901,7 +902,13 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, |
4440 | msg->size = roundup(ctx->msg_sz, PAGE_SIZE); |
4441 | fastrpc_context_get(ctx); |
4442 | |
4443 | - return rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); |
4444 | + ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); |
4445 | + |
4446 | + if (ret) |
4447 | + fastrpc_context_put(ctx); |
4448 | + |
4449 | + return ret; |
4450 | + |
4451 | } |
4452 | |
4453 | static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, |
4454 | @@ -1434,8 +1441,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) |
4455 | domains[domain_id]); |
4456 | data->miscdev.fops = &fastrpc_fops; |
4457 | err = misc_register(&data->miscdev); |
4458 | - if (err) |
4459 | + if (err) { |
4460 | + kfree(data); |
4461 | return err; |
4462 | + } |
4463 | |
4464 | kref_init(&data->refcount); |
4465 | |
4466 | diff --git a/drivers/misc/habanalabs/habanalabs.h b/drivers/misc/habanalabs/habanalabs.h |
4467 | index 75862be53c60..30addffd76f5 100644 |
4468 | --- a/drivers/misc/habanalabs/habanalabs.h |
4469 | +++ b/drivers/misc/habanalabs/habanalabs.h |
4470 | @@ -23,7 +23,7 @@ |
4471 | |
4472 | #define HL_MMAP_CB_MASK (0x8000000000000000ull >> PAGE_SHIFT) |
4473 | |
4474 | -#define HL_PENDING_RESET_PER_SEC 5 |
4475 | +#define HL_PENDING_RESET_PER_SEC 30 |
4476 | |
4477 | #define HL_DEVICE_TIMEOUT_USEC 1000000 /* 1 s */ |
4478 | |
4479 | diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c |
4480 | index 48ba7e02bed7..d4c14b617201 100644 |
4481 | --- a/drivers/misc/xilinx_sdfec.c |
4482 | +++ b/drivers/misc/xilinx_sdfec.c |
4483 | @@ -602,10 +602,10 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
4484 | const u32 depth) |
4485 | { |
4486 | u32 reg = 0; |
4487 | - u32 res; |
4488 | - u32 n, i; |
4489 | + int res, i, nr_pages; |
4490 | + u32 n; |
4491 | u32 *addr = NULL; |
4492 | - struct page *page[MAX_NUM_PAGES]; |
4493 | + struct page *pages[MAX_NUM_PAGES]; |
4494 | |
4495 | /* |
4496 | * Writes that go beyond the length of |
4497 | @@ -622,15 +622,22 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
4498 | if ((len * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE) |
4499 | n += 1; |
4500 | |
4501 | - res = get_user_pages_fast((unsigned long)src_ptr, n, 0, page); |
4502 | - if (res < n) { |
4503 | - for (i = 0; i < res; i++) |
4504 | - put_page(page[i]); |
4505 | + if (WARN_ON_ONCE(n > INT_MAX)) |
4506 | + return -EINVAL; |
4507 | + |
4508 | + nr_pages = n; |
4509 | + |
4510 | + res = get_user_pages_fast((unsigned long)src_ptr, nr_pages, 0, pages); |
4511 | + if (res < nr_pages) { |
4512 | + if (res > 0) { |
4513 | + for (i = 0; i < res; i++) |
4514 | + put_page(pages[i]); |
4515 | + } |
4516 | return -EINVAL; |
4517 | } |
4518 | |
4519 | - for (i = 0; i < n; i++) { |
4520 | - addr = kmap(page[i]); |
4521 | + for (i = 0; i < nr_pages; i++) { |
4522 | + addr = kmap(pages[i]); |
4523 | do { |
4524 | xsdfec_regwrite(xsdfec, |
4525 | base_addr + ((offset + reg) * |
4526 | @@ -639,7 +646,7 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
4527 | reg++; |
4528 | } while ((reg < len) && |
4529 | ((reg * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE)); |
4530 | - put_page(page[i]); |
4531 | + put_page(pages[i]); |
4532 | } |
4533 | return reg; |
4534 | } |
4535 | diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c |
4536 | index a69c9b9878b7..636966e93517 100644 |
4537 | --- a/drivers/net/dsa/lantiq_gswip.c |
4538 | +++ b/drivers/net/dsa/lantiq_gswip.c |
4539 | @@ -1451,7 +1451,8 @@ static void gswip_phylink_validate(struct dsa_switch *ds, int port, |
4540 | |
4541 | unsupported: |
4542 | bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); |
4543 | - dev_err(ds->dev, "Unsupported interface: %d\n", state->interface); |
4544 | + dev_err(ds->dev, "Unsupported interface '%s' for port %d\n", |
4545 | + phy_modes(state->interface), port); |
4546 | return; |
4547 | } |
4548 | |
4549 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
4550 | index 63ee0c49be7c..b5147bd6cba6 100644 |
4551 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
4552 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
4553 | @@ -9992,7 +9992,7 @@ static void bnxt_timer(struct timer_list *t) |
4554 | struct bnxt *bp = from_timer(bp, t, timer); |
4555 | struct net_device *dev = bp->dev; |
4556 | |
4557 | - if (!netif_running(dev)) |
4558 | + if (!netif_running(dev) || !test_bit(BNXT_STATE_OPEN, &bp->state)) |
4559 | return; |
4560 | |
4561 | if (atomic_read(&bp->intr_sem) != 0) |
4562 | diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
4563 | index cdd7e5da4a74..d375e438d805 100644 |
4564 | --- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
4565 | +++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
4566 | @@ -235,6 +235,11 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) |
4567 | |
4568 | /* Put it in the ring. */ |
4569 | p->rx_ring[p->rx_next_fill] = re.d64; |
4570 | + /* Make sure there is no reorder of filling the ring and ringing |
4571 | + * the bell |
4572 | + */ |
4573 | + wmb(); |
4574 | + |
4575 | dma_sync_single_for_device(p->dev, p->rx_ring_handle, |
4576 | ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), |
4577 | DMA_BIDIRECTIONAL); |
4578 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
4579 | index 108297a099ed..1ec33c614474 100644 |
4580 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c |
4581 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
4582 | @@ -6345,11 +6345,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
4583 | struct net_device *netdev = pci_get_drvdata(pdev); |
4584 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4585 | struct e1000_hw *hw = &adapter->hw; |
4586 | - u32 ctrl, ctrl_ext, rctl, status; |
4587 | - /* Runtime suspend should only enable wakeup for link changes */ |
4588 | - u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
4589 | + u32 ctrl, ctrl_ext, rctl, status, wufc; |
4590 | int retval = 0; |
4591 | |
4592 | + /* Runtime suspend should only enable wakeup for link changes */ |
4593 | + if (runtime) |
4594 | + wufc = E1000_WUFC_LNKC; |
4595 | + else if (device_may_wakeup(&pdev->dev)) |
4596 | + wufc = adapter->wol; |
4597 | + else |
4598 | + wufc = 0; |
4599 | + |
4600 | status = er32(STATUS); |
4601 | if (status & E1000_STATUS_LU) |
4602 | wufc &= ~E1000_WUFC_LNKC; |
4603 | @@ -6406,7 +6412,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
4604 | if (adapter->hw.phy.type == e1000_phy_igp_3) { |
4605 | e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); |
4606 | } else if (hw->mac.type >= e1000_pch_lpt) { |
4607 | - if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) |
4608 | + if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) |
4609 | /* ULP does not support wake from unicast, multicast |
4610 | * or broadcast. |
4611 | */ |
4612 | diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h |
4613 | index bd1b1ed323f4..6b9117a350fa 100644 |
4614 | --- a/drivers/net/ethernet/intel/iavf/iavf.h |
4615 | +++ b/drivers/net/ethernet/intel/iavf/iavf.h |
4616 | @@ -87,6 +87,10 @@ struct iavf_vsi { |
4617 | #define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4) |
4618 | #define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */ |
4619 | |
4620 | +#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \ |
4621 | + (IAVF_MAX_VF_VSI * \ |
4622 | + sizeof(struct virtchnl_vsi_resource))) |
4623 | + |
4624 | /* MAX_MSIX_Q_VECTORS of these are allocated, |
4625 | * but we only use one per queue-specific vector. |
4626 | */ |
4627 | @@ -306,6 +310,14 @@ struct iavf_adapter { |
4628 | bool netdev_registered; |
4629 | bool link_up; |
4630 | enum virtchnl_link_speed link_speed; |
4631 | + /* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set |
4632 | + * in vf_res->vf_cap_flags. Use ADV_LINK_SUPPORT macro to determine if |
4633 | + * this field is valid. This field should be used going forward and the |
4634 | + * enum virtchnl_link_speed above should be considered the legacy way of |
4635 | + * storing/communicating link speeds. |
4636 | + */ |
4637 | + u32 link_speed_mbps; |
4638 | + |
4639 | enum virtchnl_ops current_op; |
4640 | #define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \ |
4641 | (_a)->vf_res->vf_cap_flags & \ |
4642 | @@ -322,6 +334,8 @@ struct iavf_adapter { |
4643 | VIRTCHNL_VF_OFFLOAD_RSS_PF))) |
4644 | #define VLAN_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \ |
4645 | VIRTCHNL_VF_OFFLOAD_VLAN) |
4646 | +#define ADV_LINK_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \ |
4647 | + VIRTCHNL_VF_CAP_ADV_LINK_SPEED) |
4648 | struct virtchnl_vf_resource *vf_res; /* incl. all VSIs */ |
4649 | struct virtchnl_vsi_resource *vsi_res; /* our LAN VSI */ |
4650 | struct virtchnl_version_info pf_version; |
4651 | diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
4652 | index dad3eec8ccd8..758bef02a2a8 100644 |
4653 | --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
4654 | +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
4655 | @@ -278,7 +278,18 @@ static int iavf_get_link_ksettings(struct net_device *netdev, |
4656 | ethtool_link_ksettings_zero_link_mode(cmd, supported); |
4657 | cmd->base.autoneg = AUTONEG_DISABLE; |
4658 | cmd->base.port = PORT_NONE; |
4659 | - /* Set speed and duplex */ |
4660 | + cmd->base.duplex = DUPLEX_FULL; |
4661 | + |
4662 | + if (ADV_LINK_SUPPORT(adapter)) { |
4663 | + if (adapter->link_speed_mbps && |
4664 | + adapter->link_speed_mbps < U32_MAX) |
4665 | + cmd->base.speed = adapter->link_speed_mbps; |
4666 | + else |
4667 | + cmd->base.speed = SPEED_UNKNOWN; |
4668 | + |
4669 | + return 0; |
4670 | + } |
4671 | + |
4672 | switch (adapter->link_speed) { |
4673 | case IAVF_LINK_SPEED_40GB: |
4674 | cmd->base.speed = SPEED_40000; |
4675 | @@ -306,7 +317,6 @@ static int iavf_get_link_ksettings(struct net_device *netdev, |
4676 | default: |
4677 | break; |
4678 | } |
4679 | - cmd->base.duplex = DUPLEX_FULL; |
4680 | |
4681 | return 0; |
4682 | } |
4683 | diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
4684 | index 8e16be960e96..bacc5fb7eba2 100644 |
4685 | --- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
4686 | +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
4687 | @@ -1756,17 +1756,17 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) |
4688 | struct net_device *netdev = adapter->netdev; |
4689 | struct pci_dev *pdev = adapter->pdev; |
4690 | struct iavf_hw *hw = &adapter->hw; |
4691 | - int err = 0, bufsz; |
4692 | + int err; |
4693 | |
4694 | WARN_ON(adapter->state != __IAVF_INIT_GET_RESOURCES); |
4695 | /* aq msg sent, awaiting reply */ |
4696 | if (!adapter->vf_res) { |
4697 | - bufsz = sizeof(struct virtchnl_vf_resource) + |
4698 | - (IAVF_MAX_VF_VSI * |
4699 | - sizeof(struct virtchnl_vsi_resource)); |
4700 | - adapter->vf_res = kzalloc(bufsz, GFP_KERNEL); |
4701 | - if (!adapter->vf_res) |
4702 | + adapter->vf_res = kzalloc(IAVF_VIRTCHNL_VF_RESOURCE_SIZE, |
4703 | + GFP_KERNEL); |
4704 | + if (!adapter->vf_res) { |
4705 | + err = -ENOMEM; |
4706 | goto err; |
4707 | + } |
4708 | } |
4709 | err = iavf_get_vf_config(adapter); |
4710 | if (err == IAVF_ERR_ADMIN_QUEUE_NO_WORK) { |
4711 | @@ -2036,7 +2036,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) |
4712 | iavf_reset_interrupt_capability(adapter); |
4713 | iavf_free_queues(adapter); |
4714 | iavf_free_q_vectors(adapter); |
4715 | - kfree(adapter->vf_res); |
4716 | + memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE); |
4717 | iavf_shutdown_adminq(&adapter->hw); |
4718 | adapter->netdev->flags &= ~IFF_UP; |
4719 | clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); |
4720 | @@ -2487,6 +2487,16 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, |
4721 | { |
4722 | int speed = 0, ret = 0; |
4723 | |
4724 | + if (ADV_LINK_SUPPORT(adapter)) { |
4725 | + if (adapter->link_speed_mbps < U32_MAX) { |
4726 | + speed = adapter->link_speed_mbps; |
4727 | + goto validate_bw; |
4728 | + } else { |
4729 | + dev_err(&adapter->pdev->dev, "Unknown link speed\n"); |
4730 | + return -EINVAL; |
4731 | + } |
4732 | + } |
4733 | + |
4734 | switch (adapter->link_speed) { |
4735 | case IAVF_LINK_SPEED_40GB: |
4736 | speed = 40000; |
4737 | @@ -2510,6 +2520,7 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, |
4738 | break; |
4739 | } |
4740 | |
4741 | +validate_bw: |
4742 | if (max_tx_rate > speed) { |
4743 | dev_err(&adapter->pdev->dev, |
4744 | "Invalid tx rate specified\n"); |
4745 | diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
4746 | index 1ab9cb339acb..9655318803b7 100644 |
4747 | --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
4748 | +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
4749 | @@ -139,7 +139,8 @@ int iavf_send_vf_config_msg(struct iavf_adapter *adapter) |
4750 | VIRTCHNL_VF_OFFLOAD_ENCAP | |
4751 | VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM | |
4752 | VIRTCHNL_VF_OFFLOAD_REQ_QUEUES | |
4753 | - VIRTCHNL_VF_OFFLOAD_ADQ; |
4754 | + VIRTCHNL_VF_OFFLOAD_ADQ | |
4755 | + VIRTCHNL_VF_CAP_ADV_LINK_SPEED; |
4756 | |
4757 | adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; |
4758 | adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; |
4759 | @@ -918,6 +919,8 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) |
4760 | iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); |
4761 | } |
4762 | |
4763 | +#define IAVF_MAX_SPEED_STRLEN 13 |
4764 | + |
4765 | /** |
4766 | * iavf_print_link_message - print link up or down |
4767 | * @adapter: adapter structure |
4768 | @@ -927,37 +930,99 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) |
4769 | static void iavf_print_link_message(struct iavf_adapter *adapter) |
4770 | { |
4771 | struct net_device *netdev = adapter->netdev; |
4772 | - char *speed = "Unknown "; |
4773 | + int link_speed_mbps; |
4774 | + char *speed; |
4775 | |
4776 | if (!adapter->link_up) { |
4777 | netdev_info(netdev, "NIC Link is Down\n"); |
4778 | return; |
4779 | } |
4780 | |
4781 | + speed = kcalloc(1, IAVF_MAX_SPEED_STRLEN, GFP_KERNEL); |
4782 | + if (!speed) |
4783 | + return; |
4784 | + |
4785 | + if (ADV_LINK_SUPPORT(adapter)) { |
4786 | + link_speed_mbps = adapter->link_speed_mbps; |
4787 | + goto print_link_msg; |
4788 | + } |
4789 | + |
4790 | switch (adapter->link_speed) { |
4791 | case IAVF_LINK_SPEED_40GB: |
4792 | - speed = "40 G"; |
4793 | + link_speed_mbps = SPEED_40000; |
4794 | break; |
4795 | case IAVF_LINK_SPEED_25GB: |
4796 | - speed = "25 G"; |
4797 | + link_speed_mbps = SPEED_25000; |
4798 | break; |
4799 | case IAVF_LINK_SPEED_20GB: |
4800 | - speed = "20 G"; |
4801 | + link_speed_mbps = SPEED_20000; |
4802 | break; |
4803 | case IAVF_LINK_SPEED_10GB: |
4804 | - speed = "10 G"; |
4805 | + link_speed_mbps = SPEED_10000; |
4806 | break; |
4807 | case IAVF_LINK_SPEED_1GB: |
4808 | - speed = "1000 M"; |
4809 | + link_speed_mbps = SPEED_1000; |
4810 | break; |
4811 | case IAVF_LINK_SPEED_100MB: |
4812 | - speed = "100 M"; |
4813 | + link_speed_mbps = SPEED_100; |
4814 | break; |
4815 | default: |
4816 | + link_speed_mbps = SPEED_UNKNOWN; |
4817 | break; |
4818 | } |
4819 | |
4820 | - netdev_info(netdev, "NIC Link is Up %sbps Full Duplex\n", speed); |
4821 | +print_link_msg: |
4822 | + if (link_speed_mbps > SPEED_1000) { |
4823 | + if (link_speed_mbps == SPEED_2500) |
4824 | + snprintf(speed, IAVF_MAX_SPEED_STRLEN, "2.5 Gbps"); |
4825 | + else |
4826 | + /* convert to Gbps inline */ |
4827 | + snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s", |
4828 | + link_speed_mbps / 1000, "Gbps"); |
4829 | + } else if (link_speed_mbps == SPEED_UNKNOWN) { |
4830 | + snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%s", "Unknown Mbps"); |
4831 | + } else { |
4832 | + snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%u %s", |
4833 | + link_speed_mbps, "Mbps"); |
4834 | + } |
4835 | + |
4836 | + netdev_info(netdev, "NIC Link is Up Speed is %s Full Duplex\n", speed); |
4837 | + kfree(speed); |
4838 | +} |
4839 | + |
4840 | +/** |
4841 | + * iavf_get_vpe_link_status |
4842 | + * @adapter: adapter structure |
4843 | + * @vpe: virtchnl_pf_event structure |
4844 | + * |
4845 | + * Helper function for determining the link status |
4846 | + **/ |
4847 | +static bool |
4848 | +iavf_get_vpe_link_status(struct iavf_adapter *adapter, |
4849 | + struct virtchnl_pf_event *vpe) |
4850 | +{ |
4851 | + if (ADV_LINK_SUPPORT(adapter)) |
4852 | + return vpe->event_data.link_event_adv.link_status; |
4853 | + else |
4854 | + return vpe->event_data.link_event.link_status; |
4855 | +} |
4856 | + |
4857 | +/** |
4858 | + * iavf_set_adapter_link_speed_from_vpe |
4859 | + * @adapter: adapter structure for which we are setting the link speed |
4860 | + * @vpe: virtchnl_pf_event structure that contains the link speed we are setting |
4861 | + * |
4862 | + * Helper function for setting iavf_adapter link speed |
4863 | + **/ |
4864 | +static void |
4865 | +iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, |
4866 | + struct virtchnl_pf_event *vpe) |
4867 | +{ |
4868 | + if (ADV_LINK_SUPPORT(adapter)) |
4869 | + adapter->link_speed_mbps = |
4870 | + vpe->event_data.link_event_adv.link_speed; |
4871 | + else |
4872 | + adapter->link_speed = vpe->event_data.link_event.link_speed; |
4873 | } |
4874 | |
4875 | /** |
4876 | @@ -1187,12 +1252,11 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, |
4877 | if (v_opcode == VIRTCHNL_OP_EVENT) { |
4878 | struct virtchnl_pf_event *vpe = |
4879 | (struct virtchnl_pf_event *)msg; |
4880 | - bool link_up = vpe->event_data.link_event.link_status; |
4881 | + bool link_up = iavf_get_vpe_link_status(adapter, vpe); |
4882 | |
4883 | switch (vpe->event) { |
4884 | case VIRTCHNL_EVENT_LINK_CHANGE: |
4885 | - adapter->link_speed = |
4886 | - vpe->event_data.link_event.link_speed; |
4887 | + iavf_set_adapter_link_speed_from_vpe(adapter, vpe); |
4888 | |
4889 | /* we've already got the right link status, bail */ |
4890 | if (adapter->link_up == link_up) |
4891 | diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
4892 | index 373b8c832850..cf5d447af7db 100644 |
4893 | --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
4894 | +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
4895 | @@ -5925,8 +5925,8 @@ static int mvpp2_remove(struct platform_device *pdev) |
4896 | { |
4897 | struct mvpp2 *priv = platform_get_drvdata(pdev); |
4898 | struct fwnode_handle *fwnode = pdev->dev.fwnode; |
4899 | + int i = 0, poolnum = MVPP2_BM_POOLS_NUM; |
4900 | struct fwnode_handle *port_fwnode; |
4901 | - int i = 0; |
4902 | |
4903 | mvpp2_dbgfs_cleanup(priv); |
4904 | |
4905 | @@ -5940,7 +5940,10 @@ static int mvpp2_remove(struct platform_device *pdev) |
4906 | |
4907 | destroy_workqueue(priv->stats_queue); |
4908 | |
4909 | - for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { |
4910 | + if (priv->percpu_pools) |
4911 | + poolnum = mvpp2_get_nrxqs(priv) * 2; |
4912 | + |
4913 | + for (i = 0; i < poolnum; i++) { |
4914 | struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i]; |
4915 | |
4916 | mvpp2_bm_pool_destroy(&pdev->dev, priv, bm_pool); |
4917 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
4918 | index 7c77378accf0..f012aac83b10 100644 |
4919 | --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
4920 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
4921 | @@ -181,7 +181,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, |
4922 | in, pas)); |
4923 | |
4924 | err = mlx5_core_create_qp(mdev, &dr_qp->mqp, in, inlen); |
4925 | - kfree(in); |
4926 | + kvfree(in); |
4927 | |
4928 | if (err) { |
4929 | mlx5_core_warn(mdev, " Can't create QP\n"); |
4930 | diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
4931 | index aa101f72d405..cac75c7d1d01 100644 |
4932 | --- a/drivers/net/geneve.c |
4933 | +++ b/drivers/net/geneve.c |
4934 | @@ -987,9 +987,10 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) |
4935 | if (geneve->collect_md) { |
4936 | info = skb_tunnel_info(skb); |
4937 | if (unlikely(!info || !(info->mode & IP_TUNNEL_INFO_TX))) { |
4938 | - err = -EINVAL; |
4939 | netdev_dbg(dev, "no tunnel metadata\n"); |
4940 | - goto tx_error; |
4941 | + dev_kfree_skb(skb); |
4942 | + dev->stats.tx_dropped++; |
4943 | + return NETDEV_TX_OK; |
4944 | } |
4945 | } else { |
4946 | info = &geneve->info; |
4947 | @@ -1006,7 +1007,7 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) |
4948 | |
4949 | if (likely(!err)) |
4950 | return NETDEV_TX_OK; |
4951 | -tx_error: |
4952 | + |
4953 | dev_kfree_skb(skb); |
4954 | |
4955 | if (err == -ELOOP) |
4956 | diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c |
4957 | index 71cdef9fb56b..5ab53e9942f3 100644 |
4958 | --- a/drivers/net/hamradio/yam.c |
4959 | +++ b/drivers/net/hamradio/yam.c |
4960 | @@ -1133,6 +1133,7 @@ static int __init yam_init_driver(void) |
4961 | err = register_netdev(dev); |
4962 | if (err) { |
4963 | printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name); |
4964 | + free_netdev(dev); |
4965 | goto error; |
4966 | } |
4967 | yam_devs[i] = dev; |
4968 | diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
4969 | index a7796134e3be..91cf1d167263 100644 |
4970 | --- a/drivers/net/phy/marvell.c |
4971 | +++ b/drivers/net/phy/marvell.c |
4972 | @@ -358,7 +358,7 @@ static int m88e1101_config_aneg(struct phy_device *phydev) |
4973 | return marvell_config_aneg(phydev); |
4974 | } |
4975 | |
4976 | -#ifdef CONFIG_OF_MDIO |
4977 | +#if IS_ENABLED(CONFIG_OF_MDIO) |
4978 | /* Set and/or override some configuration registers based on the |
4979 | * marvell,reg-init property stored in the of_node for the phydev. |
4980 | * |
4981 | diff --git a/drivers/ntb/core.c b/drivers/ntb/core.c |
4982 | index 2581ab724c34..f8f75a504a58 100644 |
4983 | --- a/drivers/ntb/core.c |
4984 | +++ b/drivers/ntb/core.c |
4985 | @@ -214,10 +214,8 @@ int ntb_default_port_number(struct ntb_dev *ntb) |
4986 | case NTB_TOPO_B2B_DSD: |
4987 | return NTB_PORT_SEC_DSD; |
4988 | default: |
4989 | - break; |
4990 | + return 0; |
4991 | } |
4992 | - |
4993 | - return -EINVAL; |
4994 | } |
4995 | EXPORT_SYMBOL(ntb_default_port_number); |
4996 | |
4997 | @@ -240,10 +238,8 @@ int ntb_default_peer_port_number(struct ntb_dev *ntb, int pidx) |
4998 | case NTB_TOPO_B2B_DSD: |
4999 | return NTB_PORT_PRI_USD; |
5000 | default: |
5001 | - break; |
5002 | + return 0; |
5003 | } |
5004 | - |
5005 | - return -EINVAL; |
5006 | } |
5007 | EXPORT_SYMBOL(ntb_default_peer_port_number); |
5008 | |
5009 | @@ -315,4 +311,3 @@ static void __exit ntb_driver_exit(void) |
5010 | bus_unregister(&ntb_bus); |
5011 | } |
5012 | module_exit(ntb_driver_exit); |
5013 | - |
5014 | diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c |
5015 | index e9b7c2dfc730..5ce4766a6c9e 100644 |
5016 | --- a/drivers/ntb/test/ntb_perf.c |
5017 | +++ b/drivers/ntb/test/ntb_perf.c |
5018 | @@ -158,6 +158,8 @@ struct perf_peer { |
5019 | /* NTB connection setup service */ |
5020 | struct work_struct service; |
5021 | unsigned long sts; |
5022 | + |
5023 | + struct completion init_comp; |
5024 | }; |
5025 | #define to_peer_service(__work) \ |
5026 | container_of(__work, struct perf_peer, service) |
5027 | @@ -546,6 +548,7 @@ static int perf_setup_outbuf(struct perf_peer *peer) |
5028 | |
5029 | /* Initialization is finally done */ |
5030 | set_bit(PERF_STS_DONE, &peer->sts); |
5031 | + complete_all(&peer->init_comp); |
5032 | |
5033 | return 0; |
5034 | } |
5035 | @@ -556,7 +559,7 @@ static void perf_free_inbuf(struct perf_peer *peer) |
5036 | return; |
5037 | |
5038 | (void)ntb_mw_clear_trans(peer->perf->ntb, peer->pidx, peer->gidx); |
5039 | - dma_free_coherent(&peer->perf->ntb->dev, peer->inbuf_size, |
5040 | + dma_free_coherent(&peer->perf->ntb->pdev->dev, peer->inbuf_size, |
5041 | peer->inbuf, peer->inbuf_xlat); |
5042 | peer->inbuf = NULL; |
5043 | } |
5044 | @@ -585,8 +588,9 @@ static int perf_setup_inbuf(struct perf_peer *peer) |
5045 | |
5046 | perf_free_inbuf(peer); |
5047 | |
5048 | - peer->inbuf = dma_alloc_coherent(&perf->ntb->dev, peer->inbuf_size, |
5049 | - &peer->inbuf_xlat, GFP_KERNEL); |
5050 | + peer->inbuf = dma_alloc_coherent(&perf->ntb->pdev->dev, |
5051 | + peer->inbuf_size, &peer->inbuf_xlat, |
5052 | + GFP_KERNEL); |
5053 | if (!peer->inbuf) { |
5054 | dev_err(&perf->ntb->dev, "Failed to alloc inbuf of %pa\n", |
5055 | &peer->inbuf_size); |
5056 | @@ -636,6 +640,7 @@ static void perf_service_work(struct work_struct *work) |
5057 | perf_setup_outbuf(peer); |
5058 | |
5059 | if (test_and_clear_bit(PERF_CMD_CLEAR, &peer->sts)) { |
5060 | + init_completion(&peer->init_comp); |
5061 | clear_bit(PERF_STS_DONE, &peer->sts); |
5062 | if (test_bit(0, &peer->perf->busy_flag) && |
5063 | peer == peer->perf->test_peer) { |
5064 | @@ -652,7 +657,7 @@ static int perf_init_service(struct perf_ctx *perf) |
5065 | { |
5066 | u64 mask; |
5067 | |
5068 | - if (ntb_peer_mw_count(perf->ntb) < perf->pcnt + 1) { |
5069 | + if (ntb_peer_mw_count(perf->ntb) < perf->pcnt) { |
5070 | dev_err(&perf->ntb->dev, "Not enough memory windows\n"); |
5071 | return -EINVAL; |
5072 | } |
5073 | @@ -1051,8 +1056,9 @@ static int perf_submit_test(struct perf_peer *peer) |
5074 | struct perf_thread *pthr; |
5075 | int tidx, ret; |
5076 | |
5077 | - if (!test_bit(PERF_STS_DONE, &peer->sts)) |
5078 | - return -ENOLINK; |
5079 | + ret = wait_for_completion_interruptible(&peer->init_comp); |
5080 | + if (ret < 0) |
5081 | + return ret; |
5082 | |
5083 | if (test_and_set_bit_lock(0, &perf->busy_flag)) |
5084 | return -EBUSY; |
5085 | @@ -1418,10 +1424,21 @@ static int perf_init_peers(struct perf_ctx *perf) |
5086 | peer->gidx = pidx; |
5087 | } |
5088 | INIT_WORK(&peer->service, perf_service_work); |
5089 | + init_completion(&peer->init_comp); |
5090 | } |
5091 | if (perf->gidx == -1) |
5092 | perf->gidx = pidx; |
5093 | |
5094 | + /* |
5095 | + * Hardware with only two ports may not have unique port |
5096 | + * numbers. In this case, the gidxs should all be zero. |
5097 | + */ |
5098 | + if (perf->pcnt == 1 && ntb_port_number(perf->ntb) == 0 && |
5099 | + ntb_peer_port_number(perf->ntb, 0) == 0) { |
5100 | + perf->gidx = 0; |
5101 | + perf->peers[0].gidx = 0; |
5102 | + } |
5103 | + |
5104 | for (pidx = 0; pidx < perf->pcnt; pidx++) { |
5105 | ret = perf_setup_peer_mw(&perf->peers[pidx]); |
5106 | if (ret) |
5107 | @@ -1517,4 +1534,3 @@ static void __exit perf_exit(void) |
5108 | destroy_workqueue(perf_wq); |
5109 | } |
5110 | module_exit(perf_exit); |
5111 | - |
5112 | diff --git a/drivers/ntb/test/ntb_pingpong.c b/drivers/ntb/test/ntb_pingpong.c |
5113 | index 65865e460ab8..18d00eec7b02 100644 |
5114 | --- a/drivers/ntb/test/ntb_pingpong.c |
5115 | +++ b/drivers/ntb/test/ntb_pingpong.c |
5116 | @@ -121,15 +121,14 @@ static int pp_find_next_peer(struct pp_ctx *pp) |
5117 | link = ntb_link_is_up(pp->ntb, NULL, NULL); |
5118 | |
5119 | /* Find next available peer */ |
5120 | - if (link & pp->nmask) { |
5121 | + if (link & pp->nmask) |
5122 | pidx = __ffs64(link & pp->nmask); |
5123 | - out_db = BIT_ULL(pidx + 1); |
5124 | - } else if (link & pp->pmask) { |
5125 | + else if (link & pp->pmask) |
5126 | pidx = __ffs64(link & pp->pmask); |
5127 | - out_db = BIT_ULL(pidx); |
5128 | - } else { |
5129 | + else |
5130 | return -ENODEV; |
5131 | - } |
5132 | + |
5133 | + out_db = BIT_ULL(ntb_peer_port_number(pp->ntb, pidx)); |
5134 | |
5135 | spin_lock(&pp->lock); |
5136 | pp->out_pidx = pidx; |
5137 | @@ -303,7 +302,7 @@ static void pp_init_flds(struct pp_ctx *pp) |
5138 | break; |
5139 | } |
5140 | |
5141 | - pp->in_db = BIT_ULL(pidx); |
5142 | + pp->in_db = BIT_ULL(lport); |
5143 | pp->pmask = GENMASK_ULL(pidx, 0) >> 1; |
5144 | pp->nmask = GENMASK_ULL(pcnt - 1, pidx); |
5145 | |
5146 | @@ -435,4 +434,3 @@ static void __exit pp_exit(void) |
5147 | debugfs_remove_recursive(pp_dbgfs_topdir); |
5148 | } |
5149 | module_exit(pp_exit); |
5150 | - |
5151 | diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c |
5152 | index d592c0ffbd19..311d6ab8d016 100644 |
5153 | --- a/drivers/ntb/test/ntb_tool.c |
5154 | +++ b/drivers/ntb/test/ntb_tool.c |
5155 | @@ -504,7 +504,7 @@ static ssize_t tool_peer_link_read(struct file *filep, char __user *ubuf, |
5156 | buf[1] = '\n'; |
5157 | buf[2] = '\0'; |
5158 | |
5159 | - return simple_read_from_buffer(ubuf, size, offp, buf, 3); |
5160 | + return simple_read_from_buffer(ubuf, size, offp, buf, 2); |
5161 | } |
5162 | |
5163 | static TOOL_FOPS_RDWR(tool_peer_link_fops, |
5164 | @@ -590,7 +590,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, |
5165 | inmw->size = min_t(resource_size_t, req_size, size); |
5166 | inmw->size = round_up(inmw->size, addr_align); |
5167 | inmw->size = round_up(inmw->size, size_align); |
5168 | - inmw->mm_base = dma_alloc_coherent(&tc->ntb->dev, inmw->size, |
5169 | + inmw->mm_base = dma_alloc_coherent(&tc->ntb->pdev->dev, inmw->size, |
5170 | &inmw->dma_base, GFP_KERNEL); |
5171 | if (!inmw->mm_base) |
5172 | return -ENOMEM; |
5173 | @@ -612,7 +612,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, |
5174 | return 0; |
5175 | |
5176 | err_free_dma: |
5177 | - dma_free_coherent(&tc->ntb->dev, inmw->size, inmw->mm_base, |
5178 | + dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, |
5179 | inmw->dma_base); |
5180 | inmw->mm_base = NULL; |
5181 | inmw->dma_base = 0; |
5182 | @@ -629,7 +629,7 @@ static void tool_free_mw(struct tool_ctx *tc, int pidx, int widx) |
5183 | |
5184 | if (inmw->mm_base != NULL) { |
5185 | ntb_mw_clear_trans(tc->ntb, pidx, widx); |
5186 | - dma_free_coherent(&tc->ntb->dev, inmw->size, |
5187 | + dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, |
5188 | inmw->mm_base, inmw->dma_base); |
5189 | } |
5190 | |
5191 | @@ -1690,4 +1690,3 @@ static void __exit tool_exit(void) |
5192 | debugfs_remove_recursive(tool_dbgfs_topdir); |
5193 | } |
5194 | module_exit(tool_exit); |
5195 | - |
5196 | diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
5197 | index 1c2129493508..a13cae190196 100644 |
5198 | --- a/drivers/nvme/host/pci.c |
5199 | +++ b/drivers/nvme/host/pci.c |
5200 | @@ -2971,9 +2971,15 @@ static int nvme_suspend(struct device *dev) |
5201 | * the PCI bus layer to put it into D3 in order to take the PCIe link |
5202 | * down, so as to allow the platform to achieve its minimum low-power |
5203 | * state (which may not be possible if the link is up). |
5204 | + * |
5205 | + * If a host memory buffer is enabled, shut down the device as the NVMe |
5206 | + * specification allows the device to access the host memory buffer in |
5207 | + * host DRAM from all power states, but hosts will fail access to DRAM |
5208 | + * during S3. |
5209 | */ |
5210 | if (pm_suspend_via_firmware() || !ctrl->npss || |
5211 | !pcie_aspm_enabled(pdev) || |
5212 | + ndev->nr_host_mem_descs || |
5213 | (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) |
5214 | return nvme_disable_prepare_reset(ndev, true); |
5215 | |
5216 | diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c |
5217 | index c72eef988041..a32e60b024b8 100644 |
5218 | --- a/drivers/of/kobj.c |
5219 | +++ b/drivers/of/kobj.c |
5220 | @@ -134,8 +134,6 @@ int __of_attach_node_sysfs(struct device_node *np) |
5221 | if (!name) |
5222 | return -ENOMEM; |
5223 | |
5224 | - of_node_get(np); |
5225 | - |
5226 | rc = kobject_add(&np->kobj, parent, "%s", name); |
5227 | kfree(name); |
5228 | if (rc) |
5229 | @@ -144,6 +142,7 @@ int __of_attach_node_sysfs(struct device_node *np) |
5230 | for_each_property_of_node(np, pp) |
5231 | __of_add_property_sysfs(np, pp); |
5232 | |
5233 | + of_node_get(np); |
5234 | return 0; |
5235 | } |
5236 | |
5237 | diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c |
5238 | index b927a92e3463..8c9f88704874 100644 |
5239 | --- a/drivers/pci/controller/dwc/pci-meson.c |
5240 | +++ b/drivers/pci/controller/dwc/pci-meson.c |
5241 | @@ -301,11 +301,11 @@ static void meson_pcie_init_dw(struct meson_pcie *mp) |
5242 | meson_cfg_writel(mp, val, PCIE_CFG0); |
5243 | |
5244 | val = meson_elb_readl(mp, PCIE_PORT_LINK_CTRL_OFF); |
5245 | - val &= ~LINK_CAPABLE_MASK; |
5246 | + val &= ~(LINK_CAPABLE_MASK | FAST_LINK_MODE); |
5247 | meson_elb_writel(mp, val, PCIE_PORT_LINK_CTRL_OFF); |
5248 | |
5249 | val = meson_elb_readl(mp, PCIE_PORT_LINK_CTRL_OFF); |
5250 | - val |= LINK_CAPABLE_X1 | FAST_LINK_MODE; |
5251 | + val |= LINK_CAPABLE_X1; |
5252 | meson_elb_writel(mp, val, PCIE_PORT_LINK_CTRL_OFF); |
5253 | |
5254 | val = meson_elb_readl(mp, PCIE_GEN2_CTRL_OFF); |
5255 | diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c |
5256 | index 8615f1548882..fbcb211cceb4 100644 |
5257 | --- a/drivers/pci/controller/dwc/pcie-designware-host.c |
5258 | +++ b/drivers/pci/controller/dwc/pcie-designware-host.c |
5259 | @@ -263,6 +263,8 @@ int dw_pcie_allocate_domains(struct pcie_port *pp) |
5260 | return -ENOMEM; |
5261 | } |
5262 | |
5263 | + irq_domain_update_bus_token(pp->irq_domain, DOMAIN_BUS_NEXUS); |
5264 | + |
5265 | pp->msi_domain = pci_msi_create_irq_domain(fwnode, |
5266 | &dw_pcie_msi_domain_info, |
5267 | pp->irq_domain); |
5268 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
5269 | index 97245e076548..f2481e80e272 100644 |
5270 | --- a/drivers/pci/controller/pci-aardvark.c |
5271 | +++ b/drivers/pci/controller/pci-aardvark.c |
5272 | @@ -344,10 +344,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
5273 | |
5274 | advk_pcie_wait_for_link(pcie); |
5275 | |
5276 | - reg = PCIE_CORE_LINK_L0S_ENTRY | |
5277 | - (1 << PCIE_CORE_LINK_WIDTH_SHIFT); |
5278 | - advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
5279 | - |
5280 | reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); |
5281 | reg |= PCIE_CORE_CMD_MEM_ACCESS_EN | |
5282 | PCIE_CORE_CMD_IO_ACCESS_EN | |
5283 | diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c |
5284 | index d219404bad92..9a86bb7448ac 100644 |
5285 | --- a/drivers/pci/controller/pci-v3-semi.c |
5286 | +++ b/drivers/pci/controller/pci-v3-semi.c |
5287 | @@ -743,7 +743,7 @@ static int v3_pci_probe(struct platform_device *pdev) |
5288 | int ret; |
5289 | LIST_HEAD(res); |
5290 | |
5291 | - host = pci_alloc_host_bridge(sizeof(*v3)); |
5292 | + host = devm_pci_alloc_host_bridge(dev, sizeof(*v3)); |
5293 | if (!host) |
5294 | return -ENOMEM; |
5295 | |
5296 | diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c |
5297 | index 1ad0b56f11b4..04114352d0e7 100644 |
5298 | --- a/drivers/pci/controller/pcie-rcar.c |
5299 | +++ b/drivers/pci/controller/pcie-rcar.c |
5300 | @@ -335,11 +335,12 @@ static struct pci_ops rcar_pcie_ops = { |
5301 | }; |
5302 | |
5303 | static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, |
5304 | - struct resource *res) |
5305 | + struct resource_entry *window) |
5306 | { |
5307 | /* Setup PCIe address space mappings for each resource */ |
5308 | resource_size_t size; |
5309 | resource_size_t res_start; |
5310 | + struct resource *res = window->res; |
5311 | u32 mask; |
5312 | |
5313 | rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win)); |
5314 | @@ -353,9 +354,9 @@ static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, |
5315 | rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); |
5316 | |
5317 | if (res->flags & IORESOURCE_IO) |
5318 | - res_start = pci_pio_to_address(res->start); |
5319 | + res_start = pci_pio_to_address(res->start) - window->offset; |
5320 | else |
5321 | - res_start = res->start; |
5322 | + res_start = res->start - window->offset; |
5323 | |
5324 | rcar_pci_write_reg(pcie, upper_32_bits(res_start), PCIEPAUR(win)); |
5325 | rcar_pci_write_reg(pcie, lower_32_bits(res_start) & ~0x7F, |
5326 | @@ -384,7 +385,7 @@ static int rcar_pcie_setup(struct list_head *resource, struct rcar_pcie *pci) |
5327 | switch (resource_type(res)) { |
5328 | case IORESOURCE_IO: |
5329 | case IORESOURCE_MEM: |
5330 | - rcar_pcie_setup_window(i, pci, res); |
5331 | + rcar_pcie_setup_window(i, pci, win); |
5332 | i++; |
5333 | break; |
5334 | case IORESOURCE_BUS: |
5335 | diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c |
5336 | index afc1a3d240b5..87348ecfe3fc 100644 |
5337 | --- a/drivers/pci/controller/vmd.c |
5338 | +++ b/drivers/pci/controller/vmd.c |
5339 | @@ -593,9 +593,11 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) |
5340 | if (!membar2) |
5341 | return -ENOMEM; |
5342 | offset[0] = vmd->dev->resource[VMD_MEMBAR1].start - |
5343 | - readq(membar2 + MB2_SHADOW_OFFSET); |
5344 | + (readq(membar2 + MB2_SHADOW_OFFSET) & |
5345 | + PCI_BASE_ADDRESS_MEM_MASK); |
5346 | offset[1] = vmd->dev->resource[VMD_MEMBAR2].start - |
5347 | - readq(membar2 + MB2_SHADOW_OFFSET + 8); |
5348 | + (readq(membar2 + MB2_SHADOW_OFFSET + 8) & |
5349 | + PCI_BASE_ADDRESS_MEM_MASK); |
5350 | pci_iounmap(vmd->dev, membar2); |
5351 | } |
5352 | } |
5353 | diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c |
5354 | index 5fd90105510d..d3b6b9a05618 100644 |
5355 | --- a/drivers/pci/pci-bridge-emul.c |
5356 | +++ b/drivers/pci/pci-bridge-emul.c |
5357 | @@ -195,8 +195,8 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { |
5358 | * RO, the rest is reserved |
5359 | */ |
5360 | .w1c = GENMASK(19, 16), |
5361 | - .ro = GENMASK(20, 19), |
5362 | - .rsvd = GENMASK(31, 21), |
5363 | + .ro = GENMASK(21, 20), |
5364 | + .rsvd = GENMASK(31, 22), |
5365 | }, |
5366 | |
5367 | [PCI_EXP_LNKCAP / 4] = { |
5368 | @@ -236,7 +236,7 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { |
5369 | PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC) << 16, |
5370 | .ro = (PCI_EXP_SLTSTA_MRLSS | PCI_EXP_SLTSTA_PDS | |
5371 | PCI_EXP_SLTSTA_EIS) << 16, |
5372 | - .rsvd = GENMASK(15, 12) | (GENMASK(15, 9) << 16), |
5373 | + .rsvd = GENMASK(15, 13) | (GENMASK(15, 9) << 16), |
5374 | }, |
5375 | |
5376 | [PCI_EXP_RTCTL / 4] = { |
5377 | diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
5378 | index c73e8095a849..689f0280c038 100644 |
5379 | --- a/drivers/pci/pci.c |
5380 | +++ b/drivers/pci/pci.c |
5381 | @@ -4608,7 +4608,8 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) |
5382 | * pcie_wait_for_link_delay - Wait until link is active or inactive |
5383 | * @pdev: Bridge device |
5384 | * @active: waiting for active or inactive? |
5385 | - * @delay: Delay to wait after link has become active (in ms) |
5386 | + * @delay: Delay to wait after link has become active (in ms). Specify %0 |
5387 | + * for no delay. |
5388 | * |
5389 | * Use this to wait till link becomes active or inactive. |
5390 | */ |
5391 | @@ -4649,7 +4650,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, |
5392 | msleep(10); |
5393 | timeout -= 10; |
5394 | } |
5395 | - if (active && ret) |
5396 | + if (active && ret && delay) |
5397 | msleep(delay); |
5398 | else if (ret != active) |
5399 | pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", |
5400 | @@ -4770,17 +4771,28 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) |
5401 | if (!pcie_downstream_port(dev)) |
5402 | return; |
5403 | |
5404 | - if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { |
5405 | - pci_dbg(dev, "waiting %d ms for downstream link\n", delay); |
5406 | - msleep(delay); |
5407 | - } else { |
5408 | - pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", |
5409 | - delay); |
5410 | - if (!pcie_wait_for_link_delay(dev, true, delay)) { |
5411 | + /* |
5412 | + * Per PCIe r5.0, sec 6.6.1, for downstream ports that support |
5413 | + * speeds > 5 GT/s, we must wait for link training to complete |
5414 | + * before the mandatory delay. |
5415 | + * |
5416 | + * We can only tell when link training completes via DLL Link |
5417 | + * Active, which is required for downstream ports that support |
5418 | + * speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common |
5419 | + * devices do not implement Link Active reporting even when it's |
5420 | + * required, so we'll check for that directly instead of checking |
5421 | + * the supported link speed. We assume devices without Link Active |
5422 | + * reporting can train in 100 ms regardless of speed. |
5423 | + */ |
5424 | + if (dev->link_active_reporting) { |
5425 | + pci_dbg(dev, "waiting for link to train\n"); |
5426 | + if (!pcie_wait_for_link_delay(dev, true, 0)) { |
5427 | /* Did not train, no need to wait any further */ |
5428 | return; |
5429 | } |
5430 | } |
5431 | + pci_dbg(child, "waiting %d ms to become accessible\n", delay); |
5432 | + msleep(delay); |
5433 | |
5434 | if (!pci_device_is_present(child)) { |
5435 | pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); |
5436 | diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
5437 | index 5a1bbf2cb7e9..4a0ec34062d6 100644 |
5438 | --- a/drivers/pci/pcie/aspm.c |
5439 | +++ b/drivers/pci/pcie/aspm.c |
5440 | @@ -628,16 +628,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) |
5441 | |
5442 | /* Setup initial capable state. Will be updated later */ |
5443 | link->aspm_capable = link->aspm_support; |
5444 | - /* |
5445 | - * If the downstream component has pci bridge function, don't |
5446 | - * do ASPM for now. |
5447 | - */ |
5448 | - list_for_each_entry(child, &linkbus->devices, bus_list) { |
5449 | - if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) { |
5450 | - link->aspm_disable = ASPM_STATE_ALL; |
5451 | - break; |
5452 | - } |
5453 | - } |
5454 | |
5455 | /* Get and check endpoint acceptable latencies */ |
5456 | list_for_each_entry(child, &linkbus->devices, bus_list) { |
5457 | diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c |
5458 | index 9361f3aa26ab..357a454cafa0 100644 |
5459 | --- a/drivers/pci/pcie/ptm.c |
5460 | +++ b/drivers/pci/pcie/ptm.c |
5461 | @@ -39,10 +39,6 @@ void pci_ptm_init(struct pci_dev *dev) |
5462 | if (!pci_is_pcie(dev)) |
5463 | return; |
5464 | |
5465 | - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); |
5466 | - if (!pos) |
5467 | - return; |
5468 | - |
5469 | /* |
5470 | * Enable PTM only on interior devices (root ports, switch ports, |
5471 | * etc.) on the assumption that it causes no link traffic until an |
5472 | @@ -52,6 +48,23 @@ void pci_ptm_init(struct pci_dev *dev) |
5473 | pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END)) |
5474 | return; |
5475 | |
5476 | + /* |
5477 | + * Switch Downstream Ports are not permitted to have a PTM |
5478 | + * capability; their PTM behavior is controlled by the Upstream |
5479 | + * Port (PCIe r5.0, sec 7.9.16). |
5480 | + */ |
5481 | + ups = pci_upstream_bridge(dev); |
5482 | + if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM && |
5483 | + ups && ups->ptm_enabled) { |
5484 | + dev->ptm_granularity = ups->ptm_granularity; |
5485 | + dev->ptm_enabled = 1; |
5486 | + return; |
5487 | + } |
5488 | + |
5489 | + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); |
5490 | + if (!pos) |
5491 | + return; |
5492 | + |
5493 | pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); |
5494 | local_clock = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; |
5495 | |
5496 | @@ -61,7 +74,6 @@ void pci_ptm_init(struct pci_dev *dev) |
5497 | * the spec recommendation (PCIe r3.1, sec 7.32.3), select the |
5498 | * furthest upstream Time Source as the PTM Root. |
5499 | */ |
5500 | - ups = pci_upstream_bridge(dev); |
5501 | if (ups && ups->ptm_enabled) { |
5502 | ctrl = PCI_PTM_CTRL_ENABLE; |
5503 | if (ups->ptm_granularity == 0) |
5504 | diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
5505 | index 83d909abc61d..8fa13486f2f1 100644 |
5506 | --- a/drivers/pci/probe.c |
5507 | +++ b/drivers/pci/probe.c |
5508 | @@ -867,9 +867,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
5509 | goto free; |
5510 | |
5511 | err = device_register(&bridge->dev); |
5512 | - if (err) |
5513 | + if (err) { |
5514 | put_device(&bridge->dev); |
5515 | - |
5516 | + goto free; |
5517 | + } |
5518 | bus->bridge = get_device(&bridge->dev); |
5519 | device_enable_async_suspend(bus->bridge); |
5520 | pci_set_bus_of_node(bus); |
5521 | diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c |
5522 | index d8ca40a97693..d21fa04fa44d 100644 |
5523 | --- a/drivers/pci/setup-res.c |
5524 | +++ b/drivers/pci/setup-res.c |
5525 | @@ -439,10 +439,11 @@ int pci_resize_resource(struct pci_dev *dev, int resno, int size) |
5526 | res->end = res->start + pci_rebar_size_to_bytes(size) - 1; |
5527 | |
5528 | /* Check if the new config works by trying to assign everything. */ |
5529 | - ret = pci_reassign_bridge_resources(dev->bus->self, res->flags); |
5530 | - if (ret) |
5531 | - goto error_resize; |
5532 | - |
5533 | + if (dev->bus->self) { |
5534 | + ret = pci_reassign_bridge_resources(dev->bus->self, res->flags); |
5535 | + if (ret) |
5536 | + goto error_resize; |
5537 | + } |
5538 | return 0; |
5539 | |
5540 | error_resize: |
5541 | diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
5542 | index 078b8dc57250..c5b0950c2a7a 100644 |
5543 | --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
5544 | +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
5545 | @@ -35,7 +35,7 @@ |
5546 | /* L3C has 8-counters */ |
5547 | #define L3C_NR_COUNTERS 0x8 |
5548 | |
5549 | -#define L3C_PERF_CTRL_EN 0x20000 |
5550 | +#define L3C_PERF_CTRL_EN 0x10000 |
5551 | #define L3C_EVTYPE_NONE 0xff |
5552 | |
5553 | /* |
5554 | diff --git a/drivers/phy/broadcom/phy-bcm-sr-usb.c b/drivers/phy/broadcom/phy-bcm-sr-usb.c |
5555 | index fe6c58910e4c..7c7862b4f41f 100644 |
5556 | --- a/drivers/phy/broadcom/phy-bcm-sr-usb.c |
5557 | +++ b/drivers/phy/broadcom/phy-bcm-sr-usb.c |
5558 | @@ -16,8 +16,6 @@ enum bcm_usb_phy_version { |
5559 | }; |
5560 | |
5561 | enum bcm_usb_phy_reg { |
5562 | - PLL_NDIV_FRAC, |
5563 | - PLL_NDIV_INT, |
5564 | PLL_CTRL, |
5565 | PHY_CTRL, |
5566 | PHY_PLL_CTRL, |
5567 | @@ -31,18 +29,11 @@ static const u8 bcm_usb_combo_phy_ss[] = { |
5568 | }; |
5569 | |
5570 | static const u8 bcm_usb_combo_phy_hs[] = { |
5571 | - [PLL_NDIV_FRAC] = 0x04, |
5572 | - [PLL_NDIV_INT] = 0x08, |
5573 | [PLL_CTRL] = 0x0c, |
5574 | [PHY_CTRL] = 0x10, |
5575 | }; |
5576 | |
5577 | -#define HSPLL_NDIV_INT_VAL 0x13 |
5578 | -#define HSPLL_NDIV_FRAC_VAL 0x1005 |
5579 | - |
5580 | static const u8 bcm_usb_hs_phy[] = { |
5581 | - [PLL_NDIV_FRAC] = 0x0, |
5582 | - [PLL_NDIV_INT] = 0x4, |
5583 | [PLL_CTRL] = 0x8, |
5584 | [PHY_CTRL] = 0xc, |
5585 | }; |
5586 | @@ -52,7 +43,6 @@ enum pll_ctrl_bits { |
5587 | SSPLL_SUSPEND_EN, |
5588 | PLL_SEQ_START, |
5589 | PLL_LOCK, |
5590 | - PLL_PDIV, |
5591 | }; |
5592 | |
5593 | static const u8 u3pll_ctrl[] = { |
5594 | @@ -66,29 +56,17 @@ static const u8 u3pll_ctrl[] = { |
5595 | #define HSPLL_PDIV_VAL 0x1 |
5596 | |
5597 | static const u8 u2pll_ctrl[] = { |
5598 | - [PLL_PDIV] = 1, |
5599 | [PLL_RESETB] = 5, |
5600 | [PLL_LOCK] = 6, |
5601 | }; |
5602 | |
5603 | enum bcm_usb_phy_ctrl_bits { |
5604 | CORERDY, |
5605 | - AFE_LDO_PWRDWNB, |
5606 | - AFE_PLL_PWRDWNB, |
5607 | - AFE_BG_PWRDWNB, |
5608 | - PHY_ISO, |
5609 | PHY_RESETB, |
5610 | PHY_PCTL, |
5611 | }; |
5612 | |
5613 | #define PHY_PCTL_MASK 0xffff |
5614 | -/* |
5615 | - * 0x0806 of PCTL_VAL has below bits set |
5616 | - * BIT-8 : refclk divider 1 |
5617 | - * BIT-3:2: device mode; mode is not effect |
5618 | - * BIT-1: soft reset active low |
5619 | - */ |
5620 | -#define HSPHY_PCTL_VAL 0x0806 |
5621 | #define SSPHY_PCTL_VAL 0x0006 |
5622 | |
5623 | static const u8 u3phy_ctrl[] = { |
5624 | @@ -98,10 +76,6 @@ static const u8 u3phy_ctrl[] = { |
5625 | |
5626 | static const u8 u2phy_ctrl[] = { |
5627 | [CORERDY] = 0, |
5628 | - [AFE_LDO_PWRDWNB] = 1, |
5629 | - [AFE_PLL_PWRDWNB] = 2, |
5630 | - [AFE_BG_PWRDWNB] = 3, |
5631 | - [PHY_ISO] = 4, |
5632 | [PHY_RESETB] = 5, |
5633 | [PHY_PCTL] = 6, |
5634 | }; |
5635 | @@ -186,38 +160,13 @@ static int bcm_usb_hs_phy_init(struct bcm_usb_phy_cfg *phy_cfg) |
5636 | int ret = 0; |
5637 | void __iomem *regs = phy_cfg->regs; |
5638 | const u8 *offset; |
5639 | - u32 rd_data; |
5640 | |
5641 | offset = phy_cfg->offset; |
5642 | |
5643 | - writel(HSPLL_NDIV_INT_VAL, regs + offset[PLL_NDIV_INT]); |
5644 | - writel(HSPLL_NDIV_FRAC_VAL, regs + offset[PLL_NDIV_FRAC]); |
5645 | - |
5646 | - rd_data = readl(regs + offset[PLL_CTRL]); |
5647 | - rd_data &= ~(HSPLL_PDIV_MASK << u2pll_ctrl[PLL_PDIV]); |
5648 | - rd_data |= (HSPLL_PDIV_VAL << u2pll_ctrl[PLL_PDIV]); |
5649 | - writel(rd_data, regs + offset[PLL_CTRL]); |
5650 | - |
5651 | - /* Set Core Ready high */ |
5652 | - bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], |
5653 | - BIT(u2phy_ctrl[CORERDY])); |
5654 | - |
5655 | - /* Maximum timeout for Core Ready done */ |
5656 | - msleep(30); |
5657 | - |
5658 | + bcm_usb_reg32_clrbits(regs + offset[PLL_CTRL], |
5659 | + BIT(u2pll_ctrl[PLL_RESETB])); |
5660 | bcm_usb_reg32_setbits(regs + offset[PLL_CTRL], |
5661 | BIT(u2pll_ctrl[PLL_RESETB])); |
5662 | - bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], |
5663 | - BIT(u2phy_ctrl[PHY_RESETB])); |
5664 | - |
5665 | - |
5666 | - rd_data = readl(regs + offset[PHY_CTRL]); |
5667 | - rd_data &= ~(PHY_PCTL_MASK << u2phy_ctrl[PHY_PCTL]); |
5668 | - rd_data |= (HSPHY_PCTL_VAL << u2phy_ctrl[PHY_PCTL]); |
5669 | - writel(rd_data, regs + offset[PHY_CTRL]); |
5670 | - |
5671 | - /* Maximum timeout for PLL reset done */ |
5672 | - msleep(30); |
5673 | |
5674 | ret = bcm_usb_pll_lock_check(regs + offset[PLL_CTRL], |
5675 | BIT(u2pll_ctrl[PLL_LOCK])); |
5676 | diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c |
5677 | index 9f42036c5fbb..1f81569c7ae3 100644 |
5678 | --- a/drivers/pinctrl/freescale/pinctrl-imx.c |
5679 | +++ b/drivers/pinctrl/freescale/pinctrl-imx.c |
5680 | @@ -774,16 +774,6 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, |
5681 | return 0; |
5682 | } |
5683 | |
5684 | -/* |
5685 | - * imx_free_resources() - free memory used by this driver |
5686 | - * @info: info driver instance |
5687 | - */ |
5688 | -static void imx_free_resources(struct imx_pinctrl *ipctl) |
5689 | -{ |
5690 | - if (ipctl->pctl) |
5691 | - pinctrl_unregister(ipctl->pctl); |
5692 | -} |
5693 | - |
5694 | int imx_pinctrl_probe(struct platform_device *pdev, |
5695 | const struct imx_pinctrl_soc_info *info) |
5696 | { |
5697 | @@ -874,23 +864,18 @@ int imx_pinctrl_probe(struct platform_device *pdev, |
5698 | &ipctl->pctl); |
5699 | if (ret) { |
5700 | dev_err(&pdev->dev, "could not register IMX pinctrl driver\n"); |
5701 | - goto free; |
5702 | + return ret; |
5703 | } |
5704 | |
5705 | ret = imx_pinctrl_probe_dt(pdev, ipctl); |
5706 | if (ret) { |
5707 | dev_err(&pdev->dev, "fail to probe dt properties\n"); |
5708 | - goto free; |
5709 | + return ret; |
5710 | } |
5711 | |
5712 | dev_info(&pdev->dev, "initialized IMX pinctrl driver\n"); |
5713 | |
5714 | return pinctrl_enable(ipctl->pctl); |
5715 | - |
5716 | -free: |
5717 | - imx_free_resources(ipctl); |
5718 | - |
5719 | - return ret; |
5720 | } |
5721 | |
5722 | static int __maybe_unused imx_pinctrl_suspend(struct device *dev) |
5723 | diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
5724 | index 7e29e3fecdb2..5bb183c0ce31 100644 |
5725 | --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
5726 | +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
5727 | @@ -638,7 +638,6 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, |
5728 | |
5729 | ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); |
5730 | if (ret) { |
5731 | - pinctrl_unregister(ipctl->pctl); |
5732 | dev_err(&pdev->dev, "Failed to populate subdevices\n"); |
5733 | return ret; |
5734 | } |
5735 | diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c |
5736 | index fb76fb2e9ea5..0a951a75c82b 100644 |
5737 | --- a/drivers/pinctrl/pinctrl-ocelot.c |
5738 | +++ b/drivers/pinctrl/pinctrl-ocelot.c |
5739 | @@ -711,11 +711,12 @@ static void ocelot_irq_handler(struct irq_desc *desc) |
5740 | struct irq_chip *parent_chip = irq_desc_get_chip(desc); |
5741 | struct gpio_chip *chip = irq_desc_get_handler_data(desc); |
5742 | struct ocelot_pinctrl *info = gpiochip_get_data(chip); |
5743 | + unsigned int id_reg = OCELOT_GPIO_INTR_IDENT * info->stride; |
5744 | unsigned int reg = 0, irq, i; |
5745 | unsigned long irqs; |
5746 | |
5747 | for (i = 0; i < info->stride; i++) { |
5748 | - regmap_read(info->map, OCELOT_GPIO_INTR_IDENT + 4 * i, ®); |
5749 | + regmap_read(info->map, id_reg + 4 * i, ®); |
5750 | if (!reg) |
5751 | continue; |
5752 | |
5753 | diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
5754 | index dc0bbf198cbc..1bd8840e11a6 100644 |
5755 | --- a/drivers/pinctrl/pinctrl-rockchip.c |
5756 | +++ b/drivers/pinctrl/pinctrl-rockchip.c |
5757 | @@ -506,8 +506,8 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
5758 | } |
5759 | |
5760 | map_num += grp->npins; |
5761 | - new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), |
5762 | - GFP_KERNEL); |
5763 | + |
5764 | + new_map = kcalloc(map_num, sizeof(*new_map), GFP_KERNEL); |
5765 | if (!new_map) |
5766 | return -ENOMEM; |
5767 | |
5768 | @@ -517,7 +517,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
5769 | /* create mux map */ |
5770 | parent = of_get_parent(np); |
5771 | if (!parent) { |
5772 | - devm_kfree(pctldev->dev, new_map); |
5773 | + kfree(new_map); |
5774 | return -EINVAL; |
5775 | } |
5776 | new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; |
5777 | @@ -544,6 +544,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
5778 | static void rockchip_dt_free_map(struct pinctrl_dev *pctldev, |
5779 | struct pinctrl_map *map, unsigned num_maps) |
5780 | { |
5781 | + kfree(map); |
5782 | } |
5783 | |
5784 | static const struct pinctrl_ops rockchip_pctrl_ops = { |
5785 | diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c |
5786 | index 017fc6b3e27e..ca9da61cfc4e 100644 |
5787 | --- a/drivers/pinctrl/pinctrl-rza1.c |
5788 | +++ b/drivers/pinctrl/pinctrl-rza1.c |
5789 | @@ -418,7 +418,7 @@ static const struct rza1_bidir_entry rza1l_bidir_entries[RZA1_NPORTS] = { |
5790 | }; |
5791 | |
5792 | static const struct rza1_swio_entry rza1l_swio_entries[] = { |
5793 | - [0] = { ARRAY_SIZE(rza1h_swio_pins), rza1h_swio_pins }, |
5794 | + [0] = { ARRAY_SIZE(rza1l_swio_pins), rza1l_swio_pins }, |
5795 | }; |
5796 | |
5797 | /* RZ/A1L (r7s72102x) pinmux flags table */ |
5798 | diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig |
5799 | index c84a7b1caeb6..d6fdc10c29f0 100644 |
5800 | --- a/drivers/power/supply/Kconfig |
5801 | +++ b/drivers/power/supply/Kconfig |
5802 | @@ -577,7 +577,7 @@ config CHARGER_BQ24257 |
5803 | tristate "TI BQ24250/24251/24257 battery charger driver" |
5804 | depends on I2C |
5805 | depends on GPIOLIB || COMPILE_TEST |
5806 | - depends on REGMAP_I2C |
5807 | + select REGMAP_I2C |
5808 | help |
5809 | Say Y to enable support for the TI BQ24250, BQ24251, and BQ24257 battery |
5810 | chargers. |
5811 | diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c |
5812 | index 84a206f42a8e..e7931ffb7151 100644 |
5813 | --- a/drivers/power/supply/lp8788-charger.c |
5814 | +++ b/drivers/power/supply/lp8788-charger.c |
5815 | @@ -572,27 +572,14 @@ static void lp8788_setup_adc_channel(struct device *dev, |
5816 | return; |
5817 | |
5818 | /* ADC channel for battery voltage */ |
5819 | - chan = iio_channel_get(dev, pdata->adc_vbatt); |
5820 | + chan = devm_iio_channel_get(dev, pdata->adc_vbatt); |
5821 | pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan; |
5822 | |
5823 | /* ADC channel for battery temperature */ |
5824 | - chan = iio_channel_get(dev, pdata->adc_batt_temp); |
5825 | + chan = devm_iio_channel_get(dev, pdata->adc_batt_temp); |
5826 | pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan; |
5827 | } |
5828 | |
5829 | -static void lp8788_release_adc_channel(struct lp8788_charger *pchg) |
5830 | -{ |
5831 | - int i; |
5832 | - |
5833 | - for (i = 0; i < LP8788_NUM_CHG_ADC; i++) { |
5834 | - if (!pchg->chan[i]) |
5835 | - continue; |
5836 | - |
5837 | - iio_channel_release(pchg->chan[i]); |
5838 | - pchg->chan[i] = NULL; |
5839 | - } |
5840 | -} |
5841 | - |
5842 | static ssize_t lp8788_show_charger_status(struct device *dev, |
5843 | struct device_attribute *attr, char *buf) |
5844 | { |
5845 | @@ -735,7 +722,6 @@ static int lp8788_charger_remove(struct platform_device *pdev) |
5846 | flush_work(&pchg->charger_work); |
5847 | lp8788_irq_unregister(pdev, pchg); |
5848 | lp8788_psy_unregister(pchg); |
5849 | - lp8788_release_adc_channel(pchg); |
5850 | |
5851 | return 0; |
5852 | } |
5853 | diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c |
5854 | index c1d124b8be0c..d102921b3ab2 100644 |
5855 | --- a/drivers/power/supply/smb347-charger.c |
5856 | +++ b/drivers/power/supply/smb347-charger.c |
5857 | @@ -1138,6 +1138,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg) |
5858 | switch (reg) { |
5859 | case IRQSTAT_A: |
5860 | case IRQSTAT_C: |
5861 | + case IRQSTAT_D: |
5862 | case IRQSTAT_E: |
5863 | case IRQSTAT_F: |
5864 | case STAT_A: |
5865 | diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c |
5866 | index c9e57bd109fb..599a0f66a384 100644 |
5867 | --- a/drivers/pwm/pwm-img.c |
5868 | +++ b/drivers/pwm/pwm-img.c |
5869 | @@ -129,8 +129,10 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
5870 | duty = DIV_ROUND_UP(timebase * duty_ns, period_ns); |
5871 | |
5872 | ret = pm_runtime_get_sync(chip->dev); |
5873 | - if (ret < 0) |
5874 | + if (ret < 0) { |
5875 | + pm_runtime_put_autosuspend(chip->dev); |
5876 | return ret; |
5877 | + } |
5878 | |
5879 | val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); |
5880 | val &= ~(PWM_CTRL_CFG_DIV_MASK << PWM_CTRL_CFG_DIV_SHIFT(pwm->hwpwm)); |
5881 | @@ -331,8 +333,10 @@ static int img_pwm_remove(struct platform_device *pdev) |
5882 | int ret; |
5883 | |
5884 | ret = pm_runtime_get_sync(&pdev->dev); |
5885 | - if (ret < 0) |
5886 | + if (ret < 0) { |
5887 | + pm_runtime_put(&pdev->dev); |
5888 | return ret; |
5889 | + } |
5890 | |
5891 | for (i = 0; i < pwm_chip->chip.npwm; i++) { |
5892 | val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); |
5893 | diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c |
5894 | index 9d78cc21cb12..d0f5c69930d0 100644 |
5895 | --- a/drivers/pwm/pwm-jz4740.c |
5896 | +++ b/drivers/pwm/pwm-jz4740.c |
5897 | @@ -108,8 +108,8 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
5898 | if (prescaler == 6) |
5899 | return -EINVAL; |
5900 | |
5901 | - tmp = (unsigned long long)period * state->duty_cycle; |
5902 | - do_div(tmp, state->period); |
5903 | + tmp = (unsigned long long)rate * state->duty_cycle; |
5904 | + do_div(tmp, NSEC_PER_SEC); |
5905 | duty = period - tmp; |
5906 | |
5907 | if (duty >= period) |
5908 | diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c |
5909 | index 6ba065d5c4d9..d84e9f306086 100644 |
5910 | --- a/drivers/remoteproc/qcom_q6v5_mss.c |
5911 | +++ b/drivers/remoteproc/qcom_q6v5_mss.c |
5912 | @@ -1005,7 +1005,13 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
5913 | goto release_firmware; |
5914 | } |
5915 | |
5916 | - ptr = qproc->mpss_region + offset; |
5917 | + ptr = ioremap_wc(qproc->mpss_phys + offset, phdr->p_memsz); |
5918 | + if (!ptr) { |
5919 | + dev_err(qproc->dev, |
5920 | + "unable to map memory region: %pa+%zx-%x\n", |
5921 | + &qproc->mpss_phys, offset, phdr->p_memsz); |
5922 | + goto release_firmware; |
5923 | + } |
5924 | |
5925 | if (phdr->p_filesz && phdr->p_offset < fw->size) { |
5926 | /* Firmware is large enough to be non-split */ |
5927 | @@ -1014,6 +1020,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
5928 | "failed to load segment %d from truncated file %s\n", |
5929 | i, fw_name); |
5930 | ret = -EINVAL; |
5931 | + iounmap(ptr); |
5932 | goto release_firmware; |
5933 | } |
5934 | |
5935 | @@ -1024,6 +1031,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
5936 | ret = request_firmware(&seg_fw, fw_name, qproc->dev); |
5937 | if (ret) { |
5938 | dev_err(qproc->dev, "failed to load %s\n", fw_name); |
5939 | + iounmap(ptr); |
5940 | goto release_firmware; |
5941 | } |
5942 | |
5943 | @@ -1036,6 +1044,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
5944 | memset(ptr + phdr->p_filesz, 0, |
5945 | phdr->p_memsz - phdr->p_filesz); |
5946 | } |
5947 | + iounmap(ptr); |
5948 | size += phdr->p_memsz; |
5949 | } |
5950 | |
5951 | @@ -1075,7 +1084,8 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, |
5952 | int ret = 0; |
5953 | struct q6v5 *qproc = rproc->priv; |
5954 | unsigned long mask = BIT((unsigned long)segment->priv); |
5955 | - void *ptr = rproc_da_to_va(rproc, segment->da, segment->size); |
5956 | + int offset = segment->da - qproc->mpss_reloc; |
5957 | + void *ptr = NULL; |
5958 | |
5959 | /* Unlock mba before copying segments */ |
5960 | if (!qproc->dump_mba_loaded) { |
5961 | @@ -1089,10 +1099,15 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, |
5962 | } |
5963 | } |
5964 | |
5965 | - if (!ptr || ret) |
5966 | - memset(dest, 0xff, segment->size); |
5967 | - else |
5968 | + if (!ret) |
5969 | + ptr = ioremap_wc(qproc->mpss_phys + offset, segment->size); |
5970 | + |
5971 | + if (ptr) { |
5972 | memcpy(dest, ptr, segment->size); |
5973 | + iounmap(ptr); |
5974 | + } else { |
5975 | + memset(dest, 0xff, segment->size); |
5976 | + } |
5977 | |
5978 | qproc->dump_segment_mask |= mask; |
5979 | |
5980 | @@ -1393,12 +1408,6 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) |
5981 | |
5982 | qproc->mpss_phys = qproc->mpss_reloc = r.start; |
5983 | qproc->mpss_size = resource_size(&r); |
5984 | - qproc->mpss_region = devm_ioremap_wc(qproc->dev, qproc->mpss_phys, qproc->mpss_size); |
5985 | - if (!qproc->mpss_region) { |
5986 | - dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n", |
5987 | - &r.start, qproc->mpss_size); |
5988 | - return -EBUSY; |
5989 | - } |
5990 | |
5991 | return 0; |
5992 | } |
5993 | diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c |
5994 | index 0896b3614eb1..ce92ae227aa1 100644 |
5995 | --- a/drivers/remoteproc/remoteproc_core.c |
5996 | +++ b/drivers/remoteproc/remoteproc_core.c |
5997 | @@ -2036,6 +2036,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, |
5998 | rproc->dev.type = &rproc_type; |
5999 | rproc->dev.class = &rproc_class; |
6000 | rproc->dev.driver_data = rproc; |
6001 | + idr_init(&rproc->notifyids); |
6002 | |
6003 | /* Assign a unique device index and name */ |
6004 | rproc->index = ida_simple_get(&rproc_dev_index, 0, 0, GFP_KERNEL); |
6005 | @@ -2060,8 +2061,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, |
6006 | |
6007 | mutex_init(&rproc->lock); |
6008 | |
6009 | - idr_init(&rproc->notifyids); |
6010 | - |
6011 | INIT_LIST_HEAD(&rproc->carveouts); |
6012 | INIT_LIST_HEAD(&rproc->mappings); |
6013 | INIT_LIST_HEAD(&rproc->traces); |
6014 | diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c |
6015 | index afce2c0b4bd6..d6802e6191cb 100644 |
6016 | --- a/drivers/rtc/rtc-mc13xxx.c |
6017 | +++ b/drivers/rtc/rtc-mc13xxx.c |
6018 | @@ -308,8 +308,10 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) |
6019 | mc13xxx_unlock(mc13xxx); |
6020 | |
6021 | ret = rtc_register_device(priv->rtc); |
6022 | - if (ret) |
6023 | + if (ret) { |
6024 | + mc13xxx_lock(mc13xxx); |
6025 | goto err_irq_request; |
6026 | + } |
6027 | |
6028 | return 0; |
6029 | |
6030 | diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c |
6031 | index 2b316661a578..bbdfebd70644 100644 |
6032 | --- a/drivers/rtc/rtc-rv3028.c |
6033 | +++ b/drivers/rtc/rtc-rv3028.c |
6034 | @@ -625,6 +625,8 @@ static int rv3028_probe(struct i2c_client *client) |
6035 | return -ENOMEM; |
6036 | |
6037 | rv3028->regmap = devm_regmap_init_i2c(client, ®map_config); |
6038 | + if (IS_ERR(rv3028->regmap)) |
6039 | + return PTR_ERR(rv3028->regmap); |
6040 | |
6041 | i2c_set_clientdata(client, rv3028); |
6042 | |
6043 | diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h |
6044 | index a58b45df95d7..3b0a4483a252 100644 |
6045 | --- a/drivers/s390/cio/qdio.h |
6046 | +++ b/drivers/s390/cio/qdio.h |
6047 | @@ -372,7 +372,6 @@ static inline int multicast_outbound(struct qdio_q *q) |
6048 | extern u64 last_ai_time; |
6049 | |
6050 | /* prototypes for thin interrupt */ |
6051 | -void qdio_setup_thinint(struct qdio_irq *irq_ptr); |
6052 | int qdio_establish_thinint(struct qdio_irq *irq_ptr); |
6053 | void qdio_shutdown_thinint(struct qdio_irq *irq_ptr); |
6054 | void tiqdio_add_input_queues(struct qdio_irq *irq_ptr); |
6055 | diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c |
6056 | index ee0b3c586211..9dc56aa3ae55 100644 |
6057 | --- a/drivers/s390/cio/qdio_setup.c |
6058 | +++ b/drivers/s390/cio/qdio_setup.c |
6059 | @@ -479,7 +479,6 @@ int qdio_setup_irq(struct qdio_initialize *init_data) |
6060 | setup_queues(irq_ptr, init_data); |
6061 | |
6062 | setup_qib(irq_ptr, init_data); |
6063 | - qdio_setup_thinint(irq_ptr); |
6064 | set_impl_params(irq_ptr, init_data->qib_param_field_format, |
6065 | init_data->qib_param_field, |
6066 | init_data->input_slib_elements, |
6067 | diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c |
6068 | index 93ee067c10ca..ddf780b12d40 100644 |
6069 | --- a/drivers/s390/cio/qdio_thinint.c |
6070 | +++ b/drivers/s390/cio/qdio_thinint.c |
6071 | @@ -268,17 +268,19 @@ int __init tiqdio_register_thinints(void) |
6072 | |
6073 | int qdio_establish_thinint(struct qdio_irq *irq_ptr) |
6074 | { |
6075 | + int rc; |
6076 | + |
6077 | if (!is_thinint_irq(irq_ptr)) |
6078 | return 0; |
6079 | - return set_subchannel_ind(irq_ptr, 0); |
6080 | -} |
6081 | |
6082 | -void qdio_setup_thinint(struct qdio_irq *irq_ptr) |
6083 | -{ |
6084 | - if (!is_thinint_irq(irq_ptr)) |
6085 | - return; |
6086 | irq_ptr->dsci = get_indicator(); |
6087 | DBF_HEX(&irq_ptr->dsci, sizeof(void *)); |
6088 | + |
6089 | + rc = set_subchannel_ind(irq_ptr, 0); |
6090 | + if (rc) |
6091 | + put_indicator(irq_ptr->dsci); |
6092 | + |
6093 | + return rc; |
6094 | } |
6095 | |
6096 | void qdio_shutdown_thinint(struct qdio_irq *irq_ptr) |
6097 | diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c |
6098 | index d12dd89538df..deab66598910 100644 |
6099 | --- a/drivers/scsi/arm/acornscsi.c |
6100 | +++ b/drivers/scsi/arm/acornscsi.c |
6101 | @@ -2911,8 +2911,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) |
6102 | |
6103 | ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
6104 | ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
6105 | - if (!ashost->base || !ashost->fast) |
6106 | + if (!ashost->base || !ashost->fast) { |
6107 | + ret = -ENOMEM; |
6108 | goto out_put; |
6109 | + } |
6110 | |
6111 | host->irq = ec->irq; |
6112 | ashost->host = host; |
6113 | diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
6114 | index 524cdbcd29aa..ec7d01f6e2d5 100644 |
6115 | --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
6116 | +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
6117 | @@ -959,6 +959,7 @@ static int init_act_open(struct cxgbi_sock *csk) |
6118 | struct net_device *ndev = cdev->ports[csk->port_id]; |
6119 | struct cxgbi_hba *chba = cdev->hbas[csk->port_id]; |
6120 | struct sk_buff *skb = NULL; |
6121 | + int ret; |
6122 | |
6123 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
6124 | "csk 0x%p,%u,0x%lx.\n", csk, csk->state, csk->flags); |
6125 | @@ -979,16 +980,16 @@ static int init_act_open(struct cxgbi_sock *csk) |
6126 | csk->atid = cxgb3_alloc_atid(t3dev, &t3_client, csk); |
6127 | if (csk->atid < 0) { |
6128 | pr_err("NO atid available.\n"); |
6129 | - return -EINVAL; |
6130 | + ret = -EINVAL; |
6131 | + goto put_sock; |
6132 | } |
6133 | cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); |
6134 | cxgbi_sock_get(csk); |
6135 | |
6136 | skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL); |
6137 | if (!skb) { |
6138 | - cxgb3_free_atid(t3dev, csk->atid); |
6139 | - cxgbi_sock_put(csk); |
6140 | - return -ENOMEM; |
6141 | + ret = -ENOMEM; |
6142 | + goto free_atid; |
6143 | } |
6144 | skb->sk = (struct sock *)csk; |
6145 | set_arp_failure_handler(skb, act_open_arp_failure); |
6146 | @@ -1010,6 +1011,15 @@ static int init_act_open(struct cxgbi_sock *csk) |
6147 | cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); |
6148 | send_act_open_req(csk, skb, csk->l2t); |
6149 | return 0; |
6150 | + |
6151 | +free_atid: |
6152 | + cxgb3_free_atid(t3dev, csk->atid); |
6153 | +put_sock: |
6154 | + cxgbi_sock_put(csk); |
6155 | + l2t_release(t3dev, csk->l2t); |
6156 | + csk->l2t = NULL; |
6157 | + |
6158 | + return ret; |
6159 | } |
6160 | |
6161 | cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS] = { |
6162 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c |
6163 | index 6f4692f0d714..031aa4043c5e 100644 |
6164 | --- a/drivers/scsi/hisi_sas/hisi_sas_main.c |
6165 | +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c |
6166 | @@ -904,8 +904,11 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no) |
6167 | struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; |
6168 | struct device *dev = hisi_hba->dev; |
6169 | |
6170 | + dev_dbg(dev, "phy%d OOB ready\n", phy_no); |
6171 | + if (phy->phy_attached) |
6172 | + return; |
6173 | + |
6174 | if (!timer_pending(&phy->timer)) { |
6175 | - dev_dbg(dev, "phy%d OOB ready\n", phy_no); |
6176 | phy->timer.expires = jiffies + HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; |
6177 | add_timer(&phy->timer); |
6178 | } |
6179 | diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c |
6180 | index 59f0f1030c54..c5711c659b51 100644 |
6181 | --- a/drivers/scsi/ibmvscsi/ibmvscsi.c |
6182 | +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c |
6183 | @@ -415,6 +415,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, |
6184 | int rc = 0; |
6185 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); |
6186 | |
6187 | + set_adapter_info(hostdata); |
6188 | + |
6189 | /* Re-enable the CRQ */ |
6190 | do { |
6191 | if (rc) |
6192 | diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c |
6193 | index e4857b728033..a64abe38db2d 100644 |
6194 | --- a/drivers/scsi/iscsi_boot_sysfs.c |
6195 | +++ b/drivers/scsi/iscsi_boot_sysfs.c |
6196 | @@ -352,7 +352,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset, |
6197 | boot_kobj->kobj.kset = boot_kset->kset; |
6198 | if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype, |
6199 | NULL, name, index)) { |
6200 | - kfree(boot_kobj); |
6201 | + kobject_put(&boot_kobj->kobj); |
6202 | return NULL; |
6203 | } |
6204 | boot_kobj->data = data; |
6205 | diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
6206 | index 66f8867dd837..94d8f2834100 100644 |
6207 | --- a/drivers/scsi/lpfc/lpfc_els.c |
6208 | +++ b/drivers/scsi/lpfc/lpfc_els.c |
6209 | @@ -8394,6 +8394,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
6210 | spin_lock_irq(shost->host_lock); |
6211 | if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) { |
6212 | spin_unlock_irq(shost->host_lock); |
6213 | + if (newnode) |
6214 | + lpfc_nlp_put(ndlp); |
6215 | goto dropit; |
6216 | } |
6217 | spin_unlock_irq(shost->host_lock); |
6218 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
6219 | index 752b71cfbe12..7fd1d731555f 100644 |
6220 | --- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
6221 | +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
6222 | @@ -4777,7 +4777,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) |
6223 | } |
6224 | |
6225 | kfree(ioc->hpr_lookup); |
6226 | + ioc->hpr_lookup = NULL; |
6227 | kfree(ioc->internal_lookup); |
6228 | + ioc->internal_lookup = NULL; |
6229 | if (ioc->chain_lookup) { |
6230 | for (i = 0; i < ioc->scsiio_depth; i++) { |
6231 | for (j = ioc->chains_per_prp_buffer; |
6232 | diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h |
6233 | index f3f399fe10c8..0da4e16fb23a 100644 |
6234 | --- a/drivers/scsi/qedf/qedf.h |
6235 | +++ b/drivers/scsi/qedf/qedf.h |
6236 | @@ -355,6 +355,7 @@ struct qedf_ctx { |
6237 | #define QEDF_GRCDUMP_CAPTURE 4 |
6238 | #define QEDF_IN_RECOVERY 5 |
6239 | #define QEDF_DBG_STOP_IO 6 |
6240 | +#define QEDF_PROBING 8 |
6241 | unsigned long flags; /* Miscellaneous state flags */ |
6242 | int fipvlan_retries; |
6243 | u8 num_queues; |
6244 | diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c |
6245 | index 59ca98f12afd..3d0e345947c1 100644 |
6246 | --- a/drivers/scsi/qedf/qedf_main.c |
6247 | +++ b/drivers/scsi/qedf/qedf_main.c |
6248 | @@ -3153,7 +3153,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
6249 | { |
6250 | int rc = -EINVAL; |
6251 | struct fc_lport *lport; |
6252 | - struct qedf_ctx *qedf; |
6253 | + struct qedf_ctx *qedf = NULL; |
6254 | struct Scsi_Host *host; |
6255 | bool is_vf = false; |
6256 | struct qed_ll2_params params; |
6257 | @@ -3183,6 +3183,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
6258 | |
6259 | /* Initialize qedf_ctx */ |
6260 | qedf = lport_priv(lport); |
6261 | + set_bit(QEDF_PROBING, &qedf->flags); |
6262 | qedf->lport = lport; |
6263 | qedf->ctlr.lp = lport; |
6264 | qedf->pdev = pdev; |
6265 | @@ -3206,9 +3207,12 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
6266 | } else { |
6267 | /* Init pointers during recovery */ |
6268 | qedf = pci_get_drvdata(pdev); |
6269 | + set_bit(QEDF_PROBING, &qedf->flags); |
6270 | lport = qedf->lport; |
6271 | } |
6272 | |
6273 | + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe started.\n"); |
6274 | + |
6275 | host = lport->host; |
6276 | |
6277 | /* Allocate mempool for qedf_io_work structs */ |
6278 | @@ -3513,6 +3517,10 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
6279 | else |
6280 | fc_fabric_login(lport); |
6281 | |
6282 | + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); |
6283 | + |
6284 | + clear_bit(QEDF_PROBING, &qedf->flags); |
6285 | + |
6286 | /* All good */ |
6287 | return 0; |
6288 | |
6289 | @@ -3538,6 +3546,11 @@ err2: |
6290 | err1: |
6291 | scsi_host_put(lport->host); |
6292 | err0: |
6293 | + if (qedf) { |
6294 | + QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); |
6295 | + |
6296 | + clear_bit(QEDF_PROBING, &qedf->flags); |
6297 | + } |
6298 | return rc; |
6299 | } |
6300 | |
6301 | @@ -3687,11 +3700,25 @@ void qedf_get_protocol_tlv_data(void *dev, void *data) |
6302 | { |
6303 | struct qedf_ctx *qedf = dev; |
6304 | struct qed_mfw_tlv_fcoe *fcoe = data; |
6305 | - struct fc_lport *lport = qedf->lport; |
6306 | - struct Scsi_Host *host = lport->host; |
6307 | - struct fc_host_attrs *fc_host = shost_to_fc_host(host); |
6308 | + struct fc_lport *lport; |
6309 | + struct Scsi_Host *host; |
6310 | + struct fc_host_attrs *fc_host; |
6311 | struct fc_host_statistics *hst; |
6312 | |
6313 | + if (!qedf) { |
6314 | + QEDF_ERR(NULL, "qedf is null.\n"); |
6315 | + return; |
6316 | + } |
6317 | + |
6318 | + if (test_bit(QEDF_PROBING, &qedf->flags)) { |
6319 | + QEDF_ERR(&qedf->dbg_ctx, "Function is still probing.\n"); |
6320 | + return; |
6321 | + } |
6322 | + |
6323 | + lport = qedf->lport; |
6324 | + host = lport->host; |
6325 | + fc_host = shost_to_fc_host(host); |
6326 | + |
6327 | /* Force a refresh of the fc_host stats including offload stats */ |
6328 | hst = qedf_fc_get_host_stats(host); |
6329 | |
6330 | diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c |
6331 | index 8829880a54c3..0f57c8073406 100644 |
6332 | --- a/drivers/scsi/qedi/qedi_iscsi.c |
6333 | +++ b/drivers/scsi/qedi/qedi_iscsi.c |
6334 | @@ -997,7 +997,8 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) |
6335 | if (qedi_ep->state == EP_STATE_OFLDCONN_START) |
6336 | goto ep_exit_recover; |
6337 | |
6338 | - flush_work(&qedi_ep->offload_work); |
6339 | + if (qedi_ep->state != EP_STATE_OFLDCONN_NONE) |
6340 | + flush_work(&qedi_ep->offload_work); |
6341 | |
6342 | if (qedi_ep->conn) { |
6343 | qedi_conn = qedi_ep->conn; |
6344 | @@ -1214,6 +1215,10 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data) |
6345 | } |
6346 | |
6347 | iscsi_cid = (u32)path_data->handle; |
6348 | + if (iscsi_cid >= qedi->max_active_conns) { |
6349 | + ret = -EINVAL; |
6350 | + goto set_path_exit; |
6351 | + } |
6352 | qedi_ep = qedi->ep_tbl[iscsi_cid]; |
6353 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, |
6354 | "iscsi_cid=0x%x, qedi_ep=%p\n", iscsi_cid, qedi_ep); |
6355 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
6356 | index 03d272a09e26..d7ec4083a091 100644 |
6357 | --- a/drivers/scsi/qla2xxx/qla_os.c |
6358 | +++ b/drivers/scsi/qla2xxx/qla_os.c |
6359 | @@ -6295,6 +6295,7 @@ qla2x00_do_dpc(void *data) |
6360 | |
6361 | if (do_reset && !(test_and_set_bit(ABORT_ISP_ACTIVE, |
6362 | &base_vha->dpc_flags))) { |
6363 | + base_vha->flags.online = 1; |
6364 | ql_dbg(ql_dbg_dpc, base_vha, 0x4007, |
6365 | "ISP abort scheduled.\n"); |
6366 | if (ha->isp_ops->abort_isp(base_vha)) { |
6367 | diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
6368 | index abe7f79bb789..744cd93189da 100644 |
6369 | --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
6370 | +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
6371 | @@ -926,6 +926,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, |
6372 | |
6373 | atomic_set(&tpg->lport_tpg_enabled, 0); |
6374 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); |
6375 | + qlt_stop_phase2(vha->vha_tgt.qla_tgt); |
6376 | } |
6377 | |
6378 | return count; |
6379 | @@ -1088,6 +1089,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, |
6380 | |
6381 | atomic_set(&tpg->lport_tpg_enabled, 0); |
6382 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); |
6383 | + qlt_stop_phase2(vha->vha_tgt.qla_tgt); |
6384 | } |
6385 | |
6386 | return count; |
6387 | diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
6388 | index 91c007d26c1e..206c9f53e9e7 100644 |
6389 | --- a/drivers/scsi/scsi_lib.c |
6390 | +++ b/drivers/scsi/scsi_lib.c |
6391 | @@ -551,7 +551,7 @@ static void scsi_uninit_cmd(struct scsi_cmnd *cmd) |
6392 | } |
6393 | } |
6394 | |
6395 | -static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) |
6396 | +static void scsi_free_sgtables(struct scsi_cmnd *cmd) |
6397 | { |
6398 | if (cmd->sdb.table.nents) |
6399 | sg_free_table_chained(&cmd->sdb.table, |
6400 | @@ -563,7 +563,7 @@ static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) |
6401 | |
6402 | static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) |
6403 | { |
6404 | - scsi_mq_free_sgtables(cmd); |
6405 | + scsi_free_sgtables(cmd); |
6406 | scsi_uninit_cmd(cmd); |
6407 | scsi_del_cmd_from_list(cmd); |
6408 | } |
6409 | @@ -1063,7 +1063,7 @@ blk_status_t scsi_init_io(struct scsi_cmnd *cmd) |
6410 | |
6411 | return BLK_STS_OK; |
6412 | out_free_sgtables: |
6413 | - scsi_mq_free_sgtables(cmd); |
6414 | + scsi_free_sgtables(cmd); |
6415 | return ret; |
6416 | } |
6417 | EXPORT_SYMBOL(scsi_init_io); |
6418 | @@ -1214,6 +1214,7 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev, |
6419 | struct request *req) |
6420 | { |
6421 | struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); |
6422 | + blk_status_t ret; |
6423 | |
6424 | if (!blk_rq_bytes(req)) |
6425 | cmd->sc_data_direction = DMA_NONE; |
6426 | @@ -1223,9 +1224,14 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev, |
6427 | cmd->sc_data_direction = DMA_FROM_DEVICE; |
6428 | |
6429 | if (blk_rq_is_scsi(req)) |
6430 | - return scsi_setup_scsi_cmnd(sdev, req); |
6431 | + ret = scsi_setup_scsi_cmnd(sdev, req); |
6432 | else |
6433 | - return scsi_setup_fs_cmnd(sdev, req); |
6434 | + ret = scsi_setup_fs_cmnd(sdev, req); |
6435 | + |
6436 | + if (ret != BLK_STS_OK) |
6437 | + scsi_free_sgtables(cmd); |
6438 | + |
6439 | + return ret; |
6440 | } |
6441 | |
6442 | static blk_status_t |
6443 | diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
6444 | index 4664fdf75c0f..70a28f6fb1d0 100644 |
6445 | --- a/drivers/scsi/sr.c |
6446 | +++ b/drivers/scsi/sr.c |
6447 | @@ -750,7 +750,7 @@ static int sr_probe(struct device *dev) |
6448 | cd->cdi.disk = disk; |
6449 | |
6450 | if (register_cdrom(&cd->cdi)) |
6451 | - goto fail_put; |
6452 | + goto fail_minor; |
6453 | |
6454 | /* |
6455 | * Initialize block layer runtime PM stuffs before the |
6456 | @@ -768,6 +768,10 @@ static int sr_probe(struct device *dev) |
6457 | |
6458 | return 0; |
6459 | |
6460 | +fail_minor: |
6461 | + spin_lock(&sr_index_lock); |
6462 | + clear_bit(minor, sr_index_bits); |
6463 | + spin_unlock(&sr_index_lock); |
6464 | fail_put: |
6465 | put_disk(disk); |
6466 | fail_free: |
6467 | diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c |
6468 | index 411ef60b2c14..c49e9f6c46f8 100644 |
6469 | --- a/drivers/scsi/ufs/ufs-qcom.c |
6470 | +++ b/drivers/scsi/ufs/ufs-qcom.c |
6471 | @@ -1546,11 +1546,11 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba) |
6472 | |
6473 | /* sleep a bit intermittently as we are dumping too much data */ |
6474 | ufs_qcom_print_hw_debug_reg_all(hba, NULL, ufs_qcom_dump_regs_wrapper); |
6475 | - usleep_range(1000, 1100); |
6476 | + udelay(1000); |
6477 | ufs_qcom_testbus_read(hba); |
6478 | - usleep_range(1000, 1100); |
6479 | + udelay(1000); |
6480 | ufs_qcom_print_unipro_testbus(hba); |
6481 | - usleep_range(1000, 1100); |
6482 | + udelay(1000); |
6483 | } |
6484 | |
6485 | /** |
6486 | diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c |
6487 | index d2197a31abe5..bad366e49159 100644 |
6488 | --- a/drivers/scsi/ufs/ufs_bsg.c |
6489 | +++ b/drivers/scsi/ufs/ufs_bsg.c |
6490 | @@ -106,8 +106,10 @@ static int ufs_bsg_request(struct bsg_job *job) |
6491 | desc_op = bsg_request->upiu_req.qr.opcode; |
6492 | ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff, |
6493 | &desc_len, desc_op); |
6494 | - if (ret) |
6495 | + if (ret) { |
6496 | + pm_runtime_put_sync(hba->dev); |
6497 | goto out; |
6498 | + } |
6499 | |
6500 | /* fall through */ |
6501 | case UPIU_TRANSACTION_NOP_OUT: |
6502 | diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
6503 | index bc73181b0405..2b6853c7375c 100644 |
6504 | --- a/drivers/scsi/ufs/ufshcd.c |
6505 | +++ b/drivers/scsi/ufs/ufshcd.c |
6506 | @@ -5101,7 +5101,6 @@ static int ufshcd_bkops_ctrl(struct ufs_hba *hba, |
6507 | err = ufshcd_enable_auto_bkops(hba); |
6508 | else |
6509 | err = ufshcd_disable_auto_bkops(hba); |
6510 | - hba->urgent_bkops_lvl = curr_status; |
6511 | out: |
6512 | return err; |
6513 | } |
6514 | diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
6515 | index 29fbab55c3b3..01a17d84b606 100644 |
6516 | --- a/drivers/slimbus/qcom-ngd-ctrl.c |
6517 | +++ b/drivers/slimbus/qcom-ngd-ctrl.c |
6518 | @@ -1354,7 +1354,6 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
6519 | ngd->pdev->driver_override = QCOM_SLIM_NGD_DRV_NAME; |
6520 | ngd->pdev->dev.of_node = node; |
6521 | ctrl->ngd = ngd; |
6522 | - platform_set_drvdata(ngd->pdev, ctrl); |
6523 | |
6524 | platform_device_add(ngd->pdev); |
6525 | ngd->base = ctrl->base + ngd->id * data->offset + |
6526 | @@ -1369,12 +1368,13 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
6527 | |
6528 | static int qcom_slim_ngd_probe(struct platform_device *pdev) |
6529 | { |
6530 | - struct qcom_slim_ngd_ctrl *ctrl = platform_get_drvdata(pdev); |
6531 | struct device *dev = &pdev->dev; |
6532 | + struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev->parent); |
6533 | int ret; |
6534 | |
6535 | ctrl->ctrl.dev = dev; |
6536 | |
6537 | + platform_set_drvdata(pdev, ctrl); |
6538 | pm_runtime_use_autosuspend(dev); |
6539 | pm_runtime_set_autosuspend_delay(dev, QCOM_SLIM_NGD_AUTOSUSPEND); |
6540 | pm_runtime_set_suspended(dev); |
6541 | diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c |
6542 | index 6473fa602f82..611f4f5bc36a 100644 |
6543 | --- a/drivers/soundwire/slave.c |
6544 | +++ b/drivers/soundwire/slave.c |
6545 | @@ -57,6 +57,8 @@ static int sdw_slave_add(struct sdw_bus *bus, |
6546 | list_del(&slave->node); |
6547 | mutex_unlock(&bus->bus_lock); |
6548 | put_device(&slave->dev); |
6549 | + |
6550 | + return ret; |
6551 | } |
6552 | sdw_slave_debugfs_init(slave); |
6553 | |
6554 | diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c |
6555 | index 5f0e089573a2..af26bc9f184a 100644 |
6556 | --- a/drivers/staging/gasket/gasket_sysfs.c |
6557 | +++ b/drivers/staging/gasket/gasket_sysfs.c |
6558 | @@ -339,6 +339,7 @@ void gasket_sysfs_put_attr(struct device *device, |
6559 | |
6560 | dev_err(device, "Unable to put unknown attribute: %s\n", |
6561 | attr->attr.attr.name); |
6562 | + put_mapping(mapping); |
6563 | } |
6564 | EXPORT_SYMBOL(gasket_sysfs_put_attr); |
6565 | |
6566 | @@ -372,6 +373,7 @@ ssize_t gasket_sysfs_register_store(struct device *device, |
6567 | gasket_dev = mapping->gasket_dev; |
6568 | if (!gasket_dev) { |
6569 | dev_err(device, "Device driver may have been removed\n"); |
6570 | + put_mapping(mapping); |
6571 | return 0; |
6572 | } |
6573 | |
6574 | diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c |
6575 | index d6ba25f21d80..d2672b65c3f4 100644 |
6576 | --- a/drivers/staging/greybus/light.c |
6577 | +++ b/drivers/staging/greybus/light.c |
6578 | @@ -1026,7 +1026,8 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) |
6579 | |
6580 | light->channels_count = conf.channel_count; |
6581 | light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); |
6582 | - |
6583 | + if (!light->name) |
6584 | + return -ENOMEM; |
6585 | light->channels = kcalloc(light->channels_count, |
6586 | sizeof(struct gb_channel), GFP_KERNEL); |
6587 | if (!light->channels) |
6588 | diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c |
6589 | index 59568d18ce23..5b72aa81d94c 100644 |
6590 | --- a/drivers/staging/sm750fb/sm750.c |
6591 | +++ b/drivers/staging/sm750fb/sm750.c |
6592 | @@ -898,6 +898,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) |
6593 | fix->visual = FB_VISUAL_PSEUDOCOLOR; |
6594 | break; |
6595 | case 16: |
6596 | + case 24: |
6597 | case 32: |
6598 | fix->visual = FB_VISUAL_TRUECOLOR; |
6599 | break; |
6600 | diff --git a/drivers/staging/wilc1000/wilc_hif.c b/drivers/staging/wilc1000/wilc_hif.c |
6601 | index 77d0732f451b..221e3d93db14 100644 |
6602 | --- a/drivers/staging/wilc1000/wilc_hif.c |
6603 | +++ b/drivers/staging/wilc1000/wilc_hif.c |
6604 | @@ -12,6 +12,8 @@ |
6605 | #define WILC_FALSE_FRMWR_CHANNEL 100 |
6606 | #define WILC_MAX_RATES_SUPPORTED 12 |
6607 | |
6608 | +#define WILC_SCAN_WID_LIST_SIZE 6 |
6609 | + |
6610 | struct wilc_rcvd_mac_info { |
6611 | u8 status; |
6612 | }; |
6613 | @@ -233,7 +235,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, |
6614 | void *user_arg, struct cfg80211_scan_request *request) |
6615 | { |
6616 | int result = 0; |
6617 | - struct wid wid_list[5]; |
6618 | + struct wid wid_list[WILC_SCAN_WID_LIST_SIZE]; |
6619 | u32 index = 0; |
6620 | u32 i, scan_timeout; |
6621 | u8 *buffer; |
6622 | diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c |
6623 | index 3305b47fdf53..16d5a4e117a2 100644 |
6624 | --- a/drivers/target/loopback/tcm_loop.c |
6625 | +++ b/drivers/target/loopback/tcm_loop.c |
6626 | @@ -545,32 +545,15 @@ static int tcm_loop_write_pending(struct se_cmd *se_cmd) |
6627 | return 0; |
6628 | } |
6629 | |
6630 | -static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
6631 | +static int tcm_loop_queue_data_or_status(const char *func, |
6632 | + struct se_cmd *se_cmd, u8 scsi_status) |
6633 | { |
6634 | struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
6635 | struct tcm_loop_cmd, tl_se_cmd); |
6636 | struct scsi_cmnd *sc = tl_cmd->sc; |
6637 | |
6638 | pr_debug("%s() called for scsi_cmnd: %p cdb: 0x%02x\n", |
6639 | - __func__, sc, sc->cmnd[0]); |
6640 | - |
6641 | - sc->result = SAM_STAT_GOOD; |
6642 | - set_host_byte(sc, DID_OK); |
6643 | - if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
6644 | - (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) |
6645 | - scsi_set_resid(sc, se_cmd->residual_count); |
6646 | - sc->scsi_done(sc); |
6647 | - return 0; |
6648 | -} |
6649 | - |
6650 | -static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
6651 | -{ |
6652 | - struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
6653 | - struct tcm_loop_cmd, tl_se_cmd); |
6654 | - struct scsi_cmnd *sc = tl_cmd->sc; |
6655 | - |
6656 | - pr_debug("%s() called for scsi_cmnd: %p cdb: 0x%02x\n", |
6657 | - __func__, sc, sc->cmnd[0]); |
6658 | + func, sc, sc->cmnd[0]); |
6659 | |
6660 | if (se_cmd->sense_buffer && |
6661 | ((se_cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) || |
6662 | @@ -581,7 +564,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
6663 | sc->result = SAM_STAT_CHECK_CONDITION; |
6664 | set_driver_byte(sc, DRIVER_SENSE); |
6665 | } else |
6666 | - sc->result = se_cmd->scsi_status; |
6667 | + sc->result = scsi_status; |
6668 | |
6669 | set_host_byte(sc, DID_OK); |
6670 | if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
6671 | @@ -591,6 +574,17 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
6672 | return 0; |
6673 | } |
6674 | |
6675 | +static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
6676 | +{ |
6677 | + return tcm_loop_queue_data_or_status(__func__, se_cmd, SAM_STAT_GOOD); |
6678 | +} |
6679 | + |
6680 | +static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
6681 | +{ |
6682 | + return tcm_loop_queue_data_or_status(__func__, |
6683 | + se_cmd, se_cmd->scsi_status); |
6684 | +} |
6685 | + |
6686 | static void tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd) |
6687 | { |
6688 | struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
6689 | diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
6690 | index 9425354aef99..a497e7c1f4fc 100644 |
6691 | --- a/drivers/target/target_core_user.c |
6692 | +++ b/drivers/target/target_core_user.c |
6693 | @@ -882,41 +882,24 @@ static inline size_t tcmu_cmd_get_cmd_size(struct tcmu_cmd *tcmu_cmd, |
6694 | return command_size; |
6695 | } |
6696 | |
6697 | -static int tcmu_setup_cmd_timer(struct tcmu_cmd *tcmu_cmd, unsigned int tmo, |
6698 | - struct timer_list *timer) |
6699 | +static void tcmu_setup_cmd_timer(struct tcmu_cmd *tcmu_cmd, unsigned int tmo, |
6700 | + struct timer_list *timer) |
6701 | { |
6702 | - struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
6703 | - int cmd_id; |
6704 | - |
6705 | - if (tcmu_cmd->cmd_id) |
6706 | - goto setup_timer; |
6707 | - |
6708 | - cmd_id = idr_alloc(&udev->commands, tcmu_cmd, 1, USHRT_MAX, GFP_NOWAIT); |
6709 | - if (cmd_id < 0) { |
6710 | - pr_err("tcmu: Could not allocate cmd id.\n"); |
6711 | - return cmd_id; |
6712 | - } |
6713 | - tcmu_cmd->cmd_id = cmd_id; |
6714 | - |
6715 | - pr_debug("allocated cmd %u for dev %s tmo %lu\n", tcmu_cmd->cmd_id, |
6716 | - udev->name, tmo / MSEC_PER_SEC); |
6717 | - |
6718 | -setup_timer: |
6719 | if (!tmo) |
6720 | - return 0; |
6721 | + return; |
6722 | |
6723 | tcmu_cmd->deadline = round_jiffies_up(jiffies + msecs_to_jiffies(tmo)); |
6724 | if (!timer_pending(timer)) |
6725 | mod_timer(timer, tcmu_cmd->deadline); |
6726 | |
6727 | - return 0; |
6728 | + pr_debug("Timeout set up for cmd %p, dev = %s, tmo = %lu\n", tcmu_cmd, |
6729 | + tcmu_cmd->tcmu_dev->name, tmo / MSEC_PER_SEC); |
6730 | } |
6731 | |
6732 | static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) |
6733 | { |
6734 | struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
6735 | unsigned int tmo; |
6736 | - int ret; |
6737 | |
6738 | /* |
6739 | * For backwards compat if qfull_time_out is not set use |
6740 | @@ -931,13 +914,11 @@ static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) |
6741 | else |
6742 | tmo = TCMU_TIME_OUT; |
6743 | |
6744 | - ret = tcmu_setup_cmd_timer(tcmu_cmd, tmo, &udev->qfull_timer); |
6745 | - if (ret) |
6746 | - return ret; |
6747 | + tcmu_setup_cmd_timer(tcmu_cmd, tmo, &udev->qfull_timer); |
6748 | |
6749 | list_add_tail(&tcmu_cmd->queue_entry, &udev->qfull_queue); |
6750 | - pr_debug("adding cmd %u on dev %s to ring space wait queue\n", |
6751 | - tcmu_cmd->cmd_id, udev->name); |
6752 | + pr_debug("adding cmd %p on dev %s to ring space wait queue\n", |
6753 | + tcmu_cmd, udev->name); |
6754 | return 0; |
6755 | } |
6756 | |
6757 | @@ -959,7 +940,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) |
6758 | struct tcmu_mailbox *mb; |
6759 | struct tcmu_cmd_entry *entry; |
6760 | struct iovec *iov; |
6761 | - int iov_cnt, ret; |
6762 | + int iov_cnt, cmd_id; |
6763 | uint32_t cmd_head; |
6764 | uint64_t cdb_off; |
6765 | bool copy_to_data_area; |
6766 | @@ -1060,14 +1041,21 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) |
6767 | } |
6768 | entry->req.iov_bidi_cnt = iov_cnt; |
6769 | |
6770 | - ret = tcmu_setup_cmd_timer(tcmu_cmd, udev->cmd_time_out, |
6771 | - &udev->cmd_timer); |
6772 | - if (ret) { |
6773 | - tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt); |
6774 | + cmd_id = idr_alloc(&udev->commands, tcmu_cmd, 1, USHRT_MAX, GFP_NOWAIT); |
6775 | + if (cmd_id < 0) { |
6776 | + pr_err("tcmu: Could not allocate cmd id.\n"); |
6777 | |
6778 | + tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt); |
6779 | *scsi_err = TCM_OUT_OF_RESOURCES; |
6780 | return -1; |
6781 | } |
6782 | + tcmu_cmd->cmd_id = cmd_id; |
6783 | + |
6784 | + pr_debug("allocated cmd id %u for cmd %p dev %s\n", tcmu_cmd->cmd_id, |
6785 | + tcmu_cmd, udev->name); |
6786 | + |
6787 | + tcmu_setup_cmd_timer(tcmu_cmd, udev->cmd_time_out, &udev->cmd_timer); |
6788 | + |
6789 | entry->hdr.cmd_id = tcmu_cmd->cmd_id; |
6790 | |
6791 | /* |
6792 | @@ -1279,50 +1267,39 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) |
6793 | return handled; |
6794 | } |
6795 | |
6796 | -static int tcmu_check_expired_cmd(int id, void *p, void *data) |
6797 | +static void tcmu_check_expired_ring_cmd(struct tcmu_cmd *cmd) |
6798 | { |
6799 | - struct tcmu_cmd *cmd = p; |
6800 | - struct tcmu_dev *udev = cmd->tcmu_dev; |
6801 | - u8 scsi_status; |
6802 | struct se_cmd *se_cmd; |
6803 | - bool is_running; |
6804 | - |
6805 | - if (test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) |
6806 | - return 0; |
6807 | |
6808 | if (!time_after(jiffies, cmd->deadline)) |
6809 | - return 0; |
6810 | + return; |
6811 | |
6812 | - is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags); |
6813 | + set_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags); |
6814 | + list_del_init(&cmd->queue_entry); |
6815 | se_cmd = cmd->se_cmd; |
6816 | + cmd->se_cmd = NULL; |
6817 | |
6818 | - if (is_running) { |
6819 | - /* |
6820 | - * If cmd_time_out is disabled but qfull is set deadline |
6821 | - * will only reflect the qfull timeout. Ignore it. |
6822 | - */ |
6823 | - if (!udev->cmd_time_out) |
6824 | - return 0; |
6825 | + pr_debug("Timing out inflight cmd %u on dev %s.\n", |
6826 | + cmd->cmd_id, cmd->tcmu_dev->name); |
6827 | |
6828 | - set_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags); |
6829 | - /* |
6830 | - * target_complete_cmd will translate this to LUN COMM FAILURE |
6831 | - */ |
6832 | - scsi_status = SAM_STAT_CHECK_CONDITION; |
6833 | - list_del_init(&cmd->queue_entry); |
6834 | - cmd->se_cmd = NULL; |
6835 | - } else { |
6836 | - list_del_init(&cmd->queue_entry); |
6837 | - idr_remove(&udev->commands, id); |
6838 | - tcmu_free_cmd(cmd); |
6839 | - scsi_status = SAM_STAT_TASK_SET_FULL; |
6840 | - } |
6841 | + target_complete_cmd(se_cmd, SAM_STAT_CHECK_CONDITION); |
6842 | +} |
6843 | |
6844 | - pr_debug("Timing out cmd %u on dev %s that is %s.\n", |
6845 | - id, udev->name, is_running ? "inflight" : "queued"); |
6846 | +static void tcmu_check_expired_queue_cmd(struct tcmu_cmd *cmd) |
6847 | +{ |
6848 | + struct se_cmd *se_cmd; |
6849 | |
6850 | - target_complete_cmd(se_cmd, scsi_status); |
6851 | - return 0; |
6852 | + if (!time_after(jiffies, cmd->deadline)) |
6853 | + return; |
6854 | + |
6855 | + pr_debug("Timing out queued cmd %p on dev %s.\n", |
6856 | + cmd, cmd->tcmu_dev->name); |
6857 | + |
6858 | + list_del_init(&cmd->queue_entry); |
6859 | + se_cmd = cmd->se_cmd; |
6860 | + tcmu_free_cmd(cmd); |
6861 | + |
6862 | + target_complete_cmd(se_cmd, SAM_STAT_TASK_SET_FULL); |
6863 | } |
6864 | |
6865 | static void tcmu_device_timedout(struct tcmu_dev *udev) |
6866 | @@ -1407,16 +1384,15 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) |
6867 | return &udev->se_dev; |
6868 | } |
6869 | |
6870 | -static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
6871 | +static void run_qfull_queue(struct tcmu_dev *udev, bool fail) |
6872 | { |
6873 | struct tcmu_cmd *tcmu_cmd, *tmp_cmd; |
6874 | LIST_HEAD(cmds); |
6875 | - bool drained = true; |
6876 | sense_reason_t scsi_ret; |
6877 | int ret; |
6878 | |
6879 | if (list_empty(&udev->qfull_queue)) |
6880 | - return true; |
6881 | + return; |
6882 | |
6883 | pr_debug("running %s's cmdr queue forcefail %d\n", udev->name, fail); |
6884 | |
6885 | @@ -1425,11 +1401,10 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
6886 | list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, queue_entry) { |
6887 | list_del_init(&tcmu_cmd->queue_entry); |
6888 | |
6889 | - pr_debug("removing cmd %u on dev %s from queue\n", |
6890 | - tcmu_cmd->cmd_id, udev->name); |
6891 | + pr_debug("removing cmd %p on dev %s from queue\n", |
6892 | + tcmu_cmd, udev->name); |
6893 | |
6894 | if (fail) { |
6895 | - idr_remove(&udev->commands, tcmu_cmd->cmd_id); |
6896 | /* |
6897 | * We were not able to even start the command, so |
6898 | * fail with busy to allow a retry in case runner |
6899 | @@ -1444,10 +1419,8 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
6900 | |
6901 | ret = queue_cmd_ring(tcmu_cmd, &scsi_ret); |
6902 | if (ret < 0) { |
6903 | - pr_debug("cmd %u on dev %s failed with %u\n", |
6904 | - tcmu_cmd->cmd_id, udev->name, scsi_ret); |
6905 | - |
6906 | - idr_remove(&udev->commands, tcmu_cmd->cmd_id); |
6907 | + pr_debug("cmd %p on dev %s failed with %u\n", |
6908 | + tcmu_cmd, udev->name, scsi_ret); |
6909 | /* |
6910 | * Ignore scsi_ret for now. target_complete_cmd |
6911 | * drops it. |
6912 | @@ -1462,13 +1435,11 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
6913 | * the queue |
6914 | */ |
6915 | list_splice_tail(&cmds, &udev->qfull_queue); |
6916 | - drained = false; |
6917 | break; |
6918 | } |
6919 | } |
6920 | |
6921 | tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); |
6922 | - return drained; |
6923 | } |
6924 | |
6925 | static int tcmu_irqcontrol(struct uio_info *info, s32 irq_on) |
6926 | @@ -1652,6 +1623,8 @@ static void tcmu_dev_kref_release(struct kref *kref) |
6927 | if (tcmu_check_and_free_pending_cmd(cmd) != 0) |
6928 | all_expired = false; |
6929 | } |
6930 | + if (!list_empty(&udev->qfull_queue)) |
6931 | + all_expired = false; |
6932 | idr_destroy(&udev->commands); |
6933 | WARN_ON(!all_expired); |
6934 | |
6935 | @@ -2037,9 +2010,6 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
6936 | mutex_lock(&udev->cmdr_lock); |
6937 | |
6938 | idr_for_each_entry(&udev->commands, cmd, i) { |
6939 | - if (!test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags)) |
6940 | - continue; |
6941 | - |
6942 | pr_debug("removing cmd %u on dev %s from ring (is expired %d)\n", |
6943 | cmd->cmd_id, udev->name, |
6944 | test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)); |
6945 | @@ -2077,6 +2047,8 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
6946 | |
6947 | del_timer(&udev->cmd_timer); |
6948 | |
6949 | + run_qfull_queue(udev, false); |
6950 | + |
6951 | mutex_unlock(&udev->cmdr_lock); |
6952 | } |
6953 | |
6954 | @@ -2698,6 +2670,7 @@ static void find_free_blocks(void) |
6955 | static void check_timedout_devices(void) |
6956 | { |
6957 | struct tcmu_dev *udev, *tmp_dev; |
6958 | + struct tcmu_cmd *cmd, *tmp_cmd; |
6959 | LIST_HEAD(devs); |
6960 | |
6961 | spin_lock_bh(&timed_out_udevs_lock); |
6962 | @@ -2708,9 +2681,24 @@ static void check_timedout_devices(void) |
6963 | spin_unlock_bh(&timed_out_udevs_lock); |
6964 | |
6965 | mutex_lock(&udev->cmdr_lock); |
6966 | - idr_for_each(&udev->commands, tcmu_check_expired_cmd, NULL); |
6967 | |
6968 | - tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); |
6969 | + /* |
6970 | + * If cmd_time_out is disabled but qfull is set deadline |
6971 | + * will only reflect the qfull timeout. Ignore it. |
6972 | + */ |
6973 | + if (udev->cmd_time_out) { |
6974 | + list_for_each_entry_safe(cmd, tmp_cmd, |
6975 | + &udev->inflight_queue, |
6976 | + queue_entry) { |
6977 | + tcmu_check_expired_ring_cmd(cmd); |
6978 | + } |
6979 | + tcmu_set_next_deadline(&udev->inflight_queue, |
6980 | + &udev->cmd_timer); |
6981 | + } |
6982 | + list_for_each_entry_safe(cmd, tmp_cmd, &udev->qfull_queue, |
6983 | + queue_entry) { |
6984 | + tcmu_check_expired_queue_cmd(cmd); |
6985 | + } |
6986 | tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); |
6987 | |
6988 | mutex_unlock(&udev->cmdr_lock); |
6989 | diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
6990 | index d3e959d01606..85776db4bf34 100644 |
6991 | --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
6992 | +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
6993 | @@ -169,7 +169,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, |
6994 | |
6995 | data = ti_bandgap_get_sensor_data(bgp, id); |
6996 | |
6997 | - if (!data || IS_ERR(data)) |
6998 | + if (!IS_ERR_OR_NULL(data)) |
6999 | data = ti_thermal_build_data(bgp, id); |
7000 | |
7001 | if (!data) |
7002 | @@ -196,7 +196,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) |
7003 | |
7004 | data = ti_bandgap_get_sensor_data(bgp, id); |
7005 | |
7006 | - if (data && data->ti_thermal) { |
7007 | + if (!IS_ERR_OR_NULL(data) && data->ti_thermal) { |
7008 | if (data->our_zone) |
7009 | thermal_zone_device_unregister(data->ti_thermal); |
7010 | } |
7011 | @@ -262,7 +262,7 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) |
7012 | |
7013 | data = ti_bandgap_get_sensor_data(bgp, id); |
7014 | |
7015 | - if (data) { |
7016 | + if (!IS_ERR_OR_NULL(data)) { |
7017 | cpufreq_cooling_unregister(data->cool_dev); |
7018 | if (data->policy) |
7019 | cpufreq_cpu_put(data->policy); |
7020 | diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
7021 | index cdcc64ea2554..f8e43a6faea9 100644 |
7022 | --- a/drivers/tty/hvc/hvc_console.c |
7023 | +++ b/drivers/tty/hvc/hvc_console.c |
7024 | @@ -75,6 +75,8 @@ static LIST_HEAD(hvc_structs); |
7025 | */ |
7026 | static DEFINE_MUTEX(hvc_structs_mutex); |
7027 | |
7028 | +/* Mutex to serialize hvc_open */ |
7029 | +static DEFINE_MUTEX(hvc_open_mutex); |
7030 | /* |
7031 | * This value is used to assign a tty->index value to a hvc_struct based |
7032 | * upon order of exposure via hvc_probe(), when we can not match it to |
7033 | @@ -346,16 +348,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty) |
7034 | */ |
7035 | static int hvc_open(struct tty_struct *tty, struct file * filp) |
7036 | { |
7037 | - struct hvc_struct *hp = tty->driver_data; |
7038 | + struct hvc_struct *hp; |
7039 | unsigned long flags; |
7040 | int rc = 0; |
7041 | |
7042 | + mutex_lock(&hvc_open_mutex); |
7043 | + |
7044 | + hp = tty->driver_data; |
7045 | + if (!hp) { |
7046 | + rc = -EIO; |
7047 | + goto out; |
7048 | + } |
7049 | + |
7050 | spin_lock_irqsave(&hp->port.lock, flags); |
7051 | /* Check and then increment for fast path open. */ |
7052 | if (hp->port.count++ > 0) { |
7053 | spin_unlock_irqrestore(&hp->port.lock, flags); |
7054 | hvc_kick(); |
7055 | - return 0; |
7056 | + goto out; |
7057 | } /* else count == 0 */ |
7058 | spin_unlock_irqrestore(&hp->port.lock, flags); |
7059 | |
7060 | @@ -383,6 +393,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) |
7061 | /* Force wakeup of the polling thread */ |
7062 | hvc_kick(); |
7063 | |
7064 | +out: |
7065 | + mutex_unlock(&hvc_open_mutex); |
7066 | return rc; |
7067 | } |
7068 | |
7069 | diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
7070 | index 36a3eb4ad4c5..75408b9f232d 100644 |
7071 | --- a/drivers/tty/n_gsm.c |
7072 | +++ b/drivers/tty/n_gsm.c |
7073 | @@ -665,11 +665,10 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len, |
7074 | * FIXME: lock against link layer control transmissions |
7075 | */ |
7076 | |
7077 | -static void gsm_data_kick(struct gsm_mux *gsm) |
7078 | +static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) |
7079 | { |
7080 | struct gsm_msg *msg, *nmsg; |
7081 | int len; |
7082 | - int skip_sof = 0; |
7083 | |
7084 | list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { |
7085 | if (gsm->constipated && msg->addr) |
7086 | @@ -691,18 +690,23 @@ static void gsm_data_kick(struct gsm_mux *gsm) |
7087 | print_hex_dump_bytes("gsm_data_kick: ", |
7088 | DUMP_PREFIX_OFFSET, |
7089 | gsm->txframe, len); |
7090 | - |
7091 | - if (gsm->output(gsm, gsm->txframe + skip_sof, |
7092 | - len - skip_sof) < 0) |
7093 | + if (gsm->output(gsm, gsm->txframe, len) < 0) |
7094 | break; |
7095 | /* FIXME: Can eliminate one SOF in many more cases */ |
7096 | gsm->tx_bytes -= msg->len; |
7097 | - /* For a burst of frames skip the extra SOF within the |
7098 | - burst */ |
7099 | - skip_sof = 1; |
7100 | |
7101 | list_del(&msg->list); |
7102 | kfree(msg); |
7103 | + |
7104 | + if (dlci) { |
7105 | + tty_port_tty_wakeup(&dlci->port); |
7106 | + } else { |
7107 | + int i = 0; |
7108 | + |
7109 | + for (i = 0; i < NUM_DLCI; i++) |
7110 | + if (gsm->dlci[i]) |
7111 | + tty_port_tty_wakeup(&gsm->dlci[i]->port); |
7112 | + } |
7113 | } |
7114 | } |
7115 | |
7116 | @@ -754,7 +758,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) |
7117 | /* Add to the actual output queue */ |
7118 | list_add_tail(&msg->list, &gsm->tx_list); |
7119 | gsm->tx_bytes += msg->len; |
7120 | - gsm_data_kick(gsm); |
7121 | + gsm_data_kick(gsm, dlci); |
7122 | } |
7123 | |
7124 | /** |
7125 | @@ -1215,7 +1219,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, |
7126 | gsm_control_reply(gsm, CMD_FCON, NULL, 0); |
7127 | /* Kick the link in case it is idling */ |
7128 | spin_lock_irqsave(&gsm->tx_lock, flags); |
7129 | - gsm_data_kick(gsm); |
7130 | + gsm_data_kick(gsm, NULL); |
7131 | spin_unlock_irqrestore(&gsm->tx_lock, flags); |
7132 | break; |
7133 | case CMD_FCOFF: |
7134 | @@ -2525,7 +2529,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty) |
7135 | /* Queue poll */ |
7136 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
7137 | spin_lock_irqsave(&gsm->tx_lock, flags); |
7138 | - gsm_data_kick(gsm); |
7139 | + gsm_data_kick(gsm, NULL); |
7140 | if (gsm->tx_bytes < TX_THRESH_LO) { |
7141 | gsm_dlci_data_sweep(gsm); |
7142 | } |
7143 | diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
7144 | index 2c65c775bf5a..dbb27303a6b4 100644 |
7145 | --- a/drivers/tty/serial/8250/8250_port.c |
7146 | +++ b/drivers/tty/serial/8250/8250_port.c |
7147 | @@ -2539,6 +2539,8 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
7148 | struct ktermios *termios, |
7149 | struct ktermios *old) |
7150 | { |
7151 | + unsigned int tolerance = port->uartclk / 100; |
7152 | + |
7153 | /* |
7154 | * Ask the core to calculate the divisor for us. |
7155 | * Allow 1% tolerance at the upper limit so uart clks marginally |
7156 | @@ -2547,7 +2549,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
7157 | */ |
7158 | return uart_get_baud_rate(port, termios, old, |
7159 | port->uartclk / 16 / UART_DIV_MAX, |
7160 | - port->uartclk); |
7161 | + (port->uartclk + tolerance) / 16); |
7162 | } |
7163 | |
7164 | void |
7165 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
7166 | index b0b689546395..de3e8c24c03e 100644 |
7167 | --- a/drivers/tty/serial/amba-pl011.c |
7168 | +++ b/drivers/tty/serial/amba-pl011.c |
7169 | @@ -2585,6 +2585,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, |
7170 | uap->port.fifosize = uap->fifosize; |
7171 | uap->port.flags = UPF_BOOT_AUTOCONF; |
7172 | uap->port.line = index; |
7173 | + spin_lock_init(&uap->port.lock); |
7174 | |
7175 | amba_ports[index] = uap; |
7176 | |
7177 | diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c |
7178 | index 0d8e3f3804a3..084c48c5848f 100644 |
7179 | --- a/drivers/usb/class/usblp.c |
7180 | +++ b/drivers/usb/class/usblp.c |
7181 | @@ -468,7 +468,8 @@ static int usblp_release(struct inode *inode, struct file *file) |
7182 | usb_autopm_put_interface(usblp->intf); |
7183 | |
7184 | if (!usblp->present) /* finish cleanup from disconnect */ |
7185 | - usblp_cleanup(usblp); |
7186 | + usblp_cleanup(usblp); /* any URBs must be dead */ |
7187 | + |
7188 | mutex_unlock(&usblp_mutex); |
7189 | return 0; |
7190 | } |
7191 | @@ -1375,9 +1376,11 @@ static void usblp_disconnect(struct usb_interface *intf) |
7192 | |
7193 | usblp_unlink_urbs(usblp); |
7194 | mutex_unlock(&usblp->mut); |
7195 | + usb_poison_anchored_urbs(&usblp->urbs); |
7196 | |
7197 | if (!usblp->used) |
7198 | usblp_cleanup(usblp); |
7199 | + |
7200 | mutex_unlock(&usblp_mutex); |
7201 | } |
7202 | |
7203 | diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c |
7204 | index 6af6add3d4c0..6272b4ae4740 100644 |
7205 | --- a/drivers/usb/dwc2/core_intr.c |
7206 | +++ b/drivers/usb/dwc2/core_intr.c |
7207 | @@ -421,10 +421,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) |
7208 | if (ret && (ret != -ENOTSUPP)) |
7209 | dev_err(hsotg->dev, "exit power_down failed\n"); |
7210 | |
7211 | + /* Change to L0 state */ |
7212 | + hsotg->lx_state = DWC2_L0; |
7213 | call_gadget(hsotg, resume); |
7214 | + } else { |
7215 | + /* Change to L0 state */ |
7216 | + hsotg->lx_state = DWC2_L0; |
7217 | } |
7218 | - /* Change to L0 state */ |
7219 | - hsotg->lx_state = DWC2_L0; |
7220 | } else { |
7221 | if (hsotg->params.power_down) |
7222 | return; |
7223 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
7224 | index c30c5b1c478c..17340864a540 100644 |
7225 | --- a/drivers/usb/dwc3/gadget.c |
7226 | +++ b/drivers/usb/dwc3/gadget.c |
7227 | @@ -1217,6 +1217,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep) |
7228 | } |
7229 | } |
7230 | |
7231 | +static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep); |
7232 | + |
7233 | static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) |
7234 | { |
7235 | struct dwc3_gadget_ep_cmd_params params; |
7236 | @@ -1256,14 +1258,20 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) |
7237 | |
7238 | ret = dwc3_send_gadget_ep_cmd(dep, cmd, ¶ms); |
7239 | if (ret < 0) { |
7240 | - /* |
7241 | - * FIXME we need to iterate over the list of requests |
7242 | - * here and stop, unmap, free and del each of the linked |
7243 | - * requests instead of what we do now. |
7244 | - */ |
7245 | - if (req->trb) |
7246 | - memset(req->trb, 0, sizeof(struct dwc3_trb)); |
7247 | - dwc3_gadget_del_and_unmap_request(dep, req, ret); |
7248 | + struct dwc3_request *tmp; |
7249 | + |
7250 | + if (ret == -EAGAIN) |
7251 | + return ret; |
7252 | + |
7253 | + dwc3_stop_active_transfer(dep, true, true); |
7254 | + |
7255 | + list_for_each_entry_safe(req, tmp, &dep->started_list, list) |
7256 | + dwc3_gadget_move_cancelled_request(req); |
7257 | + |
7258 | + /* If ep isn't started, then there's no end transfer pending */ |
7259 | + if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) |
7260 | + dwc3_gadget_ep_cleanup_cancelled_requests(dep); |
7261 | + |
7262 | return ret; |
7263 | } |
7264 | |
7265 | @@ -1505,6 +1513,10 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r |
7266 | { |
7267 | int i; |
7268 | |
7269 | + /* If req->trb is not set, then the request has not started */ |
7270 | + if (!req->trb) |
7271 | + return; |
7272 | + |
7273 | /* |
7274 | * If request was already started, this means we had to |
7275 | * stop the transfer. With that we also need to ignore |
7276 | @@ -1595,6 +1607,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
7277 | { |
7278 | struct dwc3_gadget_ep_cmd_params params; |
7279 | struct dwc3 *dwc = dep->dwc; |
7280 | + struct dwc3_request *req; |
7281 | + struct dwc3_request *tmp; |
7282 | int ret; |
7283 | |
7284 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { |
7285 | @@ -1631,13 +1645,37 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
7286 | else |
7287 | dep->flags |= DWC3_EP_STALL; |
7288 | } else { |
7289 | + /* |
7290 | + * Don't issue CLEAR_STALL command to control endpoints. The |
7291 | + * controller automatically clears the STALL when it receives |
7292 | + * the SETUP token. |
7293 | + */ |
7294 | + if (dep->number <= 1) { |
7295 | + dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
7296 | + return 0; |
7297 | + } |
7298 | |
7299 | ret = dwc3_send_clear_stall_ep_cmd(dep); |
7300 | - if (ret) |
7301 | + if (ret) { |
7302 | dev_err(dwc->dev, "failed to clear STALL on %s\n", |
7303 | dep->name); |
7304 | - else |
7305 | - dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
7306 | + return ret; |
7307 | + } |
7308 | + |
7309 | + dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
7310 | + |
7311 | + dwc3_stop_active_transfer(dep, true, true); |
7312 | + |
7313 | + list_for_each_entry_safe(req, tmp, &dep->started_list, list) |
7314 | + dwc3_gadget_move_cancelled_request(req); |
7315 | + |
7316 | + list_for_each_entry_safe(req, tmp, &dep->pending_list, list) |
7317 | + dwc3_gadget_move_cancelled_request(req); |
7318 | + |
7319 | + if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) { |
7320 | + dep->flags &= ~DWC3_EP_DELAY_START; |
7321 | + dwc3_gadget_ep_cleanup_cancelled_requests(dep); |
7322 | + } |
7323 | } |
7324 | |
7325 | return ret; |
7326 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
7327 | index d98ca1566e95..f75ff1a75dc4 100644 |
7328 | --- a/drivers/usb/gadget/composite.c |
7329 | +++ b/drivers/usb/gadget/composite.c |
7330 | @@ -96,40 +96,43 @@ function_descriptors(struct usb_function *f, |
7331 | } |
7332 | |
7333 | /** |
7334 | - * next_ep_desc() - advance to the next EP descriptor |
7335 | + * next_desc() - advance to the next desc_type descriptor |
7336 | * @t: currect pointer within descriptor array |
7337 | + * @desc_type: descriptor type |
7338 | * |
7339 | - * Return: next EP descriptor or NULL |
7340 | + * Return: next desc_type descriptor or NULL |
7341 | * |
7342 | - * Iterate over @t until either EP descriptor found or |
7343 | + * Iterate over @t until either desc_type descriptor found or |
7344 | * NULL (that indicates end of list) encountered |
7345 | */ |
7346 | static struct usb_descriptor_header** |
7347 | -next_ep_desc(struct usb_descriptor_header **t) |
7348 | +next_desc(struct usb_descriptor_header **t, u8 desc_type) |
7349 | { |
7350 | for (; *t; t++) { |
7351 | - if ((*t)->bDescriptorType == USB_DT_ENDPOINT) |
7352 | + if ((*t)->bDescriptorType == desc_type) |
7353 | return t; |
7354 | } |
7355 | return NULL; |
7356 | } |
7357 | |
7358 | /* |
7359 | - * for_each_ep_desc()- iterate over endpoint descriptors in the |
7360 | - * descriptors list |
7361 | - * @start: pointer within descriptor array. |
7362 | - * @ep_desc: endpoint descriptor to use as the loop cursor |
7363 | + * for_each_desc() - iterate over desc_type descriptors in the |
7364 | + * descriptors list |
7365 | + * @start: pointer within descriptor array. |
7366 | + * @iter_desc: desc_type descriptor to use as the loop cursor |
7367 | + * @desc_type: wanted descriptr type |
7368 | */ |
7369 | -#define for_each_ep_desc(start, ep_desc) \ |
7370 | - for (ep_desc = next_ep_desc(start); \ |
7371 | - ep_desc; ep_desc = next_ep_desc(ep_desc+1)) |
7372 | +#define for_each_desc(start, iter_desc, desc_type) \ |
7373 | + for (iter_desc = next_desc(start, desc_type); \ |
7374 | + iter_desc; iter_desc = next_desc(iter_desc + 1, desc_type)) |
7375 | |
7376 | /** |
7377 | - * config_ep_by_speed() - configures the given endpoint |
7378 | + * config_ep_by_speed_and_alt() - configures the given endpoint |
7379 | * according to gadget speed. |
7380 | * @g: pointer to the gadget |
7381 | * @f: usb function |
7382 | * @_ep: the endpoint to configure |
7383 | + * @alt: alternate setting number |
7384 | * |
7385 | * Return: error code, 0 on success |
7386 | * |
7387 | @@ -142,11 +145,13 @@ next_ep_desc(struct usb_descriptor_header **t) |
7388 | * Note: the supplied function should hold all the descriptors |
7389 | * for supported speeds |
7390 | */ |
7391 | -int config_ep_by_speed(struct usb_gadget *g, |
7392 | - struct usb_function *f, |
7393 | - struct usb_ep *_ep) |
7394 | +int config_ep_by_speed_and_alt(struct usb_gadget *g, |
7395 | + struct usb_function *f, |
7396 | + struct usb_ep *_ep, |
7397 | + u8 alt) |
7398 | { |
7399 | struct usb_endpoint_descriptor *chosen_desc = NULL; |
7400 | + struct usb_interface_descriptor *int_desc = NULL; |
7401 | struct usb_descriptor_header **speed_desc = NULL; |
7402 | |
7403 | struct usb_ss_ep_comp_descriptor *comp_desc = NULL; |
7404 | @@ -182,8 +187,21 @@ int config_ep_by_speed(struct usb_gadget *g, |
7405 | default: |
7406 | speed_desc = f->fs_descriptors; |
7407 | } |
7408 | + |
7409 | + /* find correct alternate setting descriptor */ |
7410 | + for_each_desc(speed_desc, d_spd, USB_DT_INTERFACE) { |
7411 | + int_desc = (struct usb_interface_descriptor *)*d_spd; |
7412 | + |
7413 | + if (int_desc->bAlternateSetting == alt) { |
7414 | + speed_desc = d_spd; |
7415 | + goto intf_found; |
7416 | + } |
7417 | + } |
7418 | + return -EIO; |
7419 | + |
7420 | +intf_found: |
7421 | /* find descriptors */ |
7422 | - for_each_ep_desc(speed_desc, d_spd) { |
7423 | + for_each_desc(speed_desc, d_spd, USB_DT_ENDPOINT) { |
7424 | chosen_desc = (struct usb_endpoint_descriptor *)*d_spd; |
7425 | if (chosen_desc->bEndpointAddress == _ep->address) |
7426 | goto ep_found; |
7427 | @@ -237,6 +255,32 @@ ep_found: |
7428 | } |
7429 | return 0; |
7430 | } |
7431 | +EXPORT_SYMBOL_GPL(config_ep_by_speed_and_alt); |
7432 | + |
7433 | +/** |
7434 | + * config_ep_by_speed() - configures the given endpoint |
7435 | + * according to gadget speed. |
7436 | + * @g: pointer to the gadget |
7437 | + * @f: usb function |
7438 | + * @_ep: the endpoint to configure |
7439 | + * |
7440 | + * Return: error code, 0 on success |
7441 | + * |
7442 | + * This function chooses the right descriptors for a given |
7443 | + * endpoint according to gadget speed and saves it in the |
7444 | + * endpoint desc field. If the endpoint already has a descriptor |
7445 | + * assigned to it - overwrites it with currently corresponding |
7446 | + * descriptor. The endpoint maxpacket field is updated according |
7447 | + * to the chosen descriptor. |
7448 | + * Note: the supplied function should hold all the descriptors |
7449 | + * for supported speeds |
7450 | + */ |
7451 | +int config_ep_by_speed(struct usb_gadget *g, |
7452 | + struct usb_function *f, |
7453 | + struct usb_ep *_ep) |
7454 | +{ |
7455 | + return config_ep_by_speed_and_alt(g, f, _ep, 0); |
7456 | +} |
7457 | EXPORT_SYMBOL_GPL(config_ep_by_speed); |
7458 | |
7459 | /** |
7460 | diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c |
7461 | index 51fa614b4079..0e7820158aaa 100644 |
7462 | --- a/drivers/usb/gadget/udc/core.c |
7463 | +++ b/drivers/usb/gadget/udc/core.c |
7464 | @@ -1297,6 +1297,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) |
7465 | kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); |
7466 | |
7467 | usb_gadget_disconnect(udc->gadget); |
7468 | + if (udc->gadget->irq) |
7469 | + synchronize_irq(udc->gadget->irq); |
7470 | udc->driver->unbind(udc->gadget); |
7471 | usb_gadget_udc_stop(udc); |
7472 | |
7473 | diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c |
7474 | index bf6c81e2f8cc..6d2f1f98f13d 100644 |
7475 | --- a/drivers/usb/gadget/udc/lpc32xx_udc.c |
7476 | +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c |
7477 | @@ -1614,17 +1614,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep, |
7478 | const struct usb_endpoint_descriptor *desc) |
7479 | { |
7480 | struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); |
7481 | - struct lpc32xx_udc *udc = ep->udc; |
7482 | + struct lpc32xx_udc *udc; |
7483 | u16 maxpacket; |
7484 | u32 tmp; |
7485 | unsigned long flags; |
7486 | |
7487 | /* Verify EP data */ |
7488 | if ((!_ep) || (!ep) || (!desc) || |
7489 | - (desc->bDescriptorType != USB_DT_ENDPOINT)) { |
7490 | - dev_dbg(udc->dev, "bad ep or descriptor\n"); |
7491 | + (desc->bDescriptorType != USB_DT_ENDPOINT)) |
7492 | return -EINVAL; |
7493 | - } |
7494 | + |
7495 | + udc = ep->udc; |
7496 | maxpacket = usb_endpoint_maxp(desc); |
7497 | if ((maxpacket == 0) || (maxpacket > ep->maxpacket)) { |
7498 | dev_dbg(udc->dev, "bad ep descriptor's packet size\n"); |
7499 | @@ -1872,7 +1872,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
7500 | static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) |
7501 | { |
7502 | struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); |
7503 | - struct lpc32xx_udc *udc = ep->udc; |
7504 | + struct lpc32xx_udc *udc; |
7505 | unsigned long flags; |
7506 | |
7507 | if ((!ep) || (ep->hwep_num <= 1)) |
7508 | @@ -1882,6 +1882,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) |
7509 | if (ep->is_in) |
7510 | return -EAGAIN; |
7511 | |
7512 | + udc = ep->udc; |
7513 | spin_lock_irqsave(&udc->lock, flags); |
7514 | |
7515 | if (value == 1) { |
7516 | diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c |
7517 | index a8288df6aadf..ea59b56e5402 100644 |
7518 | --- a/drivers/usb/gadget/udc/m66592-udc.c |
7519 | +++ b/drivers/usb/gadget/udc/m66592-udc.c |
7520 | @@ -1667,7 +1667,7 @@ static int m66592_probe(struct platform_device *pdev) |
7521 | |
7522 | err_add_udc: |
7523 | m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); |
7524 | - |
7525 | + m66592->ep0_req = NULL; |
7526 | clean_up3: |
7527 | if (m66592->pdata->on_chip) { |
7528 | clk_disable(m66592->clk); |
7529 | diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c |
7530 | index f82208fbc249..5dcc0692b95c 100644 |
7531 | --- a/drivers/usb/gadget/udc/s3c2410_udc.c |
7532 | +++ b/drivers/usb/gadget/udc/s3c2410_udc.c |
7533 | @@ -251,10 +251,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep, |
7534 | static void s3c2410_udc_nuke(struct s3c2410_udc *udc, |
7535 | struct s3c2410_ep *ep, int status) |
7536 | { |
7537 | - /* Sanity check */ |
7538 | - if (&ep->queue == NULL) |
7539 | - return; |
7540 | - |
7541 | while (!list_empty(&ep->queue)) { |
7542 | struct s3c2410_request *req; |
7543 | req = list_entry(ep->queue.next, struct s3c2410_request, |
7544 | diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c |
7545 | index c9f91e6c72b6..7f65c86047dd 100644 |
7546 | --- a/drivers/usb/host/ehci-mxc.c |
7547 | +++ b/drivers/usb/host/ehci-mxc.c |
7548 | @@ -50,6 +50,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) |
7549 | } |
7550 | |
7551 | irq = platform_get_irq(pdev, 0); |
7552 | + if (irq < 0) |
7553 | + return irq; |
7554 | |
7555 | hcd = usb_create_hcd(&ehci_mxc_hc_driver, dev, dev_name(dev)); |
7556 | if (!hcd) |
7557 | diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c |
7558 | index 769749ca5961..e9a49007cce4 100644 |
7559 | --- a/drivers/usb/host/ehci-platform.c |
7560 | +++ b/drivers/usb/host/ehci-platform.c |
7561 | @@ -29,6 +29,8 @@ |
7562 | #include <linux/of.h> |
7563 | #include <linux/platform_device.h> |
7564 | #include <linux/reset.h> |
7565 | +#include <linux/sys_soc.h> |
7566 | +#include <linux/timer.h> |
7567 | #include <linux/usb.h> |
7568 | #include <linux/usb/hcd.h> |
7569 | #include <linux/usb/ehci_pdriver.h> |
7570 | @@ -44,6 +46,9 @@ struct ehci_platform_priv { |
7571 | struct clk *clks[EHCI_MAX_CLKS]; |
7572 | struct reset_control *rsts; |
7573 | bool reset_on_resume; |
7574 | + bool quirk_poll; |
7575 | + struct timer_list poll_timer; |
7576 | + struct delayed_work poll_work; |
7577 | }; |
7578 | |
7579 | static const char hcd_name[] = "ehci-platform"; |
7580 | @@ -118,6 +123,111 @@ static struct usb_ehci_pdata ehci_platform_defaults = { |
7581 | .power_off = ehci_platform_power_off, |
7582 | }; |
7583 | |
7584 | +/** |
7585 | + * quirk_poll_check_port_status - Poll port_status if the device sticks |
7586 | + * @ehci: the ehci hcd pointer |
7587 | + * |
7588 | + * Since EHCI/OHCI controllers on R-Car Gen3 SoCs are possible to be getting |
7589 | + * stuck very rarely after a full/low usb device was disconnected. To |
7590 | + * detect such a situation, the controllers require a special way which poll |
7591 | + * the EHCI PORTSC register. |
7592 | + * |
7593 | + * Return: true if the controller's port_status indicated getting stuck |
7594 | + */ |
7595 | +static bool quirk_poll_check_port_status(struct ehci_hcd *ehci) |
7596 | +{ |
7597 | + u32 port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); |
7598 | + |
7599 | + if (!(port_status & PORT_OWNER) && |
7600 | + (port_status & PORT_POWER) && |
7601 | + !(port_status & PORT_CONNECT) && |
7602 | + (port_status & PORT_LS_MASK)) |
7603 | + return true; |
7604 | + |
7605 | + return false; |
7606 | +} |
7607 | + |
7608 | +/** |
7609 | + * quirk_poll_rebind_companion - rebind comanion device to recover |
7610 | + * @ehci: the ehci hcd pointer |
7611 | + * |
7612 | + * Since EHCI/OHCI controllers on R-Car Gen3 SoCs are possible to be getting |
7613 | + * stuck very rarely after a full/low usb device was disconnected. To |
7614 | + * recover from such a situation, the controllers require changing the OHCI |
7615 | + * functional state. |
7616 | + */ |
7617 | +static void quirk_poll_rebind_companion(struct ehci_hcd *ehci) |
7618 | +{ |
7619 | + struct device *companion_dev; |
7620 | + struct usb_hcd *hcd = ehci_to_hcd(ehci); |
7621 | + |
7622 | + companion_dev = usb_of_get_companion_dev(hcd->self.controller); |
7623 | + if (!companion_dev) |
7624 | + return; |
7625 | + |
7626 | + device_release_driver(companion_dev); |
7627 | + if (device_attach(companion_dev) < 0) |
7628 | + ehci_err(ehci, "%s: failed\n", __func__); |
7629 | + |
7630 | + put_device(companion_dev); |
7631 | +} |
7632 | + |
7633 | +static void quirk_poll_work(struct work_struct *work) |
7634 | +{ |
7635 | + struct ehci_platform_priv *priv = |
7636 | + container_of(to_delayed_work(work), struct ehci_platform_priv, |
7637 | + poll_work); |
7638 | + struct ehci_hcd *ehci = container_of((void *)priv, struct ehci_hcd, |
7639 | + priv); |
7640 | + |
7641 | + /* check the status twice to reduce misdetection rate */ |
7642 | + if (!quirk_poll_check_port_status(ehci)) |
7643 | + return; |
7644 | + udelay(10); |
7645 | + if (!quirk_poll_check_port_status(ehci)) |
7646 | + return; |
7647 | + |
7648 | + ehci_dbg(ehci, "%s: detected getting stuck. rebind now!\n", __func__); |
7649 | + quirk_poll_rebind_companion(ehci); |
7650 | +} |
7651 | + |
7652 | +static void quirk_poll_timer(struct timer_list *t) |
7653 | +{ |
7654 | + struct ehci_platform_priv *priv = from_timer(priv, t, poll_timer); |
7655 | + struct ehci_hcd *ehci = container_of((void *)priv, struct ehci_hcd, |
7656 | + priv); |
7657 | + |
7658 | + if (quirk_poll_check_port_status(ehci)) { |
7659 | + /* |
7660 | + * Now scheduling the work for testing the port more. Note that |
7661 | + * updating the status is possible to be delayed when |
7662 | + * reconnection. So, this uses delayed work with 5 ms delay |
7663 | + * to avoid misdetection. |
7664 | + */ |
7665 | + schedule_delayed_work(&priv->poll_work, msecs_to_jiffies(5)); |
7666 | + } |
7667 | + |
7668 | + mod_timer(&priv->poll_timer, jiffies + HZ); |
7669 | +} |
7670 | + |
7671 | +static void quirk_poll_init(struct ehci_platform_priv *priv) |
7672 | +{ |
7673 | + INIT_DELAYED_WORK(&priv->poll_work, quirk_poll_work); |
7674 | + timer_setup(&priv->poll_timer, quirk_poll_timer, 0); |
7675 | + mod_timer(&priv->poll_timer, jiffies + HZ); |
7676 | +} |
7677 | + |
7678 | +static void quirk_poll_end(struct ehci_platform_priv *priv) |
7679 | +{ |
7680 | + del_timer_sync(&priv->poll_timer); |
7681 | + cancel_delayed_work(&priv->poll_work); |
7682 | +} |
7683 | + |
7684 | +static const struct soc_device_attribute quirk_poll_match[] = { |
7685 | + { .family = "R-Car Gen3" }, |
7686 | + { /* sentinel*/ } |
7687 | +}; |
7688 | + |
7689 | static int ehci_platform_probe(struct platform_device *dev) |
7690 | { |
7691 | struct usb_hcd *hcd; |
7692 | @@ -176,6 +286,9 @@ static int ehci_platform_probe(struct platform_device *dev) |
7693 | "has-transaction-translator")) |
7694 | hcd->has_tt = 1; |
7695 | |
7696 | + if (soc_device_match(quirk_poll_match)) |
7697 | + priv->quirk_poll = true; |
7698 | + |
7699 | for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { |
7700 | priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); |
7701 | if (IS_ERR(priv->clks[clk])) { |
7702 | @@ -247,6 +360,9 @@ static int ehci_platform_probe(struct platform_device *dev) |
7703 | device_enable_async_suspend(hcd->self.controller); |
7704 | platform_set_drvdata(dev, hcd); |
7705 | |
7706 | + if (priv->quirk_poll) |
7707 | + quirk_poll_init(priv); |
7708 | + |
7709 | return err; |
7710 | |
7711 | err_power: |
7712 | @@ -273,6 +389,9 @@ static int ehci_platform_remove(struct platform_device *dev) |
7713 | struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); |
7714 | int clk; |
7715 | |
7716 | + if (priv->quirk_poll) |
7717 | + quirk_poll_end(priv); |
7718 | + |
7719 | usb_remove_hcd(hcd); |
7720 | |
7721 | if (pdata->power_off) |
7722 | @@ -297,9 +416,13 @@ static int ehci_platform_suspend(struct device *dev) |
7723 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
7724 | struct usb_ehci_pdata *pdata = dev_get_platdata(dev); |
7725 | struct platform_device *pdev = to_platform_device(dev); |
7726 | + struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); |
7727 | bool do_wakeup = device_may_wakeup(dev); |
7728 | int ret; |
7729 | |
7730 | + if (priv->quirk_poll) |
7731 | + quirk_poll_end(priv); |
7732 | + |
7733 | ret = ehci_suspend(hcd, do_wakeup); |
7734 | if (ret) |
7735 | return ret; |
7736 | @@ -331,6 +454,14 @@ static int ehci_platform_resume(struct device *dev) |
7737 | } |
7738 | |
7739 | ehci_resume(hcd, priv->reset_on_resume); |
7740 | + |
7741 | + pm_runtime_disable(dev); |
7742 | + pm_runtime_set_active(dev); |
7743 | + pm_runtime_enable(dev); |
7744 | + |
7745 | + if (priv->quirk_poll) |
7746 | + quirk_poll_init(priv); |
7747 | + |
7748 | return 0; |
7749 | } |
7750 | #endif /* CONFIG_PM_SLEEP */ |
7751 | diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c |
7752 | index 7addfc2cbadc..4a8456f12a73 100644 |
7753 | --- a/drivers/usb/host/ohci-platform.c |
7754 | +++ b/drivers/usb/host/ohci-platform.c |
7755 | @@ -299,6 +299,11 @@ static int ohci_platform_resume(struct device *dev) |
7756 | } |
7757 | |
7758 | ohci_resume(hcd, false); |
7759 | + |
7760 | + pm_runtime_disable(dev); |
7761 | + pm_runtime_set_active(dev); |
7762 | + pm_runtime_enable(dev); |
7763 | + |
7764 | return 0; |
7765 | } |
7766 | #endif /* CONFIG_PM_SLEEP */ |
7767 | diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c |
7768 | index c158cda9e4b9..cff965240327 100644 |
7769 | --- a/drivers/usb/host/ohci-sm501.c |
7770 | +++ b/drivers/usb/host/ohci-sm501.c |
7771 | @@ -157,9 +157,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) |
7772 | * the call to usb_hcd_setup_local_mem() below does just that. |
7773 | */ |
7774 | |
7775 | - if (usb_hcd_setup_local_mem(hcd, mem->start, |
7776 | - mem->start - mem->parent->start, |
7777 | - resource_size(mem)) < 0) |
7778 | + retval = usb_hcd_setup_local_mem(hcd, mem->start, |
7779 | + mem->start - mem->parent->start, |
7780 | + resource_size(mem)); |
7781 | + if (retval < 0) |
7782 | goto err5; |
7783 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
7784 | if (retval) |
7785 | diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c |
7786 | index 52c625c02341..60d06e9b600f 100644 |
7787 | --- a/drivers/usb/host/xhci-plat.c |
7788 | +++ b/drivers/usb/host/xhci-plat.c |
7789 | @@ -410,7 +410,15 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) |
7790 | if (ret) |
7791 | return ret; |
7792 | |
7793 | - return xhci_resume(xhci, 0); |
7794 | + ret = xhci_resume(xhci, 0); |
7795 | + if (ret) |
7796 | + return ret; |
7797 | + |
7798 | + pm_runtime_disable(dev); |
7799 | + pm_runtime_set_active(dev); |
7800 | + pm_runtime_enable(dev); |
7801 | + |
7802 | + return 0; |
7803 | } |
7804 | |
7805 | static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) |
7806 | diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c |
7807 | index 7570c7602ab4..f32c582611eb 100644 |
7808 | --- a/drivers/vfio/mdev/mdev_sysfs.c |
7809 | +++ b/drivers/vfio/mdev/mdev_sysfs.c |
7810 | @@ -110,7 +110,7 @@ static struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent, |
7811 | "%s-%s", dev_driver_string(parent->dev), |
7812 | group->name); |
7813 | if (ret) { |
7814 | - kfree(type); |
7815 | + kobject_put(&type->kobj); |
7816 | return ERR_PTR(ret); |
7817 | } |
7818 | |
7819 | diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c |
7820 | index f0891bd8444c..d6359c37c9e5 100644 |
7821 | --- a/drivers/vfio/pci/vfio_pci_config.c |
7822 | +++ b/drivers/vfio/pci/vfio_pci_config.c |
7823 | @@ -1460,7 +1460,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev) |
7824 | if (ret) |
7825 | return ret; |
7826 | |
7827 | - if (cap <= PCI_CAP_ID_MAX) { |
7828 | + /* |
7829 | + * ID 0 is a NULL capability, conflicting with our fake |
7830 | + * PCI_CAP_ID_BASIC. As it has no content, consider it |
7831 | + * hidden for now. |
7832 | + */ |
7833 | + if (cap && cap <= PCI_CAP_ID_MAX) { |
7834 | len = pci_cap_length[cap]; |
7835 | if (len == 0xFF) { /* Variable length */ |
7836 | len = vfio_cap_len(vdev, cap, pos); |
7837 | @@ -1726,8 +1731,11 @@ void vfio_config_free(struct vfio_pci_device *vdev) |
7838 | vdev->vconfig = NULL; |
7839 | kfree(vdev->pci_config_map); |
7840 | vdev->pci_config_map = NULL; |
7841 | - kfree(vdev->msi_perm); |
7842 | - vdev->msi_perm = NULL; |
7843 | + if (vdev->msi_perm) { |
7844 | + free_perm_bits(vdev->msi_perm); |
7845 | + kfree(vdev->msi_perm); |
7846 | + vdev->msi_perm = NULL; |
7847 | + } |
7848 | } |
7849 | |
7850 | /* |
7851 | diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
7852 | index a9caf1bc3c3e..88ce114790d7 100644 |
7853 | --- a/drivers/vhost/scsi.c |
7854 | +++ b/drivers/vhost/scsi.c |
7855 | @@ -2290,6 +2290,7 @@ static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { |
7856 | static const struct target_core_fabric_ops vhost_scsi_ops = { |
7857 | .module = THIS_MODULE, |
7858 | .fabric_name = "vhost", |
7859 | + .max_data_sg_nents = VHOST_SCSI_PREALLOC_SGLS, |
7860 | .tpg_get_wwn = vhost_scsi_get_fabric_wwn, |
7861 | .tpg_get_tag = vhost_scsi_get_tpgt, |
7862 | .tpg_check_demo_mode = vhost_scsi_check_true, |
7863 | diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c |
7864 | index f68920131a4a..e94932c69f54 100644 |
7865 | --- a/drivers/video/backlight/lp855x_bl.c |
7866 | +++ b/drivers/video/backlight/lp855x_bl.c |
7867 | @@ -456,7 +456,7 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) |
7868 | ret = regulator_enable(lp->enable); |
7869 | if (ret < 0) { |
7870 | dev_err(lp->dev, "failed to enable vddio: %d\n", ret); |
7871 | - return ret; |
7872 | + goto disable_supply; |
7873 | } |
7874 | |
7875 | /* |
7876 | @@ -471,24 +471,34 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) |
7877 | ret = lp855x_configure(lp); |
7878 | if (ret) { |
7879 | dev_err(lp->dev, "device config err: %d", ret); |
7880 | - return ret; |
7881 | + goto disable_vddio; |
7882 | } |
7883 | |
7884 | ret = lp855x_backlight_register(lp); |
7885 | if (ret) { |
7886 | dev_err(lp->dev, |
7887 | "failed to register backlight. err: %d\n", ret); |
7888 | - return ret; |
7889 | + goto disable_vddio; |
7890 | } |
7891 | |
7892 | ret = sysfs_create_group(&lp->dev->kobj, &lp855x_attr_group); |
7893 | if (ret) { |
7894 | dev_err(lp->dev, "failed to register sysfs. err: %d\n", ret); |
7895 | - return ret; |
7896 | + goto disable_vddio; |
7897 | } |
7898 | |
7899 | backlight_update_status(lp->bl); |
7900 | + |
7901 | return 0; |
7902 | + |
7903 | +disable_vddio: |
7904 | + if (lp->enable) |
7905 | + regulator_disable(lp->enable); |
7906 | +disable_supply: |
7907 | + if (lp->supply) |
7908 | + regulator_disable(lp->supply); |
7909 | + |
7910 | + return ret; |
7911 | } |
7912 | |
7913 | static int lp855x_remove(struct i2c_client *cl) |
7914 | @@ -497,6 +507,8 @@ static int lp855x_remove(struct i2c_client *cl) |
7915 | |
7916 | lp->bl->props.brightness = 0; |
7917 | backlight_update_status(lp->bl); |
7918 | + if (lp->enable) |
7919 | + regulator_disable(lp->enable); |
7920 | if (lp->supply) |
7921 | regulator_disable(lp->supply); |
7922 | sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); |
7923 | diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c |
7924 | index e92f38fcb7a4..1b9bcfed39e9 100644 |
7925 | --- a/drivers/watchdog/da9062_wdt.c |
7926 | +++ b/drivers/watchdog/da9062_wdt.c |
7927 | @@ -55,11 +55,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt, |
7928 | unsigned int regval) |
7929 | { |
7930 | struct da9062 *chip = wdt->hw; |
7931 | - int ret; |
7932 | - |
7933 | - ret = da9062_reset_watchdog_timer(wdt); |
7934 | - if (ret) |
7935 | - return ret; |
7936 | |
7937 | regmap_update_bits(chip->regmap, |
7938 | DA9062AA_CONTROL_D, |
7939 | diff --git a/fs/afs/dir.c b/fs/afs/dir.c |
7940 | index d1e1caa23c8b..3c486340b220 100644 |
7941 | --- a/fs/afs/dir.c |
7942 | +++ b/fs/afs/dir.c |
7943 | @@ -658,7 +658,8 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, |
7944 | |
7945 | cookie->ctx.actor = afs_lookup_filldir; |
7946 | cookie->name = dentry->d_name; |
7947 | - cookie->nr_fids = 1; /* slot 0 is saved for the fid we actually want */ |
7948 | + cookie->nr_fids = 2; /* slot 0 is saved for the fid we actually want |
7949 | + * and slot 1 for the directory */ |
7950 | |
7951 | read_seqlock_excl(&dvnode->cb_lock); |
7952 | dcbi = rcu_dereference_protected(dvnode->cb_interest, |
7953 | @@ -709,7 +710,11 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, |
7954 | if (!cookie->inodes) |
7955 | goto out_s; |
7956 | |
7957 | - for (i = 1; i < cookie->nr_fids; i++) { |
7958 | + cookie->fids[1] = dvnode->fid; |
7959 | + cookie->statuses[1].cb_break = afs_calc_vnode_cb_break(dvnode); |
7960 | + cookie->inodes[1] = igrab(&dvnode->vfs_inode); |
7961 | + |
7962 | + for (i = 2; i < cookie->nr_fids; i++) { |
7963 | scb = &cookie->statuses[i]; |
7964 | |
7965 | /* Find any inodes that already exist and get their |
7966 | diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c |
7967 | index 0a4fed9e706b..5c2729fc07e5 100644 |
7968 | --- a/fs/afs/fsclient.c |
7969 | +++ b/fs/afs/fsclient.c |
7970 | @@ -56,16 +56,15 @@ static void xdr_dump_bad(const __be32 *bp) |
7971 | /* |
7972 | * decode an AFSFetchStatus block |
7973 | */ |
7974 | -static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
7975 | - struct afs_call *call, |
7976 | - struct afs_status_cb *scb) |
7977 | +static void xdr_decode_AFSFetchStatus(const __be32 **_bp, |
7978 | + struct afs_call *call, |
7979 | + struct afs_status_cb *scb) |
7980 | { |
7981 | const struct afs_xdr_AFSFetchStatus *xdr = (const void *)*_bp; |
7982 | struct afs_file_status *status = &scb->status; |
7983 | bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); |
7984 | u64 data_version, size; |
7985 | u32 type, abort_code; |
7986 | - int ret; |
7987 | |
7988 | abort_code = ntohl(xdr->abort_code); |
7989 | |
7990 | @@ -79,7 +78,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
7991 | */ |
7992 | status->abort_code = abort_code; |
7993 | scb->have_error = true; |
7994 | - goto good; |
7995 | + goto advance; |
7996 | } |
7997 | |
7998 | pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); |
7999 | @@ -89,7 +88,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
8000 | if (abort_code != 0 && inline_error) { |
8001 | status->abort_code = abort_code; |
8002 | scb->have_error = true; |
8003 | - goto good; |
8004 | + goto advance; |
8005 | } |
8006 | |
8007 | type = ntohl(xdr->type); |
8008 | @@ -125,15 +124,13 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
8009 | data_version |= (u64)ntohl(xdr->data_version_hi) << 32; |
8010 | status->data_version = data_version; |
8011 | scb->have_status = true; |
8012 | -good: |
8013 | - ret = 0; |
8014 | advance: |
8015 | *_bp = (const void *)*_bp + sizeof(*xdr); |
8016 | - return ret; |
8017 | + return; |
8018 | |
8019 | bad: |
8020 | xdr_dump_bad(*_bp); |
8021 | - ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
8022 | + afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
8023 | goto advance; |
8024 | } |
8025 | |
8026 | @@ -254,9 +251,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) |
8027 | |
8028 | /* unmarshall the reply once we've received all of it */ |
8029 | bp = call->buffer; |
8030 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8031 | - if (ret < 0) |
8032 | - return ret; |
8033 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8034 | xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
8035 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8036 | |
8037 | @@ -419,9 +414,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) |
8038 | return ret; |
8039 | |
8040 | bp = call->buffer; |
8041 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8042 | - if (ret < 0) |
8043 | - return ret; |
8044 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8045 | xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
8046 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8047 | |
8048 | @@ -579,12 +572,8 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call) |
8049 | /* unmarshall the reply once we've received all of it */ |
8050 | bp = call->buffer; |
8051 | xdr_decode_AFSFid(&bp, call->out_fid); |
8052 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8053 | - if (ret < 0) |
8054 | - return ret; |
8055 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8056 | - if (ret < 0) |
8057 | - return ret; |
8058 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8059 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8060 | xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
8061 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8062 | |
8063 | @@ -693,9 +682,7 @@ static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call) |
8064 | |
8065 | /* unmarshall the reply once we've received all of it */ |
8066 | bp = call->buffer; |
8067 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8068 | - if (ret < 0) |
8069 | - return ret; |
8070 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8071 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8072 | |
8073 | _leave(" = 0 [done]"); |
8074 | @@ -786,12 +773,8 @@ static int afs_deliver_fs_link(struct afs_call *call) |
8075 | |
8076 | /* unmarshall the reply once we've received all of it */ |
8077 | bp = call->buffer; |
8078 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8079 | - if (ret < 0) |
8080 | - return ret; |
8081 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8082 | - if (ret < 0) |
8083 | - return ret; |
8084 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8085 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8086 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8087 | |
8088 | _leave(" = 0 [done]"); |
8089 | @@ -880,12 +863,8 @@ static int afs_deliver_fs_symlink(struct afs_call *call) |
8090 | /* unmarshall the reply once we've received all of it */ |
8091 | bp = call->buffer; |
8092 | xdr_decode_AFSFid(&bp, call->out_fid); |
8093 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8094 | - if (ret < 0) |
8095 | - return ret; |
8096 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8097 | - if (ret < 0) |
8098 | - return ret; |
8099 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8100 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8101 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8102 | |
8103 | _leave(" = 0 [done]"); |
8104 | @@ -988,16 +967,12 @@ static int afs_deliver_fs_rename(struct afs_call *call) |
8105 | if (ret < 0) |
8106 | return ret; |
8107 | |
8108 | + bp = call->buffer; |
8109 | /* If the two dirs are the same, we have two copies of the same status |
8110 | * report, so we just decode it twice. |
8111 | */ |
8112 | - bp = call->buffer; |
8113 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8114 | - if (ret < 0) |
8115 | - return ret; |
8116 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8117 | - if (ret < 0) |
8118 | - return ret; |
8119 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
8120 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8121 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8122 | |
8123 | _leave(" = 0 [done]"); |
8124 | @@ -1105,9 +1080,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call) |
8125 | |
8126 | /* unmarshall the reply once we've received all of it */ |
8127 | bp = call->buffer; |
8128 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8129 | - if (ret < 0) |
8130 | - return ret; |
8131 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8132 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8133 | |
8134 | _leave(" = 0 [done]"); |
8135 | @@ -1285,9 +1258,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call) |
8136 | |
8137 | /* unmarshall the reply once we've received all of it */ |
8138 | bp = call->buffer; |
8139 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8140 | - if (ret < 0) |
8141 | - return ret; |
8142 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8143 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8144 | |
8145 | _leave(" = 0 [done]"); |
8146 | @@ -1956,9 +1927,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call) |
8147 | |
8148 | /* unmarshall the reply once we've received all of it */ |
8149 | bp = call->buffer; |
8150 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8151 | - if (ret < 0) |
8152 | - return ret; |
8153 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8154 | xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
8155 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8156 | |
8157 | @@ -2064,10 +2033,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
8158 | |
8159 | bp = call->buffer; |
8160 | scb = &call->out_scb[call->count]; |
8161 | - ret = xdr_decode_AFSFetchStatus(&bp, call, scb); |
8162 | - if (ret < 0) |
8163 | - return ret; |
8164 | - |
8165 | + xdr_decode_AFSFetchStatus(&bp, call, scb); |
8166 | call->count++; |
8167 | if (call->count < call->count2) |
8168 | goto more_counts; |
8169 | @@ -2245,9 +2211,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call) |
8170 | return ret; |
8171 | |
8172 | bp = call->buffer; |
8173 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8174 | - if (ret < 0) |
8175 | - return ret; |
8176 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8177 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8178 | |
8179 | call->unmarshall++; |
8180 | @@ -2328,9 +2292,7 @@ static int afs_deliver_fs_file_status_and_vol(struct afs_call *call) |
8181 | return ret; |
8182 | |
8183 | bp = call->buffer; |
8184 | - ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8185 | - if (ret < 0) |
8186 | - return ret; |
8187 | + xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
8188 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
8189 | |
8190 | _leave(" = 0 [done]"); |
8191 | diff --git a/fs/afs/inode.c b/fs/afs/inode.c |
8192 | index 46d2d7cb461d..a74e8e209454 100644 |
8193 | --- a/fs/afs/inode.c |
8194 | +++ b/fs/afs/inode.c |
8195 | @@ -171,6 +171,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
8196 | struct timespec64 t; |
8197 | umode_t mode; |
8198 | bool data_changed = false; |
8199 | + bool change_size = false; |
8200 | |
8201 | BUG_ON(test_bit(AFS_VNODE_UNSET, &vnode->flags)); |
8202 | |
8203 | @@ -226,6 +227,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
8204 | } else { |
8205 | set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags); |
8206 | } |
8207 | + change_size = true; |
8208 | } else if (vnode->status.type == AFS_FTYPE_DIR) { |
8209 | /* Expected directory change is handled elsewhere so |
8210 | * that we can locally edit the directory and save on a |
8211 | @@ -233,11 +235,19 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
8212 | */ |
8213 | if (test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) |
8214 | data_changed = false; |
8215 | + change_size = true; |
8216 | } |
8217 | |
8218 | if (data_changed) { |
8219 | inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); |
8220 | - afs_set_i_size(vnode, status->size); |
8221 | + |
8222 | + /* Only update the size if the data version jumped. If the |
8223 | + * file is being modified locally, then we might have our own |
8224 | + * idea of what the size should be that's not the same as |
8225 | + * what's on the server. |
8226 | + */ |
8227 | + if (change_size) |
8228 | + afs_set_i_size(vnode, status->size); |
8229 | } |
8230 | } |
8231 | |
8232 | diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
8233 | index 485cc3b2aaa8..555ad7c9afcb 100644 |
8234 | --- a/fs/afs/internal.h |
8235 | +++ b/fs/afs/internal.h |
8236 | @@ -161,6 +161,7 @@ struct afs_call { |
8237 | bool upgrade; /* T to request service upgrade */ |
8238 | bool have_reply_time; /* T if have got reply_time */ |
8239 | bool intr; /* T if interruptible */ |
8240 | + bool unmarshalling_error; /* T if an unmarshalling error occurred */ |
8241 | u16 service_id; /* Actual service ID (after upgrade) */ |
8242 | unsigned int debug_id; /* Trace ID */ |
8243 | u32 operation_ID; /* operation ID for an incoming call */ |
8244 | diff --git a/fs/afs/misc.c b/fs/afs/misc.c |
8245 | index 52b19e9c1535..5334f1bd2bca 100644 |
8246 | --- a/fs/afs/misc.c |
8247 | +++ b/fs/afs/misc.c |
8248 | @@ -83,6 +83,7 @@ int afs_abort_to_error(u32 abort_code) |
8249 | case UAENOLCK: return -ENOLCK; |
8250 | case UAENOTEMPTY: return -ENOTEMPTY; |
8251 | case UAELOOP: return -ELOOP; |
8252 | + case UAEOVERFLOW: return -EOVERFLOW; |
8253 | case UAENOMEDIUM: return -ENOMEDIUM; |
8254 | case UAEDQUOT: return -EDQUOT; |
8255 | |
8256 | diff --git a/fs/afs/proc.c b/fs/afs/proc.c |
8257 | index fba2ec3a3a9c..106b27011f6d 100644 |
8258 | --- a/fs/afs/proc.c |
8259 | +++ b/fs/afs/proc.c |
8260 | @@ -562,6 +562,7 @@ void afs_put_sysnames(struct afs_sysnames *sysnames) |
8261 | if (sysnames->subs[i] != afs_init_sysname && |
8262 | sysnames->subs[i] != sysnames->blank) |
8263 | kfree(sysnames->subs[i]); |
8264 | + kfree(sysnames); |
8265 | } |
8266 | } |
8267 | |
8268 | diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
8269 | index 52aa90fb4fbd..6adab30a8399 100644 |
8270 | --- a/fs/afs/rxrpc.c |
8271 | +++ b/fs/afs/rxrpc.c |
8272 | @@ -540,6 +540,8 @@ static void afs_deliver_to_call(struct afs_call *call) |
8273 | |
8274 | ret = call->type->deliver(call); |
8275 | state = READ_ONCE(call->state); |
8276 | + if (ret == 0 && call->unmarshalling_error) |
8277 | + ret = -EBADMSG; |
8278 | switch (ret) { |
8279 | case 0: |
8280 | afs_queue_call_work(call); |
8281 | @@ -963,5 +965,7 @@ noinline int afs_protocol_error(struct afs_call *call, int error, |
8282 | enum afs_eproto_cause cause) |
8283 | { |
8284 | trace_afs_protocol_error(call, error, cause); |
8285 | + if (call) |
8286 | + call->unmarshalling_error = true; |
8287 | return error; |
8288 | } |
8289 | diff --git a/fs/afs/write.c b/fs/afs/write.c |
8290 | index cb76566763db..96b042af6248 100644 |
8291 | --- a/fs/afs/write.c |
8292 | +++ b/fs/afs/write.c |
8293 | @@ -194,11 +194,11 @@ int afs_write_end(struct file *file, struct address_space *mapping, |
8294 | |
8295 | i_size = i_size_read(&vnode->vfs_inode); |
8296 | if (maybe_i_size > i_size) { |
8297 | - spin_lock(&vnode->wb_lock); |
8298 | + write_seqlock(&vnode->cb_lock); |
8299 | i_size = i_size_read(&vnode->vfs_inode); |
8300 | if (maybe_i_size > i_size) |
8301 | i_size_write(&vnode->vfs_inode, maybe_i_size); |
8302 | - spin_unlock(&vnode->wb_lock); |
8303 | + write_sequnlock(&vnode->cb_lock); |
8304 | } |
8305 | |
8306 | if (!PageUptodate(page)) { |
8307 | @@ -811,6 +811,7 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) |
8308 | vmf->page->index, priv); |
8309 | SetPagePrivate(vmf->page); |
8310 | set_page_private(vmf->page, priv); |
8311 | + file_update_time(file); |
8312 | |
8313 | sb_end_pagefault(inode->i_sb); |
8314 | return VM_FAULT_LOCKED; |
8315 | diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
8316 | index 8af7f093305d..d21cf61d86b9 100644 |
8317 | --- a/fs/afs/yfsclient.c |
8318 | +++ b/fs/afs/yfsclient.c |
8319 | @@ -179,21 +179,20 @@ static void xdr_dump_bad(const __be32 *bp) |
8320 | /* |
8321 | * Decode a YFSFetchStatus block |
8322 | */ |
8323 | -static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
8324 | - struct afs_call *call, |
8325 | - struct afs_status_cb *scb) |
8326 | +static void xdr_decode_YFSFetchStatus(const __be32 **_bp, |
8327 | + struct afs_call *call, |
8328 | + struct afs_status_cb *scb) |
8329 | { |
8330 | const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; |
8331 | struct afs_file_status *status = &scb->status; |
8332 | u32 type; |
8333 | - int ret; |
8334 | |
8335 | status->abort_code = ntohl(xdr->abort_code); |
8336 | if (status->abort_code != 0) { |
8337 | if (status->abort_code == VNOVNODE) |
8338 | status->nlink = 0; |
8339 | scb->have_error = true; |
8340 | - goto good; |
8341 | + goto advance; |
8342 | } |
8343 | |
8344 | type = ntohl(xdr->type); |
8345 | @@ -221,15 +220,13 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
8346 | status->size = xdr_to_u64(xdr->size); |
8347 | status->data_version = xdr_to_u64(xdr->data_version); |
8348 | scb->have_status = true; |
8349 | -good: |
8350 | - ret = 0; |
8351 | advance: |
8352 | *_bp += xdr_size(xdr); |
8353 | - return ret; |
8354 | + return; |
8355 | |
8356 | bad: |
8357 | xdr_dump_bad(*_bp); |
8358 | - ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
8359 | + afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
8360 | goto advance; |
8361 | } |
8362 | |
8363 | @@ -348,9 +345,7 @@ static int yfs_deliver_fs_status_cb_and_volsync(struct afs_call *call) |
8364 | |
8365 | /* unmarshall the reply once we've received all of it */ |
8366 | bp = call->buffer; |
8367 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8368 | - if (ret < 0) |
8369 | - return ret; |
8370 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8371 | xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
8372 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8373 | |
8374 | @@ -372,9 +367,7 @@ static int yfs_deliver_status_and_volsync(struct afs_call *call) |
8375 | return ret; |
8376 | |
8377 | bp = call->buffer; |
8378 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8379 | - if (ret < 0) |
8380 | - return ret; |
8381 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8382 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8383 | |
8384 | _leave(" = 0 [done]"); |
8385 | @@ -534,9 +527,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) |
8386 | return ret; |
8387 | |
8388 | bp = call->buffer; |
8389 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8390 | - if (ret < 0) |
8391 | - return ret; |
8392 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8393 | xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
8394 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8395 | |
8396 | @@ -645,12 +636,8 @@ static int yfs_deliver_fs_create_vnode(struct afs_call *call) |
8397 | /* unmarshall the reply once we've received all of it */ |
8398 | bp = call->buffer; |
8399 | xdr_decode_YFSFid(&bp, call->out_fid); |
8400 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8401 | - if (ret < 0) |
8402 | - return ret; |
8403 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8404 | - if (ret < 0) |
8405 | - return ret; |
8406 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8407 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8408 | xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
8409 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8410 | |
8411 | @@ -803,14 +790,9 @@ static int yfs_deliver_fs_remove_file2(struct afs_call *call) |
8412 | return ret; |
8413 | |
8414 | bp = call->buffer; |
8415 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8416 | - if (ret < 0) |
8417 | - return ret; |
8418 | - |
8419 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8420 | xdr_decode_YFSFid(&bp, &fid); |
8421 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8422 | - if (ret < 0) |
8423 | - return ret; |
8424 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8425 | /* Was deleted if vnode->status.abort_code == VNOVNODE. */ |
8426 | |
8427 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8428 | @@ -890,10 +872,7 @@ static int yfs_deliver_fs_remove(struct afs_call *call) |
8429 | return ret; |
8430 | |
8431 | bp = call->buffer; |
8432 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8433 | - if (ret < 0) |
8434 | - return ret; |
8435 | - |
8436 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8437 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8438 | return 0; |
8439 | } |
8440 | @@ -975,12 +954,8 @@ static int yfs_deliver_fs_link(struct afs_call *call) |
8441 | return ret; |
8442 | |
8443 | bp = call->buffer; |
8444 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8445 | - if (ret < 0) |
8446 | - return ret; |
8447 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8448 | - if (ret < 0) |
8449 | - return ret; |
8450 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8451 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8452 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8453 | _leave(" = 0 [done]"); |
8454 | return 0; |
8455 | @@ -1062,12 +1037,8 @@ static int yfs_deliver_fs_symlink(struct afs_call *call) |
8456 | /* unmarshall the reply once we've received all of it */ |
8457 | bp = call->buffer; |
8458 | xdr_decode_YFSFid(&bp, call->out_fid); |
8459 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8460 | - if (ret < 0) |
8461 | - return ret; |
8462 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8463 | - if (ret < 0) |
8464 | - return ret; |
8465 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8466 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8467 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8468 | |
8469 | _leave(" = 0 [done]"); |
8470 | @@ -1155,13 +1126,11 @@ static int yfs_deliver_fs_rename(struct afs_call *call) |
8471 | return ret; |
8472 | |
8473 | bp = call->buffer; |
8474 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8475 | - if (ret < 0) |
8476 | - return ret; |
8477 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8478 | - if (ret < 0) |
8479 | - return ret; |
8480 | - |
8481 | + /* If the two dirs are the same, we have two copies of the same status |
8482 | + * report, so we just decode it twice. |
8483 | + */ |
8484 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
8485 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8486 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8487 | _leave(" = 0 [done]"); |
8488 | return 0; |
8489 | @@ -1846,9 +1815,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
8490 | |
8491 | bp = call->buffer; |
8492 | scb = &call->out_scb[call->count]; |
8493 | - ret = xdr_decode_YFSFetchStatus(&bp, call, scb); |
8494 | - if (ret < 0) |
8495 | - return ret; |
8496 | + xdr_decode_YFSFetchStatus(&bp, call, scb); |
8497 | |
8498 | call->count++; |
8499 | if (call->count < call->count2) |
8500 | @@ -2068,9 +2035,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call) |
8501 | bp = call->buffer; |
8502 | yacl->inherit_flag = ntohl(*bp++); |
8503 | yacl->num_cleaned = ntohl(*bp++); |
8504 | - ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8505 | - if (ret < 0) |
8506 | - return ret; |
8507 | + xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
8508 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
8509 | |
8510 | call->unmarshall++; |
8511 | diff --git a/fs/block_dev.c b/fs/block_dev.c |
8512 | index 34644ce4b502..2dc9c73a4cb2 100644 |
8513 | --- a/fs/block_dev.c |
8514 | +++ b/fs/block_dev.c |
8515 | @@ -1546,10 +1546,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
8516 | */ |
8517 | if (!for_part) { |
8518 | ret = devcgroup_inode_permission(bdev->bd_inode, perm); |
8519 | - if (ret != 0) { |
8520 | - bdput(bdev); |
8521 | + if (ret != 0) |
8522 | return ret; |
8523 | - } |
8524 | } |
8525 | |
8526 | restart: |
8527 | @@ -1618,8 +1616,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
8528 | goto out_clear; |
8529 | BUG_ON(for_part); |
8530 | ret = __blkdev_get(whole, mode, 1); |
8531 | - if (ret) |
8532 | + if (ret) { |
8533 | + bdput(whole); |
8534 | goto out_clear; |
8535 | + } |
8536 | bdev->bd_contains = whole; |
8537 | bdev->bd_part = disk_get_part(disk, partno); |
8538 | if (!(disk->flags & GENHD_FL_UP) || |
8539 | @@ -1669,7 +1669,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
8540 | disk_unblock_events(disk); |
8541 | put_disk_and_module(disk); |
8542 | out: |
8543 | - bdput(bdev); |
8544 | |
8545 | return ret; |
8546 | } |
8547 | @@ -1736,6 +1735,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) |
8548 | bdput(whole); |
8549 | } |
8550 | |
8551 | + if (res) |
8552 | + bdput(bdev); |
8553 | + |
8554 | return res; |
8555 | } |
8556 | EXPORT_SYMBOL(blkdev_get); |
8557 | diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
8558 | index 79dc06881e78..e088843a7734 100644 |
8559 | --- a/fs/ceph/export.c |
8560 | +++ b/fs/ceph/export.c |
8561 | @@ -172,9 +172,16 @@ struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino) |
8562 | static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) |
8563 | { |
8564 | struct inode *inode = __lookup_inode(sb, ino); |
8565 | + int err; |
8566 | + |
8567 | if (IS_ERR(inode)) |
8568 | return ERR_CAST(inode); |
8569 | - if (inode->i_nlink == 0) { |
8570 | + /* We need LINK caps to reliably check i_nlink */ |
8571 | + err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false); |
8572 | + if (err) |
8573 | + return ERR_PTR(err); |
8574 | + /* -ESTALE if inode as been unlinked and no file is open */ |
8575 | + if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) { |
8576 | iput(inode); |
8577 | return ERR_PTR(-ESTALE); |
8578 | } |
8579 | diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
8580 | index 721b2560caa7..947c4aad5d6a 100644 |
8581 | --- a/fs/cifs/connect.c |
8582 | +++ b/fs/cifs/connect.c |
8583 | @@ -614,26 +614,26 @@ cifs_reconnect(struct TCP_Server_Info *server) |
8584 | try_to_freeze(); |
8585 | |
8586 | mutex_lock(&server->srv_mutex); |
8587 | +#ifdef CONFIG_CIFS_DFS_UPCALL |
8588 | /* |
8589 | * Set up next DFS target server (if any) for reconnect. If DFS |
8590 | * feature is disabled, then we will retry last server we |
8591 | * connected to before. |
8592 | */ |
8593 | + reconn_inval_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); |
8594 | +#endif |
8595 | + rc = reconn_set_ipaddr(server); |
8596 | + if (rc) { |
8597 | + cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", |
8598 | + __func__, rc); |
8599 | + } |
8600 | + |
8601 | if (cifs_rdma_enabled(server)) |
8602 | rc = smbd_reconnect(server); |
8603 | else |
8604 | rc = generic_ip_connect(server); |
8605 | if (rc) { |
8606 | cifs_dbg(FYI, "reconnect error %d\n", rc); |
8607 | -#ifdef CONFIG_CIFS_DFS_UPCALL |
8608 | - reconn_inval_dfs_target(server, cifs_sb, &tgt_list, |
8609 | - &tgt_it); |
8610 | -#endif |
8611 | - rc = reconn_set_ipaddr(server); |
8612 | - if (rc) { |
8613 | - cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", |
8614 | - __func__, rc); |
8615 | - } |
8616 | mutex_unlock(&server->srv_mutex); |
8617 | msleep(3000); |
8618 | } else { |
8619 | diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h |
8620 | index 416d9de35679..4311d01b02a8 100644 |
8621 | --- a/fs/dlm/dlm_internal.h |
8622 | +++ b/fs/dlm/dlm_internal.h |
8623 | @@ -97,7 +97,6 @@ do { \ |
8624 | __LINE__, __FILE__, #x, jiffies); \ |
8625 | {do} \ |
8626 | printk("\n"); \ |
8627 | - BUG(); \ |
8628 | panic("DLM: Record message above and reboot.\n"); \ |
8629 | } \ |
8630 | } |
8631 | diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
8632 | index 2743c6f8a457..0589e914663f 100644 |
8633 | --- a/fs/ext4/dir.c |
8634 | +++ b/fs/ext4/dir.c |
8635 | @@ -677,6 +677,7 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len, |
8636 | struct qstr qstr = {.name = str, .len = len }; |
8637 | const struct dentry *parent = READ_ONCE(dentry->d_parent); |
8638 | const struct inode *inode = READ_ONCE(parent->d_inode); |
8639 | + char strbuf[DNAME_INLINE_LEN]; |
8640 | |
8641 | if (!inode || !IS_CASEFOLDED(inode) || |
8642 | !EXT4_SB(inode->i_sb)->s_encoding) { |
8643 | @@ -685,6 +686,21 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len, |
8644 | return memcmp(str, name->name, len); |
8645 | } |
8646 | |
8647 | + /* |
8648 | + * If the dentry name is stored in-line, then it may be concurrently |
8649 | + * modified by a rename. If this happens, the VFS will eventually retry |
8650 | + * the lookup, so it doesn't matter what ->d_compare() returns. |
8651 | + * However, it's unsafe to call utf8_strncasecmp() with an unstable |
8652 | + * string. Therefore, we have to copy the name into a temporary buffer. |
8653 | + */ |
8654 | + if (len <= DNAME_INLINE_LEN - 1) { |
8655 | + memcpy(strbuf, str, len); |
8656 | + strbuf[len] = 0; |
8657 | + qstr.name = strbuf; |
8658 | + /* prevent compiler from optimizing out the temporary buffer */ |
8659 | + barrier(); |
8660 | + } |
8661 | + |
8662 | return ext4_ci_compare(inode, name, &qstr, false); |
8663 | } |
8664 | |
8665 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
8666 | index 9bd44588eb77..3193f0b4a02d 100644 |
8667 | --- a/fs/ext4/extents.c |
8668 | +++ b/fs/ext4/extents.c |
8669 | @@ -3010,7 +3010,7 @@ again: |
8670 | * in use to avoid freeing it when removing blocks. |
8671 | */ |
8672 | if (sbi->s_cluster_ratio > 1) { |
8673 | - pblk = ext4_ext_pblock(ex) + end - ee_block + 2; |
8674 | + pblk = ext4_ext_pblock(ex) + end - ee_block + 1; |
8675 | partial.pclu = EXT4_B2C(sbi, pblk); |
8676 | partial.state = nofree; |
8677 | } |
8678 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
8679 | index d3500eaf900e..f7c20bb20da3 100644 |
8680 | --- a/fs/ext4/super.c |
8681 | +++ b/fs/ext4/super.c |
8682 | @@ -2034,6 +2034,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, |
8683 | #endif |
8684 | } else if (token == Opt_dax) { |
8685 | #ifdef CONFIG_FS_DAX |
8686 | + if (is_remount && test_opt(sb, DAX)) { |
8687 | + ext4_msg(sb, KERN_ERR, "can't mount with " |
8688 | + "both data=journal and dax"); |
8689 | + return -1; |
8690 | + } |
8691 | + if (is_remount && !(sbi->s_mount_opt & EXT4_MOUNT_DAX)) { |
8692 | + ext4_msg(sb, KERN_ERR, "can't change " |
8693 | + "dax mount option while remounting"); |
8694 | + return -1; |
8695 | + } |
8696 | ext4_msg(sb, KERN_WARNING, |
8697 | "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); |
8698 | sbi->s_mount_opt |= m->mount_opt; |
8699 | @@ -2294,6 +2304,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, |
8700 | ext4_msg(sb, KERN_ERR, "revision level too high, " |
8701 | "forcing read-only mode"); |
8702 | err = -EROFS; |
8703 | + goto done; |
8704 | } |
8705 | if (read_only) |
8706 | goto done; |
8707 | @@ -5366,12 +5377,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
8708 | err = -EINVAL; |
8709 | goto restore_opts; |
8710 | } |
8711 | - if (test_opt(sb, DAX)) { |
8712 | - ext4_msg(sb, KERN_ERR, "can't mount with " |
8713 | - "both data=journal and dax"); |
8714 | - err = -EINVAL; |
8715 | - goto restore_opts; |
8716 | - } |
8717 | } else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) { |
8718 | if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { |
8719 | ext4_msg(sb, KERN_ERR, "can't mount with " |
8720 | @@ -5387,12 +5392,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
8721 | goto restore_opts; |
8722 | } |
8723 | |
8724 | - if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX) { |
8725 | - ext4_msg(sb, KERN_WARNING, "warning: refusing change of " |
8726 | - "dax flag with busy inodes while remounting"); |
8727 | - sbi->s_mount_opt ^= EXT4_MOUNT_DAX; |
8728 | - } |
8729 | - |
8730 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) |
8731 | ext4_abort(sb, "Abort forced by user"); |
8732 | |
8733 | diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
8734 | index a28ffecc0f95..bbd07fe8a492 100644 |
8735 | --- a/fs/f2fs/checkpoint.c |
8736 | +++ b/fs/f2fs/checkpoint.c |
8737 | @@ -892,8 +892,8 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
8738 | int i; |
8739 | int err; |
8740 | |
8741 | - sbi->ckpt = f2fs_kzalloc(sbi, array_size(blk_size, cp_blks), |
8742 | - GFP_KERNEL); |
8743 | + sbi->ckpt = f2fs_kvzalloc(sbi, array_size(blk_size, cp_blks), |
8744 | + GFP_KERNEL); |
8745 | if (!sbi->ckpt) |
8746 | return -ENOMEM; |
8747 | /* |
8748 | diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c |
8749 | index 84280ad3786c..e9af46dc06f7 100644 |
8750 | --- a/fs/f2fs/dir.c |
8751 | +++ b/fs/f2fs/dir.c |
8752 | @@ -107,36 +107,28 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, |
8753 | /* |
8754 | * Test whether a case-insensitive directory entry matches the filename |
8755 | * being searched for. |
8756 | - * |
8757 | - * Returns: 0 if the directory entry matches, more than 0 if it |
8758 | - * doesn't match or less than zero on error. |
8759 | */ |
8760 | -int f2fs_ci_compare(const struct inode *parent, const struct qstr *name, |
8761 | - const struct qstr *entry, bool quick) |
8762 | +static bool f2fs_match_ci_name(const struct inode *dir, const struct qstr *name, |
8763 | + const struct qstr *entry, bool quick) |
8764 | { |
8765 | - const struct f2fs_sb_info *sbi = F2FS_SB(parent->i_sb); |
8766 | + const struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); |
8767 | const struct unicode_map *um = sbi->s_encoding; |
8768 | - int ret; |
8769 | + int res; |
8770 | |
8771 | if (quick) |
8772 | - ret = utf8_strncasecmp_folded(um, name, entry); |
8773 | + res = utf8_strncasecmp_folded(um, name, entry); |
8774 | else |
8775 | - ret = utf8_strncasecmp(um, name, entry); |
8776 | - |
8777 | - if (ret < 0) { |
8778 | - /* Handle invalid character sequence as either an error |
8779 | - * or as an opaque byte sequence. |
8780 | + res = utf8_strncasecmp(um, name, entry); |
8781 | + if (res < 0) { |
8782 | + /* |
8783 | + * In strict mode, ignore invalid names. In non-strict mode, |
8784 | + * fall back to treating them as opaque byte sequences. |
8785 | */ |
8786 | - if (f2fs_has_strict_mode(sbi)) |
8787 | - return -EINVAL; |
8788 | - |
8789 | - if (name->len != entry->len) |
8790 | - return 1; |
8791 | - |
8792 | - return !!memcmp(name->name, entry->name, name->len); |
8793 | + if (f2fs_has_strict_mode(sbi) || name->len != entry->len) |
8794 | + return false; |
8795 | + return !memcmp(name->name, entry->name, name->len); |
8796 | } |
8797 | - |
8798 | - return ret; |
8799 | + return res == 0; |
8800 | } |
8801 | |
8802 | static void f2fs_fname_setup_ci_filename(struct inode *dir, |
8803 | @@ -188,10 +180,10 @@ static inline bool f2fs_match_name(struct f2fs_dentry_ptr *d, |
8804 | if (cf_str->name) { |
8805 | struct qstr cf = {.name = cf_str->name, |
8806 | .len = cf_str->len}; |
8807 | - return !f2fs_ci_compare(parent, &cf, &entry, true); |
8808 | + return f2fs_match_ci_name(parent, &cf, &entry, true); |
8809 | } |
8810 | - return !f2fs_ci_compare(parent, fname->usr_fname, &entry, |
8811 | - false); |
8812 | + return f2fs_match_ci_name(parent, fname->usr_fname, &entry, |
8813 | + false); |
8814 | } |
8815 | #endif |
8816 | if (fscrypt_match_name(fname, d->filename[bit_pos], |
8817 | @@ -1067,17 +1059,41 @@ const struct file_operations f2fs_dir_operations = { |
8818 | static int f2fs_d_compare(const struct dentry *dentry, unsigned int len, |
8819 | const char *str, const struct qstr *name) |
8820 | { |
8821 | - struct qstr qstr = {.name = str, .len = len }; |
8822 | const struct dentry *parent = READ_ONCE(dentry->d_parent); |
8823 | - const struct inode *inode = READ_ONCE(parent->d_inode); |
8824 | + const struct inode *dir = READ_ONCE(parent->d_inode); |
8825 | + const struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); |
8826 | + struct qstr entry = QSTR_INIT(str, len); |
8827 | + char strbuf[DNAME_INLINE_LEN]; |
8828 | + int res; |
8829 | + |
8830 | + if (!dir || !IS_CASEFOLDED(dir)) |
8831 | + goto fallback; |
8832 | |
8833 | - if (!inode || !IS_CASEFOLDED(inode)) { |
8834 | - if (len != name->len) |
8835 | - return -1; |
8836 | - return memcmp(str, name->name, len); |
8837 | + /* |
8838 | + * If the dentry name is stored in-line, then it may be concurrently |
8839 | + * modified by a rename. If this happens, the VFS will eventually retry |
8840 | + * the lookup, so it doesn't matter what ->d_compare() returns. |
8841 | + * However, it's unsafe to call utf8_strncasecmp() with an unstable |
8842 | + * string. Therefore, we have to copy the name into a temporary buffer. |
8843 | + */ |
8844 | + if (len <= DNAME_INLINE_LEN - 1) { |
8845 | + memcpy(strbuf, str, len); |
8846 | + strbuf[len] = 0; |
8847 | + entry.name = strbuf; |
8848 | + /* prevent compiler from optimizing out the temporary buffer */ |
8849 | + barrier(); |
8850 | } |
8851 | |
8852 | - return f2fs_ci_compare(inode, name, &qstr, false); |
8853 | + res = utf8_strncasecmp(sbi->s_encoding, name, &entry); |
8854 | + if (res >= 0) |
8855 | + return res; |
8856 | + |
8857 | + if (f2fs_has_strict_mode(sbi)) |
8858 | + return -EINVAL; |
8859 | +fallback: |
8860 | + if (len != name->len) |
8861 | + return 1; |
8862 | + return !!memcmp(str, name->name, len); |
8863 | } |
8864 | |
8865 | static int f2fs_d_hash(const struct dentry *dentry, struct qstr *str) |
8866 | diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
8867 | index a26ea1e6ba88..03693d6b1c10 100644 |
8868 | --- a/fs/f2fs/f2fs.h |
8869 | +++ b/fs/f2fs/f2fs.h |
8870 | @@ -2790,18 +2790,12 @@ static inline bool f2fs_may_extent_tree(struct inode *inode) |
8871 | static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, |
8872 | size_t size, gfp_t flags) |
8873 | { |
8874 | - void *ret; |
8875 | - |
8876 | if (time_to_inject(sbi, FAULT_KMALLOC)) { |
8877 | f2fs_show_injection_info(FAULT_KMALLOC); |
8878 | return NULL; |
8879 | } |
8880 | |
8881 | - ret = kmalloc(size, flags); |
8882 | - if (ret) |
8883 | - return ret; |
8884 | - |
8885 | - return kvmalloc(size, flags); |
8886 | + return kmalloc(size, flags); |
8887 | } |
8888 | |
8889 | static inline void *f2fs_kzalloc(struct f2fs_sb_info *sbi, |
8890 | @@ -2960,11 +2954,6 @@ int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, |
8891 | bool hot, bool set); |
8892 | struct dentry *f2fs_get_parent(struct dentry *child); |
8893 | |
8894 | -extern int f2fs_ci_compare(const struct inode *parent, |
8895 | - const struct qstr *name, |
8896 | - const struct qstr *entry, |
8897 | - bool quick); |
8898 | - |
8899 | /* |
8900 | * dir.c |
8901 | */ |
8902 | diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
8903 | index c3a9da79ac99..5d94abe467a4 100644 |
8904 | --- a/fs/f2fs/file.c |
8905 | +++ b/fs/f2fs/file.c |
8906 | @@ -2056,8 +2056,15 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) |
8907 | |
8908 | if (in != F2FS_GOING_DOWN_FULLSYNC) { |
8909 | ret = mnt_want_write_file(filp); |
8910 | - if (ret) |
8911 | + if (ret) { |
8912 | + if (ret == -EROFS) { |
8913 | + ret = 0; |
8914 | + f2fs_stop_checkpoint(sbi, false); |
8915 | + set_sbi_flag(sbi, SBI_IS_SHUTDOWN); |
8916 | + trace_f2fs_shutdown(sbi, in, ret); |
8917 | + } |
8918 | return ret; |
8919 | + } |
8920 | } |
8921 | |
8922 | switch (in) { |
8923 | diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
8924 | index f14401a77d60..90a20bd12961 100644 |
8925 | --- a/fs/f2fs/node.c |
8926 | +++ b/fs/f2fs/node.c |
8927 | @@ -2933,7 +2933,7 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) |
8928 | return 0; |
8929 | |
8930 | nm_i->nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8); |
8931 | - nm_i->nat_bits = f2fs_kzalloc(sbi, |
8932 | + nm_i->nat_bits = f2fs_kvzalloc(sbi, |
8933 | nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL); |
8934 | if (!nm_i->nat_bits) |
8935 | return -ENOMEM; |
8936 | @@ -3066,9 +3066,9 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi) |
8937 | int i; |
8938 | |
8939 | nm_i->free_nid_bitmap = |
8940 | - f2fs_kzalloc(sbi, array_size(sizeof(unsigned char *), |
8941 | - nm_i->nat_blocks), |
8942 | - GFP_KERNEL); |
8943 | + f2fs_kvzalloc(sbi, array_size(sizeof(unsigned char *), |
8944 | + nm_i->nat_blocks), |
8945 | + GFP_KERNEL); |
8946 | if (!nm_i->free_nid_bitmap) |
8947 | return -ENOMEM; |
8948 | |
8949 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
8950 | index e36543c9f2b7..f4b882ee48dd 100644 |
8951 | --- a/fs/f2fs/super.c |
8952 | +++ b/fs/f2fs/super.c |
8953 | @@ -1230,7 +1230,8 @@ static int f2fs_statfs_project(struct super_block *sb, |
8954 | limit >>= sb->s_blocksize_bits; |
8955 | |
8956 | if (limit && buf->f_blocks > limit) { |
8957 | - curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; |
8958 | + curblock = (dquot->dq_dqb.dqb_curspace + |
8959 | + dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; |
8960 | buf->f_blocks = limit; |
8961 | buf->f_bfree = buf->f_bavail = |
8962 | (buf->f_blocks > curblock) ? |
8963 | @@ -2900,7 +2901,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) |
8964 | if (nr_sectors & (bdev_zone_sectors(bdev) - 1)) |
8965 | FDEV(devi).nr_blkz++; |
8966 | |
8967 | - FDEV(devi).blkz_seq = f2fs_kzalloc(sbi, |
8968 | + FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi, |
8969 | BITS_TO_LONGS(FDEV(devi).nr_blkz) |
8970 | * sizeof(unsigned long), |
8971 | GFP_KERNEL); |
8972 | diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
8973 | index 3dd37a998ea9..66214707a945 100644 |
8974 | --- a/fs/fuse/file.c |
8975 | +++ b/fs/fuse/file.c |
8976 | @@ -712,6 +712,7 @@ static ssize_t fuse_async_req_send(struct fuse_conn *fc, |
8977 | spin_unlock(&io->lock); |
8978 | |
8979 | ia->ap.args.end = fuse_aio_complete_req; |
8980 | + ia->ap.args.may_block = io->should_dirty; |
8981 | err = fuse_simple_background(fc, &ia->ap.args, GFP_KERNEL); |
8982 | if (err) |
8983 | fuse_aio_complete_req(fc, &ia->ap.args, err); |
8984 | @@ -3279,13 +3280,11 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
8985 | if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb) |
8986 | return -EXDEV; |
8987 | |
8988 | - if (fc->writeback_cache) { |
8989 | - inode_lock(inode_in); |
8990 | - err = fuse_writeback_range(inode_in, pos_in, pos_in + len); |
8991 | - inode_unlock(inode_in); |
8992 | - if (err) |
8993 | - return err; |
8994 | - } |
8995 | + inode_lock(inode_in); |
8996 | + err = fuse_writeback_range(inode_in, pos_in, pos_in + len - 1); |
8997 | + inode_unlock(inode_in); |
8998 | + if (err) |
8999 | + return err; |
9000 | |
9001 | inode_lock(inode_out); |
9002 | |
9003 | @@ -3293,11 +3292,27 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
9004 | if (err) |
9005 | goto out; |
9006 | |
9007 | - if (fc->writeback_cache) { |
9008 | - err = fuse_writeback_range(inode_out, pos_out, pos_out + len); |
9009 | - if (err) |
9010 | - goto out; |
9011 | - } |
9012 | + /* |
9013 | + * Write out dirty pages in the destination file before sending the COPY |
9014 | + * request to userspace. After the request is completed, truncate off |
9015 | + * pages (including partial ones) from the cache that have been copied, |
9016 | + * since these contain stale data at that point. |
9017 | + * |
9018 | + * This should be mostly correct, but if the COPY writes to partial |
9019 | + * pages (at the start or end) and the parts not covered by the COPY are |
9020 | + * written through a memory map after calling fuse_writeback_range(), |
9021 | + * then these partial page modifications will be lost on truncation. |
9022 | + * |
9023 | + * It is unlikely that someone would rely on such mixed style |
9024 | + * modifications. Yet this does give less guarantees than if the |
9025 | + * copying was performed with write(2). |
9026 | + * |
9027 | + * To fix this a i_mmap_sem style lock could be used to prevent new |
9028 | + * faults while the copy is ongoing. |
9029 | + */ |
9030 | + err = fuse_writeback_range(inode_out, pos_out, pos_out + len - 1); |
9031 | + if (err) |
9032 | + goto out; |
9033 | |
9034 | if (is_unstable) |
9035 | set_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state); |
9036 | @@ -3318,6 +3333,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
9037 | if (err) |
9038 | goto out; |
9039 | |
9040 | + truncate_inode_pages_range(inode_out->i_mapping, |
9041 | + ALIGN_DOWN(pos_out, PAGE_SIZE), |
9042 | + ALIGN(pos_out + outarg.size, PAGE_SIZE) - 1); |
9043 | + |
9044 | if (fc->writeback_cache) { |
9045 | fuse_write_update_size(inode_out, pos_out + outarg.size); |
9046 | file_update_time(file_out); |
9047 | diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
9048 | index ca344bf71404..d7cde216fc87 100644 |
9049 | --- a/fs/fuse/fuse_i.h |
9050 | +++ b/fs/fuse/fuse_i.h |
9051 | @@ -249,6 +249,7 @@ struct fuse_args { |
9052 | bool out_argvar:1; |
9053 | bool page_zeroing:1; |
9054 | bool page_replace:1; |
9055 | + bool may_block:1; |
9056 | struct fuse_in_arg in_args[3]; |
9057 | struct fuse_arg out_args[2]; |
9058 | void (*end)(struct fuse_conn *fc, struct fuse_args *args, int error); |
9059 | diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c |
9060 | index a5c86048b96e..7505f8102762 100644 |
9061 | --- a/fs/fuse/virtio_fs.c |
9062 | +++ b/fs/fuse/virtio_fs.c |
9063 | @@ -55,6 +55,12 @@ struct virtio_fs_forget { |
9064 | struct list_head list; |
9065 | }; |
9066 | |
9067 | +struct virtio_fs_req_work { |
9068 | + struct fuse_req *req; |
9069 | + struct virtio_fs_vq *fsvq; |
9070 | + struct work_struct done_work; |
9071 | +}; |
9072 | + |
9073 | static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, |
9074 | struct fuse_req *req, bool in_flight); |
9075 | |
9076 | @@ -443,19 +449,67 @@ static void copy_args_from_argbuf(struct fuse_args *args, struct fuse_req *req) |
9077 | } |
9078 | |
9079 | /* Work function for request completion */ |
9080 | +static void virtio_fs_request_complete(struct fuse_req *req, |
9081 | + struct virtio_fs_vq *fsvq) |
9082 | +{ |
9083 | + struct fuse_pqueue *fpq = &fsvq->fud->pq; |
9084 | + struct fuse_conn *fc = fsvq->fud->fc; |
9085 | + struct fuse_args *args; |
9086 | + struct fuse_args_pages *ap; |
9087 | + unsigned int len, i, thislen; |
9088 | + struct page *page; |
9089 | + |
9090 | + /* |
9091 | + * TODO verify that server properly follows FUSE protocol |
9092 | + * (oh.uniq, oh.len) |
9093 | + */ |
9094 | + args = req->args; |
9095 | + copy_args_from_argbuf(args, req); |
9096 | + |
9097 | + if (args->out_pages && args->page_zeroing) { |
9098 | + len = args->out_args[args->out_numargs - 1].size; |
9099 | + ap = container_of(args, typeof(*ap), args); |
9100 | + for (i = 0; i < ap->num_pages; i++) { |
9101 | + thislen = ap->descs[i].length; |
9102 | + if (len < thislen) { |
9103 | + WARN_ON(ap->descs[i].offset); |
9104 | + page = ap->pages[i]; |
9105 | + zero_user_segment(page, len, thislen); |
9106 | + len = 0; |
9107 | + } else { |
9108 | + len -= thislen; |
9109 | + } |
9110 | + } |
9111 | + } |
9112 | + |
9113 | + spin_lock(&fpq->lock); |
9114 | + clear_bit(FR_SENT, &req->flags); |
9115 | + spin_unlock(&fpq->lock); |
9116 | + |
9117 | + fuse_request_end(fc, req); |
9118 | + spin_lock(&fsvq->lock); |
9119 | + dec_in_flight_req(fsvq); |
9120 | + spin_unlock(&fsvq->lock); |
9121 | +} |
9122 | + |
9123 | +static void virtio_fs_complete_req_work(struct work_struct *work) |
9124 | +{ |
9125 | + struct virtio_fs_req_work *w = |
9126 | + container_of(work, typeof(*w), done_work); |
9127 | + |
9128 | + virtio_fs_request_complete(w->req, w->fsvq); |
9129 | + kfree(w); |
9130 | +} |
9131 | + |
9132 | static void virtio_fs_requests_done_work(struct work_struct *work) |
9133 | { |
9134 | struct virtio_fs_vq *fsvq = container_of(work, struct virtio_fs_vq, |
9135 | done_work); |
9136 | struct fuse_pqueue *fpq = &fsvq->fud->pq; |
9137 | - struct fuse_conn *fc = fsvq->fud->fc; |
9138 | struct virtqueue *vq = fsvq->vq; |
9139 | struct fuse_req *req; |
9140 | - struct fuse_args_pages *ap; |
9141 | struct fuse_req *next; |
9142 | - struct fuse_args *args; |
9143 | - unsigned int len, i, thislen; |
9144 | - struct page *page; |
9145 | + unsigned int len; |
9146 | LIST_HEAD(reqs); |
9147 | |
9148 | /* Collect completed requests off the virtqueue */ |
9149 | @@ -473,38 +527,20 @@ static void virtio_fs_requests_done_work(struct work_struct *work) |
9150 | |
9151 | /* End requests */ |
9152 | list_for_each_entry_safe(req, next, &reqs, list) { |
9153 | - /* |
9154 | - * TODO verify that server properly follows FUSE protocol |
9155 | - * (oh.uniq, oh.len) |
9156 | - */ |
9157 | - args = req->args; |
9158 | - copy_args_from_argbuf(args, req); |
9159 | - |
9160 | - if (args->out_pages && args->page_zeroing) { |
9161 | - len = args->out_args[args->out_numargs - 1].size; |
9162 | - ap = container_of(args, typeof(*ap), args); |
9163 | - for (i = 0; i < ap->num_pages; i++) { |
9164 | - thislen = ap->descs[i].length; |
9165 | - if (len < thislen) { |
9166 | - WARN_ON(ap->descs[i].offset); |
9167 | - page = ap->pages[i]; |
9168 | - zero_user_segment(page, len, thislen); |
9169 | - len = 0; |
9170 | - } else { |
9171 | - len -= thislen; |
9172 | - } |
9173 | - } |
9174 | - } |
9175 | - |
9176 | - spin_lock(&fpq->lock); |
9177 | - clear_bit(FR_SENT, &req->flags); |
9178 | list_del_init(&req->list); |
9179 | - spin_unlock(&fpq->lock); |
9180 | |
9181 | - fuse_request_end(fc, req); |
9182 | - spin_lock(&fsvq->lock); |
9183 | - dec_in_flight_req(fsvq); |
9184 | - spin_unlock(&fsvq->lock); |
9185 | + /* blocking async request completes in a worker context */ |
9186 | + if (req->args->may_block) { |
9187 | + struct virtio_fs_req_work *w; |
9188 | + |
9189 | + w = kzalloc(sizeof(*w), GFP_NOFS | __GFP_NOFAIL); |
9190 | + INIT_WORK(&w->done_work, virtio_fs_complete_req_work); |
9191 | + w->fsvq = fsvq; |
9192 | + w->req = req; |
9193 | + schedule_work(&w->done_work); |
9194 | + } else { |
9195 | + virtio_fs_request_complete(req, fsvq); |
9196 | + } |
9197 | } |
9198 | } |
9199 | |
9200 | diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
9201 | index 110e5c4db819..a4b6a49462a4 100644 |
9202 | --- a/fs/gfs2/log.c |
9203 | +++ b/fs/gfs2/log.c |
9204 | @@ -881,8 +881,10 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) |
9205 | * @new: New transaction to be merged |
9206 | */ |
9207 | |
9208 | -static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) |
9209 | +static void gfs2_merge_trans(struct gfs2_sbd *sdp, struct gfs2_trans *new) |
9210 | { |
9211 | + struct gfs2_trans *old = sdp->sd_log_tr; |
9212 | + |
9213 | WARN_ON_ONCE(!test_bit(TR_ATTACHED, &old->tr_flags)); |
9214 | |
9215 | old->tr_num_buf_new += new->tr_num_buf_new; |
9216 | @@ -893,6 +895,11 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) |
9217 | |
9218 | list_splice_tail_init(&new->tr_databuf, &old->tr_databuf); |
9219 | list_splice_tail_init(&new->tr_buf, &old->tr_buf); |
9220 | + |
9221 | + spin_lock(&sdp->sd_ail_lock); |
9222 | + list_splice_tail_init(&new->tr_ail1_list, &old->tr_ail1_list); |
9223 | + list_splice_tail_init(&new->tr_ail2_list, &old->tr_ail2_list); |
9224 | + spin_unlock(&sdp->sd_ail_lock); |
9225 | } |
9226 | |
9227 | static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
9228 | @@ -904,7 +911,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
9229 | gfs2_log_lock(sdp); |
9230 | |
9231 | if (sdp->sd_log_tr) { |
9232 | - gfs2_merge_trans(sdp->sd_log_tr, tr); |
9233 | + gfs2_merge_trans(sdp, tr); |
9234 | } else if (tr->tr_num_buf_new || tr->tr_num_databuf_new) { |
9235 | gfs2_assert_withdraw(sdp, test_bit(TR_ALLOCED, &tr->tr_flags)); |
9236 | sdp->sd_log_tr = tr; |
9237 | diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c |
9238 | index 18daf494abab..c26c864590cc 100644 |
9239 | --- a/fs/gfs2/ops_fstype.c |
9240 | +++ b/fs/gfs2/ops_fstype.c |
9241 | @@ -911,7 +911,7 @@ fail: |
9242 | } |
9243 | |
9244 | static const match_table_t nolock_tokens = { |
9245 | - { Opt_jid, "jid=%d\n", }, |
9246 | + { Opt_jid, "jid=%d", }, |
9247 | { Opt_err, NULL }, |
9248 | }; |
9249 | |
9250 | diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
9251 | index c1ce2805c563..fa58835668a6 100644 |
9252 | --- a/fs/jbd2/journal.c |
9253 | +++ b/fs/jbd2/journal.c |
9254 | @@ -96,7 +96,6 @@ EXPORT_SYMBOL(jbd2_journal_release_jbd_inode); |
9255 | EXPORT_SYMBOL(jbd2_journal_begin_ordered_truncate); |
9256 | EXPORT_SYMBOL(jbd2_inode_cache); |
9257 | |
9258 | -static void __journal_abort_soft (journal_t *journal, int errno); |
9259 | static int jbd2_journal_create_slab(size_t slab_size); |
9260 | |
9261 | #ifdef CONFIG_JBD2_DEBUG |
9262 | @@ -805,7 +804,7 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr, |
9263 | "at offset %lu on %s\n", |
9264 | __func__, blocknr, journal->j_devname); |
9265 | err = -EIO; |
9266 | - __journal_abort_soft(journal, err); |
9267 | + jbd2_journal_abort(journal, err); |
9268 | } |
9269 | } else { |
9270 | *retp = blocknr; /* +journal->j_blk_offset */ |
9271 | @@ -2070,64 +2069,6 @@ int jbd2_journal_wipe(journal_t *journal, int write) |
9272 | return err; |
9273 | } |
9274 | |
9275 | -/* |
9276 | - * Journal abort has very specific semantics, which we describe |
9277 | - * for journal abort. |
9278 | - * |
9279 | - * Two internal functions, which provide abort to the jbd layer |
9280 | - * itself are here. |
9281 | - */ |
9282 | - |
9283 | -/* |
9284 | - * Quick version for internal journal use (doesn't lock the journal). |
9285 | - * Aborts hard --- we mark the abort as occurred, but do _nothing_ else, |
9286 | - * and don't attempt to make any other journal updates. |
9287 | - */ |
9288 | -void __jbd2_journal_abort_hard(journal_t *journal) |
9289 | -{ |
9290 | - transaction_t *transaction; |
9291 | - |
9292 | - if (journal->j_flags & JBD2_ABORT) |
9293 | - return; |
9294 | - |
9295 | - printk(KERN_ERR "Aborting journal on device %s.\n", |
9296 | - journal->j_devname); |
9297 | - |
9298 | - write_lock(&journal->j_state_lock); |
9299 | - journal->j_flags |= JBD2_ABORT; |
9300 | - transaction = journal->j_running_transaction; |
9301 | - if (transaction) |
9302 | - __jbd2_log_start_commit(journal, transaction->t_tid); |
9303 | - write_unlock(&journal->j_state_lock); |
9304 | -} |
9305 | - |
9306 | -/* Soft abort: record the abort error status in the journal superblock, |
9307 | - * but don't do any other IO. */ |
9308 | -static void __journal_abort_soft (journal_t *journal, int errno) |
9309 | -{ |
9310 | - int old_errno; |
9311 | - |
9312 | - write_lock(&journal->j_state_lock); |
9313 | - old_errno = journal->j_errno; |
9314 | - if (!journal->j_errno || errno == -ESHUTDOWN) |
9315 | - journal->j_errno = errno; |
9316 | - |
9317 | - if (journal->j_flags & JBD2_ABORT) { |
9318 | - write_unlock(&journal->j_state_lock); |
9319 | - if (old_errno != -ESHUTDOWN && errno == -ESHUTDOWN) |
9320 | - jbd2_journal_update_sb_errno(journal); |
9321 | - return; |
9322 | - } |
9323 | - write_unlock(&journal->j_state_lock); |
9324 | - |
9325 | - __jbd2_journal_abort_hard(journal); |
9326 | - |
9327 | - jbd2_journal_update_sb_errno(journal); |
9328 | - write_lock(&journal->j_state_lock); |
9329 | - journal->j_flags |= JBD2_REC_ERR; |
9330 | - write_unlock(&journal->j_state_lock); |
9331 | -} |
9332 | - |
9333 | /** |
9334 | * void jbd2_journal_abort () - Shutdown the journal immediately. |
9335 | * @journal: the journal to shutdown. |
9336 | @@ -2171,7 +2112,47 @@ static void __journal_abort_soft (journal_t *journal, int errno) |
9337 | |
9338 | void jbd2_journal_abort(journal_t *journal, int errno) |
9339 | { |
9340 | - __journal_abort_soft(journal, errno); |
9341 | + transaction_t *transaction; |
9342 | + |
9343 | + /* |
9344 | + * ESHUTDOWN always takes precedence because a file system check |
9345 | + * caused by any other journal abort error is not required after |
9346 | + * a shutdown triggered. |
9347 | + */ |
9348 | + write_lock(&journal->j_state_lock); |
9349 | + if (journal->j_flags & JBD2_ABORT) { |
9350 | + int old_errno = journal->j_errno; |
9351 | + |
9352 | + write_unlock(&journal->j_state_lock); |
9353 | + if (old_errno != -ESHUTDOWN && errno == -ESHUTDOWN) { |
9354 | + journal->j_errno = errno; |
9355 | + jbd2_journal_update_sb_errno(journal); |
9356 | + } |
9357 | + return; |
9358 | + } |
9359 | + |
9360 | + /* |
9361 | + * Mark the abort as occurred and start current running transaction |
9362 | + * to release all journaled buffer. |
9363 | + */ |
9364 | + pr_err("Aborting journal on device %s.\n", journal->j_devname); |
9365 | + |
9366 | + journal->j_flags |= JBD2_ABORT; |
9367 | + journal->j_errno = errno; |
9368 | + transaction = journal->j_running_transaction; |
9369 | + if (transaction) |
9370 | + __jbd2_log_start_commit(journal, transaction->t_tid); |
9371 | + write_unlock(&journal->j_state_lock); |
9372 | + |
9373 | + /* |
9374 | + * Record errno to the journal super block, so that fsck and jbd2 |
9375 | + * layer could realise that a filesystem check is needed. |
9376 | + */ |
9377 | + jbd2_journal_update_sb_errno(journal); |
9378 | + |
9379 | + write_lock(&journal->j_state_lock); |
9380 | + journal->j_flags |= JBD2_REC_ERR; |
9381 | + write_unlock(&journal->j_state_lock); |
9382 | } |
9383 | |
9384 | /** |
9385 | diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
9386 | index 3802c88e8372..6de41f741280 100644 |
9387 | --- a/fs/nfs/inode.c |
9388 | +++ b/fs/nfs/inode.c |
9389 | @@ -826,6 +826,8 @@ int nfs_getattr(const struct path *path, struct kstat *stat, |
9390 | do_update |= cache_validity & NFS_INO_INVALID_ATIME; |
9391 | if (request_mask & (STATX_CTIME|STATX_MTIME)) |
9392 | do_update |= cache_validity & NFS_INO_REVAL_PAGECACHE; |
9393 | + if (request_mask & STATX_BLOCKS) |
9394 | + do_update |= cache_validity & NFS_INO_INVALID_BLOCKS; |
9395 | if (do_update) { |
9396 | /* Update the attribute cache */ |
9397 | if (!(server->flags & NFS_MOUNT_NOAC)) |
9398 | @@ -1750,7 +1752,8 @@ out_noforce: |
9399 | status = nfs_post_op_update_inode_locked(inode, fattr, |
9400 | NFS_INO_INVALID_CHANGE |
9401 | | NFS_INO_INVALID_CTIME |
9402 | - | NFS_INO_INVALID_MTIME); |
9403 | + | NFS_INO_INVALID_MTIME |
9404 | + | NFS_INO_INVALID_BLOCKS); |
9405 | return status; |
9406 | } |
9407 | |
9408 | @@ -1857,7 +1860,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
9409 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR |
9410 | | NFS_INO_INVALID_ATIME |
9411 | | NFS_INO_REVAL_FORCED |
9412 | - | NFS_INO_REVAL_PAGECACHE); |
9413 | + | NFS_INO_REVAL_PAGECACHE |
9414 | + | NFS_INO_INVALID_BLOCKS); |
9415 | |
9416 | /* Do atomic weak cache consistency updates */ |
9417 | nfs_wcc_update_inode(inode, fattr); |
9418 | @@ -2019,8 +2023,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
9419 | inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used); |
9420 | } else if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) |
9421 | inode->i_blocks = fattr->du.nfs2.blocks; |
9422 | - else |
9423 | + else { |
9424 | + nfsi->cache_validity |= save_cache_validity & |
9425 | + (NFS_INO_INVALID_BLOCKS |
9426 | + | NFS_INO_REVAL_FORCED); |
9427 | cache_revalidated = false; |
9428 | + } |
9429 | |
9430 | /* Update attrtimeo value if we're out of the unstable period */ |
9431 | if (attr_changed) { |
9432 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
9433 | index e257653f25ab..33c17c69aeaa 100644 |
9434 | --- a/fs/nfs/nfs4proc.c |
9435 | +++ b/fs/nfs/nfs4proc.c |
9436 | @@ -7870,7 +7870,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) |
9437 | } |
9438 | |
9439 | static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { |
9440 | - .rpc_call_done = &nfs4_bind_one_conn_to_session_done, |
9441 | + .rpc_call_done = nfs4_bind_one_conn_to_session_done, |
9442 | }; |
9443 | |
9444 | /* |
9445 | diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h |
9446 | index 10ec5ecdf117..65c331f75e9c 100644 |
9447 | --- a/fs/nfsd/cache.h |
9448 | +++ b/fs/nfsd/cache.h |
9449 | @@ -78,6 +78,8 @@ enum { |
9450 | /* Checksum this amount of the request */ |
9451 | #define RC_CSUMLEN (256U) |
9452 | |
9453 | +int nfsd_drc_slab_create(void); |
9454 | +void nfsd_drc_slab_free(void); |
9455 | int nfsd_reply_cache_init(struct nfsd_net *); |
9456 | void nfsd_reply_cache_shutdown(struct nfsd_net *); |
9457 | int nfsd_cache_lookup(struct svc_rqst *); |
9458 | diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h |
9459 | index 9a4ef815fb8c..ed53e206a299 100644 |
9460 | --- a/fs/nfsd/netns.h |
9461 | +++ b/fs/nfsd/netns.h |
9462 | @@ -139,7 +139,6 @@ struct nfsd_net { |
9463 | * Duplicate reply cache |
9464 | */ |
9465 | struct nfsd_drc_bucket *drc_hashtbl; |
9466 | - struct kmem_cache *drc_slab; |
9467 | |
9468 | /* max number of entries allowed in the cache */ |
9469 | unsigned int max_drc_entries; |
9470 | diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c |
9471 | index afca3287184b..efe55d101b0e 100644 |
9472 | --- a/fs/nfsd/nfs4callback.c |
9473 | +++ b/fs/nfsd/nfs4callback.c |
9474 | @@ -1230,6 +1230,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) |
9475 | err = setup_callback_client(clp, &conn, ses); |
9476 | if (err) { |
9477 | nfsd4_mark_cb_down(clp, err); |
9478 | + if (c) |
9479 | + svc_xprt_put(c->cn_xprt); |
9480 | return; |
9481 | } |
9482 | } |
9483 | diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c |
9484 | index 96352ab7bd81..4a258065188e 100644 |
9485 | --- a/fs/nfsd/nfscache.c |
9486 | +++ b/fs/nfsd/nfscache.c |
9487 | @@ -36,6 +36,8 @@ struct nfsd_drc_bucket { |
9488 | spinlock_t cache_lock; |
9489 | }; |
9490 | |
9491 | +static struct kmem_cache *drc_slab; |
9492 | + |
9493 | static int nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec); |
9494 | static unsigned long nfsd_reply_cache_count(struct shrinker *shrink, |
9495 | struct shrink_control *sc); |
9496 | @@ -95,7 +97,7 @@ nfsd_reply_cache_alloc(struct svc_rqst *rqstp, __wsum csum, |
9497 | { |
9498 | struct svc_cacherep *rp; |
9499 | |
9500 | - rp = kmem_cache_alloc(nn->drc_slab, GFP_KERNEL); |
9501 | + rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); |
9502 | if (rp) { |
9503 | rp->c_state = RC_UNUSED; |
9504 | rp->c_type = RC_NOCACHE; |
9505 | @@ -129,7 +131,7 @@ nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, |
9506 | atomic_dec(&nn->num_drc_entries); |
9507 | nn->drc_mem_usage -= sizeof(*rp); |
9508 | } |
9509 | - kmem_cache_free(nn->drc_slab, rp); |
9510 | + kmem_cache_free(drc_slab, rp); |
9511 | } |
9512 | |
9513 | static void |
9514 | @@ -141,6 +143,18 @@ nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, |
9515 | spin_unlock(&b->cache_lock); |
9516 | } |
9517 | |
9518 | +int nfsd_drc_slab_create(void) |
9519 | +{ |
9520 | + drc_slab = kmem_cache_create("nfsd_drc", |
9521 | + sizeof(struct svc_cacherep), 0, 0, NULL); |
9522 | + return drc_slab ? 0: -ENOMEM; |
9523 | +} |
9524 | + |
9525 | +void nfsd_drc_slab_free(void) |
9526 | +{ |
9527 | + kmem_cache_destroy(drc_slab); |
9528 | +} |
9529 | + |
9530 | int nfsd_reply_cache_init(struct nfsd_net *nn) |
9531 | { |
9532 | unsigned int hashsize; |
9533 | @@ -159,18 +173,13 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) |
9534 | if (status) |
9535 | goto out_nomem; |
9536 | |
9537 | - nn->drc_slab = kmem_cache_create("nfsd_drc", |
9538 | - sizeof(struct svc_cacherep), 0, 0, NULL); |
9539 | - if (!nn->drc_slab) |
9540 | - goto out_shrinker; |
9541 | - |
9542 | nn->drc_hashtbl = kcalloc(hashsize, |
9543 | sizeof(*nn->drc_hashtbl), GFP_KERNEL); |
9544 | if (!nn->drc_hashtbl) { |
9545 | nn->drc_hashtbl = vzalloc(array_size(hashsize, |
9546 | sizeof(*nn->drc_hashtbl))); |
9547 | if (!nn->drc_hashtbl) |
9548 | - goto out_slab; |
9549 | + goto out_shrinker; |
9550 | } |
9551 | |
9552 | for (i = 0; i < hashsize; i++) { |
9553 | @@ -180,8 +189,6 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) |
9554 | nn->drc_hashsize = hashsize; |
9555 | |
9556 | return 0; |
9557 | -out_slab: |
9558 | - kmem_cache_destroy(nn->drc_slab); |
9559 | out_shrinker: |
9560 | unregister_shrinker(&nn->nfsd_reply_cache_shrinker); |
9561 | out_nomem: |
9562 | @@ -209,8 +216,6 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn) |
9563 | nn->drc_hashtbl = NULL; |
9564 | nn->drc_hashsize = 0; |
9565 | |
9566 | - kmem_cache_destroy(nn->drc_slab); |
9567 | - nn->drc_slab = NULL; |
9568 | } |
9569 | |
9570 | /* |
9571 | @@ -464,8 +469,7 @@ found_entry: |
9572 | rtn = RC_REPLY; |
9573 | break; |
9574 | default: |
9575 | - printk(KERN_WARNING "nfsd: bad repcache type %d\n", rp->c_type); |
9576 | - nfsd_reply_cache_free_locked(b, rp, nn); |
9577 | + WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type); |
9578 | } |
9579 | |
9580 | goto out; |
9581 | diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c |
9582 | index d77c5261c03c..159feae6af8b 100644 |
9583 | --- a/fs/nfsd/nfsctl.c |
9584 | +++ b/fs/nfsd/nfsctl.c |
9585 | @@ -1534,6 +1534,9 @@ static int __init init_nfsd(void) |
9586 | goto out_free_slabs; |
9587 | nfsd_fault_inject_init(); /* nfsd fault injection controls */ |
9588 | nfsd_stat_init(); /* Statistics */ |
9589 | + retval = nfsd_drc_slab_create(); |
9590 | + if (retval) |
9591 | + goto out_free_stat; |
9592 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
9593 | retval = create_proc_exports_entry(); |
9594 | if (retval) |
9595 | @@ -1547,6 +1550,8 @@ out_free_all: |
9596 | remove_proc_entry("fs/nfs", NULL); |
9597 | out_free_lockd: |
9598 | nfsd_lockd_shutdown(); |
9599 | + nfsd_drc_slab_free(); |
9600 | +out_free_stat: |
9601 | nfsd_stat_shutdown(); |
9602 | nfsd_fault_inject_cleanup(); |
9603 | nfsd4_exit_pnfs(); |
9604 | @@ -1561,6 +1566,7 @@ out_unregister_pernet: |
9605 | |
9606 | static void __exit exit_nfsd(void) |
9607 | { |
9608 | + nfsd_drc_slab_free(); |
9609 | remove_proc_entry("fs/nfs/exports", NULL); |
9610 | remove_proc_entry("fs/nfs", NULL); |
9611 | nfsd_stat_shutdown(); |
9612 | diff --git a/include/linux/bitops.h b/include/linux/bitops.h |
9613 | index c94a9ff9f082..4f0e62cbf2ff 100644 |
9614 | --- a/include/linux/bitops.h |
9615 | +++ b/include/linux/bitops.h |
9616 | @@ -57,7 +57,7 @@ static inline int get_bitmask_order(unsigned int count) |
9617 | |
9618 | static __always_inline unsigned long hweight_long(unsigned long w) |
9619 | { |
9620 | - return sizeof(w) == 4 ? hweight32(w) : hweight64(w); |
9621 | + return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w); |
9622 | } |
9623 | |
9624 | /** |
9625 | diff --git a/include/linux/genhd.h b/include/linux/genhd.h |
9626 | index 8b5330dd5ac0..62a2ec9f17df 100644 |
9627 | --- a/include/linux/genhd.h |
9628 | +++ b/include/linux/genhd.h |
9629 | @@ -750,9 +750,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part) |
9630 | static inline void part_nr_sects_write(struct hd_struct *part, sector_t size) |
9631 | { |
9632 | #if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
9633 | + preempt_disable(); |
9634 | write_seqcount_begin(&part->nr_sects_seq); |
9635 | part->nr_sects = size; |
9636 | write_seqcount_end(&part->nr_sects_seq); |
9637 | + preempt_enable(); |
9638 | #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) |
9639 | preempt_disable(); |
9640 | part->nr_sects = size; |
9641 | diff --git a/include/linux/ioport.h b/include/linux/ioport.h |
9642 | index 7bddddfc76d6..fdc201d61460 100644 |
9643 | --- a/include/linux/ioport.h |
9644 | +++ b/include/linux/ioport.h |
9645 | @@ -300,5 +300,11 @@ struct resource *devm_request_free_mem_region(struct device *dev, |
9646 | struct resource *request_free_mem_region(struct resource *base, |
9647 | unsigned long size, const char *name); |
9648 | |
9649 | +#ifdef CONFIG_IO_STRICT_DEVMEM |
9650 | +void revoke_devmem(struct resource *res); |
9651 | +#else |
9652 | +static inline void revoke_devmem(struct resource *res) { }; |
9653 | +#endif |
9654 | + |
9655 | #endif /* __ASSEMBLY__ */ |
9656 | #endif /* _LINUX_IOPORT_H */ |
9657 | diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h |
9658 | index 10e6049c0ba9..b0e97e5de8ca 100644 |
9659 | --- a/include/linux/jbd2.h |
9660 | +++ b/include/linux/jbd2.h |
9661 | @@ -1402,7 +1402,6 @@ extern int jbd2_journal_skip_recovery (journal_t *); |
9662 | extern void jbd2_journal_update_sb_errno(journal_t *); |
9663 | extern int jbd2_journal_update_sb_log_tail (journal_t *, tid_t, |
9664 | unsigned long, int); |
9665 | -extern void __jbd2_journal_abort_hard (journal_t *); |
9666 | extern void jbd2_journal_abort (journal_t *, int); |
9667 | extern int jbd2_journal_errno (journal_t *); |
9668 | extern void jbd2_journal_ack_err (journal_t *); |
9669 | diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h |
9670 | index 04bdaf01112c..645fd401c856 100644 |
9671 | --- a/include/linux/kprobes.h |
9672 | +++ b/include/linux/kprobes.h |
9673 | @@ -350,6 +350,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) |
9674 | return this_cpu_ptr(&kprobe_ctlblk); |
9675 | } |
9676 | |
9677 | +extern struct kprobe kprobe_busy; |
9678 | +void kprobe_busy_begin(void); |
9679 | +void kprobe_busy_end(void); |
9680 | + |
9681 | kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset); |
9682 | int register_kprobe(struct kprobe *p); |
9683 | void unregister_kprobe(struct kprobe *p); |
9684 | diff --git a/include/linux/libata.h b/include/linux/libata.h |
9685 | index c44e4cfbcb16..b9970f5bab67 100644 |
9686 | --- a/include/linux/libata.h |
9687 | +++ b/include/linux/libata.h |
9688 | @@ -22,6 +22,7 @@ |
9689 | #include <linux/acpi.h> |
9690 | #include <linux/cdrom.h> |
9691 | #include <linux/sched.h> |
9692 | +#include <linux/async.h> |
9693 | |
9694 | /* |
9695 | * Define if arch has non-standard setup. This is a _PCI_ standard |
9696 | @@ -870,6 +871,8 @@ struct ata_port { |
9697 | struct timer_list fastdrain_timer; |
9698 | unsigned long fastdrain_cnt; |
9699 | |
9700 | + async_cookie_t cookie; |
9701 | + |
9702 | int em_message_type; |
9703 | void *private_data; |
9704 | |
9705 | diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h |
9706 | index 3c67983678ec..744dce63946e 100644 |
9707 | --- a/include/linux/mfd/stmfx.h |
9708 | +++ b/include/linux/mfd/stmfx.h |
9709 | @@ -109,6 +109,7 @@ struct stmfx { |
9710 | struct device *dev; |
9711 | struct regmap *map; |
9712 | struct regulator *vdd; |
9713 | + int irq; |
9714 | struct irq_domain *irq_domain; |
9715 | struct mutex lock; /* IRQ bus lock */ |
9716 | u8 irq_src; |
9717 | diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h |
9718 | index 570a60c2f4f4..ad09c0cc5464 100644 |
9719 | --- a/include/linux/nfs_fs.h |
9720 | +++ b/include/linux/nfs_fs.h |
9721 | @@ -225,6 +225,7 @@ struct nfs4_copy_state { |
9722 | #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */ |
9723 | #define NFS_INO_DATA_INVAL_DEFER \ |
9724 | BIT(13) /* Deferred cache invalidation */ |
9725 | +#define NFS_INO_INVALID_BLOCKS BIT(14) /* cached blocks are invalid */ |
9726 | |
9727 | #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ |
9728 | | NFS_INO_INVALID_CTIME \ |
9729 | diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h |
9730 | index 8675e145ea8b..2040696d75b6 100644 |
9731 | --- a/include/linux/usb/composite.h |
9732 | +++ b/include/linux/usb/composite.h |
9733 | @@ -249,6 +249,9 @@ int usb_function_activate(struct usb_function *); |
9734 | |
9735 | int usb_interface_id(struct usb_configuration *, struct usb_function *); |
9736 | |
9737 | +int config_ep_by_speed_and_alt(struct usb_gadget *g, struct usb_function *f, |
9738 | + struct usb_ep *_ep, u8 alt); |
9739 | + |
9740 | int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, |
9741 | struct usb_ep *_ep); |
9742 | |
9743 | diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h |
9744 | index a15ce99dfc2d..78e006355557 100644 |
9745 | --- a/include/linux/usb/ehci_def.h |
9746 | +++ b/include/linux/usb/ehci_def.h |
9747 | @@ -151,7 +151,7 @@ struct ehci_regs { |
9748 | #define PORT_OWNER (1<<13) /* true: companion hc owns this port */ |
9749 | #define PORT_POWER (1<<12) /* true: has power (see PPC) */ |
9750 | #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ |
9751 | -/* 11:10 for detecting lowspeed devices (reset vs release ownership) */ |
9752 | +#define PORT_LS_MASK (3<<10) /* Link status (SE0, K or J */ |
9753 | /* 9 reserved */ |
9754 | #define PORT_LPM (1<<9) /* LPM transaction */ |
9755 | #define PORT_RESET (1<<8) /* reset port */ |
9756 | diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h |
9757 | index 124462d65eac..67f5adc9b875 100644 |
9758 | --- a/include/linux/usb/gadget.h |
9759 | +++ b/include/linux/usb/gadget.h |
9760 | @@ -373,6 +373,7 @@ struct usb_gadget_ops { |
9761 | * @connected: True if gadget is connected. |
9762 | * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag |
9763 | * indicates that it supports LPM as per the LPM ECN & errata. |
9764 | + * @irq: the interrupt number for device controller. |
9765 | * |
9766 | * Gadgets have a mostly-portable "gadget driver" implementing device |
9767 | * functions, handling all usb configurations and interfaces. Gadget |
9768 | @@ -427,6 +428,7 @@ struct usb_gadget { |
9769 | unsigned deactivated:1; |
9770 | unsigned connected:1; |
9771 | unsigned lpm_capable:1; |
9772 | + int irq; |
9773 | }; |
9774 | #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) |
9775 | |
9776 | diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h |
9777 | index 903cc2d2750b..84ae605c0643 100644 |
9778 | --- a/include/uapi/linux/magic.h |
9779 | +++ b/include/uapi/linux/magic.h |
9780 | @@ -93,6 +93,7 @@ |
9781 | #define BALLOON_KVM_MAGIC 0x13661366 |
9782 | #define ZSMALLOC_MAGIC 0x58295829 |
9783 | #define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ |
9784 | +#define DEVMEM_MAGIC 0x454d444d /* "DMEM" */ |
9785 | #define Z3FOLD_MAGIC 0x33 |
9786 | |
9787 | #endif /* __LINUX_MAGIC_H__ */ |
9788 | diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
9789 | index 2625c241ac00..195ecb955fcc 100644 |
9790 | --- a/kernel/kprobes.c |
9791 | +++ b/kernel/kprobes.c |
9792 | @@ -586,11 +586,12 @@ static void kprobe_optimizer(struct work_struct *work) |
9793 | mutex_unlock(&module_mutex); |
9794 | mutex_unlock(&text_mutex); |
9795 | cpus_read_unlock(); |
9796 | - mutex_unlock(&kprobe_mutex); |
9797 | |
9798 | /* Step 5: Kick optimizer again if needed */ |
9799 | if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) |
9800 | kick_kprobe_optimizer(); |
9801 | + |
9802 | + mutex_unlock(&kprobe_mutex); |
9803 | } |
9804 | |
9805 | /* Wait for completing optimization and unoptimization */ |
9806 | @@ -1236,6 +1237,26 @@ __releases(hlist_lock) |
9807 | } |
9808 | NOKPROBE_SYMBOL(kretprobe_table_unlock); |
9809 | |
9810 | +struct kprobe kprobe_busy = { |
9811 | + .addr = (void *) get_kprobe, |
9812 | +}; |
9813 | + |
9814 | +void kprobe_busy_begin(void) |
9815 | +{ |
9816 | + struct kprobe_ctlblk *kcb; |
9817 | + |
9818 | + preempt_disable(); |
9819 | + __this_cpu_write(current_kprobe, &kprobe_busy); |
9820 | + kcb = get_kprobe_ctlblk(); |
9821 | + kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
9822 | +} |
9823 | + |
9824 | +void kprobe_busy_end(void) |
9825 | +{ |
9826 | + __this_cpu_write(current_kprobe, NULL); |
9827 | + preempt_enable(); |
9828 | +} |
9829 | + |
9830 | /* |
9831 | * This function is called from finish_task_switch when task tk becomes dead, |
9832 | * so that we can recycle any function-return probe instances associated |
9833 | @@ -1253,6 +1274,8 @@ void kprobe_flush_task(struct task_struct *tk) |
9834 | /* Early boot. kretprobe_table_locks not yet initialized. */ |
9835 | return; |
9836 | |
9837 | + kprobe_busy_begin(); |
9838 | + |
9839 | INIT_HLIST_HEAD(&empty_rp); |
9840 | hash = hash_ptr(tk, KPROBE_HASH_BITS); |
9841 | head = &kretprobe_inst_table[hash]; |
9842 | @@ -1266,6 +1289,8 @@ void kprobe_flush_task(struct task_struct *tk) |
9843 | hlist_del(&ri->hlist); |
9844 | kfree(ri); |
9845 | } |
9846 | + |
9847 | + kprobe_busy_end(); |
9848 | } |
9849 | NOKPROBE_SYMBOL(kprobe_flush_task); |
9850 | |
9851 | diff --git a/kernel/resource.c b/kernel/resource.c |
9852 | index 76036a41143b..841737bbda9e 100644 |
9853 | --- a/kernel/resource.c |
9854 | +++ b/kernel/resource.c |
9855 | @@ -1126,6 +1126,7 @@ struct resource * __request_region(struct resource *parent, |
9856 | { |
9857 | DECLARE_WAITQUEUE(wait, current); |
9858 | struct resource *res = alloc_resource(GFP_KERNEL); |
9859 | + struct resource *orig_parent = parent; |
9860 | |
9861 | if (!res) |
9862 | return NULL; |
9863 | @@ -1176,6 +1177,10 @@ struct resource * __request_region(struct resource *parent, |
9864 | break; |
9865 | } |
9866 | write_unlock(&resource_lock); |
9867 | + |
9868 | + if (res && orig_parent == &iomem_resource) |
9869 | + revoke_devmem(res); |
9870 | + |
9871 | return res; |
9872 | } |
9873 | EXPORT_SYMBOL(__request_region); |
9874 | diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
9875 | index e7e483cdbea6..a677aa84ccb6 100644 |
9876 | --- a/kernel/trace/blktrace.c |
9877 | +++ b/kernel/trace/blktrace.c |
9878 | @@ -999,8 +999,10 @@ static void blk_add_trace_split(void *ignore, |
9879 | |
9880 | __blk_add_trace(bt, bio->bi_iter.bi_sector, |
9881 | bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, |
9882 | - BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu), |
9883 | - &rpdu, blk_trace_bio_get_cgid(q, bio)); |
9884 | + BLK_TA_SPLIT, |
9885 | + blk_status_to_errno(bio->bi_status), |
9886 | + sizeof(rpdu), &rpdu, |
9887 | + blk_trace_bio_get_cgid(q, bio)); |
9888 | } |
9889 | rcu_read_unlock(); |
9890 | } |
9891 | @@ -1037,7 +1039,8 @@ static void blk_add_trace_bio_remap(void *ignore, |
9892 | r.sector_from = cpu_to_be64(from); |
9893 | |
9894 | __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, |
9895 | - bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status, |
9896 | + bio_op(bio), bio->bi_opf, BLK_TA_REMAP, |
9897 | + blk_status_to_errno(bio->bi_status), |
9898 | sizeof(r), &r, blk_trace_bio_get_cgid(q, bio)); |
9899 | rcu_read_unlock(); |
9900 | } |
9901 | @@ -1259,21 +1262,10 @@ static inline __u16 t_error(const struct trace_entry *ent) |
9902 | |
9903 | static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) |
9904 | { |
9905 | - const __u64 *val = pdu_start(ent, has_cg); |
9906 | + const __be64 *val = pdu_start(ent, has_cg); |
9907 | return be64_to_cpu(*val); |
9908 | } |
9909 | |
9910 | -static void get_pdu_remap(const struct trace_entry *ent, |
9911 | - struct blk_io_trace_remap *r, bool has_cg) |
9912 | -{ |
9913 | - const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
9914 | - __u64 sector_from = __r->sector_from; |
9915 | - |
9916 | - r->device_from = be32_to_cpu(__r->device_from); |
9917 | - r->device_to = be32_to_cpu(__r->device_to); |
9918 | - r->sector_from = be64_to_cpu(sector_from); |
9919 | -} |
9920 | - |
9921 | typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act, |
9922 | bool has_cg); |
9923 | |
9924 | @@ -1399,13 +1391,13 @@ static void blk_log_with_error(struct trace_seq *s, |
9925 | |
9926 | static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
9927 | { |
9928 | - struct blk_io_trace_remap r = { .device_from = 0, }; |
9929 | + const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
9930 | |
9931 | - get_pdu_remap(ent, &r, has_cg); |
9932 | trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n", |
9933 | t_sector(ent), t_sec(ent), |
9934 | - MAJOR(r.device_from), MINOR(r.device_from), |
9935 | - (unsigned long long)r.sector_from); |
9936 | + MAJOR(be32_to_cpu(__r->device_from)), |
9937 | + MINOR(be32_to_cpu(__r->device_from)), |
9938 | + be64_to_cpu(__r->sector_from)); |
9939 | } |
9940 | |
9941 | static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
9942 | diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
9943 | index fba4b48451f6..26de9c654956 100644 |
9944 | --- a/kernel/trace/trace_kprobe.c |
9945 | +++ b/kernel/trace/trace_kprobe.c |
9946 | @@ -1464,7 +1464,7 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type, |
9947 | if (perf_type_tracepoint) |
9948 | tk = find_trace_kprobe(pevent, group); |
9949 | else |
9950 | - tk = event->tp_event->data; |
9951 | + tk = trace_kprobe_primary_from_call(event->tp_event); |
9952 | if (!tk) |
9953 | return -EINVAL; |
9954 | |
9955 | diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c |
9956 | index ab8b6436d53f..f98d6d94cbbf 100644 |
9957 | --- a/kernel/trace/trace_probe.c |
9958 | +++ b/kernel/trace/trace_probe.c |
9959 | @@ -639,8 +639,8 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size, |
9960 | ret = -EINVAL; |
9961 | goto fail; |
9962 | } |
9963 | - if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM) || |
9964 | - parg->count) { |
9965 | + if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM || |
9966 | + code->op == FETCH_OP_DATA) || parg->count) { |
9967 | /* |
9968 | * IMM, DATA and COMM is pointing actual address, those |
9969 | * must be kept, and if parg->count != 0, this is an |
9970 | diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c |
9971 | index 2619bc5ed520..5294843de6ef 100644 |
9972 | --- a/kernel/trace/trace_uprobe.c |
9973 | +++ b/kernel/trace/trace_uprobe.c |
9974 | @@ -1405,7 +1405,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, |
9975 | if (perf_type_tracepoint) |
9976 | tu = find_probe_event(pevent, group); |
9977 | else |
9978 | - tu = event->tp_event->data; |
9979 | + tu = trace_uprobe_primary_from_call(event->tp_event); |
9980 | if (!tu) |
9981 | return -EINVAL; |
9982 | |
9983 | diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c |
9984 | index 2c13ecc5bb2c..ed1f3df27260 100644 |
9985 | --- a/lib/zlib_inflate/inffast.c |
9986 | +++ b/lib/zlib_inflate/inffast.c |
9987 | @@ -10,17 +10,6 @@ |
9988 | |
9989 | #ifndef ASMINF |
9990 | |
9991 | -/* Allow machine dependent optimization for post-increment or pre-increment. |
9992 | - Based on testing to date, |
9993 | - Pre-increment preferred for: |
9994 | - - PowerPC G3 (Adler) |
9995 | - - MIPS R5000 (Randers-Pehrson) |
9996 | - Post-increment preferred for: |
9997 | - - none |
9998 | - No measurable difference: |
9999 | - - Pentium III (Anderson) |
10000 | - - M68060 (Nikl) |
10001 | - */ |
10002 | union uu { |
10003 | unsigned short us; |
10004 | unsigned char b[2]; |
10005 | @@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p) |
10006 | return mm.us; |
10007 | } |
10008 | |
10009 | -#ifdef POSTINC |
10010 | -# define OFF 0 |
10011 | -# define PUP(a) *(a)++ |
10012 | -# define UP_UNALIGNED(a) get_unaligned16((a)++) |
10013 | -#else |
10014 | -# define OFF 1 |
10015 | -# define PUP(a) *++(a) |
10016 | -# define UP_UNALIGNED(a) get_unaligned16(++(a)) |
10017 | -#endif |
10018 | - |
10019 | /* |
10020 | Decode literal, length, and distance codes and write out the resulting |
10021 | literal and match bytes until either not enough input or output is |
10022 | @@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
10023 | |
10024 | /* copy state to local variables */ |
10025 | state = (struct inflate_state *)strm->state; |
10026 | - in = strm->next_in - OFF; |
10027 | + in = strm->next_in; |
10028 | last = in + (strm->avail_in - 5); |
10029 | - out = strm->next_out - OFF; |
10030 | + out = strm->next_out; |
10031 | beg = out - (start - strm->avail_out); |
10032 | end = out + (strm->avail_out - 257); |
10033 | #ifdef INFLATE_STRICT |
10034 | @@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
10035 | input data or output space */ |
10036 | do { |
10037 | if (bits < 15) { |
10038 | - hold += (unsigned long)(PUP(in)) << bits; |
10039 | + hold += (unsigned long)(*in++) << bits; |
10040 | bits += 8; |
10041 | - hold += (unsigned long)(PUP(in)) << bits; |
10042 | + hold += (unsigned long)(*in++) << bits; |
10043 | bits += 8; |
10044 | } |
10045 | this = lcode[hold & lmask]; |
10046 | @@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start) |
10047 | bits -= op; |
10048 | op = (unsigned)(this.op); |
10049 | if (op == 0) { /* literal */ |
10050 | - PUP(out) = (unsigned char)(this.val); |
10051 | + *out++ = (unsigned char)(this.val); |
10052 | } |
10053 | else if (op & 16) { /* length base */ |
10054 | len = (unsigned)(this.val); |
10055 | op &= 15; /* number of extra bits */ |
10056 | if (op) { |
10057 | if (bits < op) { |
10058 | - hold += (unsigned long)(PUP(in)) << bits; |
10059 | + hold += (unsigned long)(*in++) << bits; |
10060 | bits += 8; |
10061 | } |
10062 | len += (unsigned)hold & ((1U << op) - 1); |
10063 | @@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
10064 | bits -= op; |
10065 | } |
10066 | if (bits < 15) { |
10067 | - hold += (unsigned long)(PUP(in)) << bits; |
10068 | + hold += (unsigned long)(*in++) << bits; |
10069 | bits += 8; |
10070 | - hold += (unsigned long)(PUP(in)) << bits; |
10071 | + hold += (unsigned long)(*in++) << bits; |
10072 | bits += 8; |
10073 | } |
10074 | this = dcode[hold & dmask]; |
10075 | @@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start) |
10076 | dist = (unsigned)(this.val); |
10077 | op &= 15; /* number of extra bits */ |
10078 | if (bits < op) { |
10079 | - hold += (unsigned long)(PUP(in)) << bits; |
10080 | + hold += (unsigned long)(*in++) << bits; |
10081 | bits += 8; |
10082 | if (bits < op) { |
10083 | - hold += (unsigned long)(PUP(in)) << bits; |
10084 | + hold += (unsigned long)(*in++) << bits; |
10085 | bits += 8; |
10086 | } |
10087 | } |
10088 | @@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start) |
10089 | state->mode = BAD; |
10090 | break; |
10091 | } |
10092 | - from = window - OFF; |
10093 | + from = window; |
10094 | if (write == 0) { /* very common case */ |
10095 | from += wsize - op; |
10096 | if (op < len) { /* some from window */ |
10097 | len -= op; |
10098 | do { |
10099 | - PUP(out) = PUP(from); |
10100 | + *out++ = *from++; |
10101 | } while (--op); |
10102 | from = out - dist; /* rest from output */ |
10103 | } |
10104 | @@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start) |
10105 | if (op < len) { /* some from end of window */ |
10106 | len -= op; |
10107 | do { |
10108 | - PUP(out) = PUP(from); |
10109 | + *out++ = *from++; |
10110 | } while (--op); |
10111 | - from = window - OFF; |
10112 | + from = window; |
10113 | if (write < len) { /* some from start of window */ |
10114 | op = write; |
10115 | len -= op; |
10116 | do { |
10117 | - PUP(out) = PUP(from); |
10118 | + *out++ = *from++; |
10119 | } while (--op); |
10120 | from = out - dist; /* rest from output */ |
10121 | } |
10122 | @@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start) |
10123 | if (op < len) { /* some from window */ |
10124 | len -= op; |
10125 | do { |
10126 | - PUP(out) = PUP(from); |
10127 | + *out++ = *from++; |
10128 | } while (--op); |
10129 | from = out - dist; /* rest from output */ |
10130 | } |
10131 | } |
10132 | while (len > 2) { |
10133 | - PUP(out) = PUP(from); |
10134 | - PUP(out) = PUP(from); |
10135 | - PUP(out) = PUP(from); |
10136 | + *out++ = *from++; |
10137 | + *out++ = *from++; |
10138 | + *out++ = *from++; |
10139 | len -= 3; |
10140 | } |
10141 | if (len) { |
10142 | - PUP(out) = PUP(from); |
10143 | + *out++ = *from++; |
10144 | if (len > 1) |
10145 | - PUP(out) = PUP(from); |
10146 | + *out++ = *from++; |
10147 | } |
10148 | } |
10149 | else { |
10150 | @@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start) |
10151 | from = out - dist; /* copy direct from output */ |
10152 | /* minimum length is three */ |
10153 | /* Align out addr */ |
10154 | - if (!((long)(out - 1 + OFF) & 1)) { |
10155 | - PUP(out) = PUP(from); |
10156 | + if (!((long)(out - 1) & 1)) { |
10157 | + *out++ = *from++; |
10158 | len--; |
10159 | } |
10160 | - sout = (unsigned short *)(out - OFF); |
10161 | + sout = (unsigned short *)(out); |
10162 | if (dist > 2) { |
10163 | unsigned short *sfrom; |
10164 | |
10165 | - sfrom = (unsigned short *)(from - OFF); |
10166 | + sfrom = (unsigned short *)(from); |
10167 | loops = len >> 1; |
10168 | do |
10169 | #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
10170 | - PUP(sout) = PUP(sfrom); |
10171 | + *sout++ = *sfrom++; |
10172 | #else |
10173 | - PUP(sout) = UP_UNALIGNED(sfrom); |
10174 | + *sout++ = get_unaligned16(sfrom++); |
10175 | #endif |
10176 | while (--loops); |
10177 | - out = (unsigned char *)sout + OFF; |
10178 | - from = (unsigned char *)sfrom + OFF; |
10179 | + out = (unsigned char *)sout; |
10180 | + from = (unsigned char *)sfrom; |
10181 | } else { /* dist == 1 or dist == 2 */ |
10182 | unsigned short pat16; |
10183 | |
10184 | - pat16 = *(sout-1+OFF); |
10185 | + pat16 = *(sout-1); |
10186 | if (dist == 1) { |
10187 | union uu mm; |
10188 | /* copy one char pattern to both bytes */ |
10189 | @@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start) |
10190 | } |
10191 | loops = len >> 1; |
10192 | do |
10193 | - PUP(sout) = pat16; |
10194 | + *sout++ = pat16; |
10195 | while (--loops); |
10196 | - out = (unsigned char *)sout + OFF; |
10197 | + out = (unsigned char *)sout; |
10198 | } |
10199 | if (len & 1) |
10200 | - PUP(out) = PUP(from); |
10201 | + *out++ = *from++; |
10202 | } |
10203 | } |
10204 | else if ((op & 64) == 0) { /* 2nd level distance code */ |
10205 | @@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start) |
10206 | hold &= (1U << bits) - 1; |
10207 | |
10208 | /* update state and return */ |
10209 | - strm->next_in = in + OFF; |
10210 | - strm->next_out = out + OFF; |
10211 | + strm->next_in = in; |
10212 | + strm->next_out = out; |
10213 | strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); |
10214 | strm->avail_out = (unsigned)(out < end ? |
10215 | 257 + (end - out) : 257 - (out - end)); |
10216 | diff --git a/net/core/dev.c b/net/core/dev.c |
10217 | index 8552874e5aac..204d87e7c9b1 100644 |
10218 | --- a/net/core/dev.c |
10219 | +++ b/net/core/dev.c |
10220 | @@ -79,6 +79,7 @@ |
10221 | #include <linux/sched.h> |
10222 | #include <linux/sched/mm.h> |
10223 | #include <linux/mutex.h> |
10224 | +#include <linux/rwsem.h> |
10225 | #include <linux/string.h> |
10226 | #include <linux/mm.h> |
10227 | #include <linux/socket.h> |
10228 | @@ -194,7 +195,7 @@ static DEFINE_SPINLOCK(napi_hash_lock); |
10229 | static unsigned int napi_gen_id = NR_CPUS; |
10230 | static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8); |
10231 | |
10232 | -static seqcount_t devnet_rename_seq; |
10233 | +static DECLARE_RWSEM(devnet_rename_sem); |
10234 | |
10235 | static inline void dev_base_seq_inc(struct net *net) |
10236 | { |
10237 | @@ -816,33 +817,28 @@ EXPORT_SYMBOL(dev_get_by_napi_id); |
10238 | * @net: network namespace |
10239 | * @name: a pointer to the buffer where the name will be stored. |
10240 | * @ifindex: the ifindex of the interface to get the name from. |
10241 | - * |
10242 | - * The use of raw_seqcount_begin() and cond_resched() before |
10243 | - * retrying is required as we want to give the writers a chance |
10244 | - * to complete when CONFIG_PREEMPT is not set. |
10245 | */ |
10246 | int netdev_get_name(struct net *net, char *name, int ifindex) |
10247 | { |
10248 | struct net_device *dev; |
10249 | - unsigned int seq; |
10250 | + int ret; |
10251 | |
10252 | -retry: |
10253 | - seq = raw_seqcount_begin(&devnet_rename_seq); |
10254 | + down_read(&devnet_rename_sem); |
10255 | rcu_read_lock(); |
10256 | + |
10257 | dev = dev_get_by_index_rcu(net, ifindex); |
10258 | if (!dev) { |
10259 | - rcu_read_unlock(); |
10260 | - return -ENODEV; |
10261 | + ret = -ENODEV; |
10262 | + goto out; |
10263 | } |
10264 | |
10265 | strcpy(name, dev->name); |
10266 | - rcu_read_unlock(); |
10267 | - if (read_seqcount_retry(&devnet_rename_seq, seq)) { |
10268 | - cond_resched(); |
10269 | - goto retry; |
10270 | - } |
10271 | |
10272 | - return 0; |
10273 | + ret = 0; |
10274 | +out: |
10275 | + rcu_read_unlock(); |
10276 | + up_read(&devnet_rename_sem); |
10277 | + return ret; |
10278 | } |
10279 | |
10280 | /** |
10281 | @@ -1115,10 +1111,10 @@ int dev_change_name(struct net_device *dev, const char *newname) |
10282 | likely(!(dev->priv_flags & IFF_LIVE_RENAME_OK))) |
10283 | return -EBUSY; |
10284 | |
10285 | - write_seqcount_begin(&devnet_rename_seq); |
10286 | + down_write(&devnet_rename_sem); |
10287 | |
10288 | if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { |
10289 | - write_seqcount_end(&devnet_rename_seq); |
10290 | + up_write(&devnet_rename_sem); |
10291 | return 0; |
10292 | } |
10293 | |
10294 | @@ -1126,7 +1122,7 @@ int dev_change_name(struct net_device *dev, const char *newname) |
10295 | |
10296 | err = dev_get_valid_name(net, dev, newname); |
10297 | if (err < 0) { |
10298 | - write_seqcount_end(&devnet_rename_seq); |
10299 | + up_write(&devnet_rename_sem); |
10300 | return err; |
10301 | } |
10302 | |
10303 | @@ -1141,11 +1137,11 @@ rollback: |
10304 | if (ret) { |
10305 | memcpy(dev->name, oldname, IFNAMSIZ); |
10306 | dev->name_assign_type = old_assign_type; |
10307 | - write_seqcount_end(&devnet_rename_seq); |
10308 | + up_write(&devnet_rename_sem); |
10309 | return ret; |
10310 | } |
10311 | |
10312 | - write_seqcount_end(&devnet_rename_seq); |
10313 | + up_write(&devnet_rename_sem); |
10314 | |
10315 | netdev_adjacent_rename_links(dev, oldname); |
10316 | |
10317 | @@ -1166,7 +1162,7 @@ rollback: |
10318 | /* err >= 0 after dev_alloc_name() or stores the first errno */ |
10319 | if (err >= 0) { |
10320 | err = ret; |
10321 | - write_seqcount_begin(&devnet_rename_seq); |
10322 | + down_write(&devnet_rename_sem); |
10323 | memcpy(dev->name, oldname, IFNAMSIZ); |
10324 | memcpy(oldname, newname, IFNAMSIZ); |
10325 | dev->name_assign_type = old_assign_type; |
10326 | diff --git a/net/core/filter.c b/net/core/filter.c |
10327 | index f1f2304822e3..a0a492f7cf9c 100644 |
10328 | --- a/net/core/filter.c |
10329 | +++ b/net/core/filter.c |
10330 | @@ -1766,25 +1766,27 @@ BPF_CALL_5(bpf_skb_load_bytes_relative, const struct sk_buff *, skb, |
10331 | u32, offset, void *, to, u32, len, u32, start_header) |
10332 | { |
10333 | u8 *end = skb_tail_pointer(skb); |
10334 | - u8 *net = skb_network_header(skb); |
10335 | - u8 *mac = skb_mac_header(skb); |
10336 | - u8 *ptr; |
10337 | + u8 *start, *ptr; |
10338 | |
10339 | - if (unlikely(offset > 0xffff || len > (end - mac))) |
10340 | + if (unlikely(offset > 0xffff)) |
10341 | goto err_clear; |
10342 | |
10343 | switch (start_header) { |
10344 | case BPF_HDR_START_MAC: |
10345 | - ptr = mac + offset; |
10346 | + if (unlikely(!skb_mac_header_was_set(skb))) |
10347 | + goto err_clear; |
10348 | + start = skb_mac_header(skb); |
10349 | break; |
10350 | case BPF_HDR_START_NET: |
10351 | - ptr = net + offset; |
10352 | + start = skb_network_header(skb); |
10353 | break; |
10354 | default: |
10355 | goto err_clear; |
10356 | } |
10357 | |
10358 | - if (likely(ptr >= mac && ptr + len <= end)) { |
10359 | + ptr = start + offset; |
10360 | + |
10361 | + if (likely(ptr + len <= end)) { |
10362 | memcpy(to, ptr, len); |
10363 | return 0; |
10364 | } |
10365 | diff --git a/net/core/sock_map.c b/net/core/sock_map.c |
10366 | index 8291568b707f..6bbc118bf00e 100644 |
10367 | --- a/net/core/sock_map.c |
10368 | +++ b/net/core/sock_map.c |
10369 | @@ -837,11 +837,15 @@ static struct bpf_map *sock_hash_alloc(union bpf_attr *attr) |
10370 | err = -EINVAL; |
10371 | goto free_htab; |
10372 | } |
10373 | + err = bpf_map_charge_init(&htab->map.memory, cost); |
10374 | + if (err) |
10375 | + goto free_htab; |
10376 | |
10377 | htab->buckets = bpf_map_area_alloc(htab->buckets_num * |
10378 | sizeof(struct bpf_htab_bucket), |
10379 | htab->map.numa_node); |
10380 | if (!htab->buckets) { |
10381 | + bpf_map_charge_finish(&htab->map.memory); |
10382 | err = -ENOMEM; |
10383 | goto free_htab; |
10384 | } |
10385 | @@ -861,6 +865,7 @@ static void sock_hash_free(struct bpf_map *map) |
10386 | { |
10387 | struct bpf_htab *htab = container_of(map, struct bpf_htab, map); |
10388 | struct bpf_htab_bucket *bucket; |
10389 | + struct hlist_head unlink_list; |
10390 | struct bpf_htab_elem *elem; |
10391 | struct hlist_node *node; |
10392 | int i; |
10393 | @@ -872,13 +877,32 @@ static void sock_hash_free(struct bpf_map *map) |
10394 | synchronize_rcu(); |
10395 | for (i = 0; i < htab->buckets_num; i++) { |
10396 | bucket = sock_hash_select_bucket(htab, i); |
10397 | - hlist_for_each_entry_safe(elem, node, &bucket->head, node) { |
10398 | - hlist_del_rcu(&elem->node); |
10399 | + |
10400 | + /* We are racing with sock_hash_delete_from_link to |
10401 | + * enter the spin-lock critical section. Every socket on |
10402 | + * the list is still linked to sockhash. Since link |
10403 | + * exists, psock exists and holds a ref to socket. That |
10404 | + * lets us to grab a socket ref too. |
10405 | + */ |
10406 | + raw_spin_lock_bh(&bucket->lock); |
10407 | + hlist_for_each_entry(elem, &bucket->head, node) |
10408 | + sock_hold(elem->sk); |
10409 | + hlist_move_list(&bucket->head, &unlink_list); |
10410 | + raw_spin_unlock_bh(&bucket->lock); |
10411 | + |
10412 | + /* Process removed entries out of atomic context to |
10413 | + * block for socket lock before deleting the psock's |
10414 | + * link to sockhash. |
10415 | + */ |
10416 | + hlist_for_each_entry_safe(elem, node, &unlink_list, node) { |
10417 | + hlist_del(&elem->node); |
10418 | lock_sock(elem->sk); |
10419 | rcu_read_lock(); |
10420 | sock_map_unref(elem->sk, elem); |
10421 | rcu_read_unlock(); |
10422 | release_sock(elem->sk); |
10423 | + sock_put(elem->sk); |
10424 | + sock_hash_free_elem(htab, elem); |
10425 | } |
10426 | } |
10427 | |
10428 | diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
10429 | index 69b025408390..ad9f38202731 100644 |
10430 | --- a/net/ipv4/tcp_bpf.c |
10431 | +++ b/net/ipv4/tcp_bpf.c |
10432 | @@ -96,6 +96,9 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock, |
10433 | } while (i != msg_rx->sg.end); |
10434 | |
10435 | if (unlikely(peek)) { |
10436 | + if (msg_rx == list_last_entry(&psock->ingress_msg, |
10437 | + struct sk_msg, list)) |
10438 | + break; |
10439 | msg_rx = list_next_entry(msg_rx, list); |
10440 | continue; |
10441 | } |
10442 | diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c |
10443 | index 8b179e3c802a..543afd9bd664 100644 |
10444 | --- a/net/rxrpc/proc.c |
10445 | +++ b/net/rxrpc/proc.c |
10446 | @@ -68,7 +68,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
10447 | "Proto Local " |
10448 | " Remote " |
10449 | " SvID ConnID CallID End Use State Abort " |
10450 | - " UserID TxSeq TW RxSeq RW RxSerial RxTimo\n"); |
10451 | + " DebugId TxSeq TW RxSeq RW RxSerial RxTimo\n"); |
10452 | return 0; |
10453 | } |
10454 | |
10455 | @@ -100,7 +100,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
10456 | rx_hard_ack = READ_ONCE(call->rx_hard_ack); |
10457 | seq_printf(seq, |
10458 | "UDP %-47.47s %-47.47s %4x %08x %08x %s %3u" |
10459 | - " %-8.8s %08x %lx %08x %02x %08x %02x %08x %06lx\n", |
10460 | + " %-8.8s %08x %08x %08x %02x %08x %02x %08x %06lx\n", |
10461 | lbuff, |
10462 | rbuff, |
10463 | call->service_id, |
10464 | @@ -110,7 +110,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
10465 | atomic_read(&call->usage), |
10466 | rxrpc_call_states[call->state], |
10467 | call->abort_code, |
10468 | - call->user_call_ID, |
10469 | + call->debug_id, |
10470 | tx_hard_ack, READ_ONCE(call->tx_top) - tx_hard_ack, |
10471 | rx_hard_ack, READ_ONCE(call->rx_top) - rx_hard_ack, |
10472 | call->rx_serial, |
10473 | diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c |
10474 | index d024af4be85e..105d17af4abc 100644 |
10475 | --- a/net/sunrpc/addr.c |
10476 | +++ b/net/sunrpc/addr.c |
10477 | @@ -82,11 +82,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap, |
10478 | |
10479 | rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u", |
10480 | IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id); |
10481 | - if (unlikely((size_t)rc > sizeof(scopebuf))) |
10482 | + if (unlikely((size_t)rc >= sizeof(scopebuf))) |
10483 | return 0; |
10484 | |
10485 | len += rc; |
10486 | - if (unlikely(len > buflen)) |
10487 | + if (unlikely(len >= buflen)) |
10488 | return 0; |
10489 | |
10490 | strcat(buf, scopebuf); |
10491 | diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
10492 | index 7181a30666b4..f9eb5efb237c 100644 |
10493 | --- a/net/xdp/xsk.c |
10494 | +++ b/net/xdp/xsk.c |
10495 | @@ -362,10 +362,8 @@ static int xsk_generic_xmit(struct sock *sk) |
10496 | |
10497 | len = desc.len; |
10498 | skb = sock_alloc_send_skb(sk, len, 1, &err); |
10499 | - if (unlikely(!skb)) { |
10500 | - err = -EAGAIN; |
10501 | + if (unlikely(!skb)) |
10502 | goto out; |
10503 | - } |
10504 | |
10505 | skb_put(skb, len); |
10506 | addr = desc.addr; |
10507 | diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh |
10508 | index a07668a5c36b..94a833597a88 100755 |
10509 | --- a/scripts/headers_install.sh |
10510 | +++ b/scripts/headers_install.sh |
10511 | @@ -64,7 +64,7 @@ configs=$(sed -e ' |
10512 | d |
10513 | ' $OUTFILE) |
10514 | |
10515 | -# The entries in the following list are not warned. |
10516 | +# The entries in the following list do not result in an error. |
10517 | # Please do not add a new entry. This list is only for existing ones. |
10518 | # The list will be reduced gradually, and deleted eventually. (hopefully) |
10519 | # |
10520 | @@ -98,18 +98,19 @@ include/uapi/linux/raw.h:CONFIG_MAX_RAW_DEVS |
10521 | |
10522 | for c in $configs |
10523 | do |
10524 | - warn=1 |
10525 | + leak_error=1 |
10526 | |
10527 | for ignore in $config_leak_ignores |
10528 | do |
10529 | if echo "$INFILE:$c" | grep -q "$ignore$"; then |
10530 | - warn= |
10531 | + leak_error= |
10532 | break |
10533 | fi |
10534 | done |
10535 | |
10536 | - if [ "$warn" = 1 ]; then |
10537 | - echo "warning: $INFILE: leak $c to user-space" >&2 |
10538 | + if [ "$leak_error" = 1 ]; then |
10539 | + echo "error: $INFILE: leak $c to user-space" >&2 |
10540 | + exit 1 |
10541 | fi |
10542 | done |
10543 | |
10544 | diff --git a/scripts/mksysmap b/scripts/mksysmap |
10545 | index a35acc0d0b82..9aa23d15862a 100755 |
10546 | --- a/scripts/mksysmap |
10547 | +++ b/scripts/mksysmap |
10548 | @@ -41,4 +41,4 @@ |
10549 | # so we just ignore them to let readprofile continue to work. |
10550 | # (At least sparc64 has __crc_ in the middle). |
10551 | |
10552 | -$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2 |
10553 | +$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2 |
10554 | diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c |
10555 | index 5dedc0173b02..1a33f490e667 100644 |
10556 | --- a/security/apparmor/domain.c |
10557 | +++ b/security/apparmor/domain.c |
10558 | @@ -935,7 +935,8 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm) |
10559 | * aways results in a further reduction of permissions. |
10560 | */ |
10561 | if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && |
10562 | - !unconfined(label) && !aa_label_is_subset(new, ctx->nnp)) { |
10563 | + !unconfined(label) && |
10564 | + !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
10565 | error = -EPERM; |
10566 | info = "no new privs"; |
10567 | goto audit; |
10568 | @@ -1213,7 +1214,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags) |
10569 | * reduce restrictions. |
10570 | */ |
10571 | if (task_no_new_privs(current) && !unconfined(label) && |
10572 | - !aa_label_is_subset(new, ctx->nnp)) { |
10573 | + !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
10574 | /* not an apparmor denial per se, so don't log it */ |
10575 | AA_DEBUG("no_new_privs - change_hat denied"); |
10576 | error = -EPERM; |
10577 | @@ -1234,7 +1235,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags) |
10578 | * reduce restrictions. |
10579 | */ |
10580 | if (task_no_new_privs(current) && !unconfined(label) && |
10581 | - !aa_label_is_subset(previous, ctx->nnp)) { |
10582 | + !aa_label_is_unconfined_subset(previous, ctx->nnp)) { |
10583 | /* not an apparmor denial per se, so don't log it */ |
10584 | AA_DEBUG("no_new_privs - change_hat denied"); |
10585 | error = -EPERM; |
10586 | @@ -1429,7 +1430,7 @@ check: |
10587 | * reduce restrictions. |
10588 | */ |
10589 | if (task_no_new_privs(current) && !unconfined(label) && |
10590 | - !aa_label_is_subset(new, ctx->nnp)) { |
10591 | + !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
10592 | /* not an apparmor denial per se, so don't log it */ |
10593 | AA_DEBUG("no_new_privs - change_hat denied"); |
10594 | error = -EPERM; |
10595 | diff --git a/security/apparmor/include/label.h b/security/apparmor/include/label.h |
10596 | index 47942c4ba7ca..255764ab06e2 100644 |
10597 | --- a/security/apparmor/include/label.h |
10598 | +++ b/security/apparmor/include/label.h |
10599 | @@ -281,6 +281,7 @@ bool aa_label_init(struct aa_label *label, int size, gfp_t gfp); |
10600 | struct aa_label *aa_label_alloc(int size, struct aa_proxy *proxy, gfp_t gfp); |
10601 | |
10602 | bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub); |
10603 | +bool aa_label_is_unconfined_subset(struct aa_label *set, struct aa_label *sub); |
10604 | struct aa_profile *__aa_label_next_not_in_set(struct label_it *I, |
10605 | struct aa_label *set, |
10606 | struct aa_label *sub); |
10607 | diff --git a/security/apparmor/label.c b/security/apparmor/label.c |
10608 | index 470693239e64..5f324d63ceaa 100644 |
10609 | --- a/security/apparmor/label.c |
10610 | +++ b/security/apparmor/label.c |
10611 | @@ -550,6 +550,39 @@ bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub) |
10612 | return __aa_label_next_not_in_set(&i, set, sub) == NULL; |
10613 | } |
10614 | |
10615 | +/** |
10616 | + * aa_label_is_unconfined_subset - test if @sub is a subset of @set |
10617 | + * @set: label to test against |
10618 | + * @sub: label to test if is subset of @set |
10619 | + * |
10620 | + * This checks for subset but taking into account unconfined. IF |
10621 | + * @sub contains an unconfined profile that does not have a matching |
10622 | + * unconfined in @set then this will not cause the test to fail. |
10623 | + * Conversely we don't care about an unconfined in @set that is not in |
10624 | + * @sub |
10625 | + * |
10626 | + * Returns: true if @sub is special_subset of @set |
10627 | + * else false |
10628 | + */ |
10629 | +bool aa_label_is_unconfined_subset(struct aa_label *set, struct aa_label *sub) |
10630 | +{ |
10631 | + struct label_it i = { }; |
10632 | + struct aa_profile *p; |
10633 | + |
10634 | + AA_BUG(!set); |
10635 | + AA_BUG(!sub); |
10636 | + |
10637 | + if (sub == set) |
10638 | + return true; |
10639 | + |
10640 | + do { |
10641 | + p = __aa_label_next_not_in_set(&i, set, sub); |
10642 | + if (p && !profile_unconfined(p)) |
10643 | + break; |
10644 | + } while (p); |
10645 | + |
10646 | + return p == NULL; |
10647 | +} |
10648 | |
10649 | |
10650 | /** |
10651 | @@ -1531,13 +1564,13 @@ static const char *label_modename(struct aa_ns *ns, struct aa_label *label, |
10652 | |
10653 | label_for_each(i, label, profile) { |
10654 | if (aa_ns_visible(ns, profile->ns, flags & FLAG_VIEW_SUBNS)) { |
10655 | - if (profile->mode == APPARMOR_UNCONFINED) |
10656 | + count++; |
10657 | + if (profile == profile->ns->unconfined) |
10658 | /* special case unconfined so stacks with |
10659 | * unconfined don't report as mixed. ie. |
10660 | * profile_foo//&:ns1:unconfined (mixed) |
10661 | */ |
10662 | continue; |
10663 | - count++; |
10664 | if (mode == -1) |
10665 | mode = profile->mode; |
10666 | else if (mode != profile->mode) |
10667 | diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c |
10668 | index ec3a928af829..e31965dc6dd1 100644 |
10669 | --- a/security/apparmor/lsm.c |
10670 | +++ b/security/apparmor/lsm.c |
10671 | @@ -791,7 +791,12 @@ static void apparmor_sk_clone_security(const struct sock *sk, |
10672 | struct aa_sk_ctx *ctx = SK_CTX(sk); |
10673 | struct aa_sk_ctx *new = SK_CTX(newsk); |
10674 | |
10675 | + if (new->label) |
10676 | + aa_put_label(new->label); |
10677 | new->label = aa_get_label(ctx->label); |
10678 | + |
10679 | + if (new->peer) |
10680 | + aa_put_label(new->peer); |
10681 | new->peer = aa_get_label(ctx->peer); |
10682 | } |
10683 | |
10684 | diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c |
10685 | index a5813c7629c1..f62adf3cfce8 100644 |
10686 | --- a/security/selinux/ss/services.c |
10687 | +++ b/security/selinux/ss/services.c |
10688 | @@ -2844,8 +2844,12 @@ err: |
10689 | if (*names) { |
10690 | for (i = 0; i < *len; i++) |
10691 | kfree((*names)[i]); |
10692 | + kfree(*names); |
10693 | } |
10694 | kfree(*values); |
10695 | + *len = 0; |
10696 | + *names = NULL; |
10697 | + *values = NULL; |
10698 | goto out; |
10699 | } |
10700 | |
10701 | diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c |
10702 | index 67d735e9a6a4..fea92e148790 100644 |
10703 | --- a/sound/firewire/amdtp-am824.c |
10704 | +++ b/sound/firewire/amdtp-am824.c |
10705 | @@ -82,7 +82,8 @@ int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate, |
10706 | if (err < 0) |
10707 | return err; |
10708 | |
10709 | - s->ctx_data.rx.fdf = AMDTP_FDF_AM824 | s->sfc; |
10710 | + if (s->direction == AMDTP_OUT_STREAM) |
10711 | + s->ctx_data.rx.fdf = AMDTP_FDF_AM824 | s->sfc; |
10712 | |
10713 | p->pcm_channels = pcm_channels; |
10714 | p->midi_ports = midi_ports; |
10715 | diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c |
10716 | index c5b1d5900eed..d6420d224d09 100644 |
10717 | --- a/sound/isa/wavefront/wavefront_synth.c |
10718 | +++ b/sound/isa/wavefront/wavefront_synth.c |
10719 | @@ -1171,7 +1171,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header) |
10720 | "alias for %d\n", |
10721 | header->number, |
10722 | header->hdr.a.OriginalSample); |
10723 | - |
10724 | + |
10725 | + if (header->number >= WF_MAX_SAMPLE) |
10726 | + return -EINVAL; |
10727 | + |
10728 | munge_int32 (header->number, &alias_hdr[0], 2); |
10729 | munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2); |
10730 | munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset), |
10731 | @@ -1202,6 +1205,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header) |
10732 | int num_samples; |
10733 | unsigned char *msample_hdr; |
10734 | |
10735 | + if (header->number >= WF_MAX_SAMPLE) |
10736 | + return -EINVAL; |
10737 | + |
10738 | msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL); |
10739 | if (! msample_hdr) |
10740 | return -ENOMEM; |
10741 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
10742 | index df5afac0b600..459a7d61326e 100644 |
10743 | --- a/sound/pci/hda/patch_realtek.c |
10744 | +++ b/sound/pci/hda/patch_realtek.c |
10745 | @@ -81,6 +81,7 @@ struct alc_spec { |
10746 | |
10747 | /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ |
10748 | int mute_led_polarity; |
10749 | + int micmute_led_polarity; |
10750 | hda_nid_t mute_led_nid; |
10751 | hda_nid_t cap_mute_led_nid; |
10752 | |
10753 | @@ -4080,11 +4081,9 @@ static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, |
10754 | |
10755 | /* update LED status via GPIO */ |
10756 | static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, |
10757 | - bool enabled) |
10758 | + int polarity, bool enabled) |
10759 | { |
10760 | - struct alc_spec *spec = codec->spec; |
10761 | - |
10762 | - if (spec->mute_led_polarity) |
10763 | + if (polarity) |
10764 | enabled = !enabled; |
10765 | alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ |
10766 | } |
10767 | @@ -4095,7 +4094,8 @@ static void alc_fixup_gpio_mute_hook(void *private_data, int enabled) |
10768 | struct hda_codec *codec = private_data; |
10769 | struct alc_spec *spec = codec->spec; |
10770 | |
10771 | - alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); |
10772 | + alc_update_gpio_led(codec, spec->gpio_mute_led_mask, |
10773 | + spec->mute_led_polarity, enabled); |
10774 | } |
10775 | |
10776 | /* turn on/off mic-mute LED via GPIO per capture hook */ |
10777 | @@ -4104,6 +4104,7 @@ static void alc_gpio_micmute_update(struct hda_codec *codec) |
10778 | struct alc_spec *spec = codec->spec; |
10779 | |
10780 | alc_update_gpio_led(codec, spec->gpio_mic_led_mask, |
10781 | + spec->micmute_led_polarity, |
10782 | spec->gen.micmute_led.led_value); |
10783 | } |
10784 | |
10785 | @@ -5808,7 +5809,8 @@ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, |
10786 | |
10787 | snd_hda_gen_hp_automute(codec, jack); |
10788 | /* mute_led_polarity is set to 0, so we pass inverted value here */ |
10789 | - alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); |
10790 | + alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, |
10791 | + !spec->gen.hp_jack_present); |
10792 | } |
10793 | |
10794 | /* Manage GPIOs for HP EliteBook Folio 9480m. |
10795 | diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c |
10796 | index cae1def8902d..96718e3a1ad0 100644 |
10797 | --- a/sound/soc/codecs/max98373.c |
10798 | +++ b/sound/soc/codecs/max98373.c |
10799 | @@ -850,8 +850,8 @@ static int max98373_resume(struct device *dev) |
10800 | { |
10801 | struct max98373_priv *max98373 = dev_get_drvdata(dev); |
10802 | |
10803 | - max98373_reset(max98373, dev); |
10804 | regcache_cache_only(max98373->regmap, false); |
10805 | + max98373_reset(max98373, dev); |
10806 | regcache_sync(max98373->regmap); |
10807 | return 0; |
10808 | } |
10809 | diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c |
10810 | index 19662ee330d6..c83f7f5da96b 100644 |
10811 | --- a/sound/soc/codecs/rt5645.c |
10812 | +++ b/sound/soc/codecs/rt5645.c |
10813 | @@ -3625,6 +3625,12 @@ static const struct rt5645_platform_data asus_t100ha_platform_data = { |
10814 | .inv_jd1_1 = true, |
10815 | }; |
10816 | |
10817 | +static const struct rt5645_platform_data asus_t101ha_platform_data = { |
10818 | + .dmic1_data_pin = RT5645_DMIC_DATA_IN2N, |
10819 | + .dmic2_data_pin = RT5645_DMIC2_DISABLE, |
10820 | + .jd_mode = 3, |
10821 | +}; |
10822 | + |
10823 | static const struct rt5645_platform_data lenovo_ideapad_miix_310_pdata = { |
10824 | .jd_mode = 3, |
10825 | .in2_diff = true, |
10826 | @@ -3702,6 +3708,14 @@ static const struct dmi_system_id dmi_platform_data[] = { |
10827 | }, |
10828 | .driver_data = (void *)&asus_t100ha_platform_data, |
10829 | }, |
10830 | + { |
10831 | + .ident = "ASUS T101HA", |
10832 | + .matches = { |
10833 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
10834 | + DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"), |
10835 | + }, |
10836 | + .driver_data = (void *)&asus_t101ha_platform_data, |
10837 | + }, |
10838 | { |
10839 | .ident = "MINIX Z83-4", |
10840 | .matches = { |
10841 | diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c |
10842 | index 01052a0808b0..5aee6b8366d2 100644 |
10843 | --- a/sound/soc/fsl/fsl_asrc_dma.c |
10844 | +++ b/sound/soc/fsl/fsl_asrc_dma.c |
10845 | @@ -241,6 +241,7 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream, |
10846 | ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be); |
10847 | if (ret) { |
10848 | dev_err(dev, "failed to config DMA channel for Back-End\n"); |
10849 | + dma_release_channel(pair->dma_chan[dir]); |
10850 | return ret; |
10851 | } |
10852 | |
10853 | diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c |
10854 | index c7a49d03463a..84290be778f0 100644 |
10855 | --- a/sound/soc/fsl/fsl_esai.c |
10856 | +++ b/sound/soc/fsl/fsl_esai.c |
10857 | @@ -87,6 +87,10 @@ static irqreturn_t esai_isr(int irq, void *devid) |
10858 | if ((saisr & (ESAI_SAISR_TUE | ESAI_SAISR_ROE)) && |
10859 | esai_priv->reset_at_xrun) { |
10860 | dev_dbg(&pdev->dev, "reset module for xrun\n"); |
10861 | + regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, |
10862 | + ESAI_xCR_xEIE_MASK, 0); |
10863 | + regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR, |
10864 | + ESAI_xCR_xEIE_MASK, 0); |
10865 | tasklet_schedule(&esai_priv->task); |
10866 | } |
10867 | |
10868 | diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c |
10869 | index fdd2c73fd2fa..869fe0068cbd 100644 |
10870 | --- a/sound/soc/img/img-i2s-in.c |
10871 | +++ b/sound/soc/img/img-i2s-in.c |
10872 | @@ -482,6 +482,7 @@ static int img_i2s_in_probe(struct platform_device *pdev) |
10873 | if (IS_ERR(rst)) { |
10874 | if (PTR_ERR(rst) == -EPROBE_DEFER) { |
10875 | ret = -EPROBE_DEFER; |
10876 | + pm_runtime_put(&pdev->dev); |
10877 | goto err_suspend; |
10878 | } |
10879 | |
10880 | diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
10881 | index e62e1d7815aa..f7964d1ec486 100644 |
10882 | --- a/sound/soc/intel/boards/bytcr_rt5640.c |
10883 | +++ b/sound/soc/intel/boards/bytcr_rt5640.c |
10884 | @@ -742,6 +742,30 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
10885 | BYT_RT5640_SSP0_AIF1 | |
10886 | BYT_RT5640_MCLK_EN), |
10887 | }, |
10888 | + { /* Toshiba Encore WT8-A */ |
10889 | + .matches = { |
10890 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
10891 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT8-A"), |
10892 | + }, |
10893 | + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
10894 | + BYT_RT5640_JD_SRC_JD2_IN4N | |
10895 | + BYT_RT5640_OVCD_TH_2000UA | |
10896 | + BYT_RT5640_OVCD_SF_0P75 | |
10897 | + BYT_RT5640_JD_NOT_INV | |
10898 | + BYT_RT5640_MCLK_EN), |
10899 | + }, |
10900 | + { /* Toshiba Encore WT10-A */ |
10901 | + .matches = { |
10902 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
10903 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A-103"), |
10904 | + }, |
10905 | + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
10906 | + BYT_RT5640_JD_SRC_JD1_IN4P | |
10907 | + BYT_RT5640_OVCD_TH_2000UA | |
10908 | + BYT_RT5640_OVCD_SF_0P75 | |
10909 | + BYT_RT5640_SSP0_AIF2 | |
10910 | + BYT_RT5640_MCLK_EN), |
10911 | + }, |
10912 | { /* Catch-all for generic Insyde tablets, must be last */ |
10913 | .matches = { |
10914 | DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), |
10915 | diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c |
10916 | index d286dff3171d..898ef1d5608f 100644 |
10917 | --- a/sound/soc/meson/axg-fifo.c |
10918 | +++ b/sound/soc/meson/axg-fifo.c |
10919 | @@ -244,7 +244,7 @@ static int axg_fifo_pcm_open(struct snd_pcm_substream *ss) |
10920 | /* Enable pclk to access registers and clock the fifo ip */ |
10921 | ret = clk_prepare_enable(fifo->pclk); |
10922 | if (ret) |
10923 | - return ret; |
10924 | + goto free_irq; |
10925 | |
10926 | /* Setup status2 so it reports the memory pointer */ |
10927 | regmap_update_bits(fifo->map, FIFO_CTRL1, |
10928 | @@ -264,8 +264,14 @@ static int axg_fifo_pcm_open(struct snd_pcm_substream *ss) |
10929 | /* Take memory arbitror out of reset */ |
10930 | ret = reset_control_deassert(fifo->arb); |
10931 | if (ret) |
10932 | - clk_disable_unprepare(fifo->pclk); |
10933 | + goto free_clk; |
10934 | + |
10935 | + return 0; |
10936 | |
10937 | +free_clk: |
10938 | + clk_disable_unprepare(fifo->pclk); |
10939 | +free_irq: |
10940 | + free_irq(fifo->irq, ss); |
10941 | return ret; |
10942 | } |
10943 | |
10944 | diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c |
10945 | index 548eb4fa2da6..9f0ffdcef637 100644 |
10946 | --- a/sound/soc/qcom/qdsp6/q6asm-dai.c |
10947 | +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c |
10948 | @@ -171,7 +171,7 @@ static const struct snd_compr_codec_caps q6asm_compr_caps = { |
10949 | }; |
10950 | |
10951 | static void event_handler(uint32_t opcode, uint32_t token, |
10952 | - uint32_t *payload, void *priv) |
10953 | + void *payload, void *priv) |
10954 | { |
10955 | struct q6asm_dai_rtd *prtd = priv; |
10956 | struct snd_pcm_substream *substream = prtd->substream; |
10957 | @@ -494,7 +494,7 @@ static struct snd_pcm_ops q6asm_dai_ops = { |
10958 | }; |
10959 | |
10960 | static void compress_event_handler(uint32_t opcode, uint32_t token, |
10961 | - uint32_t *payload, void *priv) |
10962 | + void *payload, void *priv) |
10963 | { |
10964 | struct q6asm_dai_rtd *prtd = priv; |
10965 | struct snd_compr_stream *substream = prtd->cstream; |
10966 | diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c |
10967 | index af19010b9d88..8bd49c8a9517 100644 |
10968 | --- a/sound/soc/sh/rcar/gen.c |
10969 | +++ b/sound/soc/sh/rcar/gen.c |
10970 | @@ -224,6 +224,14 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) |
10971 | RSND_GEN_S_REG(SSI_SYS_STATUS5, 0x884), |
10972 | RSND_GEN_S_REG(SSI_SYS_STATUS6, 0x888), |
10973 | RSND_GEN_S_REG(SSI_SYS_STATUS7, 0x88c), |
10974 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0, 0x850), |
10975 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE1, 0x854), |
10976 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2, 0x858), |
10977 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE3, 0x85c), |
10978 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE4, 0x890), |
10979 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE5, 0x894), |
10980 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE6, 0x898), |
10981 | + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE7, 0x89c), |
10982 | RSND_GEN_S_REG(HDMI0_SEL, 0x9e0), |
10983 | RSND_GEN_S_REG(HDMI1_SEL, 0x9e4), |
10984 | |
10985 | diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h |
10986 | index ea6cbaa9743e..d47608ff5fac 100644 |
10987 | --- a/sound/soc/sh/rcar/rsnd.h |
10988 | +++ b/sound/soc/sh/rcar/rsnd.h |
10989 | @@ -189,6 +189,14 @@ enum rsnd_reg { |
10990 | SSI_SYS_STATUS5, |
10991 | SSI_SYS_STATUS6, |
10992 | SSI_SYS_STATUS7, |
10993 | + SSI_SYS_INT_ENABLE0, |
10994 | + SSI_SYS_INT_ENABLE1, |
10995 | + SSI_SYS_INT_ENABLE2, |
10996 | + SSI_SYS_INT_ENABLE3, |
10997 | + SSI_SYS_INT_ENABLE4, |
10998 | + SSI_SYS_INT_ENABLE5, |
10999 | + SSI_SYS_INT_ENABLE6, |
11000 | + SSI_SYS_INT_ENABLE7, |
11001 | HDMI0_SEL, |
11002 | HDMI1_SEL, |
11003 | SSI9_BUSIF0_MODE, |
11004 | @@ -237,6 +245,7 @@ enum rsnd_reg { |
11005 | #define SSI9_BUSIF_ADINR(i) (SSI9_BUSIF0_ADINR + (i)) |
11006 | #define SSI9_BUSIF_DALIGN(i) (SSI9_BUSIF0_DALIGN + (i)) |
11007 | #define SSI_SYS_STATUS(i) (SSI_SYS_STATUS0 + (i)) |
11008 | +#define SSI_SYS_INT_ENABLE(i) (SSI_SYS_INT_ENABLE0 + (i)) |
11009 | |
11010 | |
11011 | struct rsnd_priv; |
11012 | diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c |
11013 | index 4a7d3413917f..47d5ddb526f2 100644 |
11014 | --- a/sound/soc/sh/rcar/ssi.c |
11015 | +++ b/sound/soc/sh/rcar/ssi.c |
11016 | @@ -372,6 +372,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, |
11017 | u32 wsr = ssi->wsr; |
11018 | int width; |
11019 | int is_tdm, is_tdm_split; |
11020 | + int id = rsnd_mod_id(mod); |
11021 | + int i; |
11022 | + u32 sys_int_enable = 0; |
11023 | |
11024 | is_tdm = rsnd_runtime_is_tdm(io); |
11025 | is_tdm_split = rsnd_runtime_is_tdm_split(io); |
11026 | @@ -447,6 +450,38 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, |
11027 | cr_mode = DIEN; /* PIO : enable Data interrupt */ |
11028 | } |
11029 | |
11030 | + /* enable busif buffer over/under run interrupt. */ |
11031 | + if (is_tdm || is_tdm_split) { |
11032 | + switch (id) { |
11033 | + case 0: |
11034 | + case 1: |
11035 | + case 2: |
11036 | + case 3: |
11037 | + case 4: |
11038 | + for (i = 0; i < 4; i++) { |
11039 | + sys_int_enable = rsnd_mod_read(mod, |
11040 | + SSI_SYS_INT_ENABLE(i * 2)); |
11041 | + sys_int_enable |= 0xf << (id * 4); |
11042 | + rsnd_mod_write(mod, |
11043 | + SSI_SYS_INT_ENABLE(i * 2), |
11044 | + sys_int_enable); |
11045 | + } |
11046 | + |
11047 | + break; |
11048 | + case 9: |
11049 | + for (i = 0; i < 4; i++) { |
11050 | + sys_int_enable = rsnd_mod_read(mod, |
11051 | + SSI_SYS_INT_ENABLE((i * 2) + 1)); |
11052 | + sys_int_enable |= 0xf << 4; |
11053 | + rsnd_mod_write(mod, |
11054 | + SSI_SYS_INT_ENABLE((i * 2) + 1), |
11055 | + sys_int_enable); |
11056 | + } |
11057 | + |
11058 | + break; |
11059 | + } |
11060 | + } |
11061 | + |
11062 | init_end: |
11063 | ssi->cr_own = cr_own; |
11064 | ssi->cr_mode = cr_mode; |
11065 | @@ -496,6 +531,13 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, |
11066 | { |
11067 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
11068 | struct device *dev = rsnd_priv_to_dev(priv); |
11069 | + int is_tdm, is_tdm_split; |
11070 | + int id = rsnd_mod_id(mod); |
11071 | + int i; |
11072 | + u32 sys_int_enable = 0; |
11073 | + |
11074 | + is_tdm = rsnd_runtime_is_tdm(io); |
11075 | + is_tdm_split = rsnd_runtime_is_tdm_split(io); |
11076 | |
11077 | if (!rsnd_ssi_is_run_mods(mod, io)) |
11078 | return 0; |
11079 | @@ -517,6 +559,38 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, |
11080 | ssi->wsr = 0; |
11081 | } |
11082 | |
11083 | + /* disable busif buffer over/under run interrupt. */ |
11084 | + if (is_tdm || is_tdm_split) { |
11085 | + switch (id) { |
11086 | + case 0: |
11087 | + case 1: |
11088 | + case 2: |
11089 | + case 3: |
11090 | + case 4: |
11091 | + for (i = 0; i < 4; i++) { |
11092 | + sys_int_enable = rsnd_mod_read(mod, |
11093 | + SSI_SYS_INT_ENABLE(i * 2)); |
11094 | + sys_int_enable &= ~(0xf << (id * 4)); |
11095 | + rsnd_mod_write(mod, |
11096 | + SSI_SYS_INT_ENABLE(i * 2), |
11097 | + sys_int_enable); |
11098 | + } |
11099 | + |
11100 | + break; |
11101 | + case 9: |
11102 | + for (i = 0; i < 4; i++) { |
11103 | + sys_int_enable = rsnd_mod_read(mod, |
11104 | + SSI_SYS_INT_ENABLE((i * 2) + 1)); |
11105 | + sys_int_enable &= ~(0xf << 4); |
11106 | + rsnd_mod_write(mod, |
11107 | + SSI_SYS_INT_ENABLE((i * 2) + 1), |
11108 | + sys_int_enable); |
11109 | + } |
11110 | + |
11111 | + break; |
11112 | + } |
11113 | + } |
11114 | + |
11115 | return 0; |
11116 | } |
11117 | |
11118 | @@ -622,6 +696,11 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, |
11119 | int enable) |
11120 | { |
11121 | u32 val = 0; |
11122 | + int is_tdm, is_tdm_split; |
11123 | + int id = rsnd_mod_id(mod); |
11124 | + |
11125 | + is_tdm = rsnd_runtime_is_tdm(io); |
11126 | + is_tdm_split = rsnd_runtime_is_tdm_split(io); |
11127 | |
11128 | if (rsnd_is_gen1(priv)) |
11129 | return 0; |
11130 | @@ -635,6 +714,19 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, |
11131 | if (enable) |
11132 | val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; |
11133 | |
11134 | + if (is_tdm || is_tdm_split) { |
11135 | + switch (id) { |
11136 | + case 0: |
11137 | + case 1: |
11138 | + case 2: |
11139 | + case 3: |
11140 | + case 4: |
11141 | + case 9: |
11142 | + val |= 0x0000ff00; |
11143 | + break; |
11144 | + } |
11145 | + } |
11146 | + |
11147 | rsnd_mod_write(mod, SSI_INT_ENABLE, val); |
11148 | |
11149 | return 0; |
11150 | @@ -651,6 +743,12 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
11151 | u32 status; |
11152 | bool elapsed = false; |
11153 | bool stop = false; |
11154 | + int id = rsnd_mod_id(mod); |
11155 | + int i; |
11156 | + int is_tdm, is_tdm_split; |
11157 | + |
11158 | + is_tdm = rsnd_runtime_is_tdm(io); |
11159 | + is_tdm_split = rsnd_runtime_is_tdm_split(io); |
11160 | |
11161 | spin_lock(&priv->lock); |
11162 | |
11163 | @@ -672,6 +770,53 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
11164 | stop = true; |
11165 | } |
11166 | |
11167 | + status = 0; |
11168 | + |
11169 | + if (is_tdm || is_tdm_split) { |
11170 | + switch (id) { |
11171 | + case 0: |
11172 | + case 1: |
11173 | + case 2: |
11174 | + case 3: |
11175 | + case 4: |
11176 | + for (i = 0; i < 4; i++) { |
11177 | + status = rsnd_mod_read(mod, |
11178 | + SSI_SYS_STATUS(i * 2)); |
11179 | + status &= 0xf << (id * 4); |
11180 | + |
11181 | + if (status) { |
11182 | + rsnd_dbg_irq_status(dev, |
11183 | + "%s err status : 0x%08x\n", |
11184 | + rsnd_mod_name(mod), status); |
11185 | + rsnd_mod_write(mod, |
11186 | + SSI_SYS_STATUS(i * 2), |
11187 | + 0xf << (id * 4)); |
11188 | + stop = true; |
11189 | + break; |
11190 | + } |
11191 | + } |
11192 | + break; |
11193 | + case 9: |
11194 | + for (i = 0; i < 4; i++) { |
11195 | + status = rsnd_mod_read(mod, |
11196 | + SSI_SYS_STATUS((i * 2) + 1)); |
11197 | + status &= 0xf << 4; |
11198 | + |
11199 | + if (status) { |
11200 | + rsnd_dbg_irq_status(dev, |
11201 | + "%s err status : 0x%08x\n", |
11202 | + rsnd_mod_name(mod), status); |
11203 | + rsnd_mod_write(mod, |
11204 | + SSI_SYS_STATUS((i * 2) + 1), |
11205 | + 0xf << 4); |
11206 | + stop = true; |
11207 | + break; |
11208 | + } |
11209 | + } |
11210 | + break; |
11211 | + } |
11212 | + } |
11213 | + |
11214 | rsnd_ssi_status_clear(mod); |
11215 | rsnd_ssi_interrupt_out: |
11216 | spin_unlock(&priv->lock); |
11217 | diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
11218 | index 0215e2c94bf0..9df20768a8f2 100644 |
11219 | --- a/sound/soc/soc-core.c |
11220 | +++ b/sound/soc/soc-core.c |
11221 | @@ -1895,9 +1895,25 @@ match: |
11222 | dai_link->platforms->name = component->name; |
11223 | |
11224 | /* convert non BE into BE */ |
11225 | - dai_link->no_pcm = 1; |
11226 | - dai_link->dpcm_playback = 1; |
11227 | - dai_link->dpcm_capture = 1; |
11228 | + if (!dai_link->no_pcm) { |
11229 | + dai_link->no_pcm = 1; |
11230 | + |
11231 | + if (dai_link->dpcm_playback) |
11232 | + dev_warn(card->dev, |
11233 | + "invalid configuration, dailink %s has flags no_pcm=0 and dpcm_playback=1\n", |
11234 | + dai_link->name); |
11235 | + if (dai_link->dpcm_capture) |
11236 | + dev_warn(card->dev, |
11237 | + "invalid configuration, dailink %s has flags no_pcm=0 and dpcm_capture=1\n", |
11238 | + dai_link->name); |
11239 | + |
11240 | + /* convert normal link into DPCM one */ |
11241 | + if (!(dai_link->dpcm_playback || |
11242 | + dai_link->dpcm_capture)) { |
11243 | + dai_link->dpcm_playback = !dai_link->capture_only; |
11244 | + dai_link->dpcm_capture = !dai_link->playback_only; |
11245 | + } |
11246 | + } |
11247 | |
11248 | /* override any BE fixups */ |
11249 | dai_link->be_hw_params_fixup = |
11250 | diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c |
11251 | index 12aec140819a..2a6b84d2781e 100644 |
11252 | --- a/sound/soc/sof/core.c |
11253 | +++ b/sound/soc/sof/core.c |
11254 | @@ -372,6 +372,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) |
11255 | /* init the IPC */ |
11256 | sdev->ipc = snd_sof_ipc_init(sdev); |
11257 | if (!sdev->ipc) { |
11258 | + ret = -ENOMEM; |
11259 | dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret); |
11260 | goto ipc_err; |
11261 | } |
11262 | diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig |
11263 | index 71f318bc2c74..b4f0426685c4 100644 |
11264 | --- a/sound/soc/sof/imx/Kconfig |
11265 | +++ b/sound/soc/sof/imx/Kconfig |
11266 | @@ -14,7 +14,7 @@ if SND_SOC_SOF_IMX_TOPLEVEL |
11267 | config SND_SOC_SOF_IMX8_SUPPORT |
11268 | bool "SOF support for i.MX8" |
11269 | depends on IMX_SCU |
11270 | - depends on IMX_DSP |
11271 | + select IMX_DSP |
11272 | help |
11273 | This adds support for Sound Open Firmware for NXP i.MX8 platforms |
11274 | Say Y if you have such a device. |
11275 | diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c |
11276 | index 3d128e5a132c..ea0fe9a09f3f 100644 |
11277 | --- a/sound/soc/sof/nocodec.c |
11278 | +++ b/sound/soc/sof/nocodec.c |
11279 | @@ -52,8 +52,10 @@ static int sof_nocodec_bes_setup(struct device *dev, |
11280 | links[i].platforms->name = dev_name(dev); |
11281 | links[i].codecs->dai_name = "snd-soc-dummy-dai"; |
11282 | links[i].codecs->name = "snd-soc-dummy"; |
11283 | - links[i].dpcm_playback = 1; |
11284 | - links[i].dpcm_capture = 1; |
11285 | + if (ops->drv[i].playback.channels_min) |
11286 | + links[i].dpcm_playback = 1; |
11287 | + if (ops->drv[i].capture.channels_min) |
11288 | + links[i].dpcm_capture = 1; |
11289 | } |
11290 | |
11291 | card->dai_link = links; |
11292 | diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c |
11293 | index 195af259e78e..128680b09c20 100644 |
11294 | --- a/sound/soc/sof/pm.c |
11295 | +++ b/sound/soc/sof/pm.c |
11296 | @@ -266,7 +266,10 @@ static int sof_resume(struct device *dev, bool runtime_resume) |
11297 | int ret; |
11298 | |
11299 | /* do nothing if dsp resume callbacks are not set */ |
11300 | - if (!sof_ops(sdev)->resume || !sof_ops(sdev)->runtime_resume) |
11301 | + if (!runtime_resume && !sof_ops(sdev)->resume) |
11302 | + return 0; |
11303 | + |
11304 | + if (runtime_resume && !sof_ops(sdev)->runtime_resume) |
11305 | return 0; |
11306 | |
11307 | /* DSP was never successfully started, nothing to resume */ |
11308 | @@ -346,7 +349,10 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) |
11309 | int ret; |
11310 | |
11311 | /* do nothing if dsp suspend callback is not set */ |
11312 | - if (!sof_ops(sdev)->suspend) |
11313 | + if (!runtime_suspend && !sof_ops(sdev)->suspend) |
11314 | + return 0; |
11315 | + |
11316 | + if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) |
11317 | return 0; |
11318 | |
11319 | if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) |
11320 | diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c |
11321 | index 6211dfda2195..0fa01cacfec9 100644 |
11322 | --- a/sound/soc/tegra/tegra_wm8903.c |
11323 | +++ b/sound/soc/tegra/tegra_wm8903.c |
11324 | @@ -159,6 +159,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) |
11325 | struct snd_soc_component *component = codec_dai->component; |
11326 | struct snd_soc_card *card = rtd->card; |
11327 | struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
11328 | + int shrt = 0; |
11329 | |
11330 | if (gpio_is_valid(machine->gpio_hp_det)) { |
11331 | tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; |
11332 | @@ -171,12 +172,15 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) |
11333 | &tegra_wm8903_hp_jack_gpio); |
11334 | } |
11335 | |
11336 | + if (of_property_read_bool(card->dev->of_node, "nvidia,headset")) |
11337 | + shrt = SND_JACK_MICROPHONE; |
11338 | + |
11339 | snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, |
11340 | &tegra_wm8903_mic_jack, |
11341 | tegra_wm8903_mic_jack_pins, |
11342 | ARRAY_SIZE(tegra_wm8903_mic_jack_pins)); |
11343 | wm8903_mic_detect(component, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, |
11344 | - 0); |
11345 | + shrt); |
11346 | |
11347 | snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS"); |
11348 | |
11349 | diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c |
11350 | index 7aa3c32e4a49..0541071f454b 100644 |
11351 | --- a/sound/soc/ti/davinci-mcasp.c |
11352 | +++ b/sound/soc/ti/davinci-mcasp.c |
11353 | @@ -1875,8 +1875,10 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) |
11354 | PTR_ERR(chan)); |
11355 | return PTR_ERR(chan); |
11356 | } |
11357 | - if (WARN_ON(!chan->device || !chan->device->dev)) |
11358 | + if (WARN_ON(!chan->device || !chan->device->dev)) { |
11359 | + dma_release_channel(chan); |
11360 | return -EINVAL; |
11361 | + } |
11362 | |
11363 | if (chan->device->dev->of_node) |
11364 | ret = of_property_read_string(chan->device->dev->of_node, |
11365 | diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c |
11366 | index 26b503bbdb5f..3273b317fa3b 100644 |
11367 | --- a/sound/soc/ti/omap-mcbsp.c |
11368 | +++ b/sound/soc/ti/omap-mcbsp.c |
11369 | @@ -686,7 +686,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
11370 | mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, |
11371 | SNDRV_PCM_STREAM_CAPTURE); |
11372 | |
11373 | - mcbsp->fclk = clk_get(&pdev->dev, "fck"); |
11374 | + mcbsp->fclk = devm_clk_get(&pdev->dev, "fck"); |
11375 | if (IS_ERR(mcbsp->fclk)) { |
11376 | ret = PTR_ERR(mcbsp->fclk); |
11377 | dev_err(mcbsp->dev, "unable to get fck: %d\n", ret); |
11378 | @@ -711,7 +711,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
11379 | if (ret) { |
11380 | dev_err(mcbsp->dev, |
11381 | "Unable to create additional controls\n"); |
11382 | - goto err_thres; |
11383 | + return ret; |
11384 | } |
11385 | } |
11386 | |
11387 | @@ -724,8 +724,6 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
11388 | err_st: |
11389 | if (mcbsp->pdata->buffer_size) |
11390 | sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); |
11391 | -err_thres: |
11392 | - clk_put(mcbsp->fclk); |
11393 | return ret; |
11394 | } |
11395 | |
11396 | @@ -1442,8 +1440,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev) |
11397 | |
11398 | omap_mcbsp_st_cleanup(pdev); |
11399 | |
11400 | - clk_put(mcbsp->fclk); |
11401 | - |
11402 | return 0; |
11403 | } |
11404 | |
11405 | diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c |
11406 | index 2873e8e6f02b..cdae1190b930 100644 |
11407 | --- a/sound/soc/ux500/mop500.c |
11408 | +++ b/sound/soc/ux500/mop500.c |
11409 | @@ -63,10 +63,11 @@ static void mop500_of_node_put(void) |
11410 | { |
11411 | int i; |
11412 | |
11413 | - for (i = 0; i < 2; i++) { |
11414 | + for (i = 0; i < 2; i++) |
11415 | of_node_put(mop500_dai_links[i].cpus->of_node); |
11416 | - of_node_put(mop500_dai_links[i].codecs->of_node); |
11417 | - } |
11418 | + |
11419 | + /* Both links use the same codec, which is refcounted only once */ |
11420 | + of_node_put(mop500_dai_links[0].codecs->of_node); |
11421 | } |
11422 | |
11423 | static int mop500_of_probe(struct platform_device *pdev, |
11424 | @@ -81,7 +82,9 @@ static int mop500_of_probe(struct platform_device *pdev, |
11425 | |
11426 | if (!(msp_np[0] && msp_np[1] && codec_np)) { |
11427 | dev_err(&pdev->dev, "Phandle missing or invalid\n"); |
11428 | - mop500_of_node_put(); |
11429 | + for (i = 0; i < 2; i++) |
11430 | + of_node_put(msp_np[i]); |
11431 | + of_node_put(codec_np); |
11432 | return -EINVAL; |
11433 | } |
11434 | |
11435 | diff --git a/sound/usb/card.h b/sound/usb/card.h |
11436 | index 395403a2d33f..d6219fba9699 100644 |
11437 | --- a/sound/usb/card.h |
11438 | +++ b/sound/usb/card.h |
11439 | @@ -84,6 +84,10 @@ struct snd_usb_endpoint { |
11440 | dma_addr_t sync_dma; /* DMA address of syncbuf */ |
11441 | |
11442 | unsigned int pipe; /* the data i/o pipe */ |
11443 | + unsigned int framesize[2]; /* small/large frame sizes in samples */ |
11444 | + unsigned int sample_rem; /* remainder from division fs/fps */ |
11445 | + unsigned int sample_accum; /* sample accumulator */ |
11446 | + unsigned int fps; /* frames per second */ |
11447 | unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ |
11448 | unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ |
11449 | int freqshift; /* how much to shift the feedback value to get Q16.16 */ |
11450 | @@ -104,6 +108,7 @@ struct snd_usb_endpoint { |
11451 | int iface, altsetting; |
11452 | int skip_packets; /* quirks for devices to ignore the first n packets |
11453 | in a stream */ |
11454 | + bool is_implicit_feedback; /* This endpoint is used as implicit feedback */ |
11455 | |
11456 | spinlock_t lock; |
11457 | struct list_head list; |
11458 | diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c |
11459 | index 4a9a2f6ef5a4..9bea7d3f99f8 100644 |
11460 | --- a/sound/usb/endpoint.c |
11461 | +++ b/sound/usb/endpoint.c |
11462 | @@ -124,12 +124,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep) |
11463 | |
11464 | /* |
11465 | * For streaming based on information derived from sync endpoints, |
11466 | - * prepare_outbound_urb_sizes() will call next_packet_size() to |
11467 | + * prepare_outbound_urb_sizes() will call slave_next_packet_size() to |
11468 | * determine the number of samples to be sent in the next packet. |
11469 | * |
11470 | - * For implicit feedback, next_packet_size() is unused. |
11471 | + * For implicit feedback, slave_next_packet_size() is unused. |
11472 | */ |
11473 | -int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
11474 | +int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep) |
11475 | { |
11476 | unsigned long flags; |
11477 | int ret; |
11478 | @@ -146,6 +146,29 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
11479 | return ret; |
11480 | } |
11481 | |
11482 | +/* |
11483 | + * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes() |
11484 | + * will call next_packet_size() to determine the number of samples to be |
11485 | + * sent in the next packet. |
11486 | + */ |
11487 | +int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
11488 | +{ |
11489 | + int ret; |
11490 | + |
11491 | + if (ep->fill_max) |
11492 | + return ep->maxframesize; |
11493 | + |
11494 | + ep->sample_accum += ep->sample_rem; |
11495 | + if (ep->sample_accum >= ep->fps) { |
11496 | + ep->sample_accum -= ep->fps; |
11497 | + ret = ep->framesize[1]; |
11498 | + } else { |
11499 | + ret = ep->framesize[0]; |
11500 | + } |
11501 | + |
11502 | + return ret; |
11503 | +} |
11504 | + |
11505 | static void retire_outbound_urb(struct snd_usb_endpoint *ep, |
11506 | struct snd_urb_ctx *urb_ctx) |
11507 | { |
11508 | @@ -190,6 +213,8 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep, |
11509 | |
11510 | if (ctx->packet_size[i]) |
11511 | counts = ctx->packet_size[i]; |
11512 | + else if (ep->sync_master) |
11513 | + counts = snd_usb_endpoint_slave_next_packet_size(ep); |
11514 | else |
11515 | counts = snd_usb_endpoint_next_packet_size(ep); |
11516 | |
11517 | @@ -321,17 +346,17 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep) |
11518 | ep->next_packet_read_pos %= MAX_URBS; |
11519 | |
11520 | /* take URB out of FIFO */ |
11521 | - if (!list_empty(&ep->ready_playback_urbs)) |
11522 | + if (!list_empty(&ep->ready_playback_urbs)) { |
11523 | ctx = list_first_entry(&ep->ready_playback_urbs, |
11524 | struct snd_urb_ctx, ready_list); |
11525 | + list_del_init(&ctx->ready_list); |
11526 | + } |
11527 | } |
11528 | spin_unlock_irqrestore(&ep->lock, flags); |
11529 | |
11530 | if (ctx == NULL) |
11531 | return; |
11532 | |
11533 | - list_del_init(&ctx->ready_list); |
11534 | - |
11535 | /* copy over the length information */ |
11536 | for (i = 0; i < packet->packets; i++) |
11537 | ctx->packet_size[i] = packet->packet_size[i]; |
11538 | @@ -497,6 +522,8 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, |
11539 | |
11540 | list_add_tail(&ep->list, &chip->ep_list); |
11541 | |
11542 | + ep->is_implicit_feedback = 0; |
11543 | + |
11544 | __exit_unlock: |
11545 | mutex_unlock(&chip->mutex); |
11546 | |
11547 | @@ -596,6 +623,178 @@ static void release_urbs(struct snd_usb_endpoint *ep, int force) |
11548 | ep->nurbs = 0; |
11549 | } |
11550 | |
11551 | +/* |
11552 | + * Check data endpoint for format differences |
11553 | + */ |
11554 | +static bool check_ep_params(struct snd_usb_endpoint *ep, |
11555 | + snd_pcm_format_t pcm_format, |
11556 | + unsigned int channels, |
11557 | + unsigned int period_bytes, |
11558 | + unsigned int frames_per_period, |
11559 | + unsigned int periods_per_buffer, |
11560 | + struct audioformat *fmt, |
11561 | + struct snd_usb_endpoint *sync_ep) |
11562 | +{ |
11563 | + unsigned int maxsize, minsize, packs_per_ms, max_packs_per_urb; |
11564 | + unsigned int max_packs_per_period, urbs_per_period, urb_packs; |
11565 | + unsigned int max_urbs; |
11566 | + int frame_bits = snd_pcm_format_physical_width(pcm_format) * channels; |
11567 | + int tx_length_quirk = (ep->chip->tx_length_quirk && |
11568 | + usb_pipeout(ep->pipe)); |
11569 | + bool ret = 1; |
11570 | + |
11571 | + if (pcm_format == SNDRV_PCM_FORMAT_DSD_U16_LE && fmt->dsd_dop) { |
11572 | + /* |
11573 | + * When operating in DSD DOP mode, the size of a sample frame |
11574 | + * in hardware differs from the actual physical format width |
11575 | + * because we need to make room for the DOP markers. |
11576 | + */ |
11577 | + frame_bits += channels << 3; |
11578 | + } |
11579 | + |
11580 | + ret = ret && (ep->datainterval == fmt->datainterval); |
11581 | + ret = ret && (ep->stride == frame_bits >> 3); |
11582 | + |
11583 | + switch (pcm_format) { |
11584 | + case SNDRV_PCM_FORMAT_U8: |
11585 | + ret = ret && (ep->silence_value == 0x80); |
11586 | + break; |
11587 | + case SNDRV_PCM_FORMAT_DSD_U8: |
11588 | + case SNDRV_PCM_FORMAT_DSD_U16_LE: |
11589 | + case SNDRV_PCM_FORMAT_DSD_U32_LE: |
11590 | + case SNDRV_PCM_FORMAT_DSD_U16_BE: |
11591 | + case SNDRV_PCM_FORMAT_DSD_U32_BE: |
11592 | + ret = ret && (ep->silence_value == 0x69); |
11593 | + break; |
11594 | + default: |
11595 | + ret = ret && (ep->silence_value == 0); |
11596 | + } |
11597 | + |
11598 | + /* assume max. frequency is 50% higher than nominal */ |
11599 | + ret = ret && (ep->freqmax == ep->freqn + (ep->freqn >> 1)); |
11600 | + /* Round up freqmax to nearest integer in order to calculate maximum |
11601 | + * packet size, which must represent a whole number of frames. |
11602 | + * This is accomplished by adding 0x0.ffff before converting the |
11603 | + * Q16.16 format into integer. |
11604 | + * In order to accurately calculate the maximum packet size when |
11605 | + * the data interval is more than 1 (i.e. ep->datainterval > 0), |
11606 | + * multiply by the data interval prior to rounding. For instance, |
11607 | + * a freqmax of 41 kHz will result in a max packet size of 6 (5.125) |
11608 | + * frames with a data interval of 1, but 11 (10.25) frames with a |
11609 | + * data interval of 2. |
11610 | + * (ep->freqmax << ep->datainterval overflows at 8.192 MHz for the |
11611 | + * maximum datainterval value of 3, at USB full speed, higher for |
11612 | + * USB high speed, noting that ep->freqmax is in units of |
11613 | + * frames per packet in Q16.16 format.) |
11614 | + */ |
11615 | + maxsize = (((ep->freqmax << ep->datainterval) + 0xffff) >> 16) * |
11616 | + (frame_bits >> 3); |
11617 | + if (tx_length_quirk) |
11618 | + maxsize += sizeof(__le32); /* Space for length descriptor */ |
11619 | + /* but wMaxPacketSize might reduce this */ |
11620 | + if (ep->maxpacksize && ep->maxpacksize < maxsize) { |
11621 | + /* whatever fits into a max. size packet */ |
11622 | + unsigned int data_maxsize = maxsize = ep->maxpacksize; |
11623 | + |
11624 | + if (tx_length_quirk) |
11625 | + /* Need to remove the length descriptor to calc freq */ |
11626 | + data_maxsize -= sizeof(__le32); |
11627 | + ret = ret && (ep->freqmax == (data_maxsize / (frame_bits >> 3)) |
11628 | + << (16 - ep->datainterval)); |
11629 | + } |
11630 | + |
11631 | + if (ep->fill_max) |
11632 | + ret = ret && (ep->curpacksize == ep->maxpacksize); |
11633 | + else |
11634 | + ret = ret && (ep->curpacksize == maxsize); |
11635 | + |
11636 | + if (snd_usb_get_speed(ep->chip->dev) != USB_SPEED_FULL) { |
11637 | + packs_per_ms = 8 >> ep->datainterval; |
11638 | + max_packs_per_urb = MAX_PACKS_HS; |
11639 | + } else { |
11640 | + packs_per_ms = 1; |
11641 | + max_packs_per_urb = MAX_PACKS; |
11642 | + } |
11643 | + if (sync_ep && !snd_usb_endpoint_implicit_feedback_sink(ep)) |
11644 | + max_packs_per_urb = min(max_packs_per_urb, |
11645 | + 1U << sync_ep->syncinterval); |
11646 | + max_packs_per_urb = max(1u, max_packs_per_urb >> ep->datainterval); |
11647 | + |
11648 | + /* |
11649 | + * Capture endpoints need to use small URBs because there's no way |
11650 | + * to tell in advance where the next period will end, and we don't |
11651 | + * want the next URB to complete much after the period ends. |
11652 | + * |
11653 | + * Playback endpoints with implicit sync much use the same parameters |
11654 | + * as their corresponding capture endpoint. |
11655 | + */ |
11656 | + if (usb_pipein(ep->pipe) || |
11657 | + snd_usb_endpoint_implicit_feedback_sink(ep)) { |
11658 | + |
11659 | + urb_packs = packs_per_ms; |
11660 | + /* |
11661 | + * Wireless devices can poll at a max rate of once per 4ms. |
11662 | + * For dataintervals less than 5, increase the packet count to |
11663 | + * allow the host controller to use bursting to fill in the |
11664 | + * gaps. |
11665 | + */ |
11666 | + if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_WIRELESS) { |
11667 | + int interval = ep->datainterval; |
11668 | + |
11669 | + while (interval < 5) { |
11670 | + urb_packs <<= 1; |
11671 | + ++interval; |
11672 | + } |
11673 | + } |
11674 | + /* make capture URBs <= 1 ms and smaller than a period */ |
11675 | + urb_packs = min(max_packs_per_urb, urb_packs); |
11676 | + while (urb_packs > 1 && urb_packs * maxsize >= period_bytes) |
11677 | + urb_packs >>= 1; |
11678 | + ret = ret && (ep->nurbs == MAX_URBS); |
11679 | + |
11680 | + /* |
11681 | + * Playback endpoints without implicit sync are adjusted so that |
11682 | + * a period fits as evenly as possible in the smallest number of |
11683 | + * URBs. The total number of URBs is adjusted to the size of the |
11684 | + * ALSA buffer, subject to the MAX_URBS and MAX_QUEUE limits. |
11685 | + */ |
11686 | + } else { |
11687 | + /* determine how small a packet can be */ |
11688 | + minsize = (ep->freqn >> (16 - ep->datainterval)) * |
11689 | + (frame_bits >> 3); |
11690 | + /* with sync from device, assume it can be 12% lower */ |
11691 | + if (sync_ep) |
11692 | + minsize -= minsize >> 3; |
11693 | + minsize = max(minsize, 1u); |
11694 | + |
11695 | + /* how many packets will contain an entire ALSA period? */ |
11696 | + max_packs_per_period = DIV_ROUND_UP(period_bytes, minsize); |
11697 | + |
11698 | + /* how many URBs will contain a period? */ |
11699 | + urbs_per_period = DIV_ROUND_UP(max_packs_per_period, |
11700 | + max_packs_per_urb); |
11701 | + /* how many packets are needed in each URB? */ |
11702 | + urb_packs = DIV_ROUND_UP(max_packs_per_period, urbs_per_period); |
11703 | + |
11704 | + /* limit the number of frames in a single URB */ |
11705 | + ret = ret && (ep->max_urb_frames == |
11706 | + DIV_ROUND_UP(frames_per_period, urbs_per_period)); |
11707 | + |
11708 | + /* try to use enough URBs to contain an entire ALSA buffer */ |
11709 | + max_urbs = min((unsigned) MAX_URBS, |
11710 | + MAX_QUEUE * packs_per_ms / urb_packs); |
11711 | + ret = ret && (ep->nurbs == min(max_urbs, |
11712 | + urbs_per_period * periods_per_buffer)); |
11713 | + } |
11714 | + |
11715 | + ret = ret && (ep->datainterval == fmt->datainterval); |
11716 | + ret = ret && (ep->maxpacksize == fmt->maxpacksize); |
11717 | + ret = ret && |
11718 | + (ep->fill_max == !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX)); |
11719 | + |
11720 | + return ret; |
11721 | +} |
11722 | + |
11723 | /* |
11724 | * configure a data endpoint |
11725 | */ |
11726 | @@ -861,10 +1060,23 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
11727 | int err; |
11728 | |
11729 | if (ep->use_count != 0) { |
11730 | - usb_audio_warn(ep->chip, |
11731 | - "Unable to change format on ep #%x: already in use\n", |
11732 | - ep->ep_num); |
11733 | - return -EBUSY; |
11734 | + bool check = ep->is_implicit_feedback && |
11735 | + check_ep_params(ep, pcm_format, |
11736 | + channels, period_bytes, |
11737 | + period_frames, buffer_periods, |
11738 | + fmt, sync_ep); |
11739 | + |
11740 | + if (!check) { |
11741 | + usb_audio_warn(ep->chip, |
11742 | + "Unable to change format on ep #%x: already in use\n", |
11743 | + ep->ep_num); |
11744 | + return -EBUSY; |
11745 | + } |
11746 | + |
11747 | + usb_audio_dbg(ep->chip, |
11748 | + "Ep #%x already in use as implicit feedback but format not changed\n", |
11749 | + ep->ep_num); |
11750 | + return 0; |
11751 | } |
11752 | |
11753 | /* release old buffers, if any */ |
11754 | @@ -874,10 +1086,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
11755 | ep->maxpacksize = fmt->maxpacksize; |
11756 | ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX); |
11757 | |
11758 | - if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) |
11759 | + if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) { |
11760 | ep->freqn = get_usb_full_speed_rate(rate); |
11761 | - else |
11762 | + ep->fps = 1000; |
11763 | + } else { |
11764 | ep->freqn = get_usb_high_speed_rate(rate); |
11765 | + ep->fps = 8000; |
11766 | + } |
11767 | + |
11768 | + ep->sample_rem = rate % ep->fps; |
11769 | + ep->framesize[0] = rate / ep->fps; |
11770 | + ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps; |
11771 | |
11772 | /* calculate the frequency in 16.16 format */ |
11773 | ep->freqm = ep->freqn; |
11774 | @@ -936,6 +1155,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) |
11775 | ep->active_mask = 0; |
11776 | ep->unlink_mask = 0; |
11777 | ep->phase = 0; |
11778 | + ep->sample_accum = 0; |
11779 | |
11780 | snd_usb_endpoint_start_quirk(ep); |
11781 | |
11782 | diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h |
11783 | index 63a39d4fa8d8..d23fa0a8c11b 100644 |
11784 | --- a/sound/usb/endpoint.h |
11785 | +++ b/sound/usb/endpoint.h |
11786 | @@ -28,6 +28,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep); |
11787 | void snd_usb_endpoint_free(struct snd_usb_endpoint *ep); |
11788 | |
11789 | int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); |
11790 | +int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep); |
11791 | int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep); |
11792 | |
11793 | void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, |
11794 | diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
11795 | index ad8f38380aa3..6c391e5fad2a 100644 |
11796 | --- a/sound/usb/pcm.c |
11797 | +++ b/sound/usb/pcm.c |
11798 | @@ -386,6 +386,8 @@ add_sync_ep: |
11799 | if (!subs->sync_endpoint) |
11800 | return -EINVAL; |
11801 | |
11802 | + subs->sync_endpoint->is_implicit_feedback = 1; |
11803 | + |
11804 | subs->data_endpoint->sync_master = subs->sync_endpoint; |
11805 | |
11806 | return 1; |
11807 | @@ -484,12 +486,15 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, |
11808 | implicit_fb ? |
11809 | SND_USB_ENDPOINT_TYPE_DATA : |
11810 | SND_USB_ENDPOINT_TYPE_SYNC); |
11811 | + |
11812 | if (!subs->sync_endpoint) { |
11813 | if (is_playback && attr == USB_ENDPOINT_SYNC_NONE) |
11814 | return 0; |
11815 | return -EINVAL; |
11816 | } |
11817 | |
11818 | + subs->sync_endpoint->is_implicit_feedback = implicit_fb; |
11819 | + |
11820 | subs->data_endpoint->sync_master = subs->sync_endpoint; |
11821 | |
11822 | return 0; |
11823 | @@ -1575,6 +1580,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, |
11824 | for (i = 0; i < ctx->packets; i++) { |
11825 | if (ctx->packet_size[i]) |
11826 | counts = ctx->packet_size[i]; |
11827 | + else if (ep->sync_master) |
11828 | + counts = snd_usb_endpoint_slave_next_packet_size(ep); |
11829 | else |
11830 | counts = snd_usb_endpoint_next_packet_size(ep); |
11831 | |
11832 | diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c |
11833 | index 87f27e2664c5..d9e386b8f47e 100644 |
11834 | --- a/tools/lib/bpf/btf_dump.c |
11835 | +++ b/tools/lib/bpf/btf_dump.c |
11836 | @@ -1141,6 +1141,20 @@ static void btf_dump_emit_mods(struct btf_dump *d, struct id_stack *decl_stack) |
11837 | } |
11838 | } |
11839 | |
11840 | +static void btf_dump_drop_mods(struct btf_dump *d, struct id_stack *decl_stack) |
11841 | +{ |
11842 | + const struct btf_type *t; |
11843 | + __u32 id; |
11844 | + |
11845 | + while (decl_stack->cnt) { |
11846 | + id = decl_stack->ids[decl_stack->cnt - 1]; |
11847 | + t = btf__type_by_id(d->btf, id); |
11848 | + if (!btf_is_mod(t)) |
11849 | + return; |
11850 | + decl_stack->cnt--; |
11851 | + } |
11852 | +} |
11853 | + |
11854 | static void btf_dump_emit_name(const struct btf_dump *d, |
11855 | const char *name, bool last_was_ptr) |
11856 | { |
11857 | @@ -1239,14 +1253,7 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, |
11858 | * a const/volatile modifier for array, so we are |
11859 | * going to silently skip them here. |
11860 | */ |
11861 | - while (decls->cnt) { |
11862 | - next_id = decls->ids[decls->cnt - 1]; |
11863 | - next_t = btf__type_by_id(d->btf, next_id); |
11864 | - if (btf_is_mod(next_t)) |
11865 | - decls->cnt--; |
11866 | - else |
11867 | - break; |
11868 | - } |
11869 | + btf_dump_drop_mods(d, decls); |
11870 | |
11871 | if (decls->cnt == 0) { |
11872 | btf_dump_emit_name(d, fname, last_was_ptr); |
11873 | @@ -1274,7 +1281,15 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, |
11874 | __u16 vlen = btf_vlen(t); |
11875 | int i; |
11876 | |
11877 | - btf_dump_emit_mods(d, decls); |
11878 | + /* |
11879 | + * GCC emits extra volatile qualifier for |
11880 | + * __attribute__((noreturn)) function pointers. Clang |
11881 | + * doesn't do it. It's a GCC quirk for backwards |
11882 | + * compatibility with code written for GCC <2.5. So, |
11883 | + * similarly to extra qualifiers for array, just drop |
11884 | + * them, instead of handling them. |
11885 | + */ |
11886 | + btf_dump_drop_mods(d, decls); |
11887 | if (decls->cnt) { |
11888 | btf_dump_printf(d, " ("); |
11889 | btf_dump_emit_type_chain(d, decls, fname, lvl); |
11890 | diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c |
11891 | index 4d8db41b949a..d3c0b04e2e22 100644 |
11892 | --- a/tools/perf/builtin-report.c |
11893 | +++ b/tools/perf/builtin-report.c |
11894 | @@ -462,8 +462,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report |
11895 | if (rep->time_str) |
11896 | ret += fprintf(fp, " (time slices: %s)", rep->time_str); |
11897 | |
11898 | - if (symbol_conf.show_ref_callgraph && |
11899 | - strstr(evname, "call-graph=no")) { |
11900 | + if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) { |
11901 | ret += fprintf(fp, ", show reference callgraph"); |
11902 | } |
11903 | |
11904 | diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c |
11905 | index ed3b0ac2f785..373e399e57d2 100644 |
11906 | --- a/tools/perf/util/stat-display.c |
11907 | +++ b/tools/perf/util/stat-display.c |
11908 | @@ -661,7 +661,7 @@ static void print_aggr(struct perf_stat_config *config, |
11909 | int s; |
11910 | bool first; |
11911 | |
11912 | - if (!(config->aggr_map || config->aggr_get_id)) |
11913 | + if (!config->aggr_map || !config->aggr_get_id) |
11914 | return; |
11915 | |
11916 | aggr_update_shadow(config, evlist); |
11917 | @@ -1140,7 +1140,7 @@ static void print_percore(struct perf_stat_config *config, |
11918 | int s; |
11919 | bool first = true; |
11920 | |
11921 | - if (!(config->aggr_map || config->aggr_get_id)) |
11922 | + if (!config->aggr_map || !config->aggr_get_id) |
11923 | return; |
11924 | |
11925 | for (s = 0; s < config->aggr_map->nr; s++) { |
11926 | diff --git a/tools/testing/selftests/networking/timestamping/timestamping.c b/tools/testing/selftests/networking/timestamping/timestamping.c |
11927 | index aca3491174a1..f4bb4fef0f39 100644 |
11928 | --- a/tools/testing/selftests/networking/timestamping/timestamping.c |
11929 | +++ b/tools/testing/selftests/networking/timestamping/timestamping.c |
11930 | @@ -313,10 +313,16 @@ int main(int argc, char **argv) |
11931 | int val; |
11932 | socklen_t len; |
11933 | struct timeval next; |
11934 | + size_t if_len; |
11935 | |
11936 | if (argc < 2) |
11937 | usage(0); |
11938 | interface = argv[1]; |
11939 | + if_len = strlen(interface); |
11940 | + if (if_len >= IFNAMSIZ) { |
11941 | + printf("interface name exceeds IFNAMSIZ\n"); |
11942 | + exit(1); |
11943 | + } |
11944 | |
11945 | for (i = 2; i < argc; i++) { |
11946 | if (!strcasecmp(argv[i], "SO_TIMESTAMP")) |
11947 | @@ -350,12 +356,12 @@ int main(int argc, char **argv) |
11948 | bail("socket"); |
11949 | |
11950 | memset(&device, 0, sizeof(device)); |
11951 | - strncpy(device.ifr_name, interface, sizeof(device.ifr_name)); |
11952 | + memcpy(device.ifr_name, interface, if_len + 1); |
11953 | if (ioctl(sock, SIOCGIFADDR, &device) < 0) |
11954 | bail("getting interface IP address"); |
11955 | |
11956 | memset(&hwtstamp, 0, sizeof(hwtstamp)); |
11957 | - strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name)); |
11958 | + memcpy(hwtstamp.ifr_name, interface, if_len + 1); |
11959 | hwtstamp.ifr_data = (void *)&hwconfig; |
11960 | memset(&hwconfig, 0, sizeof(hwconfig)); |
11961 | hwconfig.tx_type = |
11962 | diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh |
11963 | index 9c60337317c6..020137b61407 100755 |
11964 | --- a/tools/testing/selftests/ntb/ntb_test.sh |
11965 | +++ b/tools/testing/selftests/ntb/ntb_test.sh |
11966 | @@ -241,7 +241,7 @@ function get_files_count() |
11967 | split_remote $LOC |
11968 | |
11969 | if [[ "$REMOTE" == "" ]]; then |
11970 | - echo $(ls -1 "$LOC"/${NAME}* 2>/dev/null | wc -l) |
11971 | + echo $(ls -1 "$VPATH"/${NAME}* 2>/dev/null | wc -l) |
11972 | else |
11973 | echo $(ssh "$REMOTE" "ls -1 \"$VPATH\"/${NAME}* | \ |
11974 | wc -l" 2> /dev/null) |
11975 | diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c |
11976 | index 480995bceefa..47191af46617 100644 |
11977 | --- a/tools/testing/selftests/x86/protection_keys.c |
11978 | +++ b/tools/testing/selftests/x86/protection_keys.c |
11979 | @@ -24,6 +24,7 @@ |
11980 | #define _GNU_SOURCE |
11981 | #include <errno.h> |
11982 | #include <linux/futex.h> |
11983 | +#include <time.h> |
11984 | #include <sys/time.h> |
11985 | #include <sys/syscall.h> |
11986 | #include <string.h> |
11987 | @@ -612,10 +613,10 @@ int alloc_random_pkey(void) |
11988 | int nr_alloced = 0; |
11989 | int random_index; |
11990 | memset(alloced_pkeys, 0, sizeof(alloced_pkeys)); |
11991 | + srand((unsigned int)time(NULL)); |
11992 | |
11993 | /* allocate every possible key and make a note of which ones we got */ |
11994 | max_nr_pkey_allocs = NR_PKEYS; |
11995 | - max_nr_pkey_allocs = 1; |
11996 | for (i = 0; i < max_nr_pkey_allocs; i++) { |
11997 | int new_pkey = alloc_pkey(); |
11998 | if (new_pkey < 0) |