1 |
commit: 29791b6c4491908c9c633785b7b2c4438caea4fb |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 3 12:52:34 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 3 12:52:34 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=29791b6c |
7 |
|
8 |
Remove incorrect patch, add correct one |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
1005_linux-5.7.6.patch | 20870 ----------------------------------------------- |
13 |
1005_linux-5.8.6.patch | 11789 ++++++++++++++++++++++++++ |
14 |
2 files changed, 11789 insertions(+), 20870 deletions(-) |
15 |
|
16 |
diff --git a/1005_linux-5.7.6.patch b/1005_linux-5.7.6.patch |
17 |
deleted file mode 100644 |
18 |
index 9939e08..0000000 |
19 |
--- a/1005_linux-5.7.6.patch |
20 |
+++ /dev/null |
21 |
@@ -1,20870 +0,0 @@ |
22 |
-diff --git a/Makefile b/Makefile |
23 |
-index c48d489f82bc..f928cd1dfdc1 100644 |
24 |
---- a/Makefile |
25 |
-+++ b/Makefile |
26 |
-@@ -1,7 +1,7 @@ |
27 |
- # SPDX-License-Identifier: GPL-2.0 |
28 |
- VERSION = 5 |
29 |
- PATCHLEVEL = 7 |
30 |
--SUBLEVEL = 5 |
31 |
-+SUBLEVEL = 6 |
32 |
- EXTRAVERSION = |
33 |
- NAME = Kleptomaniac Octopus |
34 |
- |
35 |
-diff --git a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
36 |
-index 5d7cbd9164d4..669980c690f9 100644 |
37 |
---- a/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
38 |
-+++ b/arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts |
39 |
-@@ -112,13 +112,13 @@ |
40 |
- &kcs2 { |
41 |
- // BMC KCS channel 2 |
42 |
- status = "okay"; |
43 |
-- kcs_addr = <0xca8>; |
44 |
-+ aspeed,lpc-io-reg = <0xca8>; |
45 |
- }; |
46 |
- |
47 |
- &kcs3 { |
48 |
- // BMC KCS channel 3 |
49 |
- status = "okay"; |
50 |
-- kcs_addr = <0xca2>; |
51 |
-+ aspeed,lpc-io-reg = <0xca2>; |
52 |
- }; |
53 |
- |
54 |
- &mac0 { |
55 |
-diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi |
56 |
-index f12ec04d3cbc..bc92d3db7b78 100644 |
57 |
---- a/arch/arm/boot/dts/aspeed-g5.dtsi |
58 |
-+++ b/arch/arm/boot/dts/aspeed-g5.dtsi |
59 |
-@@ -426,22 +426,22 @@ |
60 |
- #size-cells = <1>; |
61 |
- ranges = <0x0 0x0 0x80>; |
62 |
- |
63 |
-- kcs1: kcs1@0 { |
64 |
-- compatible = "aspeed,ast2500-kcs-bmc"; |
65 |
-+ kcs1: kcs@24 { |
66 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
67 |
-+ reg = <0x24 0x1>, <0x30 0x1>, <0x3c 0x1>; |
68 |
- interrupts = <8>; |
69 |
-- kcs_chan = <1>; |
70 |
- status = "disabled"; |
71 |
- }; |
72 |
-- kcs2: kcs2@0 { |
73 |
-- compatible = "aspeed,ast2500-kcs-bmc"; |
74 |
-+ kcs2: kcs@28 { |
75 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
76 |
-+ reg = <0x28 0x1>, <0x34 0x1>, <0x40 0x1>; |
77 |
- interrupts = <8>; |
78 |
-- kcs_chan = <2>; |
79 |
- status = "disabled"; |
80 |
- }; |
81 |
-- kcs3: kcs3@0 { |
82 |
-- compatible = "aspeed,ast2500-kcs-bmc"; |
83 |
-+ kcs3: kcs@2c { |
84 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
85 |
-+ reg = <0x2c 0x1>, <0x38 0x1>, <0x44 0x1>; |
86 |
- interrupts = <8>; |
87 |
-- kcs_chan = <3>; |
88 |
- status = "disabled"; |
89 |
- }; |
90 |
- }; |
91 |
-@@ -455,10 +455,10 @@ |
92 |
- #size-cells = <1>; |
93 |
- ranges = <0x0 0x80 0x1e0>; |
94 |
- |
95 |
-- kcs4: kcs4@0 { |
96 |
-- compatible = "aspeed,ast2500-kcs-bmc"; |
97 |
-+ kcs4: kcs@94 { |
98 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
99 |
-+ reg = <0x94 0x1>, <0x98 0x1>, <0x9c 0x1>; |
100 |
- interrupts = <8>; |
101 |
-- kcs_chan = <4>; |
102 |
- status = "disabled"; |
103 |
- }; |
104 |
- |
105 |
-diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi |
106 |
-index 0a29b3b57a9d..a2d2ac720a51 100644 |
107 |
---- a/arch/arm/boot/dts/aspeed-g6.dtsi |
108 |
-+++ b/arch/arm/boot/dts/aspeed-g6.dtsi |
109 |
-@@ -65,6 +65,7 @@ |
110 |
- <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
111 |
- clocks = <&syscon ASPEED_CLK_HPLL>; |
112 |
- arm,cpu-registers-not-fw-configured; |
113 |
-+ always-on; |
114 |
- }; |
115 |
- |
116 |
- ahb { |
117 |
-@@ -368,6 +369,7 @@ |
118 |
- <&gic GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; |
119 |
- clocks = <&syscon ASPEED_CLK_APB1>; |
120 |
- clock-names = "PCLK"; |
121 |
-+ status = "disabled"; |
122 |
- }; |
123 |
- |
124 |
- uart1: serial@1e783000 { |
125 |
-@@ -433,22 +435,23 @@ |
126 |
- #size-cells = <1>; |
127 |
- ranges = <0x0 0x0 0x80>; |
128 |
- |
129 |
-- kcs1: kcs1@0 { |
130 |
-- compatible = "aspeed,ast2600-kcs-bmc"; |
131 |
-+ kcs1: kcs@24 { |
132 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
133 |
-+ reg = <0x24 0x1>, <0x30 0x1>, <0x3c 0x1>; |
134 |
- interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>; |
135 |
- kcs_chan = <1>; |
136 |
- status = "disabled"; |
137 |
- }; |
138 |
-- kcs2: kcs2@0 { |
139 |
-- compatible = "aspeed,ast2600-kcs-bmc"; |
140 |
-+ kcs2: kcs@28 { |
141 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
142 |
-+ reg = <0x28 0x1>, <0x34 0x1>, <0x40 0x1>; |
143 |
- interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
144 |
-- kcs_chan = <2>; |
145 |
- status = "disabled"; |
146 |
- }; |
147 |
-- kcs3: kcs3@0 { |
148 |
-- compatible = "aspeed,ast2600-kcs-bmc"; |
149 |
-+ kcs3: kcs@2c { |
150 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
151 |
-+ reg = <0x2c 0x1>, <0x38 0x1>, <0x44 0x1>; |
152 |
- interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; |
153 |
-- kcs_chan = <3>; |
154 |
- status = "disabled"; |
155 |
- }; |
156 |
- }; |
157 |
-@@ -462,10 +465,10 @@ |
158 |
- #size-cells = <1>; |
159 |
- ranges = <0x0 0x80 0x1e0>; |
160 |
- |
161 |
-- kcs4: kcs4@0 { |
162 |
-- compatible = "aspeed,ast2600-kcs-bmc"; |
163 |
-+ kcs4: kcs@94 { |
164 |
-+ compatible = "aspeed,ast2500-kcs-bmc-v2"; |
165 |
-+ reg = <0x94 0x1>, <0x98 0x1>, <0x9c 0x1>; |
166 |
- interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; |
167 |
-- kcs_chan = <4>; |
168 |
- status = "disabled"; |
169 |
- }; |
170 |
- |
171 |
-diff --git a/arch/arm/boot/dts/bcm2835-common.dtsi b/arch/arm/boot/dts/bcm2835-common.dtsi |
172 |
-index 2b1d9d4c0cde..4119271c979d 100644 |
173 |
---- a/arch/arm/boot/dts/bcm2835-common.dtsi |
174 |
-+++ b/arch/arm/boot/dts/bcm2835-common.dtsi |
175 |
-@@ -130,7 +130,6 @@ |
176 |
- compatible = "brcm,bcm2835-v3d"; |
177 |
- reg = <0x7ec00000 0x1000>; |
178 |
- interrupts = <1 10>; |
179 |
-- power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>; |
180 |
- }; |
181 |
- |
182 |
- vc4: gpu { |
183 |
-diff --git a/arch/arm/boot/dts/bcm2835-rpi-common.dtsi b/arch/arm/boot/dts/bcm2835-rpi-common.dtsi |
184 |
-new file mode 100644 |
185 |
-index 000000000000..8a55b6cded59 |
186 |
---- /dev/null |
187 |
-+++ b/arch/arm/boot/dts/bcm2835-rpi-common.dtsi |
188 |
-@@ -0,0 +1,12 @@ |
189 |
-+// SPDX-License-Identifier: GPL-2.0 |
190 |
-+/* |
191 |
-+ * This include file covers the common peripherals and configuration between |
192 |
-+ * bcm2835, bcm2836 and bcm2837 implementations that interact with RPi's |
193 |
-+ * firmware interface. |
194 |
-+ */ |
195 |
-+ |
196 |
-+#include <dt-bindings/power/raspberrypi-power.h> |
197 |
-+ |
198 |
-+&v3d { |
199 |
-+ power-domains = <&power RPI_POWER_DOMAIN_V3D>; |
200 |
-+}; |
201 |
-diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi |
202 |
-index 53bf4579cc22..0549686134ea 100644 |
203 |
---- a/arch/arm/boot/dts/bcm2835.dtsi |
204 |
-+++ b/arch/arm/boot/dts/bcm2835.dtsi |
205 |
-@@ -1,6 +1,7 @@ |
206 |
- // SPDX-License-Identifier: GPL-2.0 |
207 |
- #include "bcm283x.dtsi" |
208 |
- #include "bcm2835-common.dtsi" |
209 |
-+#include "bcm2835-rpi-common.dtsi" |
210 |
- |
211 |
- / { |
212 |
- compatible = "brcm,bcm2835"; |
213 |
-diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi |
214 |
-index 82d6c4662ae4..b390006aef79 100644 |
215 |
---- a/arch/arm/boot/dts/bcm2836.dtsi |
216 |
-+++ b/arch/arm/boot/dts/bcm2836.dtsi |
217 |
-@@ -1,6 +1,7 @@ |
218 |
- // SPDX-License-Identifier: GPL-2.0 |
219 |
- #include "bcm283x.dtsi" |
220 |
- #include "bcm2835-common.dtsi" |
221 |
-+#include "bcm2835-rpi-common.dtsi" |
222 |
- |
223 |
- / { |
224 |
- compatible = "brcm,bcm2836"; |
225 |
-diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi |
226 |
-index 9e95fee78e19..0199ec98cd61 100644 |
227 |
---- a/arch/arm/boot/dts/bcm2837.dtsi |
228 |
-+++ b/arch/arm/boot/dts/bcm2837.dtsi |
229 |
-@@ -1,5 +1,6 @@ |
230 |
- #include "bcm283x.dtsi" |
231 |
- #include "bcm2835-common.dtsi" |
232 |
-+#include "bcm2835-rpi-common.dtsi" |
233 |
- |
234 |
- / { |
235 |
- compatible = "brcm,bcm2837"; |
236 |
-diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi |
237 |
-index e8b340bb99bc..fff123753b85 100644 |
238 |
---- a/arch/arm/boot/dts/r8a7743.dtsi |
239 |
-+++ b/arch/arm/boot/dts/r8a7743.dtsi |
240 |
-@@ -338,7 +338,7 @@ |
241 |
- #thermal-sensor-cells = <0>; |
242 |
- }; |
243 |
- |
244 |
-- ipmmu_sy0: mmu@e6280000 { |
245 |
-+ ipmmu_sy0: iommu@e6280000 { |
246 |
- compatible = "renesas,ipmmu-r8a7743", |
247 |
- "renesas,ipmmu-vmsa"; |
248 |
- reg = <0 0xe6280000 0 0x1000>; |
249 |
-@@ -348,7 +348,7 @@ |
250 |
- status = "disabled"; |
251 |
- }; |
252 |
- |
253 |
-- ipmmu_sy1: mmu@e6290000 { |
254 |
-+ ipmmu_sy1: iommu@e6290000 { |
255 |
- compatible = "renesas,ipmmu-r8a7743", |
256 |
- "renesas,ipmmu-vmsa"; |
257 |
- reg = <0 0xe6290000 0 0x1000>; |
258 |
-@@ -357,7 +357,7 @@ |
259 |
- status = "disabled"; |
260 |
- }; |
261 |
- |
262 |
-- ipmmu_ds: mmu@e6740000 { |
263 |
-+ ipmmu_ds: iommu@e6740000 { |
264 |
- compatible = "renesas,ipmmu-r8a7743", |
265 |
- "renesas,ipmmu-vmsa"; |
266 |
- reg = <0 0xe6740000 0 0x1000>; |
267 |
-@@ -367,7 +367,7 @@ |
268 |
- status = "disabled"; |
269 |
- }; |
270 |
- |
271 |
-- ipmmu_mp: mmu@ec680000 { |
272 |
-+ ipmmu_mp: iommu@ec680000 { |
273 |
- compatible = "renesas,ipmmu-r8a7743", |
274 |
- "renesas,ipmmu-vmsa"; |
275 |
- reg = <0 0xec680000 0 0x1000>; |
276 |
-@@ -376,7 +376,7 @@ |
277 |
- status = "disabled"; |
278 |
- }; |
279 |
- |
280 |
-- ipmmu_mx: mmu@fe951000 { |
281 |
-+ ipmmu_mx: iommu@fe951000 { |
282 |
- compatible = "renesas,ipmmu-r8a7743", |
283 |
- "renesas,ipmmu-vmsa"; |
284 |
- reg = <0 0xfe951000 0 0x1000>; |
285 |
-@@ -386,7 +386,7 @@ |
286 |
- status = "disabled"; |
287 |
- }; |
288 |
- |
289 |
-- ipmmu_gp: mmu@e62a0000 { |
290 |
-+ ipmmu_gp: iommu@e62a0000 { |
291 |
- compatible = "renesas,ipmmu-r8a7743", |
292 |
- "renesas,ipmmu-vmsa"; |
293 |
- reg = <0 0xe62a0000 0 0x1000>; |
294 |
-diff --git a/arch/arm/boot/dts/r8a7744.dtsi b/arch/arm/boot/dts/r8a7744.dtsi |
295 |
-index def840b8b2d3..5050ac19041d 100644 |
296 |
---- a/arch/arm/boot/dts/r8a7744.dtsi |
297 |
-+++ b/arch/arm/boot/dts/r8a7744.dtsi |
298 |
-@@ -338,7 +338,7 @@ |
299 |
- #thermal-sensor-cells = <0>; |
300 |
- }; |
301 |
- |
302 |
-- ipmmu_sy0: mmu@e6280000 { |
303 |
-+ ipmmu_sy0: iommu@e6280000 { |
304 |
- compatible = "renesas,ipmmu-r8a7744", |
305 |
- "renesas,ipmmu-vmsa"; |
306 |
- reg = <0 0xe6280000 0 0x1000>; |
307 |
-@@ -348,7 +348,7 @@ |
308 |
- status = "disabled"; |
309 |
- }; |
310 |
- |
311 |
-- ipmmu_sy1: mmu@e6290000 { |
312 |
-+ ipmmu_sy1: iommu@e6290000 { |
313 |
- compatible = "renesas,ipmmu-r8a7744", |
314 |
- "renesas,ipmmu-vmsa"; |
315 |
- reg = <0 0xe6290000 0 0x1000>; |
316 |
-@@ -357,7 +357,7 @@ |
317 |
- status = "disabled"; |
318 |
- }; |
319 |
- |
320 |
-- ipmmu_ds: mmu@e6740000 { |
321 |
-+ ipmmu_ds: iommu@e6740000 { |
322 |
- compatible = "renesas,ipmmu-r8a7744", |
323 |
- "renesas,ipmmu-vmsa"; |
324 |
- reg = <0 0xe6740000 0 0x1000>; |
325 |
-@@ -367,7 +367,7 @@ |
326 |
- status = "disabled"; |
327 |
- }; |
328 |
- |
329 |
-- ipmmu_mp: mmu@ec680000 { |
330 |
-+ ipmmu_mp: iommu@ec680000 { |
331 |
- compatible = "renesas,ipmmu-r8a7744", |
332 |
- "renesas,ipmmu-vmsa"; |
333 |
- reg = <0 0xec680000 0 0x1000>; |
334 |
-@@ -376,7 +376,7 @@ |
335 |
- status = "disabled"; |
336 |
- }; |
337 |
- |
338 |
-- ipmmu_mx: mmu@fe951000 { |
339 |
-+ ipmmu_mx: iommu@fe951000 { |
340 |
- compatible = "renesas,ipmmu-r8a7744", |
341 |
- "renesas,ipmmu-vmsa"; |
342 |
- reg = <0 0xfe951000 0 0x1000>; |
343 |
-@@ -386,7 +386,7 @@ |
344 |
- status = "disabled"; |
345 |
- }; |
346 |
- |
347 |
-- ipmmu_gp: mmu@e62a0000 { |
348 |
-+ ipmmu_gp: iommu@e62a0000 { |
349 |
- compatible = "renesas,ipmmu-r8a7744", |
350 |
- "renesas,ipmmu-vmsa"; |
351 |
- reg = <0 0xe62a0000 0 0x1000>; |
352 |
-diff --git a/arch/arm/boot/dts/r8a7745.dtsi b/arch/arm/boot/dts/r8a7745.dtsi |
353 |
-index 7ab58d8bb740..b0d1fc24e97e 100644 |
354 |
---- a/arch/arm/boot/dts/r8a7745.dtsi |
355 |
-+++ b/arch/arm/boot/dts/r8a7745.dtsi |
356 |
-@@ -302,7 +302,7 @@ |
357 |
- resets = <&cpg 407>; |
358 |
- }; |
359 |
- |
360 |
-- ipmmu_sy0: mmu@e6280000 { |
361 |
-+ ipmmu_sy0: iommu@e6280000 { |
362 |
- compatible = "renesas,ipmmu-r8a7745", |
363 |
- "renesas,ipmmu-vmsa"; |
364 |
- reg = <0 0xe6280000 0 0x1000>; |
365 |
-@@ -312,7 +312,7 @@ |
366 |
- status = "disabled"; |
367 |
- }; |
368 |
- |
369 |
-- ipmmu_sy1: mmu@e6290000 { |
370 |
-+ ipmmu_sy1: iommu@e6290000 { |
371 |
- compatible = "renesas,ipmmu-r8a7745", |
372 |
- "renesas,ipmmu-vmsa"; |
373 |
- reg = <0 0xe6290000 0 0x1000>; |
374 |
-@@ -321,7 +321,7 @@ |
375 |
- status = "disabled"; |
376 |
- }; |
377 |
- |
378 |
-- ipmmu_ds: mmu@e6740000 { |
379 |
-+ ipmmu_ds: iommu@e6740000 { |
380 |
- compatible = "renesas,ipmmu-r8a7745", |
381 |
- "renesas,ipmmu-vmsa"; |
382 |
- reg = <0 0xe6740000 0 0x1000>; |
383 |
-@@ -331,7 +331,7 @@ |
384 |
- status = "disabled"; |
385 |
- }; |
386 |
- |
387 |
-- ipmmu_mp: mmu@ec680000 { |
388 |
-+ ipmmu_mp: iommu@ec680000 { |
389 |
- compatible = "renesas,ipmmu-r8a7745", |
390 |
- "renesas,ipmmu-vmsa"; |
391 |
- reg = <0 0xec680000 0 0x1000>; |
392 |
-@@ -340,7 +340,7 @@ |
393 |
- status = "disabled"; |
394 |
- }; |
395 |
- |
396 |
-- ipmmu_mx: mmu@fe951000 { |
397 |
-+ ipmmu_mx: iommu@fe951000 { |
398 |
- compatible = "renesas,ipmmu-r8a7745", |
399 |
- "renesas,ipmmu-vmsa"; |
400 |
- reg = <0 0xfe951000 0 0x1000>; |
401 |
-@@ -350,7 +350,7 @@ |
402 |
- status = "disabled"; |
403 |
- }; |
404 |
- |
405 |
-- ipmmu_gp: mmu@e62a0000 { |
406 |
-+ ipmmu_gp: iommu@e62a0000 { |
407 |
- compatible = "renesas,ipmmu-r8a7745", |
408 |
- "renesas,ipmmu-vmsa"; |
409 |
- reg = <0 0xe62a0000 0 0x1000>; |
410 |
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi |
411 |
-index e5ef9fd4284a..166d5566229d 100644 |
412 |
---- a/arch/arm/boot/dts/r8a7790.dtsi |
413 |
-+++ b/arch/arm/boot/dts/r8a7790.dtsi |
414 |
-@@ -427,7 +427,7 @@ |
415 |
- #thermal-sensor-cells = <0>; |
416 |
- }; |
417 |
- |
418 |
-- ipmmu_sy0: mmu@e6280000 { |
419 |
-+ ipmmu_sy0: iommu@e6280000 { |
420 |
- compatible = "renesas,ipmmu-r8a7790", |
421 |
- "renesas,ipmmu-vmsa"; |
422 |
- reg = <0 0xe6280000 0 0x1000>; |
423 |
-@@ -437,7 +437,7 @@ |
424 |
- status = "disabled"; |
425 |
- }; |
426 |
- |
427 |
-- ipmmu_sy1: mmu@e6290000 { |
428 |
-+ ipmmu_sy1: iommu@e6290000 { |
429 |
- compatible = "renesas,ipmmu-r8a7790", |
430 |
- "renesas,ipmmu-vmsa"; |
431 |
- reg = <0 0xe6290000 0 0x1000>; |
432 |
-@@ -446,7 +446,7 @@ |
433 |
- status = "disabled"; |
434 |
- }; |
435 |
- |
436 |
-- ipmmu_ds: mmu@e6740000 { |
437 |
-+ ipmmu_ds: iommu@e6740000 { |
438 |
- compatible = "renesas,ipmmu-r8a7790", |
439 |
- "renesas,ipmmu-vmsa"; |
440 |
- reg = <0 0xe6740000 0 0x1000>; |
441 |
-@@ -456,7 +456,7 @@ |
442 |
- status = "disabled"; |
443 |
- }; |
444 |
- |
445 |
-- ipmmu_mp: mmu@ec680000 { |
446 |
-+ ipmmu_mp: iommu@ec680000 { |
447 |
- compatible = "renesas,ipmmu-r8a7790", |
448 |
- "renesas,ipmmu-vmsa"; |
449 |
- reg = <0 0xec680000 0 0x1000>; |
450 |
-@@ -465,7 +465,7 @@ |
451 |
- status = "disabled"; |
452 |
- }; |
453 |
- |
454 |
-- ipmmu_mx: mmu@fe951000 { |
455 |
-+ ipmmu_mx: iommu@fe951000 { |
456 |
- compatible = "renesas,ipmmu-r8a7790", |
457 |
- "renesas,ipmmu-vmsa"; |
458 |
- reg = <0 0xfe951000 0 0x1000>; |
459 |
-@@ -475,7 +475,7 @@ |
460 |
- status = "disabled"; |
461 |
- }; |
462 |
- |
463 |
-- ipmmu_rt: mmu@ffc80000 { |
464 |
-+ ipmmu_rt: iommu@ffc80000 { |
465 |
- compatible = "renesas,ipmmu-r8a7790", |
466 |
- "renesas,ipmmu-vmsa"; |
467 |
- reg = <0 0xffc80000 0 0x1000>; |
468 |
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi |
469 |
-index 6e5bd86731cd..09e47cc17765 100644 |
470 |
---- a/arch/arm/boot/dts/r8a7791.dtsi |
471 |
-+++ b/arch/arm/boot/dts/r8a7791.dtsi |
472 |
-@@ -350,7 +350,7 @@ |
473 |
- #thermal-sensor-cells = <0>; |
474 |
- }; |
475 |
- |
476 |
-- ipmmu_sy0: mmu@e6280000 { |
477 |
-+ ipmmu_sy0: iommu@e6280000 { |
478 |
- compatible = "renesas,ipmmu-r8a7791", |
479 |
- "renesas,ipmmu-vmsa"; |
480 |
- reg = <0 0xe6280000 0 0x1000>; |
481 |
-@@ -360,7 +360,7 @@ |
482 |
- status = "disabled"; |
483 |
- }; |
484 |
- |
485 |
-- ipmmu_sy1: mmu@e6290000 { |
486 |
-+ ipmmu_sy1: iommu@e6290000 { |
487 |
- compatible = "renesas,ipmmu-r8a7791", |
488 |
- "renesas,ipmmu-vmsa"; |
489 |
- reg = <0 0xe6290000 0 0x1000>; |
490 |
-@@ -369,7 +369,7 @@ |
491 |
- status = "disabled"; |
492 |
- }; |
493 |
- |
494 |
-- ipmmu_ds: mmu@e6740000 { |
495 |
-+ ipmmu_ds: iommu@e6740000 { |
496 |
- compatible = "renesas,ipmmu-r8a7791", |
497 |
- "renesas,ipmmu-vmsa"; |
498 |
- reg = <0 0xe6740000 0 0x1000>; |
499 |
-@@ -379,7 +379,7 @@ |
500 |
- status = "disabled"; |
501 |
- }; |
502 |
- |
503 |
-- ipmmu_mp: mmu@ec680000 { |
504 |
-+ ipmmu_mp: iommu@ec680000 { |
505 |
- compatible = "renesas,ipmmu-r8a7791", |
506 |
- "renesas,ipmmu-vmsa"; |
507 |
- reg = <0 0xec680000 0 0x1000>; |
508 |
-@@ -388,7 +388,7 @@ |
509 |
- status = "disabled"; |
510 |
- }; |
511 |
- |
512 |
-- ipmmu_mx: mmu@fe951000 { |
513 |
-+ ipmmu_mx: iommu@fe951000 { |
514 |
- compatible = "renesas,ipmmu-r8a7791", |
515 |
- "renesas,ipmmu-vmsa"; |
516 |
- reg = <0 0xfe951000 0 0x1000>; |
517 |
-@@ -398,7 +398,7 @@ |
518 |
- status = "disabled"; |
519 |
- }; |
520 |
- |
521 |
-- ipmmu_rt: mmu@ffc80000 { |
522 |
-+ ipmmu_rt: iommu@ffc80000 { |
523 |
- compatible = "renesas,ipmmu-r8a7791", |
524 |
- "renesas,ipmmu-vmsa"; |
525 |
- reg = <0 0xffc80000 0 0x1000>; |
526 |
-@@ -407,7 +407,7 @@ |
527 |
- status = "disabled"; |
528 |
- }; |
529 |
- |
530 |
-- ipmmu_gp: mmu@e62a0000 { |
531 |
-+ ipmmu_gp: iommu@e62a0000 { |
532 |
- compatible = "renesas,ipmmu-r8a7791", |
533 |
- "renesas,ipmmu-vmsa"; |
534 |
- reg = <0 0xe62a0000 0 0x1000>; |
535 |
-diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi |
536 |
-index dadbda16161b..1b62a7e06b42 100644 |
537 |
---- a/arch/arm/boot/dts/r8a7793.dtsi |
538 |
-+++ b/arch/arm/boot/dts/r8a7793.dtsi |
539 |
-@@ -336,7 +336,7 @@ |
540 |
- #thermal-sensor-cells = <0>; |
541 |
- }; |
542 |
- |
543 |
-- ipmmu_sy0: mmu@e6280000 { |
544 |
-+ ipmmu_sy0: iommu@e6280000 { |
545 |
- compatible = "renesas,ipmmu-r8a7793", |
546 |
- "renesas,ipmmu-vmsa"; |
547 |
- reg = <0 0xe6280000 0 0x1000>; |
548 |
-@@ -346,7 +346,7 @@ |
549 |
- status = "disabled"; |
550 |
- }; |
551 |
- |
552 |
-- ipmmu_sy1: mmu@e6290000 { |
553 |
-+ ipmmu_sy1: iommu@e6290000 { |
554 |
- compatible = "renesas,ipmmu-r8a7793", |
555 |
- "renesas,ipmmu-vmsa"; |
556 |
- reg = <0 0xe6290000 0 0x1000>; |
557 |
-@@ -355,7 +355,7 @@ |
558 |
- status = "disabled"; |
559 |
- }; |
560 |
- |
561 |
-- ipmmu_ds: mmu@e6740000 { |
562 |
-+ ipmmu_ds: iommu@e6740000 { |
563 |
- compatible = "renesas,ipmmu-r8a7793", |
564 |
- "renesas,ipmmu-vmsa"; |
565 |
- reg = <0 0xe6740000 0 0x1000>; |
566 |
-@@ -365,7 +365,7 @@ |
567 |
- status = "disabled"; |
568 |
- }; |
569 |
- |
570 |
-- ipmmu_mp: mmu@ec680000 { |
571 |
-+ ipmmu_mp: iommu@ec680000 { |
572 |
- compatible = "renesas,ipmmu-r8a7793", |
573 |
- "renesas,ipmmu-vmsa"; |
574 |
- reg = <0 0xec680000 0 0x1000>; |
575 |
-@@ -374,7 +374,7 @@ |
576 |
- status = "disabled"; |
577 |
- }; |
578 |
- |
579 |
-- ipmmu_mx: mmu@fe951000 { |
580 |
-+ ipmmu_mx: iommu@fe951000 { |
581 |
- compatible = "renesas,ipmmu-r8a7793", |
582 |
- "renesas,ipmmu-vmsa"; |
583 |
- reg = <0 0xfe951000 0 0x1000>; |
584 |
-@@ -384,7 +384,7 @@ |
585 |
- status = "disabled"; |
586 |
- }; |
587 |
- |
588 |
-- ipmmu_rt: mmu@ffc80000 { |
589 |
-+ ipmmu_rt: iommu@ffc80000 { |
590 |
- compatible = "renesas,ipmmu-r8a7793", |
591 |
- "renesas,ipmmu-vmsa"; |
592 |
- reg = <0 0xffc80000 0 0x1000>; |
593 |
-@@ -393,7 +393,7 @@ |
594 |
- status = "disabled"; |
595 |
- }; |
596 |
- |
597 |
-- ipmmu_gp: mmu@e62a0000 { |
598 |
-+ ipmmu_gp: iommu@e62a0000 { |
599 |
- compatible = "renesas,ipmmu-r8a7793", |
600 |
- "renesas,ipmmu-vmsa"; |
601 |
- reg = <0 0xe62a0000 0 0x1000>; |
602 |
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi |
603 |
-index 2c9e7a1ebfec..8d7f8798628a 100644 |
604 |
---- a/arch/arm/boot/dts/r8a7794.dtsi |
605 |
-+++ b/arch/arm/boot/dts/r8a7794.dtsi |
606 |
-@@ -290,7 +290,7 @@ |
607 |
- resets = <&cpg 407>; |
608 |
- }; |
609 |
- |
610 |
-- ipmmu_sy0: mmu@e6280000 { |
611 |
-+ ipmmu_sy0: iommu@e6280000 { |
612 |
- compatible = "renesas,ipmmu-r8a7794", |
613 |
- "renesas,ipmmu-vmsa"; |
614 |
- reg = <0 0xe6280000 0 0x1000>; |
615 |
-@@ -300,7 +300,7 @@ |
616 |
- status = "disabled"; |
617 |
- }; |
618 |
- |
619 |
-- ipmmu_sy1: mmu@e6290000 { |
620 |
-+ ipmmu_sy1: iommu@e6290000 { |
621 |
- compatible = "renesas,ipmmu-r8a7794", |
622 |
- "renesas,ipmmu-vmsa"; |
623 |
- reg = <0 0xe6290000 0 0x1000>; |
624 |
-@@ -309,7 +309,7 @@ |
625 |
- status = "disabled"; |
626 |
- }; |
627 |
- |
628 |
-- ipmmu_ds: mmu@e6740000 { |
629 |
-+ ipmmu_ds: iommu@e6740000 { |
630 |
- compatible = "renesas,ipmmu-r8a7794", |
631 |
- "renesas,ipmmu-vmsa"; |
632 |
- reg = <0 0xe6740000 0 0x1000>; |
633 |
-@@ -319,7 +319,7 @@ |
634 |
- status = "disabled"; |
635 |
- }; |
636 |
- |
637 |
-- ipmmu_mp: mmu@ec680000 { |
638 |
-+ ipmmu_mp: iommu@ec680000 { |
639 |
- compatible = "renesas,ipmmu-r8a7794", |
640 |
- "renesas,ipmmu-vmsa"; |
641 |
- reg = <0 0xec680000 0 0x1000>; |
642 |
-@@ -328,7 +328,7 @@ |
643 |
- status = "disabled"; |
644 |
- }; |
645 |
- |
646 |
-- ipmmu_mx: mmu@fe951000 { |
647 |
-+ ipmmu_mx: iommu@fe951000 { |
648 |
- compatible = "renesas,ipmmu-r8a7794", |
649 |
- "renesas,ipmmu-vmsa"; |
650 |
- reg = <0 0xfe951000 0 0x1000>; |
651 |
-@@ -338,7 +338,7 @@ |
652 |
- status = "disabled"; |
653 |
- }; |
654 |
- |
655 |
-- ipmmu_gp: mmu@e62a0000 { |
656 |
-+ ipmmu_gp: iommu@e62a0000 { |
657 |
- compatible = "renesas,ipmmu-r8a7794", |
658 |
- "renesas,ipmmu-vmsa"; |
659 |
- reg = <0 0xe62a0000 0 0x1000>; |
660 |
-diff --git a/arch/arm/boot/dts/stm32mp157a-avenger96.dts b/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
661 |
-index 425175f7d83c..081037b510bc 100644 |
662 |
---- a/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
663 |
-+++ b/arch/arm/boot/dts/stm32mp157a-avenger96.dts |
664 |
-@@ -92,6 +92,9 @@ |
665 |
- #address-cells = <1>; |
666 |
- #size-cells = <0>; |
667 |
- compatible = "snps,dwmac-mdio"; |
668 |
-+ reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>; |
669 |
-+ reset-delay-us = <1000>; |
670 |
-+ |
671 |
- phy0: ethernet-phy@7 { |
672 |
- reg = <7>; |
673 |
- }; |
674 |
-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 |
675 |
-index d277d043031b..4c6704e4c57e 100644 |
676 |
---- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
677 |
-+++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts |
678 |
-@@ -31,7 +31,7 @@ |
679 |
- |
680 |
- pwr_led { |
681 |
- label = "bananapi-m2-zero:red:pwr"; |
682 |
-- gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */ |
683 |
-+ gpios = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ |
684 |
- default-state = "on"; |
685 |
- }; |
686 |
- }; |
687 |
-diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
688 |
-index 5c183483ec3b..8010cdcdb37a 100644 |
689 |
---- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
690 |
-+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi |
691 |
-@@ -31,7 +31,7 @@ |
692 |
- #interrupt-cells = <1>; |
693 |
- ranges; |
694 |
- |
695 |
-- nor_flash: flash@0,00000000 { |
696 |
-+ nor_flash: flash@0 { |
697 |
- compatible = "arm,vexpress-flash", "cfi-flash"; |
698 |
- reg = <0 0x00000000 0x04000000>, |
699 |
- <4 0x00000000 0x04000000>; |
700 |
-@@ -41,13 +41,13 @@ |
701 |
- }; |
702 |
- }; |
703 |
- |
704 |
-- psram@1,00000000 { |
705 |
-+ psram@100000000 { |
706 |
- compatible = "arm,vexpress-psram", "mtd-ram"; |
707 |
- reg = <1 0x00000000 0x02000000>; |
708 |
- bank-width = <4>; |
709 |
- }; |
710 |
- |
711 |
-- ethernet@2,02000000 { |
712 |
-+ ethernet@202000000 { |
713 |
- compatible = "smsc,lan9118", "smsc,lan9115"; |
714 |
- reg = <2 0x02000000 0x10000>; |
715 |
- interrupts = <15>; |
716 |
-@@ -59,14 +59,14 @@ |
717 |
- vddvario-supply = <&v2m_fixed_3v3>; |
718 |
- }; |
719 |
- |
720 |
-- usb@2,03000000 { |
721 |
-+ usb@203000000 { |
722 |
- compatible = "nxp,usb-isp1761"; |
723 |
- reg = <2 0x03000000 0x20000>; |
724 |
- interrupts = <16>; |
725 |
- port1-otg; |
726 |
- }; |
727 |
- |
728 |
-- iofpga@3,00000000 { |
729 |
-+ iofpga@300000000 { |
730 |
- compatible = "simple-bus"; |
731 |
- #address-cells = <1>; |
732 |
- #size-cells = <1>; |
733 |
-diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c |
734 |
-index 3461d12bbfc0..a5d3708fedf6 100644 |
735 |
---- a/arch/arm/mach-davinci/board-dm644x-evm.c |
736 |
-+++ b/arch/arm/mach-davinci/board-dm644x-evm.c |
737 |
-@@ -655,19 +655,6 @@ static struct i2c_board_info __initdata i2c_info[] = { |
738 |
- }, |
739 |
- }; |
740 |
- |
741 |
--/* Fixed regulator support */ |
742 |
--static struct regulator_consumer_supply fixed_supplies_3_3v[] = { |
743 |
-- /* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */ |
744 |
-- REGULATOR_SUPPLY("AVDD", "1-001b"), |
745 |
-- REGULATOR_SUPPLY("DRVDD", "1-001b"), |
746 |
--}; |
747 |
-- |
748 |
--static struct regulator_consumer_supply fixed_supplies_1_8v[] = { |
749 |
-- /* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */ |
750 |
-- REGULATOR_SUPPLY("IOVDD", "1-001b"), |
751 |
-- REGULATOR_SUPPLY("DVDD", "1-001b"), |
752 |
--}; |
753 |
-- |
754 |
- #define DM644X_I2C_SDA_PIN GPIO_TO_PIN(2, 12) |
755 |
- #define DM644X_I2C_SCL_PIN GPIO_TO_PIN(2, 11) |
756 |
- |
757 |
-@@ -700,6 +687,19 @@ static void __init evm_init_i2c(void) |
758 |
- } |
759 |
- #endif |
760 |
- |
761 |
-+/* Fixed regulator support */ |
762 |
-+static struct regulator_consumer_supply fixed_supplies_3_3v[] = { |
763 |
-+ /* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */ |
764 |
-+ REGULATOR_SUPPLY("AVDD", "1-001b"), |
765 |
-+ REGULATOR_SUPPLY("DRVDD", "1-001b"), |
766 |
-+}; |
767 |
-+ |
768 |
-+static struct regulator_consumer_supply fixed_supplies_1_8v[] = { |
769 |
-+ /* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */ |
770 |
-+ REGULATOR_SUPPLY("IOVDD", "1-001b"), |
771 |
-+ REGULATOR_SUPPLY("DVDD", "1-001b"), |
772 |
-+}; |
773 |
-+ |
774 |
- #define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) |
775 |
- |
776 |
- /* venc standard timings */ |
777 |
-diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig |
778 |
-index 982eabc36163..2406cab73835 100644 |
779 |
---- a/arch/arm/mach-integrator/Kconfig |
780 |
-+++ b/arch/arm/mach-integrator/Kconfig |
781 |
-@@ -4,6 +4,8 @@ menuconfig ARCH_INTEGRATOR |
782 |
- depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 |
783 |
- select ARM_AMBA |
784 |
- select COMMON_CLK_VERSATILE |
785 |
-+ select CMA |
786 |
-+ select DMA_CMA |
787 |
- select HAVE_TCM |
788 |
- select ICST |
789 |
- select MFD_SYSCON |
790 |
-@@ -35,14 +37,13 @@ config INTEGRATOR_IMPD1 |
791 |
- select ARM_VIC |
792 |
- select GPIO_PL061 |
793 |
- select GPIOLIB |
794 |
-+ select REGULATOR |
795 |
-+ select REGULATOR_FIXED_VOLTAGE |
796 |
- help |
797 |
- The IM-PD1 is an add-on logic module for the Integrator which |
798 |
- allows ARM(R) Ltd PrimeCells to be developed and evaluated. |
799 |
- The IM-PD1 can be found on the Integrator/PP2 platform. |
800 |
- |
801 |
-- To compile this driver as a module, choose M here: the |
802 |
-- module will be called impd1. |
803 |
-- |
804 |
- config INTEGRATOR_CM7TDMI |
805 |
- bool "Integrator/CM7TDMI core module" |
806 |
- depends on ARCH_INTEGRATOR_AP |
807 |
-diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms |
808 |
-index 55d70cfe0f9e..3c7e310fd8bf 100644 |
809 |
---- a/arch/arm64/Kconfig.platforms |
810 |
-+++ b/arch/arm64/Kconfig.platforms |
811 |
-@@ -248,7 +248,7 @@ config ARCH_TEGRA |
812 |
- This enables support for the NVIDIA Tegra SoC family. |
813 |
- |
814 |
- config ARCH_SPRD |
815 |
-- tristate "Spreadtrum SoC platform" |
816 |
-+ bool "Spreadtrum SoC platform" |
817 |
- help |
818 |
- Support for Spreadtrum ARM based SoCs |
819 |
- |
820 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
821 |
-index aace3d32a3df..8e6281c685fa 100644 |
822 |
---- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
823 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi |
824 |
-@@ -1735,18 +1735,18 @@ |
825 |
- }; |
826 |
- |
827 |
- sram: sram@fffc0000 { |
828 |
-- compatible = "amlogic,meson-axg-sram", "mmio-sram"; |
829 |
-+ compatible = "mmio-sram"; |
830 |
- reg = <0x0 0xfffc0000 0x0 0x20000>; |
831 |
- #address-cells = <1>; |
832 |
- #size-cells = <1>; |
833 |
- ranges = <0 0x0 0xfffc0000 0x20000>; |
834 |
- |
835 |
-- cpu_scp_lpri: scp-shmem@13000 { |
836 |
-+ cpu_scp_lpri: scp-sram@13000 { |
837 |
- compatible = "amlogic,meson-axg-scp-shmem"; |
838 |
- reg = <0x13000 0x400>; |
839 |
- }; |
840 |
- |
841 |
-- cpu_scp_hpri: scp-shmem@13400 { |
842 |
-+ cpu_scp_hpri: scp-sram@13400 { |
843 |
- compatible = "amlogic,meson-axg-scp-shmem"; |
844 |
- reg = <0x13400 0x400>; |
845 |
- }; |
846 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts |
847 |
-index 06c5430eb92d..fdaacfd96b97 100644 |
848 |
---- a/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts |
849 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts |
850 |
-@@ -14,7 +14,7 @@ |
851 |
- #include <dt-bindings/sound/meson-g12a-tohdmitx.h> |
852 |
- |
853 |
- / { |
854 |
-- compatible = "ugoos,am6", "amlogic,g12b"; |
855 |
-+ compatible = "ugoos,am6", "amlogic,s922x", "amlogic,g12b"; |
856 |
- model = "Ugoos AM6"; |
857 |
- |
858 |
- aliases { |
859 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi |
860 |
-index 248b018c83d5..b1da36fdeac6 100644 |
861 |
---- a/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi |
862 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi |
863 |
-@@ -96,14 +96,14 @@ |
864 |
- leds { |
865 |
- compatible = "gpio-leds"; |
866 |
- |
867 |
-- green { |
868 |
-+ led-green { |
869 |
- color = <LED_COLOR_ID_GREEN>; |
870 |
- function = LED_FUNCTION_DISK_ACTIVITY; |
871 |
- gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; |
872 |
- linux,default-trigger = "disk-activity"; |
873 |
- }; |
874 |
- |
875 |
-- blue { |
876 |
-+ led-blue { |
877 |
- color = <LED_COLOR_ID_BLUE>; |
878 |
- function = LED_FUNCTION_STATUS; |
879 |
- gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; |
880 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
881 |
-index 03f79fe045b7..e2bb68ec8502 100644 |
882 |
---- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
883 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
884 |
-@@ -398,20 +398,20 @@ |
885 |
- }; |
886 |
- |
887 |
- sram: sram@c8000000 { |
888 |
-- compatible = "amlogic,meson-gx-sram", "amlogic,meson-gxbb-sram", "mmio-sram"; |
889 |
-+ compatible = "mmio-sram"; |
890 |
- reg = <0x0 0xc8000000 0x0 0x14000>; |
891 |
- |
892 |
- #address-cells = <1>; |
893 |
- #size-cells = <1>; |
894 |
- ranges = <0 0x0 0xc8000000 0x14000>; |
895 |
- |
896 |
-- cpu_scp_lpri: scp-shmem@0 { |
897 |
-- compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem"; |
898 |
-+ cpu_scp_lpri: scp-sram@0 { |
899 |
-+ compatible = "amlogic,meson-gxbb-scp-shmem"; |
900 |
- reg = <0x13000 0x400>; |
901 |
- }; |
902 |
- |
903 |
-- cpu_scp_hpri: scp-shmem@200 { |
904 |
-- compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem"; |
905 |
-+ cpu_scp_hpri: scp-sram@200 { |
906 |
-+ compatible = "amlogic,meson-gxbb-scp-shmem"; |
907 |
- reg = <0x13400 0x400>; |
908 |
- }; |
909 |
- }; |
910 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts |
911 |
-index 6c9cc45fb417..e8394a8269ee 100644 |
912 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts |
913 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts |
914 |
-@@ -11,7 +11,7 @@ |
915 |
- #include <dt-bindings/input/input.h> |
916 |
- #include <dt-bindings/leds/common.h> |
917 |
- / { |
918 |
-- compatible = "videostrong,kii-pro", "amlogic,p201", "amlogic,s905", "amlogic,meson-gxbb"; |
919 |
-+ compatible = "videostrong,kii-pro", "amlogic,meson-gxbb"; |
920 |
- model = "Videostrong KII Pro"; |
921 |
- |
922 |
- leds { |
923 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
924 |
-index d6ca684e0e61..7be3e354093b 100644 |
925 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
926 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts |
927 |
-@@ -29,7 +29,7 @@ |
928 |
- leds { |
929 |
- compatible = "gpio-leds"; |
930 |
- |
931 |
-- stat { |
932 |
-+ led-stat { |
933 |
- label = "nanopi-k2:blue:stat"; |
934 |
- gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; |
935 |
- default-state = "on"; |
936 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |
937 |
-index 65ec7dea828c..67d901ed2fa3 100644 |
938 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |
939 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts |
940 |
-@@ -31,7 +31,7 @@ |
941 |
- |
942 |
- leds { |
943 |
- compatible = "gpio-leds"; |
944 |
-- blue { |
945 |
-+ led-blue { |
946 |
- label = "a95x:system-status"; |
947 |
- gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; |
948 |
- linux,default-trigger = "heartbeat"; |
949 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
950 |
-index b46ef985bb44..70fcfb7b0683 100644 |
951 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
952 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
953 |
-@@ -49,7 +49,7 @@ |
954 |
- |
955 |
- leds { |
956 |
- compatible = "gpio-leds"; |
957 |
-- blue { |
958 |
-+ led-blue { |
959 |
- label = "c2:blue:alive"; |
960 |
- gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; |
961 |
- linux,default-trigger = "heartbeat"; |
962 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
963 |
-index 45cb83625951..222ee8069cfa 100644 |
964 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
965 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi |
966 |
-@@ -20,7 +20,7 @@ |
967 |
- leds { |
968 |
- compatible = "gpio-leds"; |
969 |
- |
970 |
-- blue { |
971 |
-+ led-blue { |
972 |
- label = "vega-s95:blue:on"; |
973 |
- gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; |
974 |
- default-state = "on"; |
975 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts |
976 |
-index 1d32d1f6d032..2ab8a3d10079 100644 |
977 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts |
978 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts |
979 |
-@@ -14,13 +14,13 @@ |
980 |
- model = "WeTek Play 2"; |
981 |
- |
982 |
- leds { |
983 |
-- wifi { |
984 |
-+ led-wifi { |
985 |
- label = "wetek-play:wifi-status"; |
986 |
- gpios = <&gpio GPIODV_26 GPIO_ACTIVE_HIGH>; |
987 |
- default-state = "off"; |
988 |
- }; |
989 |
- |
990 |
-- ethernet { |
991 |
-+ led-ethernet { |
992 |
- label = "wetek-play:ethernet-status"; |
993 |
- gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; |
994 |
- default-state = "off"; |
995 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
996 |
-index dee51cf95223..d6133af09d64 100644 |
997 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
998 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi |
999 |
-@@ -25,7 +25,7 @@ |
1000 |
- leds { |
1001 |
- compatible = "gpio-leds"; |
1002 |
- |
1003 |
-- system { |
1004 |
-+ led-system { |
1005 |
- label = "wetek-play:system-status"; |
1006 |
- gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; |
1007 |
- default-state = "on"; |
1008 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
1009 |
-index e8348b2728db..a4a71c13891b 100644 |
1010 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
1011 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts |
1012 |
-@@ -54,14 +54,14 @@ |
1013 |
- leds { |
1014 |
- compatible = "gpio-leds"; |
1015 |
- |
1016 |
-- system { |
1017 |
-+ led-system { |
1018 |
- label = "librecomputer:system-status"; |
1019 |
- gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; |
1020 |
- default-state = "on"; |
1021 |
- panic-indicator; |
1022 |
- }; |
1023 |
- |
1024 |
-- blue { |
1025 |
-+ led-blue { |
1026 |
- label = "librecomputer:blue"; |
1027 |
- gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; |
1028 |
- linux,default-trigger = "heartbeat"; |
1029 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
1030 |
-index 420a88e9a195..c89c9f846fb1 100644 |
1031 |
---- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
1032 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts |
1033 |
-@@ -36,13 +36,13 @@ |
1034 |
- leds { |
1035 |
- compatible = "gpio-leds"; |
1036 |
- |
1037 |
-- blue { |
1038 |
-+ led-blue { |
1039 |
- label = "rbox-pro:blue:on"; |
1040 |
- gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; |
1041 |
- default-state = "on"; |
1042 |
- }; |
1043 |
- |
1044 |
-- red { |
1045 |
-+ led-red { |
1046 |
- label = "rbox-pro:red:standby"; |
1047 |
- gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; |
1048 |
- default-state = "off"; |
1049 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
1050 |
-index 094ecf2222bb..1ef1e3672b96 100644 |
1051 |
---- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
1052 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi |
1053 |
-@@ -39,13 +39,13 @@ |
1054 |
- leds { |
1055 |
- compatible = "gpio-leds"; |
1056 |
- |
1057 |
-- white { |
1058 |
-+ led-white { |
1059 |
- label = "vim3:white:sys"; |
1060 |
- gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; |
1061 |
- linux,default-trigger = "heartbeat"; |
1062 |
- }; |
1063 |
- |
1064 |
-- red { |
1065 |
-+ led-red { |
1066 |
- label = "vim3:red"; |
1067 |
- gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; |
1068 |
- }; |
1069 |
-diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
1070 |
-index dfb2438851c0..5ab139a34c01 100644 |
1071 |
---- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
1072 |
-+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
1073 |
-@@ -104,7 +104,7 @@ |
1074 |
- leds { |
1075 |
- compatible = "gpio-leds"; |
1076 |
- |
1077 |
-- bluetooth { |
1078 |
-+ led-bluetooth { |
1079 |
- label = "sei610:blue:bt"; |
1080 |
- gpios = <&gpio GPIOC_7 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; |
1081 |
- default-state = "off"; |
1082 |
-diff --git a/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi b/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
1083 |
-index 15fe81738e94..dfb23dfc0b0f 100644 |
1084 |
---- a/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
1085 |
-+++ b/arch/arm64/boot/dts/arm/foundation-v8-gicv2.dtsi |
1086 |
-@@ -8,7 +8,7 @@ |
1087 |
- gic: interrupt-controller@2c001000 { |
1088 |
- compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; |
1089 |
- #interrupt-cells = <3>; |
1090 |
-- #address-cells = <2>; |
1091 |
-+ #address-cells = <1>; |
1092 |
- interrupt-controller; |
1093 |
- reg = <0x0 0x2c001000 0 0x1000>, |
1094 |
- <0x0 0x2c002000 0 0x2000>, |
1095 |
-diff --git a/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi b/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
1096 |
-index f2c75c756039..906f51935b36 100644 |
1097 |
---- a/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
1098 |
-+++ b/arch/arm64/boot/dts/arm/foundation-v8-gicv3.dtsi |
1099 |
-@@ -8,9 +8,9 @@ |
1100 |
- gic: interrupt-controller@2f000000 { |
1101 |
- compatible = "arm,gic-v3"; |
1102 |
- #interrupt-cells = <3>; |
1103 |
-- #address-cells = <2>; |
1104 |
-- #size-cells = <2>; |
1105 |
-- ranges; |
1106 |
-+ #address-cells = <1>; |
1107 |
-+ #size-cells = <1>; |
1108 |
-+ ranges = <0x0 0x0 0x2f000000 0x100000>; |
1109 |
- interrupt-controller; |
1110 |
- reg = <0x0 0x2f000000 0x0 0x10000>, |
1111 |
- <0x0 0x2f100000 0x0 0x200000>, |
1112 |
-@@ -22,7 +22,7 @@ |
1113 |
- its: its@2f020000 { |
1114 |
- compatible = "arm,gic-v3-its"; |
1115 |
- msi-controller; |
1116 |
-- reg = <0x0 0x2f020000 0x0 0x20000>; |
1117 |
-+ reg = <0x20000 0x20000>; |
1118 |
- }; |
1119 |
- }; |
1120 |
- }; |
1121 |
-diff --git a/arch/arm64/boot/dts/arm/foundation-v8.dtsi b/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
1122 |
-index 12f039fa3dad..e2da63f78298 100644 |
1123 |
---- a/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
1124 |
-+++ b/arch/arm64/boot/dts/arm/foundation-v8.dtsi |
1125 |
-@@ -107,51 +107,51 @@ |
1126 |
- |
1127 |
- #interrupt-cells = <1>; |
1128 |
- interrupt-map-mask = <0 0 63>; |
1129 |
-- interrupt-map = <0 0 0 &gic 0 0 GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, |
1130 |
-- <0 0 1 &gic 0 0 GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, |
1131 |
-- <0 0 2 &gic 0 0 GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, |
1132 |
-- <0 0 3 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, |
1133 |
-- <0 0 4 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, |
1134 |
-- <0 0 5 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, |
1135 |
-- <0 0 6 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, |
1136 |
-- <0 0 7 &gic 0 0 GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, |
1137 |
-- <0 0 8 &gic 0 0 GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, |
1138 |
-- <0 0 9 &gic 0 0 GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
1139 |
-- <0 0 10 &gic 0 0 GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, |
1140 |
-- <0 0 11 &gic 0 0 GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
1141 |
-- <0 0 12 &gic 0 0 GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, |
1142 |
-- <0 0 13 &gic 0 0 GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, |
1143 |
-- <0 0 14 &gic 0 0 GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
1144 |
-- <0 0 15 &gic 0 0 GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, |
1145 |
-- <0 0 16 &gic 0 0 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, |
1146 |
-- <0 0 17 &gic 0 0 GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
1147 |
-- <0 0 18 &gic 0 0 GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, |
1148 |
-- <0 0 19 &gic 0 0 GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, |
1149 |
-- <0 0 20 &gic 0 0 GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, |
1150 |
-- <0 0 21 &gic 0 0 GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, |
1151 |
-- <0 0 22 &gic 0 0 GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, |
1152 |
-- <0 0 23 &gic 0 0 GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, |
1153 |
-- <0 0 24 &gic 0 0 GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, |
1154 |
-- <0 0 25 &gic 0 0 GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, |
1155 |
-- <0 0 26 &gic 0 0 GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, |
1156 |
-- <0 0 27 &gic 0 0 GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, |
1157 |
-- <0 0 28 &gic 0 0 GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, |
1158 |
-- <0 0 29 &gic 0 0 GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, |
1159 |
-- <0 0 30 &gic 0 0 GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, |
1160 |
-- <0 0 31 &gic 0 0 GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, |
1161 |
-- <0 0 32 &gic 0 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, |
1162 |
-- <0 0 33 &gic 0 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, |
1163 |
-- <0 0 34 &gic 0 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, |
1164 |
-- <0 0 35 &gic 0 0 GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, |
1165 |
-- <0 0 36 &gic 0 0 GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, |
1166 |
-- <0 0 37 &gic 0 0 GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, |
1167 |
-- <0 0 38 &gic 0 0 GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, |
1168 |
-- <0 0 39 &gic 0 0 GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, |
1169 |
-- <0 0 40 &gic 0 0 GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, |
1170 |
-- <0 0 41 &gic 0 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, |
1171 |
-- <0 0 42 &gic 0 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
1172 |
-- |
1173 |
-- ethernet@2,02000000 { |
1174 |
-+ interrupt-map = <0 0 0 &gic 0 GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, |
1175 |
-+ <0 0 1 &gic 0 GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, |
1176 |
-+ <0 0 2 &gic 0 GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, |
1177 |
-+ <0 0 3 &gic 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, |
1178 |
-+ <0 0 4 &gic 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, |
1179 |
-+ <0 0 5 &gic 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, |
1180 |
-+ <0 0 6 &gic 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, |
1181 |
-+ <0 0 7 &gic 0 GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, |
1182 |
-+ <0 0 8 &gic 0 GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, |
1183 |
-+ <0 0 9 &gic 0 GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
1184 |
-+ <0 0 10 &gic 0 GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, |
1185 |
-+ <0 0 11 &gic 0 GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, |
1186 |
-+ <0 0 12 &gic 0 GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>, |
1187 |
-+ <0 0 13 &gic 0 GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, |
1188 |
-+ <0 0 14 &gic 0 GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
1189 |
-+ <0 0 15 &gic 0 GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, |
1190 |
-+ <0 0 16 &gic 0 GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>, |
1191 |
-+ <0 0 17 &gic 0 GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>, |
1192 |
-+ <0 0 18 &gic 0 GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>, |
1193 |
-+ <0 0 19 &gic 0 GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, |
1194 |
-+ <0 0 20 &gic 0 GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, |
1195 |
-+ <0 0 21 &gic 0 GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, |
1196 |
-+ <0 0 22 &gic 0 GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, |
1197 |
-+ <0 0 23 &gic 0 GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, |
1198 |
-+ <0 0 24 &gic 0 GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, |
1199 |
-+ <0 0 25 &gic 0 GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, |
1200 |
-+ <0 0 26 &gic 0 GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, |
1201 |
-+ <0 0 27 &gic 0 GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, |
1202 |
-+ <0 0 28 &gic 0 GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, |
1203 |
-+ <0 0 29 &gic 0 GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, |
1204 |
-+ <0 0 30 &gic 0 GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, |
1205 |
-+ <0 0 31 &gic 0 GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, |
1206 |
-+ <0 0 32 &gic 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, |
1207 |
-+ <0 0 33 &gic 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, |
1208 |
-+ <0 0 34 &gic 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, |
1209 |
-+ <0 0 35 &gic 0 GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, |
1210 |
-+ <0 0 36 &gic 0 GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, |
1211 |
-+ <0 0 37 &gic 0 GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, |
1212 |
-+ <0 0 38 &gic 0 GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, |
1213 |
-+ <0 0 39 &gic 0 GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, |
1214 |
-+ <0 0 40 &gic 0 GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, |
1215 |
-+ <0 0 41 &gic 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, |
1216 |
-+ <0 0 42 &gic 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
1217 |
-+ |
1218 |
-+ ethernet@202000000 { |
1219 |
- compatible = "smsc,lan91c111"; |
1220 |
- reg = <2 0x02000000 0x10000>; |
1221 |
- interrupts = <15>; |
1222 |
-@@ -178,7 +178,7 @@ |
1223 |
- clock-output-names = "v2m:refclk32khz"; |
1224 |
- }; |
1225 |
- |
1226 |
-- iofpga@3,00000000 { |
1227 |
-+ iofpga@300000000 { |
1228 |
- compatible = "simple-bus"; |
1229 |
- #address-cells = <1>; |
1230 |
- #size-cells = <1>; |
1231 |
-diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi |
1232 |
-index f5889281545f..59b6ac0b828a 100644 |
1233 |
---- a/arch/arm64/boot/dts/arm/juno-base.dtsi |
1234 |
-+++ b/arch/arm64/boot/dts/arm/juno-base.dtsi |
1235 |
-@@ -74,35 +74,35 @@ |
1236 |
- <0x0 0x2c02f000 0 0x2000>, |
1237 |
- <0x0 0x2c04f000 0 0x2000>, |
1238 |
- <0x0 0x2c06f000 0 0x2000>; |
1239 |
-- #address-cells = <2>; |
1240 |
-+ #address-cells = <1>; |
1241 |
- #interrupt-cells = <3>; |
1242 |
-- #size-cells = <2>; |
1243 |
-+ #size-cells = <1>; |
1244 |
- interrupt-controller; |
1245 |
- interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_HIGH)>; |
1246 |
-- ranges = <0 0 0 0x2c1c0000 0 0x40000>; |
1247 |
-+ ranges = <0 0 0x2c1c0000 0x40000>; |
1248 |
- |
1249 |
- v2m_0: v2m@0 { |
1250 |
- compatible = "arm,gic-v2m-frame"; |
1251 |
- msi-controller; |
1252 |
-- reg = <0 0 0 0x10000>; |
1253 |
-+ reg = <0 0x10000>; |
1254 |
- }; |
1255 |
- |
1256 |
- v2m@10000 { |
1257 |
- compatible = "arm,gic-v2m-frame"; |
1258 |
- msi-controller; |
1259 |
-- reg = <0 0x10000 0 0x10000>; |
1260 |
-+ reg = <0x10000 0x10000>; |
1261 |
- }; |
1262 |
- |
1263 |
- v2m@20000 { |
1264 |
- compatible = "arm,gic-v2m-frame"; |
1265 |
- msi-controller; |
1266 |
-- reg = <0 0x20000 0 0x10000>; |
1267 |
-+ reg = <0x20000 0x10000>; |
1268 |
- }; |
1269 |
- |
1270 |
- v2m@30000 { |
1271 |
- compatible = "arm,gic-v2m-frame"; |
1272 |
- msi-controller; |
1273 |
-- reg = <0 0x30000 0 0x10000>; |
1274 |
-+ reg = <0x30000 0x10000>; |
1275 |
- }; |
1276 |
- }; |
1277 |
- |
1278 |
-@@ -546,10 +546,10 @@ |
1279 |
- <0x42000000 0x40 0x00000000 0x40 0x00000000 0x1 0x00000000>; |
1280 |
- #interrupt-cells = <1>; |
1281 |
- interrupt-map-mask = <0 0 0 7>; |
1282 |
-- interrupt-map = <0 0 0 1 &gic 0 0 GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, |
1283 |
-- <0 0 0 2 &gic 0 0 GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, |
1284 |
-- <0 0 0 3 &gic 0 0 GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
1285 |
-- <0 0 0 4 &gic 0 0 GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
1286 |
-+ interrupt-map = <0 0 0 1 &gic 0 GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, |
1287 |
-+ <0 0 0 2 &gic 0 GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>, |
1288 |
-+ <0 0 0 3 &gic 0 GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>, |
1289 |
-+ <0 0 0 4 &gic 0 GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; |
1290 |
- msi-parent = <&v2m_0>; |
1291 |
- status = "disabled"; |
1292 |
- iommu-map-mask = <0x0>; /* RC has no means to output PCI RID */ |
1293 |
-@@ -813,19 +813,19 @@ |
1294 |
- |
1295 |
- #interrupt-cells = <1>; |
1296 |
- interrupt-map-mask = <0 0 15>; |
1297 |
-- interrupt-map = <0 0 0 &gic 0 0 GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, |
1298 |
-- <0 0 1 &gic 0 0 GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, |
1299 |
-- <0 0 2 &gic 0 0 GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, |
1300 |
-- <0 0 3 &gic 0 0 GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, |
1301 |
-- <0 0 4 &gic 0 0 GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, |
1302 |
-- <0 0 5 &gic 0 0 GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, |
1303 |
-- <0 0 6 &gic 0 0 GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, |
1304 |
-- <0 0 7 &gic 0 0 GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, |
1305 |
-- <0 0 8 &gic 0 0 GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, |
1306 |
-- <0 0 9 &gic 0 0 GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, |
1307 |
-- <0 0 10 &gic 0 0 GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
1308 |
-- <0 0 11 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
1309 |
-- <0 0 12 &gic 0 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
1310 |
-+ interrupt-map = <0 0 0 &gic 0 GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>, |
1311 |
-+ <0 0 1 &gic 0 GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>, |
1312 |
-+ <0 0 2 &gic 0 GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>, |
1313 |
-+ <0 0 3 &gic 0 GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, |
1314 |
-+ <0 0 4 &gic 0 GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, |
1315 |
-+ <0 0 5 &gic 0 GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, |
1316 |
-+ <0 0 6 &gic 0 GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, |
1317 |
-+ <0 0 7 &gic 0 GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, |
1318 |
-+ <0 0 8 &gic 0 GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, |
1319 |
-+ <0 0 9 &gic 0 GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, |
1320 |
-+ <0 0 10 &gic 0 GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
1321 |
-+ <0 0 11 &gic 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
1322 |
-+ <0 0 12 &gic 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; |
1323 |
- }; |
1324 |
- |
1325 |
- site2: tlx@60000000 { |
1326 |
-@@ -835,6 +835,6 @@ |
1327 |
- ranges = <0 0 0x60000000 0x10000000>; |
1328 |
- #interrupt-cells = <1>; |
1329 |
- interrupt-map-mask = <0 0>; |
1330 |
-- interrupt-map = <0 0 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
1331 |
-+ interrupt-map = <0 0 &gic 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
1332 |
- }; |
1333 |
- }; |
1334 |
-diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
1335 |
-index e3983ded3c3c..d5cefddde08c 100644 |
1336 |
---- a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
1337 |
-+++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi |
1338 |
-@@ -103,7 +103,7 @@ |
1339 |
- }; |
1340 |
- }; |
1341 |
- |
1342 |
-- flash@0,00000000 { |
1343 |
-+ flash@0 { |
1344 |
- /* 2 * 32MiB NOR Flash memory mounted on CS0 */ |
1345 |
- compatible = "arm,vexpress-flash", "cfi-flash"; |
1346 |
- reg = <0 0x00000000 0x04000000>; |
1347 |
-@@ -120,7 +120,7 @@ |
1348 |
- }; |
1349 |
- }; |
1350 |
- |
1351 |
-- ethernet@2,00000000 { |
1352 |
-+ ethernet@200000000 { |
1353 |
- compatible = "smsc,lan9118", "smsc,lan9115"; |
1354 |
- reg = <2 0x00000000 0x10000>; |
1355 |
- interrupts = <3>; |
1356 |
-@@ -133,7 +133,7 @@ |
1357 |
- vddvario-supply = <&mb_fixed_3v3>; |
1358 |
- }; |
1359 |
- |
1360 |
-- iofpga@3,00000000 { |
1361 |
-+ iofpga@300000000 { |
1362 |
- compatible = "simple-bus"; |
1363 |
- #address-cells = <1>; |
1364 |
- #size-cells = <1>; |
1365 |
-diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
1366 |
-index 60703b5763c6..350cbf17e8b4 100644 |
1367 |
---- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
1368 |
-+++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi |
1369 |
-@@ -9,7 +9,7 @@ |
1370 |
- motherboard { |
1371 |
- arm,v2m-memory-map = "rs2"; |
1372 |
- |
1373 |
-- iofpga@3,00000000 { |
1374 |
-+ iofpga@300000000 { |
1375 |
- virtio-p9@140000 { |
1376 |
- compatible = "virtio,mmio"; |
1377 |
- reg = <0x140000 0x200>; |
1378 |
-diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
1379 |
-index e333c8d2d0e4..d1bfa62ca073 100644 |
1380 |
---- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
1381 |
-+++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi |
1382 |
-@@ -17,14 +17,14 @@ |
1383 |
- #interrupt-cells = <1>; |
1384 |
- ranges; |
1385 |
- |
1386 |
-- flash@0,00000000 { |
1387 |
-+ flash@0 { |
1388 |
- compatible = "arm,vexpress-flash", "cfi-flash"; |
1389 |
- reg = <0 0x00000000 0x04000000>, |
1390 |
- <4 0x00000000 0x04000000>; |
1391 |
- bank-width = <4>; |
1392 |
- }; |
1393 |
- |
1394 |
-- ethernet@2,02000000 { |
1395 |
-+ ethernet@202000000 { |
1396 |
- compatible = "smsc,lan91c111"; |
1397 |
- reg = <2 0x02000000 0x10000>; |
1398 |
- interrupts = <15>; |
1399 |
-@@ -51,7 +51,7 @@ |
1400 |
- clock-output-names = "v2m:refclk32khz"; |
1401 |
- }; |
1402 |
- |
1403 |
-- iofpga@3,00000000 { |
1404 |
-+ iofpga@300000000 { |
1405 |
- compatible = "simple-bus"; |
1406 |
- #address-cells = <1>; |
1407 |
- #size-cells = <1>; |
1408 |
-diff --git a/arch/arm64/boot/dts/marvell/armada-3720-db.dts b/arch/arm64/boot/dts/marvell/armada-3720-db.dts |
1409 |
-index f2cc00594d64..3e5789f37206 100644 |
1410 |
---- a/arch/arm64/boot/dts/marvell/armada-3720-db.dts |
1411 |
-+++ b/arch/arm64/boot/dts/marvell/armada-3720-db.dts |
1412 |
-@@ -128,6 +128,9 @@ |
1413 |
- |
1414 |
- /* CON15(V2.0)/CON17(V1.4) : PCIe / CON15(V2.0)/CON12(V1.4) :mini-PCIe */ |
1415 |
- &pcie0 { |
1416 |
-+ pinctrl-names = "default"; |
1417 |
-+ pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; |
1418 |
-+ reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; |
1419 |
- status = "okay"; |
1420 |
- }; |
1421 |
- |
1422 |
-diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
1423 |
-index 42e992f9c8a5..c92ad664cb0e 100644 |
1424 |
---- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
1425 |
-+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi |
1426 |
-@@ -47,6 +47,7 @@ |
1427 |
- phys = <&comphy1 0>; |
1428 |
- pinctrl-names = "default"; |
1429 |
- pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; |
1430 |
-+ reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; |
1431 |
- }; |
1432 |
- |
1433 |
- /* J6 */ |
1434 |
-diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1435 |
-index bb42d1e6a4e9..1452c821f8c0 100644 |
1436 |
---- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1437 |
-+++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts |
1438 |
-@@ -95,7 +95,7 @@ |
1439 |
- }; |
1440 |
- |
1441 |
- sfp: sfp { |
1442 |
-- compatible = "sff,sfp+"; |
1443 |
-+ compatible = "sff,sfp"; |
1444 |
- i2c-bus = <&i2c0>; |
1445 |
- los-gpio = <&moxtet_sfp 0 GPIO_ACTIVE_HIGH>; |
1446 |
- tx-fault-gpio = <&moxtet_sfp 1 GPIO_ACTIVE_HIGH>; |
1447 |
-@@ -128,10 +128,6 @@ |
1448 |
- }; |
1449 |
- }; |
1450 |
- |
1451 |
--&pcie_reset_pins { |
1452 |
-- function = "gpio"; |
1453 |
--}; |
1454 |
-- |
1455 |
- &pcie0 { |
1456 |
- pinctrl-names = "default"; |
1457 |
- pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; |
1458 |
-@@ -179,6 +175,8 @@ |
1459 |
- marvell,pad-type = "sd"; |
1460 |
- vqmmc-supply = <&vsdio_reg>; |
1461 |
- mmc-pwrseq = <&sdhci1_pwrseq>; |
1462 |
-+ /* forbid SDR104 for FCC purposes */ |
1463 |
-+ sdhci-caps-mask = <0x2 0x0>; |
1464 |
- status = "okay"; |
1465 |
- }; |
1466 |
- |
1467 |
-diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
1468 |
-index 000c135e39b7..7909c146eabf 100644 |
1469 |
---- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
1470 |
-+++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi |
1471 |
-@@ -317,7 +317,7 @@ |
1472 |
- |
1473 |
- pcie_reset_pins: pcie-reset-pins { |
1474 |
- groups = "pcie1"; |
1475 |
-- function = "pcie"; |
1476 |
-+ function = "gpio"; |
1477 |
- }; |
1478 |
- |
1479 |
- pcie_clkreq_pins: pcie-clkreq-pins { |
1480 |
-diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
1481 |
-index d819e44d94a8..6ad1053afd27 100644 |
1482 |
---- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
1483 |
-+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi |
1484 |
-@@ -242,21 +242,21 @@ |
1485 |
- cpu_on = <0x84000003>; |
1486 |
- }; |
1487 |
- |
1488 |
-- clk26m: oscillator@0 { |
1489 |
-+ clk26m: oscillator0 { |
1490 |
- compatible = "fixed-clock"; |
1491 |
- #clock-cells = <0>; |
1492 |
- clock-frequency = <26000000>; |
1493 |
- clock-output-names = "clk26m"; |
1494 |
- }; |
1495 |
- |
1496 |
-- clk32k: oscillator@1 { |
1497 |
-+ clk32k: oscillator1 { |
1498 |
- compatible = "fixed-clock"; |
1499 |
- #clock-cells = <0>; |
1500 |
- clock-frequency = <32000>; |
1501 |
- clock-output-names = "clk32k"; |
1502 |
- }; |
1503 |
- |
1504 |
-- cpum_ck: oscillator@2 { |
1505 |
-+ cpum_ck: oscillator2 { |
1506 |
- compatible = "fixed-clock"; |
1507 |
- #clock-cells = <0>; |
1508 |
- clock-frequency = <0>; |
1509 |
-@@ -272,19 +272,19 @@ |
1510 |
- sustainable-power = <1500>; /* milliwatts */ |
1511 |
- |
1512 |
- trips { |
1513 |
-- threshold: trip-point@0 { |
1514 |
-+ threshold: trip-point0 { |
1515 |
- temperature = <68000>; |
1516 |
- hysteresis = <2000>; |
1517 |
- type = "passive"; |
1518 |
- }; |
1519 |
- |
1520 |
-- target: trip-point@1 { |
1521 |
-+ target: trip-point1 { |
1522 |
- temperature = <85000>; |
1523 |
- hysteresis = <2000>; |
1524 |
- type = "passive"; |
1525 |
- }; |
1526 |
- |
1527 |
-- cpu_crit: cpu_crit@0 { |
1528 |
-+ cpu_crit: cpu_crit0 { |
1529 |
- temperature = <115000>; |
1530 |
- hysteresis = <2000>; |
1531 |
- type = "critical"; |
1532 |
-@@ -292,13 +292,13 @@ |
1533 |
- }; |
1534 |
- |
1535 |
- cooling-maps { |
1536 |
-- map@0 { |
1537 |
-+ map0 { |
1538 |
- trip = <&target>; |
1539 |
- cooling-device = <&cpu0 0 0>, |
1540 |
- <&cpu1 0 0>; |
1541 |
- contribution = <3072>; |
1542 |
- }; |
1543 |
-- map@1 { |
1544 |
-+ map1 { |
1545 |
- trip = <&target>; |
1546 |
- cooling-device = <&cpu2 0 0>, |
1547 |
- <&cpu3 0 0>; |
1548 |
-@@ -312,7 +312,7 @@ |
1549 |
- #address-cells = <2>; |
1550 |
- #size-cells = <2>; |
1551 |
- ranges; |
1552 |
-- vpu_dma_reserved: vpu_dma_mem_region { |
1553 |
-+ vpu_dma_reserved: vpu_dma_mem_region@b7000000 { |
1554 |
- compatible = "shared-dma-pool"; |
1555 |
- reg = <0 0xb7000000 0 0x500000>; |
1556 |
- alignment = <0x1000>; |
1557 |
-@@ -365,7 +365,7 @@ |
1558 |
- reg = <0 0x10005000 0 0x1000>; |
1559 |
- }; |
1560 |
- |
1561 |
-- pio: pinctrl@10005000 { |
1562 |
-+ pio: pinctrl@1000b000 { |
1563 |
- compatible = "mediatek,mt8173-pinctrl"; |
1564 |
- reg = <0 0x1000b000 0 0x1000>; |
1565 |
- mediatek,pctl-regmap = <&syscfg_pctl_a>; |
1566 |
-@@ -572,7 +572,7 @@ |
1567 |
- status = "disabled"; |
1568 |
- }; |
1569 |
- |
1570 |
-- gic: interrupt-controller@10220000 { |
1571 |
-+ gic: interrupt-controller@10221000 { |
1572 |
- compatible = "arm,gic-400"; |
1573 |
- #interrupt-cells = <3>; |
1574 |
- interrupt-parent = <&gic>; |
1575 |
-diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1576 |
-index 623f7d7d216b..8e3136dfdd62 100644 |
1577 |
---- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1578 |
-+++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi |
1579 |
-@@ -33,7 +33,7 @@ |
1580 |
- |
1581 |
- phy-reset-gpios = <&gpio TEGRA194_MAIN_GPIO(G, 5) GPIO_ACTIVE_LOW>; |
1582 |
- phy-handle = <&phy>; |
1583 |
-- phy-mode = "rgmii"; |
1584 |
-+ phy-mode = "rgmii-id"; |
1585 |
- |
1586 |
- mdio { |
1587 |
- #address-cells = <1>; |
1588 |
-diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1589 |
-index f4ede86e32b4..3c928360f4ed 100644 |
1590 |
---- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1591 |
-+++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi |
1592 |
-@@ -1387,7 +1387,7 @@ |
1593 |
- |
1594 |
- bus-range = <0x0 0xff>; |
1595 |
- ranges = <0x81000000 0x0 0x30100000 0x0 0x30100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1596 |
-- 0xc2000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1597 |
-+ 0xc3000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1598 |
- 0x82000000 0x0 0x40000000 0x12 0x30000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1599 |
- }; |
1600 |
- |
1601 |
-@@ -1432,7 +1432,7 @@ |
1602 |
- |
1603 |
- bus-range = <0x0 0xff>; |
1604 |
- ranges = <0x81000000 0x0 0x32100000 0x0 0x32100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1605 |
-- 0xc2000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1606 |
-+ 0xc3000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1607 |
- 0x82000000 0x0 0x40000000 0x12 0x70000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1608 |
- }; |
1609 |
- |
1610 |
-@@ -1477,7 +1477,7 @@ |
1611 |
- |
1612 |
- bus-range = <0x0 0xff>; |
1613 |
- ranges = <0x81000000 0x0 0x34100000 0x0 0x34100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1614 |
-- 0xc2000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1615 |
-+ 0xc3000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ |
1616 |
- 0x82000000 0x0 0x40000000 0x12 0xb0000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ |
1617 |
- }; |
1618 |
- |
1619 |
-@@ -1522,7 +1522,7 @@ |
1620 |
- |
1621 |
- bus-range = <0x0 0xff>; |
1622 |
- ranges = <0x81000000 0x0 0x36100000 0x0 0x36100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1623 |
-- 0xc2000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1624 |
-+ 0xc3000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1625 |
- 0x82000000 0x0 0x40000000 0x17 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1626 |
- }; |
1627 |
- |
1628 |
-@@ -1567,7 +1567,7 @@ |
1629 |
- |
1630 |
- bus-range = <0x0 0xff>; |
1631 |
- ranges = <0x81000000 0x0 0x38100000 0x0 0x38100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1632 |
-- 0xc2000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1633 |
-+ 0xc3000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1634 |
- 0x82000000 0x0 0x40000000 0x1b 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1635 |
- }; |
1636 |
- |
1637 |
-@@ -1616,7 +1616,7 @@ |
1638 |
- |
1639 |
- bus-range = <0x0 0xff>; |
1640 |
- ranges = <0x81000000 0x0 0x3a100000 0x0 0x3a100000 0x0 0x00100000 /* downstream I/O (1MB) */ |
1641 |
-- 0xc2000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1642 |
-+ 0xc3000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ |
1643 |
- 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ |
1644 |
- }; |
1645 |
- |
1646 |
-diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |
1647 |
-index c4abbccf2bed..eaa1eb70b455 100644 |
1648 |
---- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |
1649 |
-+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi |
1650 |
-@@ -117,16 +117,6 @@ |
1651 |
- regulator-max-microvolt = <3700000>; |
1652 |
- }; |
1653 |
- |
1654 |
-- vreg_s8a_l3a_input: vreg-s8a-l3a-input { |
1655 |
-- compatible = "regulator-fixed"; |
1656 |
-- regulator-name = "vreg_s8a_l3a_input"; |
1657 |
-- regulator-always-on; |
1658 |
-- regulator-boot-on; |
1659 |
-- |
1660 |
-- regulator-min-microvolt = <0>; |
1661 |
-- regulator-max-microvolt = <0>; |
1662 |
-- }; |
1663 |
-- |
1664 |
- wlan_en: wlan-en-1-8v { |
1665 |
- pinctrl-names = "default"; |
1666 |
- pinctrl-0 = <&wlan_en_gpios>; |
1667 |
-@@ -705,14 +695,14 @@ |
1668 |
- vdd_s11-supply = <&vph_pwr>; |
1669 |
- vdd_s12-supply = <&vph_pwr>; |
1670 |
- vdd_l2_l26_l28-supply = <&vreg_s3a_1p3>; |
1671 |
-- vdd_l3_l11-supply = <&vreg_s8a_l3a_input>; |
1672 |
-+ vdd_l3_l11-supply = <&vreg_s3a_1p3>; |
1673 |
- vdd_l4_l27_l31-supply = <&vreg_s3a_1p3>; |
1674 |
- vdd_l5_l7-supply = <&vreg_s5a_2p15>; |
1675 |
- vdd_l6_l12_l32-supply = <&vreg_s5a_2p15>; |
1676 |
- vdd_l8_l16_l30-supply = <&vph_pwr>; |
1677 |
- vdd_l14_l15-supply = <&vreg_s5a_2p15>; |
1678 |
- vdd_l25-supply = <&vreg_s3a_1p3>; |
1679 |
-- vdd_lvs1_2-supply = <&vreg_s4a_1p8>; |
1680 |
-+ vdd_lvs1_lvs2-supply = <&vreg_s4a_1p8>; |
1681 |
- |
1682 |
- vreg_s3a_1p3: s3 { |
1683 |
- regulator-name = "vreg_s3a_1p3"; |
1684 |
-diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1685 |
-index a88a15f2352b..5548d7b5096c 100644 |
1686 |
---- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1687 |
-+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
1688 |
-@@ -261,7 +261,7 @@ |
1689 |
- thermal-sensors = <&tsens 4>; |
1690 |
- |
1691 |
- trips { |
1692 |
-- cpu2_3_alert0: trip-point@0 { |
1693 |
-+ cpu2_3_alert0: trip-point0 { |
1694 |
- temperature = <75000>; |
1695 |
- hysteresis = <2000>; |
1696 |
- type = "passive"; |
1697 |
-@@ -291,7 +291,7 @@ |
1698 |
- thermal-sensors = <&tsens 2>; |
1699 |
- |
1700 |
- trips { |
1701 |
-- gpu_alert0: trip-point@0 { |
1702 |
-+ gpu_alert0: trip-point0 { |
1703 |
- temperature = <75000>; |
1704 |
- hysteresis = <2000>; |
1705 |
- type = "passive"; |
1706 |
-@@ -311,7 +311,7 @@ |
1707 |
- thermal-sensors = <&tsens 1>; |
1708 |
- |
1709 |
- trips { |
1710 |
-- cam_alert0: trip-point@0 { |
1711 |
-+ cam_alert0: trip-point0 { |
1712 |
- temperature = <75000>; |
1713 |
- hysteresis = <2000>; |
1714 |
- type = "hot"; |
1715 |
-@@ -326,7 +326,7 @@ |
1716 |
- thermal-sensors = <&tsens 0>; |
1717 |
- |
1718 |
- trips { |
1719 |
-- modem_alert0: trip-point@0 { |
1720 |
-+ modem_alert0: trip-point0 { |
1721 |
- temperature = <85000>; |
1722 |
- hysteresis = <2000>; |
1723 |
- type = "hot"; |
1724 |
-diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1725 |
-index 98634d5c4440..d22c364b520a 100644 |
1726 |
---- a/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1727 |
-+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi |
1728 |
-@@ -989,16 +989,16 @@ |
1729 |
- "csi_clk_mux", |
1730 |
- "vfe0", |
1731 |
- "vfe1"; |
1732 |
-- interrupts = <GIC_SPI 78 0>, |
1733 |
-- <GIC_SPI 79 0>, |
1734 |
-- <GIC_SPI 80 0>, |
1735 |
-- <GIC_SPI 296 0>, |
1736 |
-- <GIC_SPI 297 0>, |
1737 |
-- <GIC_SPI 298 0>, |
1738 |
-- <GIC_SPI 299 0>, |
1739 |
-- <GIC_SPI 309 0>, |
1740 |
-- <GIC_SPI 314 0>, |
1741 |
-- <GIC_SPI 315 0>; |
1742 |
-+ interrupts = <GIC_SPI 78 IRQ_TYPE_EDGE_RISING>, |
1743 |
-+ <GIC_SPI 79 IRQ_TYPE_EDGE_RISING>, |
1744 |
-+ <GIC_SPI 80 IRQ_TYPE_EDGE_RISING>, |
1745 |
-+ <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>, |
1746 |
-+ <GIC_SPI 297 IRQ_TYPE_EDGE_RISING>, |
1747 |
-+ <GIC_SPI 298 IRQ_TYPE_EDGE_RISING>, |
1748 |
-+ <GIC_SPI 299 IRQ_TYPE_EDGE_RISING>, |
1749 |
-+ <GIC_SPI 309 IRQ_TYPE_EDGE_RISING>, |
1750 |
-+ <GIC_SPI 314 IRQ_TYPE_EDGE_RISING>, |
1751 |
-+ <GIC_SPI 315 IRQ_TYPE_EDGE_RISING>; |
1752 |
- interrupt-names = "csiphy0", |
1753 |
- "csiphy1", |
1754 |
- "csiphy2", |
1755 |
-diff --git a/arch/arm64/boot/dts/qcom/pm8150.dtsi b/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1756 |
-index b6e304748a57..c0b197458665 100644 |
1757 |
---- a/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1758 |
-+++ b/arch/arm64/boot/dts/qcom/pm8150.dtsi |
1759 |
-@@ -73,18 +73,8 @@ |
1760 |
- reg = <0xc000>; |
1761 |
- gpio-controller; |
1762 |
- #gpio-cells = <2>; |
1763 |
-- interrupts = <0x0 0xc0 0x0 IRQ_TYPE_NONE>, |
1764 |
-- <0x0 0xc1 0x0 IRQ_TYPE_NONE>, |
1765 |
-- <0x0 0xc2 0x0 IRQ_TYPE_NONE>, |
1766 |
-- <0x0 0xc3 0x0 IRQ_TYPE_NONE>, |
1767 |
-- <0x0 0xc4 0x0 IRQ_TYPE_NONE>, |
1768 |
-- <0x0 0xc5 0x0 IRQ_TYPE_NONE>, |
1769 |
-- <0x0 0xc6 0x0 IRQ_TYPE_NONE>, |
1770 |
-- <0x0 0xc7 0x0 IRQ_TYPE_NONE>, |
1771 |
-- <0x0 0xc8 0x0 IRQ_TYPE_NONE>, |
1772 |
-- <0x0 0xc9 0x0 IRQ_TYPE_NONE>, |
1773 |
-- <0x0 0xca 0x0 IRQ_TYPE_NONE>, |
1774 |
-- <0x0 0xcb 0x0 IRQ_TYPE_NONE>; |
1775 |
-+ interrupt-controller; |
1776 |
-+ #interrupt-cells = <2>; |
1777 |
- }; |
1778 |
- }; |
1779 |
- |
1780 |
-diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1781 |
-index 322379d5c31f..40b5d75a4a1d 100644 |
1782 |
---- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1783 |
-+++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi |
1784 |
-@@ -62,18 +62,8 @@ |
1785 |
- reg = <0xc000>; |
1786 |
- gpio-controller; |
1787 |
- #gpio-cells = <2>; |
1788 |
-- interrupts = <0x2 0xc0 0x0 IRQ_TYPE_NONE>, |
1789 |
-- <0x2 0xc1 0x0 IRQ_TYPE_NONE>, |
1790 |
-- <0x2 0xc2 0x0 IRQ_TYPE_NONE>, |
1791 |
-- <0x2 0xc3 0x0 IRQ_TYPE_NONE>, |
1792 |
-- <0x2 0xc4 0x0 IRQ_TYPE_NONE>, |
1793 |
-- <0x2 0xc5 0x0 IRQ_TYPE_NONE>, |
1794 |
-- <0x2 0xc6 0x0 IRQ_TYPE_NONE>, |
1795 |
-- <0x2 0xc7 0x0 IRQ_TYPE_NONE>, |
1796 |
-- <0x2 0xc8 0x0 IRQ_TYPE_NONE>, |
1797 |
-- <0x2 0xc9 0x0 IRQ_TYPE_NONE>, |
1798 |
-- <0x2 0xca 0x0 IRQ_TYPE_NONE>, |
1799 |
-- <0x2 0xcb 0x0 IRQ_TYPE_NONE>; |
1800 |
-+ interrupt-controller; |
1801 |
-+ #interrupt-cells = <2>; |
1802 |
- }; |
1803 |
- }; |
1804 |
- |
1805 |
-diff --git a/arch/arm64/boot/dts/qcom/pm8150l.dtsi b/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1806 |
-index eb0e9a090e42..cf05e0685d10 100644 |
1807 |
---- a/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1808 |
-+++ b/arch/arm64/boot/dts/qcom/pm8150l.dtsi |
1809 |
-@@ -56,18 +56,8 @@ |
1810 |
- reg = <0xc000>; |
1811 |
- gpio-controller; |
1812 |
- #gpio-cells = <2>; |
1813 |
-- interrupts = <0x4 0xc0 0x0 IRQ_TYPE_NONE>, |
1814 |
-- <0x4 0xc1 0x0 IRQ_TYPE_NONE>, |
1815 |
-- <0x4 0xc2 0x0 IRQ_TYPE_NONE>, |
1816 |
-- <0x4 0xc3 0x0 IRQ_TYPE_NONE>, |
1817 |
-- <0x4 0xc4 0x0 IRQ_TYPE_NONE>, |
1818 |
-- <0x4 0xc5 0x0 IRQ_TYPE_NONE>, |
1819 |
-- <0x4 0xc6 0x0 IRQ_TYPE_NONE>, |
1820 |
-- <0x4 0xc7 0x0 IRQ_TYPE_NONE>, |
1821 |
-- <0x4 0xc8 0x0 IRQ_TYPE_NONE>, |
1822 |
-- <0x4 0xc9 0x0 IRQ_TYPE_NONE>, |
1823 |
-- <0x4 0xca 0x0 IRQ_TYPE_NONE>, |
1824 |
-- <0x4 0xcb 0x0 IRQ_TYPE_NONE>; |
1825 |
-+ interrupt-controller; |
1826 |
-+ #interrupt-cells = <2>; |
1827 |
- }; |
1828 |
- }; |
1829 |
- |
1830 |
-diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1831 |
-index 998f101ad623..eea92b314fc6 100644 |
1832 |
---- a/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1833 |
-+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi |
1834 |
-@@ -1657,8 +1657,7 @@ |
1835 |
- pdc: interrupt-controller@b220000 { |
1836 |
- compatible = "qcom,sc7180-pdc", "qcom,pdc"; |
1837 |
- reg = <0 0x0b220000 0 0x30000>; |
1838 |
-- qcom,pdc-ranges = <0 480 15>, <17 497 98>, |
1839 |
-- <119 634 4>, <124 639 1>; |
1840 |
-+ qcom,pdc-ranges = <0 480 94>, <94 609 31>, <125 63 1>; |
1841 |
- #interrupt-cells = <2>; |
1842 |
- interrupt-parent = <&intc>; |
1843 |
- interrupt-controller; |
1844 |
-diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1845 |
-index 51a670ad15b2..4b9860a2c8eb 100644 |
1846 |
---- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1847 |
-+++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts |
1848 |
-@@ -577,3 +577,14 @@ |
1849 |
- }; |
1850 |
- }; |
1851 |
- }; |
1852 |
-+ |
1853 |
-+&wifi { |
1854 |
-+ status = "okay"; |
1855 |
-+ |
1856 |
-+ vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>; |
1857 |
-+ vdd-1.8-xo-supply = <&vreg_l7a_1p8>; |
1858 |
-+ vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; |
1859 |
-+ vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; |
1860 |
-+ |
1861 |
-+ qcom,snoc-host-cap-8bit-quirk; |
1862 |
-+}; |
1863 |
-diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi |
1864 |
-index 891d83b2afea..2a7eaefd221d 100644 |
1865 |
---- a/arch/arm64/boot/dts/qcom/sm8250.dtsi |
1866 |
-+++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi |
1867 |
-@@ -314,8 +314,8 @@ |
1868 |
- }; |
1869 |
- |
1870 |
- pdc: interrupt-controller@b220000 { |
1871 |
-- compatible = "qcom,sm8250-pdc"; |
1872 |
-- reg = <0x0b220000 0x30000>, <0x17c000f0 0x60>; |
1873 |
-+ compatible = "qcom,sm8250-pdc", "qcom,pdc"; |
1874 |
-+ reg = <0 0x0b220000 0 0x30000>, <0 0x17c000f0 0 0x60>; |
1875 |
- qcom,pdc-ranges = <0 480 94>, <94 609 31>, |
1876 |
- <125 63 1>, <126 716 12>; |
1877 |
- #interrupt-cells = <2>; |
1878 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts b/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts |
1879 |
-index b2dd583146b4..b2e44c6c2d22 100644 |
1880 |
---- a/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts |
1881 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1293-ds418j.dts |
1882 |
-@@ -1,6 +1,6 @@ |
1883 |
- // SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) |
1884 |
- /* |
1885 |
-- * Copyright (c) 2017 Andreas Färber |
1886 |
-+ * Copyright (c) 2017-2019 Andreas Färber |
1887 |
- */ |
1888 |
- |
1889 |
- /dts-v1/; |
1890 |
-@@ -11,9 +11,9 @@ |
1891 |
- compatible = "synology,ds418j", "realtek,rtd1293"; |
1892 |
- model = "Synology DiskStation DS418j"; |
1893 |
- |
1894 |
-- memory@0 { |
1895 |
-+ memory@1f000 { |
1896 |
- device_type = "memory"; |
1897 |
-- reg = <0x0 0x40000000>; |
1898 |
-+ reg = <0x1f000 0x3ffe1000>; /* boot ROM to 1 GiB */ |
1899 |
- }; |
1900 |
- |
1901 |
- aliases { |
1902 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1293.dtsi b/arch/arm64/boot/dts/realtek/rtd1293.dtsi |
1903 |
-index bd4e22723f7b..2d92b56ac94d 100644 |
1904 |
---- a/arch/arm64/boot/dts/realtek/rtd1293.dtsi |
1905 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1293.dtsi |
1906 |
-@@ -36,16 +36,20 @@ |
1907 |
- timer { |
1908 |
- compatible = "arm,armv8-timer"; |
1909 |
- interrupts = <GIC_PPI 13 |
1910 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
1911 |
-+ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
1912 |
- <GIC_PPI 14 |
1913 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
1914 |
-+ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
1915 |
- <GIC_PPI 11 |
1916 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
1917 |
-+ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, |
1918 |
- <GIC_PPI 10 |
1919 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>; |
1920 |
-+ (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
1921 |
- }; |
1922 |
- }; |
1923 |
- |
1924 |
- &arm_pmu { |
1925 |
- interrupt-affinity = <&cpu0>, <&cpu1>; |
1926 |
- }; |
1927 |
-+ |
1928 |
-+&gic { |
1929 |
-+ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; |
1930 |
-+}; |
1931 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts b/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts |
1932 |
-index bd584e99fff9..cf4a57c012a8 100644 |
1933 |
---- a/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts |
1934 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1295-mele-v9.dts |
1935 |
-@@ -1,5 +1,5 @@ |
1936 |
- /* |
1937 |
-- * Copyright (c) 2017 Andreas Färber |
1938 |
-+ * Copyright (c) 2017-2019 Andreas Färber |
1939 |
- * |
1940 |
- * SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
1941 |
- */ |
1942 |
-@@ -12,9 +12,9 @@ |
1943 |
- compatible = "mele,v9", "realtek,rtd1295"; |
1944 |
- model = "MeLE V9"; |
1945 |
- |
1946 |
-- memory@0 { |
1947 |
-+ memory@1f000 { |
1948 |
- device_type = "memory"; |
1949 |
-- reg = <0x0 0x80000000>; |
1950 |
-+ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
1951 |
- }; |
1952 |
- |
1953 |
- aliases { |
1954 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts b/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts |
1955 |
-index 8e2b0e75298a..14161c3f304d 100644 |
1956 |
---- a/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts |
1957 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts |
1958 |
-@@ -1,5 +1,5 @@ |
1959 |
- /* |
1960 |
-- * Copyright (c) 2017 Andreas Färber |
1961 |
-+ * Copyright (c) 2017-2019 Andreas Färber |
1962 |
- * |
1963 |
- * SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
1964 |
- */ |
1965 |
-@@ -12,9 +12,9 @@ |
1966 |
- compatible = "probox2,ava", "realtek,rtd1295"; |
1967 |
- model = "PROBOX2 AVA"; |
1968 |
- |
1969 |
-- memory@0 { |
1970 |
-+ memory@1f000 { |
1971 |
- device_type = "memory"; |
1972 |
-- reg = <0x0 0x80000000>; |
1973 |
-+ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
1974 |
- }; |
1975 |
- |
1976 |
- aliases { |
1977 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts |
1978 |
-index e98e508b9514..4beb37bb9522 100644 |
1979 |
---- a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts |
1980 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts |
1981 |
-@@ -11,9 +11,9 @@ |
1982 |
- compatible = "zidoo,x9s", "realtek,rtd1295"; |
1983 |
- model = "Zidoo X9S"; |
1984 |
- |
1985 |
-- memory@0 { |
1986 |
-+ memory@1f000 { |
1987 |
- device_type = "memory"; |
1988 |
-- reg = <0x0 0x80000000>; |
1989 |
-+ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
1990 |
- }; |
1991 |
- |
1992 |
- aliases { |
1993 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1295.dtsi b/arch/arm64/boot/dts/realtek/rtd1295.dtsi |
1994 |
-index 93f0e1d97721..1402abe80ea1 100644 |
1995 |
---- a/arch/arm64/boot/dts/realtek/rtd1295.dtsi |
1996 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1295.dtsi |
1997 |
-@@ -2,7 +2,7 @@ |
1998 |
- /* |
1999 |
- * Realtek RTD1295 SoC |
2000 |
- * |
2001 |
-- * Copyright (c) 2016-2017 Andreas Färber |
2002 |
-+ * Copyright (c) 2016-2019 Andreas Färber |
2003 |
- */ |
2004 |
- |
2005 |
- #include "rtd129x.dtsi" |
2006 |
-@@ -47,27 +47,16 @@ |
2007 |
- }; |
2008 |
- }; |
2009 |
- |
2010 |
-- reserved-memory { |
2011 |
-- #address-cells = <1>; |
2012 |
-- #size-cells = <1>; |
2013 |
-- ranges; |
2014 |
-- |
2015 |
-- tee@10100000 { |
2016 |
-- reg = <0x10100000 0xf00000>; |
2017 |
-- no-map; |
2018 |
-- }; |
2019 |
-- }; |
2020 |
-- |
2021 |
- timer { |
2022 |
- compatible = "arm,armv8-timer"; |
2023 |
- interrupts = <GIC_PPI 13 |
2024 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2025 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2026 |
- <GIC_PPI 14 |
2027 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2028 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2029 |
- <GIC_PPI 11 |
2030 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2031 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2032 |
- <GIC_PPI 10 |
2033 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>; |
2034 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
2035 |
- }; |
2036 |
- }; |
2037 |
- |
2038 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts b/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts |
2039 |
-index 5a051a52bf88..cc706d13da8b 100644 |
2040 |
---- a/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts |
2041 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1296-ds418.dts |
2042 |
-@@ -11,9 +11,9 @@ |
2043 |
- compatible = "synology,ds418", "realtek,rtd1296"; |
2044 |
- model = "Synology DiskStation DS418"; |
2045 |
- |
2046 |
-- memory@0 { |
2047 |
-+ memory@1f000 { |
2048 |
- device_type = "memory"; |
2049 |
-- reg = <0x0 0x80000000>; |
2050 |
-+ reg = <0x1f000 0x7ffe1000>; /* boot ROM to 2 GiB */ |
2051 |
- }; |
2052 |
- |
2053 |
- aliases { |
2054 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd1296.dtsi b/arch/arm64/boot/dts/realtek/rtd1296.dtsi |
2055 |
-index 0f9e59cac086..fb864a139c97 100644 |
2056 |
---- a/arch/arm64/boot/dts/realtek/rtd1296.dtsi |
2057 |
-+++ b/arch/arm64/boot/dts/realtek/rtd1296.dtsi |
2058 |
-@@ -50,13 +50,13 @@ |
2059 |
- timer { |
2060 |
- compatible = "arm,armv8-timer"; |
2061 |
- interrupts = <GIC_PPI 13 |
2062 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2063 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2064 |
- <GIC_PPI 14 |
2065 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2066 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2067 |
- <GIC_PPI 11 |
2068 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>, |
2069 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
2070 |
- <GIC_PPI 10 |
2071 |
-- (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>; |
2072 |
-+ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
2073 |
- }; |
2074 |
- }; |
2075 |
- |
2076 |
-diff --git a/arch/arm64/boot/dts/realtek/rtd129x.dtsi b/arch/arm64/boot/dts/realtek/rtd129x.dtsi |
2077 |
-index 4433114476f5..b63d0c03597a 100644 |
2078 |
---- a/arch/arm64/boot/dts/realtek/rtd129x.dtsi |
2079 |
-+++ b/arch/arm64/boot/dts/realtek/rtd129x.dtsi |
2080 |
-@@ -2,14 +2,12 @@ |
2081 |
- /* |
2082 |
- * Realtek RTD1293/RTD1295/RTD1296 SoC |
2083 |
- * |
2084 |
-- * Copyright (c) 2016-2017 Andreas Färber |
2085 |
-+ * Copyright (c) 2016-2019 Andreas Färber |
2086 |
- */ |
2087 |
- |
2088 |
--/memreserve/ 0x0000000000000000 0x0000000000030000; |
2089 |
--/memreserve/ 0x000000000001f000 0x0000000000001000; |
2090 |
--/memreserve/ 0x0000000000030000 0x00000000000d0000; |
2091 |
-+/memreserve/ 0x0000000000000000 0x000000000001f000; |
2092 |
-+/memreserve/ 0x000000000001f000 0x00000000000e1000; |
2093 |
- /memreserve/ 0x0000000001b00000 0x00000000004be000; |
2094 |
--/memreserve/ 0x0000000001ffe000 0x0000000000004000; |
2095 |
- |
2096 |
- #include <dt-bindings/interrupt-controller/arm-gic.h> |
2097 |
- #include <dt-bindings/reset/realtek,rtd1295.h> |
2098 |
-@@ -19,6 +17,25 @@ |
2099 |
- #address-cells = <1>; |
2100 |
- #size-cells = <1>; |
2101 |
- |
2102 |
-+ reserved-memory { |
2103 |
-+ #address-cells = <1>; |
2104 |
-+ #size-cells = <1>; |
2105 |
-+ ranges; |
2106 |
-+ |
2107 |
-+ rpc_comm: rpc@1f000 { |
2108 |
-+ reg = <0x1f000 0x1000>; |
2109 |
-+ }; |
2110 |
-+ |
2111 |
-+ rpc_ringbuf: rpc@1ffe000 { |
2112 |
-+ reg = <0x1ffe000 0x4000>; |
2113 |
-+ }; |
2114 |
-+ |
2115 |
-+ tee: tee@10100000 { |
2116 |
-+ reg = <0x10100000 0xf00000>; |
2117 |
-+ no-map; |
2118 |
-+ }; |
2119 |
-+ }; |
2120 |
-+ |
2121 |
- arm_pmu: arm-pmu { |
2122 |
- compatible = "arm,cortex-a53-pmu"; |
2123 |
- interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; |
2124 |
-@@ -35,8 +52,9 @@ |
2125 |
- compatible = "simple-bus"; |
2126 |
- #address-cells = <1>; |
2127 |
- #size-cells = <1>; |
2128 |
-- /* Exclude up to 2 GiB of RAM */ |
2129 |
-- ranges = <0x80000000 0x80000000 0x80000000>; |
2130 |
-+ ranges = <0x00000000 0x00000000 0x0001f000>, /* boot ROM */ |
2131 |
-+ /* Exclude up to 2 GiB of RAM */ |
2132 |
-+ <0x80000000 0x80000000 0x80000000>; |
2133 |
- |
2134 |
- reset1: reset-controller@98000000 { |
2135 |
- compatible = "snps,dw-low-reset"; |
2136 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
2137 |
-index 79023433a740..a603d947970e 100644 |
2138 |
---- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
2139 |
-+++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi |
2140 |
-@@ -1000,7 +1000,7 @@ |
2141 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2142 |
- }; |
2143 |
- |
2144 |
-- ipmmu_ds0: mmu@e6740000 { |
2145 |
-+ ipmmu_ds0: iommu@e6740000 { |
2146 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2147 |
- reg = <0 0xe6740000 0 0x1000>; |
2148 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2149 |
-@@ -1008,7 +1008,7 @@ |
2150 |
- #iommu-cells = <1>; |
2151 |
- }; |
2152 |
- |
2153 |
-- ipmmu_ds1: mmu@e7740000 { |
2154 |
-+ ipmmu_ds1: iommu@e7740000 { |
2155 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2156 |
- reg = <0 0xe7740000 0 0x1000>; |
2157 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2158 |
-@@ -1016,7 +1016,7 @@ |
2159 |
- #iommu-cells = <1>; |
2160 |
- }; |
2161 |
- |
2162 |
-- ipmmu_hc: mmu@e6570000 { |
2163 |
-+ ipmmu_hc: iommu@e6570000 { |
2164 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2165 |
- reg = <0 0xe6570000 0 0x1000>; |
2166 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2167 |
-@@ -1024,7 +1024,7 @@ |
2168 |
- #iommu-cells = <1>; |
2169 |
- }; |
2170 |
- |
2171 |
-- ipmmu_mm: mmu@e67b0000 { |
2172 |
-+ ipmmu_mm: iommu@e67b0000 { |
2173 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2174 |
- reg = <0 0xe67b0000 0 0x1000>; |
2175 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2176 |
-@@ -1033,7 +1033,7 @@ |
2177 |
- #iommu-cells = <1>; |
2178 |
- }; |
2179 |
- |
2180 |
-- ipmmu_mp: mmu@ec670000 { |
2181 |
-+ ipmmu_mp: iommu@ec670000 { |
2182 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2183 |
- reg = <0 0xec670000 0 0x1000>; |
2184 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2185 |
-@@ -1041,7 +1041,7 @@ |
2186 |
- #iommu-cells = <1>; |
2187 |
- }; |
2188 |
- |
2189 |
-- ipmmu_pv0: mmu@fd800000 { |
2190 |
-+ ipmmu_pv0: iommu@fd800000 { |
2191 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2192 |
- reg = <0 0xfd800000 0 0x1000>; |
2193 |
- renesas,ipmmu-main = <&ipmmu_mm 5>; |
2194 |
-@@ -1049,7 +1049,7 @@ |
2195 |
- #iommu-cells = <1>; |
2196 |
- }; |
2197 |
- |
2198 |
-- ipmmu_pv1: mmu@fd950000 { |
2199 |
-+ ipmmu_pv1: iommu@fd950000 { |
2200 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2201 |
- reg = <0 0xfd950000 0 0x1000>; |
2202 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2203 |
-@@ -1057,7 +1057,7 @@ |
2204 |
- #iommu-cells = <1>; |
2205 |
- }; |
2206 |
- |
2207 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2208 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2209 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2210 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2211 |
- renesas,ipmmu-main = <&ipmmu_mm 8>; |
2212 |
-@@ -1065,7 +1065,7 @@ |
2213 |
- #iommu-cells = <1>; |
2214 |
- }; |
2215 |
- |
2216 |
-- ipmmu_vi0: mmu@febd0000 { |
2217 |
-+ ipmmu_vi0: iommu@febd0000 { |
2218 |
- compatible = "renesas,ipmmu-r8a774a1"; |
2219 |
- reg = <0 0xfebd0000 0 0x1000>; |
2220 |
- renesas,ipmmu-main = <&ipmmu_mm 9>; |
2221 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
2222 |
-index 3137f735974b..1e51855c7cd3 100644 |
2223 |
---- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
2224 |
-+++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi |
2225 |
-@@ -874,7 +874,7 @@ |
2226 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2227 |
- }; |
2228 |
- |
2229 |
-- ipmmu_ds0: mmu@e6740000 { |
2230 |
-+ ipmmu_ds0: iommu@e6740000 { |
2231 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2232 |
- reg = <0 0xe6740000 0 0x1000>; |
2233 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2234 |
-@@ -882,7 +882,7 @@ |
2235 |
- #iommu-cells = <1>; |
2236 |
- }; |
2237 |
- |
2238 |
-- ipmmu_ds1: mmu@e7740000 { |
2239 |
-+ ipmmu_ds1: iommu@e7740000 { |
2240 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2241 |
- reg = <0 0xe7740000 0 0x1000>; |
2242 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2243 |
-@@ -890,7 +890,7 @@ |
2244 |
- #iommu-cells = <1>; |
2245 |
- }; |
2246 |
- |
2247 |
-- ipmmu_hc: mmu@e6570000 { |
2248 |
-+ ipmmu_hc: iommu@e6570000 { |
2249 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2250 |
- reg = <0 0xe6570000 0 0x1000>; |
2251 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2252 |
-@@ -898,7 +898,7 @@ |
2253 |
- #iommu-cells = <1>; |
2254 |
- }; |
2255 |
- |
2256 |
-- ipmmu_mm: mmu@e67b0000 { |
2257 |
-+ ipmmu_mm: iommu@e67b0000 { |
2258 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2259 |
- reg = <0 0xe67b0000 0 0x1000>; |
2260 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2261 |
-@@ -907,7 +907,7 @@ |
2262 |
- #iommu-cells = <1>; |
2263 |
- }; |
2264 |
- |
2265 |
-- ipmmu_mp: mmu@ec670000 { |
2266 |
-+ ipmmu_mp: iommu@ec670000 { |
2267 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2268 |
- reg = <0 0xec670000 0 0x1000>; |
2269 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2270 |
-@@ -915,7 +915,7 @@ |
2271 |
- #iommu-cells = <1>; |
2272 |
- }; |
2273 |
- |
2274 |
-- ipmmu_pv0: mmu@fd800000 { |
2275 |
-+ ipmmu_pv0: iommu@fd800000 { |
2276 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2277 |
- reg = <0 0xfd800000 0 0x1000>; |
2278 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2279 |
-@@ -923,7 +923,7 @@ |
2280 |
- #iommu-cells = <1>; |
2281 |
- }; |
2282 |
- |
2283 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2284 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2285 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2286 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2287 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
2288 |
-@@ -931,7 +931,7 @@ |
2289 |
- #iommu-cells = <1>; |
2290 |
- }; |
2291 |
- |
2292 |
-- ipmmu_vi0: mmu@febd0000 { |
2293 |
-+ ipmmu_vi0: iommu@febd0000 { |
2294 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2295 |
- reg = <0 0xfebd0000 0 0x1000>; |
2296 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
2297 |
-@@ -939,7 +939,7 @@ |
2298 |
- #iommu-cells = <1>; |
2299 |
- }; |
2300 |
- |
2301 |
-- ipmmu_vp0: mmu@fe990000 { |
2302 |
-+ ipmmu_vp0: iommu@fe990000 { |
2303 |
- compatible = "renesas,ipmmu-r8a774b1"; |
2304 |
- reg = <0 0xfe990000 0 0x1000>; |
2305 |
- renesas,ipmmu-main = <&ipmmu_mm 16>; |
2306 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
2307 |
-index 22785cbddff5..5c72a7efbb03 100644 |
2308 |
---- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
2309 |
-+++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi |
2310 |
-@@ -847,7 +847,7 @@ |
2311 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2312 |
- }; |
2313 |
- |
2314 |
-- ipmmu_ds0: mmu@e6740000 { |
2315 |
-+ ipmmu_ds0: iommu@e6740000 { |
2316 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2317 |
- reg = <0 0xe6740000 0 0x1000>; |
2318 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2319 |
-@@ -855,7 +855,7 @@ |
2320 |
- #iommu-cells = <1>; |
2321 |
- }; |
2322 |
- |
2323 |
-- ipmmu_ds1: mmu@e7740000 { |
2324 |
-+ ipmmu_ds1: iommu@e7740000 { |
2325 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2326 |
- reg = <0 0xe7740000 0 0x1000>; |
2327 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2328 |
-@@ -863,7 +863,7 @@ |
2329 |
- #iommu-cells = <1>; |
2330 |
- }; |
2331 |
- |
2332 |
-- ipmmu_hc: mmu@e6570000 { |
2333 |
-+ ipmmu_hc: iommu@e6570000 { |
2334 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2335 |
- reg = <0 0xe6570000 0 0x1000>; |
2336 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2337 |
-@@ -871,7 +871,7 @@ |
2338 |
- #iommu-cells = <1>; |
2339 |
- }; |
2340 |
- |
2341 |
-- ipmmu_mm: mmu@e67b0000 { |
2342 |
-+ ipmmu_mm: iommu@e67b0000 { |
2343 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2344 |
- reg = <0 0xe67b0000 0 0x1000>; |
2345 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2346 |
-@@ -880,7 +880,7 @@ |
2347 |
- #iommu-cells = <1>; |
2348 |
- }; |
2349 |
- |
2350 |
-- ipmmu_mp: mmu@ec670000 { |
2351 |
-+ ipmmu_mp: iommu@ec670000 { |
2352 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2353 |
- reg = <0 0xec670000 0 0x1000>; |
2354 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2355 |
-@@ -888,7 +888,7 @@ |
2356 |
- #iommu-cells = <1>; |
2357 |
- }; |
2358 |
- |
2359 |
-- ipmmu_pv0: mmu@fd800000 { |
2360 |
-+ ipmmu_pv0: iommu@fd800000 { |
2361 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2362 |
- reg = <0 0xfd800000 0 0x1000>; |
2363 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2364 |
-@@ -896,7 +896,7 @@ |
2365 |
- #iommu-cells = <1>; |
2366 |
- }; |
2367 |
- |
2368 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2369 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2370 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2371 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2372 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
2373 |
-@@ -904,7 +904,7 @@ |
2374 |
- #iommu-cells = <1>; |
2375 |
- }; |
2376 |
- |
2377 |
-- ipmmu_vi0: mmu@febd0000 { |
2378 |
-+ ipmmu_vi0: iommu@febd0000 { |
2379 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2380 |
- reg = <0 0xfebd0000 0 0x1000>; |
2381 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
2382 |
-@@ -912,7 +912,7 @@ |
2383 |
- #iommu-cells = <1>; |
2384 |
- }; |
2385 |
- |
2386 |
-- ipmmu_vp0: mmu@fe990000 { |
2387 |
-+ ipmmu_vp0: iommu@fe990000 { |
2388 |
- compatible = "renesas,ipmmu-r8a774c0"; |
2389 |
- reg = <0 0xfe990000 0 0x1000>; |
2390 |
- renesas,ipmmu-main = <&ipmmu_mm 16>; |
2391 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77950.dtsi b/arch/arm64/boot/dts/renesas/r8a77950.dtsi |
2392 |
-index 3975eecd50c4..d716c4386ae9 100644 |
2393 |
---- a/arch/arm64/boot/dts/renesas/r8a77950.dtsi |
2394 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77950.dtsi |
2395 |
-@@ -77,7 +77,7 @@ |
2396 |
- /delete-node/ dma-controller@e6460000; |
2397 |
- /delete-node/ dma-controller@e6470000; |
2398 |
- |
2399 |
-- ipmmu_mp1: mmu@ec680000 { |
2400 |
-+ ipmmu_mp1: iommu@ec680000 { |
2401 |
- compatible = "renesas,ipmmu-r8a7795"; |
2402 |
- reg = <0 0xec680000 0 0x1000>; |
2403 |
- renesas,ipmmu-main = <&ipmmu_mm 5>; |
2404 |
-@@ -85,7 +85,7 @@ |
2405 |
- #iommu-cells = <1>; |
2406 |
- }; |
2407 |
- |
2408 |
-- ipmmu_sy: mmu@e7730000 { |
2409 |
-+ ipmmu_sy: iommu@e7730000 { |
2410 |
- compatible = "renesas,ipmmu-r8a7795"; |
2411 |
- reg = <0 0xe7730000 0 0x1000>; |
2412 |
- renesas,ipmmu-main = <&ipmmu_mm 8>; |
2413 |
-@@ -93,11 +93,11 @@ |
2414 |
- #iommu-cells = <1>; |
2415 |
- }; |
2416 |
- |
2417 |
-- /delete-node/ mmu@fd950000; |
2418 |
-- /delete-node/ mmu@fd960000; |
2419 |
-- /delete-node/ mmu@fd970000; |
2420 |
-- /delete-node/ mmu@febe0000; |
2421 |
-- /delete-node/ mmu@fe980000; |
2422 |
-+ /delete-node/ iommu@fd950000; |
2423 |
-+ /delete-node/ iommu@fd960000; |
2424 |
-+ /delete-node/ iommu@fd970000; |
2425 |
-+ /delete-node/ iommu@febe0000; |
2426 |
-+ /delete-node/ iommu@fe980000; |
2427 |
- |
2428 |
- xhci1: usb@ee040000 { |
2429 |
- compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci"; |
2430 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77951.dtsi b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
2431 |
-index 52229546454c..61d67d9714ab 100644 |
2432 |
---- a/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
2433 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77951.dtsi |
2434 |
-@@ -1073,7 +1073,7 @@ |
2435 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2436 |
- }; |
2437 |
- |
2438 |
-- ipmmu_ds0: mmu@e6740000 { |
2439 |
-+ ipmmu_ds0: iommu@e6740000 { |
2440 |
- compatible = "renesas,ipmmu-r8a7795"; |
2441 |
- reg = <0 0xe6740000 0 0x1000>; |
2442 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2443 |
-@@ -1081,7 +1081,7 @@ |
2444 |
- #iommu-cells = <1>; |
2445 |
- }; |
2446 |
- |
2447 |
-- ipmmu_ds1: mmu@e7740000 { |
2448 |
-+ ipmmu_ds1: iommu@e7740000 { |
2449 |
- compatible = "renesas,ipmmu-r8a7795"; |
2450 |
- reg = <0 0xe7740000 0 0x1000>; |
2451 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2452 |
-@@ -1089,7 +1089,7 @@ |
2453 |
- #iommu-cells = <1>; |
2454 |
- }; |
2455 |
- |
2456 |
-- ipmmu_hc: mmu@e6570000 { |
2457 |
-+ ipmmu_hc: iommu@e6570000 { |
2458 |
- compatible = "renesas,ipmmu-r8a7795"; |
2459 |
- reg = <0 0xe6570000 0 0x1000>; |
2460 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2461 |
-@@ -1097,7 +1097,7 @@ |
2462 |
- #iommu-cells = <1>; |
2463 |
- }; |
2464 |
- |
2465 |
-- ipmmu_ir: mmu@ff8b0000 { |
2466 |
-+ ipmmu_ir: iommu@ff8b0000 { |
2467 |
- compatible = "renesas,ipmmu-r8a7795"; |
2468 |
- reg = <0 0xff8b0000 0 0x1000>; |
2469 |
- renesas,ipmmu-main = <&ipmmu_mm 3>; |
2470 |
-@@ -1105,7 +1105,7 @@ |
2471 |
- #iommu-cells = <1>; |
2472 |
- }; |
2473 |
- |
2474 |
-- ipmmu_mm: mmu@e67b0000 { |
2475 |
-+ ipmmu_mm: iommu@e67b0000 { |
2476 |
- compatible = "renesas,ipmmu-r8a7795"; |
2477 |
- reg = <0 0xe67b0000 0 0x1000>; |
2478 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2479 |
-@@ -1114,7 +1114,7 @@ |
2480 |
- #iommu-cells = <1>; |
2481 |
- }; |
2482 |
- |
2483 |
-- ipmmu_mp0: mmu@ec670000 { |
2484 |
-+ ipmmu_mp0: iommu@ec670000 { |
2485 |
- compatible = "renesas,ipmmu-r8a7795"; |
2486 |
- reg = <0 0xec670000 0 0x1000>; |
2487 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2488 |
-@@ -1122,7 +1122,7 @@ |
2489 |
- #iommu-cells = <1>; |
2490 |
- }; |
2491 |
- |
2492 |
-- ipmmu_pv0: mmu@fd800000 { |
2493 |
-+ ipmmu_pv0: iommu@fd800000 { |
2494 |
- compatible = "renesas,ipmmu-r8a7795"; |
2495 |
- reg = <0 0xfd800000 0 0x1000>; |
2496 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2497 |
-@@ -1130,7 +1130,7 @@ |
2498 |
- #iommu-cells = <1>; |
2499 |
- }; |
2500 |
- |
2501 |
-- ipmmu_pv1: mmu@fd950000 { |
2502 |
-+ ipmmu_pv1: iommu@fd950000 { |
2503 |
- compatible = "renesas,ipmmu-r8a7795"; |
2504 |
- reg = <0 0xfd950000 0 0x1000>; |
2505 |
- renesas,ipmmu-main = <&ipmmu_mm 7>; |
2506 |
-@@ -1138,7 +1138,7 @@ |
2507 |
- #iommu-cells = <1>; |
2508 |
- }; |
2509 |
- |
2510 |
-- ipmmu_pv2: mmu@fd960000 { |
2511 |
-+ ipmmu_pv2: iommu@fd960000 { |
2512 |
- compatible = "renesas,ipmmu-r8a7795"; |
2513 |
- reg = <0 0xfd960000 0 0x1000>; |
2514 |
- renesas,ipmmu-main = <&ipmmu_mm 8>; |
2515 |
-@@ -1146,7 +1146,7 @@ |
2516 |
- #iommu-cells = <1>; |
2517 |
- }; |
2518 |
- |
2519 |
-- ipmmu_pv3: mmu@fd970000 { |
2520 |
-+ ipmmu_pv3: iommu@fd970000 { |
2521 |
- compatible = "renesas,ipmmu-r8a7795"; |
2522 |
- reg = <0 0xfd970000 0 0x1000>; |
2523 |
- renesas,ipmmu-main = <&ipmmu_mm 9>; |
2524 |
-@@ -1154,7 +1154,7 @@ |
2525 |
- #iommu-cells = <1>; |
2526 |
- }; |
2527 |
- |
2528 |
-- ipmmu_rt: mmu@ffc80000 { |
2529 |
-+ ipmmu_rt: iommu@ffc80000 { |
2530 |
- compatible = "renesas,ipmmu-r8a7795"; |
2531 |
- reg = <0 0xffc80000 0 0x1000>; |
2532 |
- renesas,ipmmu-main = <&ipmmu_mm 10>; |
2533 |
-@@ -1162,7 +1162,7 @@ |
2534 |
- #iommu-cells = <1>; |
2535 |
- }; |
2536 |
- |
2537 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2538 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2539 |
- compatible = "renesas,ipmmu-r8a7795"; |
2540 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2541 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
2542 |
-@@ -1170,7 +1170,7 @@ |
2543 |
- #iommu-cells = <1>; |
2544 |
- }; |
2545 |
- |
2546 |
-- ipmmu_vc1: mmu@fe6f0000 { |
2547 |
-+ ipmmu_vc1: iommu@fe6f0000 { |
2548 |
- compatible = "renesas,ipmmu-r8a7795"; |
2549 |
- reg = <0 0xfe6f0000 0 0x1000>; |
2550 |
- renesas,ipmmu-main = <&ipmmu_mm 13>; |
2551 |
-@@ -1178,7 +1178,7 @@ |
2552 |
- #iommu-cells = <1>; |
2553 |
- }; |
2554 |
- |
2555 |
-- ipmmu_vi0: mmu@febd0000 { |
2556 |
-+ ipmmu_vi0: iommu@febd0000 { |
2557 |
- compatible = "renesas,ipmmu-r8a7795"; |
2558 |
- reg = <0 0xfebd0000 0 0x1000>; |
2559 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
2560 |
-@@ -1186,7 +1186,7 @@ |
2561 |
- #iommu-cells = <1>; |
2562 |
- }; |
2563 |
- |
2564 |
-- ipmmu_vi1: mmu@febe0000 { |
2565 |
-+ ipmmu_vi1: iommu@febe0000 { |
2566 |
- compatible = "renesas,ipmmu-r8a7795"; |
2567 |
- reg = <0 0xfebe0000 0 0x1000>; |
2568 |
- renesas,ipmmu-main = <&ipmmu_mm 15>; |
2569 |
-@@ -1194,7 +1194,7 @@ |
2570 |
- #iommu-cells = <1>; |
2571 |
- }; |
2572 |
- |
2573 |
-- ipmmu_vp0: mmu@fe990000 { |
2574 |
-+ ipmmu_vp0: iommu@fe990000 { |
2575 |
- compatible = "renesas,ipmmu-r8a7795"; |
2576 |
- reg = <0 0xfe990000 0 0x1000>; |
2577 |
- renesas,ipmmu-main = <&ipmmu_mm 16>; |
2578 |
-@@ -1202,7 +1202,7 @@ |
2579 |
- #iommu-cells = <1>; |
2580 |
- }; |
2581 |
- |
2582 |
-- ipmmu_vp1: mmu@fe980000 { |
2583 |
-+ ipmmu_vp1: iommu@fe980000 { |
2584 |
- compatible = "renesas,ipmmu-r8a7795"; |
2585 |
- reg = <0 0xfe980000 0 0x1000>; |
2586 |
- renesas,ipmmu-main = <&ipmmu_mm 17>; |
2587 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
2588 |
-index 31282367d3ac..33bf62acffbb 100644 |
2589 |
---- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
2590 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi |
2591 |
-@@ -997,7 +997,7 @@ |
2592 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2593 |
- }; |
2594 |
- |
2595 |
-- ipmmu_ds0: mmu@e6740000 { |
2596 |
-+ ipmmu_ds0: iommu@e6740000 { |
2597 |
- compatible = "renesas,ipmmu-r8a7796"; |
2598 |
- reg = <0 0xe6740000 0 0x1000>; |
2599 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2600 |
-@@ -1005,7 +1005,7 @@ |
2601 |
- #iommu-cells = <1>; |
2602 |
- }; |
2603 |
- |
2604 |
-- ipmmu_ds1: mmu@e7740000 { |
2605 |
-+ ipmmu_ds1: iommu@e7740000 { |
2606 |
- compatible = "renesas,ipmmu-r8a7796"; |
2607 |
- reg = <0 0xe7740000 0 0x1000>; |
2608 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2609 |
-@@ -1013,7 +1013,7 @@ |
2610 |
- #iommu-cells = <1>; |
2611 |
- }; |
2612 |
- |
2613 |
-- ipmmu_hc: mmu@e6570000 { |
2614 |
-+ ipmmu_hc: iommu@e6570000 { |
2615 |
- compatible = "renesas,ipmmu-r8a7796"; |
2616 |
- reg = <0 0xe6570000 0 0x1000>; |
2617 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2618 |
-@@ -1021,7 +1021,7 @@ |
2619 |
- #iommu-cells = <1>; |
2620 |
- }; |
2621 |
- |
2622 |
-- ipmmu_ir: mmu@ff8b0000 { |
2623 |
-+ ipmmu_ir: iommu@ff8b0000 { |
2624 |
- compatible = "renesas,ipmmu-r8a7796"; |
2625 |
- reg = <0 0xff8b0000 0 0x1000>; |
2626 |
- renesas,ipmmu-main = <&ipmmu_mm 3>; |
2627 |
-@@ -1029,7 +1029,7 @@ |
2628 |
- #iommu-cells = <1>; |
2629 |
- }; |
2630 |
- |
2631 |
-- ipmmu_mm: mmu@e67b0000 { |
2632 |
-+ ipmmu_mm: iommu@e67b0000 { |
2633 |
- compatible = "renesas,ipmmu-r8a7796"; |
2634 |
- reg = <0 0xe67b0000 0 0x1000>; |
2635 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2636 |
-@@ -1038,7 +1038,7 @@ |
2637 |
- #iommu-cells = <1>; |
2638 |
- }; |
2639 |
- |
2640 |
-- ipmmu_mp: mmu@ec670000 { |
2641 |
-+ ipmmu_mp: iommu@ec670000 { |
2642 |
- compatible = "renesas,ipmmu-r8a7796"; |
2643 |
- reg = <0 0xec670000 0 0x1000>; |
2644 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2645 |
-@@ -1046,7 +1046,7 @@ |
2646 |
- #iommu-cells = <1>; |
2647 |
- }; |
2648 |
- |
2649 |
-- ipmmu_pv0: mmu@fd800000 { |
2650 |
-+ ipmmu_pv0: iommu@fd800000 { |
2651 |
- compatible = "renesas,ipmmu-r8a7796"; |
2652 |
- reg = <0 0xfd800000 0 0x1000>; |
2653 |
- renesas,ipmmu-main = <&ipmmu_mm 5>; |
2654 |
-@@ -1054,7 +1054,7 @@ |
2655 |
- #iommu-cells = <1>; |
2656 |
- }; |
2657 |
- |
2658 |
-- ipmmu_pv1: mmu@fd950000 { |
2659 |
-+ ipmmu_pv1: iommu@fd950000 { |
2660 |
- compatible = "renesas,ipmmu-r8a7796"; |
2661 |
- reg = <0 0xfd950000 0 0x1000>; |
2662 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2663 |
-@@ -1062,7 +1062,7 @@ |
2664 |
- #iommu-cells = <1>; |
2665 |
- }; |
2666 |
- |
2667 |
-- ipmmu_rt: mmu@ffc80000 { |
2668 |
-+ ipmmu_rt: iommu@ffc80000 { |
2669 |
- compatible = "renesas,ipmmu-r8a7796"; |
2670 |
- reg = <0 0xffc80000 0 0x1000>; |
2671 |
- renesas,ipmmu-main = <&ipmmu_mm 7>; |
2672 |
-@@ -1070,7 +1070,7 @@ |
2673 |
- #iommu-cells = <1>; |
2674 |
- }; |
2675 |
- |
2676 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2677 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2678 |
- compatible = "renesas,ipmmu-r8a7796"; |
2679 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2680 |
- renesas,ipmmu-main = <&ipmmu_mm 8>; |
2681 |
-@@ -1078,7 +1078,7 @@ |
2682 |
- #iommu-cells = <1>; |
2683 |
- }; |
2684 |
- |
2685 |
-- ipmmu_vi0: mmu@febd0000 { |
2686 |
-+ ipmmu_vi0: iommu@febd0000 { |
2687 |
- compatible = "renesas,ipmmu-r8a7796"; |
2688 |
- reg = <0 0xfebd0000 0 0x1000>; |
2689 |
- renesas,ipmmu-main = <&ipmmu_mm 9>; |
2690 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
2691 |
-index d82dd4e67b62..6f7ab39fd282 100644 |
2692 |
---- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
2693 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi |
2694 |
-@@ -867,7 +867,7 @@ |
2695 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2696 |
- }; |
2697 |
- |
2698 |
-- ipmmu_ds0: mmu@e6740000 { |
2699 |
-+ ipmmu_ds0: iommu@e6740000 { |
2700 |
- compatible = "renesas,ipmmu-r8a77965"; |
2701 |
- reg = <0 0xe6740000 0 0x1000>; |
2702 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2703 |
-@@ -875,7 +875,7 @@ |
2704 |
- #iommu-cells = <1>; |
2705 |
- }; |
2706 |
- |
2707 |
-- ipmmu_ds1: mmu@e7740000 { |
2708 |
-+ ipmmu_ds1: iommu@e7740000 { |
2709 |
- compatible = "renesas,ipmmu-r8a77965"; |
2710 |
- reg = <0 0xe7740000 0 0x1000>; |
2711 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2712 |
-@@ -883,7 +883,7 @@ |
2713 |
- #iommu-cells = <1>; |
2714 |
- }; |
2715 |
- |
2716 |
-- ipmmu_hc: mmu@e6570000 { |
2717 |
-+ ipmmu_hc: iommu@e6570000 { |
2718 |
- compatible = "renesas,ipmmu-r8a77965"; |
2719 |
- reg = <0 0xe6570000 0 0x1000>; |
2720 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2721 |
-@@ -891,7 +891,7 @@ |
2722 |
- #iommu-cells = <1>; |
2723 |
- }; |
2724 |
- |
2725 |
-- ipmmu_mm: mmu@e67b0000 { |
2726 |
-+ ipmmu_mm: iommu@e67b0000 { |
2727 |
- compatible = "renesas,ipmmu-r8a77965"; |
2728 |
- reg = <0 0xe67b0000 0 0x1000>; |
2729 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2730 |
-@@ -900,7 +900,7 @@ |
2731 |
- #iommu-cells = <1>; |
2732 |
- }; |
2733 |
- |
2734 |
-- ipmmu_mp: mmu@ec670000 { |
2735 |
-+ ipmmu_mp: iommu@ec670000 { |
2736 |
- compatible = "renesas,ipmmu-r8a77965"; |
2737 |
- reg = <0 0xec670000 0 0x1000>; |
2738 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2739 |
-@@ -908,7 +908,7 @@ |
2740 |
- #iommu-cells = <1>; |
2741 |
- }; |
2742 |
- |
2743 |
-- ipmmu_pv0: mmu@fd800000 { |
2744 |
-+ ipmmu_pv0: iommu@fd800000 { |
2745 |
- compatible = "renesas,ipmmu-r8a77965"; |
2746 |
- reg = <0 0xfd800000 0 0x1000>; |
2747 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2748 |
-@@ -916,7 +916,7 @@ |
2749 |
- #iommu-cells = <1>; |
2750 |
- }; |
2751 |
- |
2752 |
-- ipmmu_rt: mmu@ffc80000 { |
2753 |
-+ ipmmu_rt: iommu@ffc80000 { |
2754 |
- compatible = "renesas,ipmmu-r8a77965"; |
2755 |
- reg = <0 0xffc80000 0 0x1000>; |
2756 |
- renesas,ipmmu-main = <&ipmmu_mm 10>; |
2757 |
-@@ -924,7 +924,7 @@ |
2758 |
- #iommu-cells = <1>; |
2759 |
- }; |
2760 |
- |
2761 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2762 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2763 |
- compatible = "renesas,ipmmu-r8a77965"; |
2764 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2765 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
2766 |
-@@ -932,7 +932,7 @@ |
2767 |
- #iommu-cells = <1>; |
2768 |
- }; |
2769 |
- |
2770 |
-- ipmmu_vi0: mmu@febd0000 { |
2771 |
-+ ipmmu_vi0: iommu@febd0000 { |
2772 |
- compatible = "renesas,ipmmu-r8a77965"; |
2773 |
- reg = <0 0xfebd0000 0 0x1000>; |
2774 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
2775 |
-@@ -940,7 +940,7 @@ |
2776 |
- #iommu-cells = <1>; |
2777 |
- }; |
2778 |
- |
2779 |
-- ipmmu_vp0: mmu@fe990000 { |
2780 |
-+ ipmmu_vp0: iommu@fe990000 { |
2781 |
- compatible = "renesas,ipmmu-r8a77965"; |
2782 |
- reg = <0 0xfe990000 0 0x1000>; |
2783 |
- renesas,ipmmu-main = <&ipmmu_mm 16>; |
2784 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77970.dtsi b/arch/arm64/boot/dts/renesas/r8a77970.dtsi |
2785 |
-index a009c0ebc8b4..bd95ecb1b40d 100644 |
2786 |
---- a/arch/arm64/boot/dts/renesas/r8a77970.dtsi |
2787 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77970.dtsi |
2788 |
-@@ -985,7 +985,7 @@ |
2789 |
- <&ipmmu_ds1 22>, <&ipmmu_ds1 23>; |
2790 |
- }; |
2791 |
- |
2792 |
-- ipmmu_ds1: mmu@e7740000 { |
2793 |
-+ ipmmu_ds1: iommu@e7740000 { |
2794 |
- compatible = "renesas,ipmmu-r8a77970"; |
2795 |
- reg = <0 0xe7740000 0 0x1000>; |
2796 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2797 |
-@@ -993,7 +993,7 @@ |
2798 |
- #iommu-cells = <1>; |
2799 |
- }; |
2800 |
- |
2801 |
-- ipmmu_ir: mmu@ff8b0000 { |
2802 |
-+ ipmmu_ir: iommu@ff8b0000 { |
2803 |
- compatible = "renesas,ipmmu-r8a77970"; |
2804 |
- reg = <0 0xff8b0000 0 0x1000>; |
2805 |
- renesas,ipmmu-main = <&ipmmu_mm 3>; |
2806 |
-@@ -1001,7 +1001,7 @@ |
2807 |
- #iommu-cells = <1>; |
2808 |
- }; |
2809 |
- |
2810 |
-- ipmmu_mm: mmu@e67b0000 { |
2811 |
-+ ipmmu_mm: iommu@e67b0000 { |
2812 |
- compatible = "renesas,ipmmu-r8a77970"; |
2813 |
- reg = <0 0xe67b0000 0 0x1000>; |
2814 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2815 |
-@@ -1010,7 +1010,7 @@ |
2816 |
- #iommu-cells = <1>; |
2817 |
- }; |
2818 |
- |
2819 |
-- ipmmu_rt: mmu@ffc80000 { |
2820 |
-+ ipmmu_rt: iommu@ffc80000 { |
2821 |
- compatible = "renesas,ipmmu-r8a77970"; |
2822 |
- reg = <0 0xffc80000 0 0x1000>; |
2823 |
- renesas,ipmmu-main = <&ipmmu_mm 7>; |
2824 |
-@@ -1018,7 +1018,7 @@ |
2825 |
- #iommu-cells = <1>; |
2826 |
- }; |
2827 |
- |
2828 |
-- ipmmu_vi0: mmu@febd0000 { |
2829 |
-+ ipmmu_vi0: iommu@febd0000 { |
2830 |
- compatible = "renesas,ipmmu-r8a77970"; |
2831 |
- reg = <0 0xfebd0000 0 0x1000>; |
2832 |
- renesas,ipmmu-main = <&ipmmu_mm 9>; |
2833 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77980.dtsi b/arch/arm64/boot/dts/renesas/r8a77980.dtsi |
2834 |
-index d672b320bc14..387e6d99f2f3 100644 |
2835 |
---- a/arch/arm64/boot/dts/renesas/r8a77980.dtsi |
2836 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77980.dtsi |
2837 |
-@@ -1266,7 +1266,7 @@ |
2838 |
- status = "disabled"; |
2839 |
- }; |
2840 |
- |
2841 |
-- ipmmu_ds1: mmu@e7740000 { |
2842 |
-+ ipmmu_ds1: iommu@e7740000 { |
2843 |
- compatible = "renesas,ipmmu-r8a77980"; |
2844 |
- reg = <0 0xe7740000 0 0x1000>; |
2845 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2846 |
-@@ -1274,7 +1274,7 @@ |
2847 |
- #iommu-cells = <1>; |
2848 |
- }; |
2849 |
- |
2850 |
-- ipmmu_ir: mmu@ff8b0000 { |
2851 |
-+ ipmmu_ir: iommu@ff8b0000 { |
2852 |
- compatible = "renesas,ipmmu-r8a77980"; |
2853 |
- reg = <0 0xff8b0000 0 0x1000>; |
2854 |
- renesas,ipmmu-main = <&ipmmu_mm 3>; |
2855 |
-@@ -1282,7 +1282,7 @@ |
2856 |
- #iommu-cells = <1>; |
2857 |
- }; |
2858 |
- |
2859 |
-- ipmmu_mm: mmu@e67b0000 { |
2860 |
-+ ipmmu_mm: iommu@e67b0000 { |
2861 |
- compatible = "renesas,ipmmu-r8a77980"; |
2862 |
- reg = <0 0xe67b0000 0 0x1000>; |
2863 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2864 |
-@@ -1291,7 +1291,7 @@ |
2865 |
- #iommu-cells = <1>; |
2866 |
- }; |
2867 |
- |
2868 |
-- ipmmu_rt: mmu@ffc80000 { |
2869 |
-+ ipmmu_rt: iommu@ffc80000 { |
2870 |
- compatible = "renesas,ipmmu-r8a77980"; |
2871 |
- reg = <0 0xffc80000 0 0x1000>; |
2872 |
- renesas,ipmmu-main = <&ipmmu_mm 10>; |
2873 |
-@@ -1299,7 +1299,7 @@ |
2874 |
- #iommu-cells = <1>; |
2875 |
- }; |
2876 |
- |
2877 |
-- ipmmu_vc0: mmu@fe990000 { |
2878 |
-+ ipmmu_vc0: iommu@fe990000 { |
2879 |
- compatible = "renesas,ipmmu-r8a77980"; |
2880 |
- reg = <0 0xfe990000 0 0x1000>; |
2881 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
2882 |
-@@ -1307,7 +1307,7 @@ |
2883 |
- #iommu-cells = <1>; |
2884 |
- }; |
2885 |
- |
2886 |
-- ipmmu_vi0: mmu@febd0000 { |
2887 |
-+ ipmmu_vi0: iommu@febd0000 { |
2888 |
- compatible = "renesas,ipmmu-r8a77980"; |
2889 |
- reg = <0 0xfebd0000 0 0x1000>; |
2890 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
2891 |
-@@ -1315,7 +1315,7 @@ |
2892 |
- #iommu-cells = <1>; |
2893 |
- }; |
2894 |
- |
2895 |
-- ipmmu_vip0: mmu@e7b00000 { |
2896 |
-+ ipmmu_vip0: iommu@e7b00000 { |
2897 |
- compatible = "renesas,ipmmu-r8a77980"; |
2898 |
- reg = <0 0xe7b00000 0 0x1000>; |
2899 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2900 |
-@@ -1323,7 +1323,7 @@ |
2901 |
- #iommu-cells = <1>; |
2902 |
- }; |
2903 |
- |
2904 |
-- ipmmu_vip1: mmu@e7960000 { |
2905 |
-+ ipmmu_vip1: iommu@e7960000 { |
2906 |
- compatible = "renesas,ipmmu-r8a77980"; |
2907 |
- reg = <0 0xe7960000 0 0x1000>; |
2908 |
- renesas,ipmmu-main = <&ipmmu_mm 11>; |
2909 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
2910 |
-index 1543f18e834f..cd11f24744d4 100644 |
2911 |
---- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
2912 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi |
2913 |
-@@ -817,7 +817,7 @@ |
2914 |
- <&ipmmu_ds1 30>, <&ipmmu_ds1 31>; |
2915 |
- }; |
2916 |
- |
2917 |
-- ipmmu_ds0: mmu@e6740000 { |
2918 |
-+ ipmmu_ds0: iommu@e6740000 { |
2919 |
- compatible = "renesas,ipmmu-r8a77990"; |
2920 |
- reg = <0 0xe6740000 0 0x1000>; |
2921 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
2922 |
-@@ -825,7 +825,7 @@ |
2923 |
- #iommu-cells = <1>; |
2924 |
- }; |
2925 |
- |
2926 |
-- ipmmu_ds1: mmu@e7740000 { |
2927 |
-+ ipmmu_ds1: iommu@e7740000 { |
2928 |
- compatible = "renesas,ipmmu-r8a77990"; |
2929 |
- reg = <0 0xe7740000 0 0x1000>; |
2930 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
2931 |
-@@ -833,7 +833,7 @@ |
2932 |
- #iommu-cells = <1>; |
2933 |
- }; |
2934 |
- |
2935 |
-- ipmmu_hc: mmu@e6570000 { |
2936 |
-+ ipmmu_hc: iommu@e6570000 { |
2937 |
- compatible = "renesas,ipmmu-r8a77990"; |
2938 |
- reg = <0 0xe6570000 0 0x1000>; |
2939 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
2940 |
-@@ -841,7 +841,7 @@ |
2941 |
- #iommu-cells = <1>; |
2942 |
- }; |
2943 |
- |
2944 |
-- ipmmu_mm: mmu@e67b0000 { |
2945 |
-+ ipmmu_mm: iommu@e67b0000 { |
2946 |
- compatible = "renesas,ipmmu-r8a77990"; |
2947 |
- reg = <0 0xe67b0000 0 0x1000>; |
2948 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
2949 |
-@@ -850,7 +850,7 @@ |
2950 |
- #iommu-cells = <1>; |
2951 |
- }; |
2952 |
- |
2953 |
-- ipmmu_mp: mmu@ec670000 { |
2954 |
-+ ipmmu_mp: iommu@ec670000 { |
2955 |
- compatible = "renesas,ipmmu-r8a77990"; |
2956 |
- reg = <0 0xec670000 0 0x1000>; |
2957 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
2958 |
-@@ -858,7 +858,7 @@ |
2959 |
- #iommu-cells = <1>; |
2960 |
- }; |
2961 |
- |
2962 |
-- ipmmu_pv0: mmu@fd800000 { |
2963 |
-+ ipmmu_pv0: iommu@fd800000 { |
2964 |
- compatible = "renesas,ipmmu-r8a77990"; |
2965 |
- reg = <0 0xfd800000 0 0x1000>; |
2966 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
2967 |
-@@ -866,7 +866,7 @@ |
2968 |
- #iommu-cells = <1>; |
2969 |
- }; |
2970 |
- |
2971 |
-- ipmmu_rt: mmu@ffc80000 { |
2972 |
-+ ipmmu_rt: iommu@ffc80000 { |
2973 |
- compatible = "renesas,ipmmu-r8a77990"; |
2974 |
- reg = <0 0xffc80000 0 0x1000>; |
2975 |
- renesas,ipmmu-main = <&ipmmu_mm 10>; |
2976 |
-@@ -874,7 +874,7 @@ |
2977 |
- #iommu-cells = <1>; |
2978 |
- }; |
2979 |
- |
2980 |
-- ipmmu_vc0: mmu@fe6b0000 { |
2981 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
2982 |
- compatible = "renesas,ipmmu-r8a77990"; |
2983 |
- reg = <0 0xfe6b0000 0 0x1000>; |
2984 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
2985 |
-@@ -882,7 +882,7 @@ |
2986 |
- #iommu-cells = <1>; |
2987 |
- }; |
2988 |
- |
2989 |
-- ipmmu_vi0: mmu@febd0000 { |
2990 |
-+ ipmmu_vi0: iommu@febd0000 { |
2991 |
- compatible = "renesas,ipmmu-r8a77990"; |
2992 |
- reg = <0 0xfebd0000 0 0x1000>; |
2993 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
2994 |
-@@ -890,7 +890,7 @@ |
2995 |
- #iommu-cells = <1>; |
2996 |
- }; |
2997 |
- |
2998 |
-- ipmmu_vp0: mmu@fe990000 { |
2999 |
-+ ipmmu_vp0: iommu@fe990000 { |
3000 |
- compatible = "renesas,ipmmu-r8a77990"; |
3001 |
- reg = <0 0xfe990000 0 0x1000>; |
3002 |
- renesas,ipmmu-main = <&ipmmu_mm 16>; |
3003 |
-diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
3004 |
-index e8d2290fe79d..e5617ec0f49c 100644 |
3005 |
---- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
3006 |
-+++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi |
3007 |
-@@ -507,7 +507,7 @@ |
3008 |
- <&ipmmu_ds1 22>, <&ipmmu_ds1 23>; |
3009 |
- }; |
3010 |
- |
3011 |
-- ipmmu_ds0: mmu@e6740000 { |
3012 |
-+ ipmmu_ds0: iommu@e6740000 { |
3013 |
- compatible = "renesas,ipmmu-r8a77995"; |
3014 |
- reg = <0 0xe6740000 0 0x1000>; |
3015 |
- renesas,ipmmu-main = <&ipmmu_mm 0>; |
3016 |
-@@ -515,7 +515,7 @@ |
3017 |
- #iommu-cells = <1>; |
3018 |
- }; |
3019 |
- |
3020 |
-- ipmmu_ds1: mmu@e7740000 { |
3021 |
-+ ipmmu_ds1: iommu@e7740000 { |
3022 |
- compatible = "renesas,ipmmu-r8a77995"; |
3023 |
- reg = <0 0xe7740000 0 0x1000>; |
3024 |
- renesas,ipmmu-main = <&ipmmu_mm 1>; |
3025 |
-@@ -523,7 +523,7 @@ |
3026 |
- #iommu-cells = <1>; |
3027 |
- }; |
3028 |
- |
3029 |
-- ipmmu_hc: mmu@e6570000 { |
3030 |
-+ ipmmu_hc: iommu@e6570000 { |
3031 |
- compatible = "renesas,ipmmu-r8a77995"; |
3032 |
- reg = <0 0xe6570000 0 0x1000>; |
3033 |
- renesas,ipmmu-main = <&ipmmu_mm 2>; |
3034 |
-@@ -531,7 +531,7 @@ |
3035 |
- #iommu-cells = <1>; |
3036 |
- }; |
3037 |
- |
3038 |
-- ipmmu_mm: mmu@e67b0000 { |
3039 |
-+ ipmmu_mm: iommu@e67b0000 { |
3040 |
- compatible = "renesas,ipmmu-r8a77995"; |
3041 |
- reg = <0 0xe67b0000 0 0x1000>; |
3042 |
- interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>, |
3043 |
-@@ -540,7 +540,7 @@ |
3044 |
- #iommu-cells = <1>; |
3045 |
- }; |
3046 |
- |
3047 |
-- ipmmu_mp: mmu@ec670000 { |
3048 |
-+ ipmmu_mp: iommu@ec670000 { |
3049 |
- compatible = "renesas,ipmmu-r8a77995"; |
3050 |
- reg = <0 0xec670000 0 0x1000>; |
3051 |
- renesas,ipmmu-main = <&ipmmu_mm 4>; |
3052 |
-@@ -548,7 +548,7 @@ |
3053 |
- #iommu-cells = <1>; |
3054 |
- }; |
3055 |
- |
3056 |
-- ipmmu_pv0: mmu@fd800000 { |
3057 |
-+ ipmmu_pv0: iommu@fd800000 { |
3058 |
- compatible = "renesas,ipmmu-r8a77995"; |
3059 |
- reg = <0 0xfd800000 0 0x1000>; |
3060 |
- renesas,ipmmu-main = <&ipmmu_mm 6>; |
3061 |
-@@ -556,7 +556,7 @@ |
3062 |
- #iommu-cells = <1>; |
3063 |
- }; |
3064 |
- |
3065 |
-- ipmmu_rt: mmu@ffc80000 { |
3066 |
-+ ipmmu_rt: iommu@ffc80000 { |
3067 |
- compatible = "renesas,ipmmu-r8a77995"; |
3068 |
- reg = <0 0xffc80000 0 0x1000>; |
3069 |
- renesas,ipmmu-main = <&ipmmu_mm 10>; |
3070 |
-@@ -564,7 +564,7 @@ |
3071 |
- #iommu-cells = <1>; |
3072 |
- }; |
3073 |
- |
3074 |
-- ipmmu_vc0: mmu@fe6b0000 { |
3075 |
-+ ipmmu_vc0: iommu@fe6b0000 { |
3076 |
- compatible = "renesas,ipmmu-r8a77995"; |
3077 |
- reg = <0 0xfe6b0000 0 0x1000>; |
3078 |
- renesas,ipmmu-main = <&ipmmu_mm 12>; |
3079 |
-@@ -572,7 +572,7 @@ |
3080 |
- #iommu-cells = <1>; |
3081 |
- }; |
3082 |
- |
3083 |
-- ipmmu_vi0: mmu@febd0000 { |
3084 |
-+ ipmmu_vi0: iommu@febd0000 { |
3085 |
- compatible = "renesas,ipmmu-r8a77995"; |
3086 |
- reg = <0 0xfebd0000 0 0x1000>; |
3087 |
- renesas,ipmmu-main = <&ipmmu_mm 14>; |
3088 |
-@@ -580,7 +580,7 @@ |
3089 |
- #iommu-cells = <1>; |
3090 |
- }; |
3091 |
- |
3092 |
-- ipmmu_vp0: mmu@fe990000 { |
3093 |
-+ ipmmu_vp0: iommu@fe990000 { |
3094 |
- compatible = "renesas,ipmmu-r8a77995"; |
3095 |
- reg = <0 0xfe990000 0 0x1000>; |
3096 |
- renesas,ipmmu-main = <&ipmmu_mm 16>; |
3097 |
-diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c |
3098 |
-index 8618faa82e6d..86a5cf9bc19a 100644 |
3099 |
---- a/arch/arm64/kernel/ftrace.c |
3100 |
-+++ b/arch/arm64/kernel/ftrace.c |
3101 |
-@@ -69,7 +69,8 @@ static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr) |
3102 |
- |
3103 |
- if (addr == FTRACE_ADDR) |
3104 |
- return &plt[FTRACE_PLT_IDX]; |
3105 |
-- if (addr == FTRACE_REGS_ADDR && IS_ENABLED(CONFIG_FTRACE_WITH_REGS)) |
3106 |
-+ if (addr == FTRACE_REGS_ADDR && |
3107 |
-+ IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS)) |
3108 |
- return &plt[FTRACE_REGS_PLT_IDX]; |
3109 |
- #endif |
3110 |
- return NULL; |
3111 |
-diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c |
3112 |
-index 0b727edf4104..af234a1e08b7 100644 |
3113 |
---- a/arch/arm64/kernel/hw_breakpoint.c |
3114 |
-+++ b/arch/arm64/kernel/hw_breakpoint.c |
3115 |
-@@ -730,6 +730,27 @@ static u64 get_distance_from_watchpoint(unsigned long addr, u64 val, |
3116 |
- return 0; |
3117 |
- } |
3118 |
- |
3119 |
-+static int watchpoint_report(struct perf_event *wp, unsigned long addr, |
3120 |
-+ struct pt_regs *regs) |
3121 |
-+{ |
3122 |
-+ int step = is_default_overflow_handler(wp); |
3123 |
-+ struct arch_hw_breakpoint *info = counter_arch_bp(wp); |
3124 |
-+ |
3125 |
-+ info->trigger = addr; |
3126 |
-+ |
3127 |
-+ /* |
3128 |
-+ * If we triggered a user watchpoint from a uaccess routine, then |
3129 |
-+ * handle the stepping ourselves since userspace really can't help |
3130 |
-+ * us with this. |
3131 |
-+ */ |
3132 |
-+ if (!user_mode(regs) && info->ctrl.privilege == AARCH64_BREAKPOINT_EL0) |
3133 |
-+ step = 1; |
3134 |
-+ else |
3135 |
-+ perf_bp_event(wp, regs); |
3136 |
-+ |
3137 |
-+ return step; |
3138 |
-+} |
3139 |
-+ |
3140 |
- static int watchpoint_handler(unsigned long addr, unsigned int esr, |
3141 |
- struct pt_regs *regs) |
3142 |
- { |
3143 |
-@@ -739,7 +760,6 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
3144 |
- u64 val; |
3145 |
- struct perf_event *wp, **slots; |
3146 |
- struct debug_info *debug_info; |
3147 |
-- struct arch_hw_breakpoint *info; |
3148 |
- struct arch_hw_breakpoint_ctrl ctrl; |
3149 |
- |
3150 |
- slots = this_cpu_ptr(wp_on_reg); |
3151 |
-@@ -777,25 +797,13 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, |
3152 |
- if (dist != 0) |
3153 |
- continue; |
3154 |
- |
3155 |
-- info = counter_arch_bp(wp); |
3156 |
-- info->trigger = addr; |
3157 |
-- perf_bp_event(wp, regs); |
3158 |
-- |
3159 |
-- /* Do we need to handle the stepping? */ |
3160 |
-- if (is_default_overflow_handler(wp)) |
3161 |
-- step = 1; |
3162 |
-+ step = watchpoint_report(wp, addr, regs); |
3163 |
- } |
3164 |
-- if (min_dist > 0 && min_dist != -1) { |
3165 |
-- /* No exact match found. */ |
3166 |
-- wp = slots[closest_match]; |
3167 |
-- info = counter_arch_bp(wp); |
3168 |
-- info->trigger = addr; |
3169 |
-- perf_bp_event(wp, regs); |
3170 |
- |
3171 |
-- /* Do we need to handle the stepping? */ |
3172 |
-- if (is_default_overflow_handler(wp)) |
3173 |
-- step = 1; |
3174 |
-- } |
3175 |
-+ /* No exact match found? */ |
3176 |
-+ if (min_dist > 0 && min_dist != -1) |
3177 |
-+ step = watchpoint_report(slots[closest_match], addr, regs); |
3178 |
-+ |
3179 |
- rcu_read_unlock(); |
3180 |
- |
3181 |
- if (!step) |
3182 |
-diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c |
3183 |
-index e42727e3568e..3f9010167468 100644 |
3184 |
---- a/arch/arm64/mm/init.c |
3185 |
-+++ b/arch/arm64/mm/init.c |
3186 |
-@@ -458,11 +458,6 @@ void __init arm64_memblock_init(void) |
3187 |
- high_memory = __va(memblock_end_of_DRAM() - 1) + 1; |
3188 |
- |
3189 |
- dma_contiguous_reserve(arm64_dma32_phys_limit); |
3190 |
-- |
3191 |
--#ifdef CONFIG_ARM64_4K_PAGES |
3192 |
-- hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); |
3193 |
--#endif |
3194 |
-- |
3195 |
- } |
3196 |
- |
3197 |
- void __init bootmem_init(void) |
3198 |
-@@ -478,6 +473,16 @@ void __init bootmem_init(void) |
3199 |
- min_low_pfn = min; |
3200 |
- |
3201 |
- arm64_numa_init(); |
3202 |
-+ |
3203 |
-+ /* |
3204 |
-+ * must be done after arm64_numa_init() which calls numa_init() to |
3205 |
-+ * initialize node_online_map that gets used in hugetlb_cma_reserve() |
3206 |
-+ * while allocating required CMA size across online nodes. |
3207 |
-+ */ |
3208 |
-+#ifdef CONFIG_ARM64_4K_PAGES |
3209 |
-+ hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); |
3210 |
-+#endif |
3211 |
-+ |
3212 |
- /* |
3213 |
- * Sparsemem tries to allocate bootmem in memory_present(), so must be |
3214 |
- * done after the fixed reservations. |
3215 |
-diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c |
3216 |
-index 62b0eb6cf69a..84eab0f5e00a 100644 |
3217 |
---- a/arch/m68k/coldfire/pci.c |
3218 |
-+++ b/arch/m68k/coldfire/pci.c |
3219 |
-@@ -216,8 +216,10 @@ static int __init mcf_pci_init(void) |
3220 |
- |
3221 |
- /* Keep a virtual mapping to IO/config space active */ |
3222 |
- iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE); |
3223 |
-- if (iospace == 0) |
3224 |
-+ if (iospace == 0) { |
3225 |
-+ pci_free_host_bridge(bridge); |
3226 |
- return -ENODEV; |
3227 |
-+ } |
3228 |
- pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n", |
3229 |
- (u32) iospace); |
3230 |
- |
3231 |
-diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S |
3232 |
-index e4a78571f883..c6481cfc5220 100644 |
3233 |
---- a/arch/openrisc/kernel/entry.S |
3234 |
-+++ b/arch/openrisc/kernel/entry.S |
3235 |
-@@ -1166,13 +1166,13 @@ ENTRY(__sys_clone) |
3236 |
- l.movhi r29,hi(sys_clone) |
3237 |
- l.ori r29,r29,lo(sys_clone) |
3238 |
- l.j _fork_save_extra_regs_and_call |
3239 |
-- l.addi r7,r1,0 |
3240 |
-+ l.nop |
3241 |
- |
3242 |
- ENTRY(__sys_fork) |
3243 |
- l.movhi r29,hi(sys_fork) |
3244 |
- l.ori r29,r29,lo(sys_fork) |
3245 |
- l.j _fork_save_extra_regs_and_call |
3246 |
-- l.addi r3,r1,0 |
3247 |
-+ l.nop |
3248 |
- |
3249 |
- ENTRY(sys_rt_sigreturn) |
3250 |
- l.jal _sys_rt_sigreturn |
3251 |
-diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig |
3252 |
-index 62aca9efbbbe..310957b988e3 100644 |
3253 |
---- a/arch/powerpc/Kconfig |
3254 |
-+++ b/arch/powerpc/Kconfig |
3255 |
-@@ -773,6 +773,7 @@ config THREAD_SHIFT |
3256 |
- range 13 15 |
3257 |
- default "15" if PPC_256K_PAGES |
3258 |
- default "14" if PPC64 |
3259 |
-+ default "14" if KASAN |
3260 |
- default "13" |
3261 |
- help |
3262 |
- Used to define the stack size. The default is almost always what you |
3263 |
-diff --git a/arch/powerpc/configs/adder875_defconfig b/arch/powerpc/configs/adder875_defconfig |
3264 |
-index f55e23cb176c..5326bc739279 100644 |
3265 |
---- a/arch/powerpc/configs/adder875_defconfig |
3266 |
-+++ b/arch/powerpc/configs/adder875_defconfig |
3267 |
-@@ -10,7 +10,6 @@ CONFIG_EXPERT=y |
3268 |
- # CONFIG_BLK_DEV_BSG is not set |
3269 |
- CONFIG_PARTITION_ADVANCED=y |
3270 |
- CONFIG_PPC_ADDER875=y |
3271 |
--CONFIG_8xx_COPYBACK=y |
3272 |
- CONFIG_GEN_RTC=y |
3273 |
- CONFIG_HZ_1000=y |
3274 |
- # CONFIG_SECCOMP is not set |
3275 |
-diff --git a/arch/powerpc/configs/ep88xc_defconfig b/arch/powerpc/configs/ep88xc_defconfig |
3276 |
-index 0e2e5e81a359..f5c3e72da719 100644 |
3277 |
---- a/arch/powerpc/configs/ep88xc_defconfig |
3278 |
-+++ b/arch/powerpc/configs/ep88xc_defconfig |
3279 |
-@@ -12,7 +12,6 @@ CONFIG_EXPERT=y |
3280 |
- # CONFIG_BLK_DEV_BSG is not set |
3281 |
- CONFIG_PARTITION_ADVANCED=y |
3282 |
- CONFIG_PPC_EP88XC=y |
3283 |
--CONFIG_8xx_COPYBACK=y |
3284 |
- CONFIG_GEN_RTC=y |
3285 |
- CONFIG_HZ_100=y |
3286 |
- # CONFIG_SECCOMP is not set |
3287 |
-diff --git a/arch/powerpc/configs/mpc866_ads_defconfig b/arch/powerpc/configs/mpc866_ads_defconfig |
3288 |
-index 5320735395e7..5c56d36cdfc5 100644 |
3289 |
---- a/arch/powerpc/configs/mpc866_ads_defconfig |
3290 |
-+++ b/arch/powerpc/configs/mpc866_ads_defconfig |
3291 |
-@@ -12,7 +12,6 @@ CONFIG_EXPERT=y |
3292 |
- # CONFIG_BLK_DEV_BSG is not set |
3293 |
- CONFIG_PARTITION_ADVANCED=y |
3294 |
- CONFIG_MPC86XADS=y |
3295 |
--CONFIG_8xx_COPYBACK=y |
3296 |
- CONFIG_GEN_RTC=y |
3297 |
- CONFIG_HZ_1000=y |
3298 |
- CONFIG_MATH_EMULATION=y |
3299 |
-diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig |
3300 |
-index 82a008c04eae..949ff9ccda5e 100644 |
3301 |
---- a/arch/powerpc/configs/mpc885_ads_defconfig |
3302 |
-+++ b/arch/powerpc/configs/mpc885_ads_defconfig |
3303 |
-@@ -11,7 +11,6 @@ CONFIG_EXPERT=y |
3304 |
- # CONFIG_VM_EVENT_COUNTERS is not set |
3305 |
- # CONFIG_BLK_DEV_BSG is not set |
3306 |
- CONFIG_PARTITION_ADVANCED=y |
3307 |
--CONFIG_8xx_COPYBACK=y |
3308 |
- CONFIG_GEN_RTC=y |
3309 |
- CONFIG_HZ_100=y |
3310 |
- # CONFIG_SECCOMP is not set |
3311 |
-diff --git a/arch/powerpc/configs/tqm8xx_defconfig b/arch/powerpc/configs/tqm8xx_defconfig |
3312 |
-index eda8bfb2d0a3..77857d513022 100644 |
3313 |
---- a/arch/powerpc/configs/tqm8xx_defconfig |
3314 |
-+++ b/arch/powerpc/configs/tqm8xx_defconfig |
3315 |
-@@ -15,7 +15,6 @@ CONFIG_MODULE_SRCVERSION_ALL=y |
3316 |
- # CONFIG_BLK_DEV_BSG is not set |
3317 |
- CONFIG_PARTITION_ADVANCED=y |
3318 |
- CONFIG_TQM8XX=y |
3319 |
--CONFIG_8xx_COPYBACK=y |
3320 |
- # CONFIG_8xx_CPU15 is not set |
3321 |
- CONFIG_GEN_RTC=y |
3322 |
- CONFIG_HZ_100=y |
3323 |
-diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h |
3324 |
-index 3bcef989a35d..101d60f16d46 100644 |
3325 |
---- a/arch/powerpc/include/asm/book3s/64/kup-radix.h |
3326 |
-+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h |
3327 |
-@@ -16,7 +16,9 @@ |
3328 |
- #ifdef CONFIG_PPC_KUAP |
3329 |
- BEGIN_MMU_FTR_SECTION_NESTED(67) |
3330 |
- ld \gpr, STACK_REGS_KUAP(r1) |
3331 |
-+ isync |
3332 |
- mtspr SPRN_AMR, \gpr |
3333 |
-+ /* No isync required, see kuap_restore_amr() */ |
3334 |
- END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67) |
3335 |
- #endif |
3336 |
- .endm |
3337 |
-@@ -62,8 +64,15 @@ |
3338 |
- |
3339 |
- static inline void kuap_restore_amr(struct pt_regs *regs) |
3340 |
- { |
3341 |
-- if (mmu_has_feature(MMU_FTR_RADIX_KUAP)) |
3342 |
-+ if (mmu_has_feature(MMU_FTR_RADIX_KUAP)) { |
3343 |
-+ isync(); |
3344 |
- mtspr(SPRN_AMR, regs->kuap); |
3345 |
-+ /* |
3346 |
-+ * No isync required here because we are about to RFI back to |
3347 |
-+ * previous context before any user accesses would be made, |
3348 |
-+ * which is a CSI. |
3349 |
-+ */ |
3350 |
-+ } |
3351 |
- } |
3352 |
- |
3353 |
- static inline void kuap_check_amr(void) |
3354 |
-diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h |
3355 |
-index 368b136517e0..2838b98bc6df 100644 |
3356 |
---- a/arch/powerpc/include/asm/book3s/64/pgtable.h |
3357 |
-+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h |
3358 |
-@@ -998,10 +998,25 @@ extern struct page *pgd_page(pgd_t pgd); |
3359 |
- #define pud_page_vaddr(pud) __va(pud_val(pud) & ~PUD_MASKED_BITS) |
3360 |
- #define pgd_page_vaddr(pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS) |
3361 |
- |
3362 |
--#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1)) |
3363 |
--#define pud_index(address) (((address) >> (PUD_SHIFT)) & (PTRS_PER_PUD - 1)) |
3364 |
--#define pmd_index(address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1)) |
3365 |
--#define pte_index(address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1)) |
3366 |
-+static inline unsigned long pgd_index(unsigned long address) |
3367 |
-+{ |
3368 |
-+ return (address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1); |
3369 |
-+} |
3370 |
-+ |
3371 |
-+static inline unsigned long pud_index(unsigned long address) |
3372 |
-+{ |
3373 |
-+ return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1); |
3374 |
-+} |
3375 |
-+ |
3376 |
-+static inline unsigned long pmd_index(unsigned long address) |
3377 |
-+{ |
3378 |
-+ return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); |
3379 |
-+} |
3380 |
-+ |
3381 |
-+static inline unsigned long pte_index(unsigned long address) |
3382 |
-+{ |
3383 |
-+ return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); |
3384 |
-+} |
3385 |
- |
3386 |
- /* |
3387 |
- * Find an entry in a page-table-directory. We combine the address region |
3388 |
-diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h |
3389 |
-index 76af5b0cb16e..26b7cee34dfe 100644 |
3390 |
---- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h |
3391 |
-+++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h |
3392 |
-@@ -19,7 +19,6 @@ |
3393 |
- #define MI_RSV4I 0x08000000 /* Reserve 4 TLB entries */ |
3394 |
- #define MI_PPCS 0x02000000 /* Use MI_RPN prob/priv state */ |
3395 |
- #define MI_IDXMASK 0x00001f00 /* TLB index to be loaded */ |
3396 |
--#define MI_RESETVAL 0x00000000 /* Value of register at reset */ |
3397 |
- |
3398 |
- /* These are the Ks and Kp from the PowerPC books. For proper operation, |
3399 |
- * Ks = 0, Kp = 1. |
3400 |
-@@ -95,7 +94,6 @@ |
3401 |
- #define MD_TWAM 0x04000000 /* Use 4K page hardware assist */ |
3402 |
- #define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */ |
3403 |
- #define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */ |
3404 |
--#define MD_RESETVAL 0x04000000 /* Value of register at reset */ |
3405 |
- |
3406 |
- #define SPRN_M_CASID 793 /* Address space ID (context) to match */ |
3407 |
- #define MC_ASIDMASK 0x0000000f /* Bits used for ASID value */ |
3408 |
-diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h |
3409 |
-index eedcbfb9a6ff..c220cb9eccad 100644 |
3410 |
---- a/arch/powerpc/include/asm/processor.h |
3411 |
-+++ b/arch/powerpc/include/asm/processor.h |
3412 |
-@@ -301,7 +301,6 @@ struct thread_struct { |
3413 |
- #else |
3414 |
- #define INIT_THREAD { \ |
3415 |
- .ksp = INIT_SP, \ |
3416 |
-- .regs = (struct pt_regs *)INIT_SP - 1, /* XXX bogus, I think */ \ |
3417 |
- .addr_limit = KERNEL_DS, \ |
3418 |
- .fpexc_mode = 0, \ |
3419 |
- .fscr = FSCR_TAR | FSCR_EBB \ |
3420 |
-diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S |
3421 |
-index ebeebab74b56..d9ddce40bed8 100644 |
3422 |
---- a/arch/powerpc/kernel/exceptions-64s.S |
3423 |
-+++ b/arch/powerpc/kernel/exceptions-64s.S |
3424 |
-@@ -270,7 +270,7 @@ BEGIN_FTR_SECTION |
3425 |
- END_FTR_SECTION_IFSET(CPU_FTR_CFAR) |
3426 |
- .endif |
3427 |
- |
3428 |
-- ld r10,PACA_EXGEN+EX_CTR(r13) |
3429 |
-+ ld r10,IAREA+EX_CTR(r13) |
3430 |
- mtctr r10 |
3431 |
- BEGIN_FTR_SECTION |
3432 |
- ld r10,IAREA+EX_PPR(r13) |
3433 |
-@@ -298,7 +298,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) |
3434 |
- |
3435 |
- .if IKVM_SKIP |
3436 |
- 89: mtocrf 0x80,r9 |
3437 |
-- ld r10,PACA_EXGEN+EX_CTR(r13) |
3438 |
-+ ld r10,IAREA+EX_CTR(r13) |
3439 |
- mtctr r10 |
3440 |
- ld r9,IAREA+EX_R9(r13) |
3441 |
- ld r10,IAREA+EX_R10(r13) |
3442 |
-@@ -1117,11 +1117,30 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) |
3443 |
- li r10,MSR_RI |
3444 |
- mtmsrd r10,1 |
3445 |
- |
3446 |
-+ /* |
3447 |
-+ * Set IRQS_ALL_DISABLED and save PACAIRQHAPPENED (see |
3448 |
-+ * system_reset_common) |
3449 |
-+ */ |
3450 |
-+ li r10,IRQS_ALL_DISABLED |
3451 |
-+ stb r10,PACAIRQSOFTMASK(r13) |
3452 |
-+ lbz r10,PACAIRQHAPPENED(r13) |
3453 |
-+ std r10,RESULT(r1) |
3454 |
-+ ori r10,r10,PACA_IRQ_HARD_DIS |
3455 |
-+ stb r10,PACAIRQHAPPENED(r13) |
3456 |
-+ |
3457 |
- addi r3,r1,STACK_FRAME_OVERHEAD |
3458 |
- bl machine_check_early |
3459 |
- std r3,RESULT(r1) /* Save result */ |
3460 |
- ld r12,_MSR(r1) |
3461 |
- |
3462 |
-+ /* |
3463 |
-+ * Restore soft mask settings. |
3464 |
-+ */ |
3465 |
-+ ld r10,RESULT(r1) |
3466 |
-+ stb r10,PACAIRQHAPPENED(r13) |
3467 |
-+ ld r10,SOFTE(r1) |
3468 |
-+ stb r10,PACAIRQSOFTMASK(r13) |
3469 |
-+ |
3470 |
- #ifdef CONFIG_PPC_P7_NAP |
3471 |
- /* |
3472 |
- * Check if thread was in power saving mode. We come here when any |
3473 |
-@@ -1225,17 +1244,19 @@ EXC_COMMON_BEGIN(machine_check_idle_common) |
3474 |
- bl machine_check_queue_event |
3475 |
- |
3476 |
- /* |
3477 |
-- * We have not used any non-volatile GPRs here, and as a rule |
3478 |
-- * most exception code including machine check does not. |
3479 |
-- * Therefore PACA_NAPSTATELOST does not need to be set. Idle |
3480 |
-- * wakeup will restore volatile registers. |
3481 |
-+ * GPR-loss wakeups are relatively straightforward, because the |
3482 |
-+ * idle sleep code has saved all non-volatile registers on its |
3483 |
-+ * own stack, and r1 in PACAR1. |
3484 |
- * |
3485 |
-- * Load the original SRR1 into r3 for pnv_powersave_wakeup_mce. |
3486 |
-+ * For no-loss wakeups the r1 and lr registers used by the |
3487 |
-+ * early machine check handler have to be restored first. r2 is |
3488 |
-+ * the kernel TOC, so no need to restore it. |
3489 |
- * |
3490 |
- * Then decrement MCE nesting after finishing with the stack. |
3491 |
- */ |
3492 |
- ld r3,_MSR(r1) |
3493 |
- ld r4,_LINK(r1) |
3494 |
-+ ld r1,GPR1(r1) |
3495 |
- |
3496 |
- lhz r11,PACA_IN_MCE(r13) |
3497 |
- subi r11,r11,1 |
3498 |
-@@ -1244,7 +1265,7 @@ EXC_COMMON_BEGIN(machine_check_idle_common) |
3499 |
- mtlr r4 |
3500 |
- rlwinm r10,r3,47-31,30,31 |
3501 |
- cmpwi cr1,r10,2 |
3502 |
-- bltlr cr1 /* no state loss, return to idle caller */ |
3503 |
-+ bltlr cr1 /* no state loss, return to idle caller with r3=SRR1 */ |
3504 |
- b idle_return_gpr_loss |
3505 |
- #endif |
3506 |
- |
3507 |
-diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
3508 |
-index ddfbd02140d9..0e05a9a47a4b 100644 |
3509 |
---- a/arch/powerpc/kernel/head_64.S |
3510 |
-+++ b/arch/powerpc/kernel/head_64.S |
3511 |
-@@ -947,15 +947,8 @@ start_here_multiplatform: |
3512 |
- std r0,0(r4) |
3513 |
- #endif |
3514 |
- |
3515 |
-- /* The following gets the stack set up with the regs */ |
3516 |
-- /* pointing to the real addr of the kernel stack. This is */ |
3517 |
-- /* all done to support the C function call below which sets */ |
3518 |
-- /* up the htab. This is done because we have relocated the */ |
3519 |
-- /* kernel but are still running in real mode. */ |
3520 |
-- |
3521 |
-- LOAD_REG_ADDR(r3,init_thread_union) |
3522 |
-- |
3523 |
- /* set up a stack pointer */ |
3524 |
-+ LOAD_REG_ADDR(r3,init_thread_union) |
3525 |
- LOAD_REG_IMMEDIATE(r1,THREAD_SIZE) |
3526 |
- add r1,r3,r1 |
3527 |
- li r0,0 |
3528 |
-diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S |
3529 |
-index 073a651787df..905205c79a25 100644 |
3530 |
---- a/arch/powerpc/kernel/head_8xx.S |
3531 |
-+++ b/arch/powerpc/kernel/head_8xx.S |
3532 |
-@@ -779,10 +779,7 @@ start_here: |
3533 |
- initial_mmu: |
3534 |
- li r8, 0 |
3535 |
- mtspr SPRN_MI_CTR, r8 /* remove PINNED ITLB entries */ |
3536 |
-- lis r10, MD_RESETVAL@h |
3537 |
--#ifndef CONFIG_8xx_COPYBACK |
3538 |
-- oris r10, r10, MD_WTDEF@h |
3539 |
--#endif |
3540 |
-+ lis r10, MD_TWAM@h |
3541 |
- mtspr SPRN_MD_CTR, r10 /* remove PINNED DTLB entries */ |
3542 |
- |
3543 |
- tlbia /* Invalidate all TLB entries */ |
3544 |
-@@ -857,17 +854,7 @@ initial_mmu: |
3545 |
- mtspr SPRN_DC_CST, r8 |
3546 |
- lis r8, IDC_ENABLE@h |
3547 |
- mtspr SPRN_IC_CST, r8 |
3548 |
--#ifdef CONFIG_8xx_COPYBACK |
3549 |
-- mtspr SPRN_DC_CST, r8 |
3550 |
--#else |
3551 |
-- /* For a debug option, I left this here to easily enable |
3552 |
-- * the write through cache mode |
3553 |
-- */ |
3554 |
-- lis r8, DC_SFWT@h |
3555 |
- mtspr SPRN_DC_CST, r8 |
3556 |
-- lis r8, IDC_ENABLE@h |
3557 |
-- mtspr SPRN_DC_CST, r8 |
3558 |
--#endif |
3559 |
- /* Disable debug mode entry on breakpoints */ |
3560 |
- mfspr r8, SPRN_DER |
3561 |
- #ifdef CONFIG_PERF_EVENTS |
3562 |
-diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
3563 |
-index 9c21288f8645..774476be591b 100644 |
3564 |
---- a/arch/powerpc/kernel/process.c |
3565 |
-+++ b/arch/powerpc/kernel/process.c |
3566 |
-@@ -1241,29 +1241,31 @@ struct task_struct *__switch_to(struct task_struct *prev, |
3567 |
- static void show_instructions(struct pt_regs *regs) |
3568 |
- { |
3569 |
- int i; |
3570 |
-+ unsigned long nip = regs->nip; |
3571 |
- unsigned long pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); |
3572 |
- |
3573 |
- printk("Instruction dump:"); |
3574 |
- |
3575 |
-+ /* |
3576 |
-+ * If we were executing with the MMU off for instructions, adjust pc |
3577 |
-+ * rather than printing XXXXXXXX. |
3578 |
-+ */ |
3579 |
-+ if (!IS_ENABLED(CONFIG_BOOKE) && !(regs->msr & MSR_IR)) { |
3580 |
-+ pc = (unsigned long)phys_to_virt(pc); |
3581 |
-+ nip = (unsigned long)phys_to_virt(regs->nip); |
3582 |
-+ } |
3583 |
-+ |
3584 |
- for (i = 0; i < NR_INSN_TO_PRINT; i++) { |
3585 |
- int instr; |
3586 |
- |
3587 |
- if (!(i % 8)) |
3588 |
- pr_cont("\n"); |
3589 |
- |
3590 |
--#if !defined(CONFIG_BOOKE) |
3591 |
-- /* If executing with the IMMU off, adjust pc rather |
3592 |
-- * than print XXXXXXXX. |
3593 |
-- */ |
3594 |
-- if (!(regs->msr & MSR_IR)) |
3595 |
-- pc = (unsigned long)phys_to_virt(pc); |
3596 |
--#endif |
3597 |
-- |
3598 |
- if (!__kernel_text_address(pc) || |
3599 |
- probe_kernel_address((const void *)pc, instr)) { |
3600 |
- pr_cont("XXXXXXXX "); |
3601 |
- } else { |
3602 |
-- if (regs->nip == pc) |
3603 |
-+ if (nip == pc) |
3604 |
- pr_cont("<%08x> ", instr); |
3605 |
- else |
3606 |
- pr_cont("%08x ", instr); |
3607 |
-diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c |
3608 |
-index 078fe3d76feb..56da5eb2b923 100644 |
3609 |
---- a/arch/powerpc/kexec/core.c |
3610 |
-+++ b/arch/powerpc/kexec/core.c |
3611 |
-@@ -115,11 +115,12 @@ void machine_kexec(struct kimage *image) |
3612 |
- |
3613 |
- void __init reserve_crashkernel(void) |
3614 |
- { |
3615 |
-- unsigned long long crash_size, crash_base; |
3616 |
-+ unsigned long long crash_size, crash_base, total_mem_sz; |
3617 |
- int ret; |
3618 |
- |
3619 |
-+ total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size(); |
3620 |
- /* use common parsing */ |
3621 |
-- ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), |
3622 |
-+ ret = parse_crashkernel(boot_command_line, total_mem_sz, |
3623 |
- &crash_size, &crash_base); |
3624 |
- if (ret == 0 && crash_size > 0) { |
3625 |
- crashk_res.start = crash_base; |
3626 |
-@@ -178,6 +179,7 @@ void __init reserve_crashkernel(void) |
3627 |
- /* Crash kernel trumps memory limit */ |
3628 |
- if (memory_limit && memory_limit <= crashk_res.end) { |
3629 |
- memory_limit = crashk_res.end + 1; |
3630 |
-+ total_mem_sz = memory_limit; |
3631 |
- printk("Adjusted memory limit for crashkernel, now 0x%llx\n", |
3632 |
- memory_limit); |
3633 |
- } |
3634 |
-@@ -186,7 +188,7 @@ void __init reserve_crashkernel(void) |
3635 |
- "for crashkernel (System RAM: %ldMB)\n", |
3636 |
- (unsigned long)(crash_size >> 20), |
3637 |
- (unsigned long)(crashk_res.start >> 20), |
3638 |
-- (unsigned long)(memblock_phys_mem_size() >> 20)); |
3639 |
-+ (unsigned long)(total_mem_sz >> 20)); |
3640 |
- |
3641 |
- if (!memblock_is_region_memory(crashk_res.start, crash_size) || |
3642 |
- memblock_reserve(crashk_res.start, crash_size)) { |
3643 |
-diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
3644 |
-index aa12cd4078b3..bc6c1aa3d0e9 100644 |
3645 |
---- a/arch/powerpc/kvm/book3s_64_mmu_radix.c |
3646 |
-+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c |
3647 |
-@@ -353,7 +353,13 @@ static struct kmem_cache *kvm_pmd_cache; |
3648 |
- |
3649 |
- static pte_t *kvmppc_pte_alloc(void) |
3650 |
- { |
3651 |
-- return kmem_cache_alloc(kvm_pte_cache, GFP_KERNEL); |
3652 |
-+ pte_t *pte; |
3653 |
-+ |
3654 |
-+ pte = kmem_cache_alloc(kvm_pte_cache, GFP_KERNEL); |
3655 |
-+ /* pmd_populate() will only reference _pa(pte). */ |
3656 |
-+ kmemleak_ignore(pte); |
3657 |
-+ |
3658 |
-+ return pte; |
3659 |
- } |
3660 |
- |
3661 |
- static void kvmppc_pte_free(pte_t *ptep) |
3662 |
-@@ -363,7 +369,13 @@ static void kvmppc_pte_free(pte_t *ptep) |
3663 |
- |
3664 |
- static pmd_t *kvmppc_pmd_alloc(void) |
3665 |
- { |
3666 |
-- return kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); |
3667 |
-+ pmd_t *pmd; |
3668 |
-+ |
3669 |
-+ pmd = kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); |
3670 |
-+ /* pud_populate() will only reference _pa(pmd). */ |
3671 |
-+ kmemleak_ignore(pmd); |
3672 |
-+ |
3673 |
-+ return pmd; |
3674 |
- } |
3675 |
- |
3676 |
- static void kvmppc_pmd_free(pmd_t *pmdp) |
3677 |
-diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c |
3678 |
-index 50555ad1db93..1a529df0ab44 100644 |
3679 |
---- a/arch/powerpc/kvm/book3s_64_vio.c |
3680 |
-+++ b/arch/powerpc/kvm/book3s_64_vio.c |
3681 |
-@@ -73,6 +73,7 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
3682 |
- struct kvmppc_spapr_tce_iommu_table *stit, *tmp; |
3683 |
- struct iommu_table_group *table_group = NULL; |
3684 |
- |
3685 |
-+ rcu_read_lock(); |
3686 |
- list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) { |
3687 |
- |
3688 |
- table_group = iommu_group_get_iommudata(grp); |
3689 |
-@@ -87,7 +88,9 @@ extern void kvm_spapr_tce_release_iommu_group(struct kvm *kvm, |
3690 |
- kref_put(&stit->kref, kvm_spapr_tce_liobn_put); |
3691 |
- } |
3692 |
- } |
3693 |
-+ cond_resched_rcu(); |
3694 |
- } |
3695 |
-+ rcu_read_unlock(); |
3696 |
- } |
3697 |
- |
3698 |
- extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3699 |
-@@ -105,12 +108,14 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3700 |
- if (!f.file) |
3701 |
- return -EBADF; |
3702 |
- |
3703 |
-+ rcu_read_lock(); |
3704 |
- list_for_each_entry_rcu(stt, &kvm->arch.spapr_tce_tables, list) { |
3705 |
- if (stt == f.file->private_data) { |
3706 |
- found = true; |
3707 |
- break; |
3708 |
- } |
3709 |
- } |
3710 |
-+ rcu_read_unlock(); |
3711 |
- |
3712 |
- fdput(f); |
3713 |
- |
3714 |
-@@ -143,6 +148,7 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3715 |
- if (!tbl) |
3716 |
- return -EINVAL; |
3717 |
- |
3718 |
-+ rcu_read_lock(); |
3719 |
- list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { |
3720 |
- if (tbl != stit->tbl) |
3721 |
- continue; |
3722 |
-@@ -150,14 +156,17 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, |
3723 |
- if (!kref_get_unless_zero(&stit->kref)) { |
3724 |
- /* stit is being destroyed */ |
3725 |
- iommu_tce_table_put(tbl); |
3726 |
-+ rcu_read_unlock(); |
3727 |
- return -ENOTTY; |
3728 |
- } |
3729 |
- /* |
3730 |
- * The table is already known to this KVM, we just increased |
3731 |
- * its KVM reference counter and can return. |
3732 |
- */ |
3733 |
-+ rcu_read_unlock(); |
3734 |
- return 0; |
3735 |
- } |
3736 |
-+ rcu_read_unlock(); |
3737 |
- |
3738 |
- stit = kzalloc(sizeof(*stit), GFP_KERNEL); |
3739 |
- if (!stit) { |
3740 |
-@@ -365,18 +374,19 @@ static long kvmppc_tce_validate(struct kvmppc_spapr_tce_table *stt, |
3741 |
- if (kvmppc_tce_to_ua(stt->kvm, tce, &ua)) |
3742 |
- return H_TOO_HARD; |
3743 |
- |
3744 |
-+ rcu_read_lock(); |
3745 |
- list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { |
3746 |
- unsigned long hpa = 0; |
3747 |
- struct mm_iommu_table_group_mem_t *mem; |
3748 |
- long shift = stit->tbl->it_page_shift; |
3749 |
- |
3750 |
- mem = mm_iommu_lookup(stt->kvm->mm, ua, 1ULL << shift); |
3751 |
-- if (!mem) |
3752 |
-- return H_TOO_HARD; |
3753 |
-- |
3754 |
-- if (mm_iommu_ua_to_hpa(mem, ua, shift, &hpa)) |
3755 |
-+ if (!mem || mm_iommu_ua_to_hpa(mem, ua, shift, &hpa)) { |
3756 |
-+ rcu_read_unlock(); |
3757 |
- return H_TOO_HARD; |
3758 |
-+ } |
3759 |
- } |
3760 |
-+ rcu_read_unlock(); |
3761 |
- |
3762 |
- return H_SUCCESS; |
3763 |
- } |
3764 |
-diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
3765 |
-index 93493f0cbfe8..ee581cde4878 100644 |
3766 |
---- a/arch/powerpc/kvm/book3s_hv.c |
3767 |
-+++ b/arch/powerpc/kvm/book3s_hv.c |
3768 |
-@@ -1099,9 +1099,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) |
3769 |
- ret = kvmppc_h_svm_init_done(vcpu->kvm); |
3770 |
- break; |
3771 |
- case H_SVM_INIT_ABORT: |
3772 |
-- ret = H_UNSUPPORTED; |
3773 |
-- if (kvmppc_get_srr1(vcpu) & MSR_S) |
3774 |
-- ret = kvmppc_h_svm_init_abort(vcpu->kvm); |
3775 |
-+ /* |
3776 |
-+ * Even if that call is made by the Ultravisor, the SSR1 value |
3777 |
-+ * is the guest context one, with the secure bit clear as it has |
3778 |
-+ * not yet been secured. So we can't check it here. |
3779 |
-+ * Instead the kvm->arch.secure_guest flag is checked inside |
3780 |
-+ * kvmppc_h_svm_init_abort(). |
3781 |
-+ */ |
3782 |
-+ ret = kvmppc_h_svm_init_abort(vcpu->kvm); |
3783 |
- break; |
3784 |
- |
3785 |
- default: |
3786 |
-diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c |
3787 |
-index 39ba53ca5bb5..a9b2cbc74797 100644 |
3788 |
---- a/arch/powerpc/mm/book3s32/mmu.c |
3789 |
-+++ b/arch/powerpc/mm/book3s32/mmu.c |
3790 |
-@@ -187,6 +187,7 @@ void mmu_mark_initmem_nx(void) |
3791 |
- int i; |
3792 |
- unsigned long base = (unsigned long)_stext - PAGE_OFFSET; |
3793 |
- unsigned long top = (unsigned long)_etext - PAGE_OFFSET; |
3794 |
-+ unsigned long border = (unsigned long)__init_begin - PAGE_OFFSET; |
3795 |
- unsigned long size; |
3796 |
- |
3797 |
- if (IS_ENABLED(CONFIG_PPC_BOOK3S_601)) |
3798 |
-@@ -201,9 +202,10 @@ void mmu_mark_initmem_nx(void) |
3799 |
- size = block_size(base, top); |
3800 |
- size = max(size, 128UL << 10); |
3801 |
- if ((top - base) > size) { |
3802 |
-- if (strict_kernel_rwx_enabled()) |
3803 |
-- pr_warn("Kernel _etext not properly aligned\n"); |
3804 |
- size <<= 1; |
3805 |
-+ if (strict_kernel_rwx_enabled() && base + size > border) |
3806 |
-+ pr_warn("Some RW data is getting mapped X. " |
3807 |
-+ "Adjust CONFIG_DATA_SHIFT to avoid that.\n"); |
3808 |
- } |
3809 |
- setibat(i++, PAGE_OFFSET + base, base, size, PAGE_KERNEL_TEXT); |
3810 |
- base += size; |
3811 |
-diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c |
3812 |
-index 758ade2c2b6e..b5cc9b23cf02 100644 |
3813 |
---- a/arch/powerpc/mm/book3s64/radix_tlb.c |
3814 |
-+++ b/arch/powerpc/mm/book3s64/radix_tlb.c |
3815 |
-@@ -884,9 +884,7 @@ is_local: |
3816 |
- if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { |
3817 |
- hstart = (start + PMD_SIZE - 1) & PMD_MASK; |
3818 |
- hend = end & PMD_MASK; |
3819 |
-- if (hstart == hend) |
3820 |
-- hflush = false; |
3821 |
-- else |
3822 |
-+ if (hstart < hend) |
3823 |
- hflush = true; |
3824 |
- } |
3825 |
- |
3826 |
-diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c |
3827 |
-index 59e49c0e8154..b7c287adfd59 100644 |
3828 |
---- a/arch/powerpc/mm/kasan/kasan_init_32.c |
3829 |
-+++ b/arch/powerpc/mm/kasan/kasan_init_32.c |
3830 |
-@@ -76,15 +76,14 @@ static int __init kasan_init_region(void *start, size_t size) |
3831 |
- return ret; |
3832 |
- |
3833 |
- block = memblock_alloc(k_end - k_start, PAGE_SIZE); |
3834 |
-+ if (!block) |
3835 |
-+ return -ENOMEM; |
3836 |
- |
3837 |
- for (k_cur = k_start & PAGE_MASK; k_cur < k_end; k_cur += PAGE_SIZE) { |
3838 |
- pmd_t *pmd = pmd_ptr_k(k_cur); |
3839 |
- void *va = block + k_cur - k_start; |
3840 |
- pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL); |
3841 |
- |
3842 |
-- if (!va) |
3843 |
-- return -ENOMEM; |
3844 |
-- |
3845 |
- __set_pte_at(&init_mm, k_cur, pte_offset_kernel(pmd, k_cur), pte, 0); |
3846 |
- } |
3847 |
- flush_tlb_kernel_range(k_start, k_end); |
3848 |
-diff --git a/arch/powerpc/mm/ptdump/shared.c b/arch/powerpc/mm/ptdump/shared.c |
3849 |
-index f7ed2f187cb0..784f8df17f73 100644 |
3850 |
---- a/arch/powerpc/mm/ptdump/shared.c |
3851 |
-+++ b/arch/powerpc/mm/ptdump/shared.c |
3852 |
-@@ -30,6 +30,11 @@ static const struct flag_info flag_array[] = { |
3853 |
- .val = _PAGE_PRESENT, |
3854 |
- .set = "present", |
3855 |
- .clear = " ", |
3856 |
-+ }, { |
3857 |
-+ .mask = _PAGE_COHERENT, |
3858 |
-+ .val = _PAGE_COHERENT, |
3859 |
-+ .set = "coherent", |
3860 |
-+ .clear = " ", |
3861 |
- }, { |
3862 |
- .mask = _PAGE_GUARDED, |
3863 |
- .val = _PAGE_GUARDED, |
3864 |
-diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c |
3865 |
-index 573e0b309c0c..48e8f4b17b91 100644 |
3866 |
---- a/arch/powerpc/perf/hv-24x7.c |
3867 |
-+++ b/arch/powerpc/perf/hv-24x7.c |
3868 |
-@@ -1400,16 +1400,6 @@ static void h_24x7_event_read(struct perf_event *event) |
3869 |
- h24x7hw = &get_cpu_var(hv_24x7_hw); |
3870 |
- h24x7hw->events[i] = event; |
3871 |
- put_cpu_var(h24x7hw); |
3872 |
-- /* |
3873 |
-- * Clear the event count so we can compute the _change_ |
3874 |
-- * in the 24x7 raw counter value at the end of the txn. |
3875 |
-- * |
3876 |
-- * Note that we could alternatively read the 24x7 value |
3877 |
-- * now and save its value in event->hw.prev_count. But |
3878 |
-- * that would require issuing a hcall, which would then |
3879 |
-- * defeat the purpose of using the txn interface. |
3880 |
-- */ |
3881 |
-- local64_set(&event->count, 0); |
3882 |
- } |
3883 |
- |
3884 |
- put_cpu_var(hv_24x7_reqb); |
3885 |
-diff --git a/arch/powerpc/platforms/4xx/pci.c b/arch/powerpc/platforms/4xx/pci.c |
3886 |
-index e6e2adcc7b64..c13d64c3b019 100644 |
3887 |
---- a/arch/powerpc/platforms/4xx/pci.c |
3888 |
-+++ b/arch/powerpc/platforms/4xx/pci.c |
3889 |
-@@ -1242,7 +1242,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) |
3890 |
- if (mbase == NULL) { |
3891 |
- printk(KERN_ERR "%pOF: Can't map internal config space !", |
3892 |
- port->node); |
3893 |
-- goto done; |
3894 |
-+ return; |
3895 |
- } |
3896 |
- |
3897 |
- while (attempt && (0 == (in_le32(mbase + PECFG_460SX_DLLSTA) |
3898 |
-@@ -1252,9 +1252,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) |
3899 |
- } |
3900 |
- if (attempt) |
3901 |
- port->link = 1; |
3902 |
--done: |
3903 |
- iounmap(mbase); |
3904 |
-- |
3905 |
- } |
3906 |
- |
3907 |
- static struct ppc4xx_pciex_hwops ppc460sx_pcie_hwops __initdata = { |
3908 |
-diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig |
3909 |
-index e0fe670f06f6..b37de62d7e7f 100644 |
3910 |
---- a/arch/powerpc/platforms/8xx/Kconfig |
3911 |
-+++ b/arch/powerpc/platforms/8xx/Kconfig |
3912 |
-@@ -98,15 +98,6 @@ menu "MPC8xx CPM Options" |
3913 |
- # 8xx specific questions. |
3914 |
- comment "Generic MPC8xx Options" |
3915 |
- |
3916 |
--config 8xx_COPYBACK |
3917 |
-- bool "Copy-Back Data Cache (else Writethrough)" |
3918 |
-- help |
3919 |
-- Saying Y here will cause the cache on an MPC8xx processor to be used |
3920 |
-- in Copy-Back mode. If you say N here, it is used in Writethrough |
3921 |
-- mode. |
3922 |
-- |
3923 |
-- If in doubt, say Y here. |
3924 |
-- |
3925 |
- config 8xx_GPIO |
3926 |
- bool "GPIO API Support" |
3927 |
- select GPIOLIB |
3928 |
-diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c |
3929 |
-index 2b3dfd0b6cdd..d95954ad4c0a 100644 |
3930 |
---- a/arch/powerpc/platforms/powernv/opal.c |
3931 |
-+++ b/arch/powerpc/platforms/powernv/opal.c |
3932 |
-@@ -811,6 +811,10 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name, |
3933 |
- goto out; |
3934 |
- |
3935 |
- attr = kzalloc(sizeof(*attr), GFP_KERNEL); |
3936 |
-+ if (!attr) { |
3937 |
-+ rc = -ENOMEM; |
3938 |
-+ goto out; |
3939 |
-+ } |
3940 |
- name = kstrdup(export_name, GFP_KERNEL); |
3941 |
- if (!name) { |
3942 |
- rc = -ENOMEM; |
3943 |
-diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c |
3944 |
-index 423be34f0f5f..f42fe4e86ce5 100644 |
3945 |
---- a/arch/powerpc/platforms/ps3/mm.c |
3946 |
-+++ b/arch/powerpc/platforms/ps3/mm.c |
3947 |
-@@ -200,13 +200,14 @@ void ps3_mm_vas_destroy(void) |
3948 |
- { |
3949 |
- int result; |
3950 |
- |
3951 |
-- DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id); |
3952 |
-- |
3953 |
- if (map.vas_id) { |
3954 |
- result = lv1_select_virtual_address_space(0); |
3955 |
-- BUG_ON(result); |
3956 |
-- result = lv1_destruct_virtual_address_space(map.vas_id); |
3957 |
-- BUG_ON(result); |
3958 |
-+ result += lv1_destruct_virtual_address_space(map.vas_id); |
3959 |
-+ |
3960 |
-+ if (result) { |
3961 |
-+ lv1_panic(0); |
3962 |
-+ } |
3963 |
-+ |
3964 |
- map.vas_id = 0; |
3965 |
- } |
3966 |
- } |
3967 |
-@@ -304,19 +305,20 @@ static void ps3_mm_region_destroy(struct mem_region *r) |
3968 |
- int result; |
3969 |
- |
3970 |
- if (!r->destroy) { |
3971 |
-- pr_info("%s:%d: Not destroying high region: %llxh %llxh\n", |
3972 |
-- __func__, __LINE__, r->base, r->size); |
3973 |
- return; |
3974 |
- } |
3975 |
- |
3976 |
-- DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base); |
3977 |
-- |
3978 |
- if (r->base) { |
3979 |
- result = lv1_release_memory(r->base); |
3980 |
-- BUG_ON(result); |
3981 |
-+ |
3982 |
-+ if (result) { |
3983 |
-+ lv1_panic(0); |
3984 |
-+ } |
3985 |
-+ |
3986 |
- r->size = r->base = r->offset = 0; |
3987 |
- map.total = map.rm.size; |
3988 |
- } |
3989 |
-+ |
3990 |
- ps3_mm_set_repository_highmem(NULL); |
3991 |
- } |
3992 |
- |
3993 |
-diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c |
3994 |
-index 1d1da639b8b7..16ba5c542e55 100644 |
3995 |
---- a/arch/powerpc/platforms/pseries/ras.c |
3996 |
-+++ b/arch/powerpc/platforms/pseries/ras.c |
3997 |
-@@ -395,10 +395,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id) |
3998 |
- /* |
3999 |
- * Some versions of FWNMI place the buffer inside the 4kB page starting at |
4000 |
- * 0x7000. Other versions place it inside the rtas buffer. We check both. |
4001 |
-+ * Minimum size of the buffer is 16 bytes. |
4002 |
- */ |
4003 |
- #define VALID_FWNMI_BUFFER(A) \ |
4004 |
-- ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ |
4005 |
-- (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) |
4006 |
-+ ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ |
4007 |
-+ (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16)))) |
4008 |
- |
4009 |
- static inline struct rtas_error_log *fwnmi_get_errlog(void) |
4010 |
- { |
4011 |
-diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig |
4012 |
-index 2167bce993ff..ae01be202204 100644 |
4013 |
---- a/arch/s390/Kconfig |
4014 |
-+++ b/arch/s390/Kconfig |
4015 |
-@@ -462,6 +462,7 @@ config NUMA |
4016 |
- |
4017 |
- config NODES_SHIFT |
4018 |
- int |
4019 |
-+ depends on NEED_MULTIPLE_NODES |
4020 |
- default "1" |
4021 |
- |
4022 |
- config SCHED_SMT |
4023 |
-diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h |
4024 |
-index f073292e9fdb..d9d5de0f67ff 100644 |
4025 |
---- a/arch/s390/include/asm/syscall.h |
4026 |
-+++ b/arch/s390/include/asm/syscall.h |
4027 |
-@@ -33,7 +33,17 @@ static inline void syscall_rollback(struct task_struct *task, |
4028 |
- static inline long syscall_get_error(struct task_struct *task, |
4029 |
- struct pt_regs *regs) |
4030 |
- { |
4031 |
-- return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0; |
4032 |
-+ unsigned long error = regs->gprs[2]; |
4033 |
-+#ifdef CONFIG_COMPAT |
4034 |
-+ if (test_tsk_thread_flag(task, TIF_31BIT)) { |
4035 |
-+ /* |
4036 |
-+ * Sign-extend the value so (int)-EFOO becomes (long)-EFOO |
4037 |
-+ * and will match correctly in comparisons. |
4038 |
-+ */ |
4039 |
-+ error = (long)(int)error; |
4040 |
-+ } |
4041 |
-+#endif |
4042 |
-+ return IS_ERR_VALUE(error) ? error : 0; |
4043 |
- } |
4044 |
- |
4045 |
- static inline long syscall_get_return_value(struct task_struct *task, |
4046 |
-diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h |
4047 |
-index 39c9ead489e5..b42228906eaf 100644 |
4048 |
---- a/arch/sh/include/asm/io.h |
4049 |
-+++ b/arch/sh/include/asm/io.h |
4050 |
-@@ -328,7 +328,7 @@ __ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot) |
4051 |
- #else |
4052 |
- #define __ioremap(offset, size, prot) ((void __iomem *)(offset)) |
4053 |
- #define __ioremap_mode(offset, size, prot) ((void __iomem *)(offset)) |
4054 |
--#define iounmap(addr) do { } while (0) |
4055 |
-+static inline void iounmap(void __iomem *addr) {} |
4056 |
- #endif /* CONFIG_MMU */ |
4057 |
- |
4058 |
- static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) |
4059 |
-diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c |
4060 |
-index a8c2f2615fc6..ecc9e8786d57 100644 |
4061 |
---- a/arch/sparc/mm/srmmu.c |
4062 |
-+++ b/arch/sparc/mm/srmmu.c |
4063 |
-@@ -383,7 +383,6 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) |
4064 |
- return NULL; |
4065 |
- page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); |
4066 |
- if (!pgtable_pte_page_ctor(page)) { |
4067 |
-- __free_page(page); |
4068 |
- return NULL; |
4069 |
- } |
4070 |
- return page; |
4071 |
-diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile |
4072 |
-index a290821e355c..2a249f619467 100644 |
4073 |
---- a/arch/um/drivers/Makefile |
4074 |
-+++ b/arch/um/drivers/Makefile |
4075 |
-@@ -18,9 +18,9 @@ ubd-objs := ubd_kern.o ubd_user.o |
4076 |
- port-objs := port_kern.o port_user.o |
4077 |
- harddog-objs := harddog_kern.o harddog_user.o |
4078 |
- |
4079 |
--LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) |
4080 |
-+LDFLAGS_pcap.o = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) |
4081 |
- |
4082 |
--LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) |
4083 |
-+LDFLAGS_vde.o = $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) |
4084 |
- |
4085 |
- targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o |
4086 |
- |
4087 |
-diff --git a/arch/unicore32/lib/Makefile b/arch/unicore32/lib/Makefile |
4088 |
-index 098981a01841..5af06645b8f0 100644 |
4089 |
---- a/arch/unicore32/lib/Makefile |
4090 |
-+++ b/arch/unicore32/lib/Makefile |
4091 |
-@@ -10,12 +10,12 @@ lib-y += strncpy_from_user.o strnlen_user.o |
4092 |
- lib-y += clear_user.o copy_page.o |
4093 |
- lib-y += copy_from_user.o copy_to_user.o |
4094 |
- |
4095 |
--GNU_LIBC_A := $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libc.a) |
4096 |
-+GNU_LIBC_A = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libc.a) |
4097 |
- GNU_LIBC_A_OBJS := memchr.o memcpy.o memmove.o memset.o |
4098 |
- GNU_LIBC_A_OBJS += strchr.o strrchr.o |
4099 |
- GNU_LIBC_A_OBJS += rawmemchr.o # needed by strrchr.o |
4100 |
- |
4101 |
--GNU_LIBGCC_A := $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) |
4102 |
-+GNU_LIBGCC_A = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) |
4103 |
- GNU_LIBGCC_A_OBJS := _ashldi3.o _ashrdi3.o _lshrdi3.o |
4104 |
- GNU_LIBGCC_A_OBJS += _divsi3.o _modsi3.o _ucmpdi2.o _umodsi3.o _udivsi3.o |
4105 |
- |
4106 |
-diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
4107 |
-index e53dda210cd7..21d2f1de1057 100644 |
4108 |
---- a/arch/x86/kernel/apic/apic.c |
4109 |
-+++ b/arch/x86/kernel/apic/apic.c |
4110 |
-@@ -2093,7 +2093,7 @@ void __init init_apic_mappings(void) |
4111 |
- unsigned int new_apicid; |
4112 |
- |
4113 |
- if (apic_validate_deadline_timer()) |
4114 |
-- pr_debug("TSC deadline timer available\n"); |
4115 |
-+ pr_info("TSC deadline timer available\n"); |
4116 |
- |
4117 |
- if (x2apic_mode) { |
4118 |
- boot_cpu_physical_apicid = read_apic_id(); |
4119 |
-diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c |
4120 |
-index d089567a9ce8..bcb379b2fd42 100644 |
4121 |
---- a/arch/x86/kernel/cpu/mce/dev-mcelog.c |
4122 |
-+++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c |
4123 |
-@@ -343,7 +343,7 @@ static __init int dev_mcelog_init_device(void) |
4124 |
- if (!mcelog) |
4125 |
- return -ENOMEM; |
4126 |
- |
4127 |
-- strncpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature)); |
4128 |
-+ memcpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature)); |
4129 |
- mcelog->len = mce_log_len; |
4130 |
- mcelog->recordlen = sizeof(struct mce); |
4131 |
- |
4132 |
-diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c |
4133 |
-index 87ef69a72c52..7bb4c3cbf4dc 100644 |
4134 |
---- a/arch/x86/kernel/idt.c |
4135 |
-+++ b/arch/x86/kernel/idt.c |
4136 |
-@@ -318,7 +318,11 @@ void __init idt_setup_apic_and_irq_gates(void) |
4137 |
- |
4138 |
- #ifdef CONFIG_X86_LOCAL_APIC |
4139 |
- for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { |
4140 |
-- set_bit(i, system_vectors); |
4141 |
-+ /* |
4142 |
-+ * Don't set the non assigned system vectors in the |
4143 |
-+ * system_vectors bitmap. Otherwise they show up in |
4144 |
-+ * /proc/interrupts. |
4145 |
-+ */ |
4146 |
- entry = spurious_entries_start + 8 * (i - FIRST_SYSTEM_VECTOR); |
4147 |
- set_intr_gate(i, entry); |
4148 |
- } |
4149 |
-diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
4150 |
-index 4d7022a740ab..a12adbe1559d 100644 |
4151 |
---- a/arch/x86/kernel/kprobes/core.c |
4152 |
-+++ b/arch/x86/kernel/kprobes/core.c |
4153 |
-@@ -753,16 +753,11 @@ asm( |
4154 |
- NOKPROBE_SYMBOL(kretprobe_trampoline); |
4155 |
- STACK_FRAME_NON_STANDARD(kretprobe_trampoline); |
4156 |
- |
4157 |
--static struct kprobe kretprobe_kprobe = { |
4158 |
-- .addr = (void *)kretprobe_trampoline, |
4159 |
--}; |
4160 |
-- |
4161 |
- /* |
4162 |
- * Called from kretprobe_trampoline |
4163 |
- */ |
4164 |
- __used __visible void *trampoline_handler(struct pt_regs *regs) |
4165 |
- { |
4166 |
-- struct kprobe_ctlblk *kcb; |
4167 |
- struct kretprobe_instance *ri = NULL; |
4168 |
- struct hlist_head *head, empty_rp; |
4169 |
- struct hlist_node *tmp; |
4170 |
-@@ -772,16 +767,12 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4171 |
- void *frame_pointer; |
4172 |
- bool skipped = false; |
4173 |
- |
4174 |
-- preempt_disable(); |
4175 |
-- |
4176 |
- /* |
4177 |
- * Set a dummy kprobe for avoiding kretprobe recursion. |
4178 |
- * Since kretprobe never run in kprobe handler, kprobe must not |
4179 |
- * be running at this point. |
4180 |
- */ |
4181 |
-- kcb = get_kprobe_ctlblk(); |
4182 |
-- __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
4183 |
-- kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
4184 |
-+ kprobe_busy_begin(); |
4185 |
- |
4186 |
- INIT_HLIST_HEAD(&empty_rp); |
4187 |
- kretprobe_hash_lock(current, &head, &flags); |
4188 |
-@@ -857,7 +848,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4189 |
- __this_cpu_write(current_kprobe, &ri->rp->kp); |
4190 |
- ri->ret_addr = correct_ret_addr; |
4191 |
- ri->rp->handler(ri, regs); |
4192 |
-- __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
4193 |
-+ __this_cpu_write(current_kprobe, &kprobe_busy); |
4194 |
- } |
4195 |
- |
4196 |
- recycle_rp_inst(ri, &empty_rp); |
4197 |
-@@ -873,8 +864,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) |
4198 |
- |
4199 |
- kretprobe_hash_unlock(current, &flags); |
4200 |
- |
4201 |
-- __this_cpu_write(current_kprobe, NULL); |
4202 |
-- preempt_enable(); |
4203 |
-+ kprobe_busy_end(); |
4204 |
- |
4205 |
- hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { |
4206 |
- hlist_del(&ri->hlist); |
4207 |
-diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile |
4208 |
-index fb4ee5444379..9733d1cc791d 100644 |
4209 |
---- a/arch/x86/purgatory/Makefile |
4210 |
-+++ b/arch/x86/purgatory/Makefile |
4211 |
-@@ -17,7 +17,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS |
4212 |
- LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib |
4213 |
- targets += purgatory.ro |
4214 |
- |
4215 |
-+# Sanitizer, etc. runtimes are unavailable and cannot be linked here. |
4216 |
-+GCOV_PROFILE := n |
4217 |
- KASAN_SANITIZE := n |
4218 |
-+UBSAN_SANITIZE := n |
4219 |
- KCOV_INSTRUMENT := n |
4220 |
- |
4221 |
- # These are adjustments to the compiler flags used for objects that |
4222 |
-@@ -25,7 +28,7 @@ KCOV_INSTRUMENT := n |
4223 |
- |
4224 |
- PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel |
4225 |
- PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss |
4226 |
--PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) |
4227 |
-+PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING |
4228 |
- |
4229 |
- # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That |
4230 |
- # in turn leaves some undefined symbols like __fentry__ in purgatory and not |
4231 |
-diff --git a/crypto/algboss.c b/crypto/algboss.c |
4232 |
-index 535f1f87e6c1..5ebccbd6b74e 100644 |
4233 |
---- a/crypto/algboss.c |
4234 |
-+++ b/crypto/algboss.c |
4235 |
-@@ -178,8 +178,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) |
4236 |
- if (IS_ERR(thread)) |
4237 |
- goto err_put_larval; |
4238 |
- |
4239 |
-- wait_for_completion_interruptible(&larval->completion); |
4240 |
-- |
4241 |
- return NOTIFY_STOP; |
4242 |
- |
4243 |
- err_put_larval: |
4244 |
-diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c |
4245 |
-index e2c8ab408bed..4c3bdffe0c3a 100644 |
4246 |
---- a/crypto/algif_skcipher.c |
4247 |
-+++ b/crypto/algif_skcipher.c |
4248 |
-@@ -74,14 +74,10 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg, |
4249 |
- return PTR_ERR(areq); |
4250 |
- |
4251 |
- /* convert iovecs of output buffers into RX SGL */ |
4252 |
-- err = af_alg_get_rsgl(sk, msg, flags, areq, -1, &len); |
4253 |
-+ err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len); |
4254 |
- if (err) |
4255 |
- goto free; |
4256 |
- |
4257 |
-- /* Process only as much RX buffers for which we have TX data */ |
4258 |
-- if (len > ctx->used) |
4259 |
-- len = ctx->used; |
4260 |
-- |
4261 |
- /* |
4262 |
- * If more buffers are to be expected to be processed, process only |
4263 |
- * full block size buffers. |
4264 |
-diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
4265 |
-index beca5f91bb4c..e74c8fe2a5fd 100644 |
4266 |
---- a/drivers/ata/libata-core.c |
4267 |
-+++ b/drivers/ata/libata-core.c |
4268 |
-@@ -42,7 +42,6 @@ |
4269 |
- #include <linux/workqueue.h> |
4270 |
- #include <linux/scatterlist.h> |
4271 |
- #include <linux/io.h> |
4272 |
--#include <linux/async.h> |
4273 |
- #include <linux/log2.h> |
4274 |
- #include <linux/slab.h> |
4275 |
- #include <linux/glob.h> |
4276 |
-@@ -5778,7 +5777,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) |
4277 |
- /* perform each probe asynchronously */ |
4278 |
- for (i = 0; i < host->n_ports; i++) { |
4279 |
- struct ata_port *ap = host->ports[i]; |
4280 |
-- async_schedule(async_port_probe, ap); |
4281 |
-+ ap->cookie = async_schedule(async_port_probe, ap); |
4282 |
- } |
4283 |
- |
4284 |
- return 0; |
4285 |
-@@ -5920,11 +5919,11 @@ void ata_host_detach(struct ata_host *host) |
4286 |
- { |
4287 |
- int i; |
4288 |
- |
4289 |
-- /* Ensure ata_port probe has completed */ |
4290 |
-- async_synchronize_full(); |
4291 |
-- |
4292 |
-- for (i = 0; i < host->n_ports; i++) |
4293 |
-+ for (i = 0; i < host->n_ports; i++) { |
4294 |
-+ /* Ensure ata_port probe has completed */ |
4295 |
-+ async_synchronize_cookie(host->ports[i]->cookie + 1); |
4296 |
- ata_port_detach(host->ports[i]); |
4297 |
-+ } |
4298 |
- |
4299 |
- /* the host is dead now, dissociate ACPI */ |
4300 |
- ata_acpi_dissociate(host); |
4301 |
-diff --git a/drivers/base/platform.c b/drivers/base/platform.c |
4302 |
-index b27d0f6c18c9..f5d485166fd3 100644 |
4303 |
---- a/drivers/base/platform.c |
4304 |
-+++ b/drivers/base/platform.c |
4305 |
-@@ -851,6 +851,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, |
4306 |
- /* temporary section violation during probe() */ |
4307 |
- drv->probe = probe; |
4308 |
- retval = code = __platform_driver_register(drv, module); |
4309 |
-+ if (retval) |
4310 |
-+ return retval; |
4311 |
- |
4312 |
- /* |
4313 |
- * Fixup that section violation, being paranoid about code scanning |
4314 |
-diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c |
4315 |
-index c5c6487a19d5..7b55811c2a81 100644 |
4316 |
---- a/drivers/block/ps3disk.c |
4317 |
-+++ b/drivers/block/ps3disk.c |
4318 |
-@@ -454,7 +454,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev) |
4319 |
- queue->queuedata = dev; |
4320 |
- |
4321 |
- blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9); |
4322 |
-- blk_queue_segment_boundary(queue, -1UL); |
4323 |
- blk_queue_dma_alignment(queue, dev->blk_size-1); |
4324 |
- blk_queue_logical_block_size(queue, dev->blk_size); |
4325 |
- |
4326 |
-diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c |
4327 |
-index 97e06cc586e4..8be3d0fb0614 100644 |
4328 |
---- a/drivers/bus/mhi/core/main.c |
4329 |
-+++ b/drivers/bus/mhi/core/main.c |
4330 |
-@@ -513,7 +513,10 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl, |
4331 |
- mhi_cntrl->unmap_single(mhi_cntrl, buf_info); |
4332 |
- |
4333 |
- result.buf_addr = buf_info->cb_buf; |
4334 |
-- result.bytes_xferd = xfer_len; |
4335 |
-+ |
4336 |
-+ /* truncate to buf len if xfer_len is larger */ |
4337 |
-+ result.bytes_xferd = |
4338 |
-+ min_t(u16, xfer_len, buf_info->len); |
4339 |
- mhi_del_ring_element(mhi_cntrl, buf_ring); |
4340 |
- mhi_del_ring_element(mhi_cntrl, tre_ring); |
4341 |
- local_rp = tre_ring->rp; |
4342 |
-@@ -597,7 +600,9 @@ static int parse_rsc_event(struct mhi_controller *mhi_cntrl, |
4343 |
- |
4344 |
- result.transaction_status = (ev_code == MHI_EV_CC_OVERFLOW) ? |
4345 |
- -EOVERFLOW : 0; |
4346 |
-- result.bytes_xferd = xfer_len; |
4347 |
-+ |
4348 |
-+ /* truncate to buf len if xfer_len is larger */ |
4349 |
-+ result.bytes_xferd = min_t(u16, xfer_len, buf_info->len); |
4350 |
- result.buf_addr = buf_info->cb_buf; |
4351 |
- result.dir = mhi_chan->dir; |
4352 |
- |
4353 |
-diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
4354 |
-index c48d8f086382..9afd220cd824 100644 |
4355 |
---- a/drivers/char/ipmi/ipmi_msghandler.c |
4356 |
-+++ b/drivers/char/ipmi/ipmi_msghandler.c |
4357 |
-@@ -33,6 +33,7 @@ |
4358 |
- #include <linux/workqueue.h> |
4359 |
- #include <linux/uuid.h> |
4360 |
- #include <linux/nospec.h> |
4361 |
-+#include <linux/vmalloc.h> |
4362 |
- |
4363 |
- #define IPMI_DRIVER_VERSION "39.2" |
4364 |
- |
4365 |
-@@ -1153,7 +1154,7 @@ static void free_user_work(struct work_struct *work) |
4366 |
- remove_work); |
4367 |
- |
4368 |
- cleanup_srcu_struct(&user->release_barrier); |
4369 |
-- kfree(user); |
4370 |
-+ vfree(user); |
4371 |
- } |
4372 |
- |
4373 |
- int ipmi_create_user(unsigned int if_num, |
4374 |
-@@ -1185,7 +1186,7 @@ int ipmi_create_user(unsigned int if_num, |
4375 |
- if (rv) |
4376 |
- return rv; |
4377 |
- |
4378 |
-- new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
4379 |
-+ new_user = vzalloc(sizeof(*new_user)); |
4380 |
- if (!new_user) |
4381 |
- return -ENOMEM; |
4382 |
- |
4383 |
-@@ -1232,7 +1233,7 @@ int ipmi_create_user(unsigned int if_num, |
4384 |
- |
4385 |
- out_kfree: |
4386 |
- srcu_read_unlock(&ipmi_interfaces_srcu, index); |
4387 |
-- kfree(new_user); |
4388 |
-+ vfree(new_user); |
4389 |
- return rv; |
4390 |
- } |
4391 |
- EXPORT_SYMBOL(ipmi_create_user); |
4392 |
-diff --git a/drivers/char/mem.c b/drivers/char/mem.c |
4393 |
-index 43dd0891ca1e..31cae88a730b 100644 |
4394 |
---- a/drivers/char/mem.c |
4395 |
-+++ b/drivers/char/mem.c |
4396 |
-@@ -31,11 +31,15 @@ |
4397 |
- #include <linux/uio.h> |
4398 |
- #include <linux/uaccess.h> |
4399 |
- #include <linux/security.h> |
4400 |
-+#include <linux/pseudo_fs.h> |
4401 |
-+#include <uapi/linux/magic.h> |
4402 |
-+#include <linux/mount.h> |
4403 |
- |
4404 |
- #ifdef CONFIG_IA64 |
4405 |
- # include <linux/efi.h> |
4406 |
- #endif |
4407 |
- |
4408 |
-+#define DEVMEM_MINOR 1 |
4409 |
- #define DEVPORT_MINOR 4 |
4410 |
- |
4411 |
- static inline unsigned long size_inside_page(unsigned long start, |
4412 |
-@@ -805,12 +809,64 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) |
4413 |
- return ret; |
4414 |
- } |
4415 |
- |
4416 |
-+static struct inode *devmem_inode; |
4417 |
-+ |
4418 |
-+#ifdef CONFIG_IO_STRICT_DEVMEM |
4419 |
-+void revoke_devmem(struct resource *res) |
4420 |
-+{ |
4421 |
-+ struct inode *inode = READ_ONCE(devmem_inode); |
4422 |
-+ |
4423 |
-+ /* |
4424 |
-+ * Check that the initialization has completed. Losing the race |
4425 |
-+ * is ok because it means drivers are claiming resources before |
4426 |
-+ * the fs_initcall level of init and prevent /dev/mem from |
4427 |
-+ * establishing mappings. |
4428 |
-+ */ |
4429 |
-+ if (!inode) |
4430 |
-+ return; |
4431 |
-+ |
4432 |
-+ /* |
4433 |
-+ * The expectation is that the driver has successfully marked |
4434 |
-+ * the resource busy by this point, so devmem_is_allowed() |
4435 |
-+ * should start returning false, however for performance this |
4436 |
-+ * does not iterate the entire resource range. |
4437 |
-+ */ |
4438 |
-+ if (devmem_is_allowed(PHYS_PFN(res->start)) && |
4439 |
-+ devmem_is_allowed(PHYS_PFN(res->end))) { |
4440 |
-+ /* |
4441 |
-+ * *cringe* iomem=relaxed says "go ahead, what's the |
4442 |
-+ * worst that can happen?" |
4443 |
-+ */ |
4444 |
-+ return; |
4445 |
-+ } |
4446 |
-+ |
4447 |
-+ unmap_mapping_range(inode->i_mapping, res->start, resource_size(res), 1); |
4448 |
-+} |
4449 |
-+#endif |
4450 |
-+ |
4451 |
- static int open_port(struct inode *inode, struct file *filp) |
4452 |
- { |
4453 |
-+ int rc; |
4454 |
-+ |
4455 |
- if (!capable(CAP_SYS_RAWIO)) |
4456 |
- return -EPERM; |
4457 |
- |
4458 |
-- return security_locked_down(LOCKDOWN_DEV_MEM); |
4459 |
-+ rc = security_locked_down(LOCKDOWN_DEV_MEM); |
4460 |
-+ if (rc) |
4461 |
-+ return rc; |
4462 |
-+ |
4463 |
-+ if (iminor(inode) != DEVMEM_MINOR) |
4464 |
-+ return 0; |
4465 |
-+ |
4466 |
-+ /* |
4467 |
-+ * Use a unified address space to have a single point to manage |
4468 |
-+ * revocations when drivers want to take over a /dev/mem mapped |
4469 |
-+ * range. |
4470 |
-+ */ |
4471 |
-+ inode->i_mapping = devmem_inode->i_mapping; |
4472 |
-+ filp->f_mapping = inode->i_mapping; |
4473 |
-+ |
4474 |
-+ return 0; |
4475 |
- } |
4476 |
- |
4477 |
- #define zero_lseek null_lseek |
4478 |
-@@ -885,7 +941,7 @@ static const struct memdev { |
4479 |
- fmode_t fmode; |
4480 |
- } devlist[] = { |
4481 |
- #ifdef CONFIG_DEVMEM |
4482 |
-- [1] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET }, |
4483 |
-+ [DEVMEM_MINOR] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET }, |
4484 |
- #endif |
4485 |
- #ifdef CONFIG_DEVKMEM |
4486 |
- [2] = { "kmem", 0, &kmem_fops, FMODE_UNSIGNED_OFFSET }, |
4487 |
-@@ -939,6 +995,45 @@ static char *mem_devnode(struct device *dev, umode_t *mode) |
4488 |
- |
4489 |
- static struct class *mem_class; |
4490 |
- |
4491 |
-+static int devmem_fs_init_fs_context(struct fs_context *fc) |
4492 |
-+{ |
4493 |
-+ return init_pseudo(fc, DEVMEM_MAGIC) ? 0 : -ENOMEM; |
4494 |
-+} |
4495 |
-+ |
4496 |
-+static struct file_system_type devmem_fs_type = { |
4497 |
-+ .name = "devmem", |
4498 |
-+ .owner = THIS_MODULE, |
4499 |
-+ .init_fs_context = devmem_fs_init_fs_context, |
4500 |
-+ .kill_sb = kill_anon_super, |
4501 |
-+}; |
4502 |
-+ |
4503 |
-+static int devmem_init_inode(void) |
4504 |
-+{ |
4505 |
-+ static struct vfsmount *devmem_vfs_mount; |
4506 |
-+ static int devmem_fs_cnt; |
4507 |
-+ struct inode *inode; |
4508 |
-+ int rc; |
4509 |
-+ |
4510 |
-+ rc = simple_pin_fs(&devmem_fs_type, &devmem_vfs_mount, &devmem_fs_cnt); |
4511 |
-+ if (rc < 0) { |
4512 |
-+ pr_err("Cannot mount /dev/mem pseudo filesystem: %d\n", rc); |
4513 |
-+ return rc; |
4514 |
-+ } |
4515 |
-+ |
4516 |
-+ inode = alloc_anon_inode(devmem_vfs_mount->mnt_sb); |
4517 |
-+ if (IS_ERR(inode)) { |
4518 |
-+ rc = PTR_ERR(inode); |
4519 |
-+ pr_err("Cannot allocate inode for /dev/mem: %d\n", rc); |
4520 |
-+ simple_release_fs(&devmem_vfs_mount, &devmem_fs_cnt); |
4521 |
-+ return rc; |
4522 |
-+ } |
4523 |
-+ |
4524 |
-+ /* publish /dev/mem initialized */ |
4525 |
-+ WRITE_ONCE(devmem_inode, inode); |
4526 |
-+ |
4527 |
-+ return 0; |
4528 |
-+} |
4529 |
-+ |
4530 |
- static int __init chr_dev_init(void) |
4531 |
- { |
4532 |
- int minor; |
4533 |
-@@ -960,6 +1055,8 @@ static int __init chr_dev_init(void) |
4534 |
- */ |
4535 |
- if ((minor == DEVPORT_MINOR) && !arch_has_dev_port()) |
4536 |
- continue; |
4537 |
-+ if ((minor == DEVMEM_MINOR) && devmem_init_inode() != 0) |
4538 |
-+ continue; |
4539 |
- |
4540 |
- device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor), |
4541 |
- NULL, devlist[minor].name); |
4542 |
-diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile |
4543 |
-index f4169cc2fd31..60e811d3f226 100644 |
4544 |
---- a/drivers/clk/Makefile |
4545 |
-+++ b/drivers/clk/Makefile |
4546 |
-@@ -105,7 +105,7 @@ obj-$(CONFIG_CLK_SIFIVE) += sifive/ |
4547 |
- obj-$(CONFIG_ARCH_SIRF) += sirf/ |
4548 |
- obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/ |
4549 |
- obj-$(CONFIG_PLAT_SPEAR) += spear/ |
4550 |
--obj-$(CONFIG_ARCH_SPRD) += sprd/ |
4551 |
-+obj-y += sprd/ |
4552 |
- obj-$(CONFIG_ARCH_STI) += st/ |
4553 |
- obj-$(CONFIG_ARCH_STRATIX10) += socfpga/ |
4554 |
- obj-$(CONFIG_ARCH_SUNXI) += sunxi/ |
4555 |
-diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c |
4556 |
-index ded13ccf768e..7c845c293af0 100644 |
4557 |
---- a/drivers/clk/bcm/clk-bcm2835.c |
4558 |
-+++ b/drivers/clk/bcm/clk-bcm2835.c |
4559 |
-@@ -1448,13 +1448,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, |
4560 |
- return &clock->hw; |
4561 |
- } |
4562 |
- |
4563 |
--static struct clk *bcm2835_register_gate(struct bcm2835_cprman *cprman, |
4564 |
-+static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman, |
4565 |
- const struct bcm2835_gate_data *data) |
4566 |
- { |
4567 |
-- return clk_register_gate(cprman->dev, data->name, data->parent, |
4568 |
-- CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
4569 |
-- cprman->regs + data->ctl_reg, |
4570 |
-- CM_GATE_BIT, 0, &cprman->regs_lock); |
4571 |
-+ return clk_hw_register_gate(cprman->dev, data->name, data->parent, |
4572 |
-+ CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, |
4573 |
-+ cprman->regs + data->ctl_reg, |
4574 |
-+ CM_GATE_BIT, 0, &cprman->regs_lock); |
4575 |
- } |
4576 |
- |
4577 |
- typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman, |
4578 |
-diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c |
4579 |
-index 392d01705b97..99afc949925f 100644 |
4580 |
---- a/drivers/clk/clk-ast2600.c |
4581 |
-+++ b/drivers/clk/clk-ast2600.c |
4582 |
-@@ -642,14 +642,22 @@ static const u32 ast2600_a0_axi_ahb_div_table[] = { |
4583 |
- 2, 2, 3, 5, |
4584 |
- }; |
4585 |
- |
4586 |
--static const u32 ast2600_a1_axi_ahb_div_table[] = { |
4587 |
-- 4, 6, 2, 4, |
4588 |
-+static const u32 ast2600_a1_axi_ahb_div0_tbl[] = { |
4589 |
-+ 3, 2, 3, 4, |
4590 |
-+}; |
4591 |
-+ |
4592 |
-+static const u32 ast2600_a1_axi_ahb_div1_tbl[] = { |
4593 |
-+ 3, 4, 6, 8, |
4594 |
-+}; |
4595 |
-+ |
4596 |
-+static const u32 ast2600_a1_axi_ahb200_tbl[] = { |
4597 |
-+ 3, 4, 3, 4, 2, 2, 2, 2, |
4598 |
- }; |
4599 |
- |
4600 |
- static void __init aspeed_g6_cc(struct regmap *map) |
4601 |
- { |
4602 |
- struct clk_hw *hw; |
4603 |
-- u32 val, div, chip_id, axi_div, ahb_div; |
4604 |
-+ u32 val, div, divbits, chip_id, axi_div, ahb_div; |
4605 |
- |
4606 |
- clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, 25000000); |
4607 |
- |
4608 |
-@@ -679,11 +687,22 @@ static void __init aspeed_g6_cc(struct regmap *map) |
4609 |
- else |
4610 |
- axi_div = 2; |
4611 |
- |
4612 |
-+ divbits = (val >> 11) & 0x3; |
4613 |
- regmap_read(map, ASPEED_G6_SILICON_REV, &chip_id); |
4614 |
-- if (chip_id & BIT(16)) |
4615 |
-- ahb_div = ast2600_a1_axi_ahb_div_table[(val >> 11) & 0x3]; |
4616 |
-- else |
4617 |
-+ if (chip_id & BIT(16)) { |
4618 |
-+ if (!divbits) { |
4619 |
-+ ahb_div = ast2600_a1_axi_ahb200_tbl[(val >> 8) & 0x3]; |
4620 |
-+ if (val & BIT(16)) |
4621 |
-+ ahb_div *= 2; |
4622 |
-+ } else { |
4623 |
-+ if (val & BIT(16)) |
4624 |
-+ ahb_div = ast2600_a1_axi_ahb_div1_tbl[divbits]; |
4625 |
-+ else |
4626 |
-+ ahb_div = ast2600_a1_axi_ahb_div0_tbl[divbits]; |
4627 |
-+ } |
4628 |
-+ } else { |
4629 |
- ahb_div = ast2600_a0_axi_ahb_div_table[(val >> 11) & 0x3]; |
4630 |
-+ } |
4631 |
- |
4632 |
- hw = clk_hw_register_fixed_factor(NULL, "ahb", "hpll", 0, 1, axi_div * ahb_div); |
4633 |
- aspeed_g6_clk_data->hws[ASPEED_CLK_AHB] = hw; |
4634 |
-diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c |
4635 |
-index 34a70c4b4899..11f6b868cf2b 100644 |
4636 |
---- a/drivers/clk/meson/meson8b.c |
4637 |
-+++ b/drivers/clk/meson/meson8b.c |
4638 |
-@@ -1077,7 +1077,7 @@ static struct clk_regmap meson8b_vid_pll_in_sel = { |
4639 |
- * Meson8m2: vid2_pll |
4640 |
- */ |
4641 |
- .parent_hws = (const struct clk_hw *[]) { |
4642 |
-- &meson8b_hdmi_pll_dco.hw |
4643 |
-+ &meson8b_hdmi_pll_lvds_out.hw |
4644 |
- }, |
4645 |
- .num_parents = 1, |
4646 |
- .flags = CLK_SET_RATE_PARENT, |
4647 |
-@@ -1213,7 +1213,7 @@ static struct clk_regmap meson8b_vclk_in_en = { |
4648 |
- |
4649 |
- static struct clk_regmap meson8b_vclk_div1_gate = { |
4650 |
- .data = &(struct clk_regmap_gate_data){ |
4651 |
-- .offset = HHI_VID_CLK_DIV, |
4652 |
-+ .offset = HHI_VID_CLK_CNTL, |
4653 |
- .bit_idx = 0, |
4654 |
- }, |
4655 |
- .hw.init = &(struct clk_init_data){ |
4656 |
-@@ -1243,7 +1243,7 @@ static struct clk_fixed_factor meson8b_vclk_div2_div = { |
4657 |
- |
4658 |
- static struct clk_regmap meson8b_vclk_div2_div_gate = { |
4659 |
- .data = &(struct clk_regmap_gate_data){ |
4660 |
-- .offset = HHI_VID_CLK_DIV, |
4661 |
-+ .offset = HHI_VID_CLK_CNTL, |
4662 |
- .bit_idx = 1, |
4663 |
- }, |
4664 |
- .hw.init = &(struct clk_init_data){ |
4665 |
-@@ -1273,7 +1273,7 @@ static struct clk_fixed_factor meson8b_vclk_div4_div = { |
4666 |
- |
4667 |
- static struct clk_regmap meson8b_vclk_div4_div_gate = { |
4668 |
- .data = &(struct clk_regmap_gate_data){ |
4669 |
-- .offset = HHI_VID_CLK_DIV, |
4670 |
-+ .offset = HHI_VID_CLK_CNTL, |
4671 |
- .bit_idx = 2, |
4672 |
- }, |
4673 |
- .hw.init = &(struct clk_init_data){ |
4674 |
-@@ -1303,7 +1303,7 @@ static struct clk_fixed_factor meson8b_vclk_div6_div = { |
4675 |
- |
4676 |
- static struct clk_regmap meson8b_vclk_div6_div_gate = { |
4677 |
- .data = &(struct clk_regmap_gate_data){ |
4678 |
-- .offset = HHI_VID_CLK_DIV, |
4679 |
-+ .offset = HHI_VID_CLK_CNTL, |
4680 |
- .bit_idx = 3, |
4681 |
- }, |
4682 |
- .hw.init = &(struct clk_init_data){ |
4683 |
-@@ -1333,7 +1333,7 @@ static struct clk_fixed_factor meson8b_vclk_div12_div = { |
4684 |
- |
4685 |
- static struct clk_regmap meson8b_vclk_div12_div_gate = { |
4686 |
- .data = &(struct clk_regmap_gate_data){ |
4687 |
-- .offset = HHI_VID_CLK_DIV, |
4688 |
-+ .offset = HHI_VID_CLK_CNTL, |
4689 |
- .bit_idx = 4, |
4690 |
- }, |
4691 |
- .hw.init = &(struct clk_init_data){ |
4692 |
-@@ -1918,6 +1918,13 @@ static struct clk_regmap meson8b_mali = { |
4693 |
- }, |
4694 |
- }; |
4695 |
- |
4696 |
-+static const struct reg_sequence meson8m2_gp_pll_init_regs[] = { |
4697 |
-+ { .reg = HHI_GP_PLL_CNTL2, .def = 0x59c88000 }, |
4698 |
-+ { .reg = HHI_GP_PLL_CNTL3, .def = 0xca463823 }, |
4699 |
-+ { .reg = HHI_GP_PLL_CNTL4, .def = 0x0286a027 }, |
4700 |
-+ { .reg = HHI_GP_PLL_CNTL5, .def = 0x00003000 }, |
4701 |
-+}; |
4702 |
-+ |
4703 |
- static const struct pll_params_table meson8m2_gp_pll_params_table[] = { |
4704 |
- PLL_PARAMS(182, 3), |
4705 |
- { /* sentinel */ }, |
4706 |
-@@ -1951,6 +1958,8 @@ static struct clk_regmap meson8m2_gp_pll_dco = { |
4707 |
- .width = 1, |
4708 |
- }, |
4709 |
- .table = meson8m2_gp_pll_params_table, |
4710 |
-+ .init_regs = meson8m2_gp_pll_init_regs, |
4711 |
-+ .init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs), |
4712 |
- }, |
4713 |
- .hw.init = &(struct clk_init_data){ |
4714 |
- .name = "gp_pll_dco", |
4715 |
-@@ -3506,54 +3515,87 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { |
4716 |
- static const struct meson8b_clk_reset_line { |
4717 |
- u32 reg; |
4718 |
- u8 bit_idx; |
4719 |
-+ bool active_low; |
4720 |
- } meson8b_clk_reset_bits[] = { |
4721 |
- [CLKC_RESET_L2_CACHE_SOFT_RESET] = { |
4722 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30 |
4723 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4724 |
-+ .bit_idx = 30, |
4725 |
-+ .active_low = false, |
4726 |
- }, |
4727 |
- [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = { |
4728 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29 |
4729 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4730 |
-+ .bit_idx = 29, |
4731 |
-+ .active_low = false, |
4732 |
- }, |
4733 |
- [CLKC_RESET_SCU_SOFT_RESET] = { |
4734 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28 |
4735 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4736 |
-+ .bit_idx = 28, |
4737 |
-+ .active_low = false, |
4738 |
- }, |
4739 |
- [CLKC_RESET_CPU3_SOFT_RESET] = { |
4740 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27 |
4741 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4742 |
-+ .bit_idx = 27, |
4743 |
-+ .active_low = false, |
4744 |
- }, |
4745 |
- [CLKC_RESET_CPU2_SOFT_RESET] = { |
4746 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26 |
4747 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4748 |
-+ .bit_idx = 26, |
4749 |
-+ .active_low = false, |
4750 |
- }, |
4751 |
- [CLKC_RESET_CPU1_SOFT_RESET] = { |
4752 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25 |
4753 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4754 |
-+ .bit_idx = 25, |
4755 |
-+ .active_low = false, |
4756 |
- }, |
4757 |
- [CLKC_RESET_CPU0_SOFT_RESET] = { |
4758 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24 |
4759 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4760 |
-+ .bit_idx = 24, |
4761 |
-+ .active_low = false, |
4762 |
- }, |
4763 |
- [CLKC_RESET_A5_GLOBAL_RESET] = { |
4764 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18 |
4765 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4766 |
-+ .bit_idx = 18, |
4767 |
-+ .active_low = false, |
4768 |
- }, |
4769 |
- [CLKC_RESET_A5_AXI_SOFT_RESET] = { |
4770 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17 |
4771 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4772 |
-+ .bit_idx = 17, |
4773 |
-+ .active_low = false, |
4774 |
- }, |
4775 |
- [CLKC_RESET_A5_ABP_SOFT_RESET] = { |
4776 |
-- .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16 |
4777 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL0, |
4778 |
-+ .bit_idx = 16, |
4779 |
-+ .active_low = false, |
4780 |
- }, |
4781 |
- [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = { |
4782 |
-- .reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30 |
4783 |
-+ .reg = HHI_SYS_CPU_CLK_CNTL1, |
4784 |
-+ .bit_idx = 30, |
4785 |
-+ .active_low = false, |
4786 |
- }, |
4787 |
- [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = { |
4788 |
-- .reg = HHI_VID_CLK_CNTL, .bit_idx = 15 |
4789 |
-+ .reg = HHI_VID_CLK_CNTL, |
4790 |
-+ .bit_idx = 15, |
4791 |
-+ .active_low = false, |
4792 |
- }, |
4793 |
- [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = { |
4794 |
-- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7 |
4795 |
-+ .reg = HHI_VID_DIVIDER_CNTL, |
4796 |
-+ .bit_idx = 7, |
4797 |
-+ .active_low = false, |
4798 |
- }, |
4799 |
- [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = { |
4800 |
-- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3 |
4801 |
-+ .reg = HHI_VID_DIVIDER_CNTL, |
4802 |
-+ .bit_idx = 3, |
4803 |
-+ .active_low = false, |
4804 |
- }, |
4805 |
- [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = { |
4806 |
-- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1 |
4807 |
-+ .reg = HHI_VID_DIVIDER_CNTL, |
4808 |
-+ .bit_idx = 1, |
4809 |
-+ .active_low = true, |
4810 |
- }, |
4811 |
- [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = { |
4812 |
-- .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0 |
4813 |
-+ .reg = HHI_VID_DIVIDER_CNTL, |
4814 |
-+ .bit_idx = 0, |
4815 |
-+ .active_low = true, |
4816 |
- }, |
4817 |
- }; |
4818 |
- |
4819 |
-@@ -3562,22 +3604,22 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev, |
4820 |
- { |
4821 |
- struct meson8b_clk_reset *meson8b_clk_reset = |
4822 |
- container_of(rcdev, struct meson8b_clk_reset, reset); |
4823 |
-- unsigned long flags; |
4824 |
- const struct meson8b_clk_reset_line *reset; |
4825 |
-+ unsigned int value = 0; |
4826 |
-+ unsigned long flags; |
4827 |
- |
4828 |
- if (id >= ARRAY_SIZE(meson8b_clk_reset_bits)) |
4829 |
- return -EINVAL; |
4830 |
- |
4831 |
- reset = &meson8b_clk_reset_bits[id]; |
4832 |
- |
4833 |
-+ if (assert != reset->active_low) |
4834 |
-+ value = BIT(reset->bit_idx); |
4835 |
-+ |
4836 |
- spin_lock_irqsave(&meson_clk_lock, flags); |
4837 |
- |
4838 |
-- if (assert) |
4839 |
-- regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
4840 |
-- BIT(reset->bit_idx), BIT(reset->bit_idx)); |
4841 |
-- else |
4842 |
-- regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
4843 |
-- BIT(reset->bit_idx), 0); |
4844 |
-+ regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, |
4845 |
-+ BIT(reset->bit_idx), value); |
4846 |
- |
4847 |
- spin_unlock_irqrestore(&meson_clk_lock, flags); |
4848 |
- |
4849 |
-diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h |
4850 |
-index c889fbeec30f..c91fb07fcb65 100644 |
4851 |
---- a/drivers/clk/meson/meson8b.h |
4852 |
-+++ b/drivers/clk/meson/meson8b.h |
4853 |
-@@ -20,6 +20,10 @@ |
4854 |
- * [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf |
4855 |
- */ |
4856 |
- #define HHI_GP_PLL_CNTL 0x40 /* 0x10 offset in data sheet */ |
4857 |
-+#define HHI_GP_PLL_CNTL2 0x44 /* 0x11 offset in data sheet */ |
4858 |
-+#define HHI_GP_PLL_CNTL3 0x48 /* 0x12 offset in data sheet */ |
4859 |
-+#define HHI_GP_PLL_CNTL4 0x4C /* 0x13 offset in data sheet */ |
4860 |
-+#define HHI_GP_PLL_CNTL5 0x50 /* 0x14 offset in data sheet */ |
4861 |
- #define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */ |
4862 |
- #define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */ |
4863 |
- #define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */ |
4864 |
-diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c |
4865 |
-index 4e329a7baf2b..17e4a5a2a9fd 100644 |
4866 |
---- a/drivers/clk/qcom/gcc-msm8916.c |
4867 |
-+++ b/drivers/clk/qcom/gcc-msm8916.c |
4868 |
-@@ -260,7 +260,7 @@ static struct clk_pll gpll0 = { |
4869 |
- .l_reg = 0x21004, |
4870 |
- .m_reg = 0x21008, |
4871 |
- .n_reg = 0x2100c, |
4872 |
-- .config_reg = 0x21014, |
4873 |
-+ .config_reg = 0x21010, |
4874 |
- .mode_reg = 0x21000, |
4875 |
- .status_reg = 0x2101c, |
4876 |
- .status_bit = 17, |
4877 |
-@@ -287,7 +287,7 @@ static struct clk_pll gpll1 = { |
4878 |
- .l_reg = 0x20004, |
4879 |
- .m_reg = 0x20008, |
4880 |
- .n_reg = 0x2000c, |
4881 |
-- .config_reg = 0x20014, |
4882 |
-+ .config_reg = 0x20010, |
4883 |
- .mode_reg = 0x20000, |
4884 |
- .status_reg = 0x2001c, |
4885 |
- .status_bit = 17, |
4886 |
-@@ -314,7 +314,7 @@ static struct clk_pll gpll2 = { |
4887 |
- .l_reg = 0x4a004, |
4888 |
- .m_reg = 0x4a008, |
4889 |
- .n_reg = 0x4a00c, |
4890 |
-- .config_reg = 0x4a014, |
4891 |
-+ .config_reg = 0x4a010, |
4892 |
- .mode_reg = 0x4a000, |
4893 |
- .status_reg = 0x4a01c, |
4894 |
- .status_bit = 17, |
4895 |
-@@ -341,7 +341,7 @@ static struct clk_pll bimc_pll = { |
4896 |
- .l_reg = 0x23004, |
4897 |
- .m_reg = 0x23008, |
4898 |
- .n_reg = 0x2300c, |
4899 |
-- .config_reg = 0x23014, |
4900 |
-+ .config_reg = 0x23010, |
4901 |
- .mode_reg = 0x23000, |
4902 |
- .status_reg = 0x2301c, |
4903 |
- .status_bit = 17, |
4904 |
-diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c |
4905 |
-index a2663fbbd7a5..d6a53c99b114 100644 |
4906 |
---- a/drivers/clk/renesas/renesas-cpg-mssr.c |
4907 |
-+++ b/drivers/clk/renesas/renesas-cpg-mssr.c |
4908 |
-@@ -812,7 +812,8 @@ static int cpg_mssr_suspend_noirq(struct device *dev) |
4909 |
- /* Save module registers with bits under our control */ |
4910 |
- for (reg = 0; reg < ARRAY_SIZE(priv->smstpcr_saved); reg++) { |
4911 |
- if (priv->smstpcr_saved[reg].mask) |
4912 |
-- priv->smstpcr_saved[reg].val = |
4913 |
-+ priv->smstpcr_saved[reg].val = priv->stbyctrl ? |
4914 |
-+ readb(priv->base + STBCR(reg)) : |
4915 |
- readl(priv->base + SMSTPCR(reg)); |
4916 |
- } |
4917 |
- |
4918 |
-@@ -872,8 +873,9 @@ static int cpg_mssr_resume_noirq(struct device *dev) |
4919 |
- } |
4920 |
- |
4921 |
- if (!i) |
4922 |
-- dev_warn(dev, "Failed to enable SMSTP %p[0x%x]\n", |
4923 |
-- priv->base + SMSTPCR(reg), oldval & mask); |
4924 |
-+ dev_warn(dev, "Failed to enable %s%u[0x%x]\n", |
4925 |
-+ priv->stbyctrl ? "STB" : "SMSTP", reg, |
4926 |
-+ oldval & mask); |
4927 |
- } |
4928 |
- |
4929 |
- return 0; |
4930 |
-diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c |
4931 |
-index c9e5a1fb6653..edb2363c735a 100644 |
4932 |
---- a/drivers/clk/samsung/clk-exynos5420.c |
4933 |
-+++ b/drivers/clk/samsung/clk-exynos5420.c |
4934 |
-@@ -540,7 +540,7 @@ static const struct samsung_div_clock exynos5800_div_clks[] __initconst = { |
4935 |
- |
4936 |
- static const struct samsung_gate_clock exynos5800_gate_clks[] __initconst = { |
4937 |
- GATE(CLK_ACLK550_CAM, "aclk550_cam", "mout_user_aclk550_cam", |
4938 |
-- GATE_BUS_TOP, 24, 0, 0), |
4939 |
-+ GATE_BUS_TOP, 24, CLK_IS_CRITICAL, 0), |
4940 |
- GATE(CLK_ACLK432_SCALER, "aclk432_scaler", "mout_user_aclk432_scaler", |
4941 |
- GATE_BUS_TOP, 27, CLK_IS_CRITICAL, 0), |
4942 |
- }; |
4943 |
-@@ -943,25 +943,25 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { |
4944 |
- GATE(0, "aclk300_jpeg", "mout_user_aclk300_jpeg", |
4945 |
- GATE_BUS_TOP, 4, CLK_IGNORE_UNUSED, 0), |
4946 |
- GATE(0, "aclk333_432_isp0", "mout_user_aclk333_432_isp0", |
4947 |
-- GATE_BUS_TOP, 5, 0, 0), |
4948 |
-+ GATE_BUS_TOP, 5, CLK_IS_CRITICAL, 0), |
4949 |
- GATE(0, "aclk300_gscl", "mout_user_aclk300_gscl", |
4950 |
- GATE_BUS_TOP, 6, CLK_IS_CRITICAL, 0), |
4951 |
- GATE(0, "aclk333_432_gscl", "mout_user_aclk333_432_gscl", |
4952 |
- GATE_BUS_TOP, 7, CLK_IGNORE_UNUSED, 0), |
4953 |
- GATE(0, "aclk333_432_isp", "mout_user_aclk333_432_isp", |
4954 |
-- GATE_BUS_TOP, 8, 0, 0), |
4955 |
-+ GATE_BUS_TOP, 8, CLK_IS_CRITICAL, 0), |
4956 |
- GATE(CLK_PCLK66_GPIO, "pclk66_gpio", "mout_user_pclk66_gpio", |
4957 |
- GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), |
4958 |
- GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", |
4959 |
- GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), |
4960 |
- GATE(0, "aclk266_isp", "mout_user_aclk266_isp", |
4961 |
-- GATE_BUS_TOP, 13, 0, 0), |
4962 |
-+ GATE_BUS_TOP, 13, CLK_IS_CRITICAL, 0), |
4963 |
- GATE(0, "aclk166", "mout_user_aclk166", |
4964 |
- GATE_BUS_TOP, 14, CLK_IGNORE_UNUSED, 0), |
4965 |
- GATE(CLK_ACLK333, "aclk333", "mout_user_aclk333", |
4966 |
- GATE_BUS_TOP, 15, CLK_IS_CRITICAL, 0), |
4967 |
- GATE(0, "aclk400_isp", "mout_user_aclk400_isp", |
4968 |
-- GATE_BUS_TOP, 16, 0, 0), |
4969 |
-+ GATE_BUS_TOP, 16, CLK_IS_CRITICAL, 0), |
4970 |
- GATE(0, "aclk400_mscl", "mout_user_aclk400_mscl", |
4971 |
- GATE_BUS_TOP, 17, CLK_IS_CRITICAL, 0), |
4972 |
- GATE(0, "aclk200_disp1", "mout_user_aclk200_disp1", |
4973 |
-@@ -1161,8 +1161,10 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { |
4974 |
- GATE_IP_GSCL1, 3, 0, 0), |
4975 |
- GATE(CLK_SMMU_FIMCL1, "smmu_fimcl1", "dout_gscl_blk_333", |
4976 |
- GATE_IP_GSCL1, 4, 0, 0), |
4977 |
-- GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, 0, 0), |
4978 |
-- GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, 0, 0), |
4979 |
-+ GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, |
4980 |
-+ CLK_IS_CRITICAL, 0), |
4981 |
-+ GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, |
4982 |
-+ CLK_IS_CRITICAL, 0), |
4983 |
- GATE(CLK_SMMU_FIMCL3, "smmu_fimcl3,", "dout_gscl_blk_333", |
4984 |
- GATE_IP_GSCL1, 16, 0, 0), |
4985 |
- GATE(CLK_FIMC_LITE3, "fimc_lite3", "aclk333_432_gscl", |
4986 |
-diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c |
4987 |
-index 4b1aa9382ad2..6f29ecd0442e 100644 |
4988 |
---- a/drivers/clk/samsung/clk-exynos5433.c |
4989 |
-+++ b/drivers/clk/samsung/clk-exynos5433.c |
4990 |
-@@ -1706,7 +1706,8 @@ static const struct samsung_gate_clock peric_gate_clks[] __initconst = { |
4991 |
- GATE(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_pcm1_peric", |
4992 |
- ENABLE_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0), |
4993 |
- GATE(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_i2s1_peric", |
4994 |
-- ENABLE_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0), |
4995 |
-+ ENABLE_SCLK_PERIC, 6, |
4996 |
-+ CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0), |
4997 |
- GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC, |
4998 |
- 5, CLK_SET_RATE_PARENT, 0), |
4999 |
- GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC, |
5000 |
-diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c |
5001 |
-index 15791484388f..13a322b2535a 100644 |
5002 |
---- a/drivers/clk/sprd/pll.c |
5003 |
-+++ b/drivers/clk/sprd/pll.c |
5004 |
-@@ -106,7 +106,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, |
5005 |
- |
5006 |
- cfg = kcalloc(regs_num, sizeof(*cfg), GFP_KERNEL); |
5007 |
- if (!cfg) |
5008 |
-- return -ENOMEM; |
5009 |
-+ return parent_rate; |
5010 |
- |
5011 |
- for (i = 0; i < regs_num; i++) |
5012 |
- cfg[i] = sprd_pll_read(pll, i); |
5013 |
-diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c |
5014 |
-index 4413b6e04a8e..55873d4b7603 100644 |
5015 |
---- a/drivers/clk/st/clk-flexgen.c |
5016 |
-+++ b/drivers/clk/st/clk-flexgen.c |
5017 |
-@@ -375,6 +375,7 @@ static void __init st_of_flexgen_setup(struct device_node *np) |
5018 |
- break; |
5019 |
- } |
5020 |
- |
5021 |
-+ flex_flags &= ~CLK_IS_CRITICAL; |
5022 |
- of_clk_detect_critical(np, i, &flex_flags); |
5023 |
- |
5024 |
- /* |
5025 |
-diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c |
5026 |
-index 27201fd26e44..e1aa1fbac48a 100644 |
5027 |
---- a/drivers/clk/sunxi/clk-sunxi.c |
5028 |
-+++ b/drivers/clk/sunxi/clk-sunxi.c |
5029 |
-@@ -90,7 +90,7 @@ static void sun6i_a31_get_pll1_factors(struct factors_request *req) |
5030 |
- * Round down the frequency to the closest multiple of either |
5031 |
- * 6 or 16 |
5032 |
- */ |
5033 |
-- u32 round_freq_6 = round_down(freq_mhz, 6); |
5034 |
-+ u32 round_freq_6 = rounddown(freq_mhz, 6); |
5035 |
- u32 round_freq_16 = round_down(freq_mhz, 16); |
5036 |
- |
5037 |
- if (round_freq_6 > round_freq_16) |
5038 |
-diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c |
5039 |
-index 6a89936ba03a..eaa43575cfa5 100644 |
5040 |
---- a/drivers/clk/ti/composite.c |
5041 |
-+++ b/drivers/clk/ti/composite.c |
5042 |
-@@ -196,6 +196,7 @@ cleanup: |
5043 |
- if (!cclk->comp_clks[i]) |
5044 |
- continue; |
5045 |
- list_del(&cclk->comp_clks[i]->link); |
5046 |
-+ kfree(cclk->comp_clks[i]->parent_names); |
5047 |
- kfree(cclk->comp_clks[i]); |
5048 |
- } |
5049 |
- |
5050 |
-diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c |
5051 |
-index 10e89f23880b..b66c3a62233a 100644 |
5052 |
---- a/drivers/clk/zynqmp/clkc.c |
5053 |
-+++ b/drivers/clk/zynqmp/clkc.c |
5054 |
-@@ -558,7 +558,7 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
5055 |
- { |
5056 |
- int j; |
5057 |
- u32 num_nodes, clk_dev_id; |
5058 |
-- char *clk_out = NULL; |
5059 |
-+ char *clk_out[MAX_NODES]; |
5060 |
- struct clock_topology *nodes; |
5061 |
- struct clk_hw *hw = NULL; |
5062 |
- |
5063 |
-@@ -572,16 +572,16 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
5064 |
- * Intermediate clock names are postfixed with type of clock. |
5065 |
- */ |
5066 |
- if (j != (num_nodes - 1)) { |
5067 |
-- clk_out = kasprintf(GFP_KERNEL, "%s%s", clk_name, |
5068 |
-+ clk_out[j] = kasprintf(GFP_KERNEL, "%s%s", clk_name, |
5069 |
- clk_type_postfix[nodes[j].type]); |
5070 |
- } else { |
5071 |
-- clk_out = kasprintf(GFP_KERNEL, "%s", clk_name); |
5072 |
-+ clk_out[j] = kasprintf(GFP_KERNEL, "%s", clk_name); |
5073 |
- } |
5074 |
- |
5075 |
- if (!clk_topology[nodes[j].type]) |
5076 |
- continue; |
5077 |
- |
5078 |
-- hw = (*clk_topology[nodes[j].type])(clk_out, clk_dev_id, |
5079 |
-+ hw = (*clk_topology[nodes[j].type])(clk_out[j], clk_dev_id, |
5080 |
- parent_names, |
5081 |
- num_parents, |
5082 |
- &nodes[j]); |
5083 |
-@@ -590,9 +590,12 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, |
5084 |
- __func__, clk_dev_id, clk_name, |
5085 |
- PTR_ERR(hw)); |
5086 |
- |
5087 |
-- parent_names[0] = clk_out; |
5088 |
-+ parent_names[0] = clk_out[j]; |
5089 |
- } |
5090 |
-- kfree(clk_out); |
5091 |
-+ |
5092 |
-+ for (j = 0; j < num_nodes; j++) |
5093 |
-+ kfree(clk_out[j]); |
5094 |
-+ |
5095 |
- return hw; |
5096 |
- } |
5097 |
- |
5098 |
-diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c |
5099 |
-index 4be2cc76aa2e..9bc4f9409aea 100644 |
5100 |
---- a/drivers/clk/zynqmp/divider.c |
5101 |
-+++ b/drivers/clk/zynqmp/divider.c |
5102 |
-@@ -111,23 +111,30 @@ static unsigned long zynqmp_clk_divider_recalc_rate(struct clk_hw *hw, |
5103 |
- |
5104 |
- static void zynqmp_get_divider2_val(struct clk_hw *hw, |
5105 |
- unsigned long rate, |
5106 |
-- unsigned long parent_rate, |
5107 |
- struct zynqmp_clk_divider *divider, |
5108 |
- int *bestdiv) |
5109 |
- { |
5110 |
- int div1; |
5111 |
- int div2; |
5112 |
- long error = LONG_MAX; |
5113 |
-- struct clk_hw *parent_hw = clk_hw_get_parent(hw); |
5114 |
-- struct zynqmp_clk_divider *pdivider = to_zynqmp_clk_divider(parent_hw); |
5115 |
-+ unsigned long div1_prate; |
5116 |
-+ struct clk_hw *div1_parent_hw; |
5117 |
-+ struct clk_hw *div2_parent_hw = clk_hw_get_parent(hw); |
5118 |
-+ struct zynqmp_clk_divider *pdivider = |
5119 |
-+ to_zynqmp_clk_divider(div2_parent_hw); |
5120 |
- |
5121 |
- if (!pdivider) |
5122 |
- return; |
5123 |
- |
5124 |
-+ div1_parent_hw = clk_hw_get_parent(div2_parent_hw); |
5125 |
-+ if (!div1_parent_hw) |
5126 |
-+ return; |
5127 |
-+ |
5128 |
-+ div1_prate = clk_hw_get_rate(div1_parent_hw); |
5129 |
- *bestdiv = 1; |
5130 |
- for (div1 = 1; div1 <= pdivider->max_div;) { |
5131 |
- for (div2 = 1; div2 <= divider->max_div;) { |
5132 |
-- long new_error = ((parent_rate / div1) / div2) - rate; |
5133 |
-+ long new_error = ((div1_prate / div1) / div2) - rate; |
5134 |
- |
5135 |
- if (abs(new_error) < abs(error)) { |
5136 |
- *bestdiv = div2; |
5137 |
-@@ -192,7 +199,7 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw, |
5138 |
- */ |
5139 |
- if (div_type == TYPE_DIV2 && |
5140 |
- (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) { |
5141 |
-- zynqmp_get_divider2_val(hw, rate, *prate, divider, &bestdiv); |
5142 |
-+ zynqmp_get_divider2_val(hw, rate, divider, &bestdiv); |
5143 |
- } |
5144 |
- |
5145 |
- if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac) |
5146 |
-diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c |
5147 |
-index 0e8c7e324fb4..725a739800b0 100644 |
5148 |
---- a/drivers/crypto/hisilicon/sgl.c |
5149 |
-+++ b/drivers/crypto/hisilicon/sgl.c |
5150 |
-@@ -66,7 +66,8 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev, |
5151 |
- |
5152 |
- sgl_size = sizeof(struct acc_hw_sge) * sge_nr + |
5153 |
- sizeof(struct hisi_acc_hw_sgl); |
5154 |
-- block_size = PAGE_SIZE * (1 << (MAX_ORDER - 1)); |
5155 |
-+ block_size = 1 << (PAGE_SHIFT + MAX_ORDER <= 32 ? |
5156 |
-+ PAGE_SHIFT + MAX_ORDER - 1 : 31); |
5157 |
- sgl_num_per_block = block_size / sgl_size; |
5158 |
- block_num = count / sgl_num_per_block; |
5159 |
- remain_sgl = count % sgl_num_per_block; |
5160 |
-diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |
5161 |
-index 06202bcffb33..a370c99ecf4c 100644 |
5162 |
---- a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |
5163 |
-+++ b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |
5164 |
-@@ -118,6 +118,9 @@ static void otx_cpt_aead_callback(int status, void *arg1, void *arg2) |
5165 |
- struct otx_cpt_req_info *cpt_req; |
5166 |
- struct pci_dev *pdev; |
5167 |
- |
5168 |
-+ if (!cpt_info) |
5169 |
-+ goto complete; |
5170 |
-+ |
5171 |
- cpt_req = cpt_info->req; |
5172 |
- if (!status) { |
5173 |
- /* |
5174 |
-@@ -129,10 +132,10 @@ static void otx_cpt_aead_callback(int status, void *arg1, void *arg2) |
5175 |
- !cpt_req->is_enc) |
5176 |
- status = validate_hmac_cipher_null(cpt_req); |
5177 |
- } |
5178 |
-- if (cpt_info) { |
5179 |
-- pdev = cpt_info->pdev; |
5180 |
-- do_request_cleanup(pdev, cpt_info); |
5181 |
-- } |
5182 |
-+ pdev = cpt_info->pdev; |
5183 |
-+ do_request_cleanup(pdev, cpt_info); |
5184 |
-+ |
5185 |
-+complete: |
5186 |
- if (areq) |
5187 |
- areq->complete(areq, status); |
5188 |
- } |
5189 |
-diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
5190 |
-index e4072cd38585..a82a3596dca3 100644 |
5191 |
---- a/drivers/crypto/omap-sham.c |
5192 |
-+++ b/drivers/crypto/omap-sham.c |
5193 |
-@@ -169,8 +169,6 @@ struct omap_sham_hmac_ctx { |
5194 |
- }; |
5195 |
- |
5196 |
- struct omap_sham_ctx { |
5197 |
-- struct omap_sham_dev *dd; |
5198 |
-- |
5199 |
- unsigned long flags; |
5200 |
- |
5201 |
- /* fallback stuff */ |
5202 |
-@@ -751,8 +749,15 @@ static int omap_sham_align_sgs(struct scatterlist *sg, |
5203 |
- int offset = rctx->offset; |
5204 |
- int bufcnt = rctx->bufcnt; |
5205 |
- |
5206 |
-- if (!sg || !sg->length || !nbytes) |
5207 |
-+ if (!sg || !sg->length || !nbytes) { |
5208 |
-+ if (bufcnt) { |
5209 |
-+ sg_init_table(rctx->sgl, 1); |
5210 |
-+ sg_set_buf(rctx->sgl, rctx->dd->xmit_buf, bufcnt); |
5211 |
-+ rctx->sg = rctx->sgl; |
5212 |
-+ } |
5213 |
-+ |
5214 |
- return 0; |
5215 |
-+ } |
5216 |
- |
5217 |
- new_len = nbytes; |
5218 |
- |
5219 |
-@@ -896,7 +901,7 @@ static int omap_sham_prepare_request(struct ahash_request *req, bool update) |
5220 |
- if (hash_later < 0) |
5221 |
- hash_later = 0; |
5222 |
- |
5223 |
-- if (hash_later) { |
5224 |
-+ if (hash_later && hash_later <= rctx->buflen) { |
5225 |
- scatterwalk_map_and_copy(rctx->buffer, |
5226 |
- req->src, |
5227 |
- req->nbytes - hash_later, |
5228 |
-@@ -926,27 +931,35 @@ static int omap_sham_update_dma_stop(struct omap_sham_dev *dd) |
5229 |
- return 0; |
5230 |
- } |
5231 |
- |
5232 |
-+struct omap_sham_dev *omap_sham_find_dev(struct omap_sham_reqctx *ctx) |
5233 |
-+{ |
5234 |
-+ struct omap_sham_dev *dd; |
5235 |
-+ |
5236 |
-+ if (ctx->dd) |
5237 |
-+ return ctx->dd; |
5238 |
-+ |
5239 |
-+ spin_lock_bh(&sham.lock); |
5240 |
-+ dd = list_first_entry(&sham.dev_list, struct omap_sham_dev, list); |
5241 |
-+ list_move_tail(&dd->list, &sham.dev_list); |
5242 |
-+ ctx->dd = dd; |
5243 |
-+ spin_unlock_bh(&sham.lock); |
5244 |
-+ |
5245 |
-+ return dd; |
5246 |
-+} |
5247 |
-+ |
5248 |
- static int omap_sham_init(struct ahash_request *req) |
5249 |
- { |
5250 |
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
5251 |
- struct omap_sham_ctx *tctx = crypto_ahash_ctx(tfm); |
5252 |
- struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
5253 |
-- struct omap_sham_dev *dd = NULL, *tmp; |
5254 |
-+ struct omap_sham_dev *dd; |
5255 |
- int bs = 0; |
5256 |
- |
5257 |
-- spin_lock_bh(&sham.lock); |
5258 |
-- if (!tctx->dd) { |
5259 |
-- list_for_each_entry(tmp, &sham.dev_list, list) { |
5260 |
-- dd = tmp; |
5261 |
-- break; |
5262 |
-- } |
5263 |
-- tctx->dd = dd; |
5264 |
-- } else { |
5265 |
-- dd = tctx->dd; |
5266 |
-- } |
5267 |
-- spin_unlock_bh(&sham.lock); |
5268 |
-+ ctx->dd = NULL; |
5269 |
- |
5270 |
-- ctx->dd = dd; |
5271 |
-+ dd = omap_sham_find_dev(ctx); |
5272 |
-+ if (!dd) |
5273 |
-+ return -ENODEV; |
5274 |
- |
5275 |
- ctx->flags = 0; |
5276 |
- |
5277 |
-@@ -1216,8 +1229,7 @@ err1: |
5278 |
- static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) |
5279 |
- { |
5280 |
- struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
5281 |
-- struct omap_sham_ctx *tctx = crypto_tfm_ctx(req->base.tfm); |
5282 |
-- struct omap_sham_dev *dd = tctx->dd; |
5283 |
-+ struct omap_sham_dev *dd = ctx->dd; |
5284 |
- |
5285 |
- ctx->op = op; |
5286 |
- |
5287 |
-@@ -1227,7 +1239,7 @@ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op) |
5288 |
- static int omap_sham_update(struct ahash_request *req) |
5289 |
- { |
5290 |
- struct omap_sham_reqctx *ctx = ahash_request_ctx(req); |
5291 |
-- struct omap_sham_dev *dd = ctx->dd; |
5292 |
-+ struct omap_sham_dev *dd = omap_sham_find_dev(ctx); |
5293 |
- |
5294 |
- if (!req->nbytes) |
5295 |
- return 0; |
5296 |
-@@ -1331,21 +1343,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, |
5297 |
- struct omap_sham_hmac_ctx *bctx = tctx->base; |
5298 |
- int bs = crypto_shash_blocksize(bctx->shash); |
5299 |
- int ds = crypto_shash_digestsize(bctx->shash); |
5300 |
-- struct omap_sham_dev *dd = NULL, *tmp; |
5301 |
- int err, i; |
5302 |
- |
5303 |
-- spin_lock_bh(&sham.lock); |
5304 |
-- if (!tctx->dd) { |
5305 |
-- list_for_each_entry(tmp, &sham.dev_list, list) { |
5306 |
-- dd = tmp; |
5307 |
-- break; |
5308 |
-- } |
5309 |
-- tctx->dd = dd; |
5310 |
-- } else { |
5311 |
-- dd = tctx->dd; |
5312 |
-- } |
5313 |
-- spin_unlock_bh(&sham.lock); |
5314 |
-- |
5315 |
- err = crypto_shash_setkey(tctx->fallback, key, keylen); |
5316 |
- if (err) |
5317 |
- return err; |
5318 |
-@@ -1363,7 +1362,7 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, |
5319 |
- |
5320 |
- memset(bctx->ipad + keylen, 0, bs - keylen); |
5321 |
- |
5322 |
-- if (!test_bit(FLAGS_AUTO_XOR, &dd->flags)) { |
5323 |
-+ if (!test_bit(FLAGS_AUTO_XOR, &sham.flags)) { |
5324 |
- memcpy(bctx->opad, bctx->ipad, bs); |
5325 |
- |
5326 |
- for (i = 0; i < bs; i++) { |
5327 |
-@@ -2167,6 +2166,7 @@ static int omap_sham_probe(struct platform_device *pdev) |
5328 |
- } |
5329 |
- |
5330 |
- dd->flags |= dd->pdata->flags; |
5331 |
-+ sham.flags |= dd->pdata->flags; |
5332 |
- |
5333 |
- pm_runtime_use_autosuspend(dev); |
5334 |
- pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); |
5335 |
-@@ -2194,6 +2194,9 @@ static int omap_sham_probe(struct platform_device *pdev) |
5336 |
- spin_unlock(&sham.lock); |
5337 |
- |
5338 |
- for (i = 0; i < dd->pdata->algs_info_size; i++) { |
5339 |
-+ if (dd->pdata->algs_info[i].registered) |
5340 |
-+ break; |
5341 |
-+ |
5342 |
- for (j = 0; j < dd->pdata->algs_info[i].size; j++) { |
5343 |
- struct ahash_alg *alg; |
5344 |
- |
5345 |
-@@ -2245,9 +2248,11 @@ static int omap_sham_remove(struct platform_device *pdev) |
5346 |
- list_del(&dd->list); |
5347 |
- spin_unlock(&sham.lock); |
5348 |
- for (i = dd->pdata->algs_info_size - 1; i >= 0; i--) |
5349 |
-- for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) |
5350 |
-+ for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) { |
5351 |
- crypto_unregister_ahash( |
5352 |
- &dd->pdata->algs_info[i].algs_list[j]); |
5353 |
-+ dd->pdata->algs_info[i].registered--; |
5354 |
-+ } |
5355 |
- tasklet_kill(&dd->done_task); |
5356 |
- pm_runtime_disable(&pdev->dev); |
5357 |
- |
5358 |
-diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c |
5359 |
-index ad02dc6747a4..0317b614b680 100644 |
5360 |
---- a/drivers/extcon/extcon-adc-jack.c |
5361 |
-+++ b/drivers/extcon/extcon-adc-jack.c |
5362 |
-@@ -124,7 +124,7 @@ static int adc_jack_probe(struct platform_device *pdev) |
5363 |
- for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); |
5364 |
- data->num_conditions = i; |
5365 |
- |
5366 |
-- data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); |
5367 |
-+ data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); |
5368 |
- if (IS_ERR(data->chan)) |
5369 |
- return PTR_ERR(data->chan); |
5370 |
- |
5371 |
-@@ -164,7 +164,6 @@ static int adc_jack_remove(struct platform_device *pdev) |
5372 |
- |
5373 |
- free_irq(data->irq, data); |
5374 |
- cancel_work_sync(&data->handler.work); |
5375 |
-- iio_channel_release(data->chan); |
5376 |
- |
5377 |
- return 0; |
5378 |
- } |
5379 |
-diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c |
5380 |
-index b3da2e193ad2..176ddd151375 100644 |
5381 |
---- a/drivers/firmware/imx/imx-scu.c |
5382 |
-+++ b/drivers/firmware/imx/imx-scu.c |
5383 |
-@@ -314,6 +314,7 @@ static int imx_scu_probe(struct platform_device *pdev) |
5384 |
- if (ret != -EPROBE_DEFER) |
5385 |
- dev_err(dev, "Failed to request mbox chan %s ret %d\n", |
5386 |
- chan_name, ret); |
5387 |
-+ kfree(chan_name); |
5388 |
- return ret; |
5389 |
- } |
5390 |
- |
5391 |
-diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c |
5392 |
-index 059bb0fbae9e..4701487573f7 100644 |
5393 |
---- a/drivers/firmware/qcom_scm.c |
5394 |
-+++ b/drivers/firmware/qcom_scm.c |
5395 |
-@@ -6,7 +6,6 @@ |
5396 |
- #include <linux/init.h> |
5397 |
- #include <linux/cpumask.h> |
5398 |
- #include <linux/export.h> |
5399 |
--#include <linux/dma-direct.h> |
5400 |
- #include <linux/dma-mapping.h> |
5401 |
- #include <linux/module.h> |
5402 |
- #include <linux/types.h> |
5403 |
-@@ -806,8 +805,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
5404 |
- struct qcom_scm_mem_map_info *mem_to_map; |
5405 |
- phys_addr_t mem_to_map_phys; |
5406 |
- phys_addr_t dest_phys; |
5407 |
-- phys_addr_t ptr_phys; |
5408 |
-- dma_addr_t ptr_dma; |
5409 |
-+ dma_addr_t ptr_phys; |
5410 |
- size_t mem_to_map_sz; |
5411 |
- size_t dest_sz; |
5412 |
- size_t src_sz; |
5413 |
-@@ -824,10 +822,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
5414 |
- ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) + |
5415 |
- ALIGN(dest_sz, SZ_64); |
5416 |
- |
5417 |
-- ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_dma, GFP_KERNEL); |
5418 |
-+ ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL); |
5419 |
- if (!ptr) |
5420 |
- return -ENOMEM; |
5421 |
-- ptr_phys = dma_to_phys(__scm->dev, ptr_dma); |
5422 |
- |
5423 |
- /* Fill source vmid detail */ |
5424 |
- src = ptr; |
5425 |
-@@ -855,7 +852,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, |
5426 |
- |
5427 |
- ret = __qcom_scm_assign_mem(__scm->dev, mem_to_map_phys, mem_to_map_sz, |
5428 |
- ptr_phys, src_sz, dest_phys, dest_sz); |
5429 |
-- dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_dma); |
5430 |
-+ dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_phys); |
5431 |
- if (ret) { |
5432 |
- dev_err(__scm->dev, |
5433 |
- "Assign memory protection call failed %d\n", ret); |
5434 |
-diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c |
5435 |
-index 62f924489db5..5942343a5d6e 100644 |
5436 |
---- a/drivers/fpga/dfl-afu-dma-region.c |
5437 |
-+++ b/drivers/fpga/dfl-afu-dma-region.c |
5438 |
-@@ -61,10 +61,10 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata, |
5439 |
- region->pages); |
5440 |
- if (pinned < 0) { |
5441 |
- ret = pinned; |
5442 |
-- goto put_pages; |
5443 |
-+ goto free_pages; |
5444 |
- } else if (pinned != npages) { |
5445 |
- ret = -EFAULT; |
5446 |
-- goto free_pages; |
5447 |
-+ goto put_pages; |
5448 |
- } |
5449 |
- |
5450 |
- dev_dbg(dev, "%d pages pinned\n", pinned); |
5451 |
-diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c |
5452 |
-index 92e127e74813..ed6061b5cca1 100644 |
5453 |
---- a/drivers/gpio/gpio-dwapb.c |
5454 |
-+++ b/drivers/gpio/gpio-dwapb.c |
5455 |
-@@ -49,7 +49,9 @@ |
5456 |
- #define GPIO_EXT_PORTC 0x58 |
5457 |
- #define GPIO_EXT_PORTD 0x5c |
5458 |
- |
5459 |
-+#define DWAPB_DRIVER_NAME "gpio-dwapb" |
5460 |
- #define DWAPB_MAX_PORTS 4 |
5461 |
-+ |
5462 |
- #define GPIO_EXT_PORT_STRIDE 0x04 /* register stride 32 bits */ |
5463 |
- #define GPIO_SWPORT_DR_STRIDE 0x0c /* register stride 3*32 bits */ |
5464 |
- #define GPIO_SWPORT_DDR_STRIDE 0x0c /* register stride 3*32 bits */ |
5465 |
-@@ -398,7 +400,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, |
5466 |
- return; |
5467 |
- |
5468 |
- err = irq_alloc_domain_generic_chips(gpio->domain, ngpio, 2, |
5469 |
-- "gpio-dwapb", handle_level_irq, |
5470 |
-+ DWAPB_DRIVER_NAME, handle_level_irq, |
5471 |
- IRQ_NOREQUEST, 0, |
5472 |
- IRQ_GC_INIT_NESTED_LOCK); |
5473 |
- if (err) { |
5474 |
-@@ -455,7 +457,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, |
5475 |
- */ |
5476 |
- err = devm_request_irq(gpio->dev, pp->irq[0], |
5477 |
- dwapb_irq_handler_mfd, |
5478 |
-- IRQF_SHARED, "gpio-dwapb-mfd", gpio); |
5479 |
-+ IRQF_SHARED, DWAPB_DRIVER_NAME, gpio); |
5480 |
- if (err) { |
5481 |
- dev_err(gpio->dev, "error requesting IRQ\n"); |
5482 |
- irq_domain_remove(gpio->domain); |
5483 |
-@@ -533,26 +535,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, |
5484 |
- dwapb_configure_irqs(gpio, port, pp); |
5485 |
- |
5486 |
- err = gpiochip_add_data(&port->gc, port); |
5487 |
-- if (err) |
5488 |
-+ if (err) { |
5489 |
- dev_err(gpio->dev, "failed to register gpiochip for port%d\n", |
5490 |
- port->idx); |
5491 |
-- else |
5492 |
-- port->is_registered = true; |
5493 |
-+ return err; |
5494 |
-+ } |
5495 |
- |
5496 |
- /* Add GPIO-signaled ACPI event support */ |
5497 |
-- if (pp->has_irq) |
5498 |
-- acpi_gpiochip_request_interrupts(&port->gc); |
5499 |
-+ acpi_gpiochip_request_interrupts(&port->gc); |
5500 |
- |
5501 |
-- return err; |
5502 |
-+ port->is_registered = true; |
5503 |
-+ |
5504 |
-+ return 0; |
5505 |
- } |
5506 |
- |
5507 |
- static void dwapb_gpio_unregister(struct dwapb_gpio *gpio) |
5508 |
- { |
5509 |
- unsigned int m; |
5510 |
- |
5511 |
-- for (m = 0; m < gpio->nr_ports; ++m) |
5512 |
-- if (gpio->ports[m].is_registered) |
5513 |
-- gpiochip_remove(&gpio->ports[m].gc); |
5514 |
-+ for (m = 0; m < gpio->nr_ports; ++m) { |
5515 |
-+ struct dwapb_gpio_port *port = &gpio->ports[m]; |
5516 |
-+ |
5517 |
-+ if (!port->is_registered) |
5518 |
-+ continue; |
5519 |
-+ |
5520 |
-+ acpi_gpiochip_free_interrupts(&port->gc); |
5521 |
-+ gpiochip_remove(&port->gc); |
5522 |
-+ } |
5523 |
- } |
5524 |
- |
5525 |
- static struct dwapb_platform_data * |
5526 |
-@@ -836,7 +845,7 @@ static SIMPLE_DEV_PM_OPS(dwapb_gpio_pm_ops, dwapb_gpio_suspend, |
5527 |
- |
5528 |
- static struct platform_driver dwapb_gpio_driver = { |
5529 |
- .driver = { |
5530 |
-- .name = "gpio-dwapb", |
5531 |
-+ .name = DWAPB_DRIVER_NAME, |
5532 |
- .pm = &dwapb_gpio_pm_ops, |
5533 |
- .of_match_table = of_match_ptr(dwapb_of_match), |
5534 |
- .acpi_match_table = ACPI_PTR(dwapb_acpi_match), |
5535 |
-@@ -850,3 +859,4 @@ module_platform_driver(dwapb_gpio_driver); |
5536 |
- MODULE_LICENSE("GPL"); |
5537 |
- MODULE_AUTHOR("Jamie Iles"); |
5538 |
- MODULE_DESCRIPTION("Synopsys DesignWare APB GPIO driver"); |
5539 |
-+MODULE_ALIAS("platform:" DWAPB_DRIVER_NAME); |
5540 |
-diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c |
5541 |
-index da570e63589d..cc0dd8593a4b 100644 |
5542 |
---- a/drivers/gpio/gpio-mlxbf2.c |
5543 |
-+++ b/drivers/gpio/gpio-mlxbf2.c |
5544 |
-@@ -110,8 +110,8 @@ static int mlxbf2_gpio_get_lock_res(struct platform_device *pdev) |
5545 |
- } |
5546 |
- |
5547 |
- yu_arm_gpio_lock_param.io = devm_ioremap(dev, res->start, size); |
5548 |
-- if (IS_ERR(yu_arm_gpio_lock_param.io)) |
5549 |
-- ret = PTR_ERR(yu_arm_gpio_lock_param.io); |
5550 |
-+ if (!yu_arm_gpio_lock_param.io) |
5551 |
-+ ret = -ENOMEM; |
5552 |
- |
5553 |
- exit: |
5554 |
- mutex_unlock(yu_arm_gpio_lock_param.lock); |
5555 |
-diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c |
5556 |
-index 4269ea9a817e..01011a780688 100644 |
5557 |
---- a/drivers/gpio/gpio-pca953x.c |
5558 |
-+++ b/drivers/gpio/gpio-pca953x.c |
5559 |
-@@ -307,8 +307,22 @@ static const struct regmap_config pca953x_i2c_regmap = { |
5560 |
- .volatile_reg = pca953x_volatile_register, |
5561 |
- |
5562 |
- .cache_type = REGCACHE_RBTREE, |
5563 |
-- /* REVISIT: should be 0x7f but some 24 bit chips use REG_ADDR_AI */ |
5564 |
-- .max_register = 0xff, |
5565 |
-+ .max_register = 0x7f, |
5566 |
-+}; |
5567 |
-+ |
5568 |
-+static const struct regmap_config pca953x_ai_i2c_regmap = { |
5569 |
-+ .reg_bits = 8, |
5570 |
-+ .val_bits = 8, |
5571 |
-+ |
5572 |
-+ .read_flag_mask = REG_ADDR_AI, |
5573 |
-+ .write_flag_mask = REG_ADDR_AI, |
5574 |
-+ |
5575 |
-+ .readable_reg = pca953x_readable_register, |
5576 |
-+ .writeable_reg = pca953x_writeable_register, |
5577 |
-+ .volatile_reg = pca953x_volatile_register, |
5578 |
-+ |
5579 |
-+ .cache_type = REGCACHE_RBTREE, |
5580 |
-+ .max_register = 0x7f, |
5581 |
- }; |
5582 |
- |
5583 |
- static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, |
5584 |
-@@ -319,18 +333,6 @@ static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, |
5585 |
- int pinctrl = (reg & PCAL_PINCTRL_MASK) << 1; |
5586 |
- u8 regaddr = pinctrl | addr | (off / BANK_SZ); |
5587 |
- |
5588 |
-- /* Single byte read doesn't need AI bit set. */ |
5589 |
-- if (!addrinc) |
5590 |
-- return regaddr; |
5591 |
-- |
5592 |
-- /* Chips with 24 and more GPIOs always support Auto Increment */ |
5593 |
-- if (write && NBANK(chip) > 2) |
5594 |
-- regaddr |= REG_ADDR_AI; |
5595 |
-- |
5596 |
-- /* PCA9575 needs address-increment on multi-byte writes */ |
5597 |
-- if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) |
5598 |
-- regaddr |= REG_ADDR_AI; |
5599 |
-- |
5600 |
- return regaddr; |
5601 |
- } |
5602 |
- |
5603 |
-@@ -863,6 +865,7 @@ static int pca953x_probe(struct i2c_client *client, |
5604 |
- int ret; |
5605 |
- u32 invert = 0; |
5606 |
- struct regulator *reg; |
5607 |
-+ const struct regmap_config *regmap_config; |
5608 |
- |
5609 |
- chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
5610 |
- if (chip == NULL) |
5611 |
-@@ -925,7 +928,17 @@ static int pca953x_probe(struct i2c_client *client, |
5612 |
- |
5613 |
- i2c_set_clientdata(client, chip); |
5614 |
- |
5615 |
-- chip->regmap = devm_regmap_init_i2c(client, &pca953x_i2c_regmap); |
5616 |
-+ pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK); |
5617 |
-+ |
5618 |
-+ if (NBANK(chip) > 2 || PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) { |
5619 |
-+ dev_info(&client->dev, "using AI\n"); |
5620 |
-+ regmap_config = &pca953x_ai_i2c_regmap; |
5621 |
-+ } else { |
5622 |
-+ dev_info(&client->dev, "using no AI\n"); |
5623 |
-+ regmap_config = &pca953x_i2c_regmap; |
5624 |
-+ } |
5625 |
-+ |
5626 |
-+ chip->regmap = devm_regmap_init_i2c(client, regmap_config); |
5627 |
- if (IS_ERR(chip->regmap)) { |
5628 |
- ret = PTR_ERR(chip->regmap); |
5629 |
- goto err_exit; |
5630 |
-@@ -956,7 +969,6 @@ static int pca953x_probe(struct i2c_client *client, |
5631 |
- /* initialize cached registers from their original values. |
5632 |
- * we can't share this chip with another i2c master. |
5633 |
- */ |
5634 |
-- pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK); |
5635 |
- |
5636 |
- if (PCA_CHIP_TYPE(chip->driver_data) == PCA953X_TYPE) { |
5637 |
- chip->regs = &pca953x_regs; |
5638 |
-diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
5639 |
-index c24cad3c64ed..f7cfb8180b71 100644 |
5640 |
---- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
5641 |
-+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h |
5642 |
-@@ -40,6 +40,7 @@ |
5643 |
- #include <drm/drm_file.h> |
5644 |
- #include <drm/drm_drv.h> |
5645 |
- #include <drm/drm_device.h> |
5646 |
-+#include <drm/drm_ioctl.h> |
5647 |
- #include <kgd_kfd_interface.h> |
5648 |
- #include <linux/swap.h> |
5649 |
- |
5650 |
-@@ -1053,7 +1054,7 @@ static inline int kfd_devcgroup_check_permission(struct kfd_dev *kfd) |
5651 |
- #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF) |
5652 |
- struct drm_device *ddev = kfd->ddev; |
5653 |
- |
5654 |
-- return devcgroup_check_permission(DEVCG_DEV_CHAR, ddev->driver->major, |
5655 |
-+ return devcgroup_check_permission(DEVCG_DEV_CHAR, DRM_MAJOR, |
5656 |
- ddev->render->index, |
5657 |
- DEVCG_ACC_WRITE | DEVCG_ACC_READ); |
5658 |
- #else |
5659 |
-diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5660 |
-index 7fc15b82fe48..f9f02e08054b 100644 |
5661 |
---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5662 |
-+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
5663 |
-@@ -1334,7 +1334,7 @@ static int dm_late_init(void *handle) |
5664 |
- unsigned int linear_lut[16]; |
5665 |
- int i; |
5666 |
- struct dmcu *dmcu = adev->dm.dc->res_pool->dmcu; |
5667 |
-- bool ret = false; |
5668 |
-+ bool ret; |
5669 |
- |
5670 |
- for (i = 0; i < 16; i++) |
5671 |
- linear_lut[i] = 0xFFFF * i / 15; |
5672 |
-@@ -1350,13 +1350,10 @@ static int dm_late_init(void *handle) |
5673 |
- */ |
5674 |
- params.min_abm_backlight = 0x28F; |
5675 |
- |
5676 |
-- /* todo will enable for navi10 */ |
5677 |
-- if (adev->asic_type <= CHIP_RAVEN) { |
5678 |
-- ret = dmcu_load_iram(dmcu, params); |
5679 |
-+ ret = dmcu_load_iram(dmcu, params); |
5680 |
- |
5681 |
-- if (!ret) |
5682 |
-- return -EINVAL; |
5683 |
-- } |
5684 |
-+ if (!ret) |
5685 |
-+ return -EINVAL; |
5686 |
- |
5687 |
- return detect_mst_link_for_all_connectors(adev->ddev); |
5688 |
- } |
5689 |
-diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c |
5690 |
-index 47431ca6986d..4acaf4be8a81 100644 |
5691 |
---- a/drivers/gpu/drm/amd/display/dc/core/dc.c |
5692 |
-+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c |
5693 |
-@@ -1011,9 +1011,17 @@ static void program_timing_sync( |
5694 |
- } |
5695 |
- } |
5696 |
- |
5697 |
-- /* set first pipe with plane as master */ |
5698 |
-+ /* set first unblanked pipe as master */ |
5699 |
- for (j = 0; j < group_size; j++) { |
5700 |
-- if (pipe_set[j]->plane_state) { |
5701 |
-+ bool is_blanked; |
5702 |
-+ |
5703 |
-+ if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) |
5704 |
-+ is_blanked = |
5705 |
-+ pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); |
5706 |
-+ else |
5707 |
-+ is_blanked = |
5708 |
-+ pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); |
5709 |
-+ if (!is_blanked) { |
5710 |
- if (j == 0) |
5711 |
- break; |
5712 |
- |
5713 |
-@@ -1034,9 +1042,17 @@ static void program_timing_sync( |
5714 |
- status->timing_sync_info.master = false; |
5715 |
- |
5716 |
- } |
5717 |
-- /* remove any other pipes with plane as they have already been synced */ |
5718 |
-+ /* remove any other unblanked pipes as they have already been synced */ |
5719 |
- for (j = j + 1; j < group_size; j++) { |
5720 |
-- if (pipe_set[j]->plane_state) { |
5721 |
-+ bool is_blanked; |
5722 |
-+ |
5723 |
-+ if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) |
5724 |
-+ is_blanked = |
5725 |
-+ pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); |
5726 |
-+ else |
5727 |
-+ is_blanked = |
5728 |
-+ pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); |
5729 |
-+ if (!is_blanked) { |
5730 |
- group_size--; |
5731 |
- pipe_set[j] = pipe_set[group_size]; |
5732 |
- j--; |
5733 |
-@@ -2517,6 +2533,12 @@ void dc_commit_updates_for_stream(struct dc *dc, |
5734 |
- |
5735 |
- copy_stream_update_to_stream(dc, context, stream, stream_update); |
5736 |
- |
5737 |
-+ if (!dc->res_pool->funcs->validate_bandwidth(dc, context, false)) { |
5738 |
-+ DC_ERROR("Mode validation failed for stream update!\n"); |
5739 |
-+ dc_release_state(context); |
5740 |
-+ return; |
5741 |
-+ } |
5742 |
-+ |
5743 |
- commit_planes_for_stream( |
5744 |
- dc, |
5745 |
- srf_updates, |
5746 |
-diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5747 |
-index cac09d500fda..e89694eb90b4 100644 |
5748 |
---- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5749 |
-+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
5750 |
-@@ -843,7 +843,7 @@ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, |
5751 |
- pow_buffer_ptr = -1; // reset back to no optimize |
5752 |
- ret = true; |
5753 |
- release: |
5754 |
-- kfree(coeff); |
5755 |
-+ kvfree(coeff); |
5756 |
- return ret; |
5757 |
- } |
5758 |
- |
5759 |
-diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
5760 |
-index 868e2d5f6e62..7c3e903230ca 100644 |
5761 |
---- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
5762 |
-+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c |
5763 |
-@@ -239,7 +239,7 @@ static void ci_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) |
5764 |
- |
5765 |
- switch (dev_id) { |
5766 |
- case 0x67BA: |
5767 |
-- case 0x66B1: |
5768 |
-+ case 0x67B1: |
5769 |
- smu_data->power_tune_defaults = &defaults_hawaii_pro; |
5770 |
- break; |
5771 |
- case 0x67B8: |
5772 |
-diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c |
5773 |
-index 7a9f20a2fd30..e7ba0b6f46d8 100644 |
5774 |
---- a/drivers/gpu/drm/ast/ast_mode.c |
5775 |
-+++ b/drivers/gpu/drm/ast/ast_mode.c |
5776 |
-@@ -226,6 +226,7 @@ static void ast_set_vbios_color_reg(struct ast_private *ast, |
5777 |
- case 3: |
5778 |
- case 4: |
5779 |
- color_index = TrueCModeIndex; |
5780 |
-+ break; |
5781 |
- default: |
5782 |
- return; |
5783 |
- } |
5784 |
-@@ -801,6 +802,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, |
5785 |
- return -EINVAL; |
5786 |
- } |
5787 |
- |
5788 |
-+ if (!state->enable) |
5789 |
-+ return 0; /* no mode checks if CRTC is being disabled */ |
5790 |
-+ |
5791 |
- ast_state = to_ast_crtc_state(state); |
5792 |
- |
5793 |
- format = ast_state->format; |
5794 |
-diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c |
5795 |
-index 644f0ad10671..ac9fd96c4c66 100644 |
5796 |
---- a/drivers/gpu/drm/drm_connector.c |
5797 |
-+++ b/drivers/gpu/drm/drm_connector.c |
5798 |
-@@ -27,6 +27,7 @@ |
5799 |
- #include <drm/drm_print.h> |
5800 |
- #include <drm/drm_drv.h> |
5801 |
- #include <drm/drm_file.h> |
5802 |
-+#include <drm/drm_sysfs.h> |
5803 |
- |
5804 |
- #include <linux/uaccess.h> |
5805 |
- |
5806 |
-@@ -523,6 +524,10 @@ int drm_connector_register(struct drm_connector *connector) |
5807 |
- drm_mode_object_register(connector->dev, &connector->base); |
5808 |
- |
5809 |
- connector->registration_state = DRM_CONNECTOR_REGISTERED; |
5810 |
-+ |
5811 |
-+ /* Let userspace know we have a new connector */ |
5812 |
-+ drm_sysfs_hotplug_event(connector->dev); |
5813 |
-+ |
5814 |
- goto unlock; |
5815 |
- |
5816 |
- err_debugfs: |
5817 |
-diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
5818 |
-index 9d89ebf3a749..abb1f358ec6d 100644 |
5819 |
---- a/drivers/gpu/drm/drm_dp_mst_topology.c |
5820 |
-+++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
5821 |
-@@ -27,6 +27,7 @@ |
5822 |
- #include <linux/kernel.h> |
5823 |
- #include <linux/sched.h> |
5824 |
- #include <linux/seq_file.h> |
5825 |
-+#include <linux/iopoll.h> |
5826 |
- |
5827 |
- #if IS_ENABLED(CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS) |
5828 |
- #include <linux/stacktrace.h> |
5829 |
-@@ -4448,6 +4449,17 @@ fail: |
5830 |
- return ret; |
5831 |
- } |
5832 |
- |
5833 |
-+static int do_get_act_status(struct drm_dp_aux *aux) |
5834 |
-+{ |
5835 |
-+ int ret; |
5836 |
-+ u8 status; |
5837 |
-+ |
5838 |
-+ ret = drm_dp_dpcd_readb(aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); |
5839 |
-+ if (ret < 0) |
5840 |
-+ return ret; |
5841 |
-+ |
5842 |
-+ return status; |
5843 |
-+} |
5844 |
- |
5845 |
- /** |
5846 |
- * drm_dp_check_act_status() - Check ACT handled status. |
5847 |
-@@ -4457,33 +4469,29 @@ fail: |
5848 |
- */ |
5849 |
- int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr) |
5850 |
- { |
5851 |
-- u8 status; |
5852 |
-- int ret; |
5853 |
-- int count = 0; |
5854 |
-- |
5855 |
-- do { |
5856 |
-- ret = drm_dp_dpcd_readb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status); |
5857 |
-- |
5858 |
-- if (ret < 0) { |
5859 |
-- DRM_DEBUG_KMS("failed to read payload table status %d\n", ret); |
5860 |
-- goto fail; |
5861 |
-- } |
5862 |
-- |
5863 |
-- if (status & DP_PAYLOAD_ACT_HANDLED) |
5864 |
-- break; |
5865 |
-- count++; |
5866 |
-- udelay(100); |
5867 |
-- |
5868 |
-- } while (count < 30); |
5869 |
-- |
5870 |
-- if (!(status & DP_PAYLOAD_ACT_HANDLED)) { |
5871 |
-- DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n", status, count); |
5872 |
-- ret = -EINVAL; |
5873 |
-- goto fail; |
5874 |
-+ /* |
5875 |
-+ * There doesn't seem to be any recommended retry count or timeout in |
5876 |
-+ * the MST specification. Since some hubs have been observed to take |
5877 |
-+ * over 1 second to update their payload allocations under certain |
5878 |
-+ * conditions, we use a rather large timeout value. |
5879 |
-+ */ |
5880 |
-+ const int timeout_ms = 3000; |
5881 |
-+ int ret, status; |
5882 |
-+ |
5883 |
-+ ret = readx_poll_timeout(do_get_act_status, mgr->aux, status, |
5884 |
-+ status & DP_PAYLOAD_ACT_HANDLED || status < 0, |
5885 |
-+ 200, timeout_ms * USEC_PER_MSEC); |
5886 |
-+ if (ret < 0 && status >= 0) { |
5887 |
-+ DRM_DEBUG_KMS("Failed to get ACT after %dms, last status: %02x\n", |
5888 |
-+ timeout_ms, status); |
5889 |
-+ return -EINVAL; |
5890 |
-+ } else if (status < 0) { |
5891 |
-+ DRM_DEBUG_KMS("Failed to read payload table status: %d\n", |
5892 |
-+ status); |
5893 |
-+ return status; |
5894 |
- } |
5895 |
-+ |
5896 |
- return 0; |
5897 |
--fail: |
5898 |
-- return ret; |
5899 |
- } |
5900 |
- EXPORT_SYMBOL(drm_dp_check_act_status); |
5901 |
- |
5902 |
-diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c |
5903 |
-index cf804389f5ec..d50a7884e69e 100644 |
5904 |
---- a/drivers/gpu/drm/drm_encoder_slave.c |
5905 |
-+++ b/drivers/gpu/drm/drm_encoder_slave.c |
5906 |
-@@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, |
5907 |
- |
5908 |
- err = encoder_drv->encoder_init(client, dev, encoder); |
5909 |
- if (err) |
5910 |
-- goto fail_unregister; |
5911 |
-+ goto fail_module_put; |
5912 |
- |
5913 |
- if (info->platform_data) |
5914 |
- encoder->slave_funcs->set_config(&encoder->base, |
5915 |
-@@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev, |
5916 |
- |
5917 |
- return 0; |
5918 |
- |
5919 |
-+fail_module_put: |
5920 |
-+ module_put(module); |
5921 |
- fail_unregister: |
5922 |
- i2c_unregister_device(client); |
5923 |
-- module_put(module); |
5924 |
- fail: |
5925 |
- return err; |
5926 |
- } |
5927 |
-diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c |
5928 |
-index 939f0032aab1..f0336c804639 100644 |
5929 |
---- a/drivers/gpu/drm/drm_sysfs.c |
5930 |
-+++ b/drivers/gpu/drm/drm_sysfs.c |
5931 |
-@@ -291,9 +291,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector) |
5932 |
- return PTR_ERR(connector->kdev); |
5933 |
- } |
5934 |
- |
5935 |
-- /* Let userspace know we have a new connector */ |
5936 |
-- drm_sysfs_hotplug_event(dev); |
5937 |
-- |
5938 |
- if (connector->ddc) |
5939 |
- return sysfs_create_link(&connector->kdev->kobj, |
5940 |
- &connector->ddc->dev.kobj, "ddc"); |
5941 |
-diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c |
5942 |
-index 52db7852827b..647412da733e 100644 |
5943 |
---- a/drivers/gpu/drm/i915/display/intel_ddi.c |
5944 |
-+++ b/drivers/gpu/drm/i915/display/intel_ddi.c |
5945 |
-@@ -2866,7 +2866,7 @@ icl_program_mg_dp_mode(struct intel_digital_port *intel_dig_port, |
5946 |
- ln1 = intel_de_read(dev_priv, MG_DP_MODE(1, tc_port)); |
5947 |
- } |
5948 |
- |
5949 |
-- ln0 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X1_MODE); |
5950 |
-+ ln0 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE); |
5951 |
- ln1 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE); |
5952 |
- |
5953 |
- /* DPPATC */ |
5954 |
-diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c |
5955 |
-index a2fafd4499f2..5e228d202e4d 100644 |
5956 |
---- a/drivers/gpu/drm/i915/display/intel_dp.c |
5957 |
-+++ b/drivers/gpu/drm/i915/display/intel_dp.c |
5958 |
-@@ -1343,8 +1343,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, |
5959 |
- bool is_tc_port = intel_phy_is_tc(i915, phy); |
5960 |
- i915_reg_t ch_ctl, ch_data[5]; |
5961 |
- u32 aux_clock_divider; |
5962 |
-- enum intel_display_power_domain aux_domain = |
5963 |
-- intel_aux_power_domain(intel_dig_port); |
5964 |
-+ enum intel_display_power_domain aux_domain; |
5965 |
- intel_wakeref_t aux_wakeref; |
5966 |
- intel_wakeref_t pps_wakeref; |
5967 |
- int i, ret, recv_bytes; |
5968 |
-@@ -1359,6 +1358,8 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, |
5969 |
- if (is_tc_port) |
5970 |
- intel_tc_port_lock(intel_dig_port); |
5971 |
- |
5972 |
-+ aux_domain = intel_aux_power_domain(intel_dig_port); |
5973 |
-+ |
5974 |
- aux_wakeref = intel_display_power_get(i915, aux_domain); |
5975 |
- pps_wakeref = pps_lock(intel_dp); |
5976 |
- |
5977 |
-diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
5978 |
-index 5d5d7eef3f43..7aff3514d97a 100644 |
5979 |
---- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
5980 |
-+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c |
5981 |
-@@ -39,7 +39,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) |
5982 |
- unsigned long last_pfn = 0; /* suppress gcc warning */ |
5983 |
- unsigned int max_segment = i915_sg_segment_size(); |
5984 |
- unsigned int sg_page_sizes; |
5985 |
-- struct pagevec pvec; |
5986 |
- gfp_t noreclaim; |
5987 |
- int ret; |
5988 |
- |
5989 |
-@@ -192,13 +191,17 @@ err_sg: |
5990 |
- sg_mark_end(sg); |
5991 |
- err_pages: |
5992 |
- mapping_clear_unevictable(mapping); |
5993 |
-- pagevec_init(&pvec); |
5994 |
-- for_each_sgt_page(page, sgt_iter, st) { |
5995 |
-- if (!pagevec_add(&pvec, page)) |
5996 |
-+ if (sg != st->sgl) { |
5997 |
-+ struct pagevec pvec; |
5998 |
-+ |
5999 |
-+ pagevec_init(&pvec); |
6000 |
-+ for_each_sgt_page(page, sgt_iter, st) { |
6001 |
-+ if (!pagevec_add(&pvec, page)) |
6002 |
-+ check_release_pagevec(&pvec); |
6003 |
-+ } |
6004 |
-+ if (pagevec_count(&pvec)) |
6005 |
- check_release_pagevec(&pvec); |
6006 |
- } |
6007 |
-- if (pagevec_count(&pvec)) |
6008 |
-- check_release_pagevec(&pvec); |
6009 |
- sg_free_table(st); |
6010 |
- kfree(st); |
6011 |
- |
6012 |
-diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c |
6013 |
-index 883a9b7fe88d..55b9165e7533 100644 |
6014 |
---- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c |
6015 |
-+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c |
6016 |
-@@ -639,7 +639,7 @@ static int engine_setup_common(struct intel_engine_cs *engine) |
6017 |
- struct measure_breadcrumb { |
6018 |
- struct i915_request rq; |
6019 |
- struct intel_ring ring; |
6020 |
-- u32 cs[1024]; |
6021 |
-+ u32 cs[2048]; |
6022 |
- }; |
6023 |
- |
6024 |
- static int measure_breadcrumb_dw(struct intel_context *ce) |
6025 |
-@@ -661,6 +661,8 @@ static int measure_breadcrumb_dw(struct intel_context *ce) |
6026 |
- |
6027 |
- frame->ring.vaddr = frame->cs; |
6028 |
- frame->ring.size = sizeof(frame->cs); |
6029 |
-+ frame->ring.wrap = |
6030 |
-+ BITS_PER_TYPE(frame->ring.size) - ilog2(frame->ring.size); |
6031 |
- frame->ring.effective_size = frame->ring.size; |
6032 |
- intel_ring_update_space(&frame->ring); |
6033 |
- frame->rq.ring = &frame->ring; |
6034 |
-diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c |
6035 |
-index 2dfaddb8811e..ba82193b4e31 100644 |
6036 |
---- a/drivers/gpu/drm/i915/gt/intel_lrc.c |
6037 |
-+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c |
6038 |
-@@ -972,6 +972,13 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine) |
6039 |
- list_move(&rq->sched.link, pl); |
6040 |
- set_bit(I915_FENCE_FLAG_PQUEUE, &rq->fence.flags); |
6041 |
- |
6042 |
-+ /* Check in case we rollback so far we wrap [size/2] */ |
6043 |
-+ if (intel_ring_direction(rq->ring, |
6044 |
-+ intel_ring_wrap(rq->ring, |
6045 |
-+ rq->tail), |
6046 |
-+ rq->ring->tail) > 0) |
6047 |
-+ rq->context->lrc.desc |= CTX_DESC_FORCE_RESTORE; |
6048 |
-+ |
6049 |
- active = rq; |
6050 |
- } else { |
6051 |
- struct intel_engine_cs *owner = rq->context->engine; |
6052 |
-@@ -1383,8 +1390,9 @@ static u64 execlists_update_context(struct i915_request *rq) |
6053 |
- * HW has a tendency to ignore us rewinding the TAIL to the end of |
6054 |
- * an earlier request. |
6055 |
- */ |
6056 |
-+ GEM_BUG_ON(ce->lrc_reg_state[CTX_RING_TAIL] != rq->ring->tail); |
6057 |
-+ prev = rq->ring->tail; |
6058 |
- tail = intel_ring_set_tail(rq->ring, rq->tail); |
6059 |
-- prev = ce->lrc_reg_state[CTX_RING_TAIL]; |
6060 |
- if (unlikely(intel_ring_direction(rq->ring, tail, prev) <= 0)) |
6061 |
- desc |= CTX_DESC_FORCE_RESTORE; |
6062 |
- ce->lrc_reg_state[CTX_RING_TAIL] = tail; |
6063 |
-@@ -4213,6 +4221,14 @@ static int gen12_emit_flush_render(struct i915_request *request, |
6064 |
- return 0; |
6065 |
- } |
6066 |
- |
6067 |
-+static void assert_request_valid(struct i915_request *rq) |
6068 |
-+{ |
6069 |
-+ struct intel_ring *ring __maybe_unused = rq->ring; |
6070 |
-+ |
6071 |
-+ /* Can we unwind this request without appearing to go forwards? */ |
6072 |
-+ GEM_BUG_ON(intel_ring_direction(ring, rq->wa_tail, rq->head) <= 0); |
6073 |
-+} |
6074 |
-+ |
6075 |
- /* |
6076 |
- * Reserve space for 2 NOOPs at the end of each request to be |
6077 |
- * used as a workaround for not being allowed to do lite |
6078 |
-@@ -4225,6 +4241,9 @@ static u32 *gen8_emit_wa_tail(struct i915_request *request, u32 *cs) |
6079 |
- *cs++ = MI_NOOP; |
6080 |
- request->wa_tail = intel_ring_offset(request, cs); |
6081 |
- |
6082 |
-+ /* Check that entire request is less than half the ring */ |
6083 |
-+ assert_request_valid(request); |
6084 |
-+ |
6085 |
- return cs; |
6086 |
- } |
6087 |
- |
6088 |
-diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c |
6089 |
-index 8cda1b7e17ba..bdb324167ef3 100644 |
6090 |
---- a/drivers/gpu/drm/i915/gt/intel_ring.c |
6091 |
-+++ b/drivers/gpu/drm/i915/gt/intel_ring.c |
6092 |
-@@ -315,3 +315,7 @@ int intel_ring_cacheline_align(struct i915_request *rq) |
6093 |
- GEM_BUG_ON(rq->ring->emit & (CACHELINE_BYTES - 1)); |
6094 |
- return 0; |
6095 |
- } |
6096 |
-+ |
6097 |
-+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) |
6098 |
-+#include "selftest_ring.c" |
6099 |
-+#endif |
6100 |
-diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c |
6101 |
-index 5176ad1a3976..bb100872cd07 100644 |
6102 |
---- a/drivers/gpu/drm/i915/gt/intel_workarounds.c |
6103 |
-+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c |
6104 |
-@@ -178,6 +178,12 @@ wa_write_or(struct i915_wa_list *wal, i915_reg_t reg, u32 set) |
6105 |
- wa_write_masked_or(wal, reg, set, set); |
6106 |
- } |
6107 |
- |
6108 |
-+static void |
6109 |
-+wa_write_clr(struct i915_wa_list *wal, i915_reg_t reg, u32 clr) |
6110 |
-+{ |
6111 |
-+ wa_write_masked_or(wal, reg, clr, 0); |
6112 |
-+} |
6113 |
-+ |
6114 |
- static void |
6115 |
- wa_masked_en(struct i915_wa_list *wal, i915_reg_t reg, u32 val) |
6116 |
- { |
6117 |
-@@ -697,6 +703,227 @@ int intel_engine_emit_ctx_wa(struct i915_request *rq) |
6118 |
- return 0; |
6119 |
- } |
6120 |
- |
6121 |
-+static void |
6122 |
-+gen4_gt_workarounds_init(struct drm_i915_private *i915, |
6123 |
-+ struct i915_wa_list *wal) |
6124 |
-+{ |
6125 |
-+ /* WaDisable_RenderCache_OperationalFlush:gen4,ilk */ |
6126 |
-+ wa_masked_dis(wal, CACHE_MODE_0, RC_OP_FLUSH_ENABLE); |
6127 |
-+} |
6128 |
-+ |
6129 |
-+static void |
6130 |
-+g4x_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6131 |
-+{ |
6132 |
-+ gen4_gt_workarounds_init(i915, wal); |
6133 |
-+ |
6134 |
-+ /* WaDisableRenderCachePipelinedFlush:g4x,ilk */ |
6135 |
-+ wa_masked_en(wal, CACHE_MODE_0, CM0_PIPELINED_RENDER_FLUSH_DISABLE); |
6136 |
-+} |
6137 |
-+ |
6138 |
-+static void |
6139 |
-+ilk_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6140 |
-+{ |
6141 |
-+ g4x_gt_workarounds_init(i915, wal); |
6142 |
-+ |
6143 |
-+ wa_masked_en(wal, _3D_CHICKEN2, _3D_CHICKEN2_WM_READ_PIPELINED); |
6144 |
-+} |
6145 |
-+ |
6146 |
-+static void |
6147 |
-+snb_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6148 |
-+{ |
6149 |
-+ /* WaDisableHiZPlanesWhenMSAAEnabled:snb */ |
6150 |
-+ wa_masked_en(wal, |
6151 |
-+ _3D_CHICKEN, |
6152 |
-+ _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB); |
6153 |
-+ |
6154 |
-+ /* WaDisable_RenderCache_OperationalFlush:snb */ |
6155 |
-+ wa_masked_dis(wal, CACHE_MODE_0, RC_OP_FLUSH_ENABLE); |
6156 |
-+ |
6157 |
-+ /* |
6158 |
-+ * BSpec recommends 8x4 when MSAA is used, |
6159 |
-+ * however in practice 16x4 seems fastest. |
6160 |
-+ * |
6161 |
-+ * Note that PS/WM thread counts depend on the WIZ hashing |
6162 |
-+ * disable bit, which we don't touch here, but it's good |
6163 |
-+ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6164 |
-+ */ |
6165 |
-+ wa_add(wal, |
6166 |
-+ GEN6_GT_MODE, 0, |
6167 |
-+ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6168 |
-+ GEN6_WIZ_HASHING_16x4); |
6169 |
-+ |
6170 |
-+ wa_masked_dis(wal, CACHE_MODE_0, CM0_STC_EVICT_DISABLE_LRA_SNB); |
6171 |
-+ |
6172 |
-+ wa_masked_en(wal, |
6173 |
-+ _3D_CHICKEN3, |
6174 |
-+ /* WaStripsFansDisableFastClipPerformanceFix:snb */ |
6175 |
-+ _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL | |
6176 |
-+ /* |
6177 |
-+ * Bspec says: |
6178 |
-+ * "This bit must be set if 3DSTATE_CLIP clip mode is set |
6179 |
-+ * to normal and 3DSTATE_SF number of SF output attributes |
6180 |
-+ * is more than 16." |
6181 |
-+ */ |
6182 |
-+ _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH); |
6183 |
-+} |
6184 |
-+ |
6185 |
-+static void |
6186 |
-+ivb_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6187 |
-+{ |
6188 |
-+ /* WaDisableEarlyCull:ivb */ |
6189 |
-+ wa_masked_en(wal, _3D_CHICKEN3, _3D_CHICKEN_SF_DISABLE_OBJEND_CULL); |
6190 |
-+ |
6191 |
-+ /* WaDisablePSDDualDispatchEnable:ivb */ |
6192 |
-+ if (IS_IVB_GT1(i915)) |
6193 |
-+ wa_masked_en(wal, |
6194 |
-+ GEN7_HALF_SLICE_CHICKEN1, |
6195 |
-+ GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE); |
6196 |
-+ |
6197 |
-+ /* WaDisable_RenderCache_OperationalFlush:ivb */ |
6198 |
-+ wa_masked_dis(wal, CACHE_MODE_0_GEN7, RC_OP_FLUSH_ENABLE); |
6199 |
-+ |
6200 |
-+ /* Apply the WaDisableRHWOOptimizationForRenderHang:ivb workaround. */ |
6201 |
-+ wa_masked_dis(wal, |
6202 |
-+ GEN7_COMMON_SLICE_CHICKEN1, |
6203 |
-+ GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC); |
6204 |
-+ |
6205 |
-+ /* WaApplyL3ControlAndL3ChickenMode:ivb */ |
6206 |
-+ wa_write(wal, GEN7_L3CNTLREG1, GEN7_WA_FOR_GEN7_L3_CONTROL); |
6207 |
-+ wa_write(wal, GEN7_L3_CHICKEN_MODE_REGISTER, GEN7_WA_L3_CHICKEN_MODE); |
6208 |
-+ |
6209 |
-+ /* WaForceL3Serialization:ivb */ |
6210 |
-+ wa_write_clr(wal, GEN7_L3SQCREG4, L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6211 |
-+ |
6212 |
-+ /* |
6213 |
-+ * WaVSThreadDispatchOverride:ivb,vlv |
6214 |
-+ * |
6215 |
-+ * This actually overrides the dispatch |
6216 |
-+ * mode for all thread types. |
6217 |
-+ */ |
6218 |
-+ wa_write_masked_or(wal, GEN7_FF_THREAD_MODE, |
6219 |
-+ GEN7_FF_SCHED_MASK, |
6220 |
-+ GEN7_FF_TS_SCHED_HW | |
6221 |
-+ GEN7_FF_VS_SCHED_HW | |
6222 |
-+ GEN7_FF_DS_SCHED_HW); |
6223 |
-+ |
6224 |
-+ if (0) { /* causes HiZ corruption on ivb:gt1 */ |
6225 |
-+ /* enable HiZ Raw Stall Optimization */ |
6226 |
-+ wa_masked_dis(wal, CACHE_MODE_0_GEN7, HIZ_RAW_STALL_OPT_DISABLE); |
6227 |
-+ } |
6228 |
-+ |
6229 |
-+ /* WaDisable4x2SubspanOptimization:ivb */ |
6230 |
-+ wa_masked_en(wal, CACHE_MODE_1, PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
6231 |
-+ |
6232 |
-+ /* |
6233 |
-+ * BSpec recommends 8x4 when MSAA is used, |
6234 |
-+ * however in practice 16x4 seems fastest. |
6235 |
-+ * |
6236 |
-+ * Note that PS/WM thread counts depend on the WIZ hashing |
6237 |
-+ * disable bit, which we don't touch here, but it's good |
6238 |
-+ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6239 |
-+ */ |
6240 |
-+ wa_add(wal, GEN7_GT_MODE, 0, |
6241 |
-+ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6242 |
-+ GEN6_WIZ_HASHING_16x4); |
6243 |
-+} |
6244 |
-+ |
6245 |
-+static void |
6246 |
-+vlv_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6247 |
-+{ |
6248 |
-+ /* WaDisableEarlyCull:vlv */ |
6249 |
-+ wa_masked_en(wal, _3D_CHICKEN3, _3D_CHICKEN_SF_DISABLE_OBJEND_CULL); |
6250 |
-+ |
6251 |
-+ /* WaPsdDispatchEnable:vlv */ |
6252 |
-+ /* WaDisablePSDDualDispatchEnable:vlv */ |
6253 |
-+ wa_masked_en(wal, |
6254 |
-+ GEN7_HALF_SLICE_CHICKEN1, |
6255 |
-+ GEN7_MAX_PS_THREAD_DEP | |
6256 |
-+ GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE); |
6257 |
-+ |
6258 |
-+ /* WaDisable_RenderCache_OperationalFlush:vlv */ |
6259 |
-+ wa_masked_dis(wal, CACHE_MODE_0_GEN7, RC_OP_FLUSH_ENABLE); |
6260 |
-+ |
6261 |
-+ /* WaForceL3Serialization:vlv */ |
6262 |
-+ wa_write_clr(wal, GEN7_L3SQCREG4, L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6263 |
-+ |
6264 |
-+ /* |
6265 |
-+ * WaVSThreadDispatchOverride:ivb,vlv |
6266 |
-+ * |
6267 |
-+ * This actually overrides the dispatch |
6268 |
-+ * mode for all thread types. |
6269 |
-+ */ |
6270 |
-+ wa_write_masked_or(wal, |
6271 |
-+ GEN7_FF_THREAD_MODE, |
6272 |
-+ GEN7_FF_SCHED_MASK, |
6273 |
-+ GEN7_FF_TS_SCHED_HW | |
6274 |
-+ GEN7_FF_VS_SCHED_HW | |
6275 |
-+ GEN7_FF_DS_SCHED_HW); |
6276 |
-+ |
6277 |
-+ /* |
6278 |
-+ * BSpec says this must be set, even though |
6279 |
-+ * WaDisable4x2SubspanOptimization isn't listed for VLV. |
6280 |
-+ */ |
6281 |
-+ wa_masked_en(wal, CACHE_MODE_1, PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
6282 |
-+ |
6283 |
-+ /* |
6284 |
-+ * BSpec recommends 8x4 when MSAA is used, |
6285 |
-+ * however in practice 16x4 seems fastest. |
6286 |
-+ * |
6287 |
-+ * Note that PS/WM thread counts depend on the WIZ hashing |
6288 |
-+ * disable bit, which we don't touch here, but it's good |
6289 |
-+ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6290 |
-+ */ |
6291 |
-+ wa_add(wal, GEN7_GT_MODE, 0, |
6292 |
-+ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6293 |
-+ GEN6_WIZ_HASHING_16x4); |
6294 |
-+ |
6295 |
-+ /* |
6296 |
-+ * WaIncreaseL3CreditsForVLVB0:vlv |
6297 |
-+ * This is the hardware default actually. |
6298 |
-+ */ |
6299 |
-+ wa_write(wal, GEN7_L3SQCREG1, VLV_B0_WA_L3SQCREG1_VALUE); |
6300 |
-+} |
6301 |
-+ |
6302 |
-+static void |
6303 |
-+hsw_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6304 |
-+{ |
6305 |
-+ /* L3 caching of data atomics doesn't work -- disable it. */ |
6306 |
-+ wa_write(wal, HSW_SCRATCH1, HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE); |
6307 |
-+ |
6308 |
-+ wa_add(wal, |
6309 |
-+ HSW_ROW_CHICKEN3, 0, |
6310 |
-+ _MASKED_BIT_ENABLE(HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE), |
6311 |
-+ 0 /* XXX does this reg exist? */); |
6312 |
-+ |
6313 |
-+ /* WaVSRefCountFullforceMissDisable:hsw */ |
6314 |
-+ wa_write_clr(wal, GEN7_FF_THREAD_MODE, GEN7_FF_VS_REF_CNT_FFME); |
6315 |
-+ |
6316 |
-+ wa_masked_dis(wal, |
6317 |
-+ CACHE_MODE_0_GEN7, |
6318 |
-+ /* WaDisable_RenderCache_OperationalFlush:hsw */ |
6319 |
-+ RC_OP_FLUSH_ENABLE | |
6320 |
-+ /* enable HiZ Raw Stall Optimization */ |
6321 |
-+ HIZ_RAW_STALL_OPT_DISABLE); |
6322 |
-+ |
6323 |
-+ /* WaDisable4x2SubspanOptimization:hsw */ |
6324 |
-+ wa_masked_en(wal, CACHE_MODE_1, PIXEL_SUBSPAN_COLLECT_OPT_DISABLE); |
6325 |
-+ |
6326 |
-+ /* |
6327 |
-+ * BSpec recommends 8x4 when MSAA is used, |
6328 |
-+ * however in practice 16x4 seems fastest. |
6329 |
-+ * |
6330 |
-+ * Note that PS/WM thread counts depend on the WIZ hashing |
6331 |
-+ * disable bit, which we don't touch here, but it's good |
6332 |
-+ * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6333 |
-+ */ |
6334 |
-+ wa_add(wal, GEN7_GT_MODE, 0, |
6335 |
-+ _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4), |
6336 |
-+ GEN6_WIZ_HASHING_16x4); |
6337 |
-+ |
6338 |
-+ /* WaSampleCChickenBitEnable:hsw */ |
6339 |
-+ wa_masked_en(wal, HALF_SLICE_CHICKEN3, HSW_SAMPLE_C_PERFORMANCE); |
6340 |
-+} |
6341 |
-+ |
6342 |
- static void |
6343 |
- gen9_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6344 |
- { |
6345 |
-@@ -974,6 +1201,20 @@ gt_init_workarounds(struct drm_i915_private *i915, struct i915_wa_list *wal) |
6346 |
- bxt_gt_workarounds_init(i915, wal); |
6347 |
- else if (IS_SKYLAKE(i915)) |
6348 |
- skl_gt_workarounds_init(i915, wal); |
6349 |
-+ else if (IS_HASWELL(i915)) |
6350 |
-+ hsw_gt_workarounds_init(i915, wal); |
6351 |
-+ else if (IS_VALLEYVIEW(i915)) |
6352 |
-+ vlv_gt_workarounds_init(i915, wal); |
6353 |
-+ else if (IS_IVYBRIDGE(i915)) |
6354 |
-+ ivb_gt_workarounds_init(i915, wal); |
6355 |
-+ else if (IS_GEN(i915, 6)) |
6356 |
-+ snb_gt_workarounds_init(i915, wal); |
6357 |
-+ else if (IS_GEN(i915, 5)) |
6358 |
-+ ilk_gt_workarounds_init(i915, wal); |
6359 |
-+ else if (IS_G4X(i915)) |
6360 |
-+ g4x_gt_workarounds_init(i915, wal); |
6361 |
-+ else if (IS_GEN(i915, 4)) |
6362 |
-+ gen4_gt_workarounds_init(i915, wal); |
6363 |
- else if (INTEL_GEN(i915) <= 8) |
6364 |
- return; |
6365 |
- else |
6366 |
-@@ -1379,12 +1620,6 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) |
6367 |
- GEN7_FF_THREAD_MODE, |
6368 |
- GEN12_FF_TESSELATION_DOP_GATE_DISABLE); |
6369 |
- |
6370 |
-- /* |
6371 |
-- * Wa_1409085225:tgl |
6372 |
-- * Wa_14010229206:tgl |
6373 |
-- */ |
6374 |
-- wa_masked_en(wal, GEN9_ROW_CHICKEN4, GEN12_DISABLE_TDL_PUSH); |
6375 |
-- |
6376 |
- /* Wa_1408615072:tgl */ |
6377 |
- wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2, |
6378 |
- VSUNIT_CLKGATE_DIS_TGL); |
6379 |
-@@ -1402,6 +1637,12 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) |
6380 |
- wa_masked_en(wal, |
6381 |
- GEN9_CS_DEBUG_MODE1, |
6382 |
- FF_DOP_CLOCK_GATE_DISABLE); |
6383 |
-+ |
6384 |
-+ /* |
6385 |
-+ * Wa_1409085225:tgl |
6386 |
-+ * Wa_14010229206:tgl |
6387 |
-+ */ |
6388 |
-+ wa_masked_en(wal, GEN9_ROW_CHICKEN4, GEN12_DISABLE_TDL_PUSH); |
6389 |
- } |
6390 |
- |
6391 |
- if (IS_GEN(i915, 11)) { |
6392 |
-diff --git a/drivers/gpu/drm/i915/gt/selftest_mocs.c b/drivers/gpu/drm/i915/gt/selftest_mocs.c |
6393 |
-index 8831ffee2061..63f87d8608c3 100644 |
6394 |
---- a/drivers/gpu/drm/i915/gt/selftest_mocs.c |
6395 |
-+++ b/drivers/gpu/drm/i915/gt/selftest_mocs.c |
6396 |
-@@ -18,6 +18,20 @@ struct live_mocs { |
6397 |
- void *vaddr; |
6398 |
- }; |
6399 |
- |
6400 |
-+static struct intel_context *mocs_context_create(struct intel_engine_cs *engine) |
6401 |
-+{ |
6402 |
-+ struct intel_context *ce; |
6403 |
-+ |
6404 |
-+ ce = intel_context_create(engine); |
6405 |
-+ if (IS_ERR(ce)) |
6406 |
-+ return ce; |
6407 |
-+ |
6408 |
-+ /* We build large requests to read the registers from the ring */ |
6409 |
-+ ce->ring = __intel_context_ring_size(SZ_16K); |
6410 |
-+ |
6411 |
-+ return ce; |
6412 |
-+} |
6413 |
-+ |
6414 |
- static int request_add_sync(struct i915_request *rq, int err) |
6415 |
- { |
6416 |
- i915_request_get(rq); |
6417 |
-@@ -301,7 +315,7 @@ static int live_mocs_clean(void *arg) |
6418 |
- for_each_engine(engine, gt, id) { |
6419 |
- struct intel_context *ce; |
6420 |
- |
6421 |
-- ce = intel_context_create(engine); |
6422 |
-+ ce = mocs_context_create(engine); |
6423 |
- if (IS_ERR(ce)) { |
6424 |
- err = PTR_ERR(ce); |
6425 |
- break; |
6426 |
-@@ -395,7 +409,7 @@ static int live_mocs_reset(void *arg) |
6427 |
- for_each_engine(engine, gt, id) { |
6428 |
- struct intel_context *ce; |
6429 |
- |
6430 |
-- ce = intel_context_create(engine); |
6431 |
-+ ce = mocs_context_create(engine); |
6432 |
- if (IS_ERR(ce)) { |
6433 |
- err = PTR_ERR(ce); |
6434 |
- break; |
6435 |
-diff --git a/drivers/gpu/drm/i915/gt/selftest_ring.c b/drivers/gpu/drm/i915/gt/selftest_ring.c |
6436 |
-new file mode 100644 |
6437 |
-index 000000000000..2a8c534dc125 |
6438 |
---- /dev/null |
6439 |
-+++ b/drivers/gpu/drm/i915/gt/selftest_ring.c |
6440 |
-@@ -0,0 +1,110 @@ |
6441 |
-+// SPDX-License-Identifier: GPL-2.0 |
6442 |
-+/* |
6443 |
-+ * Copyright © 2020 Intel Corporation |
6444 |
-+ */ |
6445 |
-+ |
6446 |
-+static struct intel_ring *mock_ring(unsigned long sz) |
6447 |
-+{ |
6448 |
-+ struct intel_ring *ring; |
6449 |
-+ |
6450 |
-+ ring = kzalloc(sizeof(*ring) + sz, GFP_KERNEL); |
6451 |
-+ if (!ring) |
6452 |
-+ return NULL; |
6453 |
-+ |
6454 |
-+ kref_init(&ring->ref); |
6455 |
-+ ring->size = sz; |
6456 |
-+ ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(sz); |
6457 |
-+ ring->effective_size = sz; |
6458 |
-+ ring->vaddr = (void *)(ring + 1); |
6459 |
-+ atomic_set(&ring->pin_count, 1); |
6460 |
-+ |
6461 |
-+ intel_ring_update_space(ring); |
6462 |
-+ |
6463 |
-+ return ring; |
6464 |
-+} |
6465 |
-+ |
6466 |
-+static void mock_ring_free(struct intel_ring *ring) |
6467 |
-+{ |
6468 |
-+ kfree(ring); |
6469 |
-+} |
6470 |
-+ |
6471 |
-+static int check_ring_direction(struct intel_ring *ring, |
6472 |
-+ u32 next, u32 prev, |
6473 |
-+ int expected) |
6474 |
-+{ |
6475 |
-+ int result; |
6476 |
-+ |
6477 |
-+ result = intel_ring_direction(ring, next, prev); |
6478 |
-+ if (result < 0) |
6479 |
-+ result = -1; |
6480 |
-+ else if (result > 0) |
6481 |
-+ result = 1; |
6482 |
-+ |
6483 |
-+ if (result != expected) { |
6484 |
-+ pr_err("intel_ring_direction(%u, %u):%d != %d\n", |
6485 |
-+ next, prev, result, expected); |
6486 |
-+ return -EINVAL; |
6487 |
-+ } |
6488 |
-+ |
6489 |
-+ return 0; |
6490 |
-+} |
6491 |
-+ |
6492 |
-+static int check_ring_step(struct intel_ring *ring, u32 x, u32 step) |
6493 |
-+{ |
6494 |
-+ u32 prev = x, next = intel_ring_wrap(ring, x + step); |
6495 |
-+ int err = 0; |
6496 |
-+ |
6497 |
-+ err |= check_ring_direction(ring, next, next, 0); |
6498 |
-+ err |= check_ring_direction(ring, prev, prev, 0); |
6499 |
-+ err |= check_ring_direction(ring, next, prev, 1); |
6500 |
-+ err |= check_ring_direction(ring, prev, next, -1); |
6501 |
-+ |
6502 |
-+ return err; |
6503 |
-+} |
6504 |
-+ |
6505 |
-+static int check_ring_offset(struct intel_ring *ring, u32 x, u32 step) |
6506 |
-+{ |
6507 |
-+ int err = 0; |
6508 |
-+ |
6509 |
-+ err |= check_ring_step(ring, x, step); |
6510 |
-+ err |= check_ring_step(ring, intel_ring_wrap(ring, x + 1), step); |
6511 |
-+ err |= check_ring_step(ring, intel_ring_wrap(ring, x - 1), step); |
6512 |
-+ |
6513 |
-+ return err; |
6514 |
-+} |
6515 |
-+ |
6516 |
-+static int igt_ring_direction(void *dummy) |
6517 |
-+{ |
6518 |
-+ struct intel_ring *ring; |
6519 |
-+ unsigned int half = 2048; |
6520 |
-+ int step, err = 0; |
6521 |
-+ |
6522 |
-+ ring = mock_ring(2 * half); |
6523 |
-+ if (!ring) |
6524 |
-+ return -ENOMEM; |
6525 |
-+ |
6526 |
-+ GEM_BUG_ON(ring->size != 2 * half); |
6527 |
-+ |
6528 |
-+ /* Precision of wrap detection is limited to ring->size / 2 */ |
6529 |
-+ for (step = 1; step < half; step <<= 1) { |
6530 |
-+ err |= check_ring_offset(ring, 0, step); |
6531 |
-+ err |= check_ring_offset(ring, half, step); |
6532 |
-+ } |
6533 |
-+ err |= check_ring_step(ring, 0, half - 64); |
6534 |
-+ |
6535 |
-+ /* And check unwrapped handling for good measure */ |
6536 |
-+ err |= check_ring_offset(ring, 0, 2 * half + 64); |
6537 |
-+ err |= check_ring_offset(ring, 3 * half, 1); |
6538 |
-+ |
6539 |
-+ mock_ring_free(ring); |
6540 |
-+ return err; |
6541 |
-+} |
6542 |
-+ |
6543 |
-+int intel_ring_mock_selftests(void) |
6544 |
-+{ |
6545 |
-+ static const struct i915_subtest tests[] = { |
6546 |
-+ SUBTEST(igt_ring_direction), |
6547 |
-+ }; |
6548 |
-+ |
6549 |
-+ return i915_subtests(tests, NULL); |
6550 |
-+} |
6551 |
-diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c |
6552 |
-index 189b573d02be..372354d33f55 100644 |
6553 |
---- a/drivers/gpu/drm/i915/i915_cmd_parser.c |
6554 |
-+++ b/drivers/gpu/drm/i915/i915_cmd_parser.c |
6555 |
-@@ -572,6 +572,9 @@ struct drm_i915_reg_descriptor { |
6556 |
- #define REG32(_reg, ...) \ |
6557 |
- { .addr = (_reg), __VA_ARGS__ } |
6558 |
- |
6559 |
-+#define REG32_IDX(_reg, idx) \ |
6560 |
-+ { .addr = _reg(idx) } |
6561 |
-+ |
6562 |
- /* |
6563 |
- * Convenience macro for adding 64-bit registers. |
6564 |
- * |
6565 |
-@@ -669,6 +672,7 @@ static const struct drm_i915_reg_descriptor gen9_blt_regs[] = { |
6566 |
- REG64_IDX(RING_TIMESTAMP, BSD_RING_BASE), |
6567 |
- REG32(BCS_SWCTRL), |
6568 |
- REG64_IDX(RING_TIMESTAMP, BLT_RING_BASE), |
6569 |
-+ REG32_IDX(RING_CTX_TIMESTAMP, BLT_RING_BASE), |
6570 |
- REG64_IDX(BCS_GPR, 0), |
6571 |
- REG64_IDX(BCS_GPR, 1), |
6572 |
- REG64_IDX(BCS_GPR, 2), |
6573 |
-diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
6574 |
-index 8a2b83807ffc..bd042725a678 100644 |
6575 |
---- a/drivers/gpu/drm/i915/i915_irq.c |
6576 |
-+++ b/drivers/gpu/drm/i915/i915_irq.c |
6577 |
-@@ -3092,6 +3092,7 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv) |
6578 |
- |
6579 |
- val = I915_READ(GEN11_DE_HPD_IMR); |
6580 |
- val &= ~hotplug_irqs; |
6581 |
-+ val |= ~enabled_irqs & hotplug_irqs; |
6582 |
- I915_WRITE(GEN11_DE_HPD_IMR, val); |
6583 |
- POSTING_READ(GEN11_DE_HPD_IMR); |
6584 |
- |
6585 |
-diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
6586 |
-index 6e12000c4b6b..a41be9357d15 100644 |
6587 |
---- a/drivers/gpu/drm/i915/i915_reg.h |
6588 |
-+++ b/drivers/gpu/drm/i915/i915_reg.h |
6589 |
-@@ -7819,7 +7819,7 @@ enum { |
6590 |
- |
6591 |
- /* GEN7 chicken */ |
6592 |
- #define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010) |
6593 |
-- #define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC ((1 << 10) | (1 << 26)) |
6594 |
-+ #define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC (1 << 10) |
6595 |
- #define GEN9_RHWO_OPTIMIZATION_DISABLE (1 << 14) |
6596 |
- |
6597 |
- #define COMMON_SLICE_CHICKEN2 _MMIO(0x7014) |
6598 |
-diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
6599 |
-index a52986a9e7a6..20c1683fda24 100644 |
6600 |
---- a/drivers/gpu/drm/i915/intel_pm.c |
6601 |
-+++ b/drivers/gpu/drm/i915/intel_pm.c |
6602 |
-@@ -6593,16 +6593,6 @@ static void ilk_init_clock_gating(struct drm_i915_private *dev_priv) |
6603 |
- I915_WRITE(ILK_DISPLAY_CHICKEN2, |
6604 |
- I915_READ(ILK_DISPLAY_CHICKEN2) | |
6605 |
- ILK_ELPIN_409_SELECT); |
6606 |
-- I915_WRITE(_3D_CHICKEN2, |
6607 |
-- _3D_CHICKEN2_WM_READ_PIPELINED << 16 | |
6608 |
-- _3D_CHICKEN2_WM_READ_PIPELINED); |
6609 |
-- |
6610 |
-- /* WaDisableRenderCachePipelinedFlush:ilk */ |
6611 |
-- I915_WRITE(CACHE_MODE_0, |
6612 |
-- _MASKED_BIT_ENABLE(CM0_PIPELINED_RENDER_FLUSH_DISABLE)); |
6613 |
-- |
6614 |
-- /* WaDisable_RenderCache_OperationalFlush:ilk */ |
6615 |
-- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6616 |
- |
6617 |
- g4x_disable_trickle_feed(dev_priv); |
6618 |
- |
6619 |
-@@ -6665,27 +6655,6 @@ static void gen6_init_clock_gating(struct drm_i915_private *dev_priv) |
6620 |
- I915_READ(ILK_DISPLAY_CHICKEN2) | |
6621 |
- ILK_ELPIN_409_SELECT); |
6622 |
- |
6623 |
-- /* WaDisableHiZPlanesWhenMSAAEnabled:snb */ |
6624 |
-- I915_WRITE(_3D_CHICKEN, |
6625 |
-- _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); |
6626 |
-- |
6627 |
-- /* WaDisable_RenderCache_OperationalFlush:snb */ |
6628 |
-- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6629 |
-- |
6630 |
-- /* |
6631 |
-- * BSpec recoomends 8x4 when MSAA is used, |
6632 |
-- * however in practice 16x4 seems fastest. |
6633 |
-- * |
6634 |
-- * Note that PS/WM thread counts depend on the WIZ hashing |
6635 |
-- * disable bit, which we don't touch here, but it's good |
6636 |
-- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6637 |
-- */ |
6638 |
-- I915_WRITE(GEN6_GT_MODE, |
6639 |
-- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6640 |
-- |
6641 |
-- I915_WRITE(CACHE_MODE_0, |
6642 |
-- _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB)); |
6643 |
-- |
6644 |
- I915_WRITE(GEN6_UCGCTL1, |
6645 |
- I915_READ(GEN6_UCGCTL1) | |
6646 |
- GEN6_BLBUNIT_CLOCK_GATE_DISABLE | |
6647 |
-@@ -6708,18 +6677,6 @@ static void gen6_init_clock_gating(struct drm_i915_private *dev_priv) |
6648 |
- GEN6_RCPBUNIT_CLOCK_GATE_DISABLE | |
6649 |
- GEN6_RCCUNIT_CLOCK_GATE_DISABLE); |
6650 |
- |
6651 |
-- /* WaStripsFansDisableFastClipPerformanceFix:snb */ |
6652 |
-- I915_WRITE(_3D_CHICKEN3, |
6653 |
-- _MASKED_BIT_ENABLE(_3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL)); |
6654 |
-- |
6655 |
-- /* |
6656 |
-- * Bspec says: |
6657 |
-- * "This bit must be set if 3DSTATE_CLIP clip mode is set to normal and |
6658 |
-- * 3DSTATE_SF number of SF output attributes is more than 16." |
6659 |
-- */ |
6660 |
-- I915_WRITE(_3D_CHICKEN3, |
6661 |
-- _MASKED_BIT_ENABLE(_3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH)); |
6662 |
-- |
6663 |
- /* |
6664 |
- * According to the spec the following bits should be |
6665 |
- * set in order to enable memory self-refresh and fbc: |
6666 |
-@@ -6749,24 +6706,6 @@ static void gen6_init_clock_gating(struct drm_i915_private *dev_priv) |
6667 |
- gen6_check_mch_setup(dev_priv); |
6668 |
- } |
6669 |
- |
6670 |
--static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv) |
6671 |
--{ |
6672 |
-- u32 reg = I915_READ(GEN7_FF_THREAD_MODE); |
6673 |
-- |
6674 |
-- /* |
6675 |
-- * WaVSThreadDispatchOverride:ivb,vlv |
6676 |
-- * |
6677 |
-- * This actually overrides the dispatch |
6678 |
-- * mode for all thread types. |
6679 |
-- */ |
6680 |
-- reg &= ~GEN7_FF_SCHED_MASK; |
6681 |
-- reg |= GEN7_FF_TS_SCHED_HW; |
6682 |
-- reg |= GEN7_FF_VS_SCHED_HW; |
6683 |
-- reg |= GEN7_FF_DS_SCHED_HW; |
6684 |
-- |
6685 |
-- I915_WRITE(GEN7_FF_THREAD_MODE, reg); |
6686 |
--} |
6687 |
-- |
6688 |
- static void lpt_init_clock_gating(struct drm_i915_private *dev_priv) |
6689 |
- { |
6690 |
- /* |
6691 |
-@@ -6992,45 +6931,10 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) |
6692 |
- |
6693 |
- static void hsw_init_clock_gating(struct drm_i915_private *dev_priv) |
6694 |
- { |
6695 |
-- /* L3 caching of data atomics doesn't work -- disable it. */ |
6696 |
-- I915_WRITE(HSW_SCRATCH1, HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE); |
6697 |
-- I915_WRITE(HSW_ROW_CHICKEN3, |
6698 |
-- _MASKED_BIT_ENABLE(HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE)); |
6699 |
-- |
6700 |
- /* This is required by WaCatErrorRejectionIssue:hsw */ |
6701 |
- I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, |
6702 |
-- I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
6703 |
-- GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); |
6704 |
-- |
6705 |
-- /* WaVSRefCountFullforceMissDisable:hsw */ |
6706 |
-- I915_WRITE(GEN7_FF_THREAD_MODE, |
6707 |
-- I915_READ(GEN7_FF_THREAD_MODE) & ~GEN7_FF_VS_REF_CNT_FFME); |
6708 |
-- |
6709 |
-- /* WaDisable_RenderCache_OperationalFlush:hsw */ |
6710 |
-- I915_WRITE(CACHE_MODE_0_GEN7, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6711 |
-- |
6712 |
-- /* enable HiZ Raw Stall Optimization */ |
6713 |
-- I915_WRITE(CACHE_MODE_0_GEN7, |
6714 |
-- _MASKED_BIT_DISABLE(HIZ_RAW_STALL_OPT_DISABLE)); |
6715 |
-- |
6716 |
-- /* WaDisable4x2SubspanOptimization:hsw */ |
6717 |
-- I915_WRITE(CACHE_MODE_1, |
6718 |
-- _MASKED_BIT_ENABLE(PIXEL_SUBSPAN_COLLECT_OPT_DISABLE)); |
6719 |
-- |
6720 |
-- /* |
6721 |
-- * BSpec recommends 8x4 when MSAA is used, |
6722 |
-- * however in practice 16x4 seems fastest. |
6723 |
-- * |
6724 |
-- * Note that PS/WM thread counts depend on the WIZ hashing |
6725 |
-- * disable bit, which we don't touch here, but it's good |
6726 |
-- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6727 |
-- */ |
6728 |
-- I915_WRITE(GEN7_GT_MODE, |
6729 |
-- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6730 |
-- |
6731 |
-- /* WaSampleCChickenBitEnable:hsw */ |
6732 |
-- I915_WRITE(HALF_SLICE_CHICKEN3, |
6733 |
-- _MASKED_BIT_ENABLE(HSW_SAMPLE_C_PERFORMANCE)); |
6734 |
-+ I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
6735 |
-+ GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); |
6736 |
- |
6737 |
- /* WaSwitchSolVfFArbitrationPriority:hsw */ |
6738 |
- I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL); |
6739 |
-@@ -7044,32 +6948,11 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6740 |
- |
6741 |
- I915_WRITE(ILK_DSPCLK_GATE_D, ILK_VRHUNIT_CLOCK_GATE_DISABLE); |
6742 |
- |
6743 |
-- /* WaDisableEarlyCull:ivb */ |
6744 |
-- I915_WRITE(_3D_CHICKEN3, |
6745 |
-- _MASKED_BIT_ENABLE(_3D_CHICKEN_SF_DISABLE_OBJEND_CULL)); |
6746 |
-- |
6747 |
- /* WaDisableBackToBackFlipFix:ivb */ |
6748 |
- I915_WRITE(IVB_CHICKEN3, |
6749 |
- CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
6750 |
- CHICKEN3_DGMG_DONE_FIX_DISABLE); |
6751 |
- |
6752 |
-- /* WaDisablePSDDualDispatchEnable:ivb */ |
6753 |
-- if (IS_IVB_GT1(dev_priv)) |
6754 |
-- I915_WRITE(GEN7_HALF_SLICE_CHICKEN1, |
6755 |
-- _MASKED_BIT_ENABLE(GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE)); |
6756 |
-- |
6757 |
-- /* WaDisable_RenderCache_OperationalFlush:ivb */ |
6758 |
-- I915_WRITE(CACHE_MODE_0_GEN7, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6759 |
-- |
6760 |
-- /* Apply the WaDisableRHWOOptimizationForRenderHang:ivb workaround. */ |
6761 |
-- I915_WRITE(GEN7_COMMON_SLICE_CHICKEN1, |
6762 |
-- GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC); |
6763 |
-- |
6764 |
-- /* WaApplyL3ControlAndL3ChickenMode:ivb */ |
6765 |
-- I915_WRITE(GEN7_L3CNTLREG1, |
6766 |
-- GEN7_WA_FOR_GEN7_L3_CONTROL); |
6767 |
-- I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, |
6768 |
-- GEN7_WA_L3_CHICKEN_MODE); |
6769 |
- if (IS_IVB_GT1(dev_priv)) |
6770 |
- I915_WRITE(GEN7_ROW_CHICKEN2, |
6771 |
- _MASKED_BIT_ENABLE(DOP_CLOCK_GATING_DISABLE)); |
6772 |
-@@ -7081,10 +6964,6 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6773 |
- _MASKED_BIT_ENABLE(DOP_CLOCK_GATING_DISABLE)); |
6774 |
- } |
6775 |
- |
6776 |
-- /* WaForceL3Serialization:ivb */ |
6777 |
-- I915_WRITE(GEN7_L3SQCREG4, I915_READ(GEN7_L3SQCREG4) & |
6778 |
-- ~L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6779 |
-- |
6780 |
- /* |
6781 |
- * According to the spec, bit 13 (RCZUNIT) must be set on IVB. |
6782 |
- * This implements the WaDisableRCZUnitClockGating:ivb workaround. |
6783 |
-@@ -7099,29 +6978,6 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6784 |
- |
6785 |
- g4x_disable_trickle_feed(dev_priv); |
6786 |
- |
6787 |
-- gen7_setup_fixed_func_scheduler(dev_priv); |
6788 |
-- |
6789 |
-- if (0) { /* causes HiZ corruption on ivb:gt1 */ |
6790 |
-- /* enable HiZ Raw Stall Optimization */ |
6791 |
-- I915_WRITE(CACHE_MODE_0_GEN7, |
6792 |
-- _MASKED_BIT_DISABLE(HIZ_RAW_STALL_OPT_DISABLE)); |
6793 |
-- } |
6794 |
-- |
6795 |
-- /* WaDisable4x2SubspanOptimization:ivb */ |
6796 |
-- I915_WRITE(CACHE_MODE_1, |
6797 |
-- _MASKED_BIT_ENABLE(PIXEL_SUBSPAN_COLLECT_OPT_DISABLE)); |
6798 |
-- |
6799 |
-- /* |
6800 |
-- * BSpec recommends 8x4 when MSAA is used, |
6801 |
-- * however in practice 16x4 seems fastest. |
6802 |
-- * |
6803 |
-- * Note that PS/WM thread counts depend on the WIZ hashing |
6804 |
-- * disable bit, which we don't touch here, but it's good |
6805 |
-- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6806 |
-- */ |
6807 |
-- I915_WRITE(GEN7_GT_MODE, |
6808 |
-- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6809 |
-- |
6810 |
- snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); |
6811 |
- snpcr &= ~GEN6_MBC_SNPCR_MASK; |
6812 |
- snpcr |= GEN6_MBC_SNPCR_MED; |
6813 |
-@@ -7135,28 +6991,11 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) |
6814 |
- |
6815 |
- static void vlv_init_clock_gating(struct drm_i915_private *dev_priv) |
6816 |
- { |
6817 |
-- /* WaDisableEarlyCull:vlv */ |
6818 |
-- I915_WRITE(_3D_CHICKEN3, |
6819 |
-- _MASKED_BIT_ENABLE(_3D_CHICKEN_SF_DISABLE_OBJEND_CULL)); |
6820 |
-- |
6821 |
- /* WaDisableBackToBackFlipFix:vlv */ |
6822 |
- I915_WRITE(IVB_CHICKEN3, |
6823 |
- CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
6824 |
- CHICKEN3_DGMG_DONE_FIX_DISABLE); |
6825 |
- |
6826 |
-- /* WaPsdDispatchEnable:vlv */ |
6827 |
-- /* WaDisablePSDDualDispatchEnable:vlv */ |
6828 |
-- I915_WRITE(GEN7_HALF_SLICE_CHICKEN1, |
6829 |
-- _MASKED_BIT_ENABLE(GEN7_MAX_PS_THREAD_DEP | |
6830 |
-- GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE)); |
6831 |
-- |
6832 |
-- /* WaDisable_RenderCache_OperationalFlush:vlv */ |
6833 |
-- I915_WRITE(CACHE_MODE_0_GEN7, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6834 |
-- |
6835 |
-- /* WaForceL3Serialization:vlv */ |
6836 |
-- I915_WRITE(GEN7_L3SQCREG4, I915_READ(GEN7_L3SQCREG4) & |
6837 |
-- ~L3SQ_URB_READ_CAM_MATCH_DISABLE); |
6838 |
-- |
6839 |
- /* WaDisableDopClockGating:vlv */ |
6840 |
- I915_WRITE(GEN7_ROW_CHICKEN2, |
6841 |
- _MASKED_BIT_ENABLE(DOP_CLOCK_GATING_DISABLE)); |
6842 |
-@@ -7166,8 +7005,6 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv) |
6843 |
- I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
6844 |
- GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); |
6845 |
- |
6846 |
-- gen7_setup_fixed_func_scheduler(dev_priv); |
6847 |
-- |
6848 |
- /* |
6849 |
- * According to the spec, bit 13 (RCZUNIT) must be set on IVB. |
6850 |
- * This implements the WaDisableRCZUnitClockGating:vlv workaround. |
6851 |
-@@ -7181,30 +7018,6 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv) |
6852 |
- I915_WRITE(GEN7_UCGCTL4, |
6853 |
- I915_READ(GEN7_UCGCTL4) | GEN7_L3BANK2X_CLOCK_GATE_DISABLE); |
6854 |
- |
6855 |
-- /* |
6856 |
-- * BSpec says this must be set, even though |
6857 |
-- * WaDisable4x2SubspanOptimization isn't listed for VLV. |
6858 |
-- */ |
6859 |
-- I915_WRITE(CACHE_MODE_1, |
6860 |
-- _MASKED_BIT_ENABLE(PIXEL_SUBSPAN_COLLECT_OPT_DISABLE)); |
6861 |
-- |
6862 |
-- /* |
6863 |
-- * BSpec recommends 8x4 when MSAA is used, |
6864 |
-- * however in practice 16x4 seems fastest. |
6865 |
-- * |
6866 |
-- * Note that PS/WM thread counts depend on the WIZ hashing |
6867 |
-- * disable bit, which we don't touch here, but it's good |
6868 |
-- * to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). |
6869 |
-- */ |
6870 |
-- I915_WRITE(GEN7_GT_MODE, |
6871 |
-- _MASKED_FIELD(GEN6_WIZ_HASHING_MASK, GEN6_WIZ_HASHING_16x4)); |
6872 |
-- |
6873 |
-- /* |
6874 |
-- * WaIncreaseL3CreditsForVLVB0:vlv |
6875 |
-- * This is the hardware default actually. |
6876 |
-- */ |
6877 |
-- I915_WRITE(GEN7_L3SQCREG1, VLV_B0_WA_L3SQCREG1_VALUE); |
6878 |
-- |
6879 |
- /* |
6880 |
- * WaDisableVLVClockGating_VBIIssue:vlv |
6881 |
- * Disable clock gating on th GCFG unit to prevent a delay |
6882 |
-@@ -7257,13 +7070,6 @@ static void g4x_init_clock_gating(struct drm_i915_private *dev_priv) |
6883 |
- dspclk_gate |= DSSUNIT_CLOCK_GATE_DISABLE; |
6884 |
- I915_WRITE(DSPCLK_GATE_D, dspclk_gate); |
6885 |
- |
6886 |
-- /* WaDisableRenderCachePipelinedFlush */ |
6887 |
-- I915_WRITE(CACHE_MODE_0, |
6888 |
-- _MASKED_BIT_ENABLE(CM0_PIPELINED_RENDER_FLUSH_DISABLE)); |
6889 |
-- |
6890 |
-- /* WaDisable_RenderCache_OperationalFlush:g4x */ |
6891 |
-- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6892 |
-- |
6893 |
- g4x_disable_trickle_feed(dev_priv); |
6894 |
- } |
6895 |
- |
6896 |
-@@ -7279,11 +7085,6 @@ static void i965gm_init_clock_gating(struct drm_i915_private *dev_priv) |
6897 |
- intel_uncore_write(uncore, |
6898 |
- MI_ARB_STATE, |
6899 |
- _MASKED_BIT_ENABLE(MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE)); |
6900 |
-- |
6901 |
-- /* WaDisable_RenderCache_OperationalFlush:gen4 */ |
6902 |
-- intel_uncore_write(uncore, |
6903 |
-- CACHE_MODE_0, |
6904 |
-- _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6905 |
- } |
6906 |
- |
6907 |
- static void i965g_init_clock_gating(struct drm_i915_private *dev_priv) |
6908 |
-@@ -7296,9 +7097,6 @@ static void i965g_init_clock_gating(struct drm_i915_private *dev_priv) |
6909 |
- I915_WRITE(RENCLK_GATE_D2, 0); |
6910 |
- I915_WRITE(MI_ARB_STATE, |
6911 |
- _MASKED_BIT_ENABLE(MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE)); |
6912 |
-- |
6913 |
-- /* WaDisable_RenderCache_OperationalFlush:gen4 */ |
6914 |
-- I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6915 |
- } |
6916 |
- |
6917 |
- static void gen3_init_clock_gating(struct drm_i915_private *dev_priv) |
6918 |
-diff --git a/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h b/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h |
6919 |
-index 5b39bab4da1d..86baed226b53 100644 |
6920 |
---- a/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h |
6921 |
-+++ b/drivers/gpu/drm/i915/selftests/i915_mock_selftests.h |
6922 |
-@@ -20,6 +20,7 @@ selftest(fence, i915_sw_fence_mock_selftests) |
6923 |
- selftest(scatterlist, scatterlist_mock_selftests) |
6924 |
- selftest(syncmap, i915_syncmap_mock_selftests) |
6925 |
- selftest(uncore, intel_uncore_mock_selftests) |
6926 |
-+selftest(ring, intel_ring_mock_selftests) |
6927 |
- selftest(engine, intel_engine_cs_mock_selftests) |
6928 |
- selftest(timelines, intel_timeline_mock_selftests) |
6929 |
- selftest(requests, i915_request_mock_selftests) |
6930 |
-diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6931 |
-index 724024a2243a..662d02289533 100644 |
6932 |
---- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6933 |
-+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
6934 |
-@@ -1404,6 +1404,10 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) |
6935 |
- { |
6936 |
- u64 busy_cycles, busy_time; |
6937 |
- |
6938 |
-+ /* Only read the gpu busy if the hardware is already active */ |
6939 |
-+ if (pm_runtime_get_if_in_use(&gpu->pdev->dev) == 0) |
6940 |
-+ return 0; |
6941 |
-+ |
6942 |
- busy_cycles = gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_0_LO, |
6943 |
- REG_A5XX_RBBM_PERFCTR_RBBM_0_HI); |
6944 |
- |
6945 |
-@@ -1412,6 +1416,8 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) |
6946 |
- |
6947 |
- gpu->devfreq.busy_cycles = busy_cycles; |
6948 |
- |
6949 |
-+ pm_runtime_put(&gpu->pdev->dev); |
6950 |
-+ |
6951 |
- if (WARN_ON(busy_time > ~0LU)) |
6952 |
- return ~0LU; |
6953 |
- |
6954 |
-diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6955 |
-index c4e71abbdd53..34607a98cc7c 100644 |
6956 |
---- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6957 |
-+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c |
6958 |
-@@ -108,6 +108,13 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) |
6959 |
- struct msm_gpu *gpu = &adreno_gpu->base; |
6960 |
- int ret; |
6961 |
- |
6962 |
-+ /* |
6963 |
-+ * This can get called from devfreq while the hardware is idle. Don't |
6964 |
-+ * bring up the power if it isn't already active |
6965 |
-+ */ |
6966 |
-+ if (pm_runtime_get_if_in_use(gmu->dev) == 0) |
6967 |
-+ return; |
6968 |
-+ |
6969 |
- gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0); |
6970 |
- |
6971 |
- gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING, |
6972 |
-@@ -134,6 +141,7 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) |
6973 |
- * for now leave it at max so that the performance is nominal. |
6974 |
- */ |
6975 |
- icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216)); |
6976 |
-+ pm_runtime_put(gmu->dev); |
6977 |
- } |
6978 |
- |
6979 |
- void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq) |
6980 |
-diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6981 |
-index 68af24150de5..2c09d2c21773 100644 |
6982 |
---- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6983 |
-+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c |
6984 |
-@@ -810,6 +810,11 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) |
6985 |
- struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); |
6986 |
- u64 busy_cycles, busy_time; |
6987 |
- |
6988 |
-+ |
6989 |
-+ /* Only read the gpu busy if the hardware is already active */ |
6990 |
-+ if (pm_runtime_get_if_in_use(a6xx_gpu->gmu.dev) == 0) |
6991 |
-+ return 0; |
6992 |
-+ |
6993 |
- busy_cycles = gmu_read64(&a6xx_gpu->gmu, |
6994 |
- REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L, |
6995 |
- REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H); |
6996 |
-@@ -819,6 +824,8 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) |
6997 |
- |
6998 |
- gpu->devfreq.busy_cycles = busy_cycles; |
6999 |
- |
7000 |
-+ pm_runtime_put(a6xx_gpu->gmu.dev); |
7001 |
-+ |
7002 |
- if (WARN_ON(busy_time > ~0LU)) |
7003 |
- return ~0LU; |
7004 |
- |
7005 |
-diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
7006 |
-index 47b989834af1..c23a2fa13fb9 100644 |
7007 |
---- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
7008 |
-+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |
7009 |
-@@ -943,7 +943,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) |
7010 |
- |
7011 |
- return 0; |
7012 |
- fail: |
7013 |
-- mdp5_destroy(pdev); |
7014 |
-+ if (mdp5_kms) |
7015 |
-+ mdp5_destroy(pdev); |
7016 |
- return ret; |
7017 |
- } |
7018 |
- |
7019 |
-diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c |
7020 |
-index 732f65df5c4f..fea30e7aa9e8 100644 |
7021 |
---- a/drivers/gpu/drm/msm/msm_rd.c |
7022 |
-+++ b/drivers/gpu/drm/msm/msm_rd.c |
7023 |
-@@ -29,8 +29,6 @@ |
7024 |
- * or shader programs (if not emitted inline in cmdstream). |
7025 |
- */ |
7026 |
- |
7027 |
--#ifdef CONFIG_DEBUG_FS |
7028 |
-- |
7029 |
- #include <linux/circ_buf.h> |
7030 |
- #include <linux/debugfs.h> |
7031 |
- #include <linux/kfifo.h> |
7032 |
-@@ -47,6 +45,8 @@ bool rd_full = false; |
7033 |
- MODULE_PARM_DESC(rd_full, "If true, $debugfs/.../rd will snapshot all buffer contents"); |
7034 |
- module_param_named(rd_full, rd_full, bool, 0600); |
7035 |
- |
7036 |
-+#ifdef CONFIG_DEBUG_FS |
7037 |
-+ |
7038 |
- enum rd_sect_type { |
7039 |
- RD_NONE, |
7040 |
- RD_TEST, /* ascii text */ |
7041 |
-diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
7042 |
-index 6be9df1820c5..2625ed84fc44 100644 |
7043 |
---- a/drivers/gpu/drm/nouveau/dispnv50/disp.c |
7044 |
-+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
7045 |
-@@ -482,15 +482,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe) |
7046 |
- * audio component binding for ELD notification |
7047 |
- */ |
7048 |
- static void |
7049 |
--nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port) |
7050 |
-+nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port, |
7051 |
-+ int dev_id) |
7052 |
- { |
7053 |
- if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) |
7054 |
- acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, |
7055 |
-- port, -1); |
7056 |
-+ port, dev_id); |
7057 |
- } |
7058 |
- |
7059 |
- static int |
7060 |
--nv50_audio_component_get_eld(struct device *kdev, int port, int pipe, |
7061 |
-+nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id, |
7062 |
- bool *enabled, unsigned char *buf, int max_bytes) |
7063 |
- { |
7064 |
- struct drm_device *drm_dev = dev_get_drvdata(kdev); |
7065 |
-@@ -506,7 +507,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe, |
7066 |
- nv_encoder = nouveau_encoder(encoder); |
7067 |
- nv_connector = nouveau_encoder_connector_get(nv_encoder); |
7068 |
- nv_crtc = nouveau_crtc(encoder->crtc); |
7069 |
-- if (!nv_connector || !nv_crtc || nv_crtc->index != port) |
7070 |
-+ if (!nv_connector || !nv_crtc || nv_encoder->or != port || |
7071 |
-+ nv_crtc->index != dev_id) |
7072 |
- continue; |
7073 |
- *enabled = drm_detect_monitor_audio(nv_connector->edid); |
7074 |
- if (*enabled) { |
7075 |
-@@ -600,7 +602,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc) |
7076 |
- |
7077 |
- nvif_mthd(&disp->disp->object, 0, &args, sizeof(args)); |
7078 |
- |
7079 |
-- nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index); |
7080 |
-+ nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or, |
7081 |
-+ nv_crtc->index); |
7082 |
- } |
7083 |
- |
7084 |
- static void |
7085 |
-@@ -634,7 +637,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) |
7086 |
- nvif_mthd(&disp->disp->object, 0, &args, |
7087 |
- sizeof(args.base) + drm_eld_size(args.data)); |
7088 |
- |
7089 |
-- nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index); |
7090 |
-+ nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or, |
7091 |
-+ nv_crtc->index); |
7092 |
- } |
7093 |
- |
7094 |
- /****************************************************************************** |
7095 |
-diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
7096 |
-index 9b16a08eb4d9..bf6d41fb0c9f 100644 |
7097 |
---- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
7098 |
-+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c |
7099 |
-@@ -27,10 +27,10 @@ void |
7100 |
- gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc) |
7101 |
- { |
7102 |
- struct nvkm_device *device = ior->disp->engine.subdev.device; |
7103 |
-- const u32 hoff = head * 0x800; |
7104 |
-+ const u32 soff = nv50_ior_base(ior); |
7105 |
- const u32 ctrl = scdc & 0x3; |
7106 |
- |
7107 |
-- nvkm_mask(device, 0x61c5bc + hoff, 0x00000003, ctrl); |
7108 |
-+ nvkm_mask(device, 0x61c5bc + soff, 0x00000003, ctrl); |
7109 |
- |
7110 |
- ior->tmds.high_speed = !!(scdc & 0x2); |
7111 |
- } |
7112 |
-diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c |
7113 |
-index 4209b24a46d7..bf6b65257852 100644 |
7114 |
---- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c |
7115 |
-+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c |
7116 |
-@@ -341,7 +341,7 @@ gk20a_gr_load(struct gf100_gr *gr, int ver, const struct gf100_gr_fwif *fwif) |
7117 |
- |
7118 |
- static const struct gf100_gr_fwif |
7119 |
- gk20a_gr_fwif[] = { |
7120 |
-- { -1, gk20a_gr_load, &gk20a_gr }, |
7121 |
-+ { 0, gk20a_gr_load, &gk20a_gr }, |
7122 |
- {} |
7123 |
- }; |
7124 |
- |
7125 |
-diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c |
7126 |
-index 70b20ee4741a..41ef6a9ca8cc 100644 |
7127 |
---- a/drivers/gpu/drm/qxl/qxl_kms.c |
7128 |
-+++ b/drivers/gpu/drm/qxl/qxl_kms.c |
7129 |
-@@ -218,7 +218,7 @@ int qxl_device_init(struct qxl_device *qdev, |
7130 |
- &(qdev->ram_header->cursor_ring_hdr), |
7131 |
- sizeof(struct qxl_command), |
7132 |
- QXL_CURSOR_RING_SIZE, |
7133 |
-- qdev->io_base + QXL_IO_NOTIFY_CMD, |
7134 |
-+ qdev->io_base + QXL_IO_NOTIFY_CURSOR, |
7135 |
- false, |
7136 |
- &qdev->cursor_event); |
7137 |
- |
7138 |
-diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
7139 |
-index 7ad3f06c127e..00ca35f07ba5 100644 |
7140 |
---- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
7141 |
-+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h |
7142 |
-@@ -148,7 +148,7 @@ |
7143 |
- #define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE 3 |
7144 |
- |
7145 |
- #define SUN4I_HDMI_DDC_CLK_REG 0x528 |
7146 |
--#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0x7) << 3) |
7147 |
-+#define SUN4I_HDMI_DDC_CLK_M(m) (((m) & 0xf) << 3) |
7148 |
- #define SUN4I_HDMI_DDC_CLK_N(n) ((n) & 0x7) |
7149 |
- |
7150 |
- #define SUN4I_HDMI_DDC_LINE_CTRL_REG 0x540 |
7151 |
-diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
7152 |
-index 2ff780114106..12430b9d4e93 100644 |
7153 |
---- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
7154 |
-+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c |
7155 |
-@@ -33,7 +33,7 @@ static unsigned long sun4i_ddc_calc_divider(unsigned long rate, |
7156 |
- unsigned long best_rate = 0; |
7157 |
- u8 best_m = 0, best_n = 0, _m, _n; |
7158 |
- |
7159 |
-- for (_m = 0; _m < 8; _m++) { |
7160 |
-+ for (_m = 0; _m < 16; _m++) { |
7161 |
- for (_n = 0; _n < 8; _n++) { |
7162 |
- unsigned long tmp_rate; |
7163 |
- |
7164 |
-diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
7165 |
-index 1c71a1aa76b2..f03f1cc913ce 100644 |
7166 |
---- a/drivers/hid/hid-ids.h |
7167 |
-+++ b/drivers/hid/hid-ids.h |
7168 |
-@@ -1157,6 +1157,9 @@ |
7169 |
- #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882 |
7170 |
- #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 |
7171 |
- |
7172 |
-+#define USB_VENDOR_ID_TRUST 0x145f |
7173 |
-+#define USB_DEVICE_ID_TRUST_PANORA_TABLET 0x0212 |
7174 |
-+ |
7175 |
- #define USB_VENDOR_ID_TURBOX 0x062a |
7176 |
- #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 |
7177 |
- #define USB_DEVICE_ID_ASUS_MD_5110 0x5110 |
7178 |
-diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
7179 |
-index e4cb543de0cd..ca8b5c261c7c 100644 |
7180 |
---- a/drivers/hid/hid-quirks.c |
7181 |
-+++ b/drivers/hid/hid-quirks.c |
7182 |
-@@ -168,6 +168,7 @@ static const struct hid_device_id hid_quirks[] = { |
7183 |
- { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, |
7184 |
- { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, |
7185 |
- { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883), HID_QUIRK_NOGET }, |
7186 |
-+ { HID_USB_DEVICE(USB_VENDOR_ID_TRUST, USB_DEVICE_ID_TRUST_PANORA_TABLET), HID_QUIRK_MULTI_INPUT | HID_QUIRK_HIDINPUT_FORCE }, |
7187 |
- { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, |
7188 |
- { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, |
7189 |
- { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT }, |
7190 |
-diff --git a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
7191 |
-index aa2dbed30fc3..6cf59fd26ad7 100644 |
7192 |
---- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
7193 |
-+++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
7194 |
-@@ -480,6 +480,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, |
7195 |
- sizeof(ldr_xfer_query_resp)); |
7196 |
- if (rv < 0) { |
7197 |
- client_data->flag_retry = true; |
7198 |
-+ *fw_info = (struct shim_fw_info){}; |
7199 |
- return rv; |
7200 |
- } |
7201 |
- |
7202 |
-@@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, |
7203 |
- "data size %d is not equal to size of loader_xfer_query_response %zu\n", |
7204 |
- rv, sizeof(struct loader_xfer_query_response)); |
7205 |
- client_data->flag_retry = true; |
7206 |
-+ *fw_info = (struct shim_fw_info){}; |
7207 |
- return -EMSGSIZE; |
7208 |
- } |
7209 |
- |
7210 |
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c |
7211 |
-index a90d757f7043..a6d6c7a3abcb 100644 |
7212 |
---- a/drivers/hwtracing/coresight/coresight-etm4x.c |
7213 |
-+++ b/drivers/hwtracing/coresight/coresight-etm4x.c |
7214 |
-@@ -1527,6 +1527,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) |
7215 |
- return 0; |
7216 |
- |
7217 |
- err_arch_supported: |
7218 |
-+ etmdrvdata[drvdata->cpu] = NULL; |
7219 |
- if (--etm4_count == 0) { |
7220 |
- etm4_cpu_pm_unregister(); |
7221 |
- |
7222 |
-diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c |
7223 |
-index 43418a2126ff..471f34e40c74 100644 |
7224 |
---- a/drivers/hwtracing/coresight/coresight-platform.c |
7225 |
-+++ b/drivers/hwtracing/coresight/coresight-platform.c |
7226 |
-@@ -87,6 +87,7 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, |
7227 |
- int *nr_inport, int *nr_outport) |
7228 |
- { |
7229 |
- struct device_node *ep = NULL; |
7230 |
-+ struct of_endpoint endpoint; |
7231 |
- int in = 0, out = 0; |
7232 |
- |
7233 |
- do { |
7234 |
-@@ -94,10 +95,16 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, |
7235 |
- if (!ep) |
7236 |
- break; |
7237 |
- |
7238 |
-- if (of_coresight_legacy_ep_is_input(ep)) |
7239 |
-- in++; |
7240 |
-- else |
7241 |
-- out++; |
7242 |
-+ if (of_graph_parse_endpoint(ep, &endpoint)) |
7243 |
-+ continue; |
7244 |
-+ |
7245 |
-+ if (of_coresight_legacy_ep_is_input(ep)) { |
7246 |
-+ in = (endpoint.port + 1 > in) ? |
7247 |
-+ endpoint.port + 1 : in; |
7248 |
-+ } else { |
7249 |
-+ out = (endpoint.port + 1) > out ? |
7250 |
-+ endpoint.port + 1 : out; |
7251 |
-+ } |
7252 |
- |
7253 |
- } while (ep); |
7254 |
- |
7255 |
-@@ -137,9 +144,16 @@ of_coresight_count_ports(struct device_node *port_parent) |
7256 |
- { |
7257 |
- int i = 0; |
7258 |
- struct device_node *ep = NULL; |
7259 |
-+ struct of_endpoint endpoint; |
7260 |
-+ |
7261 |
-+ while ((ep = of_graph_get_next_endpoint(port_parent, ep))) { |
7262 |
-+ /* Defer error handling to parsing */ |
7263 |
-+ if (of_graph_parse_endpoint(ep, &endpoint)) |
7264 |
-+ continue; |
7265 |
-+ if (endpoint.port + 1 > i) |
7266 |
-+ i = endpoint.port + 1; |
7267 |
-+ } |
7268 |
- |
7269 |
-- while ((ep = of_graph_get_next_endpoint(port_parent, ep))) |
7270 |
-- i++; |
7271 |
- return i; |
7272 |
- } |
7273 |
- |
7274 |
-@@ -191,14 +205,12 @@ static int of_coresight_get_cpu(struct device *dev) |
7275 |
- * Parses the local port, remote device name and the remote port. |
7276 |
- * |
7277 |
- * Returns : |
7278 |
-- * 1 - If the parsing is successful and a connection record |
7279 |
-- * was created for an output connection. |
7280 |
- * 0 - If the parsing completed without any fatal errors. |
7281 |
- * -Errno - Fatal error, abort the scanning. |
7282 |
- */ |
7283 |
- static int of_coresight_parse_endpoint(struct device *dev, |
7284 |
- struct device_node *ep, |
7285 |
-- struct coresight_connection *conn) |
7286 |
-+ struct coresight_platform_data *pdata) |
7287 |
- { |
7288 |
- int ret = 0; |
7289 |
- struct of_endpoint endpoint, rendpoint; |
7290 |
-@@ -206,6 +218,7 @@ static int of_coresight_parse_endpoint(struct device *dev, |
7291 |
- struct device_node *rep = NULL; |
7292 |
- struct device *rdev = NULL; |
7293 |
- struct fwnode_handle *rdev_fwnode; |
7294 |
-+ struct coresight_connection *conn; |
7295 |
- |
7296 |
- do { |
7297 |
- /* Parse the local port details */ |
7298 |
-@@ -232,6 +245,13 @@ static int of_coresight_parse_endpoint(struct device *dev, |
7299 |
- break; |
7300 |
- } |
7301 |
- |
7302 |
-+ conn = &pdata->conns[endpoint.port]; |
7303 |
-+ if (conn->child_fwnode) { |
7304 |
-+ dev_warn(dev, "Duplicate output port %d\n", |
7305 |
-+ endpoint.port); |
7306 |
-+ ret = -EINVAL; |
7307 |
-+ break; |
7308 |
-+ } |
7309 |
- conn->outport = endpoint.port; |
7310 |
- /* |
7311 |
- * Hold the refcount to the target device. This could be |
7312 |
-@@ -244,7 +264,6 @@ static int of_coresight_parse_endpoint(struct device *dev, |
7313 |
- conn->child_fwnode = fwnode_handle_get(rdev_fwnode); |
7314 |
- conn->child_port = rendpoint.port; |
7315 |
- /* Connection record updated */ |
7316 |
-- ret = 1; |
7317 |
- } while (0); |
7318 |
- |
7319 |
- of_node_put(rparent); |
7320 |
-@@ -258,7 +277,6 @@ static int of_get_coresight_platform_data(struct device *dev, |
7321 |
- struct coresight_platform_data *pdata) |
7322 |
- { |
7323 |
- int ret = 0; |
7324 |
-- struct coresight_connection *conn; |
7325 |
- struct device_node *ep = NULL; |
7326 |
- const struct device_node *parent = NULL; |
7327 |
- bool legacy_binding = false; |
7328 |
-@@ -287,8 +305,6 @@ static int of_get_coresight_platform_data(struct device *dev, |
7329 |
- dev_warn_once(dev, "Uses obsolete Coresight DT bindings\n"); |
7330 |
- } |
7331 |
- |
7332 |
-- conn = pdata->conns; |
7333 |
-- |
7334 |
- /* Iterate through each output port to discover topology */ |
7335 |
- while ((ep = of_graph_get_next_endpoint(parent, ep))) { |
7336 |
- /* |
7337 |
-@@ -300,15 +316,9 @@ static int of_get_coresight_platform_data(struct device *dev, |
7338 |
- if (legacy_binding && of_coresight_legacy_ep_is_input(ep)) |
7339 |
- continue; |
7340 |
- |
7341 |
-- ret = of_coresight_parse_endpoint(dev, ep, conn); |
7342 |
-- switch (ret) { |
7343 |
-- case 1: |
7344 |
-- conn++; /* Fall through */ |
7345 |
-- case 0: |
7346 |
-- break; |
7347 |
-- default: |
7348 |
-+ ret = of_coresight_parse_endpoint(dev, ep, pdata); |
7349 |
-+ if (ret) |
7350 |
- return ret; |
7351 |
-- } |
7352 |
- } |
7353 |
- |
7354 |
- return 0; |
7355 |
-@@ -647,6 +657,16 @@ static int acpi_coresight_parse_link(struct acpi_device *adev, |
7356 |
- * coresight_remove_match(). |
7357 |
- */ |
7358 |
- conn->child_fwnode = fwnode_handle_get(&r_adev->fwnode); |
7359 |
-+ } else if (dir == ACPI_CORESIGHT_LINK_SLAVE) { |
7360 |
-+ /* |
7361 |
-+ * We are only interested in the port number |
7362 |
-+ * for the input ports at this component. |
7363 |
-+ * Store the port number in child_port. |
7364 |
-+ */ |
7365 |
-+ conn->child_port = fields[0].integer.value; |
7366 |
-+ } else { |
7367 |
-+ /* Invalid direction */ |
7368 |
-+ return -EINVAL; |
7369 |
- } |
7370 |
- |
7371 |
- return dir; |
7372 |
-@@ -692,10 +712,20 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, |
7373 |
- return dir; |
7374 |
- |
7375 |
- if (dir == ACPI_CORESIGHT_LINK_MASTER) { |
7376 |
-- pdata->nr_outport++; |
7377 |
-+ if (ptr->outport > pdata->nr_outport) |
7378 |
-+ pdata->nr_outport = ptr->outport; |
7379 |
- ptr++; |
7380 |
- } else { |
7381 |
-- pdata->nr_inport++; |
7382 |
-+ WARN_ON(pdata->nr_inport == ptr->child_port); |
7383 |
-+ /* |
7384 |
-+ * We do not track input port connections for a device. |
7385 |
-+ * However we need the highest port number described, |
7386 |
-+ * which can be recorded now and reuse this connection |
7387 |
-+ * record for an output connection. Hence, do not move |
7388 |
-+ * the ptr for input connections |
7389 |
-+ */ |
7390 |
-+ if (ptr->child_port > pdata->nr_inport) |
7391 |
-+ pdata->nr_inport = ptr->child_port; |
7392 |
- } |
7393 |
- } |
7394 |
- |
7395 |
-@@ -704,8 +734,13 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, |
7396 |
- return rc; |
7397 |
- |
7398 |
- /* Copy the connection information to the final location */ |
7399 |
-- for (i = 0; i < pdata->nr_outport; i++) |
7400 |
-- pdata->conns[i] = conns[i]; |
7401 |
-+ for (i = 0; conns + i < ptr; i++) { |
7402 |
-+ int port = conns[i].outport; |
7403 |
-+ |
7404 |
-+ /* Duplicate output port */ |
7405 |
-+ WARN_ON(pdata->conns[port].child_fwnode); |
7406 |
-+ pdata->conns[port] = conns[i]; |
7407 |
-+ } |
7408 |
- |
7409 |
- devm_kfree(&adev->dev, conns); |
7410 |
- return 0; |
7411 |
-diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
7412 |
-index d0cc3985b72a..36cce2bfb744 100644 |
7413 |
---- a/drivers/hwtracing/coresight/coresight-tmc-etf.c |
7414 |
-+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c |
7415 |
-@@ -596,13 +596,6 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) |
7416 |
- goto out; |
7417 |
- } |
7418 |
- |
7419 |
-- /* There is no point in reading a TMC in HW FIFO mode */ |
7420 |
-- mode = readl_relaxed(drvdata->base + TMC_MODE); |
7421 |
-- if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
7422 |
-- ret = -EINVAL; |
7423 |
-- goto out; |
7424 |
-- } |
7425 |
-- |
7426 |
- /* Don't interfere if operated from Perf */ |
7427 |
- if (drvdata->mode == CS_MODE_PERF) { |
7428 |
- ret = -EINVAL; |
7429 |
-@@ -616,8 +609,15 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) |
7430 |
- } |
7431 |
- |
7432 |
- /* Disable the TMC if need be */ |
7433 |
-- if (drvdata->mode == CS_MODE_SYSFS) |
7434 |
-+ if (drvdata->mode == CS_MODE_SYSFS) { |
7435 |
-+ /* There is no point in reading a TMC in HW FIFO mode */ |
7436 |
-+ mode = readl_relaxed(drvdata->base + TMC_MODE); |
7437 |
-+ if (mode != TMC_MODE_CIRCULAR_BUFFER) { |
7438 |
-+ ret = -EINVAL; |
7439 |
-+ goto out; |
7440 |
-+ } |
7441 |
- __tmc_etb_disable_hw(drvdata); |
7442 |
-+ } |
7443 |
- |
7444 |
- drvdata->reading = true; |
7445 |
- out: |
7446 |
-diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c |
7447 |
-index c71553c09f8e..8f5e62f02444 100644 |
7448 |
---- a/drivers/hwtracing/coresight/coresight.c |
7449 |
-+++ b/drivers/hwtracing/coresight/coresight.c |
7450 |
-@@ -1053,6 +1053,9 @@ static int coresight_orphan_match(struct device *dev, void *data) |
7451 |
- for (i = 0; i < i_csdev->pdata->nr_outport; i++) { |
7452 |
- conn = &i_csdev->pdata->conns[i]; |
7453 |
- |
7454 |
-+ /* Skip the port if FW doesn't describe it */ |
7455 |
-+ if (!conn->child_fwnode) |
7456 |
-+ continue; |
7457 |
- /* We have found at least one orphan connection */ |
7458 |
- if (conn->child_dev == NULL) { |
7459 |
- /* Does it match this newly added device? */ |
7460 |
-@@ -1091,6 +1094,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) |
7461 |
- for (i = 0; i < csdev->pdata->nr_outport; i++) { |
7462 |
- struct coresight_connection *conn = &csdev->pdata->conns[i]; |
7463 |
- |
7464 |
-+ if (!conn->child_fwnode) |
7465 |
-+ continue; |
7466 |
- conn->child_dev = |
7467 |
- coresight_find_csdev_by_fwnode(conn->child_fwnode); |
7468 |
- if (!conn->child_dev) |
7469 |
-@@ -1118,7 +1123,7 @@ static int coresight_remove_match(struct device *dev, void *data) |
7470 |
- for (i = 0; i < iterator->pdata->nr_outport; i++) { |
7471 |
- conn = &iterator->pdata->conns[i]; |
7472 |
- |
7473 |
-- if (conn->child_dev == NULL) |
7474 |
-+ if (conn->child_dev == NULL || conn->child_fwnode == NULL) |
7475 |
- continue; |
7476 |
- |
7477 |
- if (csdev->dev.fwnode == conn->child_fwnode) { |
7478 |
-diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c |
7479 |
-index 271470f4d8a9..66c9923fc766 100644 |
7480 |
---- a/drivers/i2c/busses/i2c-icy.c |
7481 |
-+++ b/drivers/i2c/busses/i2c-icy.c |
7482 |
-@@ -43,6 +43,7 @@ |
7483 |
- #include <linux/i2c.h> |
7484 |
- #include <linux/i2c-algo-pcf.h> |
7485 |
- |
7486 |
-+#include <asm/amigahw.h> |
7487 |
- #include <asm/amigaints.h> |
7488 |
- #include <linux/zorro.h> |
7489 |
- |
7490 |
-diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c |
7491 |
-index 30ded6422e7b..69740a4ff1db 100644 |
7492 |
---- a/drivers/i2c/busses/i2c-piix4.c |
7493 |
-+++ b/drivers/i2c/busses/i2c-piix4.c |
7494 |
-@@ -977,7 +977,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) |
7495 |
- } |
7496 |
- |
7497 |
- if (dev->vendor == PCI_VENDOR_ID_AMD && |
7498 |
-- dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) { |
7499 |
-+ (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS || |
7500 |
-+ dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) { |
7501 |
- retval = piix4_setup_sb800(dev, id, 1); |
7502 |
- } |
7503 |
- |
7504 |
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c |
7505 |
-index 466e4f681d7a..f537a37ac1d5 100644 |
7506 |
---- a/drivers/i2c/busses/i2c-pxa.c |
7507 |
-+++ b/drivers/i2c/busses/i2c-pxa.c |
7508 |
-@@ -311,11 +311,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why) |
7509 |
- dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n", |
7510 |
- readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)), |
7511 |
- readl(_ISR(i2c))); |
7512 |
-- dev_dbg(dev, "log: "); |
7513 |
-+ dev_err(dev, "log:"); |
7514 |
- for (i = 0; i < i2c->irqlogidx; i++) |
7515 |
-- pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]); |
7516 |
-- |
7517 |
-- pr_debug("\n"); |
7518 |
-+ pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]); |
7519 |
-+ pr_cont("\n"); |
7520 |
- } |
7521 |
- |
7522 |
- #else /* ifdef DEBUG */ |
7523 |
-@@ -747,11 +746,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) |
7524 |
- { |
7525 |
- u32 icr; |
7526 |
- |
7527 |
-- /* |
7528 |
-- * Clear the STOP and ACK flags |
7529 |
-- */ |
7530 |
-+ /* Clear the START, STOP, ACK, TB and MA flags */ |
7531 |
- icr = readl(_ICR(i2c)); |
7532 |
-- icr &= ~(ICR_STOP | ICR_ACKNAK); |
7533 |
-+ icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA); |
7534 |
- writel(icr, _ICR(i2c)); |
7535 |
- } |
7536 |
- |
7537 |
-diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c |
7538 |
-index b129693af0fd..94da3b1ca3a2 100644 |
7539 |
---- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c |
7540 |
-+++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c |
7541 |
-@@ -134,7 +134,7 @@ static ssize_t iio_dmaengine_buffer_get_length_align(struct device *dev, |
7542 |
- struct dmaengine_buffer *dmaengine_buffer = |
7543 |
- iio_buffer_to_dmaengine_buffer(indio_dev->buffer); |
7544 |
- |
7545 |
-- return sprintf(buf, "%u\n", dmaengine_buffer->align); |
7546 |
-+ return sprintf(buf, "%zu\n", dmaengine_buffer->align); |
7547 |
- } |
7548 |
- |
7549 |
- static IIO_DEVICE_ATTR(length_align_bytes, 0444, |
7550 |
-diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c |
7551 |
-index b7ef16b28280..7a2679bdc987 100644 |
7552 |
---- a/drivers/iio/light/gp2ap002.c |
7553 |
-+++ b/drivers/iio/light/gp2ap002.c |
7554 |
-@@ -158,6 +158,9 @@ static irqreturn_t gp2ap002_prox_irq(int irq, void *d) |
7555 |
- int val; |
7556 |
- int ret; |
7557 |
- |
7558 |
-+ if (!gp2ap002->enabled) |
7559 |
-+ goto err_retrig; |
7560 |
-+ |
7561 |
- ret = regmap_read(gp2ap002->map, GP2AP002_PROX, &val); |
7562 |
- if (ret) { |
7563 |
- dev_err(gp2ap002->dev, "error reading proximity\n"); |
7564 |
-@@ -247,6 +250,8 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev, |
7565 |
- struct gp2ap002 *gp2ap002 = iio_priv(indio_dev); |
7566 |
- int ret; |
7567 |
- |
7568 |
-+ pm_runtime_get_sync(gp2ap002->dev); |
7569 |
-+ |
7570 |
- switch (mask) { |
7571 |
- case IIO_CHAN_INFO_RAW: |
7572 |
- switch (chan->type) { |
7573 |
-@@ -255,13 +260,21 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev, |
7574 |
- if (ret < 0) |
7575 |
- return ret; |
7576 |
- *val = ret; |
7577 |
-- return IIO_VAL_INT; |
7578 |
-+ ret = IIO_VAL_INT; |
7579 |
-+ goto out; |
7580 |
- default: |
7581 |
-- return -EINVAL; |
7582 |
-+ ret = -EINVAL; |
7583 |
-+ goto out; |
7584 |
- } |
7585 |
- default: |
7586 |
-- return -EINVAL; |
7587 |
-+ ret = -EINVAL; |
7588 |
- } |
7589 |
-+ |
7590 |
-+out: |
7591 |
-+ pm_runtime_mark_last_busy(gp2ap002->dev); |
7592 |
-+ pm_runtime_put_autosuspend(gp2ap002->dev); |
7593 |
-+ |
7594 |
-+ return ret; |
7595 |
- } |
7596 |
- |
7597 |
- static int gp2ap002_init(struct gp2ap002 *gp2ap002) |
7598 |
-diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c |
7599 |
-index 29c209cc1108..973264a088f9 100644 |
7600 |
---- a/drivers/iio/pressure/bmp280-core.c |
7601 |
-+++ b/drivers/iio/pressure/bmp280-core.c |
7602 |
-@@ -271,6 +271,8 @@ static u32 bmp280_compensate_humidity(struct bmp280_data *data, |
7603 |
- + (s32)2097152) * calib->H2 + 8192) >> 14); |
7604 |
- var -= ((((var >> 15) * (var >> 15)) >> 7) * (s32)calib->H1) >> 4; |
7605 |
- |
7606 |
-+ var = clamp_val(var, 0, 419430400); |
7607 |
-+ |
7608 |
- return var >> 12; |
7609 |
- }; |
7610 |
- |
7611 |
-@@ -713,7 +715,7 @@ static int bmp180_measure(struct bmp280_data *data, u8 ctrl_meas) |
7612 |
- unsigned int ctrl; |
7613 |
- |
7614 |
- if (data->use_eoc) |
7615 |
-- init_completion(&data->done); |
7616 |
-+ reinit_completion(&data->done); |
7617 |
- |
7618 |
- ret = regmap_write(data->regmap, BMP280_REG_CTRL_MEAS, ctrl_meas); |
7619 |
- if (ret) |
7620 |
-@@ -969,6 +971,9 @@ static int bmp085_fetch_eoc_irq(struct device *dev, |
7621 |
- "trying to enforce it\n"); |
7622 |
- irq_trig = IRQF_TRIGGER_RISING; |
7623 |
- } |
7624 |
-+ |
7625 |
-+ init_completion(&data->done); |
7626 |
-+ |
7627 |
- ret = devm_request_threaded_irq(dev, |
7628 |
- irq, |
7629 |
- bmp085_eoc_irq, |
7630 |
-diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c |
7631 |
-index 17f14e0eafe4..1c2bf18cda9f 100644 |
7632 |
---- a/drivers/infiniband/core/cm.c |
7633 |
-+++ b/drivers/infiniband/core/cm.c |
7634 |
-@@ -1076,7 +1076,9 @@ retest: |
7635 |
- case IB_CM_REP_SENT: |
7636 |
- case IB_CM_MRA_REP_RCVD: |
7637 |
- ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
7638 |
-- /* Fall through */ |
7639 |
-+ cm_send_rej_locked(cm_id_priv, IB_CM_REJ_CONSUMER_DEFINED, NULL, |
7640 |
-+ 0, NULL, 0); |
7641 |
-+ goto retest; |
7642 |
- case IB_CM_MRA_REQ_SENT: |
7643 |
- case IB_CM_REP_RCVD: |
7644 |
- case IB_CM_MRA_REP_SENT: |
7645 |
-diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c |
7646 |
-index c672a4978bfd..3c1e2ca564fe 100644 |
7647 |
---- a/drivers/infiniband/core/cma_configfs.c |
7648 |
-+++ b/drivers/infiniband/core/cma_configfs.c |
7649 |
-@@ -322,8 +322,21 @@ fail: |
7650 |
- return ERR_PTR(err); |
7651 |
- } |
7652 |
- |
7653 |
-+static void drop_cma_dev(struct config_group *cgroup, struct config_item *item) |
7654 |
-+{ |
7655 |
-+ struct config_group *group = |
7656 |
-+ container_of(item, struct config_group, cg_item); |
7657 |
-+ struct cma_dev_group *cma_dev_group = |
7658 |
-+ container_of(group, struct cma_dev_group, device_group); |
7659 |
-+ |
7660 |
-+ configfs_remove_default_groups(&cma_dev_group->ports_group); |
7661 |
-+ configfs_remove_default_groups(&cma_dev_group->device_group); |
7662 |
-+ config_item_put(item); |
7663 |
-+} |
7664 |
-+ |
7665 |
- static struct configfs_group_operations cma_subsys_group_ops = { |
7666 |
- .make_group = make_cma_dev, |
7667 |
-+ .drop_item = drop_cma_dev, |
7668 |
- }; |
7669 |
- |
7670 |
- static const struct config_item_type cma_subsys_type = { |
7671 |
-diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c |
7672 |
-index 087682e6969e..defe9cd4c5ee 100644 |
7673 |
---- a/drivers/infiniband/core/sysfs.c |
7674 |
-+++ b/drivers/infiniband/core/sysfs.c |
7675 |
-@@ -1058,8 +1058,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) |
7676 |
- coredev->ports_kobj, |
7677 |
- "%d", port_num); |
7678 |
- if (ret) { |
7679 |
-- kfree(p); |
7680 |
-- return ret; |
7681 |
-+ goto err_put; |
7682 |
- } |
7683 |
- |
7684 |
- p->gid_attr_group = kzalloc(sizeof(*p->gid_attr_group), GFP_KERNEL); |
7685 |
-@@ -1072,8 +1071,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) |
7686 |
- ret = kobject_init_and_add(&p->gid_attr_group->kobj, &gid_attr_type, |
7687 |
- &p->kobj, "gid_attrs"); |
7688 |
- if (ret) { |
7689 |
-- kfree(p->gid_attr_group); |
7690 |
-- goto err_put; |
7691 |
-+ goto err_put_gid_attrs; |
7692 |
- } |
7693 |
- |
7694 |
- if (device->ops.process_mad && is_full_dev) { |
7695 |
-@@ -1404,8 +1402,10 @@ int ib_port_register_module_stat(struct ib_device *device, u8 port_num, |
7696 |
- |
7697 |
- ret = kobject_init_and_add(kobj, ktype, &port->kobj, "%s", |
7698 |
- name); |
7699 |
-- if (ret) |
7700 |
-+ if (ret) { |
7701 |
-+ kobject_put(kobj); |
7702 |
- return ret; |
7703 |
-+ } |
7704 |
- } |
7705 |
- |
7706 |
- return 0; |
7707 |
-diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c |
7708 |
-index 060b4ebbd2ba..d6e9cc94dd90 100644 |
7709 |
---- a/drivers/infiniband/core/uverbs_cmd.c |
7710 |
-+++ b/drivers/infiniband/core/uverbs_cmd.c |
7711 |
-@@ -2959,6 +2959,7 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs) |
7712 |
- wq_init_attr.event_handler = ib_uverbs_wq_event_handler; |
7713 |
- wq_init_attr.create_flags = cmd.create_flags; |
7714 |
- INIT_LIST_HEAD(&obj->uevent.event_list); |
7715 |
-+ obj->uevent.uobject.user_handle = cmd.user_handle; |
7716 |
- |
7717 |
- wq = pd->device->ops.create_wq(pd, &wq_init_attr, &attrs->driver_udata); |
7718 |
- if (IS_ERR(wq)) { |
7719 |
-@@ -2976,8 +2977,6 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs) |
7720 |
- atomic_set(&wq->usecnt, 0); |
7721 |
- atomic_inc(&pd->usecnt); |
7722 |
- atomic_inc(&cq->usecnt); |
7723 |
-- wq->uobject = obj; |
7724 |
-- obj->uevent.uobject.object = wq; |
7725 |
- |
7726 |
- memset(&resp, 0, sizeof(resp)); |
7727 |
- resp.wq_handle = obj->uevent.uobject.id; |
7728 |
-diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c |
7729 |
-index 599340c1f0b8..541dbcf22d0e 100644 |
7730 |
---- a/drivers/infiniband/hw/cxgb4/device.c |
7731 |
-+++ b/drivers/infiniband/hw/cxgb4/device.c |
7732 |
-@@ -953,6 +953,7 @@ void c4iw_dealloc(struct uld_ctx *ctx) |
7733 |
- static void c4iw_remove(struct uld_ctx *ctx) |
7734 |
- { |
7735 |
- pr_debug("c4iw_dev %p\n", ctx->dev); |
7736 |
-+ debugfs_remove_recursive(ctx->dev->debugfs_root); |
7737 |
- c4iw_unregister_device(ctx->dev); |
7738 |
- c4iw_dealloc(ctx); |
7739 |
- } |
7740 |
-diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c |
7741 |
-index eea5574a62e8..69f842c92ff6 100644 |
7742 |
---- a/drivers/infiniband/hw/efa/efa_com_cmd.c |
7743 |
-+++ b/drivers/infiniband/hw/efa/efa_com_cmd.c |
7744 |
-@@ -388,7 +388,7 @@ static int efa_com_get_feature_ex(struct efa_com_dev *edev, |
7745 |
- |
7746 |
- if (control_buff_size) |
7747 |
- EFA_SET(&get_cmd.aq_common_descriptor.flags, |
7748 |
-- EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT, 1); |
7749 |
-+ EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA, 1); |
7750 |
- |
7751 |
- efa_com_set_dma_addr(control_buf_dma_addr, |
7752 |
- &get_cmd.control_buffer.address.mem_addr_high, |
7753 |
-@@ -540,7 +540,7 @@ static int efa_com_set_feature_ex(struct efa_com_dev *edev, |
7754 |
- if (control_buff_size) { |
7755 |
- set_cmd->aq_common_descriptor.flags = 0; |
7756 |
- EFA_SET(&set_cmd->aq_common_descriptor.flags, |
7757 |
-- EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT, 1); |
7758 |
-+ EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA, 1); |
7759 |
- efa_com_set_dma_addr(control_buf_dma_addr, |
7760 |
- &set_cmd->control_buffer.address.mem_addr_high, |
7761 |
- &set_cmd->control_buffer.address.mem_addr_low); |
7762 |
-diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7763 |
-index c3316672b70e..f9fa80ae5560 100644 |
7764 |
---- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7765 |
-+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c |
7766 |
-@@ -1349,34 +1349,26 @@ static int hns_roce_query_pf_resource(struct hns_roce_dev *hr_dev) |
7767 |
- static int hns_roce_query_pf_timer_resource(struct hns_roce_dev *hr_dev) |
7768 |
- { |
7769 |
- struct hns_roce_pf_timer_res_a *req_a; |
7770 |
-- struct hns_roce_cmq_desc desc[2]; |
7771 |
-- int ret, i; |
7772 |
-+ struct hns_roce_cmq_desc desc; |
7773 |
-+ int ret; |
7774 |
- |
7775 |
-- for (i = 0; i < 2; i++) { |
7776 |
-- hns_roce_cmq_setup_basic_desc(&desc[i], |
7777 |
-- HNS_ROCE_OPC_QUERY_PF_TIMER_RES, |
7778 |
-- true); |
7779 |
-+ hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_QUERY_PF_TIMER_RES, |
7780 |
-+ true); |
7781 |
- |
7782 |
-- if (i == 0) |
7783 |
-- desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT); |
7784 |
-- else |
7785 |
-- desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT); |
7786 |
-- } |
7787 |
-- |
7788 |
-- ret = hns_roce_cmq_send(hr_dev, desc, 2); |
7789 |
-+ ret = hns_roce_cmq_send(hr_dev, &desc, 1); |
7790 |
- if (ret) |
7791 |
- return ret; |
7792 |
- |
7793 |
-- req_a = (struct hns_roce_pf_timer_res_a *)desc[0].data; |
7794 |
-+ req_a = (struct hns_roce_pf_timer_res_a *)desc.data; |
7795 |
- |
7796 |
- hr_dev->caps.qpc_timer_bt_num = |
7797 |
-- roce_get_field(req_a->qpc_timer_bt_idx_num, |
7798 |
-- PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_M, |
7799 |
-- PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_S); |
7800 |
-+ roce_get_field(req_a->qpc_timer_bt_idx_num, |
7801 |
-+ PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_M, |
7802 |
-+ PF_RES_DATA_1_PF_QPC_TIMER_BT_NUM_S); |
7803 |
- hr_dev->caps.cqc_timer_bt_num = |
7804 |
-- roce_get_field(req_a->cqc_timer_bt_idx_num, |
7805 |
-- PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_M, |
7806 |
-- PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_S); |
7807 |
-+ roce_get_field(req_a->cqc_timer_bt_idx_num, |
7808 |
-+ PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_M, |
7809 |
-+ PF_RES_DATA_2_PF_CQC_TIMER_BT_NUM_S); |
7810 |
- |
7811 |
- return 0; |
7812 |
- } |
7813 |
-@@ -4639,7 +4631,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, |
7814 |
- qp_attr->path_mig_state = IB_MIG_ARMED; |
7815 |
- qp_attr->ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE; |
7816 |
- if (hr_qp->ibqp.qp_type == IB_QPT_UD) |
7817 |
-- qp_attr->qkey = V2_QKEY_VAL; |
7818 |
-+ qp_attr->qkey = le32_to_cpu(context.qkey_xrcd); |
7819 |
- |
7820 |
- qp_attr->rq_psn = roce_get_field(context.byte_108_rx_reqepsn, |
7821 |
- V2_QPC_BYTE_108_RX_REQ_EPSN_M, |
7822 |
-diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c |
7823 |
-index 46e1ab771f10..ed10e2f32aab 100644 |
7824 |
---- a/drivers/infiniband/hw/mlx5/devx.c |
7825 |
-+++ b/drivers/infiniband/hw/mlx5/devx.c |
7826 |
-@@ -494,6 +494,10 @@ static u64 devx_get_obj_id(const void *in) |
7827 |
- obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
7828 |
- MLX5_GET(rst2init_qp_in, in, qpn)); |
7829 |
- break; |
7830 |
-+ case MLX5_CMD_OP_INIT2INIT_QP: |
7831 |
-+ obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
7832 |
-+ MLX5_GET(init2init_qp_in, in, qpn)); |
7833 |
-+ break; |
7834 |
- case MLX5_CMD_OP_INIT2RTR_QP: |
7835 |
- obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_QP, |
7836 |
- MLX5_GET(init2rtr_qp_in, in, qpn)); |
7837 |
-@@ -819,6 +823,7 @@ static bool devx_is_obj_modify_cmd(const void *in) |
7838 |
- case MLX5_CMD_OP_SET_L2_TABLE_ENTRY: |
7839 |
- case MLX5_CMD_OP_RST2INIT_QP: |
7840 |
- case MLX5_CMD_OP_INIT2RTR_QP: |
7841 |
-+ case MLX5_CMD_OP_INIT2INIT_QP: |
7842 |
- case MLX5_CMD_OP_RTR2RTS_QP: |
7843 |
- case MLX5_CMD_OP_RTS2RTS_QP: |
7844 |
- case MLX5_CMD_OP_SQERR2RTS_QP: |
7845 |
-diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c |
7846 |
-index b1a8a9175040..6d1ff13d2283 100644 |
7847 |
---- a/drivers/infiniband/hw/mlx5/srq.c |
7848 |
-+++ b/drivers/infiniband/hw/mlx5/srq.c |
7849 |
-@@ -310,12 +310,18 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq, |
7850 |
- srq->msrq.event = mlx5_ib_srq_event; |
7851 |
- srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn; |
7852 |
- |
7853 |
-- if (udata) |
7854 |
-- if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof(__u32))) { |
7855 |
-+ if (udata) { |
7856 |
-+ struct mlx5_ib_create_srq_resp resp = { |
7857 |
-+ .srqn = srq->msrq.srqn, |
7858 |
-+ }; |
7859 |
-+ |
7860 |
-+ if (ib_copy_to_udata(udata, &resp, min(udata->outlen, |
7861 |
-+ sizeof(resp)))) { |
7862 |
- mlx5_ib_dbg(dev, "copy to user failed\n"); |
7863 |
- err = -EFAULT; |
7864 |
- goto err_core; |
7865 |
- } |
7866 |
-+ } |
7867 |
- |
7868 |
- init_attr->attr.max_wr = srq->msrq.max - 1; |
7869 |
- |
7870 |
-diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c |
7871 |
-index 98552749d71c..fcf982c60db6 100644 |
7872 |
---- a/drivers/infiniband/ulp/srpt/ib_srpt.c |
7873 |
-+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c |
7874 |
-@@ -610,6 +610,11 @@ static int srpt_refresh_port(struct srpt_port *sport) |
7875 |
- dev_name(&sport->sdev->device->dev), sport->port, |
7876 |
- PTR_ERR(sport->mad_agent)); |
7877 |
- sport->mad_agent = NULL; |
7878 |
-+ memset(&port_modify, 0, sizeof(port_modify)); |
7879 |
-+ port_modify.clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP; |
7880 |
-+ ib_modify_port(sport->sdev->device, sport->port, 0, |
7881 |
-+ &port_modify); |
7882 |
-+ |
7883 |
- } |
7884 |
- } |
7885 |
- |
7886 |
-@@ -633,9 +638,8 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) |
7887 |
- for (i = 1; i <= sdev->device->phys_port_cnt; i++) { |
7888 |
- sport = &sdev->port[i - 1]; |
7889 |
- WARN_ON(sport->port != i); |
7890 |
-- if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0) |
7891 |
-- pr_err("disabling MAD processing failed.\n"); |
7892 |
- if (sport->mad_agent) { |
7893 |
-+ ib_modify_port(sdev->device, i, 0, &port_modify); |
7894 |
- ib_unregister_mad_agent(sport->mad_agent); |
7895 |
- sport->mad_agent = NULL; |
7896 |
- } |
7897 |
-diff --git a/drivers/input/serio/i8042-ppcio.h b/drivers/input/serio/i8042-ppcio.h |
7898 |
-deleted file mode 100644 |
7899 |
-index 391f94d9e47d..000000000000 |
7900 |
---- a/drivers/input/serio/i8042-ppcio.h |
7901 |
-+++ /dev/null |
7902 |
-@@ -1,57 +0,0 @@ |
7903 |
--/* SPDX-License-Identifier: GPL-2.0-only */ |
7904 |
--#ifndef _I8042_PPCIO_H |
7905 |
--#define _I8042_PPCIO_H |
7906 |
-- |
7907 |
-- |
7908 |
--#if defined(CONFIG_WALNUT) |
7909 |
-- |
7910 |
--#define I8042_KBD_IRQ 25 |
7911 |
--#define I8042_AUX_IRQ 26 |
7912 |
-- |
7913 |
--#define I8042_KBD_PHYS_DESC "walnutps2/serio0" |
7914 |
--#define I8042_AUX_PHYS_DESC "walnutps2/serio1" |
7915 |
--#define I8042_MUX_PHYS_DESC "walnutps2/serio%d" |
7916 |
-- |
7917 |
--extern void *kb_cs; |
7918 |
--extern void *kb_data; |
7919 |
-- |
7920 |
--#define I8042_COMMAND_REG (*(int *)kb_cs) |
7921 |
--#define I8042_DATA_REG (*(int *)kb_data) |
7922 |
-- |
7923 |
--static inline int i8042_read_data(void) |
7924 |
--{ |
7925 |
-- return readb(kb_data); |
7926 |
--} |
7927 |
-- |
7928 |
--static inline int i8042_read_status(void) |
7929 |
--{ |
7930 |
-- return readb(kb_cs); |
7931 |
--} |
7932 |
-- |
7933 |
--static inline void i8042_write_data(int val) |
7934 |
--{ |
7935 |
-- writeb(val, kb_data); |
7936 |
--} |
7937 |
-- |
7938 |
--static inline void i8042_write_command(int val) |
7939 |
--{ |
7940 |
-- writeb(val, kb_cs); |
7941 |
--} |
7942 |
-- |
7943 |
--static inline int i8042_platform_init(void) |
7944 |
--{ |
7945 |
-- i8042_reset = I8042_RESET_ALWAYS; |
7946 |
-- return 0; |
7947 |
--} |
7948 |
-- |
7949 |
--static inline void i8042_platform_exit(void) |
7950 |
--{ |
7951 |
--} |
7952 |
-- |
7953 |
--#else |
7954 |
-- |
7955 |
--#include "i8042-io.h" |
7956 |
-- |
7957 |
--#endif |
7958 |
-- |
7959 |
--#endif /* _I8042_PPCIO_H */ |
7960 |
-diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h |
7961 |
-index 38dc27ad3c18..eb376700dfff 100644 |
7962 |
---- a/drivers/input/serio/i8042.h |
7963 |
-+++ b/drivers/input/serio/i8042.h |
7964 |
-@@ -17,8 +17,6 @@ |
7965 |
- #include "i8042-ip22io.h" |
7966 |
- #elif defined(CONFIG_SNI_RM) |
7967 |
- #include "i8042-snirm.h" |
7968 |
--#elif defined(CONFIG_PPC) |
7969 |
--#include "i8042-ppcio.h" |
7970 |
- #elif defined(CONFIG_SPARC) |
7971 |
- #include "i8042-sparcio.h" |
7972 |
- #elif defined(CONFIG_X86) || defined(CONFIG_IA64) |
7973 |
-diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c |
7974 |
-index d2587724c52a..9b8450794a8a 100644 |
7975 |
---- a/drivers/input/touchscreen/edt-ft5x06.c |
7976 |
-+++ b/drivers/input/touchscreen/edt-ft5x06.c |
7977 |
-@@ -938,19 +938,25 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev, |
7978 |
- |
7979 |
- error = device_property_read_u32(dev, "offset", &val); |
7980 |
- if (!error) { |
7981 |
-- edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val); |
7982 |
-+ if (reg_addr->reg_offset != NO_REGISTER) |
7983 |
-+ edt_ft5x06_register_write(tsdata, |
7984 |
-+ reg_addr->reg_offset, val); |
7985 |
- tsdata->offset = val; |
7986 |
- } |
7987 |
- |
7988 |
- error = device_property_read_u32(dev, "offset-x", &val); |
7989 |
- if (!error) { |
7990 |
-- edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_x, val); |
7991 |
-+ if (reg_addr->reg_offset_x != NO_REGISTER) |
7992 |
-+ edt_ft5x06_register_write(tsdata, |
7993 |
-+ reg_addr->reg_offset_x, val); |
7994 |
- tsdata->offset_x = val; |
7995 |
- } |
7996 |
- |
7997 |
- error = device_property_read_u32(dev, "offset-y", &val); |
7998 |
- if (!error) { |
7999 |
-- edt_ft5x06_register_write(tsdata, reg_addr->reg_offset_y, val); |
8000 |
-+ if (reg_addr->reg_offset_y != NO_REGISTER) |
8001 |
-+ edt_ft5x06_register_write(tsdata, |
8002 |
-+ reg_addr->reg_offset_y, val); |
8003 |
- tsdata->offset_y = val; |
8004 |
- } |
8005 |
- } |
8006 |
-diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c |
8007 |
-index 82508730feb7..af21d24a09e8 100644 |
8008 |
---- a/drivers/iommu/arm-smmu-v3.c |
8009 |
-+++ b/drivers/iommu/arm-smmu-v3.c |
8010 |
-@@ -171,6 +171,8 @@ |
8011 |
- #define ARM_SMMU_PRIQ_IRQ_CFG1 0xd8 |
8012 |
- #define ARM_SMMU_PRIQ_IRQ_CFG2 0xdc |
8013 |
- |
8014 |
-+#define ARM_SMMU_REG_SZ 0xe00 |
8015 |
-+ |
8016 |
- /* Common MSI config fields */ |
8017 |
- #define MSI_CFG0_ADDR_MASK GENMASK_ULL(51, 2) |
8018 |
- #define MSI_CFG2_SH GENMASK(5, 4) |
8019 |
-@@ -628,6 +630,7 @@ struct arm_smmu_strtab_cfg { |
8020 |
- struct arm_smmu_device { |
8021 |
- struct device *dev; |
8022 |
- void __iomem *base; |
8023 |
-+ void __iomem *page1; |
8024 |
- |
8025 |
- #define ARM_SMMU_FEAT_2_LVL_STRTAB (1 << 0) |
8026 |
- #define ARM_SMMU_FEAT_2_LVL_CDTAB (1 << 1) |
8027 |
-@@ -733,9 +736,8 @@ static struct arm_smmu_option_prop arm_smmu_options[] = { |
8028 |
- static inline void __iomem *arm_smmu_page1_fixup(unsigned long offset, |
8029 |
- struct arm_smmu_device *smmu) |
8030 |
- { |
8031 |
-- if ((offset > SZ_64K) && |
8032 |
-- (smmu->options & ARM_SMMU_OPT_PAGE0_REGS_ONLY)) |
8033 |
-- offset -= SZ_64K; |
8034 |
-+ if (offset > SZ_64K) |
8035 |
-+ return smmu->page1 + offset - SZ_64K; |
8036 |
- |
8037 |
- return smmu->base + offset; |
8038 |
- } |
8039 |
-@@ -4021,6 +4023,18 @@ err_reset_pci_ops: __maybe_unused; |
8040 |
- return err; |
8041 |
- } |
8042 |
- |
8043 |
-+static void __iomem *arm_smmu_ioremap(struct device *dev, resource_size_t start, |
8044 |
-+ resource_size_t size) |
8045 |
-+{ |
8046 |
-+ struct resource res = { |
8047 |
-+ .flags = IORESOURCE_MEM, |
8048 |
-+ .start = start, |
8049 |
-+ .end = start + size - 1, |
8050 |
-+ }; |
8051 |
-+ |
8052 |
-+ return devm_ioremap_resource(dev, &res); |
8053 |
-+} |
8054 |
-+ |
8055 |
- static int arm_smmu_device_probe(struct platform_device *pdev) |
8056 |
- { |
8057 |
- int irq, ret; |
8058 |
-@@ -4056,10 +4070,23 @@ static int arm_smmu_device_probe(struct platform_device *pdev) |
8059 |
- } |
8060 |
- ioaddr = res->start; |
8061 |
- |
8062 |
-- smmu->base = devm_ioremap_resource(dev, res); |
8063 |
-+ /* |
8064 |
-+ * Don't map the IMPLEMENTATION DEFINED regions, since they may contain |
8065 |
-+ * the PMCG registers which are reserved by the PMU driver. |
8066 |
-+ */ |
8067 |
-+ smmu->base = arm_smmu_ioremap(dev, ioaddr, ARM_SMMU_REG_SZ); |
8068 |
- if (IS_ERR(smmu->base)) |
8069 |
- return PTR_ERR(smmu->base); |
8070 |
- |
8071 |
-+ if (arm_smmu_resource_size(smmu) > SZ_64K) { |
8072 |
-+ smmu->page1 = arm_smmu_ioremap(dev, ioaddr + SZ_64K, |
8073 |
-+ ARM_SMMU_REG_SZ); |
8074 |
-+ if (IS_ERR(smmu->page1)) |
8075 |
-+ return PTR_ERR(smmu->page1); |
8076 |
-+ } else { |
8077 |
-+ smmu->page1 = smmu->base; |
8078 |
-+ } |
8079 |
-+ |
8080 |
- /* Interrupt lines */ |
8081 |
- |
8082 |
- irq = platform_get_irq_byname_optional(pdev, "combined"); |
8083 |
-diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
8084 |
-index 11ed871dd255..fde7aba49b74 100644 |
8085 |
---- a/drivers/iommu/intel-iommu.c |
8086 |
-+++ b/drivers/iommu/intel-iommu.c |
8087 |
-@@ -2518,9 +2518,6 @@ struct dmar_domain *find_domain(struct device *dev) |
8088 |
- if (unlikely(attach_deferred(dev) || iommu_dummy(dev))) |
8089 |
- return NULL; |
8090 |
- |
8091 |
-- if (dev_is_pci(dev)) |
8092 |
-- dev = &pci_real_dma_dev(to_pci_dev(dev))->dev; |
8093 |
-- |
8094 |
- /* No lock here, assumes no domain exit in normal case */ |
8095 |
- info = dev->archdata.iommu; |
8096 |
- if (likely(info)) |
8097 |
-diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c |
8098 |
-index 7906624a731c..478308fb82cc 100644 |
8099 |
---- a/drivers/mailbox/imx-mailbox.c |
8100 |
-+++ b/drivers/mailbox/imx-mailbox.c |
8101 |
-@@ -66,6 +66,8 @@ struct imx_mu_priv { |
8102 |
- struct clk *clk; |
8103 |
- int irq; |
8104 |
- |
8105 |
-+ u32 xcr; |
8106 |
-+ |
8107 |
- bool side_b; |
8108 |
- }; |
8109 |
- |
8110 |
-@@ -374,7 +376,7 @@ static struct mbox_chan *imx_mu_scu_xlate(struct mbox_controller *mbox, |
8111 |
- break; |
8112 |
- default: |
8113 |
- dev_err(mbox->dev, "Invalid chan type: %d\n", type); |
8114 |
-- return NULL; |
8115 |
-+ return ERR_PTR(-EINVAL); |
8116 |
- } |
8117 |
- |
8118 |
- if (chan >= mbox->num_chans) { |
8119 |
-@@ -558,12 +560,45 @@ static const struct of_device_id imx_mu_dt_ids[] = { |
8120 |
- }; |
8121 |
- MODULE_DEVICE_TABLE(of, imx_mu_dt_ids); |
8122 |
- |
8123 |
-+static int imx_mu_suspend_noirq(struct device *dev) |
8124 |
-+{ |
8125 |
-+ struct imx_mu_priv *priv = dev_get_drvdata(dev); |
8126 |
-+ |
8127 |
-+ priv->xcr = imx_mu_read(priv, priv->dcfg->xCR); |
8128 |
-+ |
8129 |
-+ return 0; |
8130 |
-+} |
8131 |
-+ |
8132 |
-+static int imx_mu_resume_noirq(struct device *dev) |
8133 |
-+{ |
8134 |
-+ struct imx_mu_priv *priv = dev_get_drvdata(dev); |
8135 |
-+ |
8136 |
-+ /* |
8137 |
-+ * ONLY restore MU when context lost, the TIE could |
8138 |
-+ * be set during noirq resume as there is MU data |
8139 |
-+ * communication going on, and restore the saved |
8140 |
-+ * value will overwrite the TIE and cause MU data |
8141 |
-+ * send failed, may lead to system freeze. This issue |
8142 |
-+ * is observed by testing freeze mode suspend. |
8143 |
-+ */ |
8144 |
-+ if (!imx_mu_read(priv, priv->dcfg->xCR)) |
8145 |
-+ imx_mu_write(priv, priv->xcr, priv->dcfg->xCR); |
8146 |
-+ |
8147 |
-+ return 0; |
8148 |
-+} |
8149 |
-+ |
8150 |
-+static const struct dev_pm_ops imx_mu_pm_ops = { |
8151 |
-+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_mu_suspend_noirq, |
8152 |
-+ imx_mu_resume_noirq) |
8153 |
-+}; |
8154 |
-+ |
8155 |
- static struct platform_driver imx_mu_driver = { |
8156 |
- .probe = imx_mu_probe, |
8157 |
- .remove = imx_mu_remove, |
8158 |
- .driver = { |
8159 |
- .name = "imx_mu", |
8160 |
- .of_match_table = imx_mu_dt_ids, |
8161 |
-+ .pm = &imx_mu_pm_ops, |
8162 |
- }, |
8163 |
- }; |
8164 |
- module_platform_driver(imx_mu_driver); |
8165 |
-diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c |
8166 |
-index 86887c9a349a..f9cc674ba9b7 100644 |
8167 |
---- a/drivers/mailbox/zynqmp-ipi-mailbox.c |
8168 |
-+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c |
8169 |
-@@ -504,10 +504,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8170 |
- mchan->req_buf_size = resource_size(&res); |
8171 |
- mchan->req_buf = devm_ioremap(mdev, res.start, |
8172 |
- mchan->req_buf_size); |
8173 |
-- if (IS_ERR(mchan->req_buf)) { |
8174 |
-+ if (!mchan->req_buf) { |
8175 |
- dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8176 |
-- ret = PTR_ERR(mchan->req_buf); |
8177 |
-- return ret; |
8178 |
-+ return -ENOMEM; |
8179 |
- } |
8180 |
- } else if (ret != -ENODEV) { |
8181 |
- dev_err(mdev, "Unmatched resource %s, %d.\n", name, ret); |
8182 |
-@@ -520,10 +519,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8183 |
- mchan->resp_buf_size = resource_size(&res); |
8184 |
- mchan->resp_buf = devm_ioremap(mdev, res.start, |
8185 |
- mchan->resp_buf_size); |
8186 |
-- if (IS_ERR(mchan->resp_buf)) { |
8187 |
-+ if (!mchan->resp_buf) { |
8188 |
- dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8189 |
-- ret = PTR_ERR(mchan->resp_buf); |
8190 |
-- return ret; |
8191 |
-+ return -ENOMEM; |
8192 |
- } |
8193 |
- } else if (ret != -ENODEV) { |
8194 |
- dev_err(mdev, "Unmatched resource %s.\n", name); |
8195 |
-@@ -543,10 +541,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8196 |
- mchan->req_buf_size = resource_size(&res); |
8197 |
- mchan->req_buf = devm_ioremap(mdev, res.start, |
8198 |
- mchan->req_buf_size); |
8199 |
-- if (IS_ERR(mchan->req_buf)) { |
8200 |
-+ if (!mchan->req_buf) { |
8201 |
- dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8202 |
-- ret = PTR_ERR(mchan->req_buf); |
8203 |
-- return ret; |
8204 |
-+ return -ENOMEM; |
8205 |
- } |
8206 |
- } else if (ret != -ENODEV) { |
8207 |
- dev_err(mdev, "Unmatched resource %s.\n", name); |
8208 |
-@@ -559,10 +556,9 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, |
8209 |
- mchan->resp_buf_size = resource_size(&res); |
8210 |
- mchan->resp_buf = devm_ioremap(mdev, res.start, |
8211 |
- mchan->resp_buf_size); |
8212 |
-- if (IS_ERR(mchan->resp_buf)) { |
8213 |
-+ if (!mchan->resp_buf) { |
8214 |
- dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); |
8215 |
-- ret = PTR_ERR(mchan->resp_buf); |
8216 |
-- return ret; |
8217 |
-+ return -ENOMEM; |
8218 |
- } |
8219 |
- } else if (ret != -ENODEV) { |
8220 |
- dev_err(mdev, "Unmatched resource %s.\n", name); |
8221 |
-diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
8222 |
-index 72856e5f23a3..fd1f288fd801 100644 |
8223 |
---- a/drivers/md/bcache/btree.c |
8224 |
-+++ b/drivers/md/bcache/btree.c |
8225 |
-@@ -1389,7 +1389,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
8226 |
- if (__set_blocks(n1, n1->keys + n2->keys, |
8227 |
- block_bytes(b->c)) > |
8228 |
- btree_blocks(new_nodes[i])) |
8229 |
-- goto out_nocoalesce; |
8230 |
-+ goto out_unlock_nocoalesce; |
8231 |
- |
8232 |
- keys = n2->keys; |
8233 |
- /* Take the key of the node we're getting rid of */ |
8234 |
-@@ -1418,7 +1418,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
8235 |
- |
8236 |
- if (__bch_keylist_realloc(&keylist, |
8237 |
- bkey_u64s(&new_nodes[i]->key))) |
8238 |
-- goto out_nocoalesce; |
8239 |
-+ goto out_unlock_nocoalesce; |
8240 |
- |
8241 |
- bch_btree_node_write(new_nodes[i], &cl); |
8242 |
- bch_keylist_add(&keylist, &new_nodes[i]->key); |
8243 |
-@@ -1464,6 +1464,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, |
8244 |
- /* Invalidated our iterator */ |
8245 |
- return -EINTR; |
8246 |
- |
8247 |
-+out_unlock_nocoalesce: |
8248 |
-+ for (i = 0; i < nodes; i++) |
8249 |
-+ mutex_unlock(&new_nodes[i]->write_lock); |
8250 |
-+ |
8251 |
- out_nocoalesce: |
8252 |
- closure_sync(&cl); |
8253 |
- |
8254 |
-diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
8255 |
-index 3e500098132f..e0c800cf87a9 100644 |
8256 |
---- a/drivers/md/dm-mpath.c |
8257 |
-+++ b/drivers/md/dm-mpath.c |
8258 |
-@@ -1918,7 +1918,7 @@ static int multipath_prepare_ioctl(struct dm_target *ti, |
8259 |
- int r; |
8260 |
- |
8261 |
- current_pgpath = READ_ONCE(m->current_pgpath); |
8262 |
-- if (!current_pgpath) |
8263 |
-+ if (!current_pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) |
8264 |
- current_pgpath = choose_pgpath(m, 0); |
8265 |
- |
8266 |
- if (current_pgpath) { |
8267 |
-diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c |
8268 |
-index 369de15c4e80..61b7d7b7e5a6 100644 |
8269 |
---- a/drivers/md/dm-zoned-metadata.c |
8270 |
-+++ b/drivers/md/dm-zoned-metadata.c |
8271 |
-@@ -1554,7 +1554,7 @@ static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd) |
8272 |
- return dzone; |
8273 |
- } |
8274 |
- |
8275 |
-- return ERR_PTR(-EBUSY); |
8276 |
-+ return NULL; |
8277 |
- } |
8278 |
- |
8279 |
- /* |
8280 |
-@@ -1574,7 +1574,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd) |
8281 |
- return zone; |
8282 |
- } |
8283 |
- |
8284 |
-- return ERR_PTR(-EBUSY); |
8285 |
-+ return NULL; |
8286 |
- } |
8287 |
- |
8288 |
- /* |
8289 |
-diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c |
8290 |
-index e7ace908a9b7..d50817320e8e 100644 |
8291 |
---- a/drivers/md/dm-zoned-reclaim.c |
8292 |
-+++ b/drivers/md/dm-zoned-reclaim.c |
8293 |
-@@ -349,8 +349,8 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc) |
8294 |
- |
8295 |
- /* Get a data zone */ |
8296 |
- dzone = dmz_get_zone_for_reclaim(zmd); |
8297 |
-- if (IS_ERR(dzone)) |
8298 |
-- return PTR_ERR(dzone); |
8299 |
-+ if (!dzone) |
8300 |
-+ return -EBUSY; |
8301 |
- |
8302 |
- start = jiffies; |
8303 |
- |
8304 |
-diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
8305 |
-index 5c2a23b953a4..eba2b9f040df 100644 |
8306 |
---- a/drivers/media/platform/s5p-mfc/s5p_mfc.c |
8307 |
-+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c |
8308 |
-@@ -1089,6 +1089,10 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, |
8309 |
- child->coherent_dma_mask = dev->coherent_dma_mask; |
8310 |
- child->dma_mask = dev->dma_mask; |
8311 |
- child->release = s5p_mfc_memdev_release; |
8312 |
-+ child->dma_parms = devm_kzalloc(dev, sizeof(*child->dma_parms), |
8313 |
-+ GFP_KERNEL); |
8314 |
-+ if (!child->dma_parms) |
8315 |
-+ goto err; |
8316 |
- |
8317 |
- /* |
8318 |
- * The memdevs are not proper OF platform devices, so in order for them |
8319 |
-@@ -1104,7 +1108,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, |
8320 |
- return child; |
8321 |
- device_del(child); |
8322 |
- } |
8323 |
-- |
8324 |
-+err: |
8325 |
- put_device(child); |
8326 |
- return NULL; |
8327 |
- } |
8328 |
-diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c |
8329 |
-index 452edd06d67d..99fd377f9b81 100644 |
8330 |
---- a/drivers/media/v4l2-core/v4l2-ctrls.c |
8331 |
-+++ b/drivers/media/v4l2-core/v4l2-ctrls.c |
8332 |
-@@ -1825,7 +1825,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, |
8333 |
- sizeof(p_hevc_pps->row_height_minus1)); |
8334 |
- |
8335 |
- p_hevc_pps->flags &= |
8336 |
-- ~V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED; |
8337 |
-+ ~V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED; |
8338 |
- } |
8339 |
- |
8340 |
- if (p_hevc_pps->flags & |
8341 |
-diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c |
8342 |
-index 857991cb3cbb..711979afd90a 100644 |
8343 |
---- a/drivers/mfd/stmfx.c |
8344 |
-+++ b/drivers/mfd/stmfx.c |
8345 |
-@@ -287,14 +287,21 @@ static int stmfx_irq_init(struct i2c_client *client) |
8346 |
- |
8347 |
- ret = regmap_write(stmfx->map, STMFX_REG_IRQ_OUT_PIN, irqoutpin); |
8348 |
- if (ret) |
8349 |
-- return ret; |
8350 |
-+ goto irq_exit; |
8351 |
- |
8352 |
- ret = devm_request_threaded_irq(stmfx->dev, client->irq, |
8353 |
- NULL, stmfx_irq_handler, |
8354 |
- irqtrigger | IRQF_ONESHOT, |
8355 |
- "stmfx", stmfx); |
8356 |
- if (ret) |
8357 |
-- stmfx_irq_exit(client); |
8358 |
-+ goto irq_exit; |
8359 |
-+ |
8360 |
-+ stmfx->irq = client->irq; |
8361 |
-+ |
8362 |
-+ return 0; |
8363 |
-+ |
8364 |
-+irq_exit: |
8365 |
-+ stmfx_irq_exit(client); |
8366 |
- |
8367 |
- return ret; |
8368 |
- } |
8369 |
-@@ -481,6 +488,8 @@ static int stmfx_suspend(struct device *dev) |
8370 |
- if (ret) |
8371 |
- return ret; |
8372 |
- |
8373 |
-+ disable_irq(stmfx->irq); |
8374 |
-+ |
8375 |
- if (stmfx->vdd) |
8376 |
- return regulator_disable(stmfx->vdd); |
8377 |
- |
8378 |
-@@ -501,6 +510,13 @@ static int stmfx_resume(struct device *dev) |
8379 |
- } |
8380 |
- } |
8381 |
- |
8382 |
-+ /* Reset STMFX - supply has been stopped during suspend */ |
8383 |
-+ ret = stmfx_chip_reset(stmfx); |
8384 |
-+ if (ret) { |
8385 |
-+ dev_err(stmfx->dev, "Failed to reset chip: %d\n", ret); |
8386 |
-+ return ret; |
8387 |
-+ } |
8388 |
-+ |
8389 |
- ret = regmap_raw_write(stmfx->map, STMFX_REG_SYS_CTRL, |
8390 |
- &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl)); |
8391 |
- if (ret) |
8392 |
-@@ -517,6 +533,8 @@ static int stmfx_resume(struct device *dev) |
8393 |
- if (ret) |
8394 |
- return ret; |
8395 |
- |
8396 |
-+ enable_irq(stmfx->irq); |
8397 |
-+ |
8398 |
- return 0; |
8399 |
- } |
8400 |
- #endif |
8401 |
-diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c |
8402 |
-index 90341f3c6810..da910302d51a 100644 |
8403 |
---- a/drivers/mfd/wcd934x.c |
8404 |
-+++ b/drivers/mfd/wcd934x.c |
8405 |
-@@ -280,7 +280,6 @@ static void wcd934x_slim_remove(struct slim_device *sdev) |
8406 |
- |
8407 |
- regulator_bulk_disable(WCD934X_MAX_SUPPLY, ddata->supplies); |
8408 |
- mfd_remove_devices(&sdev->dev); |
8409 |
-- kfree(ddata); |
8410 |
- } |
8411 |
- |
8412 |
- static const struct slim_device_id wcd934x_slim_id[] = { |
8413 |
-diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c |
8414 |
-index 1e9fe7d92597..737dede4a95c 100644 |
8415 |
---- a/drivers/mfd/wm8994-core.c |
8416 |
-+++ b/drivers/mfd/wm8994-core.c |
8417 |
-@@ -690,3 +690,4 @@ module_i2c_driver(wm8994_i2c_driver); |
8418 |
- MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC"); |
8419 |
- MODULE_LICENSE("GPL"); |
8420 |
- MODULE_AUTHOR("Mark Brown <broonie@×××××××××××××××××××××××.com>"); |
8421 |
-+MODULE_SOFTDEP("pre: wm8994_regulator"); |
8422 |
-diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c |
8423 |
-index e3e085e33d46..7939c55daceb 100644 |
8424 |
---- a/drivers/misc/fastrpc.c |
8425 |
-+++ b/drivers/misc/fastrpc.c |
8426 |
-@@ -904,6 +904,7 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, |
8427 |
- struct fastrpc_channel_ctx *cctx; |
8428 |
- struct fastrpc_user *fl = ctx->fl; |
8429 |
- struct fastrpc_msg *msg = &ctx->msg; |
8430 |
-+ int ret; |
8431 |
- |
8432 |
- cctx = fl->cctx; |
8433 |
- msg->pid = fl->tgid; |
8434 |
-@@ -919,7 +920,13 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, |
8435 |
- msg->size = roundup(ctx->msg_sz, PAGE_SIZE); |
8436 |
- fastrpc_context_get(ctx); |
8437 |
- |
8438 |
-- return rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); |
8439 |
-+ ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); |
8440 |
-+ |
8441 |
-+ if (ret) |
8442 |
-+ fastrpc_context_put(ctx); |
8443 |
-+ |
8444 |
-+ return ret; |
8445 |
-+ |
8446 |
- } |
8447 |
- |
8448 |
- static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, |
8449 |
-@@ -1613,8 +1620,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) |
8450 |
- domains[domain_id]); |
8451 |
- data->miscdev.fops = &fastrpc_fops; |
8452 |
- err = misc_register(&data->miscdev); |
8453 |
-- if (err) |
8454 |
-+ if (err) { |
8455 |
-+ kfree(data); |
8456 |
- return err; |
8457 |
-+ } |
8458 |
- |
8459 |
- kref_init(&data->refcount); |
8460 |
- |
8461 |
-diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c |
8462 |
-index aef4de36b7aa..6d9c298e02c7 100644 |
8463 |
---- a/drivers/misc/habanalabs/device.c |
8464 |
-+++ b/drivers/misc/habanalabs/device.c |
8465 |
-@@ -718,7 +718,7 @@ disable_device: |
8466 |
- return rc; |
8467 |
- } |
8468 |
- |
8469 |
--static void device_kill_open_processes(struct hl_device *hdev) |
8470 |
-+static int device_kill_open_processes(struct hl_device *hdev) |
8471 |
- { |
8472 |
- u16 pending_total, pending_cnt; |
8473 |
- struct hl_fpriv *hpriv; |
8474 |
-@@ -771,9 +771,7 @@ static void device_kill_open_processes(struct hl_device *hdev) |
8475 |
- ssleep(1); |
8476 |
- } |
8477 |
- |
8478 |
-- if (!list_empty(&hdev->fpriv_list)) |
8479 |
-- dev_crit(hdev->dev, |
8480 |
-- "Going to hard reset with open user contexts\n"); |
8481 |
-+ return list_empty(&hdev->fpriv_list) ? 0 : -EBUSY; |
8482 |
- } |
8483 |
- |
8484 |
- static void device_hard_reset_pending(struct work_struct *work) |
8485 |
-@@ -894,7 +892,12 @@ again: |
8486 |
- * process can't really exit until all its CSs are done, which |
8487 |
- * is what we do in cs rollback |
8488 |
- */ |
8489 |
-- device_kill_open_processes(hdev); |
8490 |
-+ rc = device_kill_open_processes(hdev); |
8491 |
-+ if (rc) { |
8492 |
-+ dev_crit(hdev->dev, |
8493 |
-+ "Failed to kill all open processes, stopping hard reset\n"); |
8494 |
-+ goto out_err; |
8495 |
-+ } |
8496 |
- |
8497 |
- /* Flush the Event queue workers to make sure no other thread is |
8498 |
- * reading or writing to registers during the reset |
8499 |
-@@ -1375,7 +1378,9 @@ void hl_device_fini(struct hl_device *hdev) |
8500 |
- * can't really exit until all its CSs are done, which is what we |
8501 |
- * do in cs rollback |
8502 |
- */ |
8503 |
-- device_kill_open_processes(hdev); |
8504 |
-+ rc = device_kill_open_processes(hdev); |
8505 |
-+ if (rc) |
8506 |
-+ dev_crit(hdev->dev, "Failed to kill all open processes\n"); |
8507 |
- |
8508 |
- hl_cb_pool_fini(hdev); |
8509 |
- |
8510 |
-diff --git a/drivers/misc/habanalabs/habanalabs.h b/drivers/misc/habanalabs/habanalabs.h |
8511 |
-index 31ebcf9458fe..a6dd8e6ca594 100644 |
8512 |
---- a/drivers/misc/habanalabs/habanalabs.h |
8513 |
-+++ b/drivers/misc/habanalabs/habanalabs.h |
8514 |
-@@ -23,7 +23,7 @@ |
8515 |
- |
8516 |
- #define HL_MMAP_CB_MASK (0x8000000000000000ull >> PAGE_SHIFT) |
8517 |
- |
8518 |
--#define HL_PENDING_RESET_PER_SEC 5 |
8519 |
-+#define HL_PENDING_RESET_PER_SEC 30 |
8520 |
- |
8521 |
- #define HL_DEVICE_TIMEOUT_USEC 1000000 /* 1 s */ |
8522 |
- |
8523 |
-diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c |
8524 |
-index 71bbaa56bdb5..e2766aad9e14 100644 |
8525 |
---- a/drivers/misc/xilinx_sdfec.c |
8526 |
-+++ b/drivers/misc/xilinx_sdfec.c |
8527 |
-@@ -602,10 +602,10 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
8528 |
- const u32 depth) |
8529 |
- { |
8530 |
- u32 reg = 0; |
8531 |
-- u32 res; |
8532 |
-- u32 n, i; |
8533 |
-+ int res, i, nr_pages; |
8534 |
-+ u32 n; |
8535 |
- u32 *addr = NULL; |
8536 |
-- struct page *page[MAX_NUM_PAGES]; |
8537 |
-+ struct page *pages[MAX_NUM_PAGES]; |
8538 |
- |
8539 |
- /* |
8540 |
- * Writes that go beyond the length of |
8541 |
-@@ -622,15 +622,22 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
8542 |
- if ((len * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE) |
8543 |
- n += 1; |
8544 |
- |
8545 |
-- res = get_user_pages_fast((unsigned long)src_ptr, n, 0, page); |
8546 |
-- if (res < n) { |
8547 |
-- for (i = 0; i < res; i++) |
8548 |
-- put_page(page[i]); |
8549 |
-+ if (WARN_ON_ONCE(n > INT_MAX)) |
8550 |
-+ return -EINVAL; |
8551 |
-+ |
8552 |
-+ nr_pages = n; |
8553 |
-+ |
8554 |
-+ res = get_user_pages_fast((unsigned long)src_ptr, nr_pages, 0, pages); |
8555 |
-+ if (res < nr_pages) { |
8556 |
-+ if (res > 0) { |
8557 |
-+ for (i = 0; i < res; i++) |
8558 |
-+ put_page(pages[i]); |
8559 |
-+ } |
8560 |
- return -EINVAL; |
8561 |
- } |
8562 |
- |
8563 |
-- for (i = 0; i < n; i++) { |
8564 |
-- addr = kmap(page[i]); |
8565 |
-+ for (i = 0; i < nr_pages; i++) { |
8566 |
-+ addr = kmap(pages[i]); |
8567 |
- do { |
8568 |
- xsdfec_regwrite(xsdfec, |
8569 |
- base_addr + ((offset + reg) * |
8570 |
-@@ -639,7 +646,7 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, |
8571 |
- reg++; |
8572 |
- } while ((reg < len) && |
8573 |
- ((reg * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE)); |
8574 |
-- put_page(page[i]); |
8575 |
-+ put_page(pages[i]); |
8576 |
- } |
8577 |
- return reg; |
8578 |
- } |
8579 |
-diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c |
8580 |
-index efd1a1d1f35e..5d3c691a1c66 100644 |
8581 |
---- a/drivers/net/bareudp.c |
8582 |
-+++ b/drivers/net/bareudp.c |
8583 |
-@@ -552,6 +552,8 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[], |
8584 |
- static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf, |
8585 |
- struct netlink_ext_ack *extack) |
8586 |
- { |
8587 |
-+ memset(conf, 0, sizeof(*conf)); |
8588 |
-+ |
8589 |
- if (!data[IFLA_BAREUDP_PORT]) { |
8590 |
- NL_SET_ERR_MSG(extack, "port not specified"); |
8591 |
- return -EINVAL; |
8592 |
-diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c |
8593 |
-index cf6fa8fede33..521ebc072903 100644 |
8594 |
---- a/drivers/net/dsa/lantiq_gswip.c |
8595 |
-+++ b/drivers/net/dsa/lantiq_gswip.c |
8596 |
-@@ -1452,7 +1452,8 @@ static void gswip_phylink_validate(struct dsa_switch *ds, int port, |
8597 |
- |
8598 |
- unsupported: |
8599 |
- bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS); |
8600 |
-- dev_err(ds->dev, "Unsupported interface: %d\n", state->interface); |
8601 |
-+ dev_err(ds->dev, "Unsupported interface '%s' for port %d\n", |
8602 |
-+ phy_modes(state->interface), port); |
8603 |
- return; |
8604 |
- } |
8605 |
- |
8606 |
-diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c |
8607 |
-index bc0e47c1dbb9..177134596458 100644 |
8608 |
---- a/drivers/net/dsa/sja1105/sja1105_ptp.c |
8609 |
-+++ b/drivers/net/dsa/sja1105/sja1105_ptp.c |
8610 |
-@@ -891,16 +891,16 @@ void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int port, |
8611 |
- |
8612 |
- mutex_lock(&ptp_data->lock); |
8613 |
- |
8614 |
-- rc = sja1105_ptpclkval_read(priv, &ticks, NULL); |
8615 |
-+ rc = sja1105_ptpegr_ts_poll(ds, port, &ts); |
8616 |
- if (rc < 0) { |
8617 |
-- dev_err(ds->dev, "Failed to read PTP clock: %d\n", rc); |
8618 |
-+ dev_err(ds->dev, "timed out polling for tstamp\n"); |
8619 |
- kfree_skb(skb); |
8620 |
- goto out; |
8621 |
- } |
8622 |
- |
8623 |
-- rc = sja1105_ptpegr_ts_poll(ds, port, &ts); |
8624 |
-+ rc = sja1105_ptpclkval_read(priv, &ticks, NULL); |
8625 |
- if (rc < 0) { |
8626 |
-- dev_err(ds->dev, "timed out polling for tstamp\n"); |
8627 |
-+ dev_err(ds->dev, "Failed to read PTP clock: %d\n", rc); |
8628 |
- kfree_skb(skb); |
8629 |
- goto out; |
8630 |
- } |
8631 |
-diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
8632 |
-index 58e0d9a781e9..19c4a0a5727a 100644 |
8633 |
---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
8634 |
-+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
8635 |
-@@ -10014,7 +10014,7 @@ static void bnxt_timer(struct timer_list *t) |
8636 |
- struct bnxt *bp = from_timer(bp, t, timer); |
8637 |
- struct net_device *dev = bp->dev; |
8638 |
- |
8639 |
-- if (!netif_running(dev)) |
8640 |
-+ if (!netif_running(dev) || !test_bit(BNXT_STATE_OPEN, &bp->state)) |
8641 |
- return; |
8642 |
- |
8643 |
- if (atomic_read(&bp->intr_sem) != 0) |
8644 |
-@@ -12097,19 +12097,9 @@ static int bnxt_resume(struct device *device) |
8645 |
- goto resume_exit; |
8646 |
- } |
8647 |
- |
8648 |
-- if (bnxt_hwrm_queue_qportcfg(bp)) { |
8649 |
-- rc = -ENODEV; |
8650 |
-+ rc = bnxt_hwrm_func_qcaps(bp); |
8651 |
-+ if (rc) |
8652 |
- goto resume_exit; |
8653 |
-- } |
8654 |
-- |
8655 |
-- if (bp->hwrm_spec_code >= 0x10803) { |
8656 |
-- if (bnxt_alloc_ctx_mem(bp)) { |
8657 |
-- rc = -ENODEV; |
8658 |
-- goto resume_exit; |
8659 |
-- } |
8660 |
-- } |
8661 |
-- if (BNXT_NEW_RM(bp)) |
8662 |
-- bnxt_hwrm_func_resc_qcaps(bp, false); |
8663 |
- |
8664 |
- if (bnxt_hwrm_func_drv_rgtr(bp, NULL, 0, false)) { |
8665 |
- rc = -ENODEV; |
8666 |
-@@ -12125,6 +12115,8 @@ static int bnxt_resume(struct device *device) |
8667 |
- |
8668 |
- resume_exit: |
8669 |
- bnxt_ulp_start(bp, rc); |
8670 |
-+ if (!rc) |
8671 |
-+ bnxt_reenable_sriov(bp); |
8672 |
- rtnl_unlock(); |
8673 |
- return rc; |
8674 |
- } |
8675 |
-@@ -12168,6 +12160,9 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, |
8676 |
- bnxt_close(netdev); |
8677 |
- |
8678 |
- pci_disable_device(pdev); |
8679 |
-+ bnxt_free_ctx_mem(bp); |
8680 |
-+ kfree(bp->ctx); |
8681 |
-+ bp->ctx = NULL; |
8682 |
- rtnl_unlock(); |
8683 |
- |
8684 |
- /* Request a slot slot reset. */ |
8685 |
-@@ -12201,12 +12196,16 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) |
8686 |
- pci_set_master(pdev); |
8687 |
- |
8688 |
- err = bnxt_hwrm_func_reset(bp); |
8689 |
-- if (!err && netif_running(netdev)) |
8690 |
-- err = bnxt_open(netdev); |
8691 |
-- |
8692 |
-- if (!err) |
8693 |
-- result = PCI_ERS_RESULT_RECOVERED; |
8694 |
-+ if (!err) { |
8695 |
-+ err = bnxt_hwrm_func_qcaps(bp); |
8696 |
-+ if (!err && netif_running(netdev)) |
8697 |
-+ err = bnxt_open(netdev); |
8698 |
-+ } |
8699 |
- bnxt_ulp_start(bp, err); |
8700 |
-+ if (!err) { |
8701 |
-+ bnxt_reenable_sriov(bp); |
8702 |
-+ result = PCI_ERS_RESULT_RECOVERED; |
8703 |
-+ } |
8704 |
- } |
8705 |
- |
8706 |
- if (result != PCI_ERS_RESULT_RECOVERED) { |
8707 |
-diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
8708 |
-index 9d868403d86c..cbaa1924afbe 100644 |
8709 |
---- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
8710 |
-+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c |
8711 |
-@@ -234,6 +234,11 @@ static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) |
8712 |
- |
8713 |
- /* Put it in the ring. */ |
8714 |
- p->rx_ring[p->rx_next_fill] = re.d64; |
8715 |
-+ /* Make sure there is no reorder of filling the ring and ringing |
8716 |
-+ * the bell |
8717 |
-+ */ |
8718 |
-+ wmb(); |
8719 |
-+ |
8720 |
- dma_sync_single_for_device(p->dev, p->rx_ring_handle, |
8721 |
- ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), |
8722 |
- DMA_BIDIRECTIONAL); |
8723 |
-diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
8724 |
-index 197dc5b2c090..1b4d04e4474b 100644 |
8725 |
---- a/drivers/net/ethernet/ibm/ibmvnic.c |
8726 |
-+++ b/drivers/net/ethernet/ibm/ibmvnic.c |
8727 |
-@@ -5184,6 +5184,9 @@ static int ibmvnic_remove(struct vio_dev *dev) |
8728 |
- adapter->state = VNIC_REMOVING; |
8729 |
- spin_unlock_irqrestore(&adapter->state_lock, flags); |
8730 |
- |
8731 |
-+ flush_work(&adapter->ibmvnic_reset); |
8732 |
-+ flush_delayed_work(&adapter->ibmvnic_delayed_reset); |
8733 |
-+ |
8734 |
- rtnl_lock(); |
8735 |
- unregister_netdevice(netdev); |
8736 |
- |
8737 |
-diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
8738 |
-index df3d50e759de..5e388d4a97a1 100644 |
8739 |
---- a/drivers/net/ethernet/intel/e1000e/netdev.c |
8740 |
-+++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
8741 |
-@@ -6518,11 +6518,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
8742 |
- struct net_device *netdev = pci_get_drvdata(pdev); |
8743 |
- struct e1000_adapter *adapter = netdev_priv(netdev); |
8744 |
- struct e1000_hw *hw = &adapter->hw; |
8745 |
-- u32 ctrl, ctrl_ext, rctl, status; |
8746 |
-- /* Runtime suspend should only enable wakeup for link changes */ |
8747 |
-- u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
8748 |
-+ u32 ctrl, ctrl_ext, rctl, status, wufc; |
8749 |
- int retval = 0; |
8750 |
- |
8751 |
-+ /* Runtime suspend should only enable wakeup for link changes */ |
8752 |
-+ if (runtime) |
8753 |
-+ wufc = E1000_WUFC_LNKC; |
8754 |
-+ else if (device_may_wakeup(&pdev->dev)) |
8755 |
-+ wufc = adapter->wol; |
8756 |
-+ else |
8757 |
-+ wufc = 0; |
8758 |
-+ |
8759 |
- status = er32(STATUS); |
8760 |
- if (status & E1000_STATUS_LU) |
8761 |
- wufc &= ~E1000_WUFC_LNKC; |
8762 |
-@@ -6579,7 +6585,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
8763 |
- if (adapter->hw.phy.type == e1000_phy_igp_3) { |
8764 |
- e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); |
8765 |
- } else if (hw->mac.type >= e1000_pch_lpt) { |
8766 |
-- if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) |
8767 |
-+ if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) |
8768 |
- /* ULP does not support wake from unicast, multicast |
8769 |
- * or broadcast. |
8770 |
- */ |
8771 |
-diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h |
8772 |
-index bcd11b4b29df..2d4ce6fdba1a 100644 |
8773 |
---- a/drivers/net/ethernet/intel/iavf/iavf.h |
8774 |
-+++ b/drivers/net/ethernet/intel/iavf/iavf.h |
8775 |
-@@ -87,6 +87,10 @@ struct iavf_vsi { |
8776 |
- #define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4) |
8777 |
- #define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */ |
8778 |
- |
8779 |
-+#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \ |
8780 |
-+ (IAVF_MAX_VF_VSI * \ |
8781 |
-+ sizeof(struct virtchnl_vsi_resource))) |
8782 |
-+ |
8783 |
- /* MAX_MSIX_Q_VECTORS of these are allocated, |
8784 |
- * but we only use one per queue-specific vector. |
8785 |
- */ |
8786 |
-@@ -306,6 +310,14 @@ struct iavf_adapter { |
8787 |
- bool netdev_registered; |
8788 |
- bool link_up; |
8789 |
- enum virtchnl_link_speed link_speed; |
8790 |
-+ /* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set |
8791 |
-+ * in vf_res->vf_cap_flags. Use ADV_LINK_SUPPORT macro to determine if |
8792 |
-+ * this field is valid. This field should be used going forward and the |
8793 |
-+ * enum virtchnl_link_speed above should be considered the legacy way of |
8794 |
-+ * storing/communicating link speeds. |
8795 |
-+ */ |
8796 |
-+ u32 link_speed_mbps; |
8797 |
-+ |
8798 |
- enum virtchnl_ops current_op; |
8799 |
- #define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \ |
8800 |
- (_a)->vf_res->vf_cap_flags & \ |
8801 |
-@@ -322,6 +334,8 @@ struct iavf_adapter { |
8802 |
- VIRTCHNL_VF_OFFLOAD_RSS_PF))) |
8803 |
- #define VLAN_ALLOWED(_a) ((_a)->vf_res->vf_cap_flags & \ |
8804 |
- VIRTCHNL_VF_OFFLOAD_VLAN) |
8805 |
-+#define ADV_LINK_SUPPORT(_a) ((_a)->vf_res->vf_cap_flags & \ |
8806 |
-+ VIRTCHNL_VF_CAP_ADV_LINK_SPEED) |
8807 |
- struct virtchnl_vf_resource *vf_res; /* incl. all VSIs */ |
8808 |
- struct virtchnl_vsi_resource *vsi_res; /* our LAN VSI */ |
8809 |
- struct virtchnl_version_info pf_version; |
8810 |
-diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
8811 |
-index 2c39d46b6138..40a3fc7c5ea5 100644 |
8812 |
---- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
8813 |
-+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c |
8814 |
-@@ -278,7 +278,18 @@ static int iavf_get_link_ksettings(struct net_device *netdev, |
8815 |
- ethtool_link_ksettings_zero_link_mode(cmd, supported); |
8816 |
- cmd->base.autoneg = AUTONEG_DISABLE; |
8817 |
- cmd->base.port = PORT_NONE; |
8818 |
-- /* Set speed and duplex */ |
8819 |
-+ cmd->base.duplex = DUPLEX_FULL; |
8820 |
-+ |
8821 |
-+ if (ADV_LINK_SUPPORT(adapter)) { |
8822 |
-+ if (adapter->link_speed_mbps && |
8823 |
-+ adapter->link_speed_mbps < U32_MAX) |
8824 |
-+ cmd->base.speed = adapter->link_speed_mbps; |
8825 |
-+ else |
8826 |
-+ cmd->base.speed = SPEED_UNKNOWN; |
8827 |
-+ |
8828 |
-+ return 0; |
8829 |
-+ } |
8830 |
-+ |
8831 |
- switch (adapter->link_speed) { |
8832 |
- case IAVF_LINK_SPEED_40GB: |
8833 |
- cmd->base.speed = SPEED_40000; |
8834 |
-@@ -306,7 +317,6 @@ static int iavf_get_link_ksettings(struct net_device *netdev, |
8835 |
- default: |
8836 |
- break; |
8837 |
- } |
8838 |
-- cmd->base.duplex = DUPLEX_FULL; |
8839 |
- |
8840 |
- return 0; |
8841 |
- } |
8842 |
-diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c |
8843 |
-index 2050649848ba..a21ae74bcd1b 100644 |
8844 |
---- a/drivers/net/ethernet/intel/iavf/iavf_main.c |
8845 |
-+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c |
8846 |
-@@ -1756,17 +1756,17 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) |
8847 |
- struct net_device *netdev = adapter->netdev; |
8848 |
- struct pci_dev *pdev = adapter->pdev; |
8849 |
- struct iavf_hw *hw = &adapter->hw; |
8850 |
-- int err = 0, bufsz; |
8851 |
-+ int err; |
8852 |
- |
8853 |
- WARN_ON(adapter->state != __IAVF_INIT_GET_RESOURCES); |
8854 |
- /* aq msg sent, awaiting reply */ |
8855 |
- if (!adapter->vf_res) { |
8856 |
-- bufsz = sizeof(struct virtchnl_vf_resource) + |
8857 |
-- (IAVF_MAX_VF_VSI * |
8858 |
-- sizeof(struct virtchnl_vsi_resource)); |
8859 |
-- adapter->vf_res = kzalloc(bufsz, GFP_KERNEL); |
8860 |
-- if (!adapter->vf_res) |
8861 |
-+ adapter->vf_res = kzalloc(IAVF_VIRTCHNL_VF_RESOURCE_SIZE, |
8862 |
-+ GFP_KERNEL); |
8863 |
-+ if (!adapter->vf_res) { |
8864 |
-+ err = -ENOMEM; |
8865 |
- goto err; |
8866 |
-+ } |
8867 |
- } |
8868 |
- err = iavf_get_vf_config(adapter); |
8869 |
- if (err == IAVF_ERR_ADMIN_QUEUE_NO_WORK) { |
8870 |
-@@ -2036,7 +2036,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) |
8871 |
- iavf_reset_interrupt_capability(adapter); |
8872 |
- iavf_free_queues(adapter); |
8873 |
- iavf_free_q_vectors(adapter); |
8874 |
-- kfree(adapter->vf_res); |
8875 |
-+ memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE); |
8876 |
- iavf_shutdown_adminq(&adapter->hw); |
8877 |
- adapter->netdev->flags &= ~IFF_UP; |
8878 |
- clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); |
8879 |
-@@ -2487,6 +2487,16 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, |
8880 |
- { |
8881 |
- int speed = 0, ret = 0; |
8882 |
- |
8883 |
-+ if (ADV_LINK_SUPPORT(adapter)) { |
8884 |
-+ if (adapter->link_speed_mbps < U32_MAX) { |
8885 |
-+ speed = adapter->link_speed_mbps; |
8886 |
-+ goto validate_bw; |
8887 |
-+ } else { |
8888 |
-+ dev_err(&adapter->pdev->dev, "Unknown link speed\n"); |
8889 |
-+ return -EINVAL; |
8890 |
-+ } |
8891 |
-+ } |
8892 |
-+ |
8893 |
- switch (adapter->link_speed) { |
8894 |
- case IAVF_LINK_SPEED_40GB: |
8895 |
- speed = 40000; |
8896 |
-@@ -2510,6 +2520,7 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, |
8897 |
- break; |
8898 |
- } |
8899 |
- |
8900 |
-+validate_bw: |
8901 |
- if (max_tx_rate > speed) { |
8902 |
- dev_err(&adapter->pdev->dev, |
8903 |
- "Invalid tx rate specified\n"); |
8904 |
-diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
8905 |
-index d58374c2c33d..ca79bec4ebd9 100644 |
8906 |
---- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
8907 |
-+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c |
8908 |
-@@ -139,7 +139,8 @@ int iavf_send_vf_config_msg(struct iavf_adapter *adapter) |
8909 |
- VIRTCHNL_VF_OFFLOAD_ENCAP | |
8910 |
- VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM | |
8911 |
- VIRTCHNL_VF_OFFLOAD_REQ_QUEUES | |
8912 |
-- VIRTCHNL_VF_OFFLOAD_ADQ; |
8913 |
-+ VIRTCHNL_VF_OFFLOAD_ADQ | |
8914 |
-+ VIRTCHNL_VF_CAP_ADV_LINK_SPEED; |
8915 |
- |
8916 |
- adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; |
8917 |
- adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; |
8918 |
-@@ -891,6 +892,8 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) |
8919 |
- iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); |
8920 |
- } |
8921 |
- |
8922 |
-+#define IAVF_MAX_SPEED_STRLEN 13 |
8923 |
-+ |
8924 |
- /** |
8925 |
- * iavf_print_link_message - print link up or down |
8926 |
- * @adapter: adapter structure |
8927 |
-@@ -900,37 +903,99 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) |
8928 |
- static void iavf_print_link_message(struct iavf_adapter *adapter) |
8929 |
- { |
8930 |
- struct net_device *netdev = adapter->netdev; |
8931 |
-- char *speed = "Unknown "; |
8932 |
-+ int link_speed_mbps; |
8933 |
-+ char *speed; |
8934 |
- |
8935 |
- if (!adapter->link_up) { |
8936 |
- netdev_info(netdev, "NIC Link is Down\n"); |
8937 |
- return; |
8938 |
- } |
8939 |
- |
8940 |
-+ speed = kcalloc(1, IAVF_MAX_SPEED_STRLEN, GFP_KERNEL); |
8941 |
-+ if (!speed) |
8942 |
-+ return; |
8943 |
-+ |
8944 |
-+ if (ADV_LINK_SUPPORT(adapter)) { |
8945 |
-+ link_speed_mbps = adapter->link_speed_mbps; |
8946 |
-+ goto print_link_msg; |
8947 |
-+ } |
8948 |
-+ |
8949 |
- switch (adapter->link_speed) { |
8950 |
- case IAVF_LINK_SPEED_40GB: |
8951 |
-- speed = "40 G"; |
8952 |
-+ link_speed_mbps = SPEED_40000; |
8953 |
- break; |
8954 |
- case IAVF_LINK_SPEED_25GB: |
8955 |
-- speed = "25 G"; |
8956 |
-+ link_speed_mbps = SPEED_25000; |
8957 |
- break; |
8958 |
- case IAVF_LINK_SPEED_20GB: |
8959 |
-- speed = "20 G"; |
8960 |
-+ link_speed_mbps = SPEED_20000; |
8961 |
- break; |
8962 |
- case IAVF_LINK_SPEED_10GB: |
8963 |
-- speed = "10 G"; |
8964 |
-+ link_speed_mbps = SPEED_10000; |
8965 |
- break; |
8966 |
- case IAVF_LINK_SPEED_1GB: |
8967 |
-- speed = "1000 M"; |
8968 |
-+ link_speed_mbps = SPEED_1000; |
8969 |
- break; |
8970 |
- case IAVF_LINK_SPEED_100MB: |
8971 |
-- speed = "100 M"; |
8972 |
-+ link_speed_mbps = SPEED_100; |
8973 |
- break; |
8974 |
- default: |
8975 |
-+ link_speed_mbps = SPEED_UNKNOWN; |
8976 |
- break; |
8977 |
- } |
8978 |
- |
8979 |
-- netdev_info(netdev, "NIC Link is Up %sbps Full Duplex\n", speed); |
8980 |
-+print_link_msg: |
8981 |
-+ if (link_speed_mbps > SPEED_1000) { |
8982 |
-+ if (link_speed_mbps == SPEED_2500) |
8983 |
-+ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "2.5 Gbps"); |
8984 |
-+ else |
8985 |
-+ /* convert to Gbps inline */ |
8986 |
-+ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s", |
8987 |
-+ link_speed_mbps / 1000, "Gbps"); |
8988 |
-+ } else if (link_speed_mbps == SPEED_UNKNOWN) { |
8989 |
-+ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%s", "Unknown Mbps"); |
8990 |
-+ } else { |
8991 |
-+ snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%u %s", |
8992 |
-+ link_speed_mbps, "Mbps"); |
8993 |
-+ } |
8994 |
-+ |
8995 |
-+ netdev_info(netdev, "NIC Link is Up Speed is %s Full Duplex\n", speed); |
8996 |
-+ kfree(speed); |
8997 |
-+} |
8998 |
-+ |
8999 |
-+/** |
9000 |
-+ * iavf_get_vpe_link_status |
9001 |
-+ * @adapter: adapter structure |
9002 |
-+ * @vpe: virtchnl_pf_event structure |
9003 |
-+ * |
9004 |
-+ * Helper function for determining the link status |
9005 |
-+ **/ |
9006 |
-+static bool |
9007 |
-+iavf_get_vpe_link_status(struct iavf_adapter *adapter, |
9008 |
-+ struct virtchnl_pf_event *vpe) |
9009 |
-+{ |
9010 |
-+ if (ADV_LINK_SUPPORT(adapter)) |
9011 |
-+ return vpe->event_data.link_event_adv.link_status; |
9012 |
-+ else |
9013 |
-+ return vpe->event_data.link_event.link_status; |
9014 |
-+} |
9015 |
-+ |
9016 |
-+/** |
9017 |
-+ * iavf_set_adapter_link_speed_from_vpe |
9018 |
-+ * @adapter: adapter structure for which we are setting the link speed |
9019 |
-+ * @vpe: virtchnl_pf_event structure that contains the link speed we are setting |
9020 |
-+ * |
9021 |
-+ * Helper function for setting iavf_adapter link speed |
9022 |
-+ **/ |
9023 |
-+static void |
9024 |
-+iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, |
9025 |
-+ struct virtchnl_pf_event *vpe) |
9026 |
-+{ |
9027 |
-+ if (ADV_LINK_SUPPORT(adapter)) |
9028 |
-+ adapter->link_speed_mbps = |
9029 |
-+ vpe->event_data.link_event_adv.link_speed; |
9030 |
-+ else |
9031 |
-+ adapter->link_speed = vpe->event_data.link_event.link_speed; |
9032 |
- } |
9033 |
- |
9034 |
- /** |
9035 |
-@@ -1160,12 +1225,11 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, |
9036 |
- if (v_opcode == VIRTCHNL_OP_EVENT) { |
9037 |
- struct virtchnl_pf_event *vpe = |
9038 |
- (struct virtchnl_pf_event *)msg; |
9039 |
-- bool link_up = vpe->event_data.link_event.link_status; |
9040 |
-+ bool link_up = iavf_get_vpe_link_status(adapter, vpe); |
9041 |
- |
9042 |
- switch (vpe->event) { |
9043 |
- case VIRTCHNL_EVENT_LINK_CHANGE: |
9044 |
-- adapter->link_speed = |
9045 |
-- vpe->event_data.link_event.link_speed; |
9046 |
-+ iavf_set_adapter_link_speed_from_vpe(adapter, vpe); |
9047 |
- |
9048 |
- /* we've already got the right link status, bail */ |
9049 |
- if (adapter->link_up == link_up) |
9050 |
-diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9051 |
-index 2b5dad2ec650..b7b553602ea9 100644 |
9052 |
---- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9053 |
-+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
9054 |
-@@ -5983,8 +5983,8 @@ static int mvpp2_remove(struct platform_device *pdev) |
9055 |
- { |
9056 |
- struct mvpp2 *priv = platform_get_drvdata(pdev); |
9057 |
- struct fwnode_handle *fwnode = pdev->dev.fwnode; |
9058 |
-+ int i = 0, poolnum = MVPP2_BM_POOLS_NUM; |
9059 |
- struct fwnode_handle *port_fwnode; |
9060 |
-- int i = 0; |
9061 |
- |
9062 |
- mvpp2_dbgfs_cleanup(priv); |
9063 |
- |
9064 |
-@@ -5998,7 +5998,10 @@ static int mvpp2_remove(struct platform_device *pdev) |
9065 |
- |
9066 |
- destroy_workqueue(priv->stats_queue); |
9067 |
- |
9068 |
-- for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { |
9069 |
-+ if (priv->percpu_pools) |
9070 |
-+ poolnum = mvpp2_get_nrxqs(priv) * 2; |
9071 |
-+ |
9072 |
-+ for (i = 0; i < poolnum; i++) { |
9073 |
- struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i]; |
9074 |
- |
9075 |
- mvpp2_bm_pool_destroy(&pdev->dev, priv, bm_pool); |
9076 |
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
9077 |
-index 18719acb7e54..eff8bb64899d 100644 |
9078 |
---- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
9079 |
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c |
9080 |
-@@ -181,7 +181,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, |
9081 |
- in, pas)); |
9082 |
- |
9083 |
- err = mlx5_core_create_qp(mdev, &dr_qp->mqp, in, inlen); |
9084 |
-- kfree(in); |
9085 |
-+ kvfree(in); |
9086 |
- |
9087 |
- if (err) { |
9088 |
- mlx5_core_warn(mdev, " Can't create QP\n"); |
9089 |
-diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9090 |
-index 6b39978acd07..3e4199246a18 100644 |
9091 |
---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9092 |
-+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
9093 |
-@@ -990,8 +990,10 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu, |
9094 |
- |
9095 |
- lossy = !(pfc || pause_en); |
9096 |
- thres_cells = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu); |
9097 |
-+ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, &thres_cells); |
9098 |
- delay_cells = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay, |
9099 |
- pfc, pause_en); |
9100 |
-+ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, &delay_cells); |
9101 |
- total_cells = thres_cells + delay_cells; |
9102 |
- |
9103 |
- taken_headroom_cells += total_cells; |
9104 |
-diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
9105 |
-index ca56e72cb4b7..e28ecb84b816 100644 |
9106 |
---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
9107 |
-+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
9108 |
-@@ -395,6 +395,19 @@ mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port, |
9109 |
- return NULL; |
9110 |
- } |
9111 |
- |
9112 |
-+static inline void |
9113 |
-+mlxsw_sp_port_headroom_8x_adjust(const struct mlxsw_sp_port *mlxsw_sp_port, |
9114 |
-+ u16 *p_size) |
9115 |
-+{ |
9116 |
-+ /* Ports with eight lanes use two headroom buffers between which the |
9117 |
-+ * configured headroom size is split. Therefore, multiply the calculated |
9118 |
-+ * headroom size by two. |
9119 |
-+ */ |
9120 |
-+ if (mlxsw_sp_port->mapping.width != 8) |
9121 |
-+ return; |
9122 |
-+ *p_size *= 2; |
9123 |
-+} |
9124 |
-+ |
9125 |
- enum mlxsw_sp_flood_type { |
9126 |
- MLXSW_SP_FLOOD_TYPE_UC, |
9127 |
- MLXSW_SP_FLOOD_TYPE_BC, |
9128 |
-diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c |
9129 |
-index 968f0902e4fe..19bf0768ed78 100644 |
9130 |
---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c |
9131 |
-+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c |
9132 |
-@@ -312,6 +312,7 @@ static int mlxsw_sp_port_pb_init(struct mlxsw_sp_port *mlxsw_sp_port) |
9133 |
- |
9134 |
- if (i == MLXSW_SP_PB_UNUSED) |
9135 |
- continue; |
9136 |
-+ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, &size); |
9137 |
- mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, i, size); |
9138 |
- } |
9139 |
- mlxsw_reg_pbmc_lossy_buffer_pack(pbmc_pl, |
9140 |
-diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c |
9141 |
-index 9fb2e9d93929..7c5032f9c8ff 100644 |
9142 |
---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c |
9143 |
-+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c |
9144 |
-@@ -776,6 +776,7 @@ mlxsw_sp_span_port_buffsize_update(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) |
9145 |
- speed = 0; |
9146 |
- |
9147 |
- buffsize = mlxsw_sp_span_buffsize_get(mlxsw_sp, speed, mtu); |
9148 |
-+ mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize); |
9149 |
- mlxsw_reg_sbib_pack(sbib_pl, mlxsw_sp_port->local_port, buffsize); |
9150 |
- return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); |
9151 |
- } |
9152 |
-diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
9153 |
-index 6b461be1820b..75266580b586 100644 |
9154 |
---- a/drivers/net/geneve.c |
9155 |
-+++ b/drivers/net/geneve.c |
9156 |
-@@ -987,9 +987,10 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) |
9157 |
- if (geneve->collect_md) { |
9158 |
- info = skb_tunnel_info(skb); |
9159 |
- if (unlikely(!info || !(info->mode & IP_TUNNEL_INFO_TX))) { |
9160 |
-- err = -EINVAL; |
9161 |
- netdev_dbg(dev, "no tunnel metadata\n"); |
9162 |
-- goto tx_error; |
9163 |
-+ dev_kfree_skb(skb); |
9164 |
-+ dev->stats.tx_dropped++; |
9165 |
-+ return NETDEV_TX_OK; |
9166 |
- } |
9167 |
- } else { |
9168 |
- info = &geneve->info; |
9169 |
-@@ -1006,7 +1007,7 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) |
9170 |
- |
9171 |
- if (likely(!err)) |
9172 |
- return NETDEV_TX_OK; |
9173 |
--tx_error: |
9174 |
-+ |
9175 |
- dev_kfree_skb(skb); |
9176 |
- |
9177 |
- if (err == -ELOOP) |
9178 |
-diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c |
9179 |
-index 71cdef9fb56b..5ab53e9942f3 100644 |
9180 |
---- a/drivers/net/hamradio/yam.c |
9181 |
-+++ b/drivers/net/hamradio/yam.c |
9182 |
-@@ -1133,6 +1133,7 @@ static int __init yam_init_driver(void) |
9183 |
- err = register_netdev(dev); |
9184 |
- if (err) { |
9185 |
- printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name); |
9186 |
-+ free_netdev(dev); |
9187 |
- goto error; |
9188 |
- } |
9189 |
- yam_devs[i] = dev; |
9190 |
-diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c |
9191 |
-index a21534f1462f..1d823ac0f6d6 100644 |
9192 |
---- a/drivers/net/ipa/ipa_endpoint.c |
9193 |
-+++ b/drivers/net/ipa/ipa_endpoint.c |
9194 |
-@@ -669,10 +669,12 @@ static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) |
9195 |
- u32 seq_type = endpoint->seq_type; |
9196 |
- u32 val = 0; |
9197 |
- |
9198 |
-+ /* Sequencer type is made up of four nibbles */ |
9199 |
- val |= u32_encode_bits(seq_type & 0xf, HPS_SEQ_TYPE_FMASK); |
9200 |
- val |= u32_encode_bits((seq_type >> 4) & 0xf, DPS_SEQ_TYPE_FMASK); |
9201 |
-- /* HPS_REP_SEQ_TYPE is 0 */ |
9202 |
-- /* DPS_REP_SEQ_TYPE is 0 */ |
9203 |
-+ /* The second two apply to replicated packets */ |
9204 |
-+ val |= u32_encode_bits((seq_type >> 8) & 0xf, HPS_REP_SEQ_TYPE_FMASK); |
9205 |
-+ val |= u32_encode_bits((seq_type >> 12) & 0xf, DPS_REP_SEQ_TYPE_FMASK); |
9206 |
- |
9207 |
- iowrite32(val, endpoint->ipa->reg_virt + offset); |
9208 |
- } |
9209 |
-diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h |
9210 |
-index 3b8106aa277a..0a688d8c1d7c 100644 |
9211 |
---- a/drivers/net/ipa/ipa_reg.h |
9212 |
-+++ b/drivers/net/ipa/ipa_reg.h |
9213 |
-@@ -455,6 +455,8 @@ enum ipa_mode { |
9214 |
- * second packet processing pass + no decipher + microcontroller |
9215 |
- * @IPA_SEQ_DMA_DEC: DMA + cipher/decipher |
9216 |
- * @IPA_SEQ_DMA_COMP_DECOMP: DMA + compression/decompression |
9217 |
-+ * @IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP: |
9218 |
-+ * packet processing + no decipher + no uCP + HPS REP DMA parser |
9219 |
- * @IPA_SEQ_INVALID: invalid sequencer type |
9220 |
- * |
9221 |
- * The values defined here are broken into 4-bit nibbles that are written |
9222 |
-diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c |
9223 |
-index b55e3c0403ed..ddac79960ea7 100644 |
9224 |
---- a/drivers/net/phy/dp83867.c |
9225 |
-+++ b/drivers/net/phy/dp83867.c |
9226 |
-@@ -488,7 +488,7 @@ static int dp83867_verify_rgmii_cfg(struct phy_device *phydev) |
9227 |
- return 0; |
9228 |
- } |
9229 |
- |
9230 |
--#ifdef CONFIG_OF_MDIO |
9231 |
-+#if IS_ENABLED(CONFIG_OF_MDIO) |
9232 |
- static int dp83867_of_init(struct phy_device *phydev) |
9233 |
- { |
9234 |
- struct dp83867_private *dp83867 = phydev->priv; |
9235 |
-diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
9236 |
-index 7fc8e10c5f33..a435f7352cfb 100644 |
9237 |
---- a/drivers/net/phy/marvell.c |
9238 |
-+++ b/drivers/net/phy/marvell.c |
9239 |
-@@ -337,7 +337,7 @@ static int m88e1101_config_aneg(struct phy_device *phydev) |
9240 |
- return marvell_config_aneg(phydev); |
9241 |
- } |
9242 |
- |
9243 |
--#ifdef CONFIG_OF_MDIO |
9244 |
-+#if IS_ENABLED(CONFIG_OF_MDIO) |
9245 |
- /* Set and/or override some configuration registers based on the |
9246 |
- * marvell,reg-init property stored in the of_node for the phydev. |
9247 |
- * |
9248 |
-diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
9249 |
-index 7a4eb3f2cb74..a1a4dee2a033 100644 |
9250 |
---- a/drivers/net/phy/mdio_bus.c |
9251 |
-+++ b/drivers/net/phy/mdio_bus.c |
9252 |
-@@ -757,6 +757,7 @@ EXPORT_SYMBOL(mdiobus_scan); |
9253 |
- |
9254 |
- static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) |
9255 |
- { |
9256 |
-+ preempt_disable(); |
9257 |
- u64_stats_update_begin(&stats->syncp); |
9258 |
- |
9259 |
- u64_stats_inc(&stats->transfers); |
9260 |
-@@ -771,6 +772,7 @@ static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) |
9261 |
- u64_stats_inc(&stats->writes); |
9262 |
- out: |
9263 |
- u64_stats_update_end(&stats->syncp); |
9264 |
-+ preempt_enable(); |
9265 |
- } |
9266 |
- |
9267 |
- /** |
9268 |
-diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h |
9269 |
-index 414e3b31bb1f..132f9bf49198 100644 |
9270 |
---- a/drivers/net/phy/mscc/mscc.h |
9271 |
-+++ b/drivers/net/phy/mscc/mscc.h |
9272 |
-@@ -375,7 +375,7 @@ struct vsc8531_private { |
9273 |
- #endif |
9274 |
- }; |
9275 |
- |
9276 |
--#ifdef CONFIG_OF_MDIO |
9277 |
-+#if IS_ENABLED(CONFIG_OF_MDIO) |
9278 |
- struct vsc8531_edge_rate_table { |
9279 |
- u32 vddmac; |
9280 |
- u32 slowdown[8]; |
9281 |
-diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c |
9282 |
-index c8aa6d905d8e..485a4f8a6a9a 100644 |
9283 |
---- a/drivers/net/phy/mscc/mscc_main.c |
9284 |
-+++ b/drivers/net/phy/mscc/mscc_main.c |
9285 |
-@@ -98,7 +98,7 @@ static const struct vsc85xx_hw_stat vsc8584_hw_stats[] = { |
9286 |
- }, |
9287 |
- }; |
9288 |
- |
9289 |
--#ifdef CONFIG_OF_MDIO |
9290 |
-+#if IS_ENABLED(CONFIG_OF_MDIO) |
9291 |
- static const struct vsc8531_edge_rate_table edge_table[] = { |
9292 |
- {MSCC_VDDMAC_3300, { 0, 2, 4, 7, 10, 17, 29, 53} }, |
9293 |
- {MSCC_VDDMAC_2500, { 0, 3, 6, 10, 14, 23, 37, 63} }, |
9294 |
-@@ -382,7 +382,7 @@ out_unlock: |
9295 |
- mutex_unlock(&phydev->lock); |
9296 |
- } |
9297 |
- |
9298 |
--#ifdef CONFIG_OF_MDIO |
9299 |
-+#if IS_ENABLED(CONFIG_OF_MDIO) |
9300 |
- static int vsc85xx_edge_rate_magic_get(struct phy_device *phydev) |
9301 |
- { |
9302 |
- u32 vdd, sd; |
9303 |
-diff --git a/drivers/ntb/core.c b/drivers/ntb/core.c |
9304 |
-index 2581ab724c34..f8f75a504a58 100644 |
9305 |
---- a/drivers/ntb/core.c |
9306 |
-+++ b/drivers/ntb/core.c |
9307 |
-@@ -214,10 +214,8 @@ int ntb_default_port_number(struct ntb_dev *ntb) |
9308 |
- case NTB_TOPO_B2B_DSD: |
9309 |
- return NTB_PORT_SEC_DSD; |
9310 |
- default: |
9311 |
-- break; |
9312 |
-+ return 0; |
9313 |
- } |
9314 |
-- |
9315 |
-- return -EINVAL; |
9316 |
- } |
9317 |
- EXPORT_SYMBOL(ntb_default_port_number); |
9318 |
- |
9319 |
-@@ -240,10 +238,8 @@ int ntb_default_peer_port_number(struct ntb_dev *ntb, int pidx) |
9320 |
- case NTB_TOPO_B2B_DSD: |
9321 |
- return NTB_PORT_PRI_USD; |
9322 |
- default: |
9323 |
-- break; |
9324 |
-+ return 0; |
9325 |
- } |
9326 |
-- |
9327 |
-- return -EINVAL; |
9328 |
- } |
9329 |
- EXPORT_SYMBOL(ntb_default_peer_port_number); |
9330 |
- |
9331 |
-@@ -315,4 +311,3 @@ static void __exit ntb_driver_exit(void) |
9332 |
- bus_unregister(&ntb_bus); |
9333 |
- } |
9334 |
- module_exit(ntb_driver_exit); |
9335 |
-- |
9336 |
-diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c |
9337 |
-index 972f6d984f6d..528751803419 100644 |
9338 |
---- a/drivers/ntb/test/ntb_perf.c |
9339 |
-+++ b/drivers/ntb/test/ntb_perf.c |
9340 |
-@@ -159,6 +159,8 @@ struct perf_peer { |
9341 |
- /* NTB connection setup service */ |
9342 |
- struct work_struct service; |
9343 |
- unsigned long sts; |
9344 |
-+ |
9345 |
-+ struct completion init_comp; |
9346 |
- }; |
9347 |
- #define to_peer_service(__work) \ |
9348 |
- container_of(__work, struct perf_peer, service) |
9349 |
-@@ -547,6 +549,7 @@ static int perf_setup_outbuf(struct perf_peer *peer) |
9350 |
- |
9351 |
- /* Initialization is finally done */ |
9352 |
- set_bit(PERF_STS_DONE, &peer->sts); |
9353 |
-+ complete_all(&peer->init_comp); |
9354 |
- |
9355 |
- return 0; |
9356 |
- } |
9357 |
-@@ -557,7 +560,7 @@ static void perf_free_inbuf(struct perf_peer *peer) |
9358 |
- return; |
9359 |
- |
9360 |
- (void)ntb_mw_clear_trans(peer->perf->ntb, peer->pidx, peer->gidx); |
9361 |
-- dma_free_coherent(&peer->perf->ntb->dev, peer->inbuf_size, |
9362 |
-+ dma_free_coherent(&peer->perf->ntb->pdev->dev, peer->inbuf_size, |
9363 |
- peer->inbuf, peer->inbuf_xlat); |
9364 |
- peer->inbuf = NULL; |
9365 |
- } |
9366 |
-@@ -586,8 +589,9 @@ static int perf_setup_inbuf(struct perf_peer *peer) |
9367 |
- |
9368 |
- perf_free_inbuf(peer); |
9369 |
- |
9370 |
-- peer->inbuf = dma_alloc_coherent(&perf->ntb->dev, peer->inbuf_size, |
9371 |
-- &peer->inbuf_xlat, GFP_KERNEL); |
9372 |
-+ peer->inbuf = dma_alloc_coherent(&perf->ntb->pdev->dev, |
9373 |
-+ peer->inbuf_size, &peer->inbuf_xlat, |
9374 |
-+ GFP_KERNEL); |
9375 |
- if (!peer->inbuf) { |
9376 |
- dev_err(&perf->ntb->dev, "Failed to alloc inbuf of %pa\n", |
9377 |
- &peer->inbuf_size); |
9378 |
-@@ -637,6 +641,7 @@ static void perf_service_work(struct work_struct *work) |
9379 |
- perf_setup_outbuf(peer); |
9380 |
- |
9381 |
- if (test_and_clear_bit(PERF_CMD_CLEAR, &peer->sts)) { |
9382 |
-+ init_completion(&peer->init_comp); |
9383 |
- clear_bit(PERF_STS_DONE, &peer->sts); |
9384 |
- if (test_bit(0, &peer->perf->busy_flag) && |
9385 |
- peer == peer->perf->test_peer) { |
9386 |
-@@ -653,7 +658,7 @@ static int perf_init_service(struct perf_ctx *perf) |
9387 |
- { |
9388 |
- u64 mask; |
9389 |
- |
9390 |
-- if (ntb_peer_mw_count(perf->ntb) < perf->pcnt + 1) { |
9391 |
-+ if (ntb_peer_mw_count(perf->ntb) < perf->pcnt) { |
9392 |
- dev_err(&perf->ntb->dev, "Not enough memory windows\n"); |
9393 |
- return -EINVAL; |
9394 |
- } |
9395 |
-@@ -1083,8 +1088,9 @@ static int perf_submit_test(struct perf_peer *peer) |
9396 |
- struct perf_thread *pthr; |
9397 |
- int tidx, ret; |
9398 |
- |
9399 |
-- if (!test_bit(PERF_STS_DONE, &peer->sts)) |
9400 |
-- return -ENOLINK; |
9401 |
-+ ret = wait_for_completion_interruptible(&peer->init_comp); |
9402 |
-+ if (ret < 0) |
9403 |
-+ return ret; |
9404 |
- |
9405 |
- if (test_and_set_bit_lock(0, &perf->busy_flag)) |
9406 |
- return -EBUSY; |
9407 |
-@@ -1455,10 +1461,21 @@ static int perf_init_peers(struct perf_ctx *perf) |
9408 |
- peer->gidx = pidx; |
9409 |
- } |
9410 |
- INIT_WORK(&peer->service, perf_service_work); |
9411 |
-+ init_completion(&peer->init_comp); |
9412 |
- } |
9413 |
- if (perf->gidx == -1) |
9414 |
- perf->gidx = pidx; |
9415 |
- |
9416 |
-+ /* |
9417 |
-+ * Hardware with only two ports may not have unique port |
9418 |
-+ * numbers. In this case, the gidxs should all be zero. |
9419 |
-+ */ |
9420 |
-+ if (perf->pcnt == 1 && ntb_port_number(perf->ntb) == 0 && |
9421 |
-+ ntb_peer_port_number(perf->ntb, 0) == 0) { |
9422 |
-+ perf->gidx = 0; |
9423 |
-+ perf->peers[0].gidx = 0; |
9424 |
-+ } |
9425 |
-+ |
9426 |
- for (pidx = 0; pidx < perf->pcnt; pidx++) { |
9427 |
- ret = perf_setup_peer_mw(&perf->peers[pidx]); |
9428 |
- if (ret) |
9429 |
-@@ -1554,4 +1571,3 @@ static void __exit perf_exit(void) |
9430 |
- destroy_workqueue(perf_wq); |
9431 |
- } |
9432 |
- module_exit(perf_exit); |
9433 |
-- |
9434 |
-diff --git a/drivers/ntb/test/ntb_pingpong.c b/drivers/ntb/test/ntb_pingpong.c |
9435 |
-index 04dd46647db3..2164e8492772 100644 |
9436 |
---- a/drivers/ntb/test/ntb_pingpong.c |
9437 |
-+++ b/drivers/ntb/test/ntb_pingpong.c |
9438 |
-@@ -121,15 +121,14 @@ static int pp_find_next_peer(struct pp_ctx *pp) |
9439 |
- link = ntb_link_is_up(pp->ntb, NULL, NULL); |
9440 |
- |
9441 |
- /* Find next available peer */ |
9442 |
-- if (link & pp->nmask) { |
9443 |
-+ if (link & pp->nmask) |
9444 |
- pidx = __ffs64(link & pp->nmask); |
9445 |
-- out_db = BIT_ULL(pidx + 1); |
9446 |
-- } else if (link & pp->pmask) { |
9447 |
-+ else if (link & pp->pmask) |
9448 |
- pidx = __ffs64(link & pp->pmask); |
9449 |
-- out_db = BIT_ULL(pidx); |
9450 |
-- } else { |
9451 |
-+ else |
9452 |
- return -ENODEV; |
9453 |
-- } |
9454 |
-+ |
9455 |
-+ out_db = BIT_ULL(ntb_peer_port_number(pp->ntb, pidx)); |
9456 |
- |
9457 |
- spin_lock(&pp->lock); |
9458 |
- pp->out_pidx = pidx; |
9459 |
-@@ -303,7 +302,7 @@ static void pp_init_flds(struct pp_ctx *pp) |
9460 |
- break; |
9461 |
- } |
9462 |
- |
9463 |
-- pp->in_db = BIT_ULL(pidx); |
9464 |
-+ pp->in_db = BIT_ULL(lport); |
9465 |
- pp->pmask = GENMASK_ULL(pidx, 0) >> 1; |
9466 |
- pp->nmask = GENMASK_ULL(pcnt - 1, pidx); |
9467 |
- |
9468 |
-@@ -432,4 +431,3 @@ static void __exit pp_exit(void) |
9469 |
- debugfs_remove_recursive(pp_dbgfs_topdir); |
9470 |
- } |
9471 |
- module_exit(pp_exit); |
9472 |
-- |
9473 |
-diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c |
9474 |
-index 69da758fe64c..b7bf3f863d79 100644 |
9475 |
---- a/drivers/ntb/test/ntb_tool.c |
9476 |
-+++ b/drivers/ntb/test/ntb_tool.c |
9477 |
-@@ -504,7 +504,7 @@ static ssize_t tool_peer_link_read(struct file *filep, char __user *ubuf, |
9478 |
- buf[1] = '\n'; |
9479 |
- buf[2] = '\0'; |
9480 |
- |
9481 |
-- return simple_read_from_buffer(ubuf, size, offp, buf, 3); |
9482 |
-+ return simple_read_from_buffer(ubuf, size, offp, buf, 2); |
9483 |
- } |
9484 |
- |
9485 |
- static TOOL_FOPS_RDWR(tool_peer_link_fops, |
9486 |
-@@ -590,7 +590,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, |
9487 |
- inmw->size = min_t(resource_size_t, req_size, size); |
9488 |
- inmw->size = round_up(inmw->size, addr_align); |
9489 |
- inmw->size = round_up(inmw->size, size_align); |
9490 |
-- inmw->mm_base = dma_alloc_coherent(&tc->ntb->dev, inmw->size, |
9491 |
-+ inmw->mm_base = dma_alloc_coherent(&tc->ntb->pdev->dev, inmw->size, |
9492 |
- &inmw->dma_base, GFP_KERNEL); |
9493 |
- if (!inmw->mm_base) |
9494 |
- return -ENOMEM; |
9495 |
-@@ -612,7 +612,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, |
9496 |
- return 0; |
9497 |
- |
9498 |
- err_free_dma: |
9499 |
-- dma_free_coherent(&tc->ntb->dev, inmw->size, inmw->mm_base, |
9500 |
-+ dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, |
9501 |
- inmw->dma_base); |
9502 |
- inmw->mm_base = NULL; |
9503 |
- inmw->dma_base = 0; |
9504 |
-@@ -629,7 +629,7 @@ static void tool_free_mw(struct tool_ctx *tc, int pidx, int widx) |
9505 |
- |
9506 |
- if (inmw->mm_base != NULL) { |
9507 |
- ntb_mw_clear_trans(tc->ntb, pidx, widx); |
9508 |
-- dma_free_coherent(&tc->ntb->dev, inmw->size, |
9509 |
-+ dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, |
9510 |
- inmw->mm_base, inmw->dma_base); |
9511 |
- } |
9512 |
- |
9513 |
-@@ -1690,4 +1690,3 @@ static void __exit tool_exit(void) |
9514 |
- debugfs_remove_recursive(tool_dbgfs_topdir); |
9515 |
- } |
9516 |
- module_exit(tool_exit); |
9517 |
-- |
9518 |
-diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
9519 |
-index 5ef4a84c442a..564e3f220ac7 100644 |
9520 |
---- a/drivers/nvme/host/fc.c |
9521 |
-+++ b/drivers/nvme/host/fc.c |
9522 |
-@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, |
9523 |
- opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE); |
9524 |
- __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); |
9525 |
- |
9526 |
-- if (!(op->flags & FCOP_FLAGS_AEN)) |
9527 |
-+ if (!(op->flags & FCOP_FLAGS_AEN)) { |
9528 |
- nvme_fc_unmap_data(ctrl, op->rq, op); |
9529 |
-+ nvme_cleanup_cmd(op->rq); |
9530 |
-+ } |
9531 |
- |
9532 |
-- nvme_cleanup_cmd(op->rq); |
9533 |
- nvme_fc_ctrl_put(ctrl); |
9534 |
- |
9535 |
- if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE && |
9536 |
-diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
9537 |
-index 076bdd90c922..4ad629eb3bc6 100644 |
9538 |
---- a/drivers/nvme/host/pci.c |
9539 |
-+++ b/drivers/nvme/host/pci.c |
9540 |
-@@ -2958,9 +2958,15 @@ static int nvme_suspend(struct device *dev) |
9541 |
- * the PCI bus layer to put it into D3 in order to take the PCIe link |
9542 |
- * down, so as to allow the platform to achieve its minimum low-power |
9543 |
- * state (which may not be possible if the link is up). |
9544 |
-+ * |
9545 |
-+ * If a host memory buffer is enabled, shut down the device as the NVMe |
9546 |
-+ * specification allows the device to access the host memory buffer in |
9547 |
-+ * host DRAM from all power states, but hosts will fail access to DRAM |
9548 |
-+ * during S3. |
9549 |
- */ |
9550 |
- if (pm_suspend_via_firmware() || !ctrl->npss || |
9551 |
- !pcie_aspm_enabled(pdev) || |
9552 |
-+ ndev->nr_host_mem_descs || |
9553 |
- (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) |
9554 |
- return nvme_disable_prepare_reset(ndev, true); |
9555 |
- |
9556 |
-diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c |
9557 |
-index 05c6ae4b0b97..a8300202a7fb 100644 |
9558 |
---- a/drivers/nvmem/core.c |
9559 |
-+++ b/drivers/nvmem/core.c |
9560 |
-@@ -66,6 +66,30 @@ static LIST_HEAD(nvmem_lookup_list); |
9561 |
- |
9562 |
- static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); |
9563 |
- |
9564 |
-+static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, |
9565 |
-+ void *val, size_t bytes) |
9566 |
-+{ |
9567 |
-+ if (nvmem->reg_read) |
9568 |
-+ return nvmem->reg_read(nvmem->priv, offset, val, bytes); |
9569 |
-+ |
9570 |
-+ return -EINVAL; |
9571 |
-+} |
9572 |
-+ |
9573 |
-+static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, |
9574 |
-+ void *val, size_t bytes) |
9575 |
-+{ |
9576 |
-+ int ret; |
9577 |
-+ |
9578 |
-+ if (nvmem->reg_write) { |
9579 |
-+ gpiod_set_value_cansleep(nvmem->wp_gpio, 0); |
9580 |
-+ ret = nvmem->reg_write(nvmem->priv, offset, val, bytes); |
9581 |
-+ gpiod_set_value_cansleep(nvmem->wp_gpio, 1); |
9582 |
-+ return ret; |
9583 |
-+ } |
9584 |
-+ |
9585 |
-+ return -EINVAL; |
9586 |
-+} |
9587 |
-+ |
9588 |
- #ifdef CONFIG_NVMEM_SYSFS |
9589 |
- static const char * const nvmem_type_str[] = { |
9590 |
- [NVMEM_TYPE_UNKNOWN] = "Unknown", |
9591 |
-@@ -122,7 +146,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj, |
9592 |
- if (!nvmem->reg_read) |
9593 |
- return -EPERM; |
9594 |
- |
9595 |
-- rc = nvmem->reg_read(nvmem->priv, pos, buf, count); |
9596 |
-+ rc = nvmem_reg_read(nvmem, pos, buf, count); |
9597 |
- |
9598 |
- if (rc) |
9599 |
- return rc; |
9600 |
-@@ -159,7 +183,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj, |
9601 |
- if (!nvmem->reg_write) |
9602 |
- return -EPERM; |
9603 |
- |
9604 |
-- rc = nvmem->reg_write(nvmem->priv, pos, buf, count); |
9605 |
-+ rc = nvmem_reg_write(nvmem, pos, buf, count); |
9606 |
- |
9607 |
- if (rc) |
9608 |
- return rc; |
9609 |
-@@ -311,30 +335,6 @@ static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem, |
9610 |
- |
9611 |
- #endif /* CONFIG_NVMEM_SYSFS */ |
9612 |
- |
9613 |
--static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, |
9614 |
-- void *val, size_t bytes) |
9615 |
--{ |
9616 |
-- if (nvmem->reg_read) |
9617 |
-- return nvmem->reg_read(nvmem->priv, offset, val, bytes); |
9618 |
-- |
9619 |
-- return -EINVAL; |
9620 |
--} |
9621 |
-- |
9622 |
--static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, |
9623 |
-- void *val, size_t bytes) |
9624 |
--{ |
9625 |
-- int ret; |
9626 |
-- |
9627 |
-- if (nvmem->reg_write) { |
9628 |
-- gpiod_set_value_cansleep(nvmem->wp_gpio, 0); |
9629 |
-- ret = nvmem->reg_write(nvmem->priv, offset, val, bytes); |
9630 |
-- gpiod_set_value_cansleep(nvmem->wp_gpio, 1); |
9631 |
-- return ret; |
9632 |
-- } |
9633 |
-- |
9634 |
-- return -EINVAL; |
9635 |
--} |
9636 |
-- |
9637 |
- static void nvmem_release(struct device *dev) |
9638 |
- { |
9639 |
- struct nvmem_device *nvmem = to_nvmem_device(dev); |
9640 |
-diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c |
9641 |
-index c72eef988041..a32e60b024b8 100644 |
9642 |
---- a/drivers/of/kobj.c |
9643 |
-+++ b/drivers/of/kobj.c |
9644 |
-@@ -134,8 +134,6 @@ int __of_attach_node_sysfs(struct device_node *np) |
9645 |
- if (!name) |
9646 |
- return -ENOMEM; |
9647 |
- |
9648 |
-- of_node_get(np); |
9649 |
-- |
9650 |
- rc = kobject_add(&np->kobj, parent, "%s", name); |
9651 |
- kfree(name); |
9652 |
- if (rc) |
9653 |
-@@ -144,6 +142,7 @@ int __of_attach_node_sysfs(struct device_node *np) |
9654 |
- for_each_property_of_node(np, pp) |
9655 |
- __of_add_property_sysfs(np, pp); |
9656 |
- |
9657 |
-+ of_node_get(np); |
9658 |
- return 0; |
9659 |
- } |
9660 |
- |
9661 |
-diff --git a/drivers/of/property.c b/drivers/of/property.c |
9662 |
-index b4916dcc9e72..6dc542af5a70 100644 |
9663 |
---- a/drivers/of/property.c |
9664 |
-+++ b/drivers/of/property.c |
9665 |
-@@ -1045,8 +1045,20 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, |
9666 |
- * Find the device node that contains the supplier phandle. It may be |
9667 |
- * @sup_np or it may be an ancestor of @sup_np. |
9668 |
- */ |
9669 |
-- while (sup_np && !of_find_property(sup_np, "compatible", NULL)) |
9670 |
-+ while (sup_np) { |
9671 |
-+ |
9672 |
-+ /* Don't allow linking to a disabled supplier */ |
9673 |
-+ if (!of_device_is_available(sup_np)) { |
9674 |
-+ of_node_put(sup_np); |
9675 |
-+ sup_np = NULL; |
9676 |
-+ } |
9677 |
-+ |
9678 |
-+ if (of_find_property(sup_np, "compatible", NULL)) |
9679 |
-+ break; |
9680 |
-+ |
9681 |
- sup_np = of_get_next_parent(sup_np); |
9682 |
-+ } |
9683 |
-+ |
9684 |
- if (!sup_np) { |
9685 |
- dev_dbg(dev, "Not linking to %pOFP - No device\n", tmp_np); |
9686 |
- return -ENODEV; |
9687 |
-@@ -1296,7 +1308,7 @@ static int of_link_to_suppliers(struct device *dev, |
9688 |
- if (of_link_property(dev, con_np, p->name)) |
9689 |
- ret = -ENODEV; |
9690 |
- |
9691 |
-- for_each_child_of_node(con_np, child) |
9692 |
-+ for_each_available_child_of_node(con_np, child) |
9693 |
- if (of_link_to_suppliers(dev, child) && !ret) |
9694 |
- ret = -EAGAIN; |
9695 |
- |
9696 |
-diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c |
9697 |
-index 3b0e58f2de58..6184ebc9392d 100644 |
9698 |
---- a/drivers/pci/controller/dwc/pci-dra7xx.c |
9699 |
-+++ b/drivers/pci/controller/dwc/pci-dra7xx.c |
9700 |
-@@ -840,7 +840,6 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) |
9701 |
- struct phy **phy; |
9702 |
- struct device_link **link; |
9703 |
- void __iomem *base; |
9704 |
-- struct resource *res; |
9705 |
- struct dw_pcie *pci; |
9706 |
- struct dra7xx_pcie *dra7xx; |
9707 |
- struct device *dev = &pdev->dev; |
9708 |
-@@ -877,10 +876,9 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) |
9709 |
- return irq; |
9710 |
- } |
9711 |
- |
9712 |
-- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ti_conf"); |
9713 |
-- base = devm_ioremap(dev, res->start, resource_size(res)); |
9714 |
-- if (!base) |
9715 |
-- return -ENOMEM; |
9716 |
-+ base = devm_platform_ioremap_resource_byname(pdev, "ti_conf"); |
9717 |
-+ if (IS_ERR(base)) |
9718 |
-+ return PTR_ERR(base); |
9719 |
- |
9720 |
- phy_count = of_property_count_strings(np, "phy-names"); |
9721 |
- if (phy_count < 0) { |
9722 |
-diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c |
9723 |
-index 3715dceca1bf..ca59ba9e0ecd 100644 |
9724 |
---- a/drivers/pci/controller/dwc/pci-meson.c |
9725 |
-+++ b/drivers/pci/controller/dwc/pci-meson.c |
9726 |
-@@ -289,11 +289,11 @@ static void meson_pcie_init_dw(struct meson_pcie *mp) |
9727 |
- meson_cfg_writel(mp, val, PCIE_CFG0); |
9728 |
- |
9729 |
- val = meson_elb_readl(mp, PCIE_PORT_LINK_CTRL_OFF); |
9730 |
-- val &= ~LINK_CAPABLE_MASK; |
9731 |
-+ val &= ~(LINK_CAPABLE_MASK | FAST_LINK_MODE); |
9732 |
- meson_elb_writel(mp, val, PCIE_PORT_LINK_CTRL_OFF); |
9733 |
- |
9734 |
- val = meson_elb_readl(mp, PCIE_PORT_LINK_CTRL_OFF); |
9735 |
-- val |= LINK_CAPABLE_X1 | FAST_LINK_MODE; |
9736 |
-+ val |= LINK_CAPABLE_X1; |
9737 |
- meson_elb_writel(mp, val, PCIE_PORT_LINK_CTRL_OFF); |
9738 |
- |
9739 |
- val = meson_elb_readl(mp, PCIE_GEN2_CTRL_OFF); |
9740 |
-diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c |
9741 |
-index 395feb8ca051..3c43311bb95c 100644 |
9742 |
---- a/drivers/pci/controller/dwc/pcie-designware-host.c |
9743 |
-+++ b/drivers/pci/controller/dwc/pcie-designware-host.c |
9744 |
-@@ -264,6 +264,8 @@ int dw_pcie_allocate_domains(struct pcie_port *pp) |
9745 |
- return -ENOMEM; |
9746 |
- } |
9747 |
- |
9748 |
-+ irq_domain_update_bus_token(pp->irq_domain, DOMAIN_BUS_NEXUS); |
9749 |
-+ |
9750 |
- pp->msi_domain = pci_msi_create_irq_domain(fwnode, |
9751 |
- &dw_pcie_msi_domain_info, |
9752 |
- pp->irq_domain); |
9753 |
-diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
9754 |
-index 2a20b649f40c..2ecc79c03ade 100644 |
9755 |
---- a/drivers/pci/controller/pci-aardvark.c |
9756 |
-+++ b/drivers/pci/controller/pci-aardvark.c |
9757 |
-@@ -9,6 +9,7 @@ |
9758 |
- */ |
9759 |
- |
9760 |
- #include <linux/delay.h> |
9761 |
-+#include <linux/gpio.h> |
9762 |
- #include <linux/interrupt.h> |
9763 |
- #include <linux/irq.h> |
9764 |
- #include <linux/irqdomain.h> |
9765 |
-@@ -18,6 +19,7 @@ |
9766 |
- #include <linux/platform_device.h> |
9767 |
- #include <linux/msi.h> |
9768 |
- #include <linux/of_address.h> |
9769 |
-+#include <linux/of_gpio.h> |
9770 |
- #include <linux/of_pci.h> |
9771 |
- |
9772 |
- #include "../pci.h" |
9773 |
-@@ -40,6 +42,7 @@ |
9774 |
- #define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0 |
9775 |
- #define PCIE_CORE_LINK_L0S_ENTRY BIT(0) |
9776 |
- #define PCIE_CORE_LINK_TRAINING BIT(5) |
9777 |
-+#define PCIE_CORE_LINK_SPEED_SHIFT 16 |
9778 |
- #define PCIE_CORE_LINK_WIDTH_SHIFT 20 |
9779 |
- #define PCIE_CORE_ERR_CAPCTL_REG 0x118 |
9780 |
- #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5) |
9781 |
-@@ -201,7 +204,9 @@ struct advk_pcie { |
9782 |
- struct mutex msi_used_lock; |
9783 |
- u16 msi_msg; |
9784 |
- int root_bus_nr; |
9785 |
-+ int link_gen; |
9786 |
- struct pci_bridge_emul bridge; |
9787 |
-+ struct gpio_desc *reset_gpio; |
9788 |
- }; |
9789 |
- |
9790 |
- static inline void advk_writel(struct advk_pcie *pcie, u32 val, u64 reg) |
9791 |
-@@ -225,20 +230,16 @@ static int advk_pcie_link_up(struct advk_pcie *pcie) |
9792 |
- |
9793 |
- static int advk_pcie_wait_for_link(struct advk_pcie *pcie) |
9794 |
- { |
9795 |
-- struct device *dev = &pcie->pdev->dev; |
9796 |
- int retries; |
9797 |
- |
9798 |
- /* check if the link is up or not */ |
9799 |
- for (retries = 0; retries < LINK_WAIT_MAX_RETRIES; retries++) { |
9800 |
-- if (advk_pcie_link_up(pcie)) { |
9801 |
-- dev_info(dev, "link up\n"); |
9802 |
-+ if (advk_pcie_link_up(pcie)) |
9803 |
- return 0; |
9804 |
-- } |
9805 |
- |
9806 |
- usleep_range(LINK_WAIT_USLEEP_MIN, LINK_WAIT_USLEEP_MAX); |
9807 |
- } |
9808 |
- |
9809 |
-- dev_err(dev, "link never came up\n"); |
9810 |
- return -ETIMEDOUT; |
9811 |
- } |
9812 |
- |
9813 |
-@@ -253,10 +254,110 @@ static void advk_pcie_wait_for_retrain(struct advk_pcie *pcie) |
9814 |
- } |
9815 |
- } |
9816 |
- |
9817 |
-+static int advk_pcie_train_at_gen(struct advk_pcie *pcie, int gen) |
9818 |
-+{ |
9819 |
-+ int ret, neg_gen; |
9820 |
-+ u32 reg; |
9821 |
-+ |
9822 |
-+ /* Setup link speed */ |
9823 |
-+ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9824 |
-+ reg &= ~PCIE_GEN_SEL_MSK; |
9825 |
-+ if (gen == 3) |
9826 |
-+ reg |= SPEED_GEN_3; |
9827 |
-+ else if (gen == 2) |
9828 |
-+ reg |= SPEED_GEN_2; |
9829 |
-+ else |
9830 |
-+ reg |= SPEED_GEN_1; |
9831 |
-+ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9832 |
-+ |
9833 |
-+ /* |
9834 |
-+ * Enable link training. This is not needed in every call to this |
9835 |
-+ * function, just once suffices, but it does not break anything either. |
9836 |
-+ */ |
9837 |
-+ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9838 |
-+ reg |= LINK_TRAINING_EN; |
9839 |
-+ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9840 |
-+ |
9841 |
-+ /* |
9842 |
-+ * Start link training immediately after enabling it. |
9843 |
-+ * This solves problems for some buggy cards. |
9844 |
-+ */ |
9845 |
-+ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); |
9846 |
-+ reg |= PCIE_CORE_LINK_TRAINING; |
9847 |
-+ advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
9848 |
-+ |
9849 |
-+ ret = advk_pcie_wait_for_link(pcie); |
9850 |
-+ if (ret) |
9851 |
-+ return ret; |
9852 |
-+ |
9853 |
-+ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); |
9854 |
-+ neg_gen = (reg >> PCIE_CORE_LINK_SPEED_SHIFT) & 0xf; |
9855 |
-+ |
9856 |
-+ return neg_gen; |
9857 |
-+} |
9858 |
-+ |
9859 |
-+static void advk_pcie_train_link(struct advk_pcie *pcie) |
9860 |
-+{ |
9861 |
-+ struct device *dev = &pcie->pdev->dev; |
9862 |
-+ int neg_gen = -1, gen; |
9863 |
-+ |
9864 |
-+ /* |
9865 |
-+ * Try link training at link gen specified by device tree property |
9866 |
-+ * 'max-link-speed'. If this fails, iteratively train at lower gen. |
9867 |
-+ */ |
9868 |
-+ for (gen = pcie->link_gen; gen > 0; --gen) { |
9869 |
-+ neg_gen = advk_pcie_train_at_gen(pcie, gen); |
9870 |
-+ if (neg_gen > 0) |
9871 |
-+ break; |
9872 |
-+ } |
9873 |
-+ |
9874 |
-+ if (neg_gen < 0) |
9875 |
-+ goto err; |
9876 |
-+ |
9877 |
-+ /* |
9878 |
-+ * After successful training if negotiated gen is lower than requested, |
9879 |
-+ * train again on negotiated gen. This solves some stability issues for |
9880 |
-+ * some buggy gen1 cards. |
9881 |
-+ */ |
9882 |
-+ if (neg_gen < gen) { |
9883 |
-+ gen = neg_gen; |
9884 |
-+ neg_gen = advk_pcie_train_at_gen(pcie, gen); |
9885 |
-+ } |
9886 |
-+ |
9887 |
-+ if (neg_gen == gen) { |
9888 |
-+ dev_info(dev, "link up at gen %i\n", gen); |
9889 |
-+ return; |
9890 |
-+ } |
9891 |
-+ |
9892 |
-+err: |
9893 |
-+ dev_err(dev, "link never came up\n"); |
9894 |
-+} |
9895 |
-+ |
9896 |
-+static void advk_pcie_issue_perst(struct advk_pcie *pcie) |
9897 |
-+{ |
9898 |
-+ u32 reg; |
9899 |
-+ |
9900 |
-+ if (!pcie->reset_gpio) |
9901 |
-+ return; |
9902 |
-+ |
9903 |
-+ /* PERST does not work for some cards when link training is enabled */ |
9904 |
-+ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9905 |
-+ reg &= ~LINK_TRAINING_EN; |
9906 |
-+ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9907 |
-+ |
9908 |
-+ /* 10ms delay is needed for some cards */ |
9909 |
-+ dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 10ms\n"); |
9910 |
-+ gpiod_set_value_cansleep(pcie->reset_gpio, 1); |
9911 |
-+ usleep_range(10000, 11000); |
9912 |
-+ gpiod_set_value_cansleep(pcie->reset_gpio, 0); |
9913 |
-+} |
9914 |
-+ |
9915 |
- static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
9916 |
- { |
9917 |
- u32 reg; |
9918 |
- |
9919 |
-+ advk_pcie_issue_perst(pcie); |
9920 |
-+ |
9921 |
- /* Set to Direct mode */ |
9922 |
- reg = advk_readl(pcie, CTRL_CONFIG_REG); |
9923 |
- reg &= ~(CTRL_MODE_MASK << CTRL_MODE_SHIFT); |
9924 |
-@@ -288,23 +389,12 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
9925 |
- PCIE_CORE_CTRL2_TD_ENABLE; |
9926 |
- advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); |
9927 |
- |
9928 |
-- /* Set GEN2 */ |
9929 |
-- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9930 |
-- reg &= ~PCIE_GEN_SEL_MSK; |
9931 |
-- reg |= SPEED_GEN_2; |
9932 |
-- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9933 |
-- |
9934 |
- /* Set lane X1 */ |
9935 |
- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9936 |
- reg &= ~LANE_CNT_MSK; |
9937 |
- reg |= LANE_COUNT_1; |
9938 |
- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9939 |
- |
9940 |
-- /* Enable link training */ |
9941 |
-- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); |
9942 |
-- reg |= LINK_TRAINING_EN; |
9943 |
-- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); |
9944 |
-- |
9945 |
- /* Enable MSI */ |
9946 |
- reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); |
9947 |
- reg |= PCIE_CORE_CTRL2_MSI_ENABLE; |
9948 |
-@@ -340,22 +430,14 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) |
9949 |
- |
9950 |
- /* |
9951 |
- * PERST# signal could have been asserted by pinctrl subsystem before |
9952 |
-- * probe() callback has been called, making the endpoint going into |
9953 |
-+ * probe() callback has been called or issued explicitly by reset gpio |
9954 |
-+ * function advk_pcie_issue_perst(), making the endpoint going into |
9955 |
- * fundamental reset. As required by PCI Express spec a delay for at |
9956 |
- * least 100ms after such a reset before link training is needed. |
9957 |
- */ |
9958 |
- msleep(PCI_PM_D3COLD_WAIT); |
9959 |
- |
9960 |
-- /* Start link training */ |
9961 |
-- reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); |
9962 |
-- reg |= PCIE_CORE_LINK_TRAINING; |
9963 |
-- advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
9964 |
-- |
9965 |
-- advk_pcie_wait_for_link(pcie); |
9966 |
-- |
9967 |
-- reg = PCIE_CORE_LINK_L0S_ENTRY | |
9968 |
-- (1 << PCIE_CORE_LINK_WIDTH_SHIFT); |
9969 |
-- advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); |
9970 |
-+ advk_pcie_train_link(pcie); |
9971 |
- |
9972 |
- reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); |
9973 |
- reg |= PCIE_CORE_CMD_MEM_ACCESS_EN | |
9974 |
-@@ -989,6 +1071,28 @@ static int advk_pcie_probe(struct platform_device *pdev) |
9975 |
- } |
9976 |
- pcie->root_bus_nr = bus->start; |
9977 |
- |
9978 |
-+ pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node, |
9979 |
-+ "reset-gpios", 0, |
9980 |
-+ GPIOD_OUT_LOW, |
9981 |
-+ "pcie1-reset"); |
9982 |
-+ ret = PTR_ERR_OR_ZERO(pcie->reset_gpio); |
9983 |
-+ if (ret) { |
9984 |
-+ if (ret == -ENOENT) { |
9985 |
-+ pcie->reset_gpio = NULL; |
9986 |
-+ } else { |
9987 |
-+ if (ret != -EPROBE_DEFER) |
9988 |
-+ dev_err(dev, "Failed to get reset-gpio: %i\n", |
9989 |
-+ ret); |
9990 |
-+ return ret; |
9991 |
-+ } |
9992 |
-+ } |
9993 |
-+ |
9994 |
-+ ret = of_pci_get_max_link_speed(dev->of_node); |
9995 |
-+ if (ret <= 0 || ret > 3) |
9996 |
-+ pcie->link_gen = 3; |
9997 |
-+ else |
9998 |
-+ pcie->link_gen = ret; |
9999 |
-+ |
10000 |
- advk_pcie_setup_hw(pcie); |
10001 |
- |
10002 |
- advk_sw_pci_bridge_init(pcie); |
10003 |
-diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c |
10004 |
-index bd05221f5a22..ddcb4571a79b 100644 |
10005 |
---- a/drivers/pci/controller/pci-v3-semi.c |
10006 |
-+++ b/drivers/pci/controller/pci-v3-semi.c |
10007 |
-@@ -720,7 +720,7 @@ static int v3_pci_probe(struct platform_device *pdev) |
10008 |
- int irq; |
10009 |
- int ret; |
10010 |
- |
10011 |
-- host = pci_alloc_host_bridge(sizeof(*v3)); |
10012 |
-+ host = devm_pci_alloc_host_bridge(dev, sizeof(*v3)); |
10013 |
- if (!host) |
10014 |
- return -ENOMEM; |
10015 |
- |
10016 |
-diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c |
10017 |
-index 6d79d14527a6..2297910bf6e4 100644 |
10018 |
---- a/drivers/pci/controller/pcie-brcmstb.c |
10019 |
-+++ b/drivers/pci/controller/pcie-brcmstb.c |
10020 |
-@@ -54,11 +54,11 @@ |
10021 |
- |
10022 |
- #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO 0x400c |
10023 |
- #define PCIE_MEM_WIN0_LO(win) \ |
10024 |
-- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 4) |
10025 |
-+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 8) |
10026 |
- |
10027 |
- #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI 0x4010 |
10028 |
- #define PCIE_MEM_WIN0_HI(win) \ |
10029 |
-- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 4) |
10030 |
-+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8) |
10031 |
- |
10032 |
- #define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c |
10033 |
- #define PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f |
10034 |
-@@ -697,6 +697,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) |
10035 |
- |
10036 |
- /* Reset the bridge */ |
10037 |
- brcm_pcie_bridge_sw_init_set(pcie, 1); |
10038 |
-+ brcm_pcie_perst_set(pcie, 1); |
10039 |
- |
10040 |
- usleep_range(100, 200); |
10041 |
- |
10042 |
-diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c |
10043 |
-index 759c6542c5c8..1bae6a4abaae 100644 |
10044 |
---- a/drivers/pci/controller/pcie-rcar.c |
10045 |
-+++ b/drivers/pci/controller/pcie-rcar.c |
10046 |
-@@ -333,11 +333,12 @@ static struct pci_ops rcar_pcie_ops = { |
10047 |
- }; |
10048 |
- |
10049 |
- static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, |
10050 |
-- struct resource *res) |
10051 |
-+ struct resource_entry *window) |
10052 |
- { |
10053 |
- /* Setup PCIe address space mappings for each resource */ |
10054 |
- resource_size_t size; |
10055 |
- resource_size_t res_start; |
10056 |
-+ struct resource *res = window->res; |
10057 |
- u32 mask; |
10058 |
- |
10059 |
- rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win)); |
10060 |
-@@ -351,9 +352,9 @@ static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie, |
10061 |
- rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); |
10062 |
- |
10063 |
- if (res->flags & IORESOURCE_IO) |
10064 |
-- res_start = pci_pio_to_address(res->start); |
10065 |
-+ res_start = pci_pio_to_address(res->start) - window->offset; |
10066 |
- else |
10067 |
-- res_start = res->start; |
10068 |
-+ res_start = res->start - window->offset; |
10069 |
- |
10070 |
- rcar_pci_write_reg(pcie, upper_32_bits(res_start), PCIEPAUR(win)); |
10071 |
- rcar_pci_write_reg(pcie, lower_32_bits(res_start) & ~0x7F, |
10072 |
-@@ -382,7 +383,7 @@ static int rcar_pcie_setup(struct list_head *resource, struct rcar_pcie *pci) |
10073 |
- switch (resource_type(res)) { |
10074 |
- case IORESOURCE_IO: |
10075 |
- case IORESOURCE_MEM: |
10076 |
-- rcar_pcie_setup_window(i, pci, res); |
10077 |
-+ rcar_pcie_setup_window(i, pci, win); |
10078 |
- i++; |
10079 |
- break; |
10080 |
- case IORESOURCE_BUS: |
10081 |
-diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c |
10082 |
-index dac91d60701d..e386d4eac407 100644 |
10083 |
---- a/drivers/pci/controller/vmd.c |
10084 |
-+++ b/drivers/pci/controller/vmd.c |
10085 |
-@@ -445,9 +445,11 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) |
10086 |
- if (!membar2) |
10087 |
- return -ENOMEM; |
10088 |
- offset[0] = vmd->dev->resource[VMD_MEMBAR1].start - |
10089 |
-- readq(membar2 + MB2_SHADOW_OFFSET); |
10090 |
-+ (readq(membar2 + MB2_SHADOW_OFFSET) & |
10091 |
-+ PCI_BASE_ADDRESS_MEM_MASK); |
10092 |
- offset[1] = vmd->dev->resource[VMD_MEMBAR2].start - |
10093 |
-- readq(membar2 + MB2_SHADOW_OFFSET + 8); |
10094 |
-+ (readq(membar2 + MB2_SHADOW_OFFSET + 8) & |
10095 |
-+ PCI_BASE_ADDRESS_MEM_MASK); |
10096 |
- pci_iounmap(vmd->dev, membar2); |
10097 |
- } |
10098 |
- } |
10099 |
-diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c |
10100 |
-index 60330f3e3751..c89a9561439f 100644 |
10101 |
---- a/drivers/pci/endpoint/functions/pci-epf-test.c |
10102 |
-+++ b/drivers/pci/endpoint/functions/pci-epf-test.c |
10103 |
-@@ -187,6 +187,9 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) |
10104 |
- */ |
10105 |
- static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test) |
10106 |
- { |
10107 |
-+ if (!epf_test->dma_supported) |
10108 |
-+ return; |
10109 |
-+ |
10110 |
- dma_release_channel(epf_test->dma_chan); |
10111 |
- epf_test->dma_chan = NULL; |
10112 |
- } |
10113 |
-diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c |
10114 |
-index 4f4f54bc732e..faa414655f33 100644 |
10115 |
---- a/drivers/pci/pci-bridge-emul.c |
10116 |
-+++ b/drivers/pci/pci-bridge-emul.c |
10117 |
-@@ -185,8 +185,8 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { |
10118 |
- * RO, the rest is reserved |
10119 |
- */ |
10120 |
- .w1c = GENMASK(19, 16), |
10121 |
-- .ro = GENMASK(20, 19), |
10122 |
-- .rsvd = GENMASK(31, 21), |
10123 |
-+ .ro = GENMASK(21, 20), |
10124 |
-+ .rsvd = GENMASK(31, 22), |
10125 |
- }, |
10126 |
- |
10127 |
- [PCI_EXP_LNKCAP / 4] = { |
10128 |
-@@ -226,7 +226,7 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = { |
10129 |
- PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC) << 16, |
10130 |
- .ro = (PCI_EXP_SLTSTA_MRLSS | PCI_EXP_SLTSTA_PDS | |
10131 |
- PCI_EXP_SLTSTA_EIS) << 16, |
10132 |
-- .rsvd = GENMASK(15, 12) | (GENMASK(15, 9) << 16), |
10133 |
-+ .rsvd = GENMASK(15, 13) | (GENMASK(15, 9) << 16), |
10134 |
- }, |
10135 |
- |
10136 |
- [PCI_EXP_RTCTL / 4] = { |
10137 |
-diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
10138 |
-index 6d3234f75692..809f2584e338 100644 |
10139 |
---- a/drivers/pci/pci.c |
10140 |
-+++ b/drivers/pci/pci.c |
10141 |
-@@ -4660,7 +4660,8 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) |
10142 |
- * pcie_wait_for_link_delay - Wait until link is active or inactive |
10143 |
- * @pdev: Bridge device |
10144 |
- * @active: waiting for active or inactive? |
10145 |
-- * @delay: Delay to wait after link has become active (in ms) |
10146 |
-+ * @delay: Delay to wait after link has become active (in ms). Specify %0 |
10147 |
-+ * for no delay. |
10148 |
- * |
10149 |
- * Use this to wait till link becomes active or inactive. |
10150 |
- */ |
10151 |
-@@ -4701,7 +4702,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, |
10152 |
- msleep(10); |
10153 |
- timeout -= 10; |
10154 |
- } |
10155 |
-- if (active && ret) |
10156 |
-+ if (active && ret && delay) |
10157 |
- msleep(delay); |
10158 |
- else if (ret != active) |
10159 |
- pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n", |
10160 |
-@@ -4822,17 +4823,28 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) |
10161 |
- if (!pcie_downstream_port(dev)) |
10162 |
- return; |
10163 |
- |
10164 |
-- if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { |
10165 |
-- pci_dbg(dev, "waiting %d ms for downstream link\n", delay); |
10166 |
-- msleep(delay); |
10167 |
-- } else { |
10168 |
-- pci_dbg(dev, "waiting %d ms for downstream link, after activation\n", |
10169 |
-- delay); |
10170 |
-- if (!pcie_wait_for_link_delay(dev, true, delay)) { |
10171 |
-+ /* |
10172 |
-+ * Per PCIe r5.0, sec 6.6.1, for downstream ports that support |
10173 |
-+ * speeds > 5 GT/s, we must wait for link training to complete |
10174 |
-+ * before the mandatory delay. |
10175 |
-+ * |
10176 |
-+ * We can only tell when link training completes via DLL Link |
10177 |
-+ * Active, which is required for downstream ports that support |
10178 |
-+ * speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common |
10179 |
-+ * devices do not implement Link Active reporting even when it's |
10180 |
-+ * required, so we'll check for that directly instead of checking |
10181 |
-+ * the supported link speed. We assume devices without Link Active |
10182 |
-+ * reporting can train in 100 ms regardless of speed. |
10183 |
-+ */ |
10184 |
-+ if (dev->link_active_reporting) { |
10185 |
-+ pci_dbg(dev, "waiting for link to train\n"); |
10186 |
-+ if (!pcie_wait_for_link_delay(dev, true, 0)) { |
10187 |
- /* Did not train, no need to wait any further */ |
10188 |
- return; |
10189 |
- } |
10190 |
- } |
10191 |
-+ pci_dbg(child, "waiting %d ms to become accessible\n", delay); |
10192 |
-+ msleep(delay); |
10193 |
- |
10194 |
- if (!pci_device_is_present(child)) { |
10195 |
- pci_dbg(child, "waiting additional %d ms to become accessible\n", delay); |
10196 |
-diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
10197 |
-index 2378ed692534..b17e5ffd31b1 100644 |
10198 |
---- a/drivers/pci/pcie/aspm.c |
10199 |
-+++ b/drivers/pci/pcie/aspm.c |
10200 |
-@@ -628,16 +628,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) |
10201 |
- |
10202 |
- /* Setup initial capable state. Will be updated later */ |
10203 |
- link->aspm_capable = link->aspm_support; |
10204 |
-- /* |
10205 |
-- * If the downstream component has pci bridge function, don't |
10206 |
-- * do ASPM for now. |
10207 |
-- */ |
10208 |
-- list_for_each_entry(child, &linkbus->devices, bus_list) { |
10209 |
-- if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) { |
10210 |
-- link->aspm_disable = ASPM_STATE_ALL; |
10211 |
-- break; |
10212 |
-- } |
10213 |
-- } |
10214 |
- |
10215 |
- /* Get and check endpoint acceptable latencies */ |
10216 |
- list_for_each_entry(child, &linkbus->devices, bus_list) { |
10217 |
-diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c |
10218 |
-index 9361f3aa26ab..357a454cafa0 100644 |
10219 |
---- a/drivers/pci/pcie/ptm.c |
10220 |
-+++ b/drivers/pci/pcie/ptm.c |
10221 |
-@@ -39,10 +39,6 @@ void pci_ptm_init(struct pci_dev *dev) |
10222 |
- if (!pci_is_pcie(dev)) |
10223 |
- return; |
10224 |
- |
10225 |
-- pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); |
10226 |
-- if (!pos) |
10227 |
-- return; |
10228 |
-- |
10229 |
- /* |
10230 |
- * Enable PTM only on interior devices (root ports, switch ports, |
10231 |
- * etc.) on the assumption that it causes no link traffic until an |
10232 |
-@@ -52,6 +48,23 @@ void pci_ptm_init(struct pci_dev *dev) |
10233 |
- pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END)) |
10234 |
- return; |
10235 |
- |
10236 |
-+ /* |
10237 |
-+ * Switch Downstream Ports are not permitted to have a PTM |
10238 |
-+ * capability; their PTM behavior is controlled by the Upstream |
10239 |
-+ * Port (PCIe r5.0, sec 7.9.16). |
10240 |
-+ */ |
10241 |
-+ ups = pci_upstream_bridge(dev); |
10242 |
-+ if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM && |
10243 |
-+ ups && ups->ptm_enabled) { |
10244 |
-+ dev->ptm_granularity = ups->ptm_granularity; |
10245 |
-+ dev->ptm_enabled = 1; |
10246 |
-+ return; |
10247 |
-+ } |
10248 |
-+ |
10249 |
-+ pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); |
10250 |
-+ if (!pos) |
10251 |
-+ return; |
10252 |
-+ |
10253 |
- pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); |
10254 |
- local_clock = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; |
10255 |
- |
10256 |
-@@ -61,7 +74,6 @@ void pci_ptm_init(struct pci_dev *dev) |
10257 |
- * the spec recommendation (PCIe r3.1, sec 7.32.3), select the |
10258 |
- * furthest upstream Time Source as the PTM Root. |
10259 |
- */ |
10260 |
-- ups = pci_upstream_bridge(dev); |
10261 |
- if (ups && ups->ptm_enabled) { |
10262 |
- ctrl = PCI_PTM_CTRL_ENABLE; |
10263 |
- if (ups->ptm_granularity == 0) |
10264 |
-diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
10265 |
-index c7e3a8267521..b59a4b0f5f16 100644 |
10266 |
---- a/drivers/pci/probe.c |
10267 |
-+++ b/drivers/pci/probe.c |
10268 |
-@@ -909,9 +909,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
10269 |
- goto free; |
10270 |
- |
10271 |
- err = device_register(&bridge->dev); |
10272 |
-- if (err) |
10273 |
-+ if (err) { |
10274 |
- put_device(&bridge->dev); |
10275 |
-- |
10276 |
-+ goto free; |
10277 |
-+ } |
10278 |
- bus->bridge = get_device(&bridge->dev); |
10279 |
- device_enable_async_suspend(bus->bridge); |
10280 |
- pci_set_bus_of_node(bus); |
10281 |
-diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c |
10282 |
-index d8ca40a97693..d21fa04fa44d 100644 |
10283 |
---- a/drivers/pci/setup-res.c |
10284 |
-+++ b/drivers/pci/setup-res.c |
10285 |
-@@ -439,10 +439,11 @@ int pci_resize_resource(struct pci_dev *dev, int resno, int size) |
10286 |
- res->end = res->start + pci_rebar_size_to_bytes(size) - 1; |
10287 |
- |
10288 |
- /* Check if the new config works by trying to assign everything. */ |
10289 |
-- ret = pci_reassign_bridge_resources(dev->bus->self, res->flags); |
10290 |
-- if (ret) |
10291 |
-- goto error_resize; |
10292 |
-- |
10293 |
-+ if (dev->bus->self) { |
10294 |
-+ ret = pci_reassign_bridge_resources(dev->bus->self, res->flags); |
10295 |
-+ if (ret) |
10296 |
-+ goto error_resize; |
10297 |
-+ } |
10298 |
- return 0; |
10299 |
- |
10300 |
- error_resize: |
10301 |
-diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
10302 |
-index 1151e99b241c..479de4be99eb 100644 |
10303 |
---- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
10304 |
-+++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c |
10305 |
-@@ -35,7 +35,7 @@ |
10306 |
- /* L3C has 8-counters */ |
10307 |
- #define L3C_NR_COUNTERS 0x8 |
10308 |
- |
10309 |
--#define L3C_PERF_CTRL_EN 0x20000 |
10310 |
-+#define L3C_PERF_CTRL_EN 0x10000 |
10311 |
- #define L3C_EVTYPE_NONE 0xff |
10312 |
- |
10313 |
- /* |
10314 |
-diff --git a/drivers/phy/broadcom/phy-bcm-sr-usb.c b/drivers/phy/broadcom/phy-bcm-sr-usb.c |
10315 |
-index fe6c58910e4c..7c7862b4f41f 100644 |
10316 |
---- a/drivers/phy/broadcom/phy-bcm-sr-usb.c |
10317 |
-+++ b/drivers/phy/broadcom/phy-bcm-sr-usb.c |
10318 |
-@@ -16,8 +16,6 @@ enum bcm_usb_phy_version { |
10319 |
- }; |
10320 |
- |
10321 |
- enum bcm_usb_phy_reg { |
10322 |
-- PLL_NDIV_FRAC, |
10323 |
-- PLL_NDIV_INT, |
10324 |
- PLL_CTRL, |
10325 |
- PHY_CTRL, |
10326 |
- PHY_PLL_CTRL, |
10327 |
-@@ -31,18 +29,11 @@ static const u8 bcm_usb_combo_phy_ss[] = { |
10328 |
- }; |
10329 |
- |
10330 |
- static const u8 bcm_usb_combo_phy_hs[] = { |
10331 |
-- [PLL_NDIV_FRAC] = 0x04, |
10332 |
-- [PLL_NDIV_INT] = 0x08, |
10333 |
- [PLL_CTRL] = 0x0c, |
10334 |
- [PHY_CTRL] = 0x10, |
10335 |
- }; |
10336 |
- |
10337 |
--#define HSPLL_NDIV_INT_VAL 0x13 |
10338 |
--#define HSPLL_NDIV_FRAC_VAL 0x1005 |
10339 |
-- |
10340 |
- static const u8 bcm_usb_hs_phy[] = { |
10341 |
-- [PLL_NDIV_FRAC] = 0x0, |
10342 |
-- [PLL_NDIV_INT] = 0x4, |
10343 |
- [PLL_CTRL] = 0x8, |
10344 |
- [PHY_CTRL] = 0xc, |
10345 |
- }; |
10346 |
-@@ -52,7 +43,6 @@ enum pll_ctrl_bits { |
10347 |
- SSPLL_SUSPEND_EN, |
10348 |
- PLL_SEQ_START, |
10349 |
- PLL_LOCK, |
10350 |
-- PLL_PDIV, |
10351 |
- }; |
10352 |
- |
10353 |
- static const u8 u3pll_ctrl[] = { |
10354 |
-@@ -66,29 +56,17 @@ static const u8 u3pll_ctrl[] = { |
10355 |
- #define HSPLL_PDIV_VAL 0x1 |
10356 |
- |
10357 |
- static const u8 u2pll_ctrl[] = { |
10358 |
-- [PLL_PDIV] = 1, |
10359 |
- [PLL_RESETB] = 5, |
10360 |
- [PLL_LOCK] = 6, |
10361 |
- }; |
10362 |
- |
10363 |
- enum bcm_usb_phy_ctrl_bits { |
10364 |
- CORERDY, |
10365 |
-- AFE_LDO_PWRDWNB, |
10366 |
-- AFE_PLL_PWRDWNB, |
10367 |
-- AFE_BG_PWRDWNB, |
10368 |
-- PHY_ISO, |
10369 |
- PHY_RESETB, |
10370 |
- PHY_PCTL, |
10371 |
- }; |
10372 |
- |
10373 |
- #define PHY_PCTL_MASK 0xffff |
10374 |
--/* |
10375 |
-- * 0x0806 of PCTL_VAL has below bits set |
10376 |
-- * BIT-8 : refclk divider 1 |
10377 |
-- * BIT-3:2: device mode; mode is not effect |
10378 |
-- * BIT-1: soft reset active low |
10379 |
-- */ |
10380 |
--#define HSPHY_PCTL_VAL 0x0806 |
10381 |
- #define SSPHY_PCTL_VAL 0x0006 |
10382 |
- |
10383 |
- static const u8 u3phy_ctrl[] = { |
10384 |
-@@ -98,10 +76,6 @@ static const u8 u3phy_ctrl[] = { |
10385 |
- |
10386 |
- static const u8 u2phy_ctrl[] = { |
10387 |
- [CORERDY] = 0, |
10388 |
-- [AFE_LDO_PWRDWNB] = 1, |
10389 |
-- [AFE_PLL_PWRDWNB] = 2, |
10390 |
-- [AFE_BG_PWRDWNB] = 3, |
10391 |
-- [PHY_ISO] = 4, |
10392 |
- [PHY_RESETB] = 5, |
10393 |
- [PHY_PCTL] = 6, |
10394 |
- }; |
10395 |
-@@ -186,38 +160,13 @@ static int bcm_usb_hs_phy_init(struct bcm_usb_phy_cfg *phy_cfg) |
10396 |
- int ret = 0; |
10397 |
- void __iomem *regs = phy_cfg->regs; |
10398 |
- const u8 *offset; |
10399 |
-- u32 rd_data; |
10400 |
- |
10401 |
- offset = phy_cfg->offset; |
10402 |
- |
10403 |
-- writel(HSPLL_NDIV_INT_VAL, regs + offset[PLL_NDIV_INT]); |
10404 |
-- writel(HSPLL_NDIV_FRAC_VAL, regs + offset[PLL_NDIV_FRAC]); |
10405 |
-- |
10406 |
-- rd_data = readl(regs + offset[PLL_CTRL]); |
10407 |
-- rd_data &= ~(HSPLL_PDIV_MASK << u2pll_ctrl[PLL_PDIV]); |
10408 |
-- rd_data |= (HSPLL_PDIV_VAL << u2pll_ctrl[PLL_PDIV]); |
10409 |
-- writel(rd_data, regs + offset[PLL_CTRL]); |
10410 |
-- |
10411 |
-- /* Set Core Ready high */ |
10412 |
-- bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], |
10413 |
-- BIT(u2phy_ctrl[CORERDY])); |
10414 |
-- |
10415 |
-- /* Maximum timeout for Core Ready done */ |
10416 |
-- msleep(30); |
10417 |
-- |
10418 |
-+ bcm_usb_reg32_clrbits(regs + offset[PLL_CTRL], |
10419 |
-+ BIT(u2pll_ctrl[PLL_RESETB])); |
10420 |
- bcm_usb_reg32_setbits(regs + offset[PLL_CTRL], |
10421 |
- BIT(u2pll_ctrl[PLL_RESETB])); |
10422 |
-- bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], |
10423 |
-- BIT(u2phy_ctrl[PHY_RESETB])); |
10424 |
-- |
10425 |
-- |
10426 |
-- rd_data = readl(regs + offset[PHY_CTRL]); |
10427 |
-- rd_data &= ~(PHY_PCTL_MASK << u2phy_ctrl[PHY_PCTL]); |
10428 |
-- rd_data |= (HSPHY_PCTL_VAL << u2phy_ctrl[PHY_PCTL]); |
10429 |
-- writel(rd_data, regs + offset[PHY_CTRL]); |
10430 |
-- |
10431 |
-- /* Maximum timeout for PLL reset done */ |
10432 |
-- msleep(30); |
10433 |
- |
10434 |
- ret = bcm_usb_pll_lock_check(regs + offset[PLL_CTRL], |
10435 |
- BIT(u2pll_ctrl[PLL_LOCK])); |
10436 |
-diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c |
10437 |
-index a5c08e5bd2bf..faed652b73f7 100644 |
10438 |
---- a/drivers/phy/cadence/phy-cadence-sierra.c |
10439 |
-+++ b/drivers/phy/cadence/phy-cadence-sierra.c |
10440 |
-@@ -685,10 +685,10 @@ static struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = { |
10441 |
- static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10442 |
- {0xFE0A, SIERRA_DET_STANDEC_A_PREG}, |
10443 |
- {0x000F, SIERRA_DET_STANDEC_B_PREG}, |
10444 |
-- {0x00A5, SIERRA_DET_STANDEC_C_PREG}, |
10445 |
-+ {0x55A5, SIERRA_DET_STANDEC_C_PREG}, |
10446 |
- {0x69ad, SIERRA_DET_STANDEC_D_PREG}, |
10447 |
- {0x0241, SIERRA_DET_STANDEC_E_PREG}, |
10448 |
-- {0x0010, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, |
10449 |
-+ {0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, |
10450 |
- {0x0014, SIERRA_PSM_A0IN_TMR_PREG}, |
10451 |
- {0xCF00, SIERRA_PSM_DIAG_PREG}, |
10452 |
- {0x001F, SIERRA_PSC_TX_A0_PREG}, |
10453 |
-@@ -696,7 +696,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10454 |
- {0x0003, SIERRA_PSC_TX_A2_PREG}, |
10455 |
- {0x0003, SIERRA_PSC_TX_A3_PREG}, |
10456 |
- {0x0FFF, SIERRA_PSC_RX_A0_PREG}, |
10457 |
-- {0x0619, SIERRA_PSC_RX_A1_PREG}, |
10458 |
-+ {0x0003, SIERRA_PSC_RX_A1_PREG}, |
10459 |
- {0x0003, SIERRA_PSC_RX_A2_PREG}, |
10460 |
- {0x0001, SIERRA_PSC_RX_A3_PREG}, |
10461 |
- {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG}, |
10462 |
-@@ -705,19 +705,19 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10463 |
- {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG}, |
10464 |
- {0x2512, SIERRA_DFE_BIASTRIM_PREG}, |
10465 |
- {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, |
10466 |
-- {0x873E, SIERRA_CLKPATHCTRL_TMR_PREG}, |
10467 |
-- {0x03CF, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, |
10468 |
-- {0x01CE, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, |
10469 |
-+ {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, |
10470 |
-+ {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, |
10471 |
-+ {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, |
10472 |
- {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, |
10473 |
-- {0x033F, SIERRA_RX_CTLE_MAINTENANCE_PREG}, |
10474 |
-+ {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, |
10475 |
- {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, |
10476 |
- {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, |
10477 |
-- {0x8000, SIERRA_CREQ_SPARE_PREG}, |
10478 |
-+ {0x0000, SIERRA_CREQ_SPARE_PREG}, |
10479 |
- {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, |
10480 |
-- {0x8453, SIERRA_CTLELUT_CTRL_PREG}, |
10481 |
-- {0x4110, SIERRA_DFE_ECMP_RATESEL_PREG}, |
10482 |
-- {0x4110, SIERRA_DFE_SMP_RATESEL_PREG}, |
10483 |
-- {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, |
10484 |
-+ {0x8452, SIERRA_CTLELUT_CTRL_PREG}, |
10485 |
-+ {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, |
10486 |
-+ {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, |
10487 |
-+ {0x0003, SIERRA_DEQ_PHALIGN_CTRL}, |
10488 |
- {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG}, |
10489 |
- {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG}, |
10490 |
- {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, |
10491 |
-@@ -725,7 +725,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10492 |
- {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG}, |
10493 |
- {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG}, |
10494 |
- {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG}, |
10495 |
-- {0x9A8A, SIERRA_DEQ_VGATUNE_CTRL_PREG}, |
10496 |
-+ {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, |
10497 |
- {0x0014, SIERRA_DEQ_GLUT0}, |
10498 |
- {0x0014, SIERRA_DEQ_GLUT1}, |
10499 |
- {0x0014, SIERRA_DEQ_GLUT2}, |
10500 |
-@@ -772,6 +772,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { |
10501 |
- {0x000F, SIERRA_LFPSFILT_NS_PREG}, |
10502 |
- {0x0009, SIERRA_LFPSFILT_RD_PREG}, |
10503 |
- {0x0001, SIERRA_LFPSFILT_MP_PREG}, |
10504 |
-+ {0x6013, SIERRA_SIGDET_SUPPORT_PREG}, |
10505 |
- {0x8013, SIERRA_SDFILT_H2L_A_PREG}, |
10506 |
- {0x8009, SIERRA_SDFILT_L2H_PREG}, |
10507 |
- {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG}, |
10508 |
-diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c |
10509 |
-index 7b51045df783..c8e4ff341cef 100644 |
10510 |
---- a/drivers/phy/ti/phy-j721e-wiz.c |
10511 |
-+++ b/drivers/phy/ti/phy-j721e-wiz.c |
10512 |
-@@ -794,8 +794,10 @@ static int wiz_probe(struct platform_device *pdev) |
10513 |
- } |
10514 |
- |
10515 |
- base = devm_ioremap(dev, res.start, resource_size(&res)); |
10516 |
-- if (!base) |
10517 |
-+ if (!base) { |
10518 |
-+ ret = -ENOMEM; |
10519 |
- goto err_addr_to_resource; |
10520 |
-+ } |
10521 |
- |
10522 |
- regmap = devm_regmap_init_mmio(dev, base, &wiz_regmap_config); |
10523 |
- if (IS_ERR(regmap)) { |
10524 |
-@@ -812,6 +814,7 @@ static int wiz_probe(struct platform_device *pdev) |
10525 |
- |
10526 |
- if (num_lanes > WIZ_MAX_LANES) { |
10527 |
- dev_err(dev, "Cannot support %d lanes\n", num_lanes); |
10528 |
-+ ret = -ENODEV; |
10529 |
- goto err_addr_to_resource; |
10530 |
- } |
10531 |
- |
10532 |
-@@ -897,6 +900,7 @@ static int wiz_probe(struct platform_device *pdev) |
10533 |
- serdes_pdev = of_platform_device_create(child_node, NULL, dev); |
10534 |
- if (!serdes_pdev) { |
10535 |
- dev_WARN(dev, "Unable to create SERDES platform device\n"); |
10536 |
-+ ret = -ENOMEM; |
10537 |
- goto err_pdev_create; |
10538 |
- } |
10539 |
- wiz->serdes_pdev = serdes_pdev; |
10540 |
-diff --git a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c |
10541 |
-index f690fc5cd688..71e666178300 100644 |
10542 |
---- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c |
10543 |
-+++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c |
10544 |
-@@ -1406,7 +1406,7 @@ static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev) |
10545 |
- pdata->reg_base = devm_platform_ioremap_resource(pdev, 0); |
10546 |
- if (IS_ERR(pdata->reg_base)) { |
10547 |
- dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); |
10548 |
-- return -ENODEV; |
10549 |
-+ return PTR_ERR(pdata->reg_base); |
10550 |
- } |
10551 |
- |
10552 |
- /* Initialize the dynamic part of pinctrl_desc */ |
10553 |
-diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c |
10554 |
-index 9f42036c5fbb..1f81569c7ae3 100644 |
10555 |
---- a/drivers/pinctrl/freescale/pinctrl-imx.c |
10556 |
-+++ b/drivers/pinctrl/freescale/pinctrl-imx.c |
10557 |
-@@ -774,16 +774,6 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, |
10558 |
- return 0; |
10559 |
- } |
10560 |
- |
10561 |
--/* |
10562 |
-- * imx_free_resources() - free memory used by this driver |
10563 |
-- * @info: info driver instance |
10564 |
-- */ |
10565 |
--static void imx_free_resources(struct imx_pinctrl *ipctl) |
10566 |
--{ |
10567 |
-- if (ipctl->pctl) |
10568 |
-- pinctrl_unregister(ipctl->pctl); |
10569 |
--} |
10570 |
-- |
10571 |
- int imx_pinctrl_probe(struct platform_device *pdev, |
10572 |
- const struct imx_pinctrl_soc_info *info) |
10573 |
- { |
10574 |
-@@ -874,23 +864,18 @@ int imx_pinctrl_probe(struct platform_device *pdev, |
10575 |
- &ipctl->pctl); |
10576 |
- if (ret) { |
10577 |
- dev_err(&pdev->dev, "could not register IMX pinctrl driver\n"); |
10578 |
-- goto free; |
10579 |
-+ return ret; |
10580 |
- } |
10581 |
- |
10582 |
- ret = imx_pinctrl_probe_dt(pdev, ipctl); |
10583 |
- if (ret) { |
10584 |
- dev_err(&pdev->dev, "fail to probe dt properties\n"); |
10585 |
-- goto free; |
10586 |
-+ return ret; |
10587 |
- } |
10588 |
- |
10589 |
- dev_info(&pdev->dev, "initialized IMX pinctrl driver\n"); |
10590 |
- |
10591 |
- return pinctrl_enable(ipctl->pctl); |
10592 |
-- |
10593 |
--free: |
10594 |
-- imx_free_resources(ipctl); |
10595 |
-- |
10596 |
-- return ret; |
10597 |
- } |
10598 |
- |
10599 |
- static int __maybe_unused imx_pinctrl_suspend(struct device *dev) |
10600 |
-diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
10601 |
-index c00d0022d311..421f7d1886e5 100644 |
10602 |
---- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
10603 |
-+++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c |
10604 |
-@@ -638,7 +638,6 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, |
10605 |
- |
10606 |
- ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); |
10607 |
- if (ret) { |
10608 |
-- pinctrl_unregister(ipctl->pctl); |
10609 |
- dev_err(&pdev->dev, "Failed to populate subdevices\n"); |
10610 |
- return ret; |
10611 |
- } |
10612 |
-diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c |
10613 |
-index 694912409fd9..54222ccddfb1 100644 |
10614 |
---- a/drivers/pinctrl/pinctrl-at91-pio4.c |
10615 |
-+++ b/drivers/pinctrl/pinctrl-at91-pio4.c |
10616 |
-@@ -1019,7 +1019,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) |
10617 |
- |
10618 |
- atmel_pioctrl->reg_base = devm_platform_ioremap_resource(pdev, 0); |
10619 |
- if (IS_ERR(atmel_pioctrl->reg_base)) |
10620 |
-- return -EINVAL; |
10621 |
-+ return PTR_ERR(atmel_pioctrl->reg_base); |
10622 |
- |
10623 |
- atmel_pioctrl->clk = devm_clk_get(dev, NULL); |
10624 |
- if (IS_ERR(atmel_pioctrl->clk)) { |
10625 |
-diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c |
10626 |
-index ed8eac6c1494..b1bf46ec207f 100644 |
10627 |
---- a/drivers/pinctrl/pinctrl-ocelot.c |
10628 |
-+++ b/drivers/pinctrl/pinctrl-ocelot.c |
10629 |
-@@ -714,11 +714,12 @@ static void ocelot_irq_handler(struct irq_desc *desc) |
10630 |
- struct irq_chip *parent_chip = irq_desc_get_chip(desc); |
10631 |
- struct gpio_chip *chip = irq_desc_get_handler_data(desc); |
10632 |
- struct ocelot_pinctrl *info = gpiochip_get_data(chip); |
10633 |
-+ unsigned int id_reg = OCELOT_GPIO_INTR_IDENT * info->stride; |
10634 |
- unsigned int reg = 0, irq, i; |
10635 |
- unsigned long irqs; |
10636 |
- |
10637 |
- for (i = 0; i < info->stride; i++) { |
10638 |
-- regmap_read(info->map, OCELOT_GPIO_INTR_IDENT + 4 * i, ®); |
10639 |
-+ regmap_read(info->map, id_reg + 4 * i, ®); |
10640 |
- if (!reg) |
10641 |
- continue; |
10642 |
- |
10643 |
-@@ -751,21 +752,21 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, |
10644 |
- gc->of_node = info->dev->of_node; |
10645 |
- gc->label = "ocelot-gpio"; |
10646 |
- |
10647 |
-- irq = irq_of_parse_and_map(pdev->dev.of_node, 0); |
10648 |
-- if (irq <= 0) |
10649 |
-- return irq; |
10650 |
-- |
10651 |
-- girq = &gc->irq; |
10652 |
-- girq->chip = &ocelot_irqchip; |
10653 |
-- girq->parent_handler = ocelot_irq_handler; |
10654 |
-- girq->num_parents = 1; |
10655 |
-- girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), |
10656 |
-- GFP_KERNEL); |
10657 |
-- if (!girq->parents) |
10658 |
-- return -ENOMEM; |
10659 |
-- girq->parents[0] = irq; |
10660 |
-- girq->default_type = IRQ_TYPE_NONE; |
10661 |
-- girq->handler = handle_edge_irq; |
10662 |
-+ irq = irq_of_parse_and_map(gc->of_node, 0); |
10663 |
-+ if (irq) { |
10664 |
-+ girq = &gc->irq; |
10665 |
-+ girq->chip = &ocelot_irqchip; |
10666 |
-+ girq->parent_handler = ocelot_irq_handler; |
10667 |
-+ girq->num_parents = 1; |
10668 |
-+ girq->parents = devm_kcalloc(&pdev->dev, 1, |
10669 |
-+ sizeof(*girq->parents), |
10670 |
-+ GFP_KERNEL); |
10671 |
-+ if (!girq->parents) |
10672 |
-+ return -ENOMEM; |
10673 |
-+ girq->parents[0] = irq; |
10674 |
-+ girq->default_type = IRQ_TYPE_NONE; |
10675 |
-+ girq->handler = handle_edge_irq; |
10676 |
-+ } |
10677 |
- |
10678 |
- ret = devm_gpiochip_add_data(&pdev->dev, gc, info); |
10679 |
- if (ret) |
10680 |
-diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
10681 |
-index 098951346339..d7869b636889 100644 |
10682 |
---- a/drivers/pinctrl/pinctrl-rockchip.c |
10683 |
-+++ b/drivers/pinctrl/pinctrl-rockchip.c |
10684 |
-@@ -508,8 +508,8 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
10685 |
- } |
10686 |
- |
10687 |
- map_num += grp->npins; |
10688 |
-- new_map = devm_kcalloc(pctldev->dev, map_num, sizeof(*new_map), |
10689 |
-- GFP_KERNEL); |
10690 |
-+ |
10691 |
-+ new_map = kcalloc(map_num, sizeof(*new_map), GFP_KERNEL); |
10692 |
- if (!new_map) |
10693 |
- return -ENOMEM; |
10694 |
- |
10695 |
-@@ -519,7 +519,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
10696 |
- /* create mux map */ |
10697 |
- parent = of_get_parent(np); |
10698 |
- if (!parent) { |
10699 |
-- devm_kfree(pctldev->dev, new_map); |
10700 |
-+ kfree(new_map); |
10701 |
- return -EINVAL; |
10702 |
- } |
10703 |
- new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; |
10704 |
-@@ -546,6 +546,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, |
10705 |
- static void rockchip_dt_free_map(struct pinctrl_dev *pctldev, |
10706 |
- struct pinctrl_map *map, unsigned num_maps) |
10707 |
- { |
10708 |
-+ kfree(map); |
10709 |
- } |
10710 |
- |
10711 |
- static const struct pinctrl_ops rockchip_pctrl_ops = { |
10712 |
-diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c |
10713 |
-index da2d8365c690..ff4a7fb518bb 100644 |
10714 |
---- a/drivers/pinctrl/pinctrl-rza1.c |
10715 |
-+++ b/drivers/pinctrl/pinctrl-rza1.c |
10716 |
-@@ -418,7 +418,7 @@ static const struct rza1_bidir_entry rza1l_bidir_entries[RZA1_NPORTS] = { |
10717 |
- }; |
10718 |
- |
10719 |
- static const struct rza1_swio_entry rza1l_swio_entries[] = { |
10720 |
-- [0] = { ARRAY_SIZE(rza1h_swio_pins), rza1h_swio_pins }, |
10721 |
-+ [0] = { ARRAY_SIZE(rza1l_swio_pins), rza1l_swio_pins }, |
10722 |
- }; |
10723 |
- |
10724 |
- /* RZ/A1L (r7s72102x) pinmux flags table */ |
10725 |
-diff --git a/drivers/pinctrl/qcom/pinctrl-ipq6018.c b/drivers/pinctrl/qcom/pinctrl-ipq6018.c |
10726 |
-index 38c33a778cb8..ec50a3b4bd16 100644 |
10727 |
---- a/drivers/pinctrl/qcom/pinctrl-ipq6018.c |
10728 |
-+++ b/drivers/pinctrl/qcom/pinctrl-ipq6018.c |
10729 |
-@@ -367,7 +367,8 @@ static const char * const wci20_groups[] = { |
10730 |
- |
10731 |
- static const char * const qpic_pad_groups[] = { |
10732 |
- "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio9", "gpio10", |
10733 |
-- "gpio11", "gpio17", |
10734 |
-+ "gpio11", "gpio17", "gpio15", "gpio12", "gpio13", "gpio14", "gpio5", |
10735 |
-+ "gpio6", "gpio7", "gpio8", |
10736 |
- }; |
10737 |
- |
10738 |
- static const char * const burn0_groups[] = { |
10739 |
-diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c |
10740 |
-index 1ebcb957c654..63a287d5795f 100644 |
10741 |
---- a/drivers/pinctrl/sirf/pinctrl-sirf.c |
10742 |
-+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c |
10743 |
-@@ -794,13 +794,17 @@ static int sirfsoc_gpio_probe(struct device_node *np) |
10744 |
- return -ENODEV; |
10745 |
- |
10746 |
- sgpio = devm_kzalloc(&pdev->dev, sizeof(*sgpio), GFP_KERNEL); |
10747 |
-- if (!sgpio) |
10748 |
-- return -ENOMEM; |
10749 |
-+ if (!sgpio) { |
10750 |
-+ err = -ENOMEM; |
10751 |
-+ goto out_put_device; |
10752 |
-+ } |
10753 |
- spin_lock_init(&sgpio->lock); |
10754 |
- |
10755 |
- regs = of_iomap(np, 0); |
10756 |
-- if (!regs) |
10757 |
-- return -ENOMEM; |
10758 |
-+ if (!regs) { |
10759 |
-+ err = -ENOMEM; |
10760 |
-+ goto out_put_device; |
10761 |
-+ } |
10762 |
- |
10763 |
- sgpio->chip.gc.request = sirfsoc_gpio_request; |
10764 |
- sgpio->chip.gc.free = sirfsoc_gpio_free; |
10765 |
-@@ -824,8 +828,10 @@ static int sirfsoc_gpio_probe(struct device_node *np) |
10766 |
- girq->parents = devm_kcalloc(&pdev->dev, SIRFSOC_GPIO_NO_OF_BANKS, |
10767 |
- sizeof(*girq->parents), |
10768 |
- GFP_KERNEL); |
10769 |
-- if (!girq->parents) |
10770 |
-- return -ENOMEM; |
10771 |
-+ if (!girq->parents) { |
10772 |
-+ err = -ENOMEM; |
10773 |
-+ goto out_put_device; |
10774 |
-+ } |
10775 |
- for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { |
10776 |
- bank = &sgpio->sgpio_bank[i]; |
10777 |
- spin_lock_init(&bank->lock); |
10778 |
-@@ -868,6 +874,8 @@ out_no_range: |
10779 |
- gpiochip_remove(&sgpio->chip.gc); |
10780 |
- out: |
10781 |
- iounmap(regs); |
10782 |
-+out_put_device: |
10783 |
-+ put_device(&pdev->dev); |
10784 |
- return err; |
10785 |
- } |
10786 |
- |
10787 |
-diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig |
10788 |
-index f3424fdce341..d37ec0d03237 100644 |
10789 |
---- a/drivers/power/supply/Kconfig |
10790 |
-+++ b/drivers/power/supply/Kconfig |
10791 |
-@@ -577,7 +577,7 @@ config CHARGER_BQ24257 |
10792 |
- tristate "TI BQ24250/24251/24257 battery charger driver" |
10793 |
- depends on I2C |
10794 |
- depends on GPIOLIB || COMPILE_TEST |
10795 |
-- depends on REGMAP_I2C |
10796 |
-+ select REGMAP_I2C |
10797 |
- help |
10798 |
- Say Y to enable support for the TI BQ24250, BQ24251, and BQ24257 battery |
10799 |
- chargers. |
10800 |
-diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c |
10801 |
-index 84a206f42a8e..e7931ffb7151 100644 |
10802 |
---- a/drivers/power/supply/lp8788-charger.c |
10803 |
-+++ b/drivers/power/supply/lp8788-charger.c |
10804 |
-@@ -572,27 +572,14 @@ static void lp8788_setup_adc_channel(struct device *dev, |
10805 |
- return; |
10806 |
- |
10807 |
- /* ADC channel for battery voltage */ |
10808 |
-- chan = iio_channel_get(dev, pdata->adc_vbatt); |
10809 |
-+ chan = devm_iio_channel_get(dev, pdata->adc_vbatt); |
10810 |
- pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan; |
10811 |
- |
10812 |
- /* ADC channel for battery temperature */ |
10813 |
-- chan = iio_channel_get(dev, pdata->adc_batt_temp); |
10814 |
-+ chan = devm_iio_channel_get(dev, pdata->adc_batt_temp); |
10815 |
- pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan; |
10816 |
- } |
10817 |
- |
10818 |
--static void lp8788_release_adc_channel(struct lp8788_charger *pchg) |
10819 |
--{ |
10820 |
-- int i; |
10821 |
-- |
10822 |
-- for (i = 0; i < LP8788_NUM_CHG_ADC; i++) { |
10823 |
-- if (!pchg->chan[i]) |
10824 |
-- continue; |
10825 |
-- |
10826 |
-- iio_channel_release(pchg->chan[i]); |
10827 |
-- pchg->chan[i] = NULL; |
10828 |
-- } |
10829 |
--} |
10830 |
-- |
10831 |
- static ssize_t lp8788_show_charger_status(struct device *dev, |
10832 |
- struct device_attribute *attr, char *buf) |
10833 |
- { |
10834 |
-@@ -735,7 +722,6 @@ static int lp8788_charger_remove(struct platform_device *pdev) |
10835 |
- flush_work(&pchg->charger_work); |
10836 |
- lp8788_irq_unregister(pdev, pchg); |
10837 |
- lp8788_psy_unregister(pchg); |
10838 |
-- lp8788_release_adc_channel(pchg); |
10839 |
- |
10840 |
- return 0; |
10841 |
- } |
10842 |
-diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c |
10843 |
-index c1d124b8be0c..d102921b3ab2 100644 |
10844 |
---- a/drivers/power/supply/smb347-charger.c |
10845 |
-+++ b/drivers/power/supply/smb347-charger.c |
10846 |
-@@ -1138,6 +1138,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg) |
10847 |
- switch (reg) { |
10848 |
- case IRQSTAT_A: |
10849 |
- case IRQSTAT_C: |
10850 |
-+ case IRQSTAT_D: |
10851 |
- case IRQSTAT_E: |
10852 |
- case IRQSTAT_F: |
10853 |
- case STAT_A: |
10854 |
-diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c |
10855 |
-index 9973c442b455..6b3cbc0490c6 100644 |
10856 |
---- a/drivers/pwm/core.c |
10857 |
-+++ b/drivers/pwm/core.c |
10858 |
-@@ -121,7 +121,7 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) |
10859 |
- pwm->chip->ops->get_state(pwm->chip, pwm, &pwm->state); |
10860 |
- trace_pwm_get(pwm, &pwm->state); |
10861 |
- |
10862 |
-- if (IS_ENABLED(PWM_DEBUG)) |
10863 |
-+ if (IS_ENABLED(CONFIG_PWM_DEBUG)) |
10864 |
- pwm->last = pwm->state; |
10865 |
- } |
10866 |
- |
10867 |
-diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c |
10868 |
-index c9e57bd109fb..599a0f66a384 100644 |
10869 |
---- a/drivers/pwm/pwm-img.c |
10870 |
-+++ b/drivers/pwm/pwm-img.c |
10871 |
-@@ -129,8 +129,10 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, |
10872 |
- duty = DIV_ROUND_UP(timebase * duty_ns, period_ns); |
10873 |
- |
10874 |
- ret = pm_runtime_get_sync(chip->dev); |
10875 |
-- if (ret < 0) |
10876 |
-+ if (ret < 0) { |
10877 |
-+ pm_runtime_put_autosuspend(chip->dev); |
10878 |
- return ret; |
10879 |
-+ } |
10880 |
- |
10881 |
- val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); |
10882 |
- val &= ~(PWM_CTRL_CFG_DIV_MASK << PWM_CTRL_CFG_DIV_SHIFT(pwm->hwpwm)); |
10883 |
-@@ -331,8 +333,10 @@ static int img_pwm_remove(struct platform_device *pdev) |
10884 |
- int ret; |
10885 |
- |
10886 |
- ret = pm_runtime_get_sync(&pdev->dev); |
10887 |
-- if (ret < 0) |
10888 |
-+ if (ret < 0) { |
10889 |
-+ pm_runtime_put(&pdev->dev); |
10890 |
- return ret; |
10891 |
-+ } |
10892 |
- |
10893 |
- for (i = 0; i < pwm_chip->chip.npwm; i++) { |
10894 |
- val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); |
10895 |
-diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c |
10896 |
-index a6e40d4c485f..732a6f3701e8 100644 |
10897 |
---- a/drivers/pwm/pwm-imx27.c |
10898 |
-+++ b/drivers/pwm/pwm-imx27.c |
10899 |
-@@ -150,13 +150,12 @@ static void pwm_imx27_get_state(struct pwm_chip *chip, |
10900 |
- |
10901 |
- prescaler = MX3_PWMCR_PRESCALER_GET(val); |
10902 |
- pwm_clk = clk_get_rate(imx->clk_per); |
10903 |
-- pwm_clk = DIV_ROUND_CLOSEST_ULL(pwm_clk, prescaler); |
10904 |
- val = readl(imx->mmio_base + MX3_PWMPR); |
10905 |
- period = val >= MX3_PWMPR_MAX ? MX3_PWMPR_MAX : val; |
10906 |
- |
10907 |
- /* PWMOUT (Hz) = PWMCLK / (PWMPR + 2) */ |
10908 |
-- tmp = NSEC_PER_SEC * (u64)(period + 2); |
10909 |
-- state->period = DIV_ROUND_CLOSEST_ULL(tmp, pwm_clk); |
10910 |
-+ tmp = NSEC_PER_SEC * (u64)(period + 2) * prescaler; |
10911 |
-+ state->period = DIV_ROUND_UP_ULL(tmp, pwm_clk); |
10912 |
- |
10913 |
- /* |
10914 |
- * PWMSAR can be read only if PWM is enabled. If the PWM is disabled, |
10915 |
-@@ -167,8 +166,8 @@ static void pwm_imx27_get_state(struct pwm_chip *chip, |
10916 |
- else |
10917 |
- val = imx->duty_cycle; |
10918 |
- |
10919 |
-- tmp = NSEC_PER_SEC * (u64)(val); |
10920 |
-- state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, pwm_clk); |
10921 |
-+ tmp = NSEC_PER_SEC * (u64)(val) * prescaler; |
10922 |
-+ state->duty_cycle = DIV_ROUND_UP_ULL(tmp, pwm_clk); |
10923 |
- |
10924 |
- pwm_imx27_clk_disable_unprepare(imx); |
10925 |
- } |
10926 |
-@@ -220,22 +219,23 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, |
10927 |
- struct pwm_imx27_chip *imx = to_pwm_imx27_chip(chip); |
10928 |
- struct pwm_state cstate; |
10929 |
- unsigned long long c; |
10930 |
-+ unsigned long long clkrate; |
10931 |
- int ret; |
10932 |
- u32 cr; |
10933 |
- |
10934 |
- pwm_get_state(pwm, &cstate); |
10935 |
- |
10936 |
-- c = clk_get_rate(imx->clk_per); |
10937 |
-- c *= state->period; |
10938 |
-+ clkrate = clk_get_rate(imx->clk_per); |
10939 |
-+ c = clkrate * state->period; |
10940 |
- |
10941 |
-- do_div(c, 1000000000); |
10942 |
-+ do_div(c, NSEC_PER_SEC); |
10943 |
- period_cycles = c; |
10944 |
- |
10945 |
- prescale = period_cycles / 0x10000 + 1; |
10946 |
- |
10947 |
- period_cycles /= prescale; |
10948 |
-- c = (unsigned long long)period_cycles * state->duty_cycle; |
10949 |
-- do_div(c, state->period); |
10950 |
-+ c = clkrate * state->duty_cycle; |
10951 |
-+ do_div(c, NSEC_PER_SEC * prescale); |
10952 |
- duty_cycles = c; |
10953 |
- |
10954 |
- /* |
10955 |
-diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c |
10956 |
-index 2bead57c9cf9..ac13e7b046a6 100644 |
10957 |
---- a/drivers/remoteproc/mtk_scp.c |
10958 |
-+++ b/drivers/remoteproc/mtk_scp.c |
10959 |
-@@ -132,8 +132,8 @@ static int scp_ipi_init(struct mtk_scp *scp) |
10960 |
- (struct mtk_share_obj __iomem *)(scp->sram_base + recv_offset); |
10961 |
- scp->send_buf = |
10962 |
- (struct mtk_share_obj __iomem *)(scp->sram_base + send_offset); |
10963 |
-- memset_io(scp->recv_buf, 0, sizeof(scp->recv_buf)); |
10964 |
-- memset_io(scp->send_buf, 0, sizeof(scp->send_buf)); |
10965 |
-+ memset_io(scp->recv_buf, 0, sizeof(*scp->recv_buf)); |
10966 |
-+ memset_io(scp->send_buf, 0, sizeof(*scp->send_buf)); |
10967 |
- |
10968 |
- return 0; |
10969 |
- } |
10970 |
-diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c |
10971 |
-index 5475d4f808a8..629abcee2c1d 100644 |
10972 |
---- a/drivers/remoteproc/qcom_q6v5_mss.c |
10973 |
-+++ b/drivers/remoteproc/qcom_q6v5_mss.c |
10974 |
-@@ -69,13 +69,9 @@ |
10975 |
- #define AXI_HALTREQ_REG 0x0 |
10976 |
- #define AXI_HALTACK_REG 0x4 |
10977 |
- #define AXI_IDLE_REG 0x8 |
10978 |
--#define NAV_AXI_HALTREQ_BIT BIT(0) |
10979 |
--#define NAV_AXI_HALTACK_BIT BIT(1) |
10980 |
--#define NAV_AXI_IDLE_BIT BIT(2) |
10981 |
- #define AXI_GATING_VALID_OVERRIDE BIT(0) |
10982 |
- |
10983 |
- #define HALT_ACK_TIMEOUT_US 100000 |
10984 |
--#define NAV_HALT_ACK_TIMEOUT_US 200 |
10985 |
- |
10986 |
- /* QDSP6SS_RESET */ |
10987 |
- #define Q6SS_STOP_CORE BIT(0) |
10988 |
-@@ -143,7 +139,7 @@ struct rproc_hexagon_res { |
10989 |
- int version; |
10990 |
- bool need_mem_protection; |
10991 |
- bool has_alt_reset; |
10992 |
-- bool has_halt_nav; |
10993 |
-+ bool has_spare_reg; |
10994 |
- }; |
10995 |
- |
10996 |
- struct q6v5 { |
10997 |
-@@ -154,13 +150,11 @@ struct q6v5 { |
10998 |
- void __iomem *rmb_base; |
10999 |
- |
11000 |
- struct regmap *halt_map; |
11001 |
-- struct regmap *halt_nav_map; |
11002 |
- struct regmap *conn_map; |
11003 |
- |
11004 |
- u32 halt_q6; |
11005 |
- u32 halt_modem; |
11006 |
- u32 halt_nc; |
11007 |
-- u32 halt_nav; |
11008 |
- u32 conn_box; |
11009 |
- |
11010 |
- struct reset_control *mss_restart; |
11011 |
-@@ -206,7 +200,7 @@ struct q6v5 { |
11012 |
- struct qcom_sysmon *sysmon; |
11013 |
- bool need_mem_protection; |
11014 |
- bool has_alt_reset; |
11015 |
-- bool has_halt_nav; |
11016 |
-+ bool has_spare_reg; |
11017 |
- int mpss_perm; |
11018 |
- int mba_perm; |
11019 |
- const char *hexagon_mdt_image; |
11020 |
-@@ -427,21 +421,19 @@ static int q6v5_reset_assert(struct q6v5 *qproc) |
11021 |
- reset_control_assert(qproc->pdc_reset); |
11022 |
- ret = reset_control_reset(qproc->mss_restart); |
11023 |
- reset_control_deassert(qproc->pdc_reset); |
11024 |
-- } else if (qproc->has_halt_nav) { |
11025 |
-+ } else if (qproc->has_spare_reg) { |
11026 |
- /* |
11027 |
- * When the AXI pipeline is being reset with the Q6 modem partly |
11028 |
- * operational there is possibility of AXI valid signal to |
11029 |
- * glitch, leading to spurious transactions and Q6 hangs. A work |
11030 |
- * around is employed by asserting the AXI_GATING_VALID_OVERRIDE |
11031 |
-- * BIT before triggering Q6 MSS reset. Both the HALTREQ and |
11032 |
-- * AXI_GATING_VALID_OVERRIDE are withdrawn post MSS assert |
11033 |
-- * followed by a MSS deassert, while holding the PDC reset. |
11034 |
-+ * BIT before triggering Q6 MSS reset. AXI_GATING_VALID_OVERRIDE |
11035 |
-+ * is withdrawn post MSS assert followed by a MSS deassert, |
11036 |
-+ * while holding the PDC reset. |
11037 |
- */ |
11038 |
- reset_control_assert(qproc->pdc_reset); |
11039 |
- regmap_update_bits(qproc->conn_map, qproc->conn_box, |
11040 |
- AXI_GATING_VALID_OVERRIDE, 1); |
11041 |
-- regmap_update_bits(qproc->halt_nav_map, qproc->halt_nav, |
11042 |
-- NAV_AXI_HALTREQ_BIT, 0); |
11043 |
- reset_control_assert(qproc->mss_restart); |
11044 |
- reset_control_deassert(qproc->pdc_reset); |
11045 |
- regmap_update_bits(qproc->conn_map, qproc->conn_box, |
11046 |
-@@ -464,7 +456,7 @@ static int q6v5_reset_deassert(struct q6v5 *qproc) |
11047 |
- ret = reset_control_reset(qproc->mss_restart); |
11048 |
- writel(0, qproc->rmb_base + RMB_MBA_ALT_RESET); |
11049 |
- reset_control_deassert(qproc->pdc_reset); |
11050 |
-- } else if (qproc->has_halt_nav) { |
11051 |
-+ } else if (qproc->has_spare_reg) { |
11052 |
- ret = reset_control_reset(qproc->mss_restart); |
11053 |
- } else { |
11054 |
- ret = reset_control_deassert(qproc->mss_restart); |
11055 |
-@@ -761,32 +753,6 @@ static void q6v5proc_halt_axi_port(struct q6v5 *qproc, |
11056 |
- regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); |
11057 |
- } |
11058 |
- |
11059 |
--static void q6v5proc_halt_nav_axi_port(struct q6v5 *qproc, |
11060 |
-- struct regmap *halt_map, |
11061 |
-- u32 offset) |
11062 |
--{ |
11063 |
-- unsigned int val; |
11064 |
-- int ret; |
11065 |
-- |
11066 |
-- /* Check if we're already idle */ |
11067 |
-- ret = regmap_read(halt_map, offset, &val); |
11068 |
-- if (!ret && (val & NAV_AXI_IDLE_BIT)) |
11069 |
-- return; |
11070 |
-- |
11071 |
-- /* Assert halt request */ |
11072 |
-- regmap_update_bits(halt_map, offset, NAV_AXI_HALTREQ_BIT, |
11073 |
-- NAV_AXI_HALTREQ_BIT); |
11074 |
-- |
11075 |
-- /* Wait for halt ack*/ |
11076 |
-- regmap_read_poll_timeout(halt_map, offset, val, |
11077 |
-- (val & NAV_AXI_HALTACK_BIT), |
11078 |
-- 5, NAV_HALT_ACK_TIMEOUT_US); |
11079 |
-- |
11080 |
-- ret = regmap_read(halt_map, offset, &val); |
11081 |
-- if (ret || !(val & NAV_AXI_IDLE_BIT)) |
11082 |
-- dev_err(qproc->dev, "port failed halt\n"); |
11083 |
--} |
11084 |
-- |
11085 |
- static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw) |
11086 |
- { |
11087 |
- unsigned long dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS; |
11088 |
-@@ -951,9 +917,6 @@ static int q6v5_mba_load(struct q6v5 *qproc) |
11089 |
- halt_axi_ports: |
11090 |
- q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6); |
11091 |
- q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem); |
11092 |
-- if (qproc->has_halt_nav) |
11093 |
-- q6v5proc_halt_nav_axi_port(qproc, qproc->halt_nav_map, |
11094 |
-- qproc->halt_nav); |
11095 |
- q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc); |
11096 |
- |
11097 |
- reclaim_mba: |
11098 |
-@@ -1001,9 +964,6 @@ static void q6v5_mba_reclaim(struct q6v5 *qproc) |
11099 |
- |
11100 |
- q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6); |
11101 |
- q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem); |
11102 |
-- if (qproc->has_halt_nav) |
11103 |
-- q6v5proc_halt_nav_axi_port(qproc, qproc->halt_nav_map, |
11104 |
-- qproc->halt_nav); |
11105 |
- q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc); |
11106 |
- if (qproc->version == MSS_MSM8996) { |
11107 |
- /* |
11108 |
-@@ -1156,7 +1116,13 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11109 |
- goto release_firmware; |
11110 |
- } |
11111 |
- |
11112 |
-- ptr = qproc->mpss_region + offset; |
11113 |
-+ ptr = ioremap_wc(qproc->mpss_phys + offset, phdr->p_memsz); |
11114 |
-+ if (!ptr) { |
11115 |
-+ dev_err(qproc->dev, |
11116 |
-+ "unable to map memory region: %pa+%zx-%x\n", |
11117 |
-+ &qproc->mpss_phys, offset, phdr->p_memsz); |
11118 |
-+ goto release_firmware; |
11119 |
-+ } |
11120 |
- |
11121 |
- if (phdr->p_filesz && phdr->p_offset < fw->size) { |
11122 |
- /* Firmware is large enough to be non-split */ |
11123 |
-@@ -1165,6 +1131,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11124 |
- "failed to load segment %d from truncated file %s\n", |
11125 |
- i, fw_name); |
11126 |
- ret = -EINVAL; |
11127 |
-+ iounmap(ptr); |
11128 |
- goto release_firmware; |
11129 |
- } |
11130 |
- |
11131 |
-@@ -1175,6 +1142,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11132 |
- ret = request_firmware(&seg_fw, fw_name, qproc->dev); |
11133 |
- if (ret) { |
11134 |
- dev_err(qproc->dev, "failed to load %s\n", fw_name); |
11135 |
-+ iounmap(ptr); |
11136 |
- goto release_firmware; |
11137 |
- } |
11138 |
- |
11139 |
-@@ -1187,6 +1155,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) |
11140 |
- memset(ptr + phdr->p_filesz, 0, |
11141 |
- phdr->p_memsz - phdr->p_filesz); |
11142 |
- } |
11143 |
-+ iounmap(ptr); |
11144 |
- size += phdr->p_memsz; |
11145 |
- |
11146 |
- code_length = readl(qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); |
11147 |
-@@ -1236,7 +1205,8 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, |
11148 |
- int ret = 0; |
11149 |
- struct q6v5 *qproc = rproc->priv; |
11150 |
- unsigned long mask = BIT((unsigned long)segment->priv); |
11151 |
-- void *ptr = rproc_da_to_va(rproc, segment->da, segment->size); |
11152 |
-+ int offset = segment->da - qproc->mpss_reloc; |
11153 |
-+ void *ptr = NULL; |
11154 |
- |
11155 |
- /* Unlock mba before copying segments */ |
11156 |
- if (!qproc->dump_mba_loaded) { |
11157 |
-@@ -1250,10 +1220,15 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, |
11158 |
- } |
11159 |
- } |
11160 |
- |
11161 |
-- if (!ptr || ret) |
11162 |
-- memset(dest, 0xff, segment->size); |
11163 |
-- else |
11164 |
-+ if (!ret) |
11165 |
-+ ptr = ioremap_wc(qproc->mpss_phys + offset, segment->size); |
11166 |
-+ |
11167 |
-+ if (ptr) { |
11168 |
- memcpy(dest, ptr, segment->size); |
11169 |
-+ iounmap(ptr); |
11170 |
-+ } else { |
11171 |
-+ memset(dest, 0xff, segment->size); |
11172 |
-+ } |
11173 |
- |
11174 |
- qproc->dump_segment_mask |= mask; |
11175 |
- |
11176 |
-@@ -1432,36 +1407,12 @@ static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev) |
11177 |
- qproc->halt_modem = args.args[1]; |
11178 |
- qproc->halt_nc = args.args[2]; |
11179 |
- |
11180 |
-- if (qproc->has_halt_nav) { |
11181 |
-- struct platform_device *nav_pdev; |
11182 |
-- |
11183 |
-+ if (qproc->has_spare_reg) { |
11184 |
- ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node, |
11185 |
-- "qcom,halt-nav-regs", |
11186 |
-+ "qcom,spare-regs", |
11187 |
- 1, 0, &args); |
11188 |
- if (ret < 0) { |
11189 |
-- dev_err(&pdev->dev, "failed to parse halt-nav-regs\n"); |
11190 |
-- return -EINVAL; |
11191 |
-- } |
11192 |
-- |
11193 |
-- nav_pdev = of_find_device_by_node(args.np); |
11194 |
-- of_node_put(args.np); |
11195 |
-- if (!nav_pdev) { |
11196 |
-- dev_err(&pdev->dev, "failed to get mss clock device\n"); |
11197 |
-- return -EPROBE_DEFER; |
11198 |
-- } |
11199 |
-- |
11200 |
-- qproc->halt_nav_map = dev_get_regmap(&nav_pdev->dev, NULL); |
11201 |
-- if (!qproc->halt_nav_map) { |
11202 |
-- dev_err(&pdev->dev, "failed to get map from device\n"); |
11203 |
-- return -EINVAL; |
11204 |
-- } |
11205 |
-- qproc->halt_nav = args.args[0]; |
11206 |
-- |
11207 |
-- ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node, |
11208 |
-- "qcom,halt-nav-regs", |
11209 |
-- 1, 1, &args); |
11210 |
-- if (ret < 0) { |
11211 |
-- dev_err(&pdev->dev, "failed to parse halt-nav-regs\n"); |
11212 |
-+ dev_err(&pdev->dev, "failed to parse spare-regs\n"); |
11213 |
- return -EINVAL; |
11214 |
- } |
11215 |
- |
11216 |
-@@ -1547,7 +1498,7 @@ static int q6v5_init_reset(struct q6v5 *qproc) |
11217 |
- return PTR_ERR(qproc->mss_restart); |
11218 |
- } |
11219 |
- |
11220 |
-- if (qproc->has_alt_reset || qproc->has_halt_nav) { |
11221 |
-+ if (qproc->has_alt_reset || qproc->has_spare_reg) { |
11222 |
- qproc->pdc_reset = devm_reset_control_get_exclusive(qproc->dev, |
11223 |
- "pdc_reset"); |
11224 |
- if (IS_ERR(qproc->pdc_reset)) { |
11225 |
-@@ -1595,12 +1546,6 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) |
11226 |
- |
11227 |
- qproc->mpss_phys = qproc->mpss_reloc = r.start; |
11228 |
- qproc->mpss_size = resource_size(&r); |
11229 |
-- qproc->mpss_region = devm_ioremap_wc(qproc->dev, qproc->mpss_phys, qproc->mpss_size); |
11230 |
-- if (!qproc->mpss_region) { |
11231 |
-- dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n", |
11232 |
-- &r.start, qproc->mpss_size); |
11233 |
-- return -EBUSY; |
11234 |
-- } |
11235 |
- |
11236 |
- return 0; |
11237 |
- } |
11238 |
-@@ -1679,7 +1624,7 @@ static int q6v5_probe(struct platform_device *pdev) |
11239 |
- |
11240 |
- platform_set_drvdata(pdev, qproc); |
11241 |
- |
11242 |
-- qproc->has_halt_nav = desc->has_halt_nav; |
11243 |
-+ qproc->has_spare_reg = desc->has_spare_reg; |
11244 |
- ret = q6v5_init_mem(qproc, pdev); |
11245 |
- if (ret) |
11246 |
- goto free_rproc; |
11247 |
-@@ -1828,8 +1773,6 @@ static const struct rproc_hexagon_res sc7180_mss = { |
11248 |
- .active_clk_names = (char*[]){ |
11249 |
- "mnoc_axi", |
11250 |
- "nav", |
11251 |
-- "mss_nav", |
11252 |
-- "mss_crypto", |
11253 |
- NULL |
11254 |
- }, |
11255 |
- .active_pd_names = (char*[]){ |
11256 |
-@@ -1844,7 +1787,7 @@ static const struct rproc_hexagon_res sc7180_mss = { |
11257 |
- }, |
11258 |
- .need_mem_protection = true, |
11259 |
- .has_alt_reset = false, |
11260 |
-- .has_halt_nav = true, |
11261 |
-+ .has_spare_reg = true, |
11262 |
- .version = MSS_SC7180, |
11263 |
- }; |
11264 |
- |
11265 |
-@@ -1879,7 +1822,7 @@ static const struct rproc_hexagon_res sdm845_mss = { |
11266 |
- }, |
11267 |
- .need_mem_protection = true, |
11268 |
- .has_alt_reset = true, |
11269 |
-- .has_halt_nav = false, |
11270 |
-+ .has_spare_reg = false, |
11271 |
- .version = MSS_SDM845, |
11272 |
- }; |
11273 |
- |
11274 |
-@@ -1906,7 +1849,7 @@ static const struct rproc_hexagon_res msm8998_mss = { |
11275 |
- }, |
11276 |
- .need_mem_protection = true, |
11277 |
- .has_alt_reset = false, |
11278 |
-- .has_halt_nav = false, |
11279 |
-+ .has_spare_reg = false, |
11280 |
- .version = MSS_MSM8998, |
11281 |
- }; |
11282 |
- |
11283 |
-@@ -1936,7 +1879,7 @@ static const struct rproc_hexagon_res msm8996_mss = { |
11284 |
- }, |
11285 |
- .need_mem_protection = true, |
11286 |
- .has_alt_reset = false, |
11287 |
-- .has_halt_nav = false, |
11288 |
-+ .has_spare_reg = false, |
11289 |
- .version = MSS_MSM8996, |
11290 |
- }; |
11291 |
- |
11292 |
-@@ -1969,7 +1912,7 @@ static const struct rproc_hexagon_res msm8916_mss = { |
11293 |
- }, |
11294 |
- .need_mem_protection = false, |
11295 |
- .has_alt_reset = false, |
11296 |
-- .has_halt_nav = false, |
11297 |
-+ .has_spare_reg = false, |
11298 |
- .version = MSS_MSM8916, |
11299 |
- }; |
11300 |
- |
11301 |
-@@ -2010,7 +1953,7 @@ static const struct rproc_hexagon_res msm8974_mss = { |
11302 |
- }, |
11303 |
- .need_mem_protection = false, |
11304 |
- .has_alt_reset = false, |
11305 |
-- .has_halt_nav = false, |
11306 |
-+ .has_spare_reg = false, |
11307 |
- .version = MSS_MSM8974, |
11308 |
- }; |
11309 |
- |
11310 |
-diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c |
11311 |
-index be15aace9b3c..8f79cfd2e467 100644 |
11312 |
---- a/drivers/remoteproc/remoteproc_core.c |
11313 |
-+++ b/drivers/remoteproc/remoteproc_core.c |
11314 |
-@@ -2053,6 +2053,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, |
11315 |
- rproc->dev.type = &rproc_type; |
11316 |
- rproc->dev.class = &rproc_class; |
11317 |
- rproc->dev.driver_data = rproc; |
11318 |
-+ idr_init(&rproc->notifyids); |
11319 |
- |
11320 |
- /* Assign a unique device index and name */ |
11321 |
- rproc->index = ida_simple_get(&rproc_dev_index, 0, 0, GFP_KERNEL); |
11322 |
-@@ -2078,8 +2079,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, |
11323 |
- |
11324 |
- mutex_init(&rproc->lock); |
11325 |
- |
11326 |
-- idr_init(&rproc->notifyids); |
11327 |
-- |
11328 |
- INIT_LIST_HEAD(&rproc->carveouts); |
11329 |
- INIT_LIST_HEAD(&rproc->mappings); |
11330 |
- INIT_LIST_HEAD(&rproc->traces); |
11331 |
-diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c |
11332 |
-index afce2c0b4bd6..d6802e6191cb 100644 |
11333 |
---- a/drivers/rtc/rtc-mc13xxx.c |
11334 |
-+++ b/drivers/rtc/rtc-mc13xxx.c |
11335 |
-@@ -308,8 +308,10 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) |
11336 |
- mc13xxx_unlock(mc13xxx); |
11337 |
- |
11338 |
- ret = rtc_register_device(priv->rtc); |
11339 |
-- if (ret) |
11340 |
-+ if (ret) { |
11341 |
-+ mc13xxx_lock(mc13xxx); |
11342 |
- goto err_irq_request; |
11343 |
-+ } |
11344 |
- |
11345 |
- return 0; |
11346 |
- |
11347 |
-diff --git a/drivers/rtc/rtc-rc5t619.c b/drivers/rtc/rtc-rc5t619.c |
11348 |
-index 24e386ecbc7e..dd1a20977478 100644 |
11349 |
---- a/drivers/rtc/rtc-rc5t619.c |
11350 |
-+++ b/drivers/rtc/rtc-rc5t619.c |
11351 |
-@@ -356,10 +356,8 @@ static int rc5t619_rtc_probe(struct platform_device *pdev) |
11352 |
- int err; |
11353 |
- |
11354 |
- rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL); |
11355 |
-- if (IS_ERR(rtc)) { |
11356 |
-- err = PTR_ERR(rtc); |
11357 |
-+ if (!rtc) |
11358 |
- return -ENOMEM; |
11359 |
-- } |
11360 |
- |
11361 |
- rtc->rn5t618 = rn5t618; |
11362 |
- |
11363 |
-diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c |
11364 |
-index a0ddc86c975a..ec84db0b3d7a 100644 |
11365 |
---- a/drivers/rtc/rtc-rv3028.c |
11366 |
-+++ b/drivers/rtc/rtc-rv3028.c |
11367 |
-@@ -755,6 +755,8 @@ static int rv3028_probe(struct i2c_client *client) |
11368 |
- return -ENOMEM; |
11369 |
- |
11370 |
- rv3028->regmap = devm_regmap_init_i2c(client, ®map_config); |
11371 |
-+ if (IS_ERR(rv3028->regmap)) |
11372 |
-+ return PTR_ERR(rv3028->regmap); |
11373 |
- |
11374 |
- i2c_set_clientdata(client, rv3028); |
11375 |
- |
11376 |
-diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h |
11377 |
-index b8453b594679..a2afd7bc100b 100644 |
11378 |
---- a/drivers/s390/cio/qdio.h |
11379 |
-+++ b/drivers/s390/cio/qdio.h |
11380 |
-@@ -364,7 +364,6 @@ static inline int multicast_outbound(struct qdio_q *q) |
11381 |
- extern u64 last_ai_time; |
11382 |
- |
11383 |
- /* prototypes for thin interrupt */ |
11384 |
--void qdio_setup_thinint(struct qdio_irq *irq_ptr); |
11385 |
- int qdio_establish_thinint(struct qdio_irq *irq_ptr); |
11386 |
- void qdio_shutdown_thinint(struct qdio_irq *irq_ptr); |
11387 |
- void tiqdio_add_device(struct qdio_irq *irq_ptr); |
11388 |
-@@ -389,6 +388,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr, |
11389 |
- struct subchannel_id *schid, |
11390 |
- struct qdio_ssqd_desc *data); |
11391 |
- int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data); |
11392 |
-+void qdio_shutdown_irq(struct qdio_irq *irq); |
11393 |
- void qdio_print_subchannel_info(struct qdio_irq *irq_ptr); |
11394 |
- void qdio_release_memory(struct qdio_irq *irq_ptr); |
11395 |
- int qdio_setup_init(void); |
11396 |
-diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c |
11397 |
-index bcc3ab14e72d..80cc811bd2e0 100644 |
11398 |
---- a/drivers/s390/cio/qdio_main.c |
11399 |
-+++ b/drivers/s390/cio/qdio_main.c |
11400 |
-@@ -1154,35 +1154,27 @@ int qdio_shutdown(struct ccw_device *cdev, int how) |
11401 |
- |
11402 |
- /* cleanup subchannel */ |
11403 |
- spin_lock_irq(get_ccwdev_lock(cdev)); |
11404 |
-- |
11405 |
-+ qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP); |
11406 |
- if (how & QDIO_FLAG_CLEANUP_USING_CLEAR) |
11407 |
- rc = ccw_device_clear(cdev, QDIO_DOING_CLEANUP); |
11408 |
- else |
11409 |
- /* default behaviour is halt */ |
11410 |
- rc = ccw_device_halt(cdev, QDIO_DOING_CLEANUP); |
11411 |
-+ spin_unlock_irq(get_ccwdev_lock(cdev)); |
11412 |
- if (rc) { |
11413 |
- DBF_ERROR("%4x SHUTD ERR", irq_ptr->schid.sch_no); |
11414 |
- DBF_ERROR("rc:%4d", rc); |
11415 |
- goto no_cleanup; |
11416 |
- } |
11417 |
- |
11418 |
-- qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP); |
11419 |
-- spin_unlock_irq(get_ccwdev_lock(cdev)); |
11420 |
- wait_event_interruptible_timeout(cdev->private->wait_q, |
11421 |
- irq_ptr->state == QDIO_IRQ_STATE_INACTIVE || |
11422 |
- irq_ptr->state == QDIO_IRQ_STATE_ERR, |
11423 |
- 10 * HZ); |
11424 |
-- spin_lock_irq(get_ccwdev_lock(cdev)); |
11425 |
- |
11426 |
- no_cleanup: |
11427 |
- qdio_shutdown_thinint(irq_ptr); |
11428 |
-- |
11429 |
-- /* restore interrupt handler */ |
11430 |
-- if ((void *)cdev->handler == (void *)qdio_int_handler) { |
11431 |
-- cdev->handler = irq_ptr->orig_handler; |
11432 |
-- cdev->private->intparm = 0; |
11433 |
-- } |
11434 |
-- spin_unlock_irq(get_ccwdev_lock(cdev)); |
11435 |
-+ qdio_shutdown_irq(irq_ptr); |
11436 |
- |
11437 |
- qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); |
11438 |
- mutex_unlock(&irq_ptr->setup_mutex); |
11439 |
-@@ -1352,8 +1344,8 @@ int qdio_establish(struct ccw_device *cdev, |
11440 |
- |
11441 |
- rc = qdio_establish_thinint(irq_ptr); |
11442 |
- if (rc) { |
11443 |
-+ qdio_shutdown_irq(irq_ptr); |
11444 |
- mutex_unlock(&irq_ptr->setup_mutex); |
11445 |
-- qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR); |
11446 |
- return rc; |
11447 |
- } |
11448 |
- |
11449 |
-@@ -1371,8 +1363,9 @@ int qdio_establish(struct ccw_device *cdev, |
11450 |
- if (rc) { |
11451 |
- DBF_ERROR("%4x est IO ERR", irq_ptr->schid.sch_no); |
11452 |
- DBF_ERROR("rc:%4x", rc); |
11453 |
-+ qdio_shutdown_thinint(irq_ptr); |
11454 |
-+ qdio_shutdown_irq(irq_ptr); |
11455 |
- mutex_unlock(&irq_ptr->setup_mutex); |
11456 |
-- qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR); |
11457 |
- return rc; |
11458 |
- } |
11459 |
- |
11460 |
-diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c |
11461 |
-index 3083edd61f0c..8edfa0982221 100644 |
11462 |
---- a/drivers/s390/cio/qdio_setup.c |
11463 |
-+++ b/drivers/s390/cio/qdio_setup.c |
11464 |
-@@ -480,7 +480,6 @@ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data) |
11465 |
- } |
11466 |
- |
11467 |
- setup_qib(irq_ptr, init_data); |
11468 |
-- qdio_setup_thinint(irq_ptr); |
11469 |
- set_impl_params(irq_ptr, init_data->qib_param_field_format, |
11470 |
- init_data->qib_param_field, |
11471 |
- init_data->input_slib_elements, |
11472 |
-@@ -491,6 +490,12 @@ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data) |
11473 |
- |
11474 |
- /* qdr, qib, sls, slsbs, slibs, sbales are filled now */ |
11475 |
- |
11476 |
-+ /* set our IRQ handler */ |
11477 |
-+ spin_lock_irq(get_ccwdev_lock(cdev)); |
11478 |
-+ irq_ptr->orig_handler = cdev->handler; |
11479 |
-+ cdev->handler = qdio_int_handler; |
11480 |
-+ spin_unlock_irq(get_ccwdev_lock(cdev)); |
11481 |
-+ |
11482 |
- /* get qdio commands */ |
11483 |
- ciw = ccw_device_get_ciw(cdev, CIW_TYPE_EQUEUE); |
11484 |
- if (!ciw) { |
11485 |
-@@ -506,12 +511,18 @@ int qdio_setup_irq(struct qdio_irq *irq_ptr, struct qdio_initialize *init_data) |
11486 |
- } |
11487 |
- irq_ptr->aqueue = *ciw; |
11488 |
- |
11489 |
-- /* set new interrupt handler */ |
11490 |
-+ return 0; |
11491 |
-+} |
11492 |
-+ |
11493 |
-+void qdio_shutdown_irq(struct qdio_irq *irq) |
11494 |
-+{ |
11495 |
-+ struct ccw_device *cdev = irq->cdev; |
11496 |
-+ |
11497 |
-+ /* restore IRQ handler */ |
11498 |
- spin_lock_irq(get_ccwdev_lock(cdev)); |
11499 |
-- irq_ptr->orig_handler = cdev->handler; |
11500 |
-- cdev->handler = qdio_int_handler; |
11501 |
-+ cdev->handler = irq->orig_handler; |
11502 |
-+ cdev->private->intparm = 0; |
11503 |
- spin_unlock_irq(get_ccwdev_lock(cdev)); |
11504 |
-- return 0; |
11505 |
- } |
11506 |
- |
11507 |
- void qdio_print_subchannel_info(struct qdio_irq *irq_ptr) |
11508 |
-diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c |
11509 |
-index ae50373617cd..0faa0ad21732 100644 |
11510 |
---- a/drivers/s390/cio/qdio_thinint.c |
11511 |
-+++ b/drivers/s390/cio/qdio_thinint.c |
11512 |
-@@ -227,17 +227,19 @@ int __init tiqdio_register_thinints(void) |
11513 |
- |
11514 |
- int qdio_establish_thinint(struct qdio_irq *irq_ptr) |
11515 |
- { |
11516 |
-+ int rc; |
11517 |
-+ |
11518 |
- if (!is_thinint_irq(irq_ptr)) |
11519 |
- return 0; |
11520 |
-- return set_subchannel_ind(irq_ptr, 0); |
11521 |
--} |
11522 |
- |
11523 |
--void qdio_setup_thinint(struct qdio_irq *irq_ptr) |
11524 |
--{ |
11525 |
-- if (!is_thinint_irq(irq_ptr)) |
11526 |
-- return; |
11527 |
- irq_ptr->dsci = get_indicator(); |
11528 |
- DBF_HEX(&irq_ptr->dsci, sizeof(void *)); |
11529 |
-+ |
11530 |
-+ rc = set_subchannel_ind(irq_ptr, 0); |
11531 |
-+ if (rc) |
11532 |
-+ put_indicator(irq_ptr->dsci); |
11533 |
-+ |
11534 |
-+ return rc; |
11535 |
- } |
11536 |
- |
11537 |
- void qdio_shutdown_thinint(struct qdio_irq *irq_ptr) |
11538 |
-diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c |
11539 |
-index ddb52e7ba622..9a912fd0f70b 100644 |
11540 |
---- a/drivers/scsi/arm/acornscsi.c |
11541 |
-+++ b/drivers/scsi/arm/acornscsi.c |
11542 |
-@@ -2911,8 +2911,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) |
11543 |
- |
11544 |
- ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
11545 |
- ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
11546 |
-- if (!ashost->base || !ashost->fast) |
11547 |
-+ if (!ashost->base || !ashost->fast) { |
11548 |
-+ ret = -ENOMEM; |
11549 |
- goto out_put; |
11550 |
-+ } |
11551 |
- |
11552 |
- host->irq = ec->irq; |
11553 |
- ashost->host = host; |
11554 |
-diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
11555 |
-index 524cdbcd29aa..ec7d01f6e2d5 100644 |
11556 |
---- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
11557 |
-+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |
11558 |
-@@ -959,6 +959,7 @@ static int init_act_open(struct cxgbi_sock *csk) |
11559 |
- struct net_device *ndev = cdev->ports[csk->port_id]; |
11560 |
- struct cxgbi_hba *chba = cdev->hbas[csk->port_id]; |
11561 |
- struct sk_buff *skb = NULL; |
11562 |
-+ int ret; |
11563 |
- |
11564 |
- log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
11565 |
- "csk 0x%p,%u,0x%lx.\n", csk, csk->state, csk->flags); |
11566 |
-@@ -979,16 +980,16 @@ static int init_act_open(struct cxgbi_sock *csk) |
11567 |
- csk->atid = cxgb3_alloc_atid(t3dev, &t3_client, csk); |
11568 |
- if (csk->atid < 0) { |
11569 |
- pr_err("NO atid available.\n"); |
11570 |
-- return -EINVAL; |
11571 |
-+ ret = -EINVAL; |
11572 |
-+ goto put_sock; |
11573 |
- } |
11574 |
- cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); |
11575 |
- cxgbi_sock_get(csk); |
11576 |
- |
11577 |
- skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL); |
11578 |
- if (!skb) { |
11579 |
-- cxgb3_free_atid(t3dev, csk->atid); |
11580 |
-- cxgbi_sock_put(csk); |
11581 |
-- return -ENOMEM; |
11582 |
-+ ret = -ENOMEM; |
11583 |
-+ goto free_atid; |
11584 |
- } |
11585 |
- skb->sk = (struct sock *)csk; |
11586 |
- set_arp_failure_handler(skb, act_open_arp_failure); |
11587 |
-@@ -1010,6 +1011,15 @@ static int init_act_open(struct cxgbi_sock *csk) |
11588 |
- cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); |
11589 |
- send_act_open_req(csk, skb, csk->l2t); |
11590 |
- return 0; |
11591 |
-+ |
11592 |
-+free_atid: |
11593 |
-+ cxgb3_free_atid(t3dev, csk->atid); |
11594 |
-+put_sock: |
11595 |
-+ cxgbi_sock_put(csk); |
11596 |
-+ l2t_release(t3dev, csk->l2t); |
11597 |
-+ csk->l2t = NULL; |
11598 |
-+ |
11599 |
-+ return ret; |
11600 |
- } |
11601 |
- |
11602 |
- cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS] = { |
11603 |
-diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c |
11604 |
-index 9a6deb21fe4d..11caa4b0d797 100644 |
11605 |
---- a/drivers/scsi/hisi_sas/hisi_sas_main.c |
11606 |
-+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c |
11607 |
-@@ -898,8 +898,11 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no) |
11608 |
- struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; |
11609 |
- struct device *dev = hisi_hba->dev; |
11610 |
- |
11611 |
-+ dev_dbg(dev, "phy%d OOB ready\n", phy_no); |
11612 |
-+ if (phy->phy_attached) |
11613 |
-+ return; |
11614 |
-+ |
11615 |
- if (!timer_pending(&phy->timer)) { |
11616 |
-- dev_dbg(dev, "phy%d OOB ready\n", phy_no); |
11617 |
- phy->timer.expires = jiffies + HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; |
11618 |
- add_timer(&phy->timer); |
11619 |
- } |
11620 |
-diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c |
11621 |
-index 59f0f1030c54..c5711c659b51 100644 |
11622 |
---- a/drivers/scsi/ibmvscsi/ibmvscsi.c |
11623 |
-+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c |
11624 |
-@@ -415,6 +415,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, |
11625 |
- int rc = 0; |
11626 |
- struct vio_dev *vdev = to_vio_dev(hostdata->dev); |
11627 |
- |
11628 |
-+ set_adapter_info(hostdata); |
11629 |
-+ |
11630 |
- /* Re-enable the CRQ */ |
11631 |
- do { |
11632 |
- if (rc) |
11633 |
-diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c |
11634 |
-index e4857b728033..a64abe38db2d 100644 |
11635 |
---- a/drivers/scsi/iscsi_boot_sysfs.c |
11636 |
-+++ b/drivers/scsi/iscsi_boot_sysfs.c |
11637 |
-@@ -352,7 +352,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset, |
11638 |
- boot_kobj->kobj.kset = boot_kset->kset; |
11639 |
- if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype, |
11640 |
- NULL, name, index)) { |
11641 |
-- kfree(boot_kobj); |
11642 |
-+ kobject_put(&boot_kobj->kobj); |
11643 |
- return NULL; |
11644 |
- } |
11645 |
- boot_kobj->data = data; |
11646 |
-diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
11647 |
-index 80d1e661b0d4..35fbcb4d52eb 100644 |
11648 |
---- a/drivers/scsi/lpfc/lpfc_els.c |
11649 |
-+++ b/drivers/scsi/lpfc/lpfc_els.c |
11650 |
-@@ -8514,6 +8514,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
11651 |
- spin_lock_irq(shost->host_lock); |
11652 |
- if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) { |
11653 |
- spin_unlock_irq(shost->host_lock); |
11654 |
-+ if (newnode) |
11655 |
-+ lpfc_nlp_put(ndlp); |
11656 |
- goto dropit; |
11657 |
- } |
11658 |
- spin_unlock_irq(shost->host_lock); |
11659 |
-diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c |
11660 |
-index 663782bb790d..39d233262039 100644 |
11661 |
---- a/drivers/scsi/mpt3sas/mpt3sas_base.c |
11662 |
-+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c |
11663 |
-@@ -4915,7 +4915,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) |
11664 |
- } |
11665 |
- |
11666 |
- kfree(ioc->hpr_lookup); |
11667 |
-+ ioc->hpr_lookup = NULL; |
11668 |
- kfree(ioc->internal_lookup); |
11669 |
-+ ioc->internal_lookup = NULL; |
11670 |
- if (ioc->chain_lookup) { |
11671 |
- for (i = 0; i < ioc->scsiio_depth; i++) { |
11672 |
- for (j = ioc->chains_per_prp_buffer; |
11673 |
-diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h |
11674 |
-index f3f399fe10c8..0da4e16fb23a 100644 |
11675 |
---- a/drivers/scsi/qedf/qedf.h |
11676 |
-+++ b/drivers/scsi/qedf/qedf.h |
11677 |
-@@ -355,6 +355,7 @@ struct qedf_ctx { |
11678 |
- #define QEDF_GRCDUMP_CAPTURE 4 |
11679 |
- #define QEDF_IN_RECOVERY 5 |
11680 |
- #define QEDF_DBG_STOP_IO 6 |
11681 |
-+#define QEDF_PROBING 8 |
11682 |
- unsigned long flags; /* Miscellaneous state flags */ |
11683 |
- int fipvlan_retries; |
11684 |
- u8 num_queues; |
11685 |
-diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c |
11686 |
-index 5b19f5175c5c..3a7d03472922 100644 |
11687 |
---- a/drivers/scsi/qedf/qedf_main.c |
11688 |
-+++ b/drivers/scsi/qedf/qedf_main.c |
11689 |
-@@ -3153,7 +3153,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11690 |
- { |
11691 |
- int rc = -EINVAL; |
11692 |
- struct fc_lport *lport; |
11693 |
-- struct qedf_ctx *qedf; |
11694 |
-+ struct qedf_ctx *qedf = NULL; |
11695 |
- struct Scsi_Host *host; |
11696 |
- bool is_vf = false; |
11697 |
- struct qed_ll2_params params; |
11698 |
-@@ -3183,6 +3183,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11699 |
- |
11700 |
- /* Initialize qedf_ctx */ |
11701 |
- qedf = lport_priv(lport); |
11702 |
-+ set_bit(QEDF_PROBING, &qedf->flags); |
11703 |
- qedf->lport = lport; |
11704 |
- qedf->ctlr.lp = lport; |
11705 |
- qedf->pdev = pdev; |
11706 |
-@@ -3206,9 +3207,12 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11707 |
- } else { |
11708 |
- /* Init pointers during recovery */ |
11709 |
- qedf = pci_get_drvdata(pdev); |
11710 |
-+ set_bit(QEDF_PROBING, &qedf->flags); |
11711 |
- lport = qedf->lport; |
11712 |
- } |
11713 |
- |
11714 |
-+ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe started.\n"); |
11715 |
-+ |
11716 |
- host = lport->host; |
11717 |
- |
11718 |
- /* Allocate mempool for qedf_io_work structs */ |
11719 |
-@@ -3513,6 +3517,10 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) |
11720 |
- else |
11721 |
- fc_fabric_login(lport); |
11722 |
- |
11723 |
-+ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); |
11724 |
-+ |
11725 |
-+ clear_bit(QEDF_PROBING, &qedf->flags); |
11726 |
-+ |
11727 |
- /* All good */ |
11728 |
- return 0; |
11729 |
- |
11730 |
-@@ -3538,6 +3546,11 @@ err2: |
11731 |
- err1: |
11732 |
- scsi_host_put(lport->host); |
11733 |
- err0: |
11734 |
-+ if (qedf) { |
11735 |
-+ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); |
11736 |
-+ |
11737 |
-+ clear_bit(QEDF_PROBING, &qedf->flags); |
11738 |
-+ } |
11739 |
- return rc; |
11740 |
- } |
11741 |
- |
11742 |
-@@ -3687,11 +3700,25 @@ void qedf_get_protocol_tlv_data(void *dev, void *data) |
11743 |
- { |
11744 |
- struct qedf_ctx *qedf = dev; |
11745 |
- struct qed_mfw_tlv_fcoe *fcoe = data; |
11746 |
-- struct fc_lport *lport = qedf->lport; |
11747 |
-- struct Scsi_Host *host = lport->host; |
11748 |
-- struct fc_host_attrs *fc_host = shost_to_fc_host(host); |
11749 |
-+ struct fc_lport *lport; |
11750 |
-+ struct Scsi_Host *host; |
11751 |
-+ struct fc_host_attrs *fc_host; |
11752 |
- struct fc_host_statistics *hst; |
11753 |
- |
11754 |
-+ if (!qedf) { |
11755 |
-+ QEDF_ERR(NULL, "qedf is null.\n"); |
11756 |
-+ return; |
11757 |
-+ } |
11758 |
-+ |
11759 |
-+ if (test_bit(QEDF_PROBING, &qedf->flags)) { |
11760 |
-+ QEDF_ERR(&qedf->dbg_ctx, "Function is still probing.\n"); |
11761 |
-+ return; |
11762 |
-+ } |
11763 |
-+ |
11764 |
-+ lport = qedf->lport; |
11765 |
-+ host = lport->host; |
11766 |
-+ fc_host = shost_to_fc_host(host); |
11767 |
-+ |
11768 |
- /* Force a refresh of the fc_host stats including offload stats */ |
11769 |
- hst = qedf_fc_get_host_stats(host); |
11770 |
- |
11771 |
-diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c |
11772 |
-index 1f4a5fb00a05..366c65b295a5 100644 |
11773 |
---- a/drivers/scsi/qedi/qedi_iscsi.c |
11774 |
-+++ b/drivers/scsi/qedi/qedi_iscsi.c |
11775 |
-@@ -1001,7 +1001,8 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) |
11776 |
- if (qedi_ep->state == EP_STATE_OFLDCONN_START) |
11777 |
- goto ep_exit_recover; |
11778 |
- |
11779 |
-- flush_work(&qedi_ep->offload_work); |
11780 |
-+ if (qedi_ep->state != EP_STATE_OFLDCONN_NONE) |
11781 |
-+ flush_work(&qedi_ep->offload_work); |
11782 |
- |
11783 |
- if (qedi_ep->conn) { |
11784 |
- qedi_conn = qedi_ep->conn; |
11785 |
-@@ -1218,6 +1219,10 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data) |
11786 |
- } |
11787 |
- |
11788 |
- iscsi_cid = (u32)path_data->handle; |
11789 |
-+ if (iscsi_cid >= qedi->max_active_conns) { |
11790 |
-+ ret = -EINVAL; |
11791 |
-+ goto set_path_exit; |
11792 |
-+ } |
11793 |
- qedi_ep = qedi->ep_tbl[iscsi_cid]; |
11794 |
- QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, |
11795 |
- "iscsi_cid=0x%x, qedi_ep=%p\n", iscsi_cid, qedi_ep); |
11796 |
-diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
11797 |
-index 1d9a4866f9a7..9179bb4caed8 100644 |
11798 |
---- a/drivers/scsi/qla2xxx/qla_os.c |
11799 |
-+++ b/drivers/scsi/qla2xxx/qla_os.c |
11800 |
-@@ -6871,6 +6871,7 @@ qla2x00_do_dpc(void *data) |
11801 |
- |
11802 |
- if (do_reset && !(test_and_set_bit(ABORT_ISP_ACTIVE, |
11803 |
- &base_vha->dpc_flags))) { |
11804 |
-+ base_vha->flags.online = 1; |
11805 |
- ql_dbg(ql_dbg_dpc, base_vha, 0x4007, |
11806 |
- "ISP abort scheduled.\n"); |
11807 |
- if (ha->isp_ops->abort_isp(base_vha)) { |
11808 |
-diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
11809 |
-index 1f0a185b2a95..bf00ae16b487 100644 |
11810 |
---- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
11811 |
-+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
11812 |
-@@ -949,6 +949,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, |
11813 |
- |
11814 |
- atomic_set(&tpg->lport_tpg_enabled, 0); |
11815 |
- qlt_stop_phase1(vha->vha_tgt.qla_tgt); |
11816 |
-+ qlt_stop_phase2(vha->vha_tgt.qla_tgt); |
11817 |
- } |
11818 |
- |
11819 |
- return count; |
11820 |
-@@ -1111,6 +1112,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, |
11821 |
- |
11822 |
- atomic_set(&tpg->lport_tpg_enabled, 0); |
11823 |
- qlt_stop_phase1(vha->vha_tgt.qla_tgt); |
11824 |
-+ qlt_stop_phase2(vha->vha_tgt.qla_tgt); |
11825 |
- } |
11826 |
- |
11827 |
- return count; |
11828 |
-diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c |
11829 |
-index 978be1602f71..927b1e641842 100644 |
11830 |
---- a/drivers/scsi/scsi_error.c |
11831 |
-+++ b/drivers/scsi/scsi_error.c |
11832 |
-@@ -1412,6 +1412,7 @@ static int scsi_eh_stu(struct Scsi_Host *shost, |
11833 |
- sdev_printk(KERN_INFO, sdev, |
11834 |
- "%s: skip START_UNIT, past eh deadline\n", |
11835 |
- current->comm)); |
11836 |
-+ scsi_device_put(sdev); |
11837 |
- break; |
11838 |
- } |
11839 |
- stu_scmd = NULL; |
11840 |
-@@ -1478,6 +1479,7 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, |
11841 |
- sdev_printk(KERN_INFO, sdev, |
11842 |
- "%s: skip BDR, past eh deadline\n", |
11843 |
- current->comm)); |
11844 |
-+ scsi_device_put(sdev); |
11845 |
- break; |
11846 |
- } |
11847 |
- bdr_scmd = NULL; |
11848 |
-diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
11849 |
-index 06c260f6cdae..b8b4366f1200 100644 |
11850 |
---- a/drivers/scsi/scsi_lib.c |
11851 |
-+++ b/drivers/scsi/scsi_lib.c |
11852 |
-@@ -548,7 +548,7 @@ static void scsi_uninit_cmd(struct scsi_cmnd *cmd) |
11853 |
- } |
11854 |
- } |
11855 |
- |
11856 |
--static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) |
11857 |
-+static void scsi_free_sgtables(struct scsi_cmnd *cmd) |
11858 |
- { |
11859 |
- if (cmd->sdb.table.nents) |
11860 |
- sg_free_table_chained(&cmd->sdb.table, |
11861 |
-@@ -560,7 +560,7 @@ static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) |
11862 |
- |
11863 |
- static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) |
11864 |
- { |
11865 |
-- scsi_mq_free_sgtables(cmd); |
11866 |
-+ scsi_free_sgtables(cmd); |
11867 |
- scsi_uninit_cmd(cmd); |
11868 |
- } |
11869 |
- |
11870 |
-@@ -1059,7 +1059,7 @@ blk_status_t scsi_init_io(struct scsi_cmnd *cmd) |
11871 |
- |
11872 |
- return BLK_STS_OK; |
11873 |
- out_free_sgtables: |
11874 |
-- scsi_mq_free_sgtables(cmd); |
11875 |
-+ scsi_free_sgtables(cmd); |
11876 |
- return ret; |
11877 |
- } |
11878 |
- EXPORT_SYMBOL(scsi_init_io); |
11879 |
-@@ -1190,6 +1190,7 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev, |
11880 |
- struct request *req) |
11881 |
- { |
11882 |
- struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); |
11883 |
-+ blk_status_t ret; |
11884 |
- |
11885 |
- if (!blk_rq_bytes(req)) |
11886 |
- cmd->sc_data_direction = DMA_NONE; |
11887 |
-@@ -1199,9 +1200,14 @@ static blk_status_t scsi_setup_cmnd(struct scsi_device *sdev, |
11888 |
- cmd->sc_data_direction = DMA_FROM_DEVICE; |
11889 |
- |
11890 |
- if (blk_rq_is_scsi(req)) |
11891 |
-- return scsi_setup_scsi_cmnd(sdev, req); |
11892 |
-+ ret = scsi_setup_scsi_cmnd(sdev, req); |
11893 |
- else |
11894 |
-- return scsi_setup_fs_cmnd(sdev, req); |
11895 |
-+ ret = scsi_setup_fs_cmnd(sdev, req); |
11896 |
-+ |
11897 |
-+ if (ret != BLK_STS_OK) |
11898 |
-+ scsi_free_sgtables(cmd); |
11899 |
-+ |
11900 |
-+ return ret; |
11901 |
- } |
11902 |
- |
11903 |
- static blk_status_t |
11904 |
-@@ -2859,8 +2865,10 @@ scsi_host_unblock(struct Scsi_Host *shost, int new_state) |
11905 |
- |
11906 |
- shost_for_each_device(sdev, shost) { |
11907 |
- ret = scsi_internal_device_unblock(sdev, new_state); |
11908 |
-- if (ret) |
11909 |
-+ if (ret) { |
11910 |
-+ scsi_device_put(sdev); |
11911 |
- break; |
11912 |
-+ } |
11913 |
- } |
11914 |
- return ret; |
11915 |
- } |
11916 |
-diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
11917 |
-index b2a803c51288..ea6d498fa923 100644 |
11918 |
---- a/drivers/scsi/scsi_transport_iscsi.c |
11919 |
-+++ b/drivers/scsi/scsi_transport_iscsi.c |
11920 |
-@@ -1616,6 +1616,12 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class, |
11921 |
- static struct sock *nls; |
11922 |
- static DEFINE_MUTEX(rx_queue_mutex); |
11923 |
- |
11924 |
-+/* |
11925 |
-+ * conn_mutex protects the {start,bind,stop,destroy}_conn from racing |
11926 |
-+ * against the kernel stop_connection recovery mechanism |
11927 |
-+ */ |
11928 |
-+static DEFINE_MUTEX(conn_mutex); |
11929 |
-+ |
11930 |
- static LIST_HEAD(sesslist); |
11931 |
- static LIST_HEAD(sessdestroylist); |
11932 |
- static DEFINE_SPINLOCK(sesslock); |
11933 |
-@@ -2445,6 +2451,32 @@ int iscsi_offload_mesg(struct Scsi_Host *shost, |
11934 |
- } |
11935 |
- EXPORT_SYMBOL_GPL(iscsi_offload_mesg); |
11936 |
- |
11937 |
-+/* |
11938 |
-+ * This can be called without the rx_queue_mutex, if invoked by the kernel |
11939 |
-+ * stop work. But, in that case, it is guaranteed not to race with |
11940 |
-+ * iscsi_destroy by conn_mutex. |
11941 |
-+ */ |
11942 |
-+static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) |
11943 |
-+{ |
11944 |
-+ /* |
11945 |
-+ * It is important that this path doesn't rely on |
11946 |
-+ * rx_queue_mutex, otherwise, a thread doing allocation on a |
11947 |
-+ * start_session/start_connection could sleep waiting on a |
11948 |
-+ * writeback to a failed iscsi device, that cannot be recovered |
11949 |
-+ * because the lock is held. If we don't hold it here, the |
11950 |
-+ * kernel stop_conn_work_fn has a chance to stop the broken |
11951 |
-+ * session and resolve the allocation. |
11952 |
-+ * |
11953 |
-+ * Still, the user invoked .stop_conn() needs to be serialized |
11954 |
-+ * with stop_conn_work_fn by a private mutex. Not pretty, but |
11955 |
-+ * it works. |
11956 |
-+ */ |
11957 |
-+ mutex_lock(&conn_mutex); |
11958 |
-+ conn->transport->stop_conn(conn, flag); |
11959 |
-+ mutex_unlock(&conn_mutex); |
11960 |
-+ |
11961 |
-+} |
11962 |
-+ |
11963 |
- static void stop_conn_work_fn(struct work_struct *work) |
11964 |
- { |
11965 |
- struct iscsi_cls_conn *conn, *tmp; |
11966 |
-@@ -2463,30 +2495,17 @@ static void stop_conn_work_fn(struct work_struct *work) |
11967 |
- uint32_t sid = iscsi_conn_get_sid(conn); |
11968 |
- struct iscsi_cls_session *session; |
11969 |
- |
11970 |
-- mutex_lock(&rx_queue_mutex); |
11971 |
-- |
11972 |
- session = iscsi_session_lookup(sid); |
11973 |
- if (session) { |
11974 |
- if (system_state != SYSTEM_RUNNING) { |
11975 |
- session->recovery_tmo = 0; |
11976 |
-- conn->transport->stop_conn(conn, |
11977 |
-- STOP_CONN_TERM); |
11978 |
-+ iscsi_if_stop_conn(conn, STOP_CONN_TERM); |
11979 |
- } else { |
11980 |
-- conn->transport->stop_conn(conn, |
11981 |
-- STOP_CONN_RECOVER); |
11982 |
-+ iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); |
11983 |
- } |
11984 |
- } |
11985 |
- |
11986 |
- list_del_init(&conn->conn_list_err); |
11987 |
-- |
11988 |
-- mutex_unlock(&rx_queue_mutex); |
11989 |
-- |
11990 |
-- /* we don't want to hold rx_queue_mutex for too long, |
11991 |
-- * for instance if many conns failed at the same time, |
11992 |
-- * since this stall other iscsi maintenance operations. |
11993 |
-- * Give other users a chance to proceed. |
11994 |
-- */ |
11995 |
-- cond_resched(); |
11996 |
- } |
11997 |
- } |
11998 |
- |
11999 |
-@@ -2846,8 +2865,11 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev |
12000 |
- spin_unlock_irqrestore(&connlock, flags); |
12001 |
- |
12002 |
- ISCSI_DBG_TRANS_CONN(conn, "Destroying transport conn\n"); |
12003 |
-+ |
12004 |
-+ mutex_lock(&conn_mutex); |
12005 |
- if (transport->destroy_conn) |
12006 |
- transport->destroy_conn(conn); |
12007 |
-+ mutex_unlock(&conn_mutex); |
12008 |
- |
12009 |
- return 0; |
12010 |
- } |
12011 |
-@@ -3689,9 +3711,12 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
12012 |
- break; |
12013 |
- } |
12014 |
- |
12015 |
-+ mutex_lock(&conn_mutex); |
12016 |
- ev->r.retcode = transport->bind_conn(session, conn, |
12017 |
- ev->u.b_conn.transport_eph, |
12018 |
- ev->u.b_conn.is_leading); |
12019 |
-+ mutex_unlock(&conn_mutex); |
12020 |
-+ |
12021 |
- if (ev->r.retcode || !transport->ep_connect) |
12022 |
- break; |
12023 |
- |
12024 |
-@@ -3713,9 +3738,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
12025 |
- case ISCSI_UEVENT_START_CONN: |
12026 |
- conn = iscsi_conn_lookup(ev->u.start_conn.sid, ev->u.start_conn.cid); |
12027 |
- if (conn) { |
12028 |
-+ mutex_lock(&conn_mutex); |
12029 |
- ev->r.retcode = transport->start_conn(conn); |
12030 |
- if (!ev->r.retcode) |
12031 |
- conn->state = ISCSI_CONN_UP; |
12032 |
-+ mutex_unlock(&conn_mutex); |
12033 |
- } |
12034 |
- else |
12035 |
- err = -EINVAL; |
12036 |
-@@ -3723,17 +3750,20 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
12037 |
- case ISCSI_UEVENT_STOP_CONN: |
12038 |
- conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); |
12039 |
- if (conn) |
12040 |
-- transport->stop_conn(conn, ev->u.stop_conn.flag); |
12041 |
-+ iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); |
12042 |
- else |
12043 |
- err = -EINVAL; |
12044 |
- break; |
12045 |
- case ISCSI_UEVENT_SEND_PDU: |
12046 |
- conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid); |
12047 |
-- if (conn) |
12048 |
-+ if (conn) { |
12049 |
-+ mutex_lock(&conn_mutex); |
12050 |
- ev->r.retcode = transport->send_pdu(conn, |
12051 |
- (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), |
12052 |
- (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, |
12053 |
- ev->u.send_pdu.data_size); |
12054 |
-+ mutex_unlock(&conn_mutex); |
12055 |
-+ } |
12056 |
- else |
12057 |
- err = -EINVAL; |
12058 |
- break; |
12059 |
-diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
12060 |
-index d2fe3fa470f9..1e13c6a0f0ca 100644 |
12061 |
---- a/drivers/scsi/sr.c |
12062 |
-+++ b/drivers/scsi/sr.c |
12063 |
-@@ -797,7 +797,7 @@ static int sr_probe(struct device *dev) |
12064 |
- cd->cdi.disk = disk; |
12065 |
- |
12066 |
- if (register_cdrom(&cd->cdi)) |
12067 |
-- goto fail_put; |
12068 |
-+ goto fail_minor; |
12069 |
- |
12070 |
- /* |
12071 |
- * Initialize block layer runtime PM stuffs before the |
12072 |
-@@ -815,8 +815,13 @@ static int sr_probe(struct device *dev) |
12073 |
- |
12074 |
- return 0; |
12075 |
- |
12076 |
-+fail_minor: |
12077 |
-+ spin_lock(&sr_index_lock); |
12078 |
-+ clear_bit(minor, sr_index_bits); |
12079 |
-+ spin_unlock(&sr_index_lock); |
12080 |
- fail_put: |
12081 |
- put_disk(disk); |
12082 |
-+ mutex_destroy(&cd->lock); |
12083 |
- fail_free: |
12084 |
- kfree(cd); |
12085 |
- fail: |
12086 |
-diff --git a/drivers/scsi/ufs/ti-j721e-ufs.c b/drivers/scsi/ufs/ti-j721e-ufs.c |
12087 |
-index 5216d228cdd9..46bb905b4d6a 100644 |
12088 |
---- a/drivers/scsi/ufs/ti-j721e-ufs.c |
12089 |
-+++ b/drivers/scsi/ufs/ti-j721e-ufs.c |
12090 |
-@@ -32,14 +32,14 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev) |
12091 |
- ret = pm_runtime_get_sync(dev); |
12092 |
- if (ret < 0) { |
12093 |
- pm_runtime_put_noidle(dev); |
12094 |
-- return ret; |
12095 |
-+ goto disable_pm; |
12096 |
- } |
12097 |
- |
12098 |
- /* Select MPHY refclk frequency */ |
12099 |
- clk = devm_clk_get(dev, NULL); |
12100 |
- if (IS_ERR(clk)) { |
12101 |
- dev_err(dev, "Cannot claim MPHY clock.\n"); |
12102 |
-- return PTR_ERR(clk); |
12103 |
-+ goto clk_err; |
12104 |
- } |
12105 |
- clk_rate = clk_get_rate(clk); |
12106 |
- if (clk_rate == 26000000) |
12107 |
-@@ -54,16 +54,23 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev) |
12108 |
- dev); |
12109 |
- if (ret) { |
12110 |
- dev_err(dev, "failed to populate child nodes %d\n", ret); |
12111 |
-- pm_runtime_put_sync(dev); |
12112 |
-+ goto clk_err; |
12113 |
- } |
12114 |
- |
12115 |
- return ret; |
12116 |
-+ |
12117 |
-+clk_err: |
12118 |
-+ pm_runtime_put_sync(dev); |
12119 |
-+disable_pm: |
12120 |
-+ pm_runtime_disable(dev); |
12121 |
-+ return ret; |
12122 |
- } |
12123 |
- |
12124 |
- static int ti_j721e_ufs_remove(struct platform_device *pdev) |
12125 |
- { |
12126 |
- of_platform_depopulate(&pdev->dev); |
12127 |
- pm_runtime_put_sync(&pdev->dev); |
12128 |
-+ pm_runtime_disable(&pdev->dev); |
12129 |
- |
12130 |
- return 0; |
12131 |
- } |
12132 |
-diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c |
12133 |
-index 19aa5c44e0da..f938867301a0 100644 |
12134 |
---- a/drivers/scsi/ufs/ufs-qcom.c |
12135 |
-+++ b/drivers/scsi/ufs/ufs-qcom.c |
12136 |
-@@ -1658,11 +1658,11 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba) |
12137 |
- |
12138 |
- /* sleep a bit intermittently as we are dumping too much data */ |
12139 |
- ufs_qcom_print_hw_debug_reg_all(hba, NULL, ufs_qcom_dump_regs_wrapper); |
12140 |
-- usleep_range(1000, 1100); |
12141 |
-+ udelay(1000); |
12142 |
- ufs_qcom_testbus_read(hba); |
12143 |
-- usleep_range(1000, 1100); |
12144 |
-+ udelay(1000); |
12145 |
- ufs_qcom_print_unipro_testbus(hba); |
12146 |
-- usleep_range(1000, 1100); |
12147 |
-+ udelay(1000); |
12148 |
- } |
12149 |
- |
12150 |
- /** |
12151 |
-diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c |
12152 |
-index 53dd87628cbe..516a7f573942 100644 |
12153 |
---- a/drivers/scsi/ufs/ufs_bsg.c |
12154 |
-+++ b/drivers/scsi/ufs/ufs_bsg.c |
12155 |
-@@ -106,8 +106,10 @@ static int ufs_bsg_request(struct bsg_job *job) |
12156 |
- desc_op = bsg_request->upiu_req.qr.opcode; |
12157 |
- ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff, |
12158 |
- &desc_len, desc_op); |
12159 |
-- if (ret) |
12160 |
-+ if (ret) { |
12161 |
-+ pm_runtime_put_sync(hba->dev); |
12162 |
- goto out; |
12163 |
-+ } |
12164 |
- |
12165 |
- /* fall through */ |
12166 |
- case UPIU_TRANSACTION_NOP_OUT: |
12167 |
-diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
12168 |
-index 698e8d20b4ba..52740b60d786 100644 |
12169 |
---- a/drivers/scsi/ufs/ufshcd.c |
12170 |
-+++ b/drivers/scsi/ufs/ufshcd.c |
12171 |
-@@ -5098,7 +5098,6 @@ static int ufshcd_bkops_ctrl(struct ufs_hba *hba, |
12172 |
- err = ufshcd_enable_auto_bkops(hba); |
12173 |
- else |
12174 |
- err = ufshcd_disable_auto_bkops(hba); |
12175 |
-- hba->urgent_bkops_lvl = curr_status; |
12176 |
- out: |
12177 |
- return err; |
12178 |
- } |
12179 |
-diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
12180 |
-index fc2575fef51b..7426b5884218 100644 |
12181 |
---- a/drivers/slimbus/qcom-ngd-ctrl.c |
12182 |
-+++ b/drivers/slimbus/qcom-ngd-ctrl.c |
12183 |
-@@ -1361,7 +1361,6 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
12184 |
- ngd->pdev->driver_override = QCOM_SLIM_NGD_DRV_NAME; |
12185 |
- ngd->pdev->dev.of_node = node; |
12186 |
- ctrl->ngd = ngd; |
12187 |
-- platform_set_drvdata(ngd->pdev, ctrl); |
12188 |
- |
12189 |
- platform_device_add(ngd->pdev); |
12190 |
- ngd->base = ctrl->base + ngd->id * data->offset + |
12191 |
-@@ -1376,12 +1375,13 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
12192 |
- |
12193 |
- static int qcom_slim_ngd_probe(struct platform_device *pdev) |
12194 |
- { |
12195 |
-- struct qcom_slim_ngd_ctrl *ctrl = platform_get_drvdata(pdev); |
12196 |
- struct device *dev = &pdev->dev; |
12197 |
-+ struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev->parent); |
12198 |
- int ret; |
12199 |
- |
12200 |
- ctrl->ctrl.dev = dev; |
12201 |
- |
12202 |
-+ platform_set_drvdata(pdev, ctrl); |
12203 |
- pm_runtime_use_autosuspend(dev); |
12204 |
- pm_runtime_set_autosuspend_delay(dev, QCOM_SLIM_NGD_AUTOSUSPEND); |
12205 |
- pm_runtime_set_suspended(dev); |
12206 |
-diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c |
12207 |
-index aace57fae7f8..4bacdb187eab 100644 |
12208 |
---- a/drivers/soundwire/slave.c |
12209 |
-+++ b/drivers/soundwire/slave.c |
12210 |
-@@ -68,6 +68,8 @@ static int sdw_slave_add(struct sdw_bus *bus, |
12211 |
- list_del(&slave->node); |
12212 |
- mutex_unlock(&bus->bus_lock); |
12213 |
- put_device(&slave->dev); |
12214 |
-+ |
12215 |
-+ return ret; |
12216 |
- } |
12217 |
- sdw_slave_debugfs_init(slave); |
12218 |
- |
12219 |
-diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c |
12220 |
-index 5f0e089573a2..af26bc9f184a 100644 |
12221 |
---- a/drivers/staging/gasket/gasket_sysfs.c |
12222 |
-+++ b/drivers/staging/gasket/gasket_sysfs.c |
12223 |
-@@ -339,6 +339,7 @@ void gasket_sysfs_put_attr(struct device *device, |
12224 |
- |
12225 |
- dev_err(device, "Unable to put unknown attribute: %s\n", |
12226 |
- attr->attr.attr.name); |
12227 |
-+ put_mapping(mapping); |
12228 |
- } |
12229 |
- EXPORT_SYMBOL(gasket_sysfs_put_attr); |
12230 |
- |
12231 |
-@@ -372,6 +373,7 @@ ssize_t gasket_sysfs_register_store(struct device *device, |
12232 |
- gasket_dev = mapping->gasket_dev; |
12233 |
- if (!gasket_dev) { |
12234 |
- dev_err(device, "Device driver may have been removed\n"); |
12235 |
-+ put_mapping(mapping); |
12236 |
- return 0; |
12237 |
- } |
12238 |
- |
12239 |
-diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c |
12240 |
-index d6ba25f21d80..d2672b65c3f4 100644 |
12241 |
---- a/drivers/staging/greybus/light.c |
12242 |
-+++ b/drivers/staging/greybus/light.c |
12243 |
-@@ -1026,7 +1026,8 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) |
12244 |
- |
12245 |
- light->channels_count = conf.channel_count; |
12246 |
- light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); |
12247 |
-- |
12248 |
-+ if (!light->name) |
12249 |
-+ return -ENOMEM; |
12250 |
- light->channels = kcalloc(light->channels_count, |
12251 |
- sizeof(struct gb_channel), GFP_KERNEL); |
12252 |
- if (!light->channels) |
12253 |
-diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi |
12254 |
-index 9e5cf68731bb..82aa93634eda 100644 |
12255 |
---- a/drivers/staging/mt7621-dts/mt7621.dtsi |
12256 |
-+++ b/drivers/staging/mt7621-dts/mt7621.dtsi |
12257 |
-@@ -523,11 +523,10 @@ |
12258 |
- 0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */ |
12259 |
- >; |
12260 |
- |
12261 |
-- #interrupt-cells = <1>; |
12262 |
-- interrupt-map-mask = <0xF0000 0 0 1>; |
12263 |
-- interrupt-map = <0x10000 0 0 1 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>, |
12264 |
-- <0x20000 0 0 1 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>, |
12265 |
-- <0x30000 0 0 1 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; |
12266 |
-+ interrupt-parent = <&gic>; |
12267 |
-+ interrupts = <GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH |
12268 |
-+ GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH |
12269 |
-+ GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; |
12270 |
- |
12271 |
- status = "disabled"; |
12272 |
- |
12273 |
-diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c |
12274 |
-index b9d460a9c041..36207243a71b 100644 |
12275 |
---- a/drivers/staging/mt7621-pci/pci-mt7621.c |
12276 |
-+++ b/drivers/staging/mt7621-pci/pci-mt7621.c |
12277 |
-@@ -97,6 +97,7 @@ |
12278 |
- * @pcie_rst: pointer to port reset control |
12279 |
- * @gpio_rst: gpio reset |
12280 |
- * @slot: port slot |
12281 |
-+ * @irq: GIC irq |
12282 |
- * @enabled: indicates if port is enabled |
12283 |
- */ |
12284 |
- struct mt7621_pcie_port { |
12285 |
-@@ -107,6 +108,7 @@ struct mt7621_pcie_port { |
12286 |
- struct reset_control *pcie_rst; |
12287 |
- struct gpio_desc *gpio_rst; |
12288 |
- u32 slot; |
12289 |
-+ int irq; |
12290 |
- bool enabled; |
12291 |
- }; |
12292 |
- |
12293 |
-@@ -120,6 +122,7 @@ struct mt7621_pcie_port { |
12294 |
- * @dev: Pointer to PCIe device |
12295 |
- * @io_map_base: virtual memory base address for io |
12296 |
- * @ports: pointer to PCIe port information |
12297 |
-+ * @irq_map: irq mapping info according pcie link status |
12298 |
- * @resets_inverted: depends on chip revision |
12299 |
- * reset lines are inverted. |
12300 |
- */ |
12301 |
-@@ -135,6 +138,7 @@ struct mt7621_pcie { |
12302 |
- } offset; |
12303 |
- unsigned long io_map_base; |
12304 |
- struct list_head ports; |
12305 |
-+ int irq_map[PCIE_P2P_MAX]; |
12306 |
- bool resets_inverted; |
12307 |
- }; |
12308 |
- |
12309 |
-@@ -279,6 +283,16 @@ static void setup_cm_memory_region(struct mt7621_pcie *pcie) |
12310 |
- } |
12311 |
- } |
12312 |
- |
12313 |
-+static int mt7621_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
12314 |
-+{ |
12315 |
-+ struct mt7621_pcie *pcie = pdev->bus->sysdata; |
12316 |
-+ struct device *dev = pcie->dev; |
12317 |
-+ int irq = pcie->irq_map[slot]; |
12318 |
-+ |
12319 |
-+ dev_info(dev, "bus=%d slot=%d irq=%d\n", pdev->bus->number, slot, irq); |
12320 |
-+ return irq; |
12321 |
-+} |
12322 |
-+ |
12323 |
- static int mt7621_pci_parse_request_of_pci_ranges(struct mt7621_pcie *pcie) |
12324 |
- { |
12325 |
- struct device *dev = pcie->dev; |
12326 |
-@@ -330,6 +344,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, |
12327 |
- { |
12328 |
- struct mt7621_pcie_port *port; |
12329 |
- struct device *dev = pcie->dev; |
12330 |
-+ struct platform_device *pdev = to_platform_device(dev); |
12331 |
- struct device_node *pnode = dev->of_node; |
12332 |
- struct resource regs; |
12333 |
- char name[10]; |
12334 |
-@@ -371,6 +386,12 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, |
12335 |
- port->slot = slot; |
12336 |
- port->pcie = pcie; |
12337 |
- |
12338 |
-+ port->irq = platform_get_irq(pdev, slot); |
12339 |
-+ if (port->irq < 0) { |
12340 |
-+ dev_err(dev, "Failed to get IRQ for PCIe%d\n", slot); |
12341 |
-+ return -ENXIO; |
12342 |
-+ } |
12343 |
-+ |
12344 |
- INIT_LIST_HEAD(&port->list); |
12345 |
- list_add_tail(&port->list, &pcie->ports); |
12346 |
- |
12347 |
-@@ -585,13 +606,15 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) |
12348 |
- { |
12349 |
- u32 pcie_link_status = 0; |
12350 |
- u32 n; |
12351 |
-- int i; |
12352 |
-+ int i = 0; |
12353 |
- u32 p2p_br_devnum[PCIE_P2P_MAX]; |
12354 |
-+ int irqs[PCIE_P2P_MAX]; |
12355 |
- struct mt7621_pcie_port *port; |
12356 |
- |
12357 |
- list_for_each_entry(port, &pcie->ports, list) { |
12358 |
- u32 slot = port->slot; |
12359 |
- |
12360 |
-+ irqs[i++] = port->irq; |
12361 |
- if (port->enabled) |
12362 |
- pcie_link_status |= BIT(slot); |
12363 |
- } |
12364 |
-@@ -614,6 +637,15 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) |
12365 |
- (p2p_br_devnum[1] << PCIE_P2P_BR_DEVNUM1_SHIFT) | |
12366 |
- (p2p_br_devnum[2] << PCIE_P2P_BR_DEVNUM2_SHIFT)); |
12367 |
- |
12368 |
-+ /* Assign IRQs */ |
12369 |
-+ n = 0; |
12370 |
-+ for (i = 0; i < PCIE_P2P_MAX; i++) |
12371 |
-+ if (pcie_link_status & BIT(i)) |
12372 |
-+ pcie->irq_map[n++] = irqs[i]; |
12373 |
-+ |
12374 |
-+ for (i = n; i < PCIE_P2P_MAX; i++) |
12375 |
-+ pcie->irq_map[i] = -1; |
12376 |
-+ |
12377 |
- return 0; |
12378 |
- } |
12379 |
- |
12380 |
-@@ -638,7 +670,7 @@ static int mt7621_pcie_register_host(struct pci_host_bridge *host, |
12381 |
- host->busnr = pcie->busn.start; |
12382 |
- host->dev.parent = pcie->dev; |
12383 |
- host->ops = &mt7621_pci_ops; |
12384 |
-- host->map_irq = of_irq_parse_and_map_pci; |
12385 |
-+ host->map_irq = mt7621_map_irq; |
12386 |
- host->swizzle_irq = pci_common_swizzle; |
12387 |
- host->sysdata = pcie; |
12388 |
- |
12389 |
-diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c |
12390 |
-index 59568d18ce23..5b72aa81d94c 100644 |
12391 |
---- a/drivers/staging/sm750fb/sm750.c |
12392 |
-+++ b/drivers/staging/sm750fb/sm750.c |
12393 |
-@@ -898,6 +898,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) |
12394 |
- fix->visual = FB_VISUAL_PSEUDOCOLOR; |
12395 |
- break; |
12396 |
- case 16: |
12397 |
-+ case 24: |
12398 |
- case 32: |
12399 |
- fix->visual = FB_VISUAL_TRUECOLOR; |
12400 |
- break; |
12401 |
-diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c |
12402 |
-index dedc3ff58d3e..c2e4bd1e3b0a 100644 |
12403 |
---- a/drivers/staging/wfx/bus_sdio.c |
12404 |
-+++ b/drivers/staging/wfx/bus_sdio.c |
12405 |
-@@ -156,7 +156,13 @@ static const struct hwbus_ops wfx_sdio_hwbus_ops = { |
12406 |
- .align_size = wfx_sdio_align_size, |
12407 |
- }; |
12408 |
- |
12409 |
--static const struct of_device_id wfx_sdio_of_match[]; |
12410 |
-+static const struct of_device_id wfx_sdio_of_match[] = { |
12411 |
-+ { .compatible = "silabs,wfx-sdio" }, |
12412 |
-+ { .compatible = "silabs,wf200" }, |
12413 |
-+ { }, |
12414 |
-+}; |
12415 |
-+MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); |
12416 |
-+ |
12417 |
- static int wfx_sdio_probe(struct sdio_func *func, |
12418 |
- const struct sdio_device_id *id) |
12419 |
- { |
12420 |
-@@ -248,15 +254,6 @@ static const struct sdio_device_id wfx_sdio_ids[] = { |
12421 |
- }; |
12422 |
- MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); |
12423 |
- |
12424 |
--#ifdef CONFIG_OF |
12425 |
--static const struct of_device_id wfx_sdio_of_match[] = { |
12426 |
-- { .compatible = "silabs,wfx-sdio" }, |
12427 |
-- { .compatible = "silabs,wf200" }, |
12428 |
-- { }, |
12429 |
--}; |
12430 |
--MODULE_DEVICE_TABLE(of, wfx_sdio_of_match); |
12431 |
--#endif |
12432 |
-- |
12433 |
- struct sdio_driver wfx_sdio_driver = { |
12434 |
- .name = "wfx-sdio", |
12435 |
- .id_table = wfx_sdio_ids, |
12436 |
-@@ -264,6 +261,6 @@ struct sdio_driver wfx_sdio_driver = { |
12437 |
- .remove = wfx_sdio_remove, |
12438 |
- .drv = { |
12439 |
- .owner = THIS_MODULE, |
12440 |
-- .of_match_table = of_match_ptr(wfx_sdio_of_match), |
12441 |
-+ .of_match_table = wfx_sdio_of_match, |
12442 |
- } |
12443 |
- }; |
12444 |
-diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c |
12445 |
-index 1164aba118a1..a73b5bbb578e 100644 |
12446 |
---- a/drivers/staging/wfx/debug.c |
12447 |
-+++ b/drivers/staging/wfx/debug.c |
12448 |
-@@ -142,7 +142,7 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v) |
12449 |
- mutex_lock(&wdev->rx_stats_lock); |
12450 |
- seq_printf(seq, "Timestamp: %dus\n", st->date); |
12451 |
- seq_printf(seq, "Low power clock: frequency %uHz, external %s\n", |
12452 |
-- st->pwr_clk_freq, |
12453 |
-+ le32_to_cpu(st->pwr_clk_freq), |
12454 |
- st->is_ext_pwr_clk ? "yes" : "no"); |
12455 |
- seq_printf(seq, |
12456 |
- "Num. of frames: %d, PER (x10e4): %d, Throughput: %dKbps/s\n", |
12457 |
-@@ -152,9 +152,12 @@ static int wfx_rx_stats_show(struct seq_file *seq, void *v) |
12458 |
- for (i = 0; i < ARRAY_SIZE(channel_names); i++) { |
12459 |
- if (channel_names[i]) |
12460 |
- seq_printf(seq, "%5s %8d %8d %8d %8d %8d\n", |
12461 |
-- channel_names[i], st->nb_rx_by_rate[i], |
12462 |
-- st->per[i], st->rssi[i] / 100, |
12463 |
-- st->snr[i] / 100, st->cfo[i]); |
12464 |
-+ channel_names[i], |
12465 |
-+ le32_to_cpu(st->nb_rx_by_rate[i]), |
12466 |
-+ le16_to_cpu(st->per[i]), |
12467 |
-+ (s16)le16_to_cpu(st->rssi[i]) / 100, |
12468 |
-+ (s16)le16_to_cpu(st->snr[i]) / 100, |
12469 |
-+ (s16)le16_to_cpu(st->cfo[i])); |
12470 |
- } |
12471 |
- mutex_unlock(&wdev->rx_stats_lock); |
12472 |
- |
12473 |
-diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c |
12474 |
-index 77bca43aca42..20b3045d7667 100644 |
12475 |
---- a/drivers/staging/wfx/hif_tx.c |
12476 |
-+++ b/drivers/staging/wfx/hif_tx.c |
12477 |
-@@ -268,7 +268,7 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, |
12478 |
- tmo_chan_bg = le32_to_cpu(body->max_channel_time) * USEC_PER_TU; |
12479 |
- tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; |
12480 |
- tmo_chan_fg *= body->num_of_probe_requests; |
12481 |
-- tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg); |
12482 |
-+ tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; |
12483 |
- |
12484 |
- wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); |
12485 |
- ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); |
12486 |
-diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c |
12487 |
-index 39d9127ce4b9..8ae23681e29b 100644 |
12488 |
---- a/drivers/staging/wfx/queue.c |
12489 |
-+++ b/drivers/staging/wfx/queue.c |
12490 |
-@@ -35,6 +35,7 @@ void wfx_tx_flush(struct wfx_dev *wdev) |
12491 |
- if (wdev->chip_frozen) |
12492 |
- return; |
12493 |
- |
12494 |
-+ wfx_tx_lock(wdev); |
12495 |
- mutex_lock(&wdev->hif_cmd.lock); |
12496 |
- ret = wait_event_timeout(wdev->hif.tx_buffers_empty, |
12497 |
- !wdev->hif.tx_buffers_used, |
12498 |
-@@ -47,6 +48,7 @@ void wfx_tx_flush(struct wfx_dev *wdev) |
12499 |
- wdev->chip_frozen = 1; |
12500 |
- } |
12501 |
- mutex_unlock(&wdev->hif_cmd.lock); |
12502 |
-+ wfx_tx_unlock(wdev); |
12503 |
- } |
12504 |
- |
12505 |
- void wfx_tx_lock_flush(struct wfx_dev *wdev) |
12506 |
-diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c |
12507 |
-index 9d430346a58b..b4cd7cb1ce56 100644 |
12508 |
---- a/drivers/staging/wfx/sta.c |
12509 |
-+++ b/drivers/staging/wfx/sta.c |
12510 |
-@@ -520,7 +520,9 @@ static void wfx_do_join(struct wfx_vif *wvif) |
12511 |
- ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); |
12512 |
- if (ssidie) { |
12513 |
- ssidlen = ssidie[1]; |
12514 |
-- memcpy(ssid, &ssidie[2], ssidie[1]); |
12515 |
-+ if (ssidlen > IEEE80211_MAX_SSID_LEN) |
12516 |
-+ ssidlen = IEEE80211_MAX_SSID_LEN; |
12517 |
-+ memcpy(ssid, &ssidie[2], ssidlen); |
12518 |
- } |
12519 |
- rcu_read_unlock(); |
12520 |
- |
12521 |
-@@ -1047,7 +1049,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
12522 |
- init_completion(&wvif->scan_complete); |
12523 |
- INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); |
12524 |
- |
12525 |
-- INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); |
12526 |
- mutex_unlock(&wdev->conf_mutex); |
12527 |
- |
12528 |
- hif_set_macaddr(wvif, vif->addr); |
12529 |
-diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h |
12530 |
-index cf99a8a74a81..ace845f9ed14 100644 |
12531 |
---- a/drivers/staging/wfx/sta.h |
12532 |
-+++ b/drivers/staging/wfx/sta.h |
12533 |
-@@ -37,7 +37,7 @@ struct wfx_grp_addr_table { |
12534 |
- struct wfx_sta_priv { |
12535 |
- int link_id; |
12536 |
- int vif_id; |
12537 |
-- u8 buffered[IEEE80211_NUM_TIDS]; |
12538 |
-+ int buffered[IEEE80211_NUM_TIDS]; |
12539 |
- // Ensure atomicity of "buffered" and calls to ieee80211_sta_set_buffered() |
12540 |
- spinlock_t lock; |
12541 |
- }; |
12542 |
-diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c |
12543 |
-index 6c7de2f8d3f2..d025a3093015 100644 |
12544 |
---- a/drivers/staging/wilc1000/hif.c |
12545 |
-+++ b/drivers/staging/wilc1000/hif.c |
12546 |
-@@ -11,6 +11,8 @@ |
12547 |
- |
12548 |
- #define WILC_FALSE_FRMWR_CHANNEL 100 |
12549 |
- |
12550 |
-+#define WILC_SCAN_WID_LIST_SIZE 6 |
12551 |
-+ |
12552 |
- struct wilc_rcvd_mac_info { |
12553 |
- u8 status; |
12554 |
- }; |
12555 |
-@@ -151,7 +153,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, |
12556 |
- void *user_arg, struct cfg80211_scan_request *request) |
12557 |
- { |
12558 |
- int result = 0; |
12559 |
-- struct wid wid_list[5]; |
12560 |
-+ struct wid wid_list[WILC_SCAN_WID_LIST_SIZE]; |
12561 |
- u32 index = 0; |
12562 |
- u32 i, scan_timeout; |
12563 |
- u8 *buffer; |
12564 |
-diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c |
12565 |
-index 3305b47fdf53..16d5a4e117a2 100644 |
12566 |
---- a/drivers/target/loopback/tcm_loop.c |
12567 |
-+++ b/drivers/target/loopback/tcm_loop.c |
12568 |
-@@ -545,32 +545,15 @@ static int tcm_loop_write_pending(struct se_cmd *se_cmd) |
12569 |
- return 0; |
12570 |
- } |
12571 |
- |
12572 |
--static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
12573 |
-+static int tcm_loop_queue_data_or_status(const char *func, |
12574 |
-+ struct se_cmd *se_cmd, u8 scsi_status) |
12575 |
- { |
12576 |
- struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
12577 |
- struct tcm_loop_cmd, tl_se_cmd); |
12578 |
- struct scsi_cmnd *sc = tl_cmd->sc; |
12579 |
- |
12580 |
- pr_debug("%s() called for scsi_cmnd: %p cdb: 0x%02x\n", |
12581 |
-- __func__, sc, sc->cmnd[0]); |
12582 |
-- |
12583 |
-- sc->result = SAM_STAT_GOOD; |
12584 |
-- set_host_byte(sc, DID_OK); |
12585 |
-- if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
12586 |
-- (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) |
12587 |
-- scsi_set_resid(sc, se_cmd->residual_count); |
12588 |
-- sc->scsi_done(sc); |
12589 |
-- return 0; |
12590 |
--} |
12591 |
-- |
12592 |
--static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12593 |
--{ |
12594 |
-- struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
12595 |
-- struct tcm_loop_cmd, tl_se_cmd); |
12596 |
-- struct scsi_cmnd *sc = tl_cmd->sc; |
12597 |
-- |
12598 |
-- pr_debug("%s() called for scsi_cmnd: %p cdb: 0x%02x\n", |
12599 |
-- __func__, sc, sc->cmnd[0]); |
12600 |
-+ func, sc, sc->cmnd[0]); |
12601 |
- |
12602 |
- if (se_cmd->sense_buffer && |
12603 |
- ((se_cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) || |
12604 |
-@@ -581,7 +564,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12605 |
- sc->result = SAM_STAT_CHECK_CONDITION; |
12606 |
- set_driver_byte(sc, DRIVER_SENSE); |
12607 |
- } else |
12608 |
-- sc->result = se_cmd->scsi_status; |
12609 |
-+ sc->result = scsi_status; |
12610 |
- |
12611 |
- set_host_byte(sc, DID_OK); |
12612 |
- if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
12613 |
-@@ -591,6 +574,17 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12614 |
- return 0; |
12615 |
- } |
12616 |
- |
12617 |
-+static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
12618 |
-+{ |
12619 |
-+ return tcm_loop_queue_data_or_status(__func__, se_cmd, SAM_STAT_GOOD); |
12620 |
-+} |
12621 |
-+ |
12622 |
-+static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
12623 |
-+{ |
12624 |
-+ return tcm_loop_queue_data_or_status(__func__, |
12625 |
-+ se_cmd, se_cmd->scsi_status); |
12626 |
-+} |
12627 |
-+ |
12628 |
- static void tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd) |
12629 |
- { |
12630 |
- struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, |
12631 |
-diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
12632 |
-index f769bb1e3735..b63a1e0c4aa6 100644 |
12633 |
---- a/drivers/target/target_core_user.c |
12634 |
-+++ b/drivers/target/target_core_user.c |
12635 |
-@@ -882,41 +882,24 @@ static inline size_t tcmu_cmd_get_cmd_size(struct tcmu_cmd *tcmu_cmd, |
12636 |
- return command_size; |
12637 |
- } |
12638 |
- |
12639 |
--static int tcmu_setup_cmd_timer(struct tcmu_cmd *tcmu_cmd, unsigned int tmo, |
12640 |
-- struct timer_list *timer) |
12641 |
-+static void tcmu_setup_cmd_timer(struct tcmu_cmd *tcmu_cmd, unsigned int tmo, |
12642 |
-+ struct timer_list *timer) |
12643 |
- { |
12644 |
-- struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
12645 |
-- int cmd_id; |
12646 |
-- |
12647 |
-- if (tcmu_cmd->cmd_id) |
12648 |
-- goto setup_timer; |
12649 |
-- |
12650 |
-- cmd_id = idr_alloc(&udev->commands, tcmu_cmd, 1, USHRT_MAX, GFP_NOWAIT); |
12651 |
-- if (cmd_id < 0) { |
12652 |
-- pr_err("tcmu: Could not allocate cmd id.\n"); |
12653 |
-- return cmd_id; |
12654 |
-- } |
12655 |
-- tcmu_cmd->cmd_id = cmd_id; |
12656 |
-- |
12657 |
-- pr_debug("allocated cmd %u for dev %s tmo %lu\n", tcmu_cmd->cmd_id, |
12658 |
-- udev->name, tmo / MSEC_PER_SEC); |
12659 |
-- |
12660 |
--setup_timer: |
12661 |
- if (!tmo) |
12662 |
-- return 0; |
12663 |
-+ return; |
12664 |
- |
12665 |
- tcmu_cmd->deadline = round_jiffies_up(jiffies + msecs_to_jiffies(tmo)); |
12666 |
- if (!timer_pending(timer)) |
12667 |
- mod_timer(timer, tcmu_cmd->deadline); |
12668 |
- |
12669 |
-- return 0; |
12670 |
-+ pr_debug("Timeout set up for cmd %p, dev = %s, tmo = %lu\n", tcmu_cmd, |
12671 |
-+ tcmu_cmd->tcmu_dev->name, tmo / MSEC_PER_SEC); |
12672 |
- } |
12673 |
- |
12674 |
- static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) |
12675 |
- { |
12676 |
- struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
12677 |
- unsigned int tmo; |
12678 |
-- int ret; |
12679 |
- |
12680 |
- /* |
12681 |
- * For backwards compat if qfull_time_out is not set use |
12682 |
-@@ -931,13 +914,11 @@ static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) |
12683 |
- else |
12684 |
- tmo = TCMU_TIME_OUT; |
12685 |
- |
12686 |
-- ret = tcmu_setup_cmd_timer(tcmu_cmd, tmo, &udev->qfull_timer); |
12687 |
-- if (ret) |
12688 |
-- return ret; |
12689 |
-+ tcmu_setup_cmd_timer(tcmu_cmd, tmo, &udev->qfull_timer); |
12690 |
- |
12691 |
- list_add_tail(&tcmu_cmd->queue_entry, &udev->qfull_queue); |
12692 |
-- pr_debug("adding cmd %u on dev %s to ring space wait queue\n", |
12693 |
-- tcmu_cmd->cmd_id, udev->name); |
12694 |
-+ pr_debug("adding cmd %p on dev %s to ring space wait queue\n", |
12695 |
-+ tcmu_cmd, udev->name); |
12696 |
- return 0; |
12697 |
- } |
12698 |
- |
12699 |
-@@ -959,7 +940,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) |
12700 |
- struct tcmu_mailbox *mb; |
12701 |
- struct tcmu_cmd_entry *entry; |
12702 |
- struct iovec *iov; |
12703 |
-- int iov_cnt, ret; |
12704 |
-+ int iov_cnt, cmd_id; |
12705 |
- uint32_t cmd_head; |
12706 |
- uint64_t cdb_off; |
12707 |
- bool copy_to_data_area; |
12708 |
-@@ -1060,14 +1041,21 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) |
12709 |
- } |
12710 |
- entry->req.iov_bidi_cnt = iov_cnt; |
12711 |
- |
12712 |
-- ret = tcmu_setup_cmd_timer(tcmu_cmd, udev->cmd_time_out, |
12713 |
-- &udev->cmd_timer); |
12714 |
-- if (ret) { |
12715 |
-- tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt); |
12716 |
-+ cmd_id = idr_alloc(&udev->commands, tcmu_cmd, 1, USHRT_MAX, GFP_NOWAIT); |
12717 |
-+ if (cmd_id < 0) { |
12718 |
-+ pr_err("tcmu: Could not allocate cmd id.\n"); |
12719 |
- |
12720 |
-+ tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt); |
12721 |
- *scsi_err = TCM_OUT_OF_RESOURCES; |
12722 |
- return -1; |
12723 |
- } |
12724 |
-+ tcmu_cmd->cmd_id = cmd_id; |
12725 |
-+ |
12726 |
-+ pr_debug("allocated cmd id %u for cmd %p dev %s\n", tcmu_cmd->cmd_id, |
12727 |
-+ tcmu_cmd, udev->name); |
12728 |
-+ |
12729 |
-+ tcmu_setup_cmd_timer(tcmu_cmd, udev->cmd_time_out, &udev->cmd_timer); |
12730 |
-+ |
12731 |
- entry->hdr.cmd_id = tcmu_cmd->cmd_id; |
12732 |
- |
12733 |
- /* |
12734 |
-@@ -1279,50 +1267,39 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) |
12735 |
- return handled; |
12736 |
- } |
12737 |
- |
12738 |
--static int tcmu_check_expired_cmd(int id, void *p, void *data) |
12739 |
-+static void tcmu_check_expired_ring_cmd(struct tcmu_cmd *cmd) |
12740 |
- { |
12741 |
-- struct tcmu_cmd *cmd = p; |
12742 |
-- struct tcmu_dev *udev = cmd->tcmu_dev; |
12743 |
-- u8 scsi_status; |
12744 |
- struct se_cmd *se_cmd; |
12745 |
-- bool is_running; |
12746 |
-- |
12747 |
-- if (test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) |
12748 |
-- return 0; |
12749 |
- |
12750 |
- if (!time_after(jiffies, cmd->deadline)) |
12751 |
-- return 0; |
12752 |
-+ return; |
12753 |
- |
12754 |
-- is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags); |
12755 |
-+ set_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags); |
12756 |
-+ list_del_init(&cmd->queue_entry); |
12757 |
- se_cmd = cmd->se_cmd; |
12758 |
-+ cmd->se_cmd = NULL; |
12759 |
- |
12760 |
-- if (is_running) { |
12761 |
-- /* |
12762 |
-- * If cmd_time_out is disabled but qfull is set deadline |
12763 |
-- * will only reflect the qfull timeout. Ignore it. |
12764 |
-- */ |
12765 |
-- if (!udev->cmd_time_out) |
12766 |
-- return 0; |
12767 |
-+ pr_debug("Timing out inflight cmd %u on dev %s.\n", |
12768 |
-+ cmd->cmd_id, cmd->tcmu_dev->name); |
12769 |
- |
12770 |
-- set_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags); |
12771 |
-- /* |
12772 |
-- * target_complete_cmd will translate this to LUN COMM FAILURE |
12773 |
-- */ |
12774 |
-- scsi_status = SAM_STAT_CHECK_CONDITION; |
12775 |
-- list_del_init(&cmd->queue_entry); |
12776 |
-- cmd->se_cmd = NULL; |
12777 |
-- } else { |
12778 |
-- list_del_init(&cmd->queue_entry); |
12779 |
-- idr_remove(&udev->commands, id); |
12780 |
-- tcmu_free_cmd(cmd); |
12781 |
-- scsi_status = SAM_STAT_TASK_SET_FULL; |
12782 |
-- } |
12783 |
-+ target_complete_cmd(se_cmd, SAM_STAT_CHECK_CONDITION); |
12784 |
-+} |
12785 |
- |
12786 |
-- pr_debug("Timing out cmd %u on dev %s that is %s.\n", |
12787 |
-- id, udev->name, is_running ? "inflight" : "queued"); |
12788 |
-+static void tcmu_check_expired_queue_cmd(struct tcmu_cmd *cmd) |
12789 |
-+{ |
12790 |
-+ struct se_cmd *se_cmd; |
12791 |
- |
12792 |
-- target_complete_cmd(se_cmd, scsi_status); |
12793 |
-- return 0; |
12794 |
-+ if (!time_after(jiffies, cmd->deadline)) |
12795 |
-+ return; |
12796 |
-+ |
12797 |
-+ pr_debug("Timing out queued cmd %p on dev %s.\n", |
12798 |
-+ cmd, cmd->tcmu_dev->name); |
12799 |
-+ |
12800 |
-+ list_del_init(&cmd->queue_entry); |
12801 |
-+ se_cmd = cmd->se_cmd; |
12802 |
-+ tcmu_free_cmd(cmd); |
12803 |
-+ |
12804 |
-+ target_complete_cmd(se_cmd, SAM_STAT_TASK_SET_FULL); |
12805 |
- } |
12806 |
- |
12807 |
- static void tcmu_device_timedout(struct tcmu_dev *udev) |
12808 |
-@@ -1407,16 +1384,15 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) |
12809 |
- return &udev->se_dev; |
12810 |
- } |
12811 |
- |
12812 |
--static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12813 |
-+static void run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12814 |
- { |
12815 |
- struct tcmu_cmd *tcmu_cmd, *tmp_cmd; |
12816 |
- LIST_HEAD(cmds); |
12817 |
-- bool drained = true; |
12818 |
- sense_reason_t scsi_ret; |
12819 |
- int ret; |
12820 |
- |
12821 |
- if (list_empty(&udev->qfull_queue)) |
12822 |
-- return true; |
12823 |
-+ return; |
12824 |
- |
12825 |
- pr_debug("running %s's cmdr queue forcefail %d\n", udev->name, fail); |
12826 |
- |
12827 |
-@@ -1425,11 +1401,10 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12828 |
- list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, queue_entry) { |
12829 |
- list_del_init(&tcmu_cmd->queue_entry); |
12830 |
- |
12831 |
-- pr_debug("removing cmd %u on dev %s from queue\n", |
12832 |
-- tcmu_cmd->cmd_id, udev->name); |
12833 |
-+ pr_debug("removing cmd %p on dev %s from queue\n", |
12834 |
-+ tcmu_cmd, udev->name); |
12835 |
- |
12836 |
- if (fail) { |
12837 |
-- idr_remove(&udev->commands, tcmu_cmd->cmd_id); |
12838 |
- /* |
12839 |
- * We were not able to even start the command, so |
12840 |
- * fail with busy to allow a retry in case runner |
12841 |
-@@ -1444,10 +1419,8 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12842 |
- |
12843 |
- ret = queue_cmd_ring(tcmu_cmd, &scsi_ret); |
12844 |
- if (ret < 0) { |
12845 |
-- pr_debug("cmd %u on dev %s failed with %u\n", |
12846 |
-- tcmu_cmd->cmd_id, udev->name, scsi_ret); |
12847 |
-- |
12848 |
-- idr_remove(&udev->commands, tcmu_cmd->cmd_id); |
12849 |
-+ pr_debug("cmd %p on dev %s failed with %u\n", |
12850 |
-+ tcmu_cmd, udev->name, scsi_ret); |
12851 |
- /* |
12852 |
- * Ignore scsi_ret for now. target_complete_cmd |
12853 |
- * drops it. |
12854 |
-@@ -1462,13 +1435,11 @@ static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) |
12855 |
- * the queue |
12856 |
- */ |
12857 |
- list_splice_tail(&cmds, &udev->qfull_queue); |
12858 |
-- drained = false; |
12859 |
- break; |
12860 |
- } |
12861 |
- } |
12862 |
- |
12863 |
- tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); |
12864 |
-- return drained; |
12865 |
- } |
12866 |
- |
12867 |
- static int tcmu_irqcontrol(struct uio_info *info, s32 irq_on) |
12868 |
-@@ -1652,6 +1623,8 @@ static void tcmu_dev_kref_release(struct kref *kref) |
12869 |
- if (tcmu_check_and_free_pending_cmd(cmd) != 0) |
12870 |
- all_expired = false; |
12871 |
- } |
12872 |
-+ if (!list_empty(&udev->qfull_queue)) |
12873 |
-+ all_expired = false; |
12874 |
- idr_destroy(&udev->commands); |
12875 |
- WARN_ON(!all_expired); |
12876 |
- |
12877 |
-@@ -2037,9 +2010,6 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
12878 |
- mutex_lock(&udev->cmdr_lock); |
12879 |
- |
12880 |
- idr_for_each_entry(&udev->commands, cmd, i) { |
12881 |
-- if (!test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags)) |
12882 |
-- continue; |
12883 |
-- |
12884 |
- pr_debug("removing cmd %u on dev %s from ring (is expired %d)\n", |
12885 |
- cmd->cmd_id, udev->name, |
12886 |
- test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)); |
12887 |
-@@ -2077,6 +2047,8 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) |
12888 |
- |
12889 |
- del_timer(&udev->cmd_timer); |
12890 |
- |
12891 |
-+ run_qfull_queue(udev, false); |
12892 |
-+ |
12893 |
- mutex_unlock(&udev->cmdr_lock); |
12894 |
- } |
12895 |
- |
12896 |
-@@ -2698,6 +2670,7 @@ static void find_free_blocks(void) |
12897 |
- static void check_timedout_devices(void) |
12898 |
- { |
12899 |
- struct tcmu_dev *udev, *tmp_dev; |
12900 |
-+ struct tcmu_cmd *cmd, *tmp_cmd; |
12901 |
- LIST_HEAD(devs); |
12902 |
- |
12903 |
- spin_lock_bh(&timed_out_udevs_lock); |
12904 |
-@@ -2708,9 +2681,24 @@ static void check_timedout_devices(void) |
12905 |
- spin_unlock_bh(&timed_out_udevs_lock); |
12906 |
- |
12907 |
- mutex_lock(&udev->cmdr_lock); |
12908 |
-- idr_for_each(&udev->commands, tcmu_check_expired_cmd, NULL); |
12909 |
- |
12910 |
-- tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); |
12911 |
-+ /* |
12912 |
-+ * If cmd_time_out is disabled but qfull is set deadline |
12913 |
-+ * will only reflect the qfull timeout. Ignore it. |
12914 |
-+ */ |
12915 |
-+ if (udev->cmd_time_out) { |
12916 |
-+ list_for_each_entry_safe(cmd, tmp_cmd, |
12917 |
-+ &udev->inflight_queue, |
12918 |
-+ queue_entry) { |
12919 |
-+ tcmu_check_expired_ring_cmd(cmd); |
12920 |
-+ } |
12921 |
-+ tcmu_set_next_deadline(&udev->inflight_queue, |
12922 |
-+ &udev->cmd_timer); |
12923 |
-+ } |
12924 |
-+ list_for_each_entry_safe(cmd, tmp_cmd, &udev->qfull_queue, |
12925 |
-+ queue_entry) { |
12926 |
-+ tcmu_check_expired_queue_cmd(cmd); |
12927 |
-+ } |
12928 |
- tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); |
12929 |
- |
12930 |
- mutex_unlock(&udev->cmdr_lock); |
12931 |
-diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
12932 |
-index d3e959d01606..85776db4bf34 100644 |
12933 |
---- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
12934 |
-+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c |
12935 |
-@@ -169,7 +169,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, |
12936 |
- |
12937 |
- data = ti_bandgap_get_sensor_data(bgp, id); |
12938 |
- |
12939 |
-- if (!data || IS_ERR(data)) |
12940 |
-+ if (!IS_ERR_OR_NULL(data)) |
12941 |
- data = ti_thermal_build_data(bgp, id); |
12942 |
- |
12943 |
- if (!data) |
12944 |
-@@ -196,7 +196,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) |
12945 |
- |
12946 |
- data = ti_bandgap_get_sensor_data(bgp, id); |
12947 |
- |
12948 |
-- if (data && data->ti_thermal) { |
12949 |
-+ if (!IS_ERR_OR_NULL(data) && data->ti_thermal) { |
12950 |
- if (data->our_zone) |
12951 |
- thermal_zone_device_unregister(data->ti_thermal); |
12952 |
- } |
12953 |
-@@ -262,7 +262,7 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) |
12954 |
- |
12955 |
- data = ti_bandgap_get_sensor_data(bgp, id); |
12956 |
- |
12957 |
-- if (data) { |
12958 |
-+ if (!IS_ERR_OR_NULL(data)) { |
12959 |
- cpufreq_cooling_unregister(data->cool_dev); |
12960 |
- if (data->policy) |
12961 |
- cpufreq_cpu_put(data->policy); |
12962 |
-diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
12963 |
-index cdcc64ea2554..f8e43a6faea9 100644 |
12964 |
---- a/drivers/tty/hvc/hvc_console.c |
12965 |
-+++ b/drivers/tty/hvc/hvc_console.c |
12966 |
-@@ -75,6 +75,8 @@ static LIST_HEAD(hvc_structs); |
12967 |
- */ |
12968 |
- static DEFINE_MUTEX(hvc_structs_mutex); |
12969 |
- |
12970 |
-+/* Mutex to serialize hvc_open */ |
12971 |
-+static DEFINE_MUTEX(hvc_open_mutex); |
12972 |
- /* |
12973 |
- * This value is used to assign a tty->index value to a hvc_struct based |
12974 |
- * upon order of exposure via hvc_probe(), when we can not match it to |
12975 |
-@@ -346,16 +348,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty) |
12976 |
- */ |
12977 |
- static int hvc_open(struct tty_struct *tty, struct file * filp) |
12978 |
- { |
12979 |
-- struct hvc_struct *hp = tty->driver_data; |
12980 |
-+ struct hvc_struct *hp; |
12981 |
- unsigned long flags; |
12982 |
- int rc = 0; |
12983 |
- |
12984 |
-+ mutex_lock(&hvc_open_mutex); |
12985 |
-+ |
12986 |
-+ hp = tty->driver_data; |
12987 |
-+ if (!hp) { |
12988 |
-+ rc = -EIO; |
12989 |
-+ goto out; |
12990 |
-+ } |
12991 |
-+ |
12992 |
- spin_lock_irqsave(&hp->port.lock, flags); |
12993 |
- /* Check and then increment for fast path open. */ |
12994 |
- if (hp->port.count++ > 0) { |
12995 |
- spin_unlock_irqrestore(&hp->port.lock, flags); |
12996 |
- hvc_kick(); |
12997 |
-- return 0; |
12998 |
-+ goto out; |
12999 |
- } /* else count == 0 */ |
13000 |
- spin_unlock_irqrestore(&hp->port.lock, flags); |
13001 |
- |
13002 |
-@@ -383,6 +393,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) |
13003 |
- /* Force wakeup of the polling thread */ |
13004 |
- hvc_kick(); |
13005 |
- |
13006 |
-+out: |
13007 |
-+ mutex_unlock(&hvc_open_mutex); |
13008 |
- return rc; |
13009 |
- } |
13010 |
- |
13011 |
-diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
13012 |
-index d77ed82a4840..f189579db7c4 100644 |
13013 |
---- a/drivers/tty/n_gsm.c |
13014 |
-+++ b/drivers/tty/n_gsm.c |
13015 |
-@@ -673,11 +673,10 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len, |
13016 |
- * FIXME: lock against link layer control transmissions |
13017 |
- */ |
13018 |
- |
13019 |
--static void gsm_data_kick(struct gsm_mux *gsm) |
13020 |
-+static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) |
13021 |
- { |
13022 |
- struct gsm_msg *msg, *nmsg; |
13023 |
- int len; |
13024 |
-- int skip_sof = 0; |
13025 |
- |
13026 |
- list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { |
13027 |
- if (gsm->constipated && msg->addr) |
13028 |
-@@ -699,18 +698,23 @@ static void gsm_data_kick(struct gsm_mux *gsm) |
13029 |
- print_hex_dump_bytes("gsm_data_kick: ", |
13030 |
- DUMP_PREFIX_OFFSET, |
13031 |
- gsm->txframe, len); |
13032 |
-- |
13033 |
-- if (gsm->output(gsm, gsm->txframe + skip_sof, |
13034 |
-- len - skip_sof) < 0) |
13035 |
-+ if (gsm->output(gsm, gsm->txframe, len) < 0) |
13036 |
- break; |
13037 |
- /* FIXME: Can eliminate one SOF in many more cases */ |
13038 |
- gsm->tx_bytes -= msg->len; |
13039 |
-- /* For a burst of frames skip the extra SOF within the |
13040 |
-- burst */ |
13041 |
-- skip_sof = 1; |
13042 |
- |
13043 |
- list_del(&msg->list); |
13044 |
- kfree(msg); |
13045 |
-+ |
13046 |
-+ if (dlci) { |
13047 |
-+ tty_port_tty_wakeup(&dlci->port); |
13048 |
-+ } else { |
13049 |
-+ int i = 0; |
13050 |
-+ |
13051 |
-+ for (i = 0; i < NUM_DLCI; i++) |
13052 |
-+ if (gsm->dlci[i]) |
13053 |
-+ tty_port_tty_wakeup(&gsm->dlci[i]->port); |
13054 |
-+ } |
13055 |
- } |
13056 |
- } |
13057 |
- |
13058 |
-@@ -762,7 +766,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) |
13059 |
- /* Add to the actual output queue */ |
13060 |
- list_add_tail(&msg->list, &gsm->tx_list); |
13061 |
- gsm->tx_bytes += msg->len; |
13062 |
-- gsm_data_kick(gsm); |
13063 |
-+ gsm_data_kick(gsm, dlci); |
13064 |
- } |
13065 |
- |
13066 |
- /** |
13067 |
-@@ -1223,7 +1227,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, |
13068 |
- gsm_control_reply(gsm, CMD_FCON, NULL, 0); |
13069 |
- /* Kick the link in case it is idling */ |
13070 |
- spin_lock_irqsave(&gsm->tx_lock, flags); |
13071 |
-- gsm_data_kick(gsm); |
13072 |
-+ gsm_data_kick(gsm, NULL); |
13073 |
- spin_unlock_irqrestore(&gsm->tx_lock, flags); |
13074 |
- break; |
13075 |
- case CMD_FCOFF: |
13076 |
-@@ -2545,7 +2549,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty) |
13077 |
- /* Queue poll */ |
13078 |
- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
13079 |
- spin_lock_irqsave(&gsm->tx_lock, flags); |
13080 |
-- gsm_data_kick(gsm); |
13081 |
-+ gsm_data_kick(gsm, NULL); |
13082 |
- if (gsm->tx_bytes < TX_THRESH_LO) { |
13083 |
- gsm_dlci_data_sweep(gsm); |
13084 |
- } |
13085 |
-diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
13086 |
-index f77bf820b7a3..4d83c85a7389 100644 |
13087 |
---- a/drivers/tty/serial/8250/8250_port.c |
13088 |
-+++ b/drivers/tty/serial/8250/8250_port.c |
13089 |
-@@ -2615,6 +2615,8 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
13090 |
- struct ktermios *termios, |
13091 |
- struct ktermios *old) |
13092 |
- { |
13093 |
-+ unsigned int tolerance = port->uartclk / 100; |
13094 |
-+ |
13095 |
- /* |
13096 |
- * Ask the core to calculate the divisor for us. |
13097 |
- * Allow 1% tolerance at the upper limit so uart clks marginally |
13098 |
-@@ -2623,7 +2625,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, |
13099 |
- */ |
13100 |
- return uart_get_baud_rate(port, termios, old, |
13101 |
- port->uartclk / 16 / UART_DIV_MAX, |
13102 |
-- port->uartclk); |
13103 |
-+ (port->uartclk + tolerance) / 16); |
13104 |
- } |
13105 |
- |
13106 |
- void |
13107 |
-diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c |
13108 |
-index 5685ba11480b..e701ab56b0a7 100644 |
13109 |
---- a/drivers/usb/cdns3/cdns3-ti.c |
13110 |
-+++ b/drivers/usb/cdns3/cdns3-ti.c |
13111 |
-@@ -138,7 +138,7 @@ static int cdns_ti_probe(struct platform_device *pdev) |
13112 |
- error = pm_runtime_get_sync(dev); |
13113 |
- if (error < 0) { |
13114 |
- dev_err(dev, "pm_runtime_get_sync failed: %d\n", error); |
13115 |
-- goto err_get; |
13116 |
-+ goto err; |
13117 |
- } |
13118 |
- |
13119 |
- /* assert RESET */ |
13120 |
-@@ -185,7 +185,6 @@ static int cdns_ti_probe(struct platform_device *pdev) |
13121 |
- |
13122 |
- err: |
13123 |
- pm_runtime_put_sync(data->dev); |
13124 |
--err_get: |
13125 |
- pm_runtime_disable(data->dev); |
13126 |
- |
13127 |
- return error; |
13128 |
-diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c |
13129 |
-index 0d8e3f3804a3..084c48c5848f 100644 |
13130 |
---- a/drivers/usb/class/usblp.c |
13131 |
-+++ b/drivers/usb/class/usblp.c |
13132 |
-@@ -468,7 +468,8 @@ static int usblp_release(struct inode *inode, struct file *file) |
13133 |
- usb_autopm_put_interface(usblp->intf); |
13134 |
- |
13135 |
- if (!usblp->present) /* finish cleanup from disconnect */ |
13136 |
-- usblp_cleanup(usblp); |
13137 |
-+ usblp_cleanup(usblp); /* any URBs must be dead */ |
13138 |
-+ |
13139 |
- mutex_unlock(&usblp_mutex); |
13140 |
- return 0; |
13141 |
- } |
13142 |
-@@ -1375,9 +1376,11 @@ static void usblp_disconnect(struct usb_interface *intf) |
13143 |
- |
13144 |
- usblp_unlink_urbs(usblp); |
13145 |
- mutex_unlock(&usblp->mut); |
13146 |
-+ usb_poison_anchored_urbs(&usblp->urbs); |
13147 |
- |
13148 |
- if (!usblp->used) |
13149 |
- usblp_cleanup(usblp); |
13150 |
-+ |
13151 |
- mutex_unlock(&usblp_mutex); |
13152 |
- } |
13153 |
- |
13154 |
-diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c |
13155 |
-index 876ff31261d5..55f1d14fc414 100644 |
13156 |
---- a/drivers/usb/dwc2/core_intr.c |
13157 |
-+++ b/drivers/usb/dwc2/core_intr.c |
13158 |
-@@ -416,10 +416,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) |
13159 |
- if (ret && (ret != -ENOTSUPP)) |
13160 |
- dev_err(hsotg->dev, "exit power_down failed\n"); |
13161 |
- |
13162 |
-+ /* Change to L0 state */ |
13163 |
-+ hsotg->lx_state = DWC2_L0; |
13164 |
- call_gadget(hsotg, resume); |
13165 |
-+ } else { |
13166 |
-+ /* Change to L0 state */ |
13167 |
-+ hsotg->lx_state = DWC2_L0; |
13168 |
- } |
13169 |
-- /* Change to L0 state */ |
13170 |
-- hsotg->lx_state = DWC2_L0; |
13171 |
- } else { |
13172 |
- if (hsotg->params.power_down) |
13173 |
- return; |
13174 |
-diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c |
13175 |
-index b81d085bc534..eabb3bb6fcaa 100644 |
13176 |
---- a/drivers/usb/dwc3/dwc3-meson-g12a.c |
13177 |
-+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c |
13178 |
-@@ -505,7 +505,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
13179 |
- if (IS_ERR(priv->reset)) { |
13180 |
- ret = PTR_ERR(priv->reset); |
13181 |
- dev_err(dev, "failed to get device reset, err=%d\n", ret); |
13182 |
-- return ret; |
13183 |
-+ goto err_disable_clks; |
13184 |
- } |
13185 |
- |
13186 |
- ret = reset_control_reset(priv->reset); |
13187 |
-@@ -525,7 +525,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) |
13188 |
- /* Get dr_mode */ |
13189 |
- priv->otg_mode = usb_get_dr_mode(dev); |
13190 |
- |
13191 |
-- dwc3_meson_g12a_usb_init(priv); |
13192 |
-+ ret = dwc3_meson_g12a_usb_init(priv); |
13193 |
-+ if (ret) |
13194 |
-+ goto err_disable_clks; |
13195 |
- |
13196 |
- /* Init PHYs */ |
13197 |
- for (i = 0 ; i < PHY_COUNT ; ++i) { |
13198 |
-diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
13199 |
-index 585cb3deea7a..de3b92680935 100644 |
13200 |
---- a/drivers/usb/dwc3/gadget.c |
13201 |
-+++ b/drivers/usb/dwc3/gadget.c |
13202 |
-@@ -1220,6 +1220,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep) |
13203 |
- } |
13204 |
- } |
13205 |
- |
13206 |
-+static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep); |
13207 |
-+ |
13208 |
- static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) |
13209 |
- { |
13210 |
- struct dwc3_gadget_ep_cmd_params params; |
13211 |
-@@ -1259,14 +1261,20 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep) |
13212 |
- |
13213 |
- ret = dwc3_send_gadget_ep_cmd(dep, cmd, ¶ms); |
13214 |
- if (ret < 0) { |
13215 |
-- /* |
13216 |
-- * FIXME we need to iterate over the list of requests |
13217 |
-- * here and stop, unmap, free and del each of the linked |
13218 |
-- * requests instead of what we do now. |
13219 |
-- */ |
13220 |
-- if (req->trb) |
13221 |
-- memset(req->trb, 0, sizeof(struct dwc3_trb)); |
13222 |
-- dwc3_gadget_del_and_unmap_request(dep, req, ret); |
13223 |
-+ struct dwc3_request *tmp; |
13224 |
-+ |
13225 |
-+ if (ret == -EAGAIN) |
13226 |
-+ return ret; |
13227 |
-+ |
13228 |
-+ dwc3_stop_active_transfer(dep, true, true); |
13229 |
-+ |
13230 |
-+ list_for_each_entry_safe(req, tmp, &dep->started_list, list) |
13231 |
-+ dwc3_gadget_move_cancelled_request(req); |
13232 |
-+ |
13233 |
-+ /* If ep isn't started, then there's no end transfer pending */ |
13234 |
-+ if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) |
13235 |
-+ dwc3_gadget_ep_cleanup_cancelled_requests(dep); |
13236 |
-+ |
13237 |
- return ret; |
13238 |
- } |
13239 |
- |
13240 |
-@@ -1508,6 +1516,10 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r |
13241 |
- { |
13242 |
- int i; |
13243 |
- |
13244 |
-+ /* If req->trb is not set, then the request has not started */ |
13245 |
-+ if (!req->trb) |
13246 |
-+ return; |
13247 |
-+ |
13248 |
- /* |
13249 |
- * If request was already started, this means we had to |
13250 |
- * stop the transfer. With that we also need to ignore |
13251 |
-@@ -1598,6 +1610,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
13252 |
- { |
13253 |
- struct dwc3_gadget_ep_cmd_params params; |
13254 |
- struct dwc3 *dwc = dep->dwc; |
13255 |
-+ struct dwc3_request *req; |
13256 |
-+ struct dwc3_request *tmp; |
13257 |
- int ret; |
13258 |
- |
13259 |
- if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { |
13260 |
-@@ -1634,13 +1648,37 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
13261 |
- else |
13262 |
- dep->flags |= DWC3_EP_STALL; |
13263 |
- } else { |
13264 |
-+ /* |
13265 |
-+ * Don't issue CLEAR_STALL command to control endpoints. The |
13266 |
-+ * controller automatically clears the STALL when it receives |
13267 |
-+ * the SETUP token. |
13268 |
-+ */ |
13269 |
-+ if (dep->number <= 1) { |
13270 |
-+ dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
13271 |
-+ return 0; |
13272 |
-+ } |
13273 |
- |
13274 |
- ret = dwc3_send_clear_stall_ep_cmd(dep); |
13275 |
-- if (ret) |
13276 |
-+ if (ret) { |
13277 |
- dev_err(dwc->dev, "failed to clear STALL on %s\n", |
13278 |
- dep->name); |
13279 |
-- else |
13280 |
-- dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
13281 |
-+ return ret; |
13282 |
-+ } |
13283 |
-+ |
13284 |
-+ dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
13285 |
-+ |
13286 |
-+ dwc3_stop_active_transfer(dep, true, true); |
13287 |
-+ |
13288 |
-+ list_for_each_entry_safe(req, tmp, &dep->started_list, list) |
13289 |
-+ dwc3_gadget_move_cancelled_request(req); |
13290 |
-+ |
13291 |
-+ list_for_each_entry_safe(req, tmp, &dep->pending_list, list) |
13292 |
-+ dwc3_gadget_move_cancelled_request(req); |
13293 |
-+ |
13294 |
-+ if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) { |
13295 |
-+ dep->flags &= ~DWC3_EP_DELAY_START; |
13296 |
-+ dwc3_gadget_ep_cleanup_cancelled_requests(dep); |
13297 |
-+ } |
13298 |
- } |
13299 |
- |
13300 |
- return ret; |
13301 |
-diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
13302 |
-index cb4950cf1cdc..5c1eb96a5c57 100644 |
13303 |
---- a/drivers/usb/gadget/composite.c |
13304 |
-+++ b/drivers/usb/gadget/composite.c |
13305 |
-@@ -96,40 +96,43 @@ function_descriptors(struct usb_function *f, |
13306 |
- } |
13307 |
- |
13308 |
- /** |
13309 |
-- * next_ep_desc() - advance to the next EP descriptor |
13310 |
-+ * next_desc() - advance to the next desc_type descriptor |
13311 |
- * @t: currect pointer within descriptor array |
13312 |
-+ * @desc_type: descriptor type |
13313 |
- * |
13314 |
-- * Return: next EP descriptor or NULL |
13315 |
-+ * Return: next desc_type descriptor or NULL |
13316 |
- * |
13317 |
-- * Iterate over @t until either EP descriptor found or |
13318 |
-+ * Iterate over @t until either desc_type descriptor found or |
13319 |
- * NULL (that indicates end of list) encountered |
13320 |
- */ |
13321 |
- static struct usb_descriptor_header** |
13322 |
--next_ep_desc(struct usb_descriptor_header **t) |
13323 |
-+next_desc(struct usb_descriptor_header **t, u8 desc_type) |
13324 |
- { |
13325 |
- for (; *t; t++) { |
13326 |
-- if ((*t)->bDescriptorType == USB_DT_ENDPOINT) |
13327 |
-+ if ((*t)->bDescriptorType == desc_type) |
13328 |
- return t; |
13329 |
- } |
13330 |
- return NULL; |
13331 |
- } |
13332 |
- |
13333 |
- /* |
13334 |
-- * for_each_ep_desc()- iterate over endpoint descriptors in the |
13335 |
-- * descriptors list |
13336 |
-- * @start: pointer within descriptor array. |
13337 |
-- * @ep_desc: endpoint descriptor to use as the loop cursor |
13338 |
-+ * for_each_desc() - iterate over desc_type descriptors in the |
13339 |
-+ * descriptors list |
13340 |
-+ * @start: pointer within descriptor array. |
13341 |
-+ * @iter_desc: desc_type descriptor to use as the loop cursor |
13342 |
-+ * @desc_type: wanted descriptr type |
13343 |
- */ |
13344 |
--#define for_each_ep_desc(start, ep_desc) \ |
13345 |
-- for (ep_desc = next_ep_desc(start); \ |
13346 |
-- ep_desc; ep_desc = next_ep_desc(ep_desc+1)) |
13347 |
-+#define for_each_desc(start, iter_desc, desc_type) \ |
13348 |
-+ for (iter_desc = next_desc(start, desc_type); \ |
13349 |
-+ iter_desc; iter_desc = next_desc(iter_desc + 1, desc_type)) |
13350 |
- |
13351 |
- /** |
13352 |
-- * config_ep_by_speed() - configures the given endpoint |
13353 |
-+ * config_ep_by_speed_and_alt() - configures the given endpoint |
13354 |
- * according to gadget speed. |
13355 |
- * @g: pointer to the gadget |
13356 |
- * @f: usb function |
13357 |
- * @_ep: the endpoint to configure |
13358 |
-+ * @alt: alternate setting number |
13359 |
- * |
13360 |
- * Return: error code, 0 on success |
13361 |
- * |
13362 |
-@@ -142,11 +145,13 @@ next_ep_desc(struct usb_descriptor_header **t) |
13363 |
- * Note: the supplied function should hold all the descriptors |
13364 |
- * for supported speeds |
13365 |
- */ |
13366 |
--int config_ep_by_speed(struct usb_gadget *g, |
13367 |
-- struct usb_function *f, |
13368 |
-- struct usb_ep *_ep) |
13369 |
-+int config_ep_by_speed_and_alt(struct usb_gadget *g, |
13370 |
-+ struct usb_function *f, |
13371 |
-+ struct usb_ep *_ep, |
13372 |
-+ u8 alt) |
13373 |
- { |
13374 |
- struct usb_endpoint_descriptor *chosen_desc = NULL; |
13375 |
-+ struct usb_interface_descriptor *int_desc = NULL; |
13376 |
- struct usb_descriptor_header **speed_desc = NULL; |
13377 |
- |
13378 |
- struct usb_ss_ep_comp_descriptor *comp_desc = NULL; |
13379 |
-@@ -182,8 +187,21 @@ int config_ep_by_speed(struct usb_gadget *g, |
13380 |
- default: |
13381 |
- speed_desc = f->fs_descriptors; |
13382 |
- } |
13383 |
-+ |
13384 |
-+ /* find correct alternate setting descriptor */ |
13385 |
-+ for_each_desc(speed_desc, d_spd, USB_DT_INTERFACE) { |
13386 |
-+ int_desc = (struct usb_interface_descriptor *)*d_spd; |
13387 |
-+ |
13388 |
-+ if (int_desc->bAlternateSetting == alt) { |
13389 |
-+ speed_desc = d_spd; |
13390 |
-+ goto intf_found; |
13391 |
-+ } |
13392 |
-+ } |
13393 |
-+ return -EIO; |
13394 |
-+ |
13395 |
-+intf_found: |
13396 |
- /* find descriptors */ |
13397 |
-- for_each_ep_desc(speed_desc, d_spd) { |
13398 |
-+ for_each_desc(speed_desc, d_spd, USB_DT_ENDPOINT) { |
13399 |
- chosen_desc = (struct usb_endpoint_descriptor *)*d_spd; |
13400 |
- if (chosen_desc->bEndpointAddress == _ep->address) |
13401 |
- goto ep_found; |
13402 |
-@@ -237,6 +255,32 @@ ep_found: |
13403 |
- } |
13404 |
- return 0; |
13405 |
- } |
13406 |
-+EXPORT_SYMBOL_GPL(config_ep_by_speed_and_alt); |
13407 |
-+ |
13408 |
-+/** |
13409 |
-+ * config_ep_by_speed() - configures the given endpoint |
13410 |
-+ * according to gadget speed. |
13411 |
-+ * @g: pointer to the gadget |
13412 |
-+ * @f: usb function |
13413 |
-+ * @_ep: the endpoint to configure |
13414 |
-+ * |
13415 |
-+ * Return: error code, 0 on success |
13416 |
-+ * |
13417 |
-+ * This function chooses the right descriptors for a given |
13418 |
-+ * endpoint according to gadget speed and saves it in the |
13419 |
-+ * endpoint desc field. If the endpoint already has a descriptor |
13420 |
-+ * assigned to it - overwrites it with currently corresponding |
13421 |
-+ * descriptor. The endpoint maxpacket field is updated according |
13422 |
-+ * to the chosen descriptor. |
13423 |
-+ * Note: the supplied function should hold all the descriptors |
13424 |
-+ * for supported speeds |
13425 |
-+ */ |
13426 |
-+int config_ep_by_speed(struct usb_gadget *g, |
13427 |
-+ struct usb_function *f, |
13428 |
-+ struct usb_ep *_ep) |
13429 |
-+{ |
13430 |
-+ return config_ep_by_speed_and_alt(g, f, _ep, 0); |
13431 |
-+} |
13432 |
- EXPORT_SYMBOL_GPL(config_ep_by_speed); |
13433 |
- |
13434 |
- /** |
13435 |
-diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c |
13436 |
-index 9b11046480fe..2e28dde8376f 100644 |
13437 |
---- a/drivers/usb/gadget/udc/core.c |
13438 |
-+++ b/drivers/usb/gadget/udc/core.c |
13439 |
-@@ -1297,6 +1297,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) |
13440 |
- kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); |
13441 |
- |
13442 |
- usb_gadget_disconnect(udc->gadget); |
13443 |
-+ if (udc->gadget->irq) |
13444 |
-+ synchronize_irq(udc->gadget->irq); |
13445 |
- udc->driver->unbind(udc->gadget); |
13446 |
- usb_gadget_udc_stop(udc); |
13447 |
- |
13448 |
-diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c |
13449 |
-index cb997b82c008..465d0b7c6522 100644 |
13450 |
---- a/drivers/usb/gadget/udc/lpc32xx_udc.c |
13451 |
-+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c |
13452 |
-@@ -1614,17 +1614,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep, |
13453 |
- const struct usb_endpoint_descriptor *desc) |
13454 |
- { |
13455 |
- struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); |
13456 |
-- struct lpc32xx_udc *udc = ep->udc; |
13457 |
-+ struct lpc32xx_udc *udc; |
13458 |
- u16 maxpacket; |
13459 |
- u32 tmp; |
13460 |
- unsigned long flags; |
13461 |
- |
13462 |
- /* Verify EP data */ |
13463 |
- if ((!_ep) || (!ep) || (!desc) || |
13464 |
-- (desc->bDescriptorType != USB_DT_ENDPOINT)) { |
13465 |
-- dev_dbg(udc->dev, "bad ep or descriptor\n"); |
13466 |
-+ (desc->bDescriptorType != USB_DT_ENDPOINT)) |
13467 |
- return -EINVAL; |
13468 |
-- } |
13469 |
-+ |
13470 |
-+ udc = ep->udc; |
13471 |
- maxpacket = usb_endpoint_maxp(desc); |
13472 |
- if ((maxpacket == 0) || (maxpacket > ep->maxpacket)) { |
13473 |
- dev_dbg(udc->dev, "bad ep descriptor's packet size\n"); |
13474 |
-@@ -1872,7 +1872,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
13475 |
- static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) |
13476 |
- { |
13477 |
- struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); |
13478 |
-- struct lpc32xx_udc *udc = ep->udc; |
13479 |
-+ struct lpc32xx_udc *udc; |
13480 |
- unsigned long flags; |
13481 |
- |
13482 |
- if ((!ep) || (ep->hwep_num <= 1)) |
13483 |
-@@ -1882,6 +1882,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value) |
13484 |
- if (ep->is_in) |
13485 |
- return -EAGAIN; |
13486 |
- |
13487 |
-+ udc = ep->udc; |
13488 |
- spin_lock_irqsave(&udc->lock, flags); |
13489 |
- |
13490 |
- if (value == 1) { |
13491 |
-diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c |
13492 |
-index 75d16a8902e6..931e6362a13d 100644 |
13493 |
---- a/drivers/usb/gadget/udc/m66592-udc.c |
13494 |
-+++ b/drivers/usb/gadget/udc/m66592-udc.c |
13495 |
-@@ -1667,7 +1667,7 @@ static int m66592_probe(struct platform_device *pdev) |
13496 |
- |
13497 |
- err_add_udc: |
13498 |
- m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req); |
13499 |
-- |
13500 |
-+ m66592->ep0_req = NULL; |
13501 |
- clean_up3: |
13502 |
- if (m66592->pdata->on_chip) { |
13503 |
- clk_disable(m66592->clk); |
13504 |
-diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c |
13505 |
-index 0507a2ca0f55..80002d97b59d 100644 |
13506 |
---- a/drivers/usb/gadget/udc/s3c2410_udc.c |
13507 |
-+++ b/drivers/usb/gadget/udc/s3c2410_udc.c |
13508 |
-@@ -251,10 +251,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep, |
13509 |
- static void s3c2410_udc_nuke(struct s3c2410_udc *udc, |
13510 |
- struct s3c2410_ep *ep, int status) |
13511 |
- { |
13512 |
-- /* Sanity check */ |
13513 |
-- if (&ep->queue == NULL) |
13514 |
-- return; |
13515 |
-- |
13516 |
- while (!list_empty(&ep->queue)) { |
13517 |
- struct s3c2410_request *req; |
13518 |
- req = list_entry(ep->queue.next, struct s3c2410_request, |
13519 |
-diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c |
13520 |
-index c9f91e6c72b6..7f65c86047dd 100644 |
13521 |
---- a/drivers/usb/host/ehci-mxc.c |
13522 |
-+++ b/drivers/usb/host/ehci-mxc.c |
13523 |
-@@ -50,6 +50,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) |
13524 |
- } |
13525 |
- |
13526 |
- irq = platform_get_irq(pdev, 0); |
13527 |
-+ if (irq < 0) |
13528 |
-+ return irq; |
13529 |
- |
13530 |
- hcd = usb_create_hcd(&ehci_mxc_hc_driver, dev, dev_name(dev)); |
13531 |
- if (!hcd) |
13532 |
-diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c |
13533 |
-index e4fc3f66d43b..e9a49007cce4 100644 |
13534 |
---- a/drivers/usb/host/ehci-platform.c |
13535 |
-+++ b/drivers/usb/host/ehci-platform.c |
13536 |
-@@ -455,6 +455,10 @@ static int ehci_platform_resume(struct device *dev) |
13537 |
- |
13538 |
- ehci_resume(hcd, priv->reset_on_resume); |
13539 |
- |
13540 |
-+ pm_runtime_disable(dev); |
13541 |
-+ pm_runtime_set_active(dev); |
13542 |
-+ pm_runtime_enable(dev); |
13543 |
-+ |
13544 |
- if (priv->quirk_poll) |
13545 |
- quirk_poll_init(priv); |
13546 |
- |
13547 |
-diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c |
13548 |
-index 7addfc2cbadc..4a8456f12a73 100644 |
13549 |
---- a/drivers/usb/host/ohci-platform.c |
13550 |
-+++ b/drivers/usb/host/ohci-platform.c |
13551 |
-@@ -299,6 +299,11 @@ static int ohci_platform_resume(struct device *dev) |
13552 |
- } |
13553 |
- |
13554 |
- ohci_resume(hcd, false); |
13555 |
-+ |
13556 |
-+ pm_runtime_disable(dev); |
13557 |
-+ pm_runtime_set_active(dev); |
13558 |
-+ pm_runtime_enable(dev); |
13559 |
-+ |
13560 |
- return 0; |
13561 |
- } |
13562 |
- #endif /* CONFIG_PM_SLEEP */ |
13563 |
-diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c |
13564 |
-index c158cda9e4b9..cff965240327 100644 |
13565 |
---- a/drivers/usb/host/ohci-sm501.c |
13566 |
-+++ b/drivers/usb/host/ohci-sm501.c |
13567 |
-@@ -157,9 +157,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) |
13568 |
- * the call to usb_hcd_setup_local_mem() below does just that. |
13569 |
- */ |
13570 |
- |
13571 |
-- if (usb_hcd_setup_local_mem(hcd, mem->start, |
13572 |
-- mem->start - mem->parent->start, |
13573 |
-- resource_size(mem)) < 0) |
13574 |
-+ retval = usb_hcd_setup_local_mem(hcd, mem->start, |
13575 |
-+ mem->start - mem->parent->start, |
13576 |
-+ resource_size(mem)); |
13577 |
-+ if (retval < 0) |
13578 |
- goto err5; |
13579 |
- retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
13580 |
- if (retval) |
13581 |
-diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c |
13582 |
-index ea460b9682d5..ca82e2c61ddc 100644 |
13583 |
---- a/drivers/usb/host/xhci-plat.c |
13584 |
-+++ b/drivers/usb/host/xhci-plat.c |
13585 |
-@@ -409,7 +409,15 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) |
13586 |
- if (ret) |
13587 |
- return ret; |
13588 |
- |
13589 |
-- return xhci_resume(xhci, 0); |
13590 |
-+ ret = xhci_resume(xhci, 0); |
13591 |
-+ if (ret) |
13592 |
-+ return ret; |
13593 |
-+ |
13594 |
-+ pm_runtime_disable(dev); |
13595 |
-+ pm_runtime_set_active(dev); |
13596 |
-+ pm_runtime_enable(dev); |
13597 |
-+ |
13598 |
-+ return 0; |
13599 |
- } |
13600 |
- |
13601 |
- static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) |
13602 |
-diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c |
13603 |
-index 5b17709821df..27d92af29635 100644 |
13604 |
---- a/drivers/usb/roles/class.c |
13605 |
-+++ b/drivers/usb/roles/class.c |
13606 |
-@@ -49,8 +49,10 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role) |
13607 |
- mutex_lock(&sw->lock); |
13608 |
- |
13609 |
- ret = sw->set(sw, role); |
13610 |
-- if (!ret) |
13611 |
-+ if (!ret) { |
13612 |
- sw->role = role; |
13613 |
-+ kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE); |
13614 |
-+ } |
13615 |
- |
13616 |
- mutex_unlock(&sw->lock); |
13617 |
- |
13618 |
-diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c |
13619 |
-index 8ad14e5c02bf..917fd84c1c6f 100644 |
13620 |
---- a/drivers/vfio/mdev/mdev_sysfs.c |
13621 |
-+++ b/drivers/vfio/mdev/mdev_sysfs.c |
13622 |
-@@ -110,7 +110,7 @@ static struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent, |
13623 |
- "%s-%s", dev_driver_string(parent->dev), |
13624 |
- group->name); |
13625 |
- if (ret) { |
13626 |
-- kfree(type); |
13627 |
-+ kobject_put(&type->kobj); |
13628 |
- return ERR_PTR(ret); |
13629 |
- } |
13630 |
- |
13631 |
-diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c |
13632 |
-index 90c0b80f8acf..814bcbe0dd4e 100644 |
13633 |
---- a/drivers/vfio/pci/vfio_pci_config.c |
13634 |
-+++ b/drivers/vfio/pci/vfio_pci_config.c |
13635 |
-@@ -1462,7 +1462,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev) |
13636 |
- if (ret) |
13637 |
- return ret; |
13638 |
- |
13639 |
-- if (cap <= PCI_CAP_ID_MAX) { |
13640 |
-+ /* |
13641 |
-+ * ID 0 is a NULL capability, conflicting with our fake |
13642 |
-+ * PCI_CAP_ID_BASIC. As it has no content, consider it |
13643 |
-+ * hidden for now. |
13644 |
-+ */ |
13645 |
-+ if (cap && cap <= PCI_CAP_ID_MAX) { |
13646 |
- len = pci_cap_length[cap]; |
13647 |
- if (len == 0xFF) { /* Variable length */ |
13648 |
- len = vfio_cap_len(vdev, cap, pos); |
13649 |
-@@ -1728,8 +1733,11 @@ void vfio_config_free(struct vfio_pci_device *vdev) |
13650 |
- vdev->vconfig = NULL; |
13651 |
- kfree(vdev->pci_config_map); |
13652 |
- vdev->pci_config_map = NULL; |
13653 |
-- kfree(vdev->msi_perm); |
13654 |
-- vdev->msi_perm = NULL; |
13655 |
-+ if (vdev->msi_perm) { |
13656 |
-+ free_perm_bits(vdev->msi_perm); |
13657 |
-+ kfree(vdev->msi_perm); |
13658 |
-+ vdev->msi_perm = NULL; |
13659 |
-+ } |
13660 |
- } |
13661 |
- |
13662 |
- /* |
13663 |
-diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
13664 |
-index c39952243fd3..8b104f76f324 100644 |
13665 |
---- a/drivers/vhost/scsi.c |
13666 |
-+++ b/drivers/vhost/scsi.c |
13667 |
-@@ -2280,6 +2280,7 @@ static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { |
13668 |
- static const struct target_core_fabric_ops vhost_scsi_ops = { |
13669 |
- .module = THIS_MODULE, |
13670 |
- .fabric_name = "vhost", |
13671 |
-+ .max_data_sg_nents = VHOST_SCSI_PREALLOC_SGLS, |
13672 |
- .tpg_get_wwn = vhost_scsi_get_fabric_wwn, |
13673 |
- .tpg_get_tag = vhost_scsi_get_tpgt, |
13674 |
- .tpg_check_demo_mode = vhost_scsi_check_true, |
13675 |
-diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c |
13676 |
-index f68920131a4a..e94932c69f54 100644 |
13677 |
---- a/drivers/video/backlight/lp855x_bl.c |
13678 |
-+++ b/drivers/video/backlight/lp855x_bl.c |
13679 |
-@@ -456,7 +456,7 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) |
13680 |
- ret = regulator_enable(lp->enable); |
13681 |
- if (ret < 0) { |
13682 |
- dev_err(lp->dev, "failed to enable vddio: %d\n", ret); |
13683 |
-- return ret; |
13684 |
-+ goto disable_supply; |
13685 |
- } |
13686 |
- |
13687 |
- /* |
13688 |
-@@ -471,24 +471,34 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) |
13689 |
- ret = lp855x_configure(lp); |
13690 |
- if (ret) { |
13691 |
- dev_err(lp->dev, "device config err: %d", ret); |
13692 |
-- return ret; |
13693 |
-+ goto disable_vddio; |
13694 |
- } |
13695 |
- |
13696 |
- ret = lp855x_backlight_register(lp); |
13697 |
- if (ret) { |
13698 |
- dev_err(lp->dev, |
13699 |
- "failed to register backlight. err: %d\n", ret); |
13700 |
-- return ret; |
13701 |
-+ goto disable_vddio; |
13702 |
- } |
13703 |
- |
13704 |
- ret = sysfs_create_group(&lp->dev->kobj, &lp855x_attr_group); |
13705 |
- if (ret) { |
13706 |
- dev_err(lp->dev, "failed to register sysfs. err: %d\n", ret); |
13707 |
-- return ret; |
13708 |
-+ goto disable_vddio; |
13709 |
- } |
13710 |
- |
13711 |
- backlight_update_status(lp->bl); |
13712 |
-+ |
13713 |
- return 0; |
13714 |
-+ |
13715 |
-+disable_vddio: |
13716 |
-+ if (lp->enable) |
13717 |
-+ regulator_disable(lp->enable); |
13718 |
-+disable_supply: |
13719 |
-+ if (lp->supply) |
13720 |
-+ regulator_disable(lp->supply); |
13721 |
-+ |
13722 |
-+ return ret; |
13723 |
- } |
13724 |
- |
13725 |
- static int lp855x_remove(struct i2c_client *cl) |
13726 |
-@@ -497,6 +507,8 @@ static int lp855x_remove(struct i2c_client *cl) |
13727 |
- |
13728 |
- lp->bl->props.brightness = 0; |
13729 |
- backlight_update_status(lp->bl); |
13730 |
-+ if (lp->enable) |
13731 |
-+ regulator_disable(lp->enable); |
13732 |
- if (lp->supply) |
13733 |
- regulator_disable(lp->supply); |
13734 |
- sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); |
13735 |
-diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c |
13736 |
-index 0ad15d55071c..18dec438d518 100644 |
13737 |
---- a/drivers/watchdog/da9062_wdt.c |
13738 |
-+++ b/drivers/watchdog/da9062_wdt.c |
13739 |
-@@ -58,11 +58,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt, |
13740 |
- unsigned int regval) |
13741 |
- { |
13742 |
- struct da9062 *chip = wdt->hw; |
13743 |
-- int ret; |
13744 |
-- |
13745 |
-- ret = da9062_reset_watchdog_timer(wdt); |
13746 |
-- if (ret) |
13747 |
-- return ret; |
13748 |
- |
13749 |
- regmap_update_bits(chip->regmap, |
13750 |
- DA9062AA_CONTROL_D, |
13751 |
-diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c |
13752 |
-index ec975decb5de..b96b11e2b571 100644 |
13753 |
---- a/drivers/xen/cpu_hotplug.c |
13754 |
-+++ b/drivers/xen/cpu_hotplug.c |
13755 |
-@@ -93,10 +93,8 @@ static int setup_cpu_watcher(struct notifier_block *notifier, |
13756 |
- (void)register_xenbus_watch(&cpu_watch); |
13757 |
- |
13758 |
- for_each_possible_cpu(cpu) { |
13759 |
-- if (vcpu_online(cpu) == 0) { |
13760 |
-- device_offline(get_cpu_device(cpu)); |
13761 |
-- set_cpu_present(cpu, false); |
13762 |
-- } |
13763 |
-+ if (vcpu_online(cpu) == 0) |
13764 |
-+ disable_hotplug_cpu(cpu); |
13765 |
- } |
13766 |
- |
13767 |
- return NOTIFY_DONE; |
13768 |
-@@ -119,5 +117,5 @@ static int __init setup_vcpu_hotplug_event(void) |
13769 |
- return 0; |
13770 |
- } |
13771 |
- |
13772 |
--arch_initcall(setup_vcpu_hotplug_event); |
13773 |
-+late_initcall(setup_vcpu_hotplug_event); |
13774 |
- |
13775 |
-diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c |
13776 |
-index 380ad5ace7cf..3a9b8b1f5f2b 100644 |
13777 |
---- a/fs/afs/cmservice.c |
13778 |
-+++ b/fs/afs/cmservice.c |
13779 |
-@@ -305,8 +305,7 @@ static int afs_deliver_cb_callback(struct afs_call *call) |
13780 |
- call->count = ntohl(call->tmp); |
13781 |
- _debug("FID count: %u", call->count); |
13782 |
- if (call->count > AFSCBMAX) |
13783 |
-- return afs_protocol_error(call, -EBADMSG, |
13784 |
-- afs_eproto_cb_fid_count); |
13785 |
-+ return afs_protocol_error(call, afs_eproto_cb_fid_count); |
13786 |
- |
13787 |
- call->buffer = kmalloc(array3_size(call->count, 3, 4), |
13788 |
- GFP_KERNEL); |
13789 |
-@@ -351,8 +350,7 @@ static int afs_deliver_cb_callback(struct afs_call *call) |
13790 |
- call->count2 = ntohl(call->tmp); |
13791 |
- _debug("CB count: %u", call->count2); |
13792 |
- if (call->count2 != call->count && call->count2 != 0) |
13793 |
-- return afs_protocol_error(call, -EBADMSG, |
13794 |
-- afs_eproto_cb_count); |
13795 |
-+ return afs_protocol_error(call, afs_eproto_cb_count); |
13796 |
- call->iter = &call->def_iter; |
13797 |
- iov_iter_discard(&call->def_iter, READ, call->count2 * 3 * 4); |
13798 |
- call->unmarshall++; |
13799 |
-@@ -672,8 +670,7 @@ static int afs_deliver_yfs_cb_callback(struct afs_call *call) |
13800 |
- call->count = ntohl(call->tmp); |
13801 |
- _debug("FID count: %u", call->count); |
13802 |
- if (call->count > YFSCBMAX) |
13803 |
-- return afs_protocol_error(call, -EBADMSG, |
13804 |
-- afs_eproto_cb_fid_count); |
13805 |
-+ return afs_protocol_error(call, afs_eproto_cb_fid_count); |
13806 |
- |
13807 |
- size = array_size(call->count, sizeof(struct yfs_xdr_YFSFid)); |
13808 |
- call->buffer = kmalloc(size, GFP_KERNEL); |
13809 |
-diff --git a/fs/afs/dir.c b/fs/afs/dir.c |
13810 |
-index d1e1caa23c8b..3c486340b220 100644 |
13811 |
---- a/fs/afs/dir.c |
13812 |
-+++ b/fs/afs/dir.c |
13813 |
-@@ -658,7 +658,8 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, |
13814 |
- |
13815 |
- cookie->ctx.actor = afs_lookup_filldir; |
13816 |
- cookie->name = dentry->d_name; |
13817 |
-- cookie->nr_fids = 1; /* slot 0 is saved for the fid we actually want */ |
13818 |
-+ cookie->nr_fids = 2; /* slot 0 is saved for the fid we actually want |
13819 |
-+ * and slot 1 for the directory */ |
13820 |
- |
13821 |
- read_seqlock_excl(&dvnode->cb_lock); |
13822 |
- dcbi = rcu_dereference_protected(dvnode->cb_interest, |
13823 |
-@@ -709,7 +710,11 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, |
13824 |
- if (!cookie->inodes) |
13825 |
- goto out_s; |
13826 |
- |
13827 |
-- for (i = 1; i < cookie->nr_fids; i++) { |
13828 |
-+ cookie->fids[1] = dvnode->fid; |
13829 |
-+ cookie->statuses[1].cb_break = afs_calc_vnode_cb_break(dvnode); |
13830 |
-+ cookie->inodes[1] = igrab(&dvnode->vfs_inode); |
13831 |
-+ |
13832 |
-+ for (i = 2; i < cookie->nr_fids; i++) { |
13833 |
- scb = &cookie->statuses[i]; |
13834 |
- |
13835 |
- /* Find any inodes that already exist and get their |
13836 |
-diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c |
13837 |
-index d2b3798c1932..7bca0c13d0c4 100644 |
13838 |
---- a/fs/afs/fsclient.c |
13839 |
-+++ b/fs/afs/fsclient.c |
13840 |
-@@ -56,16 +56,15 @@ static void xdr_dump_bad(const __be32 *bp) |
13841 |
- /* |
13842 |
- * decode an AFSFetchStatus block |
13843 |
- */ |
13844 |
--static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13845 |
-- struct afs_call *call, |
13846 |
-- struct afs_status_cb *scb) |
13847 |
-+static void xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13848 |
-+ struct afs_call *call, |
13849 |
-+ struct afs_status_cb *scb) |
13850 |
- { |
13851 |
- const struct afs_xdr_AFSFetchStatus *xdr = (const void *)*_bp; |
13852 |
- struct afs_file_status *status = &scb->status; |
13853 |
- bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); |
13854 |
- u64 data_version, size; |
13855 |
- u32 type, abort_code; |
13856 |
-- int ret; |
13857 |
- |
13858 |
- abort_code = ntohl(xdr->abort_code); |
13859 |
- |
13860 |
-@@ -79,7 +78,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13861 |
- */ |
13862 |
- status->abort_code = abort_code; |
13863 |
- scb->have_error = true; |
13864 |
-- goto good; |
13865 |
-+ goto advance; |
13866 |
- } |
13867 |
- |
13868 |
- pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); |
13869 |
-@@ -89,7 +88,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13870 |
- if (abort_code != 0 && inline_error) { |
13871 |
- status->abort_code = abort_code; |
13872 |
- scb->have_error = true; |
13873 |
-- goto good; |
13874 |
-+ goto advance; |
13875 |
- } |
13876 |
- |
13877 |
- type = ntohl(xdr->type); |
13878 |
-@@ -125,15 +124,13 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, |
13879 |
- data_version |= (u64)ntohl(xdr->data_version_hi) << 32; |
13880 |
- status->data_version = data_version; |
13881 |
- scb->have_status = true; |
13882 |
--good: |
13883 |
-- ret = 0; |
13884 |
- advance: |
13885 |
- *_bp = (const void *)*_bp + sizeof(*xdr); |
13886 |
-- return ret; |
13887 |
-+ return; |
13888 |
- |
13889 |
- bad: |
13890 |
- xdr_dump_bad(*_bp); |
13891 |
-- ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
13892 |
-+ afs_protocol_error(call, afs_eproto_bad_status); |
13893 |
- goto advance; |
13894 |
- } |
13895 |
- |
13896 |
-@@ -254,9 +251,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) |
13897 |
- |
13898 |
- /* unmarshall the reply once we've received all of it */ |
13899 |
- bp = call->buffer; |
13900 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13901 |
-- if (ret < 0) |
13902 |
-- return ret; |
13903 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13904 |
- xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
13905 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13906 |
- |
13907 |
-@@ -419,9 +414,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) |
13908 |
- return ret; |
13909 |
- |
13910 |
- bp = call->buffer; |
13911 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13912 |
-- if (ret < 0) |
13913 |
-- return ret; |
13914 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13915 |
- xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
13916 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13917 |
- |
13918 |
-@@ -577,12 +570,8 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call) |
13919 |
- /* unmarshall the reply once we've received all of it */ |
13920 |
- bp = call->buffer; |
13921 |
- xdr_decode_AFSFid(&bp, call->out_fid); |
13922 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13923 |
-- if (ret < 0) |
13924 |
-- return ret; |
13925 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13926 |
-- if (ret < 0) |
13927 |
-- return ret; |
13928 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13929 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13930 |
- xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
13931 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13932 |
- |
13933 |
-@@ -691,9 +680,7 @@ static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call) |
13934 |
- |
13935 |
- /* unmarshall the reply once we've received all of it */ |
13936 |
- bp = call->buffer; |
13937 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13938 |
-- if (ret < 0) |
13939 |
-- return ret; |
13940 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13941 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13942 |
- |
13943 |
- _leave(" = 0 [done]"); |
13944 |
-@@ -784,12 +771,8 @@ static int afs_deliver_fs_link(struct afs_call *call) |
13945 |
- |
13946 |
- /* unmarshall the reply once we've received all of it */ |
13947 |
- bp = call->buffer; |
13948 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13949 |
-- if (ret < 0) |
13950 |
-- return ret; |
13951 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13952 |
-- if (ret < 0) |
13953 |
-- return ret; |
13954 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13955 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13956 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13957 |
- |
13958 |
- _leave(" = 0 [done]"); |
13959 |
-@@ -878,12 +861,8 @@ static int afs_deliver_fs_symlink(struct afs_call *call) |
13960 |
- /* unmarshall the reply once we've received all of it */ |
13961 |
- bp = call->buffer; |
13962 |
- xdr_decode_AFSFid(&bp, call->out_fid); |
13963 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13964 |
-- if (ret < 0) |
13965 |
-- return ret; |
13966 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13967 |
-- if (ret < 0) |
13968 |
-- return ret; |
13969 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13970 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13971 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13972 |
- |
13973 |
- _leave(" = 0 [done]"); |
13974 |
-@@ -986,16 +965,12 @@ static int afs_deliver_fs_rename(struct afs_call *call) |
13975 |
- if (ret < 0) |
13976 |
- return ret; |
13977 |
- |
13978 |
-+ bp = call->buffer; |
13979 |
- /* If the two dirs are the same, we have two copies of the same status |
13980 |
- * report, so we just decode it twice. |
13981 |
- */ |
13982 |
-- bp = call->buffer; |
13983 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13984 |
-- if (ret < 0) |
13985 |
-- return ret; |
13986 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13987 |
-- if (ret < 0) |
13988 |
-- return ret; |
13989 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
13990 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13991 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
13992 |
- |
13993 |
- _leave(" = 0 [done]"); |
13994 |
-@@ -1103,9 +1078,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call) |
13995 |
- |
13996 |
- /* unmarshall the reply once we've received all of it */ |
13997 |
- bp = call->buffer; |
13998 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
13999 |
-- if (ret < 0) |
14000 |
-- return ret; |
14001 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14002 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14003 |
- |
14004 |
- _leave(" = 0 [done]"); |
14005 |
-@@ -1283,9 +1256,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call) |
14006 |
- |
14007 |
- /* unmarshall the reply once we've received all of it */ |
14008 |
- bp = call->buffer; |
14009 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14010 |
-- if (ret < 0) |
14011 |
-- return ret; |
14012 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14013 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14014 |
- |
14015 |
- _leave(" = 0 [done]"); |
14016 |
-@@ -1499,8 +1470,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) |
14017 |
- call->count = ntohl(call->tmp); |
14018 |
- _debug("volname length: %u", call->count); |
14019 |
- if (call->count >= AFSNAMEMAX) |
14020 |
-- return afs_protocol_error(call, -EBADMSG, |
14021 |
-- afs_eproto_volname_len); |
14022 |
-+ return afs_protocol_error(call, afs_eproto_volname_len); |
14023 |
- size = (call->count + 3) & ~3; /* It's padded */ |
14024 |
- afs_extract_to_buf(call, size); |
14025 |
- call->unmarshall++; |
14026 |
-@@ -1529,8 +1499,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) |
14027 |
- call->count = ntohl(call->tmp); |
14028 |
- _debug("offline msg length: %u", call->count); |
14029 |
- if (call->count >= AFSNAMEMAX) |
14030 |
-- return afs_protocol_error(call, -EBADMSG, |
14031 |
-- afs_eproto_offline_msg_len); |
14032 |
-+ return afs_protocol_error(call, afs_eproto_offline_msg_len); |
14033 |
- size = (call->count + 3) & ~3; /* It's padded */ |
14034 |
- afs_extract_to_buf(call, size); |
14035 |
- call->unmarshall++; |
14036 |
-@@ -1560,8 +1529,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) |
14037 |
- call->count = ntohl(call->tmp); |
14038 |
- _debug("motd length: %u", call->count); |
14039 |
- if (call->count >= AFSNAMEMAX) |
14040 |
-- return afs_protocol_error(call, -EBADMSG, |
14041 |
-- afs_eproto_motd_len); |
14042 |
-+ return afs_protocol_error(call, afs_eproto_motd_len); |
14043 |
- size = (call->count + 3) & ~3; /* It's padded */ |
14044 |
- afs_extract_to_buf(call, size); |
14045 |
- call->unmarshall++; |
14046 |
-@@ -1954,9 +1922,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call) |
14047 |
- |
14048 |
- /* unmarshall the reply once we've received all of it */ |
14049 |
- bp = call->buffer; |
14050 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14051 |
-- if (ret < 0) |
14052 |
-- return ret; |
14053 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14054 |
- xdr_decode_AFSCallBack(&bp, call, call->out_scb); |
14055 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14056 |
- |
14057 |
-@@ -2045,8 +2011,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14058 |
- tmp = ntohl(call->tmp); |
14059 |
- _debug("status count: %u/%u", tmp, call->count2); |
14060 |
- if (tmp != call->count2) |
14061 |
-- return afs_protocol_error(call, -EBADMSG, |
14062 |
-- afs_eproto_ibulkst_count); |
14063 |
-+ return afs_protocol_error(call, afs_eproto_ibulkst_count); |
14064 |
- |
14065 |
- call->count = 0; |
14066 |
- call->unmarshall++; |
14067 |
-@@ -2062,10 +2027,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14068 |
- |
14069 |
- bp = call->buffer; |
14070 |
- scb = &call->out_scb[call->count]; |
14071 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, scb); |
14072 |
-- if (ret < 0) |
14073 |
-- return ret; |
14074 |
-- |
14075 |
-+ xdr_decode_AFSFetchStatus(&bp, call, scb); |
14076 |
- call->count++; |
14077 |
- if (call->count < call->count2) |
14078 |
- goto more_counts; |
14079 |
-@@ -2085,8 +2047,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14080 |
- tmp = ntohl(call->tmp); |
14081 |
- _debug("CB count: %u", tmp); |
14082 |
- if (tmp != call->count2) |
14083 |
-- return afs_protocol_error(call, -EBADMSG, |
14084 |
-- afs_eproto_ibulkst_cb_count); |
14085 |
-+ return afs_protocol_error(call, afs_eproto_ibulkst_cb_count); |
14086 |
- call->count = 0; |
14087 |
- call->unmarshall++; |
14088 |
- more_cbs: |
14089 |
-@@ -2243,9 +2204,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call) |
14090 |
- return ret; |
14091 |
- |
14092 |
- bp = call->buffer; |
14093 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14094 |
-- if (ret < 0) |
14095 |
-- return ret; |
14096 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14097 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14098 |
- |
14099 |
- call->unmarshall++; |
14100 |
-@@ -2326,9 +2285,7 @@ static int afs_deliver_fs_file_status_and_vol(struct afs_call *call) |
14101 |
- return ret; |
14102 |
- |
14103 |
- bp = call->buffer; |
14104 |
-- ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14105 |
-- if (ret < 0) |
14106 |
-- return ret; |
14107 |
-+ xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
14108 |
- xdr_decode_AFSVolSync(&bp, call->out_volsync); |
14109 |
- |
14110 |
- _leave(" = 0 [done]"); |
14111 |
-diff --git a/fs/afs/inode.c b/fs/afs/inode.c |
14112 |
-index 281470fe1183..d7b65fad6679 100644 |
14113 |
---- a/fs/afs/inode.c |
14114 |
-+++ b/fs/afs/inode.c |
14115 |
-@@ -130,7 +130,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key, |
14116 |
- default: |
14117 |
- dump_vnode(vnode, parent_vnode); |
14118 |
- write_sequnlock(&vnode->cb_lock); |
14119 |
-- return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type); |
14120 |
-+ return afs_protocol_error(NULL, afs_eproto_file_type); |
14121 |
- } |
14122 |
- |
14123 |
- afs_set_i_size(vnode, status->size); |
14124 |
-@@ -170,6 +170,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14125 |
- struct timespec64 t; |
14126 |
- umode_t mode; |
14127 |
- bool data_changed = false; |
14128 |
-+ bool change_size = false; |
14129 |
- |
14130 |
- BUG_ON(test_bit(AFS_VNODE_UNSET, &vnode->flags)); |
14131 |
- |
14132 |
-@@ -179,7 +180,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14133 |
- vnode->fid.vnode, |
14134 |
- vnode->fid.unique, |
14135 |
- status->type, vnode->status.type); |
14136 |
-- afs_protocol_error(NULL, -EBADMSG, afs_eproto_bad_status); |
14137 |
-+ afs_protocol_error(NULL, afs_eproto_bad_status); |
14138 |
- return; |
14139 |
- } |
14140 |
- |
14141 |
-@@ -225,6 +226,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14142 |
- } else { |
14143 |
- set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags); |
14144 |
- } |
14145 |
-+ change_size = true; |
14146 |
- } else if (vnode->status.type == AFS_FTYPE_DIR) { |
14147 |
- /* Expected directory change is handled elsewhere so |
14148 |
- * that we can locally edit the directory and save on a |
14149 |
-@@ -232,11 +234,19 @@ static void afs_apply_status(struct afs_fs_cursor *fc, |
14150 |
- */ |
14151 |
- if (test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) |
14152 |
- data_changed = false; |
14153 |
-+ change_size = true; |
14154 |
- } |
14155 |
- |
14156 |
- if (data_changed) { |
14157 |
- inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); |
14158 |
-- afs_set_i_size(vnode, status->size); |
14159 |
-+ |
14160 |
-+ /* Only update the size if the data version jumped. If the |
14161 |
-+ * file is being modified locally, then we might have our own |
14162 |
-+ * idea of what the size should be that's not the same as |
14163 |
-+ * what's on the server. |
14164 |
-+ */ |
14165 |
-+ if (change_size) |
14166 |
-+ afs_set_i_size(vnode, status->size); |
14167 |
- } |
14168 |
- } |
14169 |
- |
14170 |
-diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
14171 |
-index 80255513e230..98e0cebd5e5e 100644 |
14172 |
---- a/fs/afs/internal.h |
14173 |
-+++ b/fs/afs/internal.h |
14174 |
-@@ -161,6 +161,7 @@ struct afs_call { |
14175 |
- bool upgrade; /* T to request service upgrade */ |
14176 |
- bool have_reply_time; /* T if have got reply_time */ |
14177 |
- bool intr; /* T if interruptible */ |
14178 |
-+ bool unmarshalling_error; /* T if an unmarshalling error occurred */ |
14179 |
- u16 service_id; /* Actual service ID (after upgrade) */ |
14180 |
- unsigned int debug_id; /* Trace ID */ |
14181 |
- u32 operation_ID; /* operation ID for an incoming call */ |
14182 |
-@@ -1128,7 +1129,7 @@ extern void afs_flat_call_destructor(struct afs_call *); |
14183 |
- extern void afs_send_empty_reply(struct afs_call *); |
14184 |
- extern void afs_send_simple_reply(struct afs_call *, const void *, size_t); |
14185 |
- extern int afs_extract_data(struct afs_call *, bool); |
14186 |
--extern int afs_protocol_error(struct afs_call *, int, enum afs_eproto_cause); |
14187 |
-+extern int afs_protocol_error(struct afs_call *, enum afs_eproto_cause); |
14188 |
- |
14189 |
- static inline void afs_set_fc_call(struct afs_call *call, struct afs_fs_cursor *fc) |
14190 |
- { |
14191 |
-diff --git a/fs/afs/misc.c b/fs/afs/misc.c |
14192 |
-index 52b19e9c1535..5334f1bd2bca 100644 |
14193 |
---- a/fs/afs/misc.c |
14194 |
-+++ b/fs/afs/misc.c |
14195 |
-@@ -83,6 +83,7 @@ int afs_abort_to_error(u32 abort_code) |
14196 |
- case UAENOLCK: return -ENOLCK; |
14197 |
- case UAENOTEMPTY: return -ENOTEMPTY; |
14198 |
- case UAELOOP: return -ELOOP; |
14199 |
-+ case UAEOVERFLOW: return -EOVERFLOW; |
14200 |
- case UAENOMEDIUM: return -ENOMEDIUM; |
14201 |
- case UAEDQUOT: return -EDQUOT; |
14202 |
- |
14203 |
-diff --git a/fs/afs/proc.c b/fs/afs/proc.c |
14204 |
-index 468e1713bce1..6f34c84a0fd0 100644 |
14205 |
---- a/fs/afs/proc.c |
14206 |
-+++ b/fs/afs/proc.c |
14207 |
-@@ -563,6 +563,7 @@ void afs_put_sysnames(struct afs_sysnames *sysnames) |
14208 |
- if (sysnames->subs[i] != afs_init_sysname && |
14209 |
- sysnames->subs[i] != sysnames->blank) |
14210 |
- kfree(sysnames->subs[i]); |
14211 |
-+ kfree(sysnames); |
14212 |
- } |
14213 |
- } |
14214 |
- |
14215 |
-diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c |
14216 |
-index 1ecc67da6c1a..e3c2655616dc 100644 |
14217 |
---- a/fs/afs/rxrpc.c |
14218 |
-+++ b/fs/afs/rxrpc.c |
14219 |
-@@ -540,6 +540,8 @@ static void afs_deliver_to_call(struct afs_call *call) |
14220 |
- |
14221 |
- ret = call->type->deliver(call); |
14222 |
- state = READ_ONCE(call->state); |
14223 |
-+ if (ret == 0 && call->unmarshalling_error) |
14224 |
-+ ret = -EBADMSG; |
14225 |
- switch (ret) { |
14226 |
- case 0: |
14227 |
- afs_queue_call_work(call); |
14228 |
-@@ -959,9 +961,11 @@ int afs_extract_data(struct afs_call *call, bool want_more) |
14229 |
- /* |
14230 |
- * Log protocol error production. |
14231 |
- */ |
14232 |
--noinline int afs_protocol_error(struct afs_call *call, int error, |
14233 |
-+noinline int afs_protocol_error(struct afs_call *call, |
14234 |
- enum afs_eproto_cause cause) |
14235 |
- { |
14236 |
-- trace_afs_protocol_error(call, error, cause); |
14237 |
-- return error; |
14238 |
-+ trace_afs_protocol_error(call, cause); |
14239 |
-+ if (call) |
14240 |
-+ call->unmarshalling_error = true; |
14241 |
-+ return -EBADMSG; |
14242 |
- } |
14243 |
-diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c |
14244 |
-index 516e9a3bb5b4..e64b002c3bb3 100644 |
14245 |
---- a/fs/afs/vlclient.c |
14246 |
-+++ b/fs/afs/vlclient.c |
14247 |
-@@ -447,8 +447,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14248 |
- call->count2 = ntohl(*bp); /* Type or next count */ |
14249 |
- |
14250 |
- if (call->count > YFS_MAXENDPOINTS) |
14251 |
-- return afs_protocol_error(call, -EBADMSG, |
14252 |
-- afs_eproto_yvl_fsendpt_num); |
14253 |
-+ return afs_protocol_error(call, afs_eproto_yvl_fsendpt_num); |
14254 |
- |
14255 |
- alist = afs_alloc_addrlist(call->count, FS_SERVICE, AFS_FS_PORT); |
14256 |
- if (!alist) |
14257 |
-@@ -468,8 +467,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14258 |
- size = sizeof(__be32) * (1 + 4 + 1); |
14259 |
- break; |
14260 |
- default: |
14261 |
-- return afs_protocol_error(call, -EBADMSG, |
14262 |
-- afs_eproto_yvl_fsendpt_type); |
14263 |
-+ return afs_protocol_error(call, afs_eproto_yvl_fsendpt_type); |
14264 |
- } |
14265 |
- |
14266 |
- size += sizeof(__be32); |
14267 |
-@@ -487,21 +485,20 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14268 |
- switch (call->count2) { |
14269 |
- case YFS_ENDPOINT_IPV4: |
14270 |
- if (ntohl(bp[0]) != sizeof(__be32) * 2) |
14271 |
-- return afs_protocol_error(call, -EBADMSG, |
14272 |
-- afs_eproto_yvl_fsendpt4_len); |
14273 |
-+ return afs_protocol_error( |
14274 |
-+ call, afs_eproto_yvl_fsendpt4_len); |
14275 |
- afs_merge_fs_addr4(alist, bp[1], ntohl(bp[2])); |
14276 |
- bp += 3; |
14277 |
- break; |
14278 |
- case YFS_ENDPOINT_IPV6: |
14279 |
- if (ntohl(bp[0]) != sizeof(__be32) * 5) |
14280 |
-- return afs_protocol_error(call, -EBADMSG, |
14281 |
-- afs_eproto_yvl_fsendpt6_len); |
14282 |
-+ return afs_protocol_error( |
14283 |
-+ call, afs_eproto_yvl_fsendpt6_len); |
14284 |
- afs_merge_fs_addr6(alist, bp + 1, ntohl(bp[5])); |
14285 |
- bp += 6; |
14286 |
- break; |
14287 |
- default: |
14288 |
-- return afs_protocol_error(call, -EBADMSG, |
14289 |
-- afs_eproto_yvl_fsendpt_type); |
14290 |
-+ return afs_protocol_error(call, afs_eproto_yvl_fsendpt_type); |
14291 |
- } |
14292 |
- |
14293 |
- /* Got either the type of the next entry or the count of |
14294 |
-@@ -519,8 +516,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14295 |
- if (!call->count) |
14296 |
- goto end; |
14297 |
- if (call->count > YFS_MAXENDPOINTS) |
14298 |
-- return afs_protocol_error(call, -EBADMSG, |
14299 |
-- afs_eproto_yvl_vlendpt_type); |
14300 |
-+ return afs_protocol_error(call, afs_eproto_yvl_vlendpt_type); |
14301 |
- |
14302 |
- afs_extract_to_buf(call, 1 * sizeof(__be32)); |
14303 |
- call->unmarshall = 3; |
14304 |
-@@ -547,8 +543,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14305 |
- size = sizeof(__be32) * (1 + 4 + 1); |
14306 |
- break; |
14307 |
- default: |
14308 |
-- return afs_protocol_error(call, -EBADMSG, |
14309 |
-- afs_eproto_yvl_vlendpt_type); |
14310 |
-+ return afs_protocol_error(call, afs_eproto_yvl_vlendpt_type); |
14311 |
- } |
14312 |
- |
14313 |
- if (call->count > 1) |
14314 |
-@@ -566,19 +561,18 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) |
14315 |
- switch (call->count2) { |
14316 |
- case YFS_ENDPOINT_IPV4: |
14317 |
- if (ntohl(bp[0]) != sizeof(__be32) * 2) |
14318 |
-- return afs_protocol_error(call, -EBADMSG, |
14319 |
-- afs_eproto_yvl_vlendpt4_len); |
14320 |
-+ return afs_protocol_error( |
14321 |
-+ call, afs_eproto_yvl_vlendpt4_len); |
14322 |
- bp += 3; |
14323 |
- break; |
14324 |
- case YFS_ENDPOINT_IPV6: |
14325 |
- if (ntohl(bp[0]) != sizeof(__be32) * 5) |
14326 |
-- return afs_protocol_error(call, -EBADMSG, |
14327 |
-- afs_eproto_yvl_vlendpt6_len); |
14328 |
-+ return afs_protocol_error( |
14329 |
-+ call, afs_eproto_yvl_vlendpt6_len); |
14330 |
- bp += 6; |
14331 |
- break; |
14332 |
- default: |
14333 |
-- return afs_protocol_error(call, -EBADMSG, |
14334 |
-- afs_eproto_yvl_vlendpt_type); |
14335 |
-+ return afs_protocol_error(call, afs_eproto_yvl_vlendpt_type); |
14336 |
- } |
14337 |
- |
14338 |
- /* Got either the type of the next entry or the count of |
14339 |
-diff --git a/fs/afs/write.c b/fs/afs/write.c |
14340 |
-index cb76566763db..96b042af6248 100644 |
14341 |
---- a/fs/afs/write.c |
14342 |
-+++ b/fs/afs/write.c |
14343 |
-@@ -194,11 +194,11 @@ int afs_write_end(struct file *file, struct address_space *mapping, |
14344 |
- |
14345 |
- i_size = i_size_read(&vnode->vfs_inode); |
14346 |
- if (maybe_i_size > i_size) { |
14347 |
-- spin_lock(&vnode->wb_lock); |
14348 |
-+ write_seqlock(&vnode->cb_lock); |
14349 |
- i_size = i_size_read(&vnode->vfs_inode); |
14350 |
- if (maybe_i_size > i_size) |
14351 |
- i_size_write(&vnode->vfs_inode, maybe_i_size); |
14352 |
-- spin_unlock(&vnode->wb_lock); |
14353 |
-+ write_sequnlock(&vnode->cb_lock); |
14354 |
- } |
14355 |
- |
14356 |
- if (!PageUptodate(page)) { |
14357 |
-@@ -811,6 +811,7 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) |
14358 |
- vmf->page->index, priv); |
14359 |
- SetPagePrivate(vmf->page); |
14360 |
- set_page_private(vmf->page, priv); |
14361 |
-+ file_update_time(file); |
14362 |
- |
14363 |
- sb_end_pagefault(inode->i_sb); |
14364 |
- return VM_FAULT_LOCKED; |
14365 |
-diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c |
14366 |
-index fe413e7a5cf4..bf74c679c02b 100644 |
14367 |
---- a/fs/afs/yfsclient.c |
14368 |
-+++ b/fs/afs/yfsclient.c |
14369 |
-@@ -179,21 +179,20 @@ static void xdr_dump_bad(const __be32 *bp) |
14370 |
- /* |
14371 |
- * Decode a YFSFetchStatus block |
14372 |
- */ |
14373 |
--static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
14374 |
-- struct afs_call *call, |
14375 |
-- struct afs_status_cb *scb) |
14376 |
-+static void xdr_decode_YFSFetchStatus(const __be32 **_bp, |
14377 |
-+ struct afs_call *call, |
14378 |
-+ struct afs_status_cb *scb) |
14379 |
- { |
14380 |
- const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; |
14381 |
- struct afs_file_status *status = &scb->status; |
14382 |
- u32 type; |
14383 |
-- int ret; |
14384 |
- |
14385 |
- status->abort_code = ntohl(xdr->abort_code); |
14386 |
- if (status->abort_code != 0) { |
14387 |
- if (status->abort_code == VNOVNODE) |
14388 |
- status->nlink = 0; |
14389 |
- scb->have_error = true; |
14390 |
-- goto good; |
14391 |
-+ goto advance; |
14392 |
- } |
14393 |
- |
14394 |
- type = ntohl(xdr->type); |
14395 |
-@@ -221,15 +220,13 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, |
14396 |
- status->size = xdr_to_u64(xdr->size); |
14397 |
- status->data_version = xdr_to_u64(xdr->data_version); |
14398 |
- scb->have_status = true; |
14399 |
--good: |
14400 |
-- ret = 0; |
14401 |
- advance: |
14402 |
- *_bp += xdr_size(xdr); |
14403 |
-- return ret; |
14404 |
-+ return; |
14405 |
- |
14406 |
- bad: |
14407 |
- xdr_dump_bad(*_bp); |
14408 |
-- ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
14409 |
-+ afs_protocol_error(call, afs_eproto_bad_status); |
14410 |
- goto advance; |
14411 |
- } |
14412 |
- |
14413 |
-@@ -348,9 +345,7 @@ static int yfs_deliver_fs_status_cb_and_volsync(struct afs_call *call) |
14414 |
- |
14415 |
- /* unmarshall the reply once we've received all of it */ |
14416 |
- bp = call->buffer; |
14417 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14418 |
-- if (ret < 0) |
14419 |
-- return ret; |
14420 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14421 |
- xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
14422 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14423 |
- |
14424 |
-@@ -372,9 +367,7 @@ static int yfs_deliver_status_and_volsync(struct afs_call *call) |
14425 |
- return ret; |
14426 |
- |
14427 |
- bp = call->buffer; |
14428 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14429 |
-- if (ret < 0) |
14430 |
-- return ret; |
14431 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14432 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14433 |
- |
14434 |
- _leave(" = 0 [done]"); |
14435 |
-@@ -534,9 +527,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) |
14436 |
- return ret; |
14437 |
- |
14438 |
- bp = call->buffer; |
14439 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14440 |
-- if (ret < 0) |
14441 |
-- return ret; |
14442 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14443 |
- xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
14444 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14445 |
- |
14446 |
-@@ -644,12 +635,8 @@ static int yfs_deliver_fs_create_vnode(struct afs_call *call) |
14447 |
- /* unmarshall the reply once we've received all of it */ |
14448 |
- bp = call->buffer; |
14449 |
- xdr_decode_YFSFid(&bp, call->out_fid); |
14450 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14451 |
-- if (ret < 0) |
14452 |
-- return ret; |
14453 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14454 |
-- if (ret < 0) |
14455 |
-- return ret; |
14456 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14457 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14458 |
- xdr_decode_YFSCallBack(&bp, call, call->out_scb); |
14459 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14460 |
- |
14461 |
-@@ -802,14 +789,9 @@ static int yfs_deliver_fs_remove_file2(struct afs_call *call) |
14462 |
- return ret; |
14463 |
- |
14464 |
- bp = call->buffer; |
14465 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14466 |
-- if (ret < 0) |
14467 |
-- return ret; |
14468 |
-- |
14469 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14470 |
- xdr_decode_YFSFid(&bp, &fid); |
14471 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14472 |
-- if (ret < 0) |
14473 |
-- return ret; |
14474 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14475 |
- /* Was deleted if vnode->status.abort_code == VNOVNODE. */ |
14476 |
- |
14477 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14478 |
-@@ -889,10 +871,7 @@ static int yfs_deliver_fs_remove(struct afs_call *call) |
14479 |
- return ret; |
14480 |
- |
14481 |
- bp = call->buffer; |
14482 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14483 |
-- if (ret < 0) |
14484 |
-- return ret; |
14485 |
-- |
14486 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14487 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14488 |
- return 0; |
14489 |
- } |
14490 |
-@@ -974,12 +953,8 @@ static int yfs_deliver_fs_link(struct afs_call *call) |
14491 |
- return ret; |
14492 |
- |
14493 |
- bp = call->buffer; |
14494 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14495 |
-- if (ret < 0) |
14496 |
-- return ret; |
14497 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14498 |
-- if (ret < 0) |
14499 |
-- return ret; |
14500 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14501 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14502 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14503 |
- _leave(" = 0 [done]"); |
14504 |
- return 0; |
14505 |
-@@ -1061,12 +1036,8 @@ static int yfs_deliver_fs_symlink(struct afs_call *call) |
14506 |
- /* unmarshall the reply once we've received all of it */ |
14507 |
- bp = call->buffer; |
14508 |
- xdr_decode_YFSFid(&bp, call->out_fid); |
14509 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14510 |
-- if (ret < 0) |
14511 |
-- return ret; |
14512 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14513 |
-- if (ret < 0) |
14514 |
-- return ret; |
14515 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14516 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14517 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14518 |
- |
14519 |
- _leave(" = 0 [done]"); |
14520 |
-@@ -1154,13 +1125,11 @@ static int yfs_deliver_fs_rename(struct afs_call *call) |
14521 |
- return ret; |
14522 |
- |
14523 |
- bp = call->buffer; |
14524 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14525 |
-- if (ret < 0) |
14526 |
-- return ret; |
14527 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14528 |
-- if (ret < 0) |
14529 |
-- return ret; |
14530 |
-- |
14531 |
-+ /* If the two dirs are the same, we have two copies of the same status |
14532 |
-+ * report, so we just decode it twice. |
14533 |
-+ */ |
14534 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
14535 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14536 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14537 |
- _leave(" = 0 [done]"); |
14538 |
- return 0; |
14539 |
-@@ -1457,8 +1426,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) |
14540 |
- call->count = ntohl(call->tmp); |
14541 |
- _debug("volname length: %u", call->count); |
14542 |
- if (call->count >= AFSNAMEMAX) |
14543 |
-- return afs_protocol_error(call, -EBADMSG, |
14544 |
-- afs_eproto_volname_len); |
14545 |
-+ return afs_protocol_error(call, afs_eproto_volname_len); |
14546 |
- size = (call->count + 3) & ~3; /* It's padded */ |
14547 |
- afs_extract_to_buf(call, size); |
14548 |
- call->unmarshall++; |
14549 |
-@@ -1487,8 +1455,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) |
14550 |
- call->count = ntohl(call->tmp); |
14551 |
- _debug("offline msg length: %u", call->count); |
14552 |
- if (call->count >= AFSNAMEMAX) |
14553 |
-- return afs_protocol_error(call, -EBADMSG, |
14554 |
-- afs_eproto_offline_msg_len); |
14555 |
-+ return afs_protocol_error(call, afs_eproto_offline_msg_len); |
14556 |
- size = (call->count + 3) & ~3; /* It's padded */ |
14557 |
- afs_extract_to_buf(call, size); |
14558 |
- call->unmarshall++; |
14559 |
-@@ -1518,8 +1485,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) |
14560 |
- call->count = ntohl(call->tmp); |
14561 |
- _debug("motd length: %u", call->count); |
14562 |
- if (call->count >= AFSNAMEMAX) |
14563 |
-- return afs_protocol_error(call, -EBADMSG, |
14564 |
-- afs_eproto_motd_len); |
14565 |
-+ return afs_protocol_error(call, afs_eproto_motd_len); |
14566 |
- size = (call->count + 3) & ~3; /* It's padded */ |
14567 |
- afs_extract_to_buf(call, size); |
14568 |
- call->unmarshall++; |
14569 |
-@@ -1828,8 +1794,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14570 |
- tmp = ntohl(call->tmp); |
14571 |
- _debug("status count: %u/%u", tmp, call->count2); |
14572 |
- if (tmp != call->count2) |
14573 |
-- return afs_protocol_error(call, -EBADMSG, |
14574 |
-- afs_eproto_ibulkst_count); |
14575 |
-+ return afs_protocol_error(call, afs_eproto_ibulkst_count); |
14576 |
- |
14577 |
- call->count = 0; |
14578 |
- call->unmarshall++; |
14579 |
-@@ -1845,9 +1810,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14580 |
- |
14581 |
- bp = call->buffer; |
14582 |
- scb = &call->out_scb[call->count]; |
14583 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, scb); |
14584 |
-- if (ret < 0) |
14585 |
-- return ret; |
14586 |
-+ xdr_decode_YFSFetchStatus(&bp, call, scb); |
14587 |
- |
14588 |
- call->count++; |
14589 |
- if (call->count < call->count2) |
14590 |
-@@ -1868,8 +1831,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) |
14591 |
- tmp = ntohl(call->tmp); |
14592 |
- _debug("CB count: %u", tmp); |
14593 |
- if (tmp != call->count2) |
14594 |
-- return afs_protocol_error(call, -EBADMSG, |
14595 |
-- afs_eproto_ibulkst_cb_count); |
14596 |
-+ return afs_protocol_error(call, afs_eproto_ibulkst_cb_count); |
14597 |
- call->count = 0; |
14598 |
- call->unmarshall++; |
14599 |
- more_cbs: |
14600 |
-@@ -2067,9 +2029,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call) |
14601 |
- bp = call->buffer; |
14602 |
- yacl->inherit_flag = ntohl(*bp++); |
14603 |
- yacl->num_cleaned = ntohl(*bp++); |
14604 |
-- ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14605 |
-- if (ret < 0) |
14606 |
-- return ret; |
14607 |
-+ xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
14608 |
- xdr_decode_YFSVolSync(&bp, call->out_volsync); |
14609 |
- |
14610 |
- call->unmarshall++; |
14611 |
-diff --git a/fs/block_dev.c b/fs/block_dev.c |
14612 |
-index 93672c3f1c78..313aae95818e 100644 |
14613 |
---- a/fs/block_dev.c |
14614 |
-+++ b/fs/block_dev.c |
14615 |
-@@ -1583,10 +1583,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
14616 |
- */ |
14617 |
- if (!for_part) { |
14618 |
- ret = devcgroup_inode_permission(bdev->bd_inode, perm); |
14619 |
-- if (ret != 0) { |
14620 |
-- bdput(bdev); |
14621 |
-+ if (ret != 0) |
14622 |
- return ret; |
14623 |
-- } |
14624 |
- } |
14625 |
- |
14626 |
- restart: |
14627 |
-@@ -1655,8 +1653,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
14628 |
- goto out_clear; |
14629 |
- BUG_ON(for_part); |
14630 |
- ret = __blkdev_get(whole, mode, 1); |
14631 |
-- if (ret) |
14632 |
-+ if (ret) { |
14633 |
-+ bdput(whole); |
14634 |
- goto out_clear; |
14635 |
-+ } |
14636 |
- bdev->bd_contains = whole; |
14637 |
- bdev->bd_part = disk_get_part(disk, partno); |
14638 |
- if (!(disk->flags & GENHD_FL_UP) || |
14639 |
-@@ -1706,7 +1706,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
14640 |
- disk_unblock_events(disk); |
14641 |
- put_disk_and_module(disk); |
14642 |
- out: |
14643 |
-- bdput(bdev); |
14644 |
- |
14645 |
- return ret; |
14646 |
- } |
14647 |
-@@ -1773,6 +1772,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) |
14648 |
- bdput(whole); |
14649 |
- } |
14650 |
- |
14651 |
-+ if (res) |
14652 |
-+ bdput(bdev); |
14653 |
-+ |
14654 |
- return res; |
14655 |
- } |
14656 |
- EXPORT_SYMBOL(blkdev_get); |
14657 |
-diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
14658 |
-index 79dc06881e78..e088843a7734 100644 |
14659 |
---- a/fs/ceph/export.c |
14660 |
-+++ b/fs/ceph/export.c |
14661 |
-@@ -172,9 +172,16 @@ struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino) |
14662 |
- static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) |
14663 |
- { |
14664 |
- struct inode *inode = __lookup_inode(sb, ino); |
14665 |
-+ int err; |
14666 |
-+ |
14667 |
- if (IS_ERR(inode)) |
14668 |
- return ERR_CAST(inode); |
14669 |
-- if (inode->i_nlink == 0) { |
14670 |
-+ /* We need LINK caps to reliably check i_nlink */ |
14671 |
-+ err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false); |
14672 |
-+ if (err) |
14673 |
-+ return ERR_PTR(err); |
14674 |
-+ /* -ESTALE if inode as been unlinked and no file is open */ |
14675 |
-+ if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) { |
14676 |
- iput(inode); |
14677 |
- return ERR_PTR(-ESTALE); |
14678 |
- } |
14679 |
-diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
14680 |
-index 28268ed461b8..47b9fbb70bf5 100644 |
14681 |
---- a/fs/cifs/connect.c |
14682 |
-+++ b/fs/cifs/connect.c |
14683 |
-@@ -572,26 +572,26 @@ cifs_reconnect(struct TCP_Server_Info *server) |
14684 |
- try_to_freeze(); |
14685 |
- |
14686 |
- mutex_lock(&server->srv_mutex); |
14687 |
-+#ifdef CONFIG_CIFS_DFS_UPCALL |
14688 |
- /* |
14689 |
- * Set up next DFS target server (if any) for reconnect. If DFS |
14690 |
- * feature is disabled, then we will retry last server we |
14691 |
- * connected to before. |
14692 |
- */ |
14693 |
-+ reconn_inval_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); |
14694 |
-+#endif |
14695 |
-+ rc = reconn_set_ipaddr(server); |
14696 |
-+ if (rc) { |
14697 |
-+ cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", |
14698 |
-+ __func__, rc); |
14699 |
-+ } |
14700 |
-+ |
14701 |
- if (cifs_rdma_enabled(server)) |
14702 |
- rc = smbd_reconnect(server); |
14703 |
- else |
14704 |
- rc = generic_ip_connect(server); |
14705 |
- if (rc) { |
14706 |
- cifs_dbg(FYI, "reconnect error %d\n", rc); |
14707 |
--#ifdef CONFIG_CIFS_DFS_UPCALL |
14708 |
-- reconn_inval_dfs_target(server, cifs_sb, &tgt_list, |
14709 |
-- &tgt_it); |
14710 |
--#endif |
14711 |
-- rc = reconn_set_ipaddr(server); |
14712 |
-- if (rc) { |
14713 |
-- cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", |
14714 |
-- __func__, rc); |
14715 |
-- } |
14716 |
- mutex_unlock(&server->srv_mutex); |
14717 |
- msleep(3000); |
14718 |
- } else { |
14719 |
-diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h |
14720 |
-index 416d9de35679..4311d01b02a8 100644 |
14721 |
---- a/fs/dlm/dlm_internal.h |
14722 |
-+++ b/fs/dlm/dlm_internal.h |
14723 |
-@@ -97,7 +97,6 @@ do { \ |
14724 |
- __LINE__, __FILE__, #x, jiffies); \ |
14725 |
- {do} \ |
14726 |
- printk("\n"); \ |
14727 |
-- BUG(); \ |
14728 |
- panic("DLM: Record message above and reboot.\n"); \ |
14729 |
- } \ |
14730 |
- } |
14731 |
-diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c |
14732 |
-index 8c7bbf3e566d..470be69f19aa 100644 |
14733 |
---- a/fs/ext4/acl.c |
14734 |
-+++ b/fs/ext4/acl.c |
14735 |
-@@ -256,7 +256,7 @@ retry: |
14736 |
- if (!error && update_mode) { |
14737 |
- inode->i_mode = mode; |
14738 |
- inode->i_ctime = current_time(inode); |
14739 |
-- ext4_mark_inode_dirty(handle, inode); |
14740 |
-+ error = ext4_mark_inode_dirty(handle, inode); |
14741 |
- } |
14742 |
- out_stop: |
14743 |
- ext4_journal_stop(handle); |
14744 |
-diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
14745 |
-index c654205f648d..1d82336b1cd4 100644 |
14746 |
---- a/fs/ext4/dir.c |
14747 |
-+++ b/fs/ext4/dir.c |
14748 |
-@@ -675,6 +675,7 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len, |
14749 |
- struct qstr qstr = {.name = str, .len = len }; |
14750 |
- const struct dentry *parent = READ_ONCE(dentry->d_parent); |
14751 |
- const struct inode *inode = READ_ONCE(parent->d_inode); |
14752 |
-+ char strbuf[DNAME_INLINE_LEN]; |
14753 |
- |
14754 |
- if (!inode || !IS_CASEFOLDED(inode) || |
14755 |
- !EXT4_SB(inode->i_sb)->s_encoding) { |
14756 |
-@@ -683,6 +684,21 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len, |
14757 |
- return memcmp(str, name->name, len); |
14758 |
- } |
14759 |
- |
14760 |
-+ /* |
14761 |
-+ * If the dentry name is stored in-line, then it may be concurrently |
14762 |
-+ * modified by a rename. If this happens, the VFS will eventually retry |
14763 |
-+ * the lookup, so it doesn't matter what ->d_compare() returns. |
14764 |
-+ * However, it's unsafe to call utf8_strncasecmp() with an unstable |
14765 |
-+ * string. Therefore, we have to copy the name into a temporary buffer. |
14766 |
-+ */ |
14767 |
-+ if (len <= DNAME_INLINE_LEN - 1) { |
14768 |
-+ memcpy(strbuf, str, len); |
14769 |
-+ strbuf[len] = 0; |
14770 |
-+ qstr.name = strbuf; |
14771 |
-+ /* prevent compiler from optimizing out the temporary buffer */ |
14772 |
-+ barrier(); |
14773 |
-+ } |
14774 |
-+ |
14775 |
- return ext4_ci_compare(inode, name, &qstr, false); |
14776 |
- } |
14777 |
- |
14778 |
-diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
14779 |
-index ad2dbf6e4924..51a85b50033a 100644 |
14780 |
---- a/fs/ext4/ext4.h |
14781 |
-+++ b/fs/ext4/ext4.h |
14782 |
-@@ -3354,7 +3354,7 @@ struct ext4_extent; |
14783 |
- */ |
14784 |
- #define EXT_MAX_BLOCKS 0xffffffff |
14785 |
- |
14786 |
--extern int ext4_ext_tree_init(handle_t *handle, struct inode *); |
14787 |
-+extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode); |
14788 |
- extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents); |
14789 |
- extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, |
14790 |
- struct ext4_map_blocks *map, int flags); |
14791 |
-diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h |
14792 |
-index 4b9002f0e84c..3bacf76d2609 100644 |
14793 |
---- a/fs/ext4/ext4_jbd2.h |
14794 |
-+++ b/fs/ext4/ext4_jbd2.h |
14795 |
-@@ -222,7 +222,10 @@ ext4_mark_iloc_dirty(handle_t *handle, |
14796 |
- int ext4_reserve_inode_write(handle_t *handle, struct inode *inode, |
14797 |
- struct ext4_iloc *iloc); |
14798 |
- |
14799 |
--int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); |
14800 |
-+#define ext4_mark_inode_dirty(__h, __i) \ |
14801 |
-+ __ext4_mark_inode_dirty((__h), (__i), __func__, __LINE__) |
14802 |
-+int __ext4_mark_inode_dirty(handle_t *handle, struct inode *inode, |
14803 |
-+ const char *func, unsigned int line); |
14804 |
- |
14805 |
- int ext4_expand_extra_isize(struct inode *inode, |
14806 |
- unsigned int new_extra_isize, |
14807 |
-diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
14808 |
-index 2b4b94542e34..d5453072eb63 100644 |
14809 |
---- a/fs/ext4/extents.c |
14810 |
-+++ b/fs/ext4/extents.c |
14811 |
-@@ -816,7 +816,7 @@ ext4_ext_binsearch(struct inode *inode, |
14812 |
- |
14813 |
- } |
14814 |
- |
14815 |
--int ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
14816 |
-+void ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
14817 |
- { |
14818 |
- struct ext4_extent_header *eh; |
14819 |
- |
14820 |
-@@ -826,7 +826,6 @@ int ext4_ext_tree_init(handle_t *handle, struct inode *inode) |
14821 |
- eh->eh_magic = EXT4_EXT_MAGIC; |
14822 |
- eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); |
14823 |
- ext4_mark_inode_dirty(handle, inode); |
14824 |
-- return 0; |
14825 |
- } |
14826 |
- |
14827 |
- struct ext4_ext_path * |
14828 |
-@@ -1319,7 +1318,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, |
14829 |
- ext4_idx_pblock(EXT_FIRST_INDEX(neh))); |
14830 |
- |
14831 |
- le16_add_cpu(&neh->eh_depth, 1); |
14832 |
-- ext4_mark_inode_dirty(handle, inode); |
14833 |
-+ err = ext4_mark_inode_dirty(handle, inode); |
14834 |
- out: |
14835 |
- brelse(bh); |
14836 |
- |
14837 |
-@@ -2828,7 +2827,7 @@ again: |
14838 |
- * in use to avoid freeing it when removing blocks. |
14839 |
- */ |
14840 |
- if (sbi->s_cluster_ratio > 1) { |
14841 |
-- pblk = ext4_ext_pblock(ex) + end - ee_block + 2; |
14842 |
-+ pblk = ext4_ext_pblock(ex) + end - ee_block + 1; |
14843 |
- partial.pclu = EXT4_B2C(sbi, pblk); |
14844 |
- partial.state = nofree; |
14845 |
- } |
14846 |
-@@ -4363,7 +4362,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, |
14847 |
- struct inode *inode = file_inode(file); |
14848 |
- handle_t *handle; |
14849 |
- int ret = 0; |
14850 |
-- int ret2 = 0; |
14851 |
-+ int ret2 = 0, ret3 = 0; |
14852 |
- int retries = 0; |
14853 |
- int depth = 0; |
14854 |
- struct ext4_map_blocks map; |
14855 |
-@@ -4423,10 +4422,11 @@ retry: |
14856 |
- if (ext4_update_inode_size(inode, epos) & 0x1) |
14857 |
- inode->i_mtime = inode->i_ctime; |
14858 |
- } |
14859 |
-- ext4_mark_inode_dirty(handle, inode); |
14860 |
-+ ret2 = ext4_mark_inode_dirty(handle, inode); |
14861 |
- ext4_update_inode_fsync_trans(handle, inode, 1); |
14862 |
-- ret2 = ext4_journal_stop(handle); |
14863 |
-- if (ret2) |
14864 |
-+ ret3 = ext4_journal_stop(handle); |
14865 |
-+ ret2 = ret3 ? ret3 : ret2; |
14866 |
-+ if (unlikely(ret2)) |
14867 |
- break; |
14868 |
- } |
14869 |
- if (ret == -ENOSPC && |
14870 |
-@@ -4577,7 +4577,9 @@ static long ext4_zero_range(struct file *file, loff_t offset, |
14871 |
- inode->i_mtime = inode->i_ctime = current_time(inode); |
14872 |
- if (new_size) |
14873 |
- ext4_update_inode_size(inode, new_size); |
14874 |
-- ext4_mark_inode_dirty(handle, inode); |
14875 |
-+ ret = ext4_mark_inode_dirty(handle, inode); |
14876 |
-+ if (unlikely(ret)) |
14877 |
-+ goto out_handle; |
14878 |
- |
14879 |
- /* Zero out partial block at the edges of the range */ |
14880 |
- ret = ext4_zero_partial_blocks(handle, inode, offset, len); |
14881 |
-@@ -4587,6 +4589,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, |
14882 |
- if (file->f_flags & O_SYNC) |
14883 |
- ext4_handle_sync(handle); |
14884 |
- |
14885 |
-+out_handle: |
14886 |
- ext4_journal_stop(handle); |
14887 |
- out_mutex: |
14888 |
- inode_unlock(inode); |
14889 |
-@@ -4700,8 +4703,7 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode, |
14890 |
- loff_t offset, ssize_t len) |
14891 |
- { |
14892 |
- unsigned int max_blocks; |
14893 |
-- int ret = 0; |
14894 |
-- int ret2 = 0; |
14895 |
-+ int ret = 0, ret2 = 0, ret3 = 0; |
14896 |
- struct ext4_map_blocks map; |
14897 |
- unsigned int blkbits = inode->i_blkbits; |
14898 |
- unsigned int credits = 0; |
14899 |
-@@ -4734,9 +4736,13 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode, |
14900 |
- "ext4_ext_map_blocks returned %d", |
14901 |
- inode->i_ino, map.m_lblk, |
14902 |
- map.m_len, ret); |
14903 |
-- ext4_mark_inode_dirty(handle, inode); |
14904 |
-- if (credits) |
14905 |
-- ret2 = ext4_journal_stop(handle); |
14906 |
-+ ret2 = ext4_mark_inode_dirty(handle, inode); |
14907 |
-+ if (credits) { |
14908 |
-+ ret3 = ext4_journal_stop(handle); |
14909 |
-+ if (unlikely(ret3)) |
14910 |
-+ ret2 = ret3; |
14911 |
-+ } |
14912 |
-+ |
14913 |
- if (ret <= 0 || ret2) |
14914 |
- break; |
14915 |
- } |
14916 |
-@@ -5304,7 +5310,7 @@ static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) |
14917 |
- if (IS_SYNC(inode)) |
14918 |
- ext4_handle_sync(handle); |
14919 |
- inode->i_mtime = inode->i_ctime = current_time(inode); |
14920 |
-- ext4_mark_inode_dirty(handle, inode); |
14921 |
-+ ret = ext4_mark_inode_dirty(handle, inode); |
14922 |
- ext4_update_inode_fsync_trans(handle, inode, 1); |
14923 |
- |
14924 |
- out_stop: |
14925 |
-diff --git a/fs/ext4/file.c b/fs/ext4/file.c |
14926 |
-index 0d624250a62b..2a01e31a032c 100644 |
14927 |
---- a/fs/ext4/file.c |
14928 |
-+++ b/fs/ext4/file.c |
14929 |
-@@ -287,6 +287,7 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, |
14930 |
- bool truncate = false; |
14931 |
- u8 blkbits = inode->i_blkbits; |
14932 |
- ext4_lblk_t written_blk, end_blk; |
14933 |
-+ int ret; |
14934 |
- |
14935 |
- /* |
14936 |
- * Note that EXT4_I(inode)->i_disksize can get extended up to |
14937 |
-@@ -327,8 +328,14 @@ static ssize_t ext4_handle_inode_extension(struct inode *inode, loff_t offset, |
14938 |
- goto truncate; |
14939 |
- } |
14940 |
- |
14941 |
-- if (ext4_update_inode_size(inode, offset + written)) |
14942 |
-- ext4_mark_inode_dirty(handle, inode); |
14943 |
-+ if (ext4_update_inode_size(inode, offset + written)) { |
14944 |
-+ ret = ext4_mark_inode_dirty(handle, inode); |
14945 |
-+ if (unlikely(ret)) { |
14946 |
-+ written = ret; |
14947 |
-+ ext4_journal_stop(handle); |
14948 |
-+ goto truncate; |
14949 |
-+ } |
14950 |
-+ } |
14951 |
- |
14952 |
- /* |
14953 |
- * We may need to truncate allocated but not written blocks beyond EOF. |
14954 |
-@@ -495,6 +502,12 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from) |
14955 |
- if (ret <= 0) |
14956 |
- return ret; |
14957 |
- |
14958 |
-+ /* if we're going to block and IOCB_NOWAIT is set, return -EAGAIN */ |
14959 |
-+ if ((iocb->ki_flags & IOCB_NOWAIT) && (unaligned_io || extend)) { |
14960 |
-+ ret = -EAGAIN; |
14961 |
-+ goto out; |
14962 |
-+ } |
14963 |
-+ |
14964 |
- offset = iocb->ki_pos; |
14965 |
- count = ret; |
14966 |
- |
14967 |
-diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c |
14968 |
-index 107f0043f67f..be2b66eb65f7 100644 |
14969 |
---- a/fs/ext4/indirect.c |
14970 |
-+++ b/fs/ext4/indirect.c |
14971 |
-@@ -467,7 +467,9 @@ static int ext4_splice_branch(handle_t *handle, |
14972 |
- /* |
14973 |
- * OK, we spliced it into the inode itself on a direct block. |
14974 |
- */ |
14975 |
-- ext4_mark_inode_dirty(handle, ar->inode); |
14976 |
-+ err = ext4_mark_inode_dirty(handle, ar->inode); |
14977 |
-+ if (unlikely(err)) |
14978 |
-+ goto err_out; |
14979 |
- jbd_debug(5, "splicing direct\n"); |
14980 |
- } |
14981 |
- return err; |
14982 |
-diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
14983 |
-index f35e289e17aa..c3a1ad2db122 100644 |
14984 |
---- a/fs/ext4/inline.c |
14985 |
-+++ b/fs/ext4/inline.c |
14986 |
-@@ -1260,7 +1260,7 @@ out: |
14987 |
- int ext4_try_add_inline_entry(handle_t *handle, struct ext4_filename *fname, |
14988 |
- struct inode *dir, struct inode *inode) |
14989 |
- { |
14990 |
-- int ret, inline_size, no_expand; |
14991 |
-+ int ret, ret2, inline_size, no_expand; |
14992 |
- void *inline_start; |
14993 |
- struct ext4_iloc iloc; |
14994 |
- |
14995 |
-@@ -1314,7 +1314,9 @@ int ext4_try_add_inline_entry(handle_t *handle, struct ext4_filename *fname, |
14996 |
- |
14997 |
- out: |
14998 |
- ext4_write_unlock_xattr(dir, &no_expand); |
14999 |
-- ext4_mark_inode_dirty(handle, dir); |
15000 |
-+ ret2 = ext4_mark_inode_dirty(handle, dir); |
15001 |
-+ if (unlikely(ret2 && !ret)) |
15002 |
-+ ret = ret2; |
15003 |
- brelse(iloc.bh); |
15004 |
- return ret; |
15005 |
- } |
15006 |
-diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
15007 |
-index 2a4aae6acdcb..87430d276bcc 100644 |
15008 |
---- a/fs/ext4/inode.c |
15009 |
-+++ b/fs/ext4/inode.c |
15010 |
-@@ -1296,7 +1296,7 @@ static int ext4_write_end(struct file *file, |
15011 |
- * filesystems. |
15012 |
- */ |
15013 |
- if (i_size_changed || inline_data) |
15014 |
-- ext4_mark_inode_dirty(handle, inode); |
15015 |
-+ ret = ext4_mark_inode_dirty(handle, inode); |
15016 |
- |
15017 |
- if (pos + len > inode->i_size && !verity && ext4_can_truncate(inode)) |
15018 |
- /* if we have allocated more blocks and copied |
15019 |
-@@ -3077,7 +3077,7 @@ static int ext4_da_write_end(struct file *file, |
15020 |
- * new_i_size is less that inode->i_size |
15021 |
- * bu greater than i_disksize.(hint delalloc) |
15022 |
- */ |
15023 |
-- ext4_mark_inode_dirty(handle, inode); |
15024 |
-+ ret = ext4_mark_inode_dirty(handle, inode); |
15025 |
- } |
15026 |
- } |
15027 |
- |
15028 |
-@@ -3094,7 +3094,7 @@ static int ext4_da_write_end(struct file *file, |
15029 |
- if (ret2 < 0) |
15030 |
- ret = ret2; |
15031 |
- ret2 = ext4_journal_stop(handle); |
15032 |
-- if (!ret) |
15033 |
-+ if (unlikely(ret2 && !ret)) |
15034 |
- ret = ret2; |
15035 |
- |
15036 |
- return ret ? ret : copied; |
15037 |
-@@ -3886,6 +3886,8 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, |
15038 |
- loff_t len) |
15039 |
- { |
15040 |
- handle_t *handle; |
15041 |
-+ int ret; |
15042 |
-+ |
15043 |
- loff_t size = i_size_read(inode); |
15044 |
- |
15045 |
- WARN_ON(!inode_is_locked(inode)); |
15046 |
-@@ -3899,10 +3901,10 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, |
15047 |
- if (IS_ERR(handle)) |
15048 |
- return PTR_ERR(handle); |
15049 |
- ext4_update_i_disksize(inode, size); |
15050 |
-- ext4_mark_inode_dirty(handle, inode); |
15051 |
-+ ret = ext4_mark_inode_dirty(handle, inode); |
15052 |
- ext4_journal_stop(handle); |
15053 |
- |
15054 |
-- return 0; |
15055 |
-+ return ret; |
15056 |
- } |
15057 |
- |
15058 |
- static void ext4_wait_dax_page(struct ext4_inode_info *ei) |
15059 |
-@@ -3954,7 +3956,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) |
15060 |
- loff_t first_block_offset, last_block_offset; |
15061 |
- handle_t *handle; |
15062 |
- unsigned int credits; |
15063 |
-- int ret = 0; |
15064 |
-+ int ret = 0, ret2 = 0; |
15065 |
- |
15066 |
- trace_ext4_punch_hole(inode, offset, length, 0); |
15067 |
- |
15068 |
-@@ -4077,7 +4079,9 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) |
15069 |
- ext4_handle_sync(handle); |
15070 |
- |
15071 |
- inode->i_mtime = inode->i_ctime = current_time(inode); |
15072 |
-- ext4_mark_inode_dirty(handle, inode); |
15073 |
-+ ret2 = ext4_mark_inode_dirty(handle, inode); |
15074 |
-+ if (unlikely(ret2)) |
15075 |
-+ ret = ret2; |
15076 |
- if (ret >= 0) |
15077 |
- ext4_update_inode_fsync_trans(handle, inode, 1); |
15078 |
- out_stop: |
15079 |
-@@ -4146,7 +4150,7 @@ int ext4_truncate(struct inode *inode) |
15080 |
- { |
15081 |
- struct ext4_inode_info *ei = EXT4_I(inode); |
15082 |
- unsigned int credits; |
15083 |
-- int err = 0; |
15084 |
-+ int err = 0, err2; |
15085 |
- handle_t *handle; |
15086 |
- struct address_space *mapping = inode->i_mapping; |
15087 |
- |
15088 |
-@@ -4234,7 +4238,9 @@ out_stop: |
15089 |
- ext4_orphan_del(handle, inode); |
15090 |
- |
15091 |
- inode->i_mtime = inode->i_ctime = current_time(inode); |
15092 |
-- ext4_mark_inode_dirty(handle, inode); |
15093 |
-+ err2 = ext4_mark_inode_dirty(handle, inode); |
15094 |
-+ if (unlikely(err2 && !err)) |
15095 |
-+ err = err2; |
15096 |
- ext4_journal_stop(handle); |
15097 |
- |
15098 |
- trace_ext4_truncate_exit(inode); |
15099 |
-@@ -5292,6 +5298,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) |
15100 |
- inode->i_gid = attr->ia_gid; |
15101 |
- error = ext4_mark_inode_dirty(handle, inode); |
15102 |
- ext4_journal_stop(handle); |
15103 |
-+ if (unlikely(error)) |
15104 |
-+ return error; |
15105 |
- } |
15106 |
- |
15107 |
- if (attr->ia_valid & ATTR_SIZE) { |
15108 |
-@@ -5777,7 +5785,8 @@ out_unlock: |
15109 |
- * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync) |
15110 |
- * we start and wait on commits. |
15111 |
- */ |
15112 |
--int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) |
15113 |
-+int __ext4_mark_inode_dirty(handle_t *handle, struct inode *inode, |
15114 |
-+ const char *func, unsigned int line) |
15115 |
- { |
15116 |
- struct ext4_iloc iloc; |
15117 |
- struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
15118 |
-@@ -5787,13 +5796,18 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) |
15119 |
- trace_ext4_mark_inode_dirty(inode, _RET_IP_); |
15120 |
- err = ext4_reserve_inode_write(handle, inode, &iloc); |
15121 |
- if (err) |
15122 |
-- return err; |
15123 |
-+ goto out; |
15124 |
- |
15125 |
- if (EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize) |
15126 |
- ext4_try_to_expand_extra_isize(inode, sbi->s_want_extra_isize, |
15127 |
- iloc, handle); |
15128 |
- |
15129 |
-- return ext4_mark_iloc_dirty(handle, inode, &iloc); |
15130 |
-+ err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
15131 |
-+out: |
15132 |
-+ if (unlikely(err)) |
15133 |
-+ ext4_error_inode_err(inode, func, line, 0, err, |
15134 |
-+ "mark_inode_dirty error"); |
15135 |
-+ return err; |
15136 |
- } |
15137 |
- |
15138 |
- /* |
15139 |
-diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
15140 |
-index fb6520f37135..c5e3fc998211 100644 |
15141 |
---- a/fs/ext4/migrate.c |
15142 |
-+++ b/fs/ext4/migrate.c |
15143 |
-@@ -287,7 +287,7 @@ static int free_ind_block(handle_t *handle, struct inode *inode, __le32 *i_data) |
15144 |
- static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, |
15145 |
- struct inode *tmp_inode) |
15146 |
- { |
15147 |
-- int retval; |
15148 |
-+ int retval, retval2 = 0; |
15149 |
- __le32 i_data[3]; |
15150 |
- struct ext4_inode_info *ei = EXT4_I(inode); |
15151 |
- struct ext4_inode_info *tmp_ei = EXT4_I(tmp_inode); |
15152 |
-@@ -342,7 +342,9 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, |
15153 |
- * i_blocks when freeing the indirect meta-data blocks |
15154 |
- */ |
15155 |
- retval = free_ind_block(handle, inode, i_data); |
15156 |
-- ext4_mark_inode_dirty(handle, inode); |
15157 |
-+ retval2 = ext4_mark_inode_dirty(handle, inode); |
15158 |
-+ if (unlikely(retval2 && !retval)) |
15159 |
-+ retval = retval2; |
15160 |
- |
15161 |
- err_out: |
15162 |
- return retval; |
15163 |
-@@ -601,7 +603,7 @@ int ext4_ind_migrate(struct inode *inode) |
15164 |
- ext4_lblk_t start, end; |
15165 |
- ext4_fsblk_t blk; |
15166 |
- handle_t *handle; |
15167 |
-- int ret; |
15168 |
-+ int ret, ret2 = 0; |
15169 |
- |
15170 |
- if (!ext4_has_feature_extents(inode->i_sb) || |
15171 |
- (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) |
15172 |
-@@ -655,7 +657,9 @@ int ext4_ind_migrate(struct inode *inode) |
15173 |
- memset(ei->i_data, 0, sizeof(ei->i_data)); |
15174 |
- for (i = start; i <= end; i++) |
15175 |
- ei->i_data[i] = cpu_to_le32(blk++); |
15176 |
-- ext4_mark_inode_dirty(handle, inode); |
15177 |
-+ ret2 = ext4_mark_inode_dirty(handle, inode); |
15178 |
-+ if (unlikely(ret2 && !ret)) |
15179 |
-+ ret = ret2; |
15180 |
- errout: |
15181 |
- ext4_journal_stop(handle); |
15182 |
- up_write(&EXT4_I(inode)->i_data_sem); |
15183 |
-diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
15184 |
-index a8aca4772aaa..56738b538ddf 100644 |
15185 |
---- a/fs/ext4/namei.c |
15186 |
-+++ b/fs/ext4/namei.c |
15187 |
-@@ -1993,7 +1993,7 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname, |
15188 |
- { |
15189 |
- unsigned int blocksize = dir->i_sb->s_blocksize; |
15190 |
- int csum_size = 0; |
15191 |
-- int err; |
15192 |
-+ int err, err2; |
15193 |
- |
15194 |
- if (ext4_has_metadata_csum(inode->i_sb)) |
15195 |
- csum_size = sizeof(struct ext4_dir_entry_tail); |
15196 |
-@@ -2028,12 +2028,12 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname, |
15197 |
- dir->i_mtime = dir->i_ctime = current_time(dir); |
15198 |
- ext4_update_dx_flag(dir); |
15199 |
- inode_inc_iversion(dir); |
15200 |
-- ext4_mark_inode_dirty(handle, dir); |
15201 |
-+ err2 = ext4_mark_inode_dirty(handle, dir); |
15202 |
- BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); |
15203 |
- err = ext4_handle_dirty_dirblock(handle, dir, bh); |
15204 |
- if (err) |
15205 |
- ext4_std_error(dir->i_sb, err); |
15206 |
-- return 0; |
15207 |
-+ return err ? err : err2; |
15208 |
- } |
15209 |
- |
15210 |
- /* |
15211 |
-@@ -2223,7 +2223,9 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, |
15212 |
- } |
15213 |
- ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); |
15214 |
- dx_fallback++; |
15215 |
-- ext4_mark_inode_dirty(handle, dir); |
15216 |
-+ retval = ext4_mark_inode_dirty(handle, dir); |
15217 |
-+ if (unlikely(retval)) |
15218 |
-+ goto out; |
15219 |
- } |
15220 |
- blocks = dir->i_size >> sb->s_blocksize_bits; |
15221 |
- for (block = 0; block < blocks; block++) { |
15222 |
-@@ -2576,12 +2578,12 @@ static int ext4_add_nondir(handle_t *handle, |
15223 |
- struct inode *inode = *inodep; |
15224 |
- int err = ext4_add_entry(handle, dentry, inode); |
15225 |
- if (!err) { |
15226 |
-- ext4_mark_inode_dirty(handle, inode); |
15227 |
-+ err = ext4_mark_inode_dirty(handle, inode); |
15228 |
- if (IS_DIRSYNC(dir)) |
15229 |
- ext4_handle_sync(handle); |
15230 |
- d_instantiate_new(dentry, inode); |
15231 |
- *inodep = NULL; |
15232 |
-- return 0; |
15233 |
-+ return err; |
15234 |
- } |
15235 |
- drop_nlink(inode); |
15236 |
- ext4_orphan_add(handle, inode); |
15237 |
-@@ -2775,7 +2777,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
15238 |
- { |
15239 |
- handle_t *handle; |
15240 |
- struct inode *inode; |
15241 |
-- int err, credits, retries = 0; |
15242 |
-+ int err, err2 = 0, credits, retries = 0; |
15243 |
- |
15244 |
- if (EXT4_DIR_LINK_MAX(dir)) |
15245 |
- return -EMLINK; |
15246 |
-@@ -2808,7 +2810,9 @@ out_clear_inode: |
15247 |
- clear_nlink(inode); |
15248 |
- ext4_orphan_add(handle, inode); |
15249 |
- unlock_new_inode(inode); |
15250 |
-- ext4_mark_inode_dirty(handle, inode); |
15251 |
-+ err2 = ext4_mark_inode_dirty(handle, inode); |
15252 |
-+ if (unlikely(err2)) |
15253 |
-+ err = err2; |
15254 |
- ext4_journal_stop(handle); |
15255 |
- iput(inode); |
15256 |
- goto out_retry; |
15257 |
-@@ -3148,10 +3152,12 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) |
15258 |
- inode->i_size = 0; |
15259 |
- ext4_orphan_add(handle, inode); |
15260 |
- inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); |
15261 |
-- ext4_mark_inode_dirty(handle, inode); |
15262 |
-+ retval = ext4_mark_inode_dirty(handle, inode); |
15263 |
-+ if (retval) |
15264 |
-+ goto end_rmdir; |
15265 |
- ext4_dec_count(handle, dir); |
15266 |
- ext4_update_dx_flag(dir); |
15267 |
-- ext4_mark_inode_dirty(handle, dir); |
15268 |
-+ retval = ext4_mark_inode_dirty(handle, dir); |
15269 |
- |
15270 |
- #ifdef CONFIG_UNICODE |
15271 |
- /* VFS negative dentries are incompatible with Encoding and |
15272 |
-@@ -3221,7 +3227,9 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) |
15273 |
- goto end_unlink; |
15274 |
- dir->i_ctime = dir->i_mtime = current_time(dir); |
15275 |
- ext4_update_dx_flag(dir); |
15276 |
-- ext4_mark_inode_dirty(handle, dir); |
15277 |
-+ retval = ext4_mark_inode_dirty(handle, dir); |
15278 |
-+ if (retval) |
15279 |
-+ goto end_unlink; |
15280 |
- if (inode->i_nlink == 0) |
15281 |
- ext4_warning_inode(inode, "Deleting file '%.*s' with no links", |
15282 |
- dentry->d_name.len, dentry->d_name.name); |
15283 |
-@@ -3230,7 +3238,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) |
15284 |
- if (!inode->i_nlink) |
15285 |
- ext4_orphan_add(handle, inode); |
15286 |
- inode->i_ctime = current_time(inode); |
15287 |
-- ext4_mark_inode_dirty(handle, inode); |
15288 |
-+ retval = ext4_mark_inode_dirty(handle, inode); |
15289 |
- |
15290 |
- #ifdef CONFIG_UNICODE |
15291 |
- /* VFS negative dentries are incompatible with Encoding and |
15292 |
-@@ -3419,7 +3427,7 @@ retry: |
15293 |
- |
15294 |
- err = ext4_add_entry(handle, dentry, inode); |
15295 |
- if (!err) { |
15296 |
-- ext4_mark_inode_dirty(handle, inode); |
15297 |
-+ err = ext4_mark_inode_dirty(handle, inode); |
15298 |
- /* this can happen only for tmpfile being |
15299 |
- * linked the first time |
15300 |
- */ |
15301 |
-@@ -3531,7 +3539,7 @@ static int ext4_rename_dir_finish(handle_t *handle, struct ext4_renament *ent, |
15302 |
- static int ext4_setent(handle_t *handle, struct ext4_renament *ent, |
15303 |
- unsigned ino, unsigned file_type) |
15304 |
- { |
15305 |
-- int retval; |
15306 |
-+ int retval, retval2; |
15307 |
- |
15308 |
- BUFFER_TRACE(ent->bh, "get write access"); |
15309 |
- retval = ext4_journal_get_write_access(handle, ent->bh); |
15310 |
-@@ -3543,19 +3551,19 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent, |
15311 |
- inode_inc_iversion(ent->dir); |
15312 |
- ent->dir->i_ctime = ent->dir->i_mtime = |
15313 |
- current_time(ent->dir); |
15314 |
-- ext4_mark_inode_dirty(handle, ent->dir); |
15315 |
-+ retval = ext4_mark_inode_dirty(handle, ent->dir); |
15316 |
- BUFFER_TRACE(ent->bh, "call ext4_handle_dirty_metadata"); |
15317 |
- if (!ent->inlined) { |
15318 |
-- retval = ext4_handle_dirty_dirblock(handle, ent->dir, ent->bh); |
15319 |
-- if (unlikely(retval)) { |
15320 |
-- ext4_std_error(ent->dir->i_sb, retval); |
15321 |
-- return retval; |
15322 |
-+ retval2 = ext4_handle_dirty_dirblock(handle, ent->dir, ent->bh); |
15323 |
-+ if (unlikely(retval2)) { |
15324 |
-+ ext4_std_error(ent->dir->i_sb, retval2); |
15325 |
-+ return retval2; |
15326 |
- } |
15327 |
- } |
15328 |
- brelse(ent->bh); |
15329 |
- ent->bh = NULL; |
15330 |
- |
15331 |
-- return 0; |
15332 |
-+ return retval; |
15333 |
- } |
15334 |
- |
15335 |
- static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, |
15336 |
-@@ -3790,7 +3798,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
15337 |
- EXT4_FT_CHRDEV); |
15338 |
- if (retval) |
15339 |
- goto end_rename; |
15340 |
-- ext4_mark_inode_dirty(handle, whiteout); |
15341 |
-+ retval = ext4_mark_inode_dirty(handle, whiteout); |
15342 |
-+ if (unlikely(retval)) |
15343 |
-+ goto end_rename; |
15344 |
- } |
15345 |
- if (!new.bh) { |
15346 |
- retval = ext4_add_entry(handle, new.dentry, old.inode); |
15347 |
-@@ -3811,7 +3821,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
15348 |
- * rename. |
15349 |
- */ |
15350 |
- old.inode->i_ctime = current_time(old.inode); |
15351 |
-- ext4_mark_inode_dirty(handle, old.inode); |
15352 |
-+ retval = ext4_mark_inode_dirty(handle, old.inode); |
15353 |
-+ if (unlikely(retval)) |
15354 |
-+ goto end_rename; |
15355 |
- |
15356 |
- if (!whiteout) { |
15357 |
- /* |
15358 |
-@@ -3840,12 +3852,18 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
15359 |
- } else { |
15360 |
- ext4_inc_count(handle, new.dir); |
15361 |
- ext4_update_dx_flag(new.dir); |
15362 |
-- ext4_mark_inode_dirty(handle, new.dir); |
15363 |
-+ retval = ext4_mark_inode_dirty(handle, new.dir); |
15364 |
-+ if (unlikely(retval)) |
15365 |
-+ goto end_rename; |
15366 |
- } |
15367 |
- } |
15368 |
-- ext4_mark_inode_dirty(handle, old.dir); |
15369 |
-+ retval = ext4_mark_inode_dirty(handle, old.dir); |
15370 |
-+ if (unlikely(retval)) |
15371 |
-+ goto end_rename; |
15372 |
- if (new.inode) { |
15373 |
-- ext4_mark_inode_dirty(handle, new.inode); |
15374 |
-+ retval = ext4_mark_inode_dirty(handle, new.inode); |
15375 |
-+ if (unlikely(retval)) |
15376 |
-+ goto end_rename; |
15377 |
- if (!new.inode->i_nlink) |
15378 |
- ext4_orphan_add(handle, new.inode); |
15379 |
- } |
15380 |
-@@ -3979,8 +3997,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, |
15381 |
- ctime = current_time(old.inode); |
15382 |
- old.inode->i_ctime = ctime; |
15383 |
- new.inode->i_ctime = ctime; |
15384 |
-- ext4_mark_inode_dirty(handle, old.inode); |
15385 |
-- ext4_mark_inode_dirty(handle, new.inode); |
15386 |
-+ retval = ext4_mark_inode_dirty(handle, old.inode); |
15387 |
-+ if (unlikely(retval)) |
15388 |
-+ goto end_rename; |
15389 |
-+ retval = ext4_mark_inode_dirty(handle, new.inode); |
15390 |
-+ if (unlikely(retval)) |
15391 |
-+ goto end_rename; |
15392 |
- |
15393 |
- if (old.dir_bh) { |
15394 |
- retval = ext4_rename_dir_finish(handle, &old, new.dir->i_ino); |
15395 |
-diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
15396 |
-index bf5fcb477f66..7318ca71b69e 100644 |
15397 |
---- a/fs/ext4/super.c |
15398 |
-+++ b/fs/ext4/super.c |
15399 |
-@@ -522,9 +522,6 @@ static void ext4_handle_error(struct super_block *sb) |
15400 |
- smp_wmb(); |
15401 |
- sb->s_flags |= SB_RDONLY; |
15402 |
- } else if (test_opt(sb, ERRORS_PANIC)) { |
15403 |
-- if (EXT4_SB(sb)->s_journal && |
15404 |
-- !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) |
15405 |
-- return; |
15406 |
- panic("EXT4-fs (device %s): panic forced after error\n", |
15407 |
- sb->s_id); |
15408 |
- } |
15409 |
-@@ -725,23 +722,20 @@ void __ext4_abort(struct super_block *sb, const char *function, |
15410 |
- va_end(args); |
15411 |
- |
15412 |
- if (sb_rdonly(sb) == 0) { |
15413 |
-- ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); |
15414 |
- EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; |
15415 |
-+ if (EXT4_SB(sb)->s_journal) |
15416 |
-+ jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); |
15417 |
-+ |
15418 |
-+ ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); |
15419 |
- /* |
15420 |
- * Make sure updated value of ->s_mount_flags will be visible |
15421 |
- * before ->s_flags update |
15422 |
- */ |
15423 |
- smp_wmb(); |
15424 |
- sb->s_flags |= SB_RDONLY; |
15425 |
-- if (EXT4_SB(sb)->s_journal) |
15426 |
-- jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); |
15427 |
- } |
15428 |
-- if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) { |
15429 |
-- if (EXT4_SB(sb)->s_journal && |
15430 |
-- !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) |
15431 |
-- return; |
15432 |
-+ if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) |
15433 |
- panic("EXT4-fs panic from previous error\n"); |
15434 |
-- } |
15435 |
- } |
15436 |
- |
15437 |
- void __ext4_msg(struct super_block *sb, |
15438 |
-@@ -2086,6 +2080,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, |
15439 |
- #endif |
15440 |
- } else if (token == Opt_dax) { |
15441 |
- #ifdef CONFIG_FS_DAX |
15442 |
-+ if (is_remount && test_opt(sb, DAX)) { |
15443 |
-+ ext4_msg(sb, KERN_ERR, "can't mount with " |
15444 |
-+ "both data=journal and dax"); |
15445 |
-+ return -1; |
15446 |
-+ } |
15447 |
-+ if (is_remount && !(sbi->s_mount_opt & EXT4_MOUNT_DAX)) { |
15448 |
-+ ext4_msg(sb, KERN_ERR, "can't change " |
15449 |
-+ "dax mount option while remounting"); |
15450 |
-+ return -1; |
15451 |
-+ } |
15452 |
- ext4_msg(sb, KERN_WARNING, |
15453 |
- "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); |
15454 |
- sbi->s_mount_opt |= m->mount_opt; |
15455 |
-@@ -2344,6 +2348,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, |
15456 |
- ext4_msg(sb, KERN_ERR, "revision level too high, " |
15457 |
- "forcing read-only mode"); |
15458 |
- err = -EROFS; |
15459 |
-+ goto done; |
15460 |
- } |
15461 |
- if (read_only) |
15462 |
- goto done; |
15463 |
-@@ -5412,12 +5417,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
15464 |
- err = -EINVAL; |
15465 |
- goto restore_opts; |
15466 |
- } |
15467 |
-- if (test_opt(sb, DAX)) { |
15468 |
-- ext4_msg(sb, KERN_ERR, "can't mount with " |
15469 |
-- "both data=journal and dax"); |
15470 |
-- err = -EINVAL; |
15471 |
-- goto restore_opts; |
15472 |
-- } |
15473 |
- } else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) { |
15474 |
- if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { |
15475 |
- ext4_msg(sb, KERN_ERR, "can't mount with " |
15476 |
-@@ -5433,12 +5432,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
15477 |
- goto restore_opts; |
15478 |
- } |
15479 |
- |
15480 |
-- if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX) { |
15481 |
-- ext4_msg(sb, KERN_WARNING, "warning: refusing change of " |
15482 |
-- "dax flag with busy inodes while remounting"); |
15483 |
-- sbi->s_mount_opt ^= EXT4_MOUNT_DAX; |
15484 |
-- } |
15485 |
-- |
15486 |
- if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) |
15487 |
- ext4_abort(sb, EXT4_ERR_ESHUTDOWN, "Abort forced by user"); |
15488 |
- |
15489 |
-@@ -5885,7 +5878,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
15490 |
- EXT4_I(inode)->i_flags |= EXT4_NOATIME_FL | EXT4_IMMUTABLE_FL; |
15491 |
- inode_set_flags(inode, S_NOATIME | S_IMMUTABLE, |
15492 |
- S_NOATIME | S_IMMUTABLE); |
15493 |
-- ext4_mark_inode_dirty(handle, inode); |
15494 |
-+ err = ext4_mark_inode_dirty(handle, inode); |
15495 |
- ext4_journal_stop(handle); |
15496 |
- unlock_inode: |
15497 |
- inode_unlock(inode); |
15498 |
-@@ -5987,12 +5980,14 @@ static int ext4_quota_off(struct super_block *sb, int type) |
15499 |
- * this is not a hard failure and quotas are already disabled. |
15500 |
- */ |
15501 |
- handle = ext4_journal_start(inode, EXT4_HT_QUOTA, 1); |
15502 |
-- if (IS_ERR(handle)) |
15503 |
-+ if (IS_ERR(handle)) { |
15504 |
-+ err = PTR_ERR(handle); |
15505 |
- goto out_unlock; |
15506 |
-+ } |
15507 |
- EXT4_I(inode)->i_flags &= ~(EXT4_NOATIME_FL | EXT4_IMMUTABLE_FL); |
15508 |
- inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE); |
15509 |
- inode->i_mtime = inode->i_ctime = current_time(inode); |
15510 |
-- ext4_mark_inode_dirty(handle, inode); |
15511 |
-+ err = ext4_mark_inode_dirty(handle, inode); |
15512 |
- ext4_journal_stop(handle); |
15513 |
- out_unlock: |
15514 |
- inode_unlock(inode); |
15515 |
-@@ -6050,7 +6045,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, |
15516 |
- { |
15517 |
- struct inode *inode = sb_dqopt(sb)->files[type]; |
15518 |
- ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); |
15519 |
-- int err, offset = off & (sb->s_blocksize - 1); |
15520 |
-+ int err = 0, err2 = 0, offset = off & (sb->s_blocksize - 1); |
15521 |
- int retries = 0; |
15522 |
- struct buffer_head *bh; |
15523 |
- handle_t *handle = journal_current_handle(); |
15524 |
-@@ -6098,9 +6093,11 @@ out: |
15525 |
- if (inode->i_size < off + len) { |
15526 |
- i_size_write(inode, off + len); |
15527 |
- EXT4_I(inode)->i_disksize = inode->i_size; |
15528 |
-- ext4_mark_inode_dirty(handle, inode); |
15529 |
-+ err2 = ext4_mark_inode_dirty(handle, inode); |
15530 |
-+ if (unlikely(err2 && !err)) |
15531 |
-+ err = err2; |
15532 |
- } |
15533 |
-- return len; |
15534 |
-+ return err ? err : len; |
15535 |
- } |
15536 |
- #endif |
15537 |
- |
15538 |
-diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c |
15539 |
-index 01ba66373e97..9b29a40738ac 100644 |
15540 |
---- a/fs/ext4/xattr.c |
15541 |
-+++ b/fs/ext4/xattr.c |
15542 |
-@@ -1327,7 +1327,7 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode, |
15543 |
- int blocksize = ea_inode->i_sb->s_blocksize; |
15544 |
- int max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits; |
15545 |
- int csize, wsize = 0; |
15546 |
-- int ret = 0; |
15547 |
-+ int ret = 0, ret2 = 0; |
15548 |
- int retries = 0; |
15549 |
- |
15550 |
- retry: |
15551 |
-@@ -1385,7 +1385,9 @@ retry: |
15552 |
- ext4_update_i_disksize(ea_inode, wsize); |
15553 |
- inode_unlock(ea_inode); |
15554 |
- |
15555 |
-- ext4_mark_inode_dirty(handle, ea_inode); |
15556 |
-+ ret2 = ext4_mark_inode_dirty(handle, ea_inode); |
15557 |
-+ if (unlikely(ret2 && !ret)) |
15558 |
-+ ret = ret2; |
15559 |
- |
15560 |
- out: |
15561 |
- brelse(bh); |
15562 |
-diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
15563 |
-index 852890b72d6a..448b3dc6f925 100644 |
15564 |
---- a/fs/f2fs/checkpoint.c |
15565 |
-+++ b/fs/f2fs/checkpoint.c |
15566 |
-@@ -889,8 +889,8 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi) |
15567 |
- int i; |
15568 |
- int err; |
15569 |
- |
15570 |
-- sbi->ckpt = f2fs_kzalloc(sbi, array_size(blk_size, cp_blks), |
15571 |
-- GFP_KERNEL); |
15572 |
-+ sbi->ckpt = f2fs_kvzalloc(sbi, array_size(blk_size, cp_blks), |
15573 |
-+ GFP_KERNEL); |
15574 |
- if (!sbi->ckpt) |
15575 |
- return -ENOMEM; |
15576 |
- /* |
15577 |
-diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c |
15578 |
-index df7b2d15eacd..a5b2e72174bb 100644 |
15579 |
---- a/fs/f2fs/compress.c |
15580 |
-+++ b/fs/f2fs/compress.c |
15581 |
-@@ -236,7 +236,12 @@ static int lz4_init_compress_ctx(struct compress_ctx *cc) |
15582 |
- if (!cc->private) |
15583 |
- return -ENOMEM; |
15584 |
- |
15585 |
-- cc->clen = LZ4_compressBound(PAGE_SIZE << cc->log_cluster_size); |
15586 |
-+ /* |
15587 |
-+ * we do not change cc->clen to LZ4_compressBound(inputsize) to |
15588 |
-+ * adapt worst compress case, because lz4 compressor can handle |
15589 |
-+ * output budget properly. |
15590 |
-+ */ |
15591 |
-+ cc->clen = cc->rlen - PAGE_SIZE - COMPRESS_HEADER_SIZE; |
15592 |
- return 0; |
15593 |
- } |
15594 |
- |
15595 |
-@@ -252,11 +257,9 @@ static int lz4_compress_pages(struct compress_ctx *cc) |
15596 |
- |
15597 |
- len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, |
15598 |
- cc->clen, cc->private); |
15599 |
-- if (!len) { |
15600 |
-- printk_ratelimited("%sF2FS-fs (%s): lz4 compress failed\n", |
15601 |
-- KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id); |
15602 |
-- return -EIO; |
15603 |
-- } |
15604 |
-+ if (!len) |
15605 |
-+ return -EAGAIN; |
15606 |
-+ |
15607 |
- cc->clen = len; |
15608 |
- return 0; |
15609 |
- } |
15610 |
-@@ -366,6 +369,13 @@ static int zstd_compress_pages(struct compress_ctx *cc) |
15611 |
- return -EIO; |
15612 |
- } |
15613 |
- |
15614 |
-+ /* |
15615 |
-+ * there is compressed data remained in intermediate buffer due to |
15616 |
-+ * no more space in cbuf.cdata |
15617 |
-+ */ |
15618 |
-+ if (ret) |
15619 |
-+ return -EAGAIN; |
15620 |
-+ |
15621 |
- cc->clen = outbuf.pos; |
15622 |
- return 0; |
15623 |
- } |
15624 |
-diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
15625 |
-index cdf2f626bea7..10491ae1cb85 100644 |
15626 |
---- a/fs/f2fs/data.c |
15627 |
-+++ b/fs/f2fs/data.c |
15628 |
-@@ -2130,16 +2130,16 @@ submit_and_realloc: |
15629 |
- page->index, for_write); |
15630 |
- if (IS_ERR(bio)) { |
15631 |
- ret = PTR_ERR(bio); |
15632 |
-- bio = NULL; |
15633 |
- dic->failed = true; |
15634 |
- if (refcount_sub_and_test(dic->nr_cpages - i, |
15635 |
-- &dic->ref)) |
15636 |
-+ &dic->ref)) { |
15637 |
- f2fs_decompress_end_io(dic->rpages, |
15638 |
- cc->cluster_size, true, |
15639 |
- false); |
15640 |
-- f2fs_free_dic(dic); |
15641 |
-+ f2fs_free_dic(dic); |
15642 |
-+ } |
15643 |
- f2fs_put_dnode(&dn); |
15644 |
-- *bio_ret = bio; |
15645 |
-+ *bio_ret = NULL; |
15646 |
- return ret; |
15647 |
- } |
15648 |
- } |
15649 |
-diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c |
15650 |
-index 44bfc464df78..54e90dbb09e7 100644 |
15651 |
---- a/fs/f2fs/dir.c |
15652 |
-+++ b/fs/f2fs/dir.c |
15653 |
-@@ -107,36 +107,28 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, |
15654 |
- /* |
15655 |
- * Test whether a case-insensitive directory entry matches the filename |
15656 |
- * being searched for. |
15657 |
-- * |
15658 |
-- * Returns: 0 if the directory entry matches, more than 0 if it |
15659 |
-- * doesn't match or less than zero on error. |
15660 |
- */ |
15661 |
--int f2fs_ci_compare(const struct inode *parent, const struct qstr *name, |
15662 |
-- const struct qstr *entry, bool quick) |
15663 |
-+static bool f2fs_match_ci_name(const struct inode *dir, const struct qstr *name, |
15664 |
-+ const struct qstr *entry, bool quick) |
15665 |
- { |
15666 |
-- const struct f2fs_sb_info *sbi = F2FS_SB(parent->i_sb); |
15667 |
-+ const struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); |
15668 |
- const struct unicode_map *um = sbi->s_encoding; |
15669 |
-- int ret; |
15670 |
-+ int res; |
15671 |
- |
15672 |
- if (quick) |
15673 |
-- ret = utf8_strncasecmp_folded(um, name, entry); |
15674 |
-+ res = utf8_strncasecmp_folded(um, name, entry); |
15675 |
- else |
15676 |
-- ret = utf8_strncasecmp(um, name, entry); |
15677 |
-- |
15678 |
-- if (ret < 0) { |
15679 |
-- /* Handle invalid character sequence as either an error |
15680 |
-- * or as an opaque byte sequence. |
15681 |
-+ res = utf8_strncasecmp(um, name, entry); |
15682 |
-+ if (res < 0) { |
15683 |
-+ /* |
15684 |
-+ * In strict mode, ignore invalid names. In non-strict mode, |
15685 |
-+ * fall back to treating them as opaque byte sequences. |
15686 |
- */ |
15687 |
-- if (f2fs_has_strict_mode(sbi)) |
15688 |
-- return -EINVAL; |
15689 |
-- |
15690 |
-- if (name->len != entry->len) |
15691 |
-- return 1; |
15692 |
-- |
15693 |
-- return !!memcmp(name->name, entry->name, name->len); |
15694 |
-+ if (f2fs_has_strict_mode(sbi) || name->len != entry->len) |
15695 |
-+ return false; |
15696 |
-+ return !memcmp(name->name, entry->name, name->len); |
15697 |
- } |
15698 |
-- |
15699 |
-- return ret; |
15700 |
-+ return res == 0; |
15701 |
- } |
15702 |
- |
15703 |
- static void f2fs_fname_setup_ci_filename(struct inode *dir, |
15704 |
-@@ -188,10 +180,10 @@ static inline bool f2fs_match_name(struct f2fs_dentry_ptr *d, |
15705 |
- if (cf_str->name) { |
15706 |
- struct qstr cf = {.name = cf_str->name, |
15707 |
- .len = cf_str->len}; |
15708 |
-- return !f2fs_ci_compare(parent, &cf, &entry, true); |
15709 |
-+ return f2fs_match_ci_name(parent, &cf, &entry, true); |
15710 |
- } |
15711 |
-- return !f2fs_ci_compare(parent, fname->usr_fname, &entry, |
15712 |
-- false); |
15713 |
-+ return f2fs_match_ci_name(parent, fname->usr_fname, &entry, |
15714 |
-+ false); |
15715 |
- } |
15716 |
- #endif |
15717 |
- if (fscrypt_match_name(fname, d->filename[bit_pos], |
15718 |
-@@ -1080,17 +1072,41 @@ const struct file_operations f2fs_dir_operations = { |
15719 |
- static int f2fs_d_compare(const struct dentry *dentry, unsigned int len, |
15720 |
- const char *str, const struct qstr *name) |
15721 |
- { |
15722 |
-- struct qstr qstr = {.name = str, .len = len }; |
15723 |
- const struct dentry *parent = READ_ONCE(dentry->d_parent); |
15724 |
-- const struct inode *inode = READ_ONCE(parent->d_inode); |
15725 |
-+ const struct inode *dir = READ_ONCE(parent->d_inode); |
15726 |
-+ const struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); |
15727 |
-+ struct qstr entry = QSTR_INIT(str, len); |
15728 |
-+ char strbuf[DNAME_INLINE_LEN]; |
15729 |
-+ int res; |
15730 |
-+ |
15731 |
-+ if (!dir || !IS_CASEFOLDED(dir)) |
15732 |
-+ goto fallback; |
15733 |
- |
15734 |
-- if (!inode || !IS_CASEFOLDED(inode)) { |
15735 |
-- if (len != name->len) |
15736 |
-- return -1; |
15737 |
-- return memcmp(str, name->name, len); |
15738 |
-+ /* |
15739 |
-+ * If the dentry name is stored in-line, then it may be concurrently |
15740 |
-+ * modified by a rename. If this happens, the VFS will eventually retry |
15741 |
-+ * the lookup, so it doesn't matter what ->d_compare() returns. |
15742 |
-+ * However, it's unsafe to call utf8_strncasecmp() with an unstable |
15743 |
-+ * string. Therefore, we have to copy the name into a temporary buffer. |
15744 |
-+ */ |
15745 |
-+ if (len <= DNAME_INLINE_LEN - 1) { |
15746 |
-+ memcpy(strbuf, str, len); |
15747 |
-+ strbuf[len] = 0; |
15748 |
-+ entry.name = strbuf; |
15749 |
-+ /* prevent compiler from optimizing out the temporary buffer */ |
15750 |
-+ barrier(); |
15751 |
- } |
15752 |
- |
15753 |
-- return f2fs_ci_compare(inode, name, &qstr, false); |
15754 |
-+ res = utf8_strncasecmp(sbi->s_encoding, name, &entry); |
15755 |
-+ if (res >= 0) |
15756 |
-+ return res; |
15757 |
-+ |
15758 |
-+ if (f2fs_has_strict_mode(sbi)) |
15759 |
-+ return -EINVAL; |
15760 |
-+fallback: |
15761 |
-+ if (len != name->len) |
15762 |
-+ return 1; |
15763 |
-+ return !!memcmp(str, name->name, len); |
15764 |
- } |
15765 |
- |
15766 |
- static int f2fs_d_hash(const struct dentry *dentry, struct qstr *str) |
15767 |
-diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
15768 |
-index 7c5dd7f666a0..5a0f95dfbac2 100644 |
15769 |
---- a/fs/f2fs/f2fs.h |
15770 |
-+++ b/fs/f2fs/f2fs.h |
15771 |
-@@ -2936,18 +2936,12 @@ static inline bool f2fs_may_extent_tree(struct inode *inode) |
15772 |
- static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, |
15773 |
- size_t size, gfp_t flags) |
15774 |
- { |
15775 |
-- void *ret; |
15776 |
-- |
15777 |
- if (time_to_inject(sbi, FAULT_KMALLOC)) { |
15778 |
- f2fs_show_injection_info(sbi, FAULT_KMALLOC); |
15779 |
- return NULL; |
15780 |
- } |
15781 |
- |
15782 |
-- ret = kmalloc(size, flags); |
15783 |
-- if (ret) |
15784 |
-- return ret; |
15785 |
-- |
15786 |
-- return kvmalloc(size, flags); |
15787 |
-+ return kmalloc(size, flags); |
15788 |
- } |
15789 |
- |
15790 |
- static inline void *f2fs_kzalloc(struct f2fs_sb_info *sbi, |
15791 |
-@@ -3107,11 +3101,6 @@ int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, |
15792 |
- bool hot, bool set); |
15793 |
- struct dentry *f2fs_get_parent(struct dentry *child); |
15794 |
- |
15795 |
--extern int f2fs_ci_compare(const struct inode *parent, |
15796 |
-- const struct qstr *name, |
15797 |
-- const struct qstr *entry, |
15798 |
-- bool quick); |
15799 |
-- |
15800 |
- /* |
15801 |
- * dir.c |
15802 |
- */ |
15803 |
-@@ -3656,7 +3645,7 @@ static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } |
15804 |
- static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } |
15805 |
- static inline void __init f2fs_create_root_stats(void) { } |
15806 |
- static inline void f2fs_destroy_root_stats(void) { } |
15807 |
--static inline void update_sit_info(struct f2fs_sb_info *sbi) {} |
15808 |
-+static inline void f2fs_update_sit_info(struct f2fs_sb_info *sbi) {} |
15809 |
- #endif |
15810 |
- |
15811 |
- extern const struct file_operations f2fs_dir_operations; |
15812 |
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
15813 |
-index 6ab8f621a3c5..30b35915fa3a 100644 |
15814 |
---- a/fs/f2fs/file.c |
15815 |
-+++ b/fs/f2fs/file.c |
15816 |
-@@ -2219,8 +2219,15 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) |
15817 |
- |
15818 |
- if (in != F2FS_GOING_DOWN_FULLSYNC) { |
15819 |
- ret = mnt_want_write_file(filp); |
15820 |
-- if (ret) |
15821 |
-+ if (ret) { |
15822 |
-+ if (ret == -EROFS) { |
15823 |
-+ ret = 0; |
15824 |
-+ f2fs_stop_checkpoint(sbi, false); |
15825 |
-+ set_sbi_flag(sbi, SBI_IS_SHUTDOWN); |
15826 |
-+ trace_f2fs_shutdown(sbi, in, ret); |
15827 |
-+ } |
15828 |
- return ret; |
15829 |
-+ } |
15830 |
- } |
15831 |
- |
15832 |
- switch (in) { |
15833 |
-diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
15834 |
-index ecbd6bd14a49..daf531e69b67 100644 |
15835 |
---- a/fs/f2fs/node.c |
15836 |
-+++ b/fs/f2fs/node.c |
15837 |
-@@ -2928,7 +2928,7 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) |
15838 |
- return 0; |
15839 |
- |
15840 |
- nm_i->nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8); |
15841 |
-- nm_i->nat_bits = f2fs_kzalloc(sbi, |
15842 |
-+ nm_i->nat_bits = f2fs_kvzalloc(sbi, |
15843 |
- nm_i->nat_bits_blocks << F2FS_BLKSIZE_BITS, GFP_KERNEL); |
15844 |
- if (!nm_i->nat_bits) |
15845 |
- return -ENOMEM; |
15846 |
-@@ -3061,9 +3061,9 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi) |
15847 |
- int i; |
15848 |
- |
15849 |
- nm_i->free_nid_bitmap = |
15850 |
-- f2fs_kzalloc(sbi, array_size(sizeof(unsigned char *), |
15851 |
-- nm_i->nat_blocks), |
15852 |
-- GFP_KERNEL); |
15853 |
-+ f2fs_kvzalloc(sbi, array_size(sizeof(unsigned char *), |
15854 |
-+ nm_i->nat_blocks), |
15855 |
-+ GFP_KERNEL); |
15856 |
- if (!nm_i->free_nid_bitmap) |
15857 |
- return -ENOMEM; |
15858 |
- |
15859 |
-diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
15860 |
-index 56ccb8323e21..4696c9cb47a5 100644 |
15861 |
---- a/fs/f2fs/super.c |
15862 |
-+++ b/fs/f2fs/super.c |
15863 |
-@@ -1303,7 +1303,8 @@ static int f2fs_statfs_project(struct super_block *sb, |
15864 |
- limit >>= sb->s_blocksize_bits; |
15865 |
- |
15866 |
- if (limit && buf->f_blocks > limit) { |
15867 |
-- curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; |
15868 |
-+ curblock = (dquot->dq_dqb.dqb_curspace + |
15869 |
-+ dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; |
15870 |
- buf->f_blocks = limit; |
15871 |
- buf->f_bfree = buf->f_bavail = |
15872 |
- (buf->f_blocks > curblock) ? |
15873 |
-@@ -3038,7 +3039,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi) |
15874 |
- if (nr_sectors & (bdev_zone_sectors(bdev) - 1)) |
15875 |
- FDEV(devi).nr_blkz++; |
15876 |
- |
15877 |
-- FDEV(devi).blkz_seq = f2fs_kzalloc(sbi, |
15878 |
-+ FDEV(devi).blkz_seq = f2fs_kvzalloc(sbi, |
15879 |
- BITS_TO_LONGS(FDEV(devi).nr_blkz) |
15880 |
- * sizeof(unsigned long), |
15881 |
- GFP_KERNEL); |
15882 |
-diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
15883 |
-index 97eec7522bf2..5c155437a455 100644 |
15884 |
---- a/fs/fuse/dev.c |
15885 |
-+++ b/fs/fuse/dev.c |
15886 |
-@@ -1977,8 +1977,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, |
15887 |
- struct pipe_buffer *ibuf; |
15888 |
- struct pipe_buffer *obuf; |
15889 |
- |
15890 |
-- BUG_ON(nbuf >= pipe->ring_size); |
15891 |
-- BUG_ON(tail == head); |
15892 |
-+ if (WARN_ON(nbuf >= count || tail == head)) |
15893 |
-+ goto out_free; |
15894 |
-+ |
15895 |
- ibuf = &pipe->bufs[tail & mask]; |
15896 |
- obuf = &bufs[nbuf]; |
15897 |
- |
15898 |
-diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
15899 |
-index 9d67b830fb7a..e3afceecaa6b 100644 |
15900 |
---- a/fs/fuse/file.c |
15901 |
-+++ b/fs/fuse/file.c |
15902 |
-@@ -712,6 +712,7 @@ static ssize_t fuse_async_req_send(struct fuse_conn *fc, |
15903 |
- spin_unlock(&io->lock); |
15904 |
- |
15905 |
- ia->ap.args.end = fuse_aio_complete_req; |
15906 |
-+ ia->ap.args.may_block = io->should_dirty; |
15907 |
- err = fuse_simple_background(fc, &ia->ap.args, GFP_KERNEL); |
15908 |
- if (err) |
15909 |
- fuse_aio_complete_req(fc, &ia->ap.args, err); |
15910 |
-@@ -3279,13 +3280,11 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
15911 |
- if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb) |
15912 |
- return -EXDEV; |
15913 |
- |
15914 |
-- if (fc->writeback_cache) { |
15915 |
-- inode_lock(inode_in); |
15916 |
-- err = fuse_writeback_range(inode_in, pos_in, pos_in + len); |
15917 |
-- inode_unlock(inode_in); |
15918 |
-- if (err) |
15919 |
-- return err; |
15920 |
-- } |
15921 |
-+ inode_lock(inode_in); |
15922 |
-+ err = fuse_writeback_range(inode_in, pos_in, pos_in + len - 1); |
15923 |
-+ inode_unlock(inode_in); |
15924 |
-+ if (err) |
15925 |
-+ return err; |
15926 |
- |
15927 |
- inode_lock(inode_out); |
15928 |
- |
15929 |
-@@ -3293,11 +3292,27 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
15930 |
- if (err) |
15931 |
- goto out; |
15932 |
- |
15933 |
-- if (fc->writeback_cache) { |
15934 |
-- err = fuse_writeback_range(inode_out, pos_out, pos_out + len); |
15935 |
-- if (err) |
15936 |
-- goto out; |
15937 |
-- } |
15938 |
-+ /* |
15939 |
-+ * Write out dirty pages in the destination file before sending the COPY |
15940 |
-+ * request to userspace. After the request is completed, truncate off |
15941 |
-+ * pages (including partial ones) from the cache that have been copied, |
15942 |
-+ * since these contain stale data at that point. |
15943 |
-+ * |
15944 |
-+ * This should be mostly correct, but if the COPY writes to partial |
15945 |
-+ * pages (at the start or end) and the parts not covered by the COPY are |
15946 |
-+ * written through a memory map after calling fuse_writeback_range(), |
15947 |
-+ * then these partial page modifications will be lost on truncation. |
15948 |
-+ * |
15949 |
-+ * It is unlikely that someone would rely on such mixed style |
15950 |
-+ * modifications. Yet this does give less guarantees than if the |
15951 |
-+ * copying was performed with write(2). |
15952 |
-+ * |
15953 |
-+ * To fix this a i_mmap_sem style lock could be used to prevent new |
15954 |
-+ * faults while the copy is ongoing. |
15955 |
-+ */ |
15956 |
-+ err = fuse_writeback_range(inode_out, pos_out, pos_out + len - 1); |
15957 |
-+ if (err) |
15958 |
-+ goto out; |
15959 |
- |
15960 |
- if (is_unstable) |
15961 |
- set_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state); |
15962 |
-@@ -3318,6 +3333,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, |
15963 |
- if (err) |
15964 |
- goto out; |
15965 |
- |
15966 |
-+ truncate_inode_pages_range(inode_out->i_mapping, |
15967 |
-+ ALIGN_DOWN(pos_out, PAGE_SIZE), |
15968 |
-+ ALIGN(pos_out + outarg.size, PAGE_SIZE) - 1); |
15969 |
-+ |
15970 |
- if (fc->writeback_cache) { |
15971 |
- fuse_write_update_size(inode_out, pos_out + outarg.size); |
15972 |
- file_update_time(file_out); |
15973 |
-diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
15974 |
-index ca344bf71404..d7cde216fc87 100644 |
15975 |
---- a/fs/fuse/fuse_i.h |
15976 |
-+++ b/fs/fuse/fuse_i.h |
15977 |
-@@ -249,6 +249,7 @@ struct fuse_args { |
15978 |
- bool out_argvar:1; |
15979 |
- bool page_zeroing:1; |
15980 |
- bool page_replace:1; |
15981 |
-+ bool may_block:1; |
15982 |
- struct fuse_in_arg in_args[3]; |
15983 |
- struct fuse_arg out_args[2]; |
15984 |
- void (*end)(struct fuse_conn *fc, struct fuse_args *args, int error); |
15985 |
-diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c |
15986 |
-index bade74768903..0c6ef5d3c6ab 100644 |
15987 |
---- a/fs/fuse/virtio_fs.c |
15988 |
-+++ b/fs/fuse/virtio_fs.c |
15989 |
-@@ -60,6 +60,12 @@ struct virtio_fs_forget { |
15990 |
- struct virtio_fs_forget_req req; |
15991 |
- }; |
15992 |
- |
15993 |
-+struct virtio_fs_req_work { |
15994 |
-+ struct fuse_req *req; |
15995 |
-+ struct virtio_fs_vq *fsvq; |
15996 |
-+ struct work_struct done_work; |
15997 |
-+}; |
15998 |
-+ |
15999 |
- static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq, |
16000 |
- struct fuse_req *req, bool in_flight); |
16001 |
- |
16002 |
-@@ -485,19 +491,67 @@ static void copy_args_from_argbuf(struct fuse_args *args, struct fuse_req *req) |
16003 |
- } |
16004 |
- |
16005 |
- /* Work function for request completion */ |
16006 |
-+static void virtio_fs_request_complete(struct fuse_req *req, |
16007 |
-+ struct virtio_fs_vq *fsvq) |
16008 |
-+{ |
16009 |
-+ struct fuse_pqueue *fpq = &fsvq->fud->pq; |
16010 |
-+ struct fuse_conn *fc = fsvq->fud->fc; |
16011 |
-+ struct fuse_args *args; |
16012 |
-+ struct fuse_args_pages *ap; |
16013 |
-+ unsigned int len, i, thislen; |
16014 |
-+ struct page *page; |
16015 |
-+ |
16016 |
-+ /* |
16017 |
-+ * TODO verify that server properly follows FUSE protocol |
16018 |
-+ * (oh.uniq, oh.len) |
16019 |
-+ */ |
16020 |
-+ args = req->args; |
16021 |
-+ copy_args_from_argbuf(args, req); |
16022 |
-+ |
16023 |
-+ if (args->out_pages && args->page_zeroing) { |
16024 |
-+ len = args->out_args[args->out_numargs - 1].size; |
16025 |
-+ ap = container_of(args, typeof(*ap), args); |
16026 |
-+ for (i = 0; i < ap->num_pages; i++) { |
16027 |
-+ thislen = ap->descs[i].length; |
16028 |
-+ if (len < thislen) { |
16029 |
-+ WARN_ON(ap->descs[i].offset); |
16030 |
-+ page = ap->pages[i]; |
16031 |
-+ zero_user_segment(page, len, thislen); |
16032 |
-+ len = 0; |
16033 |
-+ } else { |
16034 |
-+ len -= thislen; |
16035 |
-+ } |
16036 |
-+ } |
16037 |
-+ } |
16038 |
-+ |
16039 |
-+ spin_lock(&fpq->lock); |
16040 |
-+ clear_bit(FR_SENT, &req->flags); |
16041 |
-+ spin_unlock(&fpq->lock); |
16042 |
-+ |
16043 |
-+ fuse_request_end(fc, req); |
16044 |
-+ spin_lock(&fsvq->lock); |
16045 |
-+ dec_in_flight_req(fsvq); |
16046 |
-+ spin_unlock(&fsvq->lock); |
16047 |
-+} |
16048 |
-+ |
16049 |
-+static void virtio_fs_complete_req_work(struct work_struct *work) |
16050 |
-+{ |
16051 |
-+ struct virtio_fs_req_work *w = |
16052 |
-+ container_of(work, typeof(*w), done_work); |
16053 |
-+ |
16054 |
-+ virtio_fs_request_complete(w->req, w->fsvq); |
16055 |
-+ kfree(w); |
16056 |
-+} |
16057 |
-+ |
16058 |
- static void virtio_fs_requests_done_work(struct work_struct *work) |
16059 |
- { |
16060 |
- struct virtio_fs_vq *fsvq = container_of(work, struct virtio_fs_vq, |
16061 |
- done_work); |
16062 |
- struct fuse_pqueue *fpq = &fsvq->fud->pq; |
16063 |
-- struct fuse_conn *fc = fsvq->fud->fc; |
16064 |
- struct virtqueue *vq = fsvq->vq; |
16065 |
- struct fuse_req *req; |
16066 |
-- struct fuse_args_pages *ap; |
16067 |
- struct fuse_req *next; |
16068 |
-- struct fuse_args *args; |
16069 |
-- unsigned int len, i, thislen; |
16070 |
-- struct page *page; |
16071 |
-+ unsigned int len; |
16072 |
- LIST_HEAD(reqs); |
16073 |
- |
16074 |
- /* Collect completed requests off the virtqueue */ |
16075 |
-@@ -515,38 +569,20 @@ static void virtio_fs_requests_done_work(struct work_struct *work) |
16076 |
- |
16077 |
- /* End requests */ |
16078 |
- list_for_each_entry_safe(req, next, &reqs, list) { |
16079 |
-- /* |
16080 |
-- * TODO verify that server properly follows FUSE protocol |
16081 |
-- * (oh.uniq, oh.len) |
16082 |
-- */ |
16083 |
-- args = req->args; |
16084 |
-- copy_args_from_argbuf(args, req); |
16085 |
-- |
16086 |
-- if (args->out_pages && args->page_zeroing) { |
16087 |
-- len = args->out_args[args->out_numargs - 1].size; |
16088 |
-- ap = container_of(args, typeof(*ap), args); |
16089 |
-- for (i = 0; i < ap->num_pages; i++) { |
16090 |
-- thislen = ap->descs[i].length; |
16091 |
-- if (len < thislen) { |
16092 |
-- WARN_ON(ap->descs[i].offset); |
16093 |
-- page = ap->pages[i]; |
16094 |
-- zero_user_segment(page, len, thislen); |
16095 |
-- len = 0; |
16096 |
-- } else { |
16097 |
-- len -= thislen; |
16098 |
-- } |
16099 |
-- } |
16100 |
-- } |
16101 |
-- |
16102 |
-- spin_lock(&fpq->lock); |
16103 |
-- clear_bit(FR_SENT, &req->flags); |
16104 |
- list_del_init(&req->list); |
16105 |
-- spin_unlock(&fpq->lock); |
16106 |
- |
16107 |
-- fuse_request_end(fc, req); |
16108 |
-- spin_lock(&fsvq->lock); |
16109 |
-- dec_in_flight_req(fsvq); |
16110 |
-- spin_unlock(&fsvq->lock); |
16111 |
-+ /* blocking async request completes in a worker context */ |
16112 |
-+ if (req->args->may_block) { |
16113 |
-+ struct virtio_fs_req_work *w; |
16114 |
-+ |
16115 |
-+ w = kzalloc(sizeof(*w), GFP_NOFS | __GFP_NOFAIL); |
16116 |
-+ INIT_WORK(&w->done_work, virtio_fs_complete_req_work); |
16117 |
-+ w->fsvq = fsvq; |
16118 |
-+ w->req = req; |
16119 |
-+ schedule_work(&w->done_work); |
16120 |
-+ } else { |
16121 |
-+ virtio_fs_request_complete(req, fsvq); |
16122 |
-+ } |
16123 |
- } |
16124 |
- } |
16125 |
- |
16126 |
-diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
16127 |
-index 0644e58c6191..b7a5221bea7d 100644 |
16128 |
---- a/fs/gfs2/log.c |
16129 |
-+++ b/fs/gfs2/log.c |
16130 |
-@@ -1003,8 +1003,10 @@ out: |
16131 |
- * @new: New transaction to be merged |
16132 |
- */ |
16133 |
- |
16134 |
--static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) |
16135 |
-+static void gfs2_merge_trans(struct gfs2_sbd *sdp, struct gfs2_trans *new) |
16136 |
- { |
16137 |
-+ struct gfs2_trans *old = sdp->sd_log_tr; |
16138 |
-+ |
16139 |
- WARN_ON_ONCE(!test_bit(TR_ATTACHED, &old->tr_flags)); |
16140 |
- |
16141 |
- old->tr_num_buf_new += new->tr_num_buf_new; |
16142 |
-@@ -1016,6 +1018,11 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) |
16143 |
- |
16144 |
- list_splice_tail_init(&new->tr_databuf, &old->tr_databuf); |
16145 |
- list_splice_tail_init(&new->tr_buf, &old->tr_buf); |
16146 |
-+ |
16147 |
-+ spin_lock(&sdp->sd_ail_lock); |
16148 |
-+ list_splice_tail_init(&new->tr_ail1_list, &old->tr_ail1_list); |
16149 |
-+ list_splice_tail_init(&new->tr_ail2_list, &old->tr_ail2_list); |
16150 |
-+ spin_unlock(&sdp->sd_ail_lock); |
16151 |
- } |
16152 |
- |
16153 |
- static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
16154 |
-@@ -1027,7 +1034,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
16155 |
- gfs2_log_lock(sdp); |
16156 |
- |
16157 |
- if (sdp->sd_log_tr) { |
16158 |
-- gfs2_merge_trans(sdp->sd_log_tr, tr); |
16159 |
-+ gfs2_merge_trans(sdp, tr); |
16160 |
- } else if (tr->tr_num_buf_new || tr->tr_num_databuf_new) { |
16161 |
- gfs2_assert_withdraw(sdp, test_bit(TR_ALLOCED, &tr->tr_flags)); |
16162 |
- sdp->sd_log_tr = tr; |
16163 |
-diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c |
16164 |
-index e2b69ffcc6a8..094f5fe7c009 100644 |
16165 |
---- a/fs/gfs2/ops_fstype.c |
16166 |
-+++ b/fs/gfs2/ops_fstype.c |
16167 |
-@@ -880,7 +880,7 @@ fail: |
16168 |
- } |
16169 |
- |
16170 |
- static const match_table_t nolock_tokens = { |
16171 |
-- { Opt_jid, "jid=%d\n", }, |
16172 |
-+ { Opt_jid, "jid=%d", }, |
16173 |
- { Opt_err, NULL }, |
16174 |
- }; |
16175 |
- |
16176 |
-diff --git a/fs/io_uring.c b/fs/io_uring.c |
16177 |
-index 2698e9b08490..1829be7f63a3 100644 |
16178 |
---- a/fs/io_uring.c |
16179 |
-+++ b/fs/io_uring.c |
16180 |
-@@ -513,7 +513,6 @@ enum { |
16181 |
- REQ_F_INFLIGHT_BIT, |
16182 |
- REQ_F_CUR_POS_BIT, |
16183 |
- REQ_F_NOWAIT_BIT, |
16184 |
-- REQ_F_IOPOLL_COMPLETED_BIT, |
16185 |
- REQ_F_LINK_TIMEOUT_BIT, |
16186 |
- REQ_F_TIMEOUT_BIT, |
16187 |
- REQ_F_ISREG_BIT, |
16188 |
-@@ -556,8 +555,6 @@ enum { |
16189 |
- REQ_F_CUR_POS = BIT(REQ_F_CUR_POS_BIT), |
16190 |
- /* must not punt to workers */ |
16191 |
- REQ_F_NOWAIT = BIT(REQ_F_NOWAIT_BIT), |
16192 |
-- /* polled IO has completed */ |
16193 |
-- REQ_F_IOPOLL_COMPLETED = BIT(REQ_F_IOPOLL_COMPLETED_BIT), |
16194 |
- /* has linked timeout */ |
16195 |
- REQ_F_LINK_TIMEOUT = BIT(REQ_F_LINK_TIMEOUT_BIT), |
16196 |
- /* timeout request */ |
16197 |
-@@ -618,6 +615,8 @@ struct io_kiocb { |
16198 |
- int cflags; |
16199 |
- bool needs_fixed_file; |
16200 |
- u8 opcode; |
16201 |
-+ /* polled IO has completed */ |
16202 |
-+ u8 iopoll_completed; |
16203 |
- |
16204 |
- u16 buf_index; |
16205 |
- |
16206 |
-@@ -1691,6 +1690,18 @@ static int io_put_kbuf(struct io_kiocb *req) |
16207 |
- return cflags; |
16208 |
- } |
16209 |
- |
16210 |
-+static void io_iopoll_queue(struct list_head *again) |
16211 |
-+{ |
16212 |
-+ struct io_kiocb *req; |
16213 |
-+ |
16214 |
-+ do { |
16215 |
-+ req = list_first_entry(again, struct io_kiocb, list); |
16216 |
-+ list_del(&req->list); |
16217 |
-+ refcount_inc(&req->refs); |
16218 |
-+ io_queue_async_work(req); |
16219 |
-+ } while (!list_empty(again)); |
16220 |
-+} |
16221 |
-+ |
16222 |
- /* |
16223 |
- * Find and free completed poll iocbs |
16224 |
- */ |
16225 |
-@@ -1699,12 +1710,21 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16226 |
- { |
16227 |
- struct req_batch rb; |
16228 |
- struct io_kiocb *req; |
16229 |
-+ LIST_HEAD(again); |
16230 |
-+ |
16231 |
-+ /* order with ->result store in io_complete_rw_iopoll() */ |
16232 |
-+ smp_rmb(); |
16233 |
- |
16234 |
- rb.to_free = rb.need_iter = 0; |
16235 |
- while (!list_empty(done)) { |
16236 |
- int cflags = 0; |
16237 |
- |
16238 |
- req = list_first_entry(done, struct io_kiocb, list); |
16239 |
-+ if (READ_ONCE(req->result) == -EAGAIN) { |
16240 |
-+ req->iopoll_completed = 0; |
16241 |
-+ list_move_tail(&req->list, &again); |
16242 |
-+ continue; |
16243 |
-+ } |
16244 |
- list_del(&req->list); |
16245 |
- |
16246 |
- if (req->flags & REQ_F_BUFFER_SELECTED) |
16247 |
-@@ -1722,18 +1742,9 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16248 |
- if (ctx->flags & IORING_SETUP_SQPOLL) |
16249 |
- io_cqring_ev_posted(ctx); |
16250 |
- io_free_req_many(ctx, &rb); |
16251 |
--} |
16252 |
- |
16253 |
--static void io_iopoll_queue(struct list_head *again) |
16254 |
--{ |
16255 |
-- struct io_kiocb *req; |
16256 |
-- |
16257 |
-- do { |
16258 |
-- req = list_first_entry(again, struct io_kiocb, list); |
16259 |
-- list_del(&req->list); |
16260 |
-- refcount_inc(&req->refs); |
16261 |
-- io_queue_async_work(req); |
16262 |
-- } while (!list_empty(again)); |
16263 |
-+ if (!list_empty(&again)) |
16264 |
-+ io_iopoll_queue(&again); |
16265 |
- } |
16266 |
- |
16267 |
- static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16268 |
-@@ -1741,7 +1752,6 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16269 |
- { |
16270 |
- struct io_kiocb *req, *tmp; |
16271 |
- LIST_HEAD(done); |
16272 |
-- LIST_HEAD(again); |
16273 |
- bool spin; |
16274 |
- int ret; |
16275 |
- |
16276 |
-@@ -1760,20 +1770,13 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16277 |
- * If we find a request that requires polling, break out |
16278 |
- * and complete those lists first, if we have entries there. |
16279 |
- */ |
16280 |
-- if (req->flags & REQ_F_IOPOLL_COMPLETED) { |
16281 |
-+ if (READ_ONCE(req->iopoll_completed)) { |
16282 |
- list_move_tail(&req->list, &done); |
16283 |
- continue; |
16284 |
- } |
16285 |
- if (!list_empty(&done)) |
16286 |
- break; |
16287 |
- |
16288 |
-- if (req->result == -EAGAIN) { |
16289 |
-- list_move_tail(&req->list, &again); |
16290 |
-- continue; |
16291 |
-- } |
16292 |
-- if (!list_empty(&again)) |
16293 |
-- break; |
16294 |
-- |
16295 |
- ret = kiocb->ki_filp->f_op->iopoll(kiocb, spin); |
16296 |
- if (ret < 0) |
16297 |
- break; |
16298 |
-@@ -1786,9 +1789,6 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, |
16299 |
- if (!list_empty(&done)) |
16300 |
- io_iopoll_complete(ctx, nr_events, &done); |
16301 |
- |
16302 |
-- if (!list_empty(&again)) |
16303 |
-- io_iopoll_queue(&again); |
16304 |
-- |
16305 |
- return ret; |
16306 |
- } |
16307 |
- |
16308 |
-@@ -1937,11 +1937,15 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) |
16309 |
- if (kiocb->ki_flags & IOCB_WRITE) |
16310 |
- kiocb_end_write(req); |
16311 |
- |
16312 |
-- if (res != req->result) |
16313 |
-+ if (res != -EAGAIN && res != req->result) |
16314 |
- req_set_fail_links(req); |
16315 |
-- req->result = res; |
16316 |
-- if (res != -EAGAIN) |
16317 |
-- req->flags |= REQ_F_IOPOLL_COMPLETED; |
16318 |
-+ |
16319 |
-+ WRITE_ONCE(req->result, res); |
16320 |
-+ /* order with io_poll_complete() checking ->result */ |
16321 |
-+ if (res != -EAGAIN) { |
16322 |
-+ smp_wmb(); |
16323 |
-+ WRITE_ONCE(req->iopoll_completed, 1); |
16324 |
-+ } |
16325 |
- } |
16326 |
- |
16327 |
- /* |
16328 |
-@@ -1974,7 +1978,7 @@ static void io_iopoll_req_issued(struct io_kiocb *req) |
16329 |
- * For fast devices, IO may have already completed. If it has, add |
16330 |
- * it to the front so we find it first. |
16331 |
- */ |
16332 |
-- if (req->flags & REQ_F_IOPOLL_COMPLETED) |
16333 |
-+ if (READ_ONCE(req->iopoll_completed)) |
16334 |
- list_add(&req->list, &ctx->poll_list); |
16335 |
- else |
16336 |
- list_add_tail(&req->list, &ctx->poll_list); |
16337 |
-@@ -2098,6 +2102,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, |
16338 |
- kiocb->ki_flags |= IOCB_HIPRI; |
16339 |
- kiocb->ki_complete = io_complete_rw_iopoll; |
16340 |
- req->result = 0; |
16341 |
-+ req->iopoll_completed = 0; |
16342 |
- } else { |
16343 |
- if (kiocb->ki_flags & IOCB_HIPRI) |
16344 |
- return -EINVAL; |
16345 |
-@@ -2609,8 +2614,8 @@ copy_iov: |
16346 |
- } |
16347 |
- } |
16348 |
- out_free: |
16349 |
-- kfree(iovec); |
16350 |
-- req->flags &= ~REQ_F_NEED_CLEANUP; |
16351 |
-+ if (!(req->flags & REQ_F_NEED_CLEANUP)) |
16352 |
-+ kfree(iovec); |
16353 |
- return ret; |
16354 |
- } |
16355 |
- |
16356 |
-@@ -2732,8 +2737,8 @@ copy_iov: |
16357 |
- } |
16358 |
- } |
16359 |
- out_free: |
16360 |
-- req->flags &= ~REQ_F_NEED_CLEANUP; |
16361 |
-- kfree(iovec); |
16362 |
-+ if (!(req->flags & REQ_F_NEED_CLEANUP)) |
16363 |
-+ kfree(iovec); |
16364 |
- return ret; |
16365 |
- } |
16366 |
- |
16367 |
-@@ -4297,6 +4302,28 @@ static void io_async_queue_proc(struct file *file, struct wait_queue_head *head, |
16368 |
- __io_queue_proc(&pt->req->apoll->poll, pt, head); |
16369 |
- } |
16370 |
- |
16371 |
-+static void io_sq_thread_drop_mm(struct io_ring_ctx *ctx) |
16372 |
-+{ |
16373 |
-+ struct mm_struct *mm = current->mm; |
16374 |
-+ |
16375 |
-+ if (mm) { |
16376 |
-+ unuse_mm(mm); |
16377 |
-+ mmput(mm); |
16378 |
-+ } |
16379 |
-+} |
16380 |
-+ |
16381 |
-+static int io_sq_thread_acquire_mm(struct io_ring_ctx *ctx, |
16382 |
-+ struct io_kiocb *req) |
16383 |
-+{ |
16384 |
-+ if (io_op_defs[req->opcode].needs_mm && !current->mm) { |
16385 |
-+ if (unlikely(!mmget_not_zero(ctx->sqo_mm))) |
16386 |
-+ return -EFAULT; |
16387 |
-+ use_mm(ctx->sqo_mm); |
16388 |
-+ } |
16389 |
-+ |
16390 |
-+ return 0; |
16391 |
-+} |
16392 |
-+ |
16393 |
- static void io_async_task_func(struct callback_head *cb) |
16394 |
- { |
16395 |
- struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); |
16396 |
-@@ -4328,12 +4355,17 @@ static void io_async_task_func(struct callback_head *cb) |
16397 |
- if (canceled) { |
16398 |
- kfree(apoll); |
16399 |
- io_cqring_ev_posted(ctx); |
16400 |
-+end_req: |
16401 |
- req_set_fail_links(req); |
16402 |
- io_double_put_req(req); |
16403 |
- return; |
16404 |
- } |
16405 |
- |
16406 |
- __set_current_state(TASK_RUNNING); |
16407 |
-+ if (io_sq_thread_acquire_mm(ctx, req)) { |
16408 |
-+ io_cqring_add_event(req, -EFAULT); |
16409 |
-+ goto end_req; |
16410 |
-+ } |
16411 |
- mutex_lock(&ctx->uring_lock); |
16412 |
- __io_queue_sqe(req, NULL); |
16413 |
- mutex_unlock(&ctx->uring_lock); |
16414 |
-@@ -5892,11 +5924,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, |
16415 |
- if (unlikely(req->opcode >= IORING_OP_LAST)) |
16416 |
- return -EINVAL; |
16417 |
- |
16418 |
-- if (io_op_defs[req->opcode].needs_mm && !current->mm) { |
16419 |
-- if (unlikely(!mmget_not_zero(ctx->sqo_mm))) |
16420 |
-- return -EFAULT; |
16421 |
-- use_mm(ctx->sqo_mm); |
16422 |
-- } |
16423 |
-+ if (unlikely(io_sq_thread_acquire_mm(ctx, req))) |
16424 |
-+ return -EFAULT; |
16425 |
- |
16426 |
- sqe_flags = READ_ONCE(sqe->flags); |
16427 |
- /* enforce forwards compatibility on users */ |
16428 |
-@@ -6006,16 +6035,6 @@ fail_req: |
16429 |
- return submitted; |
16430 |
- } |
16431 |
- |
16432 |
--static inline void io_sq_thread_drop_mm(struct io_ring_ctx *ctx) |
16433 |
--{ |
16434 |
-- struct mm_struct *mm = current->mm; |
16435 |
-- |
16436 |
-- if (mm) { |
16437 |
-- unuse_mm(mm); |
16438 |
-- mmput(mm); |
16439 |
-- } |
16440 |
--} |
16441 |
-- |
16442 |
- static int io_sq_thread(void *data) |
16443 |
- { |
16444 |
- struct io_ring_ctx *ctx = data; |
16445 |
-@@ -7385,7 +7404,17 @@ static void io_ring_exit_work(struct work_struct *work) |
16446 |
- if (ctx->rings) |
16447 |
- io_cqring_overflow_flush(ctx, true); |
16448 |
- |
16449 |
-- wait_for_completion(&ctx->completions[0]); |
16450 |
-+ /* |
16451 |
-+ * If we're doing polled IO and end up having requests being |
16452 |
-+ * submitted async (out-of-line), then completions can come in while |
16453 |
-+ * we're waiting for refs to drop. We need to reap these manually, |
16454 |
-+ * as nobody else will be looking for them. |
16455 |
-+ */ |
16456 |
-+ while (!wait_for_completion_timeout(&ctx->completions[0], HZ/20)) { |
16457 |
-+ io_iopoll_reap_events(ctx); |
16458 |
-+ if (ctx->rings) |
16459 |
-+ io_cqring_overflow_flush(ctx, true); |
16460 |
-+ } |
16461 |
- io_ring_ctx_free(ctx); |
16462 |
- } |
16463 |
- |
16464 |
-diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c |
16465 |
-index a49d0e670ddf..e4944436e733 100644 |
16466 |
---- a/fs/jbd2/journal.c |
16467 |
-+++ b/fs/jbd2/journal.c |
16468 |
-@@ -1140,6 +1140,7 @@ static journal_t *journal_init_common(struct block_device *bdev, |
16469 |
- init_waitqueue_head(&journal->j_wait_commit); |
16470 |
- init_waitqueue_head(&journal->j_wait_updates); |
16471 |
- init_waitqueue_head(&journal->j_wait_reserved); |
16472 |
-+ mutex_init(&journal->j_abort_mutex); |
16473 |
- mutex_init(&journal->j_barrier); |
16474 |
- mutex_init(&journal->j_checkpoint_mutex); |
16475 |
- spin_lock_init(&journal->j_revoke_lock); |
16476 |
-@@ -1402,7 +1403,8 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) |
16477 |
- printk(KERN_ERR "JBD2: Error %d detected when updating " |
16478 |
- "journal superblock for %s.\n", ret, |
16479 |
- journal->j_devname); |
16480 |
-- jbd2_journal_abort(journal, ret); |
16481 |
-+ if (!is_journal_aborted(journal)) |
16482 |
-+ jbd2_journal_abort(journal, ret); |
16483 |
- } |
16484 |
- |
16485 |
- return ret; |
16486 |
-@@ -2153,6 +2155,13 @@ void jbd2_journal_abort(journal_t *journal, int errno) |
16487 |
- { |
16488 |
- transaction_t *transaction; |
16489 |
- |
16490 |
-+ /* |
16491 |
-+ * Lock the aborting procedure until everything is done, this avoid |
16492 |
-+ * races between filesystem's error handling flow (e.g. ext4_abort()), |
16493 |
-+ * ensure panic after the error info is written into journal's |
16494 |
-+ * superblock. |
16495 |
-+ */ |
16496 |
-+ mutex_lock(&journal->j_abort_mutex); |
16497 |
- /* |
16498 |
- * ESHUTDOWN always takes precedence because a file system check |
16499 |
- * caused by any other journal abort error is not required after |
16500 |
-@@ -2167,6 +2176,7 @@ void jbd2_journal_abort(journal_t *journal, int errno) |
16501 |
- journal->j_errno = errno; |
16502 |
- jbd2_journal_update_sb_errno(journal); |
16503 |
- } |
16504 |
-+ mutex_unlock(&journal->j_abort_mutex); |
16505 |
- return; |
16506 |
- } |
16507 |
- |
16508 |
-@@ -2188,10 +2198,7 @@ void jbd2_journal_abort(journal_t *journal, int errno) |
16509 |
- * layer could realise that a filesystem check is needed. |
16510 |
- */ |
16511 |
- jbd2_journal_update_sb_errno(journal); |
16512 |
-- |
16513 |
-- write_lock(&journal->j_state_lock); |
16514 |
-- journal->j_flags |= JBD2_REC_ERR; |
16515 |
-- write_unlock(&journal->j_state_lock); |
16516 |
-+ mutex_unlock(&journal->j_abort_mutex); |
16517 |
- } |
16518 |
- |
16519 |
- /** |
16520 |
-diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c |
16521 |
-index a57e7c72c7f4..d49b1d197908 100644 |
16522 |
---- a/fs/nfs/direct.c |
16523 |
-+++ b/fs/nfs/direct.c |
16524 |
-@@ -731,6 +731,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) |
16525 |
- nfs_list_remove_request(req); |
16526 |
- if (request_commit) { |
16527 |
- kref_get(&req->wb_kref); |
16528 |
-+ memcpy(&req->wb_verf, &hdr->verf.verifier, |
16529 |
-+ sizeof(req->wb_verf)); |
16530 |
- nfs_mark_request_commit(req, hdr->lseg, &cinfo, |
16531 |
- hdr->ds_commit_idx); |
16532 |
- } |
16533 |
-diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
16534 |
-index b9d0921cb4fe..0bf1f835de01 100644 |
16535 |
---- a/fs/nfs/inode.c |
16536 |
-+++ b/fs/nfs/inode.c |
16537 |
-@@ -833,6 +833,8 @@ int nfs_getattr(const struct path *path, struct kstat *stat, |
16538 |
- do_update |= cache_validity & NFS_INO_INVALID_ATIME; |
16539 |
- if (request_mask & (STATX_CTIME|STATX_MTIME)) |
16540 |
- do_update |= cache_validity & NFS_INO_REVAL_PAGECACHE; |
16541 |
-+ if (request_mask & STATX_BLOCKS) |
16542 |
-+ do_update |= cache_validity & NFS_INO_INVALID_BLOCKS; |
16543 |
- if (do_update) { |
16544 |
- /* Update the attribute cache */ |
16545 |
- if (!(server->flags & NFS_MOUNT_NOAC)) |
16546 |
-@@ -1764,7 +1766,8 @@ out_noforce: |
16547 |
- status = nfs_post_op_update_inode_locked(inode, fattr, |
16548 |
- NFS_INO_INVALID_CHANGE |
16549 |
- | NFS_INO_INVALID_CTIME |
16550 |
-- | NFS_INO_INVALID_MTIME); |
16551 |
-+ | NFS_INO_INVALID_MTIME |
16552 |
-+ | NFS_INO_INVALID_BLOCKS); |
16553 |
- return status; |
16554 |
- } |
16555 |
- |
16556 |
-@@ -1871,7 +1874,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
16557 |
- nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR |
16558 |
- | NFS_INO_INVALID_ATIME |
16559 |
- | NFS_INO_REVAL_FORCED |
16560 |
-- | NFS_INO_REVAL_PAGECACHE); |
16561 |
-+ | NFS_INO_REVAL_PAGECACHE |
16562 |
-+ | NFS_INO_INVALID_BLOCKS); |
16563 |
- |
16564 |
- /* Do atomic weak cache consistency updates */ |
16565 |
- nfs_wcc_update_inode(inode, fattr); |
16566 |
-@@ -2033,8 +2037,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
16567 |
- inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used); |
16568 |
- } else if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) |
16569 |
- inode->i_blocks = fattr->du.nfs2.blocks; |
16570 |
-- else |
16571 |
-+ else { |
16572 |
-+ nfsi->cache_validity |= save_cache_validity & |
16573 |
-+ (NFS_INO_INVALID_BLOCKS |
16574 |
-+ | NFS_INO_REVAL_FORCED); |
16575 |
- cache_revalidated = false; |
16576 |
-+ } |
16577 |
- |
16578 |
- /* Update attrtimeo value if we're out of the unstable period */ |
16579 |
- if (attr_changed) { |
16580 |
-diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
16581 |
-index 9056f3dd380e..e32717fd1169 100644 |
16582 |
---- a/fs/nfs/nfs4proc.c |
16583 |
-+++ b/fs/nfs/nfs4proc.c |
16584 |
-@@ -7909,7 +7909,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) |
16585 |
- } |
16586 |
- |
16587 |
- static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { |
16588 |
-- .rpc_call_done = &nfs4_bind_one_conn_to_session_done, |
16589 |
-+ .rpc_call_done = nfs4_bind_one_conn_to_session_done, |
16590 |
- }; |
16591 |
- |
16592 |
- /* |
16593 |
-diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h |
16594 |
-index 10ec5ecdf117..65c331f75e9c 100644 |
16595 |
---- a/fs/nfsd/cache.h |
16596 |
-+++ b/fs/nfsd/cache.h |
16597 |
-@@ -78,6 +78,8 @@ enum { |
16598 |
- /* Checksum this amount of the request */ |
16599 |
- #define RC_CSUMLEN (256U) |
16600 |
- |
16601 |
-+int nfsd_drc_slab_create(void); |
16602 |
-+void nfsd_drc_slab_free(void); |
16603 |
- int nfsd_reply_cache_init(struct nfsd_net *); |
16604 |
- void nfsd_reply_cache_shutdown(struct nfsd_net *); |
16605 |
- int nfsd_cache_lookup(struct svc_rqst *); |
16606 |
-diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h |
16607 |
-index 09aa545825bd..9217cb64bf0e 100644 |
16608 |
---- a/fs/nfsd/netns.h |
16609 |
-+++ b/fs/nfsd/netns.h |
16610 |
-@@ -139,7 +139,6 @@ struct nfsd_net { |
16611 |
- * Duplicate reply cache |
16612 |
- */ |
16613 |
- struct nfsd_drc_bucket *drc_hashtbl; |
16614 |
-- struct kmem_cache *drc_slab; |
16615 |
- |
16616 |
- /* max number of entries allowed in the cache */ |
16617 |
- unsigned int max_drc_entries; |
16618 |
-diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c |
16619 |
-index 5cf91322de0f..07e0c6f6322f 100644 |
16620 |
---- a/fs/nfsd/nfs4callback.c |
16621 |
-+++ b/fs/nfsd/nfs4callback.c |
16622 |
-@@ -1301,6 +1301,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) |
16623 |
- err = setup_callback_client(clp, &conn, ses); |
16624 |
- if (err) { |
16625 |
- nfsd4_mark_cb_down(clp, err); |
16626 |
-+ if (c) |
16627 |
-+ svc_xprt_put(c->cn_xprt); |
16628 |
- return; |
16629 |
- } |
16630 |
- } |
16631 |
-diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c |
16632 |
-index 96352ab7bd81..4a258065188e 100644 |
16633 |
---- a/fs/nfsd/nfscache.c |
16634 |
-+++ b/fs/nfsd/nfscache.c |
16635 |
-@@ -36,6 +36,8 @@ struct nfsd_drc_bucket { |
16636 |
- spinlock_t cache_lock; |
16637 |
- }; |
16638 |
- |
16639 |
-+static struct kmem_cache *drc_slab; |
16640 |
-+ |
16641 |
- static int nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec); |
16642 |
- static unsigned long nfsd_reply_cache_count(struct shrinker *shrink, |
16643 |
- struct shrink_control *sc); |
16644 |
-@@ -95,7 +97,7 @@ nfsd_reply_cache_alloc(struct svc_rqst *rqstp, __wsum csum, |
16645 |
- { |
16646 |
- struct svc_cacherep *rp; |
16647 |
- |
16648 |
-- rp = kmem_cache_alloc(nn->drc_slab, GFP_KERNEL); |
16649 |
-+ rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); |
16650 |
- if (rp) { |
16651 |
- rp->c_state = RC_UNUSED; |
16652 |
- rp->c_type = RC_NOCACHE; |
16653 |
-@@ -129,7 +131,7 @@ nfsd_reply_cache_free_locked(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, |
16654 |
- atomic_dec(&nn->num_drc_entries); |
16655 |
- nn->drc_mem_usage -= sizeof(*rp); |
16656 |
- } |
16657 |
-- kmem_cache_free(nn->drc_slab, rp); |
16658 |
-+ kmem_cache_free(drc_slab, rp); |
16659 |
- } |
16660 |
- |
16661 |
- static void |
16662 |
-@@ -141,6 +143,18 @@ nfsd_reply_cache_free(struct nfsd_drc_bucket *b, struct svc_cacherep *rp, |
16663 |
- spin_unlock(&b->cache_lock); |
16664 |
- } |
16665 |
- |
16666 |
-+int nfsd_drc_slab_create(void) |
16667 |
-+{ |
16668 |
-+ drc_slab = kmem_cache_create("nfsd_drc", |
16669 |
-+ sizeof(struct svc_cacherep), 0, 0, NULL); |
16670 |
-+ return drc_slab ? 0: -ENOMEM; |
16671 |
-+} |
16672 |
-+ |
16673 |
-+void nfsd_drc_slab_free(void) |
16674 |
-+{ |
16675 |
-+ kmem_cache_destroy(drc_slab); |
16676 |
-+} |
16677 |
-+ |
16678 |
- int nfsd_reply_cache_init(struct nfsd_net *nn) |
16679 |
- { |
16680 |
- unsigned int hashsize; |
16681 |
-@@ -159,18 +173,13 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) |
16682 |
- if (status) |
16683 |
- goto out_nomem; |
16684 |
- |
16685 |
-- nn->drc_slab = kmem_cache_create("nfsd_drc", |
16686 |
-- sizeof(struct svc_cacherep), 0, 0, NULL); |
16687 |
-- if (!nn->drc_slab) |
16688 |
-- goto out_shrinker; |
16689 |
-- |
16690 |
- nn->drc_hashtbl = kcalloc(hashsize, |
16691 |
- sizeof(*nn->drc_hashtbl), GFP_KERNEL); |
16692 |
- if (!nn->drc_hashtbl) { |
16693 |
- nn->drc_hashtbl = vzalloc(array_size(hashsize, |
16694 |
- sizeof(*nn->drc_hashtbl))); |
16695 |
- if (!nn->drc_hashtbl) |
16696 |
-- goto out_slab; |
16697 |
-+ goto out_shrinker; |
16698 |
- } |
16699 |
- |
16700 |
- for (i = 0; i < hashsize; i++) { |
16701 |
-@@ -180,8 +189,6 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) |
16702 |
- nn->drc_hashsize = hashsize; |
16703 |
- |
16704 |
- return 0; |
16705 |
--out_slab: |
16706 |
-- kmem_cache_destroy(nn->drc_slab); |
16707 |
- out_shrinker: |
16708 |
- unregister_shrinker(&nn->nfsd_reply_cache_shrinker); |
16709 |
- out_nomem: |
16710 |
-@@ -209,8 +216,6 @@ void nfsd_reply_cache_shutdown(struct nfsd_net *nn) |
16711 |
- nn->drc_hashtbl = NULL; |
16712 |
- nn->drc_hashsize = 0; |
16713 |
- |
16714 |
-- kmem_cache_destroy(nn->drc_slab); |
16715 |
-- nn->drc_slab = NULL; |
16716 |
- } |
16717 |
- |
16718 |
- /* |
16719 |
-@@ -464,8 +469,7 @@ found_entry: |
16720 |
- rtn = RC_REPLY; |
16721 |
- break; |
16722 |
- default: |
16723 |
-- printk(KERN_WARNING "nfsd: bad repcache type %d\n", rp->c_type); |
16724 |
-- nfsd_reply_cache_free_locked(b, rp, nn); |
16725 |
-+ WARN_ONCE(1, "nfsd: bad repcache type %d\n", rp->c_type); |
16726 |
- } |
16727 |
- |
16728 |
- goto out; |
16729 |
-diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c |
16730 |
-index 3bb2db947d29..71687d99b090 100644 |
16731 |
---- a/fs/nfsd/nfsctl.c |
16732 |
-+++ b/fs/nfsd/nfsctl.c |
16733 |
-@@ -1533,6 +1533,9 @@ static int __init init_nfsd(void) |
16734 |
- goto out_free_slabs; |
16735 |
- nfsd_fault_inject_init(); /* nfsd fault injection controls */ |
16736 |
- nfsd_stat_init(); /* Statistics */ |
16737 |
-+ retval = nfsd_drc_slab_create(); |
16738 |
-+ if (retval) |
16739 |
-+ goto out_free_stat; |
16740 |
- nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
16741 |
- retval = create_proc_exports_entry(); |
16742 |
- if (retval) |
16743 |
-@@ -1546,6 +1549,8 @@ out_free_all: |
16744 |
- remove_proc_entry("fs/nfs", NULL); |
16745 |
- out_free_lockd: |
16746 |
- nfsd_lockd_shutdown(); |
16747 |
-+ nfsd_drc_slab_free(); |
16748 |
-+out_free_stat: |
16749 |
- nfsd_stat_shutdown(); |
16750 |
- nfsd_fault_inject_cleanup(); |
16751 |
- nfsd4_exit_pnfs(); |
16752 |
-@@ -1560,6 +1565,7 @@ out_unregister_pernet: |
16753 |
- |
16754 |
- static void __exit exit_nfsd(void) |
16755 |
- { |
16756 |
-+ nfsd_drc_slab_free(); |
16757 |
- remove_proc_entry("fs/nfs/exports", NULL); |
16758 |
- remove_proc_entry("fs/nfs", NULL); |
16759 |
- nfsd_stat_shutdown(); |
16760 |
-diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c |
16761 |
-index 9955d75c0585..ad31ec4ad627 100644 |
16762 |
---- a/fs/proc/bootconfig.c |
16763 |
-+++ b/fs/proc/bootconfig.c |
16764 |
-@@ -26,8 +26,9 @@ static int boot_config_proc_show(struct seq_file *m, void *v) |
16765 |
- static int __init copy_xbc_key_value_list(char *dst, size_t size) |
16766 |
- { |
16767 |
- struct xbc_node *leaf, *vnode; |
16768 |
-- const char *val; |
16769 |
- char *key, *end = dst + size; |
16770 |
-+ const char *val; |
16771 |
-+ char q; |
16772 |
- int ret = 0; |
16773 |
- |
16774 |
- key = kzalloc(XBC_KEYLEN_MAX, GFP_KERNEL); |
16775 |
-@@ -41,16 +42,20 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) |
16776 |
- break; |
16777 |
- dst += ret; |
16778 |
- vnode = xbc_node_get_child(leaf); |
16779 |
-- if (vnode && xbc_node_is_array(vnode)) { |
16780 |
-+ if (vnode) { |
16781 |
- xbc_array_for_each_value(vnode, val) { |
16782 |
-- ret = snprintf(dst, rest(dst, end), "\"%s\"%s", |
16783 |
-- val, vnode->next ? ", " : "\n"); |
16784 |
-+ if (strchr(val, '"')) |
16785 |
-+ q = '\''; |
16786 |
-+ else |
16787 |
-+ q = '"'; |
16788 |
-+ ret = snprintf(dst, rest(dst, end), "%c%s%c%s", |
16789 |
-+ q, val, q, vnode->next ? ", " : "\n"); |
16790 |
- if (ret < 0) |
16791 |
- goto out; |
16792 |
- dst += ret; |
16793 |
- } |
16794 |
- } else { |
16795 |
-- ret = snprintf(dst, rest(dst, end), "\"%s\"\n", val); |
16796 |
-+ ret = snprintf(dst, rest(dst, end), "\"\"\n"); |
16797 |
- if (ret < 0) |
16798 |
- break; |
16799 |
- dst += ret; |
16800 |
-diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
16801 |
-index d1772786af29..8845faa8161a 100644 |
16802 |
---- a/fs/xfs/xfs_inode.c |
16803 |
-+++ b/fs/xfs/xfs_inode.c |
16804 |
-@@ -2639,8 +2639,10 @@ xfs_ifree_cluster( |
16805 |
- error = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno, |
16806 |
- mp->m_bsize * igeo->blocks_per_cluster, |
16807 |
- XBF_UNMAPPED, &bp); |
16808 |
-- if (error) |
16809 |
-+ if (error) { |
16810 |
-+ xfs_perag_put(pag); |
16811 |
- return error; |
16812 |
-+ } |
16813 |
- |
16814 |
- /* |
16815 |
- * This buffer may not have been correctly initialised as we |
16816 |
-diff --git a/include/linux/bitops.h b/include/linux/bitops.h |
16817 |
-index 9acf654f0b19..99f2ac30b1d9 100644 |
16818 |
---- a/include/linux/bitops.h |
16819 |
-+++ b/include/linux/bitops.h |
16820 |
-@@ -72,7 +72,7 @@ static inline int get_bitmask_order(unsigned int count) |
16821 |
- |
16822 |
- static __always_inline unsigned long hweight_long(unsigned long w) |
16823 |
- { |
16824 |
-- return sizeof(w) == 4 ? hweight32(w) : hweight64(w); |
16825 |
-+ return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w); |
16826 |
- } |
16827 |
- |
16828 |
- /** |
16829 |
-diff --git a/include/linux/coresight.h b/include/linux/coresight.h |
16830 |
-index 193cc9dbf448..09f0565a5de3 100644 |
16831 |
---- a/include/linux/coresight.h |
16832 |
-+++ b/include/linux/coresight.h |
16833 |
-@@ -100,10 +100,12 @@ union coresight_dev_subtype { |
16834 |
- }; |
16835 |
- |
16836 |
- /** |
16837 |
-- * struct coresight_platform_data - data harvested from the DT specification |
16838 |
-- * @nr_inport: number of input ports for this component. |
16839 |
-- * @nr_outport: number of output ports for this component. |
16840 |
-- * @conns: Array of nr_outport connections from this component |
16841 |
-+ * struct coresight_platform_data - data harvested from the firmware |
16842 |
-+ * specification. |
16843 |
-+ * |
16844 |
-+ * @nr_inport: Number of elements for the input connections. |
16845 |
-+ * @nr_outport: Number of elements for the output connections. |
16846 |
-+ * @conns: Sparse array of nr_outport connections from this component. |
16847 |
- */ |
16848 |
- struct coresight_platform_data { |
16849 |
- int nr_inport; |
16850 |
-diff --git a/include/linux/ioport.h b/include/linux/ioport.h |
16851 |
-index a9b9170b5dd2..6c3eca90cbc4 100644 |
16852 |
---- a/include/linux/ioport.h |
16853 |
-+++ b/include/linux/ioport.h |
16854 |
-@@ -301,5 +301,11 @@ struct resource *devm_request_free_mem_region(struct device *dev, |
16855 |
- struct resource *request_free_mem_region(struct resource *base, |
16856 |
- unsigned long size, const char *name); |
16857 |
- |
16858 |
-+#ifdef CONFIG_IO_STRICT_DEVMEM |
16859 |
-+void revoke_devmem(struct resource *res); |
16860 |
-+#else |
16861 |
-+static inline void revoke_devmem(struct resource *res) { }; |
16862 |
-+#endif |
16863 |
-+ |
16864 |
- #endif /* __ASSEMBLY__ */ |
16865 |
- #endif /* _LINUX_IOPORT_H */ |
16866 |
-diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h |
16867 |
-index f613d8529863..d56128df2aff 100644 |
16868 |
---- a/include/linux/jbd2.h |
16869 |
-+++ b/include/linux/jbd2.h |
16870 |
-@@ -765,6 +765,11 @@ struct journal_s |
16871 |
- */ |
16872 |
- int j_errno; |
16873 |
- |
16874 |
-+ /** |
16875 |
-+ * @j_abort_mutex: Lock the whole aborting procedure. |
16876 |
-+ */ |
16877 |
-+ struct mutex j_abort_mutex; |
16878 |
-+ |
16879 |
- /** |
16880 |
- * @j_sb_buffer: The first part of the superblock buffer. |
16881 |
- */ |
16882 |
-@@ -1247,7 +1252,6 @@ JBD2_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3) |
16883 |
- #define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file |
16884 |
- * data write error in ordered |
16885 |
- * mode */ |
16886 |
--#define JBD2_REC_ERR 0x080 /* The errno in the sb has been recorded */ |
16887 |
- |
16888 |
- /* |
16889 |
- * Function declarations for the journaling transaction and buffer |
16890 |
-diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h |
16891 |
-index 04bdaf01112c..645fd401c856 100644 |
16892 |
---- a/include/linux/kprobes.h |
16893 |
-+++ b/include/linux/kprobes.h |
16894 |
-@@ -350,6 +350,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) |
16895 |
- return this_cpu_ptr(&kprobe_ctlblk); |
16896 |
- } |
16897 |
- |
16898 |
-+extern struct kprobe kprobe_busy; |
16899 |
-+void kprobe_busy_begin(void); |
16900 |
-+void kprobe_busy_end(void); |
16901 |
-+ |
16902 |
- kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset); |
16903 |
- int register_kprobe(struct kprobe *p); |
16904 |
- void unregister_kprobe(struct kprobe *p); |
16905 |
-diff --git a/include/linux/libata.h b/include/linux/libata.h |
16906 |
-index cffa4714bfa8..ae6dfc107ea8 100644 |
16907 |
---- a/include/linux/libata.h |
16908 |
-+++ b/include/linux/libata.h |
16909 |
-@@ -22,6 +22,7 @@ |
16910 |
- #include <linux/acpi.h> |
16911 |
- #include <linux/cdrom.h> |
16912 |
- #include <linux/sched.h> |
16913 |
-+#include <linux/async.h> |
16914 |
- |
16915 |
- /* |
16916 |
- * Define if arch has non-standard setup. This is a _PCI_ standard |
16917 |
-@@ -872,6 +873,8 @@ struct ata_port { |
16918 |
- struct timer_list fastdrain_timer; |
16919 |
- unsigned long fastdrain_cnt; |
16920 |
- |
16921 |
-+ async_cookie_t cookie; |
16922 |
-+ |
16923 |
- int em_message_type; |
16924 |
- void *private_data; |
16925 |
- |
16926 |
-diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h |
16927 |
-index 3c67983678ec..744dce63946e 100644 |
16928 |
---- a/include/linux/mfd/stmfx.h |
16929 |
-+++ b/include/linux/mfd/stmfx.h |
16930 |
-@@ -109,6 +109,7 @@ struct stmfx { |
16931 |
- struct device *dev; |
16932 |
- struct regmap *map; |
16933 |
- struct regulator *vdd; |
16934 |
-+ int irq; |
16935 |
- struct irq_domain *irq_domain; |
16936 |
- struct mutex lock; /* IRQ bus lock */ |
16937 |
- u8 irq_src; |
16938 |
-diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h |
16939 |
-index 73eda45f1cfd..6ee9119acc5d 100644 |
16940 |
---- a/include/linux/nfs_fs.h |
16941 |
-+++ b/include/linux/nfs_fs.h |
16942 |
-@@ -230,6 +230,7 @@ struct nfs4_copy_state { |
16943 |
- #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */ |
16944 |
- #define NFS_INO_DATA_INVAL_DEFER \ |
16945 |
- BIT(13) /* Deferred cache invalidation */ |
16946 |
-+#define NFS_INO_INVALID_BLOCKS BIT(14) /* cached blocks are invalid */ |
16947 |
- |
16948 |
- #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ |
16949 |
- | NFS_INO_INVALID_CTIME \ |
16950 |
-diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h |
16951 |
-index 8675e145ea8b..2040696d75b6 100644 |
16952 |
---- a/include/linux/usb/composite.h |
16953 |
-+++ b/include/linux/usb/composite.h |
16954 |
-@@ -249,6 +249,9 @@ int usb_function_activate(struct usb_function *); |
16955 |
- |
16956 |
- int usb_interface_id(struct usb_configuration *, struct usb_function *); |
16957 |
- |
16958 |
-+int config_ep_by_speed_and_alt(struct usb_gadget *g, struct usb_function *f, |
16959 |
-+ struct usb_ep *_ep, u8 alt); |
16960 |
-+ |
16961 |
- int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, |
16962 |
- struct usb_ep *_ep); |
16963 |
- |
16964 |
-diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h |
16965 |
-index 9411c08a5c7e..73a6113322c6 100644 |
16966 |
---- a/include/linux/usb/gadget.h |
16967 |
-+++ b/include/linux/usb/gadget.h |
16968 |
-@@ -373,6 +373,7 @@ struct usb_gadget_ops { |
16969 |
- * @connected: True if gadget is connected. |
16970 |
- * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag |
16971 |
- * indicates that it supports LPM as per the LPM ECN & errata. |
16972 |
-+ * @irq: the interrupt number for device controller. |
16973 |
- * |
16974 |
- * Gadgets have a mostly-portable "gadget driver" implementing device |
16975 |
- * functions, handling all usb configurations and interfaces. Gadget |
16976 |
-@@ -427,6 +428,7 @@ struct usb_gadget { |
16977 |
- unsigned deactivated:1; |
16978 |
- unsigned connected:1; |
16979 |
- unsigned lpm_capable:1; |
16980 |
-+ int irq; |
16981 |
- }; |
16982 |
- #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) |
16983 |
- |
16984 |
-diff --git a/include/sound/soc.h b/include/sound/soc.h |
16985 |
-index 946f88a6c63d..8e480efeda2a 100644 |
16986 |
---- a/include/sound/soc.h |
16987 |
-+++ b/include/sound/soc.h |
16988 |
-@@ -790,9 +790,6 @@ struct snd_soc_dai_link { |
16989 |
- const struct snd_soc_pcm_stream *params; |
16990 |
- unsigned int num_params; |
16991 |
- |
16992 |
-- struct snd_soc_dapm_widget *playback_widget; |
16993 |
-- struct snd_soc_dapm_widget *capture_widget; |
16994 |
-- |
16995 |
- unsigned int dai_fmt; /* format to set on init */ |
16996 |
- |
16997 |
- enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ |
16998 |
-@@ -1156,6 +1153,9 @@ struct snd_soc_pcm_runtime { |
16999 |
- struct snd_soc_dai **cpu_dais; |
17000 |
- unsigned int num_cpus; |
17001 |
- |
17002 |
-+ struct snd_soc_dapm_widget *playback_widget; |
17003 |
-+ struct snd_soc_dapm_widget *capture_widget; |
17004 |
-+ |
17005 |
- struct delayed_work delayed_work; |
17006 |
- void (*close_delayed_work_func)(struct snd_soc_pcm_runtime *rtd); |
17007 |
- #ifdef CONFIG_DEBUG_FS |
17008 |
-@@ -1177,7 +1177,7 @@ struct snd_soc_pcm_runtime { |
17009 |
- #define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus] |
17010 |
- |
17011 |
- #define for_each_rtd_components(rtd, i, component) \ |
17012 |
-- for ((i) = 0; \ |
17013 |
-+ for ((i) = 0, component = NULL; \ |
17014 |
- ((i) < rtd->num_components) && ((component) = rtd->components[i]);\ |
17015 |
- (i)++) |
17016 |
- #define for_each_rtd_cpu_dais(rtd, i, dai) \ |
17017 |
-diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h |
17018 |
-index c612cabbc378..93eddd32bd74 100644 |
17019 |
---- a/include/trace/events/afs.h |
17020 |
-+++ b/include/trace/events/afs.h |
17021 |
-@@ -988,24 +988,22 @@ TRACE_EVENT(afs_edit_dir, |
17022 |
- ); |
17023 |
- |
17024 |
- TRACE_EVENT(afs_protocol_error, |
17025 |
-- TP_PROTO(struct afs_call *call, int error, enum afs_eproto_cause cause), |
17026 |
-+ TP_PROTO(struct afs_call *call, enum afs_eproto_cause cause), |
17027 |
- |
17028 |
-- TP_ARGS(call, error, cause), |
17029 |
-+ TP_ARGS(call, cause), |
17030 |
- |
17031 |
- TP_STRUCT__entry( |
17032 |
- __field(unsigned int, call ) |
17033 |
-- __field(int, error ) |
17034 |
- __field(enum afs_eproto_cause, cause ) |
17035 |
- ), |
17036 |
- |
17037 |
- TP_fast_assign( |
17038 |
- __entry->call = call ? call->debug_id : 0; |
17039 |
-- __entry->error = error; |
17040 |
- __entry->cause = cause; |
17041 |
- ), |
17042 |
- |
17043 |
-- TP_printk("c=%08x r=%d %s", |
17044 |
-- __entry->call, __entry->error, |
17045 |
-+ TP_printk("c=%08x %s", |
17046 |
-+ __entry->call, |
17047 |
- __print_symbolic(__entry->cause, afs_eproto_causes)) |
17048 |
- ); |
17049 |
- |
17050 |
-diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h |
17051 |
-index d78064007b17..f3956fc11de6 100644 |
17052 |
---- a/include/uapi/linux/magic.h |
17053 |
-+++ b/include/uapi/linux/magic.h |
17054 |
-@@ -94,6 +94,7 @@ |
17055 |
- #define BALLOON_KVM_MAGIC 0x13661366 |
17056 |
- #define ZSMALLOC_MAGIC 0x58295829 |
17057 |
- #define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ |
17058 |
-+#define DEVMEM_MAGIC 0x454d444d /* "DMEM" */ |
17059 |
- #define Z3FOLD_MAGIC 0x33 |
17060 |
- #define PPC_CMM_MAGIC 0xc7571590 |
17061 |
- |
17062 |
-diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
17063 |
-index 5e52765161f9..c8acc8f37583 100644 |
17064 |
---- a/kernel/bpf/syscall.c |
17065 |
-+++ b/kernel/bpf/syscall.c |
17066 |
-@@ -2924,6 +2924,7 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog) |
17067 |
- struct bpf_insn *insns; |
17068 |
- u32 off, type; |
17069 |
- u64 imm; |
17070 |
-+ u8 code; |
17071 |
- int i; |
17072 |
- |
17073 |
- insns = kmemdup(prog->insnsi, bpf_prog_insn_size(prog), |
17074 |
-@@ -2932,21 +2933,27 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog) |
17075 |
- return insns; |
17076 |
- |
17077 |
- for (i = 0; i < prog->len; i++) { |
17078 |
-- if (insns[i].code == (BPF_JMP | BPF_TAIL_CALL)) { |
17079 |
-+ code = insns[i].code; |
17080 |
-+ |
17081 |
-+ if (code == (BPF_JMP | BPF_TAIL_CALL)) { |
17082 |
- insns[i].code = BPF_JMP | BPF_CALL; |
17083 |
- insns[i].imm = BPF_FUNC_tail_call; |
17084 |
- /* fall-through */ |
17085 |
- } |
17086 |
-- if (insns[i].code == (BPF_JMP | BPF_CALL) || |
17087 |
-- insns[i].code == (BPF_JMP | BPF_CALL_ARGS)) { |
17088 |
-- if (insns[i].code == (BPF_JMP | BPF_CALL_ARGS)) |
17089 |
-+ if (code == (BPF_JMP | BPF_CALL) || |
17090 |
-+ code == (BPF_JMP | BPF_CALL_ARGS)) { |
17091 |
-+ if (code == (BPF_JMP | BPF_CALL_ARGS)) |
17092 |
- insns[i].code = BPF_JMP | BPF_CALL; |
17093 |
- if (!bpf_dump_raw_ok()) |
17094 |
- insns[i].imm = 0; |
17095 |
- continue; |
17096 |
- } |
17097 |
-+ if (BPF_CLASS(code) == BPF_LDX && BPF_MODE(code) == BPF_PROBE_MEM) { |
17098 |
-+ insns[i].code = BPF_LDX | BPF_SIZE(code) | BPF_MEM; |
17099 |
-+ continue; |
17100 |
-+ } |
17101 |
- |
17102 |
-- if (insns[i].code != (BPF_LD | BPF_IMM | BPF_DW)) |
17103 |
-+ if (code != (BPF_LD | BPF_IMM | BPF_DW)) |
17104 |
- continue; |
17105 |
- |
17106 |
- imm = ((u64)insns[i + 1].imm << 32) | (u32)insns[i].imm; |
17107 |
-diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
17108 |
-index efe14cf24bc6..739d9ba3ba6b 100644 |
17109 |
---- a/kernel/bpf/verifier.c |
17110 |
-+++ b/kernel/bpf/verifier.c |
17111 |
-@@ -7366,7 +7366,7 @@ static int check_btf_func(struct bpf_verifier_env *env, |
17112 |
- const struct btf *btf; |
17113 |
- void __user *urecord; |
17114 |
- u32 prev_offset = 0; |
17115 |
-- int ret = 0; |
17116 |
-+ int ret = -ENOMEM; |
17117 |
- |
17118 |
- nfuncs = attr->func_info_cnt; |
17119 |
- if (!nfuncs) |
17120 |
-diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
17121 |
-index 2625c241ac00..195ecb955fcc 100644 |
17122 |
---- a/kernel/kprobes.c |
17123 |
-+++ b/kernel/kprobes.c |
17124 |
-@@ -586,11 +586,12 @@ static void kprobe_optimizer(struct work_struct *work) |
17125 |
- mutex_unlock(&module_mutex); |
17126 |
- mutex_unlock(&text_mutex); |
17127 |
- cpus_read_unlock(); |
17128 |
-- mutex_unlock(&kprobe_mutex); |
17129 |
- |
17130 |
- /* Step 5: Kick optimizer again if needed */ |
17131 |
- if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) |
17132 |
- kick_kprobe_optimizer(); |
17133 |
-+ |
17134 |
-+ mutex_unlock(&kprobe_mutex); |
17135 |
- } |
17136 |
- |
17137 |
- /* Wait for completing optimization and unoptimization */ |
17138 |
-@@ -1236,6 +1237,26 @@ __releases(hlist_lock) |
17139 |
- } |
17140 |
- NOKPROBE_SYMBOL(kretprobe_table_unlock); |
17141 |
- |
17142 |
-+struct kprobe kprobe_busy = { |
17143 |
-+ .addr = (void *) get_kprobe, |
17144 |
-+}; |
17145 |
-+ |
17146 |
-+void kprobe_busy_begin(void) |
17147 |
-+{ |
17148 |
-+ struct kprobe_ctlblk *kcb; |
17149 |
-+ |
17150 |
-+ preempt_disable(); |
17151 |
-+ __this_cpu_write(current_kprobe, &kprobe_busy); |
17152 |
-+ kcb = get_kprobe_ctlblk(); |
17153 |
-+ kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
17154 |
-+} |
17155 |
-+ |
17156 |
-+void kprobe_busy_end(void) |
17157 |
-+{ |
17158 |
-+ __this_cpu_write(current_kprobe, NULL); |
17159 |
-+ preempt_enable(); |
17160 |
-+} |
17161 |
-+ |
17162 |
- /* |
17163 |
- * This function is called from finish_task_switch when task tk becomes dead, |
17164 |
- * so that we can recycle any function-return probe instances associated |
17165 |
-@@ -1253,6 +1274,8 @@ void kprobe_flush_task(struct task_struct *tk) |
17166 |
- /* Early boot. kretprobe_table_locks not yet initialized. */ |
17167 |
- return; |
17168 |
- |
17169 |
-+ kprobe_busy_begin(); |
17170 |
-+ |
17171 |
- INIT_HLIST_HEAD(&empty_rp); |
17172 |
- hash = hash_ptr(tk, KPROBE_HASH_BITS); |
17173 |
- head = &kretprobe_inst_table[hash]; |
17174 |
-@@ -1266,6 +1289,8 @@ void kprobe_flush_task(struct task_struct *tk) |
17175 |
- hlist_del(&ri->hlist); |
17176 |
- kfree(ri); |
17177 |
- } |
17178 |
-+ |
17179 |
-+ kprobe_busy_end(); |
17180 |
- } |
17181 |
- NOKPROBE_SYMBOL(kprobe_flush_task); |
17182 |
- |
17183 |
-diff --git a/kernel/resource.c b/kernel/resource.c |
17184 |
-index 76036a41143b..841737bbda9e 100644 |
17185 |
---- a/kernel/resource.c |
17186 |
-+++ b/kernel/resource.c |
17187 |
-@@ -1126,6 +1126,7 @@ struct resource * __request_region(struct resource *parent, |
17188 |
- { |
17189 |
- DECLARE_WAITQUEUE(wait, current); |
17190 |
- struct resource *res = alloc_resource(GFP_KERNEL); |
17191 |
-+ struct resource *orig_parent = parent; |
17192 |
- |
17193 |
- if (!res) |
17194 |
- return NULL; |
17195 |
-@@ -1176,6 +1177,10 @@ struct resource * __request_region(struct resource *parent, |
17196 |
- break; |
17197 |
- } |
17198 |
- write_unlock(&resource_lock); |
17199 |
-+ |
17200 |
-+ if (res && orig_parent == &iomem_resource) |
17201 |
-+ revoke_devmem(res); |
17202 |
-+ |
17203 |
- return res; |
17204 |
- } |
17205 |
- EXPORT_SYMBOL(__request_region); |
17206 |
-diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
17207 |
-index ca39dc3230cb..35610a4be4a9 100644 |
17208 |
---- a/kernel/trace/blktrace.c |
17209 |
-+++ b/kernel/trace/blktrace.c |
17210 |
-@@ -995,8 +995,10 @@ static void blk_add_trace_split(void *ignore, |
17211 |
- |
17212 |
- __blk_add_trace(bt, bio->bi_iter.bi_sector, |
17213 |
- bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, |
17214 |
-- BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu), |
17215 |
-- &rpdu, blk_trace_bio_get_cgid(q, bio)); |
17216 |
-+ BLK_TA_SPLIT, |
17217 |
-+ blk_status_to_errno(bio->bi_status), |
17218 |
-+ sizeof(rpdu), &rpdu, |
17219 |
-+ blk_trace_bio_get_cgid(q, bio)); |
17220 |
- } |
17221 |
- rcu_read_unlock(); |
17222 |
- } |
17223 |
-@@ -1033,7 +1035,8 @@ static void blk_add_trace_bio_remap(void *ignore, |
17224 |
- r.sector_from = cpu_to_be64(from); |
17225 |
- |
17226 |
- __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, |
17227 |
-- bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status, |
17228 |
-+ bio_op(bio), bio->bi_opf, BLK_TA_REMAP, |
17229 |
-+ blk_status_to_errno(bio->bi_status), |
17230 |
- sizeof(r), &r, blk_trace_bio_get_cgid(q, bio)); |
17231 |
- rcu_read_unlock(); |
17232 |
- } |
17233 |
-@@ -1253,21 +1256,10 @@ static inline __u16 t_error(const struct trace_entry *ent) |
17234 |
- |
17235 |
- static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) |
17236 |
- { |
17237 |
-- const __u64 *val = pdu_start(ent, has_cg); |
17238 |
-+ const __be64 *val = pdu_start(ent, has_cg); |
17239 |
- return be64_to_cpu(*val); |
17240 |
- } |
17241 |
- |
17242 |
--static void get_pdu_remap(const struct trace_entry *ent, |
17243 |
-- struct blk_io_trace_remap *r, bool has_cg) |
17244 |
--{ |
17245 |
-- const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
17246 |
-- __u64 sector_from = __r->sector_from; |
17247 |
-- |
17248 |
-- r->device_from = be32_to_cpu(__r->device_from); |
17249 |
-- r->device_to = be32_to_cpu(__r->device_to); |
17250 |
-- r->sector_from = be64_to_cpu(sector_from); |
17251 |
--} |
17252 |
-- |
17253 |
- typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act, |
17254 |
- bool has_cg); |
17255 |
- |
17256 |
-@@ -1407,13 +1399,13 @@ static void blk_log_with_error(struct trace_seq *s, |
17257 |
- |
17258 |
- static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
17259 |
- { |
17260 |
-- struct blk_io_trace_remap r = { .device_from = 0, }; |
17261 |
-+ const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); |
17262 |
- |
17263 |
-- get_pdu_remap(ent, &r, has_cg); |
17264 |
- trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n", |
17265 |
- t_sector(ent), t_sec(ent), |
17266 |
-- MAJOR(r.device_from), MINOR(r.device_from), |
17267 |
-- (unsigned long long)r.sector_from); |
17268 |
-+ MAJOR(be32_to_cpu(__r->device_from)), |
17269 |
-+ MINOR(be32_to_cpu(__r->device_from)), |
17270 |
-+ be64_to_cpu(__r->sector_from)); |
17271 |
- } |
17272 |
- |
17273 |
- static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) |
17274 |
-diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
17275 |
-index 4eb1d004d5f2..7fb2f4c1bc49 100644 |
17276 |
---- a/kernel/trace/trace.h |
17277 |
-+++ b/kernel/trace/trace.h |
17278 |
-@@ -61,6 +61,9 @@ enum trace_type { |
17279 |
- #undef __field_desc |
17280 |
- #define __field_desc(type, container, item) |
17281 |
- |
17282 |
-+#undef __field_packed |
17283 |
-+#define __field_packed(type, container, item) |
17284 |
-+ |
17285 |
- #undef __array |
17286 |
- #define __array(type, item, size) type item[size]; |
17287 |
- |
17288 |
-diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h |
17289 |
-index a523da0dae0a..18c4a58aff79 100644 |
17290 |
---- a/kernel/trace/trace_entries.h |
17291 |
-+++ b/kernel/trace/trace_entries.h |
17292 |
-@@ -78,8 +78,8 @@ FTRACE_ENTRY_PACKED(funcgraph_entry, ftrace_graph_ent_entry, |
17293 |
- |
17294 |
- F_STRUCT( |
17295 |
- __field_struct( struct ftrace_graph_ent, graph_ent ) |
17296 |
-- __field_desc( unsigned long, graph_ent, func ) |
17297 |
-- __field_desc( int, graph_ent, depth ) |
17298 |
-+ __field_packed( unsigned long, graph_ent, func ) |
17299 |
-+ __field_packed( int, graph_ent, depth ) |
17300 |
- ), |
17301 |
- |
17302 |
- F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth) |
17303 |
-@@ -92,11 +92,11 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry, |
17304 |
- |
17305 |
- F_STRUCT( |
17306 |
- __field_struct( struct ftrace_graph_ret, ret ) |
17307 |
-- __field_desc( unsigned long, ret, func ) |
17308 |
-- __field_desc( unsigned long, ret, overrun ) |
17309 |
-- __field_desc( unsigned long long, ret, calltime) |
17310 |
-- __field_desc( unsigned long long, ret, rettime ) |
17311 |
-- __field_desc( int, ret, depth ) |
17312 |
-+ __field_packed( unsigned long, ret, func ) |
17313 |
-+ __field_packed( unsigned long, ret, overrun ) |
17314 |
-+ __field_packed( unsigned long long, ret, calltime) |
17315 |
-+ __field_packed( unsigned long long, ret, rettime ) |
17316 |
-+ __field_packed( int, ret, depth ) |
17317 |
- ), |
17318 |
- |
17319 |
- F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d", |
17320 |
-diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c |
17321 |
-index 77ce5a3b6773..70d3d0a09053 100644 |
17322 |
---- a/kernel/trace/trace_export.c |
17323 |
-+++ b/kernel/trace/trace_export.c |
17324 |
-@@ -45,6 +45,9 @@ static int ftrace_event_register(struct trace_event_call *call, |
17325 |
- #undef __field_desc |
17326 |
- #define __field_desc(type, container, item) type item; |
17327 |
- |
17328 |
-+#undef __field_packed |
17329 |
-+#define __field_packed(type, container, item) type item; |
17330 |
-+ |
17331 |
- #undef __array |
17332 |
- #define __array(type, item, size) type item[size]; |
17333 |
- |
17334 |
-@@ -85,6 +88,13 @@ static void __always_unused ____ftrace_check_##name(void) \ |
17335 |
- .size = sizeof(_type), .align = __alignof__(_type), \ |
17336 |
- is_signed_type(_type), .filter_type = _filter_type }, |
17337 |
- |
17338 |
-+ |
17339 |
-+#undef __field_ext_packed |
17340 |
-+#define __field_ext_packed(_type, _item, _filter_type) { \ |
17341 |
-+ .type = #_type, .name = #_item, \ |
17342 |
-+ .size = sizeof(_type), .align = 1, \ |
17343 |
-+ is_signed_type(_type), .filter_type = _filter_type }, |
17344 |
-+ |
17345 |
- #undef __field |
17346 |
- #define __field(_type, _item) __field_ext(_type, _item, FILTER_OTHER) |
17347 |
- |
17348 |
-@@ -94,6 +104,9 @@ static void __always_unused ____ftrace_check_##name(void) \ |
17349 |
- #undef __field_desc |
17350 |
- #define __field_desc(_type, _container, _item) __field_ext(_type, _item, FILTER_OTHER) |
17351 |
- |
17352 |
-+#undef __field_packed |
17353 |
-+#define __field_packed(_type, _container, _item) __field_ext_packed(_type, _item, FILTER_OTHER) |
17354 |
-+ |
17355 |
- #undef __array |
17356 |
- #define __array(_type, _item, _len) { \ |
17357 |
- .type = #_type"["__stringify(_len)"]", .name = #_item, \ |
17358 |
-@@ -129,6 +142,9 @@ static struct trace_event_fields ftrace_event_fields_##name[] = { \ |
17359 |
- #undef __field_desc |
17360 |
- #define __field_desc(type, container, item) |
17361 |
- |
17362 |
-+#undef __field_packed |
17363 |
-+#define __field_packed(type, container, item) |
17364 |
-+ |
17365 |
- #undef __array |
17366 |
- #define __array(type, item, len) |
17367 |
- |
17368 |
-diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c |
17369 |
-index 35989383ae11..8eeb95e04bf5 100644 |
17370 |
---- a/kernel/trace/trace_kprobe.c |
17371 |
-+++ b/kernel/trace/trace_kprobe.c |
17372 |
-@@ -1629,7 +1629,7 @@ int bpf_get_kprobe_info(const struct perf_event *event, u32 *fd_type, |
17373 |
- if (perf_type_tracepoint) |
17374 |
- tk = find_trace_kprobe(pevent, group); |
17375 |
- else |
17376 |
-- tk = event->tp_event->data; |
17377 |
-+ tk = trace_kprobe_primary_from_call(event->tp_event); |
17378 |
- if (!tk) |
17379 |
- return -EINVAL; |
17380 |
- |
17381 |
-diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c |
17382 |
-index ab8b6436d53f..f98d6d94cbbf 100644 |
17383 |
---- a/kernel/trace/trace_probe.c |
17384 |
-+++ b/kernel/trace/trace_probe.c |
17385 |
-@@ -639,8 +639,8 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size, |
17386 |
- ret = -EINVAL; |
17387 |
- goto fail; |
17388 |
- } |
17389 |
-- if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM) || |
17390 |
-- parg->count) { |
17391 |
-+ if ((code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM || |
17392 |
-+ code->op == FETCH_OP_DATA) || parg->count) { |
17393 |
- /* |
17394 |
- * IMM, DATA and COMM is pointing actual address, those |
17395 |
- * must be kept, and if parg->count != 0, this is an |
17396 |
-diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c |
17397 |
-index 2a8e8e9c1c75..fdd47f99b18f 100644 |
17398 |
---- a/kernel/trace/trace_uprobe.c |
17399 |
-+++ b/kernel/trace/trace_uprobe.c |
17400 |
-@@ -1412,7 +1412,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, |
17401 |
- if (perf_type_tracepoint) |
17402 |
- tu = find_probe_event(pevent, group); |
17403 |
- else |
17404 |
-- tu = event->tp_event->data; |
17405 |
-+ tu = trace_uprobe_primary_from_call(event->tp_event); |
17406 |
- if (!tu) |
17407 |
- return -EINVAL; |
17408 |
- |
17409 |
-diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c |
17410 |
-index 2c13ecc5bb2c..ed1f3df27260 100644 |
17411 |
---- a/lib/zlib_inflate/inffast.c |
17412 |
-+++ b/lib/zlib_inflate/inffast.c |
17413 |
-@@ -10,17 +10,6 @@ |
17414 |
- |
17415 |
- #ifndef ASMINF |
17416 |
- |
17417 |
--/* Allow machine dependent optimization for post-increment or pre-increment. |
17418 |
-- Based on testing to date, |
17419 |
-- Pre-increment preferred for: |
17420 |
-- - PowerPC G3 (Adler) |
17421 |
-- - MIPS R5000 (Randers-Pehrson) |
17422 |
-- Post-increment preferred for: |
17423 |
-- - none |
17424 |
-- No measurable difference: |
17425 |
-- - Pentium III (Anderson) |
17426 |
-- - M68060 (Nikl) |
17427 |
-- */ |
17428 |
- union uu { |
17429 |
- unsigned short us; |
17430 |
- unsigned char b[2]; |
17431 |
-@@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p) |
17432 |
- return mm.us; |
17433 |
- } |
17434 |
- |
17435 |
--#ifdef POSTINC |
17436 |
--# define OFF 0 |
17437 |
--# define PUP(a) *(a)++ |
17438 |
--# define UP_UNALIGNED(a) get_unaligned16((a)++) |
17439 |
--#else |
17440 |
--# define OFF 1 |
17441 |
--# define PUP(a) *++(a) |
17442 |
--# define UP_UNALIGNED(a) get_unaligned16(++(a)) |
17443 |
--#endif |
17444 |
-- |
17445 |
- /* |
17446 |
- Decode literal, length, and distance codes and write out the resulting |
17447 |
- literal and match bytes until either not enough input or output is |
17448 |
-@@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
17449 |
- |
17450 |
- /* copy state to local variables */ |
17451 |
- state = (struct inflate_state *)strm->state; |
17452 |
-- in = strm->next_in - OFF; |
17453 |
-+ in = strm->next_in; |
17454 |
- last = in + (strm->avail_in - 5); |
17455 |
-- out = strm->next_out - OFF; |
17456 |
-+ out = strm->next_out; |
17457 |
- beg = out - (start - strm->avail_out); |
17458 |
- end = out + (strm->avail_out - 257); |
17459 |
- #ifdef INFLATE_STRICT |
17460 |
-@@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
17461 |
- input data or output space */ |
17462 |
- do { |
17463 |
- if (bits < 15) { |
17464 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17465 |
-+ hold += (unsigned long)(*in++) << bits; |
17466 |
- bits += 8; |
17467 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17468 |
-+ hold += (unsigned long)(*in++) << bits; |
17469 |
- bits += 8; |
17470 |
- } |
17471 |
- this = lcode[hold & lmask]; |
17472 |
-@@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start) |
17473 |
- bits -= op; |
17474 |
- op = (unsigned)(this.op); |
17475 |
- if (op == 0) { /* literal */ |
17476 |
-- PUP(out) = (unsigned char)(this.val); |
17477 |
-+ *out++ = (unsigned char)(this.val); |
17478 |
- } |
17479 |
- else if (op & 16) { /* length base */ |
17480 |
- len = (unsigned)(this.val); |
17481 |
- op &= 15; /* number of extra bits */ |
17482 |
- if (op) { |
17483 |
- if (bits < op) { |
17484 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17485 |
-+ hold += (unsigned long)(*in++) << bits; |
17486 |
- bits += 8; |
17487 |
- } |
17488 |
- len += (unsigned)hold & ((1U << op) - 1); |
17489 |
-@@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start) |
17490 |
- bits -= op; |
17491 |
- } |
17492 |
- if (bits < 15) { |
17493 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17494 |
-+ hold += (unsigned long)(*in++) << bits; |
17495 |
- bits += 8; |
17496 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17497 |
-+ hold += (unsigned long)(*in++) << bits; |
17498 |
- bits += 8; |
17499 |
- } |
17500 |
- this = dcode[hold & dmask]; |
17501 |
-@@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start) |
17502 |
- dist = (unsigned)(this.val); |
17503 |
- op &= 15; /* number of extra bits */ |
17504 |
- if (bits < op) { |
17505 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17506 |
-+ hold += (unsigned long)(*in++) << bits; |
17507 |
- bits += 8; |
17508 |
- if (bits < op) { |
17509 |
-- hold += (unsigned long)(PUP(in)) << bits; |
17510 |
-+ hold += (unsigned long)(*in++) << bits; |
17511 |
- bits += 8; |
17512 |
- } |
17513 |
- } |
17514 |
-@@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start) |
17515 |
- state->mode = BAD; |
17516 |
- break; |
17517 |
- } |
17518 |
-- from = window - OFF; |
17519 |
-+ from = window; |
17520 |
- if (write == 0) { /* very common case */ |
17521 |
- from += wsize - op; |
17522 |
- if (op < len) { /* some from window */ |
17523 |
- len -= op; |
17524 |
- do { |
17525 |
-- PUP(out) = PUP(from); |
17526 |
-+ *out++ = *from++; |
17527 |
- } while (--op); |
17528 |
- from = out - dist; /* rest from output */ |
17529 |
- } |
17530 |
-@@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start) |
17531 |
- if (op < len) { /* some from end of window */ |
17532 |
- len -= op; |
17533 |
- do { |
17534 |
-- PUP(out) = PUP(from); |
17535 |
-+ *out++ = *from++; |
17536 |
- } while (--op); |
17537 |
-- from = window - OFF; |
17538 |
-+ from = window; |
17539 |
- if (write < len) { /* some from start of window */ |
17540 |
- op = write; |
17541 |
- len -= op; |
17542 |
- do { |
17543 |
-- PUP(out) = PUP(from); |
17544 |
-+ *out++ = *from++; |
17545 |
- } while (--op); |
17546 |
- from = out - dist; /* rest from output */ |
17547 |
- } |
17548 |
-@@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start) |
17549 |
- if (op < len) { /* some from window */ |
17550 |
- len -= op; |
17551 |
- do { |
17552 |
-- PUP(out) = PUP(from); |
17553 |
-+ *out++ = *from++; |
17554 |
- } while (--op); |
17555 |
- from = out - dist; /* rest from output */ |
17556 |
- } |
17557 |
- } |
17558 |
- while (len > 2) { |
17559 |
-- PUP(out) = PUP(from); |
17560 |
-- PUP(out) = PUP(from); |
17561 |
-- PUP(out) = PUP(from); |
17562 |
-+ *out++ = *from++; |
17563 |
-+ *out++ = *from++; |
17564 |
-+ *out++ = *from++; |
17565 |
- len -= 3; |
17566 |
- } |
17567 |
- if (len) { |
17568 |
-- PUP(out) = PUP(from); |
17569 |
-+ *out++ = *from++; |
17570 |
- if (len > 1) |
17571 |
-- PUP(out) = PUP(from); |
17572 |
-+ *out++ = *from++; |
17573 |
- } |
17574 |
- } |
17575 |
- else { |
17576 |
-@@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start) |
17577 |
- from = out - dist; /* copy direct from output */ |
17578 |
- /* minimum length is three */ |
17579 |
- /* Align out addr */ |
17580 |
-- if (!((long)(out - 1 + OFF) & 1)) { |
17581 |
-- PUP(out) = PUP(from); |
17582 |
-+ if (!((long)(out - 1) & 1)) { |
17583 |
-+ *out++ = *from++; |
17584 |
- len--; |
17585 |
- } |
17586 |
-- sout = (unsigned short *)(out - OFF); |
17587 |
-+ sout = (unsigned short *)(out); |
17588 |
- if (dist > 2) { |
17589 |
- unsigned short *sfrom; |
17590 |
- |
17591 |
-- sfrom = (unsigned short *)(from - OFF); |
17592 |
-+ sfrom = (unsigned short *)(from); |
17593 |
- loops = len >> 1; |
17594 |
- do |
17595 |
- #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
17596 |
-- PUP(sout) = PUP(sfrom); |
17597 |
-+ *sout++ = *sfrom++; |
17598 |
- #else |
17599 |
-- PUP(sout) = UP_UNALIGNED(sfrom); |
17600 |
-+ *sout++ = get_unaligned16(sfrom++); |
17601 |
- #endif |
17602 |
- while (--loops); |
17603 |
-- out = (unsigned char *)sout + OFF; |
17604 |
-- from = (unsigned char *)sfrom + OFF; |
17605 |
-+ out = (unsigned char *)sout; |
17606 |
-+ from = (unsigned char *)sfrom; |
17607 |
- } else { /* dist == 1 or dist == 2 */ |
17608 |
- unsigned short pat16; |
17609 |
- |
17610 |
-- pat16 = *(sout-1+OFF); |
17611 |
-+ pat16 = *(sout-1); |
17612 |
- if (dist == 1) { |
17613 |
- union uu mm; |
17614 |
- /* copy one char pattern to both bytes */ |
17615 |
-@@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start) |
17616 |
- } |
17617 |
- loops = len >> 1; |
17618 |
- do |
17619 |
-- PUP(sout) = pat16; |
17620 |
-+ *sout++ = pat16; |
17621 |
- while (--loops); |
17622 |
-- out = (unsigned char *)sout + OFF; |
17623 |
-+ out = (unsigned char *)sout; |
17624 |
- } |
17625 |
- if (len & 1) |
17626 |
-- PUP(out) = PUP(from); |
17627 |
-+ *out++ = *from++; |
17628 |
- } |
17629 |
- } |
17630 |
- else if ((op & 64) == 0) { /* 2nd level distance code */ |
17631 |
-@@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start) |
17632 |
- hold &= (1U << bits) - 1; |
17633 |
- |
17634 |
- /* update state and return */ |
17635 |
-- strm->next_in = in + OFF; |
17636 |
-- strm->next_out = out + OFF; |
17637 |
-+ strm->next_in = in; |
17638 |
-+ strm->next_out = out; |
17639 |
- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); |
17640 |
- strm->avail_out = (unsigned)(out < end ? |
17641 |
- 257 + (end - out) : 257 - (out - end)); |
17642 |
-diff --git a/net/core/dev.c b/net/core/dev.c |
17643 |
-index 2d8aceee4284..93a279ab4e97 100644 |
17644 |
---- a/net/core/dev.c |
17645 |
-+++ b/net/core/dev.c |
17646 |
-@@ -79,6 +79,7 @@ |
17647 |
- #include <linux/sched.h> |
17648 |
- #include <linux/sched/mm.h> |
17649 |
- #include <linux/mutex.h> |
17650 |
-+#include <linux/rwsem.h> |
17651 |
- #include <linux/string.h> |
17652 |
- #include <linux/mm.h> |
17653 |
- #include <linux/socket.h> |
17654 |
-@@ -194,7 +195,7 @@ static DEFINE_SPINLOCK(napi_hash_lock); |
17655 |
- static unsigned int napi_gen_id = NR_CPUS; |
17656 |
- static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8); |
17657 |
- |
17658 |
--static seqcount_t devnet_rename_seq; |
17659 |
-+static DECLARE_RWSEM(devnet_rename_sem); |
17660 |
- |
17661 |
- static inline void dev_base_seq_inc(struct net *net) |
17662 |
- { |
17663 |
-@@ -930,33 +931,28 @@ EXPORT_SYMBOL(dev_get_by_napi_id); |
17664 |
- * @net: network namespace |
17665 |
- * @name: a pointer to the buffer where the name will be stored. |
17666 |
- * @ifindex: the ifindex of the interface to get the name from. |
17667 |
-- * |
17668 |
-- * The use of raw_seqcount_begin() and cond_resched() before |
17669 |
-- * retrying is required as we want to give the writers a chance |
17670 |
-- * to complete when CONFIG_PREEMPTION is not set. |
17671 |
- */ |
17672 |
- int netdev_get_name(struct net *net, char *name, int ifindex) |
17673 |
- { |
17674 |
- struct net_device *dev; |
17675 |
-- unsigned int seq; |
17676 |
-+ int ret; |
17677 |
- |
17678 |
--retry: |
17679 |
-- seq = raw_seqcount_begin(&devnet_rename_seq); |
17680 |
-+ down_read(&devnet_rename_sem); |
17681 |
- rcu_read_lock(); |
17682 |
-+ |
17683 |
- dev = dev_get_by_index_rcu(net, ifindex); |
17684 |
- if (!dev) { |
17685 |
-- rcu_read_unlock(); |
17686 |
-- return -ENODEV; |
17687 |
-+ ret = -ENODEV; |
17688 |
-+ goto out; |
17689 |
- } |
17690 |
- |
17691 |
- strcpy(name, dev->name); |
17692 |
-- rcu_read_unlock(); |
17693 |
-- if (read_seqcount_retry(&devnet_rename_seq, seq)) { |
17694 |
-- cond_resched(); |
17695 |
-- goto retry; |
17696 |
-- } |
17697 |
- |
17698 |
-- return 0; |
17699 |
-+ ret = 0; |
17700 |
-+out: |
17701 |
-+ rcu_read_unlock(); |
17702 |
-+ up_read(&devnet_rename_sem); |
17703 |
-+ return ret; |
17704 |
- } |
17705 |
- |
17706 |
- /** |
17707 |
-@@ -1228,10 +1224,10 @@ int dev_change_name(struct net_device *dev, const char *newname) |
17708 |
- likely(!(dev->priv_flags & IFF_LIVE_RENAME_OK))) |
17709 |
- return -EBUSY; |
17710 |
- |
17711 |
-- write_seqcount_begin(&devnet_rename_seq); |
17712 |
-+ down_write(&devnet_rename_sem); |
17713 |
- |
17714 |
- if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { |
17715 |
-- write_seqcount_end(&devnet_rename_seq); |
17716 |
-+ up_write(&devnet_rename_sem); |
17717 |
- return 0; |
17718 |
- } |
17719 |
- |
17720 |
-@@ -1239,7 +1235,7 @@ int dev_change_name(struct net_device *dev, const char *newname) |
17721 |
- |
17722 |
- err = dev_get_valid_name(net, dev, newname); |
17723 |
- if (err < 0) { |
17724 |
-- write_seqcount_end(&devnet_rename_seq); |
17725 |
-+ up_write(&devnet_rename_sem); |
17726 |
- return err; |
17727 |
- } |
17728 |
- |
17729 |
-@@ -1254,11 +1250,11 @@ rollback: |
17730 |
- if (ret) { |
17731 |
- memcpy(dev->name, oldname, IFNAMSIZ); |
17732 |
- dev->name_assign_type = old_assign_type; |
17733 |
-- write_seqcount_end(&devnet_rename_seq); |
17734 |
-+ up_write(&devnet_rename_sem); |
17735 |
- return ret; |
17736 |
- } |
17737 |
- |
17738 |
-- write_seqcount_end(&devnet_rename_seq); |
17739 |
-+ up_write(&devnet_rename_sem); |
17740 |
- |
17741 |
- netdev_adjacent_rename_links(dev, oldname); |
17742 |
- |
17743 |
-@@ -1279,7 +1275,7 @@ rollback: |
17744 |
- /* err >= 0 after dev_alloc_name() or stores the first errno */ |
17745 |
- if (err >= 0) { |
17746 |
- err = ret; |
17747 |
-- write_seqcount_begin(&devnet_rename_seq); |
17748 |
-+ down_write(&devnet_rename_sem); |
17749 |
- memcpy(dev->name, oldname, IFNAMSIZ); |
17750 |
- memcpy(oldname, newname, IFNAMSIZ); |
17751 |
- dev->name_assign_type = old_assign_type; |
17752 |
-diff --git a/net/core/filter.c b/net/core/filter.c |
17753 |
-index 11b97c31bca5..9512a9772d69 100644 |
17754 |
---- a/net/core/filter.c |
17755 |
-+++ b/net/core/filter.c |
17756 |
-@@ -1766,25 +1766,27 @@ BPF_CALL_5(bpf_skb_load_bytes_relative, const struct sk_buff *, skb, |
17757 |
- u32, offset, void *, to, u32, len, u32, start_header) |
17758 |
- { |
17759 |
- u8 *end = skb_tail_pointer(skb); |
17760 |
-- u8 *net = skb_network_header(skb); |
17761 |
-- u8 *mac = skb_mac_header(skb); |
17762 |
-- u8 *ptr; |
17763 |
-+ u8 *start, *ptr; |
17764 |
- |
17765 |
-- if (unlikely(offset > 0xffff || len > (end - mac))) |
17766 |
-+ if (unlikely(offset > 0xffff)) |
17767 |
- goto err_clear; |
17768 |
- |
17769 |
- switch (start_header) { |
17770 |
- case BPF_HDR_START_MAC: |
17771 |
-- ptr = mac + offset; |
17772 |
-+ if (unlikely(!skb_mac_header_was_set(skb))) |
17773 |
-+ goto err_clear; |
17774 |
-+ start = skb_mac_header(skb); |
17775 |
- break; |
17776 |
- case BPF_HDR_START_NET: |
17777 |
-- ptr = net + offset; |
17778 |
-+ start = skb_network_header(skb); |
17779 |
- break; |
17780 |
- default: |
17781 |
- goto err_clear; |
17782 |
- } |
17783 |
- |
17784 |
-- if (likely(ptr >= mac && ptr + len <= end)) { |
17785 |
-+ ptr = start + offset; |
17786 |
-+ |
17787 |
-+ if (likely(ptr + len <= end)) { |
17788 |
- memcpy(to, ptr, len); |
17789 |
- return 0; |
17790 |
- } |
17791 |
-diff --git a/net/core/sock_map.c b/net/core/sock_map.c |
17792 |
-index b08dfae10f88..591457fcbd02 100644 |
17793 |
---- a/net/core/sock_map.c |
17794 |
-+++ b/net/core/sock_map.c |
17795 |
-@@ -417,10 +417,7 @@ static int sock_map_get_next_key(struct bpf_map *map, void *key, void *next) |
17796 |
- return 0; |
17797 |
- } |
17798 |
- |
17799 |
--static bool sock_map_redirect_allowed(const struct sock *sk) |
17800 |
--{ |
17801 |
-- return sk->sk_state != TCP_LISTEN; |
17802 |
--} |
17803 |
-+static bool sock_map_redirect_allowed(const struct sock *sk); |
17804 |
- |
17805 |
- static int sock_map_update_common(struct bpf_map *map, u32 idx, |
17806 |
- struct sock *sk, u64 flags) |
17807 |
-@@ -501,6 +498,11 @@ static bool sk_is_udp(const struct sock *sk) |
17808 |
- sk->sk_protocol == IPPROTO_UDP; |
17809 |
- } |
17810 |
- |
17811 |
-+static bool sock_map_redirect_allowed(const struct sock *sk) |
17812 |
-+{ |
17813 |
-+ return sk_is_tcp(sk) && sk->sk_state != TCP_LISTEN; |
17814 |
-+} |
17815 |
-+ |
17816 |
- static bool sock_map_sk_is_suitable(const struct sock *sk) |
17817 |
- { |
17818 |
- return sk_is_tcp(sk) || sk_is_udp(sk); |
17819 |
-@@ -982,11 +984,15 @@ static struct bpf_map *sock_hash_alloc(union bpf_attr *attr) |
17820 |
- err = -EINVAL; |
17821 |
- goto free_htab; |
17822 |
- } |
17823 |
-+ err = bpf_map_charge_init(&htab->map.memory, cost); |
17824 |
-+ if (err) |
17825 |
-+ goto free_htab; |
17826 |
- |
17827 |
- htab->buckets = bpf_map_area_alloc(htab->buckets_num * |
17828 |
- sizeof(struct bpf_htab_bucket), |
17829 |
- htab->map.numa_node); |
17830 |
- if (!htab->buckets) { |
17831 |
-+ bpf_map_charge_finish(&htab->map.memory); |
17832 |
- err = -ENOMEM; |
17833 |
- goto free_htab; |
17834 |
- } |
17835 |
-@@ -1006,6 +1012,7 @@ static void sock_hash_free(struct bpf_map *map) |
17836 |
- { |
17837 |
- struct bpf_htab *htab = container_of(map, struct bpf_htab, map); |
17838 |
- struct bpf_htab_bucket *bucket; |
17839 |
-+ struct hlist_head unlink_list; |
17840 |
- struct bpf_htab_elem *elem; |
17841 |
- struct hlist_node *node; |
17842 |
- int i; |
17843 |
-@@ -1017,13 +1024,32 @@ static void sock_hash_free(struct bpf_map *map) |
17844 |
- synchronize_rcu(); |
17845 |
- for (i = 0; i < htab->buckets_num; i++) { |
17846 |
- bucket = sock_hash_select_bucket(htab, i); |
17847 |
-- hlist_for_each_entry_safe(elem, node, &bucket->head, node) { |
17848 |
-- hlist_del_rcu(&elem->node); |
17849 |
-+ |
17850 |
-+ /* We are racing with sock_hash_delete_from_link to |
17851 |
-+ * enter the spin-lock critical section. Every socket on |
17852 |
-+ * the list is still linked to sockhash. Since link |
17853 |
-+ * exists, psock exists and holds a ref to socket. That |
17854 |
-+ * lets us to grab a socket ref too. |
17855 |
-+ */ |
17856 |
-+ raw_spin_lock_bh(&bucket->lock); |
17857 |
-+ hlist_for_each_entry(elem, &bucket->head, node) |
17858 |
-+ sock_hold(elem->sk); |
17859 |
-+ hlist_move_list(&bucket->head, &unlink_list); |
17860 |
-+ raw_spin_unlock_bh(&bucket->lock); |
17861 |
-+ |
17862 |
-+ /* Process removed entries out of atomic context to |
17863 |
-+ * block for socket lock before deleting the psock's |
17864 |
-+ * link to sockhash. |
17865 |
-+ */ |
17866 |
-+ hlist_for_each_entry_safe(elem, node, &unlink_list, node) { |
17867 |
-+ hlist_del(&elem->node); |
17868 |
- lock_sock(elem->sk); |
17869 |
- rcu_read_lock(); |
17870 |
- sock_map_unref(elem->sk, elem); |
17871 |
- rcu_read_unlock(); |
17872 |
- release_sock(elem->sk); |
17873 |
-+ sock_put(elem->sk); |
17874 |
-+ sock_hash_free_elem(htab, elem); |
17875 |
- } |
17876 |
- } |
17877 |
- |
17878 |
-diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
17879 |
-index 629aaa9a1eb9..7aa68f4aae6c 100644 |
17880 |
---- a/net/ipv4/tcp_bpf.c |
17881 |
-+++ b/net/ipv4/tcp_bpf.c |
17882 |
-@@ -64,6 +64,9 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock, |
17883 |
- } while (i != msg_rx->sg.end); |
17884 |
- |
17885 |
- if (unlikely(peek)) { |
17886 |
-+ if (msg_rx == list_last_entry(&psock->ingress_msg, |
17887 |
-+ struct sk_msg, list)) |
17888 |
-+ break; |
17889 |
- msg_rx = list_next_entry(msg_rx, list); |
17890 |
- continue; |
17891 |
- } |
17892 |
-@@ -242,6 +245,9 @@ static int tcp_bpf_wait_data(struct sock *sk, struct sk_psock *psock, |
17893 |
- DEFINE_WAIT_FUNC(wait, woken_wake_function); |
17894 |
- int ret = 0; |
17895 |
- |
17896 |
-+ if (sk->sk_shutdown & RCV_SHUTDOWN) |
17897 |
-+ return 1; |
17898 |
-+ |
17899 |
- if (!timeo) |
17900 |
- return ret; |
17901 |
- |
17902 |
-diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c |
17903 |
-index 8b5acc6910fd..8c04388296b0 100644 |
17904 |
---- a/net/netfilter/nft_set_pipapo.c |
17905 |
-+++ b/net/netfilter/nft_set_pipapo.c |
17906 |
-@@ -1242,7 +1242,9 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, |
17907 |
- end += NFT_PIPAPO_GROUPS_PADDED_SIZE(f); |
17908 |
- } |
17909 |
- |
17910 |
-- if (!*this_cpu_ptr(m->scratch) || bsize_max > m->bsize_max) { |
17911 |
-+ if (!*get_cpu_ptr(m->scratch) || bsize_max > m->bsize_max) { |
17912 |
-+ put_cpu_ptr(m->scratch); |
17913 |
-+ |
17914 |
- err = pipapo_realloc_scratch(m, bsize_max); |
17915 |
- if (err) |
17916 |
- return err; |
17917 |
-@@ -1250,6 +1252,8 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, |
17918 |
- this_cpu_write(nft_pipapo_scratch_index, false); |
17919 |
- |
17920 |
- m->bsize_max = bsize_max; |
17921 |
-+ } else { |
17922 |
-+ put_cpu_ptr(m->scratch); |
17923 |
- } |
17924 |
- |
17925 |
- *ext2 = &e->ext; |
17926 |
-diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c |
17927 |
-index 62f416bc0579..b6aad3fc46c3 100644 |
17928 |
---- a/net/netfilter/nft_set_rbtree.c |
17929 |
-+++ b/net/netfilter/nft_set_rbtree.c |
17930 |
-@@ -271,12 +271,14 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
17931 |
- |
17932 |
- if (nft_rbtree_interval_start(new)) { |
17933 |
- if (nft_rbtree_interval_end(rbe) && |
17934 |
-- nft_set_elem_active(&rbe->ext, genmask)) |
17935 |
-+ nft_set_elem_active(&rbe->ext, genmask) && |
17936 |
-+ !nft_set_elem_expired(&rbe->ext)) |
17937 |
- overlap = false; |
17938 |
- } else { |
17939 |
- overlap = nft_rbtree_interval_end(rbe) && |
17940 |
- nft_set_elem_active(&rbe->ext, |
17941 |
-- genmask); |
17942 |
-+ genmask) && |
17943 |
-+ !nft_set_elem_expired(&rbe->ext); |
17944 |
- } |
17945 |
- } else if (d > 0) { |
17946 |
- p = &parent->rb_right; |
17947 |
-@@ -284,9 +286,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
17948 |
- if (nft_rbtree_interval_end(new)) { |
17949 |
- overlap = nft_rbtree_interval_end(rbe) && |
17950 |
- nft_set_elem_active(&rbe->ext, |
17951 |
-- genmask); |
17952 |
-+ genmask) && |
17953 |
-+ !nft_set_elem_expired(&rbe->ext); |
17954 |
- } else if (nft_rbtree_interval_end(rbe) && |
17955 |
-- nft_set_elem_active(&rbe->ext, genmask)) { |
17956 |
-+ nft_set_elem_active(&rbe->ext, genmask) && |
17957 |
-+ !nft_set_elem_expired(&rbe->ext)) { |
17958 |
- overlap = true; |
17959 |
- } |
17960 |
- } else { |
17961 |
-@@ -294,15 +298,18 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, |
17962 |
- nft_rbtree_interval_start(new)) { |
17963 |
- p = &parent->rb_left; |
17964 |
- |
17965 |
-- if (nft_set_elem_active(&rbe->ext, genmask)) |
17966 |
-+ if (nft_set_elem_active(&rbe->ext, genmask) && |
17967 |
-+ !nft_set_elem_expired(&rbe->ext)) |
17968 |
- overlap = false; |
17969 |
- } else if (nft_rbtree_interval_start(rbe) && |
17970 |
- nft_rbtree_interval_end(new)) { |
17971 |
- p = &parent->rb_right; |
17972 |
- |
17973 |
-- if (nft_set_elem_active(&rbe->ext, genmask)) |
17974 |
-+ if (nft_set_elem_active(&rbe->ext, genmask) && |
17975 |
-+ !nft_set_elem_expired(&rbe->ext)) |
17976 |
- overlap = false; |
17977 |
-- } else if (nft_set_elem_active(&rbe->ext, genmask)) { |
17978 |
-+ } else if (nft_set_elem_active(&rbe->ext, genmask) && |
17979 |
-+ !nft_set_elem_expired(&rbe->ext)) { |
17980 |
- *ext = &rbe->ext; |
17981 |
- return -EEXIST; |
17982 |
- } else { |
17983 |
-diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c |
17984 |
-index 8b179e3c802a..543afd9bd664 100644 |
17985 |
---- a/net/rxrpc/proc.c |
17986 |
-+++ b/net/rxrpc/proc.c |
17987 |
-@@ -68,7 +68,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
17988 |
- "Proto Local " |
17989 |
- " Remote " |
17990 |
- " SvID ConnID CallID End Use State Abort " |
17991 |
-- " UserID TxSeq TW RxSeq RW RxSerial RxTimo\n"); |
17992 |
-+ " DebugId TxSeq TW RxSeq RW RxSerial RxTimo\n"); |
17993 |
- return 0; |
17994 |
- } |
17995 |
- |
17996 |
-@@ -100,7 +100,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
17997 |
- rx_hard_ack = READ_ONCE(call->rx_hard_ack); |
17998 |
- seq_printf(seq, |
17999 |
- "UDP %-47.47s %-47.47s %4x %08x %08x %s %3u" |
18000 |
-- " %-8.8s %08x %lx %08x %02x %08x %02x %08x %06lx\n", |
18001 |
-+ " %-8.8s %08x %08x %08x %02x %08x %02x %08x %06lx\n", |
18002 |
- lbuff, |
18003 |
- rbuff, |
18004 |
- call->service_id, |
18005 |
-@@ -110,7 +110,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) |
18006 |
- atomic_read(&call->usage), |
18007 |
- rxrpc_call_states[call->state], |
18008 |
- call->abort_code, |
18009 |
-- call->user_call_ID, |
18010 |
-+ call->debug_id, |
18011 |
- tx_hard_ack, READ_ONCE(call->tx_top) - tx_hard_ack, |
18012 |
- rx_hard_ack, READ_ONCE(call->rx_top) - rx_hard_ack, |
18013 |
- call->rx_serial, |
18014 |
-diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c |
18015 |
-index 8b4d72b1a066..010dcb876f9d 100644 |
18016 |
---- a/net/sunrpc/addr.c |
18017 |
-+++ b/net/sunrpc/addr.c |
18018 |
-@@ -82,11 +82,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap, |
18019 |
- |
18020 |
- rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u", |
18021 |
- IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id); |
18022 |
-- if (unlikely((size_t)rc > sizeof(scopebuf))) |
18023 |
-+ if (unlikely((size_t)rc >= sizeof(scopebuf))) |
18024 |
- return 0; |
18025 |
- |
18026 |
- len += rc; |
18027 |
-- if (unlikely(len > buflen)) |
18028 |
-+ if (unlikely(len >= buflen)) |
18029 |
- return 0; |
18030 |
- |
18031 |
- strcat(buf, scopebuf); |
18032 |
-diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c |
18033 |
-index c350108aa38d..a4676107fad0 100644 |
18034 |
---- a/net/xdp/xsk.c |
18035 |
-+++ b/net/xdp/xsk.c |
18036 |
-@@ -397,10 +397,8 @@ static int xsk_generic_xmit(struct sock *sk) |
18037 |
- |
18038 |
- len = desc.len; |
18039 |
- skb = sock_alloc_send_skb(sk, len, 1, &err); |
18040 |
-- if (unlikely(!skb)) { |
18041 |
-- err = -EAGAIN; |
18042 |
-+ if (unlikely(!skb)) |
18043 |
- goto out; |
18044 |
-- } |
18045 |
- |
18046 |
- skb_put(skb, len); |
18047 |
- addr = desc.addr; |
18048 |
-diff --git a/samples/ftrace/sample-trace-array.c b/samples/ftrace/sample-trace-array.c |
18049 |
-index d523450d73eb..6aba02a31c96 100644 |
18050 |
---- a/samples/ftrace/sample-trace-array.c |
18051 |
-+++ b/samples/ftrace/sample-trace-array.c |
18052 |
-@@ -6,6 +6,7 @@ |
18053 |
- #include <linux/timer.h> |
18054 |
- #include <linux/err.h> |
18055 |
- #include <linux/jiffies.h> |
18056 |
-+#include <linux/workqueue.h> |
18057 |
- |
18058 |
- /* |
18059 |
- * Any file that uses trace points, must include the header. |
18060 |
-@@ -20,6 +21,16 @@ struct trace_array *tr; |
18061 |
- static void mytimer_handler(struct timer_list *unused); |
18062 |
- static struct task_struct *simple_tsk; |
18063 |
- |
18064 |
-+static void trace_work_fn(struct work_struct *work) |
18065 |
-+{ |
18066 |
-+ /* |
18067 |
-+ * Disable tracing for event "sample_event". |
18068 |
-+ */ |
18069 |
-+ trace_array_set_clr_event(tr, "sample-subsystem", "sample_event", |
18070 |
-+ false); |
18071 |
-+} |
18072 |
-+static DECLARE_WORK(trace_work, trace_work_fn); |
18073 |
-+ |
18074 |
- /* |
18075 |
- * mytimer: Timer setup to disable tracing for event "sample_event". This |
18076 |
- * timer is only for the purposes of the sample module to demonstrate access of |
18077 |
-@@ -29,11 +40,7 @@ static DEFINE_TIMER(mytimer, mytimer_handler); |
18078 |
- |
18079 |
- static void mytimer_handler(struct timer_list *unused) |
18080 |
- { |
18081 |
-- /* |
18082 |
-- * Disable tracing for event "sample_event". |
18083 |
-- */ |
18084 |
-- trace_array_set_clr_event(tr, "sample-subsystem", "sample_event", |
18085 |
-- false); |
18086 |
-+ schedule_work(&trace_work); |
18087 |
- } |
18088 |
- |
18089 |
- static void simple_thread_func(int count) |
18090 |
-@@ -76,6 +83,7 @@ static int simple_thread(void *arg) |
18091 |
- simple_thread_func(count++); |
18092 |
- |
18093 |
- del_timer(&mytimer); |
18094 |
-+ cancel_work_sync(&trace_work); |
18095 |
- |
18096 |
- /* |
18097 |
- * trace_array_put() decrements the reference counter associated with |
18098 |
-@@ -107,8 +115,12 @@ static int __init sample_trace_array_init(void) |
18099 |
- trace_printk_init_buffers(); |
18100 |
- |
18101 |
- simple_tsk = kthread_run(simple_thread, NULL, "sample-instance"); |
18102 |
-- if (IS_ERR(simple_tsk)) |
18103 |
-+ if (IS_ERR(simple_tsk)) { |
18104 |
-+ trace_array_put(tr); |
18105 |
-+ trace_array_destroy(tr); |
18106 |
- return -1; |
18107 |
-+ } |
18108 |
-+ |
18109 |
- return 0; |
18110 |
- } |
18111 |
- |
18112 |
-diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost |
18113 |
-index 957eed6a17a5..33aaa572f686 100644 |
18114 |
---- a/scripts/Makefile.modpost |
18115 |
-+++ b/scripts/Makefile.modpost |
18116 |
-@@ -66,7 +66,7 @@ __modpost: |
18117 |
- |
18118 |
- else |
18119 |
- |
18120 |
--MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - \ |
18121 |
-+MODPOST += -s -T - \ |
18122 |
- $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) |
18123 |
- |
18124 |
- ifeq ($(KBUILD_EXTMOD),) |
18125 |
-@@ -82,6 +82,11 @@ include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ |
18126 |
- $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) |
18127 |
- endif |
18128 |
- |
18129 |
-+# 'make -i -k' ignores compile errors, and builds as many modules as possible. |
18130 |
-+ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) |
18131 |
-+MODPOST += -n |
18132 |
-+endif |
18133 |
-+ |
18134 |
- # find all modules listed in modules.order |
18135 |
- modules := $(sort $(shell cat $(MODORDER))) |
18136 |
- |
18137 |
-diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh |
18138 |
-index a07668a5c36b..94a833597a88 100755 |
18139 |
---- a/scripts/headers_install.sh |
18140 |
-+++ b/scripts/headers_install.sh |
18141 |
-@@ -64,7 +64,7 @@ configs=$(sed -e ' |
18142 |
- d |
18143 |
- ' $OUTFILE) |
18144 |
- |
18145 |
--# The entries in the following list are not warned. |
18146 |
-+# The entries in the following list do not result in an error. |
18147 |
- # Please do not add a new entry. This list is only for existing ones. |
18148 |
- # The list will be reduced gradually, and deleted eventually. (hopefully) |
18149 |
- # |
18150 |
-@@ -98,18 +98,19 @@ include/uapi/linux/raw.h:CONFIG_MAX_RAW_DEVS |
18151 |
- |
18152 |
- for c in $configs |
18153 |
- do |
18154 |
-- warn=1 |
18155 |
-+ leak_error=1 |
18156 |
- |
18157 |
- for ignore in $config_leak_ignores |
18158 |
- do |
18159 |
- if echo "$INFILE:$c" | grep -q "$ignore$"; then |
18160 |
-- warn= |
18161 |
-+ leak_error= |
18162 |
- break |
18163 |
- fi |
18164 |
- done |
18165 |
- |
18166 |
-- if [ "$warn" = 1 ]; then |
18167 |
-- echo "warning: $INFILE: leak $c to user-space" >&2 |
18168 |
-+ if [ "$leak_error" = 1 ]; then |
18169 |
-+ echo "error: $INFILE: leak $c to user-space" >&2 |
18170 |
-+ exit 1 |
18171 |
- fi |
18172 |
- done |
18173 |
- |
18174 |
-diff --git a/scripts/mksysmap b/scripts/mksysmap |
18175 |
-index a35acc0d0b82..9aa23d15862a 100755 |
18176 |
---- a/scripts/mksysmap |
18177 |
-+++ b/scripts/mksysmap |
18178 |
-@@ -41,4 +41,4 @@ |
18179 |
- # so we just ignore them to let readprofile continue to work. |
18180 |
- # (At least sparc64 has __crc_ in the middle). |
18181 |
- |
18182 |
--$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2 |
18183 |
-+$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2 |
18184 |
-diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c |
18185 |
-index a84ef030fbd7..4cfa58c07778 100644 |
18186 |
---- a/security/apparmor/domain.c |
18187 |
-+++ b/security/apparmor/domain.c |
18188 |
-@@ -929,7 +929,8 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm) |
18189 |
- * aways results in a further reduction of permissions. |
18190 |
- */ |
18191 |
- if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && |
18192 |
-- !unconfined(label) && !aa_label_is_subset(new, ctx->nnp)) { |
18193 |
-+ !unconfined(label) && |
18194 |
-+ !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
18195 |
- error = -EPERM; |
18196 |
- info = "no new privs"; |
18197 |
- goto audit; |
18198 |
-@@ -1207,7 +1208,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags) |
18199 |
- * reduce restrictions. |
18200 |
- */ |
18201 |
- if (task_no_new_privs(current) && !unconfined(label) && |
18202 |
-- !aa_label_is_subset(new, ctx->nnp)) { |
18203 |
-+ !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
18204 |
- /* not an apparmor denial per se, so don't log it */ |
18205 |
- AA_DEBUG("no_new_privs - change_hat denied"); |
18206 |
- error = -EPERM; |
18207 |
-@@ -1228,7 +1229,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags) |
18208 |
- * reduce restrictions. |
18209 |
- */ |
18210 |
- if (task_no_new_privs(current) && !unconfined(label) && |
18211 |
-- !aa_label_is_subset(previous, ctx->nnp)) { |
18212 |
-+ !aa_label_is_unconfined_subset(previous, ctx->nnp)) { |
18213 |
- /* not an apparmor denial per se, so don't log it */ |
18214 |
- AA_DEBUG("no_new_privs - change_hat denied"); |
18215 |
- error = -EPERM; |
18216 |
-@@ -1423,7 +1424,7 @@ check: |
18217 |
- * reduce restrictions. |
18218 |
- */ |
18219 |
- if (task_no_new_privs(current) && !unconfined(label) && |
18220 |
-- !aa_label_is_subset(new, ctx->nnp)) { |
18221 |
-+ !aa_label_is_unconfined_subset(new, ctx->nnp)) { |
18222 |
- /* not an apparmor denial per se, so don't log it */ |
18223 |
- AA_DEBUG("no_new_privs - change_hat denied"); |
18224 |
- error = -EPERM; |
18225 |
-diff --git a/security/apparmor/include/label.h b/security/apparmor/include/label.h |
18226 |
-index 47942c4ba7ca..255764ab06e2 100644 |
18227 |
---- a/security/apparmor/include/label.h |
18228 |
-+++ b/security/apparmor/include/label.h |
18229 |
-@@ -281,6 +281,7 @@ bool aa_label_init(struct aa_label *label, int size, gfp_t gfp); |
18230 |
- struct aa_label *aa_label_alloc(int size, struct aa_proxy *proxy, gfp_t gfp); |
18231 |
- |
18232 |
- bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub); |
18233 |
-+bool aa_label_is_unconfined_subset(struct aa_label *set, struct aa_label *sub); |
18234 |
- struct aa_profile *__aa_label_next_not_in_set(struct label_it *I, |
18235 |
- struct aa_label *set, |
18236 |
- struct aa_label *sub); |
18237 |
-diff --git a/security/apparmor/label.c b/security/apparmor/label.c |
18238 |
-index 470693239e64..5f324d63ceaa 100644 |
18239 |
---- a/security/apparmor/label.c |
18240 |
-+++ b/security/apparmor/label.c |
18241 |
-@@ -550,6 +550,39 @@ bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub) |
18242 |
- return __aa_label_next_not_in_set(&i, set, sub) == NULL; |
18243 |
- } |
18244 |
- |
18245 |
-+/** |
18246 |
-+ * aa_label_is_unconfined_subset - test if @sub is a subset of @set |
18247 |
-+ * @set: label to test against |
18248 |
-+ * @sub: label to test if is subset of @set |
18249 |
-+ * |
18250 |
-+ * This checks for subset but taking into account unconfined. IF |
18251 |
-+ * @sub contains an unconfined profile that does not have a matching |
18252 |
-+ * unconfined in @set then this will not cause the test to fail. |
18253 |
-+ * Conversely we don't care about an unconfined in @set that is not in |
18254 |
-+ * @sub |
18255 |
-+ * |
18256 |
-+ * Returns: true if @sub is special_subset of @set |
18257 |
-+ * else false |
18258 |
-+ */ |
18259 |
-+bool aa_label_is_unconfined_subset(struct aa_label *set, struct aa_label *sub) |
18260 |
-+{ |
18261 |
-+ struct label_it i = { }; |
18262 |
-+ struct aa_profile *p; |
18263 |
-+ |
18264 |
-+ AA_BUG(!set); |
18265 |
-+ AA_BUG(!sub); |
18266 |
-+ |
18267 |
-+ if (sub == set) |
18268 |
-+ return true; |
18269 |
-+ |
18270 |
-+ do { |
18271 |
-+ p = __aa_label_next_not_in_set(&i, set, sub); |
18272 |
-+ if (p && !profile_unconfined(p)) |
18273 |
-+ break; |
18274 |
-+ } while (p); |
18275 |
-+ |
18276 |
-+ return p == NULL; |
18277 |
-+} |
18278 |
- |
18279 |
- |
18280 |
- /** |
18281 |
-@@ -1531,13 +1564,13 @@ static const char *label_modename(struct aa_ns *ns, struct aa_label *label, |
18282 |
- |
18283 |
- label_for_each(i, label, profile) { |
18284 |
- if (aa_ns_visible(ns, profile->ns, flags & FLAG_VIEW_SUBNS)) { |
18285 |
-- if (profile->mode == APPARMOR_UNCONFINED) |
18286 |
-+ count++; |
18287 |
-+ if (profile == profile->ns->unconfined) |
18288 |
- /* special case unconfined so stacks with |
18289 |
- * unconfined don't report as mixed. ie. |
18290 |
- * profile_foo//&:ns1:unconfined (mixed) |
18291 |
- */ |
18292 |
- continue; |
18293 |
-- count++; |
18294 |
- if (mode == -1) |
18295 |
- mode = profile->mode; |
18296 |
- else if (mode != profile->mode) |
18297 |
-diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c |
18298 |
-index b621ad74f54a..66a8504c8bea 100644 |
18299 |
---- a/security/apparmor/lsm.c |
18300 |
-+++ b/security/apparmor/lsm.c |
18301 |
-@@ -804,7 +804,12 @@ static void apparmor_sk_clone_security(const struct sock *sk, |
18302 |
- struct aa_sk_ctx *ctx = SK_CTX(sk); |
18303 |
- struct aa_sk_ctx *new = SK_CTX(newsk); |
18304 |
- |
18305 |
-+ if (new->label) |
18306 |
-+ aa_put_label(new->label); |
18307 |
- new->label = aa_get_label(ctx->label); |
18308 |
-+ |
18309 |
-+ if (new->peer) |
18310 |
-+ aa_put_label(new->peer); |
18311 |
- new->peer = aa_get_label(ctx->peer); |
18312 |
- } |
18313 |
- |
18314 |
-diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c |
18315 |
-index da94a1b4bfda..0cc7cdd58465 100644 |
18316 |
---- a/security/selinux/ss/conditional.c |
18317 |
-+++ b/security/selinux/ss/conditional.c |
18318 |
-@@ -27,6 +27,9 @@ static int cond_evaluate_expr(struct policydb *p, struct cond_expr *expr) |
18319 |
- int s[COND_EXPR_MAXDEPTH]; |
18320 |
- int sp = -1; |
18321 |
- |
18322 |
-+ if (expr->len == 0) |
18323 |
-+ return -1; |
18324 |
-+ |
18325 |
- for (i = 0; i < expr->len; i++) { |
18326 |
- struct cond_expr_node *node = &expr->nodes[i]; |
18327 |
- |
18328 |
-@@ -392,27 +395,19 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp) |
18329 |
- |
18330 |
- rc = next_entry(buf, fp, sizeof(u32) * 2); |
18331 |
- if (rc) |
18332 |
-- goto err; |
18333 |
-+ return rc; |
18334 |
- |
18335 |
- expr->expr_type = le32_to_cpu(buf[0]); |
18336 |
- expr->bool = le32_to_cpu(buf[1]); |
18337 |
- |
18338 |
-- if (!expr_node_isvalid(p, expr)) { |
18339 |
-- rc = -EINVAL; |
18340 |
-- goto err; |
18341 |
-- } |
18342 |
-+ if (!expr_node_isvalid(p, expr)) |
18343 |
-+ return -EINVAL; |
18344 |
- } |
18345 |
- |
18346 |
- rc = cond_read_av_list(p, fp, &node->true_list, NULL); |
18347 |
- if (rc) |
18348 |
-- goto err; |
18349 |
-- rc = cond_read_av_list(p, fp, &node->false_list, &node->true_list); |
18350 |
-- if (rc) |
18351 |
-- goto err; |
18352 |
-- return 0; |
18353 |
--err: |
18354 |
-- cond_node_destroy(node); |
18355 |
-- return rc; |
18356 |
-+ return rc; |
18357 |
-+ return cond_read_av_list(p, fp, &node->false_list, &node->true_list); |
18358 |
- } |
18359 |
- |
18360 |
- int cond_read_list(struct policydb *p, void *fp) |
18361 |
-diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c |
18362 |
-index 8ad34fd031d1..77e591fce919 100644 |
18363 |
---- a/security/selinux/ss/services.c |
18364 |
-+++ b/security/selinux/ss/services.c |
18365 |
-@@ -2923,8 +2923,12 @@ err: |
18366 |
- if (*names) { |
18367 |
- for (i = 0; i < *len; i++) |
18368 |
- kfree((*names)[i]); |
18369 |
-+ kfree(*names); |
18370 |
- } |
18371 |
- kfree(*values); |
18372 |
-+ *len = 0; |
18373 |
-+ *names = NULL; |
18374 |
-+ *values = NULL; |
18375 |
- goto out; |
18376 |
- } |
18377 |
- |
18378 |
-diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c |
18379 |
-index 67d735e9a6a4..fea92e148790 100644 |
18380 |
---- a/sound/firewire/amdtp-am824.c |
18381 |
-+++ b/sound/firewire/amdtp-am824.c |
18382 |
-@@ -82,7 +82,8 @@ int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate, |
18383 |
- if (err < 0) |
18384 |
- return err; |
18385 |
- |
18386 |
-- s->ctx_data.rx.fdf = AMDTP_FDF_AM824 | s->sfc; |
18387 |
-+ if (s->direction == AMDTP_OUT_STREAM) |
18388 |
-+ s->ctx_data.rx.fdf = AMDTP_FDF_AM824 | s->sfc; |
18389 |
- |
18390 |
- p->pcm_channels = pcm_channels; |
18391 |
- p->midi_ports = midi_ports; |
18392 |
-diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c |
18393 |
-index c5b1d5900eed..d6420d224d09 100644 |
18394 |
---- a/sound/isa/wavefront/wavefront_synth.c |
18395 |
-+++ b/sound/isa/wavefront/wavefront_synth.c |
18396 |
-@@ -1171,7 +1171,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header) |
18397 |
- "alias for %d\n", |
18398 |
- header->number, |
18399 |
- header->hdr.a.OriginalSample); |
18400 |
-- |
18401 |
-+ |
18402 |
-+ if (header->number >= WF_MAX_SAMPLE) |
18403 |
-+ return -EINVAL; |
18404 |
-+ |
18405 |
- munge_int32 (header->number, &alias_hdr[0], 2); |
18406 |
- munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2); |
18407 |
- munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset), |
18408 |
-@@ -1202,6 +1205,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header) |
18409 |
- int num_samples; |
18410 |
- unsigned char *msample_hdr; |
18411 |
- |
18412 |
-+ if (header->number >= WF_MAX_SAMPLE) |
18413 |
-+ return -EINVAL; |
18414 |
-+ |
18415 |
- msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL); |
18416 |
- if (! msample_hdr) |
18417 |
- return -ENOMEM; |
18418 |
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
18419 |
-index 2c4575909441..e057ecb5a904 100644 |
18420 |
---- a/sound/pci/hda/patch_realtek.c |
18421 |
-+++ b/sound/pci/hda/patch_realtek.c |
18422 |
-@@ -81,6 +81,7 @@ struct alc_spec { |
18423 |
- |
18424 |
- /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ |
18425 |
- int mute_led_polarity; |
18426 |
-+ int micmute_led_polarity; |
18427 |
- hda_nid_t mute_led_nid; |
18428 |
- hda_nid_t cap_mute_led_nid; |
18429 |
- |
18430 |
-@@ -4080,11 +4081,9 @@ static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, |
18431 |
- |
18432 |
- /* update LED status via GPIO */ |
18433 |
- static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, |
18434 |
-- bool enabled) |
18435 |
-+ int polarity, bool enabled) |
18436 |
- { |
18437 |
-- struct alc_spec *spec = codec->spec; |
18438 |
-- |
18439 |
-- if (spec->mute_led_polarity) |
18440 |
-+ if (polarity) |
18441 |
- enabled = !enabled; |
18442 |
- alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ |
18443 |
- } |
18444 |
-@@ -4095,7 +4094,8 @@ static void alc_fixup_gpio_mute_hook(void *private_data, int enabled) |
18445 |
- struct hda_codec *codec = private_data; |
18446 |
- struct alc_spec *spec = codec->spec; |
18447 |
- |
18448 |
-- alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); |
18449 |
-+ alc_update_gpio_led(codec, spec->gpio_mute_led_mask, |
18450 |
-+ spec->mute_led_polarity, enabled); |
18451 |
- } |
18452 |
- |
18453 |
- /* turn on/off mic-mute LED via GPIO per capture hook */ |
18454 |
-@@ -4104,6 +4104,7 @@ static void alc_gpio_micmute_update(struct hda_codec *codec) |
18455 |
- struct alc_spec *spec = codec->spec; |
18456 |
- |
18457 |
- alc_update_gpio_led(codec, spec->gpio_mic_led_mask, |
18458 |
-+ spec->micmute_led_polarity, |
18459 |
- spec->gen.micmute_led.led_value); |
18460 |
- } |
18461 |
- |
18462 |
-@@ -5808,7 +5809,8 @@ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, |
18463 |
- |
18464 |
- snd_hda_gen_hp_automute(codec, jack); |
18465 |
- /* mute_led_polarity is set to 0, so we pass inverted value here */ |
18466 |
-- alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); |
18467 |
-+ alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, |
18468 |
-+ !spec->gen.hp_jack_present); |
18469 |
- } |
18470 |
- |
18471 |
- /* Manage GPIOs for HP EliteBook Folio 9480m. |
18472 |
-diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig |
18473 |
-index e60e0b6a689c..8a66f23a7b05 100644 |
18474 |
---- a/sound/soc/codecs/Kconfig |
18475 |
-+++ b/sound/soc/codecs/Kconfig |
18476 |
-@@ -1136,10 +1136,13 @@ config SND_SOC_RT5677_SPI |
18477 |
- config SND_SOC_RT5682 |
18478 |
- tristate |
18479 |
- depends on I2C || SOUNDWIRE |
18480 |
-+ depends on SOUNDWIRE || !SOUNDWIRE |
18481 |
-+ depends on I2C || !I2C |
18482 |
- |
18483 |
- config SND_SOC_RT5682_SDW |
18484 |
- tristate "Realtek RT5682 Codec - SDW" |
18485 |
- depends on SOUNDWIRE |
18486 |
-+ depends on I2C || !I2C |
18487 |
- select SND_SOC_RT5682 |
18488 |
- select REGMAP_SOUNDWIRE |
18489 |
- |
18490 |
-@@ -1620,19 +1623,19 @@ config SND_SOC_WM9090 |
18491 |
- |
18492 |
- config SND_SOC_WM9705 |
18493 |
- tristate |
18494 |
-- depends on SND_SOC_AC97_BUS |
18495 |
-+ depends on SND_SOC_AC97_BUS || AC97_BUS_NEW |
18496 |
- select REGMAP_AC97 |
18497 |
- select AC97_BUS_COMPAT if AC97_BUS_NEW |
18498 |
- |
18499 |
- config SND_SOC_WM9712 |
18500 |
- tristate |
18501 |
-- depends on SND_SOC_AC97_BUS |
18502 |
-+ depends on SND_SOC_AC97_BUS || AC97_BUS_NEW |
18503 |
- select REGMAP_AC97 |
18504 |
- select AC97_BUS_COMPAT if AC97_BUS_NEW |
18505 |
- |
18506 |
- config SND_SOC_WM9713 |
18507 |
- tristate |
18508 |
-- depends on SND_SOC_AC97_BUS |
18509 |
-+ depends on SND_SOC_AC97_BUS || AC97_BUS_NEW |
18510 |
- select REGMAP_AC97 |
18511 |
- select AC97_BUS_COMPAT if AC97_BUS_NEW |
18512 |
- |
18513 |
-diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c |
18514 |
-index cae1def8902d..96718e3a1ad0 100644 |
18515 |
---- a/sound/soc/codecs/max98373.c |
18516 |
-+++ b/sound/soc/codecs/max98373.c |
18517 |
-@@ -850,8 +850,8 @@ static int max98373_resume(struct device *dev) |
18518 |
- { |
18519 |
- struct max98373_priv *max98373 = dev_get_drvdata(dev); |
18520 |
- |
18521 |
-- max98373_reset(max98373, dev); |
18522 |
- regcache_cache_only(max98373->regmap, false); |
18523 |
-+ max98373_reset(max98373, dev); |
18524 |
- regcache_sync(max98373->regmap); |
18525 |
- return 0; |
18526 |
- } |
18527 |
-diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c |
18528 |
-index a5a7e46de246..a7f45191364d 100644 |
18529 |
---- a/sound/soc/codecs/rt1308-sdw.c |
18530 |
-+++ b/sound/soc/codecs/rt1308-sdw.c |
18531 |
-@@ -482,6 +482,9 @@ static int rt1308_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18532 |
- { |
18533 |
- struct sdw_stream_data *stream; |
18534 |
- |
18535 |
-+ if (!sdw_stream) |
18536 |
-+ return 0; |
18537 |
-+ |
18538 |
- stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18539 |
- if (!stream) |
18540 |
- return -ENOMEM; |
18541 |
-diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c |
18542 |
-index 6ba1849a77b0..e2e1d5b03b38 100644 |
18543 |
---- a/sound/soc/codecs/rt5645.c |
18544 |
-+++ b/sound/soc/codecs/rt5645.c |
18545 |
-@@ -3625,6 +3625,12 @@ static const struct rt5645_platform_data asus_t100ha_platform_data = { |
18546 |
- .inv_jd1_1 = true, |
18547 |
- }; |
18548 |
- |
18549 |
-+static const struct rt5645_platform_data asus_t101ha_platform_data = { |
18550 |
-+ .dmic1_data_pin = RT5645_DMIC_DATA_IN2N, |
18551 |
-+ .dmic2_data_pin = RT5645_DMIC2_DISABLE, |
18552 |
-+ .jd_mode = 3, |
18553 |
-+}; |
18554 |
-+ |
18555 |
- static const struct rt5645_platform_data lenovo_ideapad_miix_310_pdata = { |
18556 |
- .jd_mode = 3, |
18557 |
- .in2_diff = true, |
18558 |
-@@ -3708,6 +3714,14 @@ static const struct dmi_system_id dmi_platform_data[] = { |
18559 |
- }, |
18560 |
- .driver_data = (void *)&asus_t100ha_platform_data, |
18561 |
- }, |
18562 |
-+ { |
18563 |
-+ .ident = "ASUS T101HA", |
18564 |
-+ .matches = { |
18565 |
-+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
18566 |
-+ DMI_MATCH(DMI_PRODUCT_NAME, "T101HA"), |
18567 |
-+ }, |
18568 |
-+ .driver_data = (void *)&asus_t101ha_platform_data, |
18569 |
-+ }, |
18570 |
- { |
18571 |
- .ident = "MINIX Z83-4", |
18572 |
- .matches = { |
18573 |
-diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c |
18574 |
-index d36f560ad7a8..c4892af14850 100644 |
18575 |
---- a/sound/soc/codecs/rt5682.c |
18576 |
-+++ b/sound/soc/codecs/rt5682.c |
18577 |
-@@ -2958,6 +2958,9 @@ static int rt5682_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18578 |
- { |
18579 |
- struct sdw_stream_data *stream; |
18580 |
- |
18581 |
-+ if (!sdw_stream) |
18582 |
-+ return 0; |
18583 |
-+ |
18584 |
- stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18585 |
- if (!stream) |
18586 |
- return -ENOMEM; |
18587 |
-diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c |
18588 |
-index ff68f0e4f629..687ac2153666 100644 |
18589 |
---- a/sound/soc/codecs/rt700.c |
18590 |
-+++ b/sound/soc/codecs/rt700.c |
18591 |
-@@ -860,6 +860,9 @@ static int rt700_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18592 |
- { |
18593 |
- struct sdw_stream_data *stream; |
18594 |
- |
18595 |
-+ if (!sdw_stream) |
18596 |
-+ return 0; |
18597 |
-+ |
18598 |
- stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18599 |
- if (!stream) |
18600 |
- return -ENOMEM; |
18601 |
-diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c |
18602 |
-index 2daed7692a3b..65b59dbfb43c 100644 |
18603 |
---- a/sound/soc/codecs/rt711.c |
18604 |
-+++ b/sound/soc/codecs/rt711.c |
18605 |
-@@ -906,6 +906,9 @@ static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18606 |
- { |
18607 |
- struct sdw_stream_data *stream; |
18608 |
- |
18609 |
-+ if (!sdw_stream) |
18610 |
-+ return 0; |
18611 |
-+ |
18612 |
- stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18613 |
- if (!stream) |
18614 |
- return -ENOMEM; |
18615 |
-diff --git a/sound/soc/codecs/rt715.c b/sound/soc/codecs/rt715.c |
18616 |
-index 2cbc57b16b13..099c8bd20006 100644 |
18617 |
---- a/sound/soc/codecs/rt715.c |
18618 |
-+++ b/sound/soc/codecs/rt715.c |
18619 |
-@@ -530,6 +530,9 @@ static int rt715_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, |
18620 |
- |
18621 |
- struct sdw_stream_data *stream; |
18622 |
- |
18623 |
-+ if (!sdw_stream) |
18624 |
-+ return 0; |
18625 |
-+ |
18626 |
- stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
18627 |
- if (!stream) |
18628 |
- return -ENOMEM; |
18629 |
-diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c |
18630 |
-index e7178817d7a7..1ee10eafe3e6 100644 |
18631 |
---- a/sound/soc/fsl/fsl_asrc_dma.c |
18632 |
-+++ b/sound/soc/fsl/fsl_asrc_dma.c |
18633 |
-@@ -252,6 +252,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component, |
18634 |
- ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be); |
18635 |
- if (ret) { |
18636 |
- dev_err(dev, "failed to config DMA channel for Back-End\n"); |
18637 |
-+ dma_release_channel(pair->dma_chan[dir]); |
18638 |
- return ret; |
18639 |
- } |
18640 |
- |
18641 |
-diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c |
18642 |
-index c7a49d03463a..84290be778f0 100644 |
18643 |
---- a/sound/soc/fsl/fsl_esai.c |
18644 |
-+++ b/sound/soc/fsl/fsl_esai.c |
18645 |
-@@ -87,6 +87,10 @@ static irqreturn_t esai_isr(int irq, void *devid) |
18646 |
- if ((saisr & (ESAI_SAISR_TUE | ESAI_SAISR_ROE)) && |
18647 |
- esai_priv->reset_at_xrun) { |
18648 |
- dev_dbg(&pdev->dev, "reset module for xrun\n"); |
18649 |
-+ regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, |
18650 |
-+ ESAI_xCR_xEIE_MASK, 0); |
18651 |
-+ regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR, |
18652 |
-+ ESAI_xCR_xEIE_MASK, 0); |
18653 |
- tasklet_schedule(&esai_priv->task); |
18654 |
- } |
18655 |
- |
18656 |
-diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c |
18657 |
-index a495d1050d49..e30b66b94bf6 100644 |
18658 |
---- a/sound/soc/img/img-i2s-in.c |
18659 |
-+++ b/sound/soc/img/img-i2s-in.c |
18660 |
-@@ -482,6 +482,7 @@ static int img_i2s_in_probe(struct platform_device *pdev) |
18661 |
- if (IS_ERR(rst)) { |
18662 |
- if (PTR_ERR(rst) == -EPROBE_DEFER) { |
18663 |
- ret = -EPROBE_DEFER; |
18664 |
-+ pm_runtime_put(&pdev->dev); |
18665 |
- goto err_suspend; |
18666 |
- } |
18667 |
- |
18668 |
-diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
18669 |
-index 08f4ae964b02..5c1a5e2aff6f 100644 |
18670 |
---- a/sound/soc/intel/boards/bytcr_rt5640.c |
18671 |
-+++ b/sound/soc/intel/boards/bytcr_rt5640.c |
18672 |
-@@ -742,6 +742,30 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { |
18673 |
- BYT_RT5640_SSP0_AIF1 | |
18674 |
- BYT_RT5640_MCLK_EN), |
18675 |
- }, |
18676 |
-+ { /* Toshiba Encore WT8-A */ |
18677 |
-+ .matches = { |
18678 |
-+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
18679 |
-+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT8-A"), |
18680 |
-+ }, |
18681 |
-+ .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
18682 |
-+ BYT_RT5640_JD_SRC_JD2_IN4N | |
18683 |
-+ BYT_RT5640_OVCD_TH_2000UA | |
18684 |
-+ BYT_RT5640_OVCD_SF_0P75 | |
18685 |
-+ BYT_RT5640_JD_NOT_INV | |
18686 |
-+ BYT_RT5640_MCLK_EN), |
18687 |
-+ }, |
18688 |
-+ { /* Toshiba Encore WT10-A */ |
18689 |
-+ .matches = { |
18690 |
-+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
18691 |
-+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A-103"), |
18692 |
-+ }, |
18693 |
-+ .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | |
18694 |
-+ BYT_RT5640_JD_SRC_JD1_IN4P | |
18695 |
-+ BYT_RT5640_OVCD_TH_2000UA | |
18696 |
-+ BYT_RT5640_OVCD_SF_0P75 | |
18697 |
-+ BYT_RT5640_SSP0_AIF2 | |
18698 |
-+ BYT_RT5640_MCLK_EN), |
18699 |
-+ }, |
18700 |
- { /* Catch-all for generic Insyde tablets, must be last */ |
18701 |
- .matches = { |
18702 |
- DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), |
18703 |
-diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c |
18704 |
-index 2e9b56b29d31..b2e867113226 100644 |
18705 |
---- a/sound/soc/meson/axg-fifo.c |
18706 |
-+++ b/sound/soc/meson/axg-fifo.c |
18707 |
-@@ -249,7 +249,7 @@ int axg_fifo_pcm_open(struct snd_soc_component *component, |
18708 |
- /* Enable pclk to access registers and clock the fifo ip */ |
18709 |
- ret = clk_prepare_enable(fifo->pclk); |
18710 |
- if (ret) |
18711 |
-- return ret; |
18712 |
-+ goto free_irq; |
18713 |
- |
18714 |
- /* Setup status2 so it reports the memory pointer */ |
18715 |
- regmap_update_bits(fifo->map, FIFO_CTRL1, |
18716 |
-@@ -269,8 +269,14 @@ int axg_fifo_pcm_open(struct snd_soc_component *component, |
18717 |
- /* Take memory arbitror out of reset */ |
18718 |
- ret = reset_control_deassert(fifo->arb); |
18719 |
- if (ret) |
18720 |
-- clk_disable_unprepare(fifo->pclk); |
18721 |
-+ goto free_clk; |
18722 |
-+ |
18723 |
-+ return 0; |
18724 |
- |
18725 |
-+free_clk: |
18726 |
-+ clk_disable_unprepare(fifo->pclk); |
18727 |
-+free_irq: |
18728 |
-+ free_irq(fifo->irq, ss); |
18729 |
- return ret; |
18730 |
- } |
18731 |
- EXPORT_SYMBOL_GPL(axg_fifo_pcm_open); |
18732 |
-diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c |
18733 |
-index 2ca8c98e204f..5a4a91c88734 100644 |
18734 |
---- a/sound/soc/meson/meson-card-utils.c |
18735 |
-+++ b/sound/soc/meson/meson-card-utils.c |
18736 |
-@@ -49,19 +49,26 @@ int meson_card_reallocate_links(struct snd_soc_card *card, |
18737 |
- links = krealloc(priv->card.dai_link, |
18738 |
- num_links * sizeof(*priv->card.dai_link), |
18739 |
- GFP_KERNEL | __GFP_ZERO); |
18740 |
-+ if (!links) |
18741 |
-+ goto err_links; |
18742 |
-+ |
18743 |
- ldata = krealloc(priv->link_data, |
18744 |
- num_links * sizeof(*priv->link_data), |
18745 |
- GFP_KERNEL | __GFP_ZERO); |
18746 |
-- |
18747 |
-- if (!links || !ldata) { |
18748 |
-- dev_err(priv->card.dev, "failed to allocate links\n"); |
18749 |
-- return -ENOMEM; |
18750 |
-- } |
18751 |
-+ if (!ldata) |
18752 |
-+ goto err_ldata; |
18753 |
- |
18754 |
- priv->card.dai_link = links; |
18755 |
- priv->link_data = ldata; |
18756 |
- priv->card.num_links = num_links; |
18757 |
- return 0; |
18758 |
-+ |
18759 |
-+err_ldata: |
18760 |
-+ kfree(links); |
18761 |
-+err_links: |
18762 |
-+ dev_err(priv->card.dev, "failed to allocate links\n"); |
18763 |
-+ return -ENOMEM; |
18764 |
-+ |
18765 |
- } |
18766 |
- EXPORT_SYMBOL_GPL(meson_card_reallocate_links); |
18767 |
- |
18768 |
-diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c |
18769 |
-index 125af00bba53..4640804aab7f 100644 |
18770 |
---- a/sound/soc/qcom/qdsp6/q6asm-dai.c |
18771 |
-+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c |
18772 |
-@@ -176,7 +176,7 @@ static const struct snd_compr_codec_caps q6asm_compr_caps = { |
18773 |
- }; |
18774 |
- |
18775 |
- static void event_handler(uint32_t opcode, uint32_t token, |
18776 |
-- uint32_t *payload, void *priv) |
18777 |
-+ void *payload, void *priv) |
18778 |
- { |
18779 |
- struct q6asm_dai_rtd *prtd = priv; |
18780 |
- struct snd_pcm_substream *substream = prtd->substream; |
18781 |
-@@ -490,7 +490,7 @@ static int q6asm_dai_hw_params(struct snd_soc_component *component, |
18782 |
- } |
18783 |
- |
18784 |
- static void compress_event_handler(uint32_t opcode, uint32_t token, |
18785 |
-- uint32_t *payload, void *priv) |
18786 |
-+ void *payload, void *priv) |
18787 |
- { |
18788 |
- struct q6asm_dai_rtd *prtd = priv; |
18789 |
- struct snd_compr_stream *substream = prtd->cstream; |
18790 |
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c |
18791 |
-index af19010b9d88..8bd49c8a9517 100644 |
18792 |
---- a/sound/soc/sh/rcar/gen.c |
18793 |
-+++ b/sound/soc/sh/rcar/gen.c |
18794 |
-@@ -224,6 +224,14 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) |
18795 |
- RSND_GEN_S_REG(SSI_SYS_STATUS5, 0x884), |
18796 |
- RSND_GEN_S_REG(SSI_SYS_STATUS6, 0x888), |
18797 |
- RSND_GEN_S_REG(SSI_SYS_STATUS7, 0x88c), |
18798 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0, 0x850), |
18799 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE1, 0x854), |
18800 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2, 0x858), |
18801 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE3, 0x85c), |
18802 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE4, 0x890), |
18803 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE5, 0x894), |
18804 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE6, 0x898), |
18805 |
-+ RSND_GEN_S_REG(SSI_SYS_INT_ENABLE7, 0x89c), |
18806 |
- RSND_GEN_S_REG(HDMI0_SEL, 0x9e0), |
18807 |
- RSND_GEN_S_REG(HDMI1_SEL, 0x9e4), |
18808 |
- |
18809 |
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h |
18810 |
-index ea6cbaa9743e..d47608ff5fac 100644 |
18811 |
---- a/sound/soc/sh/rcar/rsnd.h |
18812 |
-+++ b/sound/soc/sh/rcar/rsnd.h |
18813 |
-@@ -189,6 +189,14 @@ enum rsnd_reg { |
18814 |
- SSI_SYS_STATUS5, |
18815 |
- SSI_SYS_STATUS6, |
18816 |
- SSI_SYS_STATUS7, |
18817 |
-+ SSI_SYS_INT_ENABLE0, |
18818 |
-+ SSI_SYS_INT_ENABLE1, |
18819 |
-+ SSI_SYS_INT_ENABLE2, |
18820 |
-+ SSI_SYS_INT_ENABLE3, |
18821 |
-+ SSI_SYS_INT_ENABLE4, |
18822 |
-+ SSI_SYS_INT_ENABLE5, |
18823 |
-+ SSI_SYS_INT_ENABLE6, |
18824 |
-+ SSI_SYS_INT_ENABLE7, |
18825 |
- HDMI0_SEL, |
18826 |
- HDMI1_SEL, |
18827 |
- SSI9_BUSIF0_MODE, |
18828 |
-@@ -237,6 +245,7 @@ enum rsnd_reg { |
18829 |
- #define SSI9_BUSIF_ADINR(i) (SSI9_BUSIF0_ADINR + (i)) |
18830 |
- #define SSI9_BUSIF_DALIGN(i) (SSI9_BUSIF0_DALIGN + (i)) |
18831 |
- #define SSI_SYS_STATUS(i) (SSI_SYS_STATUS0 + (i)) |
18832 |
-+#define SSI_SYS_INT_ENABLE(i) (SSI_SYS_INT_ENABLE0 + (i)) |
18833 |
- |
18834 |
- |
18835 |
- struct rsnd_priv; |
18836 |
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c |
18837 |
-index 4a7d3413917f..47d5ddb526f2 100644 |
18838 |
---- a/sound/soc/sh/rcar/ssi.c |
18839 |
-+++ b/sound/soc/sh/rcar/ssi.c |
18840 |
-@@ -372,6 +372,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, |
18841 |
- u32 wsr = ssi->wsr; |
18842 |
- int width; |
18843 |
- int is_tdm, is_tdm_split; |
18844 |
-+ int id = rsnd_mod_id(mod); |
18845 |
-+ int i; |
18846 |
-+ u32 sys_int_enable = 0; |
18847 |
- |
18848 |
- is_tdm = rsnd_runtime_is_tdm(io); |
18849 |
- is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18850 |
-@@ -447,6 +450,38 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, |
18851 |
- cr_mode = DIEN; /* PIO : enable Data interrupt */ |
18852 |
- } |
18853 |
- |
18854 |
-+ /* enable busif buffer over/under run interrupt. */ |
18855 |
-+ if (is_tdm || is_tdm_split) { |
18856 |
-+ switch (id) { |
18857 |
-+ case 0: |
18858 |
-+ case 1: |
18859 |
-+ case 2: |
18860 |
-+ case 3: |
18861 |
-+ case 4: |
18862 |
-+ for (i = 0; i < 4; i++) { |
18863 |
-+ sys_int_enable = rsnd_mod_read(mod, |
18864 |
-+ SSI_SYS_INT_ENABLE(i * 2)); |
18865 |
-+ sys_int_enable |= 0xf << (id * 4); |
18866 |
-+ rsnd_mod_write(mod, |
18867 |
-+ SSI_SYS_INT_ENABLE(i * 2), |
18868 |
-+ sys_int_enable); |
18869 |
-+ } |
18870 |
-+ |
18871 |
-+ break; |
18872 |
-+ case 9: |
18873 |
-+ for (i = 0; i < 4; i++) { |
18874 |
-+ sys_int_enable = rsnd_mod_read(mod, |
18875 |
-+ SSI_SYS_INT_ENABLE((i * 2) + 1)); |
18876 |
-+ sys_int_enable |= 0xf << 4; |
18877 |
-+ rsnd_mod_write(mod, |
18878 |
-+ SSI_SYS_INT_ENABLE((i * 2) + 1), |
18879 |
-+ sys_int_enable); |
18880 |
-+ } |
18881 |
-+ |
18882 |
-+ break; |
18883 |
-+ } |
18884 |
-+ } |
18885 |
-+ |
18886 |
- init_end: |
18887 |
- ssi->cr_own = cr_own; |
18888 |
- ssi->cr_mode = cr_mode; |
18889 |
-@@ -496,6 +531,13 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, |
18890 |
- { |
18891 |
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
18892 |
- struct device *dev = rsnd_priv_to_dev(priv); |
18893 |
-+ int is_tdm, is_tdm_split; |
18894 |
-+ int id = rsnd_mod_id(mod); |
18895 |
-+ int i; |
18896 |
-+ u32 sys_int_enable = 0; |
18897 |
-+ |
18898 |
-+ is_tdm = rsnd_runtime_is_tdm(io); |
18899 |
-+ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18900 |
- |
18901 |
- if (!rsnd_ssi_is_run_mods(mod, io)) |
18902 |
- return 0; |
18903 |
-@@ -517,6 +559,38 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, |
18904 |
- ssi->wsr = 0; |
18905 |
- } |
18906 |
- |
18907 |
-+ /* disable busif buffer over/under run interrupt. */ |
18908 |
-+ if (is_tdm || is_tdm_split) { |
18909 |
-+ switch (id) { |
18910 |
-+ case 0: |
18911 |
-+ case 1: |
18912 |
-+ case 2: |
18913 |
-+ case 3: |
18914 |
-+ case 4: |
18915 |
-+ for (i = 0; i < 4; i++) { |
18916 |
-+ sys_int_enable = rsnd_mod_read(mod, |
18917 |
-+ SSI_SYS_INT_ENABLE(i * 2)); |
18918 |
-+ sys_int_enable &= ~(0xf << (id * 4)); |
18919 |
-+ rsnd_mod_write(mod, |
18920 |
-+ SSI_SYS_INT_ENABLE(i * 2), |
18921 |
-+ sys_int_enable); |
18922 |
-+ } |
18923 |
-+ |
18924 |
-+ break; |
18925 |
-+ case 9: |
18926 |
-+ for (i = 0; i < 4; i++) { |
18927 |
-+ sys_int_enable = rsnd_mod_read(mod, |
18928 |
-+ SSI_SYS_INT_ENABLE((i * 2) + 1)); |
18929 |
-+ sys_int_enable &= ~(0xf << 4); |
18930 |
-+ rsnd_mod_write(mod, |
18931 |
-+ SSI_SYS_INT_ENABLE((i * 2) + 1), |
18932 |
-+ sys_int_enable); |
18933 |
-+ } |
18934 |
-+ |
18935 |
-+ break; |
18936 |
-+ } |
18937 |
-+ } |
18938 |
-+ |
18939 |
- return 0; |
18940 |
- } |
18941 |
- |
18942 |
-@@ -622,6 +696,11 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, |
18943 |
- int enable) |
18944 |
- { |
18945 |
- u32 val = 0; |
18946 |
-+ int is_tdm, is_tdm_split; |
18947 |
-+ int id = rsnd_mod_id(mod); |
18948 |
-+ |
18949 |
-+ is_tdm = rsnd_runtime_is_tdm(io); |
18950 |
-+ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18951 |
- |
18952 |
- if (rsnd_is_gen1(priv)) |
18953 |
- return 0; |
18954 |
-@@ -635,6 +714,19 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, |
18955 |
- if (enable) |
18956 |
- val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; |
18957 |
- |
18958 |
-+ if (is_tdm || is_tdm_split) { |
18959 |
-+ switch (id) { |
18960 |
-+ case 0: |
18961 |
-+ case 1: |
18962 |
-+ case 2: |
18963 |
-+ case 3: |
18964 |
-+ case 4: |
18965 |
-+ case 9: |
18966 |
-+ val |= 0x0000ff00; |
18967 |
-+ break; |
18968 |
-+ } |
18969 |
-+ } |
18970 |
-+ |
18971 |
- rsnd_mod_write(mod, SSI_INT_ENABLE, val); |
18972 |
- |
18973 |
- return 0; |
18974 |
-@@ -651,6 +743,12 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
18975 |
- u32 status; |
18976 |
- bool elapsed = false; |
18977 |
- bool stop = false; |
18978 |
-+ int id = rsnd_mod_id(mod); |
18979 |
-+ int i; |
18980 |
-+ int is_tdm, is_tdm_split; |
18981 |
-+ |
18982 |
-+ is_tdm = rsnd_runtime_is_tdm(io); |
18983 |
-+ is_tdm_split = rsnd_runtime_is_tdm_split(io); |
18984 |
- |
18985 |
- spin_lock(&priv->lock); |
18986 |
- |
18987 |
-@@ -672,6 +770,53 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, |
18988 |
- stop = true; |
18989 |
- } |
18990 |
- |
18991 |
-+ status = 0; |
18992 |
-+ |
18993 |
-+ if (is_tdm || is_tdm_split) { |
18994 |
-+ switch (id) { |
18995 |
-+ case 0: |
18996 |
-+ case 1: |
18997 |
-+ case 2: |
18998 |
-+ case 3: |
18999 |
-+ case 4: |
19000 |
-+ for (i = 0; i < 4; i++) { |
19001 |
-+ status = rsnd_mod_read(mod, |
19002 |
-+ SSI_SYS_STATUS(i * 2)); |
19003 |
-+ status &= 0xf << (id * 4); |
19004 |
-+ |
19005 |
-+ if (status) { |
19006 |
-+ rsnd_dbg_irq_status(dev, |
19007 |
-+ "%s err status : 0x%08x\n", |
19008 |
-+ rsnd_mod_name(mod), status); |
19009 |
-+ rsnd_mod_write(mod, |
19010 |
-+ SSI_SYS_STATUS(i * 2), |
19011 |
-+ 0xf << (id * 4)); |
19012 |
-+ stop = true; |
19013 |
-+ break; |
19014 |
-+ } |
19015 |
-+ } |
19016 |
-+ break; |
19017 |
-+ case 9: |
19018 |
-+ for (i = 0; i < 4; i++) { |
19019 |
-+ status = rsnd_mod_read(mod, |
19020 |
-+ SSI_SYS_STATUS((i * 2) + 1)); |
19021 |
-+ status &= 0xf << 4; |
19022 |
-+ |
19023 |
-+ if (status) { |
19024 |
-+ rsnd_dbg_irq_status(dev, |
19025 |
-+ "%s err status : 0x%08x\n", |
19026 |
-+ rsnd_mod_name(mod), status); |
19027 |
-+ rsnd_mod_write(mod, |
19028 |
-+ SSI_SYS_STATUS((i * 2) + 1), |
19029 |
-+ 0xf << 4); |
19030 |
-+ stop = true; |
19031 |
-+ break; |
19032 |
-+ } |
19033 |
-+ } |
19034 |
-+ break; |
19035 |
-+ } |
19036 |
-+ } |
19037 |
-+ |
19038 |
- rsnd_ssi_status_clear(mod); |
19039 |
- rsnd_ssi_interrupt_out: |
19040 |
- spin_unlock(&priv->lock); |
19041 |
-diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
19042 |
-index 843b8b1c89d4..e5433e8fcf19 100644 |
19043 |
---- a/sound/soc/soc-core.c |
19044 |
-+++ b/sound/soc/soc-core.c |
19045 |
-@@ -1720,9 +1720,25 @@ match: |
19046 |
- dai_link->platforms->name = component->name; |
19047 |
- |
19048 |
- /* convert non BE into BE */ |
19049 |
-- dai_link->no_pcm = 1; |
19050 |
-- dai_link->dpcm_playback = 1; |
19051 |
-- dai_link->dpcm_capture = 1; |
19052 |
-+ if (!dai_link->no_pcm) { |
19053 |
-+ dai_link->no_pcm = 1; |
19054 |
-+ |
19055 |
-+ if (dai_link->dpcm_playback) |
19056 |
-+ dev_warn(card->dev, |
19057 |
-+ "invalid configuration, dailink %s has flags no_pcm=0 and dpcm_playback=1\n", |
19058 |
-+ dai_link->name); |
19059 |
-+ if (dai_link->dpcm_capture) |
19060 |
-+ dev_warn(card->dev, |
19061 |
-+ "invalid configuration, dailink %s has flags no_pcm=0 and dpcm_capture=1\n", |
19062 |
-+ dai_link->name); |
19063 |
-+ |
19064 |
-+ /* convert normal link into DPCM one */ |
19065 |
-+ if (!(dai_link->dpcm_playback || |
19066 |
-+ dai_link->dpcm_capture)) { |
19067 |
-+ dai_link->dpcm_playback = !dai_link->capture_only; |
19068 |
-+ dai_link->dpcm_capture = !dai_link->playback_only; |
19069 |
-+ } |
19070 |
-+ } |
19071 |
- |
19072 |
- /* override any BE fixups */ |
19073 |
- dai_link->be_hw_params_fixup = |
19074 |
-diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
19075 |
-index e2632841b321..c0aa64ff8e32 100644 |
19076 |
---- a/sound/soc/soc-dapm.c |
19077 |
-+++ b/sound/soc/soc-dapm.c |
19078 |
-@@ -4340,16 +4340,16 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card, |
19079 |
- codec = codec_dai->playback_widget; |
19080 |
- |
19081 |
- if (playback_cpu && codec) { |
19082 |
-- if (dai_link->params && !dai_link->playback_widget) { |
19083 |
-+ if (dai_link->params && !rtd->playback_widget) { |
19084 |
- substream = streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
19085 |
- dai = snd_soc_dapm_new_dai(card, substream, "playback"); |
19086 |
- if (IS_ERR(dai)) |
19087 |
- goto capture; |
19088 |
-- dai_link->playback_widget = dai; |
19089 |
-+ rtd->playback_widget = dai; |
19090 |
- } |
19091 |
- |
19092 |
- dapm_connect_dai_routes(&card->dapm, cpu_dai, playback_cpu, |
19093 |
-- dai_link->playback_widget, |
19094 |
-+ rtd->playback_widget, |
19095 |
- codec_dai, codec); |
19096 |
- } |
19097 |
- |
19098 |
-@@ -4358,16 +4358,16 @@ capture: |
19099 |
- codec = codec_dai->capture_widget; |
19100 |
- |
19101 |
- if (codec && capture_cpu) { |
19102 |
-- if (dai_link->params && !dai_link->capture_widget) { |
19103 |
-+ if (dai_link->params && !rtd->capture_widget) { |
19104 |
- substream = streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
19105 |
- dai = snd_soc_dapm_new_dai(card, substream, "capture"); |
19106 |
- if (IS_ERR(dai)) |
19107 |
- return; |
19108 |
-- dai_link->capture_widget = dai; |
19109 |
-+ rtd->capture_widget = dai; |
19110 |
- } |
19111 |
- |
19112 |
- dapm_connect_dai_routes(&card->dapm, codec_dai, codec, |
19113 |
-- dai_link->capture_widget, |
19114 |
-+ rtd->capture_widget, |
19115 |
- cpu_dai, capture_cpu); |
19116 |
- } |
19117 |
- } |
19118 |
-diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
19119 |
-index 1f302de44052..39ce61c5b874 100644 |
19120 |
---- a/sound/soc/soc-pcm.c |
19121 |
-+++ b/sound/soc/soc-pcm.c |
19122 |
-@@ -2908,20 +2908,44 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) |
19123 |
- struct snd_pcm *pcm; |
19124 |
- char new_name[64]; |
19125 |
- int ret = 0, playback = 0, capture = 0; |
19126 |
-+ int stream; |
19127 |
- int i; |
19128 |
- |
19129 |
-+ if (rtd->dai_link->dynamic && rtd->num_cpus > 1) { |
19130 |
-+ dev_err(rtd->dev, |
19131 |
-+ "DPCM doesn't support Multi CPU for Front-Ends yet\n"); |
19132 |
-+ return -EINVAL; |
19133 |
-+ } |
19134 |
-+ |
19135 |
- if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { |
19136 |
-- cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
19137 |
-- if (rtd->num_cpus > 1) { |
19138 |
-- dev_err(rtd->dev, |
19139 |
-- "DPCM doesn't support Multi CPU yet\n"); |
19140 |
-- return -EINVAL; |
19141 |
-+ if (rtd->dai_link->dpcm_playback) { |
19142 |
-+ stream = SNDRV_PCM_STREAM_PLAYBACK; |
19143 |
-+ |
19144 |
-+ for_each_rtd_cpu_dais(rtd, i, cpu_dai) |
19145 |
-+ if (!snd_soc_dai_stream_valid(cpu_dai, |
19146 |
-+ stream)) { |
19147 |
-+ dev_err(rtd->card->dev, |
19148 |
-+ "CPU DAI %s for rtd %s does not support playback\n", |
19149 |
-+ cpu_dai->name, |
19150 |
-+ rtd->dai_link->stream_name); |
19151 |
-+ return -EINVAL; |
19152 |
-+ } |
19153 |
-+ playback = 1; |
19154 |
-+ } |
19155 |
-+ if (rtd->dai_link->dpcm_capture) { |
19156 |
-+ stream = SNDRV_PCM_STREAM_CAPTURE; |
19157 |
-+ |
19158 |
-+ for_each_rtd_cpu_dais(rtd, i, cpu_dai) |
19159 |
-+ if (!snd_soc_dai_stream_valid(cpu_dai, |
19160 |
-+ stream)) { |
19161 |
-+ dev_err(rtd->card->dev, |
19162 |
-+ "CPU DAI %s for rtd %s does not support capture\n", |
19163 |
-+ cpu_dai->name, |
19164 |
-+ rtd->dai_link->stream_name); |
19165 |
-+ return -EINVAL; |
19166 |
-+ } |
19167 |
-+ capture = 1; |
19168 |
- } |
19169 |
-- |
19170 |
-- playback = rtd->dai_link->dpcm_playback && |
19171 |
-- snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK); |
19172 |
-- capture = rtd->dai_link->dpcm_capture && |
19173 |
-- snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE); |
19174 |
- } else { |
19175 |
- /* Adapt stream for codec2codec links */ |
19176 |
- int cpu_capture = rtd->dai_link->params ? |
19177 |
-diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c |
19178 |
-index dfc412e2d956..6d63768d42aa 100644 |
19179 |
---- a/sound/soc/sof/control.c |
19180 |
-+++ b/sound/soc/sof/control.c |
19181 |
-@@ -19,8 +19,8 @@ static void update_mute_led(struct snd_sof_control *scontrol, |
19182 |
- struct snd_kcontrol *kcontrol, |
19183 |
- struct snd_ctl_elem_value *ucontrol) |
19184 |
- { |
19185 |
-- unsigned int temp = 0; |
19186 |
-- unsigned int mask; |
19187 |
-+ int temp = 0; |
19188 |
-+ int mask; |
19189 |
- int i; |
19190 |
- |
19191 |
- mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
19192 |
-diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c |
19193 |
-index 91acfae7935c..74b438216216 100644 |
19194 |
---- a/sound/soc/sof/core.c |
19195 |
-+++ b/sound/soc/sof/core.c |
19196 |
-@@ -176,6 +176,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) |
19197 |
- /* init the IPC */ |
19198 |
- sdev->ipc = snd_sof_ipc_init(sdev); |
19199 |
- if (!sdev->ipc) { |
19200 |
-+ ret = -ENOMEM; |
19201 |
- dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret); |
19202 |
- goto ipc_err; |
19203 |
- } |
19204 |
-diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig |
19205 |
-index bae4f7bf5f75..812749064ca8 100644 |
19206 |
---- a/sound/soc/sof/imx/Kconfig |
19207 |
-+++ b/sound/soc/sof/imx/Kconfig |
19208 |
-@@ -14,7 +14,7 @@ if SND_SOC_SOF_IMX_TOPLEVEL |
19209 |
- config SND_SOC_SOF_IMX8_SUPPORT |
19210 |
- bool "SOF support for i.MX8" |
19211 |
- depends on IMX_SCU |
19212 |
-- depends on IMX_DSP |
19213 |
-+ select IMX_DSP |
19214 |
- help |
19215 |
- This adds support for Sound Open Firmware for NXP i.MX8 platforms |
19216 |
- Say Y if you have such a device. |
19217 |
-diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c |
19218 |
-index 3041fbbb010a..ea021db697b8 100644 |
19219 |
---- a/sound/soc/sof/intel/hda-codec.c |
19220 |
-+++ b/sound/soc/sof/intel/hda-codec.c |
19221 |
-@@ -24,19 +24,44 @@ |
19222 |
- #define IDISP_VID_INTEL 0x80860000 |
19223 |
- |
19224 |
- /* load the legacy HDA codec driver */ |
19225 |
--static int hda_codec_load_module(struct hda_codec *codec) |
19226 |
-+static int request_codec_module(struct hda_codec *codec) |
19227 |
- { |
19228 |
- #ifdef MODULE |
19229 |
- char alias[MODULE_NAME_LEN]; |
19230 |
-- const char *module = alias; |
19231 |
-+ const char *mod = NULL; |
19232 |
- |
19233 |
-- snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias)); |
19234 |
-- dev_dbg(&codec->core.dev, "loading codec module: %s\n", module); |
19235 |
-- request_module(module); |
19236 |
-+ switch (codec->probe_id) { |
19237 |
-+ case HDA_CODEC_ID_GENERIC: |
19238 |
-+#if IS_MODULE(CONFIG_SND_HDA_GENERIC) |
19239 |
-+ mod = "snd-hda-codec-generic"; |
19240 |
- #endif |
19241 |
-+ break; |
19242 |
-+ default: |
19243 |
-+ snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias)); |
19244 |
-+ mod = alias; |
19245 |
-+ break; |
19246 |
-+ } |
19247 |
-+ |
19248 |
-+ if (mod) { |
19249 |
-+ dev_dbg(&codec->core.dev, "loading codec module: %s\n", mod); |
19250 |
-+ request_module(mod); |
19251 |
-+ } |
19252 |
-+#endif /* MODULE */ |
19253 |
- return device_attach(hda_codec_dev(codec)); |
19254 |
- } |
19255 |
- |
19256 |
-+static int hda_codec_load_module(struct hda_codec *codec) |
19257 |
-+{ |
19258 |
-+ int ret = request_codec_module(codec); |
19259 |
-+ |
19260 |
-+ if (ret <= 0) { |
19261 |
-+ codec->probe_id = HDA_CODEC_ID_GENERIC; |
19262 |
-+ ret = request_codec_module(codec); |
19263 |
-+ } |
19264 |
-+ |
19265 |
-+ return ret; |
19266 |
-+} |
19267 |
-+ |
19268 |
- /* enable controller wake up event for all codecs with jack connectors */ |
19269 |
- void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) |
19270 |
- { |
19271 |
-@@ -78,6 +103,13 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) {} |
19272 |
- EXPORT_SYMBOL_NS(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC); |
19273 |
- EXPORT_SYMBOL_NS(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC); |
19274 |
- |
19275 |
-+#if IS_ENABLED(CONFIG_SND_HDA_GENERIC) |
19276 |
-+#define is_generic_config(bus) \ |
19277 |
-+ ((bus)->modelname && !strcmp((bus)->modelname, "generic")) |
19278 |
-+#else |
19279 |
-+#define is_generic_config(x) 0 |
19280 |
-+#endif |
19281 |
-+ |
19282 |
- /* probe individual codec */ |
19283 |
- static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19284 |
- bool hda_codec_use_common_hdmi) |
19285 |
-@@ -87,6 +119,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19286 |
- #endif |
19287 |
- struct hda_bus *hbus = sof_to_hbus(sdev); |
19288 |
- struct hdac_device *hdev; |
19289 |
-+ struct hda_codec *codec; |
19290 |
- u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) | |
19291 |
- (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; |
19292 |
- u32 resp = -1; |
19293 |
-@@ -108,6 +141,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19294 |
- |
19295 |
- hda_priv->codec.bus = hbus; |
19296 |
- hdev = &hda_priv->codec.core; |
19297 |
-+ codec = &hda_priv->codec; |
19298 |
- |
19299 |
- ret = snd_hdac_ext_bus_device_init(&hbus->core, address, hdev); |
19300 |
- if (ret < 0) |
19301 |
-@@ -122,6 +156,11 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19302 |
- hda_priv->need_display_power = true; |
19303 |
- } |
19304 |
- |
19305 |
-+ if (is_generic_config(hbus)) |
19306 |
-+ codec->probe_id = HDA_CODEC_ID_GENERIC; |
19307 |
-+ else |
19308 |
-+ codec->probe_id = 0; |
19309 |
-+ |
19310 |
- /* |
19311 |
- * if common HDMI codec driver is not used, codec load |
19312 |
- * is skipped here and hdac_hdmi is used instead |
19313 |
-@@ -129,7 +168,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, |
19314 |
- if (hda_codec_use_common_hdmi || |
19315 |
- (resp & 0xFFFF0000) != IDISP_VID_INTEL) { |
19316 |
- hdev->type = HDA_DEV_LEGACY; |
19317 |
-- ret = hda_codec_load_module(&hda_priv->codec); |
19318 |
-+ ret = hda_codec_load_module(codec); |
19319 |
- /* |
19320 |
- * handle ret==0 (no driver bound) as an error, but pass |
19321 |
- * other return codes without modification |
19322 |
-diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c |
19323 |
-index 2233146386cc..71cf5f9db79d 100644 |
19324 |
---- a/sound/soc/sof/nocodec.c |
19325 |
-+++ b/sound/soc/sof/nocodec.c |
19326 |
-@@ -52,8 +52,10 @@ static int sof_nocodec_bes_setup(struct device *dev, |
19327 |
- links[i].platforms->name = dev_name(dev); |
19328 |
- links[i].codecs->dai_name = "snd-soc-dummy-dai"; |
19329 |
- links[i].codecs->name = "snd-soc-dummy"; |
19330 |
-- links[i].dpcm_playback = 1; |
19331 |
-- links[i].dpcm_capture = 1; |
19332 |
-+ if (ops->drv[i].playback.channels_min) |
19333 |
-+ links[i].dpcm_playback = 1; |
19334 |
-+ if (ops->drv[i].capture.channels_min) |
19335 |
-+ links[i].dpcm_capture = 1; |
19336 |
- } |
19337 |
- |
19338 |
- card->dai_link = links; |
19339 |
-diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c |
19340 |
-index c410822d9920..01d83ddc16ba 100644 |
19341 |
---- a/sound/soc/sof/pm.c |
19342 |
-+++ b/sound/soc/sof/pm.c |
19343 |
-@@ -90,7 +90,10 @@ static int sof_resume(struct device *dev, bool runtime_resume) |
19344 |
- int ret; |
19345 |
- |
19346 |
- /* do nothing if dsp resume callbacks are not set */ |
19347 |
-- if (!sof_ops(sdev)->resume || !sof_ops(sdev)->runtime_resume) |
19348 |
-+ if (!runtime_resume && !sof_ops(sdev)->resume) |
19349 |
-+ return 0; |
19350 |
-+ |
19351 |
-+ if (runtime_resume && !sof_ops(sdev)->runtime_resume) |
19352 |
- return 0; |
19353 |
- |
19354 |
- /* DSP was never successfully started, nothing to resume */ |
19355 |
-@@ -175,7 +178,10 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) |
19356 |
- int ret; |
19357 |
- |
19358 |
- /* do nothing if dsp suspend callback is not set */ |
19359 |
-- if (!sof_ops(sdev)->suspend) |
19360 |
-+ if (!runtime_suspend && !sof_ops(sdev)->suspend) |
19361 |
-+ return 0; |
19362 |
-+ |
19363 |
-+ if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) |
19364 |
- return 0; |
19365 |
- |
19366 |
- if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) |
19367 |
-diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h |
19368 |
-index bf65f31af858..875a5fc13297 100644 |
19369 |
---- a/sound/soc/sof/sof-audio.h |
19370 |
-+++ b/sound/soc/sof/sof-audio.h |
19371 |
-@@ -56,7 +56,7 @@ struct snd_sof_pcm { |
19372 |
- struct snd_sof_led_control { |
19373 |
- unsigned int use_led; |
19374 |
- unsigned int direction; |
19375 |
-- unsigned int led_value; |
19376 |
-+ int led_value; |
19377 |
- }; |
19378 |
- |
19379 |
- /* ALSA SOF Kcontrol device */ |
19380 |
-diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c |
19381 |
-index fe8ba3e05e08..ab2b69de1d4d 100644 |
19382 |
---- a/sound/soc/sof/topology.c |
19383 |
-+++ b/sound/soc/sof/topology.c |
19384 |
-@@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, |
19385 |
- return ret; |
19386 |
- } |
19387 |
- |
19388 |
-+ scontrol->led_ctl.led_value = -1; |
19389 |
-+ |
19390 |
- dobj->private = scontrol; |
19391 |
- list_add(&scontrol->list, &sdev->kcontrol_list); |
19392 |
- return ret; |
19393 |
-diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c |
19394 |
-index 9b5651502f12..3aca354f9e08 100644 |
19395 |
---- a/sound/soc/tegra/tegra_wm8903.c |
19396 |
-+++ b/sound/soc/tegra/tegra_wm8903.c |
19397 |
-@@ -177,6 +177,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) |
19398 |
- struct snd_soc_component *component = codec_dai->component; |
19399 |
- struct snd_soc_card *card = rtd->card; |
19400 |
- struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); |
19401 |
-+ int shrt = 0; |
19402 |
- |
19403 |
- if (gpio_is_valid(machine->gpio_hp_det)) { |
19404 |
- tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; |
19405 |
-@@ -189,12 +190,15 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) |
19406 |
- &tegra_wm8903_hp_jack_gpio); |
19407 |
- } |
19408 |
- |
19409 |
-+ if (of_property_read_bool(card->dev->of_node, "nvidia,headset")) |
19410 |
-+ shrt = SND_JACK_MICROPHONE; |
19411 |
-+ |
19412 |
- snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, |
19413 |
- &tegra_wm8903_mic_jack, |
19414 |
- tegra_wm8903_mic_jack_pins, |
19415 |
- ARRAY_SIZE(tegra_wm8903_mic_jack_pins)); |
19416 |
- wm8903_mic_detect(component, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, |
19417 |
-- 0); |
19418 |
-+ shrt); |
19419 |
- |
19420 |
- snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS"); |
19421 |
- |
19422 |
-diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c |
19423 |
-index 734ffe925c4d..7a7db743dc5b 100644 |
19424 |
---- a/sound/soc/ti/davinci-mcasp.c |
19425 |
-+++ b/sound/soc/ti/davinci-mcasp.c |
19426 |
-@@ -1896,8 +1896,10 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) |
19427 |
- PTR_ERR(chan)); |
19428 |
- return PTR_ERR(chan); |
19429 |
- } |
19430 |
-- if (WARN_ON(!chan->device || !chan->device->dev)) |
19431 |
-+ if (WARN_ON(!chan->device || !chan->device->dev)) { |
19432 |
-+ dma_release_channel(chan); |
19433 |
- return -EINVAL; |
19434 |
-+ } |
19435 |
- |
19436 |
- if (chan->device->dev->of_node) |
19437 |
- ret = of_property_read_string(chan->device->dev->of_node, |
19438 |
-diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c |
19439 |
-index 3d41ca2238d4..4f33ddb7b441 100644 |
19440 |
---- a/sound/soc/ti/omap-mcbsp.c |
19441 |
-+++ b/sound/soc/ti/omap-mcbsp.c |
19442 |
-@@ -686,7 +686,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
19443 |
- mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, |
19444 |
- SNDRV_PCM_STREAM_CAPTURE); |
19445 |
- |
19446 |
-- mcbsp->fclk = clk_get(&pdev->dev, "fck"); |
19447 |
-+ mcbsp->fclk = devm_clk_get(&pdev->dev, "fck"); |
19448 |
- if (IS_ERR(mcbsp->fclk)) { |
19449 |
- ret = PTR_ERR(mcbsp->fclk); |
19450 |
- dev_err(mcbsp->dev, "unable to get fck: %d\n", ret); |
19451 |
-@@ -711,7 +711,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
19452 |
- if (ret) { |
19453 |
- dev_err(mcbsp->dev, |
19454 |
- "Unable to create additional controls\n"); |
19455 |
-- goto err_thres; |
19456 |
-+ return ret; |
19457 |
- } |
19458 |
- } |
19459 |
- |
19460 |
-@@ -724,8 +724,6 @@ static int omap_mcbsp_init(struct platform_device *pdev) |
19461 |
- err_st: |
19462 |
- if (mcbsp->pdata->buffer_size) |
19463 |
- sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); |
19464 |
--err_thres: |
19465 |
-- clk_put(mcbsp->fclk); |
19466 |
- return ret; |
19467 |
- } |
19468 |
- |
19469 |
-@@ -1442,8 +1440,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev) |
19470 |
- |
19471 |
- omap_mcbsp_st_cleanup(pdev); |
19472 |
- |
19473 |
-- clk_put(mcbsp->fclk); |
19474 |
-- |
19475 |
- return 0; |
19476 |
- } |
19477 |
- |
19478 |
-diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c |
19479 |
-index 2873e8e6f02b..cdae1190b930 100644 |
19480 |
---- a/sound/soc/ux500/mop500.c |
19481 |
-+++ b/sound/soc/ux500/mop500.c |
19482 |
-@@ -63,10 +63,11 @@ static void mop500_of_node_put(void) |
19483 |
- { |
19484 |
- int i; |
19485 |
- |
19486 |
-- for (i = 0; i < 2; i++) { |
19487 |
-+ for (i = 0; i < 2; i++) |
19488 |
- of_node_put(mop500_dai_links[i].cpus->of_node); |
19489 |
-- of_node_put(mop500_dai_links[i].codecs->of_node); |
19490 |
-- } |
19491 |
-+ |
19492 |
-+ /* Both links use the same codec, which is refcounted only once */ |
19493 |
-+ of_node_put(mop500_dai_links[0].codecs->of_node); |
19494 |
- } |
19495 |
- |
19496 |
- static int mop500_of_probe(struct platform_device *pdev, |
19497 |
-@@ -81,7 +82,9 @@ static int mop500_of_probe(struct platform_device *pdev, |
19498 |
- |
19499 |
- if (!(msp_np[0] && msp_np[1] && codec_np)) { |
19500 |
- dev_err(&pdev->dev, "Phandle missing or invalid\n"); |
19501 |
-- mop500_of_node_put(); |
19502 |
-+ for (i = 0; i < 2; i++) |
19503 |
-+ of_node_put(msp_np[i]); |
19504 |
-+ of_node_put(codec_np); |
19505 |
- return -EINVAL; |
19506 |
- } |
19507 |
- |
19508 |
-diff --git a/sound/usb/card.h b/sound/usb/card.h |
19509 |
-index 395403a2d33f..d6219fba9699 100644 |
19510 |
---- a/sound/usb/card.h |
19511 |
-+++ b/sound/usb/card.h |
19512 |
-@@ -84,6 +84,10 @@ struct snd_usb_endpoint { |
19513 |
- dma_addr_t sync_dma; /* DMA address of syncbuf */ |
19514 |
- |
19515 |
- unsigned int pipe; /* the data i/o pipe */ |
19516 |
-+ unsigned int framesize[2]; /* small/large frame sizes in samples */ |
19517 |
-+ unsigned int sample_rem; /* remainder from division fs/fps */ |
19518 |
-+ unsigned int sample_accum; /* sample accumulator */ |
19519 |
-+ unsigned int fps; /* frames per second */ |
19520 |
- unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ |
19521 |
- unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ |
19522 |
- int freqshift; /* how much to shift the feedback value to get Q16.16 */ |
19523 |
-@@ -104,6 +108,7 @@ struct snd_usb_endpoint { |
19524 |
- int iface, altsetting; |
19525 |
- int skip_packets; /* quirks for devices to ignore the first n packets |
19526 |
- in a stream */ |
19527 |
-+ bool is_implicit_feedback; /* This endpoint is used as implicit feedback */ |
19528 |
- |
19529 |
- spinlock_t lock; |
19530 |
- struct list_head list; |
19531 |
-diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c |
19532 |
-index 4a9a2f6ef5a4..9bea7d3f99f8 100644 |
19533 |
---- a/sound/usb/endpoint.c |
19534 |
-+++ b/sound/usb/endpoint.c |
19535 |
-@@ -124,12 +124,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep) |
19536 |
- |
19537 |
- /* |
19538 |
- * For streaming based on information derived from sync endpoints, |
19539 |
-- * prepare_outbound_urb_sizes() will call next_packet_size() to |
19540 |
-+ * prepare_outbound_urb_sizes() will call slave_next_packet_size() to |
19541 |
- * determine the number of samples to be sent in the next packet. |
19542 |
- * |
19543 |
-- * For implicit feedback, next_packet_size() is unused. |
19544 |
-+ * For implicit feedback, slave_next_packet_size() is unused. |
19545 |
- */ |
19546 |
--int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
19547 |
-+int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep) |
19548 |
- { |
19549 |
- unsigned long flags; |
19550 |
- int ret; |
19551 |
-@@ -146,6 +146,29 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
19552 |
- return ret; |
19553 |
- } |
19554 |
- |
19555 |
-+/* |
19556 |
-+ * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes() |
19557 |
-+ * will call next_packet_size() to determine the number of samples to be |
19558 |
-+ * sent in the next packet. |
19559 |
-+ */ |
19560 |
-+int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
19561 |
-+{ |
19562 |
-+ int ret; |
19563 |
-+ |
19564 |
-+ if (ep->fill_max) |
19565 |
-+ return ep->maxframesize; |
19566 |
-+ |
19567 |
-+ ep->sample_accum += ep->sample_rem; |
19568 |
-+ if (ep->sample_accum >= ep->fps) { |
19569 |
-+ ep->sample_accum -= ep->fps; |
19570 |
-+ ret = ep->framesize[1]; |
19571 |
-+ } else { |
19572 |
-+ ret = ep->framesize[0]; |
19573 |
-+ } |
19574 |
-+ |
19575 |
-+ return ret; |
19576 |
-+} |
19577 |
-+ |
19578 |
- static void retire_outbound_urb(struct snd_usb_endpoint *ep, |
19579 |
- struct snd_urb_ctx *urb_ctx) |
19580 |
- { |
19581 |
-@@ -190,6 +213,8 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep, |
19582 |
- |
19583 |
- if (ctx->packet_size[i]) |
19584 |
- counts = ctx->packet_size[i]; |
19585 |
-+ else if (ep->sync_master) |
19586 |
-+ counts = snd_usb_endpoint_slave_next_packet_size(ep); |
19587 |
- else |
19588 |
- counts = snd_usb_endpoint_next_packet_size(ep); |
19589 |
- |
19590 |
-@@ -321,17 +346,17 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep) |
19591 |
- ep->next_packet_read_pos %= MAX_URBS; |
19592 |
- |
19593 |
- /* take URB out of FIFO */ |
19594 |
-- if (!list_empty(&ep->ready_playback_urbs)) |
19595 |
-+ if (!list_empty(&ep->ready_playback_urbs)) { |
19596 |
- ctx = list_first_entry(&ep->ready_playback_urbs, |
19597 |
- struct snd_urb_ctx, ready_list); |
19598 |
-+ list_del_init(&ctx->ready_list); |
19599 |
-+ } |
19600 |
- } |
19601 |
- spin_unlock_irqrestore(&ep->lock, flags); |
19602 |
- |
19603 |
- if (ctx == NULL) |
19604 |
- return; |
19605 |
- |
19606 |
-- list_del_init(&ctx->ready_list); |
19607 |
-- |
19608 |
- /* copy over the length information */ |
19609 |
- for (i = 0; i < packet->packets; i++) |
19610 |
- ctx->packet_size[i] = packet->packet_size[i]; |
19611 |
-@@ -497,6 +522,8 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, |
19612 |
- |
19613 |
- list_add_tail(&ep->list, &chip->ep_list); |
19614 |
- |
19615 |
-+ ep->is_implicit_feedback = 0; |
19616 |
-+ |
19617 |
- __exit_unlock: |
19618 |
- mutex_unlock(&chip->mutex); |
19619 |
- |
19620 |
-@@ -596,6 +623,178 @@ static void release_urbs(struct snd_usb_endpoint *ep, int force) |
19621 |
- ep->nurbs = 0; |
19622 |
- } |
19623 |
- |
19624 |
-+/* |
19625 |
-+ * Check data endpoint for format differences |
19626 |
-+ */ |
19627 |
-+static bool check_ep_params(struct snd_usb_endpoint *ep, |
19628 |
-+ snd_pcm_format_t pcm_format, |
19629 |
-+ unsigned int channels, |
19630 |
-+ unsigned int period_bytes, |
19631 |
-+ unsigned int frames_per_period, |
19632 |
-+ unsigned int periods_per_buffer, |
19633 |
-+ struct audioformat *fmt, |
19634 |
-+ struct snd_usb_endpoint *sync_ep) |
19635 |
-+{ |
19636 |
-+ unsigned int maxsize, minsize, packs_per_ms, max_packs_per_urb; |
19637 |
-+ unsigned int max_packs_per_period, urbs_per_period, urb_packs; |
19638 |
-+ unsigned int max_urbs; |
19639 |
-+ int frame_bits = snd_pcm_format_physical_width(pcm_format) * channels; |
19640 |
-+ int tx_length_quirk = (ep->chip->tx_length_quirk && |
19641 |
-+ usb_pipeout(ep->pipe)); |
19642 |
-+ bool ret = 1; |
19643 |
-+ |
19644 |
-+ if (pcm_format == SNDRV_PCM_FORMAT_DSD_U16_LE && fmt->dsd_dop) { |
19645 |
-+ /* |
19646 |
-+ * When operating in DSD DOP mode, the size of a sample frame |
19647 |
-+ * in hardware differs from the actual physical format width |
19648 |
-+ * because we need to make room for the DOP markers. |
19649 |
-+ */ |
19650 |
-+ frame_bits += channels << 3; |
19651 |
-+ } |
19652 |
-+ |
19653 |
-+ ret = ret && (ep->datainterval == fmt->datainterval); |
19654 |
-+ ret = ret && (ep->stride == frame_bits >> 3); |
19655 |
-+ |
19656 |
-+ switch (pcm_format) { |
19657 |
-+ case SNDRV_PCM_FORMAT_U8: |
19658 |
-+ ret = ret && (ep->silence_value == 0x80); |
19659 |
-+ break; |
19660 |
-+ case SNDRV_PCM_FORMAT_DSD_U8: |
19661 |
-+ case SNDRV_PCM_FORMAT_DSD_U16_LE: |
19662 |
-+ case SNDRV_PCM_FORMAT_DSD_U32_LE: |
19663 |
-+ case SNDRV_PCM_FORMAT_DSD_U16_BE: |
19664 |
-+ case SNDRV_PCM_FORMAT_DSD_U32_BE: |
19665 |
-+ ret = ret && (ep->silence_value == 0x69); |
19666 |
-+ break; |
19667 |
-+ default: |
19668 |
-+ ret = ret && (ep->silence_value == 0); |
19669 |
-+ } |
19670 |
-+ |
19671 |
-+ /* assume max. frequency is 50% higher than nominal */ |
19672 |
-+ ret = ret && (ep->freqmax == ep->freqn + (ep->freqn >> 1)); |
19673 |
-+ /* Round up freqmax to nearest integer in order to calculate maximum |
19674 |
-+ * packet size, which must represent a whole number of frames. |
19675 |
-+ * This is accomplished by adding 0x0.ffff before converting the |
19676 |
-+ * Q16.16 format into integer. |
19677 |
-+ * In order to accurately calculate the maximum packet size when |
19678 |
-+ * the data interval is more than 1 (i.e. ep->datainterval > 0), |
19679 |
-+ * multiply by the data interval prior to rounding. For instance, |
19680 |
-+ * a freqmax of 41 kHz will result in a max packet size of 6 (5.125) |
19681 |
-+ * frames with a data interval of 1, but 11 (10.25) frames with a |
19682 |
-+ * data interval of 2. |
19683 |
-+ * (ep->freqmax << ep->datainterval overflows at 8.192 MHz for the |
19684 |
-+ * maximum datainterval value of 3, at USB full speed, higher for |
19685 |
-+ * USB high speed, noting that ep->freqmax is in units of |
19686 |
-+ * frames per packet in Q16.16 format.) |
19687 |
-+ */ |
19688 |
-+ maxsize = (((ep->freqmax << ep->datainterval) + 0xffff) >> 16) * |
19689 |
-+ (frame_bits >> 3); |
19690 |
-+ if (tx_length_quirk) |
19691 |
-+ maxsize += sizeof(__le32); /* Space for length descriptor */ |
19692 |
-+ /* but wMaxPacketSize might reduce this */ |
19693 |
-+ if (ep->maxpacksize && ep->maxpacksize < maxsize) { |
19694 |
-+ /* whatever fits into a max. size packet */ |
19695 |
-+ unsigned int data_maxsize = maxsize = ep->maxpacksize; |
19696 |
-+ |
19697 |
-+ if (tx_length_quirk) |
19698 |
-+ /* Need to remove the length descriptor to calc freq */ |
19699 |
-+ data_maxsize -= sizeof(__le32); |
19700 |
-+ ret = ret && (ep->freqmax == (data_maxsize / (frame_bits >> 3)) |
19701 |
-+ << (16 - ep->datainterval)); |
19702 |
-+ } |
19703 |
-+ |
19704 |
-+ if (ep->fill_max) |
19705 |
-+ ret = ret && (ep->curpacksize == ep->maxpacksize); |
19706 |
-+ else |
19707 |
-+ ret = ret && (ep->curpacksize == maxsize); |
19708 |
-+ |
19709 |
-+ if (snd_usb_get_speed(ep->chip->dev) != USB_SPEED_FULL) { |
19710 |
-+ packs_per_ms = 8 >> ep->datainterval; |
19711 |
-+ max_packs_per_urb = MAX_PACKS_HS; |
19712 |
-+ } else { |
19713 |
-+ packs_per_ms = 1; |
19714 |
-+ max_packs_per_urb = MAX_PACKS; |
19715 |
-+ } |
19716 |
-+ if (sync_ep && !snd_usb_endpoint_implicit_feedback_sink(ep)) |
19717 |
-+ max_packs_per_urb = min(max_packs_per_urb, |
19718 |
-+ 1U << sync_ep->syncinterval); |
19719 |
-+ max_packs_per_urb = max(1u, max_packs_per_urb >> ep->datainterval); |
19720 |
-+ |
19721 |
-+ /* |
19722 |
-+ * Capture endpoints need to use small URBs because there's no way |
19723 |
-+ * to tell in advance where the next period will end, and we don't |
19724 |
-+ * want the next URB to complete much after the period ends. |
19725 |
-+ * |
19726 |
-+ * Playback endpoints with implicit sync much use the same parameters |
19727 |
-+ * as their corresponding capture endpoint. |
19728 |
-+ */ |
19729 |
-+ if (usb_pipein(ep->pipe) || |
19730 |
-+ snd_usb_endpoint_implicit_feedback_sink(ep)) { |
19731 |
-+ |
19732 |
-+ urb_packs = packs_per_ms; |
19733 |
-+ /* |
19734 |
-+ * Wireless devices can poll at a max rate of once per 4ms. |
19735 |
-+ * For dataintervals less than 5, increase the packet count to |
19736 |
-+ * allow the host controller to use bursting to fill in the |
19737 |
-+ * gaps. |
19738 |
-+ */ |
19739 |
-+ if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_WIRELESS) { |
19740 |
-+ int interval = ep->datainterval; |
19741 |
-+ |
19742 |
-+ while (interval < 5) { |
19743 |
-+ urb_packs <<= 1; |
19744 |
-+ ++interval; |
19745 |
-+ } |
19746 |
-+ } |
19747 |
-+ /* make capture URBs <= 1 ms and smaller than a period */ |
19748 |
-+ urb_packs = min(max_packs_per_urb, urb_packs); |
19749 |
-+ while (urb_packs > 1 && urb_packs * maxsize >= period_bytes) |
19750 |
-+ urb_packs >>= 1; |
19751 |
-+ ret = ret && (ep->nurbs == MAX_URBS); |
19752 |
-+ |
19753 |
-+ /* |
19754 |
-+ * Playback endpoints without implicit sync are adjusted so that |
19755 |
-+ * a period fits as evenly as possible in the smallest number of |
19756 |
-+ * URBs. The total number of URBs is adjusted to the size of the |
19757 |
-+ * ALSA buffer, subject to the MAX_URBS and MAX_QUEUE limits. |
19758 |
-+ */ |
19759 |
-+ } else { |
19760 |
-+ /* determine how small a packet can be */ |
19761 |
-+ minsize = (ep->freqn >> (16 - ep->datainterval)) * |
19762 |
-+ (frame_bits >> 3); |
19763 |
-+ /* with sync from device, assume it can be 12% lower */ |
19764 |
-+ if (sync_ep) |
19765 |
-+ minsize -= minsize >> 3; |
19766 |
-+ minsize = max(minsize, 1u); |
19767 |
-+ |
19768 |
-+ /* how many packets will contain an entire ALSA period? */ |
19769 |
-+ max_packs_per_period = DIV_ROUND_UP(period_bytes, minsize); |
19770 |
-+ |
19771 |
-+ /* how many URBs will contain a period? */ |
19772 |
-+ urbs_per_period = DIV_ROUND_UP(max_packs_per_period, |
19773 |
-+ max_packs_per_urb); |
19774 |
-+ /* how many packets are needed in each URB? */ |
19775 |
-+ urb_packs = DIV_ROUND_UP(max_packs_per_period, urbs_per_period); |
19776 |
-+ |
19777 |
-+ /* limit the number of frames in a single URB */ |
19778 |
-+ ret = ret && (ep->max_urb_frames == |
19779 |
-+ DIV_ROUND_UP(frames_per_period, urbs_per_period)); |
19780 |
-+ |
19781 |
-+ /* try to use enough URBs to contain an entire ALSA buffer */ |
19782 |
-+ max_urbs = min((unsigned) MAX_URBS, |
19783 |
-+ MAX_QUEUE * packs_per_ms / urb_packs); |
19784 |
-+ ret = ret && (ep->nurbs == min(max_urbs, |
19785 |
-+ urbs_per_period * periods_per_buffer)); |
19786 |
-+ } |
19787 |
-+ |
19788 |
-+ ret = ret && (ep->datainterval == fmt->datainterval); |
19789 |
-+ ret = ret && (ep->maxpacksize == fmt->maxpacksize); |
19790 |
-+ ret = ret && |
19791 |
-+ (ep->fill_max == !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX)); |
19792 |
-+ |
19793 |
-+ return ret; |
19794 |
-+} |
19795 |
-+ |
19796 |
- /* |
19797 |
- * configure a data endpoint |
19798 |
- */ |
19799 |
-@@ -861,10 +1060,23 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
19800 |
- int err; |
19801 |
- |
19802 |
- if (ep->use_count != 0) { |
19803 |
-- usb_audio_warn(ep->chip, |
19804 |
-- "Unable to change format on ep #%x: already in use\n", |
19805 |
-- ep->ep_num); |
19806 |
-- return -EBUSY; |
19807 |
-+ bool check = ep->is_implicit_feedback && |
19808 |
-+ check_ep_params(ep, pcm_format, |
19809 |
-+ channels, period_bytes, |
19810 |
-+ period_frames, buffer_periods, |
19811 |
-+ fmt, sync_ep); |
19812 |
-+ |
19813 |
-+ if (!check) { |
19814 |
-+ usb_audio_warn(ep->chip, |
19815 |
-+ "Unable to change format on ep #%x: already in use\n", |
19816 |
-+ ep->ep_num); |
19817 |
-+ return -EBUSY; |
19818 |
-+ } |
19819 |
-+ |
19820 |
-+ usb_audio_dbg(ep->chip, |
19821 |
-+ "Ep #%x already in use as implicit feedback but format not changed\n", |
19822 |
-+ ep->ep_num); |
19823 |
-+ return 0; |
19824 |
- } |
19825 |
- |
19826 |
- /* release old buffers, if any */ |
19827 |
-@@ -874,10 +1086,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, |
19828 |
- ep->maxpacksize = fmt->maxpacksize; |
19829 |
- ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX); |
19830 |
- |
19831 |
-- if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) |
19832 |
-+ if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) { |
19833 |
- ep->freqn = get_usb_full_speed_rate(rate); |
19834 |
-- else |
19835 |
-+ ep->fps = 1000; |
19836 |
-+ } else { |
19837 |
- ep->freqn = get_usb_high_speed_rate(rate); |
19838 |
-+ ep->fps = 8000; |
19839 |
-+ } |
19840 |
-+ |
19841 |
-+ ep->sample_rem = rate % ep->fps; |
19842 |
-+ ep->framesize[0] = rate / ep->fps; |
19843 |
-+ ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps; |
19844 |
- |
19845 |
- /* calculate the frequency in 16.16 format */ |
19846 |
- ep->freqm = ep->freqn; |
19847 |
-@@ -936,6 +1155,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) |
19848 |
- ep->active_mask = 0; |
19849 |
- ep->unlink_mask = 0; |
19850 |
- ep->phase = 0; |
19851 |
-+ ep->sample_accum = 0; |
19852 |
- |
19853 |
- snd_usb_endpoint_start_quirk(ep); |
19854 |
- |
19855 |
-diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h |
19856 |
-index 63a39d4fa8d8..d23fa0a8c11b 100644 |
19857 |
---- a/sound/usb/endpoint.h |
19858 |
-+++ b/sound/usb/endpoint.h |
19859 |
-@@ -28,6 +28,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep); |
19860 |
- void snd_usb_endpoint_free(struct snd_usb_endpoint *ep); |
19861 |
- |
19862 |
- int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); |
19863 |
-+int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep); |
19864 |
- int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep); |
19865 |
- |
19866 |
- void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, |
19867 |
-diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
19868 |
-index a5f65a9a0254..aad2683ff793 100644 |
19869 |
---- a/sound/usb/mixer_quirks.c |
19870 |
-+++ b/sound/usb/mixer_quirks.c |
19871 |
-@@ -2185,6 +2185,421 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer) |
19872 |
- return 0; |
19873 |
- } |
19874 |
- |
19875 |
-+/* |
19876 |
-+ * RME Babyface Pro (FS) |
19877 |
-+ * |
19878 |
-+ * These devices exposes a couple of DSP functions via request to EP0. |
19879 |
-+ * Switches are available via control registers, while routing is controlled |
19880 |
-+ * by controlling the volume on each possible crossing point. |
19881 |
-+ * Volume control is linear, from -inf (dec. 0) to +6dB (dec. 65536) with |
19882 |
-+ * 0dB being at dec. 32768. |
19883 |
-+ */ |
19884 |
-+enum { |
19885 |
-+ SND_BBFPRO_CTL_REG1 = 0, |
19886 |
-+ SND_BBFPRO_CTL_REG2 |
19887 |
-+}; |
19888 |
-+ |
19889 |
-+#define SND_BBFPRO_CTL_REG_MASK 1 |
19890 |
-+#define SND_BBFPRO_CTL_IDX_MASK 0xff |
19891 |
-+#define SND_BBFPRO_CTL_IDX_SHIFT 1 |
19892 |
-+#define SND_BBFPRO_CTL_VAL_MASK 1 |
19893 |
-+#define SND_BBFPRO_CTL_VAL_SHIFT 9 |
19894 |
-+#define SND_BBFPRO_CTL_REG1_CLK_MASTER 0 |
19895 |
-+#define SND_BBFPRO_CTL_REG1_CLK_OPTICAL 1 |
19896 |
-+#define SND_BBFPRO_CTL_REG1_SPDIF_PRO 7 |
19897 |
-+#define SND_BBFPRO_CTL_REG1_SPDIF_EMPH 8 |
19898 |
-+#define SND_BBFPRO_CTL_REG1_SPDIF_OPTICAL 10 |
19899 |
-+#define SND_BBFPRO_CTL_REG2_48V_AN1 0 |
19900 |
-+#define SND_BBFPRO_CTL_REG2_48V_AN2 1 |
19901 |
-+#define SND_BBFPRO_CTL_REG2_SENS_IN3 2 |
19902 |
-+#define SND_BBFPRO_CTL_REG2_SENS_IN4 3 |
19903 |
-+#define SND_BBFPRO_CTL_REG2_PAD_AN1 4 |
19904 |
-+#define SND_BBFPRO_CTL_REG2_PAD_AN2 5 |
19905 |
-+ |
19906 |
-+#define SND_BBFPRO_MIXER_IDX_MASK 0x1ff |
19907 |
-+#define SND_BBFPRO_MIXER_VAL_MASK 0x3ffff |
19908 |
-+#define SND_BBFPRO_MIXER_VAL_SHIFT 9 |
19909 |
-+#define SND_BBFPRO_MIXER_VAL_MIN 0 // -inf |
19910 |
-+#define SND_BBFPRO_MIXER_VAL_MAX 65536 // +6dB |
19911 |
-+ |
19912 |
-+#define SND_BBFPRO_USBREQ_CTL_REG1 0x10 |
19913 |
-+#define SND_BBFPRO_USBREQ_CTL_REG2 0x17 |
19914 |
-+#define SND_BBFPRO_USBREQ_MIXER 0x12 |
19915 |
-+ |
19916 |
-+static int snd_bbfpro_ctl_update(struct usb_mixer_interface *mixer, u8 reg, |
19917 |
-+ u8 index, u8 value) |
19918 |
-+{ |
19919 |
-+ int err; |
19920 |
-+ u16 usb_req, usb_idx, usb_val; |
19921 |
-+ struct snd_usb_audio *chip = mixer->chip; |
19922 |
-+ |
19923 |
-+ err = snd_usb_lock_shutdown(chip); |
19924 |
-+ if (err < 0) |
19925 |
-+ return err; |
19926 |
-+ |
19927 |
-+ if (reg == SND_BBFPRO_CTL_REG1) { |
19928 |
-+ usb_req = SND_BBFPRO_USBREQ_CTL_REG1; |
19929 |
-+ if (index == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) { |
19930 |
-+ usb_idx = 3; |
19931 |
-+ usb_val = value ? 3 : 0; |
19932 |
-+ } else { |
19933 |
-+ usb_idx = 1 << index; |
19934 |
-+ usb_val = value ? usb_idx : 0; |
19935 |
-+ } |
19936 |
-+ } else { |
19937 |
-+ usb_req = SND_BBFPRO_USBREQ_CTL_REG2; |
19938 |
-+ usb_idx = 1 << index; |
19939 |
-+ usb_val = value ? usb_idx : 0; |
19940 |
-+ } |
19941 |
-+ |
19942 |
-+ err = snd_usb_ctl_msg(chip->dev, |
19943 |
-+ usb_sndctrlpipe(chip->dev, 0), usb_req, |
19944 |
-+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
19945 |
-+ usb_val, usb_idx, 0, 0); |
19946 |
-+ |
19947 |
-+ snd_usb_unlock_shutdown(chip); |
19948 |
-+ return err; |
19949 |
-+} |
19950 |
-+ |
19951 |
-+static int snd_bbfpro_ctl_get(struct snd_kcontrol *kcontrol, |
19952 |
-+ struct snd_ctl_elem_value *ucontrol) |
19953 |
-+{ |
19954 |
-+ u8 reg, idx, val; |
19955 |
-+ int pv; |
19956 |
-+ |
19957 |
-+ pv = kcontrol->private_value; |
19958 |
-+ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
19959 |
-+ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
19960 |
-+ val = kcontrol->private_value >> SND_BBFPRO_CTL_VAL_SHIFT; |
19961 |
-+ |
19962 |
-+ if ((reg == SND_BBFPRO_CTL_REG1 && |
19963 |
-+ idx == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) || |
19964 |
-+ (reg == SND_BBFPRO_CTL_REG2 && |
19965 |
-+ (idx == SND_BBFPRO_CTL_REG2_SENS_IN3 || |
19966 |
-+ idx == SND_BBFPRO_CTL_REG2_SENS_IN4))) { |
19967 |
-+ ucontrol->value.enumerated.item[0] = val; |
19968 |
-+ } else { |
19969 |
-+ ucontrol->value.integer.value[0] = val; |
19970 |
-+ } |
19971 |
-+ return 0; |
19972 |
-+} |
19973 |
-+ |
19974 |
-+static int snd_bbfpro_ctl_info(struct snd_kcontrol *kcontrol, |
19975 |
-+ struct snd_ctl_elem_info *uinfo) |
19976 |
-+{ |
19977 |
-+ u8 reg, idx; |
19978 |
-+ int pv; |
19979 |
-+ |
19980 |
-+ pv = kcontrol->private_value; |
19981 |
-+ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
19982 |
-+ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
19983 |
-+ |
19984 |
-+ if (reg == SND_BBFPRO_CTL_REG1 && |
19985 |
-+ idx == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) { |
19986 |
-+ static const char * const texts[2] = { |
19987 |
-+ "AutoSync", |
19988 |
-+ "Internal" |
19989 |
-+ }; |
19990 |
-+ return snd_ctl_enum_info(uinfo, 1, 2, texts); |
19991 |
-+ } else if (reg == SND_BBFPRO_CTL_REG2 && |
19992 |
-+ (idx == SND_BBFPRO_CTL_REG2_SENS_IN3 || |
19993 |
-+ idx == SND_BBFPRO_CTL_REG2_SENS_IN4)) { |
19994 |
-+ static const char * const texts[2] = { |
19995 |
-+ "-10dBV", |
19996 |
-+ "+4dBu" |
19997 |
-+ }; |
19998 |
-+ return snd_ctl_enum_info(uinfo, 1, 2, texts); |
19999 |
-+ } |
20000 |
-+ |
20001 |
-+ uinfo->count = 1; |
20002 |
-+ uinfo->value.integer.min = 0; |
20003 |
-+ uinfo->value.integer.max = 1; |
20004 |
-+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
20005 |
-+ return 0; |
20006 |
-+} |
20007 |
-+ |
20008 |
-+static int snd_bbfpro_ctl_put(struct snd_kcontrol *kcontrol, |
20009 |
-+ struct snd_ctl_elem_value *ucontrol) |
20010 |
-+{ |
20011 |
-+ int err; |
20012 |
-+ u8 reg, idx; |
20013 |
-+ int old_value, pv, val; |
20014 |
-+ |
20015 |
-+ struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
20016 |
-+ struct usb_mixer_interface *mixer = list->mixer; |
20017 |
-+ |
20018 |
-+ pv = kcontrol->private_value; |
20019 |
-+ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
20020 |
-+ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
20021 |
-+ old_value = (pv >> SND_BBFPRO_CTL_VAL_SHIFT) & SND_BBFPRO_CTL_VAL_MASK; |
20022 |
-+ |
20023 |
-+ if ((reg == SND_BBFPRO_CTL_REG1 && |
20024 |
-+ idx == SND_BBFPRO_CTL_REG1_CLK_OPTICAL) || |
20025 |
-+ (reg == SND_BBFPRO_CTL_REG2 && |
20026 |
-+ (idx == SND_BBFPRO_CTL_REG2_SENS_IN3 || |
20027 |
-+ idx == SND_BBFPRO_CTL_REG2_SENS_IN4))) { |
20028 |
-+ val = ucontrol->value.enumerated.item[0]; |
20029 |
-+ } else { |
20030 |
-+ val = ucontrol->value.integer.value[0]; |
20031 |
-+ } |
20032 |
-+ |
20033 |
-+ if (val > 1) |
20034 |
-+ return -EINVAL; |
20035 |
-+ |
20036 |
-+ if (val == old_value) |
20037 |
-+ return 0; |
20038 |
-+ |
20039 |
-+ kcontrol->private_value = reg |
20040 |
-+ | ((idx & SND_BBFPRO_CTL_IDX_MASK) << SND_BBFPRO_CTL_IDX_SHIFT) |
20041 |
-+ | ((val & SND_BBFPRO_CTL_VAL_MASK) << SND_BBFPRO_CTL_VAL_SHIFT); |
20042 |
-+ |
20043 |
-+ err = snd_bbfpro_ctl_update(mixer, reg, idx, val); |
20044 |
-+ return err < 0 ? err : 1; |
20045 |
-+} |
20046 |
-+ |
20047 |
-+static int snd_bbfpro_ctl_resume(struct usb_mixer_elem_list *list) |
20048 |
-+{ |
20049 |
-+ u8 reg, idx; |
20050 |
-+ int value, pv; |
20051 |
-+ |
20052 |
-+ pv = list->kctl->private_value; |
20053 |
-+ reg = pv & SND_BBFPRO_CTL_REG_MASK; |
20054 |
-+ idx = (pv >> SND_BBFPRO_CTL_IDX_SHIFT) & SND_BBFPRO_CTL_IDX_MASK; |
20055 |
-+ value = (pv >> SND_BBFPRO_CTL_VAL_SHIFT) & SND_BBFPRO_CTL_VAL_MASK; |
20056 |
-+ |
20057 |
-+ return snd_bbfpro_ctl_update(list->mixer, reg, idx, value); |
20058 |
-+} |
20059 |
-+ |
20060 |
-+static int snd_bbfpro_vol_update(struct usb_mixer_interface *mixer, u16 index, |
20061 |
-+ u32 value) |
20062 |
-+{ |
20063 |
-+ struct snd_usb_audio *chip = mixer->chip; |
20064 |
-+ int err; |
20065 |
-+ u16 idx; |
20066 |
-+ u16 usb_idx, usb_val; |
20067 |
-+ u32 v; |
20068 |
-+ |
20069 |
-+ err = snd_usb_lock_shutdown(chip); |
20070 |
-+ if (err < 0) |
20071 |
-+ return err; |
20072 |
-+ |
20073 |
-+ idx = index & SND_BBFPRO_MIXER_IDX_MASK; |
20074 |
-+ // 18 bit linear volume, split so 2 bits end up in index. |
20075 |
-+ v = value & SND_BBFPRO_MIXER_VAL_MASK; |
20076 |
-+ usb_idx = idx | (v & 0x3) << 14; |
20077 |
-+ usb_val = (v >> 2) & 0xffff; |
20078 |
-+ |
20079 |
-+ err = snd_usb_ctl_msg(chip->dev, |
20080 |
-+ usb_sndctrlpipe(chip->dev, 0), |
20081 |
-+ SND_BBFPRO_USBREQ_MIXER, |
20082 |
-+ USB_DIR_OUT | USB_TYPE_VENDOR | |
20083 |
-+ USB_RECIP_DEVICE, |
20084 |
-+ usb_val, usb_idx, 0, 0); |
20085 |
-+ |
20086 |
-+ snd_usb_unlock_shutdown(chip); |
20087 |
-+ return err; |
20088 |
-+} |
20089 |
-+ |
20090 |
-+static int snd_bbfpro_vol_get(struct snd_kcontrol *kcontrol, |
20091 |
-+ struct snd_ctl_elem_value *ucontrol) |
20092 |
-+{ |
20093 |
-+ ucontrol->value.integer.value[0] = |
20094 |
-+ kcontrol->private_value >> SND_BBFPRO_MIXER_VAL_SHIFT; |
20095 |
-+ return 0; |
20096 |
-+} |
20097 |
-+ |
20098 |
-+static int snd_bbfpro_vol_info(struct snd_kcontrol *kcontrol, |
20099 |
-+ struct snd_ctl_elem_info *uinfo) |
20100 |
-+{ |
20101 |
-+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
20102 |
-+ uinfo->count = 1; |
20103 |
-+ uinfo->value.integer.min = SND_BBFPRO_MIXER_VAL_MIN; |
20104 |
-+ uinfo->value.integer.max = SND_BBFPRO_MIXER_VAL_MAX; |
20105 |
-+ return 0; |
20106 |
-+} |
20107 |
-+ |
20108 |
-+static int snd_bbfpro_vol_put(struct snd_kcontrol *kcontrol, |
20109 |
-+ struct snd_ctl_elem_value *ucontrol) |
20110 |
-+{ |
20111 |
-+ int err; |
20112 |
-+ u16 idx; |
20113 |
-+ u32 new_val, old_value, uvalue; |
20114 |
-+ struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
20115 |
-+ struct usb_mixer_interface *mixer = list->mixer; |
20116 |
-+ |
20117 |
-+ uvalue = ucontrol->value.integer.value[0]; |
20118 |
-+ idx = kcontrol->private_value & SND_BBFPRO_MIXER_IDX_MASK; |
20119 |
-+ old_value = kcontrol->private_value >> SND_BBFPRO_MIXER_VAL_SHIFT; |
20120 |
-+ |
20121 |
-+ if (uvalue > SND_BBFPRO_MIXER_VAL_MAX) |
20122 |
-+ return -EINVAL; |
20123 |
-+ |
20124 |
-+ if (uvalue == old_value) |
20125 |
-+ return 0; |
20126 |
-+ |
20127 |
-+ new_val = uvalue & SND_BBFPRO_MIXER_VAL_MASK; |
20128 |
-+ |
20129 |
-+ kcontrol->private_value = idx |
20130 |
-+ | (new_val << SND_BBFPRO_MIXER_VAL_SHIFT); |
20131 |
-+ |
20132 |
-+ err = snd_bbfpro_vol_update(mixer, idx, new_val); |
20133 |
-+ return err < 0 ? err : 1; |
20134 |
-+} |
20135 |
-+ |
20136 |
-+static int snd_bbfpro_vol_resume(struct usb_mixer_elem_list *list) |
20137 |
-+{ |
20138 |
-+ int pv = list->kctl->private_value; |
20139 |
-+ u16 idx = pv & SND_BBFPRO_MIXER_IDX_MASK; |
20140 |
-+ u32 val = (pv >> SND_BBFPRO_MIXER_VAL_SHIFT) |
20141 |
-+ & SND_BBFPRO_MIXER_VAL_MASK; |
20142 |
-+ return snd_bbfpro_vol_update(list->mixer, idx, val); |
20143 |
-+} |
20144 |
-+ |
20145 |
-+// Predfine elements |
20146 |
-+static const struct snd_kcontrol_new snd_bbfpro_ctl_control = { |
20147 |
-+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
20148 |
-+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, |
20149 |
-+ .index = 0, |
20150 |
-+ .info = snd_bbfpro_ctl_info, |
20151 |
-+ .get = snd_bbfpro_ctl_get, |
20152 |
-+ .put = snd_bbfpro_ctl_put |
20153 |
-+}; |
20154 |
-+ |
20155 |
-+static const struct snd_kcontrol_new snd_bbfpro_vol_control = { |
20156 |
-+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
20157 |
-+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, |
20158 |
-+ .index = 0, |
20159 |
-+ .info = snd_bbfpro_vol_info, |
20160 |
-+ .get = snd_bbfpro_vol_get, |
20161 |
-+ .put = snd_bbfpro_vol_put |
20162 |
-+}; |
20163 |
-+ |
20164 |
-+static int snd_bbfpro_ctl_add(struct usb_mixer_interface *mixer, u8 reg, |
20165 |
-+ u8 index, char *name) |
20166 |
-+{ |
20167 |
-+ struct snd_kcontrol_new knew = snd_bbfpro_ctl_control; |
20168 |
-+ |
20169 |
-+ knew.name = name; |
20170 |
-+ knew.private_value = (reg & SND_BBFPRO_CTL_REG_MASK) |
20171 |
-+ | ((index & SND_BBFPRO_CTL_IDX_MASK) |
20172 |
-+ << SND_BBFPRO_CTL_IDX_SHIFT); |
20173 |
-+ |
20174 |
-+ return add_single_ctl_with_resume(mixer, 0, snd_bbfpro_ctl_resume, |
20175 |
-+ &knew, NULL); |
20176 |
-+} |
20177 |
-+ |
20178 |
-+static int snd_bbfpro_vol_add(struct usb_mixer_interface *mixer, u16 index, |
20179 |
-+ char *name) |
20180 |
-+{ |
20181 |
-+ struct snd_kcontrol_new knew = snd_bbfpro_vol_control; |
20182 |
-+ |
20183 |
-+ knew.name = name; |
20184 |
-+ knew.private_value = index & SND_BBFPRO_MIXER_IDX_MASK; |
20185 |
-+ |
20186 |
-+ return add_single_ctl_with_resume(mixer, 0, snd_bbfpro_vol_resume, |
20187 |
-+ &knew, NULL); |
20188 |
-+} |
20189 |
-+ |
20190 |
-+static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer) |
20191 |
-+{ |
20192 |
-+ int err, i, o; |
20193 |
-+ char name[48]; |
20194 |
-+ |
20195 |
-+ static const char * const input[] = { |
20196 |
-+ "AN1", "AN2", "IN3", "IN4", "AS1", "AS2", "ADAT3", |
20197 |
-+ "ADAT4", "ADAT5", "ADAT6", "ADAT7", "ADAT8"}; |
20198 |
-+ |
20199 |
-+ static const char * const output[] = { |
20200 |
-+ "AN1", "AN2", "PH3", "PH4", "AS1", "AS2", "ADAT3", "ADAT4", |
20201 |
-+ "ADAT5", "ADAT6", "ADAT7", "ADAT8"}; |
20202 |
-+ |
20203 |
-+ for (o = 0 ; o < 12 ; ++o) { |
20204 |
-+ for (i = 0 ; i < 12 ; ++i) { |
20205 |
-+ // Line routing |
20206 |
-+ snprintf(name, sizeof(name), |
20207 |
-+ "%s-%s-%s Playback Volume", |
20208 |
-+ (i < 2 ? "Mic" : "Line"), |
20209 |
-+ input[i], output[o]); |
20210 |
-+ err = snd_bbfpro_vol_add(mixer, (26 * o + i), name); |
20211 |
-+ if (err < 0) |
20212 |
-+ return err; |
20213 |
-+ |
20214 |
-+ // PCM routing... yes, it is output remapping |
20215 |
-+ snprintf(name, sizeof(name), |
20216 |
-+ "PCM-%s-%s Playback Volume", |
20217 |
-+ output[i], output[o]); |
20218 |
-+ err = snd_bbfpro_vol_add(mixer, (26 * o + 12 + i), |
20219 |
-+ name); |
20220 |
-+ if (err < 0) |
20221 |
-+ return err; |
20222 |
-+ } |
20223 |
-+ } |
20224 |
-+ |
20225 |
-+ // Control Reg 1 |
20226 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20227 |
-+ SND_BBFPRO_CTL_REG1_CLK_OPTICAL, |
20228 |
-+ "Sample Clock Source"); |
20229 |
-+ if (err < 0) |
20230 |
-+ return err; |
20231 |
-+ |
20232 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20233 |
-+ SND_BBFPRO_CTL_REG1_SPDIF_PRO, |
20234 |
-+ "IEC958 Pro Mask"); |
20235 |
-+ if (err < 0) |
20236 |
-+ return err; |
20237 |
-+ |
20238 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20239 |
-+ SND_BBFPRO_CTL_REG1_SPDIF_EMPH, |
20240 |
-+ "IEC958 Emphasis"); |
20241 |
-+ if (err < 0) |
20242 |
-+ return err; |
20243 |
-+ |
20244 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG1, |
20245 |
-+ SND_BBFPRO_CTL_REG1_SPDIF_OPTICAL, |
20246 |
-+ "IEC958 Switch"); |
20247 |
-+ if (err < 0) |
20248 |
-+ return err; |
20249 |
-+ |
20250 |
-+ // Control Reg 2 |
20251 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20252 |
-+ SND_BBFPRO_CTL_REG2_48V_AN1, |
20253 |
-+ "Mic-AN1 48V"); |
20254 |
-+ if (err < 0) |
20255 |
-+ return err; |
20256 |
-+ |
20257 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20258 |
-+ SND_BBFPRO_CTL_REG2_48V_AN2, |
20259 |
-+ "Mic-AN2 48V"); |
20260 |
-+ if (err < 0) |
20261 |
-+ return err; |
20262 |
-+ |
20263 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20264 |
-+ SND_BBFPRO_CTL_REG2_SENS_IN3, |
20265 |
-+ "Line-IN3 Sens."); |
20266 |
-+ if (err < 0) |
20267 |
-+ return err; |
20268 |
-+ |
20269 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20270 |
-+ SND_BBFPRO_CTL_REG2_SENS_IN4, |
20271 |
-+ "Line-IN4 Sens."); |
20272 |
-+ if (err < 0) |
20273 |
-+ return err; |
20274 |
-+ |
20275 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20276 |
-+ SND_BBFPRO_CTL_REG2_PAD_AN1, |
20277 |
-+ "Mic-AN1 PAD"); |
20278 |
-+ if (err < 0) |
20279 |
-+ return err; |
20280 |
-+ |
20281 |
-+ err = snd_bbfpro_ctl_add(mixer, SND_BBFPRO_CTL_REG2, |
20282 |
-+ SND_BBFPRO_CTL_REG2_PAD_AN2, |
20283 |
-+ "Mic-AN2 PAD"); |
20284 |
-+ if (err < 0) |
20285 |
-+ return err; |
20286 |
-+ |
20287 |
-+ return 0; |
20288 |
-+} |
20289 |
-+ |
20290 |
- int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
20291 |
- { |
20292 |
- int err = 0; |
20293 |
-@@ -2286,6 +2701,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
20294 |
- case USB_ID(0x0194f, 0x010c): /* Presonus Studio 1810c */ |
20295 |
- err = snd_sc1810_init_mixer(mixer); |
20296 |
- break; |
20297 |
-+ case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */ |
20298 |
-+ err = snd_bbfpro_controls_create(mixer); |
20299 |
-+ break; |
20300 |
- } |
20301 |
- |
20302 |
- return err; |
20303 |
-diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
20304 |
-index a4e4064f9aee..d61c2f1095b5 100644 |
20305 |
---- a/sound/usb/pcm.c |
20306 |
-+++ b/sound/usb/pcm.c |
20307 |
-@@ -404,6 +404,8 @@ add_sync_ep: |
20308 |
- if (!subs->sync_endpoint) |
20309 |
- return -EINVAL; |
20310 |
- |
20311 |
-+ subs->sync_endpoint->is_implicit_feedback = 1; |
20312 |
-+ |
20313 |
- subs->data_endpoint->sync_master = subs->sync_endpoint; |
20314 |
- |
20315 |
- return 1; |
20316 |
-@@ -502,12 +504,15 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, |
20317 |
- implicit_fb ? |
20318 |
- SND_USB_ENDPOINT_TYPE_DATA : |
20319 |
- SND_USB_ENDPOINT_TYPE_SYNC); |
20320 |
-+ |
20321 |
- if (!subs->sync_endpoint) { |
20322 |
- if (is_playback && attr == USB_ENDPOINT_SYNC_NONE) |
20323 |
- return 0; |
20324 |
- return -EINVAL; |
20325 |
- } |
20326 |
- |
20327 |
-+ subs->sync_endpoint->is_implicit_feedback = implicit_fb; |
20328 |
-+ |
20329 |
- subs->data_endpoint->sync_master = subs->sync_endpoint; |
20330 |
- |
20331 |
- return 0; |
20332 |
-@@ -1579,6 +1584,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, |
20333 |
- for (i = 0; i < ctx->packets; i++) { |
20334 |
- if (ctx->packet_size[i]) |
20335 |
- counts = ctx->packet_size[i]; |
20336 |
-+ else if (ep->sync_master) |
20337 |
-+ counts = snd_usb_endpoint_slave_next_packet_size(ep); |
20338 |
- else |
20339 |
- counts = snd_usb_endpoint_next_packet_size(ep); |
20340 |
- |
20341 |
-diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c |
20342 |
-index 0efaf45f7367..e0878f5f74b1 100644 |
20343 |
---- a/tools/bootconfig/main.c |
20344 |
-+++ b/tools/bootconfig/main.c |
20345 |
-@@ -14,13 +14,18 @@ |
20346 |
- #include <linux/kernel.h> |
20347 |
- #include <linux/bootconfig.h> |
20348 |
- |
20349 |
--static int xbc_show_array(struct xbc_node *node) |
20350 |
-+static int xbc_show_value(struct xbc_node *node) |
20351 |
- { |
20352 |
- const char *val; |
20353 |
-+ char q; |
20354 |
- int i = 0; |
20355 |
- |
20356 |
- xbc_array_for_each_value(node, val) { |
20357 |
-- printf("\"%s\"%s", val, node->next ? ", " : ";\n"); |
20358 |
-+ if (strchr(val, '"')) |
20359 |
-+ q = '\''; |
20360 |
-+ else |
20361 |
-+ q = '"'; |
20362 |
-+ printf("%c%s%c%s", q, val, q, node->next ? ", " : ";\n"); |
20363 |
- i++; |
20364 |
- } |
20365 |
- return i; |
20366 |
-@@ -48,10 +53,7 @@ static void xbc_show_compact_tree(void) |
20367 |
- continue; |
20368 |
- } else if (cnode && xbc_node_is_value(cnode)) { |
20369 |
- printf("%s = ", xbc_node_get_data(node)); |
20370 |
-- if (cnode->next) |
20371 |
-- xbc_show_array(cnode); |
20372 |
-- else |
20373 |
-- printf("\"%s\";\n", xbc_node_get_data(cnode)); |
20374 |
-+ xbc_show_value(cnode); |
20375 |
- } else { |
20376 |
- printf("%s;\n", xbc_node_get_data(node)); |
20377 |
- } |
20378 |
-@@ -205,11 +207,13 @@ int show_xbc(const char *path) |
20379 |
- } |
20380 |
- |
20381 |
- ret = load_xbc_from_initrd(fd, &buf); |
20382 |
-- if (ret < 0) |
20383 |
-+ if (ret < 0) { |
20384 |
- pr_err("Failed to load a boot config from initrd: %d\n", ret); |
20385 |
-- else |
20386 |
-- xbc_show_compact_tree(); |
20387 |
-- |
20388 |
-+ goto out; |
20389 |
-+ } |
20390 |
-+ xbc_show_compact_tree(); |
20391 |
-+ ret = 0; |
20392 |
-+out: |
20393 |
- close(fd); |
20394 |
- free(buf); |
20395 |
- |
20396 |
-diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c |
20397 |
-index f8113b3646f5..f5960b48c861 100644 |
20398 |
---- a/tools/bpf/bpftool/gen.c |
20399 |
-+++ b/tools/bpf/bpftool/gen.c |
20400 |
-@@ -225,6 +225,7 @@ static int codegen(const char *template, ...) |
20401 |
- } else { |
20402 |
- p_err("unrecognized character at pos %td in template '%s'", |
20403 |
- src - template - 1, template); |
20404 |
-+ free(s); |
20405 |
- return -EINVAL; |
20406 |
- } |
20407 |
- } |
20408 |
-@@ -235,6 +236,7 @@ static int codegen(const char *template, ...) |
20409 |
- if (*src != '\t') { |
20410 |
- p_err("not enough tabs at pos %td in template '%s'", |
20411 |
- src - template - 1, template); |
20412 |
-+ free(s); |
20413 |
- return -EINVAL; |
20414 |
- } |
20415 |
- } |
20416 |
-diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c |
20417 |
-index 0c28ee82834b..653dbbe2e366 100644 |
20418 |
---- a/tools/lib/bpf/btf_dump.c |
20419 |
-+++ b/tools/lib/bpf/btf_dump.c |
20420 |
-@@ -1137,6 +1137,20 @@ static void btf_dump_emit_mods(struct btf_dump *d, struct id_stack *decl_stack) |
20421 |
- } |
20422 |
- } |
20423 |
- |
20424 |
-+static void btf_dump_drop_mods(struct btf_dump *d, struct id_stack *decl_stack) |
20425 |
-+{ |
20426 |
-+ const struct btf_type *t; |
20427 |
-+ __u32 id; |
20428 |
-+ |
20429 |
-+ while (decl_stack->cnt) { |
20430 |
-+ id = decl_stack->ids[decl_stack->cnt - 1]; |
20431 |
-+ t = btf__type_by_id(d->btf, id); |
20432 |
-+ if (!btf_is_mod(t)) |
20433 |
-+ return; |
20434 |
-+ decl_stack->cnt--; |
20435 |
-+ } |
20436 |
-+} |
20437 |
-+ |
20438 |
- static void btf_dump_emit_name(const struct btf_dump *d, |
20439 |
- const char *name, bool last_was_ptr) |
20440 |
- { |
20441 |
-@@ -1235,14 +1249,7 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, |
20442 |
- * a const/volatile modifier for array, so we are |
20443 |
- * going to silently skip them here. |
20444 |
- */ |
20445 |
-- while (decls->cnt) { |
20446 |
-- next_id = decls->ids[decls->cnt - 1]; |
20447 |
-- next_t = btf__type_by_id(d->btf, next_id); |
20448 |
-- if (btf_is_mod(next_t)) |
20449 |
-- decls->cnt--; |
20450 |
-- else |
20451 |
-- break; |
20452 |
-- } |
20453 |
-+ btf_dump_drop_mods(d, decls); |
20454 |
- |
20455 |
- if (decls->cnt == 0) { |
20456 |
- btf_dump_emit_name(d, fname, last_was_ptr); |
20457 |
-@@ -1270,7 +1277,15 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, |
20458 |
- __u16 vlen = btf_vlen(t); |
20459 |
- int i; |
20460 |
- |
20461 |
-- btf_dump_emit_mods(d, decls); |
20462 |
-+ /* |
20463 |
-+ * GCC emits extra volatile qualifier for |
20464 |
-+ * __attribute__((noreturn)) function pointers. Clang |
20465 |
-+ * doesn't do it. It's a GCC quirk for backwards |
20466 |
-+ * compatibility with code written for GCC <2.5. So, |
20467 |
-+ * similarly to extra qualifiers for array, just drop |
20468 |
-+ * them, instead of handling them. |
20469 |
-+ */ |
20470 |
-+ btf_dump_drop_mods(d, decls); |
20471 |
- if (decls->cnt) { |
20472 |
- btf_dump_printf(d, " ("); |
20473 |
- btf_dump_emit_type_chain(d, decls, fname, lvl); |
20474 |
-diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c |
20475 |
-index 0c5b4fb553fb..c417cff2cdaf 100644 |
20476 |
---- a/tools/lib/bpf/libbpf.c |
20477 |
-+++ b/tools/lib/bpf/libbpf.c |
20478 |
-@@ -3455,10 +3455,6 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map) |
20479 |
- char *cp, errmsg[STRERR_BUFSIZE]; |
20480 |
- int err, zero = 0; |
20481 |
- |
20482 |
-- /* kernel already zero-initializes .bss map. */ |
20483 |
-- if (map_type == LIBBPF_MAP_BSS) |
20484 |
-- return 0; |
20485 |
-- |
20486 |
- err = bpf_map_update_elem(map->fd, &zero, map->mmaped, 0); |
20487 |
- if (err) { |
20488 |
- err = -errno; |
20489 |
-diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c |
20490 |
-index 26d8fc27e427..fc7855262162 100644 |
20491 |
---- a/tools/perf/builtin-report.c |
20492 |
-+++ b/tools/perf/builtin-report.c |
20493 |
-@@ -476,8 +476,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report |
20494 |
- if (rep->time_str) |
20495 |
- ret += fprintf(fp, " (time slices: %s)", rep->time_str); |
20496 |
- |
20497 |
-- if (symbol_conf.show_ref_callgraph && |
20498 |
-- strstr(evname, "call-graph=no")) { |
20499 |
-+ if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) { |
20500 |
- ret += fprintf(fp, ", show reference callgraph"); |
20501 |
- } |
20502 |
- |
20503 |
-diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y |
20504 |
-index 94f8bcd83582..9a41247c602b 100644 |
20505 |
---- a/tools/perf/util/parse-events.y |
20506 |
-+++ b/tools/perf/util/parse-events.y |
20507 |
-@@ -348,7 +348,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc |
20508 |
- struct list_head *list; |
20509 |
- char pmu_name[128]; |
20510 |
- |
20511 |
-- snprintf(&pmu_name, 128, "%s-%s", $1, $3); |
20512 |
-+ snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3); |
20513 |
- free($1); |
20514 |
- free($3); |
20515 |
- if (parse_events_multi_pmu_add(_parse_state, pmu_name, &list) < 0) |
20516 |
-diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c |
20517 |
-index a08f373d3305..df713a5d1e26 100644 |
20518 |
---- a/tools/perf/util/probe-event.c |
20519 |
-+++ b/tools/perf/util/probe-event.c |
20520 |
-@@ -1575,7 +1575,7 @@ static int parse_perf_probe_arg(char *str, struct perf_probe_arg *arg) |
20521 |
- } |
20522 |
- |
20523 |
- tmp = strchr(str, '@'); |
20524 |
-- if (tmp && tmp != str && strcmp(tmp + 1, "user")) { /* user attr */ |
20525 |
-+ if (tmp && tmp != str && !strcmp(tmp + 1, "user")) { /* user attr */ |
20526 |
- if (!user_access_is_supported()) { |
20527 |
- semantic_error("ftrace does not support user access\n"); |
20528 |
- return -EINVAL; |
20529 |
-@@ -1995,7 +1995,10 @@ static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref, |
20530 |
- if (depth < 0) |
20531 |
- return depth; |
20532 |
- } |
20533 |
-- err = strbuf_addf(buf, "%+ld(", ref->offset); |
20534 |
-+ if (ref->user_access) |
20535 |
-+ err = strbuf_addf(buf, "%s%ld(", "+u", ref->offset); |
20536 |
-+ else |
20537 |
-+ err = strbuf_addf(buf, "%+ld(", ref->offset); |
20538 |
- return (err < 0) ? err : depth; |
20539 |
- } |
20540 |
- |
20541 |
-diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c |
20542 |
-index 8c852948513e..064b63a6a3f3 100644 |
20543 |
---- a/tools/perf/util/probe-file.c |
20544 |
-+++ b/tools/perf/util/probe-file.c |
20545 |
-@@ -1044,7 +1044,7 @@ static struct { |
20546 |
- DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"), |
20547 |
- DEFINE_TYPE(FTRACE_README_KRETPROBE_OFFSET, "*place (kretprobe): *"), |
20548 |
- DEFINE_TYPE(FTRACE_README_UPROBE_REF_CTR, "*ref_ctr_offset*"), |
20549 |
-- DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*[u]<offset>*"), |
20550 |
-+ DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*u]<offset>*"), |
20551 |
- DEFINE_TYPE(FTRACE_README_MULTIPROBE_EVENT, "*Create/append/*"), |
20552 |
- DEFINE_TYPE(FTRACE_README_IMMEDIATE_VALUE, "*\\imm-value,*"), |
20553 |
- }; |
20554 |
-diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c |
20555 |
-index 9e757d18d713..cf393c3eea23 100644 |
20556 |
---- a/tools/perf/util/stat-display.c |
20557 |
-+++ b/tools/perf/util/stat-display.c |
20558 |
-@@ -671,7 +671,7 @@ static void print_aggr(struct perf_stat_config *config, |
20559 |
- int s; |
20560 |
- bool first; |
20561 |
- |
20562 |
-- if (!(config->aggr_map || config->aggr_get_id)) |
20563 |
-+ if (!config->aggr_map || !config->aggr_get_id) |
20564 |
- return; |
20565 |
- |
20566 |
- aggr_update_shadow(config, evlist); |
20567 |
-@@ -1172,7 +1172,7 @@ static void print_percore(struct perf_stat_config *config, |
20568 |
- int s; |
20569 |
- bool first = true; |
20570 |
- |
20571 |
-- if (!(config->aggr_map || config->aggr_get_id)) |
20572 |
-+ if (!config->aggr_map || !config->aggr_get_id) |
20573 |
- return; |
20574 |
- |
20575 |
- if (config->percore_show_thread) |
20576 |
-diff --git a/tools/testing/selftests/bpf/prog_tests/skeleton.c b/tools/testing/selftests/bpf/prog_tests/skeleton.c |
20577 |
-index 9264a2736018..fa153cf67b1b 100644 |
20578 |
---- a/tools/testing/selftests/bpf/prog_tests/skeleton.c |
20579 |
-+++ b/tools/testing/selftests/bpf/prog_tests/skeleton.c |
20580 |
-@@ -15,6 +15,8 @@ void test_skeleton(void) |
20581 |
- int duration = 0, err; |
20582 |
- struct test_skeleton* skel; |
20583 |
- struct test_skeleton__bss *bss; |
20584 |
-+ struct test_skeleton__data *data; |
20585 |
-+ struct test_skeleton__rodata *rodata; |
20586 |
- struct test_skeleton__kconfig *kcfg; |
20587 |
- |
20588 |
- skel = test_skeleton__open(); |
20589 |
-@@ -24,13 +26,45 @@ void test_skeleton(void) |
20590 |
- if (CHECK(skel->kconfig, "skel_kconfig", "kconfig is mmaped()!\n")) |
20591 |
- goto cleanup; |
20592 |
- |
20593 |
-+ bss = skel->bss; |
20594 |
-+ data = skel->data; |
20595 |
-+ rodata = skel->rodata; |
20596 |
-+ |
20597 |
-+ /* validate values are pre-initialized correctly */ |
20598 |
-+ CHECK(data->in1 != -1, "in1", "got %d != exp %d\n", data->in1, -1); |
20599 |
-+ CHECK(data->out1 != -1, "out1", "got %d != exp %d\n", data->out1, -1); |
20600 |
-+ CHECK(data->in2 != -1, "in2", "got %lld != exp %lld\n", data->in2, -1LL); |
20601 |
-+ CHECK(data->out2 != -1, "out2", "got %lld != exp %lld\n", data->out2, -1LL); |
20602 |
-+ |
20603 |
-+ CHECK(bss->in3 != 0, "in3", "got %d != exp %d\n", bss->in3, 0); |
20604 |
-+ CHECK(bss->out3 != 0, "out3", "got %d != exp %d\n", bss->out3, 0); |
20605 |
-+ CHECK(bss->in4 != 0, "in4", "got %lld != exp %lld\n", bss->in4, 0LL); |
20606 |
-+ CHECK(bss->out4 != 0, "out4", "got %lld != exp %lld\n", bss->out4, 0LL); |
20607 |
-+ |
20608 |
-+ CHECK(rodata->in6 != 0, "in6", "got %d != exp %d\n", rodata->in6, 0); |
20609 |
-+ CHECK(bss->out6 != 0, "out6", "got %d != exp %d\n", bss->out6, 0); |
20610 |
-+ |
20611 |
-+ /* validate we can pre-setup global variables, even in .bss */ |
20612 |
-+ data->in1 = 10; |
20613 |
-+ data->in2 = 11; |
20614 |
-+ bss->in3 = 12; |
20615 |
-+ bss->in4 = 13; |
20616 |
-+ rodata->in6 = 14; |
20617 |
-+ |
20618 |
- err = test_skeleton__load(skel); |
20619 |
- if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err)) |
20620 |
- goto cleanup; |
20621 |
- |
20622 |
-- bss = skel->bss; |
20623 |
-- bss->in1 = 1; |
20624 |
-- bss->in2 = 2; |
20625 |
-+ /* validate pre-setup values are still there */ |
20626 |
-+ CHECK(data->in1 != 10, "in1", "got %d != exp %d\n", data->in1, 10); |
20627 |
-+ CHECK(data->in2 != 11, "in2", "got %lld != exp %lld\n", data->in2, 11LL); |
20628 |
-+ CHECK(bss->in3 != 12, "in3", "got %d != exp %d\n", bss->in3, 12); |
20629 |
-+ CHECK(bss->in4 != 13, "in4", "got %lld != exp %lld\n", bss->in4, 13LL); |
20630 |
-+ CHECK(rodata->in6 != 14, "in6", "got %d != exp %d\n", rodata->in6, 14); |
20631 |
-+ |
20632 |
-+ /* now set new values and attach to get them into outX variables */ |
20633 |
-+ data->in1 = 1; |
20634 |
-+ data->in2 = 2; |
20635 |
- bss->in3 = 3; |
20636 |
- bss->in4 = 4; |
20637 |
- bss->in5.a = 5; |
20638 |
-@@ -44,14 +78,15 @@ void test_skeleton(void) |
20639 |
- /* trigger tracepoint */ |
20640 |
- usleep(1); |
20641 |
- |
20642 |
-- CHECK(bss->out1 != 1, "res1", "got %d != exp %d\n", bss->out1, 1); |
20643 |
-- CHECK(bss->out2 != 2, "res2", "got %lld != exp %d\n", bss->out2, 2); |
20644 |
-+ CHECK(data->out1 != 1, "res1", "got %d != exp %d\n", data->out1, 1); |
20645 |
-+ CHECK(data->out2 != 2, "res2", "got %lld != exp %d\n", data->out2, 2); |
20646 |
- CHECK(bss->out3 != 3, "res3", "got %d != exp %d\n", (int)bss->out3, 3); |
20647 |
- CHECK(bss->out4 != 4, "res4", "got %lld != exp %d\n", bss->out4, 4); |
20648 |
- CHECK(bss->handler_out5.a != 5, "res5", "got %d != exp %d\n", |
20649 |
- bss->handler_out5.a, 5); |
20650 |
- CHECK(bss->handler_out5.b != 6, "res6", "got %lld != exp %d\n", |
20651 |
- bss->handler_out5.b, 6); |
20652 |
-+ CHECK(bss->out6 != 14, "res7", "got %d != exp %d\n", bss->out6, 14); |
20653 |
- |
20654 |
- CHECK(bss->bpf_syscall != kcfg->CONFIG_BPF_SYSCALL, "ext1", |
20655 |
- "got %d != exp %d\n", bss->bpf_syscall, kcfg->CONFIG_BPF_SYSCALL); |
20656 |
-diff --git a/tools/testing/selftests/bpf/progs/test_skeleton.c b/tools/testing/selftests/bpf/progs/test_skeleton.c |
20657 |
-index de03a90f78ca..77ae86f44db5 100644 |
20658 |
---- a/tools/testing/selftests/bpf/progs/test_skeleton.c |
20659 |
-+++ b/tools/testing/selftests/bpf/progs/test_skeleton.c |
20660 |
-@@ -10,16 +10,26 @@ struct s { |
20661 |
- long long b; |
20662 |
- } __attribute__((packed)); |
20663 |
- |
20664 |
--int in1 = 0; |
20665 |
--long long in2 = 0; |
20666 |
-+/* .data section */ |
20667 |
-+int in1 = -1; |
20668 |
-+long long in2 = -1; |
20669 |
-+ |
20670 |
-+/* .bss section */ |
20671 |
- char in3 = '\0'; |
20672 |
- long long in4 __attribute__((aligned(64))) = 0; |
20673 |
- struct s in5 = {}; |
20674 |
- |
20675 |
--long long out2 = 0; |
20676 |
-+/* .rodata section */ |
20677 |
-+const volatile int in6 = 0; |
20678 |
-+ |
20679 |
-+/* .data section */ |
20680 |
-+int out1 = -1; |
20681 |
-+long long out2 = -1; |
20682 |
-+ |
20683 |
-+/* .bss section */ |
20684 |
- char out3 = 0; |
20685 |
- long long out4 = 0; |
20686 |
--int out1 = 0; |
20687 |
-+int out6 = 0; |
20688 |
- |
20689 |
- extern bool CONFIG_BPF_SYSCALL __kconfig; |
20690 |
- extern int LINUX_KERNEL_VERSION __kconfig; |
20691 |
-@@ -36,6 +46,7 @@ int handler(const void *ctx) |
20692 |
- out3 = in3; |
20693 |
- out4 = in4; |
20694 |
- out5 = in5; |
20695 |
-+ out6 = in6; |
20696 |
- |
20697 |
- bpf_syscall = CONFIG_BPF_SYSCALL; |
20698 |
- kern_ver = LINUX_KERNEL_VERSION; |
20699 |
-diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile |
20700 |
-index 42f4f49f2a48..2c85b9dd86f5 100644 |
20701 |
---- a/tools/testing/selftests/kvm/Makefile |
20702 |
-+++ b/tools/testing/selftests/kvm/Makefile |
20703 |
-@@ -80,7 +80,11 @@ LIBKVM += $(LIBKVM_$(UNAME_M)) |
20704 |
- INSTALL_HDR_PATH = $(top_srcdir)/usr |
20705 |
- LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ |
20706 |
- LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include |
20707 |
-+ifeq ($(ARCH),x86_64) |
20708 |
-+LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include |
20709 |
-+else |
20710 |
- LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include |
20711 |
-+endif |
20712 |
- CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ |
20713 |
- -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ |
20714 |
- -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ |
20715 |
-diff --git a/tools/testing/selftests/net/timestamping.c b/tools/testing/selftests/net/timestamping.c |
20716 |
-index aca3491174a1..f4bb4fef0f39 100644 |
20717 |
---- a/tools/testing/selftests/net/timestamping.c |
20718 |
-+++ b/tools/testing/selftests/net/timestamping.c |
20719 |
-@@ -313,10 +313,16 @@ int main(int argc, char **argv) |
20720 |
- int val; |
20721 |
- socklen_t len; |
20722 |
- struct timeval next; |
20723 |
-+ size_t if_len; |
20724 |
- |
20725 |
- if (argc < 2) |
20726 |
- usage(0); |
20727 |
- interface = argv[1]; |
20728 |
-+ if_len = strlen(interface); |
20729 |
-+ if (if_len >= IFNAMSIZ) { |
20730 |
-+ printf("interface name exceeds IFNAMSIZ\n"); |
20731 |
-+ exit(1); |
20732 |
-+ } |
20733 |
- |
20734 |
- for (i = 2; i < argc; i++) { |
20735 |
- if (!strcasecmp(argv[i], "SO_TIMESTAMP")) |
20736 |
-@@ -350,12 +356,12 @@ int main(int argc, char **argv) |
20737 |
- bail("socket"); |
20738 |
- |
20739 |
- memset(&device, 0, sizeof(device)); |
20740 |
-- strncpy(device.ifr_name, interface, sizeof(device.ifr_name)); |
20741 |
-+ memcpy(device.ifr_name, interface, if_len + 1); |
20742 |
- if (ioctl(sock, SIOCGIFADDR, &device) < 0) |
20743 |
- bail("getting interface IP address"); |
20744 |
- |
20745 |
- memset(&hwtstamp, 0, sizeof(hwtstamp)); |
20746 |
-- strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name)); |
20747 |
-+ memcpy(hwtstamp.ifr_name, interface, if_len + 1); |
20748 |
- hwtstamp.ifr_data = (void *)&hwconfig; |
20749 |
- memset(&hwconfig, 0, sizeof(hwconfig)); |
20750 |
- hwconfig.tx_type = |
20751 |
-diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh |
20752 |
-index 9c60337317c6..020137b61407 100755 |
20753 |
---- a/tools/testing/selftests/ntb/ntb_test.sh |
20754 |
-+++ b/tools/testing/selftests/ntb/ntb_test.sh |
20755 |
-@@ -241,7 +241,7 @@ function get_files_count() |
20756 |
- split_remote $LOC |
20757 |
- |
20758 |
- if [[ "$REMOTE" == "" ]]; then |
20759 |
-- echo $(ls -1 "$LOC"/${NAME}* 2>/dev/null | wc -l) |
20760 |
-+ echo $(ls -1 "$VPATH"/${NAME}* 2>/dev/null | wc -l) |
20761 |
- else |
20762 |
- echo $(ssh "$REMOTE" "ls -1 \"$VPATH\"/${NAME}* | \ |
20763 |
- wc -l" 2> /dev/null) |
20764 |
-diff --git a/tools/testing/selftests/timens/clock_nanosleep.c b/tools/testing/selftests/timens/clock_nanosleep.c |
20765 |
-index 8e7b7c72ef65..72d41b955fb2 100644 |
20766 |
---- a/tools/testing/selftests/timens/clock_nanosleep.c |
20767 |
-+++ b/tools/testing/selftests/timens/clock_nanosleep.c |
20768 |
-@@ -119,7 +119,7 @@ int main(int argc, char *argv[]) |
20769 |
- |
20770 |
- ksft_set_plan(4); |
20771 |
- |
20772 |
-- check_config_posix_timers(); |
20773 |
-+ check_supported_timers(); |
20774 |
- |
20775 |
- if (unshare_timens()) |
20776 |
- return 1; |
20777 |
-diff --git a/tools/testing/selftests/timens/timens.c b/tools/testing/selftests/timens/timens.c |
20778 |
-index 098be7c83be3..52b6a1185f52 100644 |
20779 |
---- a/tools/testing/selftests/timens/timens.c |
20780 |
-+++ b/tools/testing/selftests/timens/timens.c |
20781 |
-@@ -155,7 +155,7 @@ int main(int argc, char *argv[]) |
20782 |
- |
20783 |
- nscheck(); |
20784 |
- |
20785 |
-- check_config_posix_timers(); |
20786 |
-+ check_supported_timers(); |
20787 |
- |
20788 |
- ksft_set_plan(ARRAY_SIZE(clocks) * 2); |
20789 |
- |
20790 |
-diff --git a/tools/testing/selftests/timens/timens.h b/tools/testing/selftests/timens/timens.h |
20791 |
-index e09e7e39bc52..d4fc52d47146 100644 |
20792 |
---- a/tools/testing/selftests/timens/timens.h |
20793 |
-+++ b/tools/testing/selftests/timens/timens.h |
20794 |
-@@ -14,15 +14,26 @@ |
20795 |
- #endif |
20796 |
- |
20797 |
- static int config_posix_timers = true; |
20798 |
-+static int config_alarm_timers = true; |
20799 |
- |
20800 |
--static inline void check_config_posix_timers(void) |
20801 |
-+static inline void check_supported_timers(void) |
20802 |
- { |
20803 |
-+ struct timespec ts; |
20804 |
-+ |
20805 |
- if (timer_create(-1, 0, 0) == -1 && errno == ENOSYS) |
20806 |
- config_posix_timers = false; |
20807 |
-+ |
20808 |
-+ if (clock_gettime(CLOCK_BOOTTIME_ALARM, &ts) == -1 && errno == EINVAL) |
20809 |
-+ config_alarm_timers = false; |
20810 |
- } |
20811 |
- |
20812 |
- static inline bool check_skip(int clockid) |
20813 |
- { |
20814 |
-+ if (!config_alarm_timers && clockid == CLOCK_BOOTTIME_ALARM) { |
20815 |
-+ ksft_test_result_skip("CLOCK_BOOTTIME_ALARM isn't supported\n"); |
20816 |
-+ return true; |
20817 |
-+ } |
20818 |
-+ |
20819 |
- if (config_posix_timers) |
20820 |
- return false; |
20821 |
- |
20822 |
-diff --git a/tools/testing/selftests/timens/timer.c b/tools/testing/selftests/timens/timer.c |
20823 |
-index 96dba11ebe44..5e7f0051bd7b 100644 |
20824 |
---- a/tools/testing/selftests/timens/timer.c |
20825 |
-+++ b/tools/testing/selftests/timens/timer.c |
20826 |
-@@ -22,6 +22,9 @@ int run_test(int clockid, struct timespec now) |
20827 |
- timer_t fd; |
20828 |
- int i; |
20829 |
- |
20830 |
-+ if (check_skip(clockid)) |
20831 |
-+ return 0; |
20832 |
-+ |
20833 |
- for (i = 0; i < 2; i++) { |
20834 |
- struct sigevent sevp = {.sigev_notify = SIGEV_NONE}; |
20835 |
- int flags = 0; |
20836 |
-@@ -74,6 +77,8 @@ int main(int argc, char *argv[]) |
20837 |
- |
20838 |
- nscheck(); |
20839 |
- |
20840 |
-+ check_supported_timers(); |
20841 |
-+ |
20842 |
- ksft_set_plan(3); |
20843 |
- |
20844 |
- clock_gettime(CLOCK_MONOTONIC, &mtime_now); |
20845 |
-diff --git a/tools/testing/selftests/timens/timerfd.c b/tools/testing/selftests/timens/timerfd.c |
20846 |
-index eff1ec5ff215..9edd43d6b2c1 100644 |
20847 |
---- a/tools/testing/selftests/timens/timerfd.c |
20848 |
-+++ b/tools/testing/selftests/timens/timerfd.c |
20849 |
-@@ -28,6 +28,9 @@ int run_test(int clockid, struct timespec now) |
20850 |
- long long elapsed; |
20851 |
- int fd, i; |
20852 |
- |
20853 |
-+ if (check_skip(clockid)) |
20854 |
-+ return 0; |
20855 |
-+ |
20856 |
- if (tclock_gettime(clockid, &now)) |
20857 |
- return pr_perror("clock_gettime(%d)", clockid); |
20858 |
- |
20859 |
-@@ -81,6 +84,8 @@ int main(int argc, char *argv[]) |
20860 |
- |
20861 |
- nscheck(); |
20862 |
- |
20863 |
-+ check_supported_timers(); |
20864 |
-+ |
20865 |
- ksft_set_plan(3); |
20866 |
- |
20867 |
- clock_gettime(CLOCK_MONOTONIC, &mtime_now); |
20868 |
-diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c |
20869 |
-index 480995bceefa..47191af46617 100644 |
20870 |
---- a/tools/testing/selftests/x86/protection_keys.c |
20871 |
-+++ b/tools/testing/selftests/x86/protection_keys.c |
20872 |
-@@ -24,6 +24,7 @@ |
20873 |
- #define _GNU_SOURCE |
20874 |
- #include <errno.h> |
20875 |
- #include <linux/futex.h> |
20876 |
-+#include <time.h> |
20877 |
- #include <sys/time.h> |
20878 |
- #include <sys/syscall.h> |
20879 |
- #include <string.h> |
20880 |
-@@ -612,10 +613,10 @@ int alloc_random_pkey(void) |
20881 |
- int nr_alloced = 0; |
20882 |
- int random_index; |
20883 |
- memset(alloced_pkeys, 0, sizeof(alloced_pkeys)); |
20884 |
-+ srand((unsigned int)time(NULL)); |
20885 |
- |
20886 |
- /* allocate every possible key and make a note of which ones we got */ |
20887 |
- max_nr_pkey_allocs = NR_PKEYS; |
20888 |
-- max_nr_pkey_allocs = 1; |
20889 |
- for (i = 0; i < max_nr_pkey_allocs; i++) { |
20890 |
- int new_pkey = alloc_pkey(); |
20891 |
- if (new_pkey < 0) |
20892 |
|
20893 |
diff --git a/1005_linux-5.8.6.patch b/1005_linux-5.8.6.patch |
20894 |
new file mode 100644 |
20895 |
index 0000000..842f070 |
20896 |
--- /dev/null |
20897 |
+++ b/1005_linux-5.8.6.patch |
20898 |
@@ -0,0 +1,11789 @@ |
20899 |
+diff --git a/Documentation/admin-guide/ext4.rst b/Documentation/admin-guide/ext4.rst |
20900 |
+index 9443fcef18760..f37d0743fd668 100644 |
20901 |
+--- a/Documentation/admin-guide/ext4.rst |
20902 |
++++ b/Documentation/admin-guide/ext4.rst |
20903 |
+@@ -482,6 +482,9 @@ Files in /sys/fs/ext4/<devname>: |
20904 |
+ multiple of this tuning parameter if the stripe size is not set in the |
20905 |
+ ext4 superblock |
20906 |
+ |
20907 |
++ mb_max_inode_prealloc |
20908 |
++ The maximum length of per-inode ext4_prealloc_space list. |
20909 |
++ |
20910 |
+ mb_max_to_scan |
20911 |
+ The maximum number of extents the multiblock allocator will search to |
20912 |
+ find the best extent. |
20913 |
+diff --git a/Makefile b/Makefile |
20914 |
+index f47073a3b4740..5cf35650373b1 100644 |
20915 |
+--- a/Makefile |
20916 |
++++ b/Makefile |
20917 |
+@@ -1,7 +1,7 @@ |
20918 |
+ # SPDX-License-Identifier: GPL-2.0 |
20919 |
+ VERSION = 5 |
20920 |
+ PATCHLEVEL = 8 |
20921 |
+-SUBLEVEL = 5 |
20922 |
++SUBLEVEL = 6 |
20923 |
+ EXTRAVERSION = |
20924 |
+ NAME = Kleptomaniac Octopus |
20925 |
+ |
20926 |
+diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi |
20927 |
+index 760a68c163c83..b2ff27af090ec 100644 |
20928 |
+--- a/arch/arm/boot/dts/ls1021a.dtsi |
20929 |
++++ b/arch/arm/boot/dts/ls1021a.dtsi |
20930 |
+@@ -772,7 +772,7 @@ |
20931 |
+ fsl,tmr-prsc = <2>; |
20932 |
+ fsl,tmr-add = <0xaaaaaaab>; |
20933 |
+ fsl,tmr-fiper1 = <999999995>; |
20934 |
+- fsl,tmr-fiper2 = <99990>; |
20935 |
++ fsl,tmr-fiper2 = <999999995>; |
20936 |
+ fsl,max-adj = <499999999>; |
20937 |
+ fsl,extts-fifo; |
20938 |
+ }; |
20939 |
+diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile |
20940 |
+index 91e377770a6b8..d5fe7c9e0be1d 100644 |
20941 |
+--- a/arch/arm64/Makefile |
20942 |
++++ b/arch/arm64/Makefile |
20943 |
+@@ -158,7 +158,8 @@ zinstall install: |
20944 |
+ PHONY += vdso_install |
20945 |
+ vdso_install: |
20946 |
+ $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ |
20947 |
+- $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@ |
20948 |
++ $(if $(CONFIG_COMPAT_VDSO), \ |
20949 |
++ $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) |
20950 |
+ |
20951 |
+ # We use MRPROPER_FILES and CLEAN_FILES now |
20952 |
+ archclean: |
20953 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
20954 |
+index 5785bf0a807ce..591f48a575353 100644 |
20955 |
+--- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
20956 |
++++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi |
20957 |
+@@ -569,7 +569,7 @@ |
20958 |
+ pins = "gpio63", "gpio64", "gpio65", "gpio66", |
20959 |
+ "gpio67", "gpio68"; |
20960 |
+ drive-strength = <2>; |
20961 |
+- bias-disable; |
20962 |
++ bias-pull-down; |
20963 |
+ }; |
20964 |
+ }; |
20965 |
+ }; |
20966 |
+diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h |
20967 |
+index 51c1d99189992..1da8e3dc44555 100644 |
20968 |
+--- a/arch/arm64/include/asm/kvm_arm.h |
20969 |
++++ b/arch/arm64/include/asm/kvm_arm.h |
20970 |
+@@ -71,11 +71,12 @@ |
20971 |
+ * IMO: Override CPSR.I and enable signaling with VI |
20972 |
+ * FMO: Override CPSR.F and enable signaling with VF |
20973 |
+ * SWIO: Turn set/way invalidates into set/way clean+invalidate |
20974 |
++ * PTW: Take a stage2 fault if a stage1 walk steps in device memory |
20975 |
+ */ |
20976 |
+ #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \ |
20977 |
+ HCR_BSU_IS | HCR_FB | HCR_TAC | \ |
20978 |
+ HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \ |
20979 |
+- HCR_FMO | HCR_IMO) |
20980 |
++ HCR_FMO | HCR_IMO | HCR_PTW ) |
20981 |
+ #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF) |
20982 |
+ #define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK) |
20983 |
+ #define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H) |
20984 |
+diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h |
20985 |
+index a0c8a0b652593..0eadbf933e359 100644 |
20986 |
+--- a/arch/arm64/include/asm/smp.h |
20987 |
++++ b/arch/arm64/include/asm/smp.h |
20988 |
+@@ -46,7 +46,12 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number); |
20989 |
+ * Logical CPU mapping. |
20990 |
+ */ |
20991 |
+ extern u64 __cpu_logical_map[NR_CPUS]; |
20992 |
+-#define cpu_logical_map(cpu) __cpu_logical_map[cpu] |
20993 |
++extern u64 cpu_logical_map(int cpu); |
20994 |
++ |
20995 |
++static inline void set_cpu_logical_map(int cpu, u64 hwid) |
20996 |
++{ |
20997 |
++ __cpu_logical_map[cpu] = hwid; |
20998 |
++} |
20999 |
+ |
21000 |
+ struct seq_file; |
21001 |
+ |
21002 |
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c |
21003 |
+index 79728bfb5351f..2c0b82db825ba 100644 |
21004 |
+--- a/arch/arm64/kernel/cpu_errata.c |
21005 |
++++ b/arch/arm64/kernel/cpu_errata.c |
21006 |
+@@ -910,6 +910,8 @@ const struct arm64_cpu_capabilities arm64_errata[] = { |
21007 |
+ .desc = "ARM erratum 1418040", |
21008 |
+ .capability = ARM64_WORKAROUND_1418040, |
21009 |
+ ERRATA_MIDR_RANGE_LIST(erratum_1418040_list), |
21010 |
++ .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU | |
21011 |
++ ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU), |
21012 |
+ }, |
21013 |
+ #endif |
21014 |
+ #ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT |
21015 |
+diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S |
21016 |
+index 35de8ba60e3d5..44445d471442d 100644 |
21017 |
+--- a/arch/arm64/kernel/entry.S |
21018 |
++++ b/arch/arm64/kernel/entry.S |
21019 |
+@@ -169,19 +169,6 @@ alternative_cb_end |
21020 |
+ stp x28, x29, [sp, #16 * 14] |
21021 |
+ |
21022 |
+ .if \el == 0 |
21023 |
+- .if \regsize == 32 |
21024 |
+- /* |
21025 |
+- * If we're returning from a 32-bit task on a system affected by |
21026 |
+- * 1418040 then re-enable userspace access to the virtual counter. |
21027 |
+- */ |
21028 |
+-#ifdef CONFIG_ARM64_ERRATUM_1418040 |
21029 |
+-alternative_if ARM64_WORKAROUND_1418040 |
21030 |
+- mrs x0, cntkctl_el1 |
21031 |
+- orr x0, x0, #2 // ARCH_TIMER_USR_VCT_ACCESS_EN |
21032 |
+- msr cntkctl_el1, x0 |
21033 |
+-alternative_else_nop_endif |
21034 |
+-#endif |
21035 |
+- .endif |
21036 |
+ clear_gp_regs |
21037 |
+ mrs x21, sp_el0 |
21038 |
+ ldr_this_cpu tsk, __entry_task, x20 |
21039 |
+@@ -337,14 +324,6 @@ alternative_else_nop_endif |
21040 |
+ tst x22, #PSR_MODE32_BIT // native task? |
21041 |
+ b.eq 3f |
21042 |
+ |
21043 |
+-#ifdef CONFIG_ARM64_ERRATUM_1418040 |
21044 |
+-alternative_if ARM64_WORKAROUND_1418040 |
21045 |
+- mrs x0, cntkctl_el1 |
21046 |
+- bic x0, x0, #2 // ARCH_TIMER_USR_VCT_ACCESS_EN |
21047 |
+- msr cntkctl_el1, x0 |
21048 |
+-alternative_else_nop_endif |
21049 |
+-#endif |
21050 |
+- |
21051 |
+ #ifdef CONFIG_ARM64_ERRATUM_845719 |
21052 |
+ alternative_if ARM64_WORKAROUND_845719 |
21053 |
+ #ifdef CONFIG_PID_IN_CONTEXTIDR |
21054 |
+diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c |
21055 |
+index 6089638c7d43f..d8a10cf28f827 100644 |
21056 |
+--- a/arch/arm64/kernel/process.c |
21057 |
++++ b/arch/arm64/kernel/process.c |
21058 |
+@@ -515,6 +515,39 @@ static void entry_task_switch(struct task_struct *next) |
21059 |
+ __this_cpu_write(__entry_task, next); |
21060 |
+ } |
21061 |
+ |
21062 |
++/* |
21063 |
++ * ARM erratum 1418040 handling, affecting the 32bit view of CNTVCT. |
21064 |
++ * Assuming the virtual counter is enabled at the beginning of times: |
21065 |
++ * |
21066 |
++ * - disable access when switching from a 64bit task to a 32bit task |
21067 |
++ * - enable access when switching from a 32bit task to a 64bit task |
21068 |
++ */ |
21069 |
++static void erratum_1418040_thread_switch(struct task_struct *prev, |
21070 |
++ struct task_struct *next) |
21071 |
++{ |
21072 |
++ bool prev32, next32; |
21073 |
++ u64 val; |
21074 |
++ |
21075 |
++ if (!(IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) && |
21076 |
++ cpus_have_const_cap(ARM64_WORKAROUND_1418040))) |
21077 |
++ return; |
21078 |
++ |
21079 |
++ prev32 = is_compat_thread(task_thread_info(prev)); |
21080 |
++ next32 = is_compat_thread(task_thread_info(next)); |
21081 |
++ |
21082 |
++ if (prev32 == next32) |
21083 |
++ return; |
21084 |
++ |
21085 |
++ val = read_sysreg(cntkctl_el1); |
21086 |
++ |
21087 |
++ if (!next32) |
21088 |
++ val |= ARCH_TIMER_USR_VCT_ACCESS_EN; |
21089 |
++ else |
21090 |
++ val &= ~ARCH_TIMER_USR_VCT_ACCESS_EN; |
21091 |
++ |
21092 |
++ write_sysreg(val, cntkctl_el1); |
21093 |
++} |
21094 |
++ |
21095 |
+ /* |
21096 |
+ * Thread switching. |
21097 |
+ */ |
21098 |
+@@ -530,6 +563,7 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, |
21099 |
+ entry_task_switch(next); |
21100 |
+ uao_thread_switch(next); |
21101 |
+ ssbs_thread_switch(next); |
21102 |
++ erratum_1418040_thread_switch(prev, next); |
21103 |
+ |
21104 |
+ /* |
21105 |
+ * Complete any pending TLB or cache maintenance on this CPU in case |
21106 |
+diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c |
21107 |
+index 93b3844cf4421..07b7940951e28 100644 |
21108 |
+--- a/arch/arm64/kernel/setup.c |
21109 |
++++ b/arch/arm64/kernel/setup.c |
21110 |
+@@ -85,7 +85,7 @@ u64 __cacheline_aligned boot_args[4]; |
21111 |
+ void __init smp_setup_processor_id(void) |
21112 |
+ { |
21113 |
+ u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; |
21114 |
+- cpu_logical_map(0) = mpidr; |
21115 |
++ set_cpu_logical_map(0, mpidr); |
21116 |
+ |
21117 |
+ /* |
21118 |
+ * clear __my_cpu_offset on boot CPU to avoid hang caused by |
21119 |
+@@ -276,6 +276,12 @@ arch_initcall(reserve_memblock_reserved_regions); |
21120 |
+ |
21121 |
+ u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; |
21122 |
+ |
21123 |
++u64 cpu_logical_map(int cpu) |
21124 |
++{ |
21125 |
++ return __cpu_logical_map[cpu]; |
21126 |
++} |
21127 |
++EXPORT_SYMBOL_GPL(cpu_logical_map); |
21128 |
++ |
21129 |
+ void __init setup_arch(char **cmdline_p) |
21130 |
+ { |
21131 |
+ init_mm.start_code = (unsigned long) _text; |
21132 |
+diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c |
21133 |
+index e43a8ff19f0f6..8cd6316a0d833 100644 |
21134 |
+--- a/arch/arm64/kernel/smp.c |
21135 |
++++ b/arch/arm64/kernel/smp.c |
21136 |
+@@ -567,7 +567,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) |
21137 |
+ return; |
21138 |
+ |
21139 |
+ /* map the logical cpu id to cpu MPIDR */ |
21140 |
+- cpu_logical_map(cpu_count) = hwid; |
21141 |
++ set_cpu_logical_map(cpu_count, hwid); |
21142 |
+ |
21143 |
+ cpu_madt_gicc[cpu_count] = *processor; |
21144 |
+ |
21145 |
+@@ -681,7 +681,7 @@ static void __init of_parse_and_init_cpus(void) |
21146 |
+ goto next; |
21147 |
+ |
21148 |
+ pr_debug("cpu logical map 0x%llx\n", hwid); |
21149 |
+- cpu_logical_map(cpu_count) = hwid; |
21150 |
++ set_cpu_logical_map(cpu_count, hwid); |
21151 |
+ |
21152 |
+ early_map_cpu_to_node(cpu_count, of_node_to_nid(dn)); |
21153 |
+ next: |
21154 |
+@@ -722,7 +722,7 @@ void __init smp_init_cpus(void) |
21155 |
+ for (i = 1; i < nr_cpu_ids; i++) { |
21156 |
+ if (cpu_logical_map(i) != INVALID_HWID) { |
21157 |
+ if (smp_cpu_setup(i)) |
21158 |
+- cpu_logical_map(i) = INVALID_HWID; |
21159 |
++ set_cpu_logical_map(i, INVALID_HWID); |
21160 |
+ } |
21161 |
+ } |
21162 |
+ } |
21163 |
+diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c |
21164 |
+index db1c4487d95d1..9270b14157b55 100644 |
21165 |
+--- a/arch/arm64/kvm/hyp/switch.c |
21166 |
++++ b/arch/arm64/kvm/hyp/switch.c |
21167 |
+@@ -897,7 +897,7 @@ static void __hyp_text __hyp_call_panic_nvhe(u64 spsr, u64 elr, u64 par, |
21168 |
+ * making sure it is a kernel address and not a PC-relative |
21169 |
+ * reference. |
21170 |
+ */ |
21171 |
+- asm volatile("ldr %0, =__hyp_panic_string" : "=r" (str_va)); |
21172 |
++ asm volatile("ldr %0, =%1" : "=r" (str_va) : "S" (__hyp_panic_string)); |
21173 |
+ |
21174 |
+ __hyp_do_panic(str_va, |
21175 |
+ spsr, elr, |
21176 |
+diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig |
21177 |
+index a7e40bb1e5bc6..c43ad3b3cea4b 100644 |
21178 |
+--- a/arch/mips/Kconfig |
21179 |
++++ b/arch/mips/Kconfig |
21180 |
+@@ -2203,6 +2203,7 @@ endchoice |
21181 |
+ |
21182 |
+ config KVM_GUEST |
21183 |
+ bool "KVM Guest Kernel" |
21184 |
++ depends on CPU_MIPS32_R2 |
21185 |
+ depends on BROKEN_ON_SMP |
21186 |
+ help |
21187 |
+ Select this option if building a guest kernel for KVM (Trap & Emulate) |
21188 |
+diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig |
21189 |
+index 2bf02d849a3a8..032b3fca6cbba 100644 |
21190 |
+--- a/arch/mips/kvm/Kconfig |
21191 |
++++ b/arch/mips/kvm/Kconfig |
21192 |
+@@ -37,10 +37,11 @@ choice |
21193 |
+ |
21194 |
+ config KVM_MIPS_TE |
21195 |
+ bool "Trap & Emulate" |
21196 |
++ depends on CPU_MIPS32_R2 |
21197 |
+ help |
21198 |
+ Use trap and emulate to virtualize 32-bit guests in user mode. This |
21199 |
+ does not require any special hardware Virtualization support beyond |
21200 |
+- standard MIPS32/64 r2 or later, but it does require the guest kernel |
21201 |
++ standard MIPS32 r2 or later, but it does require the guest kernel |
21202 |
+ to be configured with CONFIG_KVM_GUEST=y so that it resides in the |
21203 |
+ user address segment. |
21204 |
+ |
21205 |
+diff --git a/arch/mips/vdso/genvdso.c b/arch/mips/vdso/genvdso.c |
21206 |
+index be57b832bbe0a..ccba50ec8a40e 100644 |
21207 |
+--- a/arch/mips/vdso/genvdso.c |
21208 |
++++ b/arch/mips/vdso/genvdso.c |
21209 |
+@@ -122,6 +122,7 @@ static void *map_vdso(const char *path, size_t *_size) |
21210 |
+ if (fstat(fd, &stat) != 0) { |
21211 |
+ fprintf(stderr, "%s: Failed to stat '%s': %s\n", program_name, |
21212 |
+ path, strerror(errno)); |
21213 |
++ close(fd); |
21214 |
+ return NULL; |
21215 |
+ } |
21216 |
+ |
21217 |
+@@ -130,6 +131,7 @@ static void *map_vdso(const char *path, size_t *_size) |
21218 |
+ if (addr == MAP_FAILED) { |
21219 |
+ fprintf(stderr, "%s: Failed to map '%s': %s\n", program_name, |
21220 |
+ path, strerror(errno)); |
21221 |
++ close(fd); |
21222 |
+ return NULL; |
21223 |
+ } |
21224 |
+ |
21225 |
+@@ -139,6 +141,7 @@ static void *map_vdso(const char *path, size_t *_size) |
21226 |
+ if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) { |
21227 |
+ fprintf(stderr, "%s: '%s' is not an ELF file\n", program_name, |
21228 |
+ path); |
21229 |
++ close(fd); |
21230 |
+ return NULL; |
21231 |
+ } |
21232 |
+ |
21233 |
+@@ -150,6 +153,7 @@ static void *map_vdso(const char *path, size_t *_size) |
21234 |
+ default: |
21235 |
+ fprintf(stderr, "%s: '%s' has invalid ELF class\n", |
21236 |
+ program_name, path); |
21237 |
++ close(fd); |
21238 |
+ return NULL; |
21239 |
+ } |
21240 |
+ |
21241 |
+@@ -161,6 +165,7 @@ static void *map_vdso(const char *path, size_t *_size) |
21242 |
+ default: |
21243 |
+ fprintf(stderr, "%s: '%s' has invalid ELF data order\n", |
21244 |
+ program_name, path); |
21245 |
++ close(fd); |
21246 |
+ return NULL; |
21247 |
+ } |
21248 |
+ |
21249 |
+@@ -168,15 +173,18 @@ static void *map_vdso(const char *path, size_t *_size) |
21250 |
+ fprintf(stderr, |
21251 |
+ "%s: '%s' has invalid ELF machine (expected EM_MIPS)\n", |
21252 |
+ program_name, path); |
21253 |
++ close(fd); |
21254 |
+ return NULL; |
21255 |
+ } else if (swap_uint16(ehdr->e_type) != ET_DYN) { |
21256 |
+ fprintf(stderr, |
21257 |
+ "%s: '%s' has invalid ELF type (expected ET_DYN)\n", |
21258 |
+ program_name, path); |
21259 |
++ close(fd); |
21260 |
+ return NULL; |
21261 |
+ } |
21262 |
+ |
21263 |
+ *_size = stat.st_size; |
21264 |
++ close(fd); |
21265 |
+ return addr; |
21266 |
+ } |
21267 |
+ |
21268 |
+@@ -293,10 +301,12 @@ int main(int argc, char **argv) |
21269 |
+ /* Calculate and write symbol offsets to <output file> */ |
21270 |
+ if (!get_symbols(dbg_vdso_path, dbg_vdso)) { |
21271 |
+ unlink(out_path); |
21272 |
++ fclose(out_file); |
21273 |
+ return EXIT_FAILURE; |
21274 |
+ } |
21275 |
+ |
21276 |
+ fprintf(out_file, "};\n"); |
21277 |
++ fclose(out_file); |
21278 |
+ |
21279 |
+ return EXIT_SUCCESS; |
21280 |
+ } |
21281 |
+diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c |
21282 |
+index 01d70280d2872..c6f9d75283813 100644 |
21283 |
+--- a/arch/powerpc/perf/core-book3s.c |
21284 |
++++ b/arch/powerpc/perf/core-book3s.c |
21285 |
+@@ -1517,9 +1517,16 @@ nocheck: |
21286 |
+ ret = 0; |
21287 |
+ out: |
21288 |
+ if (has_branch_stack(event)) { |
21289 |
+- power_pmu_bhrb_enable(event); |
21290 |
+- cpuhw->bhrb_filter = ppmu->bhrb_filter_map( |
21291 |
+- event->attr.branch_sample_type); |
21292 |
++ u64 bhrb_filter = -1; |
21293 |
++ |
21294 |
++ if (ppmu->bhrb_filter_map) |
21295 |
++ bhrb_filter = ppmu->bhrb_filter_map( |
21296 |
++ event->attr.branch_sample_type); |
21297 |
++ |
21298 |
++ if (bhrb_filter != -1) { |
21299 |
++ cpuhw->bhrb_filter = bhrb_filter; |
21300 |
++ power_pmu_bhrb_enable(event); |
21301 |
++ } |
21302 |
+ } |
21303 |
+ |
21304 |
+ perf_pmu_enable(event->pmu); |
21305 |
+@@ -1841,7 +1848,6 @@ static int power_pmu_event_init(struct perf_event *event) |
21306 |
+ int n; |
21307 |
+ int err; |
21308 |
+ struct cpu_hw_events *cpuhw; |
21309 |
+- u64 bhrb_filter; |
21310 |
+ |
21311 |
+ if (!ppmu) |
21312 |
+ return -ENOENT; |
21313 |
+@@ -1947,7 +1953,10 @@ static int power_pmu_event_init(struct perf_event *event) |
21314 |
+ err = power_check_constraints(cpuhw, events, cflags, n + 1); |
21315 |
+ |
21316 |
+ if (has_branch_stack(event)) { |
21317 |
+- bhrb_filter = ppmu->bhrb_filter_map( |
21318 |
++ u64 bhrb_filter = -1; |
21319 |
++ |
21320 |
++ if (ppmu->bhrb_filter_map) |
21321 |
++ bhrb_filter = ppmu->bhrb_filter_map( |
21322 |
+ event->attr.branch_sample_type); |
21323 |
+ |
21324 |
+ if (bhrb_filter == -1) { |
21325 |
+@@ -2101,6 +2110,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val, |
21326 |
+ |
21327 |
+ if (perf_event_overflow(event, &data, regs)) |
21328 |
+ power_pmu_stop(event, 0); |
21329 |
++ } else if (period) { |
21330 |
++ /* Account for interrupt in case of invalid SIAR */ |
21331 |
++ if (perf_event_account_interrupt(event)) |
21332 |
++ power_pmu_stop(event, 0); |
21333 |
+ } |
21334 |
+ } |
21335 |
+ |
21336 |
+diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype |
21337 |
+index 87737ec86d39a..1dc9d3c818726 100644 |
21338 |
+--- a/arch/powerpc/platforms/Kconfig.cputype |
21339 |
++++ b/arch/powerpc/platforms/Kconfig.cputype |
21340 |
+@@ -36,7 +36,7 @@ config PPC_BOOK3S_6xx |
21341 |
+ select PPC_HAVE_PMU_SUPPORT |
21342 |
+ select PPC_HAVE_KUEP |
21343 |
+ select PPC_HAVE_KUAP |
21344 |
+- select HAVE_ARCH_VMAP_STACK |
21345 |
++ select HAVE_ARCH_VMAP_STACK if !ADB_PMU |
21346 |
+ |
21347 |
+ config PPC_BOOK3S_601 |
21348 |
+ bool "PowerPC 601" |
21349 |
+diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig |
21350 |
+index 0f7c8241912b9..f2ff359041eec 100644 |
21351 |
+--- a/arch/powerpc/platforms/cell/Kconfig |
21352 |
++++ b/arch/powerpc/platforms/cell/Kconfig |
21353 |
+@@ -44,6 +44,7 @@ config SPU_FS |
21354 |
+ tristate "SPU file system" |
21355 |
+ default m |
21356 |
+ depends on PPC_CELL |
21357 |
++ depends on COREDUMP |
21358 |
+ select SPU_BASE |
21359 |
+ help |
21360 |
+ The SPU file system is used to access Synergistic Processing |
21361 |
+diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c |
21362 |
+index 71b881e554fcb..cb58ec7ce77ac 100644 |
21363 |
+--- a/arch/powerpc/sysdev/xive/native.c |
21364 |
++++ b/arch/powerpc/sysdev/xive/native.c |
21365 |
+@@ -18,6 +18,7 @@ |
21366 |
+ #include <linux/delay.h> |
21367 |
+ #include <linux/cpumask.h> |
21368 |
+ #include <linux/mm.h> |
21369 |
++#include <linux/kmemleak.h> |
21370 |
+ |
21371 |
+ #include <asm/machdep.h> |
21372 |
+ #include <asm/prom.h> |
21373 |
+@@ -647,6 +648,7 @@ static bool xive_native_provision_pages(void) |
21374 |
+ pr_err("Failed to allocate provisioning page\n"); |
21375 |
+ return false; |
21376 |
+ } |
21377 |
++ kmemleak_ignore(p); |
21378 |
+ opal_xive_donate_page(chip, __pa(p)); |
21379 |
+ } |
21380 |
+ return true; |
21381 |
+diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c |
21382 |
+index dae32d948bf25..f8a56b5dc29fe 100644 |
21383 |
+--- a/arch/x86/kernel/apic/vector.c |
21384 |
++++ b/arch/x86/kernel/apic/vector.c |
21385 |
+@@ -161,6 +161,7 @@ static void apic_update_vector(struct irq_data *irqd, unsigned int newvec, |
21386 |
+ apicd->move_in_progress = true; |
21387 |
+ apicd->prev_vector = apicd->vector; |
21388 |
+ apicd->prev_cpu = apicd->cpu; |
21389 |
++ WARN_ON_ONCE(apicd->cpu == newcpu); |
21390 |
+ } else { |
21391 |
+ irq_matrix_free(vector_matrix, apicd->cpu, apicd->vector, |
21392 |
+ managed); |
21393 |
+@@ -910,7 +911,7 @@ void send_cleanup_vector(struct irq_cfg *cfg) |
21394 |
+ __send_cleanup_vector(apicd); |
21395 |
+ } |
21396 |
+ |
21397 |
+-static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector) |
21398 |
++void irq_complete_move(struct irq_cfg *cfg) |
21399 |
+ { |
21400 |
+ struct apic_chip_data *apicd; |
21401 |
+ |
21402 |
+@@ -918,15 +919,16 @@ static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector) |
21403 |
+ if (likely(!apicd->move_in_progress)) |
21404 |
+ return; |
21405 |
+ |
21406 |
+- if (vector == apicd->vector && apicd->cpu == smp_processor_id()) |
21407 |
++ /* |
21408 |
++ * If the interrupt arrived on the new target CPU, cleanup the |
21409 |
++ * vector on the old target CPU. A vector check is not required |
21410 |
++ * because an interrupt can never move from one vector to another |
21411 |
++ * on the same CPU. |
21412 |
++ */ |
21413 |
++ if (apicd->cpu == smp_processor_id()) |
21414 |
+ __send_cleanup_vector(apicd); |
21415 |
+ } |
21416 |
+ |
21417 |
+-void irq_complete_move(struct irq_cfg *cfg) |
21418 |
+-{ |
21419 |
+- __irq_complete_move(cfg, ~get_irq_regs()->orig_ax); |
21420 |
+-} |
21421 |
+- |
21422 |
+ /* |
21423 |
+ * Called from fixup_irqs() with @desc->lock held and interrupts disabled. |
21424 |
+ */ |
21425 |
+diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c |
21426 |
+index 518ac6bf752e0..9fb6a8655ddf3 100644 |
21427 |
+--- a/arch/x86/kernel/smpboot.c |
21428 |
++++ b/arch/x86/kernel/smpboot.c |
21429 |
+@@ -1604,14 +1604,28 @@ int native_cpu_disable(void) |
21430 |
+ if (ret) |
21431 |
+ return ret; |
21432 |
+ |
21433 |
+- /* |
21434 |
+- * Disable the local APIC. Otherwise IPI broadcasts will reach |
21435 |
+- * it. It still responds normally to INIT, NMI, SMI, and SIPI |
21436 |
+- * messages. |
21437 |
+- */ |
21438 |
+- apic_soft_disable(); |
21439 |
+ cpu_disable_common(); |
21440 |
+ |
21441 |
++ /* |
21442 |
++ * Disable the local APIC. Otherwise IPI broadcasts will reach |
21443 |
++ * it. It still responds normally to INIT, NMI, SMI, and SIPI |
21444 |
++ * messages. |
21445 |
++ * |
21446 |
++ * Disabling the APIC must happen after cpu_disable_common() |
21447 |
++ * which invokes fixup_irqs(). |
21448 |
++ * |
21449 |
++ * Disabling the APIC preserves already set bits in IRR, but |
21450 |
++ * an interrupt arriving after disabling the local APIC does not |
21451 |
++ * set the corresponding IRR bit. |
21452 |
++ * |
21453 |
++ * fixup_irqs() scans IRR for set bits so it can raise a not |
21454 |
++ * yet handled interrupt on the new destination CPU via an IPI |
21455 |
++ * but obviously it can't do so for IRR bits which are not set. |
21456 |
++ * IOW, interrupts arriving after disabling the local APIC will |
21457 |
++ * be lost. |
21458 |
++ */ |
21459 |
++ apic_soft_disable(); |
21460 |
++ |
21461 |
+ return 0; |
21462 |
+ } |
21463 |
+ |
21464 |
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c |
21465 |
+index 68882b9b8f11f..b791e2041e49b 100644 |
21466 |
+--- a/block/bfq-cgroup.c |
21467 |
++++ b/block/bfq-cgroup.c |
21468 |
+@@ -332,7 +332,7 @@ static void bfqg_put(struct bfq_group *bfqg) |
21469 |
+ kfree(bfqg); |
21470 |
+ } |
21471 |
+ |
21472 |
+-void bfqg_and_blkg_get(struct bfq_group *bfqg) |
21473 |
++static void bfqg_and_blkg_get(struct bfq_group *bfqg) |
21474 |
+ { |
21475 |
+ /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */ |
21476 |
+ bfqg_get(bfqg); |
21477 |
+diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h |
21478 |
+index cd224aaf9f52a..703895224562c 100644 |
21479 |
+--- a/block/bfq-iosched.h |
21480 |
++++ b/block/bfq-iosched.h |
21481 |
+@@ -986,7 +986,6 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, |
21482 |
+ struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg); |
21483 |
+ struct bfq_group *bfqq_group(struct bfq_queue *bfqq); |
21484 |
+ struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node); |
21485 |
+-void bfqg_and_blkg_get(struct bfq_group *bfqg); |
21486 |
+ void bfqg_and_blkg_put(struct bfq_group *bfqg); |
21487 |
+ |
21488 |
+ #ifdef CONFIG_BFQ_GROUP_IOSCHED |
21489 |
+diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c |
21490 |
+index eb0e2a6daabe6..26776bdbdf360 100644 |
21491 |
+--- a/block/bfq-wf2q.c |
21492 |
++++ b/block/bfq-wf2q.c |
21493 |
+@@ -533,9 +533,7 @@ static void bfq_get_entity(struct bfq_entity *entity) |
21494 |
+ bfqq->ref++; |
21495 |
+ bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d", |
21496 |
+ bfqq, bfqq->ref); |
21497 |
+- } else |
21498 |
+- bfqg_and_blkg_get(container_of(entity, struct bfq_group, |
21499 |
+- entity)); |
21500 |
++ } |
21501 |
+ } |
21502 |
+ |
21503 |
+ /** |
21504 |
+@@ -649,14 +647,8 @@ static void bfq_forget_entity(struct bfq_service_tree *st, |
21505 |
+ |
21506 |
+ entity->on_st_or_in_serv = false; |
21507 |
+ st->wsum -= entity->weight; |
21508 |
+- if (is_in_service) |
21509 |
+- return; |
21510 |
+- |
21511 |
+- if (bfqq) |
21512 |
++ if (bfqq && !is_in_service) |
21513 |
+ bfq_put_queue(bfqq); |
21514 |
+- else |
21515 |
+- bfqg_and_blkg_put(container_of(entity, struct bfq_group, |
21516 |
+- entity)); |
21517 |
+ } |
21518 |
+ |
21519 |
+ /** |
21520 |
+diff --git a/block/bio.c b/block/bio.c |
21521 |
+index a7366c02c9b57..b1883adc8f154 100644 |
21522 |
+--- a/block/bio.c |
21523 |
++++ b/block/bio.c |
21524 |
+@@ -738,8 +738,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, |
21525 |
+ struct page *page, unsigned int len, unsigned int off, |
21526 |
+ bool *same_page) |
21527 |
+ { |
21528 |
+- phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + |
21529 |
+- bv->bv_offset + bv->bv_len - 1; |
21530 |
++ size_t bv_end = bv->bv_offset + bv->bv_len; |
21531 |
++ phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_end - 1; |
21532 |
+ phys_addr_t page_addr = page_to_phys(page); |
21533 |
+ |
21534 |
+ if (vec_end_addr + 1 != page_addr + off) |
21535 |
+@@ -748,9 +748,9 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, |
21536 |
+ return false; |
21537 |
+ |
21538 |
+ *same_page = ((vec_end_addr & PAGE_MASK) == page_addr); |
21539 |
+- if (!*same_page && pfn_to_page(PFN_DOWN(vec_end_addr)) + 1 != page) |
21540 |
+- return false; |
21541 |
+- return true; |
21542 |
++ if (*same_page) |
21543 |
++ return true; |
21544 |
++ return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE); |
21545 |
+ } |
21546 |
+ |
21547 |
+ /* |
21548 |
+diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c |
21549 |
+index 0ecc897b225c9..6e8f5e60b0982 100644 |
21550 |
+--- a/block/blk-cgroup.c |
21551 |
++++ b/block/blk-cgroup.c |
21552 |
+@@ -1056,13 +1056,15 @@ int blkcg_init_queue(struct request_queue *q) |
21553 |
+ if (preloaded) |
21554 |
+ radix_tree_preload_end(); |
21555 |
+ |
21556 |
+- ret = blk_iolatency_init(q); |
21557 |
++ ret = blk_throtl_init(q); |
21558 |
+ if (ret) |
21559 |
+ goto err_destroy_all; |
21560 |
+ |
21561 |
+- ret = blk_throtl_init(q); |
21562 |
+- if (ret) |
21563 |
++ ret = blk_iolatency_init(q); |
21564 |
++ if (ret) { |
21565 |
++ blk_throtl_exit(q); |
21566 |
+ goto err_destroy_all; |
21567 |
++ } |
21568 |
+ return 0; |
21569 |
+ |
21570 |
+ err_destroy_all: |
21571 |
+diff --git a/block/blk-merge.c b/block/blk-merge.c |
21572 |
+index f0b0bae075a0c..75abba4d4591c 100644 |
21573 |
+--- a/block/blk-merge.c |
21574 |
++++ b/block/blk-merge.c |
21575 |
+@@ -154,7 +154,7 @@ static inline unsigned get_max_io_size(struct request_queue *q, |
21576 |
+ if (max_sectors > start_offset) |
21577 |
+ return max_sectors - start_offset; |
21578 |
+ |
21579 |
+- return sectors & (lbs - 1); |
21580 |
++ return sectors & ~(lbs - 1); |
21581 |
+ } |
21582 |
+ |
21583 |
+ static inline unsigned get_max_segment_size(const struct request_queue *q, |
21584 |
+@@ -534,10 +534,17 @@ int __blk_rq_map_sg(struct request_queue *q, struct request *rq, |
21585 |
+ } |
21586 |
+ EXPORT_SYMBOL(__blk_rq_map_sg); |
21587 |
+ |
21588 |
++static inline unsigned int blk_rq_get_max_segments(struct request *rq) |
21589 |
++{ |
21590 |
++ if (req_op(rq) == REQ_OP_DISCARD) |
21591 |
++ return queue_max_discard_segments(rq->q); |
21592 |
++ return queue_max_segments(rq->q); |
21593 |
++} |
21594 |
++ |
21595 |
+ static inline int ll_new_hw_segment(struct request *req, struct bio *bio, |
21596 |
+ unsigned int nr_phys_segs) |
21597 |
+ { |
21598 |
+- if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(req->q)) |
21599 |
++ if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req)) |
21600 |
+ goto no_merge; |
21601 |
+ |
21602 |
+ if (blk_integrity_merge_bio(req->q, req, bio) == false) |
21603 |
+@@ -625,7 +632,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, |
21604 |
+ return 0; |
21605 |
+ |
21606 |
+ total_phys_segments = req->nr_phys_segments + next->nr_phys_segments; |
21607 |
+- if (total_phys_segments > queue_max_segments(q)) |
21608 |
++ if (total_phys_segments > blk_rq_get_max_segments(req)) |
21609 |
+ return 0; |
21610 |
+ |
21611 |
+ if (blk_integrity_merge_rq(q, req, next) == false) |
21612 |
+diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c |
21613 |
+index fdcc2c1dd1788..fd850d9e68a1a 100644 |
21614 |
+--- a/block/blk-mq-sched.c |
21615 |
++++ b/block/blk-mq-sched.c |
21616 |
+@@ -77,6 +77,15 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx) |
21617 |
+ return; |
21618 |
+ clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); |
21619 |
+ |
21620 |
++ /* |
21621 |
++ * Order clearing SCHED_RESTART and list_empty_careful(&hctx->dispatch) |
21622 |
++ * in blk_mq_run_hw_queue(). Its pair is the barrier in |
21623 |
++ * blk_mq_dispatch_rq_list(). So dispatch code won't see SCHED_RESTART, |
21624 |
++ * meantime new request added to hctx->dispatch is missed to check in |
21625 |
++ * blk_mq_run_hw_queue(). |
21626 |
++ */ |
21627 |
++ smp_mb(); |
21628 |
++ |
21629 |
+ blk_mq_run_hw_queue(hctx, true); |
21630 |
+ } |
21631 |
+ |
21632 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
21633 |
+index 4e0d173beaa35..a366726094a89 100644 |
21634 |
+--- a/block/blk-mq.c |
21635 |
++++ b/block/blk-mq.c |
21636 |
+@@ -1323,6 +1323,15 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, |
21637 |
+ list_splice_tail_init(list, &hctx->dispatch); |
21638 |
+ spin_unlock(&hctx->lock); |
21639 |
+ |
21640 |
++ /* |
21641 |
++ * Order adding requests to hctx->dispatch and checking |
21642 |
++ * SCHED_RESTART flag. The pair of this smp_mb() is the one |
21643 |
++ * in blk_mq_sched_restart(). Avoid restart code path to |
21644 |
++ * miss the new added requests to hctx->dispatch, meantime |
21645 |
++ * SCHED_RESTART is observed here. |
21646 |
++ */ |
21647 |
++ smp_mb(); |
21648 |
++ |
21649 |
+ /* |
21650 |
+ * If SCHED_RESTART was set by the caller of this function and |
21651 |
+ * it is no longer set that means that it was cleared by another |
21652 |
+@@ -1909,7 +1918,8 @@ insert: |
21653 |
+ if (bypass_insert) |
21654 |
+ return BLK_STS_RESOURCE; |
21655 |
+ |
21656 |
+- blk_mq_request_bypass_insert(rq, false, run_queue); |
21657 |
++ blk_mq_sched_insert_request(rq, false, run_queue, false); |
21658 |
++ |
21659 |
+ return BLK_STS_OK; |
21660 |
+ } |
21661 |
+ |
21662 |
+diff --git a/crypto/af_alg.c b/crypto/af_alg.c |
21663 |
+index 5882ed46f1adb..e31cf43df2e09 100644 |
21664 |
+--- a/crypto/af_alg.c |
21665 |
++++ b/crypto/af_alg.c |
21666 |
+@@ -16,6 +16,7 @@ |
21667 |
+ #include <linux/module.h> |
21668 |
+ #include <linux/net.h> |
21669 |
+ #include <linux/rwsem.h> |
21670 |
++#include <linux/sched.h> |
21671 |
+ #include <linux/sched/signal.h> |
21672 |
+ #include <linux/security.h> |
21673 |
+ |
21674 |
+@@ -847,9 +848,15 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, |
21675 |
+ } |
21676 |
+ |
21677 |
+ lock_sock(sk); |
21678 |
+- if (ctx->init && (init || !ctx->more)) { |
21679 |
+- err = -EINVAL; |
21680 |
+- goto unlock; |
21681 |
++ if (ctx->init && !ctx->more) { |
21682 |
++ if (ctx->used) { |
21683 |
++ err = -EINVAL; |
21684 |
++ goto unlock; |
21685 |
++ } |
21686 |
++ |
21687 |
++ pr_info_once( |
21688 |
++ "%s sent an empty control message without MSG_MORE.\n", |
21689 |
++ current->comm); |
21690 |
+ } |
21691 |
+ ctx->init = true; |
21692 |
+ |
21693 |
+diff --git a/drivers/base/core.c b/drivers/base/core.c |
21694 |
+index 05d414e9e8a40..0799e1445f654 100644 |
21695 |
+--- a/drivers/base/core.c |
21696 |
++++ b/drivers/base/core.c |
21697 |
+@@ -3988,9 +3988,9 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) |
21698 |
+ */ |
21699 |
+ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) |
21700 |
+ { |
21701 |
+- if (fwnode) { |
21702 |
+- struct fwnode_handle *fn = dev->fwnode; |
21703 |
++ struct fwnode_handle *fn = dev->fwnode; |
21704 |
+ |
21705 |
++ if (fwnode) { |
21706 |
+ if (fwnode_is_primary(fn)) |
21707 |
+ fn = fn->secondary; |
21708 |
+ |
21709 |
+@@ -4000,8 +4000,12 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) |
21710 |
+ } |
21711 |
+ dev->fwnode = fwnode; |
21712 |
+ } else { |
21713 |
+- dev->fwnode = fwnode_is_primary(dev->fwnode) ? |
21714 |
+- dev->fwnode->secondary : NULL; |
21715 |
++ if (fwnode_is_primary(fn)) { |
21716 |
++ dev->fwnode = fn->secondary; |
21717 |
++ fn->secondary = NULL; |
21718 |
++ } else { |
21719 |
++ dev->fwnode = NULL; |
21720 |
++ } |
21721 |
+ } |
21722 |
+ } |
21723 |
+ EXPORT_SYMBOL_GPL(set_primary_fwnode); |
21724 |
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
21725 |
+index 9dd85bea40260..205a06752ca90 100644 |
21726 |
+--- a/drivers/base/power/main.c |
21727 |
++++ b/drivers/base/power/main.c |
21728 |
+@@ -1606,13 +1606,17 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) |
21729 |
+ } |
21730 |
+ |
21731 |
+ /* |
21732 |
+- * If a device configured to wake up the system from sleep states |
21733 |
+- * has been suspended at run time and there's a resume request pending |
21734 |
+- * for it, this is equivalent to the device signaling wakeup, so the |
21735 |
+- * system suspend operation should be aborted. |
21736 |
++ * Wait for possible runtime PM transitions of the device in progress |
21737 |
++ * to complete and if there's a runtime resume request pending for it, |
21738 |
++ * resume it before proceeding with invoking the system-wide suspend |
21739 |
++ * callbacks for it. |
21740 |
++ * |
21741 |
++ * If the system-wide suspend callbacks below change the configuration |
21742 |
++ * of the device, they must disable runtime PM for it or otherwise |
21743 |
++ * ensure that its runtime-resume callbacks will not be confused by that |
21744 |
++ * change in case they are invoked going forward. |
21745 |
+ */ |
21746 |
+- if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) |
21747 |
+- pm_wakeup_event(dev, 0); |
21748 |
++ pm_runtime_barrier(dev); |
21749 |
+ |
21750 |
+ if (pm_wakeup_pending()) { |
21751 |
+ dev->power.direct_complete = false; |
21752 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
21753 |
+index 776083963ee6c..84433922aed16 100644 |
21754 |
+--- a/drivers/block/loop.c |
21755 |
++++ b/drivers/block/loop.c |
21756 |
+@@ -877,6 +877,7 @@ static void loop_config_discard(struct loop_device *lo) |
21757 |
+ struct file *file = lo->lo_backing_file; |
21758 |
+ struct inode *inode = file->f_mapping->host; |
21759 |
+ struct request_queue *q = lo->lo_queue; |
21760 |
++ u32 granularity, max_discard_sectors; |
21761 |
+ |
21762 |
+ /* |
21763 |
+ * If the backing device is a block device, mirror its zeroing |
21764 |
+@@ -889,11 +890,10 @@ static void loop_config_discard(struct loop_device *lo) |
21765 |
+ struct request_queue *backingq; |
21766 |
+ |
21767 |
+ backingq = bdev_get_queue(inode->i_bdev); |
21768 |
+- blk_queue_max_discard_sectors(q, |
21769 |
+- backingq->limits.max_write_zeroes_sectors); |
21770 |
+ |
21771 |
+- blk_queue_max_write_zeroes_sectors(q, |
21772 |
+- backingq->limits.max_write_zeroes_sectors); |
21773 |
++ max_discard_sectors = backingq->limits.max_write_zeroes_sectors; |
21774 |
++ granularity = backingq->limits.discard_granularity ?: |
21775 |
++ queue_physical_block_size(backingq); |
21776 |
+ |
21777 |
+ /* |
21778 |
+ * We use punch hole to reclaim the free space used by the |
21779 |
+@@ -902,23 +902,26 @@ static void loop_config_discard(struct loop_device *lo) |
21780 |
+ * useful information. |
21781 |
+ */ |
21782 |
+ } else if (!file->f_op->fallocate || lo->lo_encrypt_key_size) { |
21783 |
+- q->limits.discard_granularity = 0; |
21784 |
+- q->limits.discard_alignment = 0; |
21785 |
+- blk_queue_max_discard_sectors(q, 0); |
21786 |
+- blk_queue_max_write_zeroes_sectors(q, 0); |
21787 |
++ max_discard_sectors = 0; |
21788 |
++ granularity = 0; |
21789 |
+ |
21790 |
+ } else { |
21791 |
+- q->limits.discard_granularity = inode->i_sb->s_blocksize; |
21792 |
+- q->limits.discard_alignment = 0; |
21793 |
+- |
21794 |
+- blk_queue_max_discard_sectors(q, UINT_MAX >> 9); |
21795 |
+- blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); |
21796 |
++ max_discard_sectors = UINT_MAX >> 9; |
21797 |
++ granularity = inode->i_sb->s_blocksize; |
21798 |
+ } |
21799 |
+ |
21800 |
+- if (q->limits.max_write_zeroes_sectors) |
21801 |
++ if (max_discard_sectors) { |
21802 |
++ q->limits.discard_granularity = granularity; |
21803 |
++ blk_queue_max_discard_sectors(q, max_discard_sectors); |
21804 |
++ blk_queue_max_write_zeroes_sectors(q, max_discard_sectors); |
21805 |
+ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); |
21806 |
+- else |
21807 |
++ } else { |
21808 |
++ q->limits.discard_granularity = 0; |
21809 |
++ blk_queue_max_discard_sectors(q, 0); |
21810 |
++ blk_queue_max_write_zeroes_sectors(q, 0); |
21811 |
+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); |
21812 |
++ } |
21813 |
++ q->limits.discard_alignment = 0; |
21814 |
+ } |
21815 |
+ |
21816 |
+ static void loop_unprepare_queue(struct loop_device *lo) |
21817 |
+diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c |
21818 |
+index 87b31f9ca362e..8cf13ea11cd2c 100644 |
21819 |
+--- a/drivers/block/null_blk_main.c |
21820 |
++++ b/drivers/block/null_blk_main.c |
21821 |
+@@ -1139,7 +1139,7 @@ static int null_handle_rq(struct nullb_cmd *cmd) |
21822 |
+ len = bvec.bv_len; |
21823 |
+ err = null_transfer(nullb, bvec.bv_page, len, bvec.bv_offset, |
21824 |
+ op_is_write(req_op(rq)), sector, |
21825 |
+- req_op(rq) & REQ_FUA); |
21826 |
++ rq->cmd_flags & REQ_FUA); |
21827 |
+ if (err) { |
21828 |
+ spin_unlock_irq(&nullb->lock); |
21829 |
+ return err; |
21830 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
21831 |
+index 980df853ee497..99991b6a6f0ed 100644 |
21832 |
+--- a/drivers/block/virtio_blk.c |
21833 |
++++ b/drivers/block/virtio_blk.c |
21834 |
+@@ -126,16 +126,31 @@ static int virtblk_setup_discard_write_zeroes(struct request *req, bool unmap) |
21835 |
+ if (!range) |
21836 |
+ return -ENOMEM; |
21837 |
+ |
21838 |
+- __rq_for_each_bio(bio, req) { |
21839 |
+- u64 sector = bio->bi_iter.bi_sector; |
21840 |
+- u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT; |
21841 |
+- |
21842 |
+- range[n].flags = cpu_to_le32(flags); |
21843 |
+- range[n].num_sectors = cpu_to_le32(num_sectors); |
21844 |
+- range[n].sector = cpu_to_le64(sector); |
21845 |
+- n++; |
21846 |
++ /* |
21847 |
++ * Single max discard segment means multi-range discard isn't |
21848 |
++ * supported, and block layer only runs contiguity merge like |
21849 |
++ * normal RW request. So we can't reply on bio for retrieving |
21850 |
++ * each range info. |
21851 |
++ */ |
21852 |
++ if (queue_max_discard_segments(req->q) == 1) { |
21853 |
++ range[0].flags = cpu_to_le32(flags); |
21854 |
++ range[0].num_sectors = cpu_to_le32(blk_rq_sectors(req)); |
21855 |
++ range[0].sector = cpu_to_le64(blk_rq_pos(req)); |
21856 |
++ n = 1; |
21857 |
++ } else { |
21858 |
++ __rq_for_each_bio(bio, req) { |
21859 |
++ u64 sector = bio->bi_iter.bi_sector; |
21860 |
++ u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT; |
21861 |
++ |
21862 |
++ range[n].flags = cpu_to_le32(flags); |
21863 |
++ range[n].num_sectors = cpu_to_le32(num_sectors); |
21864 |
++ range[n].sector = cpu_to_le64(sector); |
21865 |
++ n++; |
21866 |
++ } |
21867 |
+ } |
21868 |
+ |
21869 |
++ WARN_ON_ONCE(n != segments); |
21870 |
++ |
21871 |
+ req->special_vec.bv_page = virt_to_page(range); |
21872 |
+ req->special_vec.bv_offset = offset_in_page(range); |
21873 |
+ req->special_vec.bv_len = sizeof(*range) * segments; |
21874 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
21875 |
+index c7540ad28995b..8c730a47e0537 100644 |
21876 |
+--- a/drivers/cpufreq/intel_pstate.c |
21877 |
++++ b/drivers/cpufreq/intel_pstate.c |
21878 |
+@@ -649,11 +649,12 @@ static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, |
21879 |
+ mutex_lock(&intel_pstate_limits_lock); |
21880 |
+ |
21881 |
+ if (boot_cpu_has(X86_FEATURE_HWP_EPP)) { |
21882 |
+- u64 value; |
21883 |
+- |
21884 |
+- ret = rdmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, &value); |
21885 |
+- if (ret) |
21886 |
+- goto return_pref; |
21887 |
++ /* |
21888 |
++ * Use the cached HWP Request MSR value, because the register |
21889 |
++ * itself may be updated by intel_pstate_hwp_boost_up() or |
21890 |
++ * intel_pstate_hwp_boost_down() at any time. |
21891 |
++ */ |
21892 |
++ u64 value = READ_ONCE(cpu_data->hwp_req_cached); |
21893 |
+ |
21894 |
+ value &= ~GENMASK_ULL(31, 24); |
21895 |
+ |
21896 |
+@@ -661,13 +662,18 @@ static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, |
21897 |
+ epp = epp_values[pref_index - 1]; |
21898 |
+ |
21899 |
+ value |= (u64)epp << 24; |
21900 |
++ /* |
21901 |
++ * The only other updater of hwp_req_cached in the active mode, |
21902 |
++ * intel_pstate_hwp_set(), is called under the same lock as this |
21903 |
++ * function, so it cannot run in parallel with the update below. |
21904 |
++ */ |
21905 |
++ WRITE_ONCE(cpu_data->hwp_req_cached, value); |
21906 |
+ ret = wrmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, value); |
21907 |
+ } else { |
21908 |
+ if (epp == -EINVAL) |
21909 |
+ epp = (pref_index - 1) << 2; |
21910 |
+ ret = intel_pstate_set_epb(cpu_data->cpu, epp); |
21911 |
+ } |
21912 |
+-return_pref: |
21913 |
+ mutex_unlock(&intel_pstate_limits_lock); |
21914 |
+ |
21915 |
+ return ret; |
21916 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
21917 |
+index 46c84dce6544a..5f8d94e812c8f 100644 |
21918 |
+--- a/drivers/devfreq/devfreq.c |
21919 |
++++ b/drivers/devfreq/devfreq.c |
21920 |
+@@ -1690,9 +1690,9 @@ static int devfreq_summary_show(struct seq_file *s, void *data) |
21921 |
+ #endif |
21922 |
+ |
21923 |
+ mutex_lock(&devfreq->lock); |
21924 |
+- cur_freq = devfreq->previous_freq, |
21925 |
++ cur_freq = devfreq->previous_freq; |
21926 |
+ get_freq_range(devfreq, &min_freq, &max_freq); |
21927 |
+- polling_ms = devfreq->profile->polling_ms, |
21928 |
++ polling_ms = devfreq->profile->polling_ms; |
21929 |
+ mutex_unlock(&devfreq->lock); |
21930 |
+ |
21931 |
+ seq_printf(s, |
21932 |
+diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig |
21933 |
+index de41d7928bff2..984354ca877de 100644 |
21934 |
+--- a/drivers/dma/Kconfig |
21935 |
++++ b/drivers/dma/Kconfig |
21936 |
+@@ -285,6 +285,7 @@ config INTEL_IDMA64 |
21937 |
+ config INTEL_IDXD |
21938 |
+ tristate "Intel Data Accelerators support" |
21939 |
+ depends on PCI && X86_64 |
21940 |
++ depends on PCI_MSI |
21941 |
+ select DMA_ENGINE |
21942 |
+ select SBITMAP |
21943 |
+ help |
21944 |
+diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c |
21945 |
+index 5813e931f2f00..01ff71f7b6456 100644 |
21946 |
+--- a/drivers/edac/edac_mc.c |
21947 |
++++ b/drivers/edac/edac_mc.c |
21948 |
+@@ -950,6 +950,8 @@ static void edac_ue_error(struct edac_raw_error_desc *e) |
21949 |
+ e->other_detail); |
21950 |
+ } |
21951 |
+ |
21952 |
++ edac_inc_ue_error(e); |
21953 |
++ |
21954 |
+ if (edac_mc_get_panic_on_ue()) { |
21955 |
+ panic("UE %s%son %s (%s page:0x%lx offset:0x%lx grain:%ld%s%s)\n", |
21956 |
+ e->msg, |
21957 |
+@@ -959,8 +961,6 @@ static void edac_ue_error(struct edac_raw_error_desc *e) |
21958 |
+ *e->other_detail ? " - " : "", |
21959 |
+ e->other_detail); |
21960 |
+ } |
21961 |
+- |
21962 |
+- edac_inc_ue_error(e); |
21963 |
+ } |
21964 |
+ |
21965 |
+ static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) |
21966 |
+diff --git a/drivers/edac/ie31200_edac.c b/drivers/edac/ie31200_edac.c |
21967 |
+index d68346a8e141a..ebe50996cc423 100644 |
21968 |
+--- a/drivers/edac/ie31200_edac.c |
21969 |
++++ b/drivers/edac/ie31200_edac.c |
21970 |
+@@ -170,6 +170,8 @@ |
21971 |
+ (n << (28 + (2 * skl) - PAGE_SHIFT)) |
21972 |
+ |
21973 |
+ static int nr_channels; |
21974 |
++static struct pci_dev *mci_pdev; |
21975 |
++static int ie31200_registered = 1; |
21976 |
+ |
21977 |
+ struct ie31200_priv { |
21978 |
+ void __iomem *window; |
21979 |
+@@ -538,12 +540,16 @@ fail_free: |
21980 |
+ static int ie31200_init_one(struct pci_dev *pdev, |
21981 |
+ const struct pci_device_id *ent) |
21982 |
+ { |
21983 |
+- edac_dbg(0, "MC:\n"); |
21984 |
++ int rc; |
21985 |
+ |
21986 |
++ edac_dbg(0, "MC:\n"); |
21987 |
+ if (pci_enable_device(pdev) < 0) |
21988 |
+ return -EIO; |
21989 |
++ rc = ie31200_probe1(pdev, ent->driver_data); |
21990 |
++ if (rc == 0 && !mci_pdev) |
21991 |
++ mci_pdev = pci_dev_get(pdev); |
21992 |
+ |
21993 |
+- return ie31200_probe1(pdev, ent->driver_data); |
21994 |
++ return rc; |
21995 |
+ } |
21996 |
+ |
21997 |
+ static void ie31200_remove_one(struct pci_dev *pdev) |
21998 |
+@@ -552,6 +558,8 @@ static void ie31200_remove_one(struct pci_dev *pdev) |
21999 |
+ struct ie31200_priv *priv; |
22000 |
+ |
22001 |
+ edac_dbg(0, "\n"); |
22002 |
++ pci_dev_put(mci_pdev); |
22003 |
++ mci_pdev = NULL; |
22004 |
+ mci = edac_mc_del_mc(&pdev->dev); |
22005 |
+ if (!mci) |
22006 |
+ return; |
22007 |
+@@ -593,17 +601,53 @@ static struct pci_driver ie31200_driver = { |
22008 |
+ |
22009 |
+ static int __init ie31200_init(void) |
22010 |
+ { |
22011 |
++ int pci_rc, i; |
22012 |
++ |
22013 |
+ edac_dbg(3, "MC:\n"); |
22014 |
+ /* Ensure that the OPSTATE is set correctly for POLL or NMI */ |
22015 |
+ opstate_init(); |
22016 |
+ |
22017 |
+- return pci_register_driver(&ie31200_driver); |
22018 |
++ pci_rc = pci_register_driver(&ie31200_driver); |
22019 |
++ if (pci_rc < 0) |
22020 |
++ goto fail0; |
22021 |
++ |
22022 |
++ if (!mci_pdev) { |
22023 |
++ ie31200_registered = 0; |
22024 |
++ for (i = 0; ie31200_pci_tbl[i].vendor != 0; i++) { |
22025 |
++ mci_pdev = pci_get_device(ie31200_pci_tbl[i].vendor, |
22026 |
++ ie31200_pci_tbl[i].device, |
22027 |
++ NULL); |
22028 |
++ if (mci_pdev) |
22029 |
++ break; |
22030 |
++ } |
22031 |
++ if (!mci_pdev) { |
22032 |
++ edac_dbg(0, "ie31200 pci_get_device fail\n"); |
22033 |
++ pci_rc = -ENODEV; |
22034 |
++ goto fail1; |
22035 |
++ } |
22036 |
++ pci_rc = ie31200_init_one(mci_pdev, &ie31200_pci_tbl[i]); |
22037 |
++ if (pci_rc < 0) { |
22038 |
++ edac_dbg(0, "ie31200 init fail\n"); |
22039 |
++ pci_rc = -ENODEV; |
22040 |
++ goto fail1; |
22041 |
++ } |
22042 |
++ } |
22043 |
++ return 0; |
22044 |
++ |
22045 |
++fail1: |
22046 |
++ pci_unregister_driver(&ie31200_driver); |
22047 |
++fail0: |
22048 |
++ pci_dev_put(mci_pdev); |
22049 |
++ |
22050 |
++ return pci_rc; |
22051 |
+ } |
22052 |
+ |
22053 |
+ static void __exit ie31200_exit(void) |
22054 |
+ { |
22055 |
+ edac_dbg(3, "MC:\n"); |
22056 |
+ pci_unregister_driver(&ie31200_driver); |
22057 |
++ if (!ie31200_registered) |
22058 |
++ ie31200_remove_one(mci_pdev); |
22059 |
+ } |
22060 |
+ |
22061 |
+ module_init(ie31200_init); |
22062 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c |
22063 |
+index c7fd0c47b2545..1102de76d8767 100644 |
22064 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c |
22065 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c |
22066 |
+@@ -195,19 +195,32 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev, |
22067 |
+ unsigned int engine_id, |
22068 |
+ unsigned int queue_id) |
22069 |
+ { |
22070 |
+- uint32_t sdma_engine_reg_base[2] = { |
22071 |
+- SOC15_REG_OFFSET(SDMA0, 0, |
22072 |
+- mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL, |
22073 |
+- SOC15_REG_OFFSET(SDMA1, 0, |
22074 |
+- mmSDMA1_RLC0_RB_CNTL) - mmSDMA1_RLC0_RB_CNTL |
22075 |
+- }; |
22076 |
+- uint32_t retval = sdma_engine_reg_base[engine_id] |
22077 |
++ uint32_t sdma_engine_reg_base = 0; |
22078 |
++ uint32_t sdma_rlc_reg_offset; |
22079 |
++ |
22080 |
++ switch (engine_id) { |
22081 |
++ default: |
22082 |
++ dev_warn(adev->dev, |
22083 |
++ "Invalid sdma engine id (%d), using engine id 0\n", |
22084 |
++ engine_id); |
22085 |
++ fallthrough; |
22086 |
++ case 0: |
22087 |
++ sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0, |
22088 |
++ mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL; |
22089 |
++ break; |
22090 |
++ case 1: |
22091 |
++ sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA1, 0, |
22092 |
++ mmSDMA1_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL; |
22093 |
++ break; |
22094 |
++ } |
22095 |
++ |
22096 |
++ sdma_rlc_reg_offset = sdma_engine_reg_base |
22097 |
+ + queue_id * (mmSDMA0_RLC1_RB_CNTL - mmSDMA0_RLC0_RB_CNTL); |
22098 |
+ |
22099 |
+ pr_debug("RLC register offset for SDMA%d RLC%d: 0x%x\n", engine_id, |
22100 |
+- queue_id, retval); |
22101 |
++ queue_id, sdma_rlc_reg_offset); |
22102 |
+ |
22103 |
+- return retval; |
22104 |
++ return sdma_rlc_reg_offset; |
22105 |
+ } |
22106 |
+ |
22107 |
+ static inline struct v9_mqd *get_mqd(void *mqd) |
22108 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
22109 |
+index f355d9a752d29..a1aec205435de 100644 |
22110 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
22111 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
22112 |
+@@ -716,8 +716,10 @@ amdgpu_connector_lvds_detect(struct drm_connector *connector, bool force) |
22113 |
+ |
22114 |
+ if (!drm_kms_helper_is_poll_worker()) { |
22115 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
22116 |
+- if (r < 0) |
22117 |
++ if (r < 0) { |
22118 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
22119 |
+ return connector_status_disconnected; |
22120 |
++ } |
22121 |
+ } |
22122 |
+ |
22123 |
+ if (encoder) { |
22124 |
+@@ -854,8 +856,10 @@ amdgpu_connector_vga_detect(struct drm_connector *connector, bool force) |
22125 |
+ |
22126 |
+ if (!drm_kms_helper_is_poll_worker()) { |
22127 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
22128 |
+- if (r < 0) |
22129 |
++ if (r < 0) { |
22130 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
22131 |
+ return connector_status_disconnected; |
22132 |
++ } |
22133 |
+ } |
22134 |
+ |
22135 |
+ encoder = amdgpu_connector_best_single_encoder(connector); |
22136 |
+@@ -977,8 +981,10 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force) |
22137 |
+ |
22138 |
+ if (!drm_kms_helper_is_poll_worker()) { |
22139 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
22140 |
+- if (r < 0) |
22141 |
++ if (r < 0) { |
22142 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
22143 |
+ return connector_status_disconnected; |
22144 |
++ } |
22145 |
+ } |
22146 |
+ |
22147 |
+ if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) { |
22148 |
+@@ -1328,8 +1334,10 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force) |
22149 |
+ |
22150 |
+ if (!drm_kms_helper_is_poll_worker()) { |
22151 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
22152 |
+- if (r < 0) |
22153 |
++ if (r < 0) { |
22154 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
22155 |
+ return connector_status_disconnected; |
22156 |
++ } |
22157 |
+ } |
22158 |
+ |
22159 |
+ if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) { |
22160 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
22161 |
+index f7143d927b6d8..5e51f0acf744f 100644 |
22162 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
22163 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |
22164 |
+@@ -282,7 +282,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set, |
22165 |
+ |
22166 |
+ ret = pm_runtime_get_sync(dev->dev); |
22167 |
+ if (ret < 0) |
22168 |
+- return ret; |
22169 |
++ goto out; |
22170 |
+ |
22171 |
+ ret = drm_crtc_helper_set_config(set, ctx); |
22172 |
+ |
22173 |
+@@ -297,7 +297,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set, |
22174 |
+ take the current one */ |
22175 |
+ if (active && !adev->have_disp_power_ref) { |
22176 |
+ adev->have_disp_power_ref = true; |
22177 |
+- return ret; |
22178 |
++ goto out; |
22179 |
+ } |
22180 |
+ /* if we have no active crtcs, then drop the power ref |
22181 |
+ we got before */ |
22182 |
+@@ -306,6 +306,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set, |
22183 |
+ adev->have_disp_power_ref = false; |
22184 |
+ } |
22185 |
+ |
22186 |
++out: |
22187 |
+ /* drop the power reference we got coming in here */ |
22188 |
+ pm_runtime_put_autosuspend(dev->dev); |
22189 |
+ return ret; |
22190 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
22191 |
+index 126e74758a342..d73924e35a57e 100644 |
22192 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
22193 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |
22194 |
+@@ -1373,11 +1373,12 @@ long amdgpu_drm_ioctl(struct file *filp, |
22195 |
+ dev = file_priv->minor->dev; |
22196 |
+ ret = pm_runtime_get_sync(dev->dev); |
22197 |
+ if (ret < 0) |
22198 |
+- return ret; |
22199 |
++ goto out; |
22200 |
+ |
22201 |
+ ret = drm_ioctl(filp, cmd, arg); |
22202 |
+ |
22203 |
+ pm_runtime_mark_last_busy(dev->dev); |
22204 |
++out: |
22205 |
+ pm_runtime_put_autosuspend(dev->dev); |
22206 |
+ return ret; |
22207 |
+ } |
22208 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
22209 |
+index 3414e119f0cbf..f5a6ee7c2eaa3 100644 |
22210 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
22211 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
22212 |
+@@ -754,8 +754,10 @@ static int amdgpu_debugfs_gpu_recover(struct seq_file *m, void *data) |
22213 |
+ int r; |
22214 |
+ |
22215 |
+ r = pm_runtime_get_sync(dev->dev); |
22216 |
+- if (r < 0) |
22217 |
++ if (r < 0) { |
22218 |
++ pm_runtime_put_autosuspend(dev->dev); |
22219 |
+ return 0; |
22220 |
++ } |
22221 |
+ |
22222 |
+ seq_printf(m, "gpu recover\n"); |
22223 |
+ amdgpu_device_gpu_recover(adev, NULL); |
22224 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |
22225 |
+index 21292098bc023..0a3b7d9df8a56 100644 |
22226 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |
22227 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |
22228 |
+@@ -663,8 +663,12 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file |
22229 |
+ * in the bitfields */ |
22230 |
+ if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK) |
22231 |
+ se_num = 0xffffffff; |
22232 |
++ else if (se_num >= AMDGPU_GFX_MAX_SE) |
22233 |
++ return -EINVAL; |
22234 |
+ if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK) |
22235 |
+ sh_num = 0xffffffff; |
22236 |
++ else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE) |
22237 |
++ return -EINVAL; |
22238 |
+ |
22239 |
+ if (info->read_mmr_reg.count > 128) |
22240 |
+ return -EINVAL; |
22241 |
+@@ -992,7 +996,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) |
22242 |
+ |
22243 |
+ r = pm_runtime_get_sync(dev->dev); |
22244 |
+ if (r < 0) |
22245 |
+- return r; |
22246 |
++ goto pm_put; |
22247 |
+ |
22248 |
+ fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
22249 |
+ if (unlikely(!fpriv)) { |
22250 |
+@@ -1043,6 +1047,7 @@ error_pasid: |
22251 |
+ |
22252 |
+ out_suspend: |
22253 |
+ pm_runtime_mark_last_busy(dev->dev); |
22254 |
++pm_put: |
22255 |
+ pm_runtime_put_autosuspend(dev->dev); |
22256 |
+ |
22257 |
+ return r; |
22258 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |
22259 |
+index 02e6f8c4dde08..459b81fc5aef4 100644 |
22260 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |
22261 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |
22262 |
+@@ -167,8 +167,10 @@ static ssize_t amdgpu_get_power_dpm_state(struct device *dev, |
22263 |
+ return -EPERM; |
22264 |
+ |
22265 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22266 |
+- if (ret < 0) |
22267 |
++ if (ret < 0) { |
22268 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22269 |
+ return ret; |
22270 |
++ } |
22271 |
+ |
22272 |
+ if (is_support_sw_smu(adev)) { |
22273 |
+ if (adev->smu.ppt_funcs->get_current_power_state) |
22274 |
+@@ -212,8 +214,10 @@ static ssize_t amdgpu_set_power_dpm_state(struct device *dev, |
22275 |
+ return -EINVAL; |
22276 |
+ |
22277 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22278 |
+- if (ret < 0) |
22279 |
++ if (ret < 0) { |
22280 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22281 |
+ return ret; |
22282 |
++ } |
22283 |
+ |
22284 |
+ if (is_support_sw_smu(adev)) { |
22285 |
+ mutex_lock(&adev->pm.mutex); |
22286 |
+@@ -307,8 +311,10 @@ static ssize_t amdgpu_get_power_dpm_force_performance_level(struct device *dev, |
22287 |
+ return -EPERM; |
22288 |
+ |
22289 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22290 |
+- if (ret < 0) |
22291 |
++ if (ret < 0) { |
22292 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22293 |
+ return ret; |
22294 |
++ } |
22295 |
+ |
22296 |
+ if (is_support_sw_smu(adev)) |
22297 |
+ level = smu_get_performance_level(&adev->smu); |
22298 |
+@@ -369,8 +375,10 @@ static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev, |
22299 |
+ } |
22300 |
+ |
22301 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22302 |
+- if (ret < 0) |
22303 |
++ if (ret < 0) { |
22304 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22305 |
+ return ret; |
22306 |
++ } |
22307 |
+ |
22308 |
+ if (is_support_sw_smu(adev)) |
22309 |
+ current_level = smu_get_performance_level(&adev->smu); |
22310 |
+@@ -449,8 +457,10 @@ static ssize_t amdgpu_get_pp_num_states(struct device *dev, |
22311 |
+ return -EPERM; |
22312 |
+ |
22313 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22314 |
+- if (ret < 0) |
22315 |
++ if (ret < 0) { |
22316 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22317 |
+ return ret; |
22318 |
++ } |
22319 |
+ |
22320 |
+ if (is_support_sw_smu(adev)) { |
22321 |
+ ret = smu_get_power_num_states(&adev->smu, &data); |
22322 |
+@@ -491,8 +501,10 @@ static ssize_t amdgpu_get_pp_cur_state(struct device *dev, |
22323 |
+ return -EPERM; |
22324 |
+ |
22325 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22326 |
+- if (ret < 0) |
22327 |
++ if (ret < 0) { |
22328 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22329 |
+ return ret; |
22330 |
++ } |
22331 |
+ |
22332 |
+ if (is_support_sw_smu(adev)) { |
22333 |
+ pm = smu_get_current_power_state(smu); |
22334 |
+@@ -567,8 +579,10 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev, |
22335 |
+ state = data.states[idx]; |
22336 |
+ |
22337 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22338 |
+- if (ret < 0) |
22339 |
++ if (ret < 0) { |
22340 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22341 |
+ return ret; |
22342 |
++ } |
22343 |
+ |
22344 |
+ /* only set user selected power states */ |
22345 |
+ if (state != POWER_STATE_TYPE_INTERNAL_BOOT && |
22346 |
+@@ -608,8 +622,10 @@ static ssize_t amdgpu_get_pp_table(struct device *dev, |
22347 |
+ return -EPERM; |
22348 |
+ |
22349 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22350 |
+- if (ret < 0) |
22351 |
++ if (ret < 0) { |
22352 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22353 |
+ return ret; |
22354 |
++ } |
22355 |
+ |
22356 |
+ if (is_support_sw_smu(adev)) { |
22357 |
+ size = smu_sys_get_pp_table(&adev->smu, (void **)&table); |
22358 |
+@@ -650,8 +666,10 @@ static ssize_t amdgpu_set_pp_table(struct device *dev, |
22359 |
+ return -EPERM; |
22360 |
+ |
22361 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22362 |
+- if (ret < 0) |
22363 |
++ if (ret < 0) { |
22364 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22365 |
+ return ret; |
22366 |
++ } |
22367 |
+ |
22368 |
+ if (is_support_sw_smu(adev)) { |
22369 |
+ ret = smu_sys_set_pp_table(&adev->smu, (void *)buf, count); |
22370 |
+@@ -790,8 +808,10 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, |
22371 |
+ } |
22372 |
+ |
22373 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22374 |
+- if (ret < 0) |
22375 |
++ if (ret < 0) { |
22376 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22377 |
+ return ret; |
22378 |
++ } |
22379 |
+ |
22380 |
+ if (is_support_sw_smu(adev)) { |
22381 |
+ ret = smu_od_edit_dpm_table(&adev->smu, type, |
22382 |
+@@ -847,8 +867,10 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev, |
22383 |
+ return -EPERM; |
22384 |
+ |
22385 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22386 |
+- if (ret < 0) |
22387 |
++ if (ret < 0) { |
22388 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22389 |
+ return ret; |
22390 |
++ } |
22391 |
+ |
22392 |
+ if (is_support_sw_smu(adev)) { |
22393 |
+ size = smu_print_clk_levels(&adev->smu, SMU_OD_SCLK, buf); |
22394 |
+@@ -905,8 +927,10 @@ static ssize_t amdgpu_set_pp_features(struct device *dev, |
22395 |
+ pr_debug("featuremask = 0x%llx\n", featuremask); |
22396 |
+ |
22397 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22398 |
+- if (ret < 0) |
22399 |
++ if (ret < 0) { |
22400 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22401 |
+ return ret; |
22402 |
++ } |
22403 |
+ |
22404 |
+ if (is_support_sw_smu(adev)) { |
22405 |
+ ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask); |
22406 |
+@@ -942,8 +966,10 @@ static ssize_t amdgpu_get_pp_features(struct device *dev, |
22407 |
+ return -EPERM; |
22408 |
+ |
22409 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22410 |
+- if (ret < 0) |
22411 |
++ if (ret < 0) { |
22412 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22413 |
+ return ret; |
22414 |
++ } |
22415 |
+ |
22416 |
+ if (is_support_sw_smu(adev)) |
22417 |
+ size = smu_sys_get_pp_feature_mask(&adev->smu, buf); |
22418 |
+@@ -1001,8 +1027,10 @@ static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev, |
22419 |
+ return -EPERM; |
22420 |
+ |
22421 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22422 |
+- if (ret < 0) |
22423 |
++ if (ret < 0) { |
22424 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22425 |
+ return ret; |
22426 |
++ } |
22427 |
+ |
22428 |
+ if (is_support_sw_smu(adev)) |
22429 |
+ size = smu_print_clk_levels(&adev->smu, SMU_SCLK, buf); |
22430 |
+@@ -1071,8 +1099,10 @@ static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev, |
22431 |
+ return ret; |
22432 |
+ |
22433 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22434 |
+- if (ret < 0) |
22435 |
++ if (ret < 0) { |
22436 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22437 |
+ return ret; |
22438 |
++ } |
22439 |
+ |
22440 |
+ if (is_support_sw_smu(adev)) |
22441 |
+ ret = smu_force_clk_levels(&adev->smu, SMU_SCLK, mask, true); |
22442 |
+@@ -1101,8 +1131,10 @@ static ssize_t amdgpu_get_pp_dpm_mclk(struct device *dev, |
22443 |
+ return -EPERM; |
22444 |
+ |
22445 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22446 |
+- if (ret < 0) |
22447 |
++ if (ret < 0) { |
22448 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22449 |
+ return ret; |
22450 |
++ } |
22451 |
+ |
22452 |
+ if (is_support_sw_smu(adev)) |
22453 |
+ size = smu_print_clk_levels(&adev->smu, SMU_MCLK, buf); |
22454 |
+@@ -1135,8 +1167,10 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev, |
22455 |
+ return ret; |
22456 |
+ |
22457 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22458 |
+- if (ret < 0) |
22459 |
++ if (ret < 0) { |
22460 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22461 |
+ return ret; |
22462 |
++ } |
22463 |
+ |
22464 |
+ if (is_support_sw_smu(adev)) |
22465 |
+ ret = smu_force_clk_levels(&adev->smu, SMU_MCLK, mask, true); |
22466 |
+@@ -1165,8 +1199,10 @@ static ssize_t amdgpu_get_pp_dpm_socclk(struct device *dev, |
22467 |
+ return -EPERM; |
22468 |
+ |
22469 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22470 |
+- if (ret < 0) |
22471 |
++ if (ret < 0) { |
22472 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22473 |
+ return ret; |
22474 |
++ } |
22475 |
+ |
22476 |
+ if (is_support_sw_smu(adev)) |
22477 |
+ size = smu_print_clk_levels(&adev->smu, SMU_SOCCLK, buf); |
22478 |
+@@ -1199,8 +1235,10 @@ static ssize_t amdgpu_set_pp_dpm_socclk(struct device *dev, |
22479 |
+ return ret; |
22480 |
+ |
22481 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22482 |
+- if (ret < 0) |
22483 |
++ if (ret < 0) { |
22484 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22485 |
+ return ret; |
22486 |
++ } |
22487 |
+ |
22488 |
+ if (is_support_sw_smu(adev)) |
22489 |
+ ret = smu_force_clk_levels(&adev->smu, SMU_SOCCLK, mask, true); |
22490 |
+@@ -1231,8 +1269,10 @@ static ssize_t amdgpu_get_pp_dpm_fclk(struct device *dev, |
22491 |
+ return -EPERM; |
22492 |
+ |
22493 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22494 |
+- if (ret < 0) |
22495 |
++ if (ret < 0) { |
22496 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22497 |
+ return ret; |
22498 |
++ } |
22499 |
+ |
22500 |
+ if (is_support_sw_smu(adev)) |
22501 |
+ size = smu_print_clk_levels(&adev->smu, SMU_FCLK, buf); |
22502 |
+@@ -1265,8 +1305,10 @@ static ssize_t amdgpu_set_pp_dpm_fclk(struct device *dev, |
22503 |
+ return ret; |
22504 |
+ |
22505 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22506 |
+- if (ret < 0) |
22507 |
++ if (ret < 0) { |
22508 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22509 |
+ return ret; |
22510 |
++ } |
22511 |
+ |
22512 |
+ if (is_support_sw_smu(adev)) |
22513 |
+ ret = smu_force_clk_levels(&adev->smu, SMU_FCLK, mask, true); |
22514 |
+@@ -1297,8 +1339,10 @@ static ssize_t amdgpu_get_pp_dpm_dcefclk(struct device *dev, |
22515 |
+ return -EPERM; |
22516 |
+ |
22517 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22518 |
+- if (ret < 0) |
22519 |
++ if (ret < 0) { |
22520 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22521 |
+ return ret; |
22522 |
++ } |
22523 |
+ |
22524 |
+ if (is_support_sw_smu(adev)) |
22525 |
+ size = smu_print_clk_levels(&adev->smu, SMU_DCEFCLK, buf); |
22526 |
+@@ -1331,8 +1375,10 @@ static ssize_t amdgpu_set_pp_dpm_dcefclk(struct device *dev, |
22527 |
+ return ret; |
22528 |
+ |
22529 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22530 |
+- if (ret < 0) |
22531 |
++ if (ret < 0) { |
22532 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22533 |
+ return ret; |
22534 |
++ } |
22535 |
+ |
22536 |
+ if (is_support_sw_smu(adev)) |
22537 |
+ ret = smu_force_clk_levels(&adev->smu, SMU_DCEFCLK, mask, true); |
22538 |
+@@ -1363,8 +1409,10 @@ static ssize_t amdgpu_get_pp_dpm_pcie(struct device *dev, |
22539 |
+ return -EPERM; |
22540 |
+ |
22541 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22542 |
+- if (ret < 0) |
22543 |
++ if (ret < 0) { |
22544 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22545 |
+ return ret; |
22546 |
++ } |
22547 |
+ |
22548 |
+ if (is_support_sw_smu(adev)) |
22549 |
+ size = smu_print_clk_levels(&adev->smu, SMU_PCIE, buf); |
22550 |
+@@ -1397,8 +1445,10 @@ static ssize_t amdgpu_set_pp_dpm_pcie(struct device *dev, |
22551 |
+ return ret; |
22552 |
+ |
22553 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22554 |
+- if (ret < 0) |
22555 |
++ if (ret < 0) { |
22556 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22557 |
+ return ret; |
22558 |
++ } |
22559 |
+ |
22560 |
+ if (is_support_sw_smu(adev)) |
22561 |
+ ret = smu_force_clk_levels(&adev->smu, SMU_PCIE, mask, true); |
22562 |
+@@ -1429,8 +1479,10 @@ static ssize_t amdgpu_get_pp_sclk_od(struct device *dev, |
22563 |
+ return -EPERM; |
22564 |
+ |
22565 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22566 |
+- if (ret < 0) |
22567 |
++ if (ret < 0) { |
22568 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22569 |
+ return ret; |
22570 |
++ } |
22571 |
+ |
22572 |
+ if (is_support_sw_smu(adev)) |
22573 |
+ value = smu_get_od_percentage(&(adev->smu), SMU_OD_SCLK); |
22574 |
+@@ -1462,8 +1514,10 @@ static ssize_t amdgpu_set_pp_sclk_od(struct device *dev, |
22575 |
+ return -EINVAL; |
22576 |
+ |
22577 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22578 |
+- if (ret < 0) |
22579 |
++ if (ret < 0) { |
22580 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22581 |
+ return ret; |
22582 |
++ } |
22583 |
+ |
22584 |
+ if (is_support_sw_smu(adev)) { |
22585 |
+ value = smu_set_od_percentage(&(adev->smu), SMU_OD_SCLK, (uint32_t)value); |
22586 |
+@@ -1498,8 +1552,10 @@ static ssize_t amdgpu_get_pp_mclk_od(struct device *dev, |
22587 |
+ return -EPERM; |
22588 |
+ |
22589 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22590 |
+- if (ret < 0) |
22591 |
++ if (ret < 0) { |
22592 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22593 |
+ return ret; |
22594 |
++ } |
22595 |
+ |
22596 |
+ if (is_support_sw_smu(adev)) |
22597 |
+ value = smu_get_od_percentage(&(adev->smu), SMU_OD_MCLK); |
22598 |
+@@ -1531,8 +1587,10 @@ static ssize_t amdgpu_set_pp_mclk_od(struct device *dev, |
22599 |
+ return -EINVAL; |
22600 |
+ |
22601 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22602 |
+- if (ret < 0) |
22603 |
++ if (ret < 0) { |
22604 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22605 |
+ return ret; |
22606 |
++ } |
22607 |
+ |
22608 |
+ if (is_support_sw_smu(adev)) { |
22609 |
+ value = smu_set_od_percentage(&(adev->smu), SMU_OD_MCLK, (uint32_t)value); |
22610 |
+@@ -1587,8 +1645,10 @@ static ssize_t amdgpu_get_pp_power_profile_mode(struct device *dev, |
22611 |
+ return -EPERM; |
22612 |
+ |
22613 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22614 |
+- if (ret < 0) |
22615 |
++ if (ret < 0) { |
22616 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22617 |
+ return ret; |
22618 |
++ } |
22619 |
+ |
22620 |
+ if (is_support_sw_smu(adev)) |
22621 |
+ size = smu_get_power_profile_mode(&adev->smu, buf); |
22622 |
+@@ -1650,8 +1710,10 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, |
22623 |
+ parameter[parameter_size] = profile_mode; |
22624 |
+ |
22625 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22626 |
+- if (ret < 0) |
22627 |
++ if (ret < 0) { |
22628 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22629 |
+ return ret; |
22630 |
++ } |
22631 |
+ |
22632 |
+ if (is_support_sw_smu(adev)) |
22633 |
+ ret = smu_set_power_profile_mode(&adev->smu, parameter, parameter_size, true); |
22634 |
+@@ -1687,8 +1749,10 @@ static ssize_t amdgpu_get_gpu_busy_percent(struct device *dev, |
22635 |
+ return -EPERM; |
22636 |
+ |
22637 |
+ r = pm_runtime_get_sync(ddev->dev); |
22638 |
+- if (r < 0) |
22639 |
++ if (r < 0) { |
22640 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22641 |
+ return r; |
22642 |
++ } |
22643 |
+ |
22644 |
+ /* read the IP busy sensor */ |
22645 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_LOAD, |
22646 |
+@@ -1723,8 +1787,10 @@ static ssize_t amdgpu_get_mem_busy_percent(struct device *dev, |
22647 |
+ return -EPERM; |
22648 |
+ |
22649 |
+ r = pm_runtime_get_sync(ddev->dev); |
22650 |
+- if (r < 0) |
22651 |
++ if (r < 0) { |
22652 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22653 |
+ return r; |
22654 |
++ } |
22655 |
+ |
22656 |
+ /* read the IP busy sensor */ |
22657 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_MEM_LOAD, |
22658 |
+@@ -1770,8 +1836,10 @@ static ssize_t amdgpu_get_pcie_bw(struct device *dev, |
22659 |
+ return -ENODATA; |
22660 |
+ |
22661 |
+ ret = pm_runtime_get_sync(ddev->dev); |
22662 |
+- if (ret < 0) |
22663 |
++ if (ret < 0) { |
22664 |
++ pm_runtime_put_autosuspend(ddev->dev); |
22665 |
+ return ret; |
22666 |
++ } |
22667 |
+ |
22668 |
+ amdgpu_asic_get_pcie_usage(adev, &count0, &count1); |
22669 |
+ |
22670 |
+@@ -2003,8 +2071,10 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev, |
22671 |
+ return -EINVAL; |
22672 |
+ |
22673 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22674 |
+- if (r < 0) |
22675 |
++ if (r < 0) { |
22676 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22677 |
+ return r; |
22678 |
++ } |
22679 |
+ |
22680 |
+ switch (channel) { |
22681 |
+ case PP_TEMP_JUNCTION: |
22682 |
+@@ -2134,8 +2204,10 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev, |
22683 |
+ return -EPERM; |
22684 |
+ |
22685 |
+ ret = pm_runtime_get_sync(adev->ddev->dev); |
22686 |
+- if (ret < 0) |
22687 |
++ if (ret < 0) { |
22688 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22689 |
+ return ret; |
22690 |
++ } |
22691 |
+ |
22692 |
+ if (is_support_sw_smu(adev)) { |
22693 |
+ pwm_mode = smu_get_fan_control_mode(&adev->smu); |
22694 |
+@@ -2172,8 +2244,10 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev, |
22695 |
+ return err; |
22696 |
+ |
22697 |
+ ret = pm_runtime_get_sync(adev->ddev->dev); |
22698 |
+- if (ret < 0) |
22699 |
++ if (ret < 0) { |
22700 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22701 |
+ return ret; |
22702 |
++ } |
22703 |
+ |
22704 |
+ if (is_support_sw_smu(adev)) { |
22705 |
+ smu_set_fan_control_mode(&adev->smu, value); |
22706 |
+@@ -2220,8 +2294,10 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev, |
22707 |
+ return -EPERM; |
22708 |
+ |
22709 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22710 |
+- if (err < 0) |
22711 |
++ if (err < 0) { |
22712 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22713 |
+ return err; |
22714 |
++ } |
22715 |
+ |
22716 |
+ if (is_support_sw_smu(adev)) |
22717 |
+ pwm_mode = smu_get_fan_control_mode(&adev->smu); |
22718 |
+@@ -2272,8 +2348,10 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev, |
22719 |
+ return -EPERM; |
22720 |
+ |
22721 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22722 |
+- if (err < 0) |
22723 |
++ if (err < 0) { |
22724 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22725 |
+ return err; |
22726 |
++ } |
22727 |
+ |
22728 |
+ if (is_support_sw_smu(adev)) |
22729 |
+ err = smu_get_fan_speed_percent(&adev->smu, &speed); |
22730 |
+@@ -2305,8 +2383,10 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, |
22731 |
+ return -EPERM; |
22732 |
+ |
22733 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22734 |
+- if (err < 0) |
22735 |
++ if (err < 0) { |
22736 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22737 |
+ return err; |
22738 |
++ } |
22739 |
+ |
22740 |
+ if (is_support_sw_smu(adev)) |
22741 |
+ err = smu_get_fan_speed_rpm(&adev->smu, &speed); |
22742 |
+@@ -2337,8 +2417,10 @@ static ssize_t amdgpu_hwmon_get_fan1_min(struct device *dev, |
22743 |
+ return -EPERM; |
22744 |
+ |
22745 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22746 |
+- if (r < 0) |
22747 |
++ if (r < 0) { |
22748 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22749 |
+ return r; |
22750 |
++ } |
22751 |
+ |
22752 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_MIN_FAN_RPM, |
22753 |
+ (void *)&min_rpm, &size); |
22754 |
+@@ -2365,8 +2447,10 @@ static ssize_t amdgpu_hwmon_get_fan1_max(struct device *dev, |
22755 |
+ return -EPERM; |
22756 |
+ |
22757 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22758 |
+- if (r < 0) |
22759 |
++ if (r < 0) { |
22760 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22761 |
+ return r; |
22762 |
++ } |
22763 |
+ |
22764 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_MAX_FAN_RPM, |
22765 |
+ (void *)&max_rpm, &size); |
22766 |
+@@ -2392,8 +2476,10 @@ static ssize_t amdgpu_hwmon_get_fan1_target(struct device *dev, |
22767 |
+ return -EPERM; |
22768 |
+ |
22769 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22770 |
+- if (err < 0) |
22771 |
++ if (err < 0) { |
22772 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22773 |
+ return err; |
22774 |
++ } |
22775 |
+ |
22776 |
+ if (is_support_sw_smu(adev)) |
22777 |
+ err = smu_get_fan_speed_rpm(&adev->smu, &rpm); |
22778 |
+@@ -2424,8 +2510,10 @@ static ssize_t amdgpu_hwmon_set_fan1_target(struct device *dev, |
22779 |
+ return -EPERM; |
22780 |
+ |
22781 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22782 |
+- if (err < 0) |
22783 |
++ if (err < 0) { |
22784 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22785 |
+ return err; |
22786 |
++ } |
22787 |
+ |
22788 |
+ if (is_support_sw_smu(adev)) |
22789 |
+ pwm_mode = smu_get_fan_control_mode(&adev->smu); |
22790 |
+@@ -2473,8 +2561,10 @@ static ssize_t amdgpu_hwmon_get_fan1_enable(struct device *dev, |
22791 |
+ return -EPERM; |
22792 |
+ |
22793 |
+ ret = pm_runtime_get_sync(adev->ddev->dev); |
22794 |
+- if (ret < 0) |
22795 |
++ if (ret < 0) { |
22796 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22797 |
+ return ret; |
22798 |
++ } |
22799 |
+ |
22800 |
+ if (is_support_sw_smu(adev)) { |
22801 |
+ pwm_mode = smu_get_fan_control_mode(&adev->smu); |
22802 |
+@@ -2519,8 +2609,10 @@ static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev, |
22803 |
+ return -EINVAL; |
22804 |
+ |
22805 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22806 |
+- if (err < 0) |
22807 |
++ if (err < 0) { |
22808 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22809 |
+ return err; |
22810 |
++ } |
22811 |
+ |
22812 |
+ if (is_support_sw_smu(adev)) { |
22813 |
+ smu_set_fan_control_mode(&adev->smu, pwm_mode); |
22814 |
+@@ -2551,8 +2643,10 @@ static ssize_t amdgpu_hwmon_show_vddgfx(struct device *dev, |
22815 |
+ return -EPERM; |
22816 |
+ |
22817 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22818 |
+- if (r < 0) |
22819 |
++ if (r < 0) { |
22820 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22821 |
+ return r; |
22822 |
++ } |
22823 |
+ |
22824 |
+ /* get the voltage */ |
22825 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDGFX, |
22826 |
+@@ -2590,8 +2684,10 @@ static ssize_t amdgpu_hwmon_show_vddnb(struct device *dev, |
22827 |
+ return -EINVAL; |
22828 |
+ |
22829 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22830 |
+- if (r < 0) |
22831 |
++ if (r < 0) { |
22832 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22833 |
+ return r; |
22834 |
++ } |
22835 |
+ |
22836 |
+ /* get the voltage */ |
22837 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VDDNB, |
22838 |
+@@ -2626,8 +2722,10 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev, |
22839 |
+ return -EPERM; |
22840 |
+ |
22841 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22842 |
+- if (r < 0) |
22843 |
++ if (r < 0) { |
22844 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22845 |
+ return r; |
22846 |
++ } |
22847 |
+ |
22848 |
+ /* get the voltage */ |
22849 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_POWER, |
22850 |
+@@ -2665,8 +2763,10 @@ static ssize_t amdgpu_hwmon_show_power_cap_max(struct device *dev, |
22851 |
+ return -EPERM; |
22852 |
+ |
22853 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22854 |
+- if (r < 0) |
22855 |
++ if (r < 0) { |
22856 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22857 |
+ return r; |
22858 |
++ } |
22859 |
+ |
22860 |
+ if (is_support_sw_smu(adev)) { |
22861 |
+ smu_get_power_limit(&adev->smu, &limit, true, true); |
22862 |
+@@ -2697,8 +2797,10 @@ static ssize_t amdgpu_hwmon_show_power_cap(struct device *dev, |
22863 |
+ return -EPERM; |
22864 |
+ |
22865 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22866 |
+- if (r < 0) |
22867 |
++ if (r < 0) { |
22868 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22869 |
+ return r; |
22870 |
++ } |
22871 |
+ |
22872 |
+ if (is_support_sw_smu(adev)) { |
22873 |
+ smu_get_power_limit(&adev->smu, &limit, false, true); |
22874 |
+@@ -2740,8 +2842,10 @@ static ssize_t amdgpu_hwmon_set_power_cap(struct device *dev, |
22875 |
+ |
22876 |
+ |
22877 |
+ err = pm_runtime_get_sync(adev->ddev->dev); |
22878 |
+- if (err < 0) |
22879 |
++ if (err < 0) { |
22880 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22881 |
+ return err; |
22882 |
++ } |
22883 |
+ |
22884 |
+ if (is_support_sw_smu(adev)) |
22885 |
+ err = smu_set_power_limit(&adev->smu, value); |
22886 |
+@@ -2771,8 +2875,10 @@ static ssize_t amdgpu_hwmon_show_sclk(struct device *dev, |
22887 |
+ return -EPERM; |
22888 |
+ |
22889 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22890 |
+- if (r < 0) |
22891 |
++ if (r < 0) { |
22892 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22893 |
+ return r; |
22894 |
++ } |
22895 |
+ |
22896 |
+ /* get the sclk */ |
22897 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GFX_SCLK, |
22898 |
+@@ -2806,8 +2912,10 @@ static ssize_t amdgpu_hwmon_show_mclk(struct device *dev, |
22899 |
+ return -EPERM; |
22900 |
+ |
22901 |
+ r = pm_runtime_get_sync(adev->ddev->dev); |
22902 |
+- if (r < 0) |
22903 |
++ if (r < 0) { |
22904 |
++ pm_runtime_put_autosuspend(adev->ddev->dev); |
22905 |
+ return r; |
22906 |
++ } |
22907 |
+ |
22908 |
+ /* get the sclk */ |
22909 |
+ r = amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GFX_MCLK, |
22910 |
+@@ -3669,8 +3777,10 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data) |
22911 |
+ return -EPERM; |
22912 |
+ |
22913 |
+ r = pm_runtime_get_sync(dev->dev); |
22914 |
+- if (r < 0) |
22915 |
++ if (r < 0) { |
22916 |
++ pm_runtime_put_autosuspend(dev->dev); |
22917 |
+ return r; |
22918 |
++ } |
22919 |
+ |
22920 |
+ amdgpu_device_ip_get_clockgating_state(adev, &flags); |
22921 |
+ seq_printf(m, "Clock Gating Flags Mask: 0x%x\n", flags); |
22922 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c |
22923 |
+index 50fe08bf2f727..3f47f35eedff1 100644 |
22924 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c |
22925 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c |
22926 |
+@@ -1240,7 +1240,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev, |
22927 |
+ if (!obj || !obj->ent) |
22928 |
+ return; |
22929 |
+ |
22930 |
+- debugfs_remove(obj->ent); |
22931 |
+ obj->ent = NULL; |
22932 |
+ put_obj(obj); |
22933 |
+ } |
22934 |
+@@ -1254,7 +1253,6 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev) |
22935 |
+ amdgpu_ras_debugfs_remove(adev, &obj->head); |
22936 |
+ } |
22937 |
+ |
22938 |
+- debugfs_remove_recursive(con->dir); |
22939 |
+ con->dir = NULL; |
22940 |
+ } |
22941 |
+ /* debugfs end */ |
22942 |
+@@ -1914,9 +1912,8 @@ int amdgpu_ras_init(struct amdgpu_device *adev) |
22943 |
+ amdgpu_ras_check_supported(adev, &con->hw_supported, |
22944 |
+ &con->supported); |
22945 |
+ if (!con->hw_supported) { |
22946 |
+- amdgpu_ras_set_context(adev, NULL); |
22947 |
+- kfree(con); |
22948 |
+- return 0; |
22949 |
++ r = 0; |
22950 |
++ goto err_out; |
22951 |
+ } |
22952 |
+ |
22953 |
+ con->features = 0; |
22954 |
+@@ -1927,29 +1924,31 @@ int amdgpu_ras_init(struct amdgpu_device *adev) |
22955 |
+ if (adev->nbio.funcs->init_ras_controller_interrupt) { |
22956 |
+ r = adev->nbio.funcs->init_ras_controller_interrupt(adev); |
22957 |
+ if (r) |
22958 |
+- return r; |
22959 |
++ goto err_out; |
22960 |
+ } |
22961 |
+ |
22962 |
+ if (adev->nbio.funcs->init_ras_err_event_athub_interrupt) { |
22963 |
+ r = adev->nbio.funcs->init_ras_err_event_athub_interrupt(adev); |
22964 |
+ if (r) |
22965 |
+- return r; |
22966 |
++ goto err_out; |
22967 |
+ } |
22968 |
+ |
22969 |
+ amdgpu_ras_mask &= AMDGPU_RAS_BLOCK_MASK; |
22970 |
+ |
22971 |
+- if (amdgpu_ras_fs_init(adev)) |
22972 |
+- goto fs_out; |
22973 |
++ if (amdgpu_ras_fs_init(adev)) { |
22974 |
++ r = -EINVAL; |
22975 |
++ goto err_out; |
22976 |
++ } |
22977 |
+ |
22978 |
+ dev_info(adev->dev, "RAS INFO: ras initialized successfully, " |
22979 |
+ "hardware ability[%x] ras_mask[%x]\n", |
22980 |
+ con->hw_supported, con->supported); |
22981 |
+ return 0; |
22982 |
+-fs_out: |
22983 |
++err_out: |
22984 |
+ amdgpu_ras_set_context(adev, NULL); |
22985 |
+ kfree(con); |
22986 |
+ |
22987 |
+- return -EINVAL; |
22988 |
++ return r; |
22989 |
+ } |
22990 |
+ |
22991 |
+ /* helper function to handle common stuff in ip late init phase */ |
22992 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
22993 |
+index fac77a86c04b2..2c7e6efeea2ff 100644 |
22994 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
22995 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |
22996 |
+@@ -6854,10 +6854,8 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *ade |
22997 |
+ def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE); |
22998 |
+ data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK | |
22999 |
+ RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK | |
23000 |
+- RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK); |
23001 |
+- |
23002 |
+- /* only for Vega10 & Raven1 */ |
23003 |
+- data |= RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK; |
23004 |
++ RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK | |
23005 |
++ RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK); |
23006 |
+ |
23007 |
+ if (def != data) |
23008 |
+ WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data); |
23009 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c |
23010 |
+index 0e0c42e9f6a31..6520a920cad4a 100644 |
23011 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c |
23012 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c |
23013 |
+@@ -1003,8 +1003,10 @@ struct kfd_process_device *kfd_bind_process_to_device(struct kfd_dev *dev, |
23014 |
+ */ |
23015 |
+ if (!pdd->runtime_inuse) { |
23016 |
+ err = pm_runtime_get_sync(dev->ddev->dev); |
23017 |
+- if (err < 0) |
23018 |
++ if (err < 0) { |
23019 |
++ pm_runtime_put_autosuspend(dev->ddev->dev); |
23020 |
+ return ERR_PTR(err); |
23021 |
++ } |
23022 |
+ } |
23023 |
+ |
23024 |
+ err = kfd_iommu_bind_process_to_device(pdd); |
23025 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
23026 |
+index bb77f7af2b6d9..dc3c4149f8600 100644 |
23027 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
23028 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c |
23029 |
+@@ -632,8 +632,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev, |
23030 |
+ |
23031 |
+ ret = kobject_init_and_add(dev->kobj_node, &node_type, |
23032 |
+ sys_props.kobj_nodes, "%d", id); |
23033 |
+- if (ret < 0) |
23034 |
++ if (ret < 0) { |
23035 |
++ kobject_put(dev->kobj_node); |
23036 |
+ return ret; |
23037 |
++ } |
23038 |
+ |
23039 |
+ dev->kobj_mem = kobject_create_and_add("mem_banks", dev->kobj_node); |
23040 |
+ if (!dev->kobj_mem) |
23041 |
+@@ -680,8 +682,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev, |
23042 |
+ return -ENOMEM; |
23043 |
+ ret = kobject_init_and_add(mem->kobj, &mem_type, |
23044 |
+ dev->kobj_mem, "%d", i); |
23045 |
+- if (ret < 0) |
23046 |
++ if (ret < 0) { |
23047 |
++ kobject_put(mem->kobj); |
23048 |
+ return ret; |
23049 |
++ } |
23050 |
+ |
23051 |
+ mem->attr.name = "properties"; |
23052 |
+ mem->attr.mode = KFD_SYSFS_FILE_MODE; |
23053 |
+@@ -699,8 +703,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev, |
23054 |
+ return -ENOMEM; |
23055 |
+ ret = kobject_init_and_add(cache->kobj, &cache_type, |
23056 |
+ dev->kobj_cache, "%d", i); |
23057 |
+- if (ret < 0) |
23058 |
++ if (ret < 0) { |
23059 |
++ kobject_put(cache->kobj); |
23060 |
+ return ret; |
23061 |
++ } |
23062 |
+ |
23063 |
+ cache->attr.name = "properties"; |
23064 |
+ cache->attr.mode = KFD_SYSFS_FILE_MODE; |
23065 |
+@@ -718,8 +724,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev, |
23066 |
+ return -ENOMEM; |
23067 |
+ ret = kobject_init_and_add(iolink->kobj, &iolink_type, |
23068 |
+ dev->kobj_iolink, "%d", i); |
23069 |
+- if (ret < 0) |
23070 |
++ if (ret < 0) { |
23071 |
++ kobject_put(iolink->kobj); |
23072 |
+ return ret; |
23073 |
++ } |
23074 |
+ |
23075 |
+ iolink->attr.name = "properties"; |
23076 |
+ iolink->attr.mode = KFD_SYSFS_FILE_MODE; |
23077 |
+@@ -798,8 +806,10 @@ static int kfd_topology_update_sysfs(void) |
23078 |
+ ret = kobject_init_and_add(sys_props.kobj_topology, |
23079 |
+ &sysprops_type, &kfd_device->kobj, |
23080 |
+ "topology"); |
23081 |
+- if (ret < 0) |
23082 |
++ if (ret < 0) { |
23083 |
++ kobject_put(sys_props.kobj_topology); |
23084 |
+ return ret; |
23085 |
++ } |
23086 |
+ |
23087 |
+ sys_props.kobj_nodes = kobject_create_and_add("nodes", |
23088 |
+ sys_props.kobj_topology); |
23089 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
23090 |
+index 0a39a8558b294..666ebe04837af 100644 |
23091 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
23092 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
23093 |
+@@ -2882,51 +2882,50 @@ static int set_backlight_via_aux(struct dc_link *link, uint32_t brightness) |
23094 |
+ return rc ? 0 : 1; |
23095 |
+ } |
23096 |
+ |
23097 |
+-static u32 convert_brightness(const struct amdgpu_dm_backlight_caps *caps, |
23098 |
+- const uint32_t user_brightness) |
23099 |
++static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps, |
23100 |
++ unsigned *min, unsigned *max) |
23101 |
+ { |
23102 |
+- u32 min, max, conversion_pace; |
23103 |
+- u32 brightness = user_brightness; |
23104 |
+- |
23105 |
+ if (!caps) |
23106 |
+- goto out; |
23107 |
++ return 0; |
23108 |
+ |
23109 |
+- if (!caps->aux_support) { |
23110 |
+- max = caps->max_input_signal; |
23111 |
+- min = caps->min_input_signal; |
23112 |
+- /* |
23113 |
+- * The brightness input is in the range 0-255 |
23114 |
+- * It needs to be rescaled to be between the |
23115 |
+- * requested min and max input signal |
23116 |
+- * It also needs to be scaled up by 0x101 to |
23117 |
+- * match the DC interface which has a range of |
23118 |
+- * 0 to 0xffff |
23119 |
+- */ |
23120 |
+- conversion_pace = 0x101; |
23121 |
+- brightness = |
23122 |
+- user_brightness |
23123 |
+- * conversion_pace |
23124 |
+- * (max - min) |
23125 |
+- / AMDGPU_MAX_BL_LEVEL |
23126 |
+- + min * conversion_pace; |
23127 |
++ if (caps->aux_support) { |
23128 |
++ // Firmware limits are in nits, DC API wants millinits. |
23129 |
++ *max = 1000 * caps->aux_max_input_signal; |
23130 |
++ *min = 1000 * caps->aux_min_input_signal; |
23131 |
+ } else { |
23132 |
+- /* TODO |
23133 |
+- * We are doing a linear interpolation here, which is OK but |
23134 |
+- * does not provide the optimal result. We probably want |
23135 |
+- * something close to the Perceptual Quantizer (PQ) curve. |
23136 |
+- */ |
23137 |
+- max = caps->aux_max_input_signal; |
23138 |
+- min = caps->aux_min_input_signal; |
23139 |
+- |
23140 |
+- brightness = (AMDGPU_MAX_BL_LEVEL - user_brightness) * min |
23141 |
+- + user_brightness * max; |
23142 |
+- // Multiple the value by 1000 since we use millinits |
23143 |
+- brightness *= 1000; |
23144 |
+- brightness = DIV_ROUND_CLOSEST(brightness, AMDGPU_MAX_BL_LEVEL); |
23145 |
++ // Firmware limits are 8-bit, PWM control is 16-bit. |
23146 |
++ *max = 0x101 * caps->max_input_signal; |
23147 |
++ *min = 0x101 * caps->min_input_signal; |
23148 |
+ } |
23149 |
++ return 1; |
23150 |
++} |
23151 |
++ |
23152 |
++static u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps, |
23153 |
++ uint32_t brightness) |
23154 |
++{ |
23155 |
++ unsigned min, max; |
23156 |
+ |
23157 |
+-out: |
23158 |
+- return brightness; |
23159 |
++ if (!get_brightness_range(caps, &min, &max)) |
23160 |
++ return brightness; |
23161 |
++ |
23162 |
++ // Rescale 0..255 to min..max |
23163 |
++ return min + DIV_ROUND_CLOSEST((max - min) * brightness, |
23164 |
++ AMDGPU_MAX_BL_LEVEL); |
23165 |
++} |
23166 |
++ |
23167 |
++static u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps, |
23168 |
++ uint32_t brightness) |
23169 |
++{ |
23170 |
++ unsigned min, max; |
23171 |
++ |
23172 |
++ if (!get_brightness_range(caps, &min, &max)) |
23173 |
++ return brightness; |
23174 |
++ |
23175 |
++ if (brightness < min) |
23176 |
++ return 0; |
23177 |
++ // Rescale min..max to 0..255 |
23178 |
++ return DIV_ROUND_CLOSEST(AMDGPU_MAX_BL_LEVEL * (brightness - min), |
23179 |
++ max - min); |
23180 |
+ } |
23181 |
+ |
23182 |
+ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) |
23183 |
+@@ -2942,7 +2941,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) |
23184 |
+ |
23185 |
+ link = (struct dc_link *)dm->backlight_link; |
23186 |
+ |
23187 |
+- brightness = convert_brightness(&caps, bd->props.brightness); |
23188 |
++ brightness = convert_brightness_from_user(&caps, bd->props.brightness); |
23189 |
+ // Change brightness based on AUX property |
23190 |
+ if (caps.aux_support) |
23191 |
+ return set_backlight_via_aux(link, brightness); |
23192 |
+@@ -2959,7 +2958,7 @@ static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd) |
23193 |
+ |
23194 |
+ if (ret == DC_ERROR_UNEXPECTED) |
23195 |
+ return bd->props.brightness; |
23196 |
+- return ret; |
23197 |
++ return convert_brightness_to_user(&dm->backlight_caps, ret); |
23198 |
+ } |
23199 |
+ |
23200 |
+ static const struct backlight_ops amdgpu_dm_backlight_ops = { |
23201 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c |
23202 |
+index 4dfb6b55bb2ed..b321ff654df42 100644 |
23203 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c |
23204 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c |
23205 |
+@@ -195,10 +195,13 @@ static int __set_legacy_tf(struct dc_transfer_func *func, |
23206 |
+ bool has_rom) |
23207 |
+ { |
23208 |
+ struct dc_gamma *gamma = NULL; |
23209 |
++ struct calculate_buffer cal_buffer = {0}; |
23210 |
+ bool res; |
23211 |
+ |
23212 |
+ ASSERT(lut && lut_size == MAX_COLOR_LEGACY_LUT_ENTRIES); |
23213 |
+ |
23214 |
++ cal_buffer.buffer_index = -1; |
23215 |
++ |
23216 |
+ gamma = dc_create_gamma(); |
23217 |
+ if (!gamma) |
23218 |
+ return -ENOMEM; |
23219 |
+@@ -208,7 +211,7 @@ static int __set_legacy_tf(struct dc_transfer_func *func, |
23220 |
+ __drm_lut_to_dc_gamma(lut, gamma, true); |
23221 |
+ |
23222 |
+ res = mod_color_calculate_regamma_params(func, gamma, true, has_rom, |
23223 |
+- NULL); |
23224 |
++ NULL, &cal_buffer); |
23225 |
+ |
23226 |
+ dc_gamma_release(&gamma); |
23227 |
+ |
23228 |
+@@ -221,10 +224,13 @@ static int __set_output_tf(struct dc_transfer_func *func, |
23229 |
+ bool has_rom) |
23230 |
+ { |
23231 |
+ struct dc_gamma *gamma = NULL; |
23232 |
++ struct calculate_buffer cal_buffer = {0}; |
23233 |
+ bool res; |
23234 |
+ |
23235 |
+ ASSERT(lut && lut_size == MAX_COLOR_LUT_ENTRIES); |
23236 |
+ |
23237 |
++ cal_buffer.buffer_index = -1; |
23238 |
++ |
23239 |
+ gamma = dc_create_gamma(); |
23240 |
+ if (!gamma) |
23241 |
+ return -ENOMEM; |
23242 |
+@@ -248,7 +254,7 @@ static int __set_output_tf(struct dc_transfer_func *func, |
23243 |
+ */ |
23244 |
+ gamma->type = GAMMA_CS_TFM_1D; |
23245 |
+ res = mod_color_calculate_regamma_params(func, gamma, false, |
23246 |
+- has_rom, NULL); |
23247 |
++ has_rom, NULL, &cal_buffer); |
23248 |
+ } |
23249 |
+ |
23250 |
+ dc_gamma_release(&gamma); |
23251 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c |
23252 |
+index 07b2f9399671d..842abb4c475bc 100644 |
23253 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c |
23254 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c |
23255 |
+@@ -121,35 +121,35 @@ void enc1_update_generic_info_packet( |
23256 |
+ switch (packet_index) { |
23257 |
+ case 0: |
23258 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23259 |
+- AFMT_GENERIC0_FRAME_UPDATE, 1); |
23260 |
++ AFMT_GENERIC0_IMMEDIATE_UPDATE, 1); |
23261 |
+ break; |
23262 |
+ case 1: |
23263 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23264 |
+- AFMT_GENERIC1_FRAME_UPDATE, 1); |
23265 |
++ AFMT_GENERIC1_IMMEDIATE_UPDATE, 1); |
23266 |
+ break; |
23267 |
+ case 2: |
23268 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23269 |
+- AFMT_GENERIC2_FRAME_UPDATE, 1); |
23270 |
++ AFMT_GENERIC2_IMMEDIATE_UPDATE, 1); |
23271 |
+ break; |
23272 |
+ case 3: |
23273 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23274 |
+- AFMT_GENERIC3_FRAME_UPDATE, 1); |
23275 |
++ AFMT_GENERIC3_IMMEDIATE_UPDATE, 1); |
23276 |
+ break; |
23277 |
+ case 4: |
23278 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23279 |
+- AFMT_GENERIC4_FRAME_UPDATE, 1); |
23280 |
++ AFMT_GENERIC4_IMMEDIATE_UPDATE, 1); |
23281 |
+ break; |
23282 |
+ case 5: |
23283 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23284 |
+- AFMT_GENERIC5_FRAME_UPDATE, 1); |
23285 |
++ AFMT_GENERIC5_IMMEDIATE_UPDATE, 1); |
23286 |
+ break; |
23287 |
+ case 6: |
23288 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23289 |
+- AFMT_GENERIC6_FRAME_UPDATE, 1); |
23290 |
++ AFMT_GENERIC6_IMMEDIATE_UPDATE, 1); |
23291 |
+ break; |
23292 |
+ case 7: |
23293 |
+ REG_UPDATE(AFMT_VBI_PACKET_CONTROL1, |
23294 |
+- AFMT_GENERIC7_FRAME_UPDATE, 1); |
23295 |
++ AFMT_GENERIC7_IMMEDIATE_UPDATE, 1); |
23296 |
+ break; |
23297 |
+ default: |
23298 |
+ break; |
23299 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h |
23300 |
+index f9b9e221c698b..7507000a99ac4 100644 |
23301 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h |
23302 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h |
23303 |
+@@ -273,7 +273,14 @@ struct dcn10_stream_enc_registers { |
23304 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC2_FRAME_UPDATE, mask_sh),\ |
23305 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC3_FRAME_UPDATE, mask_sh),\ |
23306 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC4_FRAME_UPDATE, mask_sh),\ |
23307 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC0_IMMEDIATE_UPDATE, mask_sh),\ |
23308 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC1_IMMEDIATE_UPDATE, mask_sh),\ |
23309 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC2_IMMEDIATE_UPDATE, mask_sh),\ |
23310 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC3_IMMEDIATE_UPDATE, mask_sh),\ |
23311 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC4_IMMEDIATE_UPDATE, mask_sh),\ |
23312 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC5_IMMEDIATE_UPDATE, mask_sh),\ |
23313 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC6_IMMEDIATE_UPDATE, mask_sh),\ |
23314 |
++ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC7_IMMEDIATE_UPDATE, mask_sh),\ |
23315 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC5_FRAME_UPDATE, mask_sh),\ |
23316 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC6_FRAME_UPDATE, mask_sh),\ |
23317 |
+ SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC7_FRAME_UPDATE, mask_sh),\ |
23318 |
+@@ -337,7 +344,14 @@ struct dcn10_stream_enc_registers { |
23319 |
+ type AFMT_GENERIC2_FRAME_UPDATE;\ |
23320 |
+ type AFMT_GENERIC3_FRAME_UPDATE;\ |
23321 |
+ type AFMT_GENERIC4_FRAME_UPDATE;\ |
23322 |
++ type AFMT_GENERIC0_IMMEDIATE_UPDATE;\ |
23323 |
++ type AFMT_GENERIC1_IMMEDIATE_UPDATE;\ |
23324 |
++ type AFMT_GENERIC2_IMMEDIATE_UPDATE;\ |
23325 |
++ type AFMT_GENERIC3_IMMEDIATE_UPDATE;\ |
23326 |
+ type AFMT_GENERIC4_IMMEDIATE_UPDATE;\ |
23327 |
++ type AFMT_GENERIC5_IMMEDIATE_UPDATE;\ |
23328 |
++ type AFMT_GENERIC6_IMMEDIATE_UPDATE;\ |
23329 |
++ type AFMT_GENERIC7_IMMEDIATE_UPDATE;\ |
23330 |
+ type AFMT_GENERIC5_FRAME_UPDATE;\ |
23331 |
+ type AFMT_GENERIC6_FRAME_UPDATE;\ |
23332 |
+ type AFMT_GENERIC7_FRAME_UPDATE;\ |
23333 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/Makefile b/drivers/gpu/drm/amd/display/modules/color/Makefile |
23334 |
+index 65c33a76951a4..e66c19a840c29 100644 |
23335 |
+--- a/drivers/gpu/drm/amd/display/modules/color/Makefile |
23336 |
++++ b/drivers/gpu/drm/amd/display/modules/color/Makefile |
23337 |
+@@ -23,7 +23,7 @@ |
23338 |
+ # Makefile for the color sub-module of DAL. |
23339 |
+ # |
23340 |
+ |
23341 |
+-MOD_COLOR = color_gamma.o |
23342 |
++MOD_COLOR = color_gamma.o color_table.o |
23343 |
+ |
23344 |
+ AMD_DAL_MOD_COLOR = $(addprefix $(AMDDALPATH)/modules/color/,$(MOD_COLOR)) |
23345 |
+ #$(info ************ DAL COLOR MODULE MAKEFILE ************) |
23346 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
23347 |
+index bcfe34ef8c28d..b8695660b480e 100644 |
23348 |
+--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
23349 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c |
23350 |
+@@ -30,20 +30,10 @@ |
23351 |
+ #include "opp.h" |
23352 |
+ #include "color_gamma.h" |
23353 |
+ |
23354 |
+-#define NUM_PTS_IN_REGION 16 |
23355 |
+-#define NUM_REGIONS 32 |
23356 |
+-#define MAX_HW_POINTS (NUM_PTS_IN_REGION*NUM_REGIONS) |
23357 |
+- |
23358 |
+ static struct hw_x_point coordinates_x[MAX_HW_POINTS + 2]; |
23359 |
+ |
23360 |
+-static struct fixed31_32 pq_table[MAX_HW_POINTS + 2]; |
23361 |
+-static struct fixed31_32 de_pq_table[MAX_HW_POINTS + 2]; |
23362 |
+- |
23363 |
+ // these are helpers for calculations to reduce stack usage |
23364 |
+ // do not depend on these being preserved across calls |
23365 |
+-static struct fixed31_32 scratch_1; |
23366 |
+-static struct fixed31_32 scratch_2; |
23367 |
+-static struct translate_from_linear_space_args scratch_gamma_args; |
23368 |
+ |
23369 |
+ /* Helper to optimize gamma calculation, only use in translate_from_linear, in |
23370 |
+ * particular the dc_fixpt_pow function which is very expensive |
23371 |
+@@ -56,9 +46,6 @@ static struct translate_from_linear_space_args scratch_gamma_args; |
23372 |
+ * just multiply with 2^gamma which can be computed once, and save the result so we |
23373 |
+ * recursively compute all the values. |
23374 |
+ */ |
23375 |
+-static struct fixed31_32 pow_buffer[NUM_PTS_IN_REGION]; |
23376 |
+-static struct fixed31_32 gamma_of_2; // 2^gamma |
23377 |
+-int pow_buffer_ptr = -1; |
23378 |
+ /*sRGB 709 2.2 2.4 P3*/ |
23379 |
+ static const int32_t gamma_numerator01[] = { 31308, 180000, 0, 0, 0}; |
23380 |
+ static const int32_t gamma_numerator02[] = { 12920, 4500, 0, 0, 0}; |
23381 |
+@@ -66,9 +53,6 @@ static const int32_t gamma_numerator03[] = { 55, 99, 0, 0, 0}; |
23382 |
+ static const int32_t gamma_numerator04[] = { 55, 99, 0, 0, 0}; |
23383 |
+ static const int32_t gamma_numerator05[] = { 2400, 2200, 2200, 2400, 2600}; |
23384 |
+ |
23385 |
+-static bool pq_initialized; /* = false; */ |
23386 |
+-static bool de_pq_initialized; /* = false; */ |
23387 |
+- |
23388 |
+ /* one-time setup of X points */ |
23389 |
+ void setup_x_points_distribution(void) |
23390 |
+ { |
23391 |
+@@ -250,6 +234,8 @@ void precompute_pq(void) |
23392 |
+ struct fixed31_32 scaling_factor = |
23393 |
+ dc_fixpt_from_fraction(80, 10000); |
23394 |
+ |
23395 |
++ struct fixed31_32 *pq_table = mod_color_get_table(type_pq_table); |
23396 |
++ |
23397 |
+ /* pow function has problems with arguments too small */ |
23398 |
+ for (i = 0; i < 32; i++) |
23399 |
+ pq_table[i] = dc_fixpt_zero; |
23400 |
+@@ -269,7 +255,7 @@ void precompute_de_pq(void) |
23401 |
+ uint32_t begin_index, end_index; |
23402 |
+ |
23403 |
+ struct fixed31_32 scaling_factor = dc_fixpt_from_int(125); |
23404 |
+- |
23405 |
++ struct fixed31_32 *de_pq_table = mod_color_get_table(type_de_pq_table); |
23406 |
+ /* X points is 2^-25 to 2^7 |
23407 |
+ * De-gamma X is 2^-12 to 2^0 – we are skipping first -12-(-25) = 13 regions |
23408 |
+ */ |
23409 |
+@@ -339,6 +325,9 @@ static struct fixed31_32 translate_from_linear_space( |
23410 |
+ { |
23411 |
+ const struct fixed31_32 one = dc_fixpt_from_int(1); |
23412 |
+ |
23413 |
++ struct fixed31_32 scratch_1, scratch_2; |
23414 |
++ struct calculate_buffer *cal_buffer = args->cal_buffer; |
23415 |
++ |
23416 |
+ if (dc_fixpt_le(one, args->arg)) |
23417 |
+ return one; |
23418 |
+ |
23419 |
+@@ -352,21 +341,21 @@ static struct fixed31_32 translate_from_linear_space( |
23420 |
+ |
23421 |
+ return scratch_1; |
23422 |
+ } else if (dc_fixpt_le(args->a0, args->arg)) { |
23423 |
+- if (pow_buffer_ptr == 0) { |
23424 |
+- gamma_of_2 = dc_fixpt_pow(dc_fixpt_from_int(2), |
23425 |
++ if (cal_buffer->buffer_index == 0) { |
23426 |
++ cal_buffer->gamma_of_2 = dc_fixpt_pow(dc_fixpt_from_int(2), |
23427 |
+ dc_fixpt_recip(args->gamma)); |
23428 |
+ } |
23429 |
+ scratch_1 = dc_fixpt_add(one, args->a3); |
23430 |
+- if (pow_buffer_ptr < 16) |
23431 |
++ if (cal_buffer->buffer_index < 16) |
23432 |
+ scratch_2 = dc_fixpt_pow(args->arg, |
23433 |
+ dc_fixpt_recip(args->gamma)); |
23434 |
+ else |
23435 |
+- scratch_2 = dc_fixpt_mul(gamma_of_2, |
23436 |
+- pow_buffer[pow_buffer_ptr%16]); |
23437 |
++ scratch_2 = dc_fixpt_mul(cal_buffer->gamma_of_2, |
23438 |
++ cal_buffer->buffer[cal_buffer->buffer_index%16]); |
23439 |
+ |
23440 |
+- if (pow_buffer_ptr != -1) { |
23441 |
+- pow_buffer[pow_buffer_ptr%16] = scratch_2; |
23442 |
+- pow_buffer_ptr++; |
23443 |
++ if (cal_buffer->buffer_index != -1) { |
23444 |
++ cal_buffer->buffer[cal_buffer->buffer_index%16] = scratch_2; |
23445 |
++ cal_buffer->buffer_index++; |
23446 |
+ } |
23447 |
+ |
23448 |
+ scratch_1 = dc_fixpt_mul(scratch_1, scratch_2); |
23449 |
+@@ -413,15 +402,17 @@ static struct fixed31_32 translate_from_linear_space_long( |
23450 |
+ args->a1); |
23451 |
+ } |
23452 |
+ |
23453 |
+-static struct fixed31_32 calculate_gamma22(struct fixed31_32 arg, bool use_eetf) |
23454 |
++static struct fixed31_32 calculate_gamma22(struct fixed31_32 arg, bool use_eetf, struct calculate_buffer *cal_buffer) |
23455 |
+ { |
23456 |
+ struct fixed31_32 gamma = dc_fixpt_from_fraction(22, 10); |
23457 |
++ struct translate_from_linear_space_args scratch_gamma_args; |
23458 |
+ |
23459 |
+ scratch_gamma_args.arg = arg; |
23460 |
+ scratch_gamma_args.a0 = dc_fixpt_zero; |
23461 |
+ scratch_gamma_args.a1 = dc_fixpt_zero; |
23462 |
+ scratch_gamma_args.a2 = dc_fixpt_zero; |
23463 |
+ scratch_gamma_args.a3 = dc_fixpt_zero; |
23464 |
++ scratch_gamma_args.cal_buffer = cal_buffer; |
23465 |
+ scratch_gamma_args.gamma = gamma; |
23466 |
+ |
23467 |
+ if (use_eetf) |
23468 |
+@@ -467,14 +458,18 @@ static struct fixed31_32 translate_to_linear_space( |
23469 |
+ static struct fixed31_32 translate_from_linear_space_ex( |
23470 |
+ struct fixed31_32 arg, |
23471 |
+ struct gamma_coefficients *coeff, |
23472 |
+- uint32_t color_index) |
23473 |
++ uint32_t color_index, |
23474 |
++ struct calculate_buffer *cal_buffer) |
23475 |
+ { |
23476 |
++ struct translate_from_linear_space_args scratch_gamma_args; |
23477 |
++ |
23478 |
+ scratch_gamma_args.arg = arg; |
23479 |
+ scratch_gamma_args.a0 = coeff->a0[color_index]; |
23480 |
+ scratch_gamma_args.a1 = coeff->a1[color_index]; |
23481 |
+ scratch_gamma_args.a2 = coeff->a2[color_index]; |
23482 |
+ scratch_gamma_args.a3 = coeff->a3[color_index]; |
23483 |
+ scratch_gamma_args.gamma = coeff->user_gamma[color_index]; |
23484 |
++ scratch_gamma_args.cal_buffer = cal_buffer; |
23485 |
+ |
23486 |
+ return translate_from_linear_space(&scratch_gamma_args); |
23487 |
+ } |
23488 |
+@@ -742,10 +737,11 @@ static void build_pq(struct pwl_float_data_ex *rgb_regamma, |
23489 |
+ struct fixed31_32 output; |
23490 |
+ struct fixed31_32 scaling_factor = |
23491 |
+ dc_fixpt_from_fraction(sdr_white_level, 10000); |
23492 |
++ struct fixed31_32 *pq_table = mod_color_get_table(type_pq_table); |
23493 |
+ |
23494 |
+- if (!pq_initialized && sdr_white_level == 80) { |
23495 |
++ if (!mod_color_is_table_init(type_pq_table) && sdr_white_level == 80) { |
23496 |
+ precompute_pq(); |
23497 |
+- pq_initialized = true; |
23498 |
++ mod_color_set_table_init_state(type_pq_table, true); |
23499 |
+ } |
23500 |
+ |
23501 |
+ /* TODO: start index is from segment 2^-24, skipping first segment |
23502 |
+@@ -787,12 +783,12 @@ static void build_de_pq(struct pwl_float_data_ex *de_pq, |
23503 |
+ { |
23504 |
+ uint32_t i; |
23505 |
+ struct fixed31_32 output; |
23506 |
+- |
23507 |
++ struct fixed31_32 *de_pq_table = mod_color_get_table(type_de_pq_table); |
23508 |
+ struct fixed31_32 scaling_factor = dc_fixpt_from_int(125); |
23509 |
+ |
23510 |
+- if (!de_pq_initialized) { |
23511 |
++ if (!mod_color_is_table_init(type_de_pq_table)) { |
23512 |
+ precompute_de_pq(); |
23513 |
+- de_pq_initialized = true; |
23514 |
++ mod_color_set_table_init_state(type_de_pq_table, true); |
23515 |
+ } |
23516 |
+ |
23517 |
+ |
23518 |
+@@ -811,7 +807,9 @@ static void build_de_pq(struct pwl_float_data_ex *de_pq, |
23519 |
+ |
23520 |
+ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, |
23521 |
+ uint32_t hw_points_num, |
23522 |
+- const struct hw_x_point *coordinate_x, enum dc_transfer_func_predefined type) |
23523 |
++ const struct hw_x_point *coordinate_x, |
23524 |
++ enum dc_transfer_func_predefined type, |
23525 |
++ struct calculate_buffer *cal_buffer) |
23526 |
+ { |
23527 |
+ uint32_t i; |
23528 |
+ bool ret = false; |
23529 |
+@@ -827,20 +825,21 @@ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, |
23530 |
+ if (!build_coefficients(coeff, type)) |
23531 |
+ goto release; |
23532 |
+ |
23533 |
+- memset(pow_buffer, 0, NUM_PTS_IN_REGION * sizeof(struct fixed31_32)); |
23534 |
+- pow_buffer_ptr = 0; // see variable definition for more info |
23535 |
++ memset(cal_buffer->buffer, 0, NUM_PTS_IN_REGION * sizeof(struct fixed31_32)); |
23536 |
++ cal_buffer->buffer_index = 0; // see variable definition for more info |
23537 |
++ |
23538 |
+ i = 0; |
23539 |
+ while (i <= hw_points_num) { |
23540 |
+ /*TODO use y vs r,g,b*/ |
23541 |
+ rgb->r = translate_from_linear_space_ex( |
23542 |
+- coord_x->x, coeff, 0); |
23543 |
++ coord_x->x, coeff, 0, cal_buffer); |
23544 |
+ rgb->g = rgb->r; |
23545 |
+ rgb->b = rgb->r; |
23546 |
+ ++coord_x; |
23547 |
+ ++rgb; |
23548 |
+ ++i; |
23549 |
+ } |
23550 |
+- pow_buffer_ptr = -1; // reset back to no optimize |
23551 |
++ cal_buffer->buffer_index = -1; |
23552 |
+ ret = true; |
23553 |
+ release: |
23554 |
+ kvfree(coeff); |
23555 |
+@@ -932,7 +931,8 @@ static void hermite_spline_eetf(struct fixed31_32 input_x, |
23556 |
+ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, |
23557 |
+ uint32_t hw_points_num, |
23558 |
+ const struct hw_x_point *coordinate_x, |
23559 |
+- const struct freesync_hdr_tf_params *fs_params) |
23560 |
++ const struct freesync_hdr_tf_params *fs_params, |
23561 |
++ struct calculate_buffer *cal_buffer) |
23562 |
+ { |
23563 |
+ uint32_t i; |
23564 |
+ struct pwl_float_data_ex *rgb = rgb_regamma; |
23565 |
+@@ -969,7 +969,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, |
23566 |
+ max_content = max_display; |
23567 |
+ |
23568 |
+ if (!use_eetf) |
23569 |
+- pow_buffer_ptr = 0; // see var definition for more info |
23570 |
++ cal_buffer->buffer_index = 0; // see var definition for more info |
23571 |
+ rgb += 32; // first 32 points have problems with fixed point, too small |
23572 |
+ coord_x += 32; |
23573 |
+ for (i = 32; i <= hw_points_num; i++) { |
23574 |
+@@ -988,7 +988,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, |
23575 |
+ if (dc_fixpt_lt(scaledX, dc_fixpt_zero)) |
23576 |
+ output = dc_fixpt_zero; |
23577 |
+ else |
23578 |
+- output = calculate_gamma22(scaledX, use_eetf); |
23579 |
++ output = calculate_gamma22(scaledX, use_eetf, cal_buffer); |
23580 |
+ |
23581 |
+ rgb->r = output; |
23582 |
+ rgb->g = output; |
23583 |
+@@ -1008,7 +1008,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, |
23584 |
+ ++coord_x; |
23585 |
+ ++rgb; |
23586 |
+ } |
23587 |
+- pow_buffer_ptr = -1; |
23588 |
++ cal_buffer->buffer_index = -1; |
23589 |
+ |
23590 |
+ return true; |
23591 |
+ } |
23592 |
+@@ -1606,7 +1606,7 @@ static void build_new_custom_resulted_curve( |
23593 |
+ } |
23594 |
+ |
23595 |
+ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma, |
23596 |
+- uint32_t hw_points_num) |
23597 |
++ uint32_t hw_points_num, struct calculate_buffer *cal_buffer) |
23598 |
+ { |
23599 |
+ uint32_t i; |
23600 |
+ |
23601 |
+@@ -1619,7 +1619,7 @@ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma |
23602 |
+ i = 0; |
23603 |
+ while (i != hw_points_num + 1) { |
23604 |
+ rgb->r = translate_from_linear_space_ex( |
23605 |
+- coord_x->x, &coeff, 0); |
23606 |
++ coord_x->x, &coeff, 0, cal_buffer); |
23607 |
+ rgb->g = rgb->r; |
23608 |
+ rgb->b = rgb->r; |
23609 |
+ ++coord_x; |
23610 |
+@@ -1674,7 +1674,8 @@ static bool map_regamma_hw_to_x_user( |
23611 |
+ #define _EXTRA_POINTS 3 |
23612 |
+ |
23613 |
+ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, |
23614 |
+- const struct regamma_lut *regamma) |
23615 |
++ const struct regamma_lut *regamma, |
23616 |
++ struct calculate_buffer *cal_buffer) |
23617 |
+ { |
23618 |
+ struct gamma_coefficients coeff; |
23619 |
+ const struct hw_x_point *coord_x = coordinates_x; |
23620 |
+@@ -1706,11 +1707,11 @@ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, |
23621 |
+ } |
23622 |
+ while (i != MAX_HW_POINTS + 1) { |
23623 |
+ output_tf->tf_pts.red[i] = translate_from_linear_space_ex( |
23624 |
+- coord_x->x, &coeff, 0); |
23625 |
++ coord_x->x, &coeff, 0, cal_buffer); |
23626 |
+ output_tf->tf_pts.green[i] = translate_from_linear_space_ex( |
23627 |
+- coord_x->x, &coeff, 1); |
23628 |
++ coord_x->x, &coeff, 1, cal_buffer); |
23629 |
+ output_tf->tf_pts.blue[i] = translate_from_linear_space_ex( |
23630 |
+- coord_x->x, &coeff, 2); |
23631 |
++ coord_x->x, &coeff, 2, cal_buffer); |
23632 |
+ ++coord_x; |
23633 |
+ ++i; |
23634 |
+ } |
23635 |
+@@ -1723,7 +1724,8 @@ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, |
23636 |
+ } |
23637 |
+ |
23638 |
+ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, |
23639 |
+- const struct regamma_lut *regamma) |
23640 |
++ const struct regamma_lut *regamma, |
23641 |
++ struct calculate_buffer *cal_buffer) |
23642 |
+ { |
23643 |
+ struct dc_transfer_func_distributed_points *tf_pts = &output_tf->tf_pts; |
23644 |
+ struct dividers dividers; |
23645 |
+@@ -1756,7 +1758,7 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, |
23646 |
+ scale_user_regamma_ramp(rgb_user, ®amma->ramp, dividers); |
23647 |
+ |
23648 |
+ if (regamma->flags.bits.applyDegamma == 1) { |
23649 |
+- apply_degamma_for_user_regamma(rgb_regamma, MAX_HW_POINTS); |
23650 |
++ apply_degamma_for_user_regamma(rgb_regamma, MAX_HW_POINTS, cal_buffer); |
23651 |
+ copy_rgb_regamma_to_coordinates_x(coordinates_x, |
23652 |
+ MAX_HW_POINTS, rgb_regamma); |
23653 |
+ } |
23654 |
+@@ -1943,7 +1945,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, |
23655 |
+ struct dc_transfer_func_distributed_points *points, |
23656 |
+ struct pwl_float_data_ex *rgb_regamma, |
23657 |
+ const struct freesync_hdr_tf_params *fs_params, |
23658 |
+- uint32_t sdr_ref_white_level) |
23659 |
++ uint32_t sdr_ref_white_level, |
23660 |
++ struct calculate_buffer *cal_buffer) |
23661 |
+ { |
23662 |
+ uint32_t i; |
23663 |
+ bool ret = false; |
23664 |
+@@ -1979,7 +1982,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, |
23665 |
+ build_freesync_hdr(rgb_regamma, |
23666 |
+ MAX_HW_POINTS, |
23667 |
+ coordinates_x, |
23668 |
+- fs_params); |
23669 |
++ fs_params, |
23670 |
++ cal_buffer); |
23671 |
+ |
23672 |
+ ret = true; |
23673 |
+ } else if (trans == TRANSFER_FUNCTION_HLG) { |
23674 |
+@@ -2008,7 +2012,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, |
23675 |
+ build_regamma(rgb_regamma, |
23676 |
+ MAX_HW_POINTS, |
23677 |
+ coordinates_x, |
23678 |
+- trans); |
23679 |
++ trans, |
23680 |
++ cal_buffer); |
23681 |
+ |
23682 |
+ ret = true; |
23683 |
+ } |
23684 |
+@@ -2018,7 +2023,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, |
23685 |
+ |
23686 |
+ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, |
23687 |
+ const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed, |
23688 |
+- const struct freesync_hdr_tf_params *fs_params) |
23689 |
++ const struct freesync_hdr_tf_params *fs_params, |
23690 |
++ struct calculate_buffer *cal_buffer) |
23691 |
+ { |
23692 |
+ struct dc_transfer_func_distributed_points *tf_pts = &output_tf->tf_pts; |
23693 |
+ struct dividers dividers; |
23694 |
+@@ -2090,7 +2096,8 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, |
23695 |
+ tf_pts, |
23696 |
+ rgb_regamma, |
23697 |
+ fs_params, |
23698 |
+- output_tf->sdr_ref_white_level); |
23699 |
++ output_tf->sdr_ref_white_level, |
23700 |
++ cal_buffer); |
23701 |
+ |
23702 |
+ if (ret) { |
23703 |
+ map_regamma_hw_to_x_user(ramp, coeff, rgb_user, |
23704 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h |
23705 |
+index 7f56226ba77a9..37ffbef6602b0 100644 |
23706 |
+--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h |
23707 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h |
23708 |
+@@ -26,6 +26,8 @@ |
23709 |
+ #ifndef COLOR_MOD_COLOR_GAMMA_H_ |
23710 |
+ #define COLOR_MOD_COLOR_GAMMA_H_ |
23711 |
+ |
23712 |
++#include "color_table.h" |
23713 |
++ |
23714 |
+ struct dc_transfer_func; |
23715 |
+ struct dc_gamma; |
23716 |
+ struct dc_transfer_func_distributed_points; |
23717 |
+@@ -83,6 +85,12 @@ struct freesync_hdr_tf_params { |
23718 |
+ unsigned int skip_tm; // skip tm |
23719 |
+ }; |
23720 |
+ |
23721 |
++struct calculate_buffer { |
23722 |
++ int buffer_index; |
23723 |
++ struct fixed31_32 buffer[NUM_PTS_IN_REGION]; |
23724 |
++ struct fixed31_32 gamma_of_2; |
23725 |
++}; |
23726 |
++ |
23727 |
+ struct translate_from_linear_space_args { |
23728 |
+ struct fixed31_32 arg; |
23729 |
+ struct fixed31_32 a0; |
23730 |
+@@ -90,6 +98,7 @@ struct translate_from_linear_space_args { |
23731 |
+ struct fixed31_32 a2; |
23732 |
+ struct fixed31_32 a3; |
23733 |
+ struct fixed31_32 gamma; |
23734 |
++ struct calculate_buffer *cal_buffer; |
23735 |
+ }; |
23736 |
+ |
23737 |
+ void setup_x_points_distribution(void); |
23738 |
+@@ -99,7 +108,8 @@ void precompute_de_pq(void); |
23739 |
+ |
23740 |
+ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, |
23741 |
+ const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed, |
23742 |
+- const struct freesync_hdr_tf_params *fs_params); |
23743 |
++ const struct freesync_hdr_tf_params *fs_params, |
23744 |
++ struct calculate_buffer *cal_buffer); |
23745 |
+ |
23746 |
+ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps, |
23747 |
+ struct dc_transfer_func *output_tf, |
23748 |
+@@ -109,10 +119,12 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans, |
23749 |
+ struct dc_transfer_func_distributed_points *points); |
23750 |
+ |
23751 |
+ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, |
23752 |
+- const struct regamma_lut *regamma); |
23753 |
++ const struct regamma_lut *regamma, |
23754 |
++ struct calculate_buffer *cal_buffer); |
23755 |
+ |
23756 |
+ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, |
23757 |
+- const struct regamma_lut *regamma); |
23758 |
++ const struct regamma_lut *regamma, |
23759 |
++ struct calculate_buffer *cal_buffer); |
23760 |
+ |
23761 |
+ |
23762 |
+ #endif /* COLOR_MOD_COLOR_GAMMA_H_ */ |
23763 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_table.c b/drivers/gpu/drm/amd/display/modules/color/color_table.c |
23764 |
+new file mode 100644 |
23765 |
+index 0000000000000..692e536e7d057 |
23766 |
+--- /dev/null |
23767 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_table.c |
23768 |
+@@ -0,0 +1,48 @@ |
23769 |
++/* |
23770 |
++ * Copyright (c) 2019 Advanced Micro Devices, Inc. (unpublished) |
23771 |
++ * |
23772 |
++ * All rights reserved. This notice is intended as a precaution against |
23773 |
++ * inadvertent publication and does not imply publication or any waiver |
23774 |
++ * of confidentiality. The year included in the foregoing notice is the |
23775 |
++ * year of creation of the work. |
23776 |
++ */ |
23777 |
++ |
23778 |
++#include "color_table.h" |
23779 |
++ |
23780 |
++static struct fixed31_32 pq_table[MAX_HW_POINTS + 2]; |
23781 |
++static struct fixed31_32 de_pq_table[MAX_HW_POINTS + 2]; |
23782 |
++static bool pq_initialized; |
23783 |
++static bool de_pg_initialized; |
23784 |
++ |
23785 |
++bool mod_color_is_table_init(enum table_type type) |
23786 |
++{ |
23787 |
++ bool ret = false; |
23788 |
++ |
23789 |
++ if (type == type_pq_table) |
23790 |
++ ret = pq_initialized; |
23791 |
++ if (type == type_de_pq_table) |
23792 |
++ ret = de_pg_initialized; |
23793 |
++ |
23794 |
++ return ret; |
23795 |
++} |
23796 |
++ |
23797 |
++struct fixed31_32 *mod_color_get_table(enum table_type type) |
23798 |
++{ |
23799 |
++ struct fixed31_32 *table = NULL; |
23800 |
++ |
23801 |
++ if (type == type_pq_table) |
23802 |
++ table = pq_table; |
23803 |
++ if (type == type_de_pq_table) |
23804 |
++ table = de_pq_table; |
23805 |
++ |
23806 |
++ return table; |
23807 |
++} |
23808 |
++ |
23809 |
++void mod_color_set_table_init_state(enum table_type type, bool state) |
23810 |
++{ |
23811 |
++ if (type == type_pq_table) |
23812 |
++ pq_initialized = state; |
23813 |
++ if (type == type_de_pq_table) |
23814 |
++ de_pg_initialized = state; |
23815 |
++} |
23816 |
++ |
23817 |
+diff --git a/drivers/gpu/drm/amd/display/modules/color/color_table.h b/drivers/gpu/drm/amd/display/modules/color/color_table.h |
23818 |
+new file mode 100644 |
23819 |
+index 0000000000000..2621dd6194027 |
23820 |
+--- /dev/null |
23821 |
++++ b/drivers/gpu/drm/amd/display/modules/color/color_table.h |
23822 |
+@@ -0,0 +1,47 @@ |
23823 |
++/* |
23824 |
++ * Copyright 2016 Advanced Micro Devices, Inc. |
23825 |
++ * |
23826 |
++ * Permission is hereby granted, free of charge, to any person obtaining a |
23827 |
++ * copy of this software and associated documentation files (the "Software"), |
23828 |
++ * to deal in the Software without restriction, including without limitation |
23829 |
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
23830 |
++ * and/or sell copies of the Software, and to permit persons to whom the |
23831 |
++ * Software is furnished to do so, subject to the following conditions: |
23832 |
++ * |
23833 |
++ * The above copyright notice and this permission notice shall be included in |
23834 |
++ * all copies or substantial portions of the Software. |
23835 |
++ * |
23836 |
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
23837 |
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
23838 |
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
23839 |
++ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
23840 |
++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
23841 |
++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
23842 |
++ * OTHER DEALINGS IN THE SOFTWARE. |
23843 |
++ * |
23844 |
++ * Authors: AMD |
23845 |
++ * |
23846 |
++ */ |
23847 |
++ |
23848 |
++ |
23849 |
++#ifndef COLOR_MOD_COLOR_TABLE_H_ |
23850 |
++#define COLOR_MOD_COLOR_TABLE_H_ |
23851 |
++ |
23852 |
++#include "dc_types.h" |
23853 |
++ |
23854 |
++#define NUM_PTS_IN_REGION 16 |
23855 |
++#define NUM_REGIONS 32 |
23856 |
++#define MAX_HW_POINTS (NUM_PTS_IN_REGION*NUM_REGIONS) |
23857 |
++ |
23858 |
++enum table_type { |
23859 |
++ type_pq_table, |
23860 |
++ type_de_pq_table |
23861 |
++}; |
23862 |
++ |
23863 |
++bool mod_color_is_table_init(enum table_type type); |
23864 |
++ |
23865 |
++struct fixed31_32 *mod_color_get_table(enum table_type type); |
23866 |
++ |
23867 |
++void mod_color_set_table_init_state(enum table_type type, bool state); |
23868 |
++ |
23869 |
++#endif /* COLOR_MOD_COLOR_TABLE_H_ */ |
23870 |
+diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c |
23871 |
+index eb7421e83b865..23a7fa8447e24 100644 |
23872 |
+--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c |
23873 |
++++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c |
23874 |
+@@ -324,22 +324,44 @@ static void apply_below_the_range(struct core_freesync *core_freesync, |
23875 |
+ |
23876 |
+ /* Choose number of frames to insert based on how close it |
23877 |
+ * can get to the mid point of the variable range. |
23878 |
++ * - Delta for CEIL: delta_from_mid_point_in_us_1 |
23879 |
++ * - Delta for FLOOR: delta_from_mid_point_in_us_2 |
23880 |
+ */ |
23881 |
+- if ((frame_time_in_us / mid_point_frames_ceil) > in_out_vrr->min_duration_in_us && |
23882 |
+- (delta_from_mid_point_in_us_1 < delta_from_mid_point_in_us_2 || |
23883 |
+- mid_point_frames_floor < 2)) { |
23884 |
++ if ((last_render_time_in_us / mid_point_frames_ceil) < in_out_vrr->min_duration_in_us) { |
23885 |
++ /* Check for out of range. |
23886 |
++ * If using CEIL produces a value that is out of range, |
23887 |
++ * then we are forced to use FLOOR. |
23888 |
++ */ |
23889 |
++ frames_to_insert = mid_point_frames_floor; |
23890 |
++ } else if (mid_point_frames_floor < 2) { |
23891 |
++ /* Check if FLOOR would result in non-LFC. In this case |
23892 |
++ * choose to use CEIL |
23893 |
++ */ |
23894 |
++ frames_to_insert = mid_point_frames_ceil; |
23895 |
++ } else if (delta_from_mid_point_in_us_1 < delta_from_mid_point_in_us_2) { |
23896 |
++ /* If choosing CEIL results in a frame duration that is |
23897 |
++ * closer to the mid point of the range. |
23898 |
++ * Choose CEIL |
23899 |
++ */ |
23900 |
+ frames_to_insert = mid_point_frames_ceil; |
23901 |
+- delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_2 - |
23902 |
+- delta_from_mid_point_in_us_1; |
23903 |
+ } else { |
23904 |
++ /* If choosing FLOOR results in a frame duration that is |
23905 |
++ * closer to the mid point of the range. |
23906 |
++ * Choose FLOOR |
23907 |
++ */ |
23908 |
+ frames_to_insert = mid_point_frames_floor; |
23909 |
+- delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_1 - |
23910 |
+- delta_from_mid_point_in_us_2; |
23911 |
+ } |
23912 |
+ |
23913 |
+ /* Prefer current frame multiplier when BTR is enabled unless it drifts |
23914 |
+ * too far from the midpoint |
23915 |
+ */ |
23916 |
++ if (delta_from_mid_point_in_us_1 < delta_from_mid_point_in_us_2) { |
23917 |
++ delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_2 - |
23918 |
++ delta_from_mid_point_in_us_1; |
23919 |
++ } else { |
23920 |
++ delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_1 - |
23921 |
++ delta_from_mid_point_in_us_2; |
23922 |
++ } |
23923 |
+ if (in_out_vrr->btr.frames_to_insert != 0 && |
23924 |
+ delta_from_mid_point_delta_in_us < BTR_DRIFT_MARGIN) { |
23925 |
+ if (((last_render_time_in_us / in_out_vrr->btr.frames_to_insert) < |
23926 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |
23927 |
+index c9cfe90a29471..9ee8cf8267c88 100644 |
23928 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |
23929 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |
23930 |
+@@ -204,8 +204,7 @@ static int smu10_set_min_deep_sleep_dcefclk(struct pp_hwmgr *hwmgr, uint32_t clo |
23931 |
+ { |
23932 |
+ struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); |
23933 |
+ |
23934 |
+- if (smu10_data->need_min_deep_sleep_dcefclk && |
23935 |
+- smu10_data->deep_sleep_dcefclk != clock) { |
23936 |
++ if (clock && smu10_data->deep_sleep_dcefclk != clock) { |
23937 |
+ smu10_data->deep_sleep_dcefclk = clock; |
23938 |
+ smum_send_msg_to_smc_with_parameter(hwmgr, |
23939 |
+ PPSMC_MSG_SetMinDeepSleepDcefclk, |
23940 |
+@@ -219,8 +218,7 @@ static int smu10_set_hard_min_dcefclk_by_freq(struct pp_hwmgr *hwmgr, uint32_t c |
23941 |
+ { |
23942 |
+ struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); |
23943 |
+ |
23944 |
+- if (smu10_data->dcf_actual_hard_min_freq && |
23945 |
+- smu10_data->dcf_actual_hard_min_freq != clock) { |
23946 |
++ if (clock && smu10_data->dcf_actual_hard_min_freq != clock) { |
23947 |
+ smu10_data->dcf_actual_hard_min_freq = clock; |
23948 |
+ smum_send_msg_to_smc_with_parameter(hwmgr, |
23949 |
+ PPSMC_MSG_SetHardMinDcefclkByFreq, |
23950 |
+@@ -234,8 +232,7 @@ static int smu10_set_hard_min_fclk_by_freq(struct pp_hwmgr *hwmgr, uint32_t cloc |
23951 |
+ { |
23952 |
+ struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); |
23953 |
+ |
23954 |
+- if (smu10_data->f_actual_hard_min_freq && |
23955 |
+- smu10_data->f_actual_hard_min_freq != clock) { |
23956 |
++ if (clock && smu10_data->f_actual_hard_min_freq != clock) { |
23957 |
+ smu10_data->f_actual_hard_min_freq = clock; |
23958 |
+ smum_send_msg_to_smc_with_parameter(hwmgr, |
23959 |
+ PPSMC_MSG_SetHardMinFclkByFreq, |
23960 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c |
23961 |
+index 7783c7fd7ccb0..eff87c8968380 100644 |
23962 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c |
23963 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c |
23964 |
+@@ -363,17 +363,19 @@ int vega10_thermal_get_temperature(struct pp_hwmgr *hwmgr) |
23965 |
+ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, |
23966 |
+ struct PP_TemperatureRange *range) |
23967 |
+ { |
23968 |
++ struct phm_ppt_v2_information *pp_table_info = |
23969 |
++ (struct phm_ppt_v2_information *)(hwmgr->pptable); |
23970 |
++ struct phm_tdp_table *tdp_table = pp_table_info->tdp_table; |
23971 |
+ struct amdgpu_device *adev = hwmgr->adev; |
23972 |
+- int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP * |
23973 |
+- PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
23974 |
+- int high = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP * |
23975 |
+- PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
23976 |
++ int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP; |
23977 |
++ int high = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP; |
23978 |
+ uint32_t val; |
23979 |
+ |
23980 |
+- if (low < range->min) |
23981 |
+- low = range->min; |
23982 |
+- if (high > range->max) |
23983 |
+- high = range->max; |
23984 |
++ /* compare them in unit celsius degree */ |
23985 |
++ if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES) |
23986 |
++ low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
23987 |
++ if (high > tdp_table->usSoftwareShutdownTemp) |
23988 |
++ high = tdp_table->usSoftwareShutdownTemp; |
23989 |
+ |
23990 |
+ if (low > high) |
23991 |
+ return -EINVAL; |
23992 |
+@@ -382,8 +384,8 @@ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, |
23993 |
+ |
23994 |
+ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5); |
23995 |
+ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1); |
23996 |
+- val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)); |
23997 |
+- val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)); |
23998 |
++ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high); |
23999 |
++ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low); |
24000 |
+ val &= (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK) & |
24001 |
+ (~THM_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK) & |
24002 |
+ (~THM_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK); |
24003 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c |
24004 |
+index c85806a6f62e3..650623106ceba 100644 |
24005 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c |
24006 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c |
24007 |
+@@ -170,17 +170,18 @@ int vega12_thermal_get_temperature(struct pp_hwmgr *hwmgr) |
24008 |
+ static int vega12_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, |
24009 |
+ struct PP_TemperatureRange *range) |
24010 |
+ { |
24011 |
++ struct phm_ppt_v3_information *pptable_information = |
24012 |
++ (struct phm_ppt_v3_information *)hwmgr->pptable; |
24013 |
+ struct amdgpu_device *adev = hwmgr->adev; |
24014 |
+- int low = VEGA12_THERMAL_MINIMUM_ALERT_TEMP * |
24015 |
+- PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
24016 |
+- int high = VEGA12_THERMAL_MAXIMUM_ALERT_TEMP * |
24017 |
+- PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
24018 |
++ int low = VEGA12_THERMAL_MINIMUM_ALERT_TEMP; |
24019 |
++ int high = VEGA12_THERMAL_MAXIMUM_ALERT_TEMP; |
24020 |
+ uint32_t val; |
24021 |
+ |
24022 |
+- if (low < range->min) |
24023 |
+- low = range->min; |
24024 |
+- if (high > range->max) |
24025 |
+- high = range->max; |
24026 |
++ /* compare them in unit celsius degree */ |
24027 |
++ if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES) |
24028 |
++ low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
24029 |
++ if (high > pptable_information->us_software_shutdown_temp) |
24030 |
++ high = pptable_information->us_software_shutdown_temp; |
24031 |
+ |
24032 |
+ if (low > high) |
24033 |
+ return -EINVAL; |
24034 |
+@@ -189,8 +190,8 @@ static int vega12_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, |
24035 |
+ |
24036 |
+ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5); |
24037 |
+ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1); |
24038 |
+- val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)); |
24039 |
+- val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)); |
24040 |
++ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high); |
24041 |
++ val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low); |
24042 |
+ val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK); |
24043 |
+ |
24044 |
+ WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val); |
24045 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c |
24046 |
+index 9ff470f1b826c..9bd2874a122b4 100644 |
24047 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c |
24048 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c |
24049 |
+@@ -979,10 +979,7 @@ static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr) |
24050 |
+ { |
24051 |
+ struct vega20_hwmgr *data = |
24052 |
+ (struct vega20_hwmgr *)(hwmgr->backend); |
24053 |
+- uint64_t features_enabled; |
24054 |
+- int i; |
24055 |
+- bool enabled; |
24056 |
+- int ret = 0; |
24057 |
++ int i, ret = 0; |
24058 |
+ |
24059 |
+ PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr, |
24060 |
+ PPSMC_MSG_DisableAllSmuFeatures, |
24061 |
+@@ -990,17 +987,8 @@ static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr) |
24062 |
+ "[DisableAllSMUFeatures] Failed to disable all smu features!", |
24063 |
+ return ret); |
24064 |
+ |
24065 |
+- ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled); |
24066 |
+- PP_ASSERT_WITH_CODE(!ret, |
24067 |
+- "[DisableAllSMUFeatures] Failed to get enabled smc features!", |
24068 |
+- return ret); |
24069 |
+- |
24070 |
+- for (i = 0; i < GNLD_FEATURES_MAX; i++) { |
24071 |
+- enabled = (features_enabled & data->smu_features[i].smu_feature_bitmap) ? |
24072 |
+- true : false; |
24073 |
+- data->smu_features[i].enabled = enabled; |
24074 |
+- data->smu_features[i].supported = enabled; |
24075 |
+- } |
24076 |
++ for (i = 0; i < GNLD_FEATURES_MAX; i++) |
24077 |
++ data->smu_features[i].enabled = 0; |
24078 |
+ |
24079 |
+ return 0; |
24080 |
+ } |
24081 |
+@@ -1652,12 +1640,6 @@ static void vega20_init_powergate_state(struct pp_hwmgr *hwmgr) |
24082 |
+ |
24083 |
+ data->uvd_power_gated = true; |
24084 |
+ data->vce_power_gated = true; |
24085 |
+- |
24086 |
+- if (data->smu_features[GNLD_DPM_UVD].enabled) |
24087 |
+- data->uvd_power_gated = false; |
24088 |
+- |
24089 |
+- if (data->smu_features[GNLD_DPM_VCE].enabled) |
24090 |
+- data->vce_power_gated = false; |
24091 |
+ } |
24092 |
+ |
24093 |
+ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr) |
24094 |
+@@ -3230,10 +3212,11 @@ static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf) |
24095 |
+ |
24096 |
+ static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfeature_masks) |
24097 |
+ { |
24098 |
+- uint64_t features_enabled; |
24099 |
+- uint64_t features_to_enable; |
24100 |
+- uint64_t features_to_disable; |
24101 |
+- int ret = 0; |
24102 |
++ struct vega20_hwmgr *data = |
24103 |
++ (struct vega20_hwmgr *)(hwmgr->backend); |
24104 |
++ uint64_t features_enabled, features_to_enable, features_to_disable; |
24105 |
++ int i, ret = 0; |
24106 |
++ bool enabled; |
24107 |
+ |
24108 |
+ if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX)) |
24109 |
+ return -EINVAL; |
24110 |
+@@ -3262,6 +3245,17 @@ static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe |
24111 |
+ return ret; |
24112 |
+ } |
24113 |
+ |
24114 |
++ /* Update the cached feature enablement state */ |
24115 |
++ ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled); |
24116 |
++ if (ret) |
24117 |
++ return ret; |
24118 |
++ |
24119 |
++ for (i = 0; i < GNLD_FEATURES_MAX; i++) { |
24120 |
++ enabled = (features_enabled & data->smu_features[i].smu_feature_bitmap) ? |
24121 |
++ true : false; |
24122 |
++ data->smu_features[i].enabled = enabled; |
24123 |
++ } |
24124 |
++ |
24125 |
+ return 0; |
24126 |
+ } |
24127 |
+ |
24128 |
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c |
24129 |
+index 7add2f60f49c4..364162ddaa9c6 100644 |
24130 |
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c |
24131 |
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c |
24132 |
+@@ -240,17 +240,18 @@ int vega20_thermal_get_temperature(struct pp_hwmgr *hwmgr) |
24133 |
+ static int vega20_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, |
24134 |
+ struct PP_TemperatureRange *range) |
24135 |
+ { |
24136 |
++ struct phm_ppt_v3_information *pptable_information = |
24137 |
++ (struct phm_ppt_v3_information *)hwmgr->pptable; |
24138 |
+ struct amdgpu_device *adev = hwmgr->adev; |
24139 |
+- int low = VEGA20_THERMAL_MINIMUM_ALERT_TEMP * |
24140 |
+- PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
24141 |
+- int high = VEGA20_THERMAL_MAXIMUM_ALERT_TEMP * |
24142 |
+- PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
24143 |
++ int low = VEGA20_THERMAL_MINIMUM_ALERT_TEMP; |
24144 |
++ int high = VEGA20_THERMAL_MAXIMUM_ALERT_TEMP; |
24145 |
+ uint32_t val; |
24146 |
+ |
24147 |
+- if (low < range->min) |
24148 |
+- low = range->min; |
24149 |
+- if (high > range->max) |
24150 |
+- high = range->max; |
24151 |
++ /* compare them in unit celsius degree */ |
24152 |
++ if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES) |
24153 |
++ low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
24154 |
++ if (high > pptable_information->us_software_shutdown_temp) |
24155 |
++ high = pptable_information->us_software_shutdown_temp; |
24156 |
+ |
24157 |
+ if (low > high) |
24158 |
+ return -EINVAL; |
24159 |
+@@ -259,8 +260,8 @@ static int vega20_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, |
24160 |
+ |
24161 |
+ val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5); |
24162 |
+ val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1); |
24163 |
+- val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)); |
24164 |
+- val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)); |
24165 |
++ val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high); |
24166 |
++ val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low); |
24167 |
+ val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK); |
24168 |
+ |
24169 |
+ WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val); |
24170 |
+diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |
24171 |
+index 56bd938961eee..f33418d6e1a08 100644 |
24172 |
+--- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |
24173 |
++++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |
24174 |
+@@ -492,10 +492,8 @@ static void komeda_crtc_reset(struct drm_crtc *crtc) |
24175 |
+ crtc->state = NULL; |
24176 |
+ |
24177 |
+ state = kzalloc(sizeof(*state), GFP_KERNEL); |
24178 |
+- if (state) { |
24179 |
+- crtc->state = &state->base; |
24180 |
+- crtc->state->crtc = crtc; |
24181 |
+- } |
24182 |
++ if (state) |
24183 |
++ __drm_atomic_helper_crtc_reset(crtc, &state->base); |
24184 |
+ } |
24185 |
+ |
24186 |
+ static struct drm_crtc_state * |
24187 |
+@@ -616,7 +614,6 @@ static int komeda_crtc_add(struct komeda_kms_dev *kms, |
24188 |
+ return err; |
24189 |
+ |
24190 |
+ drm_crtc_helper_add(crtc, &komeda_crtc_helper_funcs); |
24191 |
+- drm_crtc_vblank_reset(crtc); |
24192 |
+ |
24193 |
+ crtc->port = kcrtc->master->of_output_port; |
24194 |
+ |
24195 |
+diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c |
24196 |
+index def8c9ffafcaf..a2a10bfbccac4 100644 |
24197 |
+--- a/drivers/gpu/drm/arm/malidp_drv.c |
24198 |
++++ b/drivers/gpu/drm/arm/malidp_drv.c |
24199 |
+@@ -870,7 +870,6 @@ static int malidp_bind(struct device *dev) |
24200 |
+ drm->irq_enabled = true; |
24201 |
+ |
24202 |
+ ret = drm_vblank_init(drm, drm->mode_config.num_crtc); |
24203 |
+- drm_crtc_vblank_reset(&malidp->crtc); |
24204 |
+ if (ret < 0) { |
24205 |
+ DRM_ERROR("failed to initialise vblank\n"); |
24206 |
+ goto vblank_fail; |
24207 |
+diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c |
24208 |
+index 10985134ce0ba..ce246b96330b7 100644 |
24209 |
+--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c |
24210 |
++++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c |
24211 |
+@@ -411,10 +411,8 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) |
24212 |
+ } |
24213 |
+ |
24214 |
+ state = kzalloc(sizeof(*state), GFP_KERNEL); |
24215 |
+- if (state) { |
24216 |
+- crtc->state = &state->base; |
24217 |
+- crtc->state->crtc = crtc; |
24218 |
+- } |
24219 |
++ if (state) |
24220 |
++ __drm_atomic_helper_crtc_reset(crtc, &state->base); |
24221 |
+ } |
24222 |
+ |
24223 |
+ static struct drm_crtc_state * |
24224 |
+@@ -528,7 +526,6 @@ int atmel_hlcdc_crtc_create(struct drm_device *dev) |
24225 |
+ } |
24226 |
+ |
24227 |
+ drm_crtc_helper_add(&crtc->base, &lcdc_crtc_helper_funcs); |
24228 |
+- drm_crtc_vblank_reset(&crtc->base); |
24229 |
+ |
24230 |
+ drm_mode_crtc_set_gamma_size(&crtc->base, ATMEL_HLCDC_CLUT_SIZE); |
24231 |
+ drm_crtc_enable_color_mgmt(&crtc->base, 0, false, |
24232 |
+diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c |
24233 |
+index 85d163f16801f..b78e142a5620c 100644 |
24234 |
+--- a/drivers/gpu/drm/drm_atomic_helper.c |
24235 |
++++ b/drivers/gpu/drm/drm_atomic_helper.c |
24236 |
+@@ -34,6 +34,7 @@ |
24237 |
+ #include <drm/drm_bridge.h> |
24238 |
+ #include <drm/drm_damage_helper.h> |
24239 |
+ #include <drm/drm_device.h> |
24240 |
++#include <drm/drm_drv.h> |
24241 |
+ #include <drm/drm_plane_helper.h> |
24242 |
+ #include <drm/drm_print.h> |
24243 |
+ #include <drm/drm_self_refresh_helper.h> |
24244 |
+@@ -3105,7 +3106,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev) |
24245 |
+ if (ret) |
24246 |
+ DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret); |
24247 |
+ |
24248 |
+- DRM_MODESET_LOCK_ALL_END(ctx, ret); |
24249 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); |
24250 |
+ } |
24251 |
+ EXPORT_SYMBOL(drm_atomic_helper_shutdown); |
24252 |
+ |
24253 |
+@@ -3245,7 +3246,7 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev) |
24254 |
+ } |
24255 |
+ |
24256 |
+ unlock: |
24257 |
+- DRM_MODESET_LOCK_ALL_END(ctx, err); |
24258 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, err); |
24259 |
+ if (err) |
24260 |
+ return ERR_PTR(err); |
24261 |
+ |
24262 |
+@@ -3326,7 +3327,7 @@ int drm_atomic_helper_resume(struct drm_device *dev, |
24263 |
+ |
24264 |
+ err = drm_atomic_helper_commit_duplicated_state(state, &ctx); |
24265 |
+ |
24266 |
+- DRM_MODESET_LOCK_ALL_END(ctx, err); |
24267 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, err); |
24268 |
+ drm_atomic_state_put(state); |
24269 |
+ |
24270 |
+ return err; |
24271 |
+diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c |
24272 |
+index 8fce6a115dfe3..9ad74045158ec 100644 |
24273 |
+--- a/drivers/gpu/drm/drm_atomic_state_helper.c |
24274 |
++++ b/drivers/gpu/drm/drm_atomic_state_helper.c |
24275 |
+@@ -32,6 +32,7 @@ |
24276 |
+ #include <drm/drm_device.h> |
24277 |
+ #include <drm/drm_plane.h> |
24278 |
+ #include <drm/drm_print.h> |
24279 |
++#include <drm/drm_vblank.h> |
24280 |
+ #include <drm/drm_writeback.h> |
24281 |
+ |
24282 |
+ #include <linux/slab.h> |
24283 |
+@@ -93,6 +94,9 @@ __drm_atomic_helper_crtc_reset(struct drm_crtc *crtc, |
24284 |
+ if (crtc_state) |
24285 |
+ __drm_atomic_helper_crtc_state_reset(crtc_state, crtc); |
24286 |
+ |
24287 |
++ if (drm_dev_has_vblank(crtc->dev)) |
24288 |
++ drm_crtc_vblank_reset(crtc); |
24289 |
++ |
24290 |
+ crtc->state = crtc_state; |
24291 |
+ } |
24292 |
+ EXPORT_SYMBOL(__drm_atomic_helper_crtc_reset); |
24293 |
+diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c |
24294 |
+index c93123ff7c218..138ff34b31db5 100644 |
24295 |
+--- a/drivers/gpu/drm/drm_color_mgmt.c |
24296 |
++++ b/drivers/gpu/drm/drm_color_mgmt.c |
24297 |
+@@ -294,7 +294,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
24298 |
+ crtc->gamma_size, &ctx); |
24299 |
+ |
24300 |
+ out: |
24301 |
+- DRM_MODESET_LOCK_ALL_END(ctx, ret); |
24302 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); |
24303 |
+ return ret; |
24304 |
+ |
24305 |
+ } |
24306 |
+diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c |
24307 |
+index 4936e1080e417..eb1c33e5d0f49 100644 |
24308 |
+--- a/drivers/gpu/drm/drm_crtc.c |
24309 |
++++ b/drivers/gpu/drm/drm_crtc.c |
24310 |
+@@ -561,7 +561,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, |
24311 |
+ if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id)) |
24312 |
+ return -EACCES; |
24313 |
+ |
24314 |
+- mutex_lock(&crtc->dev->mode_config.mutex); |
24315 |
+ DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, |
24316 |
+ DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret); |
24317 |
+ |
24318 |
+@@ -728,8 +727,7 @@ out: |
24319 |
+ fb = NULL; |
24320 |
+ mode = NULL; |
24321 |
+ |
24322 |
+- DRM_MODESET_LOCK_ALL_END(ctx, ret); |
24323 |
+- mutex_unlock(&crtc->dev->mode_config.mutex); |
24324 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); |
24325 |
+ |
24326 |
+ return ret; |
24327 |
+ } |
24328 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
24329 |
+index ffbd754a53825..954cd69117826 100644 |
24330 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
24331 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
24332 |
+@@ -4993,8 +4993,8 @@ int drm_dp_mst_add_affected_dsc_crtcs(struct drm_atomic_state *state, struct drm |
24333 |
+ |
24334 |
+ crtc = conn_state->crtc; |
24335 |
+ |
24336 |
+- if (WARN_ON(!crtc)) |
24337 |
+- return -EINVAL; |
24338 |
++ if (!crtc) |
24339 |
++ continue; |
24340 |
+ |
24341 |
+ if (!drm_dp_mst_dsc_aux_for_port(pos->port)) |
24342 |
+ continue; |
24343 |
+diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c |
24344 |
+index 901b078abf40c..db05f386a709e 100644 |
24345 |
+--- a/drivers/gpu/drm/drm_mode_object.c |
24346 |
++++ b/drivers/gpu/drm/drm_mode_object.c |
24347 |
+@@ -428,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, |
24348 |
+ out_unref: |
24349 |
+ drm_mode_object_put(obj); |
24350 |
+ out: |
24351 |
+- DRM_MODESET_LOCK_ALL_END(ctx, ret); |
24352 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); |
24353 |
+ return ret; |
24354 |
+ } |
24355 |
+ |
24356 |
+@@ -470,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj, |
24357 |
+ break; |
24358 |
+ } |
24359 |
+ drm_property_change_valid_put(prop, ref); |
24360 |
+- DRM_MODESET_LOCK_ALL_END(ctx, ret); |
24361 |
++ DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); |
24362 |
+ |
24363 |
+ return ret; |
24364 |
+ } |
24365 |
+diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c |
24366 |
+index 4af173ced3277..fdbafc2b81998 100644 |
24367 |
+--- a/drivers/gpu/drm/drm_plane.c |
24368 |
++++ b/drivers/gpu/drm/drm_plane.c |
24369 |
+@@ -791,7 +791,7 @@ static int setplane_internal(struct drm_plane *plane, |
24370 |
+ crtc_x, crtc_y, crtc_w, crtc_h, |
24371 |
+ src_x, src_y, src_w, src_h, &ctx); |
24372 |
+ |
24373 |
+- DRM_MODESET_LOCK_ALL_END(ctx, ret); |
24374 |
++ DRM_MODESET_LOCK_ALL_END(plane->dev, ctx, ret); |
24375 |
+ |
24376 |
+ return ret; |
24377 |
+ } |
24378 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
24379 |
+index 4a512b062df8f..bb9a37d3fcff6 100644 |
24380 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
24381 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c |
24382 |
+@@ -337,9 +337,16 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu) |
24383 |
+ |
24384 |
+ gpu->identity.model = gpu_read(gpu, VIVS_HI_CHIP_MODEL); |
24385 |
+ gpu->identity.revision = gpu_read(gpu, VIVS_HI_CHIP_REV); |
24386 |
+- gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID); |
24387 |
+ gpu->identity.customer_id = gpu_read(gpu, VIVS_HI_CHIP_CUSTOMER_ID); |
24388 |
+- gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID); |
24389 |
++ |
24390 |
++ /* |
24391 |
++ * Reading these two registers on GC600 rev 0x19 result in a |
24392 |
++ * unhandled fault: external abort on non-linefetch |
24393 |
++ */ |
24394 |
++ if (!etnaviv_is_model_rev(gpu, GC600, 0x19)) { |
24395 |
++ gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID); |
24396 |
++ gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID); |
24397 |
++ } |
24398 |
+ |
24399 |
+ /* |
24400 |
+ * !!!! HACK ALERT !!!! |
24401 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c |
24402 |
+index 4e3e95dce6d87..cd46c882269cc 100644 |
24403 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c |
24404 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c |
24405 |
+@@ -89,12 +89,15 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job) |
24406 |
+ u32 dma_addr; |
24407 |
+ int change; |
24408 |
+ |
24409 |
++ /* block scheduler */ |
24410 |
++ drm_sched_stop(&gpu->sched, sched_job); |
24411 |
++ |
24412 |
+ /* |
24413 |
+ * If the GPU managed to complete this jobs fence, the timout is |
24414 |
+ * spurious. Bail out. |
24415 |
+ */ |
24416 |
+ if (dma_fence_is_signaled(submit->out_fence)) |
24417 |
+- return; |
24418 |
++ goto out_no_timeout; |
24419 |
+ |
24420 |
+ /* |
24421 |
+ * If the GPU is still making forward progress on the front-end (which |
24422 |
+@@ -105,12 +108,9 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job) |
24423 |
+ change = dma_addr - gpu->hangcheck_dma_addr; |
24424 |
+ if (change < 0 || change > 16) { |
24425 |
+ gpu->hangcheck_dma_addr = dma_addr; |
24426 |
+- return; |
24427 |
++ goto out_no_timeout; |
24428 |
+ } |
24429 |
+ |
24430 |
+- /* block scheduler */ |
24431 |
+- drm_sched_stop(&gpu->sched, sched_job); |
24432 |
+- |
24433 |
+ if(sched_job) |
24434 |
+ drm_sched_increase_karma(sched_job); |
24435 |
+ |
24436 |
+@@ -120,6 +120,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job) |
24437 |
+ |
24438 |
+ drm_sched_resubmit_jobs(&gpu->sched); |
24439 |
+ |
24440 |
++out_no_timeout: |
24441 |
+ /* restart scheduler after GPU is usable again */ |
24442 |
+ drm_sched_start(&gpu->sched, true); |
24443 |
+ } |
24444 |
+diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c |
24445 |
+index 372354d33f552..5ac4a999f05a6 100644 |
24446 |
+--- a/drivers/gpu/drm/i915/i915_cmd_parser.c |
24447 |
++++ b/drivers/gpu/drm/i915/i915_cmd_parser.c |
24448 |
+@@ -1204,6 +1204,12 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, |
24449 |
+ return dst; |
24450 |
+ } |
24451 |
+ |
24452 |
++static inline bool cmd_desc_is(const struct drm_i915_cmd_descriptor * const desc, |
24453 |
++ const u32 cmd) |
24454 |
++{ |
24455 |
++ return desc->cmd.value == (cmd & desc->cmd.mask); |
24456 |
++} |
24457 |
++ |
24458 |
+ static bool check_cmd(const struct intel_engine_cs *engine, |
24459 |
+ const struct drm_i915_cmd_descriptor *desc, |
24460 |
+ const u32 *cmd, u32 length) |
24461 |
+@@ -1242,19 +1248,19 @@ static bool check_cmd(const struct intel_engine_cs *engine, |
24462 |
+ * allowed mask/value pair given in the whitelist entry. |
24463 |
+ */ |
24464 |
+ if (reg->mask) { |
24465 |
+- if (desc->cmd.value == MI_LOAD_REGISTER_MEM) { |
24466 |
++ if (cmd_desc_is(desc, MI_LOAD_REGISTER_MEM)) { |
24467 |
+ DRM_DEBUG("CMD: Rejected LRM to masked register 0x%08X\n", |
24468 |
+ reg_addr); |
24469 |
+ return false; |
24470 |
+ } |
24471 |
+ |
24472 |
+- if (desc->cmd.value == MI_LOAD_REGISTER_REG) { |
24473 |
++ if (cmd_desc_is(desc, MI_LOAD_REGISTER_REG)) { |
24474 |
+ DRM_DEBUG("CMD: Rejected LRR to masked register 0x%08X\n", |
24475 |
+ reg_addr); |
24476 |
+ return false; |
24477 |
+ } |
24478 |
+ |
24479 |
+- if (desc->cmd.value == MI_LOAD_REGISTER_IMM(1) && |
24480 |
++ if (cmd_desc_is(desc, MI_LOAD_REGISTER_IMM(1)) && |
24481 |
+ (offset + 2 > length || |
24482 |
+ (cmd[offset + 1] & reg->mask) != reg->value)) { |
24483 |
+ DRM_DEBUG("CMD: Rejected LRI to masked register 0x%08X\n", |
24484 |
+@@ -1478,7 +1484,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine, |
24485 |
+ break; |
24486 |
+ } |
24487 |
+ |
24488 |
+- if (desc->cmd.value == MI_BATCH_BUFFER_START) { |
24489 |
++ if (cmd_desc_is(desc, MI_BATCH_BUFFER_START)) { |
24490 |
+ ret = check_bbstart(cmd, offset, length, batch_length, |
24491 |
+ batch_addr, shadow_addr, |
24492 |
+ jump_whitelist); |
24493 |
+diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
24494 |
+index 5db06b5909438..e7b39f3ca33dc 100644 |
24495 |
+--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
24496 |
++++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c |
24497 |
+@@ -396,7 +396,7 @@ int adreno_hw_init(struct msm_gpu *gpu) |
24498 |
+ ring->next = ring->start; |
24499 |
+ |
24500 |
+ /* reset completed fence seqno: */ |
24501 |
+- ring->memptrs->fence = ring->seqno; |
24502 |
++ ring->memptrs->fence = ring->fctx->completed_fence; |
24503 |
+ ring->memptrs->rptr = 0; |
24504 |
+ } |
24505 |
+ |
24506 |
+diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |
24507 |
+index b5fed67c4651f..0c54b7bc19010 100644 |
24508 |
+--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |
24509 |
++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |
24510 |
+@@ -1117,8 +1117,6 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) |
24511 |
+ mdp5_crtc_destroy_state(crtc, crtc->state); |
24512 |
+ |
24513 |
+ __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base); |
24514 |
+- |
24515 |
+- drm_crtc_vblank_reset(crtc); |
24516 |
+ } |
24517 |
+ |
24518 |
+ static const struct drm_crtc_funcs mdp5_crtc_funcs = { |
24519 |
+diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
24520 |
+index 800b7757252e3..d2c2d102e7329 100644 |
24521 |
+--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c |
24522 |
++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c |
24523 |
+@@ -2160,8 +2160,10 @@ nv50_disp_atomic_commit(struct drm_device *dev, |
24524 |
+ int ret, i; |
24525 |
+ |
24526 |
+ ret = pm_runtime_get_sync(dev->dev); |
24527 |
+- if (ret < 0 && ret != -EACCES) |
24528 |
++ if (ret < 0 && ret != -EACCES) { |
24529 |
++ pm_runtime_put_autosuspend(dev->dev); |
24530 |
+ return ret; |
24531 |
++ } |
24532 |
+ |
24533 |
+ ret = drm_atomic_helper_setup_commit(state, nonblock); |
24534 |
+ if (ret) |
24535 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c |
24536 |
+index 1b383ae0248f3..ef8ddbe445812 100644 |
24537 |
+--- a/drivers/gpu/drm/nouveau/nouveau_connector.c |
24538 |
++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c |
24539 |
+@@ -572,8 +572,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) |
24540 |
+ pm_runtime_get_noresume(dev->dev); |
24541 |
+ } else { |
24542 |
+ ret = pm_runtime_get_sync(dev->dev); |
24543 |
+- if (ret < 0 && ret != -EACCES) |
24544 |
++ if (ret < 0 && ret != -EACCES) { |
24545 |
++ pm_runtime_put_autosuspend(dev->dev); |
24546 |
+ return conn_status; |
24547 |
++ } |
24548 |
+ } |
24549 |
+ |
24550 |
+ nv_encoder = nouveau_connector_ddc_detect(connector); |
24551 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
24552 |
+index d5c23d1c20d88..44e515bbbb444 100644 |
24553 |
+--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
24554 |
++++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c |
24555 |
+@@ -189,8 +189,10 @@ nouveau_fbcon_open(struct fb_info *info, int user) |
24556 |
+ struct nouveau_fbdev *fbcon = info->par; |
24557 |
+ struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev); |
24558 |
+ int ret = pm_runtime_get_sync(drm->dev->dev); |
24559 |
+- if (ret < 0 && ret != -EACCES) |
24560 |
++ if (ret < 0 && ret != -EACCES) { |
24561 |
++ pm_runtime_put(drm->dev->dev); |
24562 |
+ return ret; |
24563 |
++ } |
24564 |
+ return 0; |
24565 |
+ } |
24566 |
+ |
24567 |
+diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c |
24568 |
+index fce7e944a280b..6d40914675dad 100644 |
24569 |
+--- a/drivers/gpu/drm/omapdrm/omap_crtc.c |
24570 |
++++ b/drivers/gpu/drm/omapdrm/omap_crtc.c |
24571 |
+@@ -697,14 +697,16 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, |
24572 |
+ |
24573 |
+ static void omap_crtc_reset(struct drm_crtc *crtc) |
24574 |
+ { |
24575 |
++ struct omap_crtc_state *state; |
24576 |
++ |
24577 |
+ if (crtc->state) |
24578 |
+ __drm_atomic_helper_crtc_destroy_state(crtc->state); |
24579 |
+ |
24580 |
+ kfree(crtc->state); |
24581 |
+- crtc->state = kzalloc(sizeof(struct omap_crtc_state), GFP_KERNEL); |
24582 |
+ |
24583 |
+- if (crtc->state) |
24584 |
+- crtc->state->crtc = crtc; |
24585 |
++ state = kzalloc(sizeof(*state), GFP_KERNEL); |
24586 |
++ if (state) |
24587 |
++ __drm_atomic_helper_crtc_reset(crtc, &state->base); |
24588 |
+ } |
24589 |
+ |
24590 |
+ static struct drm_crtc_state * |
24591 |
+diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c |
24592 |
+index cdafd7ef1c320..cc4d754ff8c02 100644 |
24593 |
+--- a/drivers/gpu/drm/omapdrm/omap_drv.c |
24594 |
++++ b/drivers/gpu/drm/omapdrm/omap_drv.c |
24595 |
+@@ -595,7 +595,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) |
24596 |
+ { |
24597 |
+ const struct soc_device_attribute *soc; |
24598 |
+ struct drm_device *ddev; |
24599 |
+- unsigned int i; |
24600 |
+ int ret; |
24601 |
+ |
24602 |
+ DBG("%s", dev_name(dev)); |
24603 |
+@@ -642,9 +641,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) |
24604 |
+ goto err_cleanup_modeset; |
24605 |
+ } |
24606 |
+ |
24607 |
+- for (i = 0; i < priv->num_pipes; i++) |
24608 |
+- drm_crtc_vblank_off(priv->pipes[i].crtc); |
24609 |
+- |
24610 |
+ omap_fbdev_init(ddev); |
24611 |
+ |
24612 |
+ drm_kms_helper_poll_init(ddev); |
24613 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
24614 |
+index fe12d9d91d7a5..e308344344425 100644 |
24615 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
24616 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
24617 |
+@@ -879,8 +879,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force) |
24618 |
+ |
24619 |
+ if (!drm_kms_helper_is_poll_worker()) { |
24620 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
24621 |
+- if (r < 0) |
24622 |
++ if (r < 0) { |
24623 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
24624 |
+ return connector_status_disconnected; |
24625 |
++ } |
24626 |
+ } |
24627 |
+ |
24628 |
+ if (encoder) { |
24629 |
+@@ -1025,8 +1027,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force) |
24630 |
+ |
24631 |
+ if (!drm_kms_helper_is_poll_worker()) { |
24632 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
24633 |
+- if (r < 0) |
24634 |
++ if (r < 0) { |
24635 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
24636 |
+ return connector_status_disconnected; |
24637 |
++ } |
24638 |
+ } |
24639 |
+ |
24640 |
+ encoder = radeon_best_single_encoder(connector); |
24641 |
+@@ -1163,8 +1167,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force) |
24642 |
+ |
24643 |
+ if (!drm_kms_helper_is_poll_worker()) { |
24644 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
24645 |
+- if (r < 0) |
24646 |
++ if (r < 0) { |
24647 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
24648 |
+ return connector_status_disconnected; |
24649 |
++ } |
24650 |
+ } |
24651 |
+ |
24652 |
+ encoder = radeon_best_single_encoder(connector); |
24653 |
+@@ -1247,8 +1253,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) |
24654 |
+ |
24655 |
+ if (!drm_kms_helper_is_poll_worker()) { |
24656 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
24657 |
+- if (r < 0) |
24658 |
++ if (r < 0) { |
24659 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
24660 |
+ return connector_status_disconnected; |
24661 |
++ } |
24662 |
+ } |
24663 |
+ |
24664 |
+ if (radeon_connector->detected_hpd_without_ddc) { |
24665 |
+@@ -1657,8 +1665,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force) |
24666 |
+ |
24667 |
+ if (!drm_kms_helper_is_poll_worker()) { |
24668 |
+ r = pm_runtime_get_sync(connector->dev->dev); |
24669 |
+- if (r < 0) |
24670 |
++ if (r < 0) { |
24671 |
++ pm_runtime_put_autosuspend(connector->dev->dev); |
24672 |
+ return connector_status_disconnected; |
24673 |
++ } |
24674 |
+ } |
24675 |
+ |
24676 |
+ if (!force && radeon_check_hpd_status_unchanged(connector)) { |
24677 |
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
24678 |
+index d73e88ddecd0f..fe86a3e677571 100644 |
24679 |
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
24680 |
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c |
24681 |
+@@ -975,8 +975,7 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) |
24682 |
+ state->crc.source = VSP1_DU_CRC_NONE; |
24683 |
+ state->crc.index = 0; |
24684 |
+ |
24685 |
+- crtc->state = &state->state; |
24686 |
+- crtc->state->crtc = crtc; |
24687 |
++ __drm_atomic_helper_crtc_reset(crtc, &state->state); |
24688 |
+ } |
24689 |
+ |
24690 |
+ static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc) |
24691 |
+@@ -1271,9 +1270,6 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex, |
24692 |
+ |
24693 |
+ drm_crtc_helper_add(crtc, &crtc_helper_funcs); |
24694 |
+ |
24695 |
+- /* Start with vertical blanking interrupt reporting disabled. */ |
24696 |
+- drm_crtc_vblank_off(crtc); |
24697 |
+- |
24698 |
+ /* Register the interrupt handler. */ |
24699 |
+ if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CRTC_IRQ_CLOCK)) { |
24700 |
+ /* The IRQ's are associated with the CRTC (sw)index. */ |
24701 |
+diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c |
24702 |
+index 04d6848d19fcf..da8b9983b7de0 100644 |
24703 |
+--- a/drivers/gpu/drm/tegra/dc.c |
24704 |
++++ b/drivers/gpu/drm/tegra/dc.c |
24705 |
+@@ -1169,7 +1169,6 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) |
24706 |
+ tegra_crtc_atomic_destroy_state(crtc, crtc->state); |
24707 |
+ |
24708 |
+ __drm_atomic_helper_crtc_reset(crtc, &state->base); |
24709 |
+- drm_crtc_vblank_reset(crtc); |
24710 |
+ } |
24711 |
+ |
24712 |
+ static struct drm_crtc_state * |
24713 |
+diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c |
24714 |
+index 89a226912de85..4d01c4af61cd0 100644 |
24715 |
+--- a/drivers/gpu/drm/tidss/tidss_crtc.c |
24716 |
++++ b/drivers/gpu/drm/tidss/tidss_crtc.c |
24717 |
+@@ -352,8 +352,7 @@ static void tidss_crtc_reset(struct drm_crtc *crtc) |
24718 |
+ return; |
24719 |
+ } |
24720 |
+ |
24721 |
+- crtc->state = &tcrtc->base; |
24722 |
+- crtc->state->crtc = crtc; |
24723 |
++ __drm_atomic_helper_crtc_reset(crtc, &tcrtc->base); |
24724 |
+ } |
24725 |
+ |
24726 |
+ static struct drm_crtc_state *tidss_crtc_duplicate_state(struct drm_crtc *crtc) |
24727 |
+diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c |
24728 |
+index c0240f7e0b198..eec359f61a06d 100644 |
24729 |
+--- a/drivers/gpu/drm/tidss/tidss_kms.c |
24730 |
++++ b/drivers/gpu/drm/tidss/tidss_kms.c |
24731 |
+@@ -253,7 +253,6 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) |
24732 |
+ int tidss_modeset_init(struct tidss_device *tidss) |
24733 |
+ { |
24734 |
+ struct drm_device *ddev = &tidss->ddev; |
24735 |
+- unsigned int i; |
24736 |
+ int ret; |
24737 |
+ |
24738 |
+ dev_dbg(tidss->dev, "%s\n", __func__); |
24739 |
+@@ -278,10 +277,6 @@ int tidss_modeset_init(struct tidss_device *tidss) |
24740 |
+ if (ret) |
24741 |
+ return ret; |
24742 |
+ |
24743 |
+- /* Start with vertical blanking interrupt reporting disabled. */ |
24744 |
+- for (i = 0; i < tidss->num_crtcs; ++i) |
24745 |
+- drm_crtc_vblank_reset(tidss->crtcs[i]); |
24746 |
+- |
24747 |
+ drm_mode_config_reset(ddev); |
24748 |
+ |
24749 |
+ dev_dbg(tidss->dev, "%s done\n", __func__); |
24750 |
+diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c |
24751 |
+index 6ccbd01cd888c..703b5cd517519 100644 |
24752 |
+--- a/drivers/gpu/drm/virtio/virtgpu_object.c |
24753 |
++++ b/drivers/gpu/drm/virtio/virtgpu_object.c |
24754 |
+@@ -79,6 +79,7 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object *bo) |
24755 |
+ } |
24756 |
+ |
24757 |
+ sg_free_table(shmem->pages); |
24758 |
++ kfree(shmem->pages); |
24759 |
+ shmem->pages = NULL; |
24760 |
+ drm_gem_shmem_unpin(&bo->base.base); |
24761 |
+ } |
24762 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |
24763 |
+index 009f1742bed51..c4017c7a24db6 100644 |
24764 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |
24765 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |
24766 |
+@@ -387,8 +387,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) |
24767 |
+ ldu->base.is_implicit = true; |
24768 |
+ |
24769 |
+ /* Initialize primary plane */ |
24770 |
+- vmw_du_plane_reset(primary); |
24771 |
+- |
24772 |
+ ret = drm_universal_plane_init(dev, &ldu->base.primary, |
24773 |
+ 0, &vmw_ldu_plane_funcs, |
24774 |
+ vmw_primary_plane_formats, |
24775 |
+@@ -402,8 +400,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) |
24776 |
+ drm_plane_helper_add(primary, &vmw_ldu_primary_plane_helper_funcs); |
24777 |
+ |
24778 |
+ /* Initialize cursor plane */ |
24779 |
+- vmw_du_plane_reset(cursor); |
24780 |
+- |
24781 |
+ ret = drm_universal_plane_init(dev, &ldu->base.cursor, |
24782 |
+ 0, &vmw_ldu_cursor_funcs, |
24783 |
+ vmw_cursor_plane_formats, |
24784 |
+@@ -417,7 +413,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) |
24785 |
+ |
24786 |
+ drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs); |
24787 |
+ |
24788 |
+- vmw_du_connector_reset(connector); |
24789 |
+ ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, |
24790 |
+ DRM_MODE_CONNECTOR_VIRTUAL); |
24791 |
+ if (ret) { |
24792 |
+@@ -445,7 +440,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) |
24793 |
+ goto err_free_encoder; |
24794 |
+ } |
24795 |
+ |
24796 |
+- vmw_du_crtc_reset(crtc); |
24797 |
+ ret = drm_crtc_init_with_planes(dev, crtc, &ldu->base.primary, |
24798 |
+ &ldu->base.cursor, |
24799 |
+ &vmw_legacy_crtc_funcs, NULL); |
24800 |
+@@ -520,6 +514,8 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv) |
24801 |
+ |
24802 |
+ dev_priv->active_display_unit = vmw_du_legacy; |
24803 |
+ |
24804 |
++ drm_mode_config_reset(dev); |
24805 |
++ |
24806 |
+ DRM_INFO("Legacy Display Unit initialized\n"); |
24807 |
+ |
24808 |
+ return 0; |
24809 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
24810 |
+index 32a22e4eddb1a..4bf0f5ec4fc2d 100644 |
24811 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
24812 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |
24813 |
+@@ -859,8 +859,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) |
24814 |
+ sou->base.is_implicit = false; |
24815 |
+ |
24816 |
+ /* Initialize primary plane */ |
24817 |
+- vmw_du_plane_reset(primary); |
24818 |
+- |
24819 |
+ ret = drm_universal_plane_init(dev, &sou->base.primary, |
24820 |
+ 0, &vmw_sou_plane_funcs, |
24821 |
+ vmw_primary_plane_formats, |
24822 |
+@@ -875,8 +873,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) |
24823 |
+ drm_plane_enable_fb_damage_clips(primary); |
24824 |
+ |
24825 |
+ /* Initialize cursor plane */ |
24826 |
+- vmw_du_plane_reset(cursor); |
24827 |
+- |
24828 |
+ ret = drm_universal_plane_init(dev, &sou->base.cursor, |
24829 |
+ 0, &vmw_sou_cursor_funcs, |
24830 |
+ vmw_cursor_plane_formats, |
24831 |
+@@ -890,7 +886,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) |
24832 |
+ |
24833 |
+ drm_plane_helper_add(cursor, &vmw_sou_cursor_plane_helper_funcs); |
24834 |
+ |
24835 |
+- vmw_du_connector_reset(connector); |
24836 |
+ ret = drm_connector_init(dev, connector, &vmw_sou_connector_funcs, |
24837 |
+ DRM_MODE_CONNECTOR_VIRTUAL); |
24838 |
+ if (ret) { |
24839 |
+@@ -918,8 +913,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) |
24840 |
+ goto err_free_encoder; |
24841 |
+ } |
24842 |
+ |
24843 |
+- |
24844 |
+- vmw_du_crtc_reset(crtc); |
24845 |
+ ret = drm_crtc_init_with_planes(dev, crtc, &sou->base.primary, |
24846 |
+ &sou->base.cursor, |
24847 |
+ &vmw_screen_object_crtc_funcs, NULL); |
24848 |
+@@ -973,6 +966,8 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv) |
24849 |
+ |
24850 |
+ dev_priv->active_display_unit = vmw_du_screen_object; |
24851 |
+ |
24852 |
++ drm_mode_config_reset(dev); |
24853 |
++ |
24854 |
+ DRM_INFO("Screen Objects Display Unit initialized\n"); |
24855 |
+ |
24856 |
+ return 0; |
24857 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
24858 |
+index 16b3856296889..cf3aafd00837c 100644 |
24859 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
24860 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |
24861 |
+@@ -1738,8 +1738,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit) |
24862 |
+ stdu->base.is_implicit = false; |
24863 |
+ |
24864 |
+ /* Initialize primary plane */ |
24865 |
+- vmw_du_plane_reset(primary); |
24866 |
+- |
24867 |
+ ret = drm_universal_plane_init(dev, primary, |
24868 |
+ 0, &vmw_stdu_plane_funcs, |
24869 |
+ vmw_primary_plane_formats, |
24870 |
+@@ -1754,8 +1752,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit) |
24871 |
+ drm_plane_enable_fb_damage_clips(primary); |
24872 |
+ |
24873 |
+ /* Initialize cursor plane */ |
24874 |
+- vmw_du_plane_reset(cursor); |
24875 |
+- |
24876 |
+ ret = drm_universal_plane_init(dev, cursor, |
24877 |
+ 0, &vmw_stdu_cursor_funcs, |
24878 |
+ vmw_cursor_plane_formats, |
24879 |
+@@ -1769,8 +1765,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit) |
24880 |
+ |
24881 |
+ drm_plane_helper_add(cursor, &vmw_stdu_cursor_plane_helper_funcs); |
24882 |
+ |
24883 |
+- vmw_du_connector_reset(connector); |
24884 |
+- |
24885 |
+ ret = drm_connector_init(dev, connector, &vmw_stdu_connector_funcs, |
24886 |
+ DRM_MODE_CONNECTOR_VIRTUAL); |
24887 |
+ if (ret) { |
24888 |
+@@ -1798,7 +1792,6 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit) |
24889 |
+ goto err_free_encoder; |
24890 |
+ } |
24891 |
+ |
24892 |
+- vmw_du_crtc_reset(crtc); |
24893 |
+ ret = drm_crtc_init_with_planes(dev, crtc, &stdu->base.primary, |
24894 |
+ &stdu->base.cursor, |
24895 |
+ &vmw_stdu_crtc_funcs, NULL); |
24896 |
+@@ -1894,6 +1887,8 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) |
24897 |
+ } |
24898 |
+ } |
24899 |
+ |
24900 |
++ drm_mode_config_reset(dev); |
24901 |
++ |
24902 |
+ DRM_INFO("Screen Target Display device initialized\n"); |
24903 |
+ |
24904 |
+ return 0; |
24905 |
+diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c |
24906 |
+index a10643aa89aa5..2ac5a99406d98 100644 |
24907 |
+--- a/drivers/gpu/host1x/job.c |
24908 |
++++ b/drivers/gpu/host1x/job.c |
24909 |
+@@ -102,6 +102,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24910 |
+ { |
24911 |
+ struct host1x_client *client = job->client; |
24912 |
+ struct device *dev = client->dev; |
24913 |
++ struct host1x_job_gather *g; |
24914 |
+ struct iommu_domain *domain; |
24915 |
+ unsigned int i; |
24916 |
+ int err; |
24917 |
+@@ -184,7 +185,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24918 |
+ } |
24919 |
+ |
24920 |
+ for (i = 0; i < job->num_gathers; i++) { |
24921 |
+- struct host1x_job_gather *g = &job->gathers[i]; |
24922 |
+ size_t gather_size = 0; |
24923 |
+ struct scatterlist *sg; |
24924 |
+ struct sg_table *sgt; |
24925 |
+@@ -194,6 +194,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24926 |
+ dma_addr_t *phys; |
24927 |
+ unsigned int j; |
24928 |
+ |
24929 |
++ g = &job->gathers[i]; |
24930 |
+ g->bo = host1x_bo_get(g->bo); |
24931 |
+ if (!g->bo) { |
24932 |
+ err = -EINVAL; |
24933 |
+@@ -213,7 +214,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24934 |
+ sgt = host1x_bo_pin(host->dev, g->bo, phys); |
24935 |
+ if (IS_ERR(sgt)) { |
24936 |
+ err = PTR_ERR(sgt); |
24937 |
+- goto unpin; |
24938 |
++ goto put; |
24939 |
+ } |
24940 |
+ |
24941 |
+ if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) { |
24942 |
+@@ -226,7 +227,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24943 |
+ host->iova_end >> shift, true); |
24944 |
+ if (!alloc) { |
24945 |
+ err = -ENOMEM; |
24946 |
+- goto unpin; |
24947 |
++ goto put; |
24948 |
+ } |
24949 |
+ |
24950 |
+ err = iommu_map_sg(host->domain, |
24951 |
+@@ -235,7 +236,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24952 |
+ if (err == 0) { |
24953 |
+ __free_iova(&host->iova, alloc); |
24954 |
+ err = -EINVAL; |
24955 |
+- goto unpin; |
24956 |
++ goto put; |
24957 |
+ } |
24958 |
+ |
24959 |
+ job->unpins[job->num_unpins].size = gather_size; |
24960 |
+@@ -245,7 +246,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24961 |
+ DMA_TO_DEVICE); |
24962 |
+ if (!err) { |
24963 |
+ err = -ENOMEM; |
24964 |
+- goto unpin; |
24965 |
++ goto put; |
24966 |
+ } |
24967 |
+ |
24968 |
+ job->unpins[job->num_unpins].dir = DMA_TO_DEVICE; |
24969 |
+@@ -263,6 +264,8 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job) |
24970 |
+ |
24971 |
+ return 0; |
24972 |
+ |
24973 |
++put: |
24974 |
++ host1x_bo_put(g->bo); |
24975 |
+ unpin: |
24976 |
+ host1x_job_unpin(job); |
24977 |
+ return err; |
24978 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
24979 |
+index 6f370e020feb3..7cfa9785bfbb0 100644 |
24980 |
+--- a/drivers/hid/hid-ids.h |
24981 |
++++ b/drivers/hid/hid-ids.h |
24982 |
+@@ -773,6 +773,7 @@ |
24983 |
+ #define USB_DEVICE_ID_LOGITECH_G27_WHEEL 0xc29b |
24984 |
+ #define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c |
24985 |
+ #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a |
24986 |
++#define USB_DEVICE_ID_LOGITECH_GROUP_AUDIO 0x0882 |
24987 |
+ #define USB_DEVICE_ID_S510_RECEIVER 0xc50c |
24988 |
+ #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 |
24989 |
+ #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 |
24990 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
24991 |
+index 934fc0a798d4d..c242150d35a3a 100644 |
24992 |
+--- a/drivers/hid/hid-quirks.c |
24993 |
++++ b/drivers/hid/hid-quirks.c |
24994 |
+@@ -179,6 +179,7 @@ static const struct hid_device_id hid_quirks[] = { |
24995 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
24996 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
24997 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, |
24998 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_GROUP_AUDIO), HID_QUIRK_NOGET }, |
24999 |
+ |
25000 |
+ { 0 } |
25001 |
+ }; |
25002 |
+diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c |
25003 |
+index 294c84e136d72..dbd04492825d4 100644 |
25004 |
+--- a/drivers/hid/i2c-hid/i2c-hid-core.c |
25005 |
++++ b/drivers/hid/i2c-hid/i2c-hid-core.c |
25006 |
+@@ -420,6 +420,19 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) |
25007 |
+ dev_err(&client->dev, "failed to change power setting.\n"); |
25008 |
+ |
25009 |
+ set_pwr_exit: |
25010 |
++ |
25011 |
++ /* |
25012 |
++ * The HID over I2C specification states that if a DEVICE needs time |
25013 |
++ * after the PWR_ON request, it should utilise CLOCK stretching. |
25014 |
++ * However, it has been observered that the Windows driver provides a |
25015 |
++ * 1ms sleep between the PWR_ON and RESET requests. |
25016 |
++ * According to Goodix Windows even waits 60 ms after (other?) |
25017 |
++ * PWR_ON requests. Testing has confirmed that several devices |
25018 |
++ * will not work properly without a delay after a PWR_ON request. |
25019 |
++ */ |
25020 |
++ if (!ret && power_state == I2C_HID_PWR_ON) |
25021 |
++ msleep(60); |
25022 |
++ |
25023 |
+ return ret; |
25024 |
+ } |
25025 |
+ |
25026 |
+@@ -441,15 +454,6 @@ static int i2c_hid_hwreset(struct i2c_client *client) |
25027 |
+ if (ret) |
25028 |
+ goto out_unlock; |
25029 |
+ |
25030 |
+- /* |
25031 |
+- * The HID over I2C specification states that if a DEVICE needs time |
25032 |
+- * after the PWR_ON request, it should utilise CLOCK stretching. |
25033 |
+- * However, it has been observered that the Windows driver provides a |
25034 |
+- * 1ms sleep between the PWR_ON and RESET requests and that some devices |
25035 |
+- * rely on this. |
25036 |
+- */ |
25037 |
+- usleep_range(1000, 5000); |
25038 |
+- |
25039 |
+ i2c_hid_dbg(ihid, "resetting...\n"); |
25040 |
+ |
25041 |
+ ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0); |
25042 |
+diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c |
25043 |
+index 4140dea693e90..4f97e6c120595 100644 |
25044 |
+--- a/drivers/hid/usbhid/hiddev.c |
25045 |
++++ b/drivers/hid/usbhid/hiddev.c |
25046 |
+@@ -519,12 +519,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, |
25047 |
+ |
25048 |
+ switch (cmd) { |
25049 |
+ case HIDIOCGUSAGE: |
25050 |
++ if (uref->usage_index >= field->report_count) |
25051 |
++ goto inval; |
25052 |
+ uref->value = field->value[uref->usage_index]; |
25053 |
+ if (copy_to_user(user_arg, uref, sizeof(*uref))) |
25054 |
+ goto fault; |
25055 |
+ goto goodreturn; |
25056 |
+ |
25057 |
+ case HIDIOCSUSAGE: |
25058 |
++ if (uref->usage_index >= field->report_count) |
25059 |
++ goto inval; |
25060 |
+ field->value[uref->usage_index] = uref->value; |
25061 |
+ goto goodreturn; |
25062 |
+ |
25063 |
+diff --git a/drivers/hwmon/gsc-hwmon.c b/drivers/hwmon/gsc-hwmon.c |
25064 |
+index 2137bc65829d3..35337922aa1bd 100644 |
25065 |
+--- a/drivers/hwmon/gsc-hwmon.c |
25066 |
++++ b/drivers/hwmon/gsc-hwmon.c |
25067 |
+@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, |
25068 |
+ case mode_temperature: |
25069 |
+ if (tmp > 0x8000) |
25070 |
+ tmp -= 0xffff; |
25071 |
++ tmp *= 100; /* convert to millidegrees celsius */ |
25072 |
+ break; |
25073 |
+ case mode_voltage_raw: |
25074 |
+ tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION)); |
25075 |
+diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c |
25076 |
+index b0425694f7022..242ff8bee78dd 100644 |
25077 |
+--- a/drivers/hwmon/nct7904.c |
25078 |
++++ b/drivers/hwmon/nct7904.c |
25079 |
+@@ -231,7 +231,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel, |
25080 |
+ if (ret < 0) |
25081 |
+ return ret; |
25082 |
+ cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f); |
25083 |
+- if (cnt == 0x1fff) |
25084 |
++ if (cnt == 0 || cnt == 0x1fff) |
25085 |
+ rpm = 0; |
25086 |
+ else |
25087 |
+ rpm = 1350000 / cnt; |
25088 |
+@@ -243,7 +243,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel, |
25089 |
+ if (ret < 0) |
25090 |
+ return ret; |
25091 |
+ cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f); |
25092 |
+- if (cnt == 0x1fff) |
25093 |
++ if (cnt == 0 || cnt == 0x1fff) |
25094 |
+ rpm = 0; |
25095 |
+ else |
25096 |
+ rpm = 1350000 / cnt; |
25097 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
25098 |
+index fea644921a768..f206e28af5831 100644 |
25099 |
+--- a/drivers/i2c/busses/i2c-i801.c |
25100 |
++++ b/drivers/i2c/busses/i2c-i801.c |
25101 |
+@@ -67,6 +67,7 @@ |
25102 |
+ * Comet Lake-H (PCH) 0x06a3 32 hard yes yes yes |
25103 |
+ * Elkhart Lake (PCH) 0x4b23 32 hard yes yes yes |
25104 |
+ * Tiger Lake-LP (PCH) 0xa0a3 32 hard yes yes yes |
25105 |
++ * Tiger Lake-H (PCH) 0x43a3 32 hard yes yes yes |
25106 |
+ * Jasper Lake (SOC) 0x4da3 32 hard yes yes yes |
25107 |
+ * Comet Lake-V (PCH) 0xa3a3 32 hard yes yes yes |
25108 |
+ * |
25109 |
+@@ -221,6 +222,7 @@ |
25110 |
+ #define PCI_DEVICE_ID_INTEL_GEMINILAKE_SMBUS 0x31d4 |
25111 |
+ #define PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS 0x34a3 |
25112 |
+ #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 |
25113 |
++#define PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS 0x43a3 |
25114 |
+ #define PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS 0x4b23 |
25115 |
+ #define PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS 0x4da3 |
25116 |
+ #define PCI_DEVICE_ID_INTEL_BROXTON_SMBUS 0x5ad4 |
25117 |
+@@ -1074,6 +1076,7 @@ static const struct pci_device_id i801_ids[] = { |
25118 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COMETLAKE_V_SMBUS) }, |
25119 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS) }, |
25120 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TIGERLAKE_LP_SMBUS) }, |
25121 |
++ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS) }, |
25122 |
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS) }, |
25123 |
+ { 0, } |
25124 |
+ }; |
25125 |
+@@ -1748,6 +1751,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) |
25126 |
+ case PCI_DEVICE_ID_INTEL_COMETLAKE_H_SMBUS: |
25127 |
+ case PCI_DEVICE_ID_INTEL_ELKHART_LAKE_SMBUS: |
25128 |
+ case PCI_DEVICE_ID_INTEL_TIGERLAKE_LP_SMBUS: |
25129 |
++ case PCI_DEVICE_ID_INTEL_TIGERLAKE_H_SMBUS: |
25130 |
+ case PCI_DEVICE_ID_INTEL_JASPER_LAKE_SMBUS: |
25131 |
+ priv->features |= FEATURE_BLOCK_PROC; |
25132 |
+ priv->features |= FEATURE_I2C_BLOCK_READ; |
25133 |
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c |
25134 |
+index 9e883474db8ce..c7c543483b08c 100644 |
25135 |
+--- a/drivers/i2c/busses/i2c-rcar.c |
25136 |
++++ b/drivers/i2c/busses/i2c-rcar.c |
25137 |
+@@ -590,6 +590,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv) |
25138 |
+ /* master sent stop */ |
25139 |
+ if (ssr_filtered & SSR) { |
25140 |
+ i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); |
25141 |
++ rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */ |
25142 |
+ rcar_i2c_write(priv, ICSIER, SAR); |
25143 |
+ rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); |
25144 |
+ } |
25145 |
+diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c |
25146 |
+index 26f03a14a4781..4f09d4c318287 100644 |
25147 |
+--- a/drivers/i2c/i2c-core-base.c |
25148 |
++++ b/drivers/i2c/i2c-core-base.c |
25149 |
+@@ -354,7 +354,7 @@ static int i2c_device_probe(struct device *dev) |
25150 |
+ * or ACPI ID table is supplied for the probing device. |
25151 |
+ */ |
25152 |
+ if (!driver->id_table && |
25153 |
+- !i2c_acpi_match_device(dev->driver->acpi_match_table, client) && |
25154 |
++ !acpi_driver_match_device(dev, dev->driver) && |
25155 |
+ !i2c_of_match_device(dev->driver->of_match_table, client)) { |
25156 |
+ status = -ENODEV; |
25157 |
+ goto put_sync_adapter; |
25158 |
+diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c |
25159 |
+index 4959f5df21bd0..5141d49a046ba 100644 |
25160 |
+--- a/drivers/iommu/dma-iommu.c |
25161 |
++++ b/drivers/iommu/dma-iommu.c |
25162 |
+@@ -1035,8 +1035,8 @@ static void *iommu_dma_alloc(struct device *dev, size_t size, |
25163 |
+ |
25164 |
+ if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) && |
25165 |
+ !gfpflags_allow_blocking(gfp) && !coherent) |
25166 |
+- cpu_addr = dma_alloc_from_pool(dev, PAGE_ALIGN(size), &page, |
25167 |
+- gfp); |
25168 |
++ page = dma_alloc_from_pool(dev, PAGE_ALIGN(size), &cpu_addr, |
25169 |
++ gfp, NULL); |
25170 |
+ else |
25171 |
+ cpu_addr = iommu_dma_alloc_pages(dev, size, &page, gfp, attrs); |
25172 |
+ if (!cpu_addr) |
25173 |
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
25174 |
+index 49fc01f2a28d4..45a251da54537 100644 |
25175 |
+--- a/drivers/iommu/iova.c |
25176 |
++++ b/drivers/iommu/iova.c |
25177 |
+@@ -811,7 +811,9 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) |
25178 |
+ for (i = 0 ; i < mag->size; ++i) { |
25179 |
+ struct iova *iova = private_find_iova(iovad, mag->pfns[i]); |
25180 |
+ |
25181 |
+- BUG_ON(!iova); |
25182 |
++ if (WARN_ON(!iova)) |
25183 |
++ continue; |
25184 |
++ |
25185 |
+ private_free_iova(iovad, iova); |
25186 |
+ } |
25187 |
+ |
25188 |
+diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c |
25189 |
+index faa8482c8246d..4dd8a5532f893 100644 |
25190 |
+--- a/drivers/irqchip/irq-stm32-exti.c |
25191 |
++++ b/drivers/irqchip/irq-stm32-exti.c |
25192 |
+@@ -431,6 +431,16 @@ static void stm32_irq_ack(struct irq_data *d) |
25193 |
+ irq_gc_unlock(gc); |
25194 |
+ } |
25195 |
+ |
25196 |
++/* directly set the target bit without reading first. */ |
25197 |
++static inline void stm32_exti_write_bit(struct irq_data *d, u32 reg) |
25198 |
++{ |
25199 |
++ struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d); |
25200 |
++ void __iomem *base = chip_data->host_data->base; |
25201 |
++ u32 val = BIT(d->hwirq % IRQS_PER_BANK); |
25202 |
++ |
25203 |
++ writel_relaxed(val, base + reg); |
25204 |
++} |
25205 |
++ |
25206 |
+ static inline u32 stm32_exti_set_bit(struct irq_data *d, u32 reg) |
25207 |
+ { |
25208 |
+ struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d); |
25209 |
+@@ -464,9 +474,9 @@ static void stm32_exti_h_eoi(struct irq_data *d) |
25210 |
+ |
25211 |
+ raw_spin_lock(&chip_data->rlock); |
25212 |
+ |
25213 |
+- stm32_exti_set_bit(d, stm32_bank->rpr_ofst); |
25214 |
++ stm32_exti_write_bit(d, stm32_bank->rpr_ofst); |
25215 |
+ if (stm32_bank->fpr_ofst != UNDEF_REG) |
25216 |
+- stm32_exti_set_bit(d, stm32_bank->fpr_ofst); |
25217 |
++ stm32_exti_write_bit(d, stm32_bank->fpr_ofst); |
25218 |
+ |
25219 |
+ raw_spin_unlock(&chip_data->rlock); |
25220 |
+ |
25221 |
+diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c |
25222 |
+index 17d1cb2e5f976..f922a2196b2b7 100644 |
25223 |
+--- a/drivers/media/cec/core/cec-api.c |
25224 |
++++ b/drivers/media/cec/core/cec-api.c |
25225 |
+@@ -147,7 +147,13 @@ static long cec_adap_g_log_addrs(struct cec_adapter *adap, |
25226 |
+ struct cec_log_addrs log_addrs; |
25227 |
+ |
25228 |
+ mutex_lock(&adap->lock); |
25229 |
+- log_addrs = adap->log_addrs; |
25230 |
++ /* |
25231 |
++ * We use memcpy here instead of assignment since there is a |
25232 |
++ * hole at the end of struct cec_log_addrs that an assignment |
25233 |
++ * might ignore. So when we do copy_to_user() we could leak |
25234 |
++ * one byte of memory. |
25235 |
++ */ |
25236 |
++ memcpy(&log_addrs, &adap->log_addrs, sizeof(log_addrs)); |
25237 |
+ if (!adap->is_configured) |
25238 |
+ memset(log_addrs.log_addr, CEC_LOG_ADDR_INVALID, |
25239 |
+ sizeof(log_addrs.log_addr)); |
25240 |
+diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c |
25241 |
+index f7678e5a5d879..157a0ed0a8856 100644 |
25242 |
+--- a/drivers/media/i2c/imx290.c |
25243 |
++++ b/drivers/media/i2c/imx290.c |
25244 |
+@@ -628,7 +628,7 @@ static int imx290_power_on(struct device *dev) |
25245 |
+ } |
25246 |
+ |
25247 |
+ usleep_range(1, 2); |
25248 |
+- gpiod_set_value_cansleep(imx290->rst_gpio, 1); |
25249 |
++ gpiod_set_value_cansleep(imx290->rst_gpio, 0); |
25250 |
+ usleep_range(30000, 31000); |
25251 |
+ |
25252 |
+ return 0; |
25253 |
+@@ -641,7 +641,7 @@ static int imx290_power_off(struct device *dev) |
25254 |
+ struct imx290 *imx290 = to_imx290(sd); |
25255 |
+ |
25256 |
+ clk_disable_unprepare(imx290->xclk); |
25257 |
+- gpiod_set_value_cansleep(imx290->rst_gpio, 0); |
25258 |
++ gpiod_set_value_cansleep(imx290->rst_gpio, 1); |
25259 |
+ regulator_bulk_disable(IMX290_NUM_SUPPLIES, imx290->supplies); |
25260 |
+ |
25261 |
+ return 0; |
25262 |
+@@ -760,7 +760,8 @@ static int imx290_probe(struct i2c_client *client) |
25263 |
+ goto free_err; |
25264 |
+ } |
25265 |
+ |
25266 |
+- imx290->rst_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); |
25267 |
++ imx290->rst_gpio = devm_gpiod_get_optional(dev, "reset", |
25268 |
++ GPIOD_OUT_HIGH); |
25269 |
+ if (IS_ERR(imx290->rst_gpio)) { |
25270 |
+ dev_err(dev, "Cannot get reset gpio\n"); |
25271 |
+ ret = PTR_ERR(imx290->rst_gpio); |
25272 |
+diff --git a/drivers/media/pci/ttpci/av7110.c b/drivers/media/pci/ttpci/av7110.c |
25273 |
+index d0cdee1c6eb0b..bf36b1e22b635 100644 |
25274 |
+--- a/drivers/media/pci/ttpci/av7110.c |
25275 |
++++ b/drivers/media/pci/ttpci/av7110.c |
25276 |
+@@ -406,14 +406,15 @@ static void debiirq(unsigned long cookie) |
25277 |
+ case DATA_CI_GET: |
25278 |
+ { |
25279 |
+ u8 *data = av7110->debi_virt; |
25280 |
++ u8 data_0 = data[0]; |
25281 |
+ |
25282 |
+- if ((data[0] < 2) && data[2] == 0xff) { |
25283 |
++ if (data_0 < 2 && data[2] == 0xff) { |
25284 |
+ int flags = 0; |
25285 |
+ if (data[5] > 0) |
25286 |
+ flags |= CA_CI_MODULE_PRESENT; |
25287 |
+ if (data[5] > 5) |
25288 |
+ flags |= CA_CI_MODULE_READY; |
25289 |
+- av7110->ci_slot[data[0]].flags = flags; |
25290 |
++ av7110->ci_slot[data_0].flags = flags; |
25291 |
+ } else |
25292 |
+ ci_get_data(&av7110->ci_rbuffer, |
25293 |
+ av7110->debi_virt, |
25294 |
+diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c |
25295 |
+index d9ec439faefa6..72a0e94e2e21a 100644 |
25296 |
+--- a/drivers/media/platform/davinci/vpif_capture.c |
25297 |
++++ b/drivers/media/platform/davinci/vpif_capture.c |
25298 |
+@@ -1482,8 +1482,6 @@ probe_out: |
25299 |
+ /* Unregister video device */ |
25300 |
+ video_unregister_device(&ch->video_dev); |
25301 |
+ } |
25302 |
+- kfree(vpif_obj.sd); |
25303 |
+- v4l2_device_unregister(&vpif_obj.v4l2_dev); |
25304 |
+ |
25305 |
+ return err; |
25306 |
+ } |
25307 |
+diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c |
25308 |
+index 046222684b8b2..9a58032f818ae 100644 |
25309 |
+--- a/drivers/mfd/intel-lpss-pci.c |
25310 |
++++ b/drivers/mfd/intel-lpss-pci.c |
25311 |
+@@ -201,6 +201,9 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { |
25312 |
+ { PCI_VDEVICE(INTEL, 0x1ac4), (kernel_ulong_t)&bxt_info }, |
25313 |
+ { PCI_VDEVICE(INTEL, 0x1ac6), (kernel_ulong_t)&bxt_info }, |
25314 |
+ { PCI_VDEVICE(INTEL, 0x1aee), (kernel_ulong_t)&bxt_uart_info }, |
25315 |
++ /* EBG */ |
25316 |
++ { PCI_VDEVICE(INTEL, 0x1bad), (kernel_ulong_t)&bxt_uart_info }, |
25317 |
++ { PCI_VDEVICE(INTEL, 0x1bae), (kernel_ulong_t)&bxt_uart_info }, |
25318 |
+ /* GLK */ |
25319 |
+ { PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&glk_i2c_info }, |
25320 |
+ { PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&glk_i2c_info }, |
25321 |
+@@ -230,6 +233,22 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { |
25322 |
+ { PCI_VDEVICE(INTEL, 0x34ea), (kernel_ulong_t)&bxt_i2c_info }, |
25323 |
+ { PCI_VDEVICE(INTEL, 0x34eb), (kernel_ulong_t)&bxt_i2c_info }, |
25324 |
+ { PCI_VDEVICE(INTEL, 0x34fb), (kernel_ulong_t)&spt_info }, |
25325 |
++ /* TGL-H */ |
25326 |
++ { PCI_VDEVICE(INTEL, 0x43a7), (kernel_ulong_t)&bxt_uart_info }, |
25327 |
++ { PCI_VDEVICE(INTEL, 0x43a8), (kernel_ulong_t)&bxt_uart_info }, |
25328 |
++ { PCI_VDEVICE(INTEL, 0x43a9), (kernel_ulong_t)&bxt_uart_info }, |
25329 |
++ { PCI_VDEVICE(INTEL, 0x43aa), (kernel_ulong_t)&bxt_info }, |
25330 |
++ { PCI_VDEVICE(INTEL, 0x43ab), (kernel_ulong_t)&bxt_info }, |
25331 |
++ { PCI_VDEVICE(INTEL, 0x43ad), (kernel_ulong_t)&bxt_i2c_info }, |
25332 |
++ { PCI_VDEVICE(INTEL, 0x43ae), (kernel_ulong_t)&bxt_i2c_info }, |
25333 |
++ { PCI_VDEVICE(INTEL, 0x43d8), (kernel_ulong_t)&bxt_i2c_info }, |
25334 |
++ { PCI_VDEVICE(INTEL, 0x43da), (kernel_ulong_t)&bxt_uart_info }, |
25335 |
++ { PCI_VDEVICE(INTEL, 0x43e8), (kernel_ulong_t)&bxt_i2c_info }, |
25336 |
++ { PCI_VDEVICE(INTEL, 0x43e9), (kernel_ulong_t)&bxt_i2c_info }, |
25337 |
++ { PCI_VDEVICE(INTEL, 0x43ea), (kernel_ulong_t)&bxt_i2c_info }, |
25338 |
++ { PCI_VDEVICE(INTEL, 0x43eb), (kernel_ulong_t)&bxt_i2c_info }, |
25339 |
++ { PCI_VDEVICE(INTEL, 0x43fb), (kernel_ulong_t)&bxt_info }, |
25340 |
++ { PCI_VDEVICE(INTEL, 0x43fd), (kernel_ulong_t)&bxt_info }, |
25341 |
+ /* EHL */ |
25342 |
+ { PCI_VDEVICE(INTEL, 0x4b28), (kernel_ulong_t)&bxt_uart_info }, |
25343 |
+ { PCI_VDEVICE(INTEL, 0x4b29), (kernel_ulong_t)&bxt_uart_info }, |
25344 |
+diff --git a/drivers/misc/habanalabs/debugfs.c b/drivers/misc/habanalabs/debugfs.c |
25345 |
+index 0bc036e01ee8d..6c2b9cf45e831 100644 |
25346 |
+--- a/drivers/misc/habanalabs/debugfs.c |
25347 |
++++ b/drivers/misc/habanalabs/debugfs.c |
25348 |
+@@ -19,7 +19,7 @@ |
25349 |
+ static struct dentry *hl_debug_root; |
25350 |
+ |
25351 |
+ static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr, |
25352 |
+- u8 i2c_reg, u32 *val) |
25353 |
++ u8 i2c_reg, long *val) |
25354 |
+ { |
25355 |
+ struct armcp_packet pkt; |
25356 |
+ int rc; |
25357 |
+@@ -36,7 +36,7 @@ static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr, |
25358 |
+ pkt.i2c_reg = i2c_reg; |
25359 |
+ |
25360 |
+ rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), |
25361 |
+- 0, (long *) val); |
25362 |
++ 0, val); |
25363 |
+ |
25364 |
+ if (rc) |
25365 |
+ dev_err(hdev->dev, "Failed to read from I2C, error %d\n", rc); |
25366 |
+@@ -827,7 +827,7 @@ static ssize_t hl_i2c_data_read(struct file *f, char __user *buf, |
25367 |
+ struct hl_dbg_device_entry *entry = file_inode(f)->i_private; |
25368 |
+ struct hl_device *hdev = entry->hdev; |
25369 |
+ char tmp_buf[32]; |
25370 |
+- u32 val; |
25371 |
++ long val; |
25372 |
+ ssize_t rc; |
25373 |
+ |
25374 |
+ if (*ppos) |
25375 |
+@@ -842,7 +842,7 @@ static ssize_t hl_i2c_data_read(struct file *f, char __user *buf, |
25376 |
+ return rc; |
25377 |
+ } |
25378 |
+ |
25379 |
+- sprintf(tmp_buf, "0x%02x\n", val); |
25380 |
++ sprintf(tmp_buf, "0x%02lx\n", val); |
25381 |
+ rc = simple_read_from_buffer(buf, count, ppos, tmp_buf, |
25382 |
+ strlen(tmp_buf)); |
25383 |
+ |
25384 |
+diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c |
25385 |
+index fb26e743e1fd4..d0a80bfb953b0 100644 |
25386 |
+--- a/drivers/mmc/host/sdhci-of-arasan.c |
25387 |
++++ b/drivers/mmc/host/sdhci-of-arasan.c |
25388 |
+@@ -1025,7 +1025,6 @@ static void arasan_dt_read_clk_phase(struct device *dev, |
25389 |
+ static void arasan_dt_parse_clk_phases(struct device *dev, |
25390 |
+ struct sdhci_arasan_clk_data *clk_data) |
25391 |
+ { |
25392 |
+- int *iclk_phase, *oclk_phase; |
25393 |
+ u32 mio_bank = 0; |
25394 |
+ int i; |
25395 |
+ |
25396 |
+@@ -1037,28 +1036,32 @@ static void arasan_dt_parse_clk_phases(struct device *dev, |
25397 |
+ clk_data->set_clk_delays = sdhci_arasan_set_clk_delays; |
25398 |
+ |
25399 |
+ if (of_device_is_compatible(dev->of_node, "xlnx,zynqmp-8.9a")) { |
25400 |
+- iclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) ZYNQMP_ICLK_PHASE; |
25401 |
+- oclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) ZYNQMP_OCLK_PHASE; |
25402 |
++ u32 zynqmp_iclk_phase[MMC_TIMING_MMC_HS400 + 1] = |
25403 |
++ ZYNQMP_ICLK_PHASE; |
25404 |
++ u32 zynqmp_oclk_phase[MMC_TIMING_MMC_HS400 + 1] = |
25405 |
++ ZYNQMP_OCLK_PHASE; |
25406 |
+ |
25407 |
+ of_property_read_u32(dev->of_node, "xlnx,mio-bank", &mio_bank); |
25408 |
+ if (mio_bank == 2) { |
25409 |
+- oclk_phase[MMC_TIMING_UHS_SDR104] = 90; |
25410 |
+- oclk_phase[MMC_TIMING_MMC_HS200] = 90; |
25411 |
++ zynqmp_oclk_phase[MMC_TIMING_UHS_SDR104] = 90; |
25412 |
++ zynqmp_oclk_phase[MMC_TIMING_MMC_HS200] = 90; |
25413 |
+ } |
25414 |
+ |
25415 |
+ for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { |
25416 |
+- clk_data->clk_phase_in[i] = iclk_phase[i]; |
25417 |
+- clk_data->clk_phase_out[i] = oclk_phase[i]; |
25418 |
++ clk_data->clk_phase_in[i] = zynqmp_iclk_phase[i]; |
25419 |
++ clk_data->clk_phase_out[i] = zynqmp_oclk_phase[i]; |
25420 |
+ } |
25421 |
+ } |
25422 |
+ |
25423 |
+ if (of_device_is_compatible(dev->of_node, "xlnx,versal-8.9a")) { |
25424 |
+- iclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) VERSAL_ICLK_PHASE; |
25425 |
+- oclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) VERSAL_OCLK_PHASE; |
25426 |
++ u32 versal_iclk_phase[MMC_TIMING_MMC_HS400 + 1] = |
25427 |
++ VERSAL_ICLK_PHASE; |
25428 |
++ u32 versal_oclk_phase[MMC_TIMING_MMC_HS400 + 1] = |
25429 |
++ VERSAL_OCLK_PHASE; |
25430 |
+ |
25431 |
+ for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { |
25432 |
+- clk_data->clk_phase_in[i] = iclk_phase[i]; |
25433 |
+- clk_data->clk_phase_out[i] = oclk_phase[i]; |
25434 |
++ clk_data->clk_phase_in[i] = versal_iclk_phase[i]; |
25435 |
++ clk_data->clk_phase_out[i] = versal_oclk_phase[i]; |
25436 |
+ } |
25437 |
+ } |
25438 |
+ |
25439 |
+diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c |
25440 |
+index b513b8c5c3b5e..41dd3d0f34524 100644 |
25441 |
+--- a/drivers/net/ethernet/freescale/gianfar.c |
25442 |
++++ b/drivers/net/ethernet/freescale/gianfar.c |
25443 |
+@@ -750,8 +750,10 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) |
25444 |
+ continue; |
25445 |
+ |
25446 |
+ err = gfar_parse_group(child, priv, model); |
25447 |
+- if (err) |
25448 |
++ if (err) { |
25449 |
++ of_node_put(child); |
25450 |
+ goto err_grp_init; |
25451 |
++ } |
25452 |
+ } |
25453 |
+ } else { /* SQ_SG_MODE */ |
25454 |
+ err = gfar_parse_group(np, priv, model); |
25455 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c |
25456 |
+index ec7a11d13fdc0..9e70b9a674409 100644 |
25457 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c |
25458 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c |
25459 |
+@@ -192,7 +192,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid, |
25460 |
+ } |
25461 |
+ |
25462 |
+ /* alloc the udl from per cpu ddp pool */ |
25463 |
+- ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_KERNEL, &ddp->udp); |
25464 |
++ ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp); |
25465 |
+ if (!ddp->udl) { |
25466 |
+ e_err(drv, "failed allocated ddp context\n"); |
25467 |
+ goto out_noddp_unmap; |
25468 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
25469 |
+index 4942f6112e51f..5da04e9979894 100644 |
25470 |
+--- a/drivers/net/macvlan.c |
25471 |
++++ b/drivers/net/macvlan.c |
25472 |
+@@ -1269,6 +1269,9 @@ static void macvlan_port_destroy(struct net_device *dev) |
25473 |
+ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[], |
25474 |
+ struct netlink_ext_ack *extack) |
25475 |
+ { |
25476 |
++ struct nlattr *nla, *head; |
25477 |
++ int rem, len; |
25478 |
++ |
25479 |
+ if (tb[IFLA_ADDRESS]) { |
25480 |
+ if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) |
25481 |
+ return -EINVAL; |
25482 |
+@@ -1316,6 +1319,20 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[], |
25483 |
+ return -EADDRNOTAVAIL; |
25484 |
+ } |
25485 |
+ |
25486 |
++ if (data[IFLA_MACVLAN_MACADDR_DATA]) { |
25487 |
++ head = nla_data(data[IFLA_MACVLAN_MACADDR_DATA]); |
25488 |
++ len = nla_len(data[IFLA_MACVLAN_MACADDR_DATA]); |
25489 |
++ |
25490 |
++ nla_for_each_attr(nla, head, len, rem) { |
25491 |
++ if (nla_type(nla) != IFLA_MACVLAN_MACADDR || |
25492 |
++ nla_len(nla) != ETH_ALEN) |
25493 |
++ return -EINVAL; |
25494 |
++ |
25495 |
++ if (!is_valid_ether_addr(nla_data(nla))) |
25496 |
++ return -EADDRNOTAVAIL; |
25497 |
++ } |
25498 |
++ } |
25499 |
++ |
25500 |
+ if (data[IFLA_MACVLAN_MACADDR_COUNT]) |
25501 |
+ return -EINVAL; |
25502 |
+ |
25503 |
+@@ -1372,10 +1389,6 @@ static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode, |
25504 |
+ len = nla_len(data[IFLA_MACVLAN_MACADDR_DATA]); |
25505 |
+ |
25506 |
+ nla_for_each_attr(nla, head, len, rem) { |
25507 |
+- if (nla_type(nla) != IFLA_MACVLAN_MACADDR || |
25508 |
+- nla_len(nla) != ETH_ALEN) |
25509 |
+- continue; |
25510 |
+- |
25511 |
+ addr = nla_data(nla); |
25512 |
+ ret = macvlan_hash_add_source(vlan, addr); |
25513 |
+ if (ret) |
25514 |
+diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c |
25515 |
+index dfc16770458d8..386ed2aa31fd9 100644 |
25516 |
+--- a/drivers/net/wan/hdlc.c |
25517 |
++++ b/drivers/net/wan/hdlc.c |
25518 |
+@@ -230,6 +230,7 @@ static void hdlc_setup_dev(struct net_device *dev) |
25519 |
+ dev->max_mtu = HDLC_MAX_MTU; |
25520 |
+ dev->type = ARPHRD_RAWHDLC; |
25521 |
+ dev->hard_header_len = 16; |
25522 |
++ dev->needed_headroom = 0; |
25523 |
+ dev->addr_len = 0; |
25524 |
+ dev->header_ops = &hdlc_null_ops; |
25525 |
+ } |
25526 |
+diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c |
25527 |
+index f70336bb6f524..f52b9fed05931 100644 |
25528 |
+--- a/drivers/net/wan/hdlc_x25.c |
25529 |
++++ b/drivers/net/wan/hdlc_x25.c |
25530 |
+@@ -107,8 +107,14 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) |
25531 |
+ { |
25532 |
+ int result; |
25533 |
+ |
25534 |
++ /* There should be a pseudo header of 1 byte added by upper layers. |
25535 |
++ * Check to make sure it is there before reading it. |
25536 |
++ */ |
25537 |
++ if (skb->len < 1) { |
25538 |
++ kfree_skb(skb); |
25539 |
++ return NETDEV_TX_OK; |
25540 |
++ } |
25541 |
+ |
25542 |
+- /* X.25 to LAPB */ |
25543 |
+ switch (skb->data[0]) { |
25544 |
+ case X25_IFACE_DATA: /* Data to be transmitted */ |
25545 |
+ skb_pull(skb, 1); |
25546 |
+@@ -294,6 +300,15 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr) |
25547 |
+ return result; |
25548 |
+ |
25549 |
+ memcpy(&state(hdlc)->settings, &new_settings, size); |
25550 |
++ |
25551 |
++ /* There's no header_ops so hard_header_len should be 0. */ |
25552 |
++ dev->hard_header_len = 0; |
25553 |
++ /* When transmitting data: |
25554 |
++ * first we'll remove a pseudo header of 1 byte, |
25555 |
++ * then we'll prepend an LAPB header of at most 3 bytes. |
25556 |
++ */ |
25557 |
++ dev->needed_headroom = 3 - 1; |
25558 |
++ |
25559 |
+ dev->type = ARPHRD_X25; |
25560 |
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); |
25561 |
+ netif_dormant_off(dev); |
25562 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
25563 |
+index a757abd7a5999..f4db818cccae7 100644 |
25564 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
25565 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
25566 |
+@@ -84,6 +84,8 @@ |
25567 |
+ |
25568 |
+ #define BRCMF_ND_INFO_TIMEOUT msecs_to_jiffies(2000) |
25569 |
+ |
25570 |
++#define BRCMF_PS_MAX_TIMEOUT_MS 2000 |
25571 |
++ |
25572 |
+ #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ |
25573 |
+ (sizeof(struct brcmf_assoc_params_le) - sizeof(u16)) |
25574 |
+ |
25575 |
+@@ -2941,6 +2943,12 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, |
25576 |
+ else |
25577 |
+ bphy_err(drvr, "error (%d)\n", err); |
25578 |
+ } |
25579 |
++ |
25580 |
++ err = brcmf_fil_iovar_int_set(ifp, "pm2_sleep_ret", |
25581 |
++ min_t(u32, timeout, BRCMF_PS_MAX_TIMEOUT_MS)); |
25582 |
++ if (err) |
25583 |
++ bphy_err(drvr, "Unable to set pm timeout, (%d)\n", err); |
25584 |
++ |
25585 |
+ done: |
25586 |
+ brcmf_dbg(TRACE, "Exit\n"); |
25587 |
+ return err; |
25588 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c |
25589 |
+index c66c6dc003783..bad06939a247c 100644 |
25590 |
+--- a/drivers/net/wireless/realtek/rtlwifi/usb.c |
25591 |
++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c |
25592 |
+@@ -718,8 +718,11 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw) |
25593 |
+ |
25594 |
+ usb_anchor_urb(urb, &rtlusb->rx_submitted); |
25595 |
+ err = usb_submit_urb(urb, GFP_KERNEL); |
25596 |
+- if (err) |
25597 |
++ if (err) { |
25598 |
++ usb_unanchor_urb(urb); |
25599 |
++ usb_free_urb(urb); |
25600 |
+ goto err_out; |
25601 |
++ } |
25602 |
+ usb_free_urb(urb); |
25603 |
+ } |
25604 |
+ return 0; |
25605 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
25606 |
+index 549f5b0fb0b4b..1a2b6910509ca 100644 |
25607 |
+--- a/drivers/nvme/host/fc.c |
25608 |
++++ b/drivers/nvme/host/fc.c |
25609 |
+@@ -2076,7 +2076,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, |
25610 |
+ if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) { |
25611 |
+ dev_err(ctrl->dev, |
25612 |
+ "FCP Op failed - cmdiu dma mapping failed.\n"); |
25613 |
+- ret = EFAULT; |
25614 |
++ ret = -EFAULT; |
25615 |
+ goto out_on_error; |
25616 |
+ } |
25617 |
+ |
25618 |
+@@ -2086,7 +2086,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, |
25619 |
+ if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) { |
25620 |
+ dev_err(ctrl->dev, |
25621 |
+ "FCP Op failed - rspiu dma mapping failed.\n"); |
25622 |
+- ret = EFAULT; |
25623 |
++ ret = -EFAULT; |
25624 |
+ } |
25625 |
+ |
25626 |
+ atomic_set(&op->state, FCPOP_STATE_IDLE); |
25627 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
25628 |
+index 2672953233434..041a755f936a6 100644 |
25629 |
+--- a/drivers/nvme/host/multipath.c |
25630 |
++++ b/drivers/nvme/host/multipath.c |
25631 |
+@@ -255,12 +255,17 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, |
25632 |
+ fallback = ns; |
25633 |
+ } |
25634 |
+ |
25635 |
+- /* No optimized path found, re-check the current path */ |
25636 |
++ /* |
25637 |
++ * The loop above skips the current path for round-robin semantics. |
25638 |
++ * Fall back to the current path if either: |
25639 |
++ * - no other optimized path found and current is optimized, |
25640 |
++ * - no other usable path found and current is usable. |
25641 |
++ */ |
25642 |
+ if (!nvme_path_is_disabled(old) && |
25643 |
+- old->ana_state == NVME_ANA_OPTIMIZED) { |
25644 |
+- found = old; |
25645 |
+- goto out; |
25646 |
+- } |
25647 |
++ (old->ana_state == NVME_ANA_OPTIMIZED || |
25648 |
++ (!fallback && old->ana_state == NVME_ANA_NONOPTIMIZED))) |
25649 |
++ return old; |
25650 |
++ |
25651 |
+ if (!fallback) |
25652 |
+ return NULL; |
25653 |
+ found = fallback; |
25654 |
+diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c |
25655 |
+index 419e0d4ce79b1..d84b935704a3d 100644 |
25656 |
+--- a/drivers/nvme/target/configfs.c |
25657 |
++++ b/drivers/nvme/target/configfs.c |
25658 |
+@@ -1035,6 +1035,7 @@ static ssize_t nvmet_subsys_attr_model_store(struct config_item *item, |
25659 |
+ up_write(&nvmet_config_sem); |
25660 |
+ |
25661 |
+ kfree_rcu(new_model, rcuhead); |
25662 |
++ kfree(new_model_number); |
25663 |
+ |
25664 |
+ return count; |
25665 |
+ } |
25666 |
+diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c |
25667 |
+index 5dd1740855770..f38e710de4789 100644 |
25668 |
+--- a/drivers/pci/controller/dwc/pcie-qcom.c |
25669 |
++++ b/drivers/pci/controller/dwc/pcie-qcom.c |
25670 |
+@@ -106,11 +106,14 @@ struct qcom_pcie_resources_2_1_0 { |
25671 |
+ struct clk *iface_clk; |
25672 |
+ struct clk *core_clk; |
25673 |
+ struct clk *phy_clk; |
25674 |
++ struct clk *aux_clk; |
25675 |
++ struct clk *ref_clk; |
25676 |
+ struct reset_control *pci_reset; |
25677 |
+ struct reset_control *axi_reset; |
25678 |
+ struct reset_control *ahb_reset; |
25679 |
+ struct reset_control *por_reset; |
25680 |
+ struct reset_control *phy_reset; |
25681 |
++ struct reset_control *ext_reset; |
25682 |
+ struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; |
25683 |
+ }; |
25684 |
+ |
25685 |
+@@ -264,6 +267,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) |
25686 |
+ if (IS_ERR(res->phy_clk)) |
25687 |
+ return PTR_ERR(res->phy_clk); |
25688 |
+ |
25689 |
++ res->aux_clk = devm_clk_get_optional(dev, "aux"); |
25690 |
++ if (IS_ERR(res->aux_clk)) |
25691 |
++ return PTR_ERR(res->aux_clk); |
25692 |
++ |
25693 |
++ res->ref_clk = devm_clk_get_optional(dev, "ref"); |
25694 |
++ if (IS_ERR(res->ref_clk)) |
25695 |
++ return PTR_ERR(res->ref_clk); |
25696 |
++ |
25697 |
+ res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); |
25698 |
+ if (IS_ERR(res->pci_reset)) |
25699 |
+ return PTR_ERR(res->pci_reset); |
25700 |
+@@ -280,6 +291,10 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) |
25701 |
+ if (IS_ERR(res->por_reset)) |
25702 |
+ return PTR_ERR(res->por_reset); |
25703 |
+ |
25704 |
++ res->ext_reset = devm_reset_control_get_optional_exclusive(dev, "ext"); |
25705 |
++ if (IS_ERR(res->ext_reset)) |
25706 |
++ return PTR_ERR(res->ext_reset); |
25707 |
++ |
25708 |
+ res->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); |
25709 |
+ return PTR_ERR_OR_ZERO(res->phy_reset); |
25710 |
+ } |
25711 |
+@@ -288,14 +303,17 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) |
25712 |
+ { |
25713 |
+ struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; |
25714 |
+ |
25715 |
++ clk_disable_unprepare(res->phy_clk); |
25716 |
+ reset_control_assert(res->pci_reset); |
25717 |
+ reset_control_assert(res->axi_reset); |
25718 |
+ reset_control_assert(res->ahb_reset); |
25719 |
+ reset_control_assert(res->por_reset); |
25720 |
+- reset_control_assert(res->pci_reset); |
25721 |
++ reset_control_assert(res->ext_reset); |
25722 |
++ reset_control_assert(res->phy_reset); |
25723 |
+ clk_disable_unprepare(res->iface_clk); |
25724 |
+ clk_disable_unprepare(res->core_clk); |
25725 |
+- clk_disable_unprepare(res->phy_clk); |
25726 |
++ clk_disable_unprepare(res->aux_clk); |
25727 |
++ clk_disable_unprepare(res->ref_clk); |
25728 |
+ regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); |
25729 |
+ } |
25730 |
+ |
25731 |
+@@ -326,24 +344,36 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) |
25732 |
+ goto err_assert_ahb; |
25733 |
+ } |
25734 |
+ |
25735 |
+- ret = clk_prepare_enable(res->phy_clk); |
25736 |
+- if (ret) { |
25737 |
+- dev_err(dev, "cannot prepare/enable phy clock\n"); |
25738 |
+- goto err_clk_phy; |
25739 |
+- } |
25740 |
+- |
25741 |
+ ret = clk_prepare_enable(res->core_clk); |
25742 |
+ if (ret) { |
25743 |
+ dev_err(dev, "cannot prepare/enable core clock\n"); |
25744 |
+ goto err_clk_core; |
25745 |
+ } |
25746 |
+ |
25747 |
++ ret = clk_prepare_enable(res->aux_clk); |
25748 |
++ if (ret) { |
25749 |
++ dev_err(dev, "cannot prepare/enable aux clock\n"); |
25750 |
++ goto err_clk_aux; |
25751 |
++ } |
25752 |
++ |
25753 |
++ ret = clk_prepare_enable(res->ref_clk); |
25754 |
++ if (ret) { |
25755 |
++ dev_err(dev, "cannot prepare/enable ref clock\n"); |
25756 |
++ goto err_clk_ref; |
25757 |
++ } |
25758 |
++ |
25759 |
+ ret = reset_control_deassert(res->ahb_reset); |
25760 |
+ if (ret) { |
25761 |
+ dev_err(dev, "cannot deassert ahb reset\n"); |
25762 |
+ goto err_deassert_ahb; |
25763 |
+ } |
25764 |
+ |
25765 |
++ ret = reset_control_deassert(res->ext_reset); |
25766 |
++ if (ret) { |
25767 |
++ dev_err(dev, "cannot deassert ext reset\n"); |
25768 |
++ goto err_deassert_ahb; |
25769 |
++ } |
25770 |
++ |
25771 |
+ /* enable PCIe clocks and resets */ |
25772 |
+ val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); |
25773 |
+ val &= ~BIT(0); |
25774 |
+@@ -398,6 +428,12 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) |
25775 |
+ return ret; |
25776 |
+ } |
25777 |
+ |
25778 |
++ ret = clk_prepare_enable(res->phy_clk); |
25779 |
++ if (ret) { |
25780 |
++ dev_err(dev, "cannot prepare/enable phy clock\n"); |
25781 |
++ goto err_deassert_ahb; |
25782 |
++ } |
25783 |
++ |
25784 |
+ /* wait for clock acquisition */ |
25785 |
+ usleep_range(1000, 1500); |
25786 |
+ |
25787 |
+@@ -411,10 +447,12 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) |
25788 |
+ return 0; |
25789 |
+ |
25790 |
+ err_deassert_ahb: |
25791 |
++ clk_disable_unprepare(res->ref_clk); |
25792 |
++err_clk_ref: |
25793 |
++ clk_disable_unprepare(res->aux_clk); |
25794 |
++err_clk_aux: |
25795 |
+ clk_disable_unprepare(res->core_clk); |
25796 |
+ err_clk_core: |
25797 |
+- clk_disable_unprepare(res->phy_clk); |
25798 |
+-err_clk_phy: |
25799 |
+ clk_disable_unprepare(res->iface_clk); |
25800 |
+ err_assert_ahb: |
25801 |
+ regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); |
25802 |
+diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c |
25803 |
+index cc386ef2fa122..3861505741e6d 100644 |
25804 |
+--- a/drivers/pci/slot.c |
25805 |
++++ b/drivers/pci/slot.c |
25806 |
+@@ -268,13 +268,16 @@ placeholder: |
25807 |
+ slot_name = make_slot_name(name); |
25808 |
+ if (!slot_name) { |
25809 |
+ err = -ENOMEM; |
25810 |
++ kfree(slot); |
25811 |
+ goto err; |
25812 |
+ } |
25813 |
+ |
25814 |
+ err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL, |
25815 |
+ "%s", slot_name); |
25816 |
+- if (err) |
25817 |
++ if (err) { |
25818 |
++ kobject_put(&slot->kobj); |
25819 |
+ goto err; |
25820 |
++ } |
25821 |
+ |
25822 |
+ INIT_LIST_HEAD(&slot->list); |
25823 |
+ list_add(&slot->list, &parent->slots); |
25824 |
+@@ -293,7 +296,6 @@ out: |
25825 |
+ mutex_unlock(&pci_slot_mutex); |
25826 |
+ return slot; |
25827 |
+ err: |
25828 |
+- kfree(slot); |
25829 |
+ slot = ERR_PTR(err); |
25830 |
+ goto out; |
25831 |
+ } |
25832 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |
25833 |
+index b77b18fe5adcf..2f3dfb56c3fa4 100644 |
25834 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |
25835 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |
25836 |
+@@ -243,6 +243,29 @@ static int mtk_xt_find_eint_num(struct mtk_pinctrl *hw, unsigned long eint_n) |
25837 |
+ return EINT_NA; |
25838 |
+ } |
25839 |
+ |
25840 |
++/* |
25841 |
++ * Virtual GPIO only used inside SOC and not being exported to outside SOC. |
25842 |
++ * Some modules use virtual GPIO as eint (e.g. pmif or usb). |
25843 |
++ * In MTK platform, external interrupt (EINT) and GPIO is 1-1 mapping |
25844 |
++ * and we can set GPIO as eint. |
25845 |
++ * But some modules use specific eint which doesn't have real GPIO pin. |
25846 |
++ * So we use virtual GPIO to map it. |
25847 |
++ */ |
25848 |
++ |
25849 |
++bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n) |
25850 |
++{ |
25851 |
++ const struct mtk_pin_desc *desc; |
25852 |
++ bool virt_gpio = false; |
25853 |
++ |
25854 |
++ desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n]; |
25855 |
++ |
25856 |
++ if (desc->funcs && !desc->funcs[desc->eint.eint_m].name) |
25857 |
++ virt_gpio = true; |
25858 |
++ |
25859 |
++ return virt_gpio; |
25860 |
++} |
25861 |
++EXPORT_SYMBOL_GPL(mtk_is_virt_gpio); |
25862 |
++ |
25863 |
+ static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n, |
25864 |
+ unsigned int *gpio_n, |
25865 |
+ struct gpio_chip **gpio_chip) |
25866 |
+@@ -295,6 +318,9 @@ static int mtk_xt_set_gpio_as_eint(void *data, unsigned long eint_n) |
25867 |
+ if (err) |
25868 |
+ return err; |
25869 |
+ |
25870 |
++ if (mtk_is_virt_gpio(hw, gpio_n)) |
25871 |
++ return 0; |
25872 |
++ |
25873 |
+ desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n]; |
25874 |
+ |
25875 |
+ err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_MODE, |
25876 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h |
25877 |
+index 27df087363960..bd079f4fb1d6f 100644 |
25878 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h |
25879 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h |
25880 |
+@@ -315,4 +315,5 @@ int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw, |
25881 |
+ int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw, |
25882 |
+ const struct mtk_pin_desc *desc, u32 *val); |
25883 |
+ |
25884 |
++bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n); |
25885 |
+ #endif /* __PINCTRL_MTK_COMMON_V2_H */ |
25886 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c |
25887 |
+index 90a432bf9fedc..a23c18251965e 100644 |
25888 |
+--- a/drivers/pinctrl/mediatek/pinctrl-paris.c |
25889 |
++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c |
25890 |
+@@ -769,6 +769,13 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio) |
25891 |
+ if (gpio >= hw->soc->npins) |
25892 |
+ return -EINVAL; |
25893 |
+ |
25894 |
++ /* |
25895 |
++ * "Virtual" GPIOs are always and only used for interrupts |
25896 |
++ * Since they are only used for interrupts, they are always inputs |
25897 |
++ */ |
25898 |
++ if (mtk_is_virt_gpio(hw, gpio)) |
25899 |
++ return 1; |
25900 |
++ |
25901 |
+ desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; |
25902 |
+ |
25903 |
+ err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &value); |
25904 |
+diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c |
25905 |
+index 24e48d96ed766..b1c641c72f515 100644 |
25906 |
+--- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c |
25907 |
++++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c |
25908 |
+@@ -419,9 +419,7 @@ cros_ec_sensor_ring_process_event(struct cros_ec_sensorhub *sensorhub, |
25909 |
+ * Disable filtering since we might add more jitter |
25910 |
+ * if b is in a random point in time. |
25911 |
+ */ |
25912 |
+- new_timestamp = fifo_timestamp - |
25913 |
+- fifo_info->timestamp * 1000 + |
25914 |
+- in->timestamp * 1000; |
25915 |
++ new_timestamp = c - b * 1000 + a * 1000; |
25916 |
+ /* |
25917 |
+ * The timestamp can be stale if we had to use the fifo |
25918 |
+ * info timestamp. |
25919 |
+diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c |
25920 |
+index 94edbb33d0d1f..aca022239b333 100644 |
25921 |
+--- a/drivers/s390/cio/css.c |
25922 |
++++ b/drivers/s390/cio/css.c |
25923 |
+@@ -677,6 +677,11 @@ static int slow_eval_known_fn(struct subchannel *sch, void *data) |
25924 |
+ rc = css_evaluate_known_subchannel(sch, 1); |
25925 |
+ if (rc == -EAGAIN) |
25926 |
+ css_schedule_eval(sch->schid); |
25927 |
++ /* |
25928 |
++ * The loop might take long time for platforms with lots of |
25929 |
++ * known devices. Allow scheduling here. |
25930 |
++ */ |
25931 |
++ cond_resched(); |
25932 |
+ } |
25933 |
+ return 0; |
25934 |
+ } |
25935 |
+diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c |
25936 |
+index 1791a393795da..07a0dadc75bf5 100644 |
25937 |
+--- a/drivers/scsi/fcoe/fcoe_ctlr.c |
25938 |
++++ b/drivers/scsi/fcoe/fcoe_ctlr.c |
25939 |
+@@ -255,9 +255,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) |
25940 |
+ WARN_ON(!fcf_dev); |
25941 |
+ new->fcf_dev = NULL; |
25942 |
+ fcoe_fcf_device_delete(fcf_dev); |
25943 |
+- kfree(new); |
25944 |
+ mutex_unlock(&cdev->lock); |
25945 |
+ } |
25946 |
++ kfree(new); |
25947 |
+ } |
25948 |
+ |
25949 |
+ /** |
25950 |
+diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c |
25951 |
+index b766463579800..d0296f7cf45fc 100644 |
25952 |
+--- a/drivers/scsi/lpfc/lpfc_vport.c |
25953 |
++++ b/drivers/scsi/lpfc/lpfc_vport.c |
25954 |
+@@ -642,27 +642,16 @@ lpfc_vport_delete(struct fc_vport *fc_vport) |
25955 |
+ vport->port_state < LPFC_VPORT_READY) |
25956 |
+ return -EAGAIN; |
25957 |
+ } |
25958 |
++ |
25959 |
+ /* |
25960 |
+- * This is a bit of a mess. We want to ensure the shost doesn't get |
25961 |
+- * torn down until we're done with the embedded lpfc_vport structure. |
25962 |
+- * |
25963 |
+- * Beyond holding a reference for this function, we also need a |
25964 |
+- * reference for outstanding I/O requests we schedule during delete |
25965 |
+- * processing. But once we scsi_remove_host() we can no longer obtain |
25966 |
+- * a reference through scsi_host_get(). |
25967 |
+- * |
25968 |
+- * So we take two references here. We release one reference at the |
25969 |
+- * bottom of the function -- after delinking the vport. And we |
25970 |
+- * release the other at the completion of the unreg_vpi that get's |
25971 |
+- * initiated after we've disposed of all other resources associated |
25972 |
+- * with the port. |
25973 |
++ * Take early refcount for outstanding I/O requests we schedule during |
25974 |
++ * delete processing for unreg_vpi. Always keep this before |
25975 |
++ * scsi_remove_host() as we can no longer obtain a reference through |
25976 |
++ * scsi_host_get() after scsi_host_remove as shost is set to SHOST_DEL. |
25977 |
+ */ |
25978 |
+ if (!scsi_host_get(shost)) |
25979 |
+ return VPORT_INVAL; |
25980 |
+- if (!scsi_host_get(shost)) { |
25981 |
+- scsi_host_put(shost); |
25982 |
+- return VPORT_INVAL; |
25983 |
+- } |
25984 |
++ |
25985 |
+ lpfc_free_sysfs_attr(vport); |
25986 |
+ |
25987 |
+ lpfc_debugfs_terminate(vport); |
25988 |
+@@ -809,8 +798,9 @@ skip_logo: |
25989 |
+ if (!(vport->vpi_state & LPFC_VPI_REGISTERED) || |
25990 |
+ lpfc_mbx_unreg_vpi(vport)) |
25991 |
+ scsi_host_put(shost); |
25992 |
+- } else |
25993 |
++ } else { |
25994 |
+ scsi_host_put(shost); |
25995 |
++ } |
25996 |
+ |
25997 |
+ lpfc_free_vpi(phba, vport->vpi); |
25998 |
+ vport->work_port_events = 0; |
25999 |
+diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c |
26000 |
+index df670fba2ab8a..de9fd7f688d01 100644 |
26001 |
+--- a/drivers/scsi/qla2xxx/qla_gs.c |
26002 |
++++ b/drivers/scsi/qla2xxx/qla_gs.c |
26003 |
+@@ -1505,11 +1505,11 @@ qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd, |
26004 |
+ static uint |
26005 |
+ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) |
26006 |
+ { |
26007 |
++ uint speeds = 0; |
26008 |
++ |
26009 |
+ if (IS_CNA_CAPABLE(ha)) |
26010 |
+ return FDMI_PORT_SPEED_10GB; |
26011 |
+ if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) { |
26012 |
+- uint speeds = 0; |
26013 |
+- |
26014 |
+ if (ha->max_supported_speed == 2) { |
26015 |
+ if (ha->min_supported_speed <= 6) |
26016 |
+ speeds |= FDMI_PORT_SPEED_64GB; |
26017 |
+@@ -1536,9 +1536,16 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) |
26018 |
+ } |
26019 |
+ return speeds; |
26020 |
+ } |
26021 |
+- if (IS_QLA2031(ha)) |
26022 |
+- return FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB| |
26023 |
+- FDMI_PORT_SPEED_4GB; |
26024 |
++ if (IS_QLA2031(ha)) { |
26025 |
++ if ((ha->pdev->subsystem_vendor == 0x103C) && |
26026 |
++ (ha->pdev->subsystem_device == 0x8002)) { |
26027 |
++ speeds = FDMI_PORT_SPEED_16GB; |
26028 |
++ } else { |
26029 |
++ speeds = FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB| |
26030 |
++ FDMI_PORT_SPEED_4GB; |
26031 |
++ } |
26032 |
++ return speeds; |
26033 |
++ } |
26034 |
+ if (IS_QLA25XX(ha)) |
26035 |
+ return FDMI_PORT_SPEED_8GB|FDMI_PORT_SPEED_4GB| |
26036 |
+ FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB; |
26037 |
+@@ -3436,7 +3443,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) |
26038 |
+ list_for_each_entry(fcport, &vha->vp_fcports, list) { |
26039 |
+ if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) { |
26040 |
+ fcport->scan_state = QLA_FCPORT_SCAN; |
26041 |
+- fcport->logout_on_delete = 0; |
26042 |
+ } |
26043 |
+ } |
26044 |
+ goto login_logout; |
26045 |
+@@ -3532,10 +3538,22 @@ login_logout: |
26046 |
+ } |
26047 |
+ |
26048 |
+ if (fcport->scan_state != QLA_FCPORT_FOUND) { |
26049 |
++ bool do_delete = false; |
26050 |
++ |
26051 |
++ if (fcport->scan_needed && |
26052 |
++ fcport->disc_state == DSC_LOGIN_PEND) { |
26053 |
++ /* Cable got disconnected after we sent |
26054 |
++ * a login. Do delete to prevent timeout. |
26055 |
++ */ |
26056 |
++ fcport->logout_on_delete = 1; |
26057 |
++ do_delete = true; |
26058 |
++ } |
26059 |
++ |
26060 |
+ fcport->scan_needed = 0; |
26061 |
+- if ((qla_dual_mode_enabled(vha) || |
26062 |
+- qla_ini_mode_enabled(vha)) && |
26063 |
+- atomic_read(&fcport->state) == FCS_ONLINE) { |
26064 |
++ if (((qla_dual_mode_enabled(vha) || |
26065 |
++ qla_ini_mode_enabled(vha)) && |
26066 |
++ atomic_read(&fcport->state) == FCS_ONLINE) || |
26067 |
++ do_delete) { |
26068 |
+ if (fcport->loop_id != FC_NO_LOOP_ID) { |
26069 |
+ if (fcport->flags & FCF_FCP2_DEVICE) |
26070 |
+ fcport->logout_on_delete = 0; |
26071 |
+@@ -3736,6 +3754,18 @@ static void qla2x00_async_gpnft_gnnft_sp_done(srb_t *sp, int res) |
26072 |
+ unsigned long flags; |
26073 |
+ const char *name = sp->name; |
26074 |
+ |
26075 |
++ if (res == QLA_OS_TIMER_EXPIRED) { |
26076 |
++ /* switch is ignoring all commands. |
26077 |
++ * This might be a zone disable behavior. |
26078 |
++ * This means we hit 64s timeout. |
26079 |
++ * 22s GPNFT + 44s Abort = 64s |
26080 |
++ */ |
26081 |
++ ql_dbg(ql_dbg_disc, vha, 0xffff, |
26082 |
++ "%s: Switch Zone check please .\n", |
26083 |
++ name); |
26084 |
++ qla2x00_mark_all_devices_lost(vha); |
26085 |
++ } |
26086 |
++ |
26087 |
+ /* |
26088 |
+ * We are in an Interrupt context, queue up this |
26089 |
+ * sp for GNNFT_DONE work. This will allow all |
26090 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
26091 |
+index df31ee0d59b20..fdb2ce7acb912 100644 |
26092 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
26093 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
26094 |
+@@ -333,14 +333,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) |
26095 |
+ if (time_after(jiffies, wait_time)) |
26096 |
+ break; |
26097 |
+ |
26098 |
+- /* |
26099 |
+- * Check if it's UNLOADING, cause we cannot poll in |
26100 |
+- * this case, or else a NULL pointer dereference |
26101 |
+- * is triggered. |
26102 |
+- */ |
26103 |
+- if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) |
26104 |
+- return QLA_FUNCTION_TIMEOUT; |
26105 |
+- |
26106 |
+ /* Check for pending interrupts. */ |
26107 |
+ qla2x00_poll(ha->rsp_q_map[0]); |
26108 |
+ |
26109 |
+diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
26110 |
+index fa695a4007f86..262dfd7635a48 100644 |
26111 |
+--- a/drivers/scsi/qla2xxx/qla_nvme.c |
26112 |
++++ b/drivers/scsi/qla2xxx/qla_nvme.c |
26113 |
+@@ -536,6 +536,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, |
26114 |
+ struct nvme_private *priv = fd->private; |
26115 |
+ struct qla_nvme_rport *qla_rport = rport->private; |
26116 |
+ |
26117 |
++ if (!priv) { |
26118 |
++ /* nvme association has been torn down */ |
26119 |
++ return rval; |
26120 |
++ } |
26121 |
++ |
26122 |
+ fcport = qla_rport->fcport; |
26123 |
+ |
26124 |
+ if (!qpair || !fcport || (qpair && !qpair->fw_started) || |
26125 |
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
26126 |
+index 5c7c22d0fab4b..8b6803f4f2dc1 100644 |
26127 |
+--- a/drivers/scsi/qla2xxx/qla_os.c |
26128 |
++++ b/drivers/scsi/qla2xxx/qla_os.c |
26129 |
+@@ -2017,6 +2017,11 @@ skip_pio: |
26130 |
+ /* Determine queue resources */ |
26131 |
+ ha->max_req_queues = ha->max_rsp_queues = 1; |
26132 |
+ ha->msix_count = QLA_BASE_VECTORS; |
26133 |
++ |
26134 |
++ /* Check if FW supports MQ or not */ |
26135 |
++ if (!(ha->fw_attributes & BIT_6)) |
26136 |
++ goto mqiobase_exit; |
26137 |
++ |
26138 |
+ if (!ql2xmqsupport || !ql2xnvmeenable || |
26139 |
+ (!IS_QLA25XX(ha) && !IS_QLA81XX(ha))) |
26140 |
+ goto mqiobase_exit; |
26141 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
26142 |
+index fbb80a043b4fe..90289162dbd4c 100644 |
26143 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
26144 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
26145 |
+@@ -1270,7 +1270,7 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) |
26146 |
+ |
26147 |
+ qla24xx_chk_fcp_state(sess); |
26148 |
+ |
26149 |
+- ql_dbg(ql_dbg_tgt, sess->vha, 0xe001, |
26150 |
++ ql_dbg(ql_dbg_disc, sess->vha, 0xe001, |
26151 |
+ "Scheduling sess %p for deletion %8phC\n", |
26152 |
+ sess, sess->port_name); |
26153 |
+ |
26154 |
+diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
26155 |
+index b0d93bf79978f..25faad7f8e617 100644 |
26156 |
+--- a/drivers/scsi/scsi_debug.c |
26157 |
++++ b/drivers/scsi/scsi_debug.c |
26158 |
+@@ -5486,9 +5486,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, |
26159 |
+ u64 d = ktime_get_boottime_ns() - ns_from_boot; |
26160 |
+ |
26161 |
+ if (kt <= d) { /* elapsed duration >= kt */ |
26162 |
++ spin_lock_irqsave(&sqp->qc_lock, iflags); |
26163 |
+ sqcp->a_cmnd = NULL; |
26164 |
+ atomic_dec(&devip->num_in_q); |
26165 |
+ clear_bit(k, sqp->in_use_bm); |
26166 |
++ spin_unlock_irqrestore(&sqp->qc_lock, iflags); |
26167 |
+ if (new_sd_dp) |
26168 |
+ kfree(sd_dp); |
26169 |
+ /* call scsi_done() from this thread */ |
26170 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
26171 |
+index 7ae5024e78243..df07ecd94793a 100644 |
26172 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
26173 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
26174 |
+@@ -3291,7 +3291,7 @@ static int iscsi_set_flashnode_param(struct iscsi_transport *transport, |
26175 |
+ pr_err("%s could not find host no %u\n", |
26176 |
+ __func__, ev->u.set_flashnode.host_no); |
26177 |
+ err = -ENODEV; |
26178 |
+- goto put_host; |
26179 |
++ goto exit_set_fnode; |
26180 |
+ } |
26181 |
+ |
26182 |
+ idx = ev->u.set_flashnode.flashnode_idx; |
26183 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
26184 |
+index 136b863bc1d45..8bc8e4e62c045 100644 |
26185 |
+--- a/drivers/scsi/ufs/ufshcd.c |
26186 |
++++ b/drivers/scsi/ufs/ufshcd.c |
26187 |
+@@ -1566,6 +1566,7 @@ unblock_reqs: |
26188 |
+ int ufshcd_hold(struct ufs_hba *hba, bool async) |
26189 |
+ { |
26190 |
+ int rc = 0; |
26191 |
++ bool flush_result; |
26192 |
+ unsigned long flags; |
26193 |
+ |
26194 |
+ if (!ufshcd_is_clkgating_allowed(hba)) |
26195 |
+@@ -1597,7 +1598,9 @@ start: |
26196 |
+ break; |
26197 |
+ } |
26198 |
+ spin_unlock_irqrestore(hba->host->host_lock, flags); |
26199 |
+- flush_work(&hba->clk_gating.ungate_work); |
26200 |
++ flush_result = flush_work(&hba->clk_gating.ungate_work); |
26201 |
++ if (hba->clk_gating.is_suspended && !flush_result) |
26202 |
++ goto out; |
26203 |
+ spin_lock_irqsave(hba->host->host_lock, flags); |
26204 |
+ goto start; |
26205 |
+ } |
26206 |
+@@ -5988,7 +5991,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) |
26207 |
+ */ |
26208 |
+ static irqreturn_t ufshcd_intr(int irq, void *__hba) |
26209 |
+ { |
26210 |
+- u32 intr_status, enabled_intr_status; |
26211 |
++ u32 intr_status, enabled_intr_status = 0; |
26212 |
+ irqreturn_t retval = IRQ_NONE; |
26213 |
+ struct ufs_hba *hba = __hba; |
26214 |
+ int retries = hba->nutrs; |
26215 |
+@@ -6002,7 +6005,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) |
26216 |
+ * read, make sure we handle them by checking the interrupt status |
26217 |
+ * again in a loop until we process all of the reqs before returning. |
26218 |
+ */ |
26219 |
+- do { |
26220 |
++ while (intr_status && retries--) { |
26221 |
+ enabled_intr_status = |
26222 |
+ intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); |
26223 |
+ if (intr_status) |
26224 |
+@@ -6011,7 +6014,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) |
26225 |
+ retval |= ufshcd_sl_intr(hba, enabled_intr_status); |
26226 |
+ |
26227 |
+ intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); |
26228 |
+- } while (intr_status && --retries); |
26229 |
++ } |
26230 |
+ |
26231 |
+ if (enabled_intr_status && retval == IRQ_NONE) { |
26232 |
+ dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", |
26233 |
+@@ -6538,7 +6541,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) |
26234 |
+ /* command completed already */ |
26235 |
+ dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", |
26236 |
+ __func__, tag); |
26237 |
+- goto out; |
26238 |
++ goto cleanup; |
26239 |
+ } else { |
26240 |
+ dev_err(hba->dev, |
26241 |
+ "%s: no response from device. tag = %d, err %d\n", |
26242 |
+@@ -6572,6 +6575,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) |
26243 |
+ goto out; |
26244 |
+ } |
26245 |
+ |
26246 |
++cleanup: |
26247 |
+ scsi_dma_unmap(cmd); |
26248 |
+ |
26249 |
+ spin_lock_irqsave(host->host_lock, flags); |
26250 |
+diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c |
26251 |
+index 9672cda2f8031..d4b33b358a31e 100644 |
26252 |
+--- a/drivers/spi/spi-stm32.c |
26253 |
++++ b/drivers/spi/spi-stm32.c |
26254 |
+@@ -442,7 +442,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz, |
26255 |
+ { |
26256 |
+ u32 div, mbrdiv; |
26257 |
+ |
26258 |
+- div = DIV_ROUND_UP(spi->clk_rate, speed_hz); |
26259 |
++ /* Ensure spi->clk_rate is even */ |
26260 |
++ div = DIV_ROUND_UP(spi->clk_rate & ~0x1, speed_hz); |
26261 |
+ |
26262 |
+ /* |
26263 |
+ * SPI framework set xfer->speed_hz to master->max_speed_hz if |
26264 |
+@@ -468,20 +469,27 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz, |
26265 |
+ /** |
26266 |
+ * stm32h7_spi_prepare_fthlv - Determine FIFO threshold level |
26267 |
+ * @spi: pointer to the spi controller data structure |
26268 |
++ * @xfer_len: length of the message to be transferred |
26269 |
+ */ |
26270 |
+-static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi) |
26271 |
++static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi, u32 xfer_len) |
26272 |
+ { |
26273 |
+- u32 fthlv, half_fifo; |
26274 |
++ u32 fthlv, half_fifo, packet; |
26275 |
+ |
26276 |
+ /* data packet should not exceed 1/2 of fifo space */ |
26277 |
+ half_fifo = (spi->fifo_size / 2); |
26278 |
+ |
26279 |
++ /* data_packet should not exceed transfer length */ |
26280 |
++ if (half_fifo > xfer_len) |
26281 |
++ packet = xfer_len; |
26282 |
++ else |
26283 |
++ packet = half_fifo; |
26284 |
++ |
26285 |
+ if (spi->cur_bpw <= 8) |
26286 |
+- fthlv = half_fifo; |
26287 |
++ fthlv = packet; |
26288 |
+ else if (spi->cur_bpw <= 16) |
26289 |
+- fthlv = half_fifo / 2; |
26290 |
++ fthlv = packet / 2; |
26291 |
+ else |
26292 |
+- fthlv = half_fifo / 4; |
26293 |
++ fthlv = packet / 4; |
26294 |
+ |
26295 |
+ /* align packet size with data registers access */ |
26296 |
+ if (spi->cur_bpw > 8) |
26297 |
+@@ -489,6 +497,9 @@ static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi) |
26298 |
+ else |
26299 |
+ fthlv -= (fthlv % 4); /* multiple of 4 */ |
26300 |
+ |
26301 |
++ if (!fthlv) |
26302 |
++ fthlv = 1; |
26303 |
++ |
26304 |
+ return fthlv; |
26305 |
+ } |
26306 |
+ |
26307 |
+@@ -967,13 +978,13 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) |
26308 |
+ if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0))) |
26309 |
+ stm32h7_spi_read_rxfifo(spi, false); |
26310 |
+ |
26311 |
+- writel_relaxed(mask, spi->base + STM32H7_SPI_IFCR); |
26312 |
++ writel_relaxed(sr & mask, spi->base + STM32H7_SPI_IFCR); |
26313 |
+ |
26314 |
+ spin_unlock_irqrestore(&spi->lock, flags); |
26315 |
+ |
26316 |
+ if (end) { |
26317 |
+- spi_finalize_current_transfer(master); |
26318 |
+ stm32h7_spi_disable(spi); |
26319 |
++ spi_finalize_current_transfer(master); |
26320 |
+ } |
26321 |
+ |
26322 |
+ return IRQ_HANDLED; |
26323 |
+@@ -1394,7 +1405,7 @@ static void stm32h7_spi_set_bpw(struct stm32_spi *spi) |
26324 |
+ cfg1_setb |= (bpw << STM32H7_SPI_CFG1_DSIZE_SHIFT) & |
26325 |
+ STM32H7_SPI_CFG1_DSIZE; |
26326 |
+ |
26327 |
+- spi->cur_fthlv = stm32h7_spi_prepare_fthlv(spi); |
26328 |
++ spi->cur_fthlv = stm32h7_spi_prepare_fthlv(spi, spi->cur_xferlen); |
26329 |
+ fthlv = spi->cur_fthlv - 1; |
26330 |
+ |
26331 |
+ cfg1_clrb |= STM32H7_SPI_CFG1_FTHLV; |
26332 |
+@@ -1586,39 +1597,33 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi, |
26333 |
+ unsigned long flags; |
26334 |
+ unsigned int comm_type; |
26335 |
+ int nb_words, ret = 0; |
26336 |
++ int mbr; |
26337 |
+ |
26338 |
+ spin_lock_irqsave(&spi->lock, flags); |
26339 |
+ |
26340 |
+- if (spi->cur_bpw != transfer->bits_per_word) { |
26341 |
+- spi->cur_bpw = transfer->bits_per_word; |
26342 |
+- spi->cfg->set_bpw(spi); |
26343 |
+- } |
26344 |
++ spi->cur_xferlen = transfer->len; |
26345 |
+ |
26346 |
+- if (spi->cur_speed != transfer->speed_hz) { |
26347 |
+- int mbr; |
26348 |
++ spi->cur_bpw = transfer->bits_per_word; |
26349 |
++ spi->cfg->set_bpw(spi); |
26350 |
+ |
26351 |
+- /* Update spi->cur_speed with real clock speed */ |
26352 |
+- mbr = stm32_spi_prepare_mbr(spi, transfer->speed_hz, |
26353 |
+- spi->cfg->baud_rate_div_min, |
26354 |
+- spi->cfg->baud_rate_div_max); |
26355 |
+- if (mbr < 0) { |
26356 |
+- ret = mbr; |
26357 |
+- goto out; |
26358 |
+- } |
26359 |
+- |
26360 |
+- transfer->speed_hz = spi->cur_speed; |
26361 |
+- stm32_spi_set_mbr(spi, mbr); |
26362 |
++ /* Update spi->cur_speed with real clock speed */ |
26363 |
++ mbr = stm32_spi_prepare_mbr(spi, transfer->speed_hz, |
26364 |
++ spi->cfg->baud_rate_div_min, |
26365 |
++ spi->cfg->baud_rate_div_max); |
26366 |
++ if (mbr < 0) { |
26367 |
++ ret = mbr; |
26368 |
++ goto out; |
26369 |
+ } |
26370 |
+ |
26371 |
+- comm_type = stm32_spi_communication_type(spi_dev, transfer); |
26372 |
+- if (spi->cur_comm != comm_type) { |
26373 |
+- ret = spi->cfg->set_mode(spi, comm_type); |
26374 |
++ transfer->speed_hz = spi->cur_speed; |
26375 |
++ stm32_spi_set_mbr(spi, mbr); |
26376 |
+ |
26377 |
+- if (ret < 0) |
26378 |
+- goto out; |
26379 |
++ comm_type = stm32_spi_communication_type(spi_dev, transfer); |
26380 |
++ ret = spi->cfg->set_mode(spi, comm_type); |
26381 |
++ if (ret < 0) |
26382 |
++ goto out; |
26383 |
+ |
26384 |
+- spi->cur_comm = comm_type; |
26385 |
+- } |
26386 |
++ spi->cur_comm = comm_type; |
26387 |
+ |
26388 |
+ if (spi->cfg->set_data_idleness) |
26389 |
+ spi->cfg->set_data_idleness(spi, transfer->len); |
26390 |
+@@ -1636,8 +1641,6 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi, |
26391 |
+ goto out; |
26392 |
+ } |
26393 |
+ |
26394 |
+- spi->cur_xferlen = transfer->len; |
26395 |
+- |
26396 |
+ dev_dbg(spi->dev, "transfer communication mode set to %d\n", |
26397 |
+ spi->cur_comm); |
26398 |
+ dev_dbg(spi->dev, |
26399 |
+diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c |
26400 |
+index be0053c795b7a..937f4e732a75c 100644 |
26401 |
+--- a/drivers/staging/rts5208/rtsx.c |
26402 |
++++ b/drivers/staging/rts5208/rtsx.c |
26403 |
+@@ -972,6 +972,7 @@ ioremap_fail: |
26404 |
+ kfree(dev->chip); |
26405 |
+ chip_alloc_fail: |
26406 |
+ dev_err(&pci->dev, "%s failed\n", __func__); |
26407 |
++ scsi_host_put(host); |
26408 |
+ scsi_host_alloc_fail: |
26409 |
+ pci_release_regions(pci); |
26410 |
+ return err; |
26411 |
+diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h |
26412 |
+index 8533444159635..e7b3c6e5d5744 100644 |
26413 |
+--- a/drivers/target/target_core_internal.h |
26414 |
++++ b/drivers/target/target_core_internal.h |
26415 |
+@@ -138,6 +138,7 @@ int init_se_kmem_caches(void); |
26416 |
+ void release_se_kmem_caches(void); |
26417 |
+ u32 scsi_get_new_index(scsi_index_t); |
26418 |
+ void transport_subsystem_check_init(void); |
26419 |
++void transport_uninit_session(struct se_session *); |
26420 |
+ unsigned char *transport_dump_cmd_direction(struct se_cmd *); |
26421 |
+ void transport_dump_dev_state(struct se_device *, char *, int *); |
26422 |
+ void transport_dump_dev_info(struct se_device *, struct se_lun *, |
26423 |
+diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
26424 |
+index 90ecdd706a017..e6e1fa68de542 100644 |
26425 |
+--- a/drivers/target/target_core_transport.c |
26426 |
++++ b/drivers/target/target_core_transport.c |
26427 |
+@@ -236,6 +236,11 @@ int transport_init_session(struct se_session *se_sess) |
26428 |
+ } |
26429 |
+ EXPORT_SYMBOL(transport_init_session); |
26430 |
+ |
26431 |
++void transport_uninit_session(struct se_session *se_sess) |
26432 |
++{ |
26433 |
++ percpu_ref_exit(&se_sess->cmd_count); |
26434 |
++} |
26435 |
++ |
26436 |
+ /** |
26437 |
+ * transport_alloc_session - allocate a session object and initialize it |
26438 |
+ * @sup_prot_ops: bitmask that defines which T10-PI modes are supported. |
26439 |
+@@ -579,7 +584,7 @@ void transport_free_session(struct se_session *se_sess) |
26440 |
+ sbitmap_queue_free(&se_sess->sess_tag_pool); |
26441 |
+ kvfree(se_sess->sess_cmd_map); |
26442 |
+ } |
26443 |
+- percpu_ref_exit(&se_sess->cmd_count); |
26444 |
++ transport_uninit_session(se_sess); |
26445 |
+ kmem_cache_free(se_sess_cache, se_sess); |
26446 |
+ } |
26447 |
+ EXPORT_SYMBOL(transport_free_session); |
26448 |
+diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
26449 |
+index 63cca0e1e9123..9ab960cc39b6f 100644 |
26450 |
+--- a/drivers/target/target_core_user.c |
26451 |
++++ b/drivers/target/target_core_user.c |
26452 |
+@@ -1220,7 +1220,14 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) |
26453 |
+ |
26454 |
+ struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned; |
26455 |
+ |
26456 |
+- tcmu_flush_dcache_range(entry, sizeof(*entry)); |
26457 |
++ /* |
26458 |
++ * Flush max. up to end of cmd ring since current entry might |
26459 |
++ * be a padding that is shorter than sizeof(*entry) |
26460 |
++ */ |
26461 |
++ size_t ring_left = head_to_end(udev->cmdr_last_cleaned, |
26462 |
++ udev->cmdr_size); |
26463 |
++ tcmu_flush_dcache_range(entry, ring_left < sizeof(*entry) ? |
26464 |
++ ring_left : sizeof(*entry)); |
26465 |
+ |
26466 |
+ if (tcmu_hdr_get_op(entry->hdr.len_op) == TCMU_OP_PAD) { |
26467 |
+ UPDATE_HEAD(udev->cmdr_last_cleaned, |
26468 |
+diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c |
26469 |
+index 0d00ccbeb0503..44e15d7fb2f09 100644 |
26470 |
+--- a/drivers/target/target_core_xcopy.c |
26471 |
++++ b/drivers/target/target_core_xcopy.c |
26472 |
+@@ -474,7 +474,7 @@ int target_xcopy_setup_pt(void) |
26473 |
+ memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); |
26474 |
+ ret = transport_init_session(&xcopy_pt_sess); |
26475 |
+ if (ret < 0) |
26476 |
+- return ret; |
26477 |
++ goto destroy_wq; |
26478 |
+ |
26479 |
+ xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg; |
26480 |
+ xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess; |
26481 |
+@@ -483,12 +483,19 @@ int target_xcopy_setup_pt(void) |
26482 |
+ xcopy_pt_sess.se_node_acl = &xcopy_pt_nacl; |
26483 |
+ |
26484 |
+ return 0; |
26485 |
++ |
26486 |
++destroy_wq: |
26487 |
++ destroy_workqueue(xcopy_wq); |
26488 |
++ xcopy_wq = NULL; |
26489 |
++ return ret; |
26490 |
+ } |
26491 |
+ |
26492 |
+ void target_xcopy_release_pt(void) |
26493 |
+ { |
26494 |
+- if (xcopy_wq) |
26495 |
++ if (xcopy_wq) { |
26496 |
+ destroy_workqueue(xcopy_wq); |
26497 |
++ transport_uninit_session(&xcopy_pt_sess); |
26498 |
++ } |
26499 |
+ } |
26500 |
+ |
26501 |
+ /* |
26502 |
+diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c |
26503 |
+index 04b9af7ed9415..2d0e7c7e408dc 100644 |
26504 |
+--- a/drivers/tty/serial/8250/8250_exar.c |
26505 |
++++ b/drivers/tty/serial/8250/8250_exar.c |
26506 |
+@@ -744,6 +744,24 @@ static const struct exar8250_board pbn_exar_XR17V35x = { |
26507 |
+ .exit = pci_xr17v35x_exit, |
26508 |
+ }; |
26509 |
+ |
26510 |
++static const struct exar8250_board pbn_fastcom35x_2 = { |
26511 |
++ .num_ports = 2, |
26512 |
++ .setup = pci_xr17v35x_setup, |
26513 |
++ .exit = pci_xr17v35x_exit, |
26514 |
++}; |
26515 |
++ |
26516 |
++static const struct exar8250_board pbn_fastcom35x_4 = { |
26517 |
++ .num_ports = 4, |
26518 |
++ .setup = pci_xr17v35x_setup, |
26519 |
++ .exit = pci_xr17v35x_exit, |
26520 |
++}; |
26521 |
++ |
26522 |
++static const struct exar8250_board pbn_fastcom35x_8 = { |
26523 |
++ .num_ports = 8, |
26524 |
++ .setup = pci_xr17v35x_setup, |
26525 |
++ .exit = pci_xr17v35x_exit, |
26526 |
++}; |
26527 |
++ |
26528 |
+ static const struct exar8250_board pbn_exar_XR17V4358 = { |
26529 |
+ .num_ports = 12, |
26530 |
+ .setup = pci_xr17v35x_setup, |
26531 |
+@@ -811,9 +829,9 @@ static const struct pci_device_id exar_pci_tbl[] = { |
26532 |
+ EXAR_DEVICE(EXAR, XR17V358, pbn_exar_XR17V35x), |
26533 |
+ EXAR_DEVICE(EXAR, XR17V4358, pbn_exar_XR17V4358), |
26534 |
+ EXAR_DEVICE(EXAR, XR17V8358, pbn_exar_XR17V8358), |
26535 |
+- EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_exar_XR17V35x), |
26536 |
+- EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_exar_XR17V35x), |
26537 |
+- EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_exar_XR17V35x), |
26538 |
++ EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_fastcom35x_2), |
26539 |
++ EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_fastcom35x_4), |
26540 |
++ EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_fastcom35x_8), |
26541 |
+ |
26542 |
+ EXAR_DEVICE(COMMTECH, 4222PCI335, pbn_fastcom335_2), |
26543 |
+ EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4), |
26544 |
+diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
26545 |
+index 1632f7d25acca..63a6d13f70b80 100644 |
26546 |
+--- a/drivers/tty/serial/8250/8250_port.c |
26547 |
++++ b/drivers/tty/serial/8250/8250_port.c |
26548 |
+@@ -2274,6 +2274,10 @@ int serial8250_do_startup(struct uart_port *port) |
26549 |
+ |
26550 |
+ if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { |
26551 |
+ unsigned char iir1; |
26552 |
++ |
26553 |
++ if (port->irqflags & IRQF_SHARED) |
26554 |
++ disable_irq_nosync(port->irq); |
26555 |
++ |
26556 |
+ /* |
26557 |
+ * Test for UARTs that do not reassert THRE when the |
26558 |
+ * transmitter is idle and the interrupt has already |
26559 |
+@@ -2283,8 +2287,6 @@ int serial8250_do_startup(struct uart_port *port) |
26560 |
+ * allow register changes to become visible. |
26561 |
+ */ |
26562 |
+ spin_lock_irqsave(&port->lock, flags); |
26563 |
+- if (up->port.irqflags & IRQF_SHARED) |
26564 |
+- disable_irq_nosync(port->irq); |
26565 |
+ |
26566 |
+ wait_for_xmitr(up, UART_LSR_THRE); |
26567 |
+ serial_port_out_sync(port, UART_IER, UART_IER_THRI); |
26568 |
+@@ -2296,9 +2298,10 @@ int serial8250_do_startup(struct uart_port *port) |
26569 |
+ iir = serial_port_in(port, UART_IIR); |
26570 |
+ serial_port_out(port, UART_IER, 0); |
26571 |
+ |
26572 |
++ spin_unlock_irqrestore(&port->lock, flags); |
26573 |
++ |
26574 |
+ if (port->irqflags & IRQF_SHARED) |
26575 |
+ enable_irq(port->irq); |
26576 |
+- spin_unlock_irqrestore(&port->lock, flags); |
26577 |
+ |
26578 |
+ /* |
26579 |
+ * If the interrupt is not reasserted, or we otherwise |
26580 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
26581 |
+index 8efd7c2a34fe8..a8d1edcf252c7 100644 |
26582 |
+--- a/drivers/tty/serial/amba-pl011.c |
26583 |
++++ b/drivers/tty/serial/amba-pl011.c |
26584 |
+@@ -2241,9 +2241,8 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) |
26585 |
+ clk_disable(uap->clk); |
26586 |
+ } |
26587 |
+ |
26588 |
+-static void __init |
26589 |
+-pl011_console_get_options(struct uart_amba_port *uap, int *baud, |
26590 |
+- int *parity, int *bits) |
26591 |
++static void pl011_console_get_options(struct uart_amba_port *uap, int *baud, |
26592 |
++ int *parity, int *bits) |
26593 |
+ { |
26594 |
+ if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) { |
26595 |
+ unsigned int lcr_h, ibrd, fbrd; |
26596 |
+@@ -2276,7 +2275,7 @@ pl011_console_get_options(struct uart_amba_port *uap, int *baud, |
26597 |
+ } |
26598 |
+ } |
26599 |
+ |
26600 |
+-static int __init pl011_console_setup(struct console *co, char *options) |
26601 |
++static int pl011_console_setup(struct console *co, char *options) |
26602 |
+ { |
26603 |
+ struct uart_amba_port *uap; |
26604 |
+ int baud = 38400; |
26605 |
+@@ -2344,8 +2343,8 @@ static int __init pl011_console_setup(struct console *co, char *options) |
26606 |
+ * |
26607 |
+ * Returns 0 if console matches; otherwise non-zero to use default matching |
26608 |
+ */ |
26609 |
+-static int __init pl011_console_match(struct console *co, char *name, int idx, |
26610 |
+- char *options) |
26611 |
++static int pl011_console_match(struct console *co, char *name, int idx, |
26612 |
++ char *options) |
26613 |
+ { |
26614 |
+ unsigned char iotype; |
26615 |
+ resource_size_t addr; |
26616 |
+@@ -2616,7 +2615,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, |
26617 |
+ |
26618 |
+ static int pl011_register_port(struct uart_amba_port *uap) |
26619 |
+ { |
26620 |
+- int ret; |
26621 |
++ int ret, i; |
26622 |
+ |
26623 |
+ /* Ensure interrupts from this UART are masked and cleared */ |
26624 |
+ pl011_write(0, uap, REG_IMSC); |
26625 |
+@@ -2627,6 +2626,9 @@ static int pl011_register_port(struct uart_amba_port *uap) |
26626 |
+ if (ret < 0) { |
26627 |
+ dev_err(uap->port.dev, |
26628 |
+ "Failed to register AMBA-PL011 driver\n"); |
26629 |
++ for (i = 0; i < ARRAY_SIZE(amba_ports); i++) |
26630 |
++ if (amba_ports[i] == uap) |
26631 |
++ amba_ports[i] = NULL; |
26632 |
+ return ret; |
26633 |
+ } |
26634 |
+ } |
26635 |
+diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c |
26636 |
+index d913d9b2762a6..815da3e78ad1a 100644 |
26637 |
+--- a/drivers/tty/serial/samsung_tty.c |
26638 |
++++ b/drivers/tty/serial/samsung_tty.c |
26639 |
+@@ -1911,9 +1911,11 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, |
26640 |
+ ourport->tx_irq = ret + 1; |
26641 |
+ } |
26642 |
+ |
26643 |
+- ret = platform_get_irq(platdev, 1); |
26644 |
+- if (ret > 0) |
26645 |
+- ourport->tx_irq = ret; |
26646 |
++ if (!s3c24xx_serial_has_interrupt_mask(port)) { |
26647 |
++ ret = platform_get_irq(platdev, 1); |
26648 |
++ if (ret > 0) |
26649 |
++ ourport->tx_irq = ret; |
26650 |
++ } |
26651 |
+ /* |
26652 |
+ * DMA is currently supported only on DT platforms, if DMA properties |
26653 |
+ * are specified. |
26654 |
+diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c |
26655 |
+index 8602ff3573218..b77b41c768fbf 100644 |
26656 |
+--- a/drivers/tty/serial/stm32-usart.c |
26657 |
++++ b/drivers/tty/serial/stm32-usart.c |
26658 |
+@@ -962,7 +962,7 @@ static int stm32_init_port(struct stm32_port *stm32port, |
26659 |
+ return ret; |
26660 |
+ |
26661 |
+ if (stm32port->info->cfg.has_wakeup) { |
26662 |
+- stm32port->wakeirq = platform_get_irq(pdev, 1); |
26663 |
++ stm32port->wakeirq = platform_get_irq_optional(pdev, 1); |
26664 |
+ if (stm32port->wakeirq <= 0 && stm32port->wakeirq != -ENXIO) |
26665 |
+ return stm32port->wakeirq ? : -ENODEV; |
26666 |
+ } |
26667 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
26668 |
+index 42d8c67a481f0..c9ee8e9498d5a 100644 |
26669 |
+--- a/drivers/tty/vt/vt.c |
26670 |
++++ b/drivers/tty/vt/vt.c |
26671 |
+@@ -1196,7 +1196,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, |
26672 |
+ unsigned int old_rows, old_row_size, first_copied_row; |
26673 |
+ unsigned int new_cols, new_rows, new_row_size, new_screen_size; |
26674 |
+ unsigned int user; |
26675 |
+- unsigned short *newscreen; |
26676 |
++ unsigned short *oldscreen, *newscreen; |
26677 |
+ struct uni_screen *new_uniscr = NULL; |
26678 |
+ |
26679 |
+ WARN_CONSOLE_UNLOCKED(); |
26680 |
+@@ -1294,10 +1294,11 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, |
26681 |
+ if (new_scr_end > new_origin) |
26682 |
+ scr_memsetw((void *)new_origin, vc->vc_video_erase_char, |
26683 |
+ new_scr_end - new_origin); |
26684 |
+- kfree(vc->vc_screenbuf); |
26685 |
++ oldscreen = vc->vc_screenbuf; |
26686 |
+ vc->vc_screenbuf = newscreen; |
26687 |
+ vc->vc_screenbuf_size = new_screen_size; |
26688 |
+ set_origin(vc); |
26689 |
++ kfree(oldscreen); |
26690 |
+ |
26691 |
+ /* do part of a reset_terminal() */ |
26692 |
+ vc->vc_top = 0; |
26693 |
+diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c |
26694 |
+index daf61c28ba766..cbc85c995d92d 100644 |
26695 |
+--- a/drivers/tty/vt/vt_ioctl.c |
26696 |
++++ b/drivers/tty/vt/vt_ioctl.c |
26697 |
+@@ -893,12 +893,22 @@ int vt_ioctl(struct tty_struct *tty, |
26698 |
+ console_lock(); |
26699 |
+ vcp = vc_cons[i].d; |
26700 |
+ if (vcp) { |
26701 |
++ int ret; |
26702 |
++ int save_scan_lines = vcp->vc_scan_lines; |
26703 |
++ int save_font_height = vcp->vc_font.height; |
26704 |
++ |
26705 |
+ if (v.v_vlin) |
26706 |
+ vcp->vc_scan_lines = v.v_vlin; |
26707 |
+ if (v.v_clin) |
26708 |
+ vcp->vc_font.height = v.v_clin; |
26709 |
+ vcp->vc_resize_user = 1; |
26710 |
+- vc_resize(vcp, v.v_cols, v.v_rows); |
26711 |
++ ret = vc_resize(vcp, v.v_cols, v.v_rows); |
26712 |
++ if (ret) { |
26713 |
++ vcp->vc_scan_lines = save_scan_lines; |
26714 |
++ vcp->vc_font.height = save_font_height; |
26715 |
++ console_unlock(); |
26716 |
++ return ret; |
26717 |
++ } |
26718 |
+ } |
26719 |
+ console_unlock(); |
26720 |
+ } |
26721 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
26722 |
+index d5187b50fc828..7499ba118665a 100644 |
26723 |
+--- a/drivers/usb/class/cdc-acm.c |
26724 |
++++ b/drivers/usb/class/cdc-acm.c |
26725 |
+@@ -378,21 +378,19 @@ static void acm_ctrl_irq(struct urb *urb) |
26726 |
+ if (current_size < expected_size) { |
26727 |
+ /* notification is transmitted fragmented, reassemble */ |
26728 |
+ if (acm->nb_size < expected_size) { |
26729 |
+- if (acm->nb_size) { |
26730 |
+- kfree(acm->notification_buffer); |
26731 |
+- acm->nb_size = 0; |
26732 |
+- } |
26733 |
++ u8 *new_buffer; |
26734 |
+ alloc_size = roundup_pow_of_two(expected_size); |
26735 |
+- /* |
26736 |
+- * kmalloc ensures a valid notification_buffer after a |
26737 |
+- * use of kfree in case the previous allocation was too |
26738 |
+- * small. Final freeing is done on disconnect. |
26739 |
+- */ |
26740 |
+- acm->notification_buffer = |
26741 |
+- kmalloc(alloc_size, GFP_ATOMIC); |
26742 |
+- if (!acm->notification_buffer) |
26743 |
++ /* Final freeing is done on disconnect. */ |
26744 |
++ new_buffer = krealloc(acm->notification_buffer, |
26745 |
++ alloc_size, GFP_ATOMIC); |
26746 |
++ if (!new_buffer) { |
26747 |
++ acm->nb_index = 0; |
26748 |
+ goto exit; |
26749 |
++ } |
26750 |
++ |
26751 |
++ acm->notification_buffer = new_buffer; |
26752 |
+ acm->nb_size = alloc_size; |
26753 |
++ dr = (struct usb_cdc_notification *)acm->notification_buffer; |
26754 |
+ } |
26755 |
+ |
26756 |
+ copy_size = min(current_size, |
26757 |
+diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c |
26758 |
+index f81606c6a35b0..7e73e989645bd 100644 |
26759 |
+--- a/drivers/usb/core/driver.c |
26760 |
++++ b/drivers/usb/core/driver.c |
26761 |
+@@ -905,6 +905,35 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) |
26762 |
+ return 0; |
26763 |
+ } |
26764 |
+ |
26765 |
++static bool is_dev_usb_generic_driver(struct device *dev) |
26766 |
++{ |
26767 |
++ struct usb_device_driver *udd = dev->driver ? |
26768 |
++ to_usb_device_driver(dev->driver) : NULL; |
26769 |
++ |
26770 |
++ return udd == &usb_generic_driver; |
26771 |
++} |
26772 |
++ |
26773 |
++static int __usb_bus_reprobe_drivers(struct device *dev, void *data) |
26774 |
++{ |
26775 |
++ struct usb_device_driver *new_udriver = data; |
26776 |
++ struct usb_device *udev; |
26777 |
++ int ret; |
26778 |
++ |
26779 |
++ if (!is_dev_usb_generic_driver(dev)) |
26780 |
++ return 0; |
26781 |
++ |
26782 |
++ udev = to_usb_device(dev); |
26783 |
++ if (usb_device_match_id(udev, new_udriver->id_table) == NULL && |
26784 |
++ (!new_udriver->match || new_udriver->match(udev) != 0)) |
26785 |
++ return 0; |
26786 |
++ |
26787 |
++ ret = device_reprobe(dev); |
26788 |
++ if (ret && ret != -EPROBE_DEFER) |
26789 |
++ dev_err(dev, "Failed to reprobe device (error %d)\n", ret); |
26790 |
++ |
26791 |
++ return 0; |
26792 |
++} |
26793 |
++ |
26794 |
+ /** |
26795 |
+ * usb_register_device_driver - register a USB device (not interface) driver |
26796 |
+ * @new_udriver: USB operations for the device driver |
26797 |
+@@ -934,13 +963,20 @@ int usb_register_device_driver(struct usb_device_driver *new_udriver, |
26798 |
+ |
26799 |
+ retval = driver_register(&new_udriver->drvwrap.driver); |
26800 |
+ |
26801 |
+- if (!retval) |
26802 |
++ if (!retval) { |
26803 |
+ pr_info("%s: registered new device driver %s\n", |
26804 |
+ usbcore_name, new_udriver->name); |
26805 |
+- else |
26806 |
++ /* |
26807 |
++ * Check whether any device could be better served with |
26808 |
++ * this new driver |
26809 |
++ */ |
26810 |
++ bus_for_each_dev(&usb_bus_type, NULL, new_udriver, |
26811 |
++ __usb_bus_reprobe_drivers); |
26812 |
++ } else { |
26813 |
+ printk(KERN_ERR "%s: error %d registering device " |
26814 |
+ " driver %s\n", |
26815 |
+ usbcore_name, retval, new_udriver->name); |
26816 |
++ } |
26817 |
+ |
26818 |
+ return retval; |
26819 |
+ } |
26820 |
+diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c |
26821 |
+index 4626227a6dd22..cd08a47144bd3 100644 |
26822 |
+--- a/drivers/usb/core/generic.c |
26823 |
++++ b/drivers/usb/core/generic.c |
26824 |
+@@ -207,8 +207,9 @@ static int __check_usb_generic(struct device_driver *drv, void *data) |
26825 |
+ return 0; |
26826 |
+ if (!udrv->id_table) |
26827 |
+ return 0; |
26828 |
+- |
26829 |
+- return usb_device_match_id(udev, udrv->id_table) != NULL; |
26830 |
++ if (usb_device_match_id(udev, udrv->id_table) != NULL) |
26831 |
++ return 1; |
26832 |
++ return (udrv->match && udrv->match(udev)); |
26833 |
+ } |
26834 |
+ |
26835 |
+ static bool usb_generic_driver_match(struct usb_device *udev) |
26836 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
26837 |
+index c96c50faccf72..2f068e525a374 100644 |
26838 |
+--- a/drivers/usb/core/quirks.c |
26839 |
++++ b/drivers/usb/core/quirks.c |
26840 |
+@@ -370,6 +370,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
26841 |
+ { USB_DEVICE(0x0926, 0x0202), .driver_info = |
26842 |
+ USB_QUIRK_ENDPOINT_BLACKLIST }, |
26843 |
+ |
26844 |
++ /* Sound Devices MixPre-D */ |
26845 |
++ { USB_DEVICE(0x0926, 0x0208), .driver_info = |
26846 |
++ USB_QUIRK_ENDPOINT_BLACKLIST }, |
26847 |
++ |
26848 |
+ /* Keytouch QWERTY Panel keyboard */ |
26849 |
+ { USB_DEVICE(0x0926, 0x3333), .driver_info = |
26850 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
26851 |
+@@ -465,6 +469,8 @@ static const struct usb_device_id usb_quirk_list[] = { |
26852 |
+ |
26853 |
+ { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, |
26854 |
+ |
26855 |
++ { USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM }, |
26856 |
++ |
26857 |
+ /* DJI CineSSD */ |
26858 |
+ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, |
26859 |
+ |
26860 |
+@@ -509,6 +515,7 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = { |
26861 |
+ */ |
26862 |
+ static const struct usb_device_id usb_endpoint_blacklist[] = { |
26863 |
+ { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 }, |
26864 |
++ { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 }, |
26865 |
+ { } |
26866 |
+ }; |
26867 |
+ |
26868 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
26869 |
+index 80c3ef134e41d..1739c5ea93c82 100644 |
26870 |
+--- a/drivers/usb/dwc3/gadget.c |
26871 |
++++ b/drivers/usb/dwc3/gadget.c |
26872 |
+@@ -1054,27 +1054,25 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, |
26873 |
+ * dwc3_prepare_one_trb - setup one TRB from one request |
26874 |
+ * @dep: endpoint for which this request is prepared |
26875 |
+ * @req: dwc3_request pointer |
26876 |
++ * @trb_length: buffer size of the TRB |
26877 |
+ * @chain: should this TRB be chained to the next? |
26878 |
+ * @node: only for isochronous endpoints. First TRB needs different type. |
26879 |
+ */ |
26880 |
+ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, |
26881 |
+- struct dwc3_request *req, unsigned chain, unsigned node) |
26882 |
++ struct dwc3_request *req, unsigned int trb_length, |
26883 |
++ unsigned chain, unsigned node) |
26884 |
+ { |
26885 |
+ struct dwc3_trb *trb; |
26886 |
+- unsigned int length; |
26887 |
+ dma_addr_t dma; |
26888 |
+ unsigned stream_id = req->request.stream_id; |
26889 |
+ unsigned short_not_ok = req->request.short_not_ok; |
26890 |
+ unsigned no_interrupt = req->request.no_interrupt; |
26891 |
+ unsigned is_last = req->request.is_last; |
26892 |
+ |
26893 |
+- if (req->request.num_sgs > 0) { |
26894 |
+- length = sg_dma_len(req->start_sg); |
26895 |
++ if (req->request.num_sgs > 0) |
26896 |
+ dma = sg_dma_address(req->start_sg); |
26897 |
+- } else { |
26898 |
+- length = req->request.length; |
26899 |
++ else |
26900 |
+ dma = req->request.dma; |
26901 |
+- } |
26902 |
+ |
26903 |
+ trb = &dep->trb_pool[dep->trb_enqueue]; |
26904 |
+ |
26905 |
+@@ -1086,7 +1084,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, |
26906 |
+ |
26907 |
+ req->num_trbs++; |
26908 |
+ |
26909 |
+- __dwc3_prepare_one_trb(dep, trb, dma, length, chain, node, |
26910 |
++ __dwc3_prepare_one_trb(dep, trb, dma, trb_length, chain, node, |
26911 |
+ stream_id, short_not_ok, no_interrupt, is_last); |
26912 |
+ } |
26913 |
+ |
26914 |
+@@ -1096,16 +1094,27 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, |
26915 |
+ struct scatterlist *sg = req->start_sg; |
26916 |
+ struct scatterlist *s; |
26917 |
+ int i; |
26918 |
+- |
26919 |
++ unsigned int length = req->request.length; |
26920 |
+ unsigned int remaining = req->request.num_mapped_sgs |
26921 |
+ - req->num_queued_sgs; |
26922 |
+ |
26923 |
++ /* |
26924 |
++ * If we resume preparing the request, then get the remaining length of |
26925 |
++ * the request and resume where we left off. |
26926 |
++ */ |
26927 |
++ for_each_sg(req->request.sg, s, req->num_queued_sgs, i) |
26928 |
++ length -= sg_dma_len(s); |
26929 |
++ |
26930 |
+ for_each_sg(sg, s, remaining, i) { |
26931 |
+- unsigned int length = req->request.length; |
26932 |
+ unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); |
26933 |
+ unsigned int rem = length % maxp; |
26934 |
++ unsigned int trb_length; |
26935 |
+ unsigned chain = true; |
26936 |
+ |
26937 |
++ trb_length = min_t(unsigned int, length, sg_dma_len(s)); |
26938 |
++ |
26939 |
++ length -= trb_length; |
26940 |
++ |
26941 |
+ /* |
26942 |
+ * IOMMU driver is coalescing the list of sgs which shares a |
26943 |
+ * page boundary into one and giving it to USB driver. With |
26944 |
+@@ -1113,7 +1122,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, |
26945 |
+ * sgs passed. So mark the chain bit to false if it isthe last |
26946 |
+ * mapped sg. |
26947 |
+ */ |
26948 |
+- if (i == remaining - 1) |
26949 |
++ if ((i == remaining - 1) || !length) |
26950 |
+ chain = false; |
26951 |
+ |
26952 |
+ if (rem && usb_endpoint_dir_out(dep->endpoint.desc) && !chain) { |
26953 |
+@@ -1123,7 +1132,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, |
26954 |
+ req->needs_extra_trb = true; |
26955 |
+ |
26956 |
+ /* prepare normal TRB */ |
26957 |
+- dwc3_prepare_one_trb(dep, req, true, i); |
26958 |
++ dwc3_prepare_one_trb(dep, req, trb_length, true, i); |
26959 |
+ |
26960 |
+ /* Now prepare one extra TRB to align transfer size */ |
26961 |
+ trb = &dep->trb_pool[dep->trb_enqueue]; |
26962 |
+@@ -1134,8 +1143,39 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, |
26963 |
+ req->request.short_not_ok, |
26964 |
+ req->request.no_interrupt, |
26965 |
+ req->request.is_last); |
26966 |
++ } else if (req->request.zero && req->request.length && |
26967 |
++ !usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
26968 |
++ !rem && !chain) { |
26969 |
++ struct dwc3 *dwc = dep->dwc; |
26970 |
++ struct dwc3_trb *trb; |
26971 |
++ |
26972 |
++ req->needs_extra_trb = true; |
26973 |
++ |
26974 |
++ /* Prepare normal TRB */ |
26975 |
++ dwc3_prepare_one_trb(dep, req, trb_length, true, i); |
26976 |
++ |
26977 |
++ /* Prepare one extra TRB to handle ZLP */ |
26978 |
++ trb = &dep->trb_pool[dep->trb_enqueue]; |
26979 |
++ req->num_trbs++; |
26980 |
++ __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0, |
26981 |
++ !req->direction, 1, |
26982 |
++ req->request.stream_id, |
26983 |
++ req->request.short_not_ok, |
26984 |
++ req->request.no_interrupt, |
26985 |
++ req->request.is_last); |
26986 |
++ |
26987 |
++ /* Prepare one more TRB to handle MPS alignment */ |
26988 |
++ if (!req->direction) { |
26989 |
++ trb = &dep->trb_pool[dep->trb_enqueue]; |
26990 |
++ req->num_trbs++; |
26991 |
++ __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp, |
26992 |
++ false, 1, req->request.stream_id, |
26993 |
++ req->request.short_not_ok, |
26994 |
++ req->request.no_interrupt, |
26995 |
++ req->request.is_last); |
26996 |
++ } |
26997 |
+ } else { |
26998 |
+- dwc3_prepare_one_trb(dep, req, chain, i); |
26999 |
++ dwc3_prepare_one_trb(dep, req, trb_length, chain, i); |
27000 |
+ } |
27001 |
+ |
27002 |
+ /* |
27003 |
+@@ -1150,6 +1190,16 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, |
27004 |
+ |
27005 |
+ req->num_queued_sgs++; |
27006 |
+ |
27007 |
++ /* |
27008 |
++ * The number of pending SG entries may not correspond to the |
27009 |
++ * number of mapped SG entries. If all the data are queued, then |
27010 |
++ * don't include unused SG entries. |
27011 |
++ */ |
27012 |
++ if (length == 0) { |
27013 |
++ req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs; |
27014 |
++ break; |
27015 |
++ } |
27016 |
++ |
27017 |
+ if (!dwc3_calc_trbs_left(dep)) |
27018 |
+ break; |
27019 |
+ } |
27020 |
+@@ -1169,7 +1219,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, |
27021 |
+ req->needs_extra_trb = true; |
27022 |
+ |
27023 |
+ /* prepare normal TRB */ |
27024 |
+- dwc3_prepare_one_trb(dep, req, true, 0); |
27025 |
++ dwc3_prepare_one_trb(dep, req, length, true, 0); |
27026 |
+ |
27027 |
+ /* Now prepare one extra TRB to align transfer size */ |
27028 |
+ trb = &dep->trb_pool[dep->trb_enqueue]; |
27029 |
+@@ -1180,6 +1230,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, |
27030 |
+ req->request.no_interrupt, |
27031 |
+ req->request.is_last); |
27032 |
+ } else if (req->request.zero && req->request.length && |
27033 |
++ !usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
27034 |
+ (IS_ALIGNED(req->request.length, maxp))) { |
27035 |
+ struct dwc3 *dwc = dep->dwc; |
27036 |
+ struct dwc3_trb *trb; |
27037 |
+@@ -1187,18 +1238,29 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, |
27038 |
+ req->needs_extra_trb = true; |
27039 |
+ |
27040 |
+ /* prepare normal TRB */ |
27041 |
+- dwc3_prepare_one_trb(dep, req, true, 0); |
27042 |
++ dwc3_prepare_one_trb(dep, req, length, true, 0); |
27043 |
+ |
27044 |
+- /* Now prepare one extra TRB to handle ZLP */ |
27045 |
++ /* Prepare one extra TRB to handle ZLP */ |
27046 |
+ trb = &dep->trb_pool[dep->trb_enqueue]; |
27047 |
+ req->num_trbs++; |
27048 |
+ __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0, |
27049 |
+- false, 1, req->request.stream_id, |
27050 |
++ !req->direction, 1, req->request.stream_id, |
27051 |
+ req->request.short_not_ok, |
27052 |
+ req->request.no_interrupt, |
27053 |
+ req->request.is_last); |
27054 |
++ |
27055 |
++ /* Prepare one more TRB to handle MPS alignment for OUT */ |
27056 |
++ if (!req->direction) { |
27057 |
++ trb = &dep->trb_pool[dep->trb_enqueue]; |
27058 |
++ req->num_trbs++; |
27059 |
++ __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp, |
27060 |
++ false, 1, req->request.stream_id, |
27061 |
++ req->request.short_not_ok, |
27062 |
++ req->request.no_interrupt, |
27063 |
++ req->request.is_last); |
27064 |
++ } |
27065 |
+ } else { |
27066 |
+- dwc3_prepare_one_trb(dep, req, false, 0); |
27067 |
++ dwc3_prepare_one_trb(dep, req, length, false, 0); |
27068 |
+ } |
27069 |
+ } |
27070 |
+ |
27071 |
+@@ -2649,8 +2711,17 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, |
27072 |
+ status); |
27073 |
+ |
27074 |
+ if (req->needs_extra_trb) { |
27075 |
++ unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); |
27076 |
++ |
27077 |
+ ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, |
27078 |
+ status); |
27079 |
++ |
27080 |
++ /* Reclaim MPS padding TRB for ZLP */ |
27081 |
++ if (!req->direction && req->request.zero && req->request.length && |
27082 |
++ !usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
27083 |
++ (IS_ALIGNED(req->request.length, maxp))) |
27084 |
++ ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, status); |
27085 |
++ |
27086 |
+ req->needs_extra_trb = false; |
27087 |
+ } |
27088 |
+ |
27089 |
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
27090 |
+index 1d900081b1f0c..b4206b0dede54 100644 |
27091 |
+--- a/drivers/usb/gadget/function/f_ncm.c |
27092 |
++++ b/drivers/usb/gadget/function/f_ncm.c |
27093 |
+@@ -1181,12 +1181,15 @@ static int ncm_unwrap_ntb(struct gether *port, |
27094 |
+ int ndp_index; |
27095 |
+ unsigned dg_len, dg_len2; |
27096 |
+ unsigned ndp_len; |
27097 |
++ unsigned block_len; |
27098 |
+ struct sk_buff *skb2; |
27099 |
+ int ret = -EINVAL; |
27100 |
+- unsigned max_size = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize); |
27101 |
++ unsigned ntb_max = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize); |
27102 |
++ unsigned frame_max = le16_to_cpu(ecm_desc.wMaxSegmentSize); |
27103 |
+ const struct ndp_parser_opts *opts = ncm->parser_opts; |
27104 |
+ unsigned crc_len = ncm->is_crc ? sizeof(uint32_t) : 0; |
27105 |
+ int dgram_counter; |
27106 |
++ bool ndp_after_header; |
27107 |
+ |
27108 |
+ /* dwSignature */ |
27109 |
+ if (get_unaligned_le32(tmp) != opts->nth_sign) { |
27110 |
+@@ -1205,25 +1208,37 @@ static int ncm_unwrap_ntb(struct gether *port, |
27111 |
+ } |
27112 |
+ tmp++; /* skip wSequence */ |
27113 |
+ |
27114 |
++ block_len = get_ncm(&tmp, opts->block_length); |
27115 |
+ /* (d)wBlockLength */ |
27116 |
+- if (get_ncm(&tmp, opts->block_length) > max_size) { |
27117 |
++ if (block_len > ntb_max) { |
27118 |
+ INFO(port->func.config->cdev, "OUT size exceeded\n"); |
27119 |
+ goto err; |
27120 |
+ } |
27121 |
+ |
27122 |
+ ndp_index = get_ncm(&tmp, opts->ndp_index); |
27123 |
++ ndp_after_header = false; |
27124 |
+ |
27125 |
+ /* Run through all the NDP's in the NTB */ |
27126 |
+ do { |
27127 |
+- /* NCM 3.2 */ |
27128 |
+- if (((ndp_index % 4) != 0) && |
27129 |
+- (ndp_index < opts->nth_size)) { |
27130 |
++ /* |
27131 |
++ * NCM 3.2 |
27132 |
++ * dwNdpIndex |
27133 |
++ */ |
27134 |
++ if (((ndp_index % 4) != 0) || |
27135 |
++ (ndp_index < opts->nth_size) || |
27136 |
++ (ndp_index > (block_len - |
27137 |
++ opts->ndp_size))) { |
27138 |
+ INFO(port->func.config->cdev, "Bad index: %#X\n", |
27139 |
+ ndp_index); |
27140 |
+ goto err; |
27141 |
+ } |
27142 |
++ if (ndp_index == opts->nth_size) |
27143 |
++ ndp_after_header = true; |
27144 |
+ |
27145 |
+- /* walk through NDP */ |
27146 |
++ /* |
27147 |
++ * walk through NDP |
27148 |
++ * dwSignature |
27149 |
++ */ |
27150 |
+ tmp = (void *)(skb->data + ndp_index); |
27151 |
+ if (get_unaligned_le32(tmp) != ncm->ndp_sign) { |
27152 |
+ INFO(port->func.config->cdev, "Wrong NDP SIGN\n"); |
27153 |
+@@ -1234,14 +1249,15 @@ static int ncm_unwrap_ntb(struct gether *port, |
27154 |
+ ndp_len = get_unaligned_le16(tmp++); |
27155 |
+ /* |
27156 |
+ * NCM 3.3.1 |
27157 |
++ * wLength |
27158 |
+ * entry is 2 items |
27159 |
+ * item size is 16/32 bits, opts->dgram_item_len * 2 bytes |
27160 |
+ * minimal: struct usb_cdc_ncm_ndpX + normal entry + zero entry |
27161 |
+ * Each entry is a dgram index and a dgram length. |
27162 |
+ */ |
27163 |
+ if ((ndp_len < opts->ndp_size |
27164 |
+- + 2 * 2 * (opts->dgram_item_len * 2)) |
27165 |
+- || (ndp_len % opts->ndplen_align != 0)) { |
27166 |
++ + 2 * 2 * (opts->dgram_item_len * 2)) || |
27167 |
++ (ndp_len % opts->ndplen_align != 0)) { |
27168 |
+ INFO(port->func.config->cdev, "Bad NDP length: %#X\n", |
27169 |
+ ndp_len); |
27170 |
+ goto err; |
27171 |
+@@ -1258,8 +1274,21 @@ static int ncm_unwrap_ntb(struct gether *port, |
27172 |
+ |
27173 |
+ do { |
27174 |
+ index = index2; |
27175 |
++ /* wDatagramIndex[0] */ |
27176 |
++ if ((index < opts->nth_size) || |
27177 |
++ (index > block_len - opts->dpe_size)) { |
27178 |
++ INFO(port->func.config->cdev, |
27179 |
++ "Bad index: %#X\n", index); |
27180 |
++ goto err; |
27181 |
++ } |
27182 |
++ |
27183 |
+ dg_len = dg_len2; |
27184 |
+- if (dg_len < 14 + crc_len) { /* ethernet hdr + crc */ |
27185 |
++ /* |
27186 |
++ * wDatagramLength[0] |
27187 |
++ * ethernet hdr + crc or larger than max frame size |
27188 |
++ */ |
27189 |
++ if ((dg_len < 14 + crc_len) || |
27190 |
++ (dg_len > frame_max)) { |
27191 |
+ INFO(port->func.config->cdev, |
27192 |
+ "Bad dgram length: %#X\n", dg_len); |
27193 |
+ goto err; |
27194 |
+@@ -1283,6 +1312,37 @@ static int ncm_unwrap_ntb(struct gether *port, |
27195 |
+ index2 = get_ncm(&tmp, opts->dgram_item_len); |
27196 |
+ dg_len2 = get_ncm(&tmp, opts->dgram_item_len); |
27197 |
+ |
27198 |
++ if (index2 == 0 || dg_len2 == 0) |
27199 |
++ break; |
27200 |
++ |
27201 |
++ /* wDatagramIndex[1] */ |
27202 |
++ if (ndp_after_header) { |
27203 |
++ if (index2 < opts->nth_size + opts->ndp_size) { |
27204 |
++ INFO(port->func.config->cdev, |
27205 |
++ "Bad index: %#X\n", index2); |
27206 |
++ goto err; |
27207 |
++ } |
27208 |
++ } else { |
27209 |
++ if (index2 < opts->nth_size + opts->dpe_size) { |
27210 |
++ INFO(port->func.config->cdev, |
27211 |
++ "Bad index: %#X\n", index2); |
27212 |
++ goto err; |
27213 |
++ } |
27214 |
++ } |
27215 |
++ if (index2 > block_len - opts->dpe_size) { |
27216 |
++ INFO(port->func.config->cdev, |
27217 |
++ "Bad index: %#X\n", index2); |
27218 |
++ goto err; |
27219 |
++ } |
27220 |
++ |
27221 |
++ /* wDatagramLength[1] */ |
27222 |
++ if ((dg_len2 < 14 + crc_len) || |
27223 |
++ (dg_len2 > frame_max)) { |
27224 |
++ INFO(port->func.config->cdev, |
27225 |
++ "Bad dgram length: %#X\n", dg_len); |
27226 |
++ goto err; |
27227 |
++ } |
27228 |
++ |
27229 |
+ /* |
27230 |
+ * Copy the data into a new skb. |
27231 |
+ * This ensures the truesize is correct |
27232 |
+@@ -1299,9 +1359,6 @@ static int ncm_unwrap_ntb(struct gether *port, |
27233 |
+ ndp_len -= 2 * (opts->dgram_item_len * 2); |
27234 |
+ |
27235 |
+ dgram_counter++; |
27236 |
+- |
27237 |
+- if (index2 == 0 || dg_len2 == 0) |
27238 |
+- break; |
27239 |
+ } while (ndp_len > 2 * (opts->dgram_item_len * 2)); |
27240 |
+ } while (ndp_index); |
27241 |
+ |
27242 |
+diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c |
27243 |
+index eaf556ceac32b..0a45b4ef66a67 100644 |
27244 |
+--- a/drivers/usb/gadget/function/f_tcm.c |
27245 |
++++ b/drivers/usb/gadget/function/f_tcm.c |
27246 |
+@@ -753,12 +753,13 @@ static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream) |
27247 |
+ goto err_sts; |
27248 |
+ |
27249 |
+ return 0; |
27250 |
++ |
27251 |
+ err_sts: |
27252 |
+- usb_ep_free_request(fu->ep_status, stream->req_status); |
27253 |
+- stream->req_status = NULL; |
27254 |
+-err_out: |
27255 |
+ usb_ep_free_request(fu->ep_out, stream->req_out); |
27256 |
+ stream->req_out = NULL; |
27257 |
++err_out: |
27258 |
++ usb_ep_free_request(fu->ep_in, stream->req_in); |
27259 |
++ stream->req_in = NULL; |
27260 |
+ out: |
27261 |
+ return -ENOMEM; |
27262 |
+ } |
27263 |
+diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h |
27264 |
+index eaa13fd3dc7f3..e313c3b8dcb19 100644 |
27265 |
+--- a/drivers/usb/gadget/u_f.h |
27266 |
++++ b/drivers/usb/gadget/u_f.h |
27267 |
+@@ -14,6 +14,7 @@ |
27268 |
+ #define __U_F_H__ |
27269 |
+ |
27270 |
+ #include <linux/usb/gadget.h> |
27271 |
++#include <linux/overflow.h> |
27272 |
+ |
27273 |
+ /* Variable Length Array Macros **********************************************/ |
27274 |
+ #define vla_group(groupname) size_t groupname##__next = 0 |
27275 |
+@@ -21,21 +22,36 @@ |
27276 |
+ |
27277 |
+ #define vla_item(groupname, type, name, n) \ |
27278 |
+ size_t groupname##_##name##__offset = ({ \ |
27279 |
+- size_t align_mask = __alignof__(type) - 1; \ |
27280 |
+- size_t offset = (groupname##__next + align_mask) & ~align_mask;\ |
27281 |
+- size_t size = (n) * sizeof(type); \ |
27282 |
+- groupname##__next = offset + size; \ |
27283 |
++ size_t offset = 0; \ |
27284 |
++ if (groupname##__next != SIZE_MAX) { \ |
27285 |
++ size_t align_mask = __alignof__(type) - 1; \ |
27286 |
++ size_t size = array_size(n, sizeof(type)); \ |
27287 |
++ offset = (groupname##__next + align_mask) & \ |
27288 |
++ ~align_mask; \ |
27289 |
++ if (check_add_overflow(offset, size, \ |
27290 |
++ &groupname##__next)) { \ |
27291 |
++ groupname##__next = SIZE_MAX; \ |
27292 |
++ offset = 0; \ |
27293 |
++ } \ |
27294 |
++ } \ |
27295 |
+ offset; \ |
27296 |
+ }) |
27297 |
+ |
27298 |
+ #define vla_item_with_sz(groupname, type, name, n) \ |
27299 |
+- size_t groupname##_##name##__sz = (n) * sizeof(type); \ |
27300 |
+- size_t groupname##_##name##__offset = ({ \ |
27301 |
+- size_t align_mask = __alignof__(type) - 1; \ |
27302 |
+- size_t offset = (groupname##__next + align_mask) & ~align_mask;\ |
27303 |
+- size_t size = groupname##_##name##__sz; \ |
27304 |
+- groupname##__next = offset + size; \ |
27305 |
+- offset; \ |
27306 |
++ size_t groupname##_##name##__sz = array_size(n, sizeof(type)); \ |
27307 |
++ size_t groupname##_##name##__offset = ({ \ |
27308 |
++ size_t offset = 0; \ |
27309 |
++ if (groupname##__next != SIZE_MAX) { \ |
27310 |
++ size_t align_mask = __alignof__(type) - 1; \ |
27311 |
++ offset = (groupname##__next + align_mask) & \ |
27312 |
++ ~align_mask; \ |
27313 |
++ if (check_add_overflow(offset, groupname##_##name##__sz,\ |
27314 |
++ &groupname##__next)) { \ |
27315 |
++ groupname##__next = SIZE_MAX; \ |
27316 |
++ offset = 0; \ |
27317 |
++ } \ |
27318 |
++ } \ |
27319 |
++ offset; \ |
27320 |
+ }) |
27321 |
+ |
27322 |
+ #define vla_ptr(ptr, groupname, name) \ |
27323 |
+diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c |
27324 |
+index bd40e597f2566..5f5e8a64c8e2e 100644 |
27325 |
+--- a/drivers/usb/host/ohci-exynos.c |
27326 |
++++ b/drivers/usb/host/ohci-exynos.c |
27327 |
+@@ -171,9 +171,8 @@ static int exynos_ohci_probe(struct platform_device *pdev) |
27328 |
+ hcd->rsrc_len = resource_size(res); |
27329 |
+ |
27330 |
+ irq = platform_get_irq(pdev, 0); |
27331 |
+- if (!irq) { |
27332 |
+- dev_err(&pdev->dev, "Failed to get IRQ\n"); |
27333 |
+- err = -ENODEV; |
27334 |
++ if (irq < 0) { |
27335 |
++ err = irq; |
27336 |
+ goto fail_io; |
27337 |
+ } |
27338 |
+ |
27339 |
+diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c |
27340 |
+index 76c3f29562d2b..448d7b11dec4c 100644 |
27341 |
+--- a/drivers/usb/host/xhci-debugfs.c |
27342 |
++++ b/drivers/usb/host/xhci-debugfs.c |
27343 |
+@@ -273,7 +273,7 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused) |
27344 |
+ |
27345 |
+ static int xhci_endpoint_context_show(struct seq_file *s, void *unused) |
27346 |
+ { |
27347 |
+- int dci; |
27348 |
++ int ep_index; |
27349 |
+ dma_addr_t dma; |
27350 |
+ struct xhci_hcd *xhci; |
27351 |
+ struct xhci_ep_ctx *ep_ctx; |
27352 |
+@@ -282,9 +282,9 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused) |
27353 |
+ |
27354 |
+ xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus)); |
27355 |
+ |
27356 |
+- for (dci = 1; dci < 32; dci++) { |
27357 |
+- ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci); |
27358 |
+- dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params); |
27359 |
++ for (ep_index = 0; ep_index < 31; ep_index++) { |
27360 |
++ ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); |
27361 |
++ dma = dev->out_ctx->dma + (ep_index + 1) * CTX_SIZE(xhci->hcc_params); |
27362 |
+ seq_printf(s, "%pad: %s\n", &dma, |
27363 |
+ xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info), |
27364 |
+ le32_to_cpu(ep_ctx->ep_info2), |
27365 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
27366 |
+index f37316d2c8fa4..fa8f7935c2abe 100644 |
27367 |
+--- a/drivers/usb/host/xhci-hub.c |
27368 |
++++ b/drivers/usb/host/xhci-hub.c |
27369 |
+@@ -740,15 +740,6 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, |
27370 |
+ { |
27371 |
+ u32 pls = status_reg & PORT_PLS_MASK; |
27372 |
+ |
27373 |
+- /* resume state is a xHCI internal state. |
27374 |
+- * Do not report it to usb core, instead, pretend to be U3, |
27375 |
+- * thus usb core knows it's not ready for transfer |
27376 |
+- */ |
27377 |
+- if (pls == XDEV_RESUME) { |
27378 |
+- *status |= USB_SS_PORT_LS_U3; |
27379 |
+- return; |
27380 |
+- } |
27381 |
+- |
27382 |
+ /* When the CAS bit is set then warm reset |
27383 |
+ * should be performed on port |
27384 |
+ */ |
27385 |
+@@ -770,6 +761,16 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, |
27386 |
+ */ |
27387 |
+ pls |= USB_PORT_STAT_CONNECTION; |
27388 |
+ } else { |
27389 |
++ /* |
27390 |
++ * Resume state is an xHCI internal state. Do not report it to |
27391 |
++ * usb core, instead, pretend to be U3, thus usb core knows |
27392 |
++ * it's not ready for transfer. |
27393 |
++ */ |
27394 |
++ if (pls == XDEV_RESUME) { |
27395 |
++ *status |= USB_SS_PORT_LS_U3; |
27396 |
++ return; |
27397 |
++ } |
27398 |
++ |
27399 |
+ /* |
27400 |
+ * If CAS bit isn't set but the Port is already at |
27401 |
+ * Compliance Mode, fake a connection so the USB core |
27402 |
+diff --git a/drivers/usb/host/xhci-pci-renesas.c b/drivers/usb/host/xhci-pci-renesas.c |
27403 |
+index 59b1965ad0a3f..f97ac9f52bf4d 100644 |
27404 |
+--- a/drivers/usb/host/xhci-pci-renesas.c |
27405 |
++++ b/drivers/usb/host/xhci-pci-renesas.c |
27406 |
+@@ -50,20 +50,6 @@ |
27407 |
+ #define RENESAS_RETRY 10000 |
27408 |
+ #define RENESAS_DELAY 10 |
27409 |
+ |
27410 |
+-#define ROM_VALID_01 0x2013 |
27411 |
+-#define ROM_VALID_02 0x2026 |
27412 |
+- |
27413 |
+-static int renesas_verify_fw_version(struct pci_dev *pdev, u32 version) |
27414 |
+-{ |
27415 |
+- switch (version) { |
27416 |
+- case ROM_VALID_01: |
27417 |
+- case ROM_VALID_02: |
27418 |
+- return 0; |
27419 |
+- } |
27420 |
+- dev_err(&pdev->dev, "FW has invalid version :%d\n", version); |
27421 |
+- return -EINVAL; |
27422 |
+-} |
27423 |
+- |
27424 |
+ static int renesas_fw_download_image(struct pci_dev *dev, |
27425 |
+ const u32 *fw, size_t step, bool rom) |
27426 |
+ { |
27427 |
+@@ -202,10 +188,7 @@ static int renesas_check_rom_state(struct pci_dev *pdev) |
27428 |
+ |
27429 |
+ version &= RENESAS_FW_VERSION_FIELD; |
27430 |
+ version = version >> RENESAS_FW_VERSION_OFFSET; |
27431 |
+- |
27432 |
+- err = renesas_verify_fw_version(pdev, version); |
27433 |
+- if (err) |
27434 |
+- return err; |
27435 |
++ dev_dbg(&pdev->dev, "Found ROM version: %x\n", version); |
27436 |
+ |
27437 |
+ /* |
27438 |
+ * Test if ROM is present and loaded, if so we can skip everything |
27439 |
+diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c |
27440 |
+index ee6bf01775bba..545bdecc8f15e 100644 |
27441 |
+--- a/drivers/usb/host/xhci-tegra.c |
27442 |
++++ b/drivers/usb/host/xhci-tegra.c |
27443 |
+@@ -1136,7 +1136,7 @@ static struct phy *tegra_xusb_get_phy(struct tegra_xusb *tegra, char *name, |
27444 |
+ unsigned int i, phy_count = 0; |
27445 |
+ |
27446 |
+ for (i = 0; i < tegra->soc->num_types; i++) { |
27447 |
+- if (!strncmp(tegra->soc->phy_types[i].name, "usb2", |
27448 |
++ if (!strncmp(tegra->soc->phy_types[i].name, name, |
27449 |
+ strlen(name))) |
27450 |
+ return tegra->phys[phy_count+port]; |
27451 |
+ |
27452 |
+@@ -1258,6 +1258,8 @@ static int tegra_xusb_init_usb_phy(struct tegra_xusb *tegra) |
27453 |
+ |
27454 |
+ INIT_WORK(&tegra->id_work, tegra_xhci_id_work); |
27455 |
+ tegra->id_nb.notifier_call = tegra_xhci_id_notify; |
27456 |
++ tegra->otg_usb2_port = -EINVAL; |
27457 |
++ tegra->otg_usb3_port = -EINVAL; |
27458 |
+ |
27459 |
+ for (i = 0; i < tegra->num_usb_phys; i++) { |
27460 |
+ struct phy *phy = tegra_xusb_get_phy(tegra, "usb2", i); |
27461 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
27462 |
+index ed468eed299c5..113ab5d3cbfe5 100644 |
27463 |
+--- a/drivers/usb/host/xhci.c |
27464 |
++++ b/drivers/usb/host/xhci.c |
27465 |
+@@ -3236,10 +3236,11 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, |
27466 |
+ |
27467 |
+ wait_for_completion(cfg_cmd->completion); |
27468 |
+ |
27469 |
+- ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE; |
27470 |
+ xhci_free_command(xhci, cfg_cmd); |
27471 |
+ cleanup: |
27472 |
+ xhci_free_command(xhci, stop_cmd); |
27473 |
++ if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE) |
27474 |
++ ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE; |
27475 |
+ } |
27476 |
+ |
27477 |
+ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
27478 |
+diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c |
27479 |
+index 407fe7570f3bc..f8686139d6f39 100644 |
27480 |
+--- a/drivers/usb/misc/lvstest.c |
27481 |
++++ b/drivers/usb/misc/lvstest.c |
27482 |
+@@ -426,7 +426,7 @@ static int lvs_rh_probe(struct usb_interface *intf, |
27483 |
+ USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT); |
27484 |
+ if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) { |
27485 |
+ dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret); |
27486 |
+- return ret; |
27487 |
++ return ret < 0 ? ret : -EINVAL; |
27488 |
+ } |
27489 |
+ |
27490 |
+ /* submit urb to poll interrupt endpoint */ |
27491 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c |
27492 |
+index fc8a5da4a07c9..0734e6dd93862 100644 |
27493 |
+--- a/drivers/usb/misc/sisusbvga/sisusb.c |
27494 |
++++ b/drivers/usb/misc/sisusbvga/sisusb.c |
27495 |
+@@ -761,7 +761,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, |
27496 |
+ u8 swap8, fromkern = kernbuffer ? 1 : 0; |
27497 |
+ u16 swap16; |
27498 |
+ u32 swap32, flag = (length >> 28) & 1; |
27499 |
+- char buf[4]; |
27500 |
++ u8 buf[4]; |
27501 |
+ |
27502 |
+ /* if neither kernbuffer not userbuffer are given, assume |
27503 |
+ * data in obuf |
27504 |
+diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c |
27505 |
+index be0505b8b5d4e..785080f790738 100644 |
27506 |
+--- a/drivers/usb/misc/yurex.c |
27507 |
++++ b/drivers/usb/misc/yurex.c |
27508 |
+@@ -492,7 +492,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, |
27509 |
+ prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); |
27510 |
+ dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__, |
27511 |
+ dev->cntl_buffer[0]); |
27512 |
+- retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL); |
27513 |
++ retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC); |
27514 |
+ if (retval >= 0) |
27515 |
+ timeout = schedule_timeout(YUREX_WRITE_TIMEOUT); |
27516 |
+ finish_wait(&dev->waitq, &wait); |
27517 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
27518 |
+index b6a9a74516201..e5f9557690f9e 100644 |
27519 |
+--- a/drivers/usb/storage/unusual_devs.h |
27520 |
++++ b/drivers/usb/storage/unusual_devs.h |
27521 |
+@@ -2328,7 +2328,7 @@ UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114, |
27522 |
+ "JMicron", |
27523 |
+ "USB to ATA/ATAPI Bridge", |
27524 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
27525 |
+- US_FL_BROKEN_FUA ), |
27526 |
++ US_FL_BROKEN_FUA | US_FL_IGNORE_UAS ), |
27527 |
+ |
27528 |
+ /* Reported by Andrey Rahmatullin <wrar@××××××××.org> */ |
27529 |
+ UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, |
27530 |
+diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h |
27531 |
+index 162b09d69f62f..711ab240058c7 100644 |
27532 |
+--- a/drivers/usb/storage/unusual_uas.h |
27533 |
++++ b/drivers/usb/storage/unusual_uas.h |
27534 |
+@@ -28,6 +28,13 @@ |
27535 |
+ * and don't forget to CC: the USB development list <linux-usb@×××××××××××.org> |
27536 |
+ */ |
27537 |
+ |
27538 |
++/* Reported-by: Till Dörges <doerges@×××××××××.de> */ |
27539 |
++UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999, |
27540 |
++ "Sony", |
27541 |
++ "PSZ-HA*", |
27542 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
27543 |
++ US_FL_NO_REPORT_OPCODES), |
27544 |
++ |
27545 |
+ /* Reported-by: Julian Groß <julian.g@××××××.de> */ |
27546 |
+ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, |
27547 |
+ "LaCie", |
27548 |
+@@ -80,6 +87,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999, |
27549 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
27550 |
+ US_FL_BROKEN_FUA), |
27551 |
+ |
27552 |
++/* Reported-by: Thinh Nguyen <thinhn@××××××××.com> */ |
27553 |
++UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999, |
27554 |
++ "PNY", |
27555 |
++ "Pro Elite SSD", |
27556 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
27557 |
++ US_FL_NO_ATA_1X), |
27558 |
++ |
27559 |
+ /* Reported-by: Hans de Goede <hdegoede@××××××.com> */ |
27560 |
+ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, |
27561 |
+ "VIA", |
27562 |
+diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c |
27563 |
+index 82b19ebd7838e..b2111fe6d140a 100644 |
27564 |
+--- a/drivers/usb/typec/tcpm/tcpm.c |
27565 |
++++ b/drivers/usb/typec/tcpm/tcpm.c |
27566 |
+@@ -3321,13 +3321,31 @@ static void run_state_machine(struct tcpm_port *port) |
27567 |
+ tcpm_set_state(port, SNK_HARD_RESET_SINK_OFF, 0); |
27568 |
+ break; |
27569 |
+ case SRC_HARD_RESET_VBUS_OFF: |
27570 |
+- tcpm_set_vconn(port, true); |
27571 |
++ /* |
27572 |
++ * 7.1.5 Response to Hard Resets |
27573 |
++ * Hard Reset Signaling indicates a communication failure has occurred and the |
27574 |
++ * Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin and Shall |
27575 |
++ * drive VBUS to vSafe0V as shown in Figure 7-9. |
27576 |
++ */ |
27577 |
++ tcpm_set_vconn(port, false); |
27578 |
+ tcpm_set_vbus(port, false); |
27579 |
+ tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE, |
27580 |
+ tcpm_data_role_for_source(port)); |
27581 |
+- tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); |
27582 |
++ /* |
27583 |
++ * If tcpc fails to notify vbus off, TCPM will wait for PD_T_SAFE_0V + |
27584 |
++ * PD_T_SRC_RECOVER before turning vbus back on. |
27585 |
++ * From Table 7-12 Sequence Description for a Source Initiated Hard Reset: |
27586 |
++ * 4. Policy Engine waits tPSHardReset after sending Hard Reset Signaling and then |
27587 |
++ * tells the Device Policy Manager to instruct the power supply to perform a |
27588 |
++ * Hard Reset. The transition to vSafe0V Shall occur within tSafe0V (t2). |
27589 |
++ * 5. After tSrcRecover the Source applies power to VBUS in an attempt to |
27590 |
++ * re-establish communication with the Sink and resume USB Default Operation. |
27591 |
++ * The transition to vSafe5V Shall occur within tSrcTurnOn(t4). |
27592 |
++ */ |
27593 |
++ tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SAFE_0V + PD_T_SRC_RECOVER); |
27594 |
+ break; |
27595 |
+ case SRC_HARD_RESET_VBUS_ON: |
27596 |
++ tcpm_set_vconn(port, true); |
27597 |
+ tcpm_set_vbus(port, true); |
27598 |
+ port->tcpc->set_pd_rx(port->tcpc, true); |
27599 |
+ tcpm_set_attached_state(port, true); |
27600 |
+@@ -3887,7 +3905,11 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) |
27601 |
+ tcpm_set_state(port, SNK_HARD_RESET_WAIT_VBUS, 0); |
27602 |
+ break; |
27603 |
+ case SRC_HARD_RESET_VBUS_OFF: |
27604 |
+- tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, 0); |
27605 |
++ /* |
27606 |
++ * After establishing the vSafe0V voltage condition on VBUS, the Source Shall wait |
27607 |
++ * tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V. |
27608 |
++ */ |
27609 |
++ tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); |
27610 |
+ break; |
27611 |
+ case HARD_RESET_SEND: |
27612 |
+ break; |
27613 |
+diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c |
27614 |
+index 048381c058a5b..261131c9e37c6 100644 |
27615 |
+--- a/drivers/usb/typec/ucsi/displayport.c |
27616 |
++++ b/drivers/usb/typec/ucsi/displayport.c |
27617 |
+@@ -288,8 +288,6 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, |
27618 |
+ struct typec_altmode *alt; |
27619 |
+ struct ucsi_dp *dp; |
27620 |
+ |
27621 |
+- mutex_lock(&con->lock); |
27622 |
+- |
27623 |
+ /* We can't rely on the firmware with the capabilities. */ |
27624 |
+ desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE; |
27625 |
+ |
27626 |
+@@ -298,15 +296,12 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, |
27627 |
+ desc->vdo |= all_assignments << 16; |
27628 |
+ |
27629 |
+ alt = typec_port_register_altmode(con->port, desc); |
27630 |
+- if (IS_ERR(alt)) { |
27631 |
+- mutex_unlock(&con->lock); |
27632 |
++ if (IS_ERR(alt)) |
27633 |
+ return alt; |
27634 |
+- } |
27635 |
+ |
27636 |
+ dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL); |
27637 |
+ if (!dp) { |
27638 |
+ typec_unregister_altmode(alt); |
27639 |
+- mutex_unlock(&con->lock); |
27640 |
+ return ERR_PTR(-ENOMEM); |
27641 |
+ } |
27642 |
+ |
27643 |
+@@ -319,7 +314,5 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, |
27644 |
+ alt->ops = &ucsi_displayport_ops; |
27645 |
+ typec_altmode_set_drvdata(alt, dp); |
27646 |
+ |
27647 |
+- mutex_unlock(&con->lock); |
27648 |
+- |
27649 |
+ return alt; |
27650 |
+ } |
27651 |
+diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c |
27652 |
+index d0c63afaf345d..2999217c81090 100644 |
27653 |
+--- a/drivers/usb/typec/ucsi/ucsi.c |
27654 |
++++ b/drivers/usb/typec/ucsi/ucsi.c |
27655 |
+@@ -146,40 +146,33 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) |
27656 |
+ return UCSI_CCI_LENGTH(cci); |
27657 |
+ } |
27658 |
+ |
27659 |
+-static int ucsi_run_command(struct ucsi *ucsi, u64 command, |
27660 |
+- void *data, size_t size) |
27661 |
++int ucsi_send_command(struct ucsi *ucsi, u64 command, |
27662 |
++ void *data, size_t size) |
27663 |
+ { |
27664 |
+ u8 length; |
27665 |
+ int ret; |
27666 |
+ |
27667 |
++ mutex_lock(&ucsi->ppm_lock); |
27668 |
++ |
27669 |
+ ret = ucsi_exec_command(ucsi, command); |
27670 |
+ if (ret < 0) |
27671 |
+- return ret; |
27672 |
++ goto out; |
27673 |
+ |
27674 |
+ length = ret; |
27675 |
+ |
27676 |
+ if (data) { |
27677 |
+ ret = ucsi->ops->read(ucsi, UCSI_MESSAGE_IN, data, size); |
27678 |
+ if (ret) |
27679 |
+- return ret; |
27680 |
++ goto out; |
27681 |
+ } |
27682 |
+ |
27683 |
+ ret = ucsi_acknowledge_command(ucsi); |
27684 |
+ if (ret) |
27685 |
+- return ret; |
27686 |
+- |
27687 |
+- return length; |
27688 |
+-} |
27689 |
+- |
27690 |
+-int ucsi_send_command(struct ucsi *ucsi, u64 command, |
27691 |
+- void *retval, size_t size) |
27692 |
+-{ |
27693 |
+- int ret; |
27694 |
++ goto out; |
27695 |
+ |
27696 |
+- mutex_lock(&ucsi->ppm_lock); |
27697 |
+- ret = ucsi_run_command(ucsi, command, retval, size); |
27698 |
++ ret = length; |
27699 |
++out: |
27700 |
+ mutex_unlock(&ucsi->ppm_lock); |
27701 |
+- |
27702 |
+ return ret; |
27703 |
+ } |
27704 |
+ EXPORT_SYMBOL_GPL(ucsi_send_command); |
27705 |
+@@ -205,7 +198,7 @@ void ucsi_altmode_update_active(struct ucsi_connector *con) |
27706 |
+ int i; |
27707 |
+ |
27708 |
+ command = UCSI_GET_CURRENT_CAM | UCSI_CONNECTOR_NUMBER(con->num); |
27709 |
+- ret = ucsi_run_command(con->ucsi, command, &cur, sizeof(cur)); |
27710 |
++ ret = ucsi_send_command(con->ucsi, command, &cur, sizeof(cur)); |
27711 |
+ if (ret < 0) { |
27712 |
+ if (con->ucsi->version > 0x0100) { |
27713 |
+ dev_err(con->ucsi->dev, |
27714 |
+@@ -354,7 +347,7 @@ ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient) |
27715 |
+ command |= UCSI_GET_ALTMODE_RECIPIENT(recipient); |
27716 |
+ command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num); |
27717 |
+ command |= UCSI_GET_ALTMODE_OFFSET(i); |
27718 |
+- len = ucsi_run_command(con->ucsi, command, &alt, sizeof(alt)); |
27719 |
++ len = ucsi_send_command(con->ucsi, command, &alt, sizeof(alt)); |
27720 |
+ /* |
27721 |
+ * We are collecting all altmodes first and then registering. |
27722 |
+ * Some type-C device will return zero length data beyond last |
27723 |
+@@ -431,7 +424,7 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient) |
27724 |
+ command |= UCSI_GET_ALTMODE_RECIPIENT(recipient); |
27725 |
+ command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num); |
27726 |
+ command |= UCSI_GET_ALTMODE_OFFSET(i); |
27727 |
+- len = ucsi_run_command(con->ucsi, command, alt, sizeof(alt)); |
27728 |
++ len = ucsi_send_command(con->ucsi, command, alt, sizeof(alt)); |
27729 |
+ if (len <= 0) |
27730 |
+ return len; |
27731 |
+ |
27732 |
+@@ -502,7 +495,7 @@ static void ucsi_get_pdos(struct ucsi_connector *con, int is_partner) |
27733 |
+ command |= UCSI_GET_PDOS_PARTNER_PDO(is_partner); |
27734 |
+ command |= UCSI_GET_PDOS_NUM_PDOS(UCSI_MAX_PDOS - 1); |
27735 |
+ command |= UCSI_GET_PDOS_SRC_PDOS; |
27736 |
+- ret = ucsi_run_command(ucsi, command, con->src_pdos, |
27737 |
++ ret = ucsi_send_command(ucsi, command, con->src_pdos, |
27738 |
+ sizeof(con->src_pdos)); |
27739 |
+ if (ret < 0) { |
27740 |
+ dev_err(ucsi->dev, "UCSI_GET_PDOS failed (%d)\n", ret); |
27741 |
+@@ -681,7 +674,7 @@ static void ucsi_handle_connector_change(struct work_struct *work) |
27742 |
+ */ |
27743 |
+ command = UCSI_GET_CAM_SUPPORTED; |
27744 |
+ command |= UCSI_CONNECTOR_NUMBER(con->num); |
27745 |
+- ucsi_run_command(con->ucsi, command, NULL, 0); |
27746 |
++ ucsi_send_command(con->ucsi, command, NULL, 0); |
27747 |
+ } |
27748 |
+ |
27749 |
+ if (con->status.change & UCSI_CONSTAT_PARTNER_CHANGE) |
27750 |
+@@ -736,20 +729,24 @@ static int ucsi_reset_ppm(struct ucsi *ucsi) |
27751 |
+ u32 cci; |
27752 |
+ int ret; |
27753 |
+ |
27754 |
++ mutex_lock(&ucsi->ppm_lock); |
27755 |
++ |
27756 |
+ ret = ucsi->ops->async_write(ucsi, UCSI_CONTROL, &command, |
27757 |
+ sizeof(command)); |
27758 |
+ if (ret < 0) |
27759 |
+- return ret; |
27760 |
++ goto out; |
27761 |
+ |
27762 |
+ tmo = jiffies + msecs_to_jiffies(UCSI_TIMEOUT_MS); |
27763 |
+ |
27764 |
+ do { |
27765 |
+- if (time_is_before_jiffies(tmo)) |
27766 |
+- return -ETIMEDOUT; |
27767 |
++ if (time_is_before_jiffies(tmo)) { |
27768 |
++ ret = -ETIMEDOUT; |
27769 |
++ goto out; |
27770 |
++ } |
27771 |
+ |
27772 |
+ ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); |
27773 |
+ if (ret) |
27774 |
+- return ret; |
27775 |
++ goto out; |
27776 |
+ |
27777 |
+ /* If the PPM is still doing something else, reset it again. */ |
27778 |
+ if (cci & ~UCSI_CCI_RESET_COMPLETE) { |
27779 |
+@@ -757,13 +754,15 @@ static int ucsi_reset_ppm(struct ucsi *ucsi) |
27780 |
+ &command, |
27781 |
+ sizeof(command)); |
27782 |
+ if (ret < 0) |
27783 |
+- return ret; |
27784 |
++ goto out; |
27785 |
+ } |
27786 |
+ |
27787 |
+ msleep(20); |
27788 |
+ } while (!(cci & UCSI_CCI_RESET_COMPLETE)); |
27789 |
+ |
27790 |
+- return 0; |
27791 |
++out: |
27792 |
++ mutex_unlock(&ucsi->ppm_lock); |
27793 |
++ return ret; |
27794 |
+ } |
27795 |
+ |
27796 |
+ static int ucsi_role_cmd(struct ucsi_connector *con, u64 command) |
27797 |
+@@ -775,9 +774,7 @@ static int ucsi_role_cmd(struct ucsi_connector *con, u64 command) |
27798 |
+ u64 c; |
27799 |
+ |
27800 |
+ /* PPM most likely stopped responding. Resetting everything. */ |
27801 |
+- mutex_lock(&con->ucsi->ppm_lock); |
27802 |
+ ucsi_reset_ppm(con->ucsi); |
27803 |
+- mutex_unlock(&con->ucsi->ppm_lock); |
27804 |
+ |
27805 |
+ c = UCSI_SET_NOTIFICATION_ENABLE | con->ucsi->ntfy; |
27806 |
+ ucsi_send_command(con->ucsi, c, NULL, 0); |
27807 |
+@@ -901,12 +898,15 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) |
27808 |
+ con->num = index + 1; |
27809 |
+ con->ucsi = ucsi; |
27810 |
+ |
27811 |
++ /* Delay other interactions with the con until registration is complete */ |
27812 |
++ mutex_lock(&con->lock); |
27813 |
++ |
27814 |
+ /* Get connector capability */ |
27815 |
+ command = UCSI_GET_CONNECTOR_CAPABILITY; |
27816 |
+ command |= UCSI_CONNECTOR_NUMBER(con->num); |
27817 |
+- ret = ucsi_run_command(ucsi, command, &con->cap, sizeof(con->cap)); |
27818 |
++ ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap)); |
27819 |
+ if (ret < 0) |
27820 |
+- return ret; |
27821 |
++ goto out; |
27822 |
+ |
27823 |
+ if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP) |
27824 |
+ cap->data = TYPEC_PORT_DRD; |
27825 |
+@@ -938,27 +938,32 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) |
27826 |
+ |
27827 |
+ ret = ucsi_register_port_psy(con); |
27828 |
+ if (ret) |
27829 |
+- return ret; |
27830 |
++ goto out; |
27831 |
+ |
27832 |
+ /* Register the connector */ |
27833 |
+ con->port = typec_register_port(ucsi->dev, cap); |
27834 |
+- if (IS_ERR(con->port)) |
27835 |
+- return PTR_ERR(con->port); |
27836 |
++ if (IS_ERR(con->port)) { |
27837 |
++ ret = PTR_ERR(con->port); |
27838 |
++ goto out; |
27839 |
++ } |
27840 |
+ |
27841 |
+ /* Alternate modes */ |
27842 |
+ ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_CON); |
27843 |
+- if (ret) |
27844 |
++ if (ret) { |
27845 |
+ dev_err(ucsi->dev, "con%d: failed to register alt modes\n", |
27846 |
+ con->num); |
27847 |
++ goto out; |
27848 |
++ } |
27849 |
+ |
27850 |
+ /* Get the status */ |
27851 |
+ command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num); |
27852 |
+- ret = ucsi_run_command(ucsi, command, &con->status, |
27853 |
+- sizeof(con->status)); |
27854 |
++ ret = ucsi_send_command(ucsi, command, &con->status, sizeof(con->status)); |
27855 |
+ if (ret < 0) { |
27856 |
+ dev_err(ucsi->dev, "con%d: failed to get status\n", con->num); |
27857 |
+- return 0; |
27858 |
++ ret = 0; |
27859 |
++ goto out; |
27860 |
+ } |
27861 |
++ ret = 0; /* ucsi_send_command() returns length on success */ |
27862 |
+ |
27863 |
+ switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) { |
27864 |
+ case UCSI_CONSTAT_PARTNER_TYPE_UFP: |
27865 |
+@@ -983,17 +988,21 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) |
27866 |
+ |
27867 |
+ if (con->partner) { |
27868 |
+ ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_SOP); |
27869 |
+- if (ret) |
27870 |
++ if (ret) { |
27871 |
+ dev_err(ucsi->dev, |
27872 |
+ "con%d: failed to register alternate modes\n", |
27873 |
+ con->num); |
27874 |
+- else |
27875 |
++ ret = 0; |
27876 |
++ } else { |
27877 |
+ ucsi_altmode_update_active(con); |
27878 |
++ } |
27879 |
+ } |
27880 |
+ |
27881 |
+ trace_ucsi_register_port(con->num, &con->status); |
27882 |
+ |
27883 |
+- return 0; |
27884 |
++out: |
27885 |
++ mutex_unlock(&con->lock); |
27886 |
++ return ret; |
27887 |
+ } |
27888 |
+ |
27889 |
+ /** |
27890 |
+@@ -1009,8 +1018,6 @@ int ucsi_init(struct ucsi *ucsi) |
27891 |
+ int ret; |
27892 |
+ int i; |
27893 |
+ |
27894 |
+- mutex_lock(&ucsi->ppm_lock); |
27895 |
+- |
27896 |
+ /* Reset the PPM */ |
27897 |
+ ret = ucsi_reset_ppm(ucsi); |
27898 |
+ if (ret) { |
27899 |
+@@ -1021,13 +1028,13 @@ int ucsi_init(struct ucsi *ucsi) |
27900 |
+ /* Enable basic notifications */ |
27901 |
+ ucsi->ntfy = UCSI_ENABLE_NTFY_CMD_COMPLETE | UCSI_ENABLE_NTFY_ERROR; |
27902 |
+ command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy; |
27903 |
+- ret = ucsi_run_command(ucsi, command, NULL, 0); |
27904 |
++ ret = ucsi_send_command(ucsi, command, NULL, 0); |
27905 |
+ if (ret < 0) |
27906 |
+ goto err_reset; |
27907 |
+ |
27908 |
+ /* Get PPM capabilities */ |
27909 |
+ command = UCSI_GET_CAPABILITY; |
27910 |
+- ret = ucsi_run_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap)); |
27911 |
++ ret = ucsi_send_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap)); |
27912 |
+ if (ret < 0) |
27913 |
+ goto err_reset; |
27914 |
+ |
27915 |
+@@ -1054,12 +1061,10 @@ int ucsi_init(struct ucsi *ucsi) |
27916 |
+ /* Enable all notifications */ |
27917 |
+ ucsi->ntfy = UCSI_ENABLE_NTFY_ALL; |
27918 |
+ command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy; |
27919 |
+- ret = ucsi_run_command(ucsi, command, NULL, 0); |
27920 |
++ ret = ucsi_send_command(ucsi, command, NULL, 0); |
27921 |
+ if (ret < 0) |
27922 |
+ goto err_unregister; |
27923 |
+ |
27924 |
+- mutex_unlock(&ucsi->ppm_lock); |
27925 |
+- |
27926 |
+ return 0; |
27927 |
+ |
27928 |
+ err_unregister: |
27929 |
+@@ -1074,8 +1079,6 @@ err_unregister: |
27930 |
+ err_reset: |
27931 |
+ ucsi_reset_ppm(ucsi); |
27932 |
+ err: |
27933 |
+- mutex_unlock(&ucsi->ppm_lock); |
27934 |
+- |
27935 |
+ return ret; |
27936 |
+ } |
27937 |
+ EXPORT_SYMBOL_GPL(ucsi_init); |
27938 |
+diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c |
27939 |
+index 2305d425e6c9a..9d7d642022d1f 100644 |
27940 |
+--- a/drivers/usb/usbip/stub_dev.c |
27941 |
++++ b/drivers/usb/usbip/stub_dev.c |
27942 |
+@@ -461,6 +461,11 @@ static void stub_disconnect(struct usb_device *udev) |
27943 |
+ return; |
27944 |
+ } |
27945 |
+ |
27946 |
++static bool usbip_match(struct usb_device *udev) |
27947 |
++{ |
27948 |
++ return true; |
27949 |
++} |
27950 |
++ |
27951 |
+ #ifdef CONFIG_PM |
27952 |
+ |
27953 |
+ /* These functions need usb_port_suspend and usb_port_resume, |
27954 |
+@@ -486,6 +491,7 @@ struct usb_device_driver stub_driver = { |
27955 |
+ .name = "usbip-host", |
27956 |
+ .probe = stub_probe, |
27957 |
+ .disconnect = stub_disconnect, |
27958 |
++ .match = usbip_match, |
27959 |
+ #ifdef CONFIG_PM |
27960 |
+ .suspend = stub_suspend, |
27961 |
+ .resume = stub_resume, |
27962 |
+diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h |
27963 |
+index f4554412e607f..29efa75cdfce5 100644 |
27964 |
+--- a/drivers/vdpa/ifcvf/ifcvf_base.h |
27965 |
++++ b/drivers/vdpa/ifcvf/ifcvf_base.h |
27966 |
+@@ -84,7 +84,7 @@ struct ifcvf_hw { |
27967 |
+ void __iomem * const *base; |
27968 |
+ char config_msix_name[256]; |
27969 |
+ struct vdpa_callback config_cb; |
27970 |
+- |
27971 |
++ unsigned int config_irq; |
27972 |
+ }; |
27973 |
+ |
27974 |
+ struct ifcvf_adapter { |
27975 |
+diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c |
27976 |
+index f5a60c14b9799..7a6d899e541df 100644 |
27977 |
+--- a/drivers/vdpa/ifcvf/ifcvf_main.c |
27978 |
++++ b/drivers/vdpa/ifcvf/ifcvf_main.c |
27979 |
+@@ -53,6 +53,7 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues) |
27980 |
+ for (i = 0; i < queues; i++) |
27981 |
+ devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]); |
27982 |
+ |
27983 |
++ devm_free_irq(&pdev->dev, vf->config_irq, vf); |
27984 |
+ ifcvf_free_irq_vectors(pdev); |
27985 |
+ } |
27986 |
+ |
27987 |
+@@ -72,10 +73,14 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter) |
27988 |
+ snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n", |
27989 |
+ pci_name(pdev)); |
27990 |
+ vector = 0; |
27991 |
+- irq = pci_irq_vector(pdev, vector); |
27992 |
+- ret = devm_request_irq(&pdev->dev, irq, |
27993 |
++ vf->config_irq = pci_irq_vector(pdev, vector); |
27994 |
++ ret = devm_request_irq(&pdev->dev, vf->config_irq, |
27995 |
+ ifcvf_config_changed, 0, |
27996 |
+ vf->config_msix_name, vf); |
27997 |
++ if (ret) { |
27998 |
++ IFCVF_ERR(pdev, "Failed to request config irq\n"); |
27999 |
++ return ret; |
28000 |
++ } |
28001 |
+ |
28002 |
+ for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) { |
28003 |
+ snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n", |
28004 |
+diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c |
28005 |
+index 9c4f1be856eca..547abeb39f87a 100644 |
28006 |
+--- a/drivers/video/fbdev/controlfb.c |
28007 |
++++ b/drivers/video/fbdev/controlfb.c |
28008 |
+@@ -49,6 +49,8 @@ |
28009 |
+ #include <linux/cuda.h> |
28010 |
+ #ifdef CONFIG_PPC_PMAC |
28011 |
+ #include <asm/prom.h> |
28012 |
++#endif |
28013 |
++#ifdef CONFIG_BOOTX_TEXT |
28014 |
+ #include <asm/btext.h> |
28015 |
+ #endif |
28016 |
+ |
28017 |
+diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c |
28018 |
+index e2a490c5ae08f..fbf10e62bcde9 100644 |
28019 |
+--- a/drivers/video/fbdev/core/fbcon.c |
28020 |
++++ b/drivers/video/fbdev/core/fbcon.c |
28021 |
+@@ -2191,6 +2191,9 @@ static void updatescrollmode(struct fbcon_display *p, |
28022 |
+ } |
28023 |
+ } |
28024 |
+ |
28025 |
++#define PITCH(w) (((w) + 7) >> 3) |
28026 |
++#define CALC_FONTSZ(h, p, c) ((h) * (p) * (c)) /* size = height * pitch * charcount */ |
28027 |
++ |
28028 |
+ static int fbcon_resize(struct vc_data *vc, unsigned int width, |
28029 |
+ unsigned int height, unsigned int user) |
28030 |
+ { |
28031 |
+@@ -2200,6 +2203,24 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, |
28032 |
+ struct fb_var_screeninfo var = info->var; |
28033 |
+ int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; |
28034 |
+ |
28035 |
++ if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) { |
28036 |
++ int size; |
28037 |
++ int pitch = PITCH(vc->vc_font.width); |
28038 |
++ |
28039 |
++ /* |
28040 |
++ * If user font, ensure that a possible change to user font |
28041 |
++ * height or width will not allow a font data out-of-bounds access. |
28042 |
++ * NOTE: must use original charcount in calculation as font |
28043 |
++ * charcount can change and cannot be used to determine the |
28044 |
++ * font data allocated size. |
28045 |
++ */ |
28046 |
++ if (pitch <= 0) |
28047 |
++ return -EINVAL; |
28048 |
++ size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data)); |
28049 |
++ if (size > FNTSIZE(vc->vc_font.data)) |
28050 |
++ return -EINVAL; |
28051 |
++ } |
28052 |
++ |
28053 |
+ virt_w = FBCON_SWAP(ops->rotate, width, height); |
28054 |
+ virt_h = FBCON_SWAP(ops->rotate, height, width); |
28055 |
+ virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, |
28056 |
+@@ -2652,7 +2673,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, |
28057 |
+ int size; |
28058 |
+ int i, csum; |
28059 |
+ u8 *new_data, *data = font->data; |
28060 |
+- int pitch = (font->width+7) >> 3; |
28061 |
++ int pitch = PITCH(font->width); |
28062 |
+ |
28063 |
+ /* Is there a reason why fbconsole couldn't handle any charcount >256? |
28064 |
+ * If not this check should be changed to charcount < 256 */ |
28065 |
+@@ -2668,7 +2689,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, |
28066 |
+ if (fbcon_invalid_charcount(info, charcount)) |
28067 |
+ return -EINVAL; |
28068 |
+ |
28069 |
+- size = h * pitch * charcount; |
28070 |
++ size = CALC_FONTSZ(h, pitch, charcount); |
28071 |
+ |
28072 |
+ new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER); |
28073 |
+ |
28074 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
28075 |
+index 30e73ec4ad5c8..da7c88ffaa6a8 100644 |
28076 |
+--- a/drivers/video/fbdev/core/fbmem.c |
28077 |
++++ b/drivers/video/fbdev/core/fbmem.c |
28078 |
+@@ -957,7 +957,6 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, |
28079 |
+ int |
28080 |
+ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
28081 |
+ { |
28082 |
+- int flags = info->flags; |
28083 |
+ int ret = 0; |
28084 |
+ u32 activate; |
28085 |
+ struct fb_var_screeninfo old_var; |
28086 |
+@@ -1052,9 +1051,6 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
28087 |
+ event.data = &mode; |
28088 |
+ fb_notifier_call_chain(FB_EVENT_MODE_CHANGE, &event); |
28089 |
+ |
28090 |
+- if (flags & FBINFO_MISC_USEREVENT) |
28091 |
+- fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL); |
28092 |
+- |
28093 |
+ return 0; |
28094 |
+ } |
28095 |
+ EXPORT_SYMBOL(fb_set_var); |
28096 |
+@@ -1105,9 +1101,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, |
28097 |
+ return -EFAULT; |
28098 |
+ console_lock(); |
28099 |
+ lock_fb_info(info); |
28100 |
+- info->flags |= FBINFO_MISC_USEREVENT; |
28101 |
+ ret = fb_set_var(info, &var); |
28102 |
+- info->flags &= ~FBINFO_MISC_USEREVENT; |
28103 |
++ if (!ret) |
28104 |
++ fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); |
28105 |
+ unlock_fb_info(info); |
28106 |
+ console_unlock(); |
28107 |
+ if (!ret && copy_to_user(argp, &var, sizeof(var))) |
28108 |
+diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c |
28109 |
+index d54c88f88991d..65dae05fff8e6 100644 |
28110 |
+--- a/drivers/video/fbdev/core/fbsysfs.c |
28111 |
++++ b/drivers/video/fbdev/core/fbsysfs.c |
28112 |
+@@ -91,9 +91,9 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) |
28113 |
+ |
28114 |
+ var->activate |= FB_ACTIVATE_FORCE; |
28115 |
+ console_lock(); |
28116 |
+- fb_info->flags |= FBINFO_MISC_USEREVENT; |
28117 |
+ err = fb_set_var(fb_info, var); |
28118 |
+- fb_info->flags &= ~FBINFO_MISC_USEREVENT; |
28119 |
++ if (!err) |
28120 |
++ fbcon_update_vcs(fb_info, var->activate & FB_ACTIVATE_ALL); |
28121 |
+ console_unlock(); |
28122 |
+ if (err) |
28123 |
+ return err; |
28124 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c |
28125 |
+index 4a16798b2ecd8..e2b572761bf61 100644 |
28126 |
+--- a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c |
28127 |
++++ b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c |
28128 |
+@@ -520,8 +520,11 @@ int dispc_runtime_get(void) |
28129 |
+ DSSDBG("dispc_runtime_get\n"); |
28130 |
+ |
28131 |
+ r = pm_runtime_get_sync(&dispc.pdev->dev); |
28132 |
+- WARN_ON(r < 0); |
28133 |
+- return r < 0 ? r : 0; |
28134 |
++ if (WARN_ON(r < 0)) { |
28135 |
++ pm_runtime_put_sync(&dispc.pdev->dev); |
28136 |
++ return r; |
28137 |
++ } |
28138 |
++ return 0; |
28139 |
+ } |
28140 |
+ EXPORT_SYMBOL(dispc_runtime_get); |
28141 |
+ |
28142 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c |
28143 |
+index d620376216e1d..6f9c25fec9946 100644 |
28144 |
+--- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c |
28145 |
++++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c |
28146 |
+@@ -1137,8 +1137,11 @@ static int dsi_runtime_get(struct platform_device *dsidev) |
28147 |
+ DSSDBG("dsi_runtime_get\n"); |
28148 |
+ |
28149 |
+ r = pm_runtime_get_sync(&dsi->pdev->dev); |
28150 |
+- WARN_ON(r < 0); |
28151 |
+- return r < 0 ? r : 0; |
28152 |
++ if (WARN_ON(r < 0)) { |
28153 |
++ pm_runtime_put_sync(&dsi->pdev->dev); |
28154 |
++ return r; |
28155 |
++ } |
28156 |
++ return 0; |
28157 |
+ } |
28158 |
+ |
28159 |
+ static void dsi_runtime_put(struct platform_device *dsidev) |
28160 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
28161 |
+index bfc5c4c5a26ad..a6b1c1598040d 100644 |
28162 |
+--- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
28163 |
++++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c |
28164 |
+@@ -768,8 +768,11 @@ int dss_runtime_get(void) |
28165 |
+ DSSDBG("dss_runtime_get\n"); |
28166 |
+ |
28167 |
+ r = pm_runtime_get_sync(&dss.pdev->dev); |
28168 |
+- WARN_ON(r < 0); |
28169 |
+- return r < 0 ? r : 0; |
28170 |
++ if (WARN_ON(r < 0)) { |
28171 |
++ pm_runtime_put_sync(&dss.pdev->dev); |
28172 |
++ return r; |
28173 |
++ } |
28174 |
++ return 0; |
28175 |
+ } |
28176 |
+ |
28177 |
+ void dss_runtime_put(void) |
28178 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c |
28179 |
+index 7060ae56c062c..4804aab342981 100644 |
28180 |
+--- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c |
28181 |
++++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c |
28182 |
+@@ -39,9 +39,10 @@ static int hdmi_runtime_get(void) |
28183 |
+ DSSDBG("hdmi_runtime_get\n"); |
28184 |
+ |
28185 |
+ r = pm_runtime_get_sync(&hdmi.pdev->dev); |
28186 |
+- WARN_ON(r < 0); |
28187 |
+- if (r < 0) |
28188 |
++ if (WARN_ON(r < 0)) { |
28189 |
++ pm_runtime_put_sync(&hdmi.pdev->dev); |
28190 |
+ return r; |
28191 |
++ } |
28192 |
+ |
28193 |
+ return 0; |
28194 |
+ } |
28195 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c |
28196 |
+index ac49531e47327..a06b6f1355bdb 100644 |
28197 |
+--- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c |
28198 |
++++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c |
28199 |
+@@ -43,9 +43,10 @@ static int hdmi_runtime_get(void) |
28200 |
+ DSSDBG("hdmi_runtime_get\n"); |
28201 |
+ |
28202 |
+ r = pm_runtime_get_sync(&hdmi.pdev->dev); |
28203 |
+- WARN_ON(r < 0); |
28204 |
+- if (r < 0) |
28205 |
++ if (WARN_ON(r < 0)) { |
28206 |
++ pm_runtime_put_sync(&hdmi.pdev->dev); |
28207 |
+ return r; |
28208 |
++ } |
28209 |
+ |
28210 |
+ return 0; |
28211 |
+ } |
28212 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/dss/venc.c b/drivers/video/fbdev/omap2/omapfb/dss/venc.c |
28213 |
+index d5404d56c922f..0b0ad20afd630 100644 |
28214 |
+--- a/drivers/video/fbdev/omap2/omapfb/dss/venc.c |
28215 |
++++ b/drivers/video/fbdev/omap2/omapfb/dss/venc.c |
28216 |
+@@ -348,8 +348,11 @@ static int venc_runtime_get(void) |
28217 |
+ DSSDBG("venc_runtime_get\n"); |
28218 |
+ |
28219 |
+ r = pm_runtime_get_sync(&venc.pdev->dev); |
28220 |
+- WARN_ON(r < 0); |
28221 |
+- return r < 0 ? r : 0; |
28222 |
++ if (WARN_ON(r < 0)) { |
28223 |
++ pm_runtime_put_sync(&venc.pdev->dev); |
28224 |
++ return r; |
28225 |
++ } |
28226 |
++ return 0; |
28227 |
+ } |
28228 |
+ |
28229 |
+ static void venc_runtime_put(void) |
28230 |
+diff --git a/drivers/video/fbdev/ps3fb.c b/drivers/video/fbdev/ps3fb.c |
28231 |
+index 9df78fb772672..203c254f8f6cb 100644 |
28232 |
+--- a/drivers/video/fbdev/ps3fb.c |
28233 |
++++ b/drivers/video/fbdev/ps3fb.c |
28234 |
+@@ -29,6 +29,7 @@ |
28235 |
+ #include <linux/freezer.h> |
28236 |
+ #include <linux/uaccess.h> |
28237 |
+ #include <linux/fb.h> |
28238 |
++#include <linux/fbcon.h> |
28239 |
+ #include <linux/init.h> |
28240 |
+ |
28241 |
+ #include <asm/cell-regs.h> |
28242 |
+@@ -824,12 +825,12 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, |
28243 |
+ var = info->var; |
28244 |
+ fb_videomode_to_var(&var, vmode); |
28245 |
+ console_lock(); |
28246 |
+- info->flags |= FBINFO_MISC_USEREVENT; |
28247 |
+ /* Force, in case only special bits changed */ |
28248 |
+ var.activate |= FB_ACTIVATE_FORCE; |
28249 |
+ par->new_mode_id = val; |
28250 |
+ retval = fb_set_var(info, &var); |
28251 |
+- info->flags &= ~FBINFO_MISC_USEREVENT; |
28252 |
++ if (!retval) |
28253 |
++ fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL); |
28254 |
+ console_unlock(); |
28255 |
+ } |
28256 |
+ break; |
28257 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
28258 |
+index 140c7bf33a989..90b8f56fbadb1 100644 |
28259 |
+--- a/drivers/xen/events/events_base.c |
28260 |
++++ b/drivers/xen/events/events_base.c |
28261 |
+@@ -156,7 +156,7 @@ int get_evtchn_to_irq(evtchn_port_t evtchn) |
28262 |
+ /* Get info for IRQ */ |
28263 |
+ struct irq_info *info_for_irq(unsigned irq) |
28264 |
+ { |
28265 |
+- return irq_get_handler_data(irq); |
28266 |
++ return irq_get_chip_data(irq); |
28267 |
+ } |
28268 |
+ |
28269 |
+ /* Constructors for packed IRQ information. */ |
28270 |
+@@ -377,7 +377,7 @@ static void xen_irq_init(unsigned irq) |
28271 |
+ info->type = IRQT_UNBOUND; |
28272 |
+ info->refcnt = -1; |
28273 |
+ |
28274 |
+- irq_set_handler_data(irq, info); |
28275 |
++ irq_set_chip_data(irq, info); |
28276 |
+ |
28277 |
+ list_add_tail(&info->list, &xen_irq_list_head); |
28278 |
+ } |
28279 |
+@@ -426,14 +426,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi) |
28280 |
+ |
28281 |
+ static void xen_free_irq(unsigned irq) |
28282 |
+ { |
28283 |
+- struct irq_info *info = irq_get_handler_data(irq); |
28284 |
++ struct irq_info *info = irq_get_chip_data(irq); |
28285 |
+ |
28286 |
+ if (WARN_ON(!info)) |
28287 |
+ return; |
28288 |
+ |
28289 |
+ list_del(&info->list); |
28290 |
+ |
28291 |
+- irq_set_handler_data(irq, NULL); |
28292 |
++ irq_set_chip_data(irq, NULL); |
28293 |
+ |
28294 |
+ WARN_ON(info->refcnt > 0); |
28295 |
+ |
28296 |
+@@ -603,7 +603,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi); |
28297 |
+ static void __unbind_from_irq(unsigned int irq) |
28298 |
+ { |
28299 |
+ evtchn_port_t evtchn = evtchn_from_irq(irq); |
28300 |
+- struct irq_info *info = irq_get_handler_data(irq); |
28301 |
++ struct irq_info *info = irq_get_chip_data(irq); |
28302 |
+ |
28303 |
+ if (info->refcnt > 0) { |
28304 |
+ info->refcnt--; |
28305 |
+@@ -1108,7 +1108,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, |
28306 |
+ |
28307 |
+ void unbind_from_irqhandler(unsigned int irq, void *dev_id) |
28308 |
+ { |
28309 |
+- struct irq_info *info = irq_get_handler_data(irq); |
28310 |
++ struct irq_info *info = irq_get_chip_data(irq); |
28311 |
+ |
28312 |
+ if (WARN_ON(!info)) |
28313 |
+ return; |
28314 |
+@@ -1142,7 +1142,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn) |
28315 |
+ if (irq == -1) |
28316 |
+ return -ENOENT; |
28317 |
+ |
28318 |
+- info = irq_get_handler_data(irq); |
28319 |
++ info = irq_get_chip_data(irq); |
28320 |
+ |
28321 |
+ if (!info) |
28322 |
+ return -ENOENT; |
28323 |
+@@ -1170,7 +1170,7 @@ int evtchn_get(evtchn_port_t evtchn) |
28324 |
+ if (irq == -1) |
28325 |
+ goto done; |
28326 |
+ |
28327 |
+- info = irq_get_handler_data(irq); |
28328 |
++ info = irq_get_chip_data(irq); |
28329 |
+ |
28330 |
+ if (!info) |
28331 |
+ goto done; |
28332 |
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
28333 |
+index 6fdb3392a06d5..284d9afa900b3 100644 |
28334 |
+--- a/fs/btrfs/ctree.h |
28335 |
++++ b/fs/btrfs/ctree.h |
28336 |
+@@ -2468,7 +2468,7 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans, |
28337 |
+ u64 bytenr, u64 num_bytes); |
28338 |
+ int btrfs_exclude_logged_extents(struct extent_buffer *eb); |
28339 |
+ int btrfs_cross_ref_exist(struct btrfs_root *root, |
28340 |
+- u64 objectid, u64 offset, u64 bytenr); |
28341 |
++ u64 objectid, u64 offset, u64 bytenr, bool strict); |
28342 |
+ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, |
28343 |
+ struct btrfs_root *root, |
28344 |
+ u64 parent, u64 root_objectid, |
28345 |
+@@ -2854,7 +2854,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode, |
28346 |
+ u64 start, u64 len); |
28347 |
+ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, |
28348 |
+ u64 *orig_start, u64 *orig_block_len, |
28349 |
+- u64 *ram_bytes); |
28350 |
++ u64 *ram_bytes, bool strict); |
28351 |
+ |
28352 |
+ void __btrfs_del_delalloc_inode(struct btrfs_root *root, |
28353 |
+ struct btrfs_inode *inode); |
28354 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
28355 |
+index 66618a1794ea7..983f4d58ae59b 100644 |
28356 |
+--- a/fs/btrfs/disk-io.c |
28357 |
++++ b/fs/btrfs/disk-io.c |
28358 |
+@@ -4574,6 +4574,7 @@ static void btrfs_cleanup_bg_io(struct btrfs_block_group *cache) |
28359 |
+ cache->io_ctl.inode = NULL; |
28360 |
+ iput(inode); |
28361 |
+ } |
28362 |
++ ASSERT(cache->io_ctl.pages == NULL); |
28363 |
+ btrfs_put_block_group(cache); |
28364 |
+ } |
28365 |
+ |
28366 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
28367 |
+index de6fe176fdfb3..5871ef78edbac 100644 |
28368 |
+--- a/fs/btrfs/extent-tree.c |
28369 |
++++ b/fs/btrfs/extent-tree.c |
28370 |
+@@ -2306,7 +2306,8 @@ static noinline int check_delayed_ref(struct btrfs_root *root, |
28371 |
+ |
28372 |
+ static noinline int check_committed_ref(struct btrfs_root *root, |
28373 |
+ struct btrfs_path *path, |
28374 |
+- u64 objectid, u64 offset, u64 bytenr) |
28375 |
++ u64 objectid, u64 offset, u64 bytenr, |
28376 |
++ bool strict) |
28377 |
+ { |
28378 |
+ struct btrfs_fs_info *fs_info = root->fs_info; |
28379 |
+ struct btrfs_root *extent_root = fs_info->extent_root; |
28380 |
+@@ -2348,9 +2349,13 @@ static noinline int check_committed_ref(struct btrfs_root *root, |
28381 |
+ btrfs_extent_inline_ref_size(BTRFS_EXTENT_DATA_REF_KEY)) |
28382 |
+ goto out; |
28383 |
+ |
28384 |
+- /* If extent created before last snapshot => it's definitely shared */ |
28385 |
+- if (btrfs_extent_generation(leaf, ei) <= |
28386 |
+- btrfs_root_last_snapshot(&root->root_item)) |
28387 |
++ /* |
28388 |
++ * If extent created before last snapshot => it's shared unless the |
28389 |
++ * snapshot has been deleted. Use the heuristic if strict is false. |
28390 |
++ */ |
28391 |
++ if (!strict && |
28392 |
++ (btrfs_extent_generation(leaf, ei) <= |
28393 |
++ btrfs_root_last_snapshot(&root->root_item))) |
28394 |
+ goto out; |
28395 |
+ |
28396 |
+ iref = (struct btrfs_extent_inline_ref *)(ei + 1); |
28397 |
+@@ -2375,7 +2380,7 @@ out: |
28398 |
+ } |
28399 |
+ |
28400 |
+ int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset, |
28401 |
+- u64 bytenr) |
28402 |
++ u64 bytenr, bool strict) |
28403 |
+ { |
28404 |
+ struct btrfs_path *path; |
28405 |
+ int ret; |
28406 |
+@@ -2386,7 +2391,7 @@ int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset, |
28407 |
+ |
28408 |
+ do { |
28409 |
+ ret = check_committed_ref(root, path, objectid, |
28410 |
+- offset, bytenr); |
28411 |
++ offset, bytenr, strict); |
28412 |
+ if (ret && ret != -ENOENT) |
28413 |
+ goto out; |
28414 |
+ |
28415 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
28416 |
+index 1523aa4eaff07..e485f0275e1a6 100644 |
28417 |
+--- a/fs/btrfs/file.c |
28418 |
++++ b/fs/btrfs/file.c |
28419 |
+@@ -1568,7 +1568,7 @@ int btrfs_check_can_nocow(struct btrfs_inode *inode, loff_t pos, |
28420 |
+ } |
28421 |
+ |
28422 |
+ ret = can_nocow_extent(&inode->vfs_inode, lockstart, &num_bytes, |
28423 |
+- NULL, NULL, NULL); |
28424 |
++ NULL, NULL, NULL, false); |
28425 |
+ if (ret <= 0) { |
28426 |
+ ret = 0; |
28427 |
+ if (!nowait) |
28428 |
+@@ -3176,14 +3176,14 @@ reserve_space: |
28429 |
+ if (ret < 0) |
28430 |
+ goto out; |
28431 |
+ space_reserved = true; |
28432 |
+- ret = btrfs_qgroup_reserve_data(inode, &data_reserved, |
28433 |
+- alloc_start, bytes_to_reserve); |
28434 |
+- if (ret) |
28435 |
+- goto out; |
28436 |
+ ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend, |
28437 |
+ &cached_state); |
28438 |
+ if (ret) |
28439 |
+ goto out; |
28440 |
++ ret = btrfs_qgroup_reserve_data(inode, &data_reserved, |
28441 |
++ alloc_start, bytes_to_reserve); |
28442 |
++ if (ret) |
28443 |
++ goto out; |
28444 |
+ ret = btrfs_prealloc_file_range(inode, mode, alloc_start, |
28445 |
+ alloc_end - alloc_start, |
28446 |
+ i_blocksize(inode), |
28447 |
+diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c |
28448 |
+index 6f7b6bca6dc5b..53cfcf017b8db 100644 |
28449 |
+--- a/fs/btrfs/free-space-cache.c |
28450 |
++++ b/fs/btrfs/free-space-cache.c |
28451 |
+@@ -1186,7 +1186,6 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root, |
28452 |
+ ret = update_cache_item(trans, root, inode, path, offset, |
28453 |
+ io_ctl->entries, io_ctl->bitmaps); |
28454 |
+ out: |
28455 |
+- io_ctl_free(io_ctl); |
28456 |
+ if (ret) { |
28457 |
+ invalidate_inode_pages2(inode->i_mapping); |
28458 |
+ BTRFS_I(inode)->generation = 0; |
28459 |
+@@ -1346,6 +1345,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, |
28460 |
+ * them out later |
28461 |
+ */ |
28462 |
+ io_ctl_drop_pages(io_ctl); |
28463 |
++ io_ctl_free(io_ctl); |
28464 |
+ |
28465 |
+ unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, |
28466 |
+ i_size_read(inode) - 1, &cached_state); |
28467 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
28468 |
+index 7ba1218b1630e..cb2a6893ec417 100644 |
28469 |
+--- a/fs/btrfs/inode.c |
28470 |
++++ b/fs/btrfs/inode.c |
28471 |
+@@ -1611,7 +1611,7 @@ next_slot: |
28472 |
+ goto out_check; |
28473 |
+ ret = btrfs_cross_ref_exist(root, ino, |
28474 |
+ found_key.offset - |
28475 |
+- extent_offset, disk_bytenr); |
28476 |
++ extent_offset, disk_bytenr, false); |
28477 |
+ if (ret) { |
28478 |
+ /* |
28479 |
+ * ret could be -EIO if the above fails to read |
28480 |
+@@ -6957,7 +6957,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, |
28481 |
+ */ |
28482 |
+ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, |
28483 |
+ u64 *orig_start, u64 *orig_block_len, |
28484 |
+- u64 *ram_bytes) |
28485 |
++ u64 *ram_bytes, bool strict) |
28486 |
+ { |
28487 |
+ struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
28488 |
+ struct btrfs_path *path; |
28489 |
+@@ -7035,8 +7035,9 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, |
28490 |
+ * Do the same check as in btrfs_cross_ref_exist but without the |
28491 |
+ * unnecessary search. |
28492 |
+ */ |
28493 |
+- if (btrfs_file_extent_generation(leaf, fi) <= |
28494 |
+- btrfs_root_last_snapshot(&root->root_item)) |
28495 |
++ if (!strict && |
28496 |
++ (btrfs_file_extent_generation(leaf, fi) <= |
28497 |
++ btrfs_root_last_snapshot(&root->root_item))) |
28498 |
+ goto out; |
28499 |
+ |
28500 |
+ backref_offset = btrfs_file_extent_offset(leaf, fi); |
28501 |
+@@ -7072,7 +7073,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, |
28502 |
+ */ |
28503 |
+ |
28504 |
+ ret = btrfs_cross_ref_exist(root, btrfs_ino(BTRFS_I(inode)), |
28505 |
+- key.offset - backref_offset, disk_bytenr); |
28506 |
++ key.offset - backref_offset, disk_bytenr, |
28507 |
++ strict); |
28508 |
+ if (ret) { |
28509 |
+ ret = 0; |
28510 |
+ goto out; |
28511 |
+@@ -7293,7 +7295,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map, |
28512 |
+ block_start = em->block_start + (start - em->start); |
28513 |
+ |
28514 |
+ if (can_nocow_extent(inode, start, &len, &orig_start, |
28515 |
+- &orig_block_len, &ram_bytes) == 1 && |
28516 |
++ &orig_block_len, &ram_bytes, false) == 1 && |
28517 |
+ btrfs_inc_nocow_writers(fs_info, block_start)) { |
28518 |
+ struct extent_map *em2; |
28519 |
+ |
28520 |
+@@ -8640,7 +8642,7 @@ void btrfs_destroy_inode(struct inode *inode) |
28521 |
+ btrfs_put_ordered_extent(ordered); |
28522 |
+ } |
28523 |
+ } |
28524 |
+- btrfs_qgroup_check_reserved_leak(inode); |
28525 |
++ btrfs_qgroup_check_reserved_leak(BTRFS_I(inode)); |
28526 |
+ inode_tree_del(inode); |
28527 |
+ btrfs_drop_extent_cache(BTRFS_I(inode), 0, (u64)-1, 0); |
28528 |
+ btrfs_inode_clear_file_extent_range(BTRFS_I(inode), 0, (u64)-1); |
28529 |
+@@ -10103,7 +10105,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, |
28530 |
+ free_extent_map(em); |
28531 |
+ em = NULL; |
28532 |
+ |
28533 |
+- ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL); |
28534 |
++ ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL, true); |
28535 |
+ if (ret < 0) { |
28536 |
+ goto out; |
28537 |
+ } else if (ret) { |
28538 |
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c |
28539 |
+index 5bd4089ad0e1a..574a669894774 100644 |
28540 |
+--- a/fs/btrfs/qgroup.c |
28541 |
++++ b/fs/btrfs/qgroup.c |
28542 |
+@@ -3742,7 +3742,7 @@ void btrfs_qgroup_convert_reserved_meta(struct btrfs_root *root, int num_bytes) |
28543 |
+ * Check qgroup reserved space leaking, normally at destroy inode |
28544 |
+ * time |
28545 |
+ */ |
28546 |
+-void btrfs_qgroup_check_reserved_leak(struct inode *inode) |
28547 |
++void btrfs_qgroup_check_reserved_leak(struct btrfs_inode *inode) |
28548 |
+ { |
28549 |
+ struct extent_changeset changeset; |
28550 |
+ struct ulist_node *unode; |
28551 |
+@@ -3750,19 +3750,19 @@ void btrfs_qgroup_check_reserved_leak(struct inode *inode) |
28552 |
+ int ret; |
28553 |
+ |
28554 |
+ extent_changeset_init(&changeset); |
28555 |
+- ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree, 0, (u64)-1, |
28556 |
++ ret = clear_record_extent_bits(&inode->io_tree, 0, (u64)-1, |
28557 |
+ EXTENT_QGROUP_RESERVED, &changeset); |
28558 |
+ |
28559 |
+ WARN_ON(ret < 0); |
28560 |
+ if (WARN_ON(changeset.bytes_changed)) { |
28561 |
+ ULIST_ITER_INIT(&iter); |
28562 |
+ while ((unode = ulist_next(&changeset.range_changed, &iter))) { |
28563 |
+- btrfs_warn(BTRFS_I(inode)->root->fs_info, |
28564 |
+- "leaking qgroup reserved space, ino: %lu, start: %llu, end: %llu", |
28565 |
+- inode->i_ino, unode->val, unode->aux); |
28566 |
++ btrfs_warn(inode->root->fs_info, |
28567 |
++ "leaking qgroup reserved space, ino: %llu, start: %llu, end: %llu", |
28568 |
++ btrfs_ino(inode), unode->val, unode->aux); |
28569 |
+ } |
28570 |
+- btrfs_qgroup_free_refroot(BTRFS_I(inode)->root->fs_info, |
28571 |
+- BTRFS_I(inode)->root->root_key.objectid, |
28572 |
++ btrfs_qgroup_free_refroot(inode->root->fs_info, |
28573 |
++ inode->root->root_key.objectid, |
28574 |
+ changeset.bytes_changed, BTRFS_QGROUP_RSV_DATA); |
28575 |
+ |
28576 |
+ } |
28577 |
+diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h |
28578 |
+index 1bc6544594690..406366f20cb0a 100644 |
28579 |
+--- a/fs/btrfs/qgroup.h |
28580 |
++++ b/fs/btrfs/qgroup.h |
28581 |
+@@ -399,7 +399,7 @@ void btrfs_qgroup_free_meta_all_pertrans(struct btrfs_root *root); |
28582 |
+ */ |
28583 |
+ void btrfs_qgroup_convert_reserved_meta(struct btrfs_root *root, int num_bytes); |
28584 |
+ |
28585 |
+-void btrfs_qgroup_check_reserved_leak(struct inode *inode); |
28586 |
++void btrfs_qgroup_check_reserved_leak(struct btrfs_inode *inode); |
28587 |
+ |
28588 |
+ /* btrfs_qgroup_swapped_blocks related functions */ |
28589 |
+ void btrfs_qgroup_init_swapped_blocks( |
28590 |
+diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c |
28591 |
+index 56cd2cf571588..9eb03b0e0dd43 100644 |
28592 |
+--- a/fs/btrfs/super.c |
28593 |
++++ b/fs/btrfs/super.c |
28594 |
+@@ -558,6 +558,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, |
28595 |
+ } else if (strncmp(args[0].from, "lzo", 3) == 0) { |
28596 |
+ compress_type = "lzo"; |
28597 |
+ info->compress_type = BTRFS_COMPRESS_LZO; |
28598 |
++ info->compress_level = 0; |
28599 |
+ btrfs_set_opt(info->mount_opt, COMPRESS); |
28600 |
+ btrfs_clear_opt(info->mount_opt, NODATACOW); |
28601 |
+ btrfs_clear_opt(info->mount_opt, NODATASUM); |
28602 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
28603 |
+index d22ff1e0963c6..065439b4bdda5 100644 |
28604 |
+--- a/fs/btrfs/tree-log.c |
28605 |
++++ b/fs/btrfs/tree-log.c |
28606 |
+@@ -3449,11 +3449,13 @@ fail: |
28607 |
+ btrfs_free_path(path); |
28608 |
+ out_unlock: |
28609 |
+ mutex_unlock(&dir->log_mutex); |
28610 |
+- if (ret == -ENOSPC) { |
28611 |
++ if (err == -ENOSPC) { |
28612 |
+ btrfs_set_log_full_commit(trans); |
28613 |
+- ret = 0; |
28614 |
+- } else if (ret < 0) |
28615 |
+- btrfs_abort_transaction(trans, ret); |
28616 |
++ err = 0; |
28617 |
++ } else if (err < 0 && err != -ENOENT) { |
28618 |
++ /* ENOENT can be returned if the entry hasn't been fsynced yet */ |
28619 |
++ btrfs_abort_transaction(trans, err); |
28620 |
++ } |
28621 |
+ |
28622 |
+ btrfs_end_log_trans(root); |
28623 |
+ |
28624 |
+diff --git a/fs/buffer.c b/fs/buffer.c |
28625 |
+index 64fe82ec65ff1..75a8849abb5d2 100644 |
28626 |
+--- a/fs/buffer.c |
28627 |
++++ b/fs/buffer.c |
28628 |
+@@ -3160,6 +3160,15 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags) |
28629 |
+ WARN_ON(atomic_read(&bh->b_count) < 1); |
28630 |
+ lock_buffer(bh); |
28631 |
+ if (test_clear_buffer_dirty(bh)) { |
28632 |
++ /* |
28633 |
++ * The bh should be mapped, but it might not be if the |
28634 |
++ * device was hot-removed. Not much we can do but fail the I/O. |
28635 |
++ */ |
28636 |
++ if (!buffer_mapped(bh)) { |
28637 |
++ unlock_buffer(bh); |
28638 |
++ return -EIO; |
28639 |
++ } |
28640 |
++ |
28641 |
+ get_bh(bh); |
28642 |
+ bh->b_end_io = end_buffer_write_sync; |
28643 |
+ ret = submit_bh(REQ_OP_WRITE, op_flags, bh); |
28644 |
+diff --git a/fs/ceph/file.c b/fs/ceph/file.c |
28645 |
+index 160644ddaeed7..d51c3f2fdca02 100644 |
28646 |
+--- a/fs/ceph/file.c |
28647 |
++++ b/fs/ceph/file.c |
28648 |
+@@ -1538,6 +1538,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) |
28649 |
+ struct inode *inode = file_inode(filp); |
28650 |
+ struct ceph_inode_info *ci = ceph_inode(inode); |
28651 |
+ struct page *pinned_page = NULL; |
28652 |
++ bool direct_lock = iocb->ki_flags & IOCB_DIRECT; |
28653 |
+ ssize_t ret; |
28654 |
+ int want, got = 0; |
28655 |
+ int retry_op = 0, read = 0; |
28656 |
+@@ -1546,7 +1547,7 @@ again: |
28657 |
+ dout("aio_read %p %llx.%llx %llu~%u trying to get caps on %p\n", |
28658 |
+ inode, ceph_vinop(inode), iocb->ki_pos, (unsigned)len, inode); |
28659 |
+ |
28660 |
+- if (iocb->ki_flags & IOCB_DIRECT) |
28661 |
++ if (direct_lock) |
28662 |
+ ceph_start_io_direct(inode); |
28663 |
+ else |
28664 |
+ ceph_start_io_read(inode); |
28665 |
+@@ -1603,7 +1604,7 @@ again: |
28666 |
+ } |
28667 |
+ ceph_put_cap_refs(ci, got); |
28668 |
+ |
28669 |
+- if (iocb->ki_flags & IOCB_DIRECT) |
28670 |
++ if (direct_lock) |
28671 |
+ ceph_end_io_direct(inode); |
28672 |
+ else |
28673 |
+ ceph_end_io_read(inode); |
28674 |
+diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c |
28675 |
+index 946f9a92658ab..903b6a35b321b 100644 |
28676 |
+--- a/fs/ceph/mds_client.c |
28677 |
++++ b/fs/ceph/mds_client.c |
28678 |
+@@ -4285,6 +4285,9 @@ static void delayed_work(struct work_struct *work) |
28679 |
+ |
28680 |
+ dout("mdsc delayed_work\n"); |
28681 |
+ |
28682 |
++ if (mdsc->stopping) |
28683 |
++ return; |
28684 |
++ |
28685 |
+ mutex_lock(&mdsc->mutex); |
28686 |
+ renew_interval = mdsc->mdsmap->m_session_timeout >> 2; |
28687 |
+ renew_caps = time_after_eq(jiffies, HZ*renew_interval + |
28688 |
+@@ -4660,7 +4663,16 @@ void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc) |
28689 |
+ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc) |
28690 |
+ { |
28691 |
+ dout("stop\n"); |
28692 |
+- cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */ |
28693 |
++ /* |
28694 |
++ * Make sure the delayed work stopped before releasing |
28695 |
++ * the resources. |
28696 |
++ * |
28697 |
++ * Because the cancel_delayed_work_sync() will only |
28698 |
++ * guarantee that the work finishes executing. But the |
28699 |
++ * delayed work will re-arm itself again after that. |
28700 |
++ */ |
28701 |
++ flush_delayed_work(&mdsc->delayed_work); |
28702 |
++ |
28703 |
+ if (mdsc->mdsmap) |
28704 |
+ ceph_mdsmap_destroy(mdsc->mdsmap); |
28705 |
+ kfree(mdsc->sessions); |
28706 |
+diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c |
28707 |
+index e830a9d4e10d3..11aa37693e436 100644 |
28708 |
+--- a/fs/ext4/block_validity.c |
28709 |
++++ b/fs/ext4/block_validity.c |
28710 |
+@@ -254,14 +254,6 @@ int ext4_setup_system_zone(struct super_block *sb) |
28711 |
+ int flex_size = ext4_flex_bg_size(sbi); |
28712 |
+ int ret; |
28713 |
+ |
28714 |
+- if (!test_opt(sb, BLOCK_VALIDITY)) { |
28715 |
+- if (sbi->system_blks) |
28716 |
+- ext4_release_system_zone(sb); |
28717 |
+- return 0; |
28718 |
+- } |
28719 |
+- if (sbi->system_blks) |
28720 |
+- return 0; |
28721 |
+- |
28722 |
+ system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL); |
28723 |
+ if (!system_blks) |
28724 |
+ return -ENOMEM; |
28725 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
28726 |
+index 42815304902b8..ff46defc65683 100644 |
28727 |
+--- a/fs/ext4/ext4.h |
28728 |
++++ b/fs/ext4/ext4.h |
28729 |
+@@ -1054,6 +1054,7 @@ struct ext4_inode_info { |
28730 |
+ struct timespec64 i_crtime; |
28731 |
+ |
28732 |
+ /* mballoc */ |
28733 |
++ atomic_t i_prealloc_active; |
28734 |
+ struct list_head i_prealloc_list; |
28735 |
+ spinlock_t i_prealloc_lock; |
28736 |
+ |
28737 |
+@@ -1501,6 +1502,7 @@ struct ext4_sb_info { |
28738 |
+ unsigned int s_mb_stats; |
28739 |
+ unsigned int s_mb_order2_reqs; |
28740 |
+ unsigned int s_mb_group_prealloc; |
28741 |
++ unsigned int s_mb_max_inode_prealloc; |
28742 |
+ unsigned int s_max_dir_size_kb; |
28743 |
+ /* where last allocation was done - for stream allocation */ |
28744 |
+ unsigned long s_mb_last_group; |
28745 |
+@@ -1585,6 +1587,9 @@ struct ext4_sb_info { |
28746 |
+ #ifdef CONFIG_EXT4_DEBUG |
28747 |
+ unsigned long s_simulate_fail; |
28748 |
+ #endif |
28749 |
++ /* Record the errseq of the backing block device */ |
28750 |
++ errseq_t s_bdev_wb_err; |
28751 |
++ spinlock_t s_bdev_wb_lock; |
28752 |
+ }; |
28753 |
+ |
28754 |
+ static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
28755 |
+@@ -2651,7 +2656,7 @@ extern int ext4_mb_release(struct super_block *); |
28756 |
+ extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, |
28757 |
+ struct ext4_allocation_request *, int *); |
28758 |
+ extern int ext4_mb_reserve_blocks(struct super_block *, int); |
28759 |
+-extern void ext4_discard_preallocations(struct inode *); |
28760 |
++extern void ext4_discard_preallocations(struct inode *, unsigned int); |
28761 |
+ extern int __init ext4_init_mballoc(void); |
28762 |
+ extern void ext4_exit_mballoc(void); |
28763 |
+ extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
28764 |
+diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c |
28765 |
+index 0c76cdd44d90d..760b9ee49dc00 100644 |
28766 |
+--- a/fs/ext4/ext4_jbd2.c |
28767 |
++++ b/fs/ext4/ext4_jbd2.c |
28768 |
+@@ -195,6 +195,28 @@ static void ext4_journal_abort_handle(const char *caller, unsigned int line, |
28769 |
+ jbd2_journal_abort_handle(handle); |
28770 |
+ } |
28771 |
+ |
28772 |
++static void ext4_check_bdev_write_error(struct super_block *sb) |
28773 |
++{ |
28774 |
++ struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; |
28775 |
++ struct ext4_sb_info *sbi = EXT4_SB(sb); |
28776 |
++ int err; |
28777 |
++ |
28778 |
++ /* |
28779 |
++ * If the block device has write error flag, it may have failed to |
28780 |
++ * async write out metadata buffers in the background. In this case, |
28781 |
++ * we could read old data from disk and write it out again, which |
28782 |
++ * may lead to on-disk filesystem inconsistency. |
28783 |
++ */ |
28784 |
++ if (errseq_check(&mapping->wb_err, READ_ONCE(sbi->s_bdev_wb_err))) { |
28785 |
++ spin_lock(&sbi->s_bdev_wb_lock); |
28786 |
++ err = errseq_check_and_advance(&mapping->wb_err, &sbi->s_bdev_wb_err); |
28787 |
++ spin_unlock(&sbi->s_bdev_wb_lock); |
28788 |
++ if (err) |
28789 |
++ ext4_error_err(sb, -err, |
28790 |
++ "Error while async write back metadata"); |
28791 |
++ } |
28792 |
++} |
28793 |
++ |
28794 |
+ int __ext4_journal_get_write_access(const char *where, unsigned int line, |
28795 |
+ handle_t *handle, struct buffer_head *bh) |
28796 |
+ { |
28797 |
+@@ -202,6 +224,9 @@ int __ext4_journal_get_write_access(const char *where, unsigned int line, |
28798 |
+ |
28799 |
+ might_sleep(); |
28800 |
+ |
28801 |
++ if (bh->b_bdev->bd_super) |
28802 |
++ ext4_check_bdev_write_error(bh->b_bdev->bd_super); |
28803 |
++ |
28804 |
+ if (ext4_handle_valid(handle)) { |
28805 |
+ err = jbd2_journal_get_write_access(handle, bh); |
28806 |
+ if (err) |
28807 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
28808 |
+index d75054570e44c..11a321dd11e7e 100644 |
28809 |
+--- a/fs/ext4/extents.c |
28810 |
++++ b/fs/ext4/extents.c |
28811 |
+@@ -100,7 +100,7 @@ static int ext4_ext_trunc_restart_fn(struct inode *inode, int *dropped) |
28812 |
+ * i_mutex. So we can safely drop the i_data_sem here. |
28813 |
+ */ |
28814 |
+ BUG_ON(EXT4_JOURNAL(inode) == NULL); |
28815 |
+- ext4_discard_preallocations(inode); |
28816 |
++ ext4_discard_preallocations(inode, 0); |
28817 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
28818 |
+ *dropped = 1; |
28819 |
+ return 0; |
28820 |
+@@ -4268,7 +4268,7 @@ got_allocated_blocks: |
28821 |
+ * not a good idea to call discard here directly, |
28822 |
+ * but otherwise we'd need to call it every free(). |
28823 |
+ */ |
28824 |
+- ext4_discard_preallocations(inode); |
28825 |
++ ext4_discard_preallocations(inode, 0); |
28826 |
+ if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) |
28827 |
+ fb_flags = EXT4_FREE_BLOCKS_NO_QUOT_UPDATE; |
28828 |
+ ext4_free_blocks(handle, inode, NULL, newblock, |
28829 |
+@@ -5295,7 +5295,7 @@ static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) |
28830 |
+ } |
28831 |
+ |
28832 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
28833 |
+- ext4_discard_preallocations(inode); |
28834 |
++ ext4_discard_preallocations(inode, 0); |
28835 |
+ |
28836 |
+ ret = ext4_es_remove_extent(inode, punch_start, |
28837 |
+ EXT_MAX_BLOCKS - punch_start); |
28838 |
+@@ -5309,7 +5309,7 @@ static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) |
28839 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
28840 |
+ goto out_stop; |
28841 |
+ } |
28842 |
+- ext4_discard_preallocations(inode); |
28843 |
++ ext4_discard_preallocations(inode, 0); |
28844 |
+ |
28845 |
+ ret = ext4_ext_shift_extents(inode, handle, punch_stop, |
28846 |
+ punch_stop - punch_start, SHIFT_LEFT); |
28847 |
+@@ -5441,7 +5441,7 @@ static int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) |
28848 |
+ goto out_stop; |
28849 |
+ |
28850 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
28851 |
+- ext4_discard_preallocations(inode); |
28852 |
++ ext4_discard_preallocations(inode, 0); |
28853 |
+ |
28854 |
+ path = ext4_find_extent(inode, offset_lblk, NULL, 0); |
28855 |
+ if (IS_ERR(path)) { |
28856 |
+diff --git a/fs/ext4/file.c b/fs/ext4/file.c |
28857 |
+index 8f742b53f1d40..4ee9a4dc01a88 100644 |
28858 |
+--- a/fs/ext4/file.c |
28859 |
++++ b/fs/ext4/file.c |
28860 |
+@@ -148,7 +148,7 @@ static int ext4_release_file(struct inode *inode, struct file *filp) |
28861 |
+ !EXT4_I(inode)->i_reserved_data_blocks) |
28862 |
+ { |
28863 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
28864 |
+- ext4_discard_preallocations(inode); |
28865 |
++ ext4_discard_preallocations(inode, 0); |
28866 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
28867 |
+ } |
28868 |
+ if (is_dx(inode) && filp->private_data) |
28869 |
+diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c |
28870 |
+index 4026418257121..e8ca405673923 100644 |
28871 |
+--- a/fs/ext4/indirect.c |
28872 |
++++ b/fs/ext4/indirect.c |
28873 |
+@@ -696,7 +696,7 @@ static int ext4_ind_trunc_restart_fn(handle_t *handle, struct inode *inode, |
28874 |
+ * i_mutex. So we can safely drop the i_data_sem here. |
28875 |
+ */ |
28876 |
+ BUG_ON(EXT4_JOURNAL(inode) == NULL); |
28877 |
+- ext4_discard_preallocations(inode); |
28878 |
++ ext4_discard_preallocations(inode, 0); |
28879 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
28880 |
+ *dropped = 1; |
28881 |
+ return 0; |
28882 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
28883 |
+index 92573f8540ab7..9c0629ffb4261 100644 |
28884 |
+--- a/fs/ext4/inode.c |
28885 |
++++ b/fs/ext4/inode.c |
28886 |
+@@ -383,7 +383,7 @@ void ext4_da_update_reserve_space(struct inode *inode, |
28887 |
+ */ |
28888 |
+ if ((ei->i_reserved_data_blocks == 0) && |
28889 |
+ !inode_is_open_for_write(inode)) |
28890 |
+- ext4_discard_preallocations(inode); |
28891 |
++ ext4_discard_preallocations(inode, 0); |
28892 |
+ } |
28893 |
+ |
28894 |
+ static int __check_block_validity(struct inode *inode, const char *func, |
28895 |
+@@ -4055,7 +4055,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) |
28896 |
+ if (stop_block > first_block) { |
28897 |
+ |
28898 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
28899 |
+- ext4_discard_preallocations(inode); |
28900 |
++ ext4_discard_preallocations(inode, 0); |
28901 |
+ |
28902 |
+ ret = ext4_es_remove_extent(inode, first_block, |
28903 |
+ stop_block - first_block); |
28904 |
+@@ -4210,7 +4210,7 @@ int ext4_truncate(struct inode *inode) |
28905 |
+ |
28906 |
+ down_write(&EXT4_I(inode)->i_data_sem); |
28907 |
+ |
28908 |
+- ext4_discard_preallocations(inode); |
28909 |
++ ext4_discard_preallocations(inode, 0); |
28910 |
+ |
28911 |
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) |
28912 |
+ err = ext4_ext_truncate(handle, inode); |
28913 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
28914 |
+index 999cf6add39c6..a5fcc238c6693 100644 |
28915 |
+--- a/fs/ext4/ioctl.c |
28916 |
++++ b/fs/ext4/ioctl.c |
28917 |
+@@ -202,7 +202,7 @@ static long swap_inode_boot_loader(struct super_block *sb, |
28918 |
+ reset_inode_seed(inode); |
28919 |
+ reset_inode_seed(inode_bl); |
28920 |
+ |
28921 |
+- ext4_discard_preallocations(inode); |
28922 |
++ ext4_discard_preallocations(inode, 0); |
28923 |
+ |
28924 |
+ err = ext4_mark_inode_dirty(handle, inode); |
28925 |
+ if (err < 0) { |
28926 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
28927 |
+index 38719c156573c..e88eff999bd15 100644 |
28928 |
+--- a/fs/ext4/mballoc.c |
28929 |
++++ b/fs/ext4/mballoc.c |
28930 |
+@@ -2177,6 +2177,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac, |
28931 |
+ { |
28932 |
+ struct ext4_group_info *grp = ext4_get_group_info(ac->ac_sb, group); |
28933 |
+ struct super_block *sb = ac->ac_sb; |
28934 |
++ struct ext4_sb_info *sbi = EXT4_SB(sb); |
28935 |
+ bool should_lock = ac->ac_flags & EXT4_MB_STRICT_CHECK; |
28936 |
+ ext4_grpblk_t free; |
28937 |
+ int ret = 0; |
28938 |
+@@ -2195,7 +2196,25 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac, |
28939 |
+ |
28940 |
+ /* We only do this if the grp has never been initialized */ |
28941 |
+ if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) { |
28942 |
+- ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS); |
28943 |
++ struct ext4_group_desc *gdp = |
28944 |
++ ext4_get_group_desc(sb, group, NULL); |
28945 |
++ int ret; |
28946 |
++ |
28947 |
++ /* cr=0/1 is a very optimistic search to find large |
28948 |
++ * good chunks almost for free. If buddy data is not |
28949 |
++ * ready, then this optimization makes no sense. But |
28950 |
++ * we never skip the first block group in a flex_bg, |
28951 |
++ * since this gets used for metadata block allocation, |
28952 |
++ * and we want to make sure we locate metadata blocks |
28953 |
++ * in the first block group in the flex_bg if possible. |
28954 |
++ */ |
28955 |
++ if (cr < 2 && |
28956 |
++ (!sbi->s_log_groups_per_flex || |
28957 |
++ ((group & ((1 << sbi->s_log_groups_per_flex) - 1)) != 0)) && |
28958 |
++ !(ext4_has_group_desc_csum(sb) && |
28959 |
++ (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)))) |
28960 |
++ return 0; |
28961 |
++ ret = ext4_mb_init_group(sb, group, GFP_NOFS); |
28962 |
+ if (ret) |
28963 |
+ return ret; |
28964 |
+ } |
28965 |
+@@ -2736,6 +2755,7 @@ int ext4_mb_init(struct super_block *sb) |
28966 |
+ sbi->s_mb_stats = MB_DEFAULT_STATS; |
28967 |
+ sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD; |
28968 |
+ sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS; |
28969 |
++ sbi->s_mb_max_inode_prealloc = MB_DEFAULT_MAX_INODE_PREALLOC; |
28970 |
+ /* |
28971 |
+ * The default group preallocation is 512, which for 4k block |
28972 |
+ * sizes translates to 2 megabytes. However for bigalloc file |
28973 |
+@@ -3674,6 +3694,26 @@ void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, |
28974 |
+ mb_debug(sb, "preallocated %d for group %u\n", preallocated, group); |
28975 |
+ } |
28976 |
+ |
28977 |
++static void ext4_mb_mark_pa_deleted(struct super_block *sb, |
28978 |
++ struct ext4_prealloc_space *pa) |
28979 |
++{ |
28980 |
++ struct ext4_inode_info *ei; |
28981 |
++ |
28982 |
++ if (pa->pa_deleted) { |
28983 |
++ ext4_warning(sb, "deleted pa, type:%d, pblk:%llu, lblk:%u, len:%d\n", |
28984 |
++ pa->pa_type, pa->pa_pstart, pa->pa_lstart, |
28985 |
++ pa->pa_len); |
28986 |
++ return; |
28987 |
++ } |
28988 |
++ |
28989 |
++ pa->pa_deleted = 1; |
28990 |
++ |
28991 |
++ if (pa->pa_type == MB_INODE_PA) { |
28992 |
++ ei = EXT4_I(pa->pa_inode); |
28993 |
++ atomic_dec(&ei->i_prealloc_active); |
28994 |
++ } |
28995 |
++} |
28996 |
++ |
28997 |
+ static void ext4_mb_pa_callback(struct rcu_head *head) |
28998 |
+ { |
28999 |
+ struct ext4_prealloc_space *pa; |
29000 |
+@@ -3706,7 +3746,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac, |
29001 |
+ return; |
29002 |
+ } |
29003 |
+ |
29004 |
+- pa->pa_deleted = 1; |
29005 |
++ ext4_mb_mark_pa_deleted(sb, pa); |
29006 |
+ spin_unlock(&pa->pa_lock); |
29007 |
+ |
29008 |
+ grp_blk = pa->pa_pstart; |
29009 |
+@@ -3830,6 +3870,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) |
29010 |
+ spin_lock(pa->pa_obj_lock); |
29011 |
+ list_add_rcu(&pa->pa_inode_list, &ei->i_prealloc_list); |
29012 |
+ spin_unlock(pa->pa_obj_lock); |
29013 |
++ atomic_inc(&ei->i_prealloc_active); |
29014 |
+ } |
29015 |
+ |
29016 |
+ /* |
29017 |
+@@ -4040,7 +4081,7 @@ repeat: |
29018 |
+ } |
29019 |
+ |
29020 |
+ /* seems this one can be freed ... */ |
29021 |
+- pa->pa_deleted = 1; |
29022 |
++ ext4_mb_mark_pa_deleted(sb, pa); |
29023 |
+ |
29024 |
+ /* we can trust pa_free ... */ |
29025 |
+ free += pa->pa_free; |
29026 |
+@@ -4103,7 +4144,7 @@ out_dbg: |
29027 |
+ * |
29028 |
+ * FIXME!! Make sure it is valid at all the call sites |
29029 |
+ */ |
29030 |
+-void ext4_discard_preallocations(struct inode *inode) |
29031 |
++void ext4_discard_preallocations(struct inode *inode, unsigned int needed) |
29032 |
+ { |
29033 |
+ struct ext4_inode_info *ei = EXT4_I(inode); |
29034 |
+ struct super_block *sb = inode->i_sb; |
29035 |
+@@ -4121,15 +4162,19 @@ void ext4_discard_preallocations(struct inode *inode) |
29036 |
+ |
29037 |
+ mb_debug(sb, "discard preallocation for inode %lu\n", |
29038 |
+ inode->i_ino); |
29039 |
+- trace_ext4_discard_preallocations(inode); |
29040 |
++ trace_ext4_discard_preallocations(inode, |
29041 |
++ atomic_read(&ei->i_prealloc_active), needed); |
29042 |
+ |
29043 |
+ INIT_LIST_HEAD(&list); |
29044 |
+ |
29045 |
++ if (needed == 0) |
29046 |
++ needed = UINT_MAX; |
29047 |
++ |
29048 |
+ repeat: |
29049 |
+ /* first, collect all pa's in the inode */ |
29050 |
+ spin_lock(&ei->i_prealloc_lock); |
29051 |
+- while (!list_empty(&ei->i_prealloc_list)) { |
29052 |
+- pa = list_entry(ei->i_prealloc_list.next, |
29053 |
++ while (!list_empty(&ei->i_prealloc_list) && needed) { |
29054 |
++ pa = list_entry(ei->i_prealloc_list.prev, |
29055 |
+ struct ext4_prealloc_space, pa_inode_list); |
29056 |
+ BUG_ON(pa->pa_obj_lock != &ei->i_prealloc_lock); |
29057 |
+ spin_lock(&pa->pa_lock); |
29058 |
+@@ -4146,10 +4191,11 @@ repeat: |
29059 |
+ |
29060 |
+ } |
29061 |
+ if (pa->pa_deleted == 0) { |
29062 |
+- pa->pa_deleted = 1; |
29063 |
++ ext4_mb_mark_pa_deleted(sb, pa); |
29064 |
+ spin_unlock(&pa->pa_lock); |
29065 |
+ list_del_rcu(&pa->pa_inode_list); |
29066 |
+ list_add(&pa->u.pa_tmp_list, &list); |
29067 |
++ needed--; |
29068 |
+ continue; |
29069 |
+ } |
29070 |
+ |
29071 |
+@@ -4450,7 +4496,7 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb, |
29072 |
+ BUG_ON(pa->pa_type != MB_GROUP_PA); |
29073 |
+ |
29074 |
+ /* seems this one can be freed ... */ |
29075 |
+- pa->pa_deleted = 1; |
29076 |
++ ext4_mb_mark_pa_deleted(sb, pa); |
29077 |
+ spin_unlock(&pa->pa_lock); |
29078 |
+ |
29079 |
+ list_del_rcu(&pa->pa_inode_list); |
29080 |
+@@ -4548,11 +4594,30 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac) |
29081 |
+ return ; |
29082 |
+ } |
29083 |
+ |
29084 |
++/* |
29085 |
++ * if per-inode prealloc list is too long, trim some PA |
29086 |
++ */ |
29087 |
++static void ext4_mb_trim_inode_pa(struct inode *inode) |
29088 |
++{ |
29089 |
++ struct ext4_inode_info *ei = EXT4_I(inode); |
29090 |
++ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
29091 |
++ int count, delta; |
29092 |
++ |
29093 |
++ count = atomic_read(&ei->i_prealloc_active); |
29094 |
++ delta = (sbi->s_mb_max_inode_prealloc >> 2) + 1; |
29095 |
++ if (count > sbi->s_mb_max_inode_prealloc + delta) { |
29096 |
++ count -= sbi->s_mb_max_inode_prealloc; |
29097 |
++ ext4_discard_preallocations(inode, count); |
29098 |
++ } |
29099 |
++} |
29100 |
++ |
29101 |
+ /* |
29102 |
+ * release all resource we used in allocation |
29103 |
+ */ |
29104 |
+ static int ext4_mb_release_context(struct ext4_allocation_context *ac) |
29105 |
+ { |
29106 |
++ struct inode *inode = ac->ac_inode; |
29107 |
++ struct ext4_inode_info *ei = EXT4_I(inode); |
29108 |
+ struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); |
29109 |
+ struct ext4_prealloc_space *pa = ac->ac_pa; |
29110 |
+ if (pa) { |
29111 |
+@@ -4579,6 +4644,17 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) |
29112 |
+ spin_unlock(pa->pa_obj_lock); |
29113 |
+ ext4_mb_add_n_trim(ac); |
29114 |
+ } |
29115 |
++ |
29116 |
++ if (pa->pa_type == MB_INODE_PA) { |
29117 |
++ /* |
29118 |
++ * treat per-inode prealloc list as a lru list, then try |
29119 |
++ * to trim the least recently used PA. |
29120 |
++ */ |
29121 |
++ spin_lock(pa->pa_obj_lock); |
29122 |
++ list_move(&pa->pa_inode_list, &ei->i_prealloc_list); |
29123 |
++ spin_unlock(pa->pa_obj_lock); |
29124 |
++ } |
29125 |
++ |
29126 |
+ ext4_mb_put_pa(ac, ac->ac_sb, pa); |
29127 |
+ } |
29128 |
+ if (ac->ac_bitmap_page) |
29129 |
+@@ -4588,6 +4664,7 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) |
29130 |
+ if (ac->ac_flags & EXT4_MB_HINT_GROUP_ALLOC) |
29131 |
+ mutex_unlock(&ac->ac_lg->lg_mutex); |
29132 |
+ ext4_mb_collect_stats(ac); |
29133 |
++ ext4_mb_trim_inode_pa(inode); |
29134 |
+ return 0; |
29135 |
+ } |
29136 |
+ |
29137 |
+diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h |
29138 |
+index 6b4d17c2935d6..e75b4749aa1c2 100644 |
29139 |
+--- a/fs/ext4/mballoc.h |
29140 |
++++ b/fs/ext4/mballoc.h |
29141 |
+@@ -73,6 +73,10 @@ |
29142 |
+ */ |
29143 |
+ #define MB_DEFAULT_GROUP_PREALLOC 512 |
29144 |
+ |
29145 |
++/* |
29146 |
++ * maximum length of inode prealloc list |
29147 |
++ */ |
29148 |
++#define MB_DEFAULT_MAX_INODE_PREALLOC 512 |
29149 |
+ |
29150 |
+ struct ext4_free_data { |
29151 |
+ /* this links the free block information from sb_info */ |
29152 |
+diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c |
29153 |
+index 1ed86fb6c3026..0d601b8228753 100644 |
29154 |
+--- a/fs/ext4/move_extent.c |
29155 |
++++ b/fs/ext4/move_extent.c |
29156 |
+@@ -686,8 +686,8 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk, |
29157 |
+ |
29158 |
+ out: |
29159 |
+ if (*moved_len) { |
29160 |
+- ext4_discard_preallocations(orig_inode); |
29161 |
+- ext4_discard_preallocations(donor_inode); |
29162 |
++ ext4_discard_preallocations(orig_inode, 0); |
29163 |
++ ext4_discard_preallocations(donor_inode, 0); |
29164 |
+ } |
29165 |
+ |
29166 |
+ ext4_ext_drop_refs(path); |
29167 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
29168 |
+index 330957ed1f05c..0b38bf29c07e0 100644 |
29169 |
+--- a/fs/ext4/super.c |
29170 |
++++ b/fs/ext4/super.c |
29171 |
+@@ -66,10 +66,10 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *, |
29172 |
+ unsigned long journal_devnum); |
29173 |
+ static int ext4_show_options(struct seq_file *seq, struct dentry *root); |
29174 |
+ static int ext4_commit_super(struct super_block *sb, int sync); |
29175 |
+-static void ext4_mark_recovery_complete(struct super_block *sb, |
29176 |
++static int ext4_mark_recovery_complete(struct super_block *sb, |
29177 |
+ struct ext4_super_block *es); |
29178 |
+-static void ext4_clear_journal_err(struct super_block *sb, |
29179 |
+- struct ext4_super_block *es); |
29180 |
++static int ext4_clear_journal_err(struct super_block *sb, |
29181 |
++ struct ext4_super_block *es); |
29182 |
+ static int ext4_sync_fs(struct super_block *sb, int wait); |
29183 |
+ static int ext4_remount(struct super_block *sb, int *flags, char *data); |
29184 |
+ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf); |
29185 |
+@@ -1123,6 +1123,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) |
29186 |
+ inode_set_iversion(&ei->vfs_inode, 1); |
29187 |
+ spin_lock_init(&ei->i_raw_lock); |
29188 |
+ INIT_LIST_HEAD(&ei->i_prealloc_list); |
29189 |
++ atomic_set(&ei->i_prealloc_active, 0); |
29190 |
+ spin_lock_init(&ei->i_prealloc_lock); |
29191 |
+ ext4_es_init_tree(&ei->i_es_tree); |
29192 |
+ rwlock_init(&ei->i_es_lock); |
29193 |
+@@ -1216,7 +1217,7 @@ void ext4_clear_inode(struct inode *inode) |
29194 |
+ { |
29195 |
+ invalidate_inode_buffers(inode); |
29196 |
+ clear_inode(inode); |
29197 |
+- ext4_discard_preallocations(inode); |
29198 |
++ ext4_discard_preallocations(inode, 0); |
29199 |
+ ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS); |
29200 |
+ dquot_drop(inode); |
29201 |
+ if (EXT4_I(inode)->jinode) { |
29202 |
+@@ -4698,11 +4699,13 @@ no_journal: |
29203 |
+ |
29204 |
+ ext4_set_resv_clusters(sb); |
29205 |
+ |
29206 |
+- err = ext4_setup_system_zone(sb); |
29207 |
+- if (err) { |
29208 |
+- ext4_msg(sb, KERN_ERR, "failed to initialize system " |
29209 |
+- "zone (%d)", err); |
29210 |
+- goto failed_mount4a; |
29211 |
++ if (test_opt(sb, BLOCK_VALIDITY)) { |
29212 |
++ err = ext4_setup_system_zone(sb); |
29213 |
++ if (err) { |
29214 |
++ ext4_msg(sb, KERN_ERR, "failed to initialize system " |
29215 |
++ "zone (%d)", err); |
29216 |
++ goto failed_mount4a; |
29217 |
++ } |
29218 |
+ } |
29219 |
+ |
29220 |
+ ext4_ext_init(sb); |
29221 |
+@@ -4765,12 +4768,23 @@ no_journal: |
29222 |
+ } |
29223 |
+ #endif /* CONFIG_QUOTA */ |
29224 |
+ |
29225 |
++ /* |
29226 |
++ * Save the original bdev mapping's wb_err value which could be |
29227 |
++ * used to detect the metadata async write error. |
29228 |
++ */ |
29229 |
++ spin_lock_init(&sbi->s_bdev_wb_lock); |
29230 |
++ if (!sb_rdonly(sb)) |
29231 |
++ errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err, |
29232 |
++ &sbi->s_bdev_wb_err); |
29233 |
++ sb->s_bdev->bd_super = sb; |
29234 |
+ EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; |
29235 |
+ ext4_orphan_cleanup(sb, es); |
29236 |
+ EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS; |
29237 |
+ if (needs_recovery) { |
29238 |
+ ext4_msg(sb, KERN_INFO, "recovery complete"); |
29239 |
+- ext4_mark_recovery_complete(sb, es); |
29240 |
++ err = ext4_mark_recovery_complete(sb, es); |
29241 |
++ if (err) |
29242 |
++ goto failed_mount8; |
29243 |
+ } |
29244 |
+ if (EXT4_SB(sb)->s_journal) { |
29245 |
+ if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) |
29246 |
+@@ -4813,10 +4827,8 @@ cantfind_ext4: |
29247 |
+ ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); |
29248 |
+ goto failed_mount; |
29249 |
+ |
29250 |
+-#ifdef CONFIG_QUOTA |
29251 |
+ failed_mount8: |
29252 |
+ ext4_unregister_sysfs(sb); |
29253 |
+-#endif |
29254 |
+ failed_mount7: |
29255 |
+ ext4_unregister_li_request(sb); |
29256 |
+ failed_mount6: |
29257 |
+@@ -4956,7 +4968,8 @@ static journal_t *ext4_get_journal(struct super_block *sb, |
29258 |
+ struct inode *journal_inode; |
29259 |
+ journal_t *journal; |
29260 |
+ |
29261 |
+- BUG_ON(!ext4_has_feature_journal(sb)); |
29262 |
++ if (WARN_ON_ONCE(!ext4_has_feature_journal(sb))) |
29263 |
++ return NULL; |
29264 |
+ |
29265 |
+ journal_inode = ext4_get_journal_inode(sb, journal_inum); |
29266 |
+ if (!journal_inode) |
29267 |
+@@ -4986,7 +4999,8 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb, |
29268 |
+ struct ext4_super_block *es; |
29269 |
+ struct block_device *bdev; |
29270 |
+ |
29271 |
+- BUG_ON(!ext4_has_feature_journal(sb)); |
29272 |
++ if (WARN_ON_ONCE(!ext4_has_feature_journal(sb))) |
29273 |
++ return NULL; |
29274 |
+ |
29275 |
+ bdev = ext4_blkdev_get(j_dev, sb); |
29276 |
+ if (bdev == NULL) |
29277 |
+@@ -5077,8 +5091,10 @@ static int ext4_load_journal(struct super_block *sb, |
29278 |
+ dev_t journal_dev; |
29279 |
+ int err = 0; |
29280 |
+ int really_read_only; |
29281 |
++ int journal_dev_ro; |
29282 |
+ |
29283 |
+- BUG_ON(!ext4_has_feature_journal(sb)); |
29284 |
++ if (WARN_ON_ONCE(!ext4_has_feature_journal(sb))) |
29285 |
++ return -EFSCORRUPTED; |
29286 |
+ |
29287 |
+ if (journal_devnum && |
29288 |
+ journal_devnum != le32_to_cpu(es->s_journal_dev)) { |
29289 |
+@@ -5088,7 +5104,31 @@ static int ext4_load_journal(struct super_block *sb, |
29290 |
+ } else |
29291 |
+ journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev)); |
29292 |
+ |
29293 |
+- really_read_only = bdev_read_only(sb->s_bdev); |
29294 |
++ if (journal_inum && journal_dev) { |
29295 |
++ ext4_msg(sb, KERN_ERR, |
29296 |
++ "filesystem has both journal inode and journal device!"); |
29297 |
++ return -EINVAL; |
29298 |
++ } |
29299 |
++ |
29300 |
++ if (journal_inum) { |
29301 |
++ journal = ext4_get_journal(sb, journal_inum); |
29302 |
++ if (!journal) |
29303 |
++ return -EINVAL; |
29304 |
++ } else { |
29305 |
++ journal = ext4_get_dev_journal(sb, journal_dev); |
29306 |
++ if (!journal) |
29307 |
++ return -EINVAL; |
29308 |
++ } |
29309 |
++ |
29310 |
++ journal_dev_ro = bdev_read_only(journal->j_dev); |
29311 |
++ really_read_only = bdev_read_only(sb->s_bdev) | journal_dev_ro; |
29312 |
++ |
29313 |
++ if (journal_dev_ro && !sb_rdonly(sb)) { |
29314 |
++ ext4_msg(sb, KERN_ERR, |
29315 |
++ "journal device read-only, try mounting with '-o ro'"); |
29316 |
++ err = -EROFS; |
29317 |
++ goto err_out; |
29318 |
++ } |
29319 |
+ |
29320 |
+ /* |
29321 |
+ * Are we loading a blank journal or performing recovery after a |
29322 |
+@@ -5103,27 +5143,14 @@ static int ext4_load_journal(struct super_block *sb, |
29323 |
+ ext4_msg(sb, KERN_ERR, "write access " |
29324 |
+ "unavailable, cannot proceed " |
29325 |
+ "(try mounting with noload)"); |
29326 |
+- return -EROFS; |
29327 |
++ err = -EROFS; |
29328 |
++ goto err_out; |
29329 |
+ } |
29330 |
+ ext4_msg(sb, KERN_INFO, "write access will " |
29331 |
+ "be enabled during recovery"); |
29332 |
+ } |
29333 |
+ } |
29334 |
+ |
29335 |
+- if (journal_inum && journal_dev) { |
29336 |
+- ext4_msg(sb, KERN_ERR, "filesystem has both journal " |
29337 |
+- "and inode journals!"); |
29338 |
+- return -EINVAL; |
29339 |
+- } |
29340 |
+- |
29341 |
+- if (journal_inum) { |
29342 |
+- if (!(journal = ext4_get_journal(sb, journal_inum))) |
29343 |
+- return -EINVAL; |
29344 |
+- } else { |
29345 |
+- if (!(journal = ext4_get_dev_journal(sb, journal_dev))) |
29346 |
+- return -EINVAL; |
29347 |
+- } |
29348 |
+- |
29349 |
+ if (!(journal->j_flags & JBD2_BARRIER)) |
29350 |
+ ext4_msg(sb, KERN_INFO, "barriers disabled"); |
29351 |
+ |
29352 |
+@@ -5143,12 +5170,16 @@ static int ext4_load_journal(struct super_block *sb, |
29353 |
+ |
29354 |
+ if (err) { |
29355 |
+ ext4_msg(sb, KERN_ERR, "error loading journal"); |
29356 |
+- jbd2_journal_destroy(journal); |
29357 |
+- return err; |
29358 |
++ goto err_out; |
29359 |
+ } |
29360 |
+ |
29361 |
+ EXT4_SB(sb)->s_journal = journal; |
29362 |
+- ext4_clear_journal_err(sb, es); |
29363 |
++ err = ext4_clear_journal_err(sb, es); |
29364 |
++ if (err) { |
29365 |
++ EXT4_SB(sb)->s_journal = NULL; |
29366 |
++ jbd2_journal_destroy(journal); |
29367 |
++ return err; |
29368 |
++ } |
29369 |
+ |
29370 |
+ if (!really_read_only && journal_devnum && |
29371 |
+ journal_devnum != le32_to_cpu(es->s_journal_dev)) { |
29372 |
+@@ -5159,6 +5190,10 @@ static int ext4_load_journal(struct super_block *sb, |
29373 |
+ } |
29374 |
+ |
29375 |
+ return 0; |
29376 |
++ |
29377 |
++err_out: |
29378 |
++ jbd2_journal_destroy(journal); |
29379 |
++ return err; |
29380 |
+ } |
29381 |
+ |
29382 |
+ static int ext4_commit_super(struct super_block *sb, int sync) |
29383 |
+@@ -5170,13 +5205,6 @@ static int ext4_commit_super(struct super_block *sb, int sync) |
29384 |
+ if (!sbh || block_device_ejected(sb)) |
29385 |
+ return error; |
29386 |
+ |
29387 |
+- /* |
29388 |
+- * The superblock bh should be mapped, but it might not be if the |
29389 |
+- * device was hot-removed. Not much we can do but fail the I/O. |
29390 |
+- */ |
29391 |
+- if (!buffer_mapped(sbh)) |
29392 |
+- return error; |
29393 |
+- |
29394 |
+ /* |
29395 |
+ * If the file system is mounted read-only, don't update the |
29396 |
+ * superblock write time. This avoids updating the superblock |
29397 |
+@@ -5244,26 +5272,32 @@ static int ext4_commit_super(struct super_block *sb, int sync) |
29398 |
+ * remounting) the filesystem readonly, then we will end up with a |
29399 |
+ * consistent fs on disk. Record that fact. |
29400 |
+ */ |
29401 |
+-static void ext4_mark_recovery_complete(struct super_block *sb, |
29402 |
+- struct ext4_super_block *es) |
29403 |
++static int ext4_mark_recovery_complete(struct super_block *sb, |
29404 |
++ struct ext4_super_block *es) |
29405 |
+ { |
29406 |
++ int err; |
29407 |
+ journal_t *journal = EXT4_SB(sb)->s_journal; |
29408 |
+ |
29409 |
+ if (!ext4_has_feature_journal(sb)) { |
29410 |
+- BUG_ON(journal != NULL); |
29411 |
+- return; |
29412 |
++ if (journal != NULL) { |
29413 |
++ ext4_error(sb, "Journal got removed while the fs was " |
29414 |
++ "mounted!"); |
29415 |
++ return -EFSCORRUPTED; |
29416 |
++ } |
29417 |
++ return 0; |
29418 |
+ } |
29419 |
+ jbd2_journal_lock_updates(journal); |
29420 |
+- if (jbd2_journal_flush(journal) < 0) |
29421 |
++ err = jbd2_journal_flush(journal); |
29422 |
++ if (err < 0) |
29423 |
+ goto out; |
29424 |
+ |
29425 |
+ if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { |
29426 |
+ ext4_clear_feature_journal_needs_recovery(sb); |
29427 |
+ ext4_commit_super(sb, 1); |
29428 |
+ } |
29429 |
+- |
29430 |
+ out: |
29431 |
+ jbd2_journal_unlock_updates(journal); |
29432 |
++ return err; |
29433 |
+ } |
29434 |
+ |
29435 |
+ /* |
29436 |
+@@ -5271,14 +5305,17 @@ out: |
29437 |
+ * has recorded an error from a previous lifetime, move that error to the |
29438 |
+ * main filesystem now. |
29439 |
+ */ |
29440 |
+-static void ext4_clear_journal_err(struct super_block *sb, |
29441 |
++static int ext4_clear_journal_err(struct super_block *sb, |
29442 |
+ struct ext4_super_block *es) |
29443 |
+ { |
29444 |
+ journal_t *journal; |
29445 |
+ int j_errno; |
29446 |
+ const char *errstr; |
29447 |
+ |
29448 |
+- BUG_ON(!ext4_has_feature_journal(sb)); |
29449 |
++ if (!ext4_has_feature_journal(sb)) { |
29450 |
++ ext4_error(sb, "Journal got removed while the fs was mounted!"); |
29451 |
++ return -EFSCORRUPTED; |
29452 |
++ } |
29453 |
+ |
29454 |
+ journal = EXT4_SB(sb)->s_journal; |
29455 |
+ |
29456 |
+@@ -5303,6 +5340,7 @@ static void ext4_clear_journal_err(struct super_block *sb, |
29457 |
+ jbd2_journal_clear_err(journal); |
29458 |
+ jbd2_journal_update_sb_errno(journal); |
29459 |
+ } |
29460 |
++ return 0; |
29461 |
+ } |
29462 |
+ |
29463 |
+ /* |
29464 |
+@@ -5445,7 +5483,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29465 |
+ { |
29466 |
+ struct ext4_super_block *es; |
29467 |
+ struct ext4_sb_info *sbi = EXT4_SB(sb); |
29468 |
+- unsigned long old_sb_flags; |
29469 |
++ unsigned long old_sb_flags, vfs_flags; |
29470 |
+ struct ext4_mount_options old_opts; |
29471 |
+ int enable_quota = 0; |
29472 |
+ ext4_group_t g; |
29473 |
+@@ -5488,6 +5526,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29474 |
+ if (sbi->s_journal && sbi->s_journal->j_task->io_context) |
29475 |
+ journal_ioprio = sbi->s_journal->j_task->io_context->ioprio; |
29476 |
+ |
29477 |
++ /* |
29478 |
++ * Some options can be enabled by ext4 and/or by VFS mount flag |
29479 |
++ * either way we need to make sure it matches in both *flags and |
29480 |
++ * s_flags. Copy those selected flags from *flags to s_flags |
29481 |
++ */ |
29482 |
++ vfs_flags = SB_LAZYTIME | SB_I_VERSION; |
29483 |
++ sb->s_flags = (sb->s_flags & ~vfs_flags) | (*flags & vfs_flags); |
29484 |
++ |
29485 |
+ if (!parse_options(data, sb, NULL, &journal_ioprio, 1)) { |
29486 |
+ err = -EINVAL; |
29487 |
+ goto restore_opts; |
29488 |
+@@ -5541,9 +5587,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29489 |
+ set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); |
29490 |
+ } |
29491 |
+ |
29492 |
+- if (*flags & SB_LAZYTIME) |
29493 |
+- sb->s_flags |= SB_LAZYTIME; |
29494 |
+- |
29495 |
+ if ((bool)(*flags & SB_RDONLY) != sb_rdonly(sb)) { |
29496 |
+ if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { |
29497 |
+ err = -EROFS; |
29498 |
+@@ -5573,8 +5616,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29499 |
+ (sbi->s_mount_state & EXT4_VALID_FS)) |
29500 |
+ es->s_state = cpu_to_le16(sbi->s_mount_state); |
29501 |
+ |
29502 |
+- if (sbi->s_journal) |
29503 |
++ if (sbi->s_journal) { |
29504 |
++ /* |
29505 |
++ * We let remount-ro finish even if marking fs |
29506 |
++ * as clean failed... |
29507 |
++ */ |
29508 |
+ ext4_mark_recovery_complete(sb, es); |
29509 |
++ } |
29510 |
+ if (sbi->s_mmp_tsk) |
29511 |
+ kthread_stop(sbi->s_mmp_tsk); |
29512 |
+ } else { |
29513 |
+@@ -5616,14 +5664,25 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29514 |
+ goto restore_opts; |
29515 |
+ } |
29516 |
+ |
29517 |
++ /* |
29518 |
++ * Update the original bdev mapping's wb_err value |
29519 |
++ * which could be used to detect the metadata async |
29520 |
++ * write error. |
29521 |
++ */ |
29522 |
++ errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err, |
29523 |
++ &sbi->s_bdev_wb_err); |
29524 |
++ |
29525 |
+ /* |
29526 |
+ * Mounting a RDONLY partition read-write, so reread |
29527 |
+ * and store the current valid flag. (It may have |
29528 |
+ * been changed by e2fsck since we originally mounted |
29529 |
+ * the partition.) |
29530 |
+ */ |
29531 |
+- if (sbi->s_journal) |
29532 |
+- ext4_clear_journal_err(sb, es); |
29533 |
++ if (sbi->s_journal) { |
29534 |
++ err = ext4_clear_journal_err(sb, es); |
29535 |
++ if (err) |
29536 |
++ goto restore_opts; |
29537 |
++ } |
29538 |
+ sbi->s_mount_state = le16_to_cpu(es->s_state); |
29539 |
+ |
29540 |
+ err = ext4_setup_super(sb, es, 0); |
29541 |
+@@ -5653,7 +5712,17 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29542 |
+ ext4_register_li_request(sb, first_not_zeroed); |
29543 |
+ } |
29544 |
+ |
29545 |
+- ext4_setup_system_zone(sb); |
29546 |
++ /* |
29547 |
++ * Handle creation of system zone data early because it can fail. |
29548 |
++ * Releasing of existing data is done when we are sure remount will |
29549 |
++ * succeed. |
29550 |
++ */ |
29551 |
++ if (test_opt(sb, BLOCK_VALIDITY) && !sbi->system_blks) { |
29552 |
++ err = ext4_setup_system_zone(sb); |
29553 |
++ if (err) |
29554 |
++ goto restore_opts; |
29555 |
++ } |
29556 |
++ |
29557 |
+ if (sbi->s_journal == NULL && !(old_sb_flags & SB_RDONLY)) { |
29558 |
+ err = ext4_commit_super(sb, 1); |
29559 |
+ if (err) |
29560 |
+@@ -5674,8 +5743,16 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
29561 |
+ } |
29562 |
+ } |
29563 |
+ #endif |
29564 |
++ if (!test_opt(sb, BLOCK_VALIDITY) && sbi->system_blks) |
29565 |
++ ext4_release_system_zone(sb); |
29566 |
++ |
29567 |
++ /* |
29568 |
++ * Some options can be enabled by ext4 and/or by VFS mount flag |
29569 |
++ * either way we need to make sure it matches in both *flags and |
29570 |
++ * s_flags. Copy those selected flags from s_flags to *flags |
29571 |
++ */ |
29572 |
++ *flags = (*flags & ~vfs_flags) | (sb->s_flags & vfs_flags); |
29573 |
+ |
29574 |
+- *flags = (*flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYTIME); |
29575 |
+ ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data); |
29576 |
+ kfree(orig_data); |
29577 |
+ return 0; |
29578 |
+@@ -5689,6 +5766,8 @@ restore_opts: |
29579 |
+ sbi->s_commit_interval = old_opts.s_commit_interval; |
29580 |
+ sbi->s_min_batch_time = old_opts.s_min_batch_time; |
29581 |
+ sbi->s_max_batch_time = old_opts.s_max_batch_time; |
29582 |
++ if (!test_opt(sb, BLOCK_VALIDITY) && sbi->system_blks) |
29583 |
++ ext4_release_system_zone(sb); |
29584 |
+ #ifdef CONFIG_QUOTA |
29585 |
+ sbi->s_jquota_fmt = old_opts.s_jquota_fmt; |
29586 |
+ for (i = 0; i < EXT4_MAXQUOTAS; i++) { |
29587 |
+diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c |
29588 |
+index 6c9fc9e21c138..92f04e9e94413 100644 |
29589 |
+--- a/fs/ext4/sysfs.c |
29590 |
++++ b/fs/ext4/sysfs.c |
29591 |
+@@ -215,6 +215,7 @@ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan); |
29592 |
+ EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs); |
29593 |
+ EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request); |
29594 |
+ EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc); |
29595 |
++EXT4_RW_ATTR_SBI_UI(mb_max_inode_prealloc, s_mb_max_inode_prealloc); |
29596 |
+ EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb); |
29597 |
+ EXT4_ATTR(trigger_fs_error, 0200, trigger_test_error); |
29598 |
+ EXT4_RW_ATTR_SBI_UI(err_ratelimit_interval_ms, s_err_ratelimit_state.interval); |
29599 |
+@@ -257,6 +258,7 @@ static struct attribute *ext4_attrs[] = { |
29600 |
+ ATTR_LIST(mb_order2_req), |
29601 |
+ ATTR_LIST(mb_stream_req), |
29602 |
+ ATTR_LIST(mb_group_prealloc), |
29603 |
++ ATTR_LIST(mb_max_inode_prealloc), |
29604 |
+ ATTR_LIST(max_writeback_mb_bump), |
29605 |
+ ATTR_LIST(extent_max_zeroout_kb), |
29606 |
+ ATTR_LIST(trigger_fs_error), |
29607 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
29608 |
+index b35a50f4953c5..7d9afd54e9d8f 100644 |
29609 |
+--- a/fs/f2fs/f2fs.h |
29610 |
++++ b/fs/f2fs/f2fs.h |
29611 |
+@@ -3287,7 +3287,7 @@ bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid); |
29612 |
+ void f2fs_alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid); |
29613 |
+ void f2fs_alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid); |
29614 |
+ int f2fs_try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink); |
29615 |
+-void f2fs_recover_inline_xattr(struct inode *inode, struct page *page); |
29616 |
++int f2fs_recover_inline_xattr(struct inode *inode, struct page *page); |
29617 |
+ int f2fs_recover_xattr_data(struct inode *inode, struct page *page); |
29618 |
+ int f2fs_recover_inode_page(struct f2fs_sb_info *sbi, struct page *page); |
29619 |
+ int f2fs_restore_node_summary(struct f2fs_sb_info *sbi, |
29620 |
+@@ -3750,7 +3750,7 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page); |
29621 |
+ int f2fs_convert_inline_inode(struct inode *inode); |
29622 |
+ int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); |
29623 |
+ int f2fs_write_inline_data(struct inode *inode, struct page *page); |
29624 |
+-bool f2fs_recover_inline_data(struct inode *inode, struct page *npage); |
29625 |
++int f2fs_recover_inline_data(struct inode *inode, struct page *npage); |
29626 |
+ struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, |
29627 |
+ const struct f2fs_filename *fname, |
29628 |
+ struct page **res_page); |
29629 |
+diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c |
29630 |
+index dbade310dc792..cf2c347bd7a3d 100644 |
29631 |
+--- a/fs/f2fs/inline.c |
29632 |
++++ b/fs/f2fs/inline.c |
29633 |
+@@ -253,7 +253,7 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page) |
29634 |
+ return 0; |
29635 |
+ } |
29636 |
+ |
29637 |
+-bool f2fs_recover_inline_data(struct inode *inode, struct page *npage) |
29638 |
++int f2fs_recover_inline_data(struct inode *inode, struct page *npage) |
29639 |
+ { |
29640 |
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode); |
29641 |
+ struct f2fs_inode *ri = NULL; |
29642 |
+@@ -275,7 +275,8 @@ bool f2fs_recover_inline_data(struct inode *inode, struct page *npage) |
29643 |
+ ri && (ri->i_inline & F2FS_INLINE_DATA)) { |
29644 |
+ process_inline: |
29645 |
+ ipage = f2fs_get_node_page(sbi, inode->i_ino); |
29646 |
+- f2fs_bug_on(sbi, IS_ERR(ipage)); |
29647 |
++ if (IS_ERR(ipage)) |
29648 |
++ return PTR_ERR(ipage); |
29649 |
+ |
29650 |
+ f2fs_wait_on_page_writeback(ipage, NODE, true, true); |
29651 |
+ |
29652 |
+@@ -288,21 +289,25 @@ process_inline: |
29653 |
+ |
29654 |
+ set_page_dirty(ipage); |
29655 |
+ f2fs_put_page(ipage, 1); |
29656 |
+- return true; |
29657 |
++ return 1; |
29658 |
+ } |
29659 |
+ |
29660 |
+ if (f2fs_has_inline_data(inode)) { |
29661 |
+ ipage = f2fs_get_node_page(sbi, inode->i_ino); |
29662 |
+- f2fs_bug_on(sbi, IS_ERR(ipage)); |
29663 |
++ if (IS_ERR(ipage)) |
29664 |
++ return PTR_ERR(ipage); |
29665 |
+ f2fs_truncate_inline_inode(inode, ipage, 0); |
29666 |
+ clear_inode_flag(inode, FI_INLINE_DATA); |
29667 |
+ f2fs_put_page(ipage, 1); |
29668 |
+ } else if (ri && (ri->i_inline & F2FS_INLINE_DATA)) { |
29669 |
+- if (f2fs_truncate_blocks(inode, 0, false)) |
29670 |
+- return false; |
29671 |
++ int ret; |
29672 |
++ |
29673 |
++ ret = f2fs_truncate_blocks(inode, 0, false); |
29674 |
++ if (ret) |
29675 |
++ return ret; |
29676 |
+ goto process_inline; |
29677 |
+ } |
29678 |
+- return false; |
29679 |
++ return 0; |
29680 |
+ } |
29681 |
+ |
29682 |
+ struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, |
29683 |
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
29684 |
+index e61ce7fb0958b..98736d0598b8d 100644 |
29685 |
+--- a/fs/f2fs/node.c |
29686 |
++++ b/fs/f2fs/node.c |
29687 |
+@@ -2576,7 +2576,7 @@ int f2fs_try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink) |
29688 |
+ return nr - nr_shrink; |
29689 |
+ } |
29690 |
+ |
29691 |
+-void f2fs_recover_inline_xattr(struct inode *inode, struct page *page) |
29692 |
++int f2fs_recover_inline_xattr(struct inode *inode, struct page *page) |
29693 |
+ { |
29694 |
+ void *src_addr, *dst_addr; |
29695 |
+ size_t inline_size; |
29696 |
+@@ -2584,7 +2584,8 @@ void f2fs_recover_inline_xattr(struct inode *inode, struct page *page) |
29697 |
+ struct f2fs_inode *ri; |
29698 |
+ |
29699 |
+ ipage = f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino); |
29700 |
+- f2fs_bug_on(F2FS_I_SB(inode), IS_ERR(ipage)); |
29701 |
++ if (IS_ERR(ipage)) |
29702 |
++ return PTR_ERR(ipage); |
29703 |
+ |
29704 |
+ ri = F2FS_INODE(page); |
29705 |
+ if (ri->i_inline & F2FS_INLINE_XATTR) { |
29706 |
+@@ -2603,6 +2604,7 @@ void f2fs_recover_inline_xattr(struct inode *inode, struct page *page) |
29707 |
+ update_inode: |
29708 |
+ f2fs_update_inode(inode, ipage); |
29709 |
+ f2fs_put_page(ipage, 1); |
29710 |
++ return 0; |
29711 |
+ } |
29712 |
+ |
29713 |
+ int f2fs_recover_xattr_data(struct inode *inode, struct page *page) |
29714 |
+diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c |
29715 |
+index ae5310f02e7ff..2807251944668 100644 |
29716 |
+--- a/fs/f2fs/recovery.c |
29717 |
++++ b/fs/f2fs/recovery.c |
29718 |
+@@ -544,7 +544,9 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, |
29719 |
+ |
29720 |
+ /* step 1: recover xattr */ |
29721 |
+ if (IS_INODE(page)) { |
29722 |
+- f2fs_recover_inline_xattr(inode, page); |
29723 |
++ err = f2fs_recover_inline_xattr(inode, page); |
29724 |
++ if (err) |
29725 |
++ goto out; |
29726 |
+ } else if (f2fs_has_xattr_block(ofs_of_node(page))) { |
29727 |
+ err = f2fs_recover_xattr_data(inode, page); |
29728 |
+ if (!err) |
29729 |
+@@ -553,8 +555,12 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, |
29730 |
+ } |
29731 |
+ |
29732 |
+ /* step 2: recover inline data */ |
29733 |
+- if (f2fs_recover_inline_data(inode, page)) |
29734 |
++ err = f2fs_recover_inline_data(inode, page); |
29735 |
++ if (err) { |
29736 |
++ if (err == 1) |
29737 |
++ err = 0; |
29738 |
+ goto out; |
29739 |
++ } |
29740 |
+ |
29741 |
+ /* step 3: recover data indices */ |
29742 |
+ start = f2fs_start_bidx_of_node(ofs_of_node(page), inode); |
29743 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
29744 |
+index 20e56b0fa46a9..0deb839da0a03 100644 |
29745 |
+--- a/fs/f2fs/super.c |
29746 |
++++ b/fs/f2fs/super.c |
29747 |
+@@ -1173,6 +1173,9 @@ static void f2fs_put_super(struct super_block *sb) |
29748 |
+ int i; |
29749 |
+ bool dropped; |
29750 |
+ |
29751 |
++ /* unregister procfs/sysfs entries in advance to avoid race case */ |
29752 |
++ f2fs_unregister_sysfs(sbi); |
29753 |
++ |
29754 |
+ f2fs_quota_off_umount(sb); |
29755 |
+ |
29756 |
+ /* prevent remaining shrinker jobs */ |
29757 |
+@@ -1238,8 +1241,6 @@ static void f2fs_put_super(struct super_block *sb) |
29758 |
+ |
29759 |
+ kvfree(sbi->ckpt); |
29760 |
+ |
29761 |
+- f2fs_unregister_sysfs(sbi); |
29762 |
+- |
29763 |
+ sb->s_fs_info = NULL; |
29764 |
+ if (sbi->s_chksum_driver) |
29765 |
+ crypto_free_shash(sbi->s_chksum_driver); |
29766 |
+diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c |
29767 |
+index e877c59b9fdb4..c5e32ceb94827 100644 |
29768 |
+--- a/fs/f2fs/sysfs.c |
29769 |
++++ b/fs/f2fs/sysfs.c |
29770 |
+@@ -223,6 +223,13 @@ static ssize_t avg_vblocks_show(struct f2fs_attr *a, |
29771 |
+ } |
29772 |
+ #endif |
29773 |
+ |
29774 |
++static ssize_t main_blkaddr_show(struct f2fs_attr *a, |
29775 |
++ struct f2fs_sb_info *sbi, char *buf) |
29776 |
++{ |
29777 |
++ return snprintf(buf, PAGE_SIZE, "%llu\n", |
29778 |
++ (unsigned long long)MAIN_BLKADDR(sbi)); |
29779 |
++} |
29780 |
++ |
29781 |
+ static ssize_t f2fs_sbi_show(struct f2fs_attr *a, |
29782 |
+ struct f2fs_sb_info *sbi, char *buf) |
29783 |
+ { |
29784 |
+@@ -522,7 +529,6 @@ F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_no_gc_sleep_time, no_gc_sleep_time); |
29785 |
+ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle, gc_mode); |
29786 |
+ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent, gc_mode); |
29787 |
+ F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, reclaim_segments, rec_prefree_segments); |
29788 |
+-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, main_blkaddr, main_blkaddr); |
29789 |
+ F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_small_discards, max_discards); |
29790 |
+ F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, discard_granularity, discard_granularity); |
29791 |
+ F2FS_RW_ATTR(RESERVED_BLOCKS, f2fs_sb_info, reserved_blocks, reserved_blocks); |
29792 |
+@@ -565,6 +571,7 @@ F2FS_GENERAL_RO_ATTR(current_reserved_blocks); |
29793 |
+ F2FS_GENERAL_RO_ATTR(unusable); |
29794 |
+ F2FS_GENERAL_RO_ATTR(encoding); |
29795 |
+ F2FS_GENERAL_RO_ATTR(mounted_time_sec); |
29796 |
++F2FS_GENERAL_RO_ATTR(main_blkaddr); |
29797 |
+ #ifdef CONFIG_F2FS_STAT_FS |
29798 |
+ F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_foreground_calls, cp_count); |
29799 |
+ F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_background_calls, bg_cp_count); |
29800 |
+diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c |
29801 |
+index a605c3dddabc7..ae17d64a3e189 100644 |
29802 |
+--- a/fs/fs-writeback.c |
29803 |
++++ b/fs/fs-writeback.c |
29804 |
+@@ -42,7 +42,6 @@ |
29805 |
+ struct wb_writeback_work { |
29806 |
+ long nr_pages; |
29807 |
+ struct super_block *sb; |
29808 |
+- unsigned long *older_than_this; |
29809 |
+ enum writeback_sync_modes sync_mode; |
29810 |
+ unsigned int tagged_writepages:1; |
29811 |
+ unsigned int for_kupdate:1; |
29812 |
+@@ -144,7 +143,9 @@ static void inode_io_list_del_locked(struct inode *inode, |
29813 |
+ struct bdi_writeback *wb) |
29814 |
+ { |
29815 |
+ assert_spin_locked(&wb->list_lock); |
29816 |
++ assert_spin_locked(&inode->i_lock); |
29817 |
+ |
29818 |
++ inode->i_state &= ~I_SYNC_QUEUED; |
29819 |
+ list_del_init(&inode->i_io_list); |
29820 |
+ wb_io_lists_depopulated(wb); |
29821 |
+ } |
29822 |
+@@ -1122,7 +1123,9 @@ void inode_io_list_del(struct inode *inode) |
29823 |
+ struct bdi_writeback *wb; |
29824 |
+ |
29825 |
+ wb = inode_to_wb_and_lock_list(inode); |
29826 |
++ spin_lock(&inode->i_lock); |
29827 |
+ inode_io_list_del_locked(inode, wb); |
29828 |
++ spin_unlock(&inode->i_lock); |
29829 |
+ spin_unlock(&wb->list_lock); |
29830 |
+ } |
29831 |
+ EXPORT_SYMBOL(inode_io_list_del); |
29832 |
+@@ -1172,8 +1175,10 @@ void sb_clear_inode_writeback(struct inode *inode) |
29833 |
+ * the case then the inode must have been redirtied while it was being written |
29834 |
+ * out and we don't reset its dirtied_when. |
29835 |
+ */ |
29836 |
+-static void redirty_tail(struct inode *inode, struct bdi_writeback *wb) |
29837 |
++static void redirty_tail_locked(struct inode *inode, struct bdi_writeback *wb) |
29838 |
+ { |
29839 |
++ assert_spin_locked(&inode->i_lock); |
29840 |
++ |
29841 |
+ if (!list_empty(&wb->b_dirty)) { |
29842 |
+ struct inode *tail; |
29843 |
+ |
29844 |
+@@ -1182,6 +1187,14 @@ static void redirty_tail(struct inode *inode, struct bdi_writeback *wb) |
29845 |
+ inode->dirtied_when = jiffies; |
29846 |
+ } |
29847 |
+ inode_io_list_move_locked(inode, wb, &wb->b_dirty); |
29848 |
++ inode->i_state &= ~I_SYNC_QUEUED; |
29849 |
++} |
29850 |
++ |
29851 |
++static void redirty_tail(struct inode *inode, struct bdi_writeback *wb) |
29852 |
++{ |
29853 |
++ spin_lock(&inode->i_lock); |
29854 |
++ redirty_tail_locked(inode, wb); |
29855 |
++ spin_unlock(&inode->i_lock); |
29856 |
+ } |
29857 |
+ |
29858 |
+ /* |
29859 |
+@@ -1220,16 +1233,13 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t) |
29860 |
+ #define EXPIRE_DIRTY_ATIME 0x0001 |
29861 |
+ |
29862 |
+ /* |
29863 |
+- * Move expired (dirtied before work->older_than_this) dirty inodes from |
29864 |
++ * Move expired (dirtied before dirtied_before) dirty inodes from |
29865 |
+ * @delaying_queue to @dispatch_queue. |
29866 |
+ */ |
29867 |
+ static int move_expired_inodes(struct list_head *delaying_queue, |
29868 |
+ struct list_head *dispatch_queue, |
29869 |
+- int flags, |
29870 |
+- struct wb_writeback_work *work) |
29871 |
++ int flags, unsigned long dirtied_before) |
29872 |
+ { |
29873 |
+- unsigned long *older_than_this = NULL; |
29874 |
+- unsigned long expire_time; |
29875 |
+ LIST_HEAD(tmp); |
29876 |
+ struct list_head *pos, *node; |
29877 |
+ struct super_block *sb = NULL; |
29878 |
+@@ -1237,21 +1247,17 @@ static int move_expired_inodes(struct list_head *delaying_queue, |
29879 |
+ int do_sb_sort = 0; |
29880 |
+ int moved = 0; |
29881 |
+ |
29882 |
+- if ((flags & EXPIRE_DIRTY_ATIME) == 0) |
29883 |
+- older_than_this = work->older_than_this; |
29884 |
+- else if (!work->for_sync) { |
29885 |
+- expire_time = jiffies - (dirtytime_expire_interval * HZ); |
29886 |
+- older_than_this = &expire_time; |
29887 |
+- } |
29888 |
+ while (!list_empty(delaying_queue)) { |
29889 |
+ inode = wb_inode(delaying_queue->prev); |
29890 |
+- if (older_than_this && |
29891 |
+- inode_dirtied_after(inode, *older_than_this)) |
29892 |
++ if (inode_dirtied_after(inode, dirtied_before)) |
29893 |
+ break; |
29894 |
+ list_move(&inode->i_io_list, &tmp); |
29895 |
+ moved++; |
29896 |
++ spin_lock(&inode->i_lock); |
29897 |
+ if (flags & EXPIRE_DIRTY_ATIME) |
29898 |
+- set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state); |
29899 |
++ inode->i_state |= I_DIRTY_TIME_EXPIRED; |
29900 |
++ inode->i_state |= I_SYNC_QUEUED; |
29901 |
++ spin_unlock(&inode->i_lock); |
29902 |
+ if (sb_is_blkdev_sb(inode->i_sb)) |
29903 |
+ continue; |
29904 |
+ if (sb && sb != inode->i_sb) |
29905 |
+@@ -1289,18 +1295,22 @@ out: |
29906 |
+ * | |
29907 |
+ * +--> dequeue for IO |
29908 |
+ */ |
29909 |
+-static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work) |
29910 |
++static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work, |
29911 |
++ unsigned long dirtied_before) |
29912 |
+ { |
29913 |
+ int moved; |
29914 |
++ unsigned long time_expire_jif = dirtied_before; |
29915 |
+ |
29916 |
+ assert_spin_locked(&wb->list_lock); |
29917 |
+ list_splice_init(&wb->b_more_io, &wb->b_io); |
29918 |
+- moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, work); |
29919 |
++ moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, dirtied_before); |
29920 |
++ if (!work->for_sync) |
29921 |
++ time_expire_jif = jiffies - dirtytime_expire_interval * HZ; |
29922 |
+ moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io, |
29923 |
+- EXPIRE_DIRTY_ATIME, work); |
29924 |
++ EXPIRE_DIRTY_ATIME, time_expire_jif); |
29925 |
+ if (moved) |
29926 |
+ wb_io_lists_populated(wb); |
29927 |
+- trace_writeback_queue_io(wb, work, moved); |
29928 |
++ trace_writeback_queue_io(wb, work, dirtied_before, moved); |
29929 |
+ } |
29930 |
+ |
29931 |
+ static int write_inode(struct inode *inode, struct writeback_control *wbc) |
29932 |
+@@ -1394,7 +1404,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb, |
29933 |
+ * writeback is not making progress due to locked |
29934 |
+ * buffers. Skip this inode for now. |
29935 |
+ */ |
29936 |
+- redirty_tail(inode, wb); |
29937 |
++ redirty_tail_locked(inode, wb); |
29938 |
+ return; |
29939 |
+ } |
29940 |
+ |
29941 |
+@@ -1414,7 +1424,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb, |
29942 |
+ * retrying writeback of the dirty page/inode |
29943 |
+ * that cannot be performed immediately. |
29944 |
+ */ |
29945 |
+- redirty_tail(inode, wb); |
29946 |
++ redirty_tail_locked(inode, wb); |
29947 |
+ } |
29948 |
+ } else if (inode->i_state & I_DIRTY) { |
29949 |
+ /* |
29950 |
+@@ -1422,10 +1432,11 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb, |
29951 |
+ * such as delayed allocation during submission or metadata |
29952 |
+ * updates after data IO completion. |
29953 |
+ */ |
29954 |
+- redirty_tail(inode, wb); |
29955 |
++ redirty_tail_locked(inode, wb); |
29956 |
+ } else if (inode->i_state & I_DIRTY_TIME) { |
29957 |
+ inode->dirtied_when = jiffies; |
29958 |
+ inode_io_list_move_locked(inode, wb, &wb->b_dirty_time); |
29959 |
++ inode->i_state &= ~I_SYNC_QUEUED; |
29960 |
+ } else { |
29961 |
+ /* The inode is clean. Remove from writeback lists. */ |
29962 |
+ inode_io_list_del_locked(inode, wb); |
29963 |
+@@ -1669,8 +1680,8 @@ static long writeback_sb_inodes(struct super_block *sb, |
29964 |
+ */ |
29965 |
+ spin_lock(&inode->i_lock); |
29966 |
+ if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) { |
29967 |
++ redirty_tail_locked(inode, wb); |
29968 |
+ spin_unlock(&inode->i_lock); |
29969 |
+- redirty_tail(inode, wb); |
29970 |
+ continue; |
29971 |
+ } |
29972 |
+ if ((inode->i_state & I_SYNC) && wbc.sync_mode != WB_SYNC_ALL) { |
29973 |
+@@ -1811,7 +1822,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, |
29974 |
+ blk_start_plug(&plug); |
29975 |
+ spin_lock(&wb->list_lock); |
29976 |
+ if (list_empty(&wb->b_io)) |
29977 |
+- queue_io(wb, &work); |
29978 |
++ queue_io(wb, &work, jiffies); |
29979 |
+ __writeback_inodes_wb(wb, &work); |
29980 |
+ spin_unlock(&wb->list_lock); |
29981 |
+ blk_finish_plug(&plug); |
29982 |
+@@ -1831,7 +1842,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, |
29983 |
+ * takes longer than a dirty_writeback_interval interval, then leave a |
29984 |
+ * one-second gap. |
29985 |
+ * |
29986 |
+- * older_than_this takes precedence over nr_to_write. So we'll only write back |
29987 |
++ * dirtied_before takes precedence over nr_to_write. So we'll only write back |
29988 |
+ * all dirty pages if they are all attached to "old" mappings. |
29989 |
+ */ |
29990 |
+ static long wb_writeback(struct bdi_writeback *wb, |
29991 |
+@@ -1839,14 +1850,11 @@ static long wb_writeback(struct bdi_writeback *wb, |
29992 |
+ { |
29993 |
+ unsigned long wb_start = jiffies; |
29994 |
+ long nr_pages = work->nr_pages; |
29995 |
+- unsigned long oldest_jif; |
29996 |
++ unsigned long dirtied_before = jiffies; |
29997 |
+ struct inode *inode; |
29998 |
+ long progress; |
29999 |
+ struct blk_plug plug; |
30000 |
+ |
30001 |
+- oldest_jif = jiffies; |
30002 |
+- work->older_than_this = &oldest_jif; |
30003 |
+- |
30004 |
+ blk_start_plug(&plug); |
30005 |
+ spin_lock(&wb->list_lock); |
30006 |
+ for (;;) { |
30007 |
+@@ -1880,14 +1888,14 @@ static long wb_writeback(struct bdi_writeback *wb, |
30008 |
+ * safe. |
30009 |
+ */ |
30010 |
+ if (work->for_kupdate) { |
30011 |
+- oldest_jif = jiffies - |
30012 |
++ dirtied_before = jiffies - |
30013 |
+ msecs_to_jiffies(dirty_expire_interval * 10); |
30014 |
+ } else if (work->for_background) |
30015 |
+- oldest_jif = jiffies; |
30016 |
++ dirtied_before = jiffies; |
30017 |
+ |
30018 |
+ trace_writeback_start(wb, work); |
30019 |
+ if (list_empty(&wb->b_io)) |
30020 |
+- queue_io(wb, work); |
30021 |
++ queue_io(wb, work, dirtied_before); |
30022 |
+ if (work->sb) |
30023 |
+ progress = writeback_sb_inodes(work->sb, wb, work); |
30024 |
+ else |
30025 |
+@@ -2289,11 +2297,12 @@ void __mark_inode_dirty(struct inode *inode, int flags) |
30026 |
+ inode->i_state |= flags; |
30027 |
+ |
30028 |
+ /* |
30029 |
+- * If the inode is being synced, just update its dirty state. |
30030 |
+- * The unlocker will place the inode on the appropriate |
30031 |
+- * superblock list, based upon its state. |
30032 |
++ * If the inode is queued for writeback by flush worker, just |
30033 |
++ * update its dirty state. Once the flush worker is done with |
30034 |
++ * the inode it will place it on the appropriate superblock |
30035 |
++ * list, based upon its state. |
30036 |
+ */ |
30037 |
+- if (inode->i_state & I_SYNC) |
30038 |
++ if (inode->i_state & I_SYNC_QUEUED) |
30039 |
+ goto out_unlock_inode; |
30040 |
+ |
30041 |
+ /* |
30042 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
30043 |
+index ef5313f9c78fe..f936bcf02cce7 100644 |
30044 |
+--- a/fs/hugetlbfs/inode.c |
30045 |
++++ b/fs/hugetlbfs/inode.c |
30046 |
+@@ -1364,6 +1364,12 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) |
30047 |
+ sb->s_magic = HUGETLBFS_MAGIC; |
30048 |
+ sb->s_op = &hugetlbfs_ops; |
30049 |
+ sb->s_time_gran = 1; |
30050 |
++ |
30051 |
++ /* |
30052 |
++ * Due to the special and limited functionality of hugetlbfs, it does |
30053 |
++ * not work well as a stacking filesystem. |
30054 |
++ */ |
30055 |
++ sb->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH; |
30056 |
+ sb->s_root = d_make_root(hugetlbfs_get_root(sb, ctx)); |
30057 |
+ if (!sb->s_root) |
30058 |
+ goto out_free; |
30059 |
+diff --git a/fs/io-wq.c b/fs/io-wq.c |
30060 |
+index 47c5f3aeb4600..cb9e5a444fba7 100644 |
30061 |
+--- a/fs/io-wq.c |
30062 |
++++ b/fs/io-wq.c |
30063 |
+@@ -929,6 +929,24 @@ static bool io_wq_worker_cancel(struct io_worker *worker, void *data) |
30064 |
+ return match->nr_running && !match->cancel_all; |
30065 |
+ } |
30066 |
+ |
30067 |
++static inline void io_wqe_remove_pending(struct io_wqe *wqe, |
30068 |
++ struct io_wq_work *work, |
30069 |
++ struct io_wq_work_node *prev) |
30070 |
++{ |
30071 |
++ unsigned int hash = io_get_work_hash(work); |
30072 |
++ struct io_wq_work *prev_work = NULL; |
30073 |
++ |
30074 |
++ if (io_wq_is_hashed(work) && work == wqe->hash_tail[hash]) { |
30075 |
++ if (prev) |
30076 |
++ prev_work = container_of(prev, struct io_wq_work, list); |
30077 |
++ if (prev_work && io_get_work_hash(prev_work) == hash) |
30078 |
++ wqe->hash_tail[hash] = prev_work; |
30079 |
++ else |
30080 |
++ wqe->hash_tail[hash] = NULL; |
30081 |
++ } |
30082 |
++ wq_list_del(&wqe->work_list, &work->list, prev); |
30083 |
++} |
30084 |
++ |
30085 |
+ static void io_wqe_cancel_pending_work(struct io_wqe *wqe, |
30086 |
+ struct io_cb_cancel_data *match) |
30087 |
+ { |
30088 |
+@@ -942,8 +960,7 @@ retry: |
30089 |
+ work = container_of(node, struct io_wq_work, list); |
30090 |
+ if (!match->fn(work, match->data)) |
30091 |
+ continue; |
30092 |
+- |
30093 |
+- wq_list_del(&wqe->work_list, node, prev); |
30094 |
++ io_wqe_remove_pending(wqe, work, prev); |
30095 |
+ spin_unlock_irqrestore(&wqe->lock, flags); |
30096 |
+ io_run_cancel(work, wqe); |
30097 |
+ match->nr_pending++; |
30098 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
30099 |
+index 26978630378e0..4115bfedf15dc 100644 |
30100 |
+--- a/fs/io_uring.c |
30101 |
++++ b/fs/io_uring.c |
30102 |
+@@ -1810,6 +1810,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, |
30103 |
+ |
30104 |
+ req = list_first_entry(done, struct io_kiocb, list); |
30105 |
+ if (READ_ONCE(req->result) == -EAGAIN) { |
30106 |
++ req->result = 0; |
30107 |
+ req->iopoll_completed = 0; |
30108 |
+ list_move_tail(&req->list, &again); |
30109 |
+ continue; |
30110 |
+@@ -2517,6 +2518,11 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, |
30111 |
+ return import_iovec(rw, buf, sqe_len, UIO_FASTIOV, iovec, iter); |
30112 |
+ } |
30113 |
+ |
30114 |
++static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb) |
30115 |
++{ |
30116 |
++ return kiocb->ki_filp->f_mode & FMODE_STREAM ? NULL : &kiocb->ki_pos; |
30117 |
++} |
30118 |
++ |
30119 |
+ /* |
30120 |
+ * For files that don't have ->read_iter() and ->write_iter(), handle them |
30121 |
+ * by looping over ->read() or ->write() manually. |
30122 |
+@@ -2552,10 +2558,10 @@ static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb, |
30123 |
+ |
30124 |
+ if (rw == READ) { |
30125 |
+ nr = file->f_op->read(file, iovec.iov_base, |
30126 |
+- iovec.iov_len, &kiocb->ki_pos); |
30127 |
++ iovec.iov_len, io_kiocb_ppos(kiocb)); |
30128 |
+ } else { |
30129 |
+ nr = file->f_op->write(file, iovec.iov_base, |
30130 |
+- iovec.iov_len, &kiocb->ki_pos); |
30131 |
++ iovec.iov_len, io_kiocb_ppos(kiocb)); |
30132 |
+ } |
30133 |
+ |
30134 |
+ if (iov_iter_is_bvec(iter)) |
30135 |
+@@ -2680,7 +2686,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) |
30136 |
+ goto copy_iov; |
30137 |
+ |
30138 |
+ iov_count = iov_iter_count(&iter); |
30139 |
+- ret = rw_verify_area(READ, req->file, &kiocb->ki_pos, iov_count); |
30140 |
++ ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count); |
30141 |
+ if (!ret) { |
30142 |
+ ssize_t ret2; |
30143 |
+ |
30144 |
+@@ -2779,7 +2785,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) |
30145 |
+ goto copy_iov; |
30146 |
+ |
30147 |
+ iov_count = iov_iter_count(&iter); |
30148 |
+- ret = rw_verify_area(WRITE, req->file, &kiocb->ki_pos, iov_count); |
30149 |
++ ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), iov_count); |
30150 |
+ if (!ret) { |
30151 |
+ ssize_t ret2; |
30152 |
+ |
30153 |
+@@ -4113,7 +4119,8 @@ struct io_poll_table { |
30154 |
+ int error; |
30155 |
+ }; |
30156 |
+ |
30157 |
+-static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb) |
30158 |
++static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb, |
30159 |
++ bool twa_signal_ok) |
30160 |
+ { |
30161 |
+ struct task_struct *tsk = req->task; |
30162 |
+ struct io_ring_ctx *ctx = req->ctx; |
30163 |
+@@ -4126,7 +4133,7 @@ static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb) |
30164 |
+ * will do the job. |
30165 |
+ */ |
30166 |
+ notify = 0; |
30167 |
+- if (!(ctx->flags & IORING_SETUP_SQPOLL)) |
30168 |
++ if (!(ctx->flags & IORING_SETUP_SQPOLL) && twa_signal_ok) |
30169 |
+ notify = TWA_SIGNAL; |
30170 |
+ |
30171 |
+ ret = task_work_add(tsk, cb, notify); |
30172 |
+@@ -4140,6 +4147,7 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, |
30173 |
+ __poll_t mask, task_work_func_t func) |
30174 |
+ { |
30175 |
+ struct task_struct *tsk; |
30176 |
++ bool twa_signal_ok; |
30177 |
+ int ret; |
30178 |
+ |
30179 |
+ /* for instances that support it check for an event match first: */ |
30180 |
+@@ -4155,13 +4163,21 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, |
30181 |
+ init_task_work(&req->task_work, func); |
30182 |
+ percpu_ref_get(&req->ctx->refs); |
30183 |
+ |
30184 |
++ /* |
30185 |
++ * If we using the signalfd wait_queue_head for this wakeup, then |
30186 |
++ * it's not safe to use TWA_SIGNAL as we could be recursing on the |
30187 |
++ * tsk->sighand->siglock on doing the wakeup. Should not be needed |
30188 |
++ * either, as the normal wakeup will suffice. |
30189 |
++ */ |
30190 |
++ twa_signal_ok = (poll->head != &req->task->sighand->signalfd_wqh); |
30191 |
++ |
30192 |
+ /* |
30193 |
+ * If this fails, then the task is exiting. When a task exits, the |
30194 |
+ * work gets canceled, so just cancel this request as well instead |
30195 |
+ * of executing it. We can't safely execute it anyway, as we may not |
30196 |
+ * have the needed state needed for it anyway. |
30197 |
+ */ |
30198 |
+- ret = io_req_task_work_add(req, &req->task_work); |
30199 |
++ ret = io_req_task_work_add(req, &req->task_work, twa_signal_ok); |
30200 |
+ if (unlikely(ret)) { |
30201 |
+ WRITE_ONCE(poll->canceled, true); |
30202 |
+ tsk = io_wq_get_task(req->ctx->io_wq); |
30203 |
+@@ -4492,12 +4508,20 @@ static bool io_arm_poll_handler(struct io_kiocb *req) |
30204 |
+ struct async_poll *apoll; |
30205 |
+ struct io_poll_table ipt; |
30206 |
+ __poll_t mask, ret; |
30207 |
++ int rw; |
30208 |
+ |
30209 |
+ if (!req->file || !file_can_poll(req->file)) |
30210 |
+ return false; |
30211 |
+ if (req->flags & (REQ_F_MUST_PUNT | REQ_F_POLLED)) |
30212 |
+ return false; |
30213 |
+- if (!def->pollin && !def->pollout) |
30214 |
++ if (def->pollin) |
30215 |
++ rw = READ; |
30216 |
++ else if (def->pollout) |
30217 |
++ rw = WRITE; |
30218 |
++ else |
30219 |
++ return false; |
30220 |
++ /* if we can't nonblock try, then no point in arming a poll handler */ |
30221 |
++ if (!io_file_supports_async(req->file, rw)) |
30222 |
+ return false; |
30223 |
+ |
30224 |
+ apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC); |
30225 |
+diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
30226 |
+index e91aad3637a23..6250c9faa4cbe 100644 |
30227 |
+--- a/fs/jbd2/transaction.c |
30228 |
++++ b/fs/jbd2/transaction.c |
30229 |
+@@ -2026,6 +2026,9 @@ static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh) |
30230 |
+ */ |
30231 |
+ static void __jbd2_journal_unfile_buffer(struct journal_head *jh) |
30232 |
+ { |
30233 |
++ J_ASSERT_JH(jh, jh->b_transaction != NULL); |
30234 |
++ J_ASSERT_JH(jh, jh->b_next_transaction == NULL); |
30235 |
++ |
30236 |
+ __jbd2_journal_temp_unlink_buffer(jh); |
30237 |
+ jh->b_transaction = NULL; |
30238 |
+ } |
30239 |
+@@ -2117,6 +2120,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, |
30240 |
+ { |
30241 |
+ struct buffer_head *head; |
30242 |
+ struct buffer_head *bh; |
30243 |
++ bool has_write_io_error = false; |
30244 |
+ int ret = 0; |
30245 |
+ |
30246 |
+ J_ASSERT(PageLocked(page)); |
30247 |
+@@ -2141,11 +2145,26 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, |
30248 |
+ jbd2_journal_put_journal_head(jh); |
30249 |
+ if (buffer_jbd(bh)) |
30250 |
+ goto busy; |
30251 |
++ |
30252 |
++ /* |
30253 |
++ * If we free a metadata buffer which has been failed to |
30254 |
++ * write out, the jbd2 checkpoint procedure will not detect |
30255 |
++ * this failure and may lead to filesystem inconsistency |
30256 |
++ * after cleanup journal tail. |
30257 |
++ */ |
30258 |
++ if (buffer_write_io_error(bh)) { |
30259 |
++ pr_err("JBD2: Error while async write back metadata bh %llu.", |
30260 |
++ (unsigned long long)bh->b_blocknr); |
30261 |
++ has_write_io_error = true; |
30262 |
++ } |
30263 |
+ } while ((bh = bh->b_this_page) != head); |
30264 |
+ |
30265 |
+ ret = try_to_free_buffers(page); |
30266 |
+ |
30267 |
+ busy: |
30268 |
++ if (has_write_io_error) |
30269 |
++ jbd2_journal_abort(journal, -EIO); |
30270 |
++ |
30271 |
+ return ret; |
30272 |
+ } |
30273 |
+ |
30274 |
+@@ -2572,6 +2591,13 @@ bool __jbd2_journal_refile_buffer(struct journal_head *jh) |
30275 |
+ |
30276 |
+ was_dirty = test_clear_buffer_jbddirty(bh); |
30277 |
+ __jbd2_journal_temp_unlink_buffer(jh); |
30278 |
++ |
30279 |
++ /* |
30280 |
++ * b_transaction must be set, otherwise the new b_transaction won't |
30281 |
++ * be holding jh reference |
30282 |
++ */ |
30283 |
++ J_ASSERT_JH(jh, jh->b_transaction != NULL); |
30284 |
++ |
30285 |
+ /* |
30286 |
+ * We set b_transaction here because b_next_transaction will inherit |
30287 |
+ * our jh reference and thus __jbd2_journal_file_buffer() must not |
30288 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
30289 |
+index c9056316a0b35..cea682ce8aa12 100644 |
30290 |
+--- a/fs/nfsd/nfs4state.c |
30291 |
++++ b/fs/nfsd/nfs4state.c |
30292 |
+@@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl) |
30293 |
+ if (!i_am_nfsd()) |
30294 |
+ return NULL; |
30295 |
+ rqst = kthread_data(current); |
30296 |
++ if (!rqst->rq_lease_breaker) |
30297 |
++ return NULL; |
30298 |
+ clp = *(rqst->rq_lease_breaker); |
30299 |
+ return dl->dl_stid.sc_client == clp; |
30300 |
+ } |
30301 |
+diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c |
30302 |
+index b5dfb66548422..4504d215cd590 100644 |
30303 |
+--- a/fs/xfs/libxfs/xfs_trans_inode.c |
30304 |
++++ b/fs/xfs/libxfs/xfs_trans_inode.c |
30305 |
+@@ -36,6 +36,7 @@ xfs_trans_ijoin( |
30306 |
+ |
30307 |
+ ASSERT(iip->ili_lock_flags == 0); |
30308 |
+ iip->ili_lock_flags = lock_flags; |
30309 |
++ ASSERT(!xfs_iflags_test(ip, XFS_ISTALE)); |
30310 |
+ |
30311 |
+ /* |
30312 |
+ * Get a log_item_desc to point at the new item. |
30313 |
+@@ -89,6 +90,7 @@ xfs_trans_log_inode( |
30314 |
+ |
30315 |
+ ASSERT(ip->i_itemp != NULL); |
30316 |
+ ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
30317 |
++ ASSERT(!xfs_iflags_test(ip, XFS_ISTALE)); |
30318 |
+ |
30319 |
+ /* |
30320 |
+ * Don't bother with i_lock for the I_DIRTY_TIME check here, as races |
30321 |
+diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c |
30322 |
+index 5daef654956cb..59dea8178ae3c 100644 |
30323 |
+--- a/fs/xfs/xfs_icache.c |
30324 |
++++ b/fs/xfs/xfs_icache.c |
30325 |
+@@ -1141,7 +1141,7 @@ restart: |
30326 |
+ goto out_ifunlock; |
30327 |
+ xfs_iunpin_wait(ip); |
30328 |
+ } |
30329 |
+- if (xfs_iflags_test(ip, XFS_ISTALE) || xfs_inode_clean(ip)) { |
30330 |
++ if (xfs_inode_clean(ip)) { |
30331 |
+ xfs_ifunlock(ip); |
30332 |
+ goto reclaim; |
30333 |
+ } |
30334 |
+@@ -1228,6 +1228,7 @@ reclaim: |
30335 |
+ xfs_ilock(ip, XFS_ILOCK_EXCL); |
30336 |
+ xfs_qm_dqdetach(ip); |
30337 |
+ xfs_iunlock(ip, XFS_ILOCK_EXCL); |
30338 |
++ ASSERT(xfs_inode_clean(ip)); |
30339 |
+ |
30340 |
+ __xfs_inode_free(ip); |
30341 |
+ return error; |
30342 |
+diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
30343 |
+index 9aea7d68d8ab9..6d70daf1c92a7 100644 |
30344 |
+--- a/fs/xfs/xfs_inode.c |
30345 |
++++ b/fs/xfs/xfs_inode.c |
30346 |
+@@ -1740,10 +1740,31 @@ xfs_inactive_ifree( |
30347 |
+ return error; |
30348 |
+ } |
30349 |
+ |
30350 |
++ /* |
30351 |
++ * We do not hold the inode locked across the entire rolling transaction |
30352 |
++ * here. We only need to hold it for the first transaction that |
30353 |
++ * xfs_ifree() builds, which may mark the inode XFS_ISTALE if the |
30354 |
++ * underlying cluster buffer is freed. Relogging an XFS_ISTALE inode |
30355 |
++ * here breaks the relationship between cluster buffer invalidation and |
30356 |
++ * stale inode invalidation on cluster buffer item journal commit |
30357 |
++ * completion, and can result in leaving dirty stale inodes hanging |
30358 |
++ * around in memory. |
30359 |
++ * |
30360 |
++ * We have no need for serialising this inode operation against other |
30361 |
++ * operations - we freed the inode and hence reallocation is required |
30362 |
++ * and that will serialise on reallocating the space the deferops need |
30363 |
++ * to free. Hence we can unlock the inode on the first commit of |
30364 |
++ * the transaction rather than roll it right through the deferops. This |
30365 |
++ * avoids relogging the XFS_ISTALE inode. |
30366 |
++ * |
30367 |
++ * We check that xfs_ifree() hasn't grown an internal transaction roll |
30368 |
++ * by asserting that the inode is still locked when it returns. |
30369 |
++ */ |
30370 |
+ xfs_ilock(ip, XFS_ILOCK_EXCL); |
30371 |
+- xfs_trans_ijoin(tp, ip, 0); |
30372 |
++ xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
30373 |
+ |
30374 |
+ error = xfs_ifree(tp, ip); |
30375 |
++ ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
30376 |
+ if (error) { |
30377 |
+ /* |
30378 |
+ * If we fail to free the inode, shut down. The cancel |
30379 |
+@@ -1756,7 +1777,6 @@ xfs_inactive_ifree( |
30380 |
+ xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); |
30381 |
+ } |
30382 |
+ xfs_trans_cancel(tp); |
30383 |
+- xfs_iunlock(ip, XFS_ILOCK_EXCL); |
30384 |
+ return error; |
30385 |
+ } |
30386 |
+ |
30387 |
+@@ -1774,7 +1794,6 @@ xfs_inactive_ifree( |
30388 |
+ xfs_notice(mp, "%s: xfs_trans_commit returned error %d", |
30389 |
+ __func__, error); |
30390 |
+ |
30391 |
+- xfs_iunlock(ip, XFS_ILOCK_EXCL); |
30392 |
+ return 0; |
30393 |
+ } |
30394 |
+ |
30395 |
+diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h |
30396 |
+index 4fc9a43ac45a8..aafd07388eb7b 100644 |
30397 |
+--- a/include/drm/drm_modeset_lock.h |
30398 |
++++ b/include/drm/drm_modeset_lock.h |
30399 |
+@@ -164,6 +164,8 @@ int drm_modeset_lock_all_ctx(struct drm_device *dev, |
30400 |
+ * is 0, so no error checking is necessary |
30401 |
+ */ |
30402 |
+ #define DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, flags, ret) \ |
30403 |
++ if (!drm_drv_uses_atomic_modeset(dev)) \ |
30404 |
++ mutex_lock(&dev->mode_config.mutex); \ |
30405 |
+ drm_modeset_acquire_init(&ctx, flags); \ |
30406 |
+ modeset_lock_retry: \ |
30407 |
+ ret = drm_modeset_lock_all_ctx(dev, &ctx); \ |
30408 |
+@@ -172,6 +174,7 @@ modeset_lock_retry: \ |
30409 |
+ |
30410 |
+ /** |
30411 |
+ * DRM_MODESET_LOCK_ALL_END - Helper to release and cleanup modeset locks |
30412 |
++ * @dev: drm device |
30413 |
+ * @ctx: local modeset acquire context, will be dereferenced |
30414 |
+ * @ret: local ret/err/etc variable to track error status |
30415 |
+ * |
30416 |
+@@ -188,7 +191,7 @@ modeset_lock_retry: \ |
30417 |
+ * to that failure. In both of these cases the code between BEGIN/END will not |
30418 |
+ * be run, so the failure will reflect the inability to grab the locks. |
30419 |
+ */ |
30420 |
+-#define DRM_MODESET_LOCK_ALL_END(ctx, ret) \ |
30421 |
++#define DRM_MODESET_LOCK_ALL_END(dev, ctx, ret) \ |
30422 |
+ modeset_lock_fail: \ |
30423 |
+ if (ret == -EDEADLK) { \ |
30424 |
+ ret = drm_modeset_backoff(&ctx); \ |
30425 |
+@@ -196,6 +199,8 @@ modeset_lock_fail: \ |
30426 |
+ goto modeset_lock_retry; \ |
30427 |
+ } \ |
30428 |
+ drm_modeset_drop_locks(&ctx); \ |
30429 |
+- drm_modeset_acquire_fini(&ctx); |
30430 |
++ drm_modeset_acquire_fini(&ctx); \ |
30431 |
++ if (!drm_drv_uses_atomic_modeset(dev)) \ |
30432 |
++ mutex_unlock(&dev->mode_config.mutex); |
30433 |
+ |
30434 |
+ #endif /* DRM_MODESET_LOCK_H_ */ |
30435 |
+diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h |
30436 |
+index ab2e20cba9514..ba22952c24e24 100644 |
30437 |
+--- a/include/linux/dma-direct.h |
30438 |
++++ b/include/linux/dma-direct.h |
30439 |
+@@ -67,9 +67,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size, |
30440 |
+ } |
30441 |
+ |
30442 |
+ u64 dma_direct_get_required_mask(struct device *dev); |
30443 |
+-gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, |
30444 |
+- u64 *phys_mask); |
30445 |
+-bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size); |
30446 |
+ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, |
30447 |
+ gfp_t gfp, unsigned long attrs); |
30448 |
+ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr, |
30449 |
+diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h |
30450 |
+index a33ed3954ed46..0dc08701d7b7e 100644 |
30451 |
+--- a/include/linux/dma-mapping.h |
30452 |
++++ b/include/linux/dma-mapping.h |
30453 |
+@@ -715,8 +715,9 @@ void *dma_common_pages_remap(struct page **pages, size_t size, |
30454 |
+ pgprot_t prot, const void *caller); |
30455 |
+ void dma_common_free_remap(void *cpu_addr, size_t size); |
30456 |
+ |
30457 |
+-void *dma_alloc_from_pool(struct device *dev, size_t size, |
30458 |
+- struct page **ret_page, gfp_t flags); |
30459 |
++struct page *dma_alloc_from_pool(struct device *dev, size_t size, |
30460 |
++ void **cpu_addr, gfp_t flags, |
30461 |
++ bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t)); |
30462 |
+ bool dma_free_from_pool(struct device *dev, void *start, size_t size); |
30463 |
+ |
30464 |
+ int |
30465 |
+diff --git a/include/linux/efi.h b/include/linux/efi.h |
30466 |
+index 05c47f857383e..73db1ae04cef8 100644 |
30467 |
+--- a/include/linux/efi.h |
30468 |
++++ b/include/linux/efi.h |
30469 |
+@@ -606,7 +606,11 @@ extern void *efi_get_pal_addr (void); |
30470 |
+ extern void efi_map_pal_code (void); |
30471 |
+ extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); |
30472 |
+ extern void efi_gettimeofday (struct timespec64 *ts); |
30473 |
++#ifdef CONFIG_EFI |
30474 |
+ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ |
30475 |
++#else |
30476 |
++static inline void efi_enter_virtual_mode (void) {} |
30477 |
++#endif |
30478 |
+ #ifdef CONFIG_X86 |
30479 |
+ extern efi_status_t efi_query_variable_store(u32 attributes, |
30480 |
+ unsigned long size, |
30481 |
+diff --git a/include/linux/fb.h b/include/linux/fb.h |
30482 |
+index 3b4b2f0c6994d..b11eb02cad6d3 100644 |
30483 |
+--- a/include/linux/fb.h |
30484 |
++++ b/include/linux/fb.h |
30485 |
+@@ -400,8 +400,6 @@ struct fb_tile_ops { |
30486 |
+ #define FBINFO_HWACCEL_YPAN 0x2000 /* optional */ |
30487 |
+ #define FBINFO_HWACCEL_YWRAP 0x4000 /* optional */ |
30488 |
+ |
30489 |
+-#define FBINFO_MISC_USEREVENT 0x10000 /* event request |
30490 |
+- from userspace */ |
30491 |
+ #define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ |
30492 |
+ |
30493 |
+ /* A driver may set this flag to indicate that it does want a set_par to be |
30494 |
+diff --git a/include/linux/fs.h b/include/linux/fs.h |
30495 |
+index 2dab217c6047f..ac1e89872db4f 100644 |
30496 |
+--- a/include/linux/fs.h |
30497 |
++++ b/include/linux/fs.h |
30498 |
+@@ -2168,6 +2168,10 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src, |
30499 |
+ * |
30500 |
+ * I_DONTCACHE Evict inode as soon as it is not used anymore. |
30501 |
+ * |
30502 |
++ * I_SYNC_QUEUED Inode is queued in b_io or b_more_io writeback lists. |
30503 |
++ * Used to detect that mark_inode_dirty() should not move |
30504 |
++ * inode between dirty lists. |
30505 |
++ * |
30506 |
+ * Q: What is the difference between I_WILL_FREE and I_FREEING? |
30507 |
+ */ |
30508 |
+ #define I_DIRTY_SYNC (1 << 0) |
30509 |
+@@ -2185,12 +2189,12 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src, |
30510 |
+ #define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP) |
30511 |
+ #define I_LINKABLE (1 << 10) |
30512 |
+ #define I_DIRTY_TIME (1 << 11) |
30513 |
+-#define __I_DIRTY_TIME_EXPIRED 12 |
30514 |
+-#define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED) |
30515 |
++#define I_DIRTY_TIME_EXPIRED (1 << 12) |
30516 |
+ #define I_WB_SWITCH (1 << 13) |
30517 |
+ #define I_OVL_INUSE (1 << 14) |
30518 |
+ #define I_CREATING (1 << 15) |
30519 |
+ #define I_DONTCACHE (1 << 16) |
30520 |
++#define I_SYNC_QUEUED (1 << 17) |
30521 |
+ |
30522 |
+ #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) |
30523 |
+ #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES) |
30524 |
+diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h |
30525 |
+index aac42c28fe62d..9b67394471e1c 100644 |
30526 |
+--- a/include/linux/netfilter_ipv6.h |
30527 |
++++ b/include/linux/netfilter_ipv6.h |
30528 |
+@@ -58,7 +58,6 @@ struct nf_ipv6_ops { |
30529 |
+ int (*output)(struct net *, struct sock *, struct sk_buff *)); |
30530 |
+ int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); |
30531 |
+ #if IS_MODULE(CONFIG_IPV6) |
30532 |
+- int (*br_defrag)(struct net *net, struct sk_buff *skb, u32 user); |
30533 |
+ int (*br_fragment)(struct net *net, struct sock *sk, |
30534 |
+ struct sk_buff *skb, |
30535 |
+ struct nf_bridge_frag_data *data, |
30536 |
+@@ -117,23 +116,6 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, |
30537 |
+ |
30538 |
+ #include <net/netfilter/ipv6/nf_defrag_ipv6.h> |
30539 |
+ |
30540 |
+-static inline int nf_ipv6_br_defrag(struct net *net, struct sk_buff *skb, |
30541 |
+- u32 user) |
30542 |
+-{ |
30543 |
+-#if IS_MODULE(CONFIG_IPV6) |
30544 |
+- const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); |
30545 |
+- |
30546 |
+- if (!v6_ops) |
30547 |
+- return 1; |
30548 |
+- |
30549 |
+- return v6_ops->br_defrag(net, skb, user); |
30550 |
+-#elif IS_BUILTIN(CONFIG_IPV6) |
30551 |
+- return nf_ct_frag6_gather(net, skb, user); |
30552 |
+-#else |
30553 |
+- return 1; |
30554 |
+-#endif |
30555 |
+-} |
30556 |
+- |
30557 |
+ int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, |
30558 |
+ struct nf_bridge_frag_data *data, |
30559 |
+ int (*output)(struct net *, struct sock *sk, |
30560 |
+diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h |
30561 |
+index cc41d692ae8ed..628db6a07fda0 100644 |
30562 |
+--- a/include/trace/events/ext4.h |
30563 |
++++ b/include/trace/events/ext4.h |
30564 |
+@@ -746,24 +746,29 @@ TRACE_EVENT(ext4_mb_release_group_pa, |
30565 |
+ ); |
30566 |
+ |
30567 |
+ TRACE_EVENT(ext4_discard_preallocations, |
30568 |
+- TP_PROTO(struct inode *inode), |
30569 |
++ TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed), |
30570 |
+ |
30571 |
+- TP_ARGS(inode), |
30572 |
++ TP_ARGS(inode, len, needed), |
30573 |
+ |
30574 |
+ TP_STRUCT__entry( |
30575 |
+- __field( dev_t, dev ) |
30576 |
+- __field( ino_t, ino ) |
30577 |
++ __field( dev_t, dev ) |
30578 |
++ __field( ino_t, ino ) |
30579 |
++ __field( unsigned int, len ) |
30580 |
++ __field( unsigned int, needed ) |
30581 |
+ |
30582 |
+ ), |
30583 |
+ |
30584 |
+ TP_fast_assign( |
30585 |
+ __entry->dev = inode->i_sb->s_dev; |
30586 |
+ __entry->ino = inode->i_ino; |
30587 |
++ __entry->len = len; |
30588 |
++ __entry->needed = needed; |
30589 |
+ ), |
30590 |
+ |
30591 |
+- TP_printk("dev %d,%d ino %lu", |
30592 |
++ TP_printk("dev %d,%d ino %lu len: %u needed %u", |
30593 |
+ MAJOR(__entry->dev), MINOR(__entry->dev), |
30594 |
+- (unsigned long) __entry->ino) |
30595 |
++ (unsigned long) __entry->ino, __entry->len, |
30596 |
++ __entry->needed) |
30597 |
+ ); |
30598 |
+ |
30599 |
+ TRACE_EVENT(ext4_mb_discard_preallocations, |
30600 |
+diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h |
30601 |
+index 10f5d1fa73476..7565dcd596973 100644 |
30602 |
+--- a/include/trace/events/writeback.h |
30603 |
++++ b/include/trace/events/writeback.h |
30604 |
+@@ -498,8 +498,9 @@ DEFINE_WBC_EVENT(wbc_writepage); |
30605 |
+ TRACE_EVENT(writeback_queue_io, |
30606 |
+ TP_PROTO(struct bdi_writeback *wb, |
30607 |
+ struct wb_writeback_work *work, |
30608 |
++ unsigned long dirtied_before, |
30609 |
+ int moved), |
30610 |
+- TP_ARGS(wb, work, moved), |
30611 |
++ TP_ARGS(wb, work, dirtied_before, moved), |
30612 |
+ TP_STRUCT__entry( |
30613 |
+ __array(char, name, 32) |
30614 |
+ __field(unsigned long, older) |
30615 |
+@@ -509,19 +510,17 @@ TRACE_EVENT(writeback_queue_io, |
30616 |
+ __field(ino_t, cgroup_ino) |
30617 |
+ ), |
30618 |
+ TP_fast_assign( |
30619 |
+- unsigned long *older_than_this = work->older_than_this; |
30620 |
+ strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); |
30621 |
+- __entry->older = older_than_this ? *older_than_this : 0; |
30622 |
+- __entry->age = older_than_this ? |
30623 |
+- (jiffies - *older_than_this) * 1000 / HZ : -1; |
30624 |
++ __entry->older = dirtied_before; |
30625 |
++ __entry->age = (jiffies - dirtied_before) * 1000 / HZ; |
30626 |
+ __entry->moved = moved; |
30627 |
+ __entry->reason = work->reason; |
30628 |
+ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
30629 |
+ ), |
30630 |
+ TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%lu", |
30631 |
+ __entry->name, |
30632 |
+- __entry->older, /* older_than_this in jiffies */ |
30633 |
+- __entry->age, /* older_than_this in relative milliseconds */ |
30634 |
++ __entry->older, /* dirtied_before in jiffies */ |
30635 |
++ __entry->age, /* dirtied_before in relative milliseconds */ |
30636 |
+ __entry->moved, |
30637 |
+ __print_symbolic(__entry->reason, WB_WORK_REASON), |
30638 |
+ (unsigned long)__entry->cgroup_ino |
30639 |
+diff --git a/kernel/Makefile b/kernel/Makefile |
30640 |
+index f3218bc5ec69f..155b5380500ad 100644 |
30641 |
+--- a/kernel/Makefile |
30642 |
++++ b/kernel/Makefile |
30643 |
+@@ -125,6 +125,7 @@ obj-$(CONFIG_WATCH_QUEUE) += watch_queue.o |
30644 |
+ |
30645 |
+ obj-$(CONFIG_SYSCTL_KUNIT_TEST) += sysctl-test.o |
30646 |
+ |
30647 |
++CFLAGS_stackleak.o += $(DISABLE_STACKLEAK_PLUGIN) |
30648 |
+ obj-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak.o |
30649 |
+ KASAN_SANITIZE_stackleak.o := n |
30650 |
+ KCSAN_SANITIZE_stackleak.o := n |
30651 |
+diff --git a/kernel/bpf/bpf_iter.c b/kernel/bpf/bpf_iter.c |
30652 |
+index dd612b80b9fea..3c18090cd73dc 100644 |
30653 |
+--- a/kernel/bpf/bpf_iter.c |
30654 |
++++ b/kernel/bpf/bpf_iter.c |
30655 |
+@@ -64,6 +64,9 @@ static void bpf_iter_done_stop(struct seq_file *seq) |
30656 |
+ iter_priv->done_stop = true; |
30657 |
+ } |
30658 |
+ |
30659 |
++/* maximum visited objects before bailing out */ |
30660 |
++#define MAX_ITER_OBJECTS 1000000 |
30661 |
++ |
30662 |
+ /* bpf_seq_read, a customized and simpler version for bpf iterator. |
30663 |
+ * no_llseek is assumed for this file. |
30664 |
+ * The following are differences from seq_read(): |
30665 |
+@@ -76,7 +79,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size, |
30666 |
+ { |
30667 |
+ struct seq_file *seq = file->private_data; |
30668 |
+ size_t n, offs, copied = 0; |
30669 |
+- int err = 0; |
30670 |
++ int err = 0, num_objs = 0; |
30671 |
+ void *p; |
30672 |
+ |
30673 |
+ mutex_lock(&seq->lock); |
30674 |
+@@ -132,6 +135,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size, |
30675 |
+ while (1) { |
30676 |
+ loff_t pos = seq->index; |
30677 |
+ |
30678 |
++ num_objs++; |
30679 |
+ offs = seq->count; |
30680 |
+ p = seq->op->next(seq, p, &seq->index); |
30681 |
+ if (pos == seq->index) { |
30682 |
+@@ -150,6 +154,15 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size, |
30683 |
+ if (seq->count >= size) |
30684 |
+ break; |
30685 |
+ |
30686 |
++ if (num_objs >= MAX_ITER_OBJECTS) { |
30687 |
++ if (offs == 0) { |
30688 |
++ err = -EAGAIN; |
30689 |
++ seq->op->stop(seq, p); |
30690 |
++ goto done; |
30691 |
++ } |
30692 |
++ break; |
30693 |
++ } |
30694 |
++ |
30695 |
+ err = seq->op->show(seq, p); |
30696 |
+ if (err > 0) { |
30697 |
+ bpf_iter_dec_seq_num(seq); |
30698 |
+diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c |
30699 |
+index a4a0fb4f94cc1..323def936be24 100644 |
30700 |
+--- a/kernel/bpf/task_iter.c |
30701 |
++++ b/kernel/bpf/task_iter.c |
30702 |
+@@ -28,8 +28,9 @@ static struct task_struct *task_seq_get_next(struct pid_namespace *ns, |
30703 |
+ |
30704 |
+ rcu_read_lock(); |
30705 |
+ retry: |
30706 |
+- pid = idr_get_next(&ns->idr, tid); |
30707 |
++ pid = find_ge_pid(*tid, ns); |
30708 |
+ if (pid) { |
30709 |
++ *tid = pid_nr_ns(pid, ns); |
30710 |
+ task = get_pid_task(pid, PIDTYPE_PID); |
30711 |
+ if (!task) { |
30712 |
+ ++*tid; |
30713 |
+diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c |
30714 |
+index 67f060b86a73f..f17aec9d01f0c 100644 |
30715 |
+--- a/kernel/dma/direct.c |
30716 |
++++ b/kernel/dma/direct.c |
30717 |
+@@ -45,7 +45,7 @@ u64 dma_direct_get_required_mask(struct device *dev) |
30718 |
+ return (1ULL << (fls64(max_dma) - 1)) * 2 - 1; |
30719 |
+ } |
30720 |
+ |
30721 |
+-gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, |
30722 |
++static gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, |
30723 |
+ u64 *phys_limit) |
30724 |
+ { |
30725 |
+ u64 dma_limit = min_not_zero(dma_mask, dev->bus_dma_limit); |
30726 |
+@@ -70,7 +70,7 @@ gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, |
30727 |
+ return 0; |
30728 |
+ } |
30729 |
+ |
30730 |
+-bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size) |
30731 |
++static bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size) |
30732 |
+ { |
30733 |
+ return phys_to_dma_direct(dev, phys) + size - 1 <= |
30734 |
+ min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit); |
30735 |
+@@ -163,8 +163,13 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, |
30736 |
+ size = PAGE_ALIGN(size); |
30737 |
+ |
30738 |
+ if (dma_should_alloc_from_pool(dev, gfp, attrs)) { |
30739 |
+- ret = dma_alloc_from_pool(dev, size, &page, gfp); |
30740 |
+- if (!ret) |
30741 |
++ u64 phys_mask; |
30742 |
++ |
30743 |
++ gfp |= dma_direct_optimal_gfp_mask(dev, dev->coherent_dma_mask, |
30744 |
++ &phys_mask); |
30745 |
++ page = dma_alloc_from_pool(dev, size, &ret, gfp, |
30746 |
++ dma_coherent_ok); |
30747 |
++ if (!page) |
30748 |
+ return NULL; |
30749 |
+ goto done; |
30750 |
+ } |
30751 |
+diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c |
30752 |
+index 6bc74a2d51273..1281c0f0442bc 100644 |
30753 |
+--- a/kernel/dma/pool.c |
30754 |
++++ b/kernel/dma/pool.c |
30755 |
+@@ -3,7 +3,9 @@ |
30756 |
+ * Copyright (C) 2012 ARM Ltd. |
30757 |
+ * Copyright (C) 2020 Google LLC |
30758 |
+ */ |
30759 |
++#include <linux/cma.h> |
30760 |
+ #include <linux/debugfs.h> |
30761 |
++#include <linux/dma-contiguous.h> |
30762 |
+ #include <linux/dma-direct.h> |
30763 |
+ #include <linux/dma-noncoherent.h> |
30764 |
+ #include <linux/init.h> |
30765 |
+@@ -55,11 +57,34 @@ static void dma_atomic_pool_size_add(gfp_t gfp, size_t size) |
30766 |
+ pool_size_kernel += size; |
30767 |
+ } |
30768 |
+ |
30769 |
++static bool cma_in_zone(gfp_t gfp) |
30770 |
++{ |
30771 |
++ unsigned long size; |
30772 |
++ phys_addr_t end; |
30773 |
++ struct cma *cma; |
30774 |
++ |
30775 |
++ cma = dev_get_cma_area(NULL); |
30776 |
++ if (!cma) |
30777 |
++ return false; |
30778 |
++ |
30779 |
++ size = cma_get_size(cma); |
30780 |
++ if (!size) |
30781 |
++ return false; |
30782 |
++ |
30783 |
++ /* CMA can't cross zone boundaries, see cma_activate_area() */ |
30784 |
++ end = cma_get_base(cma) + size - 1; |
30785 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA)) |
30786 |
++ return end <= DMA_BIT_MASK(zone_dma_bits); |
30787 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32)) |
30788 |
++ return end <= DMA_BIT_MASK(32); |
30789 |
++ return true; |
30790 |
++} |
30791 |
++ |
30792 |
+ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, |
30793 |
+ gfp_t gfp) |
30794 |
+ { |
30795 |
+ unsigned int order; |
30796 |
+- struct page *page; |
30797 |
++ struct page *page = NULL; |
30798 |
+ void *addr; |
30799 |
+ int ret = -ENOMEM; |
30800 |
+ |
30801 |
+@@ -68,7 +93,11 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, |
30802 |
+ |
30803 |
+ do { |
30804 |
+ pool_size = 1 << (PAGE_SHIFT + order); |
30805 |
+- page = alloc_pages(gfp, order); |
30806 |
++ if (cma_in_zone(gfp)) |
30807 |
++ page = dma_alloc_from_contiguous(NULL, 1 << order, |
30808 |
++ order, false); |
30809 |
++ if (!page) |
30810 |
++ page = alloc_pages(gfp, order); |
30811 |
+ } while (!page && order-- > 0); |
30812 |
+ if (!page) |
30813 |
+ goto out; |
30814 |
+@@ -196,93 +225,75 @@ static int __init dma_atomic_pool_init(void) |
30815 |
+ } |
30816 |
+ postcore_initcall(dma_atomic_pool_init); |
30817 |
+ |
30818 |
+-static inline struct gen_pool *dma_guess_pool_from_device(struct device *dev) |
30819 |
++static inline struct gen_pool *dma_guess_pool(struct gen_pool *prev, gfp_t gfp) |
30820 |
+ { |
30821 |
+- u64 phys_mask; |
30822 |
+- gfp_t gfp; |
30823 |
+- |
30824 |
+- gfp = dma_direct_optimal_gfp_mask(dev, dev->coherent_dma_mask, |
30825 |
+- &phys_mask); |
30826 |
+- if (IS_ENABLED(CONFIG_ZONE_DMA) && gfp == GFP_DMA) |
30827 |
++ if (prev == NULL) { |
30828 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32)) |
30829 |
++ return atomic_pool_dma32; |
30830 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA)) |
30831 |
++ return atomic_pool_dma; |
30832 |
++ return atomic_pool_kernel; |
30833 |
++ } |
30834 |
++ if (prev == atomic_pool_kernel) |
30835 |
++ return atomic_pool_dma32 ? atomic_pool_dma32 : atomic_pool_dma; |
30836 |
++ if (prev == atomic_pool_dma32) |
30837 |
+ return atomic_pool_dma; |
30838 |
+- if (IS_ENABLED(CONFIG_ZONE_DMA32) && gfp == GFP_DMA32) |
30839 |
+- return atomic_pool_dma32; |
30840 |
+- return atomic_pool_kernel; |
30841 |
++ return NULL; |
30842 |
+ } |
30843 |
+ |
30844 |
+-static inline struct gen_pool *dma_get_safer_pool(struct gen_pool *bad_pool) |
30845 |
++static struct page *__dma_alloc_from_pool(struct device *dev, size_t size, |
30846 |
++ struct gen_pool *pool, void **cpu_addr, |
30847 |
++ bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t)) |
30848 |
+ { |
30849 |
+- if (bad_pool == atomic_pool_kernel) |
30850 |
+- return atomic_pool_dma32 ? : atomic_pool_dma; |
30851 |
++ unsigned long addr; |
30852 |
++ phys_addr_t phys; |
30853 |
+ |
30854 |
+- if (bad_pool == atomic_pool_dma32) |
30855 |
+- return atomic_pool_dma; |
30856 |
++ addr = gen_pool_alloc(pool, size); |
30857 |
++ if (!addr) |
30858 |
++ return NULL; |
30859 |
+ |
30860 |
+- return NULL; |
30861 |
+-} |
30862 |
++ phys = gen_pool_virt_to_phys(pool, addr); |
30863 |
++ if (phys_addr_ok && !phys_addr_ok(dev, phys, size)) { |
30864 |
++ gen_pool_free(pool, addr, size); |
30865 |
++ return NULL; |
30866 |
++ } |
30867 |
+ |
30868 |
+-static inline struct gen_pool *dma_guess_pool(struct device *dev, |
30869 |
+- struct gen_pool *bad_pool) |
30870 |
+-{ |
30871 |
+- if (bad_pool) |
30872 |
+- return dma_get_safer_pool(bad_pool); |
30873 |
++ if (gen_pool_avail(pool) < atomic_pool_size) |
30874 |
++ schedule_work(&atomic_pool_work); |
30875 |
+ |
30876 |
+- return dma_guess_pool_from_device(dev); |
30877 |
++ *cpu_addr = (void *)addr; |
30878 |
++ memset(*cpu_addr, 0, size); |
30879 |
++ return pfn_to_page(__phys_to_pfn(phys)); |
30880 |
+ } |
30881 |
+ |
30882 |
+-void *dma_alloc_from_pool(struct device *dev, size_t size, |
30883 |
+- struct page **ret_page, gfp_t flags) |
30884 |
++struct page *dma_alloc_from_pool(struct device *dev, size_t size, |
30885 |
++ void **cpu_addr, gfp_t gfp, |
30886 |
++ bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t)) |
30887 |
+ { |
30888 |
+ struct gen_pool *pool = NULL; |
30889 |
+- unsigned long val = 0; |
30890 |
+- void *ptr = NULL; |
30891 |
+- phys_addr_t phys; |
30892 |
+- |
30893 |
+- while (1) { |
30894 |
+- pool = dma_guess_pool(dev, pool); |
30895 |
+- if (!pool) { |
30896 |
+- WARN(1, "Failed to get suitable pool for %s\n", |
30897 |
+- dev_name(dev)); |
30898 |
+- break; |
30899 |
+- } |
30900 |
+- |
30901 |
+- val = gen_pool_alloc(pool, size); |
30902 |
+- if (!val) |
30903 |
+- continue; |
30904 |
+- |
30905 |
+- phys = gen_pool_virt_to_phys(pool, val); |
30906 |
+- if (dma_coherent_ok(dev, phys, size)) |
30907 |
+- break; |
30908 |
+- |
30909 |
+- gen_pool_free(pool, val, size); |
30910 |
+- val = 0; |
30911 |
+- } |
30912 |
+- |
30913 |
+- |
30914 |
+- if (val) { |
30915 |
+- *ret_page = pfn_to_page(__phys_to_pfn(phys)); |
30916 |
+- ptr = (void *)val; |
30917 |
+- memset(ptr, 0, size); |
30918 |
++ struct page *page; |
30919 |
+ |
30920 |
+- if (gen_pool_avail(pool) < atomic_pool_size) |
30921 |
+- schedule_work(&atomic_pool_work); |
30922 |
++ while ((pool = dma_guess_pool(pool, gfp))) { |
30923 |
++ page = __dma_alloc_from_pool(dev, size, pool, cpu_addr, |
30924 |
++ phys_addr_ok); |
30925 |
++ if (page) |
30926 |
++ return page; |
30927 |
+ } |
30928 |
+ |
30929 |
+- return ptr; |
30930 |
++ WARN(1, "Failed to get suitable pool for %s\n", dev_name(dev)); |
30931 |
++ return NULL; |
30932 |
+ } |
30933 |
+ |
30934 |
+ bool dma_free_from_pool(struct device *dev, void *start, size_t size) |
30935 |
+ { |
30936 |
+ struct gen_pool *pool = NULL; |
30937 |
+ |
30938 |
+- while (1) { |
30939 |
+- pool = dma_guess_pool(dev, pool); |
30940 |
+- if (!pool) |
30941 |
+- return false; |
30942 |
+- |
30943 |
+- if (gen_pool_has_addr(pool, (unsigned long)start, size)) { |
30944 |
+- gen_pool_free(pool, (unsigned long)start, size); |
30945 |
+- return true; |
30946 |
+- } |
30947 |
++ while ((pool = dma_guess_pool(pool, 0))) { |
30948 |
++ if (!gen_pool_has_addr(pool, (unsigned long)start, size)) |
30949 |
++ continue; |
30950 |
++ gen_pool_free(pool, (unsigned long)start, size); |
30951 |
++ return true; |
30952 |
+ } |
30953 |
++ |
30954 |
++ return false; |
30955 |
+ } |
30956 |
+diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c |
30957 |
+index 30cc217b86318..651a4ad6d711f 100644 |
30958 |
+--- a/kernel/irq/matrix.c |
30959 |
++++ b/kernel/irq/matrix.c |
30960 |
+@@ -380,6 +380,13 @@ int irq_matrix_alloc(struct irq_matrix *m, const struct cpumask *msk, |
30961 |
+ unsigned int cpu, bit; |
30962 |
+ struct cpumap *cm; |
30963 |
+ |
30964 |
++ /* |
30965 |
++ * Not required in theory, but matrix_find_best_cpu() uses |
30966 |
++ * for_each_cpu() which ignores the cpumask on UP . |
30967 |
++ */ |
30968 |
++ if (cpumask_empty(msk)) |
30969 |
++ return -EINVAL; |
30970 |
++ |
30971 |
+ cpu = matrix_find_best_cpu(m, msk); |
30972 |
+ if (cpu == UINT_MAX) |
30973 |
+ return -ENOSPC; |
30974 |
+diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c |
30975 |
+index 5525cd3ba0c83..02ef87f50df29 100644 |
30976 |
+--- a/kernel/locking/lockdep_proc.c |
30977 |
++++ b/kernel/locking/lockdep_proc.c |
30978 |
+@@ -423,7 +423,7 @@ static void seq_lock_time(struct seq_file *m, struct lock_time *lt) |
30979 |
+ seq_time(m, lt->min); |
30980 |
+ seq_time(m, lt->max); |
30981 |
+ seq_time(m, lt->total); |
30982 |
+- seq_time(m, lt->nr ? div_s64(lt->total, lt->nr) : 0); |
30983 |
++ seq_time(m, lt->nr ? div64_u64(lt->total, lt->nr) : 0); |
30984 |
+ } |
30985 |
+ |
30986 |
+ static void seq_stats(struct seq_file *m, struct lock_stat_data *data) |
30987 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
30988 |
+index 588e8e3960197..1bd6563939e59 100644 |
30989 |
+--- a/kernel/trace/blktrace.c |
30990 |
++++ b/kernel/trace/blktrace.c |
30991 |
+@@ -536,6 +536,18 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
30992 |
+ #endif |
30993 |
+ bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); |
30994 |
+ |
30995 |
++ /* |
30996 |
++ * As blktrace relies on debugfs for its interface the debugfs directory |
30997 |
++ * is required, contrary to the usual mantra of not checking for debugfs |
30998 |
++ * files or directories. |
30999 |
++ */ |
31000 |
++ if (IS_ERR_OR_NULL(dir)) { |
31001 |
++ pr_warn("debugfs_dir not present for %s so skipping\n", |
31002 |
++ buts->name); |
31003 |
++ ret = -ENOENT; |
31004 |
++ goto err; |
31005 |
++ } |
31006 |
++ |
31007 |
+ bt->dev = dev; |
31008 |
+ atomic_set(&bt->dropped, 0); |
31009 |
+ INIT_LIST_HEAD(&bt->running_list); |
31010 |
+diff --git a/mm/khugepaged.c b/mm/khugepaged.c |
31011 |
+index 1d6a9b0b6a9fd..dd592ea9a4a06 100644 |
31012 |
+--- a/mm/khugepaged.c |
31013 |
++++ b/mm/khugepaged.c |
31014 |
+@@ -431,7 +431,7 @@ static void insert_to_mm_slots_hash(struct mm_struct *mm, |
31015 |
+ |
31016 |
+ static inline int khugepaged_test_exit(struct mm_struct *mm) |
31017 |
+ { |
31018 |
+- return atomic_read(&mm->mm_users) == 0; |
31019 |
++ return atomic_read(&mm->mm_users) == 0 || !mmget_still_valid(mm); |
31020 |
+ } |
31021 |
+ |
31022 |
+ static bool hugepage_vma_check(struct vm_area_struct *vma, |
31023 |
+@@ -1100,9 +1100,6 @@ static void collapse_huge_page(struct mm_struct *mm, |
31024 |
+ * handled by the anon_vma lock + PG_lock. |
31025 |
+ */ |
31026 |
+ mmap_write_lock(mm); |
31027 |
+- result = SCAN_ANY_PROCESS; |
31028 |
+- if (!mmget_still_valid(mm)) |
31029 |
+- goto out; |
31030 |
+ result = hugepage_vma_revalidate(mm, address, &vma); |
31031 |
+ if (result) |
31032 |
+ goto out; |
31033 |
+diff --git a/mm/page_counter.c b/mm/page_counter.c |
31034 |
+index b4663844c9b37..afe22ad335ccc 100644 |
31035 |
+--- a/mm/page_counter.c |
31036 |
++++ b/mm/page_counter.c |
31037 |
+@@ -77,8 +77,8 @@ void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) |
31038 |
+ * This is indeed racy, but we can live with some |
31039 |
+ * inaccuracy in the watermark. |
31040 |
+ */ |
31041 |
+- if (new > c->watermark) |
31042 |
+- c->watermark = new; |
31043 |
++ if (new > READ_ONCE(c->watermark)) |
31044 |
++ WRITE_ONCE(c->watermark, new); |
31045 |
+ } |
31046 |
+ } |
31047 |
+ |
31048 |
+@@ -119,9 +119,10 @@ bool page_counter_try_charge(struct page_counter *counter, |
31049 |
+ propagate_protected_usage(c, new); |
31050 |
+ /* |
31051 |
+ * This is racy, but we can live with some |
31052 |
+- * inaccuracy in the failcnt. |
31053 |
++ * inaccuracy in the failcnt which is only used |
31054 |
++ * to report stats. |
31055 |
+ */ |
31056 |
+- c->failcnt++; |
31057 |
++ data_race(c->failcnt++); |
31058 |
+ *fail = c; |
31059 |
+ goto failed; |
31060 |
+ } |
31061 |
+@@ -130,8 +131,8 @@ bool page_counter_try_charge(struct page_counter *counter, |
31062 |
+ * Just like with failcnt, we can live with some |
31063 |
+ * inaccuracy in the watermark. |
31064 |
+ */ |
31065 |
+- if (new > c->watermark) |
31066 |
+- c->watermark = new; |
31067 |
++ if (new > READ_ONCE(c->watermark)) |
31068 |
++ WRITE_ONCE(c->watermark, new); |
31069 |
+ } |
31070 |
+ return true; |
31071 |
+ |
31072 |
+diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c |
31073 |
+index 8096732223828..8d033a75a766e 100644 |
31074 |
+--- a/net/bridge/netfilter/nf_conntrack_bridge.c |
31075 |
++++ b/net/bridge/netfilter/nf_conntrack_bridge.c |
31076 |
+@@ -168,6 +168,7 @@ static unsigned int nf_ct_br_defrag4(struct sk_buff *skb, |
31077 |
+ static unsigned int nf_ct_br_defrag6(struct sk_buff *skb, |
31078 |
+ const struct nf_hook_state *state) |
31079 |
+ { |
31080 |
++#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) |
31081 |
+ u16 zone_id = NF_CT_DEFAULT_ZONE_ID; |
31082 |
+ enum ip_conntrack_info ctinfo; |
31083 |
+ struct br_input_skb_cb cb; |
31084 |
+@@ -180,14 +181,17 @@ static unsigned int nf_ct_br_defrag6(struct sk_buff *skb, |
31085 |
+ |
31086 |
+ br_skb_cb_save(skb, &cb, sizeof(struct inet6_skb_parm)); |
31087 |
+ |
31088 |
+- err = nf_ipv6_br_defrag(state->net, skb, |
31089 |
+- IP_DEFRAG_CONNTRACK_BRIDGE_IN + zone_id); |
31090 |
++ err = nf_ct_frag6_gather(state->net, skb, |
31091 |
++ IP_DEFRAG_CONNTRACK_BRIDGE_IN + zone_id); |
31092 |
+ /* queued */ |
31093 |
+ if (err == -EINPROGRESS) |
31094 |
+ return NF_STOLEN; |
31095 |
+ |
31096 |
+ br_skb_cb_restore(skb, &cb, IP6CB(skb)->frag_max_size); |
31097 |
+ return err == 0 ? NF_ACCEPT : NF_DROP; |
31098 |
++#else |
31099 |
++ return NF_ACCEPT; |
31100 |
++#endif |
31101 |
+ } |
31102 |
+ |
31103 |
+ static int nf_ct_br_ip_check(const struct sk_buff *skb) |
31104 |
+diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c |
31105 |
+index dbd215cbc53d8..a8dd956b5e8e1 100644 |
31106 |
+--- a/net/can/j1939/transport.c |
31107 |
++++ b/net/can/j1939/transport.c |
31108 |
+@@ -1803,7 +1803,20 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session, |
31109 |
+ } |
31110 |
+ |
31111 |
+ tpdat = se_skb->data; |
31112 |
+- memcpy(&tpdat[offset], &dat[1], nbytes); |
31113 |
++ if (!session->transmission) { |
31114 |
++ memcpy(&tpdat[offset], &dat[1], nbytes); |
31115 |
++ } else { |
31116 |
++ int err; |
31117 |
++ |
31118 |
++ err = memcmp(&tpdat[offset], &dat[1], nbytes); |
31119 |
++ if (err) |
31120 |
++ netdev_err_once(priv->ndev, |
31121 |
++ "%s: 0x%p: Data of RX-looped back packet (%*ph) doesn't match TX data (%*ph)!\n", |
31122 |
++ __func__, session, |
31123 |
++ nbytes, &dat[1], |
31124 |
++ nbytes, &tpdat[offset]); |
31125 |
++ } |
31126 |
++ |
31127 |
+ if (packet == session->pkt.rx) |
31128 |
+ session->pkt.rx++; |
31129 |
+ |
31130 |
+diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c |
31131 |
+index 409e79b84a830..6d0e942d082d4 100644 |
31132 |
+--- a/net/ipv6/netfilter.c |
31133 |
++++ b/net/ipv6/netfilter.c |
31134 |
+@@ -245,9 +245,6 @@ static const struct nf_ipv6_ops ipv6ops = { |
31135 |
+ .route_input = ip6_route_input, |
31136 |
+ .fragment = ip6_fragment, |
31137 |
+ .reroute = nf_ip6_reroute, |
31138 |
+-#if IS_MODULE(CONFIG_IPV6) && IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) |
31139 |
+- .br_defrag = nf_ct_frag6_gather, |
31140 |
+-#endif |
31141 |
+ #if IS_MODULE(CONFIG_IPV6) |
31142 |
+ .br_fragment = br_ip6_fragment, |
31143 |
+ #endif |
31144 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
31145 |
+index 88325b264737f..d31832d32e028 100644 |
31146 |
+--- a/net/netfilter/nf_tables_api.c |
31147 |
++++ b/net/netfilter/nf_tables_api.c |
31148 |
+@@ -2037,7 +2037,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, |
31149 |
+ |
31150 |
+ if (nla[NFTA_CHAIN_HOOK]) { |
31151 |
+ if (!nft_is_base_chain(chain)) |
31152 |
+- return -EBUSY; |
31153 |
++ return -EEXIST; |
31154 |
+ |
31155 |
+ err = nft_chain_parse_hook(ctx->net, nla, &hook, ctx->family, |
31156 |
+ false); |
31157 |
+@@ -2047,21 +2047,21 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, |
31158 |
+ basechain = nft_base_chain(chain); |
31159 |
+ if (basechain->type != hook.type) { |
31160 |
+ nft_chain_release_hook(&hook); |
31161 |
+- return -EBUSY; |
31162 |
++ return -EEXIST; |
31163 |
+ } |
31164 |
+ |
31165 |
+ if (ctx->family == NFPROTO_NETDEV) { |
31166 |
+ if (!nft_hook_list_equal(&basechain->hook_list, |
31167 |
+ &hook.list)) { |
31168 |
+ nft_chain_release_hook(&hook); |
31169 |
+- return -EBUSY; |
31170 |
++ return -EEXIST; |
31171 |
+ } |
31172 |
+ } else { |
31173 |
+ ops = &basechain->ops; |
31174 |
+ if (ops->hooknum != hook.num || |
31175 |
+ ops->priority != hook.priority) { |
31176 |
+ nft_chain_release_hook(&hook); |
31177 |
+- return -EBUSY; |
31178 |
++ return -EEXIST; |
31179 |
+ } |
31180 |
+ } |
31181 |
+ nft_chain_release_hook(&hook); |
31182 |
+@@ -5160,10 +5160,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, |
31183 |
+ if (nft_set_ext_exists(ext, NFT_SET_EXT_DATA) ^ |
31184 |
+ nft_set_ext_exists(ext2, NFT_SET_EXT_DATA) || |
31185 |
+ nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF) ^ |
31186 |
+- nft_set_ext_exists(ext2, NFT_SET_EXT_OBJREF)) { |
31187 |
+- err = -EBUSY; |
31188 |
++ nft_set_ext_exists(ext2, NFT_SET_EXT_OBJREF)) |
31189 |
+ goto err_element_clash; |
31190 |
+- } |
31191 |
+ if ((nft_set_ext_exists(ext, NFT_SET_EXT_DATA) && |
31192 |
+ nft_set_ext_exists(ext2, NFT_SET_EXT_DATA) && |
31193 |
+ memcmp(nft_set_ext_data(ext), |
31194 |
+@@ -5171,7 +5169,7 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, |
31195 |
+ (nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF) && |
31196 |
+ nft_set_ext_exists(ext2, NFT_SET_EXT_OBJREF) && |
31197 |
+ *nft_set_ext_obj(ext) != *nft_set_ext_obj(ext2))) |
31198 |
+- err = -EBUSY; |
31199 |
++ goto err_element_clash; |
31200 |
+ else if (!(nlmsg_flags & NLM_F_EXCL)) |
31201 |
+ err = 0; |
31202 |
+ } else if (err == -ENOTEMPTY) { |
31203 |
+@@ -6308,7 +6306,7 @@ static int nft_register_flowtable_net_hooks(struct net *net, |
31204 |
+ list_for_each_entry(hook2, &ft->hook_list, list) { |
31205 |
+ if (hook->ops.dev == hook2->ops.dev && |
31206 |
+ hook->ops.pf == hook2->ops.pf) { |
31207 |
+- err = -EBUSY; |
31208 |
++ err = -EEXIST; |
31209 |
+ goto err_unregister_net_hooks; |
31210 |
+ } |
31211 |
+ } |
31212 |
+diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c |
31213 |
+index 94b024534987a..03b81aa99975b 100644 |
31214 |
+--- a/net/openvswitch/datapath.c |
31215 |
++++ b/net/openvswitch/datapath.c |
31216 |
+@@ -1736,6 +1736,7 @@ err: |
31217 |
+ /* Called with ovs_mutex. */ |
31218 |
+ static void __dp_destroy(struct datapath *dp) |
31219 |
+ { |
31220 |
++ struct flow_table *table = &dp->table; |
31221 |
+ int i; |
31222 |
+ |
31223 |
+ for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) { |
31224 |
+@@ -1754,7 +1755,14 @@ static void __dp_destroy(struct datapath *dp) |
31225 |
+ */ |
31226 |
+ ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL)); |
31227 |
+ |
31228 |
+- /* RCU destroy the flow table */ |
31229 |
++ /* Flush sw_flow in the tables. RCU cb only releases resource |
31230 |
++ * such as dp, ports and tables. That may avoid some issues |
31231 |
++ * such as RCU usage warning. |
31232 |
++ */ |
31233 |
++ table_instance_flow_flush(table, ovsl_dereference(table->ti), |
31234 |
++ ovsl_dereference(table->ufid_ti)); |
31235 |
++ |
31236 |
++ /* RCU destroy the ports, meters and flow tables. */ |
31237 |
+ call_rcu(&dp->rcu, destroy_dp_rcu); |
31238 |
+ } |
31239 |
+ |
31240 |
+diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c |
31241 |
+index 2398d72383005..f198bbb0c517a 100644 |
31242 |
+--- a/net/openvswitch/flow_table.c |
31243 |
++++ b/net/openvswitch/flow_table.c |
31244 |
+@@ -345,19 +345,15 @@ static void table_instance_flow_free(struct flow_table *table, |
31245 |
+ flow_mask_remove(table, flow->mask); |
31246 |
+ } |
31247 |
+ |
31248 |
+-static void table_instance_destroy(struct flow_table *table, |
31249 |
+- struct table_instance *ti, |
31250 |
+- struct table_instance *ufid_ti, |
31251 |
+- bool deferred) |
31252 |
++/* Must be called with OVS mutex held. */ |
31253 |
++void table_instance_flow_flush(struct flow_table *table, |
31254 |
++ struct table_instance *ti, |
31255 |
++ struct table_instance *ufid_ti) |
31256 |
+ { |
31257 |
+ int i; |
31258 |
+ |
31259 |
+- if (!ti) |
31260 |
+- return; |
31261 |
+- |
31262 |
+- BUG_ON(!ufid_ti); |
31263 |
+ if (ti->keep_flows) |
31264 |
+- goto skip_flows; |
31265 |
++ return; |
31266 |
+ |
31267 |
+ for (i = 0; i < ti->n_buckets; i++) { |
31268 |
+ struct sw_flow *flow; |
31269 |
+@@ -369,18 +365,16 @@ static void table_instance_destroy(struct flow_table *table, |
31270 |
+ |
31271 |
+ table_instance_flow_free(table, ti, ufid_ti, |
31272 |
+ flow, false); |
31273 |
+- ovs_flow_free(flow, deferred); |
31274 |
++ ovs_flow_free(flow, true); |
31275 |
+ } |
31276 |
+ } |
31277 |
++} |
31278 |
+ |
31279 |
+-skip_flows: |
31280 |
+- if (deferred) { |
31281 |
+- call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb); |
31282 |
+- call_rcu(&ufid_ti->rcu, flow_tbl_destroy_rcu_cb); |
31283 |
+- } else { |
31284 |
+- __table_instance_destroy(ti); |
31285 |
+- __table_instance_destroy(ufid_ti); |
31286 |
+- } |
31287 |
++static void table_instance_destroy(struct table_instance *ti, |
31288 |
++ struct table_instance *ufid_ti) |
31289 |
++{ |
31290 |
++ call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb); |
31291 |
++ call_rcu(&ufid_ti->rcu, flow_tbl_destroy_rcu_cb); |
31292 |
+ } |
31293 |
+ |
31294 |
+ /* No need for locking this function is called from RCU callback or |
31295 |
+@@ -393,7 +387,7 @@ void ovs_flow_tbl_destroy(struct flow_table *table) |
31296 |
+ |
31297 |
+ free_percpu(table->mask_cache); |
31298 |
+ kfree_rcu(rcu_dereference_raw(table->mask_array), rcu); |
31299 |
+- table_instance_destroy(table, ti, ufid_ti, false); |
31300 |
++ table_instance_destroy(ti, ufid_ti); |
31301 |
+ } |
31302 |
+ |
31303 |
+ struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti, |
31304 |
+@@ -511,7 +505,8 @@ int ovs_flow_tbl_flush(struct flow_table *flow_table) |
31305 |
+ flow_table->count = 0; |
31306 |
+ flow_table->ufid_count = 0; |
31307 |
+ |
31308 |
+- table_instance_destroy(flow_table, old_ti, old_ufid_ti, true); |
31309 |
++ table_instance_flow_flush(flow_table, old_ti, old_ufid_ti); |
31310 |
++ table_instance_destroy(old_ti, old_ufid_ti); |
31311 |
+ return 0; |
31312 |
+ |
31313 |
+ err_free_ti: |
31314 |
+diff --git a/net/openvswitch/flow_table.h b/net/openvswitch/flow_table.h |
31315 |
+index 8a5cea6ae1116..8ea8fc9573776 100644 |
31316 |
+--- a/net/openvswitch/flow_table.h |
31317 |
++++ b/net/openvswitch/flow_table.h |
31318 |
+@@ -86,4 +86,7 @@ bool ovs_flow_cmp(const struct sw_flow *, const struct sw_flow_match *); |
31319 |
+ |
31320 |
+ void ovs_flow_mask_key(struct sw_flow_key *dst, const struct sw_flow_key *src, |
31321 |
+ bool full, const struct sw_flow_mask *mask); |
31322 |
++void table_instance_flow_flush(struct flow_table *table, |
31323 |
++ struct table_instance *ti, |
31324 |
++ struct table_instance *ufid_ti); |
31325 |
+ #endif /* flow_table.h */ |
31326 |
+diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c |
31327 |
+index a080d63a9b456..4490dd7469d99 100644 |
31328 |
+--- a/sound/pci/cs46xx/cs46xx_lib.c |
31329 |
++++ b/sound/pci/cs46xx/cs46xx_lib.c |
31330 |
+@@ -766,7 +766,7 @@ static void snd_cs46xx_set_capture_sample_rate(struct snd_cs46xx *chip, unsigned |
31331 |
+ rate = 48000 / 9; |
31332 |
+ |
31333 |
+ /* |
31334 |
+- * We can not capture at at rate greater than the Input Rate (48000). |
31335 |
++ * We can not capture at a rate greater than the Input Rate (48000). |
31336 |
+ * Return an error if an attempt is made to stray outside that limit. |
31337 |
+ */ |
31338 |
+ if (rate > 48000) |
31339 |
+diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c |
31340 |
+index 6b536fc23ca62..1f90ca723f4df 100644 |
31341 |
+--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c |
31342 |
++++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c |
31343 |
+@@ -1716,7 +1716,7 @@ int cs46xx_iec958_pre_open (struct snd_cs46xx *chip) |
31344 |
+ struct dsp_spos_instance * ins = chip->dsp_spos_instance; |
31345 |
+ |
31346 |
+ if ( ins->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED ) { |
31347 |
+- /* remove AsynchFGTxSCB and and PCMSerialInput_II */ |
31348 |
++ /* remove AsynchFGTxSCB and PCMSerialInput_II */ |
31349 |
+ cs46xx_dsp_disable_spdif_out (chip); |
31350 |
+ |
31351 |
+ /* save state */ |
31352 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
31353 |
+index 803978d69e3c4..ea7f16dd1f73c 100644 |
31354 |
+--- a/sound/pci/hda/hda_codec.c |
31355 |
++++ b/sound/pci/hda/hda_codec.c |
31356 |
+@@ -3427,7 +3427,7 @@ EXPORT_SYMBOL_GPL(snd_hda_set_power_save); |
31357 |
+ * @nid: NID to check / update |
31358 |
+ * |
31359 |
+ * Check whether the given NID is in the amp list. If it's in the list, |
31360 |
+- * check the current AMP status, and update the the power-status according |
31361 |
++ * check the current AMP status, and update the power-status according |
31362 |
+ * to the mute status. |
31363 |
+ * |
31364 |
+ * This function is supposed to be set or called from the check_power_status |
31365 |
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c |
31366 |
+index f4e9d9445e18f..201a3b6b0b0f6 100644 |
31367 |
+--- a/sound/pci/hda/hda_generic.c |
31368 |
++++ b/sound/pci/hda/hda_generic.c |
31369 |
+@@ -813,7 +813,7 @@ static void activate_amp_in(struct hda_codec *codec, struct nid_path *path, |
31370 |
+ } |
31371 |
+ } |
31372 |
+ |
31373 |
+-/* sync power of each widget in the the given path */ |
31374 |
++/* sync power of each widget in the given path */ |
31375 |
+ static hda_nid_t path_power_update(struct hda_codec *codec, |
31376 |
+ struct nid_path *path, |
31377 |
+ bool allow_powerdown) |
31378 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
31379 |
+index 4c23b169ac67e..1a26940a3fd7c 100644 |
31380 |
+--- a/sound/pci/hda/hda_intel.c |
31381 |
++++ b/sound/pci/hda/hda_intel.c |
31382 |
+@@ -2747,6 +2747,8 @@ static const struct pci_device_id azx_ids[] = { |
31383 |
+ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI }, |
31384 |
+ /* Zhaoxin */ |
31385 |
+ { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN }, |
31386 |
++ /* Loongson */ |
31387 |
++ { PCI_DEVICE(0x0014, 0x7a07), .driver_data = AZX_DRIVER_GENERIC }, |
31388 |
+ { 0, } |
31389 |
+ }; |
31390 |
+ MODULE_DEVICE_TABLE(pci, azx_ids); |
31391 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
31392 |
+index cd46247988e4d..f0c6d2907e396 100644 |
31393 |
+--- a/sound/pci/hda/patch_hdmi.c |
31394 |
++++ b/sound/pci/hda/patch_hdmi.c |
31395 |
+@@ -160,6 +160,7 @@ struct hdmi_spec { |
31396 |
+ |
31397 |
+ bool use_acomp_notifier; /* use eld_notify callback for hotplug */ |
31398 |
+ bool acomp_registered; /* audio component registered in this driver */ |
31399 |
++ bool force_connect; /* force connectivity */ |
31400 |
+ struct drm_audio_component_audio_ops drm_audio_ops; |
31401 |
+ int (*port2pin)(struct hda_codec *, int); /* reverse port/pin mapping */ |
31402 |
+ |
31403 |
+@@ -1701,7 +1702,8 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
31404 |
+ * all device entries on the same pin |
31405 |
+ */ |
31406 |
+ config = snd_hda_codec_get_pincfg(codec, pin_nid); |
31407 |
+- if (get_defcfg_connect(config) == AC_JACK_PORT_NONE) |
31408 |
++ if (get_defcfg_connect(config) == AC_JACK_PORT_NONE && |
31409 |
++ !spec->force_connect) |
31410 |
+ return 0; |
31411 |
+ |
31412 |
+ /* |
31413 |
+@@ -1803,11 +1805,19 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) |
31414 |
+ return 0; |
31415 |
+ } |
31416 |
+ |
31417 |
++static const struct snd_pci_quirk force_connect_list[] = { |
31418 |
++ SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), |
31419 |
++ SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), |
31420 |
++ {} |
31421 |
++}; |
31422 |
++ |
31423 |
+ static int hdmi_parse_codec(struct hda_codec *codec) |
31424 |
+ { |
31425 |
++ struct hdmi_spec *spec = codec->spec; |
31426 |
+ hda_nid_t start_nid; |
31427 |
+ unsigned int caps; |
31428 |
+ int i, nodes; |
31429 |
++ const struct snd_pci_quirk *q; |
31430 |
+ |
31431 |
+ nodes = snd_hda_get_sub_nodes(codec, codec->core.afg, &start_nid); |
31432 |
+ if (!start_nid || nodes < 0) { |
31433 |
+@@ -1815,6 +1825,11 @@ static int hdmi_parse_codec(struct hda_codec *codec) |
31434 |
+ return -EINVAL; |
31435 |
+ } |
31436 |
+ |
31437 |
++ q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list); |
31438 |
++ |
31439 |
++ if (q && q->value) |
31440 |
++ spec->force_connect = true; |
31441 |
++ |
31442 |
+ /* |
31443 |
+ * hdmi_add_pin() assumes total amount of converters to |
31444 |
+ * be known, so first discover all converters |
31445 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
31446 |
+index b10d005786d07..da23c2d4ca51e 100644 |
31447 |
+--- a/sound/pci/hda/patch_realtek.c |
31448 |
++++ b/sound/pci/hda/patch_realtek.c |
31449 |
+@@ -6167,6 +6167,7 @@ enum { |
31450 |
+ ALC269_FIXUP_CZC_L101, |
31451 |
+ ALC269_FIXUP_LEMOTE_A1802, |
31452 |
+ ALC269_FIXUP_LEMOTE_A190X, |
31453 |
++ ALC256_FIXUP_INTEL_NUC8_RUGGED, |
31454 |
+ }; |
31455 |
+ |
31456 |
+ static const struct hda_fixup alc269_fixups[] = { |
31457 |
+@@ -7488,6 +7489,15 @@ static const struct hda_fixup alc269_fixups[] = { |
31458 |
+ }, |
31459 |
+ .chain_id = ALC269_FIXUP_DMIC, |
31460 |
+ }, |
31461 |
++ [ALC256_FIXUP_INTEL_NUC8_RUGGED] = { |
31462 |
++ .type = HDA_FIXUP_PINS, |
31463 |
++ .v.pins = (const struct hda_pintbl[]) { |
31464 |
++ { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */ |
31465 |
++ { } |
31466 |
++ }, |
31467 |
++ .chained = true, |
31468 |
++ .chain_id = ALC269_FIXUP_HEADSET_MODE |
31469 |
++ }, |
31470 |
+ }; |
31471 |
+ |
31472 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
31473 |
+@@ -7787,6 +7797,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
31474 |
+ SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), |
31475 |
+ SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), |
31476 |
+ SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), |
31477 |
++ SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), |
31478 |
+ |
31479 |
+ #if 0 |
31480 |
+ /* Below is a quirk table taken from the old code. |
31481 |
+@@ -7958,6 +7969,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { |
31482 |
+ {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"}, |
31483 |
+ {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"}, |
31484 |
+ {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, |
31485 |
++ {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, |
31486 |
+ {} |
31487 |
+ }; |
31488 |
+ #define ALC225_STANDARD_PINS \ |
31489 |
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c |
31490 |
+index a608d0486ae49..2bea11d62d3e9 100644 |
31491 |
+--- a/sound/pci/hda/patch_sigmatel.c |
31492 |
++++ b/sound/pci/hda/patch_sigmatel.c |
31493 |
+@@ -832,7 +832,7 @@ static int stac_auto_create_beep_ctls(struct hda_codec *codec, |
31494 |
+ static const struct snd_kcontrol_new beep_vol_ctl = |
31495 |
+ HDA_CODEC_VOLUME(NULL, 0, 0, 0); |
31496 |
+ |
31497 |
+- /* check for mute support for the the amp */ |
31498 |
++ /* check for mute support for the amp */ |
31499 |
+ if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
31500 |
+ const struct snd_kcontrol_new *temp; |
31501 |
+ if (spec->anabeep_nid == nid) |
31502 |
+diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c |
31503 |
+index 8df14f63b10df..096ec76f53046 100644 |
31504 |
+--- a/sound/pci/ice1712/prodigy192.c |
31505 |
++++ b/sound/pci/ice1712/prodigy192.c |
31506 |
+@@ -32,7 +32,7 @@ |
31507 |
+ * Experimentally I found out that only a combination of |
31508 |
+ * OCKS0=1, OCKS1=1 (128fs, 64fs output) and ice1724 - |
31509 |
+ * VT1724_MT_I2S_MCLK_128X=0 (256fs input) yields correct |
31510 |
+- * sampling rate. That means the the FPGA doubles the |
31511 |
++ * sampling rate. That means that the FPGA doubles the |
31512 |
+ * MCK01 rate. |
31513 |
+ * |
31514 |
+ * Copyright (c) 2003 Takashi Iwai <tiwai@××××.de> |
31515 |
+diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c |
31516 |
+index c3f8721624cd4..b90421a1d909a 100644 |
31517 |
+--- a/sound/pci/oxygen/xonar_dg.c |
31518 |
++++ b/sound/pci/oxygen/xonar_dg.c |
31519 |
+@@ -29,7 +29,7 @@ |
31520 |
+ * GPIO 4 <- headphone detect |
31521 |
+ * GPIO 5 -> enable ADC analog circuit for the left channel |
31522 |
+ * GPIO 6 -> enable ADC analog circuit for the right channel |
31523 |
+- * GPIO 7 -> switch green rear output jack between CS4245 and and the first |
31524 |
++ * GPIO 7 -> switch green rear output jack between CS4245 and the first |
31525 |
+ * channel of CS4361 (mechanical relay) |
31526 |
+ * GPIO 8 -> enable output to speakers |
31527 |
+ * |
31528 |
+diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c |
31529 |
+index ca42445b649d4..b471892d84778 100644 |
31530 |
+--- a/sound/soc/codecs/wm8958-dsp2.c |
31531 |
++++ b/sound/soc/codecs/wm8958-dsp2.c |
31532 |
+@@ -412,8 +412,12 @@ int wm8958_aif_ev(struct snd_soc_dapm_widget *w, |
31533 |
+ struct snd_kcontrol *kcontrol, int event) |
31534 |
+ { |
31535 |
+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
31536 |
++ struct wm8994 *control = dev_get_drvdata(component->dev->parent); |
31537 |
+ int i; |
31538 |
+ |
31539 |
++ if (control->type != WM8958) |
31540 |
++ return 0; |
31541 |
++ |
31542 |
+ switch (event) { |
31543 |
+ case SND_SOC_DAPM_POST_PMU: |
31544 |
+ case SND_SOC_DAPM_PRE_PMU: |
31545 |
+diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c |
31546 |
+index e30b66b94bf67..0843235d73c91 100644 |
31547 |
+--- a/sound/soc/img/img-i2s-in.c |
31548 |
++++ b/sound/soc/img/img-i2s-in.c |
31549 |
+@@ -343,8 +343,10 @@ static int img_i2s_in_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
31550 |
+ chan_control_mask = IMG_I2S_IN_CH_CTL_CLK_TRANS_MASK; |
31551 |
+ |
31552 |
+ ret = pm_runtime_get_sync(i2s->dev); |
31553 |
+- if (ret < 0) |
31554 |
++ if (ret < 0) { |
31555 |
++ pm_runtime_put_noidle(i2s->dev); |
31556 |
+ return ret; |
31557 |
++ } |
31558 |
+ |
31559 |
+ for (i = 0; i < i2s->active_channels; i++) |
31560 |
+ img_i2s_in_ch_disable(i2s, i); |
31561 |
+diff --git a/sound/soc/img/img-parallel-out.c b/sound/soc/img/img-parallel-out.c |
31562 |
+index 5ddbe3a31c2e9..4da49a42e8547 100644 |
31563 |
+--- a/sound/soc/img/img-parallel-out.c |
31564 |
++++ b/sound/soc/img/img-parallel-out.c |
31565 |
+@@ -163,8 +163,10 @@ static int img_prl_out_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
31566 |
+ } |
31567 |
+ |
31568 |
+ ret = pm_runtime_get_sync(prl->dev); |
31569 |
+- if (ret < 0) |
31570 |
++ if (ret < 0) { |
31571 |
++ pm_runtime_put_noidle(prl->dev); |
31572 |
+ return ret; |
31573 |
++ } |
31574 |
+ |
31575 |
+ reg = img_prl_out_readl(prl, IMG_PRL_OUT_CTL); |
31576 |
+ reg = (reg & ~IMG_PRL_OUT_CTL_EDGE_MASK) | control_set; |
31577 |
+diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.h b/sound/soc/intel/boards/skl_hda_dsp_common.h |
31578 |
+index 507750ef67f30..4b0b3959182e5 100644 |
31579 |
+--- a/sound/soc/intel/boards/skl_hda_dsp_common.h |
31580 |
++++ b/sound/soc/intel/boards/skl_hda_dsp_common.h |
31581 |
+@@ -33,6 +33,7 @@ struct skl_hda_private { |
31582 |
+ int dai_index; |
31583 |
+ const char *platform_name; |
31584 |
+ bool common_hdmi_codec_drv; |
31585 |
++ bool idisp_codec; |
31586 |
+ }; |
31587 |
+ |
31588 |
+ extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS]; |
31589 |
+diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c |
31590 |
+index 79c8947f840b9..ca4900036ead9 100644 |
31591 |
+--- a/sound/soc/intel/boards/skl_hda_dsp_generic.c |
31592 |
++++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c |
31593 |
+@@ -79,6 +79,9 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link) |
31594 |
+ link->platforms->name = ctx->platform_name; |
31595 |
+ link->nonatomic = 1; |
31596 |
+ |
31597 |
++ if (!ctx->idisp_codec) |
31598 |
++ return 0; |
31599 |
++ |
31600 |
+ if (strstr(link->name, "HDMI")) { |
31601 |
+ ret = skl_hda_hdmi_add_pcm(card, ctx->pcm_count); |
31602 |
+ |
31603 |
+@@ -118,19 +121,20 @@ static char hda_soc_components[30]; |
31604 |
+ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params) |
31605 |
+ { |
31606 |
+ struct snd_soc_card *card = &hda_soc_card; |
31607 |
++ struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); |
31608 |
+ struct snd_soc_dai_link *dai_link; |
31609 |
+- u32 codec_count, codec_mask, idisp_mask; |
31610 |
++ u32 codec_count, codec_mask; |
31611 |
+ int i, num_links, num_route; |
31612 |
+ |
31613 |
+ codec_mask = mach_params->codec_mask; |
31614 |
+ codec_count = hweight_long(codec_mask); |
31615 |
+- idisp_mask = codec_mask & IDISP_CODEC_MASK; |
31616 |
++ ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK); |
31617 |
+ |
31618 |
+ if (!codec_count || codec_count > 2 || |
31619 |
+- (codec_count == 2 && !idisp_mask)) |
31620 |
++ (codec_count == 2 && !ctx->idisp_codec)) |
31621 |
+ return -EINVAL; |
31622 |
+ |
31623 |
+- if (codec_mask == idisp_mask) { |
31624 |
++ if (codec_mask == IDISP_CODEC_MASK) { |
31625 |
+ /* topology with iDisp as the only HDA codec */ |
31626 |
+ num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT; |
31627 |
+ num_route = IDISP_ROUTE_COUNT; |
31628 |
+@@ -152,7 +156,7 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params) |
31629 |
+ num_route = ARRAY_SIZE(skl_hda_map); |
31630 |
+ card->dapm_widgets = skl_hda_widgets; |
31631 |
+ card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets); |
31632 |
+- if (!idisp_mask) { |
31633 |
++ if (!ctx->idisp_codec) { |
31634 |
+ for (i = 0; i < IDISP_DAI_COUNT; i++) { |
31635 |
+ skl_hda_be_dai_links[i].codecs = dummy_codec; |
31636 |
+ skl_hda_be_dai_links[i].num_codecs = |
31637 |
+@@ -211,6 +215,8 @@ static int skl_hda_audio_probe(struct platform_device *pdev) |
31638 |
+ if (!mach) |
31639 |
+ return -EINVAL; |
31640 |
+ |
31641 |
++ snd_soc_card_set_drvdata(&hda_soc_card, ctx); |
31642 |
++ |
31643 |
+ ret = skl_hda_fill_card_info(&mach->mach_params); |
31644 |
+ if (ret < 0) { |
31645 |
+ dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n"); |
31646 |
+@@ -223,7 +229,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev) |
31647 |
+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; |
31648 |
+ |
31649 |
+ hda_soc_card.dev = &pdev->dev; |
31650 |
+- snd_soc_card_set_drvdata(&hda_soc_card, ctx); |
31651 |
+ |
31652 |
+ if (mach->mach_params.dmic_num > 0) { |
31653 |
+ snprintf(hda_soc_components, sizeof(hda_soc_components), |
31654 |
+diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c |
31655 |
+index 1bfd9613449e9..95a119a2d354e 100644 |
31656 |
+--- a/sound/soc/intel/boards/sof_sdw.c |
31657 |
++++ b/sound/soc/intel/boards/sof_sdw.c |
31658 |
+@@ -184,6 +184,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { |
31659 |
+ .direction = {true, true}, |
31660 |
+ .dai_name = "rt711-aif1", |
31661 |
+ .init = sof_sdw_rt711_init, |
31662 |
++ .exit = sof_sdw_rt711_exit, |
31663 |
+ }, |
31664 |
+ { |
31665 |
+ .id = 0x1308, |
31666 |
+diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h |
31667 |
+index 69b363b8a6869..fdd2385049e1e 100644 |
31668 |
+--- a/sound/soc/intel/boards/sof_sdw_common.h |
31669 |
++++ b/sound/soc/intel/boards/sof_sdw_common.h |
31670 |
+@@ -84,6 +84,7 @@ int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link, |
31671 |
+ struct snd_soc_dai_link *dai_links, |
31672 |
+ struct sof_sdw_codec_info *info, |
31673 |
+ bool playback); |
31674 |
++int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link); |
31675 |
+ |
31676 |
+ /* RT700 support */ |
31677 |
+ int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link, |
31678 |
+diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c |
31679 |
+index d4d75c8dc6b78..0cb9f1c1f8676 100644 |
31680 |
+--- a/sound/soc/intel/boards/sof_sdw_rt711.c |
31681 |
++++ b/sound/soc/intel/boards/sof_sdw_rt711.c |
31682 |
+@@ -133,6 +133,21 @@ static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) |
31683 |
+ return ret; |
31684 |
+ } |
31685 |
+ |
31686 |
++int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link) |
31687 |
++{ |
31688 |
++ struct device *sdw_dev; |
31689 |
++ |
31690 |
++ sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, |
31691 |
++ dai_link->codecs[0].name); |
31692 |
++ if (!sdw_dev) |
31693 |
++ return -EINVAL; |
31694 |
++ |
31695 |
++ device_remove_properties(sdw_dev); |
31696 |
++ put_device(sdw_dev); |
31697 |
++ |
31698 |
++ return 0; |
31699 |
++} |
31700 |
++ |
31701 |
+ int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link, |
31702 |
+ struct snd_soc_dai_link *dai_links, |
31703 |
+ struct sof_sdw_codec_info *info, |
31704 |
+diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c |
31705 |
+index 635eacbd28d47..156e3b9d613c6 100644 |
31706 |
+--- a/sound/soc/tegra/tegra30_ahub.c |
31707 |
++++ b/sound/soc/tegra/tegra30_ahub.c |
31708 |
+@@ -643,8 +643,10 @@ static int tegra30_ahub_resume(struct device *dev) |
31709 |
+ int ret; |
31710 |
+ |
31711 |
+ ret = pm_runtime_get_sync(dev); |
31712 |
+- if (ret < 0) |
31713 |
++ if (ret < 0) { |
31714 |
++ pm_runtime_put(dev); |
31715 |
+ return ret; |
31716 |
++ } |
31717 |
+ ret = regcache_sync(ahub->regmap_ahub); |
31718 |
+ ret |= regcache_sync(ahub->regmap_apbif); |
31719 |
+ pm_runtime_put(dev); |
31720 |
+diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c |
31721 |
+index d59882ec48f16..db5a8587bfa4c 100644 |
31722 |
+--- a/sound/soc/tegra/tegra30_i2s.c |
31723 |
++++ b/sound/soc/tegra/tegra30_i2s.c |
31724 |
+@@ -567,8 +567,10 @@ static int tegra30_i2s_resume(struct device *dev) |
31725 |
+ int ret; |
31726 |
+ |
31727 |
+ ret = pm_runtime_get_sync(dev); |
31728 |
+- if (ret < 0) |
31729 |
++ if (ret < 0) { |
31730 |
++ pm_runtime_put(dev); |
31731 |
+ return ret; |
31732 |
++ } |
31733 |
+ ret = regcache_sync(i2s->regmap); |
31734 |
+ pm_runtime_put(dev); |
31735 |
+ |
31736 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
31737 |
+index eab0fd4fd7c33..e0b7174c10430 100644 |
31738 |
+--- a/sound/usb/mixer.c |
31739 |
++++ b/sound/usb/mixer.c |
31740 |
+@@ -2367,7 +2367,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, |
31741 |
+ int num_ins; |
31742 |
+ struct usb_mixer_elem_info *cval; |
31743 |
+ struct snd_kcontrol *kctl; |
31744 |
+- int i, err, nameid, type, len; |
31745 |
++ int i, err, nameid, type, len, val; |
31746 |
+ const struct procunit_info *info; |
31747 |
+ const struct procunit_value_info *valinfo; |
31748 |
+ const struct usbmix_name_map *map; |
31749 |
+@@ -2470,6 +2470,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, |
31750 |
+ break; |
31751 |
+ } |
31752 |
+ |
31753 |
++ err = get_cur_ctl_value(cval, cval->control << 8, &val); |
31754 |
++ if (err < 0) { |
31755 |
++ usb_mixer_elem_info_free(cval); |
31756 |
++ return -EINVAL; |
31757 |
++ } |
31758 |
++ |
31759 |
+ kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); |
31760 |
+ if (!kctl) { |
31761 |
+ usb_mixer_elem_info_free(cval); |
31762 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
31763 |
+index a53eb67ad4bd8..366faaa4ba82c 100644 |
31764 |
+--- a/sound/usb/quirks-table.h |
31765 |
++++ b/sound/usb/quirks-table.h |
31766 |
+@@ -2678,6 +2678,10 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
31767 |
+ .ifnum = QUIRK_ANY_INTERFACE, |
31768 |
+ .type = QUIRK_COMPOSITE, |
31769 |
+ .data = (const struct snd_usb_audio_quirk[]) { |
31770 |
++ { |
31771 |
++ .ifnum = 0, |
31772 |
++ .type = QUIRK_AUDIO_STANDARD_MIXER, |
31773 |
++ }, |
31774 |
+ { |
31775 |
+ .ifnum = 0, |
31776 |
+ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
31777 |
+@@ -2690,6 +2694,32 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
31778 |
+ .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, |
31779 |
+ .endpoint = 0x01, |
31780 |
+ .ep_attr = USB_ENDPOINT_XFER_ISOC, |
31781 |
++ .datainterval = 1, |
31782 |
++ .maxpacksize = 0x024c, |
31783 |
++ .rates = SNDRV_PCM_RATE_44100 | |
31784 |
++ SNDRV_PCM_RATE_48000, |
31785 |
++ .rate_min = 44100, |
31786 |
++ .rate_max = 48000, |
31787 |
++ .nr_rates = 2, |
31788 |
++ .rate_table = (unsigned int[]) { |
31789 |
++ 44100, 48000 |
31790 |
++ } |
31791 |
++ } |
31792 |
++ }, |
31793 |
++ { |
31794 |
++ .ifnum = 0, |
31795 |
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, |
31796 |
++ .data = &(const struct audioformat) { |
31797 |
++ .formats = SNDRV_PCM_FMTBIT_S24_3LE, |
31798 |
++ .channels = 2, |
31799 |
++ .iface = 0, |
31800 |
++ .altsetting = 1, |
31801 |
++ .altset_idx = 1, |
31802 |
++ .attributes = 0, |
31803 |
++ .endpoint = 0x82, |
31804 |
++ .ep_attr = USB_ENDPOINT_XFER_ISOC, |
31805 |
++ .datainterval = 1, |
31806 |
++ .maxpacksize = 0x0126, |
31807 |
+ .rates = SNDRV_PCM_RATE_44100 | |
31808 |
+ SNDRV_PCM_RATE_48000, |
31809 |
+ .rate_min = 44100, |
31810 |
+@@ -3697,8 +3727,8 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */ |
31811 |
+ * they pretend to be 96kHz mono as a workaround for stereo being broken |
31812 |
+ * by that... |
31813 |
+ * |
31814 |
+- * They also have swapped L-R channels, but that's for userspace to deal |
31815 |
+- * with. |
31816 |
++ * They also have an issue with initial stream alignment that causes the |
31817 |
++ * channels to be swapped and out of phase, which is dealt with in quirks.c. |
31818 |
+ */ |
31819 |
+ { |
31820 |
+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | |
31821 |
+diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c |
31822 |
+index ede162f83eea0..0e9310727281a 100644 |
31823 |
+--- a/tools/bpf/bpftool/btf_dumper.c |
31824 |
++++ b/tools/bpf/bpftool/btf_dumper.c |
31825 |
+@@ -67,7 +67,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d, |
31826 |
+ if (!info->btf_id || !info->nr_func_info || |
31827 |
+ btf__get_from_id(info->btf_id, &prog_btf)) |
31828 |
+ goto print; |
31829 |
+- finfo = (struct bpf_func_info *)info->func_info; |
31830 |
++ finfo = u64_to_ptr(info->func_info); |
31831 |
+ func_type = btf__type_by_id(prog_btf, finfo->type_id); |
31832 |
+ if (!func_type || !btf_is_func(func_type)) |
31833 |
+ goto print; |
31834 |
+diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c |
31835 |
+index fca57ee8fafe4..dea691c83afca 100644 |
31836 |
+--- a/tools/bpf/bpftool/link.c |
31837 |
++++ b/tools/bpf/bpftool/link.c |
31838 |
+@@ -101,7 +101,7 @@ static int show_link_close_json(int fd, struct bpf_link_info *info) |
31839 |
+ switch (info->type) { |
31840 |
+ case BPF_LINK_TYPE_RAW_TRACEPOINT: |
31841 |
+ jsonw_string_field(json_wtr, "tp_name", |
31842 |
+- (const char *)info->raw_tracepoint.tp_name); |
31843 |
++ u64_to_ptr(info->raw_tracepoint.tp_name)); |
31844 |
+ break; |
31845 |
+ case BPF_LINK_TYPE_TRACING: |
31846 |
+ err = get_prog_info(info->prog_id, &prog_info); |
31847 |
+@@ -177,7 +177,7 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info) |
31848 |
+ switch (info->type) { |
31849 |
+ case BPF_LINK_TYPE_RAW_TRACEPOINT: |
31850 |
+ printf("\n\ttp '%s' ", |
31851 |
+- (const char *)info->raw_tracepoint.tp_name); |
31852 |
++ (const char *)u64_to_ptr(info->raw_tracepoint.tp_name)); |
31853 |
+ break; |
31854 |
+ case BPF_LINK_TYPE_TRACING: |
31855 |
+ err = get_prog_info(info->prog_id, &prog_info); |
31856 |
+diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h |
31857 |
+index 5cdf0bc049bd9..5917484c2e027 100644 |
31858 |
+--- a/tools/bpf/bpftool/main.h |
31859 |
++++ b/tools/bpf/bpftool/main.h |
31860 |
+@@ -21,7 +21,15 @@ |
31861 |
+ /* Make sure we do not use kernel-only integer typedefs */ |
31862 |
+ #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64 |
31863 |
+ |
31864 |
+-#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) |
31865 |
++static inline __u64 ptr_to_u64(const void *ptr) |
31866 |
++{ |
31867 |
++ return (__u64)(unsigned long)ptr; |
31868 |
++} |
31869 |
++ |
31870 |
++static inline void *u64_to_ptr(__u64 ptr) |
31871 |
++{ |
31872 |
++ return (void *)(unsigned long)ptr; |
31873 |
++} |
31874 |
+ |
31875 |
+ #define NEXT_ARG() ({ argc--; argv++; if (argc < 0) usage(); }) |
31876 |
+ #define NEXT_ARGP() ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); }) |
31877 |
+diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c |
31878 |
+index a5eff83496f2d..2c6f7e160b248 100644 |
31879 |
+--- a/tools/bpf/bpftool/prog.c |
31880 |
++++ b/tools/bpf/bpftool/prog.c |
31881 |
+@@ -537,14 +537,14 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode, |
31882 |
+ p_info("no instructions returned"); |
31883 |
+ return -1; |
31884 |
+ } |
31885 |
+- buf = (unsigned char *)(info->jited_prog_insns); |
31886 |
++ buf = u64_to_ptr(info->jited_prog_insns); |
31887 |
+ member_len = info->jited_prog_len; |
31888 |
+ } else { /* DUMP_XLATED */ |
31889 |
+ if (info->xlated_prog_len == 0 || !info->xlated_prog_insns) { |
31890 |
+ p_err("error retrieving insn dump: kernel.kptr_restrict set?"); |
31891 |
+ return -1; |
31892 |
+ } |
31893 |
+- buf = (unsigned char *)info->xlated_prog_insns; |
31894 |
++ buf = u64_to_ptr(info->xlated_prog_insns); |
31895 |
+ member_len = info->xlated_prog_len; |
31896 |
+ } |
31897 |
+ |
31898 |
+@@ -553,7 +553,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode, |
31899 |
+ return -1; |
31900 |
+ } |
31901 |
+ |
31902 |
+- func_info = (void *)info->func_info; |
31903 |
++ func_info = u64_to_ptr(info->func_info); |
31904 |
+ |
31905 |
+ if (info->nr_line_info) { |
31906 |
+ prog_linfo = bpf_prog_linfo__new(info); |
31907 |
+@@ -571,7 +571,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode, |
31908 |
+ |
31909 |
+ n = write(fd, buf, member_len); |
31910 |
+ close(fd); |
31911 |
+- if (n != member_len) { |
31912 |
++ if (n != (ssize_t)member_len) { |
31913 |
+ p_err("error writing output file: %s", |
31914 |
+ n < 0 ? strerror(errno) : "short write"); |
31915 |
+ return -1; |
31916 |
+@@ -601,13 +601,13 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode, |
31917 |
+ __u32 i; |
31918 |
+ if (info->nr_jited_ksyms) { |
31919 |
+ kernel_syms_load(&dd); |
31920 |
+- ksyms = (__u64 *) info->jited_ksyms; |
31921 |
++ ksyms = u64_to_ptr(info->jited_ksyms); |
31922 |
+ } |
31923 |
+ |
31924 |
+ if (json_output) |
31925 |
+ jsonw_start_array(json_wtr); |
31926 |
+ |
31927 |
+- lens = (__u32 *) info->jited_func_lens; |
31928 |
++ lens = u64_to_ptr(info->jited_func_lens); |
31929 |
+ for (i = 0; i < info->nr_jited_func_lens; i++) { |
31930 |
+ if (ksyms) { |
31931 |
+ sym = kernel_syms_search(&dd, ksyms[i]); |
31932 |
+@@ -668,7 +668,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode, |
31933 |
+ } else { |
31934 |
+ kernel_syms_load(&dd); |
31935 |
+ dd.nr_jited_ksyms = info->nr_jited_ksyms; |
31936 |
+- dd.jited_ksyms = (__u64 *) info->jited_ksyms; |
31937 |
++ dd.jited_ksyms = u64_to_ptr(info->jited_ksyms); |
31938 |
+ dd.btf = btf; |
31939 |
+ dd.func_info = func_info; |
31940 |
+ dd.finfo_rec_size = info->func_info_rec_size; |
31941 |
+@@ -1790,7 +1790,7 @@ static char *profile_target_name(int tgt_fd) |
31942 |
+ goto out; |
31943 |
+ } |
31944 |
+ |
31945 |
+- func_info = (struct bpf_func_info *)(info_linear->info.func_info); |
31946 |
++ func_info = u64_to_ptr(info_linear->info.func_info); |
31947 |
+ t = btf__type_by_id(btf, func_info[0].type_id); |
31948 |
+ if (!t) { |
31949 |
+ p_err("btf %d doesn't have type %d", |
31950 |
+diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c |
31951 |
+index e7642a6e39f9e..3ac0094706b81 100644 |
31952 |
+--- a/tools/lib/bpf/libbpf.c |
31953 |
++++ b/tools/lib/bpf/libbpf.c |
31954 |
+@@ -2237,7 +2237,7 @@ static int bpf_object__init_user_btf_maps(struct bpf_object *obj, bool strict, |
31955 |
+ data = elf_getdata(scn, NULL); |
31956 |
+ if (!scn || !data) { |
31957 |
+ pr_warn("failed to get Elf_Data from map section %d (%s)\n", |
31958 |
+- obj->efile.maps_shndx, MAPS_ELF_SEC); |
31959 |
++ obj->efile.btf_maps_shndx, MAPS_ELF_SEC); |
31960 |
+ return -EINVAL; |
31961 |
+ } |
31962 |
+ |
31963 |
+@@ -3319,10 +3319,11 @@ bpf_object__probe_global_data(struct bpf_object *obj) |
31964 |
+ |
31965 |
+ map = bpf_create_map_xattr(&map_attr); |
31966 |
+ if (map < 0) { |
31967 |
+- cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg)); |
31968 |
++ ret = -errno; |
31969 |
++ cp = libbpf_strerror_r(ret, errmsg, sizeof(errmsg)); |
31970 |
+ pr_warn("Error in %s():%s(%d). Couldn't create simple array map.\n", |
31971 |
+- __func__, cp, errno); |
31972 |
+- return -errno; |
31973 |
++ __func__, cp, -ret); |
31974 |
++ return ret; |
31975 |
+ } |
31976 |
+ |
31977 |
+ insns[0].imm = map; |
31978 |
+@@ -5779,9 +5780,10 @@ int bpf_program__pin_instance(struct bpf_program *prog, const char *path, |
31979 |
+ } |
31980 |
+ |
31981 |
+ if (bpf_obj_pin(prog->instances.fds[instance], path)) { |
31982 |
+- cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg)); |
31983 |
++ err = -errno; |
31984 |
++ cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg)); |
31985 |
+ pr_warn("failed to pin program: %s\n", cp); |
31986 |
+- return -errno; |
31987 |
++ return err; |
31988 |
+ } |
31989 |
+ pr_debug("pinned program '%s'\n", path); |
31990 |
+ |
31991 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c b/tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c |
31992 |
+index 7afa4160416f6..284d5921c3458 100644 |
31993 |
+--- a/tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c |
31994 |
++++ b/tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c |
31995 |
+@@ -159,15 +159,15 @@ void test_bpf_obj_id(void) |
31996 |
+ /* Check getting link info */ |
31997 |
+ info_len = sizeof(struct bpf_link_info) * 2; |
31998 |
+ bzero(&link_infos[i], info_len); |
31999 |
+- link_infos[i].raw_tracepoint.tp_name = (__u64)&tp_name; |
32000 |
++ link_infos[i].raw_tracepoint.tp_name = ptr_to_u64(&tp_name); |
32001 |
+ link_infos[i].raw_tracepoint.tp_name_len = sizeof(tp_name); |
32002 |
+ err = bpf_obj_get_info_by_fd(bpf_link__fd(links[i]), |
32003 |
+ &link_infos[i], &info_len); |
32004 |
+ if (CHECK(err || |
32005 |
+ link_infos[i].type != BPF_LINK_TYPE_RAW_TRACEPOINT || |
32006 |
+ link_infos[i].prog_id != prog_infos[i].id || |
32007 |
+- link_infos[i].raw_tracepoint.tp_name != (__u64)&tp_name || |
32008 |
+- strcmp((char *)link_infos[i].raw_tracepoint.tp_name, |
32009 |
++ link_infos[i].raw_tracepoint.tp_name != ptr_to_u64(&tp_name) || |
32010 |
++ strcmp(u64_to_ptr(link_infos[i].raw_tracepoint.tp_name), |
32011 |
+ "sys_enter") || |
32012 |
+ info_len != sizeof(struct bpf_link_info), |
32013 |
+ "get-link-info(fd)", |
32014 |
+@@ -178,7 +178,7 @@ void test_bpf_obj_id(void) |
32015 |
+ link_infos[i].type, BPF_LINK_TYPE_RAW_TRACEPOINT, |
32016 |
+ link_infos[i].id, |
32017 |
+ link_infos[i].prog_id, prog_infos[i].id, |
32018 |
+- (char *)link_infos[i].raw_tracepoint.tp_name, |
32019 |
++ (const char *)u64_to_ptr(link_infos[i].raw_tracepoint.tp_name), |
32020 |
+ "sys_enter")) |
32021 |
+ goto done; |
32022 |
+ |
32023 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/btf_dump.c b/tools/testing/selftests/bpf/prog_tests/btf_dump.c |
32024 |
+index cb33a7ee4e04f..39fb81d9daeb5 100644 |
32025 |
+--- a/tools/testing/selftests/bpf/prog_tests/btf_dump.c |
32026 |
++++ b/tools/testing/selftests/bpf/prog_tests/btf_dump.c |
32027 |
+@@ -12,15 +12,16 @@ void btf_dump_printf(void *ctx, const char *fmt, va_list args) |
32028 |
+ static struct btf_dump_test_case { |
32029 |
+ const char *name; |
32030 |
+ const char *file; |
32031 |
++ bool known_ptr_sz; |
32032 |
+ struct btf_dump_opts opts; |
32033 |
+ } btf_dump_test_cases[] = { |
32034 |
+- {"btf_dump: syntax", "btf_dump_test_case_syntax", {}}, |
32035 |
+- {"btf_dump: ordering", "btf_dump_test_case_ordering", {}}, |
32036 |
+- {"btf_dump: padding", "btf_dump_test_case_padding", {}}, |
32037 |
+- {"btf_dump: packing", "btf_dump_test_case_packing", {}}, |
32038 |
+- {"btf_dump: bitfields", "btf_dump_test_case_bitfields", {}}, |
32039 |
+- {"btf_dump: multidim", "btf_dump_test_case_multidim", {}}, |
32040 |
+- {"btf_dump: namespacing", "btf_dump_test_case_namespacing", {}}, |
32041 |
++ {"btf_dump: syntax", "btf_dump_test_case_syntax", true, {}}, |
32042 |
++ {"btf_dump: ordering", "btf_dump_test_case_ordering", false, {}}, |
32043 |
++ {"btf_dump: padding", "btf_dump_test_case_padding", true, {}}, |
32044 |
++ {"btf_dump: packing", "btf_dump_test_case_packing", true, {}}, |
32045 |
++ {"btf_dump: bitfields", "btf_dump_test_case_bitfields", true, {}}, |
32046 |
++ {"btf_dump: multidim", "btf_dump_test_case_multidim", false, {}}, |
32047 |
++ {"btf_dump: namespacing", "btf_dump_test_case_namespacing", false, {}}, |
32048 |
+ }; |
32049 |
+ |
32050 |
+ static int btf_dump_all_types(const struct btf *btf, |
32051 |
+@@ -62,6 +63,18 @@ static int test_btf_dump_case(int n, struct btf_dump_test_case *t) |
32052 |
+ goto done; |
32053 |
+ } |
32054 |
+ |
32055 |
++ /* tests with t->known_ptr_sz have no "long" or "unsigned long" type, |
32056 |
++ * so it's impossible to determine correct pointer size; but if they |
32057 |
++ * do, it should be 8 regardless of host architecture, becaues BPF |
32058 |
++ * target is always 64-bit |
32059 |
++ */ |
32060 |
++ if (!t->known_ptr_sz) { |
32061 |
++ btf__set_pointer_size(btf, 8); |
32062 |
++ } else { |
32063 |
++ CHECK(btf__pointer_size(btf) != 8, "ptr_sz", "exp %d, got %zu\n", |
32064 |
++ 8, btf__pointer_size(btf)); |
32065 |
++ } |
32066 |
++ |
32067 |
+ snprintf(out_file, sizeof(out_file), "/tmp/%s.output.XXXXXX", t->file); |
32068 |
+ fd = mkstemp(out_file); |
32069 |
+ if (CHECK(fd < 0, "create_tmp", "failed to create file: %d\n", fd)) { |
32070 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/core_extern.c b/tools/testing/selftests/bpf/prog_tests/core_extern.c |
32071 |
+index b093787e94489..1931a158510e0 100644 |
32072 |
+--- a/tools/testing/selftests/bpf/prog_tests/core_extern.c |
32073 |
++++ b/tools/testing/selftests/bpf/prog_tests/core_extern.c |
32074 |
+@@ -159,8 +159,8 @@ void test_core_extern(void) |
32075 |
+ exp = (uint64_t *)&t->data; |
32076 |
+ for (j = 0; j < n; j++) { |
32077 |
+ CHECK(got[j] != exp[j], "check_res", |
32078 |
+- "result #%d: expected %lx, but got %lx\n", |
32079 |
+- j, exp[j], got[j]); |
32080 |
++ "result #%d: expected %llx, but got %llx\n", |
32081 |
++ j, (__u64)exp[j], (__u64)got[j]); |
32082 |
+ } |
32083 |
+ cleanup: |
32084 |
+ test_core_extern__destroy(skel); |
32085 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/core_reloc.c b/tools/testing/selftests/bpf/prog_tests/core_reloc.c |
32086 |
+index 084ed26a7d78c..a54eafc5e4b31 100644 |
32087 |
+--- a/tools/testing/selftests/bpf/prog_tests/core_reloc.c |
32088 |
++++ b/tools/testing/selftests/bpf/prog_tests/core_reloc.c |
32089 |
+@@ -237,8 +237,8 @@ |
32090 |
+ .union_sz = sizeof(((type *)0)->union_field), \ |
32091 |
+ .arr_sz = sizeof(((type *)0)->arr_field), \ |
32092 |
+ .arr_elem_sz = sizeof(((type *)0)->arr_field[0]), \ |
32093 |
+- .ptr_sz = sizeof(((type *)0)->ptr_field), \ |
32094 |
+- .enum_sz = sizeof(((type *)0)->enum_field), \ |
32095 |
++ .ptr_sz = 8, /* always 8-byte pointer for BPF */ \ |
32096 |
++ .enum_sz = sizeof(((type *)0)->enum_field), \ |
32097 |
+ } |
32098 |
+ |
32099 |
+ #define SIZE_CASE(name) { \ |
32100 |
+@@ -432,20 +432,20 @@ static struct core_reloc_test_case test_cases[] = { |
32101 |
+ .sb4 = -1, |
32102 |
+ .sb20 = -0x17654321, |
32103 |
+ .u32 = 0xBEEF, |
32104 |
+- .s32 = -0x3FEDCBA987654321, |
32105 |
++ .s32 = -0x3FEDCBA987654321LL, |
32106 |
+ }), |
32107 |
+ BITFIELDS_CASE(bitfields___bitfield_vs_int, { |
32108 |
+- .ub1 = 0xFEDCBA9876543210, |
32109 |
++ .ub1 = 0xFEDCBA9876543210LL, |
32110 |
+ .ub2 = 0xA6, |
32111 |
+- .ub7 = -0x7EDCBA987654321, |
32112 |
+- .sb4 = -0x6123456789ABCDE, |
32113 |
+- .sb20 = 0xD00D, |
32114 |
++ .ub7 = -0x7EDCBA987654321LL, |
32115 |
++ .sb4 = -0x6123456789ABCDELL, |
32116 |
++ .sb20 = 0xD00DLL, |
32117 |
+ .u32 = -0x76543, |
32118 |
+- .s32 = 0x0ADEADBEEFBADB0B, |
32119 |
++ .s32 = 0x0ADEADBEEFBADB0BLL, |
32120 |
+ }), |
32121 |
+ BITFIELDS_CASE(bitfields___just_big_enough, { |
32122 |
+- .ub1 = 0xF, |
32123 |
+- .ub2 = 0x0812345678FEDCBA, |
32124 |
++ .ub1 = 0xFLL, |
32125 |
++ .ub2 = 0x0812345678FEDCBALL, |
32126 |
+ }), |
32127 |
+ BITFIELDS_ERR_CASE(bitfields___err_too_big_bitfield), |
32128 |
+ |
32129 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c |
32130 |
+index a895bfed55db0..197d0d217b56b 100644 |
32131 |
+--- a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c |
32132 |
++++ b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c |
32133 |
+@@ -16,7 +16,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file, |
32134 |
+ __u32 duration = 0, retval; |
32135 |
+ struct bpf_map *data_map; |
32136 |
+ const int zero = 0; |
32137 |
+- u64 *result = NULL; |
32138 |
++ __u64 *result = NULL; |
32139 |
+ |
32140 |
+ err = bpf_prog_load(target_obj_file, BPF_PROG_TYPE_UNSPEC, |
32141 |
+ &pkt_obj, &pkt_fd); |
32142 |
+@@ -29,7 +29,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file, |
32143 |
+ |
32144 |
+ link = calloc(sizeof(struct bpf_link *), prog_cnt); |
32145 |
+ prog = calloc(sizeof(struct bpf_program *), prog_cnt); |
32146 |
+- result = malloc((prog_cnt + 32 /* spare */) * sizeof(u64)); |
32147 |
++ result = malloc((prog_cnt + 32 /* spare */) * sizeof(__u64)); |
32148 |
+ if (CHECK(!link || !prog || !result, "alloc_memory", |
32149 |
+ "failed to alloc memory")) |
32150 |
+ goto close_prog; |
32151 |
+@@ -72,7 +72,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file, |
32152 |
+ goto close_prog; |
32153 |
+ |
32154 |
+ for (i = 0; i < prog_cnt; i++) |
32155 |
+- if (CHECK(result[i] != 1, "result", "fexit_bpf2bpf failed err %ld\n", |
32156 |
++ if (CHECK(result[i] != 1, "result", "fexit_bpf2bpf failed err %llu\n", |
32157 |
+ result[i])) |
32158 |
+ goto close_prog; |
32159 |
+ |
32160 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c |
32161 |
+index f11f187990e95..cd6dc80edf18e 100644 |
32162 |
+--- a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c |
32163 |
++++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c |
32164 |
+@@ -591,7 +591,7 @@ void test_flow_dissector(void) |
32165 |
+ CHECK_ATTR(tattr.data_size_out != sizeof(flow_keys) || |
32166 |
+ err || tattr.retval != 1, |
32167 |
+ tests[i].name, |
32168 |
+- "err %d errno %d retval %d duration %d size %u/%lu\n", |
32169 |
++ "err %d errno %d retval %d duration %d size %u/%zu\n", |
32170 |
+ err, errno, tattr.retval, tattr.duration, |
32171 |
+ tattr.data_size_out, sizeof(flow_keys)); |
32172 |
+ CHECK_FLOW_KEYS(tests[i].name, flow_keys, tests[i].keys); |
32173 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/global_data.c b/tools/testing/selftests/bpf/prog_tests/global_data.c |
32174 |
+index e3cb62b0a110e..9efa7e50eab27 100644 |
32175 |
+--- a/tools/testing/selftests/bpf/prog_tests/global_data.c |
32176 |
++++ b/tools/testing/selftests/bpf/prog_tests/global_data.c |
32177 |
+@@ -5,7 +5,7 @@ |
32178 |
+ static void test_global_data_number(struct bpf_object *obj, __u32 duration) |
32179 |
+ { |
32180 |
+ int i, err, map_fd; |
32181 |
+- uint64_t num; |
32182 |
++ __u64 num; |
32183 |
+ |
32184 |
+ map_fd = bpf_find_map(__func__, obj, "result_number"); |
32185 |
+ if (CHECK_FAIL(map_fd < 0)) |
32186 |
+@@ -14,7 +14,7 @@ static void test_global_data_number(struct bpf_object *obj, __u32 duration) |
32187 |
+ struct { |
32188 |
+ char *name; |
32189 |
+ uint32_t key; |
32190 |
+- uint64_t num; |
32191 |
++ __u64 num; |
32192 |
+ } tests[] = { |
32193 |
+ { "relocate .bss reference", 0, 0 }, |
32194 |
+ { "relocate .data reference", 1, 42 }, |
32195 |
+@@ -32,7 +32,7 @@ static void test_global_data_number(struct bpf_object *obj, __u32 duration) |
32196 |
+ for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { |
32197 |
+ err = bpf_map_lookup_elem(map_fd, &tests[i].key, &num); |
32198 |
+ CHECK(err || num != tests[i].num, tests[i].name, |
32199 |
+- "err %d result %lx expected %lx\n", |
32200 |
++ "err %d result %llx expected %llx\n", |
32201 |
+ err, num, tests[i].num); |
32202 |
+ } |
32203 |
+ } |
32204 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/mmap.c b/tools/testing/selftests/bpf/prog_tests/mmap.c |
32205 |
+index 43d0b5578f461..9c3c5c0f068fb 100644 |
32206 |
+--- a/tools/testing/selftests/bpf/prog_tests/mmap.c |
32207 |
++++ b/tools/testing/selftests/bpf/prog_tests/mmap.c |
32208 |
+@@ -21,7 +21,7 @@ void test_mmap(void) |
32209 |
+ const long page_size = sysconf(_SC_PAGE_SIZE); |
32210 |
+ int err, duration = 0, i, data_map_fd, data_map_id, tmp_fd, rdmap_fd; |
32211 |
+ struct bpf_map *data_map, *bss_map; |
32212 |
+- void *bss_mmaped = NULL, *map_mmaped = NULL, *tmp1, *tmp2; |
32213 |
++ void *bss_mmaped = NULL, *map_mmaped = NULL, *tmp0, *tmp1, *tmp2; |
32214 |
+ struct test_mmap__bss *bss_data; |
32215 |
+ struct bpf_map_info map_info; |
32216 |
+ __u32 map_info_sz = sizeof(map_info); |
32217 |
+@@ -183,16 +183,23 @@ void test_mmap(void) |
32218 |
+ |
32219 |
+ /* check some more advanced mmap() manipulations */ |
32220 |
+ |
32221 |
++ tmp0 = mmap(NULL, 4 * page_size, PROT_READ, MAP_SHARED | MAP_ANONYMOUS, |
32222 |
++ -1, 0); |
32223 |
++ if (CHECK(tmp0 == MAP_FAILED, "adv_mmap0", "errno %d\n", errno)) |
32224 |
++ goto cleanup; |
32225 |
++ |
32226 |
+ /* map all but last page: pages 1-3 mapped */ |
32227 |
+- tmp1 = mmap(NULL, 3 * page_size, PROT_READ, MAP_SHARED, |
32228 |
++ tmp1 = mmap(tmp0, 3 * page_size, PROT_READ, MAP_SHARED | MAP_FIXED, |
32229 |
+ data_map_fd, 0); |
32230 |
+- if (CHECK(tmp1 == MAP_FAILED, "adv_mmap1", "errno %d\n", errno)) |
32231 |
++ if (CHECK(tmp0 != tmp1, "adv_mmap1", "tmp0: %p, tmp1: %p\n", tmp0, tmp1)) { |
32232 |
++ munmap(tmp0, 4 * page_size); |
32233 |
+ goto cleanup; |
32234 |
++ } |
32235 |
+ |
32236 |
+ /* unmap second page: pages 1, 3 mapped */ |
32237 |
+ err = munmap(tmp1 + page_size, page_size); |
32238 |
+ if (CHECK(err, "adv_mmap2", "errno %d\n", errno)) { |
32239 |
+- munmap(tmp1, map_sz); |
32240 |
++ munmap(tmp1, 4 * page_size); |
32241 |
+ goto cleanup; |
32242 |
+ } |
32243 |
+ |
32244 |
+@@ -201,7 +208,7 @@ void test_mmap(void) |
32245 |
+ MAP_SHARED | MAP_FIXED, data_map_fd, 0); |
32246 |
+ if (CHECK(tmp2 == MAP_FAILED, "adv_mmap3", "errno %d\n", errno)) { |
32247 |
+ munmap(tmp1, page_size); |
32248 |
+- munmap(tmp1 + 2*page_size, page_size); |
32249 |
++ munmap(tmp1 + 2*page_size, 2 * page_size); |
32250 |
+ goto cleanup; |
32251 |
+ } |
32252 |
+ CHECK(tmp1 + page_size != tmp2, "adv_mmap4", |
32253 |
+@@ -211,7 +218,7 @@ void test_mmap(void) |
32254 |
+ tmp2 = mmap(tmp1, 4 * page_size, PROT_READ, MAP_SHARED | MAP_FIXED, |
32255 |
+ data_map_fd, 0); |
32256 |
+ if (CHECK(tmp2 == MAP_FAILED, "adv_mmap5", "errno %d\n", errno)) { |
32257 |
+- munmap(tmp1, 3 * page_size); /* unmap page 1 */ |
32258 |
++ munmap(tmp1, 4 * page_size); /* unmap page 1 */ |
32259 |
+ goto cleanup; |
32260 |
+ } |
32261 |
+ CHECK(tmp1 != tmp2, "adv_mmap6", "tmp1: %p, tmp2: %p\n", tmp1, tmp2); |
32262 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c b/tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c |
32263 |
+index dde2b7ae7bc9e..935a294f049a2 100644 |
32264 |
+--- a/tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c |
32265 |
++++ b/tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c |
32266 |
+@@ -28,7 +28,7 @@ void test_prog_run_xattr(void) |
32267 |
+ "err %d errno %d retval %d\n", err, errno, tattr.retval); |
32268 |
+ |
32269 |
+ CHECK_ATTR(tattr.data_size_out != sizeof(pkt_v4), "data_size_out", |
32270 |
+- "incorrect output size, want %lu have %u\n", |
32271 |
++ "incorrect output size, want %zu have %u\n", |
32272 |
+ sizeof(pkt_v4), tattr.data_size_out); |
32273 |
+ |
32274 |
+ CHECK_ATTR(buf[5] != 0, "overflow", |
32275 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c |
32276 |
+index 7021b92af3134..c61b2b69710a9 100644 |
32277 |
+--- a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c |
32278 |
++++ b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c |
32279 |
+@@ -80,7 +80,7 @@ void test_skb_ctx(void) |
32280 |
+ |
32281 |
+ CHECK_ATTR(tattr.ctx_size_out != sizeof(skb), |
32282 |
+ "ctx_size_out", |
32283 |
+- "incorrect output size, want %lu have %u\n", |
32284 |
++ "incorrect output size, want %zu have %u\n", |
32285 |
+ sizeof(skb), tattr.ctx_size_out); |
32286 |
+ |
32287 |
+ for (i = 0; i < 5; i++) |
32288 |
+diff --git a/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c b/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c |
32289 |
+index 25b068591e9a4..193002b14d7f6 100644 |
32290 |
+--- a/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c |
32291 |
++++ b/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c |
32292 |
+@@ -19,7 +19,7 @@ static int libbpf_debug_print(enum libbpf_print_level level, |
32293 |
+ log_buf = va_arg(args, char *); |
32294 |
+ if (!log_buf) |
32295 |
+ goto out; |
32296 |
+- if (strstr(log_buf, err_str) == 0) |
32297 |
++ if (err_str && strstr(log_buf, err_str) == 0) |
32298 |
+ found = true; |
32299 |
+ out: |
32300 |
+ printf(format, log_buf); |
32301 |
+diff --git a/tools/testing/selftests/bpf/progs/core_reloc_types.h b/tools/testing/selftests/bpf/progs/core_reloc_types.h |
32302 |
+index 34d84717c9464..69139ed662164 100644 |
32303 |
+--- a/tools/testing/selftests/bpf/progs/core_reloc_types.h |
32304 |
++++ b/tools/testing/selftests/bpf/progs/core_reloc_types.h |
32305 |
+@@ -1,5 +1,10 @@ |
32306 |
+ #include <stdint.h> |
32307 |
+ #include <stdbool.h> |
32308 |
++ |
32309 |
++void preserce_ptr_sz_fn(long x) {} |
32310 |
++ |
32311 |
++#define __bpf_aligned __attribute__((aligned(8))) |
32312 |
++ |
32313 |
+ /* |
32314 |
+ * KERNEL |
32315 |
+ */ |
32316 |
+@@ -444,51 +449,51 @@ struct core_reloc_primitives { |
32317 |
+ char a; |
32318 |
+ int b; |
32319 |
+ enum core_reloc_primitives_enum c; |
32320 |
+- void *d; |
32321 |
+- int (*f)(const char *); |
32322 |
++ void *d __bpf_aligned; |
32323 |
++ int (*f)(const char *) __bpf_aligned; |
32324 |
+ }; |
32325 |
+ |
32326 |
+ struct core_reloc_primitives___diff_enum_def { |
32327 |
+ char a; |
32328 |
+ int b; |
32329 |
+- void *d; |
32330 |
+- int (*f)(const char *); |
32331 |
++ void *d __bpf_aligned; |
32332 |
++ int (*f)(const char *) __bpf_aligned; |
32333 |
+ enum { |
32334 |
+ X = 100, |
32335 |
+ Y = 200, |
32336 |
+- } c; /* inline enum def with differing set of values */ |
32337 |
++ } c __bpf_aligned; /* inline enum def with differing set of values */ |
32338 |
+ }; |
32339 |
+ |
32340 |
+ struct core_reloc_primitives___diff_func_proto { |
32341 |
+- void (*f)(int); /* incompatible function prototype */ |
32342 |
+- void *d; |
32343 |
+- enum core_reloc_primitives_enum c; |
32344 |
++ void (*f)(int) __bpf_aligned; /* incompatible function prototype */ |
32345 |
++ void *d __bpf_aligned; |
32346 |
++ enum core_reloc_primitives_enum c __bpf_aligned; |
32347 |
+ int b; |
32348 |
+ char a; |
32349 |
+ }; |
32350 |
+ |
32351 |
+ struct core_reloc_primitives___diff_ptr_type { |
32352 |
+- const char * const d; /* different pointee type + modifiers */ |
32353 |
+- char a; |
32354 |
++ const char * const d __bpf_aligned; /* different pointee type + modifiers */ |
32355 |
++ char a __bpf_aligned; |
32356 |
+ int b; |
32357 |
+ enum core_reloc_primitives_enum c; |
32358 |
+- int (*f)(const char *); |
32359 |
++ int (*f)(const char *) __bpf_aligned; |
32360 |
+ }; |
32361 |
+ |
32362 |
+ struct core_reloc_primitives___err_non_enum { |
32363 |
+ char a[1]; |
32364 |
+ int b; |
32365 |
+ int c; /* int instead of enum */ |
32366 |
+- void *d; |
32367 |
+- int (*f)(const char *); |
32368 |
++ void *d __bpf_aligned; |
32369 |
++ int (*f)(const char *) __bpf_aligned; |
32370 |
+ }; |
32371 |
+ |
32372 |
+ struct core_reloc_primitives___err_non_int { |
32373 |
+ char a[1]; |
32374 |
+- int *b; /* ptr instead of int */ |
32375 |
+- enum core_reloc_primitives_enum c; |
32376 |
+- void *d; |
32377 |
+- int (*f)(const char *); |
32378 |
++ int *b __bpf_aligned; /* ptr instead of int */ |
32379 |
++ enum core_reloc_primitives_enum c __bpf_aligned; |
32380 |
++ void *d __bpf_aligned; |
32381 |
++ int (*f)(const char *) __bpf_aligned; |
32382 |
+ }; |
32383 |
+ |
32384 |
+ struct core_reloc_primitives___err_non_ptr { |
32385 |
+@@ -496,7 +501,7 @@ struct core_reloc_primitives___err_non_ptr { |
32386 |
+ int b; |
32387 |
+ enum core_reloc_primitives_enum c; |
32388 |
+ int d; /* int instead of ptr */ |
32389 |
+- int (*f)(const char *); |
32390 |
++ int (*f)(const char *) __bpf_aligned; |
32391 |
+ }; |
32392 |
+ |
32393 |
+ /* |
32394 |
+@@ -507,7 +512,7 @@ struct core_reloc_mods_output { |
32395 |
+ }; |
32396 |
+ |
32397 |
+ typedef const int int_t; |
32398 |
+-typedef const char *char_ptr_t; |
32399 |
++typedef const char *char_ptr_t __bpf_aligned; |
32400 |
+ typedef const int arr_t[7]; |
32401 |
+ |
32402 |
+ struct core_reloc_mods_substruct { |
32403 |
+@@ -523,9 +528,9 @@ typedef struct { |
32404 |
+ struct core_reloc_mods { |
32405 |
+ int a; |
32406 |
+ int_t b; |
32407 |
+- char *c; |
32408 |
++ char *c __bpf_aligned; |
32409 |
+ char_ptr_t d; |
32410 |
+- int e[3]; |
32411 |
++ int e[3] __bpf_aligned; |
32412 |
+ arr_t f; |
32413 |
+ struct core_reloc_mods_substruct g; |
32414 |
+ core_reloc_mods_substruct_t h; |
32415 |
+@@ -535,9 +540,9 @@ struct core_reloc_mods { |
32416 |
+ struct core_reloc_mods___mod_swap { |
32417 |
+ int b; |
32418 |
+ int_t a; |
32419 |
+- char *d; |
32420 |
++ char *d __bpf_aligned; |
32421 |
+ char_ptr_t c; |
32422 |
+- int f[3]; |
32423 |
++ int f[3] __bpf_aligned; |
32424 |
+ arr_t e; |
32425 |
+ struct { |
32426 |
+ int y; |
32427 |
+@@ -555,7 +560,7 @@ typedef arr1_t arr2_t; |
32428 |
+ typedef arr2_t arr3_t; |
32429 |
+ typedef arr3_t arr4_t; |
32430 |
+ |
32431 |
+-typedef const char * const volatile fancy_char_ptr_t; |
32432 |
++typedef const char * const volatile fancy_char_ptr_t __bpf_aligned; |
32433 |
+ |
32434 |
+ typedef core_reloc_mods_substruct_t core_reloc_mods_substruct_tt; |
32435 |
+ |
32436 |
+@@ -567,7 +572,7 @@ struct core_reloc_mods___typedefs { |
32437 |
+ arr4_t e; |
32438 |
+ fancy_char_ptr_t d; |
32439 |
+ fancy_char_ptr_t c; |
32440 |
+- int3_t b; |
32441 |
++ int3_t b __bpf_aligned; |
32442 |
+ int3_t a; |
32443 |
+ }; |
32444 |
+ |
32445 |
+@@ -739,19 +744,19 @@ struct core_reloc_bitfields___bit_sz_change { |
32446 |
+ int8_t sb4: 1; /* 4 -> 1 */ |
32447 |
+ int32_t sb20: 30; /* 20 -> 30 */ |
32448 |
+ /* non-bitfields */ |
32449 |
+- uint16_t u32; /* 32 -> 16 */ |
32450 |
+- int64_t s32; /* 32 -> 64 */ |
32451 |
++ uint16_t u32; /* 32 -> 16 */ |
32452 |
++ int64_t s32 __bpf_aligned; /* 32 -> 64 */ |
32453 |
+ }; |
32454 |
+ |
32455 |
+ /* turn bitfield into non-bitfield and vice versa */ |
32456 |
+ struct core_reloc_bitfields___bitfield_vs_int { |
32457 |
+ uint64_t ub1; /* 3 -> 64 non-bitfield */ |
32458 |
+ uint8_t ub2; /* 20 -> 8 non-bitfield */ |
32459 |
+- int64_t ub7; /* 7 -> 64 non-bitfield signed */ |
32460 |
+- int64_t sb4; /* 4 -> 64 non-bitfield signed */ |
32461 |
+- uint64_t sb20; /* 20 -> 16 non-bitfield unsigned */ |
32462 |
+- int32_t u32: 20; /* 32 non-bitfield -> 20 bitfield */ |
32463 |
+- uint64_t s32: 60; /* 32 non-bitfield -> 60 bitfield */ |
32464 |
++ int64_t ub7 __bpf_aligned; /* 7 -> 64 non-bitfield signed */ |
32465 |
++ int64_t sb4 __bpf_aligned; /* 4 -> 64 non-bitfield signed */ |
32466 |
++ uint64_t sb20 __bpf_aligned; /* 20 -> 16 non-bitfield unsigned */ |
32467 |
++ int32_t u32: 20; /* 32 non-bitfield -> 20 bitfield */ |
32468 |
++ uint64_t s32: 60 __bpf_aligned; /* 32 non-bitfield -> 60 bitfield */ |
32469 |
+ }; |
32470 |
+ |
32471 |
+ struct core_reloc_bitfields___just_big_enough { |
32472 |
+diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c |
32473 |
+index 305fae8f80a98..c75fc6447186a 100644 |
32474 |
+--- a/tools/testing/selftests/bpf/test_btf.c |
32475 |
++++ b/tools/testing/selftests/bpf/test_btf.c |
32476 |
+@@ -3883,7 +3883,7 @@ static int test_big_btf_info(unsigned int test_num) |
32477 |
+ info_garbage.garbage = 0; |
32478 |
+ err = bpf_obj_get_info_by_fd(btf_fd, info, &info_len); |
32479 |
+ if (CHECK(err || info_len != sizeof(*info), |
32480 |
+- "err:%d errno:%d info_len:%u sizeof(*info):%lu", |
32481 |
++ "err:%d errno:%d info_len:%u sizeof(*info):%zu", |
32482 |
+ err, errno, info_len, sizeof(*info))) { |
32483 |
+ err = -1; |
32484 |
+ goto done; |
32485 |
+@@ -4094,7 +4094,7 @@ static int do_test_get_info(unsigned int test_num) |
32486 |
+ if (CHECK(err || !info.id || info_len != sizeof(info) || |
32487 |
+ info.btf_size != raw_btf_size || |
32488 |
+ (ret = memcmp(raw_btf, user_btf, expected_nbytes)), |
32489 |
+- "err:%d errno:%d info.id:%u info_len:%u sizeof(info):%lu raw_btf_size:%u info.btf_size:%u expected_nbytes:%u memcmp:%d", |
32490 |
++ "err:%d errno:%d info.id:%u info_len:%u sizeof(info):%zu raw_btf_size:%u info.btf_size:%u expected_nbytes:%u memcmp:%d", |
32491 |
+ err, errno, info.id, info_len, sizeof(info), |
32492 |
+ raw_btf_size, info.btf_size, expected_nbytes, ret)) { |
32493 |
+ err = -1; |
32494 |
+@@ -4730,7 +4730,7 @@ ssize_t get_pprint_expected_line(enum pprint_mapv_kind_t mapv_kind, |
32495 |
+ |
32496 |
+ nexpected_line = snprintf(expected_line, line_size, |
32497 |
+ "%s%u: {%u,0,%d,0x%x,0x%x,0x%x," |
32498 |
+- "{%lu|[%u,%u,%u,%u,%u,%u,%u,%u]},%s," |
32499 |
++ "{%llu|[%u,%u,%u,%u,%u,%u,%u,%u]},%s," |
32500 |
+ "%u,0x%x,[[%d,%d],[%d,%d]]}\n", |
32501 |
+ percpu_map ? "\tcpu" : "", |
32502 |
+ percpu_map ? cpu : next_key, |
32503 |
+@@ -4738,7 +4738,7 @@ ssize_t get_pprint_expected_line(enum pprint_mapv_kind_t mapv_kind, |
32504 |
+ v->unused_bits2a, |
32505 |
+ v->bits28, |
32506 |
+ v->unused_bits2b, |
32507 |
+- v->ui64, |
32508 |
++ (__u64)v->ui64, |
32509 |
+ v->ui8a[0], v->ui8a[1], |
32510 |
+ v->ui8a[2], v->ui8a[3], |
32511 |
+ v->ui8a[4], v->ui8a[5], |
32512 |
+diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h |
32513 |
+index b809246039181..b5670350e3263 100644 |
32514 |
+--- a/tools/testing/selftests/bpf/test_progs.h |
32515 |
++++ b/tools/testing/selftests/bpf/test_progs.h |
32516 |
+@@ -133,6 +133,11 @@ static inline __u64 ptr_to_u64(const void *ptr) |
32517 |
+ return (__u64) (unsigned long) ptr; |
32518 |
+ } |
32519 |
+ |
32520 |
++static inline void *u64_to_ptr(__u64 ptr) |
32521 |
++{ |
32522 |
++ return (void *) (unsigned long) ptr; |
32523 |
++} |
32524 |
++ |
32525 |
+ int bpf_find_map(const char *test, struct bpf_object *obj, const char *name); |
32526 |
+ int compare_map_keys(int map1_fd, int map2_fd); |
32527 |
+ int compare_stack_ips(int smap_fd, int amap_fd, int stack_trace_len); |
32528 |
+diff --git a/tools/testing/selftests/net/icmp_redirect.sh b/tools/testing/selftests/net/icmp_redirect.sh |
32529 |
+index 18c5de53558af..bf361f30d6ef9 100755 |
32530 |
+--- a/tools/testing/selftests/net/icmp_redirect.sh |
32531 |
++++ b/tools/testing/selftests/net/icmp_redirect.sh |
32532 |
+@@ -180,6 +180,8 @@ setup() |
32533 |
+ ;; |
32534 |
+ r[12]) ip netns exec $ns sysctl -q -w net.ipv4.ip_forward=1 |
32535 |
+ ip netns exec $ns sysctl -q -w net.ipv4.conf.all.send_redirects=1 |
32536 |
++ ip netns exec $ns sysctl -q -w net.ipv4.conf.default.rp_filter=0 |
32537 |
++ ip netns exec $ns sysctl -q -w net.ipv4.conf.all.rp_filter=0 |
32538 |
+ |
32539 |
+ ip netns exec $ns sysctl -q -w net.ipv6.conf.all.forwarding=1 |
32540 |
+ ip netns exec $ns sysctl -q -w net.ipv6.route.mtu_expires=10 |
32541 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c b/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c |
32542 |
+index a2d7b0e3dca97..a26ac122c759f 100644 |
32543 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c |
32544 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c |
32545 |
+@@ -91,8 +91,6 @@ int back_to_back_ebbs(void) |
32546 |
+ ebb_global_disable(); |
32547 |
+ ebb_freeze_pmcs(); |
32548 |
+ |
32549 |
+- count_pmc(1, sample_period); |
32550 |
+- |
32551 |
+ dump_ebb_state(); |
32552 |
+ |
32553 |
+ event_close(&event); |
32554 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c |
32555 |
+index bc893813483ee..bb9f587fa76e8 100644 |
32556 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c |
32557 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c |
32558 |
+@@ -42,8 +42,6 @@ int cycles(void) |
32559 |
+ ebb_global_disable(); |
32560 |
+ ebb_freeze_pmcs(); |
32561 |
+ |
32562 |
+- count_pmc(1, sample_period); |
32563 |
+- |
32564 |
+ dump_ebb_state(); |
32565 |
+ |
32566 |
+ event_close(&event); |
32567 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c |
32568 |
+index dcd351d203289..9ae795ce314e6 100644 |
32569 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c |
32570 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c |
32571 |
+@@ -99,8 +99,6 @@ int cycles_with_freeze(void) |
32572 |
+ ebb_global_disable(); |
32573 |
+ ebb_freeze_pmcs(); |
32574 |
+ |
32575 |
+- count_pmc(1, sample_period); |
32576 |
+- |
32577 |
+ dump_ebb_state(); |
32578 |
+ |
32579 |
+ printf("EBBs while frozen %d\n", ebbs_while_frozen); |
32580 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c |
32581 |
+index 94c99c12c0f23..4b45a2e70f62b 100644 |
32582 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c |
32583 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c |
32584 |
+@@ -71,8 +71,6 @@ int cycles_with_mmcr2(void) |
32585 |
+ ebb_global_disable(); |
32586 |
+ ebb_freeze_pmcs(); |
32587 |
+ |
32588 |
+- count_pmc(1, sample_period); |
32589 |
+- |
32590 |
+ dump_ebb_state(); |
32591 |
+ |
32592 |
+ event_close(&event); |
32593 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c |
32594 |
+index dfbc5c3ad52d7..21537d6eb6b7d 100644 |
32595 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c |
32596 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c |
32597 |
+@@ -396,8 +396,6 @@ int ebb_child(union pipe read_pipe, union pipe write_pipe) |
32598 |
+ ebb_global_disable(); |
32599 |
+ ebb_freeze_pmcs(); |
32600 |
+ |
32601 |
+- count_pmc(1, sample_period); |
32602 |
+- |
32603 |
+ dump_ebb_state(); |
32604 |
+ |
32605 |
+ event_close(&event); |
32606 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c |
32607 |
+index ca2f7d729155b..b208bf6ad58d3 100644 |
32608 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c |
32609 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c |
32610 |
+@@ -38,8 +38,6 @@ static int victim_child(union pipe read_pipe, union pipe write_pipe) |
32611 |
+ ebb_global_disable(); |
32612 |
+ ebb_freeze_pmcs(); |
32613 |
+ |
32614 |
+- count_pmc(1, sample_period); |
32615 |
+- |
32616 |
+ dump_ebb_state(); |
32617 |
+ |
32618 |
+ FAIL_IF(ebb_state.stats.ebb_count == 0); |
32619 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c b/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c |
32620 |
+index ac3e6e182614a..ba2681a12cc7b 100644 |
32621 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c |
32622 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c |
32623 |
+@@ -75,7 +75,6 @@ static int test_body(void) |
32624 |
+ ebb_freeze_pmcs(); |
32625 |
+ ebb_global_disable(); |
32626 |
+ |
32627 |
+- count_pmc(4, sample_period); |
32628 |
+ mtspr(SPRN_PMC4, 0xdead); |
32629 |
+ |
32630 |
+ dump_summary_ebb_state(); |
32631 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c b/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c |
32632 |
+index b8242e9d97d2d..791d37ba327b5 100644 |
32633 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c |
32634 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c |
32635 |
+@@ -70,13 +70,6 @@ int multi_counter(void) |
32636 |
+ ebb_global_disable(); |
32637 |
+ ebb_freeze_pmcs(); |
32638 |
+ |
32639 |
+- count_pmc(1, sample_period); |
32640 |
+- count_pmc(2, sample_period); |
32641 |
+- count_pmc(3, sample_period); |
32642 |
+- count_pmc(4, sample_period); |
32643 |
+- count_pmc(5, sample_period); |
32644 |
+- count_pmc(6, sample_period); |
32645 |
+- |
32646 |
+ dump_ebb_state(); |
32647 |
+ |
32648 |
+ for (i = 0; i < 6; i++) |
32649 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c b/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c |
32650 |
+index a05c0e18ded63..9b0f70d597020 100644 |
32651 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c |
32652 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c |
32653 |
+@@ -61,8 +61,6 @@ static int cycles_child(void) |
32654 |
+ ebb_global_disable(); |
32655 |
+ ebb_freeze_pmcs(); |
32656 |
+ |
32657 |
+- count_pmc(1, sample_period); |
32658 |
+- |
32659 |
+ dump_summary_ebb_state(); |
32660 |
+ |
32661 |
+ event_close(&event); |
32662 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c b/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c |
32663 |
+index 153ebc92234fd..2904c741e04e5 100644 |
32664 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c |
32665 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c |
32666 |
+@@ -82,8 +82,6 @@ static int test_body(void) |
32667 |
+ ebb_global_disable(); |
32668 |
+ ebb_freeze_pmcs(); |
32669 |
+ |
32670 |
+- count_pmc(1, sample_period); |
32671 |
+- |
32672 |
+ dump_ebb_state(); |
32673 |
+ |
32674 |
+ if (mmcr0_mismatch) |
32675 |
+diff --git a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c |
32676 |
+index eadad75ed7e6f..b29f8ba22d1e6 100644 |
32677 |
+--- a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c |
32678 |
++++ b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c |
32679 |
+@@ -76,8 +76,6 @@ int pmc56_overflow(void) |
32680 |
+ ebb_global_disable(); |
32681 |
+ ebb_freeze_pmcs(); |
32682 |
+ |
32683 |
+- count_pmc(2, sample_period); |
32684 |
+- |
32685 |
+ dump_ebb_state(); |
32686 |
+ |
32687 |
+ printf("PMC5/6 overflow %d\n", pmc56_overflowed); |