1 |
commit: 28c96975c24fae2b42b0573ff32c1abb76602038 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Apr 8 13:15:49 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 8 13:15:49 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=28c96975 |
7 |
|
8 |
Linux patch 5.10.110 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1109_linux-5.10.110.patch | 21603 ++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 21607 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index e51b86fc..958564ab 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -479,6 +479,10 @@ Patch: 1108_linux-5.10.109.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.109 |
23 |
|
24 |
+Patch: 1109_linux-5.10.110.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.110 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1109_linux-5.10.110.patch b/1109_linux-5.10.110.patch |
33 |
new file mode 100644 |
34 |
index 00000000..6efeb944 |
35 |
--- /dev/null |
36 |
+++ b/1109_linux-5.10.110.patch |
37 |
@@ -0,0 +1,21603 @@ |
38 |
+diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst |
39 |
+index 7d5e8a67c775f..e338306f45873 100644 |
40 |
+--- a/Documentation/admin-guide/sysctl/kernel.rst |
41 |
++++ b/Documentation/admin-guide/sysctl/kernel.rst |
42 |
+@@ -787,6 +787,7 @@ bit 1 print system memory info |
43 |
+ bit 2 print timer info |
44 |
+ bit 3 print locks info if ``CONFIG_LOCKDEP`` is on |
45 |
+ bit 4 print ftrace buffer |
46 |
++bit 5 print all printk messages in buffer |
47 |
+ ===== ============================================ |
48 |
+ |
49 |
+ So for example to print tasks and memory info on panic, user can:: |
50 |
+diff --git a/Documentation/core-api/dma-attributes.rst b/Documentation/core-api/dma-attributes.rst |
51 |
+index 1887d92e8e926..17706dc91ec9f 100644 |
52 |
+--- a/Documentation/core-api/dma-attributes.rst |
53 |
++++ b/Documentation/core-api/dma-attributes.rst |
54 |
+@@ -130,3 +130,11 @@ accesses to DMA buffers in both privileged "supervisor" and unprivileged |
55 |
+ subsystem that the buffer is fully accessible at the elevated privilege |
56 |
+ level (and ideally inaccessible or at least read-only at the |
57 |
+ lesser-privileged levels). |
58 |
++ |
59 |
++DMA_ATTR_OVERWRITE |
60 |
++------------------ |
61 |
++ |
62 |
++This is a hint to the DMA-mapping subsystem that the device is expected to |
63 |
++overwrite the entire mapped size, thus the caller does not require any of the |
64 |
++previous buffer contents to be preserved. This allows bounce-buffering |
65 |
++implementations to optimise DMA_FROM_DEVICE transfers. |
66 |
+diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml |
67 |
+index b29050fd7470a..6fe2a3d8ee6b8 100644 |
68 |
+--- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml |
69 |
++++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml |
70 |
+@@ -44,7 +44,7 @@ patternProperties: |
71 |
+ properties: |
72 |
+ reg: |
73 |
+ description: |
74 |
+- Contains the native Ready/Busy IDs. |
75 |
++ Contains the chip-select IDs. |
76 |
+ |
77 |
+ nand-ecc-mode: |
78 |
+ description: |
79 |
+@@ -174,6 +174,6 @@ examples: |
80 |
+ nand-ecc-mode = "soft"; |
81 |
+ nand-ecc-algo = "bch"; |
82 |
+ |
83 |
+- /* controller specific properties */ |
84 |
++ /* NAND chip specific properties */ |
85 |
+ }; |
86 |
+ }; |
87 |
+diff --git a/Documentation/devicetree/bindings/spi/spi-mxic.txt b/Documentation/devicetree/bindings/spi/spi-mxic.txt |
88 |
+index 529f2dab2648a..7bcbb229b78bb 100644 |
89 |
+--- a/Documentation/devicetree/bindings/spi/spi-mxic.txt |
90 |
++++ b/Documentation/devicetree/bindings/spi/spi-mxic.txt |
91 |
+@@ -8,11 +8,13 @@ Required properties: |
92 |
+ - reg: should contain 2 entries, one for the registers and one for the direct |
93 |
+ mapping area |
94 |
+ - reg-names: should contain "regs" and "dirmap" |
95 |
+-- interrupts: interrupt line connected to the SPI controller |
96 |
+ - clock-names: should contain "ps_clk", "send_clk" and "send_dly_clk" |
97 |
+ - clocks: should contain 3 entries for the "ps_clk", "send_clk" and |
98 |
+ "send_dly_clk" clocks |
99 |
+ |
100 |
++Optional properties: |
101 |
++- interrupts: interrupt line connected to the SPI controller |
102 |
++ |
103 |
+ Example: |
104 |
+ |
105 |
+ spi@43c30000 { |
106 |
+diff --git a/Documentation/process/stable-kernel-rules.rst b/Documentation/process/stable-kernel-rules.rst |
107 |
+index 003c865e9c212..fbcb48bc2a903 100644 |
108 |
+--- a/Documentation/process/stable-kernel-rules.rst |
109 |
++++ b/Documentation/process/stable-kernel-rules.rst |
110 |
+@@ -168,7 +168,16 @@ Trees |
111 |
+ - The finalized and tagged releases of all stable kernels can be found |
112 |
+ in separate branches per version at: |
113 |
+ |
114 |
+- https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git |
115 |
++ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git |
116 |
++ |
117 |
++ - The release candidate of all stable kernel versions can be found at: |
118 |
++ |
119 |
++ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/ |
120 |
++ |
121 |
++ .. warning:: |
122 |
++ The -stable-rc tree is a snapshot in time of the stable-queue tree and |
123 |
++ will change frequently, hence will be rebased often. It should only be |
124 |
++ used for testing purposes (e.g. to be consumed by CI systems). |
125 |
+ |
126 |
+ |
127 |
+ Review committee |
128 |
+diff --git a/Documentation/sound/hd-audio/models.rst b/Documentation/sound/hd-audio/models.rst |
129 |
+index d25335993e553..9b52f50a68542 100644 |
130 |
+--- a/Documentation/sound/hd-audio/models.rst |
131 |
++++ b/Documentation/sound/hd-audio/models.rst |
132 |
+@@ -261,6 +261,10 @@ alc-sense-combo |
133 |
+ huawei-mbx-stereo |
134 |
+ Enable initialization verbs for Huawei MBX stereo speakers; |
135 |
+ might be risky, try this at your own risk |
136 |
++alc298-samsung-headphone |
137 |
++ Samsung laptops with ALC298 |
138 |
++alc256-samsung-headphone |
139 |
++ Samsung laptops with ALC256 |
140 |
+ |
141 |
+ ALC66x/67x/892 |
142 |
+ ============== |
143 |
+diff --git a/Makefile b/Makefile |
144 |
+index 3b462df1134b6..c4674e8bb3e81 100644 |
145 |
+--- a/Makefile |
146 |
++++ b/Makefile |
147 |
+@@ -1,7 +1,7 @@ |
148 |
+ # SPDX-License-Identifier: GPL-2.0 |
149 |
+ VERSION = 5 |
150 |
+ PATCHLEVEL = 10 |
151 |
+-SUBLEVEL = 109 |
152 |
++SUBLEVEL = 110 |
153 |
+ EXTRAVERSION = |
154 |
+ NAME = Dare mighty things |
155 |
+ |
156 |
+diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c |
157 |
+index 37f724ad5e399..a85e9c625ab50 100644 |
158 |
+--- a/arch/arc/kernel/process.c |
159 |
++++ b/arch/arc/kernel/process.c |
160 |
+@@ -43,7 +43,7 @@ SYSCALL_DEFINE0(arc_gettls) |
161 |
+ return task_thread_info(current)->thr_ptr; |
162 |
+ } |
163 |
+ |
164 |
+-SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) |
165 |
++SYSCALL_DEFINE3(arc_usr_cmpxchg, int __user *, uaddr, int, expected, int, new) |
166 |
+ { |
167 |
+ struct pt_regs *regs = current_pt_regs(); |
168 |
+ u32 uval; |
169 |
+diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi |
170 |
+index e46a3f4ad350a..b50229c3102fa 100644 |
171 |
+--- a/arch/arm/boot/dts/bcm2711.dtsi |
172 |
++++ b/arch/arm/boot/dts/bcm2711.dtsi |
173 |
+@@ -433,12 +433,26 @@ |
174 |
+ #size-cells = <0>; |
175 |
+ enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit |
176 |
+ |
177 |
++ /* Source for d/i-cache-line-size and d/i-cache-sets |
178 |
++ * https://developer.arm.com/documentation/100095/0003 |
179 |
++ * /Level-1-Memory-System/About-the-L1-memory-system?lang=en |
180 |
++ * Source for d/i-cache-size |
181 |
++ * https://www.raspberrypi.com/documentation/computers |
182 |
++ * /processors.html#bcm2711 |
183 |
++ */ |
184 |
+ cpu0: cpu@0 { |
185 |
+ device_type = "cpu"; |
186 |
+ compatible = "arm,cortex-a72"; |
187 |
+ reg = <0>; |
188 |
+ enable-method = "spin-table"; |
189 |
+ cpu-release-addr = <0x0 0x000000d8>; |
190 |
++ d-cache-size = <0x8000>; |
191 |
++ d-cache-line-size = <64>; |
192 |
++ d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
193 |
++ i-cache-size = <0xc000>; |
194 |
++ i-cache-line-size = <64>; |
195 |
++ i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set |
196 |
++ next-level-cache = <&l2>; |
197 |
+ }; |
198 |
+ |
199 |
+ cpu1: cpu@1 { |
200 |
+@@ -447,6 +461,13 @@ |
201 |
+ reg = <1>; |
202 |
+ enable-method = "spin-table"; |
203 |
+ cpu-release-addr = <0x0 0x000000e0>; |
204 |
++ d-cache-size = <0x8000>; |
205 |
++ d-cache-line-size = <64>; |
206 |
++ d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
207 |
++ i-cache-size = <0xc000>; |
208 |
++ i-cache-line-size = <64>; |
209 |
++ i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set |
210 |
++ next-level-cache = <&l2>; |
211 |
+ }; |
212 |
+ |
213 |
+ cpu2: cpu@2 { |
214 |
+@@ -455,6 +476,13 @@ |
215 |
+ reg = <2>; |
216 |
+ enable-method = "spin-table"; |
217 |
+ cpu-release-addr = <0x0 0x000000e8>; |
218 |
++ d-cache-size = <0x8000>; |
219 |
++ d-cache-line-size = <64>; |
220 |
++ d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
221 |
++ i-cache-size = <0xc000>; |
222 |
++ i-cache-line-size = <64>; |
223 |
++ i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set |
224 |
++ next-level-cache = <&l2>; |
225 |
+ }; |
226 |
+ |
227 |
+ cpu3: cpu@3 { |
228 |
+@@ -463,6 +491,28 @@ |
229 |
+ reg = <3>; |
230 |
+ enable-method = "spin-table"; |
231 |
+ cpu-release-addr = <0x0 0x000000f0>; |
232 |
++ d-cache-size = <0x8000>; |
233 |
++ d-cache-line-size = <64>; |
234 |
++ d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
235 |
++ i-cache-size = <0xc000>; |
236 |
++ i-cache-line-size = <64>; |
237 |
++ i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set |
238 |
++ next-level-cache = <&l2>; |
239 |
++ }; |
240 |
++ |
241 |
++ /* Source for d/i-cache-line-size and d/i-cache-sets |
242 |
++ * https://developer.arm.com/documentation/100095/0003 |
243 |
++ * /Level-2-Memory-System/About-the-L2-memory-system?lang=en |
244 |
++ * Source for d/i-cache-size |
245 |
++ * https://www.raspberrypi.com/documentation/computers |
246 |
++ * /processors.html#bcm2711 |
247 |
++ */ |
248 |
++ l2: l2-cache0 { |
249 |
++ compatible = "cache"; |
250 |
++ cache-size = <0x100000>; |
251 |
++ cache-line-size = <64>; |
252 |
++ cache-sets = <1024>; // 1MiB(size)/64(line-size)=16384ways/16-way set |
253 |
++ cache-level = <2>; |
254 |
+ }; |
255 |
+ }; |
256 |
+ |
257 |
+diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi |
258 |
+index 0199ec98cd616..5dbdebc462594 100644 |
259 |
+--- a/arch/arm/boot/dts/bcm2837.dtsi |
260 |
++++ b/arch/arm/boot/dts/bcm2837.dtsi |
261 |
+@@ -40,12 +40,26 @@ |
262 |
+ #size-cells = <0>; |
263 |
+ enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit |
264 |
+ |
265 |
++ /* Source for d/i-cache-line-size and d/i-cache-sets |
266 |
++ * https://developer.arm.com/documentation/ddi0500/e/level-1-memory-system |
267 |
++ * /about-the-l1-memory-system?lang=en |
268 |
++ * |
269 |
++ * Source for d/i-cache-size |
270 |
++ * https://magpi.raspberrypi.com/articles/raspberry-pi-3-specs-benchmarks |
271 |
++ */ |
272 |
+ cpu0: cpu@0 { |
273 |
+ device_type = "cpu"; |
274 |
+ compatible = "arm,cortex-a53"; |
275 |
+ reg = <0>; |
276 |
+ enable-method = "spin-table"; |
277 |
+ cpu-release-addr = <0x0 0x000000d8>; |
278 |
++ d-cache-size = <0x8000>; |
279 |
++ d-cache-line-size = <64>; |
280 |
++ d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
281 |
++ i-cache-size = <0x8000>; |
282 |
++ i-cache-line-size = <64>; |
283 |
++ i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
284 |
++ next-level-cache = <&l2>; |
285 |
+ }; |
286 |
+ |
287 |
+ cpu1: cpu@1 { |
288 |
+@@ -54,6 +68,13 @@ |
289 |
+ reg = <1>; |
290 |
+ enable-method = "spin-table"; |
291 |
+ cpu-release-addr = <0x0 0x000000e0>; |
292 |
++ d-cache-size = <0x8000>; |
293 |
++ d-cache-line-size = <64>; |
294 |
++ d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
295 |
++ i-cache-size = <0x8000>; |
296 |
++ i-cache-line-size = <64>; |
297 |
++ i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
298 |
++ next-level-cache = <&l2>; |
299 |
+ }; |
300 |
+ |
301 |
+ cpu2: cpu@2 { |
302 |
+@@ -62,6 +83,13 @@ |
303 |
+ reg = <2>; |
304 |
+ enable-method = "spin-table"; |
305 |
+ cpu-release-addr = <0x0 0x000000e8>; |
306 |
++ d-cache-size = <0x8000>; |
307 |
++ d-cache-line-size = <64>; |
308 |
++ d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
309 |
++ i-cache-size = <0x8000>; |
310 |
++ i-cache-line-size = <64>; |
311 |
++ i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
312 |
++ next-level-cache = <&l2>; |
313 |
+ }; |
314 |
+ |
315 |
+ cpu3: cpu@3 { |
316 |
+@@ -70,6 +98,27 @@ |
317 |
+ reg = <3>; |
318 |
+ enable-method = "spin-table"; |
319 |
+ cpu-release-addr = <0x0 0x000000f0>; |
320 |
++ d-cache-size = <0x8000>; |
321 |
++ d-cache-line-size = <64>; |
322 |
++ d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
323 |
++ i-cache-size = <0x8000>; |
324 |
++ i-cache-line-size = <64>; |
325 |
++ i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
326 |
++ next-level-cache = <&l2>; |
327 |
++ }; |
328 |
++ |
329 |
++ /* Source for cache-line-size + cache-sets |
330 |
++ * https://developer.arm.com/documentation/ddi0500 |
331 |
++ * /e/level-2-memory-system/about-the-l2-memory-system?lang=en |
332 |
++ * Source for cache-size |
333 |
++ * https://datasheets.raspberrypi.com/cm/cm1-and-cm3-datasheet.pdf |
334 |
++ */ |
335 |
++ l2: l2-cache0 { |
336 |
++ compatible = "cache"; |
337 |
++ cache-size = <0x80000>; |
338 |
++ cache-line-size = <64>; |
339 |
++ cache-sets = <512>; // 512KiB(size)/64(line-size)=8192ways/16-way set |
340 |
++ cache-level = <2>; |
341 |
+ }; |
342 |
+ }; |
343 |
+ }; |
344 |
+diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi |
345 |
+index 30b72f4318501..f8c0eee7a62b9 100644 |
346 |
+--- a/arch/arm/boot/dts/dra7-l4.dtsi |
347 |
++++ b/arch/arm/boot/dts/dra7-l4.dtsi |
348 |
+@@ -3448,8 +3448,7 @@ |
349 |
+ ti,timer-pwm; |
350 |
+ }; |
351 |
+ }; |
352 |
+- |
353 |
+- target-module@2c000 { /* 0x4882c000, ap 17 02.0 */ |
354 |
++ timer15_target: target-module@2c000 { /* 0x4882c000, ap 17 02.0 */ |
355 |
+ compatible = "ti,sysc-omap4-timer", "ti,sysc"; |
356 |
+ reg = <0x2c000 0x4>, |
357 |
+ <0x2c010 0x4>; |
358 |
+@@ -3477,7 +3476,7 @@ |
359 |
+ }; |
360 |
+ }; |
361 |
+ |
362 |
+- target-module@2e000 { /* 0x4882e000, ap 19 14.0 */ |
363 |
++ timer16_target: target-module@2e000 { /* 0x4882e000, ap 19 14.0 */ |
364 |
+ compatible = "ti,sysc-omap4-timer", "ti,sysc"; |
365 |
+ reg = <0x2e000 0x4>, |
366 |
+ <0x2e010 0x4>; |
367 |
+diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi |
368 |
+index 7ecf8f86ac747..9989321366560 100644 |
369 |
+--- a/arch/arm/boot/dts/dra7.dtsi |
370 |
++++ b/arch/arm/boot/dts/dra7.dtsi |
371 |
+@@ -1093,20 +1093,20 @@ |
372 |
+ }; |
373 |
+ |
374 |
+ /* Local timers, see ARM architected timer wrap erratum i940 */ |
375 |
+-&timer3_target { |
376 |
++&timer15_target { |
377 |
+ ti,no-reset-on-init; |
378 |
+ ti,no-idle; |
379 |
+ timer@0 { |
380 |
+- assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER3_CLKCTRL 24>; |
381 |
++ assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER15_CLKCTRL 24>; |
382 |
+ assigned-clock-parents = <&timer_sys_clk_div>; |
383 |
+ }; |
384 |
+ }; |
385 |
+ |
386 |
+-&timer4_target { |
387 |
++&timer16_target { |
388 |
+ ti,no-reset-on-init; |
389 |
+ ti,no-idle; |
390 |
+ timer@0 { |
391 |
+- assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER4_CLKCTRL 24>; |
392 |
++ assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER16_CLKCTRL 24>; |
393 |
+ assigned-clock-parents = <&timer_sys_clk_div>; |
394 |
+ }; |
395 |
+ }; |
396 |
+diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi |
397 |
+index d31a68672bfac..d7d756614edd1 100644 |
398 |
+--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi |
399 |
++++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi |
400 |
+@@ -260,7 +260,7 @@ |
401 |
+ }; |
402 |
+ |
403 |
+ uart3_data: uart3-data { |
404 |
+- samsung,pins = "gpa1-4", "gpa1-4"; |
405 |
++ samsung,pins = "gpa1-4", "gpa1-5"; |
406 |
+ samsung,pin-function = <EXYNOS_PIN_FUNC_2>; |
407 |
+ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
408 |
+ samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>; |
409 |
+diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts |
410 |
+index d0e48c10aec2b..572198b6834e6 100644 |
411 |
+--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts |
412 |
++++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts |
413 |
+@@ -118,6 +118,9 @@ |
414 |
+ status = "okay"; |
415 |
+ ddc = <&i2c_2>; |
416 |
+ hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; |
417 |
++ vdd-supply = <&ldo8_reg>; |
418 |
++ vdd_osc-supply = <&ldo10_reg>; |
419 |
++ vdd_pll-supply = <&ldo8_reg>; |
420 |
+ }; |
421 |
+ |
422 |
+ &i2c_0 { |
423 |
+diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts |
424 |
+index 4e49d8095b292..741294bd564e7 100644 |
425 |
+--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts |
426 |
++++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts |
427 |
+@@ -124,6 +124,9 @@ |
428 |
+ hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; |
429 |
+ pinctrl-names = "default"; |
430 |
+ pinctrl-0 = <&hdmi_hpd_irq>; |
431 |
++ vdd-supply = <&ldo6_reg>; |
432 |
++ vdd_osc-supply = <&ldo7_reg>; |
433 |
++ vdd_pll-supply = <&ldo6_reg>; |
434 |
+ }; |
435 |
+ |
436 |
+ &hsi2c_4 { |
437 |
+diff --git a/arch/arm/boot/dts/imx53-m53menlo.dts b/arch/arm/boot/dts/imx53-m53menlo.dts |
438 |
+index 4f88e96d81ddb..d5c68d1ea707c 100644 |
439 |
+--- a/arch/arm/boot/dts/imx53-m53menlo.dts |
440 |
++++ b/arch/arm/boot/dts/imx53-m53menlo.dts |
441 |
+@@ -53,6 +53,31 @@ |
442 |
+ }; |
443 |
+ }; |
444 |
+ |
445 |
++ lvds-decoder { |
446 |
++ compatible = "ti,ds90cf364a", "lvds-decoder"; |
447 |
++ |
448 |
++ ports { |
449 |
++ #address-cells = <1>; |
450 |
++ #size-cells = <0>; |
451 |
++ |
452 |
++ port@0 { |
453 |
++ reg = <0>; |
454 |
++ |
455 |
++ lvds_decoder_in: endpoint { |
456 |
++ remote-endpoint = <&lvds0_out>; |
457 |
++ }; |
458 |
++ }; |
459 |
++ |
460 |
++ port@1 { |
461 |
++ reg = <1>; |
462 |
++ |
463 |
++ lvds_decoder_out: endpoint { |
464 |
++ remote-endpoint = <&panel_in>; |
465 |
++ }; |
466 |
++ }; |
467 |
++ }; |
468 |
++ }; |
469 |
++ |
470 |
+ panel { |
471 |
+ compatible = "edt,etm0700g0dh6"; |
472 |
+ pinctrl-0 = <&pinctrl_display_gpio>; |
473 |
+@@ -61,7 +86,7 @@ |
474 |
+ |
475 |
+ port { |
476 |
+ panel_in: endpoint { |
477 |
+- remote-endpoint = <&lvds0_out>; |
478 |
++ remote-endpoint = <&lvds_decoder_out>; |
479 |
+ }; |
480 |
+ }; |
481 |
+ }; |
482 |
+@@ -450,7 +475,7 @@ |
483 |
+ reg = <2>; |
484 |
+ |
485 |
+ lvds0_out: endpoint { |
486 |
+- remote-endpoint = <&panel_in>; |
487 |
++ remote-endpoint = <&lvds_decoder_in>; |
488 |
+ }; |
489 |
+ }; |
490 |
+ }; |
491 |
+diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi b/arch/arm/boot/dts/imx7-colibri.dtsi |
492 |
+index 62b771c1d5a9a..f1c60b0cb143e 100644 |
493 |
+--- a/arch/arm/boot/dts/imx7-colibri.dtsi |
494 |
++++ b/arch/arm/boot/dts/imx7-colibri.dtsi |
495 |
+@@ -40,7 +40,7 @@ |
496 |
+ |
497 |
+ dailink_master: simple-audio-card,codec { |
498 |
+ sound-dai = <&codec>; |
499 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
500 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
501 |
+ }; |
502 |
+ }; |
503 |
+ }; |
504 |
+@@ -293,7 +293,7 @@ |
505 |
+ compatible = "fsl,sgtl5000"; |
506 |
+ #sound-dai-cells = <0>; |
507 |
+ reg = <0x0a>; |
508 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
509 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
510 |
+ pinctrl-names = "default"; |
511 |
+ pinctrl-0 = <&pinctrl_sai1_mclk>; |
512 |
+ VDDA-supply = <®_module_3v3_avdd>; |
513 |
+diff --git a/arch/arm/boot/dts/imx7-mba7.dtsi b/arch/arm/boot/dts/imx7-mba7.dtsi |
514 |
+index 50abf18ad30b2..887497e3bb4b8 100644 |
515 |
+--- a/arch/arm/boot/dts/imx7-mba7.dtsi |
516 |
++++ b/arch/arm/boot/dts/imx7-mba7.dtsi |
517 |
+@@ -250,7 +250,7 @@ |
518 |
+ tlv320aic32x4: audio-codec@18 { |
519 |
+ compatible = "ti,tlv320aic32x4"; |
520 |
+ reg = <0x18>; |
521 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
522 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
523 |
+ clock-names = "mclk"; |
524 |
+ ldoin-supply = <®_audio_3v3>; |
525 |
+ iov-supply = <®_audio_3v3>; |
526 |
+diff --git a/arch/arm/boot/dts/imx7d-nitrogen7.dts b/arch/arm/boot/dts/imx7d-nitrogen7.dts |
527 |
+index e0751e6ba3c0f..a31de900139d6 100644 |
528 |
+--- a/arch/arm/boot/dts/imx7d-nitrogen7.dts |
529 |
++++ b/arch/arm/boot/dts/imx7d-nitrogen7.dts |
530 |
+@@ -288,7 +288,7 @@ |
531 |
+ codec: wm8960@1a { |
532 |
+ compatible = "wlf,wm8960"; |
533 |
+ reg = <0x1a>; |
534 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
535 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
536 |
+ clock-names = "mclk"; |
537 |
+ wlf,shared-lrclk; |
538 |
+ }; |
539 |
+diff --git a/arch/arm/boot/dts/imx7d-pico-hobbit.dts b/arch/arm/boot/dts/imx7d-pico-hobbit.dts |
540 |
+index 7b2198a9372c6..d917dc4f2f227 100644 |
541 |
+--- a/arch/arm/boot/dts/imx7d-pico-hobbit.dts |
542 |
++++ b/arch/arm/boot/dts/imx7d-pico-hobbit.dts |
543 |
+@@ -31,7 +31,7 @@ |
544 |
+ |
545 |
+ dailink_master: simple-audio-card,codec { |
546 |
+ sound-dai = <&sgtl5000>; |
547 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
548 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
549 |
+ }; |
550 |
+ }; |
551 |
+ }; |
552 |
+@@ -41,7 +41,7 @@ |
553 |
+ #sound-dai-cells = <0>; |
554 |
+ reg = <0x0a>; |
555 |
+ compatible = "fsl,sgtl5000"; |
556 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
557 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
558 |
+ VDDA-supply = <®_2p5v>; |
559 |
+ VDDIO-supply = <®_vref_1v8>; |
560 |
+ }; |
561 |
+diff --git a/arch/arm/boot/dts/imx7d-pico-pi.dts b/arch/arm/boot/dts/imx7d-pico-pi.dts |
562 |
+index 70bea95c06d83..f263e391e24cb 100644 |
563 |
+--- a/arch/arm/boot/dts/imx7d-pico-pi.dts |
564 |
++++ b/arch/arm/boot/dts/imx7d-pico-pi.dts |
565 |
+@@ -31,7 +31,7 @@ |
566 |
+ |
567 |
+ dailink_master: simple-audio-card,codec { |
568 |
+ sound-dai = <&sgtl5000>; |
569 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
570 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
571 |
+ }; |
572 |
+ }; |
573 |
+ }; |
574 |
+@@ -41,7 +41,7 @@ |
575 |
+ #sound-dai-cells = <0>; |
576 |
+ reg = <0x0a>; |
577 |
+ compatible = "fsl,sgtl5000"; |
578 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
579 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
580 |
+ VDDA-supply = <®_2p5v>; |
581 |
+ VDDIO-supply = <®_vref_1v8>; |
582 |
+ }; |
583 |
+diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts |
584 |
+index ac0751bc1177e..6823b9f1a2a32 100644 |
585 |
+--- a/arch/arm/boot/dts/imx7d-sdb.dts |
586 |
++++ b/arch/arm/boot/dts/imx7d-sdb.dts |
587 |
+@@ -378,14 +378,14 @@ |
588 |
+ codec: wm8960@1a { |
589 |
+ compatible = "wlf,wm8960"; |
590 |
+ reg = <0x1a>; |
591 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
592 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
593 |
+ clock-names = "mclk"; |
594 |
+ wlf,shared-lrclk; |
595 |
+ wlf,hp-cfg = <2 2 3>; |
596 |
+ wlf,gpio-cfg = <1 3>; |
597 |
+ assigned-clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_SRC>, |
598 |
+ <&clks IMX7D_PLL_AUDIO_POST_DIV>, |
599 |
+- <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
600 |
++ <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
601 |
+ assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>; |
602 |
+ assigned-clock-rates = <0>, <884736000>, <12288000>; |
603 |
+ }; |
604 |
+diff --git a/arch/arm/boot/dts/imx7s-warp.dts b/arch/arm/boot/dts/imx7s-warp.dts |
605 |
+index d6b4888fa686b..e035dd5bf4f62 100644 |
606 |
+--- a/arch/arm/boot/dts/imx7s-warp.dts |
607 |
++++ b/arch/arm/boot/dts/imx7s-warp.dts |
608 |
+@@ -75,7 +75,7 @@ |
609 |
+ |
610 |
+ dailink_master: simple-audio-card,codec { |
611 |
+ sound-dai = <&codec>; |
612 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
613 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
614 |
+ }; |
615 |
+ }; |
616 |
+ }; |
617 |
+@@ -232,7 +232,7 @@ |
618 |
+ #sound-dai-cells = <0>; |
619 |
+ reg = <0x0a>; |
620 |
+ compatible = "fsl,sgtl5000"; |
621 |
+- clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; |
622 |
++ clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; |
623 |
+ pinctrl-names = "default"; |
624 |
+ pinctrl-0 = <&pinctrl_sai1_mclk>; |
625 |
+ VDDA-supply = <&vgen4_reg>; |
626 |
+diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi |
627 |
+index 74d8e2c8e4b34..3defd47fd8fab 100644 |
628 |
+--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi |
629 |
++++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi |
630 |
+@@ -142,7 +142,8 @@ |
631 |
+ clocks { |
632 |
+ sleep_clk: sleep_clk { |
633 |
+ compatible = "fixed-clock"; |
634 |
+- clock-frequency = <32768>; |
635 |
++ clock-frequency = <32000>; |
636 |
++ clock-output-names = "gcc_sleep_clk_src"; |
637 |
+ #clock-cells = <0>; |
638 |
+ }; |
639 |
+ |
640 |
+diff --git a/arch/arm/boot/dts/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom-msm8960.dtsi |
641 |
+index 172ea3c70eac2..c197927e7435f 100644 |
642 |
+--- a/arch/arm/boot/dts/qcom-msm8960.dtsi |
643 |
++++ b/arch/arm/boot/dts/qcom-msm8960.dtsi |
644 |
+@@ -146,7 +146,9 @@ |
645 |
+ reg = <0x108000 0x1000>; |
646 |
+ qcom,ipc = <&l2cc 0x8 2>; |
647 |
+ |
648 |
+- interrupts = <0 19 0>, <0 21 0>, <0 22 0>; |
649 |
++ interrupts = <GIC_SPI 19 IRQ_TYPE_EDGE_RISING>, |
650 |
++ <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>, |
651 |
++ <GIC_SPI 22 IRQ_TYPE_EDGE_RISING>; |
652 |
+ interrupt-names = "ack", "err", "wakeup"; |
653 |
+ |
654 |
+ regulators { |
655 |
+@@ -192,7 +194,7 @@ |
656 |
+ compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; |
657 |
+ reg = <0x16440000 0x1000>, |
658 |
+ <0x16400000 0x1000>; |
659 |
+- interrupts = <0 154 0x0>; |
660 |
++ interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>; |
661 |
+ clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>; |
662 |
+ clock-names = "core", "iface"; |
663 |
+ status = "disabled"; |
664 |
+@@ -318,7 +320,7 @@ |
665 |
+ #address-cells = <1>; |
666 |
+ #size-cells = <0>; |
667 |
+ reg = <0x16080000 0x1000>; |
668 |
+- interrupts = <0 147 0>; |
669 |
++ interrupts = <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>; |
670 |
+ spi-max-frequency = <24000000>; |
671 |
+ cs-gpios = <&msmgpio 8 0>; |
672 |
+ |
673 |
+diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi |
674 |
+index 2c4952427296e..12f57278ba4a5 100644 |
675 |
+--- a/arch/arm/boot/dts/sama5d2.dtsi |
676 |
++++ b/arch/arm/boot/dts/sama5d2.dtsi |
677 |
+@@ -413,7 +413,7 @@ |
678 |
+ pmecc: ecc-engine@f8014070 { |
679 |
+ compatible = "atmel,sama5d2-pmecc"; |
680 |
+ reg = <0xf8014070 0x490>, |
681 |
+- <0xf8014500 0x100>; |
682 |
++ <0xf8014500 0x200>; |
683 |
+ }; |
684 |
+ }; |
685 |
+ |
686 |
+diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi |
687 |
+index 1a8f5e8b10e3a..66cd473ecb617 100644 |
688 |
+--- a/arch/arm/boot/dts/spear1340.dtsi |
689 |
++++ b/arch/arm/boot/dts/spear1340.dtsi |
690 |
+@@ -136,9 +136,9 @@ |
691 |
+ reg = <0xb4100000 0x1000>; |
692 |
+ interrupts = <0 105 0x4>; |
693 |
+ status = "disabled"; |
694 |
+- dmas = <&dwdma0 12 0 1>, |
695 |
+- <&dwdma0 13 1 0>; |
696 |
+- dma-names = "tx", "rx"; |
697 |
++ dmas = <&dwdma0 13 0 1>, |
698 |
++ <&dwdma0 12 1 0>; |
699 |
++ dma-names = "rx", "tx"; |
700 |
+ }; |
701 |
+ |
702 |
+ thermal@e07008c4 { |
703 |
+diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi |
704 |
+index c87b881b2c8bb..9135533676879 100644 |
705 |
+--- a/arch/arm/boot/dts/spear13xx.dtsi |
706 |
++++ b/arch/arm/boot/dts/spear13xx.dtsi |
707 |
+@@ -284,9 +284,9 @@ |
708 |
+ #size-cells = <0>; |
709 |
+ interrupts = <0 31 0x4>; |
710 |
+ status = "disabled"; |
711 |
+- dmas = <&dwdma0 4 0 0>, |
712 |
+- <&dwdma0 5 0 0>; |
713 |
+- dma-names = "tx", "rx"; |
714 |
++ dmas = <&dwdma0 5 0 0>, |
715 |
++ <&dwdma0 4 0 0>; |
716 |
++ dma-names = "rx", "tx"; |
717 |
+ }; |
718 |
+ |
719 |
+ rtc@e0580000 { |
720 |
+diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi |
721 |
+index 89abd4cc7e23a..b21ecb820b133 100644 |
722 |
+--- a/arch/arm/boot/dts/sun8i-v3s.dtsi |
723 |
++++ b/arch/arm/boot/dts/sun8i-v3s.dtsi |
724 |
+@@ -524,6 +524,17 @@ |
725 |
+ #size-cells = <0>; |
726 |
+ }; |
727 |
+ |
728 |
++ gic: interrupt-controller@1c81000 { |
729 |
++ compatible = "arm,gic-400"; |
730 |
++ reg = <0x01c81000 0x1000>, |
731 |
++ <0x01c82000 0x2000>, |
732 |
++ <0x01c84000 0x2000>, |
733 |
++ <0x01c86000 0x2000>; |
734 |
++ interrupt-controller; |
735 |
++ #interrupt-cells = <3>; |
736 |
++ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; |
737 |
++ }; |
738 |
++ |
739 |
+ csi1: camera@1cb4000 { |
740 |
+ compatible = "allwinner,sun8i-v3s-csi"; |
741 |
+ reg = <0x01cb4000 0x3000>; |
742 |
+@@ -535,16 +546,5 @@ |
743 |
+ resets = <&ccu RST_BUS_CSI>; |
744 |
+ status = "disabled"; |
745 |
+ }; |
746 |
+- |
747 |
+- gic: interrupt-controller@1c81000 { |
748 |
+- compatible = "arm,gic-400"; |
749 |
+- reg = <0x01c81000 0x1000>, |
750 |
+- <0x01c82000 0x2000>, |
751 |
+- <0x01c84000 0x2000>, |
752 |
+- <0x01c86000 0x2000>; |
753 |
+- interrupt-controller; |
754 |
+- #interrupt-cells = <3>; |
755 |
+- interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; |
756 |
+- }; |
757 |
+ }; |
758 |
+ }; |
759 |
+diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi |
760 |
+index dd4d506683de7..7f14f0d005c3e 100644 |
761 |
+--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi |
762 |
++++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi |
763 |
+@@ -183,8 +183,8 @@ |
764 |
+ }; |
765 |
+ conf_ata { |
766 |
+ nvidia,pins = "ata", "atb", "atc", "atd", "ate", |
767 |
+- "cdev1", "cdev2", "dap1", "dtb", "gma", |
768 |
+- "gmb", "gmc", "gmd", "gme", "gpu7", |
769 |
++ "cdev1", "cdev2", "dap1", "dtb", "dtf", |
770 |
++ "gma", "gmb", "gmc", "gmd", "gme", "gpu7", |
771 |
+ "gpv", "i2cp", "irrx", "irtx", "pta", |
772 |
+ "rm", "slxa", "slxk", "spia", "spib", |
773 |
+ "uac"; |
774 |
+@@ -203,7 +203,7 @@ |
775 |
+ }; |
776 |
+ conf_crtp { |
777 |
+ nvidia,pins = "crtp", "dap2", "dap3", "dap4", |
778 |
+- "dtc", "dte", "dtf", "gpu", "sdio1", |
779 |
++ "dtc", "dte", "gpu", "sdio1", |
780 |
+ "slxc", "slxd", "spdi", "spdo", "spig", |
781 |
+ "uda"; |
782 |
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
783 |
+diff --git a/arch/arm/configs/multi_v5_defconfig b/arch/arm/configs/multi_v5_defconfig |
784 |
+index e00be9faa23bf..4393e689f2354 100644 |
785 |
+--- a/arch/arm/configs/multi_v5_defconfig |
786 |
++++ b/arch/arm/configs/multi_v5_defconfig |
787 |
+@@ -187,6 +187,7 @@ CONFIG_REGULATOR=y |
788 |
+ CONFIG_REGULATOR_FIXED_VOLTAGE=y |
789 |
+ CONFIG_MEDIA_SUPPORT=y |
790 |
+ CONFIG_MEDIA_CAMERA_SUPPORT=y |
791 |
++CONFIG_MEDIA_PLATFORM_SUPPORT=y |
792 |
+ CONFIG_V4L_PLATFORM_DRIVERS=y |
793 |
+ CONFIG_VIDEO_ASPEED=m |
794 |
+ CONFIG_VIDEO_ATMEL_ISI=m |
795 |
+diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig |
796 |
+index c9bf2df85cb90..c46c05548080a 100644 |
797 |
+--- a/arch/arm/crypto/Kconfig |
798 |
++++ b/arch/arm/crypto/Kconfig |
799 |
+@@ -83,6 +83,8 @@ config CRYPTO_AES_ARM_BS |
800 |
+ depends on KERNEL_MODE_NEON |
801 |
+ select CRYPTO_SKCIPHER |
802 |
+ select CRYPTO_LIB_AES |
803 |
++ select CRYPTO_AES |
804 |
++ select CRYPTO_CBC |
805 |
+ select CRYPTO_SIMD |
806 |
+ help |
807 |
+ Use a faster and more secure NEON based implementation of AES in CBC, |
808 |
+diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S |
809 |
+index a74289ebc8036..5f1b1ce10473a 100644 |
810 |
+--- a/arch/arm/kernel/entry-ftrace.S |
811 |
++++ b/arch/arm/kernel/entry-ftrace.S |
812 |
+@@ -22,10 +22,7 @@ |
813 |
+ * mcount can be thought of as a function called in the middle of a subroutine |
814 |
+ * call. As such, it needs to be transparent for both the caller and the |
815 |
+ * callee: the original lr needs to be restored when leaving mcount, and no |
816 |
+- * registers should be clobbered. (In the __gnu_mcount_nc implementation, we |
817 |
+- * clobber the ip register. This is OK because the ARM calling convention |
818 |
+- * allows it to be clobbered in subroutines and doesn't use it to hold |
819 |
+- * parameters.) |
820 |
++ * registers should be clobbered. |
821 |
+ * |
822 |
+ * When using dynamic ftrace, we patch out the mcount call by a "pop {lr}" |
823 |
+ * instead of the __gnu_mcount_nc call (see arch/arm/kernel/ftrace.c). |
824 |
+@@ -70,26 +67,25 @@ |
825 |
+ |
826 |
+ .macro __ftrace_regs_caller |
827 |
+ |
828 |
+- sub sp, sp, #8 @ space for PC and CPSR OLD_R0, |
829 |
++ str lr, [sp, #-8]! @ store LR as PC and make space for CPSR/OLD_R0, |
830 |
+ @ OLD_R0 will overwrite previous LR |
831 |
+ |
832 |
+- add ip, sp, #12 @ move in IP the value of SP as it was |
833 |
+- @ before the push {lr} of the mcount mechanism |
834 |
++ ldr lr, [sp, #8] @ get previous LR |
835 |
+ |
836 |
+- str lr, [sp, #0] @ store LR instead of PC |
837 |
++ str r0, [sp, #8] @ write r0 as OLD_R0 over previous LR |
838 |
+ |
839 |
+- ldr lr, [sp, #8] @ get previous LR |
840 |
++ str lr, [sp, #-4]! @ store previous LR as LR |
841 |
+ |
842 |
+- str r0, [sp, #8] @ write r0 as OLD_R0 over previous LR |
843 |
++ add lr, sp, #16 @ move in LR the value of SP as it was |
844 |
++ @ before the push {lr} of the mcount mechanism |
845 |
+ |
846 |
+- stmdb sp!, {ip, lr} |
847 |
+- stmdb sp!, {r0-r11, lr} |
848 |
++ push {r0-r11, ip, lr} |
849 |
+ |
850 |
+ @ stack content at this point: |
851 |
+ @ 0 4 48 52 56 60 64 68 72 |
852 |
+- @ R0 | R1 | ... | LR | SP + 4 | previous LR | LR | PSR | OLD_R0 | |
853 |
++ @ R0 | R1 | ... | IP | SP + 4 | previous LR | LR | PSR | OLD_R0 | |
854 |
+ |
855 |
+- mov r3, sp @ struct pt_regs* |
856 |
++ mov r3, sp @ struct pt_regs* |
857 |
+ |
858 |
+ ldr r2, =function_trace_op |
859 |
+ ldr r2, [r2] @ pointer to the current |
860 |
+@@ -112,11 +108,9 @@ ftrace_graph_regs_call: |
861 |
+ #endif |
862 |
+ |
863 |
+ @ pop saved regs |
864 |
+- ldmia sp!, {r0-r12} @ restore r0 through r12 |
865 |
+- ldr ip, [sp, #8] @ restore PC |
866 |
+- ldr lr, [sp, #4] @ restore LR |
867 |
+- ldr sp, [sp, #0] @ restore SP |
868 |
+- mov pc, ip @ return |
869 |
++ pop {r0-r11, ip, lr} @ restore r0 through r12 |
870 |
++ ldr lr, [sp], #4 @ restore LR |
871 |
++ ldr pc, [sp], #12 |
872 |
+ .endm |
873 |
+ |
874 |
+ #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
875 |
+@@ -132,11 +126,9 @@ ftrace_graph_regs_call: |
876 |
+ bl prepare_ftrace_return |
877 |
+ |
878 |
+ @ pop registers saved in ftrace_regs_caller |
879 |
+- ldmia sp!, {r0-r12} @ restore r0 through r12 |
880 |
+- ldr ip, [sp, #8] @ restore PC |
881 |
+- ldr lr, [sp, #4] @ restore LR |
882 |
+- ldr sp, [sp, #0] @ restore SP |
883 |
+- mov pc, ip @ return |
884 |
++ pop {r0-r11, ip, lr} @ restore r0 through r12 |
885 |
++ ldr lr, [sp], #4 @ restore LR |
886 |
++ ldr pc, [sp], #12 |
887 |
+ |
888 |
+ .endm |
889 |
+ #endif |
890 |
+@@ -202,16 +194,17 @@ ftrace_graph_call\suffix: |
891 |
+ .endm |
892 |
+ |
893 |
+ .macro mcount_exit |
894 |
+- ldmia sp!, {r0-r3, ip, lr} |
895 |
+- ret ip |
896 |
++ ldmia sp!, {r0-r3} |
897 |
++ ldr lr, [sp, #4] |
898 |
++ ldr pc, [sp], #8 |
899 |
+ .endm |
900 |
+ |
901 |
+ ENTRY(__gnu_mcount_nc) |
902 |
+ UNWIND(.fnstart) |
903 |
+ #ifdef CONFIG_DYNAMIC_FTRACE |
904 |
+- mov ip, lr |
905 |
+- ldmia sp!, {lr} |
906 |
+- ret ip |
907 |
++ push {lr} |
908 |
++ ldr lr, [sp, #4] |
909 |
++ ldr pc, [sp], #8 |
910 |
+ #else |
911 |
+ __mcount |
912 |
+ #endif |
913 |
+diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c |
914 |
+index 6166ba38bf994..b74bfcf94fb1a 100644 |
915 |
+--- a/arch/arm/kernel/swp_emulate.c |
916 |
++++ b/arch/arm/kernel/swp_emulate.c |
917 |
+@@ -195,7 +195,7 @@ static int swp_handler(struct pt_regs *regs, unsigned int instr) |
918 |
+ destreg, EXTRACT_REG_NUM(instr, RT2_OFFSET), data); |
919 |
+ |
920 |
+ /* Check access in reasonable access range for both SWP and SWPB */ |
921 |
+- if (!access_ok((address & ~3), 4)) { |
922 |
++ if (!access_ok((void __user *)(address & ~3), 4)) { |
923 |
+ pr_debug("SWP{B} emulation: access to %p not allowed!\n", |
924 |
+ (void *)address); |
925 |
+ res = -EFAULT; |
926 |
+diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c |
927 |
+index 2d9e72ad1b0f9..a531afad87fdb 100644 |
928 |
+--- a/arch/arm/kernel/traps.c |
929 |
++++ b/arch/arm/kernel/traps.c |
930 |
+@@ -589,7 +589,7 @@ do_cache_op(unsigned long start, unsigned long end, int flags) |
931 |
+ if (end < start || flags) |
932 |
+ return -EINVAL; |
933 |
+ |
934 |
+- if (!access_ok(start, end - start)) |
935 |
++ if (!access_ok((void __user *)start, end - start)) |
936 |
+ return -EFAULT; |
937 |
+ |
938 |
+ return __do_cache_op(start, end); |
939 |
+diff --git a/arch/arm/mach-iop32x/include/mach/entry-macro.S b/arch/arm/mach-iop32x/include/mach/entry-macro.S |
940 |
+index 8e6766d4621eb..341e5d9a6616d 100644 |
941 |
+--- a/arch/arm/mach-iop32x/include/mach/entry-macro.S |
942 |
++++ b/arch/arm/mach-iop32x/include/mach/entry-macro.S |
943 |
+@@ -20,7 +20,7 @@ |
944 |
+ mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC |
945 |
+ cmp \irqstat, #0 |
946 |
+ clzne \irqnr, \irqstat |
947 |
+- rsbne \irqnr, \irqnr, #31 |
948 |
++ rsbne \irqnr, \irqnr, #32 |
949 |
+ .endm |
950 |
+ |
951 |
+ .macro arch_ret_to_user, tmp1, tmp2 |
952 |
+diff --git a/arch/arm/mach-iop32x/include/mach/irqs.h b/arch/arm/mach-iop32x/include/mach/irqs.h |
953 |
+index c4e78df428e86..e09ae5f48aec5 100644 |
954 |
+--- a/arch/arm/mach-iop32x/include/mach/irqs.h |
955 |
++++ b/arch/arm/mach-iop32x/include/mach/irqs.h |
956 |
+@@ -9,6 +9,6 @@ |
957 |
+ #ifndef __IRQS_H |
958 |
+ #define __IRQS_H |
959 |
+ |
960 |
+-#define NR_IRQS 32 |
961 |
++#define NR_IRQS 33 |
962 |
+ |
963 |
+ #endif |
964 |
+diff --git a/arch/arm/mach-iop32x/irq.c b/arch/arm/mach-iop32x/irq.c |
965 |
+index 2d48bf1398c10..d1e8824cbd824 100644 |
966 |
+--- a/arch/arm/mach-iop32x/irq.c |
967 |
++++ b/arch/arm/mach-iop32x/irq.c |
968 |
+@@ -32,14 +32,14 @@ static void intstr_write(u32 val) |
969 |
+ static void |
970 |
+ iop32x_irq_mask(struct irq_data *d) |
971 |
+ { |
972 |
+- iop32x_mask &= ~(1 << d->irq); |
973 |
++ iop32x_mask &= ~(1 << (d->irq - 1)); |
974 |
+ intctl_write(iop32x_mask); |
975 |
+ } |
976 |
+ |
977 |
+ static void |
978 |
+ iop32x_irq_unmask(struct irq_data *d) |
979 |
+ { |
980 |
+- iop32x_mask |= 1 << d->irq; |
981 |
++ iop32x_mask |= 1 << (d->irq - 1); |
982 |
+ intctl_write(iop32x_mask); |
983 |
+ } |
984 |
+ |
985 |
+@@ -65,7 +65,7 @@ void __init iop32x_init_irq(void) |
986 |
+ machine_is_em7210()) |
987 |
+ *IOP3XX_PCIIRSR = 0x0f; |
988 |
+ |
989 |
+- for (i = 0; i < NR_IRQS; i++) { |
990 |
++ for (i = 1; i < NR_IRQS; i++) { |
991 |
+ irq_set_chip_and_handler(i, &ext_chip, handle_level_irq); |
992 |
+ irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE); |
993 |
+ } |
994 |
+diff --git a/arch/arm/mach-iop32x/irqs.h b/arch/arm/mach-iop32x/irqs.h |
995 |
+index 69858e4e905d1..e1dfc8b4e7d7e 100644 |
996 |
+--- a/arch/arm/mach-iop32x/irqs.h |
997 |
++++ b/arch/arm/mach-iop32x/irqs.h |
998 |
+@@ -7,36 +7,40 @@ |
999 |
+ #ifndef __IOP32X_IRQS_H |
1000 |
+ #define __IOP32X_IRQS_H |
1001 |
+ |
1002 |
++/* Interrupts in Linux start at 1, hardware starts at 0 */ |
1003 |
++ |
1004 |
++#define IOP_IRQ(x) ((x) + 1) |
1005 |
++ |
1006 |
+ /* |
1007 |
+ * IOP80321 chipset interrupts |
1008 |
+ */ |
1009 |
+-#define IRQ_IOP32X_DMA0_EOT 0 |
1010 |
+-#define IRQ_IOP32X_DMA0_EOC 1 |
1011 |
+-#define IRQ_IOP32X_DMA1_EOT 2 |
1012 |
+-#define IRQ_IOP32X_DMA1_EOC 3 |
1013 |
+-#define IRQ_IOP32X_AA_EOT 6 |
1014 |
+-#define IRQ_IOP32X_AA_EOC 7 |
1015 |
+-#define IRQ_IOP32X_CORE_PMON 8 |
1016 |
+-#define IRQ_IOP32X_TIMER0 9 |
1017 |
+-#define IRQ_IOP32X_TIMER1 10 |
1018 |
+-#define IRQ_IOP32X_I2C_0 11 |
1019 |
+-#define IRQ_IOP32X_I2C_1 12 |
1020 |
+-#define IRQ_IOP32X_MESSAGING 13 |
1021 |
+-#define IRQ_IOP32X_ATU_BIST 14 |
1022 |
+-#define IRQ_IOP32X_PERFMON 15 |
1023 |
+-#define IRQ_IOP32X_CORE_PMU 16 |
1024 |
+-#define IRQ_IOP32X_BIU_ERR 17 |
1025 |
+-#define IRQ_IOP32X_ATU_ERR 18 |
1026 |
+-#define IRQ_IOP32X_MCU_ERR 19 |
1027 |
+-#define IRQ_IOP32X_DMA0_ERR 20 |
1028 |
+-#define IRQ_IOP32X_DMA1_ERR 21 |
1029 |
+-#define IRQ_IOP32X_AA_ERR 23 |
1030 |
+-#define IRQ_IOP32X_MSG_ERR 24 |
1031 |
+-#define IRQ_IOP32X_SSP 25 |
1032 |
+-#define IRQ_IOP32X_XINT0 27 |
1033 |
+-#define IRQ_IOP32X_XINT1 28 |
1034 |
+-#define IRQ_IOP32X_XINT2 29 |
1035 |
+-#define IRQ_IOP32X_XINT3 30 |
1036 |
+-#define IRQ_IOP32X_HPI 31 |
1037 |
++#define IRQ_IOP32X_DMA0_EOT IOP_IRQ(0) |
1038 |
++#define IRQ_IOP32X_DMA0_EOC IOP_IRQ(1) |
1039 |
++#define IRQ_IOP32X_DMA1_EOT IOP_IRQ(2) |
1040 |
++#define IRQ_IOP32X_DMA1_EOC IOP_IRQ(3) |
1041 |
++#define IRQ_IOP32X_AA_EOT IOP_IRQ(6) |
1042 |
++#define IRQ_IOP32X_AA_EOC IOP_IRQ(7) |
1043 |
++#define IRQ_IOP32X_CORE_PMON IOP_IRQ(8) |
1044 |
++#define IRQ_IOP32X_TIMER0 IOP_IRQ(9) |
1045 |
++#define IRQ_IOP32X_TIMER1 IOP_IRQ(10) |
1046 |
++#define IRQ_IOP32X_I2C_0 IOP_IRQ(11) |
1047 |
++#define IRQ_IOP32X_I2C_1 IOP_IRQ(12) |
1048 |
++#define IRQ_IOP32X_MESSAGING IOP_IRQ(13) |
1049 |
++#define IRQ_IOP32X_ATU_BIST IOP_IRQ(14) |
1050 |
++#define IRQ_IOP32X_PERFMON IOP_IRQ(15) |
1051 |
++#define IRQ_IOP32X_CORE_PMU IOP_IRQ(16) |
1052 |
++#define IRQ_IOP32X_BIU_ERR IOP_IRQ(17) |
1053 |
++#define IRQ_IOP32X_ATU_ERR IOP_IRQ(18) |
1054 |
++#define IRQ_IOP32X_MCU_ERR IOP_IRQ(19) |
1055 |
++#define IRQ_IOP32X_DMA0_ERR IOP_IRQ(20) |
1056 |
++#define IRQ_IOP32X_DMA1_ERR IOP_IRQ(21) |
1057 |
++#define IRQ_IOP32X_AA_ERR IOP_IRQ(23) |
1058 |
++#define IRQ_IOP32X_MSG_ERR IOP_IRQ(24) |
1059 |
++#define IRQ_IOP32X_SSP IOP_IRQ(25) |
1060 |
++#define IRQ_IOP32X_XINT0 IOP_IRQ(27) |
1061 |
++#define IRQ_IOP32X_XINT1 IOP_IRQ(28) |
1062 |
++#define IRQ_IOP32X_XINT2 IOP_IRQ(29) |
1063 |
++#define IRQ_IOP32X_XINT3 IOP_IRQ(30) |
1064 |
++#define IRQ_IOP32X_HPI IOP_IRQ(31) |
1065 |
+ |
1066 |
+ #endif |
1067 |
+diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c |
1068 |
+index 6794e2db1ad5f..ecc46c31004f6 100644 |
1069 |
+--- a/arch/arm/mach-mmp/sram.c |
1070 |
++++ b/arch/arm/mach-mmp/sram.c |
1071 |
+@@ -72,6 +72,8 @@ static int sram_probe(struct platform_device *pdev) |
1072 |
+ if (!info) |
1073 |
+ return -ENOMEM; |
1074 |
+ |
1075 |
++ platform_set_drvdata(pdev, info); |
1076 |
++ |
1077 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1078 |
+ if (res == NULL) { |
1079 |
+ dev_err(&pdev->dev, "no memory resource defined\n"); |
1080 |
+@@ -107,8 +109,6 @@ static int sram_probe(struct platform_device *pdev) |
1081 |
+ list_add(&info->node, &sram_bank_list); |
1082 |
+ mutex_unlock(&sram_lock); |
1083 |
+ |
1084 |
+- platform_set_drvdata(pdev, info); |
1085 |
+- |
1086 |
+ dev_info(&pdev->dev, "initialized\n"); |
1087 |
+ return 0; |
1088 |
+ |
1089 |
+@@ -127,17 +127,19 @@ static int sram_remove(struct platform_device *pdev) |
1090 |
+ struct sram_bank_info *info; |
1091 |
+ |
1092 |
+ info = platform_get_drvdata(pdev); |
1093 |
+- if (info == NULL) |
1094 |
+- return -ENODEV; |
1095 |
+ |
1096 |
+- mutex_lock(&sram_lock); |
1097 |
+- list_del(&info->node); |
1098 |
+- mutex_unlock(&sram_lock); |
1099 |
++ if (info->sram_size) { |
1100 |
++ mutex_lock(&sram_lock); |
1101 |
++ list_del(&info->node); |
1102 |
++ mutex_unlock(&sram_lock); |
1103 |
++ |
1104 |
++ gen_pool_destroy(info->gpool); |
1105 |
++ iounmap(info->sram_virt); |
1106 |
++ kfree(info->pool_name); |
1107 |
++ } |
1108 |
+ |
1109 |
+- gen_pool_destroy(info->gpool); |
1110 |
+- iounmap(info->sram_virt); |
1111 |
+- kfree(info->pool_name); |
1112 |
+ kfree(info); |
1113 |
++ |
1114 |
+ return 0; |
1115 |
+ } |
1116 |
+ |
1117 |
+diff --git a/arch/arm/mach-mstar/Kconfig b/arch/arm/mach-mstar/Kconfig |
1118 |
+index 576d1ab293c87..30560fdf87ed2 100644 |
1119 |
+--- a/arch/arm/mach-mstar/Kconfig |
1120 |
++++ b/arch/arm/mach-mstar/Kconfig |
1121 |
+@@ -3,6 +3,7 @@ menuconfig ARCH_MSTARV7 |
1122 |
+ depends on ARCH_MULTI_V7 |
1123 |
+ select ARM_GIC |
1124 |
+ select ARM_HEAVY_MB |
1125 |
++ select HAVE_ARM_ARCH_TIMER |
1126 |
+ select MST_IRQ |
1127 |
+ help |
1128 |
+ Support for newer MStar/Sigmastar SoC families that are |
1129 |
+diff --git a/arch/arm/mach-s3c/mach-jive.c b/arch/arm/mach-s3c/mach-jive.c |
1130 |
+index 2a29c3eca559e..ae6a1c9ebf78c 100644 |
1131 |
+--- a/arch/arm/mach-s3c/mach-jive.c |
1132 |
++++ b/arch/arm/mach-s3c/mach-jive.c |
1133 |
+@@ -236,11 +236,11 @@ static int __init jive_mtdset(char *options) |
1134 |
+ unsigned long set; |
1135 |
+ |
1136 |
+ if (options == NULL || options[0] == '\0') |
1137 |
+- return 0; |
1138 |
++ return 1; |
1139 |
+ |
1140 |
+ if (kstrtoul(options, 10, &set)) { |
1141 |
+ printk(KERN_ERR "failed to parse mtdset=%s\n", options); |
1142 |
+- return 0; |
1143 |
++ return 1; |
1144 |
+ } |
1145 |
+ |
1146 |
+ switch (set) { |
1147 |
+@@ -255,7 +255,7 @@ static int __init jive_mtdset(char *options) |
1148 |
+ "using default.", set); |
1149 |
+ } |
1150 |
+ |
1151 |
+- return 0; |
1152 |
++ return 1; |
1153 |
+ } |
1154 |
+ |
1155 |
+ /* parse the mtdset= option given to the kernel command line */ |
1156 |
+diff --git a/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts b/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts |
1157 |
+index ec19fbf928a14..12a4b1c03390c 100644 |
1158 |
+--- a/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts |
1159 |
++++ b/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts |
1160 |
+@@ -111,8 +111,8 @@ |
1161 |
+ compatible = "silabs,si3226x"; |
1162 |
+ reg = <0>; |
1163 |
+ spi-max-frequency = <5000000>; |
1164 |
+- spi-cpha = <1>; |
1165 |
+- spi-cpol = <1>; |
1166 |
++ spi-cpha; |
1167 |
++ spi-cpol; |
1168 |
+ pl022,hierarchy = <0>; |
1169 |
+ pl022,interface = <0>; |
1170 |
+ pl022,slave-tx-disable = <0>; |
1171 |
+@@ -135,8 +135,8 @@ |
1172 |
+ at25,byte-len = <0x8000>; |
1173 |
+ at25,addr-mode = <2>; |
1174 |
+ at25,page-size = <64>; |
1175 |
+- spi-cpha = <1>; |
1176 |
+- spi-cpol = <1>; |
1177 |
++ spi-cpha; |
1178 |
++ spi-cpol; |
1179 |
+ pl022,hierarchy = <0>; |
1180 |
+ pl022,interface = <0>; |
1181 |
+ pl022,slave-tx-disable = <0>; |
1182 |
+diff --git a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
1183 |
+index 2cfeaf3b0a876..8c218689fef70 100644 |
1184 |
+--- a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
1185 |
++++ b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
1186 |
+@@ -687,7 +687,7 @@ |
1187 |
+ }; |
1188 |
+ }; |
1189 |
+ |
1190 |
+- sata: ahci@663f2000 { |
1191 |
++ sata: sata@663f2000 { |
1192 |
+ compatible = "brcm,iproc-ahci", "generic-ahci"; |
1193 |
+ reg = <0x663f2000 0x1000>; |
1194 |
+ dma-coherent; |
1195 |
+diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi |
1196 |
+index ea6e3a11e641b..9beb3c34fcdb5 100644 |
1197 |
+--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi |
1198 |
++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi |
1199 |
+@@ -3406,10 +3406,10 @@ |
1200 |
+ #clock-cells = <0>; |
1201 |
+ clock-frequency = <9600000>; |
1202 |
+ clock-output-names = "mclk"; |
1203 |
+- qcom,micbias1-millivolt = <1800>; |
1204 |
+- qcom,micbias2-millivolt = <1800>; |
1205 |
+- qcom,micbias3-millivolt = <1800>; |
1206 |
+- qcom,micbias4-millivolt = <1800>; |
1207 |
++ qcom,micbias1-microvolt = <1800000>; |
1208 |
++ qcom,micbias2-microvolt = <1800000>; |
1209 |
++ qcom,micbias3-microvolt = <1800000>; |
1210 |
++ qcom,micbias4-microvolt = <1800000>; |
1211 |
+ |
1212 |
+ #address-cells = <1>; |
1213 |
+ #size-cells = <1>; |
1214 |
+diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi |
1215 |
+index 1aec54590a11a..a8a47378ba689 100644 |
1216 |
+--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi |
1217 |
++++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi |
1218 |
+@@ -1114,9 +1114,9 @@ |
1219 |
+ qcom,tcs-offset = <0xd00>; |
1220 |
+ qcom,drv-id = <2>; |
1221 |
+ qcom,tcs-config = <ACTIVE_TCS 2>, |
1222 |
+- <SLEEP_TCS 1>, |
1223 |
+- <WAKE_TCS 1>, |
1224 |
+- <CONTROL_TCS 0>; |
1225 |
++ <SLEEP_TCS 3>, |
1226 |
++ <WAKE_TCS 3>, |
1227 |
++ <CONTROL_TCS 1>; |
1228 |
+ |
1229 |
+ rpmhcc: clock-controller { |
1230 |
+ compatible = "qcom,sm8150-rpmh-clk"; |
1231 |
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts |
1232 |
+index 6db18808b9c54..dc45ec372ada4 100644 |
1233 |
+--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts |
1234 |
++++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts |
1235 |
+@@ -665,8 +665,8 @@ |
1236 |
+ sd-uhs-sdr104; |
1237 |
+ |
1238 |
+ /* Power supply */ |
1239 |
+- vqmmc-supply = &vcc1v8_s3; /* IO line */ |
1240 |
+- vmmc-supply = &vcc_sdio; /* card's power */ |
1241 |
++ vqmmc-supply = <&vcc1v8_s3>; /* IO line */ |
1242 |
++ vmmc-supply = <&vcc_sdio>; /* card's power */ |
1243 |
+ |
1244 |
+ #address-cells = <1>; |
1245 |
+ #size-cells = <0>; |
1246 |
+diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi |
1247 |
+index b9662205be9bf..d04189771c773 100644 |
1248 |
+--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi |
1249 |
++++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi |
1250 |
+@@ -35,7 +35,10 @@ |
1251 |
+ #interrupt-cells = <3>; |
1252 |
+ interrupt-controller; |
1253 |
+ reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ |
1254 |
+- <0x00 0x01880000 0x00 0x90000>; /* GICR */ |
1255 |
++ <0x00 0x01880000 0x00 0x90000>, /* GICR */ |
1256 |
++ <0x00 0x6f000000 0x00 0x2000>, /* GICC */ |
1257 |
++ <0x00 0x6f010000 0x00 0x1000>, /* GICH */ |
1258 |
++ <0x00 0x6f020000 0x00 0x2000>; /* GICV */ |
1259 |
+ /* |
1260 |
+ * vcpumntirq: |
1261 |
+ * virtual CPU interface maintenance interrupt |
1262 |
+diff --git a/arch/arm64/boot/dts/ti/k3-am65.dtsi b/arch/arm64/boot/dts/ti/k3-am65.dtsi |
1263 |
+index d84c0bc050233..c6a3fecc7518e 100644 |
1264 |
+--- a/arch/arm64/boot/dts/ti/k3-am65.dtsi |
1265 |
++++ b/arch/arm64/boot/dts/ti/k3-am65.dtsi |
1266 |
+@@ -84,6 +84,7 @@ |
1267 |
+ <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>, |
1268 |
+ <0x00 0x47000000 0x00 0x47000000 0x00 0x00068400>, |
1269 |
+ <0x00 0x50000000 0x00 0x50000000 0x00 0x8000000>, |
1270 |
++ <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A53 PERIPHBASE */ |
1271 |
+ <0x00 0x70000000 0x00 0x70000000 0x00 0x200000>, |
1272 |
+ <0x05 0x00000000 0x05 0x00000000 0x01 0x0000000>, |
1273 |
+ <0x07 0x00000000 0x07 0x00000000 0x01 0x0000000>; |
1274 |
+diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi |
1275 |
+index 1ab9f9604af6c..bef47f96376d9 100644 |
1276 |
+--- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi |
1277 |
++++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi |
1278 |
+@@ -47,7 +47,10 @@ |
1279 |
+ #interrupt-cells = <3>; |
1280 |
+ interrupt-controller; |
1281 |
+ reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ |
1282 |
+- <0x00 0x01900000 0x00 0x100000>; /* GICR */ |
1283 |
++ <0x00 0x01900000 0x00 0x100000>, /* GICR */ |
1284 |
++ <0x00 0x6f000000 0x00 0x2000>, /* GICC */ |
1285 |
++ <0x00 0x6f010000 0x00 0x1000>, /* GICH */ |
1286 |
++ <0x00 0x6f020000 0x00 0x2000>; /* GICV */ |
1287 |
+ |
1288 |
+ /* vcpumntirq: virtual CPU interface maintenance interrupt */ |
1289 |
+ interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>; |
1290 |
+diff --git a/arch/arm64/boot/dts/ti/k3-j7200.dtsi b/arch/arm64/boot/dts/ti/k3-j7200.dtsi |
1291 |
+index 03a9623f0f956..59f5113e657dd 100644 |
1292 |
+--- a/arch/arm64/boot/dts/ti/k3-j7200.dtsi |
1293 |
++++ b/arch/arm64/boot/dts/ti/k3-j7200.dtsi |
1294 |
+@@ -127,6 +127,7 @@ |
1295 |
+ <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* timesync router */ |
1296 |
+ <0x00 0x01000000 0x00 0x01000000 0x00 0x0d000000>, /* Most peripherals */ |
1297 |
+ <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>, /* MAIN NAVSS */ |
1298 |
++ <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A72 PERIPHBASE */ |
1299 |
+ <0x00 0x70000000 0x00 0x70000000 0x00 0x00800000>, /* MSMC RAM */ |
1300 |
+ <0x00 0x18000000 0x00 0x18000000 0x00 0x08000000>, /* PCIe1 DAT0 */ |
1301 |
+ <0x41 0x00000000 0x41 0x00000000 0x01 0x00000000>, /* PCIe1 DAT1 */ |
1302 |
+diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi |
1303 |
+index 85526f72b4616..0350ddfe2c723 100644 |
1304 |
+--- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi |
1305 |
++++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi |
1306 |
+@@ -108,7 +108,10 @@ |
1307 |
+ #interrupt-cells = <3>; |
1308 |
+ interrupt-controller; |
1309 |
+ reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ |
1310 |
+- <0x00 0x01900000 0x00 0x100000>; /* GICR */ |
1311 |
++ <0x00 0x01900000 0x00 0x100000>, /* GICR */ |
1312 |
++ <0x00 0x6f000000 0x00 0x2000>, /* GICC */ |
1313 |
++ <0x00 0x6f010000 0x00 0x1000>, /* GICH */ |
1314 |
++ <0x00 0x6f020000 0x00 0x2000>; /* GICV */ |
1315 |
+ |
1316 |
+ /* vcpumntirq: virtual CPU interface maintenance interrupt */ |
1317 |
+ interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>; |
1318 |
+diff --git a/arch/arm64/boot/dts/ti/k3-j721e.dtsi b/arch/arm64/boot/dts/ti/k3-j721e.dtsi |
1319 |
+index a199227327ed2..ba4fe3f983158 100644 |
1320 |
+--- a/arch/arm64/boot/dts/ti/k3-j721e.dtsi |
1321 |
++++ b/arch/arm64/boot/dts/ti/k3-j721e.dtsi |
1322 |
+@@ -136,6 +136,7 @@ |
1323 |
+ <0x00 0x0e000000 0x00 0x0e000000 0x00 0x01800000>, /* PCIe Core*/ |
1324 |
+ <0x00 0x10000000 0x00 0x10000000 0x00 0x10000000>, /* PCIe DAT */ |
1325 |
+ <0x00 0x64800000 0x00 0x64800000 0x00 0x00800000>, /* C71 */ |
1326 |
++ <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A72 PERIPHBASE */ |
1327 |
+ <0x44 0x00000000 0x44 0x00000000 0x00 0x08000000>, /* PCIe2 DAT */ |
1328 |
+ <0x44 0x10000000 0x44 0x10000000 0x00 0x08000000>, /* PCIe3 DAT */ |
1329 |
+ <0x4d 0x80800000 0x4d 0x80800000 0x00 0x00800000>, /* C66_0 */ |
1330 |
+diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig |
1331 |
+index 5cfe3cf6f2acb..2bdf38d05fa5b 100644 |
1332 |
+--- a/arch/arm64/configs/defconfig |
1333 |
++++ b/arch/arm64/configs/defconfig |
1334 |
+@@ -837,7 +837,7 @@ CONFIG_DMADEVICES=y |
1335 |
+ CONFIG_DMA_BCM2835=y |
1336 |
+ CONFIG_DMA_SUN6I=m |
1337 |
+ CONFIG_FSL_EDMA=y |
1338 |
+-CONFIG_IMX_SDMA=y |
1339 |
++CONFIG_IMX_SDMA=m |
1340 |
+ CONFIG_K3_DMA=y |
1341 |
+ CONFIG_MV_XOR=y |
1342 |
+ CONFIG_MV_XOR_V2=y |
1343 |
+diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c |
1344 |
+index e62005317ce29..0dab5679a97d5 100644 |
1345 |
+--- a/arch/arm64/kernel/signal.c |
1346 |
++++ b/arch/arm64/kernel/signal.c |
1347 |
+@@ -572,10 +572,12 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user, |
1348 |
+ { |
1349 |
+ int err; |
1350 |
+ |
1351 |
+- err = sigframe_alloc(user, &user->fpsimd_offset, |
1352 |
+- sizeof(struct fpsimd_context)); |
1353 |
+- if (err) |
1354 |
+- return err; |
1355 |
++ if (system_supports_fpsimd()) { |
1356 |
++ err = sigframe_alloc(user, &user->fpsimd_offset, |
1357 |
++ sizeof(struct fpsimd_context)); |
1358 |
++ if (err) |
1359 |
++ return err; |
1360 |
++ } |
1361 |
+ |
1362 |
+ /* fault information, if valid */ |
1363 |
+ if (add_all || current->thread.fault_code) { |
1364 |
+diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c |
1365 |
+index c0a7f0d90b39d..80cc79760e8e9 100644 |
1366 |
+--- a/arch/arm64/mm/init.c |
1367 |
++++ b/arch/arm64/mm/init.c |
1368 |
+@@ -58,8 +58,34 @@ EXPORT_SYMBOL(memstart_addr); |
1369 |
+ * unless restricted on specific platforms (e.g. 30-bit on Raspberry Pi 4). |
1370 |
+ * In such case, ZONE_DMA32 covers the rest of the 32-bit addressable memory, |
1371 |
+ * otherwise it is empty. |
1372 |
++ * |
1373 |
++ * Memory reservation for crash kernel either done early or deferred |
1374 |
++ * depending on DMA memory zones configs (ZONE_DMA) -- |
1375 |
++ * |
1376 |
++ * In absence of ZONE_DMA configs arm64_dma_phys_limit initialized |
1377 |
++ * here instead of max_zone_phys(). This lets early reservation of |
1378 |
++ * crash kernel memory which has a dependency on arm64_dma_phys_limit. |
1379 |
++ * Reserving memory early for crash kernel allows linear creation of block |
1380 |
++ * mappings (greater than page-granularity) for all the memory bank rangs. |
1381 |
++ * In this scheme a comparatively quicker boot is observed. |
1382 |
++ * |
1383 |
++ * If ZONE_DMA configs are defined, crash kernel memory reservation |
1384 |
++ * is delayed until DMA zone memory range size initilazation performed in |
1385 |
++ * zone_sizes_init(). The defer is necessary to steer clear of DMA zone |
1386 |
++ * memory range to avoid overlap allocation. So crash kernel memory boundaries |
1387 |
++ * are not known when mapping all bank memory ranges, which otherwise means |
1388 |
++ * not possible to exclude crash kernel range from creating block mappings |
1389 |
++ * so page-granularity mappings are created for the entire memory range. |
1390 |
++ * Hence a slightly slower boot is observed. |
1391 |
++ * |
1392 |
++ * Note: Page-granularity mapppings are necessary for crash kernel memory |
1393 |
++ * range for shrinking its size via /sys/kernel/kexec_crash_size interface. |
1394 |
+ */ |
1395 |
+-phys_addr_t arm64_dma_phys_limit __ro_after_init; |
1396 |
++#if IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32) |
1397 |
++phys_addr_t __ro_after_init arm64_dma_phys_limit; |
1398 |
++#else |
1399 |
++phys_addr_t __ro_after_init arm64_dma_phys_limit = PHYS_MASK + 1; |
1400 |
++#endif |
1401 |
+ |
1402 |
+ #ifdef CONFIG_KEXEC_CORE |
1403 |
+ /* |
1404 |
+@@ -210,8 +236,6 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) |
1405 |
+ if (!arm64_dma_phys_limit) |
1406 |
+ arm64_dma_phys_limit = dma32_phys_limit; |
1407 |
+ #endif |
1408 |
+- if (!arm64_dma_phys_limit) |
1409 |
+- arm64_dma_phys_limit = PHYS_MASK + 1; |
1410 |
+ max_zone_pfns[ZONE_NORMAL] = max; |
1411 |
+ |
1412 |
+ free_area_init(max_zone_pfns); |
1413 |
+@@ -407,6 +431,9 @@ void __init arm64_memblock_init(void) |
1414 |
+ |
1415 |
+ reserve_elfcorehdr(); |
1416 |
+ |
1417 |
++ if (!IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) |
1418 |
++ reserve_crashkernel(); |
1419 |
++ |
1420 |
+ high_memory = __va(memblock_end_of_DRAM() - 1) + 1; |
1421 |
+ } |
1422 |
+ |
1423 |
+@@ -451,7 +478,8 @@ void __init bootmem_init(void) |
1424 |
+ * request_standard_resources() depends on crashkernel's memory being |
1425 |
+ * reserved, so do it here. |
1426 |
+ */ |
1427 |
+- reserve_crashkernel(); |
1428 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32)) |
1429 |
++ reserve_crashkernel(); |
1430 |
+ |
1431 |
+ memblock_dump_all(); |
1432 |
+ } |
1433 |
+diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c |
1434 |
+index 991e599f70577..3284709ef5676 100644 |
1435 |
+--- a/arch/arm64/mm/mmu.c |
1436 |
++++ b/arch/arm64/mm/mmu.c |
1437 |
+@@ -61,6 +61,7 @@ static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss __maybe_unused; |
1438 |
+ static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss __maybe_unused; |
1439 |
+ |
1440 |
+ static DEFINE_SPINLOCK(swapper_pgdir_lock); |
1441 |
++static DEFINE_MUTEX(fixmap_lock); |
1442 |
+ |
1443 |
+ void set_swapper_pgd(pgd_t *pgdp, pgd_t pgd) |
1444 |
+ { |
1445 |
+@@ -314,6 +315,12 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, |
1446 |
+ } |
1447 |
+ BUG_ON(p4d_bad(p4d)); |
1448 |
+ |
1449 |
++ /* |
1450 |
++ * No need for locking during early boot. And it doesn't work as |
1451 |
++ * expected with KASLR enabled. |
1452 |
++ */ |
1453 |
++ if (system_state != SYSTEM_BOOTING) |
1454 |
++ mutex_lock(&fixmap_lock); |
1455 |
+ pudp = pud_set_fixmap_offset(p4dp, addr); |
1456 |
+ do { |
1457 |
+ pud_t old_pud = READ_ONCE(*pudp); |
1458 |
+@@ -344,6 +351,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, |
1459 |
+ } while (pudp++, addr = next, addr != end); |
1460 |
+ |
1461 |
+ pud_clear_fixmap(); |
1462 |
++ if (system_state != SYSTEM_BOOTING) |
1463 |
++ mutex_unlock(&fixmap_lock); |
1464 |
+ } |
1465 |
+ |
1466 |
+ static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, |
1467 |
+@@ -492,7 +501,7 @@ static void __init map_mem(pgd_t *pgdp) |
1468 |
+ int flags = 0; |
1469 |
+ u64 i; |
1470 |
+ |
1471 |
+- if (rodata_full || crash_mem_map || debug_pagealloc_enabled()) |
1472 |
++ if (rodata_full || debug_pagealloc_enabled()) |
1473 |
+ flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; |
1474 |
+ |
1475 |
+ /* |
1476 |
+@@ -503,6 +512,17 @@ static void __init map_mem(pgd_t *pgdp) |
1477 |
+ */ |
1478 |
+ memblock_mark_nomap(kernel_start, kernel_end - kernel_start); |
1479 |
+ |
1480 |
++#ifdef CONFIG_KEXEC_CORE |
1481 |
++ if (crash_mem_map) { |
1482 |
++ if (IS_ENABLED(CONFIG_ZONE_DMA) || |
1483 |
++ IS_ENABLED(CONFIG_ZONE_DMA32)) |
1484 |
++ flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; |
1485 |
++ else if (crashk_res.end) |
1486 |
++ memblock_mark_nomap(crashk_res.start, |
1487 |
++ resource_size(&crashk_res)); |
1488 |
++ } |
1489 |
++#endif |
1490 |
++ |
1491 |
+ /* map all the memory banks */ |
1492 |
+ for_each_mem_range(i, &start, &end) { |
1493 |
+ if (start >= end) |
1494 |
+@@ -529,6 +549,25 @@ static void __init map_mem(pgd_t *pgdp) |
1495 |
+ __map_memblock(pgdp, kernel_start, kernel_end, |
1496 |
+ PAGE_KERNEL, NO_CONT_MAPPINGS); |
1497 |
+ memblock_clear_nomap(kernel_start, kernel_end - kernel_start); |
1498 |
++ |
1499 |
++ /* |
1500 |
++ * Use page-level mappings here so that we can shrink the region |
1501 |
++ * in page granularity and put back unused memory to buddy system |
1502 |
++ * through /sys/kernel/kexec_crash_size interface. |
1503 |
++ */ |
1504 |
++#ifdef CONFIG_KEXEC_CORE |
1505 |
++ if (crash_mem_map && |
1506 |
++ !IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) { |
1507 |
++ if (crashk_res.end) { |
1508 |
++ __map_memblock(pgdp, crashk_res.start, |
1509 |
++ crashk_res.end + 1, |
1510 |
++ PAGE_KERNEL, |
1511 |
++ NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS); |
1512 |
++ memblock_clear_nomap(crashk_res.start, |
1513 |
++ resource_size(&crashk_res)); |
1514 |
++ } |
1515 |
++ } |
1516 |
++#endif |
1517 |
+ } |
1518 |
+ |
1519 |
+ void mark_rodata_ro(void) |
1520 |
+diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c |
1521 |
+index 064577ff9ff59..9c6cab71ba98b 100644 |
1522 |
+--- a/arch/arm64/net/bpf_jit_comp.c |
1523 |
++++ b/arch/arm64/net/bpf_jit_comp.c |
1524 |
+@@ -1040,15 +1040,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) |
1525 |
+ goto out_off; |
1526 |
+ } |
1527 |
+ |
1528 |
+- /* 1. Initial fake pass to compute ctx->idx. */ |
1529 |
+- |
1530 |
+- /* Fake pass to fill in ctx->offset. */ |
1531 |
+- if (build_body(&ctx, extra_pass)) { |
1532 |
++ /* |
1533 |
++ * 1. Initial fake pass to compute ctx->idx and ctx->offset. |
1534 |
++ * |
1535 |
++ * BPF line info needs ctx->offset[i] to be the offset of |
1536 |
++ * instruction[i] in jited image, so build prologue first. |
1537 |
++ */ |
1538 |
++ if (build_prologue(&ctx, was_classic)) { |
1539 |
+ prog = orig_prog; |
1540 |
+ goto out_off; |
1541 |
+ } |
1542 |
+ |
1543 |
+- if (build_prologue(&ctx, was_classic)) { |
1544 |
++ if (build_body(&ctx, extra_pass)) { |
1545 |
+ prog = orig_prog; |
1546 |
+ goto out_off; |
1547 |
+ } |
1548 |
+@@ -1121,6 +1124,11 @@ skip_init_ctx: |
1549 |
+ prog->jited_len = prog_size; |
1550 |
+ |
1551 |
+ if (!prog->is_func || extra_pass) { |
1552 |
++ int i; |
1553 |
++ |
1554 |
++ /* offset[prog->len] is the size of program */ |
1555 |
++ for (i = 0; i <= prog->len; i++) |
1556 |
++ ctx.offset[i] *= AARCH64_INSN_SIZE; |
1557 |
+ bpf_prog_fill_jited_linfo(prog, ctx.offset + 1); |
1558 |
+ out_off: |
1559 |
+ kfree(ctx.offset); |
1560 |
+diff --git a/arch/csky/kernel/perf_callchain.c b/arch/csky/kernel/perf_callchain.c |
1561 |
+index 35318a635a5fa..75e1f9df5f604 100644 |
1562 |
+--- a/arch/csky/kernel/perf_callchain.c |
1563 |
++++ b/arch/csky/kernel/perf_callchain.c |
1564 |
+@@ -49,7 +49,7 @@ static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry, |
1565 |
+ { |
1566 |
+ struct stackframe buftail; |
1567 |
+ unsigned long lr = 0; |
1568 |
+- unsigned long *user_frame_tail = (unsigned long *)fp; |
1569 |
++ unsigned long __user *user_frame_tail = (unsigned long __user *)fp; |
1570 |
+ |
1571 |
+ /* Check accessibility of one struct frame_tail beyond */ |
1572 |
+ if (!access_ok(user_frame_tail, sizeof(buftail))) |
1573 |
+diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c |
1574 |
+index 0ca49b5e3dd37..243228b0aa075 100644 |
1575 |
+--- a/arch/csky/kernel/signal.c |
1576 |
++++ b/arch/csky/kernel/signal.c |
1577 |
+@@ -136,7 +136,7 @@ static inline void __user *get_sigframe(struct ksignal *ksig, |
1578 |
+ static int |
1579 |
+ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) |
1580 |
+ { |
1581 |
+- struct rt_sigframe *frame; |
1582 |
++ struct rt_sigframe __user *frame; |
1583 |
+ int err = 0; |
1584 |
+ struct csky_vdso *vdso = current->mm->context.vdso; |
1585 |
+ |
1586 |
+diff --git a/arch/m68k/coldfire/device.c b/arch/m68k/coldfire/device.c |
1587 |
+index 59f7dfe50a4d0..a055616942a1e 100644 |
1588 |
+--- a/arch/m68k/coldfire/device.c |
1589 |
++++ b/arch/m68k/coldfire/device.c |
1590 |
+@@ -480,7 +480,7 @@ static struct platform_device mcf_i2c5 = { |
1591 |
+ #endif /* MCFI2C_BASE5 */ |
1592 |
+ #endif /* IS_ENABLED(CONFIG_I2C_IMX) */ |
1593 |
+ |
1594 |
+-#if IS_ENABLED(CONFIG_MCF_EDMA) |
1595 |
++#ifdef MCFEDMA_BASE |
1596 |
+ |
1597 |
+ static const struct dma_slave_map mcf_edma_map[] = { |
1598 |
+ { "dreq0", "rx-tx", MCF_EDMA_FILTER_PARAM(0) }, |
1599 |
+@@ -552,7 +552,7 @@ static struct platform_device mcf_edma = { |
1600 |
+ .platform_data = &mcf_edma_data, |
1601 |
+ } |
1602 |
+ }; |
1603 |
+-#endif /* IS_ENABLED(CONFIG_MCF_EDMA) */ |
1604 |
++#endif /* MCFEDMA_BASE */ |
1605 |
+ |
1606 |
+ #ifdef MCFSDHC_BASE |
1607 |
+ static struct mcf_esdhc_platform_data mcf_esdhc_data = { |
1608 |
+@@ -610,7 +610,7 @@ static struct platform_device *mcf_devices[] __initdata = { |
1609 |
+ &mcf_i2c5, |
1610 |
+ #endif |
1611 |
+ #endif |
1612 |
+-#if IS_ENABLED(CONFIG_MCF_EDMA) |
1613 |
++#ifdef MCFEDMA_BASE |
1614 |
+ &mcf_edma, |
1615 |
+ #endif |
1616 |
+ #ifdef MCFSDHC_BASE |
1617 |
+diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h |
1618 |
+index 304b04ffea2fa..7c5d92e2915ca 100644 |
1619 |
+--- a/arch/microblaze/include/asm/uaccess.h |
1620 |
++++ b/arch/microblaze/include/asm/uaccess.h |
1621 |
+@@ -167,27 +167,27 @@ extern long __user_bad(void); |
1622 |
+ |
1623 |
+ #define __get_user(x, ptr) \ |
1624 |
+ ({ \ |
1625 |
+- unsigned long __gu_val = 0; \ |
1626 |
+ long __gu_err; \ |
1627 |
+ switch (sizeof(*(ptr))) { \ |
1628 |
+ case 1: \ |
1629 |
+- __get_user_asm("lbu", (ptr), __gu_val, __gu_err); \ |
1630 |
++ __get_user_asm("lbu", (ptr), x, __gu_err); \ |
1631 |
+ break; \ |
1632 |
+ case 2: \ |
1633 |
+- __get_user_asm("lhu", (ptr), __gu_val, __gu_err); \ |
1634 |
++ __get_user_asm("lhu", (ptr), x, __gu_err); \ |
1635 |
+ break; \ |
1636 |
+ case 4: \ |
1637 |
+- __get_user_asm("lw", (ptr), __gu_val, __gu_err); \ |
1638 |
++ __get_user_asm("lw", (ptr), x, __gu_err); \ |
1639 |
+ break; \ |
1640 |
+- case 8: \ |
1641 |
+- __gu_err = __copy_from_user(&__gu_val, ptr, 8); \ |
1642 |
+- if (__gu_err) \ |
1643 |
+- __gu_err = -EFAULT; \ |
1644 |
++ case 8: { \ |
1645 |
++ __u64 __x = 0; \ |
1646 |
++ __gu_err = raw_copy_from_user(&__x, ptr, 8) ? \ |
1647 |
++ -EFAULT : 0; \ |
1648 |
++ (x) = (typeof(x))(typeof((x) - (x)))__x; \ |
1649 |
+ break; \ |
1650 |
++ } \ |
1651 |
+ default: \ |
1652 |
+ /* __gu_val = 0; __gu_err = -EINVAL;*/ __gu_err = __user_bad();\ |
1653 |
+ } \ |
1654 |
+- x = (__force __typeof__(*(ptr))) __gu_val; \ |
1655 |
+ __gu_err; \ |
1656 |
+ }) |
1657 |
+ |
1658 |
+diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S |
1659 |
+index ea5b5a83f1e11..011d1d678840a 100644 |
1660 |
+--- a/arch/mips/dec/int-handler.S |
1661 |
++++ b/arch/mips/dec/int-handler.S |
1662 |
+@@ -131,7 +131,7 @@ |
1663 |
+ */ |
1664 |
+ mfc0 t0,CP0_CAUSE # get pending interrupts |
1665 |
+ mfc0 t1,CP0_STATUS |
1666 |
+-#ifdef CONFIG_32BIT |
1667 |
++#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) |
1668 |
+ lw t2,cpu_fpu_mask |
1669 |
+ #endif |
1670 |
+ andi t0,ST0_IM # CAUSE.CE may be non-zero! |
1671 |
+@@ -139,7 +139,7 @@ |
1672 |
+ |
1673 |
+ beqz t0,spurious |
1674 |
+ |
1675 |
+-#ifdef CONFIG_32BIT |
1676 |
++#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) |
1677 |
+ and t2,t0 |
1678 |
+ bnez t2,fpu # handle FPU immediately |
1679 |
+ #endif |
1680 |
+@@ -280,7 +280,7 @@ handle_it: |
1681 |
+ j dec_irq_dispatch |
1682 |
+ nop |
1683 |
+ |
1684 |
+-#ifdef CONFIG_32BIT |
1685 |
++#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) |
1686 |
+ fpu: |
1687 |
+ lw t0,fpu_kstat_irq |
1688 |
+ nop |
1689 |
+diff --git a/arch/mips/dec/prom/Makefile b/arch/mips/dec/prom/Makefile |
1690 |
+index d95016016b42b..2bad87551203b 100644 |
1691 |
+--- a/arch/mips/dec/prom/Makefile |
1692 |
++++ b/arch/mips/dec/prom/Makefile |
1693 |
+@@ -6,4 +6,4 @@ |
1694 |
+ |
1695 |
+ lib-y += init.o memory.o cmdline.o identify.o console.o |
1696 |
+ |
1697 |
+-lib-$(CONFIG_32BIT) += locore.o |
1698 |
++lib-$(CONFIG_CPU_R3000) += locore.o |
1699 |
+diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c |
1700 |
+index eaad0ed4b523b..99b9b29750db3 100644 |
1701 |
+--- a/arch/mips/dec/setup.c |
1702 |
++++ b/arch/mips/dec/setup.c |
1703 |
+@@ -746,7 +746,8 @@ void __init arch_init_irq(void) |
1704 |
+ dec_interrupt[DEC_IRQ_HALT] = -1; |
1705 |
+ |
1706 |
+ /* Register board interrupts: FPU and cascade. */ |
1707 |
+- if (dec_interrupt[DEC_IRQ_FPU] >= 0 && cpu_has_fpu) { |
1708 |
++ if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT) && |
1709 |
++ dec_interrupt[DEC_IRQ_FPU] >= 0 && cpu_has_fpu) { |
1710 |
+ struct irq_desc *desc_fpu; |
1711 |
+ int irq_fpu; |
1712 |
+ |
1713 |
+diff --git a/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h |
1714 |
+index 62c7dfb90e06c..1e1247add1cf8 100644 |
1715 |
+--- a/arch/mips/include/asm/dec/prom.h |
1716 |
++++ b/arch/mips/include/asm/dec/prom.h |
1717 |
+@@ -43,16 +43,11 @@ |
1718 |
+ */ |
1719 |
+ #define REX_PROM_MAGIC 0x30464354 |
1720 |
+ |
1721 |
+-#ifdef CONFIG_64BIT |
1722 |
+- |
1723 |
+-#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ |
1724 |
+- |
1725 |
+-#else /* !CONFIG_64BIT */ |
1726 |
+- |
1727 |
+-#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) |
1728 |
+- |
1729 |
+-#endif /* !CONFIG_64BIT */ |
1730 |
+- |
1731 |
++/* KN04 and KN05 are REX PROMs, so only do the check for R3k systems. */ |
1732 |
++static inline bool prom_is_rex(u32 magic) |
1733 |
++{ |
1734 |
++ return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC; |
1735 |
++} |
1736 |
+ |
1737 |
+ /* |
1738 |
+ * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and |
1739 |
+diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h |
1740 |
+index 139b4050259fa..71153c369f294 100644 |
1741 |
+--- a/arch/mips/include/asm/pgalloc.h |
1742 |
++++ b/arch/mips/include/asm/pgalloc.h |
1743 |
+@@ -15,6 +15,7 @@ |
1744 |
+ |
1745 |
+ #define __HAVE_ARCH_PMD_ALLOC_ONE |
1746 |
+ #define __HAVE_ARCH_PUD_ALLOC_ONE |
1747 |
++#define __HAVE_ARCH_PGD_FREE |
1748 |
+ #include <asm-generic/pgalloc.h> |
1749 |
+ |
1750 |
+ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, |
1751 |
+@@ -49,6 +50,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) |
1752 |
+ extern void pgd_init(unsigned long page); |
1753 |
+ extern pgd_t *pgd_alloc(struct mm_struct *mm); |
1754 |
+ |
1755 |
++static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
1756 |
++{ |
1757 |
++ free_pages((unsigned long)pgd, PGD_ORDER); |
1758 |
++} |
1759 |
++ |
1760 |
+ #define __pte_free_tlb(tlb,pte,address) \ |
1761 |
+ do { \ |
1762 |
+ pgtable_pte_page_dtor(pte); \ |
1763 |
+diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c |
1764 |
+index dd34f1b32b797..0e3c8d761a451 100644 |
1765 |
+--- a/arch/mips/rb532/devices.c |
1766 |
++++ b/arch/mips/rb532/devices.c |
1767 |
+@@ -310,11 +310,9 @@ static int __init plat_setup_devices(void) |
1768 |
+ static int __init setup_kmac(char *s) |
1769 |
+ { |
1770 |
+ printk(KERN_INFO "korina mac = %s\n", s); |
1771 |
+- if (!mac_pton(s, korina_dev0_data.mac)) { |
1772 |
++ if (!mac_pton(s, korina_dev0_data.mac)) |
1773 |
+ printk(KERN_ERR "Invalid mac\n"); |
1774 |
+- return -EINVAL; |
1775 |
+- } |
1776 |
+- return 0; |
1777 |
++ return 1; |
1778 |
+ } |
1779 |
+ |
1780 |
+ __setup("kmac=", setup_kmac); |
1781 |
+diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h |
1782 |
+index a741abbed6fbf..8a386e6c07df1 100644 |
1783 |
+--- a/arch/nios2/include/asm/uaccess.h |
1784 |
++++ b/arch/nios2/include/asm/uaccess.h |
1785 |
+@@ -89,6 +89,7 @@ extern __must_check long strnlen_user(const char __user *s, long n); |
1786 |
+ /* Optimized macros */ |
1787 |
+ #define __get_user_asm(val, insn, addr, err) \ |
1788 |
+ { \ |
1789 |
++ unsigned long __gu_val; \ |
1790 |
+ __asm__ __volatile__( \ |
1791 |
+ " movi %0, %3\n" \ |
1792 |
+ "1: " insn " %1, 0(%2)\n" \ |
1793 |
+@@ -97,14 +98,20 @@ extern __must_check long strnlen_user(const char __user *s, long n); |
1794 |
+ " .section __ex_table,\"a\"\n" \ |
1795 |
+ " .word 1b, 2b\n" \ |
1796 |
+ " .previous" \ |
1797 |
+- : "=&r" (err), "=r" (val) \ |
1798 |
++ : "=&r" (err), "=r" (__gu_val) \ |
1799 |
+ : "r" (addr), "i" (-EFAULT)); \ |
1800 |
++ val = (__force __typeof__(*(addr)))__gu_val; \ |
1801 |
+ } |
1802 |
+ |
1803 |
+-#define __get_user_unknown(val, size, ptr, err) do { \ |
1804 |
++extern void __get_user_unknown(void); |
1805 |
++ |
1806 |
++#define __get_user_8(val, ptr, err) do { \ |
1807 |
++ u64 __val = 0; \ |
1808 |
+ err = 0; \ |
1809 |
+- if (__copy_from_user(&(val), ptr, size)) { \ |
1810 |
++ if (raw_copy_from_user(&(__val), ptr, sizeof(val))) { \ |
1811 |
+ err = -EFAULT; \ |
1812 |
++ } else { \ |
1813 |
++ val = (typeof(val))(typeof((val) - (val)))__val; \ |
1814 |
+ } \ |
1815 |
+ } while (0) |
1816 |
+ |
1817 |
+@@ -120,8 +127,11 @@ do { \ |
1818 |
+ case 4: \ |
1819 |
+ __get_user_asm(val, "ldw", ptr, err); \ |
1820 |
+ break; \ |
1821 |
++ case 8: \ |
1822 |
++ __get_user_8(val, ptr, err); \ |
1823 |
++ break; \ |
1824 |
+ default: \ |
1825 |
+- __get_user_unknown(val, size, ptr, err); \ |
1826 |
++ __get_user_unknown(); \ |
1827 |
+ break; \ |
1828 |
+ } \ |
1829 |
+ } while (0) |
1830 |
+@@ -130,9 +140,7 @@ do { \ |
1831 |
+ ({ \ |
1832 |
+ long __gu_err = -EFAULT; \ |
1833 |
+ const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
1834 |
+- unsigned long __gu_val = 0; \ |
1835 |
+- __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ |
1836 |
+- (x) = (__force __typeof__(x))__gu_val; \ |
1837 |
++ __get_user_common(x, sizeof(*(ptr)), __gu_ptr, __gu_err); \ |
1838 |
+ __gu_err; \ |
1839 |
+ }) |
1840 |
+ |
1841 |
+@@ -140,11 +148,9 @@ do { \ |
1842 |
+ ({ \ |
1843 |
+ long __gu_err = -EFAULT; \ |
1844 |
+ const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
1845 |
+- unsigned long __gu_val = 0; \ |
1846 |
+ if (access_ok( __gu_ptr, sizeof(*__gu_ptr))) \ |
1847 |
+- __get_user_common(__gu_val, sizeof(*__gu_ptr), \ |
1848 |
++ __get_user_common(x, sizeof(*__gu_ptr), \ |
1849 |
+ __gu_ptr, __gu_err); \ |
1850 |
+- (x) = (__force __typeof__(x))__gu_val; \ |
1851 |
+ __gu_err; \ |
1852 |
+ }) |
1853 |
+ |
1854 |
+diff --git a/arch/nios2/kernel/signal.c b/arch/nios2/kernel/signal.c |
1855 |
+index cf2dca2ac7c37..e45491d1d3e44 100644 |
1856 |
+--- a/arch/nios2/kernel/signal.c |
1857 |
++++ b/arch/nios2/kernel/signal.c |
1858 |
+@@ -36,10 +36,10 @@ struct rt_sigframe { |
1859 |
+ |
1860 |
+ static inline int rt_restore_ucontext(struct pt_regs *regs, |
1861 |
+ struct switch_stack *sw, |
1862 |
+- struct ucontext *uc, int *pr2) |
1863 |
++ struct ucontext __user *uc, int *pr2) |
1864 |
+ { |
1865 |
+ int temp; |
1866 |
+- unsigned long *gregs = uc->uc_mcontext.gregs; |
1867 |
++ unsigned long __user *gregs = uc->uc_mcontext.gregs; |
1868 |
+ int err; |
1869 |
+ |
1870 |
+ /* Always make any pending restarted system calls return -EINTR */ |
1871 |
+@@ -102,10 +102,11 @@ asmlinkage int do_rt_sigreturn(struct switch_stack *sw) |
1872 |
+ { |
1873 |
+ struct pt_regs *regs = (struct pt_regs *)(sw + 1); |
1874 |
+ /* Verify, can we follow the stack back */ |
1875 |
+- struct rt_sigframe *frame = (struct rt_sigframe *) regs->sp; |
1876 |
++ struct rt_sigframe __user *frame; |
1877 |
+ sigset_t set; |
1878 |
+ int rval; |
1879 |
+ |
1880 |
++ frame = (struct rt_sigframe __user *) regs->sp; |
1881 |
+ if (!access_ok(frame, sizeof(*frame))) |
1882 |
+ goto badframe; |
1883 |
+ |
1884 |
+@@ -124,10 +125,10 @@ badframe: |
1885 |
+ return 0; |
1886 |
+ } |
1887 |
+ |
1888 |
+-static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) |
1889 |
++static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs) |
1890 |
+ { |
1891 |
+ struct switch_stack *sw = (struct switch_stack *)regs - 1; |
1892 |
+- unsigned long *gregs = uc->uc_mcontext.gregs; |
1893 |
++ unsigned long __user *gregs = uc->uc_mcontext.gregs; |
1894 |
+ int err = 0; |
1895 |
+ |
1896 |
+ err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); |
1897 |
+@@ -162,8 +163,9 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) |
1898 |
+ return err; |
1899 |
+ } |
1900 |
+ |
1901 |
+-static inline void *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, |
1902 |
+- size_t frame_size) |
1903 |
++static inline void __user *get_sigframe(struct ksignal *ksig, |
1904 |
++ struct pt_regs *regs, |
1905 |
++ size_t frame_size) |
1906 |
+ { |
1907 |
+ unsigned long usp; |
1908 |
+ |
1909 |
+@@ -174,13 +176,13 @@ static inline void *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, |
1910 |
+ usp = sigsp(usp, ksig); |
1911 |
+ |
1912 |
+ /* Verify, is it 32 or 64 bit aligned */ |
1913 |
+- return (void *)((usp - frame_size) & -8UL); |
1914 |
++ return (void __user *)((usp - frame_size) & -8UL); |
1915 |
+ } |
1916 |
+ |
1917 |
+ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, |
1918 |
+ struct pt_regs *regs) |
1919 |
+ { |
1920 |
+- struct rt_sigframe *frame; |
1921 |
++ struct rt_sigframe __user *frame; |
1922 |
+ int err = 0; |
1923 |
+ |
1924 |
+ frame = get_sigframe(ksig, regs, sizeof(*frame)); |
1925 |
+diff --git a/arch/parisc/include/asm/traps.h b/arch/parisc/include/asm/traps.h |
1926 |
+index 8ecc1f0c0483d..d0e090a2c000d 100644 |
1927 |
+--- a/arch/parisc/include/asm/traps.h |
1928 |
++++ b/arch/parisc/include/asm/traps.h |
1929 |
+@@ -17,6 +17,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err); |
1930 |
+ const char *trap_name(unsigned long code); |
1931 |
+ void do_page_fault(struct pt_regs *regs, unsigned long code, |
1932 |
+ unsigned long address); |
1933 |
++int handle_nadtlb_fault(struct pt_regs *regs); |
1934 |
+ #endif |
1935 |
+ |
1936 |
+ #endif |
1937 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
1938 |
+index 269b737d26299..bce47e0fb692c 100644 |
1939 |
+--- a/arch/parisc/kernel/traps.c |
1940 |
++++ b/arch/parisc/kernel/traps.c |
1941 |
+@@ -661,6 +661,8 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
1942 |
+ by hand. Technically we need to emulate: |
1943 |
+ fdc,fdce,pdc,"fic,4f",prober,probeir,probew, probeiw |
1944 |
+ */ |
1945 |
++ if (code == 17 && handle_nadtlb_fault(regs)) |
1946 |
++ return; |
1947 |
+ fault_address = regs->ior; |
1948 |
+ fault_space = regs->isr; |
1949 |
+ break; |
1950 |
+diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c |
1951 |
+index 716960f5d92ea..5faa3cff47387 100644 |
1952 |
+--- a/arch/parisc/mm/fault.c |
1953 |
++++ b/arch/parisc/mm/fault.c |
1954 |
+@@ -424,3 +424,92 @@ no_context: |
1955 |
+ goto no_context; |
1956 |
+ pagefault_out_of_memory(); |
1957 |
+ } |
1958 |
++ |
1959 |
++/* Handle non-access data TLB miss faults. |
1960 |
++ * |
1961 |
++ * For probe instructions, accesses to userspace are considered allowed |
1962 |
++ * if they lie in a valid VMA and the access type matches. We are not |
1963 |
++ * allowed to handle MM faults here so there may be situations where an |
1964 |
++ * actual access would fail even though a probe was successful. |
1965 |
++ */ |
1966 |
++int |
1967 |
++handle_nadtlb_fault(struct pt_regs *regs) |
1968 |
++{ |
1969 |
++ unsigned long insn = regs->iir; |
1970 |
++ int breg, treg, xreg, val = 0; |
1971 |
++ struct vm_area_struct *vma, *prev_vma; |
1972 |
++ struct task_struct *tsk; |
1973 |
++ struct mm_struct *mm; |
1974 |
++ unsigned long address; |
1975 |
++ unsigned long acc_type; |
1976 |
++ |
1977 |
++ switch (insn & 0x380) { |
1978 |
++ case 0x280: |
1979 |
++ /* FDC instruction */ |
1980 |
++ fallthrough; |
1981 |
++ case 0x380: |
1982 |
++ /* PDC and FIC instructions */ |
1983 |
++ if (printk_ratelimit()) { |
1984 |
++ pr_warn("BUG: nullifying cache flush/purge instruction\n"); |
1985 |
++ show_regs(regs); |
1986 |
++ } |
1987 |
++ if (insn & 0x20) { |
1988 |
++ /* Base modification */ |
1989 |
++ breg = (insn >> 21) & 0x1f; |
1990 |
++ xreg = (insn >> 16) & 0x1f; |
1991 |
++ if (breg && xreg) |
1992 |
++ regs->gr[breg] += regs->gr[xreg]; |
1993 |
++ } |
1994 |
++ regs->gr[0] |= PSW_N; |
1995 |
++ return 1; |
1996 |
++ |
1997 |
++ case 0x180: |
1998 |
++ /* PROBE instruction */ |
1999 |
++ treg = insn & 0x1f; |
2000 |
++ if (regs->isr) { |
2001 |
++ tsk = current; |
2002 |
++ mm = tsk->mm; |
2003 |
++ if (mm) { |
2004 |
++ /* Search for VMA */ |
2005 |
++ address = regs->ior; |
2006 |
++ mmap_read_lock(mm); |
2007 |
++ vma = find_vma_prev(mm, address, &prev_vma); |
2008 |
++ mmap_read_unlock(mm); |
2009 |
++ |
2010 |
++ /* |
2011 |
++ * Check if access to the VMA is okay. |
2012 |
++ * We don't allow for stack expansion. |
2013 |
++ */ |
2014 |
++ acc_type = (insn & 0x40) ? VM_WRITE : VM_READ; |
2015 |
++ if (vma |
2016 |
++ && address >= vma->vm_start |
2017 |
++ && (vma->vm_flags & acc_type) == acc_type) |
2018 |
++ val = 1; |
2019 |
++ } |
2020 |
++ } |
2021 |
++ if (treg) |
2022 |
++ regs->gr[treg] = val; |
2023 |
++ regs->gr[0] |= PSW_N; |
2024 |
++ return 1; |
2025 |
++ |
2026 |
++ case 0x300: |
2027 |
++ /* LPA instruction */ |
2028 |
++ if (insn & 0x20) { |
2029 |
++ /* Base modification */ |
2030 |
++ breg = (insn >> 21) & 0x1f; |
2031 |
++ xreg = (insn >> 16) & 0x1f; |
2032 |
++ if (breg && xreg) |
2033 |
++ regs->gr[breg] += regs->gr[xreg]; |
2034 |
++ } |
2035 |
++ treg = insn & 0x1f; |
2036 |
++ if (treg) |
2037 |
++ regs->gr[treg] = 0; |
2038 |
++ regs->gr[0] |= PSW_N; |
2039 |
++ return 1; |
2040 |
++ |
2041 |
++ default: |
2042 |
++ break; |
2043 |
++ } |
2044 |
++ |
2045 |
++ return 0; |
2046 |
++} |
2047 |
+diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile |
2048 |
+index 5c8c06215dd4b..7a96cdefbd4e4 100644 |
2049 |
+--- a/arch/powerpc/Makefile |
2050 |
++++ b/arch/powerpc/Makefile |
2051 |
+@@ -172,7 +172,7 @@ else |
2052 |
+ CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) |
2053 |
+ CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) |
2054 |
+ endif |
2055 |
+-else |
2056 |
++else ifdef CONFIG_PPC_BOOK3E_64 |
2057 |
+ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 |
2058 |
+ endif |
2059 |
+ |
2060 |
+diff --git a/arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts b/arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts |
2061 |
+new file mode 100644 |
2062 |
+index 0000000000000..73f8c998c64df |
2063 |
+--- /dev/null |
2064 |
++++ b/arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts |
2065 |
+@@ -0,0 +1,30 @@ |
2066 |
++// SPDX-License-Identifier: GPL-2.0-or-later |
2067 |
++/* |
2068 |
++ * T1040RDB-REV-A Device Tree Source |
2069 |
++ * |
2070 |
++ * Copyright 2014 - 2015 Freescale Semiconductor Inc. |
2071 |
++ * |
2072 |
++ */ |
2073 |
++ |
2074 |
++#include "t1040rdb.dts" |
2075 |
++ |
2076 |
++/ { |
2077 |
++ model = "fsl,T1040RDB-REV-A"; |
2078 |
++ compatible = "fsl,T1040RDB-REV-A"; |
2079 |
++}; |
2080 |
++ |
2081 |
++&seville_port0 { |
2082 |
++ label = "ETH5"; |
2083 |
++}; |
2084 |
++ |
2085 |
++&seville_port2 { |
2086 |
++ label = "ETH7"; |
2087 |
++}; |
2088 |
++ |
2089 |
++&seville_port4 { |
2090 |
++ label = "ETH9"; |
2091 |
++}; |
2092 |
++ |
2093 |
++&seville_port6 { |
2094 |
++ label = "ETH11"; |
2095 |
++}; |
2096 |
+diff --git a/arch/powerpc/boot/dts/fsl/t1040rdb.dts b/arch/powerpc/boot/dts/fsl/t1040rdb.dts |
2097 |
+index af0c8a6f56138..b6733e7e65805 100644 |
2098 |
+--- a/arch/powerpc/boot/dts/fsl/t1040rdb.dts |
2099 |
++++ b/arch/powerpc/boot/dts/fsl/t1040rdb.dts |
2100 |
+@@ -119,7 +119,7 @@ |
2101 |
+ managed = "in-band-status"; |
2102 |
+ phy-handle = <&phy_qsgmii_0>; |
2103 |
+ phy-mode = "qsgmii"; |
2104 |
+- label = "ETH5"; |
2105 |
++ label = "ETH3"; |
2106 |
+ status = "okay"; |
2107 |
+ }; |
2108 |
+ |
2109 |
+@@ -135,7 +135,7 @@ |
2110 |
+ managed = "in-band-status"; |
2111 |
+ phy-handle = <&phy_qsgmii_2>; |
2112 |
+ phy-mode = "qsgmii"; |
2113 |
+- label = "ETH7"; |
2114 |
++ label = "ETH5"; |
2115 |
+ status = "okay"; |
2116 |
+ }; |
2117 |
+ |
2118 |
+@@ -151,7 +151,7 @@ |
2119 |
+ managed = "in-band-status"; |
2120 |
+ phy-handle = <&phy_qsgmii_4>; |
2121 |
+ phy-mode = "qsgmii"; |
2122 |
+- label = "ETH9"; |
2123 |
++ label = "ETH7"; |
2124 |
+ status = "okay"; |
2125 |
+ }; |
2126 |
+ |
2127 |
+@@ -167,7 +167,7 @@ |
2128 |
+ managed = "in-band-status"; |
2129 |
+ phy-handle = <&phy_qsgmii_6>; |
2130 |
+ phy-mode = "qsgmii"; |
2131 |
+- label = "ETH11"; |
2132 |
++ label = "ETH9"; |
2133 |
+ status = "okay"; |
2134 |
+ }; |
2135 |
+ |
2136 |
+diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h |
2137 |
+index 58635960403c0..0182b291248ac 100644 |
2138 |
+--- a/arch/powerpc/include/asm/io.h |
2139 |
++++ b/arch/powerpc/include/asm/io.h |
2140 |
+@@ -344,25 +344,37 @@ static inline void __raw_writeq_be(unsigned long v, volatile void __iomem *addr) |
2141 |
+ */ |
2142 |
+ static inline void __raw_rm_writeb(u8 val, volatile void __iomem *paddr) |
2143 |
+ { |
2144 |
+- __asm__ __volatile__("stbcix %0,0,%1" |
2145 |
++ __asm__ __volatile__(".machine push; \ |
2146 |
++ .machine power6; \ |
2147 |
++ stbcix %0,0,%1; \ |
2148 |
++ .machine pop;" |
2149 |
+ : : "r" (val), "r" (paddr) : "memory"); |
2150 |
+ } |
2151 |
+ |
2152 |
+ static inline void __raw_rm_writew(u16 val, volatile void __iomem *paddr) |
2153 |
+ { |
2154 |
+- __asm__ __volatile__("sthcix %0,0,%1" |
2155 |
++ __asm__ __volatile__(".machine push; \ |
2156 |
++ .machine power6; \ |
2157 |
++ sthcix %0,0,%1; \ |
2158 |
++ .machine pop;" |
2159 |
+ : : "r" (val), "r" (paddr) : "memory"); |
2160 |
+ } |
2161 |
+ |
2162 |
+ static inline void __raw_rm_writel(u32 val, volatile void __iomem *paddr) |
2163 |
+ { |
2164 |
+- __asm__ __volatile__("stwcix %0,0,%1" |
2165 |
++ __asm__ __volatile__(".machine push; \ |
2166 |
++ .machine power6; \ |
2167 |
++ stwcix %0,0,%1; \ |
2168 |
++ .machine pop;" |
2169 |
+ : : "r" (val), "r" (paddr) : "memory"); |
2170 |
+ } |
2171 |
+ |
2172 |
+ static inline void __raw_rm_writeq(u64 val, volatile void __iomem *paddr) |
2173 |
+ { |
2174 |
+- __asm__ __volatile__("stdcix %0,0,%1" |
2175 |
++ __asm__ __volatile__(".machine push; \ |
2176 |
++ .machine power6; \ |
2177 |
++ stdcix %0,0,%1; \ |
2178 |
++ .machine pop;" |
2179 |
+ : : "r" (val), "r" (paddr) : "memory"); |
2180 |
+ } |
2181 |
+ |
2182 |
+@@ -374,7 +386,10 @@ static inline void __raw_rm_writeq_be(u64 val, volatile void __iomem *paddr) |
2183 |
+ static inline u8 __raw_rm_readb(volatile void __iomem *paddr) |
2184 |
+ { |
2185 |
+ u8 ret; |
2186 |
+- __asm__ __volatile__("lbzcix %0,0, %1" |
2187 |
++ __asm__ __volatile__(".machine push; \ |
2188 |
++ .machine power6; \ |
2189 |
++ lbzcix %0,0, %1; \ |
2190 |
++ .machine pop;" |
2191 |
+ : "=r" (ret) : "r" (paddr) : "memory"); |
2192 |
+ return ret; |
2193 |
+ } |
2194 |
+@@ -382,7 +397,10 @@ static inline u8 __raw_rm_readb(volatile void __iomem *paddr) |
2195 |
+ static inline u16 __raw_rm_readw(volatile void __iomem *paddr) |
2196 |
+ { |
2197 |
+ u16 ret; |
2198 |
+- __asm__ __volatile__("lhzcix %0,0, %1" |
2199 |
++ __asm__ __volatile__(".machine push; \ |
2200 |
++ .machine power6; \ |
2201 |
++ lhzcix %0,0, %1; \ |
2202 |
++ .machine pop;" |
2203 |
+ : "=r" (ret) : "r" (paddr) : "memory"); |
2204 |
+ return ret; |
2205 |
+ } |
2206 |
+@@ -390,7 +408,10 @@ static inline u16 __raw_rm_readw(volatile void __iomem *paddr) |
2207 |
+ static inline u32 __raw_rm_readl(volatile void __iomem *paddr) |
2208 |
+ { |
2209 |
+ u32 ret; |
2210 |
+- __asm__ __volatile__("lwzcix %0,0, %1" |
2211 |
++ __asm__ __volatile__(".machine push; \ |
2212 |
++ .machine power6; \ |
2213 |
++ lwzcix %0,0, %1; \ |
2214 |
++ .machine pop;" |
2215 |
+ : "=r" (ret) : "r" (paddr) : "memory"); |
2216 |
+ return ret; |
2217 |
+ } |
2218 |
+@@ -398,7 +419,10 @@ static inline u32 __raw_rm_readl(volatile void __iomem *paddr) |
2219 |
+ static inline u64 __raw_rm_readq(volatile void __iomem *paddr) |
2220 |
+ { |
2221 |
+ u64 ret; |
2222 |
+- __asm__ __volatile__("ldcix %0,0, %1" |
2223 |
++ __asm__ __volatile__(".machine push; \ |
2224 |
++ .machine power6; \ |
2225 |
++ ldcix %0,0, %1; \ |
2226 |
++ .machine pop;" |
2227 |
+ : "=r" (ret) : "r" (paddr) : "memory"); |
2228 |
+ return ret; |
2229 |
+ } |
2230 |
+diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h |
2231 |
+index f53bfefb4a577..6b808bcdecd52 100644 |
2232 |
+--- a/arch/powerpc/include/asm/uaccess.h |
2233 |
++++ b/arch/powerpc/include/asm/uaccess.h |
2234 |
+@@ -229,8 +229,11 @@ extern long __get_user_bad(void); |
2235 |
+ */ |
2236 |
+ #define __get_user_atomic_128_aligned(kaddr, uaddr, err) \ |
2237 |
+ __asm__ __volatile__( \ |
2238 |
++ ".machine push\n" \ |
2239 |
++ ".machine altivec\n" \ |
2240 |
+ "1: lvx 0,0,%1 # get user\n" \ |
2241 |
+ " stvx 0,0,%2 # put kernel\n" \ |
2242 |
++ ".machine pop\n" \ |
2243 |
+ "2:\n" \ |
2244 |
+ ".section .fixup,\"ax\"\n" \ |
2245 |
+ "3: li %0,%3\n" \ |
2246 |
+diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c |
2247 |
+index 617eba82531cb..d89cf802d9aa7 100644 |
2248 |
+--- a/arch/powerpc/kernel/kvm.c |
2249 |
++++ b/arch/powerpc/kernel/kvm.c |
2250 |
+@@ -669,7 +669,7 @@ static void __init kvm_use_magic_page(void) |
2251 |
+ on_each_cpu(kvm_map_magic_page, &features, 1); |
2252 |
+ |
2253 |
+ /* Quick self-test to see if the mapping works */ |
2254 |
+- if (!fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) { |
2255 |
++ if (fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) { |
2256 |
+ kvm_patching_worked = false; |
2257 |
+ return; |
2258 |
+ } |
2259 |
+diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c |
2260 |
+index 527c205d5a5f5..38b7a3491aac0 100644 |
2261 |
+--- a/arch/powerpc/kvm/book3s_hv.c |
2262 |
++++ b/arch/powerpc/kvm/book3s_hv.c |
2263 |
+@@ -5752,8 +5752,11 @@ static int kvmppc_book3s_init_hv(void) |
2264 |
+ if (r) |
2265 |
+ return r; |
2266 |
+ |
2267 |
+- if (kvmppc_radix_possible()) |
2268 |
++ if (kvmppc_radix_possible()) { |
2269 |
+ r = kvmppc_radix_init(); |
2270 |
++ if (r) |
2271 |
++ return r; |
2272 |
++ } |
2273 |
+ |
2274 |
+ /* |
2275 |
+ * POWER9 chips before version 2.02 can't have some threads in |
2276 |
+diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c |
2277 |
+index 543db9157f3b1..ef8077a739b88 100644 |
2278 |
+--- a/arch/powerpc/kvm/powerpc.c |
2279 |
++++ b/arch/powerpc/kvm/powerpc.c |
2280 |
+@@ -1500,7 +1500,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu, |
2281 |
+ { |
2282 |
+ enum emulation_result emulated = EMULATE_DONE; |
2283 |
+ |
2284 |
+- if (vcpu->arch.mmio_vsx_copy_nums > 2) |
2285 |
++ if (vcpu->arch.mmio_vmx_copy_nums > 2) |
2286 |
+ return EMULATE_FAIL; |
2287 |
+ |
2288 |
+ while (vcpu->arch.mmio_vmx_copy_nums) { |
2289 |
+@@ -1597,7 +1597,7 @@ int kvmppc_handle_vmx_store(struct kvm_vcpu *vcpu, |
2290 |
+ unsigned int index = rs & KVM_MMIO_REG_MASK; |
2291 |
+ enum emulation_result emulated = EMULATE_DONE; |
2292 |
+ |
2293 |
+- if (vcpu->arch.mmio_vsx_copy_nums > 2) |
2294 |
++ if (vcpu->arch.mmio_vmx_copy_nums > 2) |
2295 |
+ return EMULATE_FAIL; |
2296 |
+ |
2297 |
+ vcpu->arch.io_gpr = rs; |
2298 |
+diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c |
2299 |
+index 0edebbbffcdca..2d19655328f12 100644 |
2300 |
+--- a/arch/powerpc/lib/sstep.c |
2301 |
++++ b/arch/powerpc/lib/sstep.c |
2302 |
+@@ -108,9 +108,9 @@ static nokprobe_inline long address_ok(struct pt_regs *regs, |
2303 |
+ { |
2304 |
+ if (!user_mode(regs)) |
2305 |
+ return 1; |
2306 |
+- if (__access_ok(ea, nb)) |
2307 |
++ if (access_ok((void __user *)ea, nb)) |
2308 |
+ return 1; |
2309 |
+- if (__access_ok(ea, 1)) |
2310 |
++ if (access_ok((void __user *)ea, 1)) |
2311 |
+ /* Access overlaps the end of the user region */ |
2312 |
+ regs->dar = TASK_SIZE_MAX - 1; |
2313 |
+ else |
2314 |
+@@ -949,7 +949,10 @@ NOKPROBE_SYMBOL(emulate_dcbz); |
2315 |
+ |
2316 |
+ #define __put_user_asmx(x, addr, err, op, cr) \ |
2317 |
+ __asm__ __volatile__( \ |
2318 |
++ ".machine push\n" \ |
2319 |
++ ".machine power8\n" \ |
2320 |
+ "1: " op " %2,0,%3\n" \ |
2321 |
++ ".machine pop\n" \ |
2322 |
+ " mfcr %1\n" \ |
2323 |
+ "2:\n" \ |
2324 |
+ ".section .fixup,\"ax\"\n" \ |
2325 |
+@@ -962,7 +965,10 @@ NOKPROBE_SYMBOL(emulate_dcbz); |
2326 |
+ |
2327 |
+ #define __get_user_asmx(x, addr, err, op) \ |
2328 |
+ __asm__ __volatile__( \ |
2329 |
++ ".machine push\n" \ |
2330 |
++ ".machine power8\n" \ |
2331 |
+ "1: "op" %1,0,%2\n" \ |
2332 |
++ ".machine pop\n" \ |
2333 |
+ "2:\n" \ |
2334 |
+ ".section .fixup,\"ax\"\n" \ |
2335 |
+ "3: li %0,%3\n" \ |
2336 |
+@@ -3187,7 +3193,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op) |
2337 |
+ __put_user_asmx(op->val, ea, err, "stbcx.", cr); |
2338 |
+ break; |
2339 |
+ case 2: |
2340 |
+- __put_user_asmx(op->val, ea, err, "stbcx.", cr); |
2341 |
++ __put_user_asmx(op->val, ea, err, "sthcx.", cr); |
2342 |
+ break; |
2343 |
+ #endif |
2344 |
+ case 4: |
2345 |
+diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c |
2346 |
+index cf8770b1a692e..f3e4d069e0ba7 100644 |
2347 |
+--- a/arch/powerpc/mm/kasan/kasan_init_32.c |
2348 |
++++ b/arch/powerpc/mm/kasan/kasan_init_32.c |
2349 |
+@@ -83,13 +83,12 @@ void __init |
2350 |
+ kasan_update_early_region(unsigned long k_start, unsigned long k_end, pte_t pte) |
2351 |
+ { |
2352 |
+ unsigned long k_cur; |
2353 |
+- phys_addr_t pa = __pa(kasan_early_shadow_page); |
2354 |
+ |
2355 |
+ for (k_cur = k_start; k_cur != k_end; k_cur += PAGE_SIZE) { |
2356 |
+ pmd_t *pmd = pmd_off_k(k_cur); |
2357 |
+ pte_t *ptep = pte_offset_kernel(pmd, k_cur); |
2358 |
+ |
2359 |
+- if ((pte_val(*ptep) & PTE_RPN_MASK) != pa) |
2360 |
++ if (pte_page(*ptep) != virt_to_page(lm_alias(kasan_early_shadow_page))) |
2361 |
+ continue; |
2362 |
+ |
2363 |
+ __set_pte_at(&init_mm, k_cur, ptep, pte, 0); |
2364 |
+diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
2365 |
+index 094a1076fd1fe..275c60f92a7ce 100644 |
2366 |
+--- a/arch/powerpc/mm/numa.c |
2367 |
++++ b/arch/powerpc/mm/numa.c |
2368 |
+@@ -742,7 +742,9 @@ static int __init parse_numa_properties(void) |
2369 |
+ of_node_put(cpu); |
2370 |
+ } |
2371 |
+ |
2372 |
+- node_set_online(nid); |
2373 |
++ /* node_set_online() is an UB if 'nid' is negative */ |
2374 |
++ if (likely(nid >= 0)) |
2375 |
++ node_set_online(nid); |
2376 |
+ } |
2377 |
+ |
2378 |
+ get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells); |
2379 |
+diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c |
2380 |
+index 7b25548ec42b0..e8074d7f2401b 100644 |
2381 |
+--- a/arch/powerpc/perf/imc-pmu.c |
2382 |
++++ b/arch/powerpc/perf/imc-pmu.c |
2383 |
+@@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event) |
2384 |
+ |
2385 |
+ event->hw.idx = -1; |
2386 |
+ |
2387 |
+- event->pmu->task_ctx_nr = perf_hw_context; |
2388 |
++ /* |
2389 |
++ * There can only be a single PMU for perf_hw_context events which is assigned to |
2390 |
++ * core PMU. Hence use "perf_sw_context" for trace_imc. |
2391 |
++ */ |
2392 |
++ event->pmu->task_ctx_nr = perf_sw_context; |
2393 |
+ event->destroy = reset_global_refc; |
2394 |
+ return 0; |
2395 |
+ } |
2396 |
+diff --git a/arch/powerpc/platforms/8xx/pic.c b/arch/powerpc/platforms/8xx/pic.c |
2397 |
+index f2ba837249d69..04a6abf14c295 100644 |
2398 |
+--- a/arch/powerpc/platforms/8xx/pic.c |
2399 |
++++ b/arch/powerpc/platforms/8xx/pic.c |
2400 |
+@@ -153,6 +153,7 @@ int __init mpc8xx_pic_init(void) |
2401 |
+ if (mpc8xx_pic_host == NULL) { |
2402 |
+ printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); |
2403 |
+ ret = -ENOMEM; |
2404 |
++ goto out; |
2405 |
+ } |
2406 |
+ |
2407 |
+ ret = 0; |
2408 |
+diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c |
2409 |
+index 72c25295c1c2b..69c344c8884f3 100644 |
2410 |
+--- a/arch/powerpc/platforms/powernv/rng.c |
2411 |
++++ b/arch/powerpc/platforms/powernv/rng.c |
2412 |
+@@ -43,7 +43,11 @@ static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) |
2413 |
+ unsigned long parity; |
2414 |
+ |
2415 |
+ /* Calculate the parity of the value */ |
2416 |
+- asm ("popcntd %0,%1" : "=r" (parity) : "r" (val)); |
2417 |
++ asm (".machine push; \ |
2418 |
++ .machine power7; \ |
2419 |
++ popcntd %0,%1; \ |
2420 |
++ .machine pop;" |
2421 |
++ : "=r" (parity) : "r" (val)); |
2422 |
+ |
2423 |
+ /* xor our value with the previous mask */ |
2424 |
+ val ^= rng->mask; |
2425 |
+diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c |
2426 |
+index 8963eaffb1b7b..39186ad6b3c3a 100644 |
2427 |
+--- a/arch/powerpc/sysdev/fsl_gtm.c |
2428 |
++++ b/arch/powerpc/sysdev/fsl_gtm.c |
2429 |
+@@ -86,7 +86,7 @@ static LIST_HEAD(gtms); |
2430 |
+ */ |
2431 |
+ struct gtm_timer *gtm_get_timer16(void) |
2432 |
+ { |
2433 |
+- struct gtm *gtm = NULL; |
2434 |
++ struct gtm *gtm; |
2435 |
+ int i; |
2436 |
+ |
2437 |
+ list_for_each_entry(gtm, >ms, list_node) { |
2438 |
+@@ -103,7 +103,7 @@ struct gtm_timer *gtm_get_timer16(void) |
2439 |
+ spin_unlock_irq(>m->lock); |
2440 |
+ } |
2441 |
+ |
2442 |
+- if (gtm) |
2443 |
++ if (!list_empty(>ms)) |
2444 |
+ return ERR_PTR(-EBUSY); |
2445 |
+ return ERR_PTR(-ENODEV); |
2446 |
+ } |
2447 |
+diff --git a/arch/riscv/include/asm/module.lds.h b/arch/riscv/include/asm/module.lds.h |
2448 |
+index 4254ff2ff0494..1075beae1ac64 100644 |
2449 |
+--- a/arch/riscv/include/asm/module.lds.h |
2450 |
++++ b/arch/riscv/include/asm/module.lds.h |
2451 |
+@@ -2,8 +2,8 @@ |
2452 |
+ /* Copyright (C) 2017 Andes Technology Corporation */ |
2453 |
+ #ifdef CONFIG_MODULE_SECTIONS |
2454 |
+ SECTIONS { |
2455 |
+- .plt (NOLOAD) : { BYTE(0) } |
2456 |
+- .got (NOLOAD) : { BYTE(0) } |
2457 |
+- .got.plt (NOLOAD) : { BYTE(0) } |
2458 |
++ .plt : { BYTE(0) } |
2459 |
++ .got : { BYTE(0) } |
2460 |
++ .got.plt : { BYTE(0) } |
2461 |
+ } |
2462 |
+ #endif |
2463 |
+diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h |
2464 |
+index a390711129de6..d79ae9d98999f 100644 |
2465 |
+--- a/arch/riscv/include/asm/thread_info.h |
2466 |
++++ b/arch/riscv/include/asm/thread_info.h |
2467 |
+@@ -11,11 +11,17 @@ |
2468 |
+ #include <asm/page.h> |
2469 |
+ #include <linux/const.h> |
2470 |
+ |
2471 |
++#ifdef CONFIG_KASAN |
2472 |
++#define KASAN_STACK_ORDER 1 |
2473 |
++#else |
2474 |
++#define KASAN_STACK_ORDER 0 |
2475 |
++#endif |
2476 |
++ |
2477 |
+ /* thread information allocation */ |
2478 |
+ #ifdef CONFIG_64BIT |
2479 |
+-#define THREAD_SIZE_ORDER (2) |
2480 |
++#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER) |
2481 |
+ #else |
2482 |
+-#define THREAD_SIZE_ORDER (1) |
2483 |
++#define THREAD_SIZE_ORDER (1 + KASAN_STACK_ORDER) |
2484 |
+ #endif |
2485 |
+ #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
2486 |
+ |
2487 |
+diff --git a/arch/riscv/kernel/perf_callchain.c b/arch/riscv/kernel/perf_callchain.c |
2488 |
+index ad3001cbdf618..fb02811df7143 100644 |
2489 |
+--- a/arch/riscv/kernel/perf_callchain.c |
2490 |
++++ b/arch/riscv/kernel/perf_callchain.c |
2491 |
+@@ -19,8 +19,8 @@ static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry, |
2492 |
+ { |
2493 |
+ struct stackframe buftail; |
2494 |
+ unsigned long ra = 0; |
2495 |
+- unsigned long *user_frame_tail = |
2496 |
+- (unsigned long *)(fp - sizeof(struct stackframe)); |
2497 |
++ unsigned long __user *user_frame_tail = |
2498 |
++ (unsigned long __user *)(fp - sizeof(struct stackframe)); |
2499 |
+ |
2500 |
+ /* Check accessibility of one struct frame_tail beyond */ |
2501 |
+ if (!access_ok(user_frame_tail, sizeof(buftail))) |
2502 |
+@@ -77,7 +77,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry, |
2503 |
+ |
2504 |
+ bool fill_callchain(unsigned long pc, void *entry) |
2505 |
+ { |
2506 |
+- return perf_callchain_store(entry, pc); |
2507 |
++ return perf_callchain_store(entry, pc) == 0; |
2508 |
+ } |
2509 |
+ |
2510 |
+ void notrace walk_stackframe(struct task_struct *task, |
2511 |
+diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c |
2512 |
+index 741d0701003af..1da36dd34990b 100644 |
2513 |
+--- a/arch/sparc/kernel/signal_32.c |
2514 |
++++ b/arch/sparc/kernel/signal_32.c |
2515 |
+@@ -65,7 +65,7 @@ struct rt_signal_frame { |
2516 |
+ */ |
2517 |
+ static inline bool invalid_frame_pointer(void __user *fp, int fplen) |
2518 |
+ { |
2519 |
+- if ((((unsigned long) fp) & 15) || !__access_ok((unsigned long)fp, fplen)) |
2520 |
++ if ((((unsigned long) fp) & 15) || !access_ok(fp, fplen)) |
2521 |
+ return true; |
2522 |
+ |
2523 |
+ return false; |
2524 |
+diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c |
2525 |
+index a2e680f7d39f2..2d20773b7d8ee 100644 |
2526 |
+--- a/arch/um/drivers/mconsole_kern.c |
2527 |
++++ b/arch/um/drivers/mconsole_kern.c |
2528 |
+@@ -223,7 +223,7 @@ void mconsole_go(struct mc_request *req) |
2529 |
+ |
2530 |
+ void mconsole_stop(struct mc_request *req) |
2531 |
+ { |
2532 |
+- deactivate_fd(req->originating_fd, MCONSOLE_IRQ); |
2533 |
++ block_signals(); |
2534 |
+ os_set_fd_block(req->originating_fd, 1); |
2535 |
+ mconsole_reply(req, "stopped", 0, 0); |
2536 |
+ for (;;) { |
2537 |
+@@ -246,6 +246,7 @@ void mconsole_stop(struct mc_request *req) |
2538 |
+ } |
2539 |
+ os_set_fd_block(req->originating_fd, 0); |
2540 |
+ mconsole_reply(req, "", 0, 0); |
2541 |
++ unblock_signals(); |
2542 |
+ } |
2543 |
+ |
2544 |
+ static DEFINE_SPINLOCK(mc_devices_lock); |
2545 |
+diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
2546 |
+index c084899e95825..cc3b79c066853 100644 |
2547 |
+--- a/arch/x86/events/intel/pt.c |
2548 |
++++ b/arch/x86/events/intel/pt.c |
2549 |
+@@ -472,7 +472,7 @@ static u64 pt_config_filters(struct perf_event *event) |
2550 |
+ pt->filters.filter[range].msr_b = filter->msr_b; |
2551 |
+ } |
2552 |
+ |
2553 |
+- rtit_ctl |= filter->config << pt_address_ranges[range].reg_off; |
2554 |
++ rtit_ctl |= (u64)filter->config << pt_address_ranges[range].reg_off; |
2555 |
+ } |
2556 |
+ |
2557 |
+ return rtit_ctl; |
2558 |
+diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c |
2559 |
+index 7462b79c39de6..18e952fed021b 100644 |
2560 |
+--- a/arch/x86/kernel/kvm.c |
2561 |
++++ b/arch/x86/kernel/kvm.c |
2562 |
+@@ -532,7 +532,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) |
2563 |
+ } else if (apic_id < min && max - apic_id < KVM_IPI_CLUSTER_SIZE) { |
2564 |
+ ipi_bitmap <<= min - apic_id; |
2565 |
+ min = apic_id; |
2566 |
+- } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
2567 |
++ } else if (apic_id > min && apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
2568 |
+ max = apic_id < max ? max : apic_id; |
2569 |
+ } else { |
2570 |
+ ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
2571 |
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
2572 |
+index e82151ba95c09..a63df19ef4dad 100644 |
2573 |
+--- a/arch/x86/kvm/emulate.c |
2574 |
++++ b/arch/x86/kvm/emulate.c |
2575 |
+@@ -1718,11 +1718,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
2576 |
+ goto exception; |
2577 |
+ } |
2578 |
+ |
2579 |
+- if (!seg_desc.p) { |
2580 |
+- err_vec = (seg == VCPU_SREG_SS) ? SS_VECTOR : NP_VECTOR; |
2581 |
+- goto exception; |
2582 |
+- } |
2583 |
+- |
2584 |
+ dpl = seg_desc.dpl; |
2585 |
+ |
2586 |
+ switch (seg) { |
2587 |
+@@ -1762,6 +1757,10 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
2588 |
+ case VCPU_SREG_TR: |
2589 |
+ if (seg_desc.s || (seg_desc.type != 1 && seg_desc.type != 9)) |
2590 |
+ goto exception; |
2591 |
++ if (!seg_desc.p) { |
2592 |
++ err_vec = NP_VECTOR; |
2593 |
++ goto exception; |
2594 |
++ } |
2595 |
+ old_desc = seg_desc; |
2596 |
+ seg_desc.type |= 2; /* busy */ |
2597 |
+ ret = ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_desc, |
2598 |
+@@ -1786,6 +1785,11 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
2599 |
+ break; |
2600 |
+ } |
2601 |
+ |
2602 |
++ if (!seg_desc.p) { |
2603 |
++ err_vec = (seg == VCPU_SREG_SS) ? SS_VECTOR : NP_VECTOR; |
2604 |
++ goto exception; |
2605 |
++ } |
2606 |
++ |
2607 |
+ if (seg_desc.s) { |
2608 |
+ /* mark segment as accessed */ |
2609 |
+ if (!(seg_desc.type & 1)) { |
2610 |
+diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c |
2611 |
+index 328f37e4fd3a7..d806139377bc6 100644 |
2612 |
+--- a/arch/x86/kvm/hyperv.c |
2613 |
++++ b/arch/x86/kvm/hyperv.c |
2614 |
+@@ -207,7 +207,7 @@ static int synic_set_msr(struct kvm_vcpu_hv_synic *synic, |
2615 |
+ struct kvm_vcpu *vcpu = synic_to_vcpu(synic); |
2616 |
+ int ret; |
2617 |
+ |
2618 |
+- if (!synic->active && !host) |
2619 |
++ if (!synic->active && (!host || data)) |
2620 |
+ return 1; |
2621 |
+ |
2622 |
+ trace_kvm_hv_synic_set_msr(vcpu->vcpu_id, msr, data, host); |
2623 |
+@@ -253,6 +253,9 @@ static int synic_set_msr(struct kvm_vcpu_hv_synic *synic, |
2624 |
+ case HV_X64_MSR_EOM: { |
2625 |
+ int i; |
2626 |
+ |
2627 |
++ if (!synic->active) |
2628 |
++ break; |
2629 |
++ |
2630 |
+ for (i = 0; i < ARRAY_SIZE(synic->sint); i++) |
2631 |
+ kvm_hv_notify_acked_sint(vcpu, i); |
2632 |
+ break; |
2633 |
+@@ -636,7 +639,7 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, |
2634 |
+ struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer); |
2635 |
+ struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); |
2636 |
+ |
2637 |
+- if (!synic->active && !host) |
2638 |
++ if (!synic->active && (!host || config)) |
2639 |
+ return 1; |
2640 |
+ |
2641 |
+ trace_kvm_hv_stimer_set_config(stimer_to_vcpu(stimer)->vcpu_id, |
2642 |
+@@ -660,7 +663,7 @@ static int stimer_set_count(struct kvm_vcpu_hv_stimer *stimer, u64 count, |
2643 |
+ struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer); |
2644 |
+ struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); |
2645 |
+ |
2646 |
+- if (!synic->active && !host) |
2647 |
++ if (!synic->active && (!host || count)) |
2648 |
+ return 1; |
2649 |
+ |
2650 |
+ trace_kvm_hv_stimer_set_count(stimer_to_vcpu(stimer)->vcpu_id, |
2651 |
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
2652 |
+index 677d21082454f..de11149e28e09 100644 |
2653 |
+--- a/arch/x86/kvm/lapic.c |
2654 |
++++ b/arch/x86/kvm/lapic.c |
2655 |
+@@ -2227,10 +2227,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) |
2656 |
+ |
2657 |
+ void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8) |
2658 |
+ { |
2659 |
+- struct kvm_lapic *apic = vcpu->arch.apic; |
2660 |
+- |
2661 |
+- apic_set_tpr(apic, ((cr8 & 0x0f) << 4) |
2662 |
+- | (kvm_lapic_get_reg(apic, APIC_TASKPRI) & 4)); |
2663 |
++ apic_set_tpr(vcpu->arch.apic, (cr8 & 0x0f) << 4); |
2664 |
+ } |
2665 |
+ |
2666 |
+ u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) |
2667 |
+diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h |
2668 |
+index f8829134bf341..c6daeeff1d9c9 100644 |
2669 |
+--- a/arch/x86/kvm/mmu/paging_tmpl.h |
2670 |
++++ b/arch/x86/kvm/mmu/paging_tmpl.h |
2671 |
+@@ -34,9 +34,8 @@ |
2672 |
+ #define PT_HAVE_ACCESSED_DIRTY(mmu) true |
2673 |
+ #ifdef CONFIG_X86_64 |
2674 |
+ #define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL |
2675 |
+- #define CMPXCHG cmpxchg |
2676 |
++ #define CMPXCHG "cmpxchgq" |
2677 |
+ #else |
2678 |
+- #define CMPXCHG cmpxchg64 |
2679 |
+ #define PT_MAX_FULL_LEVELS 2 |
2680 |
+ #endif |
2681 |
+ #elif PTTYPE == 32 |
2682 |
+@@ -52,7 +51,7 @@ |
2683 |
+ #define PT_GUEST_DIRTY_SHIFT PT_DIRTY_SHIFT |
2684 |
+ #define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT |
2685 |
+ #define PT_HAVE_ACCESSED_DIRTY(mmu) true |
2686 |
+- #define CMPXCHG cmpxchg |
2687 |
++ #define CMPXCHG "cmpxchgl" |
2688 |
+ #elif PTTYPE == PTTYPE_EPT |
2689 |
+ #define pt_element_t u64 |
2690 |
+ #define guest_walker guest_walkerEPT |
2691 |
+@@ -65,7 +64,9 @@ |
2692 |
+ #define PT_GUEST_DIRTY_SHIFT 9 |
2693 |
+ #define PT_GUEST_ACCESSED_SHIFT 8 |
2694 |
+ #define PT_HAVE_ACCESSED_DIRTY(mmu) ((mmu)->ept_ad) |
2695 |
+- #define CMPXCHG cmpxchg64 |
2696 |
++ #ifdef CONFIG_X86_64 |
2697 |
++ #define CMPXCHG "cmpxchgq" |
2698 |
++ #endif |
2699 |
+ #define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL |
2700 |
+ #else |
2701 |
+ #error Invalid PTTYPE value |
2702 |
+@@ -147,43 +148,39 @@ static int FNAME(cmpxchg_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
2703 |
+ pt_element_t __user *ptep_user, unsigned index, |
2704 |
+ pt_element_t orig_pte, pt_element_t new_pte) |
2705 |
+ { |
2706 |
+- int npages; |
2707 |
+- pt_element_t ret; |
2708 |
+- pt_element_t *table; |
2709 |
+- struct page *page; |
2710 |
+- |
2711 |
+- npages = get_user_pages_fast((unsigned long)ptep_user, 1, FOLL_WRITE, &page); |
2712 |
+- if (likely(npages == 1)) { |
2713 |
+- table = kmap_atomic(page); |
2714 |
+- ret = CMPXCHG(&table[index], orig_pte, new_pte); |
2715 |
+- kunmap_atomic(table); |
2716 |
+- |
2717 |
+- kvm_release_page_dirty(page); |
2718 |
+- } else { |
2719 |
+- struct vm_area_struct *vma; |
2720 |
+- unsigned long vaddr = (unsigned long)ptep_user & PAGE_MASK; |
2721 |
+- unsigned long pfn; |
2722 |
+- unsigned long paddr; |
2723 |
+- |
2724 |
+- mmap_read_lock(current->mm); |
2725 |
+- vma = find_vma_intersection(current->mm, vaddr, vaddr + PAGE_SIZE); |
2726 |
+- if (!vma || !(vma->vm_flags & VM_PFNMAP)) { |
2727 |
+- mmap_read_unlock(current->mm); |
2728 |
+- return -EFAULT; |
2729 |
+- } |
2730 |
+- pfn = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
2731 |
+- paddr = pfn << PAGE_SHIFT; |
2732 |
+- table = memremap(paddr, PAGE_SIZE, MEMREMAP_WB); |
2733 |
+- if (!table) { |
2734 |
+- mmap_read_unlock(current->mm); |
2735 |
+- return -EFAULT; |
2736 |
+- } |
2737 |
+- ret = CMPXCHG(&table[index], orig_pte, new_pte); |
2738 |
+- memunmap(table); |
2739 |
+- mmap_read_unlock(current->mm); |
2740 |
+- } |
2741 |
++ int r = -EFAULT; |
2742 |
++ |
2743 |
++ if (!user_access_begin(ptep_user, sizeof(pt_element_t))) |
2744 |
++ return -EFAULT; |
2745 |
++ |
2746 |
++#ifdef CMPXCHG |
2747 |
++ asm volatile("1:" LOCK_PREFIX CMPXCHG " %[new], %[ptr]\n" |
2748 |
++ "mov $0, %[r]\n" |
2749 |
++ "setnz %b[r]\n" |
2750 |
++ "2:" |
2751 |
++ _ASM_EXTABLE_UA(1b, 2b) |
2752 |
++ : [ptr] "+m" (*ptep_user), |
2753 |
++ [old] "+a" (orig_pte), |
2754 |
++ [r] "+q" (r) |
2755 |
++ : [new] "r" (new_pte) |
2756 |
++ : "memory"); |
2757 |
++#else |
2758 |
++ asm volatile("1:" LOCK_PREFIX "cmpxchg8b %[ptr]\n" |
2759 |
++ "movl $0, %[r]\n" |
2760 |
++ "jz 2f\n" |
2761 |
++ "incl %[r]\n" |
2762 |
++ "2:" |
2763 |
++ _ASM_EXTABLE_UA(1b, 2b) |
2764 |
++ : [ptr] "+m" (*ptep_user), |
2765 |
++ [old] "+A" (orig_pte), |
2766 |
++ [r] "+rm" (r) |
2767 |
++ : [new_lo] "b" ((u32)new_pte), |
2768 |
++ [new_hi] "c" ((u32)(new_pte >> 32)) |
2769 |
++ : "memory"); |
2770 |
++#endif |
2771 |
+ |
2772 |
+- return (ret != orig_pte); |
2773 |
++ user_access_end(); |
2774 |
++ return r; |
2775 |
+ } |
2776 |
+ |
2777 |
+ static bool FNAME(prefetch_invalid_gpte)(struct kvm_vcpu *vcpu, |
2778 |
+diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c |
2779 |
+index 7e08efb068393..073514bbb5f71 100644 |
2780 |
+--- a/arch/x86/kvm/mmu/tdp_mmu.c |
2781 |
++++ b/arch/x86/kvm/mmu/tdp_mmu.c |
2782 |
+@@ -902,6 +902,9 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, |
2783 |
+ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) |
2784 |
+ continue; |
2785 |
+ |
2786 |
++ if (!is_shadow_present_pte(iter.old_spte)) |
2787 |
++ continue; |
2788 |
++ |
2789 |
+ if (spte_ad_need_write_protect(iter.old_spte)) { |
2790 |
+ if (is_writable_pte(iter.old_spte)) |
2791 |
+ new_spte = iter.old_spte & ~PT_WRITABLE_MASK; |
2792 |
+diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c |
2793 |
+index a8b5533cf601d..3e5cb74c0b538 100644 |
2794 |
+--- a/arch/x86/kvm/svm/avic.c |
2795 |
++++ b/arch/x86/kvm/svm/avic.c |
2796 |
+@@ -806,7 +806,7 @@ int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq, |
2797 |
+ { |
2798 |
+ struct kvm_kernel_irq_routing_entry *e; |
2799 |
+ struct kvm_irq_routing_table *irq_rt; |
2800 |
+- int idx, ret = -EINVAL; |
2801 |
++ int idx, ret = 0; |
2802 |
+ |
2803 |
+ if (!kvm_arch_has_assigned_device(kvm) || |
2804 |
+ !irq_remapping_cap(IRQ_POSTING_CAP)) |
2805 |
+@@ -817,7 +817,13 @@ int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq, |
2806 |
+ |
2807 |
+ idx = srcu_read_lock(&kvm->irq_srcu); |
2808 |
+ irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu); |
2809 |
+- WARN_ON(guest_irq >= irq_rt->nr_rt_entries); |
2810 |
++ |
2811 |
++ if (guest_irq >= irq_rt->nr_rt_entries || |
2812 |
++ hlist_empty(&irq_rt->map[guest_irq])) { |
2813 |
++ pr_warn_once("no route for guest_irq %u/%u (broken user space?)\n", |
2814 |
++ guest_irq, irq_rt->nr_rt_entries); |
2815 |
++ goto out; |
2816 |
++ } |
2817 |
+ |
2818 |
+ hlist_for_each_entry(e, &irq_rt->map[guest_irq], link) { |
2819 |
+ struct vcpu_data vcpu_info; |
2820 |
+diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c |
2821 |
+index e13b0b49fcdfc..d7249f4c90f1b 100644 |
2822 |
+--- a/arch/x86/xen/pmu.c |
2823 |
++++ b/arch/x86/xen/pmu.c |
2824 |
+@@ -512,10 +512,7 @@ irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id) |
2825 |
+ return ret; |
2826 |
+ } |
2827 |
+ |
2828 |
+-bool is_xen_pmu(int cpu) |
2829 |
+-{ |
2830 |
+- return (get_xenpmu_data() != NULL); |
2831 |
+-} |
2832 |
++bool is_xen_pmu; |
2833 |
+ |
2834 |
+ void xen_pmu_init(int cpu) |
2835 |
+ { |
2836 |
+@@ -526,7 +523,7 @@ void xen_pmu_init(int cpu) |
2837 |
+ |
2838 |
+ BUILD_BUG_ON(sizeof(struct xen_pmu_data) > PAGE_SIZE); |
2839 |
+ |
2840 |
+- if (xen_hvm_domain()) |
2841 |
++ if (xen_hvm_domain() || (cpu != 0 && !is_xen_pmu)) |
2842 |
+ return; |
2843 |
+ |
2844 |
+ xenpmu_data = (struct xen_pmu_data *)get_zeroed_page(GFP_KERNEL); |
2845 |
+@@ -547,7 +544,8 @@ void xen_pmu_init(int cpu) |
2846 |
+ per_cpu(xenpmu_shared, cpu).xenpmu_data = xenpmu_data; |
2847 |
+ per_cpu(xenpmu_shared, cpu).flags = 0; |
2848 |
+ |
2849 |
+- if (cpu == 0) { |
2850 |
++ if (!is_xen_pmu) { |
2851 |
++ is_xen_pmu = true; |
2852 |
+ perf_register_guest_info_callbacks(&xen_guest_cbs); |
2853 |
+ xen_pmu_arch_init(); |
2854 |
+ } |
2855 |
+diff --git a/arch/x86/xen/pmu.h b/arch/x86/xen/pmu.h |
2856 |
+index 0e83a160589bc..65c58894fc79f 100644 |
2857 |
+--- a/arch/x86/xen/pmu.h |
2858 |
++++ b/arch/x86/xen/pmu.h |
2859 |
+@@ -4,6 +4,8 @@ |
2860 |
+ |
2861 |
+ #include <xen/interface/xenpmu.h> |
2862 |
+ |
2863 |
++extern bool is_xen_pmu; |
2864 |
++ |
2865 |
+ irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id); |
2866 |
+ #ifdef CONFIG_XEN_HAVE_VPMU |
2867 |
+ void xen_pmu_init(int cpu); |
2868 |
+@@ -12,7 +14,6 @@ void xen_pmu_finish(int cpu); |
2869 |
+ static inline void xen_pmu_init(int cpu) {} |
2870 |
+ static inline void xen_pmu_finish(int cpu) {} |
2871 |
+ #endif |
2872 |
+-bool is_xen_pmu(int cpu); |
2873 |
+ bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err); |
2874 |
+ bool pmu_msr_write(unsigned int msr, uint32_t low, uint32_t high, int *err); |
2875 |
+ int pmu_apic_update(uint32_t reg); |
2876 |
+diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c |
2877 |
+index 8f9e7e2407c87..35b6d15d874d0 100644 |
2878 |
+--- a/arch/x86/xen/smp_pv.c |
2879 |
++++ b/arch/x86/xen/smp_pv.c |
2880 |
+@@ -130,7 +130,7 @@ int xen_smp_intr_init_pv(unsigned int cpu) |
2881 |
+ per_cpu(xen_irq_work, cpu).irq = rc; |
2882 |
+ per_cpu(xen_irq_work, cpu).name = callfunc_name; |
2883 |
+ |
2884 |
+- if (is_xen_pmu(cpu)) { |
2885 |
++ if (is_xen_pmu) { |
2886 |
+ pmu_name = kasprintf(GFP_KERNEL, "pmu%d", cpu); |
2887 |
+ rc = bind_virq_to_irqhandler(VIRQ_XENPMU, cpu, |
2888 |
+ xen_pmu_irq_handler, |
2889 |
+diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h |
2890 |
+index 7f63aca6a0d34..9dd4efe1bf0bd 100644 |
2891 |
+--- a/arch/xtensa/include/asm/processor.h |
2892 |
++++ b/arch/xtensa/include/asm/processor.h |
2893 |
+@@ -226,8 +226,8 @@ extern unsigned long get_wchan(struct task_struct *p); |
2894 |
+ |
2895 |
+ #define xtensa_set_sr(x, sr) \ |
2896 |
+ ({ \ |
2897 |
+- unsigned int v = (unsigned int)(x); \ |
2898 |
+- __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \ |
2899 |
++ __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: \ |
2900 |
++ "a"((unsigned int)(x))); \ |
2901 |
+ }) |
2902 |
+ |
2903 |
+ #define xtensa_get_sr(sr) \ |
2904 |
+diff --git a/arch/xtensa/kernel/jump_label.c b/arch/xtensa/kernel/jump_label.c |
2905 |
+index 61cf6497a646b..0dde21e0d3de4 100644 |
2906 |
+--- a/arch/xtensa/kernel/jump_label.c |
2907 |
++++ b/arch/xtensa/kernel/jump_label.c |
2908 |
+@@ -61,7 +61,7 @@ static void patch_text(unsigned long addr, const void *data, size_t sz) |
2909 |
+ .data = data, |
2910 |
+ }; |
2911 |
+ stop_machine_cpuslocked(patch_text_stop_machine, |
2912 |
+- &patch, NULL); |
2913 |
++ &patch, cpu_online_mask); |
2914 |
+ } else { |
2915 |
+ unsigned long flags; |
2916 |
+ |
2917 |
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c |
2918 |
+index b791e2041e49b..c2fdd6fcdaee6 100644 |
2919 |
+--- a/block/bfq-cgroup.c |
2920 |
++++ b/block/bfq-cgroup.c |
2921 |
+@@ -642,6 +642,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
2922 |
+ { |
2923 |
+ struct bfq_entity *entity = &bfqq->entity; |
2924 |
+ |
2925 |
++ /* |
2926 |
++ * oom_bfqq is not allowed to move, oom_bfqq will hold ref to root_group |
2927 |
++ * until elevator exit. |
2928 |
++ */ |
2929 |
++ if (bfqq == &bfqd->oom_bfqq) |
2930 |
++ return; |
2931 |
+ /* |
2932 |
+ * Get extra reference to prevent bfqq from being freed in |
2933 |
+ * next possible expire or deactivate. |
2934 |
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
2935 |
+index 8d95bf7765b19..de2cd4bd602fd 100644 |
2936 |
+--- a/block/bfq-iosched.c |
2937 |
++++ b/block/bfq-iosched.c |
2938 |
+@@ -2526,6 +2526,15 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) |
2939 |
+ * are likely to increase the throughput. |
2940 |
+ */ |
2941 |
+ bfqq->new_bfqq = new_bfqq; |
2942 |
++ /* |
2943 |
++ * The above assignment schedules the following redirections: |
2944 |
++ * each time some I/O for bfqq arrives, the process that |
2945 |
++ * generated that I/O is disassociated from bfqq and |
2946 |
++ * associated with new_bfqq. Here we increases new_bfqq->ref |
2947 |
++ * in advance, adding the number of processes that are |
2948 |
++ * expected to be associated with new_bfqq as they happen to |
2949 |
++ * issue I/O. |
2950 |
++ */ |
2951 |
+ new_bfqq->ref += process_refs; |
2952 |
+ return new_bfqq; |
2953 |
+ } |
2954 |
+@@ -2585,6 +2594,10 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
2955 |
+ { |
2956 |
+ struct bfq_queue *in_service_bfqq, *new_bfqq; |
2957 |
+ |
2958 |
++ /* if a merge has already been setup, then proceed with that first */ |
2959 |
++ if (bfqq->new_bfqq) |
2960 |
++ return bfqq->new_bfqq; |
2961 |
++ |
2962 |
+ /* |
2963 |
+ * Do not perform queue merging if the device is non |
2964 |
+ * rotational and performs internal queueing. In fact, such a |
2965 |
+@@ -2639,9 +2652,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
2966 |
+ if (bfq_too_late_for_merging(bfqq)) |
2967 |
+ return NULL; |
2968 |
+ |
2969 |
+- if (bfqq->new_bfqq) |
2970 |
+- return bfqq->new_bfqq; |
2971 |
+- |
2972 |
+ if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) |
2973 |
+ return NULL; |
2974 |
+ |
2975 |
+@@ -4799,7 +4809,7 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) |
2976 |
+ struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; |
2977 |
+ struct request *rq; |
2978 |
+ struct bfq_queue *in_serv_queue; |
2979 |
+- bool waiting_rq, idle_timer_disabled; |
2980 |
++ bool waiting_rq, idle_timer_disabled = false; |
2981 |
+ |
2982 |
+ spin_lock_irq(&bfqd->lock); |
2983 |
+ |
2984 |
+@@ -4807,14 +4817,15 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) |
2985 |
+ waiting_rq = in_serv_queue && bfq_bfqq_wait_request(in_serv_queue); |
2986 |
+ |
2987 |
+ rq = __bfq_dispatch_request(hctx); |
2988 |
+- |
2989 |
+- idle_timer_disabled = |
2990 |
+- waiting_rq && !bfq_bfqq_wait_request(in_serv_queue); |
2991 |
++ if (in_serv_queue == bfqd->in_service_queue) { |
2992 |
++ idle_timer_disabled = |
2993 |
++ waiting_rq && !bfq_bfqq_wait_request(in_serv_queue); |
2994 |
++ } |
2995 |
+ |
2996 |
+ spin_unlock_irq(&bfqd->lock); |
2997 |
+- |
2998 |
+- bfq_update_dispatch_stats(hctx->queue, rq, in_serv_queue, |
2999 |
+- idle_timer_disabled); |
3000 |
++ bfq_update_dispatch_stats(hctx->queue, rq, |
3001 |
++ idle_timer_disabled ? in_serv_queue : NULL, |
3002 |
++ idle_timer_disabled); |
3003 |
+ |
3004 |
+ return rq; |
3005 |
+ } |
3006 |
+diff --git a/block/blk-merge.c b/block/blk-merge.c |
3007 |
+index 26f4bcc10de9d..006b1f0a59bc5 100644 |
3008 |
+--- a/block/blk-merge.c |
3009 |
++++ b/block/blk-merge.c |
3010 |
+@@ -7,6 +7,7 @@ |
3011 |
+ #include <linux/bio.h> |
3012 |
+ #include <linux/blkdev.h> |
3013 |
+ #include <linux/scatterlist.h> |
3014 |
++#include <linux/blk-cgroup.h> |
3015 |
+ |
3016 |
+ #include <trace/events/block.h> |
3017 |
+ |
3018 |
+@@ -554,6 +555,9 @@ static inline unsigned int blk_rq_get_max_segments(struct request *rq) |
3019 |
+ static inline int ll_new_hw_segment(struct request *req, struct bio *bio, |
3020 |
+ unsigned int nr_phys_segs) |
3021 |
+ { |
3022 |
++ if (!blk_cgroup_mergeable(req, bio)) |
3023 |
++ goto no_merge; |
3024 |
++ |
3025 |
+ if (blk_integrity_merge_bio(req->q, req, bio) == false) |
3026 |
+ goto no_merge; |
3027 |
+ |
3028 |
+@@ -650,6 +654,9 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, |
3029 |
+ if (total_phys_segments > blk_rq_get_max_segments(req)) |
3030 |
+ return 0; |
3031 |
+ |
3032 |
++ if (!blk_cgroup_mergeable(req, next->bio)) |
3033 |
++ return 0; |
3034 |
++ |
3035 |
+ if (blk_integrity_merge_rq(q, req, next) == false) |
3036 |
+ return 0; |
3037 |
+ |
3038 |
+@@ -861,6 +868,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) |
3039 |
+ if (rq->rq_disk != bio->bi_disk) |
3040 |
+ return false; |
3041 |
+ |
3042 |
++ /* don't merge across cgroup boundaries */ |
3043 |
++ if (!blk_cgroup_mergeable(rq, bio)) |
3044 |
++ return false; |
3045 |
++ |
3046 |
+ /* only merge integrity protected bio into ditto rq */ |
3047 |
+ if (blk_integrity_merge_bio(rq->q, rq, bio) == false) |
3048 |
+ return false; |
3049 |
+diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c |
3050 |
+index 24c08963890e9..e0117f5f969de 100644 |
3051 |
+--- a/block/blk-mq-sched.c |
3052 |
++++ b/block/blk-mq-sched.c |
3053 |
+@@ -194,11 +194,18 @@ static int __blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx) |
3054 |
+ |
3055 |
+ static int blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx) |
3056 |
+ { |
3057 |
++ unsigned long end = jiffies + HZ; |
3058 |
+ int ret; |
3059 |
+ |
3060 |
+ do { |
3061 |
+ ret = __blk_mq_do_dispatch_sched(hctx); |
3062 |
+- } while (ret == 1); |
3063 |
++ if (ret != 1) |
3064 |
++ break; |
3065 |
++ if (need_resched() || time_is_before_jiffies(end)) { |
3066 |
++ blk_mq_delay_run_hw_queue(hctx, 0); |
3067 |
++ break; |
3068 |
++ } |
3069 |
++ } while (1); |
3070 |
+ |
3071 |
+ return ret; |
3072 |
+ } |
3073 |
+diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c |
3074 |
+index b513f1683af06..8c5816364dd17 100644 |
3075 |
+--- a/block/blk-sysfs.c |
3076 |
++++ b/block/blk-sysfs.c |
3077 |
+@@ -958,15 +958,17 @@ void blk_unregister_queue(struct gendisk *disk) |
3078 |
+ */ |
3079 |
+ if (queue_is_mq(q)) |
3080 |
+ blk_mq_unregister_dev(disk_to_dev(disk), q); |
3081 |
+- |
3082 |
+- kobject_uevent(&q->kobj, KOBJ_REMOVE); |
3083 |
+- kobject_del(&q->kobj); |
3084 |
+ blk_trace_remove_sysfs(disk_to_dev(disk)); |
3085 |
+ |
3086 |
+ mutex_lock(&q->sysfs_lock); |
3087 |
+ if (q->elevator) |
3088 |
+ elv_unregister_queue(q); |
3089 |
+ mutex_unlock(&q->sysfs_lock); |
3090 |
++ |
3091 |
++ /* Now that we've deleted all child objects, we can delete the queue. */ |
3092 |
++ kobject_uevent(&q->kobj, KOBJ_REMOVE); |
3093 |
++ kobject_del(&q->kobj); |
3094 |
++ |
3095 |
+ mutex_unlock(&q->sysfs_dir_lock); |
3096 |
+ |
3097 |
+ kobject_put(&disk_to_dev(disk)->kobj); |
3098 |
+diff --git a/crypto/authenc.c b/crypto/authenc.c |
3099 |
+index 670bf1a01d00e..17f674a7cdff5 100644 |
3100 |
+--- a/crypto/authenc.c |
3101 |
++++ b/crypto/authenc.c |
3102 |
+@@ -253,7 +253,7 @@ static int crypto_authenc_decrypt_tail(struct aead_request *req, |
3103 |
+ dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen); |
3104 |
+ |
3105 |
+ skcipher_request_set_tfm(skreq, ctx->enc); |
3106 |
+- skcipher_request_set_callback(skreq, aead_request_flags(req), |
3107 |
++ skcipher_request_set_callback(skreq, flags, |
3108 |
+ req->base.complete, req->base.data); |
3109 |
+ skcipher_request_set_crypt(skreq, src, dst, |
3110 |
+ req->cryptlen - authsize, req->iv); |
3111 |
+diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c |
3112 |
+index 8ac3e73e8ea65..9d804831c8b3f 100644 |
3113 |
+--- a/crypto/rsa-pkcs1pad.c |
3114 |
++++ b/crypto/rsa-pkcs1pad.c |
3115 |
+@@ -476,6 +476,8 @@ static int pkcs1pad_verify_complete(struct akcipher_request *req, int err) |
3116 |
+ pos++; |
3117 |
+ |
3118 |
+ if (digest_info) { |
3119 |
++ if (digest_info->size > dst_len - pos) |
3120 |
++ goto done; |
3121 |
+ if (crypto_memneq(out_buf + pos, digest_info->data, |
3122 |
+ digest_info->size)) |
3123 |
+ goto done; |
3124 |
+@@ -495,7 +497,7 @@ static int pkcs1pad_verify_complete(struct akcipher_request *req, int err) |
3125 |
+ sg_nents_for_len(req->src, |
3126 |
+ req->src_len + req->dst_len), |
3127 |
+ req_ctx->out_buf + ctx->key_size, |
3128 |
+- req->dst_len, ctx->key_size); |
3129 |
++ req->dst_len, req->src_len); |
3130 |
+ /* Do the actual verification step. */ |
3131 |
+ if (memcmp(req_ctx->out_buf + ctx->key_size, out_buf + pos, |
3132 |
+ req->dst_len) != 0) |
3133 |
+@@ -538,7 +540,7 @@ static int pkcs1pad_verify(struct akcipher_request *req) |
3134 |
+ |
3135 |
+ if (WARN_ON(req->dst) || |
3136 |
+ WARN_ON(!req->dst_len) || |
3137 |
+- !ctx->key_size || req->src_len < ctx->key_size) |
3138 |
++ !ctx->key_size || req->src_len != ctx->key_size) |
3139 |
+ return -EINVAL; |
3140 |
+ |
3141 |
+ req_ctx->out_buf = kmalloc(ctx->key_size + req->dst_len, GFP_KERNEL); |
3142 |
+@@ -621,6 +623,11 @@ static int pkcs1pad_create(struct crypto_template *tmpl, struct rtattr **tb) |
3143 |
+ |
3144 |
+ rsa_alg = crypto_spawn_akcipher_alg(&ctx->spawn); |
3145 |
+ |
3146 |
++ if (strcmp(rsa_alg->base.cra_name, "rsa") != 0) { |
3147 |
++ err = -EINVAL; |
3148 |
++ goto err_free_inst; |
3149 |
++ } |
3150 |
++ |
3151 |
+ err = -ENAMETOOLONG; |
3152 |
+ hash_name = crypto_attr_alg_name(tb[2]); |
3153 |
+ if (IS_ERR(hash_name)) { |
3154 |
+diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c |
3155 |
+index b7f3e8603ad84..901fa5ca284d2 100644 |
3156 |
+--- a/drivers/acpi/acpica/nswalk.c |
3157 |
++++ b/drivers/acpi/acpica/nswalk.c |
3158 |
+@@ -169,6 +169,9 @@ acpi_ns_walk_namespace(acpi_object_type type, |
3159 |
+ |
3160 |
+ if (start_node == ACPI_ROOT_OBJECT) { |
3161 |
+ start_node = acpi_gbl_root_node; |
3162 |
++ if (!start_node) { |
3163 |
++ return_ACPI_STATUS(AE_NO_NAMESPACE); |
3164 |
++ } |
3165 |
+ } |
3166 |
+ |
3167 |
+ /* Null child means "get first node" */ |
3168 |
+diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c |
3169 |
+index 19e50fcbf4d6f..598fd19b65fa4 100644 |
3170 |
+--- a/drivers/acpi/apei/bert.c |
3171 |
++++ b/drivers/acpi/apei/bert.c |
3172 |
+@@ -29,6 +29,7 @@ |
3173 |
+ |
3174 |
+ #undef pr_fmt |
3175 |
+ #define pr_fmt(fmt) "BERT: " fmt |
3176 |
++#define ACPI_BERT_PRINT_MAX_LEN 1024 |
3177 |
+ |
3178 |
+ static int bert_disable; |
3179 |
+ |
3180 |
+@@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region, |
3181 |
+ } |
3182 |
+ |
3183 |
+ pr_info_once("Error records from previous boot:\n"); |
3184 |
+- |
3185 |
+- cper_estatus_print(KERN_INFO HW_ERR, estatus); |
3186 |
++ if (region_len < ACPI_BERT_PRINT_MAX_LEN) |
3187 |
++ cper_estatus_print(KERN_INFO HW_ERR, estatus); |
3188 |
++ else |
3189 |
++ pr_info_once("Max print length exceeded, table data is available at:\n" |
3190 |
++ "/sys/firmware/acpi/tables/data/BERT"); |
3191 |
+ |
3192 |
+ /* |
3193 |
+ * Because the boot error source is "one-time polled" type, |
3194 |
+@@ -77,7 +81,7 @@ static int __init setup_bert_disable(char *str) |
3195 |
+ { |
3196 |
+ bert_disable = 1; |
3197 |
+ |
3198 |
+- return 0; |
3199 |
++ return 1; |
3200 |
+ } |
3201 |
+ __setup("bert_disable", setup_bert_disable); |
3202 |
+ |
3203 |
+diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c |
3204 |
+index 2e0b0fcad9607..83efb52a3f31d 100644 |
3205 |
+--- a/drivers/acpi/apei/erst.c |
3206 |
++++ b/drivers/acpi/apei/erst.c |
3207 |
+@@ -891,7 +891,7 @@ EXPORT_SYMBOL_GPL(erst_clear); |
3208 |
+ static int __init setup_erst_disable(char *str) |
3209 |
+ { |
3210 |
+ erst_disable = 1; |
3211 |
+- return 0; |
3212 |
++ return 1; |
3213 |
+ } |
3214 |
+ |
3215 |
+ __setup("erst_disable", setup_erst_disable); |
3216 |
+diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c |
3217 |
+index 6e980fe16772c..7bf48c2776fbf 100644 |
3218 |
+--- a/drivers/acpi/apei/hest.c |
3219 |
++++ b/drivers/acpi/apei/hest.c |
3220 |
+@@ -219,7 +219,7 @@ err: |
3221 |
+ static int __init setup_hest_disable(char *str) |
3222 |
+ { |
3223 |
+ hest_disable = HEST_DISABLED; |
3224 |
+- return 0; |
3225 |
++ return 1; |
3226 |
+ } |
3227 |
+ |
3228 |
+ __setup("hest_disable", setup_hest_disable); |
3229 |
+diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c |
3230 |
+index 0a2da06e9d8bf..2ac0773326e9a 100644 |
3231 |
+--- a/drivers/acpi/cppc_acpi.c |
3232 |
++++ b/drivers/acpi/cppc_acpi.c |
3233 |
+@@ -719,6 +719,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) |
3234 |
+ cpc_obj = &out_obj->package.elements[0]; |
3235 |
+ if (cpc_obj->type == ACPI_TYPE_INTEGER) { |
3236 |
+ num_ent = cpc_obj->integer.value; |
3237 |
++ if (num_ent <= 1) { |
3238 |
++ pr_debug("Unexpected _CPC NumEntries value (%d) for CPU:%d\n", |
3239 |
++ num_ent, pr->id); |
3240 |
++ goto out_free; |
3241 |
++ } |
3242 |
+ } else { |
3243 |
+ pr_debug("Unexpected entry type(%d) for NumEntries\n", |
3244 |
+ cpc_obj->type); |
3245 |
+diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c |
3246 |
+index 18bd428f11ac0..bd16340088389 100644 |
3247 |
+--- a/drivers/acpi/property.c |
3248 |
++++ b/drivers/acpi/property.c |
3249 |
+@@ -685,7 +685,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
3250 |
+ */ |
3251 |
+ if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { |
3252 |
+ if (index) |
3253 |
+- return -EINVAL; |
3254 |
++ return -ENOENT; |
3255 |
+ |
3256 |
+ ret = acpi_bus_get_device(obj->reference.handle, &device); |
3257 |
+ if (ret) |
3258 |
+diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c |
3259 |
+index 8f4ae6e967e39..47c72447ccd59 100644 |
3260 |
+--- a/drivers/amba/bus.c |
3261 |
++++ b/drivers/amba/bus.c |
3262 |
+@@ -299,11 +299,10 @@ static int amba_remove(struct device *dev) |
3263 |
+ { |
3264 |
+ struct amba_device *pcdev = to_amba_device(dev); |
3265 |
+ struct amba_driver *drv = to_amba_driver(dev->driver); |
3266 |
+- int ret = 0; |
3267 |
+ |
3268 |
+ pm_runtime_get_sync(dev); |
3269 |
+ if (drv->remove) |
3270 |
+- ret = drv->remove(pcdev); |
3271 |
++ drv->remove(pcdev); |
3272 |
+ pm_runtime_put_noidle(dev); |
3273 |
+ |
3274 |
+ /* Undo the runtime PM settings in amba_probe() */ |
3275 |
+@@ -314,7 +313,7 @@ static int amba_remove(struct device *dev) |
3276 |
+ amba_put_disable_pclk(pcdev); |
3277 |
+ dev_pm_domain_detach(dev, true); |
3278 |
+ |
3279 |
+- return ret; |
3280 |
++ return 0; |
3281 |
+ } |
3282 |
+ |
3283 |
+ static void amba_shutdown(struct device *dev) |
3284 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
3285 |
+index 64ff137408b8c..2728223c1fbc8 100644 |
3286 |
+--- a/drivers/base/dd.c |
3287 |
++++ b/drivers/base/dd.c |
3288 |
+@@ -771,7 +771,7 @@ static int __init save_async_options(char *buf) |
3289 |
+ pr_warn("Too long list of driver names for 'driver_async_probe'!\n"); |
3290 |
+ |
3291 |
+ strlcpy(async_probe_drv_names, buf, ASYNC_DRV_NAMES_MAX_LEN); |
3292 |
+- return 0; |
3293 |
++ return 1; |
3294 |
+ } |
3295 |
+ __setup("driver_async_probe=", save_async_options); |
3296 |
+ |
3297 |
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
3298 |
+index 4167e2aef3975..1dbaaddf540e1 100644 |
3299 |
+--- a/drivers/base/power/main.c |
3300 |
++++ b/drivers/base/power/main.c |
3301 |
+@@ -1994,7 +1994,9 @@ static bool pm_ops_is_empty(const struct dev_pm_ops *ops) |
3302 |
+ |
3303 |
+ void device_pm_check_callbacks(struct device *dev) |
3304 |
+ { |
3305 |
+- spin_lock_irq(&dev->power.lock); |
3306 |
++ unsigned long flags; |
3307 |
++ |
3308 |
++ spin_lock_irqsave(&dev->power.lock, flags); |
3309 |
+ dev->power.no_pm_callbacks = |
3310 |
+ (!dev->bus || (pm_ops_is_empty(dev->bus->pm) && |
3311 |
+ !dev->bus->suspend && !dev->bus->resume)) && |
3312 |
+@@ -2003,7 +2005,7 @@ void device_pm_check_callbacks(struct device *dev) |
3313 |
+ (!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) && |
3314 |
+ (!dev->driver || (pm_ops_is_empty(dev->driver->pm) && |
3315 |
+ !dev->driver->suspend && !dev->driver->resume)); |
3316 |
+- spin_unlock_irq(&dev->power.lock); |
3317 |
++ spin_unlock_irqrestore(&dev->power.lock, flags); |
3318 |
+ } |
3319 |
+ |
3320 |
+ bool dev_pm_skip_suspend(struct device *dev) |
3321 |
+diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c |
3322 |
+index 330f851cb8f0b..69638146f949c 100644 |
3323 |
+--- a/drivers/block/drbd/drbd_req.c |
3324 |
++++ b/drivers/block/drbd/drbd_req.c |
3325 |
+@@ -177,7 +177,8 @@ void start_new_tl_epoch(struct drbd_connection *connection) |
3326 |
+ void complete_master_bio(struct drbd_device *device, |
3327 |
+ struct bio_and_error *m) |
3328 |
+ { |
3329 |
+- m->bio->bi_status = errno_to_blk_status(m->error); |
3330 |
++ if (unlikely(m->error)) |
3331 |
++ m->bio->bi_status = errno_to_blk_status(m->error); |
3332 |
+ bio_endio(m->bio); |
3333 |
+ dec_ap_bio(device); |
3334 |
+ } |
3335 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
3336 |
+index ee537a9f1d1a4..e4517d483bdc3 100644 |
3337 |
+--- a/drivers/block/loop.c |
3338 |
++++ b/drivers/block/loop.c |
3339 |
+@@ -797,33 +797,33 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) |
3340 |
+ |
3341 |
+ static ssize_t loop_attr_offset_show(struct loop_device *lo, char *buf) |
3342 |
+ { |
3343 |
+- return sprintf(buf, "%llu\n", (unsigned long long)lo->lo_offset); |
3344 |
++ return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_offset); |
3345 |
+ } |
3346 |
+ |
3347 |
+ static ssize_t loop_attr_sizelimit_show(struct loop_device *lo, char *buf) |
3348 |
+ { |
3349 |
+- return sprintf(buf, "%llu\n", (unsigned long long)lo->lo_sizelimit); |
3350 |
++ return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_sizelimit); |
3351 |
+ } |
3352 |
+ |
3353 |
+ static ssize_t loop_attr_autoclear_show(struct loop_device *lo, char *buf) |
3354 |
+ { |
3355 |
+ int autoclear = (lo->lo_flags & LO_FLAGS_AUTOCLEAR); |
3356 |
+ |
3357 |
+- return sprintf(buf, "%s\n", autoclear ? "1" : "0"); |
3358 |
++ return sysfs_emit(buf, "%s\n", autoclear ? "1" : "0"); |
3359 |
+ } |
3360 |
+ |
3361 |
+ static ssize_t loop_attr_partscan_show(struct loop_device *lo, char *buf) |
3362 |
+ { |
3363 |
+ int partscan = (lo->lo_flags & LO_FLAGS_PARTSCAN); |
3364 |
+ |
3365 |
+- return sprintf(buf, "%s\n", partscan ? "1" : "0"); |
3366 |
++ return sysfs_emit(buf, "%s\n", partscan ? "1" : "0"); |
3367 |
+ } |
3368 |
+ |
3369 |
+ static ssize_t loop_attr_dio_show(struct loop_device *lo, char *buf) |
3370 |
+ { |
3371 |
+ int dio = (lo->lo_flags & LO_FLAGS_DIRECT_IO); |
3372 |
+ |
3373 |
+- return sprintf(buf, "%s\n", dio ? "1" : "0"); |
3374 |
++ return sysfs_emit(buf, "%s\n", dio ? "1" : "0"); |
3375 |
+ } |
3376 |
+ |
3377 |
+ LOOP_ATTR_RO(backing_file); |
3378 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
3379 |
+index a03390127741f..02e2056780ad2 100644 |
3380 |
+--- a/drivers/block/virtio_blk.c |
3381 |
++++ b/drivers/block/virtio_blk.c |
3382 |
+@@ -825,9 +825,17 @@ static int virtblk_probe(struct virtio_device *vdev) |
3383 |
+ err = virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE, |
3384 |
+ struct virtio_blk_config, blk_size, |
3385 |
+ &blk_size); |
3386 |
+- if (!err) |
3387 |
++ if (!err) { |
3388 |
++ err = blk_validate_block_size(blk_size); |
3389 |
++ if (err) { |
3390 |
++ dev_err(&vdev->dev, |
3391 |
++ "virtio_blk: invalid block size: 0x%x\n", |
3392 |
++ blk_size); |
3393 |
++ goto out_free_tags; |
3394 |
++ } |
3395 |
++ |
3396 |
+ blk_queue_logical_block_size(q, blk_size); |
3397 |
+- else |
3398 |
++ } else |
3399 |
+ blk_size = queue_logical_block_size(q); |
3400 |
+ |
3401 |
+ /* Use topology information if available */ |
3402 |
+diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
3403 |
+index 74856a5862162..c41560be39fb6 100644 |
3404 |
+--- a/drivers/bluetooth/btmtksdio.c |
3405 |
++++ b/drivers/bluetooth/btmtksdio.c |
3406 |
+@@ -981,6 +981,8 @@ static int btmtksdio_probe(struct sdio_func *func, |
3407 |
+ hdev->manufacturer = 70; |
3408 |
+ set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks); |
3409 |
+ |
3410 |
++ sdio_set_drvdata(func, bdev); |
3411 |
++ |
3412 |
+ err = hci_register_dev(hdev); |
3413 |
+ if (err < 0) { |
3414 |
+ dev_err(&func->dev, "Can't register HCI device\n"); |
3415 |
+@@ -988,8 +990,6 @@ static int btmtksdio_probe(struct sdio_func *func, |
3416 |
+ return err; |
3417 |
+ } |
3418 |
+ |
3419 |
+- sdio_set_drvdata(func, bdev); |
3420 |
+- |
3421 |
+ /* pm_runtime_enable would be done after the firmware is being |
3422 |
+ * downloaded because the core layer probably already enables |
3423 |
+ * runtime PM for this func such as the case host->caps & |
3424 |
+diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c |
3425 |
+index 9e03402ef1b37..e9a44ab3812df 100644 |
3426 |
+--- a/drivers/bluetooth/hci_serdev.c |
3427 |
++++ b/drivers/bluetooth/hci_serdev.c |
3428 |
+@@ -305,6 +305,8 @@ int hci_uart_register_device(struct hci_uart *hu, |
3429 |
+ if (err) |
3430 |
+ return err; |
3431 |
+ |
3432 |
++ percpu_init_rwsem(&hu->proto_lock); |
3433 |
++ |
3434 |
+ err = p->open(hu); |
3435 |
+ if (err) |
3436 |
+ goto err_open; |
3437 |
+@@ -327,7 +329,6 @@ int hci_uart_register_device(struct hci_uart *hu, |
3438 |
+ |
3439 |
+ INIT_WORK(&hu->init_ready, hci_uart_init_work); |
3440 |
+ INIT_WORK(&hu->write_work, hci_uart_write_work); |
3441 |
+- percpu_init_rwsem(&hu->proto_lock); |
3442 |
+ |
3443 |
+ /* Only when vendor specific setup callback is provided, consider |
3444 |
+ * the manufacturer information valid. This avoids filling in the |
3445 |
+diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c |
3446 |
+index 626dedd110cbc..fca0d0669aa97 100644 |
3447 |
+--- a/drivers/bus/mips_cdmm.c |
3448 |
++++ b/drivers/bus/mips_cdmm.c |
3449 |
+@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void) |
3450 |
+ np = of_find_compatible_node(NULL, NULL, "mti,mips-cdmm"); |
3451 |
+ if (np) { |
3452 |
+ err = of_address_to_resource(np, 0, &res); |
3453 |
++ of_node_put(np); |
3454 |
+ if (!err) |
3455 |
+ return res.start; |
3456 |
+ } |
3457 |
+diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig |
3458 |
+index 5952210526aaa..a7d9e4600d40e 100644 |
3459 |
+--- a/drivers/char/hw_random/Kconfig |
3460 |
++++ b/drivers/char/hw_random/Kconfig |
3461 |
+@@ -427,7 +427,7 @@ config HW_RANDOM_MESON |
3462 |
+ |
3463 |
+ config HW_RANDOM_CAVIUM |
3464 |
+ tristate "Cavium ThunderX Random Number Generator support" |
3465 |
+- depends on HW_RANDOM && PCI && (ARM64 || (COMPILE_TEST && 64BIT)) |
3466 |
++ depends on HW_RANDOM && PCI && ARCH_THUNDER |
3467 |
+ default HW_RANDOM |
3468 |
+ help |
3469 |
+ This driver provides kernel-side support for the Random Number |
3470 |
+diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c |
3471 |
+index ecb71c4317a50..8cf0ef501341e 100644 |
3472 |
+--- a/drivers/char/hw_random/atmel-rng.c |
3473 |
++++ b/drivers/char/hw_random/atmel-rng.c |
3474 |
+@@ -114,6 +114,7 @@ static int atmel_trng_probe(struct platform_device *pdev) |
3475 |
+ |
3476 |
+ err_register: |
3477 |
+ clk_disable_unprepare(trng->clk); |
3478 |
++ atmel_trng_disable(trng); |
3479 |
+ return ret; |
3480 |
+ } |
3481 |
+ |
3482 |
+diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c |
3483 |
+index 3de4a6a443ef9..6f66919652bf5 100644 |
3484 |
+--- a/drivers/char/hw_random/cavium-rng-vf.c |
3485 |
++++ b/drivers/char/hw_random/cavium-rng-vf.c |
3486 |
+@@ -1,10 +1,7 @@ |
3487 |
++// SPDX-License-Identifier: GPL-2.0 |
3488 |
+ /* |
3489 |
+- * Hardware Random Number Generator support for Cavium, Inc. |
3490 |
+- * Thunder processor family. |
3491 |
+- * |
3492 |
+- * This file is subject to the terms and conditions of the GNU General Public |
3493 |
+- * License. See the file "COPYING" in the main directory of this archive |
3494 |
+- * for more details. |
3495 |
++ * Hardware Random Number Generator support. |
3496 |
++ * Cavium Thunder, Marvell OcteonTx/Tx2 processor families. |
3497 |
+ * |
3498 |
+ * Copyright (C) 2016 Cavium, Inc. |
3499 |
+ */ |
3500 |
+@@ -15,16 +12,146 @@ |
3501 |
+ #include <linux/pci.h> |
3502 |
+ #include <linux/pci_ids.h> |
3503 |
+ |
3504 |
++#include <asm/arch_timer.h> |
3505 |
++ |
3506 |
++/* PCI device IDs */ |
3507 |
++#define PCI_DEVID_CAVIUM_RNG_PF 0xA018 |
3508 |
++#define PCI_DEVID_CAVIUM_RNG_VF 0xA033 |
3509 |
++ |
3510 |
++#define HEALTH_STATUS_REG 0x38 |
3511 |
++ |
3512 |
++/* RST device info */ |
3513 |
++#define PCI_DEVICE_ID_RST_OTX2 0xA085 |
3514 |
++#define RST_BOOT_REG 0x1600ULL |
3515 |
++#define CLOCK_BASE_RATE 50000000ULL |
3516 |
++#define MSEC_TO_NSEC(x) (x * 1000000) |
3517 |
++ |
3518 |
+ struct cavium_rng { |
3519 |
+ struct hwrng ops; |
3520 |
+ void __iomem *result; |
3521 |
++ void __iomem *pf_regbase; |
3522 |
++ struct pci_dev *pdev; |
3523 |
++ u64 clock_rate; |
3524 |
++ u64 prev_error; |
3525 |
++ u64 prev_time; |
3526 |
+ }; |
3527 |
+ |
3528 |
++static inline bool is_octeontx(struct pci_dev *pdev) |
3529 |
++{ |
3530 |
++ if (midr_is_cpu_model_range(read_cpuid_id(), MIDR_THUNDERX_83XX, |
3531 |
++ MIDR_CPU_VAR_REV(0, 0), |
3532 |
++ MIDR_CPU_VAR_REV(3, 0)) || |
3533 |
++ midr_is_cpu_model_range(read_cpuid_id(), MIDR_THUNDERX_81XX, |
3534 |
++ MIDR_CPU_VAR_REV(0, 0), |
3535 |
++ MIDR_CPU_VAR_REV(3, 0)) || |
3536 |
++ midr_is_cpu_model_range(read_cpuid_id(), MIDR_THUNDERX, |
3537 |
++ MIDR_CPU_VAR_REV(0, 0), |
3538 |
++ MIDR_CPU_VAR_REV(3, 0))) |
3539 |
++ return true; |
3540 |
++ |
3541 |
++ return false; |
3542 |
++} |
3543 |
++ |
3544 |
++static u64 rng_get_coprocessor_clkrate(void) |
3545 |
++{ |
3546 |
++ u64 ret = CLOCK_BASE_RATE * 16; /* Assume 800Mhz as default */ |
3547 |
++ struct pci_dev *pdev; |
3548 |
++ void __iomem *base; |
3549 |
++ |
3550 |
++ pdev = pci_get_device(PCI_VENDOR_ID_CAVIUM, |
3551 |
++ PCI_DEVICE_ID_RST_OTX2, NULL); |
3552 |
++ if (!pdev) |
3553 |
++ goto error; |
3554 |
++ |
3555 |
++ base = pci_ioremap_bar(pdev, 0); |
3556 |
++ if (!base) |
3557 |
++ goto error_put_pdev; |
3558 |
++ |
3559 |
++ /* RST: PNR_MUL * 50Mhz gives clockrate */ |
3560 |
++ ret = CLOCK_BASE_RATE * ((readq(base + RST_BOOT_REG) >> 33) & 0x3F); |
3561 |
++ |
3562 |
++ iounmap(base); |
3563 |
++ |
3564 |
++error_put_pdev: |
3565 |
++ pci_dev_put(pdev); |
3566 |
++ |
3567 |
++error: |
3568 |
++ return ret; |
3569 |
++} |
3570 |
++ |
3571 |
++static int check_rng_health(struct cavium_rng *rng) |
3572 |
++{ |
3573 |
++ u64 cur_err, cur_time; |
3574 |
++ u64 status, cycles; |
3575 |
++ u64 time_elapsed; |
3576 |
++ |
3577 |
++ |
3578 |
++ /* Skip checking health for OcteonTx */ |
3579 |
++ if (!rng->pf_regbase) |
3580 |
++ return 0; |
3581 |
++ |
3582 |
++ status = readq(rng->pf_regbase + HEALTH_STATUS_REG); |
3583 |
++ if (status & BIT_ULL(0)) { |
3584 |
++ dev_err(&rng->pdev->dev, "HWRNG: Startup health test failed\n"); |
3585 |
++ return -EIO; |
3586 |
++ } |
3587 |
++ |
3588 |
++ cycles = status >> 1; |
3589 |
++ if (!cycles) |
3590 |
++ return 0; |
3591 |
++ |
3592 |
++ cur_time = arch_timer_read_counter(); |
3593 |
++ |
3594 |
++ /* RNM_HEALTH_STATUS[CYCLES_SINCE_HEALTH_FAILURE] |
3595 |
++ * Number of coprocessor cycles times 2 since the last failure. |
3596 |
++ * This field doesn't get cleared/updated until another failure. |
3597 |
++ */ |
3598 |
++ cycles = cycles / 2; |
3599 |
++ cur_err = (cycles * 1000000000) / rng->clock_rate; /* In nanosec */ |
3600 |
++ |
3601 |
++ /* Ignore errors that happenned a long time ago, these |
3602 |
++ * are most likely false positive errors. |
3603 |
++ */ |
3604 |
++ if (cur_err > MSEC_TO_NSEC(10)) { |
3605 |
++ rng->prev_error = 0; |
3606 |
++ rng->prev_time = 0; |
3607 |
++ return 0; |
3608 |
++ } |
3609 |
++ |
3610 |
++ if (rng->prev_error) { |
3611 |
++ /* Calculate time elapsed since last error |
3612 |
++ * '1' tick of CNTVCT is 10ns, since it runs at 100Mhz. |
3613 |
++ */ |
3614 |
++ time_elapsed = (cur_time - rng->prev_time) * 10; |
3615 |
++ time_elapsed += rng->prev_error; |
3616 |
++ |
3617 |
++ /* Check if current error is a new one or the old one itself. |
3618 |
++ * If error is a new one then consider there is a persistent |
3619 |
++ * issue with entropy, declare hardware failure. |
3620 |
++ */ |
3621 |
++ if (cur_err < time_elapsed) { |
3622 |
++ dev_err(&rng->pdev->dev, "HWRNG failure detected\n"); |
3623 |
++ rng->prev_error = cur_err; |
3624 |
++ rng->prev_time = cur_time; |
3625 |
++ return -EIO; |
3626 |
++ } |
3627 |
++ } |
3628 |
++ |
3629 |
++ rng->prev_error = cur_err; |
3630 |
++ rng->prev_time = cur_time; |
3631 |
++ return 0; |
3632 |
++} |
3633 |
++ |
3634 |
+ /* Read data from the RNG unit */ |
3635 |
+ static int cavium_rng_read(struct hwrng *rng, void *dat, size_t max, bool wait) |
3636 |
+ { |
3637 |
+ struct cavium_rng *p = container_of(rng, struct cavium_rng, ops); |
3638 |
+ unsigned int size = max; |
3639 |
++ int err = 0; |
3640 |
++ |
3641 |
++ err = check_rng_health(p); |
3642 |
++ if (err) |
3643 |
++ return err; |
3644 |
+ |
3645 |
+ while (size >= 8) { |
3646 |
+ *((u64 *)dat) = readq(p->result); |
3647 |
+@@ -39,6 +166,39 @@ static int cavium_rng_read(struct hwrng *rng, void *dat, size_t max, bool wait) |
3648 |
+ return max; |
3649 |
+ } |
3650 |
+ |
3651 |
++static int cavium_map_pf_regs(struct cavium_rng *rng) |
3652 |
++{ |
3653 |
++ struct pci_dev *pdev; |
3654 |
++ |
3655 |
++ /* Health status is not supported on 83xx, skip mapping PF CSRs */ |
3656 |
++ if (is_octeontx(rng->pdev)) { |
3657 |
++ rng->pf_regbase = NULL; |
3658 |
++ return 0; |
3659 |
++ } |
3660 |
++ |
3661 |
++ pdev = pci_get_device(PCI_VENDOR_ID_CAVIUM, |
3662 |
++ PCI_DEVID_CAVIUM_RNG_PF, NULL); |
3663 |
++ if (!pdev) { |
3664 |
++ dev_err(&pdev->dev, "Cannot find RNG PF device\n"); |
3665 |
++ return -EIO; |
3666 |
++ } |
3667 |
++ |
3668 |
++ rng->pf_regbase = ioremap(pci_resource_start(pdev, 0), |
3669 |
++ pci_resource_len(pdev, 0)); |
3670 |
++ if (!rng->pf_regbase) { |
3671 |
++ dev_err(&pdev->dev, "Failed to map PF CSR region\n"); |
3672 |
++ pci_dev_put(pdev); |
3673 |
++ return -ENOMEM; |
3674 |
++ } |
3675 |
++ |
3676 |
++ pci_dev_put(pdev); |
3677 |
++ |
3678 |
++ /* Get co-processor clock rate */ |
3679 |
++ rng->clock_rate = rng_get_coprocessor_clkrate(); |
3680 |
++ |
3681 |
++ return 0; |
3682 |
++} |
3683 |
++ |
3684 |
+ /* Map Cavium RNG to an HWRNG object */ |
3685 |
+ static int cavium_rng_probe_vf(struct pci_dev *pdev, |
3686 |
+ const struct pci_device_id *id) |
3687 |
+@@ -50,6 +210,8 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev, |
3688 |
+ if (!rng) |
3689 |
+ return -ENOMEM; |
3690 |
+ |
3691 |
++ rng->pdev = pdev; |
3692 |
++ |
3693 |
+ /* Map the RNG result */ |
3694 |
+ rng->result = pcim_iomap(pdev, 0, 0); |
3695 |
+ if (!rng->result) { |
3696 |
+@@ -67,6 +229,11 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev, |
3697 |
+ |
3698 |
+ pci_set_drvdata(pdev, rng); |
3699 |
+ |
3700 |
++ /* Health status is available only at PF, hence map PF registers. */ |
3701 |
++ ret = cavium_map_pf_regs(rng); |
3702 |
++ if (ret) |
3703 |
++ return ret; |
3704 |
++ |
3705 |
+ ret = devm_hwrng_register(&pdev->dev, &rng->ops); |
3706 |
+ if (ret) { |
3707 |
+ dev_err(&pdev->dev, "Error registering device as HWRNG.\n"); |
3708 |
+@@ -76,10 +243,18 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev, |
3709 |
+ return 0; |
3710 |
+ } |
3711 |
+ |
3712 |
++/* Remove the VF */ |
3713 |
++static void cavium_rng_remove_vf(struct pci_dev *pdev) |
3714 |
++{ |
3715 |
++ struct cavium_rng *rng; |
3716 |
++ |
3717 |
++ rng = pci_get_drvdata(pdev); |
3718 |
++ iounmap(rng->pf_regbase); |
3719 |
++} |
3720 |
+ |
3721 |
+ static const struct pci_device_id cavium_rng_vf_id_table[] = { |
3722 |
+- { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 0xa033), 0, 0, 0}, |
3723 |
+- {0,}, |
3724 |
++ { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_CAVIUM_RNG_VF) }, |
3725 |
++ { 0, } |
3726 |
+ }; |
3727 |
+ MODULE_DEVICE_TABLE(pci, cavium_rng_vf_id_table); |
3728 |
+ |
3729 |
+@@ -87,8 +262,9 @@ static struct pci_driver cavium_rng_vf_driver = { |
3730 |
+ .name = "cavium_rng_vf", |
3731 |
+ .id_table = cavium_rng_vf_id_table, |
3732 |
+ .probe = cavium_rng_probe_vf, |
3733 |
++ .remove = cavium_rng_remove_vf, |
3734 |
+ }; |
3735 |
+ module_pci_driver(cavium_rng_vf_driver); |
3736 |
+ |
3737 |
+ MODULE_AUTHOR("Omer Khaliq <okhaliq@××××××××××××××.com>"); |
3738 |
+-MODULE_LICENSE("GPL"); |
3739 |
++MODULE_LICENSE("GPL v2"); |
3740 |
+diff --git a/drivers/char/hw_random/cavium-rng.c b/drivers/char/hw_random/cavium-rng.c |
3741 |
+index 63d6e68c24d2f..b96579222408b 100644 |
3742 |
+--- a/drivers/char/hw_random/cavium-rng.c |
3743 |
++++ b/drivers/char/hw_random/cavium-rng.c |
3744 |
+@@ -1,10 +1,7 @@ |
3745 |
++// SPDX-License-Identifier: GPL-2.0 |
3746 |
+ /* |
3747 |
+- * Hardware Random Number Generator support for Cavium Inc. |
3748 |
+- * Thunder processor family. |
3749 |
+- * |
3750 |
+- * This file is subject to the terms and conditions of the GNU General Public |
3751 |
+- * License. See the file "COPYING" in the main directory of this archive |
3752 |
+- * for more details. |
3753 |
++ * Hardware Random Number Generator support. |
3754 |
++ * Cavium Thunder, Marvell OcteonTx/Tx2 processor families. |
3755 |
+ * |
3756 |
+ * Copyright (C) 2016 Cavium, Inc. |
3757 |
+ */ |
3758 |
+@@ -91,4 +88,4 @@ static struct pci_driver cavium_rng_pf_driver = { |
3759 |
+ |
3760 |
+ module_pci_driver(cavium_rng_pf_driver); |
3761 |
+ MODULE_AUTHOR("Omer Khaliq <okhaliq@××××××××××××××.com>"); |
3762 |
+-MODULE_LICENSE("GPL"); |
3763 |
++MODULE_LICENSE("GPL v2"); |
3764 |
+diff --git a/drivers/char/hw_random/nomadik-rng.c b/drivers/char/hw_random/nomadik-rng.c |
3765 |
+index b0ded41eb865f..e8f9621e79541 100644 |
3766 |
+--- a/drivers/char/hw_random/nomadik-rng.c |
3767 |
++++ b/drivers/char/hw_random/nomadik-rng.c |
3768 |
+@@ -65,15 +65,14 @@ static int nmk_rng_probe(struct amba_device *dev, const struct amba_id *id) |
3769 |
+ out_release: |
3770 |
+ amba_release_regions(dev); |
3771 |
+ out_clk: |
3772 |
+- clk_disable(rng_clk); |
3773 |
++ clk_disable_unprepare(rng_clk); |
3774 |
+ return ret; |
3775 |
+ } |
3776 |
+ |
3777 |
+-static int nmk_rng_remove(struct amba_device *dev) |
3778 |
++static void nmk_rng_remove(struct amba_device *dev) |
3779 |
+ { |
3780 |
+ amba_release_regions(dev); |
3781 |
+- clk_disable(rng_clk); |
3782 |
+- return 0; |
3783 |
++ clk_disable_unprepare(rng_clk); |
3784 |
+ } |
3785 |
+ |
3786 |
+ static const struct amba_id nmk_rng_ids[] = { |
3787 |
+diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c |
3788 |
+index ddaeceb7e1091..ed600473ad7e3 100644 |
3789 |
+--- a/drivers/char/tpm/tpm-chip.c |
3790 |
++++ b/drivers/char/tpm/tpm-chip.c |
3791 |
+@@ -274,14 +274,6 @@ static void tpm_dev_release(struct device *dev) |
3792 |
+ kfree(chip); |
3793 |
+ } |
3794 |
+ |
3795 |
+-static void tpm_devs_release(struct device *dev) |
3796 |
+-{ |
3797 |
+- struct tpm_chip *chip = container_of(dev, struct tpm_chip, devs); |
3798 |
+- |
3799 |
+- /* release the master device reference */ |
3800 |
+- put_device(&chip->dev); |
3801 |
+-} |
3802 |
+- |
3803 |
+ /** |
3804 |
+ * tpm_class_shutdown() - prepare the TPM device for loss of power. |
3805 |
+ * @dev: device to which the chip is associated. |
3806 |
+@@ -344,7 +336,6 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
3807 |
+ chip->dev_num = rc; |
3808 |
+ |
3809 |
+ device_initialize(&chip->dev); |
3810 |
+- device_initialize(&chip->devs); |
3811 |
+ |
3812 |
+ chip->dev.class = tpm_class; |
3813 |
+ chip->dev.class->shutdown_pre = tpm_class_shutdown; |
3814 |
+@@ -352,29 +343,12 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
3815 |
+ chip->dev.parent = pdev; |
3816 |
+ chip->dev.groups = chip->groups; |
3817 |
+ |
3818 |
+- chip->devs.parent = pdev; |
3819 |
+- chip->devs.class = tpmrm_class; |
3820 |
+- chip->devs.release = tpm_devs_release; |
3821 |
+- /* get extra reference on main device to hold on |
3822 |
+- * behalf of devs. This holds the chip structure |
3823 |
+- * while cdevs is in use. The corresponding put |
3824 |
+- * is in the tpm_devs_release (TPM2 only) |
3825 |
+- */ |
3826 |
+- if (chip->flags & TPM_CHIP_FLAG_TPM2) |
3827 |
+- get_device(&chip->dev); |
3828 |
+- |
3829 |
+ if (chip->dev_num == 0) |
3830 |
+ chip->dev.devt = MKDEV(MISC_MAJOR, TPM_MINOR); |
3831 |
+ else |
3832 |
+ chip->dev.devt = MKDEV(MAJOR(tpm_devt), chip->dev_num); |
3833 |
+ |
3834 |
+- chip->devs.devt = |
3835 |
+- MKDEV(MAJOR(tpm_devt), chip->dev_num + TPM_NUM_DEVICES); |
3836 |
+- |
3837 |
+ rc = dev_set_name(&chip->dev, "tpm%d", chip->dev_num); |
3838 |
+- if (rc) |
3839 |
+- goto out; |
3840 |
+- rc = dev_set_name(&chip->devs, "tpmrm%d", chip->dev_num); |
3841 |
+ if (rc) |
3842 |
+ goto out; |
3843 |
+ |
3844 |
+@@ -382,9 +356,7 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
3845 |
+ chip->flags |= TPM_CHIP_FLAG_VIRTUAL; |
3846 |
+ |
3847 |
+ cdev_init(&chip->cdev, &tpm_fops); |
3848 |
+- cdev_init(&chip->cdevs, &tpmrm_fops); |
3849 |
+ chip->cdev.owner = THIS_MODULE; |
3850 |
+- chip->cdevs.owner = THIS_MODULE; |
3851 |
+ |
3852 |
+ rc = tpm2_init_space(&chip->work_space, TPM2_SPACE_BUFFER_SIZE); |
3853 |
+ if (rc) { |
3854 |
+@@ -396,7 +368,6 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
3855 |
+ return chip; |
3856 |
+ |
3857 |
+ out: |
3858 |
+- put_device(&chip->devs); |
3859 |
+ put_device(&chip->dev); |
3860 |
+ return ERR_PTR(rc); |
3861 |
+ } |
3862 |
+@@ -445,14 +416,9 @@ static int tpm_add_char_device(struct tpm_chip *chip) |
3863 |
+ } |
3864 |
+ |
3865 |
+ if (chip->flags & TPM_CHIP_FLAG_TPM2) { |
3866 |
+- rc = cdev_device_add(&chip->cdevs, &chip->devs); |
3867 |
+- if (rc) { |
3868 |
+- dev_err(&chip->devs, |
3869 |
+- "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n", |
3870 |
+- dev_name(&chip->devs), MAJOR(chip->devs.devt), |
3871 |
+- MINOR(chip->devs.devt), rc); |
3872 |
+- return rc; |
3873 |
+- } |
3874 |
++ rc = tpm_devs_add(chip); |
3875 |
++ if (rc) |
3876 |
++ goto err_del_cdev; |
3877 |
+ } |
3878 |
+ |
3879 |
+ /* Make the chip available. */ |
3880 |
+@@ -460,6 +426,10 @@ static int tpm_add_char_device(struct tpm_chip *chip) |
3881 |
+ idr_replace(&dev_nums_idr, chip, chip->dev_num); |
3882 |
+ mutex_unlock(&idr_lock); |
3883 |
+ |
3884 |
++ return 0; |
3885 |
++ |
3886 |
++err_del_cdev: |
3887 |
++ cdev_device_del(&chip->cdev, &chip->dev); |
3888 |
+ return rc; |
3889 |
+ } |
3890 |
+ |
3891 |
+@@ -641,7 +611,7 @@ void tpm_chip_unregister(struct tpm_chip *chip) |
3892 |
+ hwrng_unregister(&chip->hwrng); |
3893 |
+ tpm_bios_log_teardown(chip); |
3894 |
+ if (chip->flags & TPM_CHIP_FLAG_TPM2) |
3895 |
+- cdev_device_del(&chip->cdevs, &chip->devs); |
3896 |
++ tpm_devs_remove(chip); |
3897 |
+ tpm_del_char_device(chip); |
3898 |
+ } |
3899 |
+ EXPORT_SYMBOL_GPL(tpm_chip_unregister); |
3900 |
+diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
3901 |
+index 283f78211c3a7..2163c6ee0d364 100644 |
3902 |
+--- a/drivers/char/tpm/tpm.h |
3903 |
++++ b/drivers/char/tpm/tpm.h |
3904 |
+@@ -234,6 +234,8 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, |
3905 |
+ size_t cmdsiz); |
3906 |
+ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, void *buf, |
3907 |
+ size_t *bufsiz); |
3908 |
++int tpm_devs_add(struct tpm_chip *chip); |
3909 |
++void tpm_devs_remove(struct tpm_chip *chip); |
3910 |
+ |
3911 |
+ void tpm_bios_log_setup(struct tpm_chip *chip); |
3912 |
+ void tpm_bios_log_teardown(struct tpm_chip *chip); |
3913 |
+diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c |
3914 |
+index d2225020e4d2c..ffb35f0154c16 100644 |
3915 |
+--- a/drivers/char/tpm/tpm2-space.c |
3916 |
++++ b/drivers/char/tpm/tpm2-space.c |
3917 |
+@@ -574,3 +574,68 @@ out: |
3918 |
+ dev_err(&chip->dev, "%s: error %d\n", __func__, rc); |
3919 |
+ return rc; |
3920 |
+ } |
3921 |
++ |
3922 |
++/* |
3923 |
++ * Put the reference to the main device. |
3924 |
++ */ |
3925 |
++static void tpm_devs_release(struct device *dev) |
3926 |
++{ |
3927 |
++ struct tpm_chip *chip = container_of(dev, struct tpm_chip, devs); |
3928 |
++ |
3929 |
++ /* release the master device reference */ |
3930 |
++ put_device(&chip->dev); |
3931 |
++} |
3932 |
++ |
3933 |
++/* |
3934 |
++ * Remove the device file for exposed TPM spaces and release the device |
3935 |
++ * reference. This may also release the reference to the master device. |
3936 |
++ */ |
3937 |
++void tpm_devs_remove(struct tpm_chip *chip) |
3938 |
++{ |
3939 |
++ cdev_device_del(&chip->cdevs, &chip->devs); |
3940 |
++ put_device(&chip->devs); |
3941 |
++} |
3942 |
++ |
3943 |
++/* |
3944 |
++ * Add a device file to expose TPM spaces. Also take a reference to the |
3945 |
++ * main device. |
3946 |
++ */ |
3947 |
++int tpm_devs_add(struct tpm_chip *chip) |
3948 |
++{ |
3949 |
++ int rc; |
3950 |
++ |
3951 |
++ device_initialize(&chip->devs); |
3952 |
++ chip->devs.parent = chip->dev.parent; |
3953 |
++ chip->devs.class = tpmrm_class; |
3954 |
++ |
3955 |
++ /* |
3956 |
++ * Get extra reference on main device to hold on behalf of devs. |
3957 |
++ * This holds the chip structure while cdevs is in use. The |
3958 |
++ * corresponding put is in the tpm_devs_release. |
3959 |
++ */ |
3960 |
++ get_device(&chip->dev); |
3961 |
++ chip->devs.release = tpm_devs_release; |
3962 |
++ chip->devs.devt = MKDEV(MAJOR(tpm_devt), chip->dev_num + TPM_NUM_DEVICES); |
3963 |
++ cdev_init(&chip->cdevs, &tpmrm_fops); |
3964 |
++ chip->cdevs.owner = THIS_MODULE; |
3965 |
++ |
3966 |
++ rc = dev_set_name(&chip->devs, "tpmrm%d", chip->dev_num); |
3967 |
++ if (rc) |
3968 |
++ goto err_put_devs; |
3969 |
++ |
3970 |
++ rc = cdev_device_add(&chip->cdevs, &chip->devs); |
3971 |
++ if (rc) { |
3972 |
++ dev_err(&chip->devs, |
3973 |
++ "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n", |
3974 |
++ dev_name(&chip->devs), MAJOR(chip->devs.devt), |
3975 |
++ MINOR(chip->devs.devt), rc); |
3976 |
++ goto err_put_devs; |
3977 |
++ } |
3978 |
++ |
3979 |
++ return 0; |
3980 |
++ |
3981 |
++err_put_devs: |
3982 |
++ put_device(&chip->devs); |
3983 |
++ |
3984 |
++ return rc; |
3985 |
++} |
3986 |
+diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c |
3987 |
+index 673522874cec4..3dd4deb60adbf 100644 |
3988 |
+--- a/drivers/char/virtio_console.c |
3989 |
++++ b/drivers/char/virtio_console.c |
3990 |
+@@ -1959,6 +1959,13 @@ static void virtcons_remove(struct virtio_device *vdev) |
3991 |
+ list_del(&portdev->list); |
3992 |
+ spin_unlock_irq(&pdrvdata_lock); |
3993 |
+ |
3994 |
++ /* Device is going away, exit any polling for buffers */ |
3995 |
++ virtio_break_device(vdev); |
3996 |
++ if (use_multiport(portdev)) |
3997 |
++ flush_work(&portdev->control_work); |
3998 |
++ else |
3999 |
++ flush_work(&portdev->config_work); |
4000 |
++ |
4001 |
+ /* Disable interrupts for vqs */ |
4002 |
+ vdev->config->reset(vdev); |
4003 |
+ /* Finish up work that's lined up */ |
4004 |
+diff --git a/drivers/clk/actions/owl-s700.c b/drivers/clk/actions/owl-s700.c |
4005 |
+index a2f34d13fb543..6ea7da1d6d755 100644 |
4006 |
+--- a/drivers/clk/actions/owl-s700.c |
4007 |
++++ b/drivers/clk/actions/owl-s700.c |
4008 |
+@@ -162,6 +162,7 @@ static struct clk_div_table hdmia_div_table[] = { |
4009 |
+ |
4010 |
+ static struct clk_div_table rmii_div_table[] = { |
4011 |
+ {0, 4}, {1, 10}, |
4012 |
++ {0, 0} |
4013 |
+ }; |
4014 |
+ |
4015 |
+ /* divider clocks */ |
4016 |
+diff --git a/drivers/clk/actions/owl-s900.c b/drivers/clk/actions/owl-s900.c |
4017 |
+index 790890978424a..5144ada2c7e1a 100644 |
4018 |
+--- a/drivers/clk/actions/owl-s900.c |
4019 |
++++ b/drivers/clk/actions/owl-s900.c |
4020 |
+@@ -140,7 +140,7 @@ static struct clk_div_table rmii_ref_div_table[] = { |
4021 |
+ |
4022 |
+ static struct clk_div_table usb3_mac_div_table[] = { |
4023 |
+ { 1, 2 }, { 2, 3 }, { 3, 4 }, |
4024 |
+- { 0, 8 }, |
4025 |
++ { 0, 0 } |
4026 |
+ }; |
4027 |
+ |
4028 |
+ static struct clk_div_table i2s_div_table[] = { |
4029 |
+diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c |
4030 |
+index a092a940baa40..9d25b23fb99d7 100644 |
4031 |
+--- a/drivers/clk/at91/sama7g5.c |
4032 |
++++ b/drivers/clk/at91/sama7g5.c |
4033 |
+@@ -606,16 +606,16 @@ static const struct { |
4034 |
+ { .n = "pdmc0_gclk", |
4035 |
+ .id = 68, |
4036 |
+ .r = { .max = 50000000 }, |
4037 |
+- .pp = { "syspll_divpmcck", "baudpll_divpmcck", }, |
4038 |
+- .pp_mux_table = { 5, 8, }, |
4039 |
++ .pp = { "syspll_divpmcck", "audiopll_divpmcck", }, |
4040 |
++ .pp_mux_table = { 5, 9, }, |
4041 |
+ .pp_count = 2, |
4042 |
+ .pp_chg_id = INT_MIN, }, |
4043 |
+ |
4044 |
+ { .n = "pdmc1_gclk", |
4045 |
+ .id = 69, |
4046 |
+ .r = { .max = 50000000, }, |
4047 |
+- .pp = { "syspll_divpmcck", "baudpll_divpmcck", }, |
4048 |
+- .pp_mux_table = { 5, 8, }, |
4049 |
++ .pp = { "syspll_divpmcck", "audiopll_divpmcck", }, |
4050 |
++ .pp_mux_table = { 5, 9, }, |
4051 |
+ .pp_count = 2, |
4052 |
+ .pp_chg_id = INT_MIN, }, |
4053 |
+ |
4054 |
+diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c |
4055 |
+index a2c6486ef1708..f8417ee2961aa 100644 |
4056 |
+--- a/drivers/clk/clk-clps711x.c |
4057 |
++++ b/drivers/clk/clk-clps711x.c |
4058 |
+@@ -28,11 +28,13 @@ static const struct clk_div_table spi_div_table[] = { |
4059 |
+ { .val = 1, .div = 8, }, |
4060 |
+ { .val = 2, .div = 2, }, |
4061 |
+ { .val = 3, .div = 1, }, |
4062 |
++ { /* sentinel */ } |
4063 |
+ }; |
4064 |
+ |
4065 |
+ static const struct clk_div_table timer_div_table[] = { |
4066 |
+ { .val = 0, .div = 256, }, |
4067 |
+ { .val = 1, .div = 1, }, |
4068 |
++ { /* sentinel */ } |
4069 |
+ }; |
4070 |
+ |
4071 |
+ struct clps711x_clk { |
4072 |
+diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
4073 |
+index b8a0e3d23698c..92fc084203b75 100644 |
4074 |
+--- a/drivers/clk/clk.c |
4075 |
++++ b/drivers/clk/clk.c |
4076 |
+@@ -3384,6 +3384,19 @@ static void clk_core_reparent_orphans_nolock(void) |
4077 |
+ __clk_set_parent_after(orphan, parent, NULL); |
4078 |
+ __clk_recalc_accuracies(orphan); |
4079 |
+ __clk_recalc_rates(orphan, 0); |
4080 |
++ |
4081 |
++ /* |
4082 |
++ * __clk_init_parent() will set the initial req_rate to |
4083 |
++ * 0 if the clock doesn't have clk_ops::recalc_rate and |
4084 |
++ * is an orphan when it's registered. |
4085 |
++ * |
4086 |
++ * 'req_rate' is used by clk_set_rate_range() and |
4087 |
++ * clk_put() to trigger a clk_set_rate() call whenever |
4088 |
++ * the boundaries are modified. Let's make sure |
4089 |
++ * 'req_rate' is set to something non-zero so that |
4090 |
++ * clk_set_rate_range() doesn't drop the frequency. |
4091 |
++ */ |
4092 |
++ orphan->req_rate = orphan->rate; |
4093 |
+ } |
4094 |
+ } |
4095 |
+ } |
4096 |
+diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c |
4097 |
+index c4e0f1c07192f..3f6fd7ef2a68f 100644 |
4098 |
+--- a/drivers/clk/imx/clk-imx7d.c |
4099 |
++++ b/drivers/clk/imx/clk-imx7d.c |
4100 |
+@@ -849,7 +849,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) |
4101 |
+ hws[IMX7D_WDOG4_ROOT_CLK] = imx_clk_hw_gate4("wdog4_root_clk", "wdog_post_div", base + 0x49f0, 0); |
4102 |
+ hws[IMX7D_KPP_ROOT_CLK] = imx_clk_hw_gate4("kpp_root_clk", "ipg_root_clk", base + 0x4aa0, 0); |
4103 |
+ hws[IMX7D_CSI_MCLK_ROOT_CLK] = imx_clk_hw_gate4("csi_mclk_root_clk", "csi_mclk_post_div", base + 0x4490, 0); |
4104 |
+- hws[IMX7D_AUDIO_MCLK_ROOT_CLK] = imx_clk_hw_gate4("audio_mclk_root_clk", "audio_mclk_post_div", base + 0x4790, 0); |
4105 |
+ hws[IMX7D_WRCLK_ROOT_CLK] = imx_clk_hw_gate4("wrclk_root_clk", "wrclk_post_div", base + 0x47a0, 0); |
4106 |
+ hws[IMX7D_USB_CTRL_CLK] = imx_clk_hw_gate4("usb_ctrl_clk", "ahb_root_clk", base + 0x4680, 0); |
4107 |
+ hws[IMX7D_USB_PHY1_CLK] = imx_clk_hw_gate4("usb_phy1_clk", "pll_usb1_main_clk", base + 0x46a0, 0); |
4108 |
+diff --git a/drivers/clk/loongson1/clk-loongson1c.c b/drivers/clk/loongson1/clk-loongson1c.c |
4109 |
+index 703f87622cf5f..1ebf740380efb 100644 |
4110 |
+--- a/drivers/clk/loongson1/clk-loongson1c.c |
4111 |
++++ b/drivers/clk/loongson1/clk-loongson1c.c |
4112 |
+@@ -37,6 +37,7 @@ static const struct clk_div_table ahb_div_table[] = { |
4113 |
+ [1] = { .val = 1, .div = 4 }, |
4114 |
+ [2] = { .val = 2, .div = 3 }, |
4115 |
+ [3] = { .val = 3, .div = 3 }, |
4116 |
++ [4] = { /* sentinel */ } |
4117 |
+ }; |
4118 |
+ |
4119 |
+ void __init ls1x_clk_init(void) |
4120 |
+diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c |
4121 |
+index 59a5a0f261f33..71a0d30cf44df 100644 |
4122 |
+--- a/drivers/clk/qcom/clk-rcg2.c |
4123 |
++++ b/drivers/clk/qcom/clk-rcg2.c |
4124 |
+@@ -264,7 +264,7 @@ static int clk_rcg2_determine_floor_rate(struct clk_hw *hw, |
4125 |
+ |
4126 |
+ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) |
4127 |
+ { |
4128 |
+- u32 cfg, mask; |
4129 |
++ u32 cfg, mask, d_val, not2d_val, n_minus_m; |
4130 |
+ struct clk_hw *hw = &rcg->clkr.hw; |
4131 |
+ int ret, index = qcom_find_src_index(hw, rcg->parent_map, f->src); |
4132 |
+ |
4133 |
+@@ -283,8 +283,17 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) |
4134 |
+ if (ret) |
4135 |
+ return ret; |
4136 |
+ |
4137 |
++ /* Calculate 2d value */ |
4138 |
++ d_val = f->n; |
4139 |
++ |
4140 |
++ n_minus_m = f->n - f->m; |
4141 |
++ n_minus_m *= 2; |
4142 |
++ |
4143 |
++ d_val = clamp_t(u32, d_val, f->m, n_minus_m); |
4144 |
++ not2d_val = ~d_val & mask; |
4145 |
++ |
4146 |
+ ret = regmap_update_bits(rcg->clkr.regmap, |
4147 |
+- RCG_D_OFFSET(rcg), mask, ~f->n); |
4148 |
++ RCG_D_OFFSET(rcg), mask, not2d_val); |
4149 |
+ if (ret) |
4150 |
+ return ret; |
4151 |
+ } |
4152 |
+@@ -639,6 +648,7 @@ static const struct frac_entry frac_table_pixel[] = { |
4153 |
+ { 2, 9 }, |
4154 |
+ { 4, 9 }, |
4155 |
+ { 1, 1 }, |
4156 |
++ { 2, 3 }, |
4157 |
+ { } |
4158 |
+ }; |
4159 |
+ |
4160 |
+diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c |
4161 |
+index 108fe27bee10f..541016db3c4bb 100644 |
4162 |
+--- a/drivers/clk/qcom/gcc-ipq8074.c |
4163 |
++++ b/drivers/clk/qcom/gcc-ipq8074.c |
4164 |
+@@ -60,11 +60,6 @@ static const struct parent_map gcc_xo_gpll0_gpll0_out_main_div2_map[] = { |
4165 |
+ { P_GPLL0_DIV2, 4 }, |
4166 |
+ }; |
4167 |
+ |
4168 |
+-static const char * const gcc_xo_gpll0[] = { |
4169 |
+- "xo", |
4170 |
+- "gpll0", |
4171 |
+-}; |
4172 |
+- |
4173 |
+ static const struct parent_map gcc_xo_gpll0_map[] = { |
4174 |
+ { P_XO, 0 }, |
4175 |
+ { P_GPLL0, 1 }, |
4176 |
+@@ -956,6 +951,11 @@ static struct clk_rcg2 blsp1_uart6_apps_clk_src = { |
4177 |
+ }, |
4178 |
+ }; |
4179 |
+ |
4180 |
++static const struct clk_parent_data gcc_xo_gpll0[] = { |
4181 |
++ { .fw_name = "xo" }, |
4182 |
++ { .hw = &gpll0.clkr.hw }, |
4183 |
++}; |
4184 |
++ |
4185 |
+ static const struct freq_tbl ftbl_pcie_axi_clk_src[] = { |
4186 |
+ F(19200000, P_XO, 1, 0, 0), |
4187 |
+ F(200000000, P_GPLL0, 4, 0, 0), |
4188 |
+@@ -969,7 +969,7 @@ static struct clk_rcg2 pcie0_axi_clk_src = { |
4189 |
+ .parent_map = gcc_xo_gpll0_map, |
4190 |
+ .clkr.hw.init = &(struct clk_init_data){ |
4191 |
+ .name = "pcie0_axi_clk_src", |
4192 |
+- .parent_names = gcc_xo_gpll0, |
4193 |
++ .parent_data = gcc_xo_gpll0, |
4194 |
+ .num_parents = 2, |
4195 |
+ .ops = &clk_rcg2_ops, |
4196 |
+ }, |
4197 |
+@@ -1016,7 +1016,7 @@ static struct clk_rcg2 pcie1_axi_clk_src = { |
4198 |
+ .parent_map = gcc_xo_gpll0_map, |
4199 |
+ .clkr.hw.init = &(struct clk_init_data){ |
4200 |
+ .name = "pcie1_axi_clk_src", |
4201 |
+- .parent_names = gcc_xo_gpll0, |
4202 |
++ .parent_data = gcc_xo_gpll0, |
4203 |
+ .num_parents = 2, |
4204 |
+ .ops = &clk_rcg2_ops, |
4205 |
+ }, |
4206 |
+@@ -1074,7 +1074,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { |
4207 |
+ .name = "sdcc1_apps_clk_src", |
4208 |
+ .parent_names = gcc_xo_gpll0_gpll2_gpll0_out_main_div2, |
4209 |
+ .num_parents = 4, |
4210 |
+- .ops = &clk_rcg2_ops, |
4211 |
++ .ops = &clk_rcg2_floor_ops, |
4212 |
+ }, |
4213 |
+ }; |
4214 |
+ |
4215 |
+@@ -1330,7 +1330,7 @@ static struct clk_rcg2 nss_ce_clk_src = { |
4216 |
+ .parent_map = gcc_xo_gpll0_map, |
4217 |
+ .clkr.hw.init = &(struct clk_init_data){ |
4218 |
+ .name = "nss_ce_clk_src", |
4219 |
+- .parent_names = gcc_xo_gpll0, |
4220 |
++ .parent_data = gcc_xo_gpll0, |
4221 |
+ .num_parents = 2, |
4222 |
+ .ops = &clk_rcg2_ops, |
4223 |
+ }, |
4224 |
+@@ -4329,8 +4329,7 @@ static struct clk_rcg2 pcie0_rchng_clk_src = { |
4225 |
+ .parent_map = gcc_xo_gpll0_map, |
4226 |
+ .clkr.hw.init = &(struct clk_init_data){ |
4227 |
+ .name = "pcie0_rchng_clk_src", |
4228 |
+- .parent_hws = (const struct clk_hw *[]) { |
4229 |
+- &gpll0.clkr.hw }, |
4230 |
++ .parent_data = gcc_xo_gpll0, |
4231 |
+ .num_parents = 2, |
4232 |
+ .ops = &clk_rcg2_ops, |
4233 |
+ }, |
4234 |
+diff --git a/drivers/clk/qcom/gcc-msm8994.c b/drivers/clk/qcom/gcc-msm8994.c |
4235 |
+index 144d2ba7a9bef..463a444c8a7e4 100644 |
4236 |
+--- a/drivers/clk/qcom/gcc-msm8994.c |
4237 |
++++ b/drivers/clk/qcom/gcc-msm8994.c |
4238 |
+@@ -108,6 +108,7 @@ static struct clk_alpha_pll gpll4_early = { |
4239 |
+ |
4240 |
+ static struct clk_alpha_pll_postdiv gpll4 = { |
4241 |
+ .offset = 0x1dc0, |
4242 |
++ .width = 4, |
4243 |
+ .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], |
4244 |
+ .clkr.hw.init = &(struct clk_init_data) |
4245 |
+ { |
4246 |
+diff --git a/drivers/clk/tegra/clk-tegra124-emc.c b/drivers/clk/tegra/clk-tegra124-emc.c |
4247 |
+index 745f9faa98d8e..733a962ff521a 100644 |
4248 |
+--- a/drivers/clk/tegra/clk-tegra124-emc.c |
4249 |
++++ b/drivers/clk/tegra/clk-tegra124-emc.c |
4250 |
+@@ -191,6 +191,7 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra) |
4251 |
+ |
4252 |
+ tegra->emc = platform_get_drvdata(pdev); |
4253 |
+ if (!tegra->emc) { |
4254 |
++ put_device(&pdev->dev); |
4255 |
+ pr_err("%s: cannot find EMC driver\n", __func__); |
4256 |
+ return NULL; |
4257 |
+ } |
4258 |
+diff --git a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c |
4259 |
+index 5319cd3804801..3bc55ab75314b 100644 |
4260 |
+--- a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c |
4261 |
++++ b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c |
4262 |
+@@ -24,6 +24,7 @@ struct clk_hw *uniphier_clk_register_fixed_rate(struct device *dev, |
4263 |
+ |
4264 |
+ init.name = name; |
4265 |
+ init.ops = &clk_fixed_rate_ops; |
4266 |
++ init.flags = 0; |
4267 |
+ init.parent_names = NULL; |
4268 |
+ init.num_parents = 0; |
4269 |
+ |
4270 |
+diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c |
4271 |
+index eb596ff9e7bb3..279ddff81ab49 100644 |
4272 |
+--- a/drivers/clocksource/acpi_pm.c |
4273 |
++++ b/drivers/clocksource/acpi_pm.c |
4274 |
+@@ -229,8 +229,10 @@ static int __init parse_pmtmr(char *arg) |
4275 |
+ int ret; |
4276 |
+ |
4277 |
+ ret = kstrtouint(arg, 16, &base); |
4278 |
+- if (ret) |
4279 |
+- return ret; |
4280 |
++ if (ret) { |
4281 |
++ pr_warn("PMTMR: invalid 'pmtmr=' value: '%s'\n", arg); |
4282 |
++ return 1; |
4283 |
++ } |
4284 |
+ |
4285 |
+ pr_info("PMTMR IOPort override: 0x%04x -> 0x%04x\n", pmtmr_ioport, |
4286 |
+ base); |
4287 |
+diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c |
4288 |
+index fabad79baafce..df194b05e944c 100644 |
4289 |
+--- a/drivers/clocksource/exynos_mct.c |
4290 |
++++ b/drivers/clocksource/exynos_mct.c |
4291 |
+@@ -494,11 +494,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu) |
4292 |
+ return 0; |
4293 |
+ } |
4294 |
+ |
4295 |
+-static int __init exynos4_timer_resources(struct device_node *np, void __iomem *base) |
4296 |
++static int __init exynos4_timer_resources(struct device_node *np) |
4297 |
+ { |
4298 |
+- int err, cpu; |
4299 |
+ struct clk *mct_clk, *tick_clk; |
4300 |
+ |
4301 |
++ reg_base = of_iomap(np, 0); |
4302 |
++ if (!reg_base) |
4303 |
++ panic("%s: unable to ioremap mct address space\n", __func__); |
4304 |
++ |
4305 |
+ tick_clk = of_clk_get_by_name(np, "fin_pll"); |
4306 |
+ if (IS_ERR(tick_clk)) |
4307 |
+ panic("%s: unable to determine tick clock rate\n", __func__); |
4308 |
+@@ -509,9 +512,32 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * |
4309 |
+ panic("%s: unable to retrieve mct clock instance\n", __func__); |
4310 |
+ clk_prepare_enable(mct_clk); |
4311 |
+ |
4312 |
+- reg_base = base; |
4313 |
+- if (!reg_base) |
4314 |
+- panic("%s: unable to ioremap mct address space\n", __func__); |
4315 |
++ return 0; |
4316 |
++} |
4317 |
++ |
4318 |
++static int __init exynos4_timer_interrupts(struct device_node *np, |
4319 |
++ unsigned int int_type) |
4320 |
++{ |
4321 |
++ int nr_irqs, i, err, cpu; |
4322 |
++ |
4323 |
++ mct_int_type = int_type; |
4324 |
++ |
4325 |
++ /* This driver uses only one global timer interrupt */ |
4326 |
++ mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); |
4327 |
++ |
4328 |
++ /* |
4329 |
++ * Find out the number of local irqs specified. The local |
4330 |
++ * timer irqs are specified after the four global timer |
4331 |
++ * irqs are specified. |
4332 |
++ */ |
4333 |
++ nr_irqs = of_irq_count(np); |
4334 |
++ if (nr_irqs > ARRAY_SIZE(mct_irqs)) { |
4335 |
++ pr_err("exynos-mct: too many (%d) interrupts configured in DT\n", |
4336 |
++ nr_irqs); |
4337 |
++ nr_irqs = ARRAY_SIZE(mct_irqs); |
4338 |
++ } |
4339 |
++ for (i = MCT_L0_IRQ; i < nr_irqs; i++) |
4340 |
++ mct_irqs[i] = irq_of_parse_and_map(np, i); |
4341 |
+ |
4342 |
+ if (mct_int_type == MCT_INT_PPI) { |
4343 |
+ |
4344 |
+@@ -522,11 +548,14 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * |
4345 |
+ mct_irqs[MCT_L0_IRQ], err); |
4346 |
+ } else { |
4347 |
+ for_each_possible_cpu(cpu) { |
4348 |
+- int mct_irq = mct_irqs[MCT_L0_IRQ + cpu]; |
4349 |
++ int mct_irq; |
4350 |
+ struct mct_clock_event_device *pcpu_mevt = |
4351 |
+ per_cpu_ptr(&percpu_mct_tick, cpu); |
4352 |
+ |
4353 |
+ pcpu_mevt->evt.irq = -1; |
4354 |
++ if (MCT_L0_IRQ + cpu >= ARRAY_SIZE(mct_irqs)) |
4355 |
++ break; |
4356 |
++ mct_irq = mct_irqs[MCT_L0_IRQ + cpu]; |
4357 |
+ |
4358 |
+ irq_set_status_flags(mct_irq, IRQ_NOAUTOEN); |
4359 |
+ if (request_irq(mct_irq, |
4360 |
+@@ -571,24 +600,13 @@ out_irq: |
4361 |
+ |
4362 |
+ static int __init mct_init_dt(struct device_node *np, unsigned int int_type) |
4363 |
+ { |
4364 |
+- u32 nr_irqs, i; |
4365 |
+ int ret; |
4366 |
+ |
4367 |
+- mct_int_type = int_type; |
4368 |
+- |
4369 |
+- /* This driver uses only one global timer interrupt */ |
4370 |
+- mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); |
4371 |
+- |
4372 |
+- /* |
4373 |
+- * Find out the number of local irqs specified. The local |
4374 |
+- * timer irqs are specified after the four global timer |
4375 |
+- * irqs are specified. |
4376 |
+- */ |
4377 |
+- nr_irqs = of_irq_count(np); |
4378 |
+- for (i = MCT_L0_IRQ; i < nr_irqs; i++) |
4379 |
+- mct_irqs[i] = irq_of_parse_and_map(np, i); |
4380 |
++ ret = exynos4_timer_resources(np); |
4381 |
++ if (ret) |
4382 |
++ return ret; |
4383 |
+ |
4384 |
+- ret = exynos4_timer_resources(np, of_iomap(np, 0)); |
4385 |
++ ret = exynos4_timer_interrupts(np, int_type); |
4386 |
+ if (ret) |
4387 |
+ return ret; |
4388 |
+ |
4389 |
+diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c |
4390 |
+index 59e11ca8ee73e..5c9485cb4e059 100644 |
4391 |
+--- a/drivers/clocksource/timer-microchip-pit64b.c |
4392 |
++++ b/drivers/clocksource/timer-microchip-pit64b.c |
4393 |
+@@ -121,7 +121,7 @@ static u64 mchp_pit64b_clksrc_read(struct clocksource *cs) |
4394 |
+ return mchp_pit64b_cnt_read(mchp_pit64b_cs_base); |
4395 |
+ } |
4396 |
+ |
4397 |
+-static u64 mchp_pit64b_sched_read_clk(void) |
4398 |
++static u64 notrace mchp_pit64b_sched_read_clk(void) |
4399 |
+ { |
4400 |
+ return mchp_pit64b_cnt_read(mchp_pit64b_cs_base); |
4401 |
+ } |
4402 |
+diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c |
4403 |
+index 572da477c6d35..b965f20174e3a 100644 |
4404 |
+--- a/drivers/clocksource/timer-of.c |
4405 |
++++ b/drivers/clocksource/timer-of.c |
4406 |
+@@ -157,9 +157,9 @@ static __init int timer_of_base_init(struct device_node *np, |
4407 |
+ of_base->base = of_base->name ? |
4408 |
+ of_io_request_and_map(np, of_base->index, of_base->name) : |
4409 |
+ of_iomap(np, of_base->index); |
4410 |
+- if (IS_ERR(of_base->base)) { |
4411 |
+- pr_err("Failed to iomap (%s)\n", of_base->name); |
4412 |
+- return PTR_ERR(of_base->base); |
4413 |
++ if (IS_ERR_OR_NULL(of_base->base)) { |
4414 |
++ pr_err("Failed to iomap (%s:%s)\n", np->name, of_base->name); |
4415 |
++ return of_base->base ? PTR_ERR(of_base->base) : -ENOMEM; |
4416 |
+ } |
4417 |
+ |
4418 |
+ return 0; |
4419 |
+diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c |
4420 |
+index 1fccb457fcc54..2737407ff0698 100644 |
4421 |
+--- a/drivers/clocksource/timer-ti-dm-systimer.c |
4422 |
++++ b/drivers/clocksource/timer-ti-dm-systimer.c |
4423 |
+@@ -694,9 +694,9 @@ static int __init dmtimer_percpu_quirk_init(struct device_node *np, u32 pa) |
4424 |
+ return 0; |
4425 |
+ } |
4426 |
+ |
4427 |
+- if (pa == 0x48034000) /* dra7 dmtimer3 */ |
4428 |
++ if (pa == 0x4882c000) /* dra7 dmtimer15 */ |
4429 |
+ return dmtimer_percpu_timer_init(np, 0); |
4430 |
+- else if (pa == 0x48036000) /* dra7 dmtimer4 */ |
4431 |
++ else if (pa == 0x4882e000) /* dra7 dmtimer16 */ |
4432 |
+ return dmtimer_percpu_timer_init(np, 1); |
4433 |
+ |
4434 |
+ return 0; |
4435 |
+diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c |
4436 |
+index fba9937a406b3..7fdd30e92e429 100644 |
4437 |
+--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c |
4438 |
++++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c |
4439 |
+@@ -130,7 +130,7 @@ static void get_krait_bin_format_b(struct device *cpu_dev, |
4440 |
+ } |
4441 |
+ |
4442 |
+ /* Check PVS_BLOW_STATUS */ |
4443 |
+- pte_efuse = *(((u32 *)buf) + 4); |
4444 |
++ pte_efuse = *(((u32 *)buf) + 1); |
4445 |
+ pte_efuse &= BIT(21); |
4446 |
+ if (pte_efuse) { |
4447 |
+ dev_dbg(cpu_dev, "PVS bin: %d\n", *pvs); |
4448 |
+diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c |
4449 |
+index 33707a2e55ff0..64133d4da3d56 100644 |
4450 |
+--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c |
4451 |
++++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c |
4452 |
+@@ -11,6 +11,7 @@ |
4453 |
+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst |
4454 |
+ */ |
4455 |
+ |
4456 |
++#include <linux/bottom_half.h> |
4457 |
+ #include <linux/crypto.h> |
4458 |
+ #include <linux/dma-mapping.h> |
4459 |
+ #include <linux/io.h> |
4460 |
+@@ -280,7 +281,9 @@ static int sun8i_ce_cipher_run(struct crypto_engine *engine, void *areq) |
4461 |
+ |
4462 |
+ flow = rctx->flow; |
4463 |
+ err = sun8i_ce_run_task(ce, flow, crypto_tfm_alg_name(breq->base.tfm)); |
4464 |
++ local_bh_disable(); |
4465 |
+ crypto_finalize_skcipher_request(engine, breq, err); |
4466 |
++ local_bh_enable(); |
4467 |
+ return 0; |
4468 |
+ } |
4469 |
+ |
4470 |
+diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |
4471 |
+index 4c5a2c11d7141..62c07a724d40e 100644 |
4472 |
+--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |
4473 |
++++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |
4474 |
+@@ -9,6 +9,7 @@ |
4475 |
+ * |
4476 |
+ * You could find the datasheet in Documentation/arm/sunxi.rst |
4477 |
+ */ |
4478 |
++#include <linux/bottom_half.h> |
4479 |
+ #include <linux/dma-mapping.h> |
4480 |
+ #include <linux/pm_runtime.h> |
4481 |
+ #include <linux/scatterlist.h> |
4482 |
+@@ -412,6 +413,8 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) |
4483 |
+ theend: |
4484 |
+ kfree(buf); |
4485 |
+ kfree(result); |
4486 |
++ local_bh_disable(); |
4487 |
+ crypto_finalize_hash_request(engine, breq, err); |
4488 |
++ local_bh_enable(); |
4489 |
+ return 0; |
4490 |
+ } |
4491 |
+diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c |
4492 |
+index 7c355bc2fb066..f783748462f94 100644 |
4493 |
+--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c |
4494 |
++++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c |
4495 |
+@@ -11,6 +11,7 @@ |
4496 |
+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst |
4497 |
+ */ |
4498 |
+ |
4499 |
++#include <linux/bottom_half.h> |
4500 |
+ #include <linux/crypto.h> |
4501 |
+ #include <linux/dma-mapping.h> |
4502 |
+ #include <linux/io.h> |
4503 |
+@@ -271,7 +272,9 @@ static int sun8i_ss_handle_cipher_request(struct crypto_engine *engine, void *ar |
4504 |
+ struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); |
4505 |
+ |
4506 |
+ err = sun8i_ss_cipher(breq); |
4507 |
++ local_bh_disable(); |
4508 |
+ crypto_finalize_skcipher_request(engine, breq, err); |
4509 |
++ local_bh_enable(); |
4510 |
+ |
4511 |
+ return 0; |
4512 |
+ } |
4513 |
+diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |
4514 |
+index 80e89066dbd1a..319fe3279a716 100644 |
4515 |
+--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |
4516 |
++++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |
4517 |
+@@ -30,6 +30,8 @@ |
4518 |
+ static const struct ss_variant ss_a80_variant = { |
4519 |
+ .alg_cipher = { SS_ALG_AES, SS_ALG_DES, SS_ALG_3DES, |
4520 |
+ }, |
4521 |
++ .alg_hash = { SS_ID_NOTSUPP, SS_ID_NOTSUPP, SS_ID_NOTSUPP, SS_ID_NOTSUPP, |
4522 |
++ }, |
4523 |
+ .op_mode = { SS_OP_ECB, SS_OP_CBC, |
4524 |
+ }, |
4525 |
+ .ss_clks = { |
4526 |
+diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c |
4527 |
+index 756d5a7835482..c9edecd43ef96 100644 |
4528 |
+--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c |
4529 |
++++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c |
4530 |
+@@ -9,6 +9,7 @@ |
4531 |
+ * |
4532 |
+ * You could find the datasheet in Documentation/arm/sunxi.rst |
4533 |
+ */ |
4534 |
++#include <linux/bottom_half.h> |
4535 |
+ #include <linux/dma-mapping.h> |
4536 |
+ #include <linux/pm_runtime.h> |
4537 |
+ #include <linux/scatterlist.h> |
4538 |
+@@ -440,6 +441,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq) |
4539 |
+ theend: |
4540 |
+ kfree(pad); |
4541 |
+ kfree(result); |
4542 |
++ local_bh_disable(); |
4543 |
+ crypto_finalize_hash_request(engine, breq, err); |
4544 |
++ local_bh_enable(); |
4545 |
+ return 0; |
4546 |
+ } |
4547 |
+diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c |
4548 |
+index 8b5e07316352c..652e72d030bb0 100644 |
4549 |
+--- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c |
4550 |
++++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c |
4551 |
+@@ -265,7 +265,9 @@ static int meson_handle_cipher_request(struct crypto_engine *engine, |
4552 |
+ struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); |
4553 |
+ |
4554 |
+ err = meson_cipher(breq); |
4555 |
++ local_bh_disable(); |
4556 |
+ crypto_finalize_skcipher_request(engine, breq, err); |
4557 |
++ local_bh_enable(); |
4558 |
+ |
4559 |
+ return 0; |
4560 |
+ } |
4561 |
+diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c |
4562 |
+index 0770a83bf1a57..b3eea329f840f 100644 |
4563 |
+--- a/drivers/crypto/ccp/ccp-dmaengine.c |
4564 |
++++ b/drivers/crypto/ccp/ccp-dmaengine.c |
4565 |
+@@ -633,6 +633,20 @@ static int ccp_terminate_all(struct dma_chan *dma_chan) |
4566 |
+ return 0; |
4567 |
+ } |
4568 |
+ |
4569 |
++static void ccp_dma_release(struct ccp_device *ccp) |
4570 |
++{ |
4571 |
++ struct ccp_dma_chan *chan; |
4572 |
++ struct dma_chan *dma_chan; |
4573 |
++ unsigned int i; |
4574 |
++ |
4575 |
++ for (i = 0; i < ccp->cmd_q_count; i++) { |
4576 |
++ chan = ccp->ccp_dma_chan + i; |
4577 |
++ dma_chan = &chan->dma_chan; |
4578 |
++ tasklet_kill(&chan->cleanup_tasklet); |
4579 |
++ list_del_rcu(&dma_chan->device_node); |
4580 |
++ } |
4581 |
++} |
4582 |
++ |
4583 |
+ int ccp_dmaengine_register(struct ccp_device *ccp) |
4584 |
+ { |
4585 |
+ struct ccp_dma_chan *chan; |
4586 |
+@@ -737,6 +751,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp) |
4587 |
+ return 0; |
4588 |
+ |
4589 |
+ err_reg: |
4590 |
++ ccp_dma_release(ccp); |
4591 |
+ kmem_cache_destroy(ccp->dma_desc_cache); |
4592 |
+ |
4593 |
+ err_cache: |
4594 |
+@@ -753,6 +768,7 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp) |
4595 |
+ return; |
4596 |
+ |
4597 |
+ dma_async_device_unregister(dma_dev); |
4598 |
++ ccp_dma_release(ccp); |
4599 |
+ |
4600 |
+ kmem_cache_destroy(ccp->dma_desc_cache); |
4601 |
+ kmem_cache_destroy(ccp->dma_cmd_cache); |
4602 |
+diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc_buffer_mgr.c |
4603 |
+index a5e041d9d2cf1..11e0278c8631d 100644 |
4604 |
+--- a/drivers/crypto/ccree/cc_buffer_mgr.c |
4605 |
++++ b/drivers/crypto/ccree/cc_buffer_mgr.c |
4606 |
+@@ -258,6 +258,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg, |
4607 |
+ { |
4608 |
+ int ret = 0; |
4609 |
+ |
4610 |
++ if (!nbytes) { |
4611 |
++ *mapped_nents = 0; |
4612 |
++ *lbytes = 0; |
4613 |
++ *nents = 0; |
4614 |
++ return 0; |
4615 |
++ } |
4616 |
++ |
4617 |
+ *nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes); |
4618 |
+ if (*nents > max_sg_nents) { |
4619 |
+ *nents = 0; |
4620 |
+diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c |
4621 |
+index dafa6577a8451..c289e4d5cbdc0 100644 |
4622 |
+--- a/drivers/crypto/ccree/cc_cipher.c |
4623 |
++++ b/drivers/crypto/ccree/cc_cipher.c |
4624 |
+@@ -254,8 +254,8 @@ static void cc_cipher_exit(struct crypto_tfm *tfm) |
4625 |
+ &ctx_p->user.key_dma_addr); |
4626 |
+ |
4627 |
+ /* Free key buffer in context */ |
4628 |
+- kfree_sensitive(ctx_p->user.key); |
4629 |
+ dev_dbg(dev, "Free key buffer in context. key=@%p\n", ctx_p->user.key); |
4630 |
++ kfree_sensitive(ctx_p->user.key); |
4631 |
+ } |
4632 |
+ |
4633 |
+ struct tdes_keys { |
4634 |
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
4635 |
+index 5edc91cdb4e65..a9d3e675f7ff4 100644 |
4636 |
+--- a/drivers/crypto/mxs-dcp.c |
4637 |
++++ b/drivers/crypto/mxs-dcp.c |
4638 |
+@@ -330,7 +330,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
4639 |
+ memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128); |
4640 |
+ } |
4641 |
+ |
4642 |
+- for_each_sg(req->src, src, sg_nents(src), i) { |
4643 |
++ for_each_sg(req->src, src, sg_nents(req->src), i) { |
4644 |
+ src_buf = sg_virt(src); |
4645 |
+ len = sg_dma_len(src); |
4646 |
+ tlen += len; |
4647 |
+diff --git a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c |
4648 |
+index 1cece1a7d3f00..5bbf0d2722e11 100644 |
4649 |
+--- a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c |
4650 |
++++ b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c |
4651 |
+@@ -506,7 +506,6 @@ struct rk_crypto_tmp rk_ecb_des3_ede_alg = { |
4652 |
+ .exit = rk_ablk_exit_tfm, |
4653 |
+ .min_keysize = DES3_EDE_KEY_SIZE, |
4654 |
+ .max_keysize = DES3_EDE_KEY_SIZE, |
4655 |
+- .ivsize = DES_BLOCK_SIZE, |
4656 |
+ .setkey = rk_tdes_setkey, |
4657 |
+ .encrypt = rk_des3_ede_ecb_encrypt, |
4658 |
+ .decrypt = rk_des3_ede_ecb_decrypt, |
4659 |
+diff --git a/drivers/crypto/vmx/Kconfig b/drivers/crypto/vmx/Kconfig |
4660 |
+index c85fab7ef0bdd..b2c28b87f14b3 100644 |
4661 |
+--- a/drivers/crypto/vmx/Kconfig |
4662 |
++++ b/drivers/crypto/vmx/Kconfig |
4663 |
+@@ -2,7 +2,11 @@ |
4664 |
+ config CRYPTO_DEV_VMX_ENCRYPT |
4665 |
+ tristate "Encryption acceleration support on P8 CPU" |
4666 |
+ depends on CRYPTO_DEV_VMX |
4667 |
++ select CRYPTO_AES |
4668 |
++ select CRYPTO_CBC |
4669 |
++ select CRYPTO_CTR |
4670 |
+ select CRYPTO_GHASH |
4671 |
++ select CRYPTO_XTS |
4672 |
+ default m |
4673 |
+ help |
4674 |
+ Support for VMX cryptographic acceleration instructions on Power8 CPU. |
4675 |
+diff --git a/drivers/dax/super.c b/drivers/dax/super.c |
4676 |
+index cadbd0a1a1ef0..260a247c60d2d 100644 |
4677 |
+--- a/drivers/dax/super.c |
4678 |
++++ b/drivers/dax/super.c |
4679 |
+@@ -723,6 +723,7 @@ static int dax_fs_init(void) |
4680 |
+ static void dax_fs_exit(void) |
4681 |
+ { |
4682 |
+ kern_unmount(dax_mnt); |
4683 |
++ rcu_barrier(); |
4684 |
+ kmem_cache_destroy(dax_cache); |
4685 |
+ } |
4686 |
+ |
4687 |
+diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c |
4688 |
+index db732f71e59ad..cfbf10128aaed 100644 |
4689 |
+--- a/drivers/dma-buf/udmabuf.c |
4690 |
++++ b/drivers/dma-buf/udmabuf.c |
4691 |
+@@ -181,6 +181,10 @@ static long udmabuf_create(struct miscdevice *device, |
4692 |
+ if (ubuf->pagecount > pglimit) |
4693 |
+ goto err; |
4694 |
+ } |
4695 |
++ |
4696 |
++ if (!ubuf->pagecount) |
4697 |
++ goto err; |
4698 |
++ |
4699 |
+ ubuf->pages = kmalloc_array(ubuf->pagecount, sizeof(*ubuf->pages), |
4700 |
+ GFP_KERNEL); |
4701 |
+ if (!ubuf->pages) { |
4702 |
+diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c |
4703 |
+index e1a958ae79254..3e83769615d1c 100644 |
4704 |
+--- a/drivers/dma/hisi_dma.c |
4705 |
++++ b/drivers/dma/hisi_dma.c |
4706 |
+@@ -30,7 +30,7 @@ |
4707 |
+ #define HISI_DMA_MODE 0x217c |
4708 |
+ #define HISI_DMA_OFFSET 0x100 |
4709 |
+ |
4710 |
+-#define HISI_DMA_MSI_NUM 30 |
4711 |
++#define HISI_DMA_MSI_NUM 32 |
4712 |
+ #define HISI_DMA_CHAN_NUM 30 |
4713 |
+ #define HISI_DMA_Q_DEPTH_VAL 1024 |
4714 |
+ |
4715 |
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
4716 |
+index dfbf514188f37..6dca548f4dab1 100644 |
4717 |
+--- a/drivers/dma/pl330.c |
4718 |
++++ b/drivers/dma/pl330.c |
4719 |
+@@ -3199,7 +3199,7 @@ probe_err2: |
4720 |
+ return ret; |
4721 |
+ } |
4722 |
+ |
4723 |
+-static int pl330_remove(struct amba_device *adev) |
4724 |
++static void pl330_remove(struct amba_device *adev) |
4725 |
+ { |
4726 |
+ struct pl330_dmac *pl330 = amba_get_drvdata(adev); |
4727 |
+ struct dma_pl330_chan *pch, *_p; |
4728 |
+@@ -3239,7 +3239,6 @@ static int pl330_remove(struct amba_device *adev) |
4729 |
+ |
4730 |
+ if (pl330->rstc) |
4731 |
+ reset_control_assert(pl330->rstc); |
4732 |
+- return 0; |
4733 |
+ } |
4734 |
+ |
4735 |
+ static const struct amba_id pl330_ids[] = { |
4736 |
+diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c |
4737 |
+index 0ef086e43090b..7e771c56c13c6 100644 |
4738 |
+--- a/drivers/firmware/efi/efi-pstore.c |
4739 |
++++ b/drivers/firmware/efi/efi-pstore.c |
4740 |
+@@ -266,7 +266,7 @@ static int efi_pstore_write(struct pstore_record *record) |
4741 |
+ efi_name[i] = name[i]; |
4742 |
+ |
4743 |
+ ret = efivar_entry_set_safe(efi_name, vendor, PSTORE_EFI_ATTRIBUTES, |
4744 |
+- preemptible(), record->size, record->psi->buf); |
4745 |
++ false, record->size, record->psi->buf); |
4746 |
+ |
4747 |
+ if (record->reason == KMSG_DUMP_OOPS && try_module_get(THIS_MODULE)) |
4748 |
+ if (!schedule_work(&efivar_work)) |
4749 |
+diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig |
4750 |
+index 931544c9f63d4..983e07dc022ed 100644 |
4751 |
+--- a/drivers/firmware/google/Kconfig |
4752 |
++++ b/drivers/firmware/google/Kconfig |
4753 |
+@@ -21,7 +21,7 @@ config GOOGLE_SMI |
4754 |
+ |
4755 |
+ config GOOGLE_COREBOOT_TABLE |
4756 |
+ tristate "Coreboot Table Access" |
4757 |
+- depends on ACPI || OF |
4758 |
++ depends on HAS_IOMEM && (ACPI || OF) |
4759 |
+ help |
4760 |
+ This option enables the coreboot_table module, which provides other |
4761 |
+ firmware modules access to the coreboot table. The coreboot table |
4762 |
+diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c |
4763 |
+index e10a99860ca4b..d417199f8fe94 100644 |
4764 |
+--- a/drivers/firmware/qcom_scm.c |
4765 |
++++ b/drivers/firmware/qcom_scm.c |
4766 |
+@@ -749,12 +749,6 @@ int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) |
4767 |
+ }; |
4768 |
+ int ret; |
4769 |
+ |
4770 |
+- desc.args[0] = addr; |
4771 |
+- desc.args[1] = size; |
4772 |
+- desc.args[2] = spare; |
4773 |
+- desc.arginfo = QCOM_SCM_ARGS(3, QCOM_SCM_RW, QCOM_SCM_VAL, |
4774 |
+- QCOM_SCM_VAL); |
4775 |
+- |
4776 |
+ ret = qcom_scm_call(__scm->dev, &desc, NULL); |
4777 |
+ |
4778 |
+ /* the pg table has been initialized already, ignore the error */ |
4779 |
+diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c |
4780 |
+index 2a7687911c097..53c7e3f8cfde2 100644 |
4781 |
+--- a/drivers/firmware/stratix10-svc.c |
4782 |
++++ b/drivers/firmware/stratix10-svc.c |
4783 |
+@@ -477,7 +477,7 @@ static int svc_normal_to_secure_thread(void *data) |
4784 |
+ case INTEL_SIP_SMC_RSU_ERROR: |
4785 |
+ pr_err("%s: STATUS_ERROR\n", __func__); |
4786 |
+ cbdata->status = BIT(SVC_STATUS_ERROR); |
4787 |
+- cbdata->kaddr1 = NULL; |
4788 |
++ cbdata->kaddr1 = &res.a1; |
4789 |
+ cbdata->kaddr2 = NULL; |
4790 |
+ cbdata->kaddr3 = NULL; |
4791 |
+ pdata->chan->scl->receive_cb(pdata->chan->scl, cbdata); |
4792 |
+diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c |
4793 |
+index dbad73162c833..87edc77260d20 100644 |
4794 |
+--- a/drivers/fsi/fsi-master-aspeed.c |
4795 |
++++ b/drivers/fsi/fsi-master-aspeed.c |
4796 |
+@@ -525,7 +525,6 @@ static int tacoma_cabled_fsi_fixup(struct device *dev) |
4797 |
+ static int fsi_master_aspeed_probe(struct platform_device *pdev) |
4798 |
+ { |
4799 |
+ struct fsi_master_aspeed *aspeed; |
4800 |
+- struct resource *res; |
4801 |
+ int rc, links, reg; |
4802 |
+ __be32 raw; |
4803 |
+ |
4804 |
+@@ -535,26 +534,28 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) |
4805 |
+ return rc; |
4806 |
+ } |
4807 |
+ |
4808 |
+- aspeed = devm_kzalloc(&pdev->dev, sizeof(*aspeed), GFP_KERNEL); |
4809 |
++ aspeed = kzalloc(sizeof(*aspeed), GFP_KERNEL); |
4810 |
+ if (!aspeed) |
4811 |
+ return -ENOMEM; |
4812 |
+ |
4813 |
+ aspeed->dev = &pdev->dev; |
4814 |
+ |
4815 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
4816 |
+- aspeed->base = devm_ioremap_resource(&pdev->dev, res); |
4817 |
+- if (IS_ERR(aspeed->base)) |
4818 |
+- return PTR_ERR(aspeed->base); |
4819 |
++ aspeed->base = devm_platform_ioremap_resource(pdev, 0); |
4820 |
++ if (IS_ERR(aspeed->base)) { |
4821 |
++ rc = PTR_ERR(aspeed->base); |
4822 |
++ goto err_free_aspeed; |
4823 |
++ } |
4824 |
+ |
4825 |
+ aspeed->clk = devm_clk_get(aspeed->dev, NULL); |
4826 |
+ if (IS_ERR(aspeed->clk)) { |
4827 |
+ dev_err(aspeed->dev, "couldn't get clock\n"); |
4828 |
+- return PTR_ERR(aspeed->clk); |
4829 |
++ rc = PTR_ERR(aspeed->clk); |
4830 |
++ goto err_free_aspeed; |
4831 |
+ } |
4832 |
+ rc = clk_prepare_enable(aspeed->clk); |
4833 |
+ if (rc) { |
4834 |
+ dev_err(aspeed->dev, "couldn't enable clock\n"); |
4835 |
+- return rc; |
4836 |
++ goto err_free_aspeed; |
4837 |
+ } |
4838 |
+ |
4839 |
+ rc = setup_cfam_reset(aspeed); |
4840 |
+@@ -589,7 +590,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) |
4841 |
+ rc = opb_readl(aspeed, ctrl_base + FSI_MVER, &raw); |
4842 |
+ if (rc) { |
4843 |
+ dev_err(&pdev->dev, "failed to read hub version\n"); |
4844 |
+- return rc; |
4845 |
++ goto err_release; |
4846 |
+ } |
4847 |
+ |
4848 |
+ reg = be32_to_cpu(raw); |
4849 |
+@@ -628,6 +629,8 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) |
4850 |
+ |
4851 |
+ err_release: |
4852 |
+ clk_disable_unprepare(aspeed->clk); |
4853 |
++err_free_aspeed: |
4854 |
++ kfree(aspeed); |
4855 |
+ return rc; |
4856 |
+ } |
4857 |
+ |
4858 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
4859 |
+index 6c8f141103da4..e828f9414ba2c 100644 |
4860 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
4861 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
4862 |
+@@ -6396,6 +6396,9 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, |
4863 |
+ mode = amdgpu_dm_create_common_mode(encoder, |
4864 |
+ common_modes[i].name, common_modes[i].w, |
4865 |
+ common_modes[i].h); |
4866 |
++ if (!mode) |
4867 |
++ continue; |
4868 |
++ |
4869 |
+ drm_mode_probed_add(connector, mode); |
4870 |
+ amdgpu_dm_connector->num_modes++; |
4871 |
+ } |
4872 |
+@@ -8612,10 +8615,13 @@ static int dm_update_plane_state(struct dc *dc, |
4873 |
+ static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm_crtc *crtc) |
4874 |
+ { |
4875 |
+ struct drm_connector *connector; |
4876 |
+- struct drm_connector_state *conn_state; |
4877 |
++ struct drm_connector_state *conn_state, *old_conn_state; |
4878 |
+ struct amdgpu_dm_connector *aconnector = NULL; |
4879 |
+ int i; |
4880 |
+- for_each_new_connector_in_state(state, connector, conn_state, i) { |
4881 |
++ for_each_oldnew_connector_in_state(state, connector, old_conn_state, conn_state, i) { |
4882 |
++ if (!conn_state->crtc) |
4883 |
++ conn_state = old_conn_state; |
4884 |
++ |
4885 |
+ if (conn_state->crtc != crtc) |
4886 |
+ continue; |
4887 |
+ |
4888 |
+diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c |
4889 |
+index 0e0f494fbb5e1..b037fd57fd366 100644 |
4890 |
+--- a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c |
4891 |
++++ b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c |
4892 |
+@@ -227,14 +227,6 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { |
4893 |
+ .funcs = &pflip_irq_info_funcs\ |
4894 |
+ } |
4895 |
+ |
4896 |
+-#define vupdate_int_entry(reg_num)\ |
4897 |
+- [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ |
4898 |
+- IRQ_REG_ENTRY(OTG, reg_num,\ |
4899 |
+- OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ |
4900 |
+- OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ |
4901 |
+- .funcs = &vblank_irq_info_funcs\ |
4902 |
+- } |
4903 |
+- |
4904 |
+ /* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic |
4905 |
+ * of DCE's DC_IRQ_SOURCE_VUPDATEx. |
4906 |
+ */ |
4907 |
+@@ -348,12 +340,6 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { |
4908 |
+ dc_underflow_int_entry(6), |
4909 |
+ [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), |
4910 |
+ [DC_IRQ_SOURCE_VBIOS_SW] = dummy_irq_entry(), |
4911 |
+- vupdate_int_entry(0), |
4912 |
+- vupdate_int_entry(1), |
4913 |
+- vupdate_int_entry(2), |
4914 |
+- vupdate_int_entry(3), |
4915 |
+- vupdate_int_entry(4), |
4916 |
+- vupdate_int_entry(5), |
4917 |
+ vupdate_no_lock_int_entry(0), |
4918 |
+ vupdate_no_lock_int_entry(1), |
4919 |
+ vupdate_no_lock_int_entry(2), |
4920 |
+diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c |
4921 |
+index 49109614510b8..5abb68017f6ed 100644 |
4922 |
+--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c |
4923 |
++++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c |
4924 |
+@@ -2098,8 +2098,8 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ |
4925 |
+ } |
4926 |
+ } |
4927 |
+ |
4928 |
+- /* setting should not be allowed from VF */ |
4929 |
+- if (amdgpu_sriov_vf(adev)) { |
4930 |
++ /* setting should not be allowed from VF if not in one VF mode */ |
4931 |
++ if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev)) { |
4932 |
+ dev_attr->attr.mode &= ~S_IWUGO; |
4933 |
+ dev_attr->store = NULL; |
4934 |
+ } |
4935 |
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c |
4936 |
+index e5893218fa4bb..ee27970cfff95 100644 |
4937 |
+--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c |
4938 |
++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c |
4939 |
+@@ -115,7 +115,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu, |
4940 |
+ uint32_t *min, |
4941 |
+ uint32_t *max) |
4942 |
+ { |
4943 |
+- int ret = 0; |
4944 |
++ int ret = -ENOTSUPP; |
4945 |
+ |
4946 |
+ if (!min && !max) |
4947 |
+ return -EINVAL; |
4948 |
+diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h |
4949 |
+index a9bb734366ae6..a0f6ee15c2485 100644 |
4950 |
+--- a/drivers/gpu/drm/bridge/adv7511/adv7511.h |
4951 |
++++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h |
4952 |
+@@ -169,6 +169,7 @@ |
4953 |
+ #define ADV7511_PACKET_ENABLE_SPARE2 BIT(1) |
4954 |
+ #define ADV7511_PACKET_ENABLE_SPARE1 BIT(0) |
4955 |
+ |
4956 |
++#define ADV7535_REG_POWER2_HPD_OVERRIDE BIT(6) |
4957 |
+ #define ADV7511_REG_POWER2_HPD_SRC_MASK 0xc0 |
4958 |
+ #define ADV7511_REG_POWER2_HPD_SRC_BOTH 0x00 |
4959 |
+ #define ADV7511_REG_POWER2_HPD_SRC_HPD 0x40 |
4960 |
+diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c |
4961 |
+index a0d392c338da5..c6f059be4b897 100644 |
4962 |
+--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c |
4963 |
++++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c |
4964 |
+@@ -351,11 +351,17 @@ static void __adv7511_power_on(struct adv7511 *adv7511) |
4965 |
+ * from standby or are enabled. When the HPD goes low the adv7511 is |
4966 |
+ * reset and the outputs are disabled which might cause the monitor to |
4967 |
+ * go to standby again. To avoid this we ignore the HPD pin for the |
4968 |
+- * first few seconds after enabling the output. |
4969 |
++ * first few seconds after enabling the output. On the other hand |
4970 |
++ * adv7535 require to enable HPD Override bit for proper HPD. |
4971 |
+ */ |
4972 |
+- regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
4973 |
+- ADV7511_REG_POWER2_HPD_SRC_MASK, |
4974 |
+- ADV7511_REG_POWER2_HPD_SRC_NONE); |
4975 |
++ if (adv7511->type == ADV7535) |
4976 |
++ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
4977 |
++ ADV7535_REG_POWER2_HPD_OVERRIDE, |
4978 |
++ ADV7535_REG_POWER2_HPD_OVERRIDE); |
4979 |
++ else |
4980 |
++ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
4981 |
++ ADV7511_REG_POWER2_HPD_SRC_MASK, |
4982 |
++ ADV7511_REG_POWER2_HPD_SRC_NONE); |
4983 |
+ } |
4984 |
+ |
4985 |
+ static void adv7511_power_on(struct adv7511 *adv7511) |
4986 |
+@@ -375,6 +381,10 @@ static void adv7511_power_on(struct adv7511 *adv7511) |
4987 |
+ static void __adv7511_power_off(struct adv7511 *adv7511) |
4988 |
+ { |
4989 |
+ /* TODO: setup additional power down modes */ |
4990 |
++ if (adv7511->type == ADV7535) |
4991 |
++ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
4992 |
++ ADV7535_REG_POWER2_HPD_OVERRIDE, 0); |
4993 |
++ |
4994 |
+ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, |
4995 |
+ ADV7511_POWER_POWER_DOWN, |
4996 |
+ ADV7511_POWER_POWER_DOWN); |
4997 |
+@@ -672,9 +682,14 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector) |
4998 |
+ status = connector_status_disconnected; |
4999 |
+ } else { |
5000 |
+ /* Renable HPD sensing */ |
5001 |
+- regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
5002 |
+- ADV7511_REG_POWER2_HPD_SRC_MASK, |
5003 |
+- ADV7511_REG_POWER2_HPD_SRC_BOTH); |
5004 |
++ if (adv7511->type == ADV7535) |
5005 |
++ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
5006 |
++ ADV7535_REG_POWER2_HPD_OVERRIDE, |
5007 |
++ ADV7535_REG_POWER2_HPD_OVERRIDE); |
5008 |
++ else |
5009 |
++ regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, |
5010 |
++ ADV7511_REG_POWER2_HPD_SRC_MASK, |
5011 |
++ ADV7511_REG_POWER2_HPD_SRC_BOTH); |
5012 |
+ } |
5013 |
+ |
5014 |
+ adv7511->status = status; |
5015 |
+diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c |
5016 |
+index b31281f76117c..0ced08d81d7a2 100644 |
5017 |
+--- a/drivers/gpu/drm/bridge/cdns-dsi.c |
5018 |
++++ b/drivers/gpu/drm/bridge/cdns-dsi.c |
5019 |
+@@ -1286,6 +1286,7 @@ static const struct of_device_id cdns_dsi_of_match[] = { |
5020 |
+ { .compatible = "cdns,dsi" }, |
5021 |
+ { }, |
5022 |
+ }; |
5023 |
++MODULE_DEVICE_TABLE(of, cdns_dsi_of_match); |
5024 |
+ |
5025 |
+ static struct platform_driver cdns_dsi_platform_driver = { |
5026 |
+ .probe = cdns_dsi_drm_probe, |
5027 |
+diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c |
5028 |
+index 6cac2e58cd15f..b68d335981588 100644 |
5029 |
+--- a/drivers/gpu/drm/bridge/nwl-dsi.c |
5030 |
++++ b/drivers/gpu/drm/bridge/nwl-dsi.c |
5031 |
+@@ -1188,6 +1188,7 @@ static int nwl_dsi_probe(struct platform_device *pdev) |
5032 |
+ |
5033 |
+ ret = nwl_dsi_select_input(dsi); |
5034 |
+ if (ret < 0) { |
5035 |
++ pm_runtime_disable(dev); |
5036 |
+ mipi_dsi_host_unregister(&dsi->dsi_host); |
5037 |
+ return ret; |
5038 |
+ } |
5039 |
+diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c |
5040 |
+index 843265d7f1b12..ec7745c31da07 100644 |
5041 |
+--- a/drivers/gpu/drm/bridge/sil-sii8620.c |
5042 |
++++ b/drivers/gpu/drm/bridge/sil-sii8620.c |
5043 |
+@@ -2120,7 +2120,7 @@ static void sii8620_init_rcp_input_dev(struct sii8620 *ctx) |
5044 |
+ if (ret) { |
5045 |
+ dev_err(ctx->dev, "Failed to register RC device\n"); |
5046 |
+ ctx->error = ret; |
5047 |
+- rc_free_device(ctx->rc_dev); |
5048 |
++ rc_free_device(rc_dev); |
5049 |
+ return; |
5050 |
+ } |
5051 |
+ ctx->rc_dev = rc_dev; |
5052 |
+diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
5053 |
+index 29c0eb4bd7546..b10228b9e3a93 100644 |
5054 |
+--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
5055 |
++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |
5056 |
+@@ -2566,8 +2566,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, |
5057 |
+ if (!output_fmts) |
5058 |
+ return NULL; |
5059 |
+ |
5060 |
+- /* If dw-hdmi is the only bridge, avoid negociating with ourselves */ |
5061 |
+- if (list_is_singular(&bridge->encoder->bridge_chain)) { |
5062 |
++ /* If dw-hdmi is the first or only bridge, avoid negociating with ourselves */ |
5063 |
++ if (list_is_singular(&bridge->encoder->bridge_chain) || |
5064 |
++ list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain)) { |
5065 |
+ *num_output_fmts = 1; |
5066 |
+ output_fmts[0] = MEDIA_BUS_FMT_FIXED; |
5067 |
+ |
5068 |
+diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c |
5069 |
+index 6b268f9445b36..376fa6eb46f69 100644 |
5070 |
+--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c |
5071 |
++++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c |
5072 |
+@@ -1172,6 +1172,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev, |
5073 |
+ ret = mipi_dsi_host_register(&dsi->dsi_host); |
5074 |
+ if (ret) { |
5075 |
+ dev_err(dev, "Failed to register MIPI host: %d\n", ret); |
5076 |
++ pm_runtime_disable(dev); |
5077 |
+ dw_mipi_dsi_debugfs_remove(dsi); |
5078 |
+ return ERR_PTR(ret); |
5079 |
+ } |
5080 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
5081 |
+index 3d7593ea79f14..862e173d34315 100644 |
5082 |
+--- a/drivers/gpu/drm/drm_edid.c |
5083 |
++++ b/drivers/gpu/drm/drm_edid.c |
5084 |
+@@ -4806,7 +4806,8 @@ bool drm_detect_monitor_audio(struct edid *edid) |
5085 |
+ if (!edid_ext) |
5086 |
+ goto end; |
5087 |
+ |
5088 |
+- has_audio = ((edid_ext[3] & EDID_BASIC_AUDIO) != 0); |
5089 |
++ has_audio = (edid_ext[0] == CEA_EXT && |
5090 |
++ (edid_ext[3] & EDID_BASIC_AUDIO) != 0); |
5091 |
+ |
5092 |
+ if (has_audio) { |
5093 |
+ DRM_DEBUG_KMS("Monitor has basic audio support\n"); |
5094 |
+@@ -4959,16 +4960,8 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, |
5095 |
+ connector->name, dc_bpc); |
5096 |
+ info->bpc = dc_bpc; |
5097 |
+ |
5098 |
+- /* |
5099 |
+- * Deep color support mandates RGB444 support for all video |
5100 |
+- * modes and forbids YCRCB422 support for all video modes per |
5101 |
+- * HDMI 1.3 spec. |
5102 |
+- */ |
5103 |
+- info->color_formats = DRM_COLOR_FORMAT_RGB444; |
5104 |
+- |
5105 |
+ /* YCRCB444 is optional according to spec. */ |
5106 |
+ if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) { |
5107 |
+- info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; |
5108 |
+ DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n", |
5109 |
+ connector->name); |
5110 |
+ } |
5111 |
+diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c |
5112 |
+index abff2d6cedd12..6d083b98f6ae6 100644 |
5113 |
+--- a/drivers/gpu/drm/i915/display/intel_opregion.c |
5114 |
++++ b/drivers/gpu/drm/i915/display/intel_opregion.c |
5115 |
+@@ -376,6 +376,21 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, |
5116 |
+ return -EINVAL; |
5117 |
+ } |
5118 |
+ |
5119 |
++ /* |
5120 |
++ * The port numbering and mapping here is bizarre. The now-obsolete |
5121 |
++ * swsci spec supports ports numbered [0..4]. Port E is handled as a |
5122 |
++ * special case, but port F and beyond are not. The functionality is |
5123 |
++ * supposed to be obsolete for new platforms. Just bail out if the port |
5124 |
++ * number is out of bounds after mapping. |
5125 |
++ */ |
5126 |
++ if (port > 4) { |
5127 |
++ drm_dbg_kms(&dev_priv->drm, |
5128 |
++ "[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n", |
5129 |
++ intel_encoder->base.base.id, intel_encoder->base.name, |
5130 |
++ port_name(intel_encoder->port), port); |
5131 |
++ return -EINVAL; |
5132 |
++ } |
5133 |
++ |
5134 |
+ if (!enable) |
5135 |
+ parm |= 4 << 8; |
5136 |
+ |
5137 |
+diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c |
5138 |
+index 5754bccff4d15..92dd65befbcb8 100644 |
5139 |
+--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c |
5140 |
++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c |
5141 |
+@@ -423,7 +423,7 @@ vm_access(struct vm_area_struct *area, unsigned long addr, |
5142 |
+ return -EACCES; |
5143 |
+ |
5144 |
+ addr -= area->vm_start; |
5145 |
+- if (addr >= obj->base.size) |
5146 |
++ if (range_overflows_t(u64, addr, len, obj->base.size)) |
5147 |
+ return -EINVAL; |
5148 |
+ |
5149 |
+ /* As this is primarily for debugging, let's focus on simplicity */ |
5150 |
+diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c |
5151 |
+index 2753067c08e68..728fea5094124 100644 |
5152 |
+--- a/drivers/gpu/drm/meson/meson_drv.c |
5153 |
++++ b/drivers/gpu/drm/meson/meson_drv.c |
5154 |
+@@ -396,10 +396,8 @@ static void meson_drv_unbind(struct device *dev) |
5155 |
+ drm_irq_uninstall(drm); |
5156 |
+ drm_dev_put(drm); |
5157 |
+ |
5158 |
+- if (priv->afbcd.ops) { |
5159 |
+- priv->afbcd.ops->reset(priv); |
5160 |
+- meson_rdma_free(priv); |
5161 |
+- } |
5162 |
++ if (priv->afbcd.ops) |
5163 |
++ priv->afbcd.ops->exit(priv); |
5164 |
+ } |
5165 |
+ |
5166 |
+ static const struct component_master_ops meson_drv_master_ops = { |
5167 |
+diff --git a/drivers/gpu/drm/meson/meson_osd_afbcd.c b/drivers/gpu/drm/meson/meson_osd_afbcd.c |
5168 |
+index ffc6b584dbf85..0cdbe899402f8 100644 |
5169 |
+--- a/drivers/gpu/drm/meson/meson_osd_afbcd.c |
5170 |
++++ b/drivers/gpu/drm/meson/meson_osd_afbcd.c |
5171 |
+@@ -79,11 +79,6 @@ static bool meson_gxm_afbcd_supported_fmt(u64 modifier, uint32_t format) |
5172 |
+ return meson_gxm_afbcd_pixel_fmt(modifier, format) >= 0; |
5173 |
+ } |
5174 |
+ |
5175 |
+-static int meson_gxm_afbcd_init(struct meson_drm *priv) |
5176 |
+-{ |
5177 |
+- return 0; |
5178 |
+-} |
5179 |
+- |
5180 |
+ static int meson_gxm_afbcd_reset(struct meson_drm *priv) |
5181 |
+ { |
5182 |
+ writel_relaxed(VIU_SW_RESET_OSD1_AFBCD, |
5183 |
+@@ -93,6 +88,16 @@ static int meson_gxm_afbcd_reset(struct meson_drm *priv) |
5184 |
+ return 0; |
5185 |
+ } |
5186 |
+ |
5187 |
++static int meson_gxm_afbcd_init(struct meson_drm *priv) |
5188 |
++{ |
5189 |
++ return 0; |
5190 |
++} |
5191 |
++ |
5192 |
++static void meson_gxm_afbcd_exit(struct meson_drm *priv) |
5193 |
++{ |
5194 |
++ meson_gxm_afbcd_reset(priv); |
5195 |
++} |
5196 |
++ |
5197 |
+ static int meson_gxm_afbcd_enable(struct meson_drm *priv) |
5198 |
+ { |
5199 |
+ writel_relaxed(FIELD_PREP(OSD1_AFBCD_ID_FIFO_THRD, 0x40) | |
5200 |
+@@ -172,6 +177,7 @@ static int meson_gxm_afbcd_setup(struct meson_drm *priv) |
5201 |
+ |
5202 |
+ struct meson_afbcd_ops meson_afbcd_gxm_ops = { |
5203 |
+ .init = meson_gxm_afbcd_init, |
5204 |
++ .exit = meson_gxm_afbcd_exit, |
5205 |
+ .reset = meson_gxm_afbcd_reset, |
5206 |
+ .enable = meson_gxm_afbcd_enable, |
5207 |
+ .disable = meson_gxm_afbcd_disable, |
5208 |
+@@ -269,6 +275,18 @@ static bool meson_g12a_afbcd_supported_fmt(u64 modifier, uint32_t format) |
5209 |
+ return meson_g12a_afbcd_pixel_fmt(modifier, format) >= 0; |
5210 |
+ } |
5211 |
+ |
5212 |
++static int meson_g12a_afbcd_reset(struct meson_drm *priv) |
5213 |
++{ |
5214 |
++ meson_rdma_reset(priv); |
5215 |
++ |
5216 |
++ meson_rdma_writel_sync(priv, VIU_SW_RESET_G12A_AFBC_ARB | |
5217 |
++ VIU_SW_RESET_G12A_OSD1_AFBCD, |
5218 |
++ VIU_SW_RESET); |
5219 |
++ meson_rdma_writel_sync(priv, 0, VIU_SW_RESET); |
5220 |
++ |
5221 |
++ return 0; |
5222 |
++} |
5223 |
++ |
5224 |
+ static int meson_g12a_afbcd_init(struct meson_drm *priv) |
5225 |
+ { |
5226 |
+ int ret; |
5227 |
+@@ -286,16 +304,10 @@ static int meson_g12a_afbcd_init(struct meson_drm *priv) |
5228 |
+ return 0; |
5229 |
+ } |
5230 |
+ |
5231 |
+-static int meson_g12a_afbcd_reset(struct meson_drm *priv) |
5232 |
++static void meson_g12a_afbcd_exit(struct meson_drm *priv) |
5233 |
+ { |
5234 |
+- meson_rdma_reset(priv); |
5235 |
+- |
5236 |
+- meson_rdma_writel_sync(priv, VIU_SW_RESET_G12A_AFBC_ARB | |
5237 |
+- VIU_SW_RESET_G12A_OSD1_AFBCD, |
5238 |
+- VIU_SW_RESET); |
5239 |
+- meson_rdma_writel_sync(priv, 0, VIU_SW_RESET); |
5240 |
+- |
5241 |
+- return 0; |
5242 |
++ meson_g12a_afbcd_reset(priv); |
5243 |
++ meson_rdma_free(priv); |
5244 |
+ } |
5245 |
+ |
5246 |
+ static int meson_g12a_afbcd_enable(struct meson_drm *priv) |
5247 |
+@@ -380,6 +392,7 @@ static int meson_g12a_afbcd_setup(struct meson_drm *priv) |
5248 |
+ |
5249 |
+ struct meson_afbcd_ops meson_afbcd_g12a_ops = { |
5250 |
+ .init = meson_g12a_afbcd_init, |
5251 |
++ .exit = meson_g12a_afbcd_exit, |
5252 |
+ .reset = meson_g12a_afbcd_reset, |
5253 |
+ .enable = meson_g12a_afbcd_enable, |
5254 |
+ .disable = meson_g12a_afbcd_disable, |
5255 |
+diff --git a/drivers/gpu/drm/meson/meson_osd_afbcd.h b/drivers/gpu/drm/meson/meson_osd_afbcd.h |
5256 |
+index 5e5523304f42f..e77ddeb6416f3 100644 |
5257 |
+--- a/drivers/gpu/drm/meson/meson_osd_afbcd.h |
5258 |
++++ b/drivers/gpu/drm/meson/meson_osd_afbcd.h |
5259 |
+@@ -14,6 +14,7 @@ |
5260 |
+ |
5261 |
+ struct meson_afbcd_ops { |
5262 |
+ int (*init)(struct meson_drm *priv); |
5263 |
++ void (*exit)(struct meson_drm *priv); |
5264 |
+ int (*reset)(struct meson_drm *priv); |
5265 |
+ int (*enable)(struct meson_drm *priv); |
5266 |
+ int (*disable)(struct meson_drm *priv); |
5267 |
+diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c |
5268 |
+index 509968c0d16bc..2a13e297e16df 100644 |
5269 |
+--- a/drivers/gpu/drm/mgag200/mgag200_mode.c |
5270 |
++++ b/drivers/gpu/drm/mgag200/mgag200_mode.c |
5271 |
+@@ -1243,7 +1243,10 @@ static void mgag200_set_format_regs(struct mga_device *mdev, |
5272 |
+ WREG_GFX(3, 0x00); |
5273 |
+ WREG_GFX(4, 0x00); |
5274 |
+ WREG_GFX(5, 0x40); |
5275 |
+- WREG_GFX(6, 0x05); |
5276 |
++ /* GCTL6 should be 0x05, but we configure memmapsl to 0xb8000 (text mode), |
5277 |
++ * so that it doesn't hang when running kexec/kdump on G200_SE rev42. |
5278 |
++ */ |
5279 |
++ WREG_GFX(6, 0x0d); |
5280 |
+ WREG_GFX(7, 0x0f); |
5281 |
+ WREG_GFX(8, 0x0f); |
5282 |
+ |
5283 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
5284 |
+index f7f5c258b5537..a0274fcfe9c9d 100644 |
5285 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
5286 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
5287 |
+@@ -1113,7 +1113,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) |
5288 |
+ } |
5289 |
+ |
5290 |
+ |
5291 |
+- if (dpu_enc->disp_info.intf_type == DRM_MODE_CONNECTOR_DisplayPort && |
5292 |
++ if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_TMDS && |
5293 |
+ dpu_enc->cur_master->hw_mdptop && |
5294 |
+ dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select) |
5295 |
+ dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select( |
5296 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c |
5297 |
+index 9b2b5044e8e05..74a13ccad34c0 100644 |
5298 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c |
5299 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c |
5300 |
+@@ -34,6 +34,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) |
5301 |
+ { |
5302 |
+ int i; |
5303 |
+ |
5304 |
++ for (i = 0; i < ARRAY_SIZE(rm->dspp_blks); i++) { |
5305 |
++ struct dpu_hw_dspp *hw; |
5306 |
++ |
5307 |
++ if (rm->dspp_blks[i]) { |
5308 |
++ hw = to_dpu_hw_dspp(rm->dspp_blks[i]); |
5309 |
++ dpu_hw_dspp_destroy(hw); |
5310 |
++ } |
5311 |
++ } |
5312 |
+ for (i = 0; i < ARRAY_SIZE(rm->pingpong_blks); i++) { |
5313 |
+ struct dpu_hw_pingpong *hw; |
5314 |
+ |
5315 |
+diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c |
5316 |
+index 66f2ea3d42fc2..6cd6934c8c9f1 100644 |
5317 |
+--- a/drivers/gpu/drm/msm/dp/dp_display.c |
5318 |
++++ b/drivers/gpu/drm/msm/dp/dp_display.c |
5319 |
+@@ -1336,6 +1336,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, |
5320 |
+ struct drm_encoder *encoder) |
5321 |
+ { |
5322 |
+ struct msm_drm_private *priv; |
5323 |
++ struct dp_display_private *dp_priv; |
5324 |
+ int ret; |
5325 |
+ |
5326 |
+ if (WARN_ON(!encoder) || WARN_ON(!dp_display) || WARN_ON(!dev)) |
5327 |
+@@ -1344,6 +1345,8 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, |
5328 |
+ priv = dev->dev_private; |
5329 |
+ dp_display->drm_dev = dev; |
5330 |
+ |
5331 |
++ dp_priv = container_of(dp_display, struct dp_display_private, dp_display); |
5332 |
++ |
5333 |
+ ret = dp_display_request_irq(dp_display); |
5334 |
+ if (ret) { |
5335 |
+ DRM_ERROR("request_irq failed, ret=%d\n", ret); |
5336 |
+@@ -1361,6 +1364,8 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, |
5337 |
+ return ret; |
5338 |
+ } |
5339 |
+ |
5340 |
++ dp_priv->panel->connector = dp_display->connector; |
5341 |
++ |
5342 |
+ priv->connectors[priv->num_connectors++] = dp_display->connector; |
5343 |
+ return 0; |
5344 |
+ } |
5345 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c |
5346 |
+index 667fa016496ee..a6ea89a5d51ab 100644 |
5347 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c |
5348 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c |
5349 |
+@@ -142,11 +142,12 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver, |
5350 |
+ |
5351 |
+ hsfw->imem_size = desc->code_size; |
5352 |
+ hsfw->imem_tag = desc->start_tag; |
5353 |
+- hsfw->imem = kmalloc(desc->code_size, GFP_KERNEL); |
5354 |
+- memcpy(hsfw->imem, data + desc->code_off, desc->code_size); |
5355 |
+- |
5356 |
++ hsfw->imem = kmemdup(data + desc->code_off, desc->code_size, GFP_KERNEL); |
5357 |
+ nvkm_firmware_put(fw); |
5358 |
+- return 0; |
5359 |
++ if (!hsfw->imem) |
5360 |
++ return -ENOMEM; |
5361 |
++ else |
5362 |
++ return 0; |
5363 |
+ } |
5364 |
+ |
5365 |
+ int |
5366 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c |
5367 |
+index 2aae636f1cf5c..107ad2d764ec0 100644 |
5368 |
+--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c |
5369 |
++++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c |
5370 |
+@@ -359,8 +359,11 @@ int panfrost_gpu_init(struct panfrost_device *pfdev) |
5371 |
+ |
5372 |
+ panfrost_gpu_init_features(pfdev); |
5373 |
+ |
5374 |
+- dma_set_mask_and_coherent(pfdev->dev, |
5375 |
++ err = dma_set_mask_and_coherent(pfdev->dev, |
5376 |
+ DMA_BIT_MASK(FIELD_GET(0xff00, pfdev->features.mmu_features))); |
5377 |
++ if (err) |
5378 |
++ return err; |
5379 |
++ |
5380 |
+ dma_set_max_seg_size(pfdev->dev, UINT_MAX); |
5381 |
+ |
5382 |
+ irq = platform_get_irq_byname(to_platform_device(pfdev->dev), "gpu"); |
5383 |
+diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c |
5384 |
+index 46b0d1c4a16c6..d5e8e3a8bff3e 100644 |
5385 |
+--- a/drivers/gpu/drm/pl111/pl111_drv.c |
5386 |
++++ b/drivers/gpu/drm/pl111/pl111_drv.c |
5387 |
+@@ -324,7 +324,7 @@ dev_put: |
5388 |
+ return ret; |
5389 |
+ } |
5390 |
+ |
5391 |
+-static int pl111_amba_remove(struct amba_device *amba_dev) |
5392 |
++static void pl111_amba_remove(struct amba_device *amba_dev) |
5393 |
+ { |
5394 |
+ struct device *dev = &amba_dev->dev; |
5395 |
+ struct drm_device *drm = amba_get_drvdata(amba_dev); |
5396 |
+@@ -335,8 +335,6 @@ static int pl111_amba_remove(struct amba_device *amba_dev) |
5397 |
+ drm_panel_bridge_remove(priv->bridge); |
5398 |
+ drm_dev_put(drm); |
5399 |
+ of_reserved_mem_device_release(dev); |
5400 |
+- |
5401 |
+- return 0; |
5402 |
+ } |
5403 |
+ |
5404 |
+ /* |
5405 |
+diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c |
5406 |
+index f46d377f0c304..de1333dc0d867 100644 |
5407 |
+--- a/drivers/gpu/drm/tegra/dsi.c |
5408 |
++++ b/drivers/gpu/drm/tegra/dsi.c |
5409 |
+@@ -1538,8 +1538,10 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) |
5410 |
+ dsi->slave = platform_get_drvdata(gangster); |
5411 |
+ of_node_put(np); |
5412 |
+ |
5413 |
+- if (!dsi->slave) |
5414 |
++ if (!dsi->slave) { |
5415 |
++ put_device(&gangster->dev); |
5416 |
+ return -EPROBE_DEFER; |
5417 |
++ } |
5418 |
+ |
5419 |
+ dsi->slave->master = dsi; |
5420 |
+ } |
5421 |
+diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c |
5422 |
+index a2c09dca4eef9..8659558b518d6 100644 |
5423 |
+--- a/drivers/gpu/host1x/dev.c |
5424 |
++++ b/drivers/gpu/host1x/dev.c |
5425 |
+@@ -520,6 +520,7 @@ static int host1x_remove(struct platform_device *pdev) |
5426 |
+ host1x_syncpt_deinit(host); |
5427 |
+ reset_control_assert(host->rst); |
5428 |
+ clk_disable_unprepare(host->clk); |
5429 |
++ host1x_channel_list_free(&host->channel_list); |
5430 |
+ host1x_iommu_exit(host); |
5431 |
+ |
5432 |
+ return 0; |
5433 |
+diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c |
5434 |
+index ce7740ef449ba..51d0875a34800 100644 |
5435 |
+--- a/drivers/greybus/svc.c |
5436 |
++++ b/drivers/greybus/svc.c |
5437 |
+@@ -866,8 +866,14 @@ static int gb_svc_hello(struct gb_operation *op) |
5438 |
+ |
5439 |
+ gb_svc_debugfs_init(svc); |
5440 |
+ |
5441 |
+- return gb_svc_queue_deferred_request(op); |
5442 |
++ ret = gb_svc_queue_deferred_request(op); |
5443 |
++ if (ret) |
5444 |
++ goto err_remove_debugfs; |
5445 |
++ |
5446 |
++ return 0; |
5447 |
+ |
5448 |
++err_remove_debugfs: |
5449 |
++ gb_svc_debugfs_exit(svc); |
5450 |
+ err_unregister_device: |
5451 |
+ gb_svc_watchdog_destroy(svc); |
5452 |
+ device_del(&svc->dev); |
5453 |
+diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c |
5454 |
+index a311b0a33eba7..587259b3db97c 100644 |
5455 |
+--- a/drivers/hid/hid-logitech-dj.c |
5456 |
++++ b/drivers/hid/hid-logitech-dj.c |
5457 |
+@@ -1000,6 +1000,7 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev, |
5458 |
+ workitem.reports_supported |= STD_KEYBOARD; |
5459 |
+ break; |
5460 |
+ case 0x0f: |
5461 |
++ case 0x11: |
5462 |
+ device_type = "eQUAD Lightspeed 1.2"; |
5463 |
+ logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem); |
5464 |
+ workitem.reports_supported |= STD_KEYBOARD; |
5465 |
+diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c |
5466 |
+index 998aad8a9e608..14811d42a5a91 100644 |
5467 |
+--- a/drivers/hid/i2c-hid/i2c-hid-core.c |
5468 |
++++ b/drivers/hid/i2c-hid/i2c-hid-core.c |
5469 |
+@@ -620,6 +620,17 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, |
5470 |
+ if (report_type == HID_OUTPUT_REPORT) |
5471 |
+ return -EINVAL; |
5472 |
+ |
5473 |
++ /* |
5474 |
++ * In case of unnumbered reports the response from the device will |
5475 |
++ * not have the report ID that the upper layers expect, so we need |
5476 |
++ * to stash it the buffer ourselves and adjust the data size. |
5477 |
++ */ |
5478 |
++ if (!report_number) { |
5479 |
++ buf[0] = 0; |
5480 |
++ buf++; |
5481 |
++ count--; |
5482 |
++ } |
5483 |
++ |
5484 |
+ /* +2 bytes to include the size of the reply in the query buffer */ |
5485 |
+ ask_count = min(count + 2, (size_t)ihid->bufsize); |
5486 |
+ |
5487 |
+@@ -641,6 +652,9 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, |
5488 |
+ count = min(count, ret_count - 2); |
5489 |
+ memcpy(buf, ihid->rawbuf + 2, count); |
5490 |
+ |
5491 |
++ if (!report_number) |
5492 |
++ count++; |
5493 |
++ |
5494 |
+ return count; |
5495 |
+ } |
5496 |
+ |
5497 |
+@@ -657,17 +671,19 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf, |
5498 |
+ |
5499 |
+ mutex_lock(&ihid->reset_lock); |
5500 |
+ |
5501 |
+- if (report_id) { |
5502 |
+- buf++; |
5503 |
+- count--; |
5504 |
+- } |
5505 |
+- |
5506 |
++ /* |
5507 |
++ * Note that both numbered and unnumbered reports passed here |
5508 |
++ * are supposed to have report ID stored in the 1st byte of the |
5509 |
++ * buffer, so we strip it off unconditionally before passing payload |
5510 |
++ * to i2c_hid_set_or_send_report which takes care of encoding |
5511 |
++ * everything properly. |
5512 |
++ */ |
5513 |
+ ret = i2c_hid_set_or_send_report(client, |
5514 |
+ report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, |
5515 |
+- report_id, buf, count, use_data); |
5516 |
++ report_id, buf + 1, count - 1, use_data); |
5517 |
+ |
5518 |
+- if (report_id && ret >= 0) |
5519 |
+- ret++; /* add report_id to the number of transfered bytes */ |
5520 |
++ if (ret >= 0) |
5521 |
++ ret++; /* add report_id to the number of transferred bytes */ |
5522 |
+ |
5523 |
+ mutex_unlock(&ihid->reset_lock); |
5524 |
+ |
5525 |
+diff --git a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
5526 |
+index 6cf59fd26ad78..b6d6d119035ca 100644 |
5527 |
+--- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
5528 |
++++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
5529 |
+@@ -656,21 +656,12 @@ static int ish_fw_xfer_direct_dma(struct ishtp_cl_data *client_data, |
5530 |
+ */ |
5531 |
+ payload_max_size &= ~(L1_CACHE_BYTES - 1); |
5532 |
+ |
5533 |
+- dma_buf = kmalloc(payload_max_size, GFP_KERNEL | GFP_DMA32); |
5534 |
++ dma_buf = dma_alloc_coherent(devc, payload_max_size, &dma_buf_phy, GFP_KERNEL); |
5535 |
+ if (!dma_buf) { |
5536 |
+ client_data->flag_retry = true; |
5537 |
+ return -ENOMEM; |
5538 |
+ } |
5539 |
+ |
5540 |
+- dma_buf_phy = dma_map_single(devc, dma_buf, payload_max_size, |
5541 |
+- DMA_TO_DEVICE); |
5542 |
+- if (dma_mapping_error(devc, dma_buf_phy)) { |
5543 |
+- dev_err(cl_data_to_dev(client_data), "DMA map failed\n"); |
5544 |
+- client_data->flag_retry = true; |
5545 |
+- rv = -ENOMEM; |
5546 |
+- goto end_err_dma_buf_release; |
5547 |
+- } |
5548 |
+- |
5549 |
+ ldr_xfer_dma_frag.fragment.hdr.command = LOADER_CMD_XFER_FRAGMENT; |
5550 |
+ ldr_xfer_dma_frag.fragment.xfer_mode = LOADER_XFER_MODE_DIRECT_DMA; |
5551 |
+ ldr_xfer_dma_frag.ddr_phys_addr = (u64)dma_buf_phy; |
5552 |
+@@ -690,14 +681,7 @@ static int ish_fw_xfer_direct_dma(struct ishtp_cl_data *client_data, |
5553 |
+ ldr_xfer_dma_frag.fragment.size = fragment_size; |
5554 |
+ memcpy(dma_buf, &fw->data[fragment_offset], fragment_size); |
5555 |
+ |
5556 |
+- dma_sync_single_for_device(devc, dma_buf_phy, |
5557 |
+- payload_max_size, |
5558 |
+- DMA_TO_DEVICE); |
5559 |
+- |
5560 |
+- /* |
5561 |
+- * Flush cache here because the dma_sync_single_for_device() |
5562 |
+- * does not do for x86. |
5563 |
+- */ |
5564 |
++ /* Flush cache to be sure the data is in main memory. */ |
5565 |
+ clflush_cache_range(dma_buf, payload_max_size); |
5566 |
+ |
5567 |
+ dev_dbg(cl_data_to_dev(client_data), |
5568 |
+@@ -720,15 +704,8 @@ static int ish_fw_xfer_direct_dma(struct ishtp_cl_data *client_data, |
5569 |
+ fragment_offset += fragment_size; |
5570 |
+ } |
5571 |
+ |
5572 |
+- dma_unmap_single(devc, dma_buf_phy, payload_max_size, DMA_TO_DEVICE); |
5573 |
+- kfree(dma_buf); |
5574 |
+- return 0; |
5575 |
+- |
5576 |
+ end_err_resp_buf_release: |
5577 |
+- /* Free ISH buffer if not done already, in error case */ |
5578 |
+- dma_unmap_single(devc, dma_buf_phy, payload_max_size, DMA_TO_DEVICE); |
5579 |
+-end_err_dma_buf_release: |
5580 |
+- kfree(dma_buf); |
5581 |
++ dma_free_coherent(devc, payload_max_size, dma_buf, dma_buf_phy); |
5582 |
+ return rv; |
5583 |
+ } |
5584 |
+ |
5585 |
+diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig |
5586 |
+index 79e5356a737a2..210e532ac277f 100644 |
5587 |
+--- a/drivers/hv/Kconfig |
5588 |
++++ b/drivers/hv/Kconfig |
5589 |
+@@ -17,6 +17,7 @@ config HYPERV_TIMER |
5590 |
+ config HYPERV_UTILS |
5591 |
+ tristate "Microsoft Hyper-V Utilities driver" |
5592 |
+ depends on HYPERV && CONNECTOR && NLS |
5593 |
++ depends on PTP_1588_CLOCK_OPTIONAL |
5594 |
+ help |
5595 |
+ Select this option to enable the Hyper-V Utilities. |
5596 |
+ |
5597 |
+diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c |
5598 |
+index eb56e09ae15f3..6a716996a6250 100644 |
5599 |
+--- a/drivers/hv/hv_balloon.c |
5600 |
++++ b/drivers/hv/hv_balloon.c |
5601 |
+@@ -1558,7 +1558,7 @@ static void balloon_onchannelcallback(void *context) |
5602 |
+ break; |
5603 |
+ |
5604 |
+ default: |
5605 |
+- pr_warn("Unhandled message: type: %d\n", dm_hdr->type); |
5606 |
++ pr_warn_ratelimited("Unhandled message: type: %d\n", dm_hdr->type); |
5607 |
+ |
5608 |
+ } |
5609 |
+ } |
5610 |
+diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h |
5611 |
+index 88a5df2633fb2..de27837e85271 100644 |
5612 |
+--- a/drivers/hwmon/pmbus/pmbus.h |
5613 |
++++ b/drivers/hwmon/pmbus/pmbus.h |
5614 |
+@@ -319,6 +319,7 @@ enum pmbus_fan_mode { percent = 0, rpm }; |
5615 |
+ /* |
5616 |
+ * STATUS_VOUT, STATUS_INPUT |
5617 |
+ */ |
5618 |
++#define PB_VOLTAGE_VIN_OFF BIT(3) |
5619 |
+ #define PB_VOLTAGE_UV_FAULT BIT(4) |
5620 |
+ #define PB_VOLTAGE_UV_WARNING BIT(5) |
5621 |
+ #define PB_VOLTAGE_OV_WARNING BIT(6) |
5622 |
+diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c |
5623 |
+index 71798fde2ef0c..117e3ce9c76ad 100644 |
5624 |
+--- a/drivers/hwmon/pmbus/pmbus_core.c |
5625 |
++++ b/drivers/hwmon/pmbus/pmbus_core.c |
5626 |
+@@ -1360,7 +1360,7 @@ static const struct pmbus_limit_attr vin_limit_attrs[] = { |
5627 |
+ .reg = PMBUS_VIN_UV_FAULT_LIMIT, |
5628 |
+ .attr = "lcrit", |
5629 |
+ .alarm = "lcrit_alarm", |
5630 |
+- .sbit = PB_VOLTAGE_UV_FAULT, |
5631 |
++ .sbit = PB_VOLTAGE_UV_FAULT | PB_VOLTAGE_VIN_OFF, |
5632 |
+ }, { |
5633 |
+ .reg = PMBUS_VIN_OV_WARN_LIMIT, |
5634 |
+ .attr = "max", |
5635 |
+@@ -2255,10 +2255,14 @@ static int pmbus_regulator_is_enabled(struct regulator_dev *rdev) |
5636 |
+ { |
5637 |
+ struct device *dev = rdev_get_dev(rdev); |
5638 |
+ struct i2c_client *client = to_i2c_client(dev->parent); |
5639 |
++ struct pmbus_data *data = i2c_get_clientdata(client); |
5640 |
+ u8 page = rdev_get_id(rdev); |
5641 |
+ int ret; |
5642 |
+ |
5643 |
++ mutex_lock(&data->update_lock); |
5644 |
+ ret = pmbus_read_byte_data(client, page, PMBUS_OPERATION); |
5645 |
++ mutex_unlock(&data->update_lock); |
5646 |
++ |
5647 |
+ if (ret < 0) |
5648 |
+ return ret; |
5649 |
+ |
5650 |
+@@ -2269,11 +2273,17 @@ static int _pmbus_regulator_on_off(struct regulator_dev *rdev, bool enable) |
5651 |
+ { |
5652 |
+ struct device *dev = rdev_get_dev(rdev); |
5653 |
+ struct i2c_client *client = to_i2c_client(dev->parent); |
5654 |
++ struct pmbus_data *data = i2c_get_clientdata(client); |
5655 |
+ u8 page = rdev_get_id(rdev); |
5656 |
++ int ret; |
5657 |
+ |
5658 |
+- return pmbus_update_byte_data(client, page, PMBUS_OPERATION, |
5659 |
+- PB_OPERATION_CONTROL_ON, |
5660 |
+- enable ? PB_OPERATION_CONTROL_ON : 0); |
5661 |
++ mutex_lock(&data->update_lock); |
5662 |
++ ret = pmbus_update_byte_data(client, page, PMBUS_OPERATION, |
5663 |
++ PB_OPERATION_CONTROL_ON, |
5664 |
++ enable ? PB_OPERATION_CONTROL_ON : 0); |
5665 |
++ mutex_unlock(&data->update_lock); |
5666 |
++ |
5667 |
++ return ret; |
5668 |
+ } |
5669 |
+ |
5670 |
+ static int pmbus_regulator_enable(struct regulator_dev *rdev) |
5671 |
+diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c |
5672 |
+index 6c84780e358e8..066b12990fbfb 100644 |
5673 |
+--- a/drivers/hwmon/sch56xx-common.c |
5674 |
++++ b/drivers/hwmon/sch56xx-common.c |
5675 |
+@@ -424,7 +424,7 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, |
5676 |
+ if (nowayout) |
5677 |
+ set_bit(WDOG_NO_WAY_OUT, &data->wddev.status); |
5678 |
+ if (output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) |
5679 |
+- set_bit(WDOG_ACTIVE, &data->wddev.status); |
5680 |
++ set_bit(WDOG_HW_RUNNING, &data->wddev.status); |
5681 |
+ |
5682 |
+ /* Since the watchdog uses a downcounter there is no register to read |
5683 |
+ the BIOS set timeout from (if any was set at all) -> |
5684 |
+diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c |
5685 |
+index a61313f320bda..8e19e8cdcce5e 100644 |
5686 |
+--- a/drivers/hwtracing/coresight/coresight-catu.c |
5687 |
++++ b/drivers/hwtracing/coresight/coresight-catu.c |
5688 |
+@@ -567,12 +567,11 @@ out: |
5689 |
+ return ret; |
5690 |
+ } |
5691 |
+ |
5692 |
+-static int catu_remove(struct amba_device *adev) |
5693 |
++static void catu_remove(struct amba_device *adev) |
5694 |
+ { |
5695 |
+ struct catu_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5696 |
+ |
5697 |
+ coresight_unregister(drvdata->csdev); |
5698 |
+- return 0; |
5699 |
+ } |
5700 |
+ |
5701 |
+ static struct amba_id catu_ids[] = { |
5702 |
+diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c |
5703 |
+index e1d232411d8d7..2dcf13de751fc 100644 |
5704 |
+--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c |
5705 |
++++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c |
5706 |
+@@ -627,7 +627,7 @@ err: |
5707 |
+ return ret; |
5708 |
+ } |
5709 |
+ |
5710 |
+-static int debug_remove(struct amba_device *adev) |
5711 |
++static void debug_remove(struct amba_device *adev) |
5712 |
+ { |
5713 |
+ struct device *dev = &adev->dev; |
5714 |
+ struct debug_drvdata *drvdata = amba_get_drvdata(adev); |
5715 |
+@@ -642,8 +642,6 @@ static int debug_remove(struct amba_device *adev) |
5716 |
+ |
5717 |
+ if (!--debug_count) |
5718 |
+ debug_func_exit(); |
5719 |
+- |
5720 |
+- return 0; |
5721 |
+ } |
5722 |
+ |
5723 |
+ static const struct amba_cs_uci_id uci_id_debug[] = { |
5724 |
+diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c |
5725 |
+index 7ea93598f0eea..0276700c246d5 100644 |
5726 |
+--- a/drivers/hwtracing/coresight/coresight-cti-core.c |
5727 |
++++ b/drivers/hwtracing/coresight/coresight-cti-core.c |
5728 |
+@@ -836,7 +836,7 @@ static void cti_device_release(struct device *dev) |
5729 |
+ if (drvdata->csdev_release) |
5730 |
+ drvdata->csdev_release(dev); |
5731 |
+ } |
5732 |
+-static int cti_remove(struct amba_device *adev) |
5733 |
++static void cti_remove(struct amba_device *adev) |
5734 |
+ { |
5735 |
+ struct cti_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5736 |
+ |
5737 |
+@@ -845,8 +845,6 @@ static int cti_remove(struct amba_device *adev) |
5738 |
+ mutex_unlock(&ect_mutex); |
5739 |
+ |
5740 |
+ coresight_unregister(drvdata->csdev); |
5741 |
+- |
5742 |
+- return 0; |
5743 |
+ } |
5744 |
+ |
5745 |
+ static int cti_probe(struct amba_device *adev, const struct amba_id *id) |
5746 |
+diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c |
5747 |
+index 0cf6f0b947b6f..51c801c05e5c3 100644 |
5748 |
+--- a/drivers/hwtracing/coresight/coresight-etb10.c |
5749 |
++++ b/drivers/hwtracing/coresight/coresight-etb10.c |
5750 |
+@@ -803,7 +803,7 @@ err_misc_register: |
5751 |
+ return ret; |
5752 |
+ } |
5753 |
+ |
5754 |
+-static int etb_remove(struct amba_device *adev) |
5755 |
++static void etb_remove(struct amba_device *adev) |
5756 |
+ { |
5757 |
+ struct etb_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5758 |
+ |
5759 |
+@@ -814,8 +814,6 @@ static int etb_remove(struct amba_device *adev) |
5760 |
+ */ |
5761 |
+ misc_deregister(&drvdata->miscdev); |
5762 |
+ coresight_unregister(drvdata->csdev); |
5763 |
+- |
5764 |
+- return 0; |
5765 |
+ } |
5766 |
+ |
5767 |
+ #ifdef CONFIG_PM |
5768 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c |
5769 |
+index 5bf5a5a4ce6d1..683a69e88efda 100644 |
5770 |
+--- a/drivers/hwtracing/coresight/coresight-etm3x-core.c |
5771 |
++++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c |
5772 |
+@@ -909,7 +909,7 @@ static void clear_etmdrvdata(void *info) |
5773 |
+ etmdrvdata[cpu] = NULL; |
5774 |
+ } |
5775 |
+ |
5776 |
+-static int etm_remove(struct amba_device *adev) |
5777 |
++static void etm_remove(struct amba_device *adev) |
5778 |
+ { |
5779 |
+ struct etm_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5780 |
+ |
5781 |
+@@ -932,8 +932,6 @@ static int etm_remove(struct amba_device *adev) |
5782 |
+ cpus_read_unlock(); |
5783 |
+ |
5784 |
+ coresight_unregister(drvdata->csdev); |
5785 |
+- |
5786 |
+- return 0; |
5787 |
+ } |
5788 |
+ |
5789 |
+ #ifdef CONFIG_PM |
5790 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c |
5791 |
+index 74d3e2fe43d46..99df453575f50 100644 |
5792 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c |
5793 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c |
5794 |
+@@ -1582,7 +1582,7 @@ static void clear_etmdrvdata(void *info) |
5795 |
+ etmdrvdata[cpu] = NULL; |
5796 |
+ } |
5797 |
+ |
5798 |
+-static int etm4_remove(struct amba_device *adev) |
5799 |
++static void etm4_remove(struct amba_device *adev) |
5800 |
+ { |
5801 |
+ struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5802 |
+ |
5803 |
+@@ -1605,8 +1605,6 @@ static int etm4_remove(struct amba_device *adev) |
5804 |
+ cpus_read_unlock(); |
5805 |
+ |
5806 |
+ coresight_unregister(drvdata->csdev); |
5807 |
+- |
5808 |
+- return 0; |
5809 |
+ } |
5810 |
+ |
5811 |
+ static const struct amba_id etm4_ids[] = { |
5812 |
+diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
5813 |
+index 4682f26139961..42cc38c89f3ba 100644 |
5814 |
+--- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
5815 |
++++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
5816 |
+@@ -364,8 +364,12 @@ static ssize_t mode_store(struct device *dev, |
5817 |
+ mode = ETM_MODE_QELEM(config->mode); |
5818 |
+ /* start by clearing QE bits */ |
5819 |
+ config->cfg &= ~(BIT(13) | BIT(14)); |
5820 |
+- /* if supported, Q elements with instruction counts are enabled */ |
5821 |
+- if ((mode & BIT(0)) && (drvdata->q_support & BIT(0))) |
5822 |
++ /* |
5823 |
++ * if supported, Q elements with instruction counts are enabled. |
5824 |
++ * Always set the low bit for any requested mode. Valid combos are |
5825 |
++ * 0b00, 0b01 and 0b11. |
5826 |
++ */ |
5827 |
++ if (mode && drvdata->q_support) |
5828 |
+ config->cfg |= BIT(13); |
5829 |
+ /* |
5830 |
+ * if supported, Q elements with and without instruction |
5831 |
+diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c |
5832 |
+index 3fc6c678b51d8..b2fb853776d79 100644 |
5833 |
+--- a/drivers/hwtracing/coresight/coresight-funnel.c |
5834 |
++++ b/drivers/hwtracing/coresight/coresight-funnel.c |
5835 |
+@@ -370,9 +370,9 @@ static int dynamic_funnel_probe(struct amba_device *adev, |
5836 |
+ return funnel_probe(&adev->dev, &adev->res); |
5837 |
+ } |
5838 |
+ |
5839 |
+-static int dynamic_funnel_remove(struct amba_device *adev) |
5840 |
++static void dynamic_funnel_remove(struct amba_device *adev) |
5841 |
+ { |
5842 |
+- return funnel_remove(&adev->dev); |
5843 |
++ funnel_remove(&adev->dev); |
5844 |
+ } |
5845 |
+ |
5846 |
+ static const struct amba_id dynamic_funnel_ids[] = { |
5847 |
+diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c |
5848 |
+index 38008aca2c0f4..da2bfeeabc1b4 100644 |
5849 |
+--- a/drivers/hwtracing/coresight/coresight-replicator.c |
5850 |
++++ b/drivers/hwtracing/coresight/coresight-replicator.c |
5851 |
+@@ -388,9 +388,9 @@ static int dynamic_replicator_probe(struct amba_device *adev, |
5852 |
+ return replicator_probe(&adev->dev, &adev->res); |
5853 |
+ } |
5854 |
+ |
5855 |
+-static int dynamic_replicator_remove(struct amba_device *adev) |
5856 |
++static void dynamic_replicator_remove(struct amba_device *adev) |
5857 |
+ { |
5858 |
+- return replicator_remove(&adev->dev); |
5859 |
++ replicator_remove(&adev->dev); |
5860 |
+ } |
5861 |
+ |
5862 |
+ static const struct amba_id dynamic_replicator_ids[] = { |
5863 |
+diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c |
5864 |
+index 587c1d7f25208..0ecca9f93f3a1 100644 |
5865 |
+--- a/drivers/hwtracing/coresight/coresight-stm.c |
5866 |
++++ b/drivers/hwtracing/coresight/coresight-stm.c |
5867 |
+@@ -951,15 +951,13 @@ stm_unregister: |
5868 |
+ return ret; |
5869 |
+ } |
5870 |
+ |
5871 |
+-static int stm_remove(struct amba_device *adev) |
5872 |
++static void stm_remove(struct amba_device *adev) |
5873 |
+ { |
5874 |
+ struct stm_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5875 |
+ |
5876 |
+ coresight_unregister(drvdata->csdev); |
5877 |
+ |
5878 |
+ stm_unregister_device(&drvdata->stm); |
5879 |
+- |
5880 |
+- return 0; |
5881 |
+ } |
5882 |
+ |
5883 |
+ #ifdef CONFIG_PM |
5884 |
+diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c |
5885 |
+index 8169dff5a9f6a..e29b3914fc0ff 100644 |
5886 |
+--- a/drivers/hwtracing/coresight/coresight-tmc-core.c |
5887 |
++++ b/drivers/hwtracing/coresight/coresight-tmc-core.c |
5888 |
+@@ -559,7 +559,7 @@ out: |
5889 |
+ spin_unlock_irqrestore(&drvdata->spinlock, flags); |
5890 |
+ } |
5891 |
+ |
5892 |
+-static int tmc_remove(struct amba_device *adev) |
5893 |
++static void tmc_remove(struct amba_device *adev) |
5894 |
+ { |
5895 |
+ struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5896 |
+ |
5897 |
+@@ -570,8 +570,6 @@ static int tmc_remove(struct amba_device *adev) |
5898 |
+ */ |
5899 |
+ misc_deregister(&drvdata->miscdev); |
5900 |
+ coresight_unregister(drvdata->csdev); |
5901 |
+- |
5902 |
+- return 0; |
5903 |
+ } |
5904 |
+ |
5905 |
+ static const struct amba_id tmc_ids[] = { |
5906 |
+diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c |
5907 |
+index 5b35029461a0c..0ca39d905d0b3 100644 |
5908 |
+--- a/drivers/hwtracing/coresight/coresight-tpiu.c |
5909 |
++++ b/drivers/hwtracing/coresight/coresight-tpiu.c |
5910 |
+@@ -173,13 +173,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) |
5911 |
+ return PTR_ERR(drvdata->csdev); |
5912 |
+ } |
5913 |
+ |
5914 |
+-static int tpiu_remove(struct amba_device *adev) |
5915 |
++static void tpiu_remove(struct amba_device *adev) |
5916 |
+ { |
5917 |
+ struct tpiu_drvdata *drvdata = dev_get_drvdata(&adev->dev); |
5918 |
+ |
5919 |
+ coresight_unregister(drvdata->csdev); |
5920 |
+- |
5921 |
+- return 0; |
5922 |
+ } |
5923 |
+ |
5924 |
+ #ifdef CONFIG_PM |
5925 |
+diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c |
5926 |
+index ef73a42577cc7..07eb819072c4f 100644 |
5927 |
+--- a/drivers/i2c/busses/i2c-meson.c |
5928 |
++++ b/drivers/i2c/busses/i2c-meson.c |
5929 |
+@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev) |
5930 |
+ */ |
5931 |
+ meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0); |
5932 |
+ |
5933 |
+- ret = i2c_add_adapter(&i2c->adap); |
5934 |
+- if (ret < 0) { |
5935 |
+- clk_disable_unprepare(i2c->clk); |
5936 |
+- return ret; |
5937 |
+- } |
5938 |
+- |
5939 |
+ /* Disable filtering */ |
5940 |
+ meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, |
5941 |
+ REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0); |
5942 |
+ |
5943 |
+ meson_i2c_set_clk_div(i2c, timings.bus_freq_hz); |
5944 |
+ |
5945 |
++ ret = i2c_add_adapter(&i2c->adap); |
5946 |
++ if (ret < 0) { |
5947 |
++ clk_disable_unprepare(i2c->clk); |
5948 |
++ return ret; |
5949 |
++ } |
5950 |
++ |
5951 |
+ return 0; |
5952 |
+ } |
5953 |
+ |
5954 |
+diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c |
5955 |
+index d4b1b0865f676..a3363b20f168a 100644 |
5956 |
+--- a/drivers/i2c/busses/i2c-nomadik.c |
5957 |
++++ b/drivers/i2c/busses/i2c-nomadik.c |
5958 |
+@@ -1055,7 +1055,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) |
5959 |
+ return ret; |
5960 |
+ } |
5961 |
+ |
5962 |
+-static int nmk_i2c_remove(struct amba_device *adev) |
5963 |
++static void nmk_i2c_remove(struct amba_device *adev) |
5964 |
+ { |
5965 |
+ struct resource *res = &adev->res; |
5966 |
+ struct nmk_i2c_dev *dev = amba_get_drvdata(adev); |
5967 |
+@@ -1068,8 +1068,6 @@ static int nmk_i2c_remove(struct amba_device *adev) |
5968 |
+ i2c_clr_bit(dev->virtbase + I2C_CR, I2C_CR_PE); |
5969 |
+ clk_disable_unprepare(dev->clk); |
5970 |
+ release_mem_region(res->start, resource_size(res)); |
5971 |
+- |
5972 |
+- return 0; |
5973 |
+ } |
5974 |
+ |
5975 |
+ static struct i2c_vendor_data vendor_stn8815 = { |
5976 |
+diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c |
5977 |
+index 2a8568b97c14d..8dabb6ffb1a4f 100644 |
5978 |
+--- a/drivers/i2c/busses/i2c-xiic.c |
5979 |
++++ b/drivers/i2c/busses/i2c-xiic.c |
5980 |
+@@ -756,7 +756,6 @@ static const struct i2c_adapter_quirks xiic_quirks = { |
5981 |
+ |
5982 |
+ static const struct i2c_adapter xiic_adapter = { |
5983 |
+ .owner = THIS_MODULE, |
5984 |
+- .name = DRIVER_NAME, |
5985 |
+ .class = I2C_CLASS_DEPRECATED, |
5986 |
+ .algo = &xiic_algorithm, |
5987 |
+ .quirks = &xiic_quirks, |
5988 |
+@@ -793,6 +792,8 @@ static int xiic_i2c_probe(struct platform_device *pdev) |
5989 |
+ i2c_set_adapdata(&i2c->adap, i2c); |
5990 |
+ i2c->adap.dev.parent = &pdev->dev; |
5991 |
+ i2c->adap.dev.of_node = pdev->dev.of_node; |
5992 |
++ snprintf(i2c->adap.name, sizeof(i2c->adap.name), |
5993 |
++ DRIVER_NAME " %s", pdev->name); |
5994 |
+ |
5995 |
+ mutex_init(&i2c->lock); |
5996 |
+ init_waitqueue_head(&i2c->wait); |
5997 |
+diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c |
5998 |
+index 5365199a31f41..f7a7405d4350a 100644 |
5999 |
+--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c |
6000 |
++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c |
6001 |
+@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) |
6002 |
+ |
6003 |
+ err = device_create_file(&pdev->dev, &dev_attr_available_masters); |
6004 |
+ if (err) |
6005 |
+- goto err_rollback; |
6006 |
++ goto err_rollback_activation; |
6007 |
+ |
6008 |
+ err = device_create_file(&pdev->dev, &dev_attr_current_master); |
6009 |
+ if (err) |
6010 |
+@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) |
6011 |
+ |
6012 |
+ err_rollback_available: |
6013 |
+ device_remove_file(&pdev->dev, &dev_attr_available_masters); |
6014 |
+-err_rollback: |
6015 |
++err_rollback_activation: |
6016 |
+ i2c_demux_deactivate_master(priv); |
6017 |
++err_rollback: |
6018 |
+ for (j = 0; j < i; j++) { |
6019 |
+ of_node_put(priv->chan[j].parent_np); |
6020 |
+ of_changeset_destroy(&priv->chan[j].chgset); |
6021 |
+diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c |
6022 |
+index a7208704d31c9..e7e2802827740 100644 |
6023 |
+--- a/drivers/iio/accel/mma8452.c |
6024 |
++++ b/drivers/iio/accel/mma8452.c |
6025 |
+@@ -176,6 +176,7 @@ static const struct mma8452_event_regs trans_ev_regs = { |
6026 |
+ * @enabled_events: event flags enabled and handled by this driver |
6027 |
+ */ |
6028 |
+ struct mma_chip_info { |
6029 |
++ const char *name; |
6030 |
+ u8 chip_id; |
6031 |
+ const struct iio_chan_spec *channels; |
6032 |
+ int num_channels; |
6033 |
+@@ -1303,6 +1304,7 @@ enum { |
6034 |
+ |
6035 |
+ static const struct mma_chip_info mma_chip_info_table[] = { |
6036 |
+ [mma8451] = { |
6037 |
++ .name = "mma8451", |
6038 |
+ .chip_id = MMA8451_DEVICE_ID, |
6039 |
+ .channels = mma8451_channels, |
6040 |
+ .num_channels = ARRAY_SIZE(mma8451_channels), |
6041 |
+@@ -1327,6 +1329,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { |
6042 |
+ MMA8452_INT_FF_MT, |
6043 |
+ }, |
6044 |
+ [mma8452] = { |
6045 |
++ .name = "mma8452", |
6046 |
+ .chip_id = MMA8452_DEVICE_ID, |
6047 |
+ .channels = mma8452_channels, |
6048 |
+ .num_channels = ARRAY_SIZE(mma8452_channels), |
6049 |
+@@ -1343,6 +1346,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { |
6050 |
+ MMA8452_INT_FF_MT, |
6051 |
+ }, |
6052 |
+ [mma8453] = { |
6053 |
++ .name = "mma8453", |
6054 |
+ .chip_id = MMA8453_DEVICE_ID, |
6055 |
+ .channels = mma8453_channels, |
6056 |
+ .num_channels = ARRAY_SIZE(mma8453_channels), |
6057 |
+@@ -1359,6 +1363,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { |
6058 |
+ MMA8452_INT_FF_MT, |
6059 |
+ }, |
6060 |
+ [mma8652] = { |
6061 |
++ .name = "mma8652", |
6062 |
+ .chip_id = MMA8652_DEVICE_ID, |
6063 |
+ .channels = mma8652_channels, |
6064 |
+ .num_channels = ARRAY_SIZE(mma8652_channels), |
6065 |
+@@ -1368,6 +1373,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { |
6066 |
+ .enabled_events = MMA8452_INT_FF_MT, |
6067 |
+ }, |
6068 |
+ [mma8653] = { |
6069 |
++ .name = "mma8653", |
6070 |
+ .chip_id = MMA8653_DEVICE_ID, |
6071 |
+ .channels = mma8653_channels, |
6072 |
+ .num_channels = ARRAY_SIZE(mma8653_channels), |
6073 |
+@@ -1382,6 +1388,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { |
6074 |
+ .enabled_events = MMA8452_INT_FF_MT, |
6075 |
+ }, |
6076 |
+ [fxls8471] = { |
6077 |
++ .name = "fxls8471", |
6078 |
+ .chip_id = FXLS8471_DEVICE_ID, |
6079 |
+ .channels = mma8451_channels, |
6080 |
+ .num_channels = ARRAY_SIZE(mma8451_channels), |
6081 |
+@@ -1525,13 +1532,6 @@ static int mma8452_probe(struct i2c_client *client, |
6082 |
+ struct mma8452_data *data; |
6083 |
+ struct iio_dev *indio_dev; |
6084 |
+ int ret; |
6085 |
+- const struct of_device_id *match; |
6086 |
+- |
6087 |
+- match = of_match_device(mma8452_dt_ids, &client->dev); |
6088 |
+- if (!match) { |
6089 |
+- dev_err(&client->dev, "unknown device model\n"); |
6090 |
+- return -ENODEV; |
6091 |
+- } |
6092 |
+ |
6093 |
+ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); |
6094 |
+ if (!indio_dev) |
6095 |
+@@ -1540,7 +1540,14 @@ static int mma8452_probe(struct i2c_client *client, |
6096 |
+ data = iio_priv(indio_dev); |
6097 |
+ data->client = client; |
6098 |
+ mutex_init(&data->lock); |
6099 |
+- data->chip_info = match->data; |
6100 |
++ |
6101 |
++ data->chip_info = device_get_match_data(&client->dev); |
6102 |
++ if (!data->chip_info && id) { |
6103 |
++ data->chip_info = &mma_chip_info_table[id->driver_data]; |
6104 |
++ } else { |
6105 |
++ dev_err(&client->dev, "unknown device model\n"); |
6106 |
++ return -ENODEV; |
6107 |
++ } |
6108 |
+ |
6109 |
+ data->vdd_reg = devm_regulator_get(&client->dev, "vdd"); |
6110 |
+ if (IS_ERR(data->vdd_reg)) |
6111 |
+@@ -1584,11 +1591,11 @@ static int mma8452_probe(struct i2c_client *client, |
6112 |
+ } |
6113 |
+ |
6114 |
+ dev_info(&client->dev, "registering %s accelerometer; ID 0x%x\n", |
6115 |
+- match->compatible, data->chip_info->chip_id); |
6116 |
++ data->chip_info->name, data->chip_info->chip_id); |
6117 |
+ |
6118 |
+ i2c_set_clientdata(client, indio_dev); |
6119 |
+ indio_dev->info = &mma8452_info; |
6120 |
+- indio_dev->name = id->name; |
6121 |
++ indio_dev->name = data->chip_info->name; |
6122 |
+ indio_dev->modes = INDIO_DIRECT_MODE; |
6123 |
+ indio_dev->channels = data->chip_info->channels; |
6124 |
+ indio_dev->num_channels = data->chip_info->num_channels; |
6125 |
+@@ -1814,7 +1821,7 @@ MODULE_DEVICE_TABLE(i2c, mma8452_id); |
6126 |
+ static struct i2c_driver mma8452_driver = { |
6127 |
+ .driver = { |
6128 |
+ .name = "mma8452", |
6129 |
+- .of_match_table = of_match_ptr(mma8452_dt_ids), |
6130 |
++ .of_match_table = mma8452_dt_ids, |
6131 |
+ .pm = &mma8452_pm_ops, |
6132 |
+ }, |
6133 |
+ .probe = mma8452_probe, |
6134 |
+diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c |
6135 |
+index c6416ad795ca4..256177b15c511 100644 |
6136 |
+--- a/drivers/iio/adc/twl6030-gpadc.c |
6137 |
++++ b/drivers/iio/adc/twl6030-gpadc.c |
6138 |
+@@ -911,6 +911,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) |
6139 |
+ ret = devm_request_threaded_irq(dev, irq, NULL, |
6140 |
+ twl6030_gpadc_irq_handler, |
6141 |
+ IRQF_ONESHOT, "twl6030_gpadc", indio_dev); |
6142 |
++ if (ret) |
6143 |
++ return ret; |
6144 |
+ |
6145 |
+ ret = twl6030_gpadc_enable_irq(TWL6030_GPADC_RT_SW1_EOC_MASK); |
6146 |
+ if (ret < 0) { |
6147 |
+diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c |
6148 |
+index e42ea2b1707db..3809f98894a51 100644 |
6149 |
+--- a/drivers/iio/afe/iio-rescale.c |
6150 |
++++ b/drivers/iio/afe/iio-rescale.c |
6151 |
+@@ -38,7 +38,7 @@ static int rescale_read_raw(struct iio_dev *indio_dev, |
6152 |
+ int *val, int *val2, long mask) |
6153 |
+ { |
6154 |
+ struct rescale *rescale = iio_priv(indio_dev); |
6155 |
+- unsigned long long tmp; |
6156 |
++ s64 tmp; |
6157 |
+ int ret; |
6158 |
+ |
6159 |
+ switch (mask) { |
6160 |
+@@ -59,10 +59,10 @@ static int rescale_read_raw(struct iio_dev *indio_dev, |
6161 |
+ *val2 = rescale->denominator; |
6162 |
+ return IIO_VAL_FRACTIONAL; |
6163 |
+ case IIO_VAL_FRACTIONAL_LOG2: |
6164 |
+- tmp = *val * 1000000000LL; |
6165 |
+- do_div(tmp, rescale->denominator); |
6166 |
++ tmp = (s64)*val * 1000000000LL; |
6167 |
++ tmp = div_s64(tmp, rescale->denominator); |
6168 |
+ tmp *= rescale->numerator; |
6169 |
+- do_div(tmp, 1000000000LL); |
6170 |
++ tmp = div_s64(tmp, 1000000000LL); |
6171 |
+ *val = tmp; |
6172 |
+ return ret; |
6173 |
+ default: |
6174 |
+diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c |
6175 |
+index ede99e0d53714..8c3faa7972842 100644 |
6176 |
+--- a/drivers/iio/inkern.c |
6177 |
++++ b/drivers/iio/inkern.c |
6178 |
+@@ -561,28 +561,50 @@ EXPORT_SYMBOL_GPL(iio_read_channel_average_raw); |
6179 |
+ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, |
6180 |
+ int raw, int *processed, unsigned int scale) |
6181 |
+ { |
6182 |
+- int scale_type, scale_val, scale_val2, offset; |
6183 |
++ int scale_type, scale_val, scale_val2; |
6184 |
++ int offset_type, offset_val, offset_val2; |
6185 |
+ s64 raw64 = raw; |
6186 |
+- int ret; |
6187 |
+ |
6188 |
+- ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET); |
6189 |
+- if (ret >= 0) |
6190 |
+- raw64 += offset; |
6191 |
++ offset_type = iio_channel_read(chan, &offset_val, &offset_val2, |
6192 |
++ IIO_CHAN_INFO_OFFSET); |
6193 |
++ if (offset_type >= 0) { |
6194 |
++ switch (offset_type) { |
6195 |
++ case IIO_VAL_INT: |
6196 |
++ break; |
6197 |
++ case IIO_VAL_INT_PLUS_MICRO: |
6198 |
++ case IIO_VAL_INT_PLUS_NANO: |
6199 |
++ /* |
6200 |
++ * Both IIO_VAL_INT_PLUS_MICRO and IIO_VAL_INT_PLUS_NANO |
6201 |
++ * implicitely truncate the offset to it's integer form. |
6202 |
++ */ |
6203 |
++ break; |
6204 |
++ case IIO_VAL_FRACTIONAL: |
6205 |
++ offset_val /= offset_val2; |
6206 |
++ break; |
6207 |
++ case IIO_VAL_FRACTIONAL_LOG2: |
6208 |
++ offset_val >>= offset_val2; |
6209 |
++ break; |
6210 |
++ default: |
6211 |
++ return -EINVAL; |
6212 |
++ } |
6213 |
++ |
6214 |
++ raw64 += offset_val; |
6215 |
++ } |
6216 |
+ |
6217 |
+ scale_type = iio_channel_read(chan, &scale_val, &scale_val2, |
6218 |
+ IIO_CHAN_INFO_SCALE); |
6219 |
+ if (scale_type < 0) { |
6220 |
+ /* |
6221 |
+- * Just pass raw values as processed if no scaling is |
6222 |
+- * available. |
6223 |
++ * If no channel scaling is available apply consumer scale to |
6224 |
++ * raw value and return. |
6225 |
+ */ |
6226 |
+- *processed = raw; |
6227 |
++ *processed = raw * scale; |
6228 |
+ return 0; |
6229 |
+ } |
6230 |
+ |
6231 |
+ switch (scale_type) { |
6232 |
+ case IIO_VAL_INT: |
6233 |
+- *processed = raw64 * scale_val; |
6234 |
++ *processed = raw64 * scale_val * scale; |
6235 |
+ break; |
6236 |
+ case IIO_VAL_INT_PLUS_MICRO: |
6237 |
+ if (scale_val2 < 0) |
6238 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
6239 |
+index fbb0efbe25f84..3c40aa50cd60c 100644 |
6240 |
+--- a/drivers/infiniband/core/cma.c |
6241 |
++++ b/drivers/infiniband/core/cma.c |
6242 |
+@@ -2635,7 +2635,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) |
6243 |
+ { |
6244 |
+ struct rdma_id_private *id_priv; |
6245 |
+ |
6246 |
+- if (id->qp_type != IB_QPT_RC) |
6247 |
++ if (id->qp_type != IB_QPT_RC && id->qp_type != IB_QPT_XRC_INI) |
6248 |
+ return -EINVAL; |
6249 |
+ |
6250 |
+ id_priv = container_of(id, struct rdma_id_private, id); |
6251 |
+diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c |
6252 |
+index 3d895cc41c3ad..597e889ba8312 100644 |
6253 |
+--- a/drivers/infiniband/core/verbs.c |
6254 |
++++ b/drivers/infiniband/core/verbs.c |
6255 |
+@@ -2078,6 +2078,7 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
6256 |
+ return mr; |
6257 |
+ |
6258 |
+ mr->device = pd->device; |
6259 |
++ mr->type = IB_MR_TYPE_USER; |
6260 |
+ mr->pd = pd; |
6261 |
+ mr->dm = NULL; |
6262 |
+ atomic_inc(&pd->usecnt); |
6263 |
+diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c |
6264 |
+index 3591923abebb9..5f3edd255ca3c 100644 |
6265 |
+--- a/drivers/infiniband/hw/hfi1/verbs.c |
6266 |
++++ b/drivers/infiniband/hw/hfi1/verbs.c |
6267 |
+@@ -1439,8 +1439,7 @@ static int query_port(struct rvt_dev_info *rdi, u8 port_num, |
6268 |
+ 4096 : hfi1_max_mtu), IB_MTU_4096); |
6269 |
+ props->active_mtu = !valid_ib_mtu(ppd->ibmtu) ? props->max_mtu : |
6270 |
+ mtu_to_enum(ppd->ibmtu, IB_MTU_4096); |
6271 |
+- props->phys_mtu = HFI1_CAP_IS_KSET(AIP) ? hfi1_max_mtu : |
6272 |
+- ib_mtu_enum_to_int(props->max_mtu); |
6273 |
++ props->phys_mtu = hfi1_max_mtu; |
6274 |
+ |
6275 |
+ return 0; |
6276 |
+ } |
6277 |
+diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c |
6278 |
+index 343e6709d9fc3..2f053f48f1beb 100644 |
6279 |
+--- a/drivers/infiniband/hw/mlx5/devx.c |
6280 |
++++ b/drivers/infiniband/hw/mlx5/devx.c |
6281 |
+@@ -1792,8 +1792,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table, |
6282 |
+ key_level2, |
6283 |
+ obj_event, |
6284 |
+ GFP_KERNEL); |
6285 |
+- if (err) |
6286 |
++ if (err) { |
6287 |
++ kfree(obj_event); |
6288 |
+ return err; |
6289 |
++ } |
6290 |
+ INIT_LIST_HEAD(&obj_event->obj_sub_list); |
6291 |
+ } |
6292 |
+ |
6293 |
+diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c |
6294 |
+index 19346693c1da4..6cd0cbd4fc9f6 100644 |
6295 |
+--- a/drivers/infiniband/hw/mlx5/mr.c |
6296 |
++++ b/drivers/infiniband/hw/mlx5/mr.c |
6297 |
+@@ -575,6 +575,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, |
6298 |
+ ent = &cache->ent[entry]; |
6299 |
+ spin_lock_irq(&ent->lock); |
6300 |
+ if (list_empty(&ent->head)) { |
6301 |
++ queue_adjust_cache_locked(ent); |
6302 |
++ ent->miss++; |
6303 |
+ spin_unlock_irq(&ent->lock); |
6304 |
+ mr = create_cache_mr(ent); |
6305 |
+ if (IS_ERR(mr)) |
6306 |
+diff --git a/drivers/input/input.c b/drivers/input/input.c |
6307 |
+index ff9dc37eff345..3cfd2c18eebd9 100644 |
6308 |
+--- a/drivers/input/input.c |
6309 |
++++ b/drivers/input/input.c |
6310 |
+@@ -2179,12 +2179,6 @@ int input_register_device(struct input_dev *dev) |
6311 |
+ /* KEY_RESERVED is not supposed to be transmitted to userspace. */ |
6312 |
+ __clear_bit(KEY_RESERVED, dev->keybit); |
6313 |
+ |
6314 |
+- /* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */ |
6315 |
+- if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) { |
6316 |
+- __clear_bit(BTN_RIGHT, dev->keybit); |
6317 |
+- __clear_bit(BTN_MIDDLE, dev->keybit); |
6318 |
+- } |
6319 |
+- |
6320 |
+ /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
6321 |
+ input_cleanse_bitmasks(dev); |
6322 |
+ |
6323 |
+diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c |
6324 |
+index ecdeca147ed71..4408245b61d2c 100644 |
6325 |
+--- a/drivers/input/serio/ambakmi.c |
6326 |
++++ b/drivers/input/serio/ambakmi.c |
6327 |
+@@ -159,7 +159,7 @@ static int amba_kmi_probe(struct amba_device *dev, |
6328 |
+ return ret; |
6329 |
+ } |
6330 |
+ |
6331 |
+-static int amba_kmi_remove(struct amba_device *dev) |
6332 |
++static void amba_kmi_remove(struct amba_device *dev) |
6333 |
+ { |
6334 |
+ struct amba_kmi_port *kmi = amba_get_drvdata(dev); |
6335 |
+ |
6336 |
+@@ -168,7 +168,6 @@ static int amba_kmi_remove(struct amba_device *dev) |
6337 |
+ iounmap(kmi->base); |
6338 |
+ kfree(kmi); |
6339 |
+ amba_release_regions(dev); |
6340 |
+- return 0; |
6341 |
+ } |
6342 |
+ |
6343 |
+ static int __maybe_unused amba_kmi_resume(struct device *dev) |
6344 |
+diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c |
6345 |
+index 6df6f07f1ac66..17b10b81c7131 100644 |
6346 |
+--- a/drivers/input/touchscreen/zinitix.c |
6347 |
++++ b/drivers/input/touchscreen/zinitix.c |
6348 |
+@@ -135,7 +135,7 @@ struct point_coord { |
6349 |
+ |
6350 |
+ struct touch_event { |
6351 |
+ __le16 status; |
6352 |
+- u8 finger_cnt; |
6353 |
++ u8 finger_mask; |
6354 |
+ u8 time_stamp; |
6355 |
+ struct point_coord point_coord[MAX_SUPPORTED_FINGER_NUM]; |
6356 |
+ }; |
6357 |
+@@ -311,11 +311,32 @@ static int zinitix_send_power_on_sequence(struct bt541_ts_data *bt541) |
6358 |
+ static void zinitix_report_finger(struct bt541_ts_data *bt541, int slot, |
6359 |
+ const struct point_coord *p) |
6360 |
+ { |
6361 |
++ u16 x, y; |
6362 |
++ |
6363 |
++ if (unlikely(!(p->sub_status & |
6364 |
++ (SUB_BIT_UP | SUB_BIT_DOWN | SUB_BIT_MOVE)))) { |
6365 |
++ dev_dbg(&bt541->client->dev, "unknown finger event %#02x\n", |
6366 |
++ p->sub_status); |
6367 |
++ return; |
6368 |
++ } |
6369 |
++ |
6370 |
++ x = le16_to_cpu(p->x); |
6371 |
++ y = le16_to_cpu(p->y); |
6372 |
++ |
6373 |
+ input_mt_slot(bt541->input_dev, slot); |
6374 |
+- input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, true); |
6375 |
+- touchscreen_report_pos(bt541->input_dev, &bt541->prop, |
6376 |
+- le16_to_cpu(p->x), le16_to_cpu(p->y), true); |
6377 |
+- input_report_abs(bt541->input_dev, ABS_MT_TOUCH_MAJOR, p->width); |
6378 |
++ if (input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, |
6379 |
++ !(p->sub_status & SUB_BIT_UP))) { |
6380 |
++ touchscreen_report_pos(bt541->input_dev, |
6381 |
++ &bt541->prop, x, y, true); |
6382 |
++ input_report_abs(bt541->input_dev, |
6383 |
++ ABS_MT_TOUCH_MAJOR, p->width); |
6384 |
++ dev_dbg(&bt541->client->dev, "finger %d %s (%u, %u)\n", |
6385 |
++ slot, p->sub_status & SUB_BIT_DOWN ? "down" : "move", |
6386 |
++ x, y); |
6387 |
++ } else { |
6388 |
++ dev_dbg(&bt541->client->dev, "finger %d up (%u, %u)\n", |
6389 |
++ slot, x, y); |
6390 |
++ } |
6391 |
+ } |
6392 |
+ |
6393 |
+ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) |
6394 |
+@@ -323,6 +344,7 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) |
6395 |
+ struct bt541_ts_data *bt541 = bt541_handler; |
6396 |
+ struct i2c_client *client = bt541->client; |
6397 |
+ struct touch_event touch_event; |
6398 |
++ unsigned long finger_mask; |
6399 |
+ int error; |
6400 |
+ int i; |
6401 |
+ |
6402 |
+@@ -335,10 +357,14 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) |
6403 |
+ goto out; |
6404 |
+ } |
6405 |
+ |
6406 |
+- for (i = 0; i < MAX_SUPPORTED_FINGER_NUM; i++) |
6407 |
+- if (touch_event.point_coord[i].sub_status & SUB_BIT_EXIST) |
6408 |
+- zinitix_report_finger(bt541, i, |
6409 |
+- &touch_event.point_coord[i]); |
6410 |
++ finger_mask = touch_event.finger_mask; |
6411 |
++ for_each_set_bit(i, &finger_mask, MAX_SUPPORTED_FINGER_NUM) { |
6412 |
++ const struct point_coord *p = &touch_event.point_coord[i]; |
6413 |
++ |
6414 |
++ /* Only process contacts that are actually reported */ |
6415 |
++ if (p->sub_status & SUB_BIT_EXIST) |
6416 |
++ zinitix_report_finger(bt541, i, p); |
6417 |
++ } |
6418 |
+ |
6419 |
+ input_mt_sync_frame(bt541->input_dev); |
6420 |
+ input_sync(bt541->input_dev); |
6421 |
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
6422 |
+index 1164d1a42cbc5..4600e97acb264 100644 |
6423 |
+--- a/drivers/iommu/iova.c |
6424 |
++++ b/drivers/iommu/iova.c |
6425 |
+@@ -138,10 +138,11 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) |
6426 |
+ cached_iova = rb_entry(iovad->cached32_node, struct iova, node); |
6427 |
+ if (free == cached_iova || |
6428 |
+ (free->pfn_hi < iovad->dma_32bit_pfn && |
6429 |
+- free->pfn_lo >= cached_iova->pfn_lo)) { |
6430 |
++ free->pfn_lo >= cached_iova->pfn_lo)) |
6431 |
+ iovad->cached32_node = rb_next(&free->node); |
6432 |
++ |
6433 |
++ if (free->pfn_lo < iovad->dma_32bit_pfn) |
6434 |
+ iovad->max32_alloc_size = iovad->dma_32bit_pfn; |
6435 |
+- } |
6436 |
+ |
6437 |
+ cached_iova = rb_entry(iovad->cached_node, struct iova, node); |
6438 |
+ if (free->pfn_lo >= cached_iova->pfn_lo) |
6439 |
+diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c |
6440 |
+index 0f18abda0e208..bae6c7078ec97 100644 |
6441 |
+--- a/drivers/iommu/ipmmu-vmsa.c |
6442 |
++++ b/drivers/iommu/ipmmu-vmsa.c |
6443 |
+@@ -1013,7 +1013,9 @@ static int ipmmu_probe(struct platform_device *pdev) |
6444 |
+ bitmap_zero(mmu->ctx, IPMMU_CTX_MAX); |
6445 |
+ mmu->features = of_device_get_match_data(&pdev->dev); |
6446 |
+ memset(mmu->utlb_ctx, IPMMU_CTX_INVALID, mmu->features->num_utlbs); |
6447 |
+- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); |
6448 |
++ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); |
6449 |
++ if (ret) |
6450 |
++ return ret; |
6451 |
+ |
6452 |
+ /* Map I/O memory and request IRQ. */ |
6453 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
6454 |
+diff --git a/drivers/irqchip/irq-nvic.c b/drivers/irqchip/irq-nvic.c |
6455 |
+index 21cb31ff2bbf2..e903c44edb64a 100644 |
6456 |
+--- a/drivers/irqchip/irq-nvic.c |
6457 |
++++ b/drivers/irqchip/irq-nvic.c |
6458 |
+@@ -94,6 +94,7 @@ static int __init nvic_of_init(struct device_node *node, |
6459 |
+ |
6460 |
+ if (!nvic_irq_domain) { |
6461 |
+ pr_warn("Failed to allocate irq domain\n"); |
6462 |
++ iounmap(nvic_base); |
6463 |
+ return -ENOMEM; |
6464 |
+ } |
6465 |
+ |
6466 |
+@@ -103,6 +104,7 @@ static int __init nvic_of_init(struct device_node *node, |
6467 |
+ if (ret) { |
6468 |
+ pr_warn("Failed to allocate irq chips\n"); |
6469 |
+ irq_domain_remove(nvic_irq_domain); |
6470 |
++ iounmap(nvic_base); |
6471 |
+ return ret; |
6472 |
+ } |
6473 |
+ |
6474 |
+diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c |
6475 |
+index 5dc63c20b67ea..fc747b7f49830 100644 |
6476 |
+--- a/drivers/irqchip/qcom-pdc.c |
6477 |
++++ b/drivers/irqchip/qcom-pdc.c |
6478 |
+@@ -74,17 +74,18 @@ static int qcom_pdc_gic_set_irqchip_state(struct irq_data *d, |
6479 |
+ static void pdc_enable_intr(struct irq_data *d, bool on) |
6480 |
+ { |
6481 |
+ int pin_out = d->hwirq; |
6482 |
++ unsigned long flags; |
6483 |
+ u32 index, mask; |
6484 |
+ u32 enable; |
6485 |
+ |
6486 |
+ index = pin_out / 32; |
6487 |
+ mask = pin_out % 32; |
6488 |
+ |
6489 |
+- raw_spin_lock(&pdc_lock); |
6490 |
++ raw_spin_lock_irqsave(&pdc_lock, flags); |
6491 |
+ enable = pdc_reg_read(IRQ_ENABLE_BANK, index); |
6492 |
+ enable = on ? ENABLE_INTR(enable, mask) : CLEAR_INTR(enable, mask); |
6493 |
+ pdc_reg_write(IRQ_ENABLE_BANK, index, enable); |
6494 |
+- raw_spin_unlock(&pdc_lock); |
6495 |
++ raw_spin_unlock_irqrestore(&pdc_lock, flags); |
6496 |
+ } |
6497 |
+ |
6498 |
+ static void qcom_pdc_gic_disable(struct irq_data *d) |
6499 |
+diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c |
6500 |
+index 2543c7b6948b6..c5663398c6b7d 100644 |
6501 |
+--- a/drivers/mailbox/imx-mailbox.c |
6502 |
++++ b/drivers/mailbox/imx-mailbox.c |
6503 |
+@@ -13,6 +13,7 @@ |
6504 |
+ #include <linux/module.h> |
6505 |
+ #include <linux/of_device.h> |
6506 |
+ #include <linux/pm_runtime.h> |
6507 |
++#include <linux/suspend.h> |
6508 |
+ #include <linux/slab.h> |
6509 |
+ |
6510 |
+ #define IMX_MU_xSR_GIPn(x) BIT(28 + (3 - (x))) |
6511 |
+@@ -66,6 +67,7 @@ struct imx_mu_priv { |
6512 |
+ const struct imx_mu_dcfg *dcfg; |
6513 |
+ struct clk *clk; |
6514 |
+ int irq; |
6515 |
++ bool suspend; |
6516 |
+ |
6517 |
+ u32 xcr; |
6518 |
+ |
6519 |
+@@ -277,6 +279,9 @@ static irqreturn_t imx_mu_isr(int irq, void *p) |
6520 |
+ return IRQ_NONE; |
6521 |
+ } |
6522 |
+ |
6523 |
++ if (priv->suspend) |
6524 |
++ pm_system_wakeup(); |
6525 |
++ |
6526 |
+ return IRQ_HANDLED; |
6527 |
+ } |
6528 |
+ |
6529 |
+@@ -326,6 +331,8 @@ static int imx_mu_startup(struct mbox_chan *chan) |
6530 |
+ break; |
6531 |
+ } |
6532 |
+ |
6533 |
++ priv->suspend = true; |
6534 |
++ |
6535 |
+ return 0; |
6536 |
+ } |
6537 |
+ |
6538 |
+@@ -543,6 +550,8 @@ static int imx_mu_probe(struct platform_device *pdev) |
6539 |
+ |
6540 |
+ clk_disable_unprepare(priv->clk); |
6541 |
+ |
6542 |
++ priv->suspend = false; |
6543 |
++ |
6544 |
+ return 0; |
6545 |
+ |
6546 |
+ disable_runtime_pm: |
6547 |
+diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c |
6548 |
+index e07091d71986a..4895d80740022 100644 |
6549 |
+--- a/drivers/mailbox/tegra-hsp.c |
6550 |
++++ b/drivers/mailbox/tegra-hsp.c |
6551 |
+@@ -410,6 +410,11 @@ static int tegra_hsp_mailbox_flush(struct mbox_chan *chan, |
6552 |
+ value = tegra_hsp_channel_readl(ch, HSP_SM_SHRD_MBOX); |
6553 |
+ if ((value & HSP_SM_SHRD_MBOX_FULL) == 0) { |
6554 |
+ mbox_chan_txdone(chan, 0); |
6555 |
++ |
6556 |
++ /* Wait until channel is empty */ |
6557 |
++ if (chan->active_req != NULL) |
6558 |
++ continue; |
6559 |
++ |
6560 |
+ return 0; |
6561 |
+ } |
6562 |
+ |
6563 |
+diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
6564 |
+index fe6dce125aba2..418914373a513 100644 |
6565 |
+--- a/drivers/md/bcache/btree.c |
6566 |
++++ b/drivers/md/bcache/btree.c |
6567 |
+@@ -2060,9 +2060,11 @@ int bch_btree_check(struct cache_set *c) |
6568 |
+ } |
6569 |
+ } |
6570 |
+ |
6571 |
++ /* |
6572 |
++ * Must wait for all threads to stop. |
6573 |
++ */ |
6574 |
+ wait_event_interruptible(check_state->wait, |
6575 |
+- atomic_read(&check_state->started) == 0 || |
6576 |
+- test_bit(CACHE_SET_IO_DISABLE, &c->flags)); |
6577 |
++ atomic_read(&check_state->started) == 0); |
6578 |
+ |
6579 |
+ for (i = 0; i < check_state->total_threads; i++) { |
6580 |
+ if (check_state->infos[i].result) { |
6581 |
+diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c |
6582 |
+index 3c74996978dad..952253f24175a 100644 |
6583 |
+--- a/drivers/md/bcache/writeback.c |
6584 |
++++ b/drivers/md/bcache/writeback.c |
6585 |
+@@ -952,9 +952,11 @@ void bch_sectors_dirty_init(struct bcache_device *d) |
6586 |
+ } |
6587 |
+ } |
6588 |
+ |
6589 |
++ /* |
6590 |
++ * Must wait for all threads to stop. |
6591 |
++ */ |
6592 |
+ wait_event_interruptible(state->wait, |
6593 |
+- atomic_read(&state->started) == 0 || |
6594 |
+- test_bit(CACHE_SET_IO_DISABLE, &c->flags)); |
6595 |
++ atomic_read(&state->started) == 0); |
6596 |
+ |
6597 |
+ out: |
6598 |
+ kfree(state); |
6599 |
+diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
6600 |
+index 2aa4acd33af39..b9677f701b6a1 100644 |
6601 |
+--- a/drivers/md/dm-crypt.c |
6602 |
++++ b/drivers/md/dm-crypt.c |
6603 |
+@@ -2561,7 +2561,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string |
6604 |
+ |
6605 |
+ static int get_key_size(char **key_string) |
6606 |
+ { |
6607 |
+- return (*key_string[0] == ':') ? -EINVAL : strlen(*key_string) >> 1; |
6608 |
++ return (*key_string[0] == ':') ? -EINVAL : (int)(strlen(*key_string) >> 1); |
6609 |
+ } |
6610 |
+ |
6611 |
+ #endif /* CONFIG_KEYS */ |
6612 |
+diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c |
6613 |
+index 4c7da1c4e6cb9..f7471a2642dd4 100644 |
6614 |
+--- a/drivers/md/dm-integrity.c |
6615 |
++++ b/drivers/md/dm-integrity.c |
6616 |
+@@ -2354,9 +2354,11 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start, |
6617 |
+ dm_integrity_io_error(ic, "invalid sector in journal", -EIO); |
6618 |
+ sec &= ~(sector_t)(ic->sectors_per_block - 1); |
6619 |
+ } |
6620 |
++ if (unlikely(sec >= ic->provided_data_sectors)) { |
6621 |
++ journal_entry_set_unused(je); |
6622 |
++ continue; |
6623 |
++ } |
6624 |
+ } |
6625 |
+- if (unlikely(sec >= ic->provided_data_sectors)) |
6626 |
+- continue; |
6627 |
+ get_area_and_offset(ic, sec, &area, &offset); |
6628 |
+ restore_last_bytes(ic, access_journal_data(ic, i, j), je); |
6629 |
+ for (k = j + 1; k < ic->journal_section_entries; k++) { |
6630 |
+diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c |
6631 |
+index ab7883cff8b22..9f5713b76794d 100644 |
6632 |
+--- a/drivers/media/i2c/adv7511-v4l2.c |
6633 |
++++ b/drivers/media/i2c/adv7511-v4l2.c |
6634 |
+@@ -555,7 +555,7 @@ static void log_infoframe(struct v4l2_subdev *sd, const struct adv7511_cfg_read_ |
6635 |
+ buffer[3] = 0; |
6636 |
+ buffer[3] = hdmi_infoframe_checksum(buffer, len + 4); |
6637 |
+ |
6638 |
+- if (hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)) < 0) { |
6639 |
++ if (hdmi_infoframe_unpack(&frame, buffer, len + 4) < 0) { |
6640 |
+ v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, cri->desc); |
6641 |
+ return; |
6642 |
+ } |
6643 |
+diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c |
6644 |
+index d1f58795794fd..8cf1704308bf5 100644 |
6645 |
+--- a/drivers/media/i2c/adv7604.c |
6646 |
++++ b/drivers/media/i2c/adv7604.c |
6647 |
+@@ -2454,7 +2454,7 @@ static int adv76xx_read_infoframe(struct v4l2_subdev *sd, int index, |
6648 |
+ buffer[i + 3] = infoframe_read(sd, |
6649 |
+ adv76xx_cri[index].payload_addr + i); |
6650 |
+ |
6651 |
+- if (hdmi_infoframe_unpack(frame, buffer, sizeof(buffer)) < 0) { |
6652 |
++ if (hdmi_infoframe_unpack(frame, buffer, len + 3) < 0) { |
6653 |
+ v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, |
6654 |
+ adv76xx_cri[index].desc); |
6655 |
+ return -ENOENT; |
6656 |
+diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c |
6657 |
+index f7d2b6cd3008b..a870117feb44c 100644 |
6658 |
+--- a/drivers/media/i2c/adv7842.c |
6659 |
++++ b/drivers/media/i2c/adv7842.c |
6660 |
+@@ -2574,7 +2574,7 @@ static void log_infoframe(struct v4l2_subdev *sd, const struct adv7842_cfg_read_ |
6661 |
+ for (i = 0; i < len; i++) |
6662 |
+ buffer[i + 3] = infoframe_read(sd, cri->payload_addr + i); |
6663 |
+ |
6664 |
+- if (hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)) < 0) { |
6665 |
++ if (hdmi_infoframe_unpack(&frame, buffer, len + 3) < 0) { |
6666 |
+ v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, cri->desc); |
6667 |
+ return; |
6668 |
+ } |
6669 |
+diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c |
6670 |
+index 35a51e9b539da..1f0e4b913a053 100644 |
6671 |
+--- a/drivers/media/pci/bt8xx/bttv-driver.c |
6672 |
++++ b/drivers/media/pci/bt8xx/bttv-driver.c |
6673 |
+@@ -3898,7 +3898,7 @@ static int bttv_register_video(struct bttv *btv) |
6674 |
+ |
6675 |
+ /* video */ |
6676 |
+ vdev_init(btv, &btv->video_dev, &bttv_video_template, "video"); |
6677 |
+- btv->video_dev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | |
6678 |
++ btv->video_dev.device_caps = V4L2_CAP_VIDEO_CAPTURE | |
6679 |
+ V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
6680 |
+ if (btv->tuner_type != TUNER_ABSENT) |
6681 |
+ btv->video_dev.device_caps |= V4L2_CAP_TUNER; |
6682 |
+@@ -3919,7 +3919,7 @@ static int bttv_register_video(struct bttv *btv) |
6683 |
+ /* vbi */ |
6684 |
+ vdev_init(btv, &btv->vbi_dev, &bttv_video_template, "vbi"); |
6685 |
+ btv->vbi_dev.device_caps = V4L2_CAP_VBI_CAPTURE | V4L2_CAP_READWRITE | |
6686 |
+- V4L2_CAP_STREAMING | V4L2_CAP_TUNER; |
6687 |
++ V4L2_CAP_STREAMING; |
6688 |
+ if (btv->tuner_type != TUNER_ABSENT) |
6689 |
+ btv->vbi_dev.device_caps |= V4L2_CAP_TUNER; |
6690 |
+ |
6691 |
+diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c |
6692 |
+index a57c991b165b1..10d2971ef0624 100644 |
6693 |
+--- a/drivers/media/pci/cx88/cx88-mpeg.c |
6694 |
++++ b/drivers/media/pci/cx88/cx88-mpeg.c |
6695 |
+@@ -162,6 +162,9 @@ int cx8802_start_dma(struct cx8802_dev *dev, |
6696 |
+ cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); |
6697 |
+ q->count = 0; |
6698 |
+ |
6699 |
++ /* clear interrupt status register */ |
6700 |
++ cx_write(MO_TS_INTSTAT, 0x1f1111); |
6701 |
++ |
6702 |
+ /* enable irqs */ |
6703 |
+ dprintk(1, "setting the interrupt mask\n"); |
6704 |
+ cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT); |
6705 |
+diff --git a/drivers/media/pci/ivtv/ivtv-driver.h b/drivers/media/pci/ivtv/ivtv-driver.h |
6706 |
+index e5efe525ad7bf..00caf60ff9890 100644 |
6707 |
+--- a/drivers/media/pci/ivtv/ivtv-driver.h |
6708 |
++++ b/drivers/media/pci/ivtv/ivtv-driver.h |
6709 |
+@@ -332,7 +332,6 @@ struct ivtv_stream { |
6710 |
+ struct ivtv *itv; /* for ease of use */ |
6711 |
+ const char *name; /* name of the stream */ |
6712 |
+ int type; /* stream type */ |
6713 |
+- u32 caps; /* V4L2 capabilities */ |
6714 |
+ |
6715 |
+ struct v4l2_fh *fh; /* pointer to the streaming filehandle */ |
6716 |
+ spinlock_t qlock; /* locks access to the queues */ |
6717 |
+diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c |
6718 |
+index 35dccb31174c1..a9d69b253516b 100644 |
6719 |
+--- a/drivers/media/pci/ivtv/ivtv-ioctl.c |
6720 |
++++ b/drivers/media/pci/ivtv/ivtv-ioctl.c |
6721 |
+@@ -443,7 +443,7 @@ static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_f |
6722 |
+ struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; |
6723 |
+ struct v4l2_window *winfmt = &fmt->fmt.win; |
6724 |
+ |
6725 |
+- if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6726 |
++ if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6727 |
+ return -EINVAL; |
6728 |
+ if (!itv->osd_video_pbase) |
6729 |
+ return -EINVAL; |
6730 |
+@@ -554,7 +554,7 @@ static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2 |
6731 |
+ u32 chromakey = fmt->fmt.win.chromakey; |
6732 |
+ u8 global_alpha = fmt->fmt.win.global_alpha; |
6733 |
+ |
6734 |
+- if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6735 |
++ if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6736 |
+ return -EINVAL; |
6737 |
+ if (!itv->osd_video_pbase) |
6738 |
+ return -EINVAL; |
6739 |
+@@ -1388,7 +1388,7 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) |
6740 |
+ 0, |
6741 |
+ }; |
6742 |
+ |
6743 |
+- if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6744 |
++ if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6745 |
+ return -ENOTTY; |
6746 |
+ if (!itv->osd_video_pbase) |
6747 |
+ return -ENOTTY; |
6748 |
+@@ -1455,7 +1455,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffe |
6749 |
+ struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; |
6750 |
+ struct yuv_playback_info *yi = &itv->yuv_info; |
6751 |
+ |
6752 |
+- if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6753 |
++ if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6754 |
+ return -ENOTTY; |
6755 |
+ if (!itv->osd_video_pbase) |
6756 |
+ return -ENOTTY; |
6757 |
+@@ -1475,7 +1475,7 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on) |
6758 |
+ struct ivtv *itv = id->itv; |
6759 |
+ struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; |
6760 |
+ |
6761 |
+- if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6762 |
++ if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
6763 |
+ return -ENOTTY; |
6764 |
+ if (!itv->osd_video_pbase) |
6765 |
+ return -ENOTTY; |
6766 |
+diff --git a/drivers/media/pci/ivtv/ivtv-streams.c b/drivers/media/pci/ivtv/ivtv-streams.c |
6767 |
+index f04ee84bab5fd..f9de5d1605fe3 100644 |
6768 |
+--- a/drivers/media/pci/ivtv/ivtv-streams.c |
6769 |
++++ b/drivers/media/pci/ivtv/ivtv-streams.c |
6770 |
+@@ -176,7 +176,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type) |
6771 |
+ s->itv = itv; |
6772 |
+ s->type = type; |
6773 |
+ s->name = ivtv_stream_info[type].name; |
6774 |
+- s->caps = ivtv_stream_info[type].v4l2_caps; |
6775 |
++ s->vdev.device_caps = ivtv_stream_info[type].v4l2_caps; |
6776 |
+ |
6777 |
+ if (ivtv_stream_info[type].pio) |
6778 |
+ s->dma = PCI_DMA_NONE; |
6779 |
+@@ -299,12 +299,9 @@ static int ivtv_reg_dev(struct ivtv *itv, int type) |
6780 |
+ if (s_mpg->vdev.v4l2_dev) |
6781 |
+ num = s_mpg->vdev.num + ivtv_stream_info[type].num_offset; |
6782 |
+ } |
6783 |
+- s->vdev.device_caps = s->caps; |
6784 |
+- if (itv->osd_video_pbase) { |
6785 |
+- itv->streams[IVTV_DEC_STREAM_TYPE_YUV].vdev.device_caps |= |
6786 |
+- V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
6787 |
+- itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps |= |
6788 |
+- V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
6789 |
++ if (itv->osd_video_pbase && (type == IVTV_DEC_STREAM_TYPE_YUV || |
6790 |
++ type == IVTV_DEC_STREAM_TYPE_MPG)) { |
6791 |
++ s->vdev.device_caps |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
6792 |
+ itv->v4l2_cap |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
6793 |
+ } |
6794 |
+ video_set_drvdata(&s->vdev, s); |
6795 |
+diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c |
6796 |
+index 7a1fb067b0e09..d3cde05a6ebab 100644 |
6797 |
+--- a/drivers/media/pci/saa7134/saa7134-alsa.c |
6798 |
++++ b/drivers/media/pci/saa7134/saa7134-alsa.c |
6799 |
+@@ -1214,16 +1214,14 @@ static int alsa_device_exit(struct saa7134_dev *dev) |
6800 |
+ |
6801 |
+ static int saa7134_alsa_init(void) |
6802 |
+ { |
6803 |
+- struct saa7134_dev *dev = NULL; |
6804 |
+- struct list_head *list; |
6805 |
++ struct saa7134_dev *dev; |
6806 |
+ |
6807 |
+ saa7134_dmasound_init = alsa_device_init; |
6808 |
+ saa7134_dmasound_exit = alsa_device_exit; |
6809 |
+ |
6810 |
+ pr_info("saa7134 ALSA driver for DMA sound loaded\n"); |
6811 |
+ |
6812 |
+- list_for_each(list,&saa7134_devlist) { |
6813 |
+- dev = list_entry(list, struct saa7134_dev, devlist); |
6814 |
++ list_for_each_entry(dev, &saa7134_devlist, devlist) { |
6815 |
+ if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130) |
6816 |
+ pr_info("%s/alsa: %s doesn't support digital audio\n", |
6817 |
+ dev->name, saa7134_boards[dev->board].name); |
6818 |
+@@ -1231,7 +1229,7 @@ static int saa7134_alsa_init(void) |
6819 |
+ alsa_device_init(dev); |
6820 |
+ } |
6821 |
+ |
6822 |
+- if (dev == NULL) |
6823 |
++ if (list_empty(&saa7134_devlist)) |
6824 |
+ pr_info("saa7134 ALSA: no saa7134 cards found\n"); |
6825 |
+ |
6826 |
+ return 0; |
6827 |
+diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c |
6828 |
+index debc7509c173c..757a58829a512 100644 |
6829 |
+--- a/drivers/media/platform/aspeed-video.c |
6830 |
++++ b/drivers/media/platform/aspeed-video.c |
6831 |
+@@ -151,7 +151,7 @@ |
6832 |
+ #define VE_SRC_TB_EDGE_DET_BOT GENMASK(28, VE_SRC_TB_EDGE_DET_BOT_SHF) |
6833 |
+ |
6834 |
+ #define VE_MODE_DETECT_STATUS 0x098 |
6835 |
+-#define VE_MODE_DETECT_H_PIXELS GENMASK(11, 0) |
6836 |
++#define VE_MODE_DETECT_H_PERIOD GENMASK(11, 0) |
6837 |
+ #define VE_MODE_DETECT_V_LINES_SHF 16 |
6838 |
+ #define VE_MODE_DETECT_V_LINES GENMASK(27, VE_MODE_DETECT_V_LINES_SHF) |
6839 |
+ #define VE_MODE_DETECT_STATUS_VSYNC BIT(28) |
6840 |
+@@ -162,6 +162,8 @@ |
6841 |
+ #define VE_SYNC_STATUS_VSYNC_SHF 16 |
6842 |
+ #define VE_SYNC_STATUS_VSYNC GENMASK(27, VE_SYNC_STATUS_VSYNC_SHF) |
6843 |
+ |
6844 |
++#define VE_H_TOTAL_PIXELS 0x0A0 |
6845 |
++ |
6846 |
+ #define VE_INTERRUPT_CTRL 0x304 |
6847 |
+ #define VE_INTERRUPT_STATUS 0x308 |
6848 |
+ #define VE_INTERRUPT_MODE_DETECT_WD BIT(0) |
6849 |
+@@ -765,6 +767,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
6850 |
+ u32 src_lr_edge; |
6851 |
+ u32 src_tb_edge; |
6852 |
+ u32 sync; |
6853 |
++ u32 htotal; |
6854 |
+ struct v4l2_bt_timings *det = &video->detected_timings; |
6855 |
+ |
6856 |
+ det->width = MIN_WIDTH; |
6857 |
+@@ -809,6 +812,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
6858 |
+ src_tb_edge = aspeed_video_read(video, VE_SRC_TB_EDGE_DET); |
6859 |
+ mds = aspeed_video_read(video, VE_MODE_DETECT_STATUS); |
6860 |
+ sync = aspeed_video_read(video, VE_SYNC_STATUS); |
6861 |
++ htotal = aspeed_video_read(video, VE_H_TOTAL_PIXELS); |
6862 |
+ |
6863 |
+ video->frame_bottom = (src_tb_edge & VE_SRC_TB_EDGE_DET_BOT) >> |
6864 |
+ VE_SRC_TB_EDGE_DET_BOT_SHF; |
6865 |
+@@ -825,8 +829,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
6866 |
+ VE_SRC_LR_EDGE_DET_RT_SHF; |
6867 |
+ video->frame_left = src_lr_edge & VE_SRC_LR_EDGE_DET_LEFT; |
6868 |
+ det->hfrontporch = video->frame_left; |
6869 |
+- det->hbackporch = (mds & VE_MODE_DETECT_H_PIXELS) - |
6870 |
+- video->frame_right; |
6871 |
++ det->hbackporch = htotal - video->frame_right; |
6872 |
+ det->hsync = sync & VE_SYNC_STATUS_HSYNC; |
6873 |
+ if (video->frame_left > video->frame_right) |
6874 |
+ continue; |
6875 |
+diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c |
6876 |
+index 1eed69d29149f..2333079a83c71 100644 |
6877 |
+--- a/drivers/media/platform/coda/coda-common.c |
6878 |
++++ b/drivers/media/platform/coda/coda-common.c |
6879 |
+@@ -408,6 +408,7 @@ static struct vdoa_data *coda_get_vdoa_data(void) |
6880 |
+ if (!vdoa_data) |
6881 |
+ vdoa_data = ERR_PTR(-EPROBE_DEFER); |
6882 |
+ |
6883 |
++ put_device(&vdoa_pdev->dev); |
6884 |
+ out: |
6885 |
+ of_node_put(vdoa_node); |
6886 |
+ |
6887 |
+diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c |
6888 |
+index 5e67994e62cca..ee610daf90a3c 100644 |
6889 |
+--- a/drivers/media/platform/davinci/vpif.c |
6890 |
++++ b/drivers/media/platform/davinci/vpif.c |
6891 |
+@@ -428,6 +428,7 @@ static int vpif_probe(struct platform_device *pdev) |
6892 |
+ static struct resource *res, *res_irq; |
6893 |
+ struct platform_device *pdev_capture, *pdev_display; |
6894 |
+ struct device_node *endpoint = NULL; |
6895 |
++ int ret; |
6896 |
+ |
6897 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
6898 |
+ vpif_base = devm_ioremap_resource(&pdev->dev, res); |
6899 |
+@@ -458,8 +459,8 @@ static int vpif_probe(struct platform_device *pdev) |
6900 |
+ res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
6901 |
+ if (!res_irq) { |
6902 |
+ dev_warn(&pdev->dev, "Missing IRQ resource.\n"); |
6903 |
+- pm_runtime_put(&pdev->dev); |
6904 |
+- return -EINVAL; |
6905 |
++ ret = -EINVAL; |
6906 |
++ goto err_put_rpm; |
6907 |
+ } |
6908 |
+ |
6909 |
+ pdev_capture = devm_kzalloc(&pdev->dev, sizeof(*pdev_capture), |
6910 |
+@@ -493,10 +494,17 @@ static int vpif_probe(struct platform_device *pdev) |
6911 |
+ } |
6912 |
+ |
6913 |
+ return 0; |
6914 |
++ |
6915 |
++err_put_rpm: |
6916 |
++ pm_runtime_put(&pdev->dev); |
6917 |
++ pm_runtime_disable(&pdev->dev); |
6918 |
++ |
6919 |
++ return ret; |
6920 |
+ } |
6921 |
+ |
6922 |
+ static int vpif_remove(struct platform_device *pdev) |
6923 |
+ { |
6924 |
++ pm_runtime_put(&pdev->dev); |
6925 |
+ pm_runtime_disable(&pdev->dev); |
6926 |
+ return 0; |
6927 |
+ } |
6928 |
+diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c |
6929 |
+index cd27f637dbe7c..cfc7ebed8fb7a 100644 |
6930 |
+--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c |
6931 |
++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c |
6932 |
+@@ -102,6 +102,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev, |
6933 |
+ vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id); |
6934 |
+ |
6935 |
+ fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL); |
6936 |
++ if (!fw) |
6937 |
++ return ERR_PTR(-ENOMEM); |
6938 |
+ fw->type = VPU; |
6939 |
+ fw->ops = &mtk_vcodec_vpu_msg; |
6940 |
+ fw->pdev = fw_pdev; |
6941 |
+diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c |
6942 |
+index c6cd2e6d8e654..a50701cfbbd7b 100644 |
6943 |
+--- a/drivers/media/rc/gpio-ir-tx.c |
6944 |
++++ b/drivers/media/rc/gpio-ir-tx.c |
6945 |
+@@ -48,11 +48,29 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier) |
6946 |
+ return 0; |
6947 |
+ } |
6948 |
+ |
6949 |
++static void delay_until(ktime_t until) |
6950 |
++{ |
6951 |
++ /* |
6952 |
++ * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on |
6953 |
++ * m68k ndelay(s64) does not compile; so use s32 rather than s64. |
6954 |
++ */ |
6955 |
++ s32 delta; |
6956 |
++ |
6957 |
++ while (true) { |
6958 |
++ delta = ktime_us_delta(until, ktime_get()); |
6959 |
++ if (delta <= 0) |
6960 |
++ return; |
6961 |
++ |
6962 |
++ /* udelay more than 1ms may not work */ |
6963 |
++ delta = min(delta, 1000); |
6964 |
++ udelay(delta); |
6965 |
++ } |
6966 |
++} |
6967 |
++ |
6968 |
+ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, |
6969 |
+ uint count) |
6970 |
+ { |
6971 |
+ ktime_t edge; |
6972 |
+- s32 delta; |
6973 |
+ int i; |
6974 |
+ |
6975 |
+ local_irq_disable(); |
6976 |
+@@ -63,9 +81,7 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, |
6977 |
+ gpiod_set_value(gpio_ir->gpio, !(i % 2)); |
6978 |
+ |
6979 |
+ edge = ktime_add_us(edge, txbuf[i]); |
6980 |
+- delta = ktime_us_delta(edge, ktime_get()); |
6981 |
+- if (delta > 0) |
6982 |
+- udelay(delta); |
6983 |
++ delay_until(edge); |
6984 |
+ } |
6985 |
+ |
6986 |
+ gpiod_set_value(gpio_ir->gpio, 0); |
6987 |
+@@ -97,9 +113,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, |
6988 |
+ if (i % 2) { |
6989 |
+ // space |
6990 |
+ edge = ktime_add_us(edge, txbuf[i]); |
6991 |
+- delta = ktime_us_delta(edge, ktime_get()); |
6992 |
+- if (delta > 0) |
6993 |
+- udelay(delta); |
6994 |
++ delay_until(edge); |
6995 |
+ } else { |
6996 |
+ // pulse |
6997 |
+ ktime_t last = ktime_add_us(edge, txbuf[i]); |
6998 |
+diff --git a/drivers/media/rc/ir_toy.c b/drivers/media/rc/ir_toy.c |
6999 |
+index 1aa7989e756cc..7f394277478b3 100644 |
7000 |
+--- a/drivers/media/rc/ir_toy.c |
7001 |
++++ b/drivers/media/rc/ir_toy.c |
7002 |
+@@ -429,7 +429,7 @@ static int irtoy_probe(struct usb_interface *intf, |
7003 |
+ err = usb_submit_urb(irtoy->urb_in, GFP_KERNEL); |
7004 |
+ if (err != 0) { |
7005 |
+ dev_err(irtoy->dev, "fail to submit in urb: %d\n", err); |
7006 |
+- return err; |
7007 |
++ goto free_rcdev; |
7008 |
+ } |
7009 |
+ |
7010 |
+ err = irtoy_setup(irtoy); |
7011 |
+diff --git a/drivers/media/test-drivers/vidtv/vidtv_s302m.c b/drivers/media/test-drivers/vidtv/vidtv_s302m.c |
7012 |
+index d79b65854627c..4676083cee3b8 100644 |
7013 |
+--- a/drivers/media/test-drivers/vidtv/vidtv_s302m.c |
7014 |
++++ b/drivers/media/test-drivers/vidtv/vidtv_s302m.c |
7015 |
+@@ -455,6 +455,9 @@ struct vidtv_encoder |
7016 |
+ e->name = kstrdup(args.name, GFP_KERNEL); |
7017 |
+ |
7018 |
+ e->encoder_buf = vzalloc(VIDTV_S302M_BUF_SZ); |
7019 |
++ if (!e->encoder_buf) |
7020 |
++ goto out_kfree_e; |
7021 |
++ |
7022 |
+ e->encoder_buf_sz = VIDTV_S302M_BUF_SZ; |
7023 |
+ e->encoder_buf_offset = 0; |
7024 |
+ |
7025 |
+@@ -467,10 +470,8 @@ struct vidtv_encoder |
7026 |
+ e->is_video_encoder = false; |
7027 |
+ |
7028 |
+ ctx = kzalloc(priv_sz, GFP_KERNEL); |
7029 |
+- if (!ctx) { |
7030 |
+- kfree(e); |
7031 |
+- return NULL; |
7032 |
+- } |
7033 |
++ if (!ctx) |
7034 |
++ goto out_kfree_buf; |
7035 |
+ |
7036 |
+ e->ctx = ctx; |
7037 |
+ ctx->last_duration = 0; |
7038 |
+@@ -498,6 +499,14 @@ struct vidtv_encoder |
7039 |
+ e->next = NULL; |
7040 |
+ |
7041 |
+ return e; |
7042 |
++ |
7043 |
++out_kfree_buf: |
7044 |
++ kfree(e->encoder_buf); |
7045 |
++ |
7046 |
++out_kfree_e: |
7047 |
++ kfree(e->name); |
7048 |
++ kfree(e); |
7049 |
++ return NULL; |
7050 |
+ } |
7051 |
+ |
7052 |
+ void vidtv_s302m_encoder_destroy(struct vidtv_encoder *e) |
7053 |
+diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c |
7054 |
+index 87e375562dbb2..26408a972b443 100644 |
7055 |
+--- a/drivers/media/usb/em28xx/em28xx-cards.c |
7056 |
++++ b/drivers/media/usb/em28xx/em28xx-cards.c |
7057 |
+@@ -3881,6 +3881,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, |
7058 |
+ goto err_free; |
7059 |
+ } |
7060 |
+ |
7061 |
++ kref_init(&dev->ref); |
7062 |
++ |
7063 |
+ dev->devno = nr; |
7064 |
+ dev->model = id->driver_info; |
7065 |
+ dev->alt = -1; |
7066 |
+@@ -3981,6 +3983,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, |
7067 |
+ } |
7068 |
+ |
7069 |
+ if (dev->board.has_dual_ts && em28xx_duplicate_dev(dev) == 0) { |
7070 |
++ kref_init(&dev->dev_next->ref); |
7071 |
++ |
7072 |
+ dev->dev_next->ts = SECONDARY_TS; |
7073 |
+ dev->dev_next->alt = -1; |
7074 |
+ dev->dev_next->is_audio_only = has_vendor_audio && |
7075 |
+@@ -4035,12 +4039,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, |
7076 |
+ em28xx_write_reg(dev, 0x0b, 0x82); |
7077 |
+ mdelay(100); |
7078 |
+ } |
7079 |
+- |
7080 |
+- kref_init(&dev->dev_next->ref); |
7081 |
+ } |
7082 |
+ |
7083 |
+- kref_init(&dev->ref); |
7084 |
+- |
7085 |
+ request_modules(dev); |
7086 |
+ |
7087 |
+ /* |
7088 |
+@@ -4095,11 +4095,8 @@ static void em28xx_usb_disconnect(struct usb_interface *intf) |
7089 |
+ |
7090 |
+ em28xx_close_extension(dev); |
7091 |
+ |
7092 |
+- if (dev->dev_next) { |
7093 |
+- em28xx_close_extension(dev->dev_next); |
7094 |
++ if (dev->dev_next) |
7095 |
+ em28xx_release_resources(dev->dev_next); |
7096 |
+- } |
7097 |
+- |
7098 |
+ em28xx_release_resources(dev); |
7099 |
+ |
7100 |
+ if (dev->dev_next) { |
7101 |
+diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c |
7102 |
+index b9e45124673b6..2e5913bccb38f 100644 |
7103 |
+--- a/drivers/media/usb/go7007/s2250-board.c |
7104 |
++++ b/drivers/media/usb/go7007/s2250-board.c |
7105 |
+@@ -504,6 +504,7 @@ static int s2250_probe(struct i2c_client *client, |
7106 |
+ u8 *data; |
7107 |
+ struct go7007 *go = i2c_get_adapdata(adapter); |
7108 |
+ struct go7007_usb *usb = go->hpi_context; |
7109 |
++ int err = -EIO; |
7110 |
+ |
7111 |
+ audio = i2c_new_dummy_device(adapter, TLV320_ADDRESS >> 1); |
7112 |
+ if (IS_ERR(audio)) |
7113 |
+@@ -532,11 +533,8 @@ static int s2250_probe(struct i2c_client *client, |
7114 |
+ V4L2_CID_HUE, -512, 511, 1, 0); |
7115 |
+ sd->ctrl_handler = &state->hdl; |
7116 |
+ if (state->hdl.error) { |
7117 |
+- int err = state->hdl.error; |
7118 |
+- |
7119 |
+- v4l2_ctrl_handler_free(&state->hdl); |
7120 |
+- kfree(state); |
7121 |
+- return err; |
7122 |
++ err = state->hdl.error; |
7123 |
++ goto fail; |
7124 |
+ } |
7125 |
+ |
7126 |
+ state->std = V4L2_STD_NTSC; |
7127 |
+@@ -600,7 +598,7 @@ fail: |
7128 |
+ i2c_unregister_device(audio); |
7129 |
+ v4l2_ctrl_handler_free(&state->hdl); |
7130 |
+ kfree(state); |
7131 |
+- return -EIO; |
7132 |
++ return err; |
7133 |
+ } |
7134 |
+ |
7135 |
+ static int s2250_remove(struct i2c_client *client) |
7136 |
+diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c |
7137 |
+index 563128d117317..60e57e0f19272 100644 |
7138 |
+--- a/drivers/media/usb/hdpvr/hdpvr-video.c |
7139 |
++++ b/drivers/media/usb/hdpvr/hdpvr-video.c |
7140 |
+@@ -308,7 +308,6 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) |
7141 |
+ |
7142 |
+ dev->status = STATUS_STREAMING; |
7143 |
+ |
7144 |
+- INIT_WORK(&dev->worker, hdpvr_transmit_buffers); |
7145 |
+ schedule_work(&dev->worker); |
7146 |
+ |
7147 |
+ v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
7148 |
+@@ -1165,6 +1164,9 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, |
7149 |
+ bool ac3 = dev->flags & HDPVR_FLAG_AC3_CAP; |
7150 |
+ int res; |
7151 |
+ |
7152 |
++ // initialize dev->worker |
7153 |
++ INIT_WORK(&dev->worker, hdpvr_transmit_buffers); |
7154 |
++ |
7155 |
+ dev->cur_std = V4L2_STD_525_60; |
7156 |
+ dev->width = 720; |
7157 |
+ dev->height = 480; |
7158 |
+diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c |
7159 |
+index 4e1698f788187..ce717502ea4c3 100644 |
7160 |
+--- a/drivers/media/usb/stk1160/stk1160-core.c |
7161 |
++++ b/drivers/media/usb/stk1160/stk1160-core.c |
7162 |
+@@ -403,7 +403,7 @@ static void stk1160_disconnect(struct usb_interface *interface) |
7163 |
+ /* Here is the only place where isoc get released */ |
7164 |
+ stk1160_uninit_isoc(dev); |
7165 |
+ |
7166 |
+- stk1160_clear_queue(dev); |
7167 |
++ stk1160_clear_queue(dev, VB2_BUF_STATE_ERROR); |
7168 |
+ |
7169 |
+ video_unregister_device(&dev->vdev); |
7170 |
+ v4l2_device_disconnect(&dev->v4l2_dev); |
7171 |
+diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c |
7172 |
+index 6a4eb616d5160..1aa953469402f 100644 |
7173 |
+--- a/drivers/media/usb/stk1160/stk1160-v4l.c |
7174 |
++++ b/drivers/media/usb/stk1160/stk1160-v4l.c |
7175 |
+@@ -258,7 +258,7 @@ out_uninit: |
7176 |
+ stk1160_uninit_isoc(dev); |
7177 |
+ out_stop_hw: |
7178 |
+ usb_set_interface(dev->udev, 0, 0); |
7179 |
+- stk1160_clear_queue(dev); |
7180 |
++ stk1160_clear_queue(dev, VB2_BUF_STATE_QUEUED); |
7181 |
+ |
7182 |
+ mutex_unlock(&dev->v4l_lock); |
7183 |
+ |
7184 |
+@@ -306,7 +306,7 @@ static int stk1160_stop_streaming(struct stk1160 *dev) |
7185 |
+ |
7186 |
+ stk1160_stop_hw(dev); |
7187 |
+ |
7188 |
+- stk1160_clear_queue(dev); |
7189 |
++ stk1160_clear_queue(dev, VB2_BUF_STATE_ERROR); |
7190 |
+ |
7191 |
+ stk1160_dbg("streaming stopped\n"); |
7192 |
+ |
7193 |
+@@ -745,7 +745,7 @@ static const struct video_device v4l_template = { |
7194 |
+ /********************************************************************/ |
7195 |
+ |
7196 |
+ /* Must be called with both v4l_lock and vb_queue_lock hold */ |
7197 |
+-void stk1160_clear_queue(struct stk1160 *dev) |
7198 |
++void stk1160_clear_queue(struct stk1160 *dev, enum vb2_buffer_state vb2_state) |
7199 |
+ { |
7200 |
+ struct stk1160_buffer *buf; |
7201 |
+ unsigned long flags; |
7202 |
+@@ -756,7 +756,7 @@ void stk1160_clear_queue(struct stk1160 *dev) |
7203 |
+ buf = list_first_entry(&dev->avail_bufs, |
7204 |
+ struct stk1160_buffer, list); |
7205 |
+ list_del(&buf->list); |
7206 |
+- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
7207 |
++ vb2_buffer_done(&buf->vb.vb2_buf, vb2_state); |
7208 |
+ stk1160_dbg("buffer [%p/%d] aborted\n", |
7209 |
+ buf, buf->vb.vb2_buf.index); |
7210 |
+ } |
7211 |
+@@ -766,7 +766,7 @@ void stk1160_clear_queue(struct stk1160 *dev) |
7212 |
+ buf = dev->isoc_ctl.buf; |
7213 |
+ dev->isoc_ctl.buf = NULL; |
7214 |
+ |
7215 |
+- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
7216 |
++ vb2_buffer_done(&buf->vb.vb2_buf, vb2_state); |
7217 |
+ stk1160_dbg("buffer [%p/%d] aborted\n", |
7218 |
+ buf, buf->vb.vb2_buf.index); |
7219 |
+ } |
7220 |
+diff --git a/drivers/media/usb/stk1160/stk1160.h b/drivers/media/usb/stk1160/stk1160.h |
7221 |
+index a31ea1c80f255..a70963ce87533 100644 |
7222 |
+--- a/drivers/media/usb/stk1160/stk1160.h |
7223 |
++++ b/drivers/media/usb/stk1160/stk1160.h |
7224 |
+@@ -166,7 +166,7 @@ struct regval { |
7225 |
+ int stk1160_vb2_setup(struct stk1160 *dev); |
7226 |
+ int stk1160_video_register(struct stk1160 *dev); |
7227 |
+ void stk1160_video_unregister(struct stk1160 *dev); |
7228 |
+-void stk1160_clear_queue(struct stk1160 *dev); |
7229 |
++void stk1160_clear_queue(struct stk1160 *dev, enum vb2_buffer_state vb2_state); |
7230 |
+ |
7231 |
+ /* Provided by stk1160-video.c */ |
7232 |
+ int stk1160_alloc_isoc(struct stk1160 *dev); |
7233 |
+diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c |
7234 |
+index b221b4e438a1a..73190652c267b 100644 |
7235 |
+--- a/drivers/media/v4l2-core/v4l2-mem2mem.c |
7236 |
++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c |
7237 |
+@@ -585,19 +585,14 @@ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7238 |
+ } |
7239 |
+ EXPORT_SYMBOL_GPL(v4l2_m2m_reqbufs); |
7240 |
+ |
7241 |
+-int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7242 |
+- struct v4l2_buffer *buf) |
7243 |
++static void v4l2_m2m_adjust_mem_offset(struct vb2_queue *vq, |
7244 |
++ struct v4l2_buffer *buf) |
7245 |
+ { |
7246 |
+- struct vb2_queue *vq; |
7247 |
+- int ret = 0; |
7248 |
+- unsigned int i; |
7249 |
+- |
7250 |
+- vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); |
7251 |
+- ret = vb2_querybuf(vq, buf); |
7252 |
+- |
7253 |
+ /* Adjust MMAP memory offsets for the CAPTURE queue */ |
7254 |
+ if (buf->memory == V4L2_MEMORY_MMAP && V4L2_TYPE_IS_CAPTURE(vq->type)) { |
7255 |
+ if (V4L2_TYPE_IS_MULTIPLANAR(vq->type)) { |
7256 |
++ unsigned int i; |
7257 |
++ |
7258 |
+ for (i = 0; i < buf->length; ++i) |
7259 |
+ buf->m.planes[i].m.mem_offset |
7260 |
+ += DST_QUEUE_OFF_BASE; |
7261 |
+@@ -605,8 +600,23 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7262 |
+ buf->m.offset += DST_QUEUE_OFF_BASE; |
7263 |
+ } |
7264 |
+ } |
7265 |
++} |
7266 |
+ |
7267 |
+- return ret; |
7268 |
++int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7269 |
++ struct v4l2_buffer *buf) |
7270 |
++{ |
7271 |
++ struct vb2_queue *vq; |
7272 |
++ int ret; |
7273 |
++ |
7274 |
++ vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); |
7275 |
++ ret = vb2_querybuf(vq, buf); |
7276 |
++ if (ret) |
7277 |
++ return ret; |
7278 |
++ |
7279 |
++ /* Adjust MMAP memory offsets for the CAPTURE queue */ |
7280 |
++ v4l2_m2m_adjust_mem_offset(vq, buf); |
7281 |
++ |
7282 |
++ return 0; |
7283 |
+ } |
7284 |
+ EXPORT_SYMBOL_GPL(v4l2_m2m_querybuf); |
7285 |
+ |
7286 |
+@@ -763,6 +773,9 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7287 |
+ if (ret) |
7288 |
+ return ret; |
7289 |
+ |
7290 |
++ /* Adjust MMAP memory offsets for the CAPTURE queue */ |
7291 |
++ v4l2_m2m_adjust_mem_offset(vq, buf); |
7292 |
++ |
7293 |
+ /* |
7294 |
+ * If the capture queue is streaming, but streaming hasn't started |
7295 |
+ * on the device, but was asked to stop, mark the previously queued |
7296 |
+@@ -784,9 +797,17 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7297 |
+ struct v4l2_buffer *buf) |
7298 |
+ { |
7299 |
+ struct vb2_queue *vq; |
7300 |
++ int ret; |
7301 |
+ |
7302 |
+ vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); |
7303 |
+- return vb2_dqbuf(vq, buf, file->f_flags & O_NONBLOCK); |
7304 |
++ ret = vb2_dqbuf(vq, buf, file->f_flags & O_NONBLOCK); |
7305 |
++ if (ret) |
7306 |
++ return ret; |
7307 |
++ |
7308 |
++ /* Adjust MMAP memory offsets for the CAPTURE queue */ |
7309 |
++ v4l2_m2m_adjust_mem_offset(vq, buf); |
7310 |
++ |
7311 |
++ return 0; |
7312 |
+ } |
7313 |
+ EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); |
7314 |
+ |
7315 |
+@@ -795,9 +816,17 @@ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
7316 |
+ { |
7317 |
+ struct video_device *vdev = video_devdata(file); |
7318 |
+ struct vb2_queue *vq; |
7319 |
++ int ret; |
7320 |
+ |
7321 |
+ vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); |
7322 |
+- return vb2_prepare_buf(vq, vdev->v4l2_dev->mdev, buf); |
7323 |
++ ret = vb2_prepare_buf(vq, vdev->v4l2_dev->mdev, buf); |
7324 |
++ if (ret) |
7325 |
++ return ret; |
7326 |
++ |
7327 |
++ /* Adjust MMAP memory offsets for the CAPTURE queue */ |
7328 |
++ v4l2_m2m_adjust_mem_offset(vq, buf); |
7329 |
++ |
7330 |
++ return 0; |
7331 |
+ } |
7332 |
+ EXPORT_SYMBOL_GPL(v4l2_m2m_prepare_buf); |
7333 |
+ |
7334 |
+diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c |
7335 |
+index ddb1879f07d3f..5a059be3516c9 100644 |
7336 |
+--- a/drivers/memory/emif.c |
7337 |
++++ b/drivers/memory/emif.c |
7338 |
+@@ -1403,7 +1403,7 @@ static struct emif_data *__init_or_module get_device_details( |
7339 |
+ temp = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); |
7340 |
+ dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL); |
7341 |
+ |
7342 |
+- if (!emif || !pd || !dev_info) { |
7343 |
++ if (!emif || !temp || !dev_info) { |
7344 |
+ dev_err(dev, "%s:%d: allocation error\n", __func__, __LINE__); |
7345 |
+ goto error; |
7346 |
+ } |
7347 |
+@@ -1495,7 +1495,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev) |
7348 |
+ { |
7349 |
+ struct emif_data *emif; |
7350 |
+ struct resource *res; |
7351 |
+- int irq; |
7352 |
++ int irq, ret; |
7353 |
+ |
7354 |
+ if (pdev->dev.of_node) |
7355 |
+ emif = of_get_memory_device_details(pdev->dev.of_node, &pdev->dev); |
7356 |
+@@ -1526,7 +1526,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev) |
7357 |
+ emif_onetime_settings(emif); |
7358 |
+ emif_debugfs_init(emif); |
7359 |
+ disable_and_clear_all_interrupts(emif); |
7360 |
+- setup_interrupts(emif, irq); |
7361 |
++ ret = setup_interrupts(emif, irq); |
7362 |
++ if (ret) |
7363 |
++ goto error; |
7364 |
+ |
7365 |
+ /* One-time actions taken on probing the first device */ |
7366 |
+ if (!emif1) { |
7367 |
+diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c |
7368 |
+index 575fadbffa306..9eb8cc7de494a 100644 |
7369 |
+--- a/drivers/memory/pl172.c |
7370 |
++++ b/drivers/memory/pl172.c |
7371 |
+@@ -273,14 +273,12 @@ err_clk_enable: |
7372 |
+ return ret; |
7373 |
+ } |
7374 |
+ |
7375 |
+-static int pl172_remove(struct amba_device *adev) |
7376 |
++static void pl172_remove(struct amba_device *adev) |
7377 |
+ { |
7378 |
+ struct pl172_data *pl172 = amba_get_drvdata(adev); |
7379 |
+ |
7380 |
+ clk_disable_unprepare(pl172->clk); |
7381 |
+ amba_release_regions(adev); |
7382 |
+- |
7383 |
+- return 0; |
7384 |
+ } |
7385 |
+ |
7386 |
+ static const struct amba_id pl172_ids[] = { |
7387 |
+diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c |
7388 |
+index cc01979780d87..b0b251bb207f3 100644 |
7389 |
+--- a/drivers/memory/pl353-smc.c |
7390 |
++++ b/drivers/memory/pl353-smc.c |
7391 |
+@@ -427,14 +427,12 @@ out_clk_dis_aper: |
7392 |
+ return err; |
7393 |
+ } |
7394 |
+ |
7395 |
+-static int pl353_smc_remove(struct amba_device *adev) |
7396 |
++static void pl353_smc_remove(struct amba_device *adev) |
7397 |
+ { |
7398 |
+ struct pl353_smc_data *pl353_smc = amba_get_drvdata(adev); |
7399 |
+ |
7400 |
+ clk_disable_unprepare(pl353_smc->memclk); |
7401 |
+ clk_disable_unprepare(pl353_smc->aclk); |
7402 |
+- |
7403 |
+- return 0; |
7404 |
+ } |
7405 |
+ |
7406 |
+ static const struct amba_id pl353_ids[] = { |
7407 |
+diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c |
7408 |
+index a6bd2134cea2a..14e4bbe6a9da3 100644 |
7409 |
+--- a/drivers/mfd/asic3.c |
7410 |
++++ b/drivers/mfd/asic3.c |
7411 |
+@@ -914,14 +914,14 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, |
7412 |
+ ret = mfd_add_devices(&pdev->dev, pdev->id, |
7413 |
+ &asic3_cell_ds1wm, 1, mem, asic->irq_base, NULL); |
7414 |
+ if (ret < 0) |
7415 |
+- goto out; |
7416 |
++ goto out_unmap; |
7417 |
+ } |
7418 |
+ |
7419 |
+ if (mem_sdio && (irq >= 0)) { |
7420 |
+ ret = mfd_add_devices(&pdev->dev, pdev->id, |
7421 |
+ &asic3_cell_mmc, 1, mem_sdio, irq, NULL); |
7422 |
+ if (ret < 0) |
7423 |
+- goto out; |
7424 |
++ goto out_unmap; |
7425 |
+ } |
7426 |
+ |
7427 |
+ ret = 0; |
7428 |
+@@ -935,8 +935,12 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, |
7429 |
+ ret = mfd_add_devices(&pdev->dev, 0, |
7430 |
+ asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0, NULL); |
7431 |
+ } |
7432 |
++ return ret; |
7433 |
+ |
7434 |
+- out: |
7435 |
++out_unmap: |
7436 |
++ if (asic->tmio_cnf) |
7437 |
++ iounmap(asic->tmio_cnf); |
7438 |
++out: |
7439 |
+ return ret; |
7440 |
+ } |
7441 |
+ |
7442 |
+diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c |
7443 |
+index 1abe7432aad82..e281a9202f110 100644 |
7444 |
+--- a/drivers/mfd/mc13xxx-core.c |
7445 |
++++ b/drivers/mfd/mc13xxx-core.c |
7446 |
+@@ -323,8 +323,10 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, |
7447 |
+ adc1 |= MC13783_ADC1_ATOX; |
7448 |
+ |
7449 |
+ dev_dbg(mc13xxx->dev, "%s: request irq\n", __func__); |
7450 |
+- mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_ADCDONE, |
7451 |
++ ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_ADCDONE, |
7452 |
+ mc13xxx_handler_adcdone, __func__, &adcdone_data); |
7453 |
++ if (ret) |
7454 |
++ goto out; |
7455 |
+ |
7456 |
+ mc13xxx_reg_write(mc13xxx, MC13XXX_ADC0, adc0); |
7457 |
+ mc13xxx_reg_write(mc13xxx, MC13XXX_ADC1, adc1); |
7458 |
+diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c |
7459 |
+index de6d44a158bba..3f514d77a843f 100644 |
7460 |
+--- a/drivers/misc/cardreader/alcor_pci.c |
7461 |
++++ b/drivers/misc/cardreader/alcor_pci.c |
7462 |
+@@ -266,7 +266,7 @@ static int alcor_pci_probe(struct pci_dev *pdev, |
7463 |
+ if (!priv) |
7464 |
+ return -ENOMEM; |
7465 |
+ |
7466 |
+- ret = ida_simple_get(&alcor_pci_idr, 0, 0, GFP_KERNEL); |
7467 |
++ ret = ida_alloc(&alcor_pci_idr, GFP_KERNEL); |
7468 |
+ if (ret < 0) |
7469 |
+ return ret; |
7470 |
+ priv->id = ret; |
7471 |
+@@ -280,7 +280,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, |
7472 |
+ ret = pci_request_regions(pdev, DRV_NAME_ALCOR_PCI); |
7473 |
+ if (ret) { |
7474 |
+ dev_err(&pdev->dev, "Cannot request region\n"); |
7475 |
+- return -ENOMEM; |
7476 |
++ ret = -ENOMEM; |
7477 |
++ goto error_free_ida; |
7478 |
+ } |
7479 |
+ |
7480 |
+ if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { |
7481 |
+@@ -324,6 +325,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, |
7482 |
+ |
7483 |
+ error_release_regions: |
7484 |
+ pci_release_regions(pdev); |
7485 |
++error_free_ida: |
7486 |
++ ida_free(&alcor_pci_idr, priv->id); |
7487 |
+ return ret; |
7488 |
+ } |
7489 |
+ |
7490 |
+@@ -337,7 +340,7 @@ static void alcor_pci_remove(struct pci_dev *pdev) |
7491 |
+ |
7492 |
+ mfd_remove_devices(&pdev->dev); |
7493 |
+ |
7494 |
+- ida_simple_remove(&alcor_pci_idr, priv->id); |
7495 |
++ ida_free(&alcor_pci_idr, priv->id); |
7496 |
+ |
7497 |
+ pci_release_regions(pdev); |
7498 |
+ pci_set_drvdata(pdev, NULL); |
7499 |
+diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c |
7500 |
+index 912ddfa360b13..9716b0728b306 100644 |
7501 |
+--- a/drivers/misc/habanalabs/common/debugfs.c |
7502 |
++++ b/drivers/misc/habanalabs/common/debugfs.c |
7503 |
+@@ -859,6 +859,8 @@ static ssize_t hl_set_power_state(struct file *f, const char __user *buf, |
7504 |
+ pci_set_power_state(hdev->pdev, PCI_D0); |
7505 |
+ pci_restore_state(hdev->pdev); |
7506 |
+ rc = pci_enable_device(hdev->pdev); |
7507 |
++ if (rc < 0) |
7508 |
++ return rc; |
7509 |
+ } else if (value == 2) { |
7510 |
+ pci_save_state(hdev->pdev); |
7511 |
+ pci_disable_device(hdev->pdev); |
7512 |
+diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c |
7513 |
+index 49489153cd162..3e4d894719380 100644 |
7514 |
+--- a/drivers/misc/kgdbts.c |
7515 |
++++ b/drivers/misc/kgdbts.c |
7516 |
+@@ -1060,10 +1060,10 @@ static int kgdbts_option_setup(char *opt) |
7517 |
+ { |
7518 |
+ if (strlen(opt) >= MAX_CONFIG_LEN) { |
7519 |
+ printk(KERN_ERR "kgdbts: config string too long\n"); |
7520 |
+- return -ENOSPC; |
7521 |
++ return 1; |
7522 |
+ } |
7523 |
+ strcpy(config, opt); |
7524 |
+- return 0; |
7525 |
++ return 1; |
7526 |
+ } |
7527 |
+ |
7528 |
+ __setup("kgdbts=", kgdbts_option_setup); |
7529 |
+diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h |
7530 |
+index 67bb6a25fd0a0..d81d75a20b8f2 100644 |
7531 |
+--- a/drivers/misc/mei/hw-me-regs.h |
7532 |
++++ b/drivers/misc/mei/hw-me-regs.h |
7533 |
+@@ -107,6 +107,7 @@ |
7534 |
+ #define MEI_DEV_ID_ADP_S 0x7AE8 /* Alder Lake Point S */ |
7535 |
+ #define MEI_DEV_ID_ADP_LP 0x7A60 /* Alder Lake Point LP */ |
7536 |
+ #define MEI_DEV_ID_ADP_P 0x51E0 /* Alder Lake Point P */ |
7537 |
++#define MEI_DEV_ID_ADP_N 0x54E0 /* Alder Lake Point N */ |
7538 |
+ |
7539 |
+ /* |
7540 |
+ * MEI HW Section |
7541 |
+diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c |
7542 |
+index fee603039e872..ca3067fa6f0e0 100644 |
7543 |
+--- a/drivers/misc/mei/interrupt.c |
7544 |
++++ b/drivers/misc/mei/interrupt.c |
7545 |
+@@ -427,31 +427,26 @@ int mei_irq_read_handler(struct mei_device *dev, |
7546 |
+ list_for_each_entry(cl, &dev->file_list, link) { |
7547 |
+ if (mei_cl_hbm_equal(cl, mei_hdr)) { |
7548 |
+ cl_dbg(dev, cl, "got a message\n"); |
7549 |
+- break; |
7550 |
++ ret = mei_cl_irq_read_msg(cl, mei_hdr, meta_hdr, cmpl_list); |
7551 |
++ goto reset_slots; |
7552 |
+ } |
7553 |
+ } |
7554 |
+ |
7555 |
+ /* if no recipient cl was found we assume corrupted header */ |
7556 |
+- if (&cl->link == &dev->file_list) { |
7557 |
+- /* A message for not connected fixed address clients |
7558 |
+- * should be silently discarded |
7559 |
+- * On power down client may be force cleaned, |
7560 |
+- * silently discard such messages |
7561 |
+- */ |
7562 |
+- if (hdr_is_fixed(mei_hdr) || |
7563 |
+- dev->dev_state == MEI_DEV_POWER_DOWN) { |
7564 |
+- mei_irq_discard_msg(dev, mei_hdr, mei_hdr->length); |
7565 |
+- ret = 0; |
7566 |
+- goto reset_slots; |
7567 |
+- } |
7568 |
+- dev_err(dev->dev, "no destination client found 0x%08X\n", |
7569 |
+- dev->rd_msg_hdr[0]); |
7570 |
+- ret = -EBADMSG; |
7571 |
+- goto end; |
7572 |
++ /* A message for not connected fixed address clients |
7573 |
++ * should be silently discarded |
7574 |
++ * On power down client may be force cleaned, |
7575 |
++ * silently discard such messages |
7576 |
++ */ |
7577 |
++ if (hdr_is_fixed(mei_hdr) || |
7578 |
++ dev->dev_state == MEI_DEV_POWER_DOWN) { |
7579 |
++ mei_irq_discard_msg(dev, mei_hdr, mei_hdr->length); |
7580 |
++ ret = 0; |
7581 |
++ goto reset_slots; |
7582 |
+ } |
7583 |
+- |
7584 |
+- ret = mei_cl_irq_read_msg(cl, mei_hdr, meta_hdr, cmpl_list); |
7585 |
+- |
7586 |
++ dev_err(dev->dev, "no destination client found 0x%08X\n", dev->rd_msg_hdr[0]); |
7587 |
++ ret = -EBADMSG; |
7588 |
++ goto end; |
7589 |
+ |
7590 |
+ reset_slots: |
7591 |
+ /* reset the number of slots and header */ |
7592 |
+diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c |
7593 |
+index 3a45aaf002ac8..a738253dbd056 100644 |
7594 |
+--- a/drivers/misc/mei/pci-me.c |
7595 |
++++ b/drivers/misc/mei/pci-me.c |
7596 |
+@@ -113,6 +113,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { |
7597 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_S, MEI_ME_PCH15_CFG)}, |
7598 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_LP, MEI_ME_PCH15_CFG)}, |
7599 |
+ {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_P, MEI_ME_PCH15_CFG)}, |
7600 |
++ {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_N, MEI_ME_PCH15_CFG)}, |
7601 |
+ |
7602 |
+ /* required last entry */ |
7603 |
+ {0, } |
7604 |
+diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c |
7605 |
+index 864c8c205ff78..03e2f965a96a8 100644 |
7606 |
+--- a/drivers/mmc/core/host.c |
7607 |
++++ b/drivers/mmc/core/host.c |
7608 |
+@@ -513,6 +513,16 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) |
7609 |
+ |
7610 |
+ EXPORT_SYMBOL(mmc_alloc_host); |
7611 |
+ |
7612 |
++static int mmc_validate_host_caps(struct mmc_host *host) |
7613 |
++{ |
7614 |
++ if (host->caps & MMC_CAP_SDIO_IRQ && !host->ops->enable_sdio_irq) { |
7615 |
++ dev_warn(host->parent, "missing ->enable_sdio_irq() ops\n"); |
7616 |
++ return -EINVAL; |
7617 |
++ } |
7618 |
++ |
7619 |
++ return 0; |
7620 |
++} |
7621 |
++ |
7622 |
+ /** |
7623 |
+ * mmc_add_host - initialise host hardware |
7624 |
+ * @host: mmc host |
7625 |
+@@ -525,8 +535,9 @@ int mmc_add_host(struct mmc_host *host) |
7626 |
+ { |
7627 |
+ int err; |
7628 |
+ |
7629 |
+- WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && |
7630 |
+- !host->ops->enable_sdio_irq); |
7631 |
++ err = mmc_validate_host_caps(host); |
7632 |
++ if (err) |
7633 |
++ return err; |
7634 |
+ |
7635 |
+ err = device_add(&host->class_dev); |
7636 |
+ if (err) |
7637 |
+diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c |
7638 |
+index 90cd179625fc2..647928ab00a30 100644 |
7639 |
+--- a/drivers/mmc/host/davinci_mmc.c |
7640 |
++++ b/drivers/mmc/host/davinci_mmc.c |
7641 |
+@@ -1375,8 +1375,12 @@ static int davinci_mmcsd_suspend(struct device *dev) |
7642 |
+ static int davinci_mmcsd_resume(struct device *dev) |
7643 |
+ { |
7644 |
+ struct mmc_davinci_host *host = dev_get_drvdata(dev); |
7645 |
++ int ret; |
7646 |
++ |
7647 |
++ ret = clk_enable(host->clk); |
7648 |
++ if (ret) |
7649 |
++ return ret; |
7650 |
+ |
7651 |
+- clk_enable(host->clk); |
7652 |
+ mmc_davinci_reset_ctrl(host, 0); |
7653 |
+ |
7654 |
+ return 0; |
7655 |
+diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c |
7656 |
+index 9bde0def114b5..b5684e5d79e60 100644 |
7657 |
+--- a/drivers/mmc/host/mmci.c |
7658 |
++++ b/drivers/mmc/host/mmci.c |
7659 |
+@@ -2203,7 +2203,7 @@ static int mmci_probe(struct amba_device *dev, |
7660 |
+ return ret; |
7661 |
+ } |
7662 |
+ |
7663 |
+-static int mmci_remove(struct amba_device *dev) |
7664 |
++static void mmci_remove(struct amba_device *dev) |
7665 |
+ { |
7666 |
+ struct mmc_host *mmc = amba_get_drvdata(dev); |
7667 |
+ |
7668 |
+@@ -2231,8 +2231,6 @@ static int mmci_remove(struct amba_device *dev) |
7669 |
+ clk_disable_unprepare(host->clk); |
7670 |
+ mmc_free_host(mmc); |
7671 |
+ } |
7672 |
+- |
7673 |
+- return 0; |
7674 |
+ } |
7675 |
+ |
7676 |
+ #ifdef CONFIG_PM |
7677 |
+diff --git a/drivers/mtd/nand/onenand/generic.c b/drivers/mtd/nand/onenand/generic.c |
7678 |
+index 8b6f4da5d7201..a4b8b65fe15f5 100644 |
7679 |
+--- a/drivers/mtd/nand/onenand/generic.c |
7680 |
++++ b/drivers/mtd/nand/onenand/generic.c |
7681 |
+@@ -53,7 +53,12 @@ static int generic_onenand_probe(struct platform_device *pdev) |
7682 |
+ } |
7683 |
+ |
7684 |
+ info->onenand.mmcontrol = pdata ? pdata->mmcontrol : NULL; |
7685 |
+- info->onenand.irq = platform_get_irq(pdev, 0); |
7686 |
++ |
7687 |
++ err = platform_get_irq(pdev, 0); |
7688 |
++ if (err < 0) |
7689 |
++ goto out_iounmap; |
7690 |
++ |
7691 |
++ info->onenand.irq = err; |
7692 |
+ |
7693 |
+ info->mtd.dev.parent = &pdev->dev; |
7694 |
+ info->mtd.priv = &info->onenand; |
7695 |
+diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c |
7696 |
+index 8aab1017b4600..c048e826746a9 100644 |
7697 |
+--- a/drivers/mtd/nand/raw/atmel/nand-controller.c |
7698 |
++++ b/drivers/mtd/nand/raw/atmel/nand-controller.c |
7699 |
+@@ -2057,13 +2057,15 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, |
7700 |
+ nc->mck = of_clk_get(dev->parent->of_node, 0); |
7701 |
+ if (IS_ERR(nc->mck)) { |
7702 |
+ dev_err(dev, "Failed to retrieve MCK clk\n"); |
7703 |
+- return PTR_ERR(nc->mck); |
7704 |
++ ret = PTR_ERR(nc->mck); |
7705 |
++ goto out_release_dma; |
7706 |
+ } |
7707 |
+ |
7708 |
+ np = of_parse_phandle(dev->parent->of_node, "atmel,smc", 0); |
7709 |
+ if (!np) { |
7710 |
+ dev_err(dev, "Missing or invalid atmel,smc property\n"); |
7711 |
+- return -EINVAL; |
7712 |
++ ret = -EINVAL; |
7713 |
++ goto out_release_dma; |
7714 |
+ } |
7715 |
+ |
7716 |
+ nc->smc = syscon_node_to_regmap(np); |
7717 |
+@@ -2071,10 +2073,16 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, |
7718 |
+ if (IS_ERR(nc->smc)) { |
7719 |
+ ret = PTR_ERR(nc->smc); |
7720 |
+ dev_err(dev, "Could not get SMC regmap (err = %d)\n", ret); |
7721 |
+- return ret; |
7722 |
++ goto out_release_dma; |
7723 |
+ } |
7724 |
+ |
7725 |
+ return 0; |
7726 |
++ |
7727 |
++out_release_dma: |
7728 |
++ if (nc->dmac) |
7729 |
++ dma_release_channel(nc->dmac); |
7730 |
++ |
7731 |
++ return ret; |
7732 |
+ } |
7733 |
+ |
7734 |
+ static int |
7735 |
+diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
7736 |
+index cb7631145700a..92e8ca56f5665 100644 |
7737 |
+--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
7738 |
++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
7739 |
+@@ -646,6 +646,7 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, |
7740 |
+ const struct nand_sdr_timings *sdr) |
7741 |
+ { |
7742 |
+ struct gpmi_nfc_hardware_timing *hw = &this->hw; |
7743 |
++ struct resources *r = &this->resources; |
7744 |
+ unsigned int dll_threshold_ps = this->devdata->max_chain_delay; |
7745 |
+ unsigned int period_ps, reference_period_ps; |
7746 |
+ unsigned int data_setup_cycles, data_hold_cycles, addr_setup_cycles; |
7747 |
+@@ -669,6 +670,8 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, |
7748 |
+ wrn_dly_sel = BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY; |
7749 |
+ } |
7750 |
+ |
7751 |
++ hw->clk_rate = clk_round_rate(r->clock[0], hw->clk_rate); |
7752 |
++ |
7753 |
+ /* SDR core timings are given in picoseconds */ |
7754 |
+ period_ps = div_u64((u64)NSEC_PER_SEC * 1000, hw->clk_rate); |
7755 |
+ |
7756 |
+diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c |
7757 |
+index 1f0d542d59230..c41c0ff611b1b 100644 |
7758 |
+--- a/drivers/mtd/nand/raw/nand_base.c |
7759 |
++++ b/drivers/mtd/nand/raw/nand_base.c |
7760 |
+@@ -297,16 +297,19 @@ static int nand_isbad_bbm(struct nand_chip *chip, loff_t ofs) |
7761 |
+ * |
7762 |
+ * Return: -EBUSY if the chip has been suspended, 0 otherwise |
7763 |
+ */ |
7764 |
+-static int nand_get_device(struct nand_chip *chip) |
7765 |
++static void nand_get_device(struct nand_chip *chip) |
7766 |
+ { |
7767 |
+- mutex_lock(&chip->lock); |
7768 |
+- if (chip->suspended) { |
7769 |
++ /* Wait until the device is resumed. */ |
7770 |
++ while (1) { |
7771 |
++ mutex_lock(&chip->lock); |
7772 |
++ if (!chip->suspended) { |
7773 |
++ mutex_lock(&chip->controller->lock); |
7774 |
++ return; |
7775 |
++ } |
7776 |
+ mutex_unlock(&chip->lock); |
7777 |
+- return -EBUSY; |
7778 |
+- } |
7779 |
+- mutex_lock(&chip->controller->lock); |
7780 |
+ |
7781 |
+- return 0; |
7782 |
++ wait_event(chip->resume_wq, !chip->suspended); |
7783 |
++ } |
7784 |
+ } |
7785 |
+ |
7786 |
+ /** |
7787 |
+@@ -531,9 +534,7 @@ static int nand_block_markbad_lowlevel(struct nand_chip *chip, loff_t ofs) |
7788 |
+ nand_erase_nand(chip, &einfo, 0); |
7789 |
+ |
7790 |
+ /* Write bad block marker to OOB */ |
7791 |
+- ret = nand_get_device(chip); |
7792 |
+- if (ret) |
7793 |
+- return ret; |
7794 |
++ nand_get_device(chip); |
7795 |
+ |
7796 |
+ ret = nand_markbad_bbm(chip, ofs); |
7797 |
+ nand_release_device(chip); |
7798 |
+@@ -3534,9 +3535,7 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from, |
7799 |
+ ops->mode != MTD_OPS_RAW) |
7800 |
+ return -ENOTSUPP; |
7801 |
+ |
7802 |
+- ret = nand_get_device(chip); |
7803 |
+- if (ret) |
7804 |
+- return ret; |
7805 |
++ nand_get_device(chip); |
7806 |
+ |
7807 |
+ if (!ops->datbuf) |
7808 |
+ ret = nand_do_read_oob(chip, from, ops); |
7809 |
+@@ -4119,13 +4118,11 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, |
7810 |
+ struct mtd_oob_ops *ops) |
7811 |
+ { |
7812 |
+ struct nand_chip *chip = mtd_to_nand(mtd); |
7813 |
+- int ret; |
7814 |
++ int ret = 0; |
7815 |
+ |
7816 |
+ ops->retlen = 0; |
7817 |
+ |
7818 |
+- ret = nand_get_device(chip); |
7819 |
+- if (ret) |
7820 |
+- return ret; |
7821 |
++ nand_get_device(chip); |
7822 |
+ |
7823 |
+ switch (ops->mode) { |
7824 |
+ case MTD_OPS_PLACE_OOB: |
7825 |
+@@ -4181,9 +4178,7 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr, |
7826 |
+ return -EINVAL; |
7827 |
+ |
7828 |
+ /* Grab the lock and see if the device is available */ |
7829 |
+- ret = nand_get_device(chip); |
7830 |
+- if (ret) |
7831 |
+- return ret; |
7832 |
++ nand_get_device(chip); |
7833 |
+ |
7834 |
+ /* Shift to get first page */ |
7835 |
+ page = (int)(instr->addr >> chip->page_shift); |
7836 |
+@@ -4270,7 +4265,7 @@ static void nand_sync(struct mtd_info *mtd) |
7837 |
+ pr_debug("%s: called\n", __func__); |
7838 |
+ |
7839 |
+ /* Grab the lock and see if the device is available */ |
7840 |
+- WARN_ON(nand_get_device(chip)); |
7841 |
++ nand_get_device(chip); |
7842 |
+ /* Release it and go back */ |
7843 |
+ nand_release_device(chip); |
7844 |
+ } |
7845 |
+@@ -4287,9 +4282,7 @@ static int nand_block_isbad(struct mtd_info *mtd, loff_t offs) |
7846 |
+ int ret; |
7847 |
+ |
7848 |
+ /* Select the NAND device */ |
7849 |
+- ret = nand_get_device(chip); |
7850 |
+- if (ret) |
7851 |
+- return ret; |
7852 |
++ nand_get_device(chip); |
7853 |
+ |
7854 |
+ nand_select_target(chip, chipnr); |
7855 |
+ |
7856 |
+@@ -4360,6 +4353,8 @@ static void nand_resume(struct mtd_info *mtd) |
7857 |
+ __func__); |
7858 |
+ } |
7859 |
+ mutex_unlock(&chip->lock); |
7860 |
++ |
7861 |
++ wake_up_all(&chip->resume_wq); |
7862 |
+ } |
7863 |
+ |
7864 |
+ /** |
7865 |
+@@ -5068,6 +5063,7 @@ static int nand_scan_ident(struct nand_chip *chip, unsigned int maxchips, |
7866 |
+ chip->cur_cs = -1; |
7867 |
+ |
7868 |
+ mutex_init(&chip->lock); |
7869 |
++ init_waitqueue_head(&chip->resume_wq); |
7870 |
+ |
7871 |
+ /* Enforce the right timings for reset/detection */ |
7872 |
+ chip->current_interface_config = nand_get_reset_interface_config(); |
7873 |
+diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c |
7874 |
+index e85b04e9716b2..4153e0d15c5f9 100644 |
7875 |
+--- a/drivers/mtd/ubi/build.c |
7876 |
++++ b/drivers/mtd/ubi/build.c |
7877 |
+@@ -350,9 +350,6 @@ static ssize_t dev_attribute_show(struct device *dev, |
7878 |
+ * we still can use 'ubi->ubi_num'. |
7879 |
+ */ |
7880 |
+ ubi = container_of(dev, struct ubi_device, dev); |
7881 |
+- ubi = ubi_get_device(ubi->ubi_num); |
7882 |
+- if (!ubi) |
7883 |
+- return -ENODEV; |
7884 |
+ |
7885 |
+ if (attr == &dev_eraseblock_size) |
7886 |
+ ret = sprintf(buf, "%d\n", ubi->leb_size); |
7887 |
+@@ -381,7 +378,6 @@ static ssize_t dev_attribute_show(struct device *dev, |
7888 |
+ else |
7889 |
+ ret = -EINVAL; |
7890 |
+ |
7891 |
+- ubi_put_device(ubi); |
7892 |
+ return ret; |
7893 |
+ } |
7894 |
+ |
7895 |
+@@ -980,9 +976,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
7896 |
+ goto out_detach; |
7897 |
+ } |
7898 |
+ |
7899 |
+- /* Make device "available" before it becomes accessible via sysfs */ |
7900 |
+- ubi_devices[ubi_num] = ubi; |
7901 |
+- |
7902 |
+ err = uif_init(ubi); |
7903 |
+ if (err) |
7904 |
+ goto out_detach; |
7905 |
+@@ -1027,6 +1020,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
7906 |
+ wake_up_process(ubi->bgt_thread); |
7907 |
+ spin_unlock(&ubi->wl_lock); |
7908 |
+ |
7909 |
++ ubi_devices[ubi_num] = ubi; |
7910 |
+ ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL); |
7911 |
+ return ubi_num; |
7912 |
+ |
7913 |
+@@ -1035,7 +1029,6 @@ out_debugfs: |
7914 |
+ out_uif: |
7915 |
+ uif_close(ubi); |
7916 |
+ out_detach: |
7917 |
+- ubi_devices[ubi_num] = NULL; |
7918 |
+ ubi_wl_close(ubi); |
7919 |
+ ubi_free_all_volumes(ubi); |
7920 |
+ vfree(ubi->vtbl); |
7921 |
+diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c |
7922 |
+index 022af59906aa9..6b5f1ffd961b9 100644 |
7923 |
+--- a/drivers/mtd/ubi/fastmap.c |
7924 |
++++ b/drivers/mtd/ubi/fastmap.c |
7925 |
+@@ -468,7 +468,9 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, |
7926 |
+ if (err == UBI_IO_FF_BITFLIPS) |
7927 |
+ scrub = 1; |
7928 |
+ |
7929 |
+- add_aeb(ai, free, pnum, ec, scrub); |
7930 |
++ ret = add_aeb(ai, free, pnum, ec, scrub); |
7931 |
++ if (ret) |
7932 |
++ goto out; |
7933 |
+ continue; |
7934 |
+ } else if (err == 0 || err == UBI_IO_BITFLIPS) { |
7935 |
+ dbg_bld("Found non empty PEB:%i in pool", pnum); |
7936 |
+@@ -638,8 +640,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
7937 |
+ if (fm_pos >= fm_size) |
7938 |
+ goto fail_bad; |
7939 |
+ |
7940 |
+- add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), |
7941 |
+- be32_to_cpu(fmec->ec), 0); |
7942 |
++ ret = add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), |
7943 |
++ be32_to_cpu(fmec->ec), 0); |
7944 |
++ if (ret) |
7945 |
++ goto fail; |
7946 |
+ } |
7947 |
+ |
7948 |
+ /* read EC values from used list */ |
7949 |
+@@ -649,8 +653,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
7950 |
+ if (fm_pos >= fm_size) |
7951 |
+ goto fail_bad; |
7952 |
+ |
7953 |
+- add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
7954 |
+- be32_to_cpu(fmec->ec), 0); |
7955 |
++ ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
7956 |
++ be32_to_cpu(fmec->ec), 0); |
7957 |
++ if (ret) |
7958 |
++ goto fail; |
7959 |
+ } |
7960 |
+ |
7961 |
+ /* read EC values from scrub list */ |
7962 |
+@@ -660,8 +666,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
7963 |
+ if (fm_pos >= fm_size) |
7964 |
+ goto fail_bad; |
7965 |
+ |
7966 |
+- add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
7967 |
+- be32_to_cpu(fmec->ec), 1); |
7968 |
++ ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
7969 |
++ be32_to_cpu(fmec->ec), 1); |
7970 |
++ if (ret) |
7971 |
++ goto fail; |
7972 |
+ } |
7973 |
+ |
7974 |
+ /* read EC values from erase list */ |
7975 |
+@@ -671,8 +679,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
7976 |
+ if (fm_pos >= fm_size) |
7977 |
+ goto fail_bad; |
7978 |
+ |
7979 |
+- add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), |
7980 |
+- be32_to_cpu(fmec->ec), 1); |
7981 |
++ ret = add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), |
7982 |
++ be32_to_cpu(fmec->ec), 1); |
7983 |
++ if (ret) |
7984 |
++ goto fail; |
7985 |
+ } |
7986 |
+ |
7987 |
+ ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count); |
7988 |
+diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c |
7989 |
+index 139ee132bfbcf..1bc7b3a056046 100644 |
7990 |
+--- a/drivers/mtd/ubi/vmt.c |
7991 |
++++ b/drivers/mtd/ubi/vmt.c |
7992 |
+@@ -56,16 +56,11 @@ static ssize_t vol_attribute_show(struct device *dev, |
7993 |
+ { |
7994 |
+ int ret; |
7995 |
+ struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev); |
7996 |
+- struct ubi_device *ubi; |
7997 |
+- |
7998 |
+- ubi = ubi_get_device(vol->ubi->ubi_num); |
7999 |
+- if (!ubi) |
8000 |
+- return -ENODEV; |
8001 |
++ struct ubi_device *ubi = vol->ubi; |
8002 |
+ |
8003 |
+ spin_lock(&ubi->volumes_lock); |
8004 |
+ if (!ubi->volumes[vol->vol_id]) { |
8005 |
+ spin_unlock(&ubi->volumes_lock); |
8006 |
+- ubi_put_device(ubi); |
8007 |
+ return -ENODEV; |
8008 |
+ } |
8009 |
+ /* Take a reference to prevent volume removal */ |
8010 |
+@@ -103,7 +98,6 @@ static ssize_t vol_attribute_show(struct device *dev, |
8011 |
+ vol->ref_count -= 1; |
8012 |
+ ubi_assert(vol->ref_count >= 0); |
8013 |
+ spin_unlock(&ubi->volumes_lock); |
8014 |
+- ubi_put_device(ubi); |
8015 |
+ return ret; |
8016 |
+ } |
8017 |
+ |
8018 |
+diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c |
8019 |
+index 39b128205f255..53ef48588e59a 100644 |
8020 |
+--- a/drivers/net/bareudp.c |
8021 |
++++ b/drivers/net/bareudp.c |
8022 |
+@@ -140,14 +140,14 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) |
8023 |
+ oiph = skb_network_header(skb); |
8024 |
+ skb_reset_network_header(skb); |
8025 |
+ |
8026 |
+- if (!IS_ENABLED(CONFIG_IPV6) || family == AF_INET) |
8027 |
++ if (!ipv6_mod_enabled() || family == AF_INET) |
8028 |
+ err = IP_ECN_decapsulate(oiph, skb); |
8029 |
+ else |
8030 |
+ err = IP6_ECN_decapsulate(oiph, skb); |
8031 |
+ |
8032 |
+ if (unlikely(err)) { |
8033 |
+ if (log_ecn_error) { |
8034 |
+- if (!IS_ENABLED(CONFIG_IPV6) || family == AF_INET) |
8035 |
++ if (!ipv6_mod_enabled() || family == AF_INET) |
8036 |
+ net_info_ratelimited("non-ECT from %pI4 " |
8037 |
+ "with TOS=%#x\n", |
8038 |
+ &((struct iphdr *)oiph)->saddr, |
8039 |
+@@ -213,11 +213,12 @@ static struct socket *bareudp_create_sock(struct net *net, __be16 port) |
8040 |
+ int err; |
8041 |
+ |
8042 |
+ memset(&udp_conf, 0, sizeof(udp_conf)); |
8043 |
+-#if IS_ENABLED(CONFIG_IPV6) |
8044 |
+- udp_conf.family = AF_INET6; |
8045 |
+-#else |
8046 |
+- udp_conf.family = AF_INET; |
8047 |
+-#endif |
8048 |
++ |
8049 |
++ if (ipv6_mod_enabled()) |
8050 |
++ udp_conf.family = AF_INET6; |
8051 |
++ else |
8052 |
++ udp_conf.family = AF_INET; |
8053 |
++ |
8054 |
+ udp_conf.local_udp_port = port; |
8055 |
+ /* Open UDP socket */ |
8056 |
+ err = udp_sock_create(net, &udp_conf, &sock); |
8057 |
+@@ -246,12 +247,6 @@ static int bareudp_socket_create(struct bareudp_dev *bareudp, __be16 port) |
8058 |
+ tunnel_cfg.encap_destroy = NULL; |
8059 |
+ setup_udp_tunnel_sock(bareudp->net, sock, &tunnel_cfg); |
8060 |
+ |
8061 |
+- /* As the setup_udp_tunnel_sock does not call udp_encap_enable if the |
8062 |
+- * socket type is v6 an explicit call to udp_encap_enable is needed. |
8063 |
+- */ |
8064 |
+- if (sock->sk->sk_family == AF_INET6) |
8065 |
+- udp_encap_enable(); |
8066 |
+- |
8067 |
+ rcu_assign_pointer(bareudp->sock, sock); |
8068 |
+ return 0; |
8069 |
+ } |
8070 |
+@@ -445,7 +440,7 @@ static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev) |
8071 |
+ } |
8072 |
+ |
8073 |
+ rcu_read_lock(); |
8074 |
+- if (IS_ENABLED(CONFIG_IPV6) && info->mode & IP_TUNNEL_INFO_IPV6) |
8075 |
++ if (ipv6_mod_enabled() && info->mode & IP_TUNNEL_INFO_IPV6) |
8076 |
+ err = bareudp6_xmit_skb(skb, dev, bareudp, info); |
8077 |
+ else |
8078 |
+ err = bareudp_xmit_skb(skb, dev, bareudp, info); |
8079 |
+@@ -475,7 +470,7 @@ static int bareudp_fill_metadata_dst(struct net_device *dev, |
8080 |
+ |
8081 |
+ use_cache = ip_tunnel_dst_cache_usable(skb, info); |
8082 |
+ |
8083 |
+- if (!IS_ENABLED(CONFIG_IPV6) || ip_tunnel_info_af(info) == AF_INET) { |
8084 |
++ if (!ipv6_mod_enabled() || ip_tunnel_info_af(info) == AF_INET) { |
8085 |
+ struct rtable *rt; |
8086 |
+ __be32 saddr; |
8087 |
+ |
8088 |
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c |
8089 |
+index 19a7e4adb9338..19a19a7b7deb8 100644 |
8090 |
+--- a/drivers/net/can/m_can/m_can.c |
8091 |
++++ b/drivers/net/can/m_can/m_can.c |
8092 |
+@@ -1491,8 +1491,6 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev) |
8093 |
+ M_CAN_FIFO_DATA(i / 4), |
8094 |
+ *(u32 *)(cf->data + i)); |
8095 |
+ |
8096 |
+- can_put_echo_skb(skb, dev, 0); |
8097 |
+- |
8098 |
+ if (cdev->can.ctrlmode & CAN_CTRLMODE_FD) { |
8099 |
+ cccr = m_can_read(cdev, M_CAN_CCCR); |
8100 |
+ cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); |
8101 |
+@@ -1509,6 +1507,9 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev) |
8102 |
+ m_can_write(cdev, M_CAN_CCCR, cccr); |
8103 |
+ } |
8104 |
+ m_can_write(cdev, M_CAN_TXBTIE, 0x1); |
8105 |
++ |
8106 |
++ can_put_echo_skb(skb, dev, 0); |
8107 |
++ |
8108 |
+ m_can_write(cdev, M_CAN_TXBAR, 0x1); |
8109 |
+ /* End of xmit function for version 3.0.x */ |
8110 |
+ } else { |
8111 |
+diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c |
8112 |
+index abe00a085f6fc..189d226588133 100644 |
8113 |
+--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c |
8114 |
++++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c |
8115 |
+@@ -2578,7 +2578,7 @@ mcp251xfd_register_get_dev_id(const struct mcp251xfd_priv *priv, |
8116 |
+ out_kfree_buf_rx: |
8117 |
+ kfree(buf_rx); |
8118 |
+ |
8119 |
+- return 0; |
8120 |
++ return err; |
8121 |
+ } |
8122 |
+ |
8123 |
+ #define MCP251XFD_QUIRK_ACTIVE(quirk) \ |
8124 |
+diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c |
8125 |
+index 249d2fba28c7f..6458da9c13b95 100644 |
8126 |
+--- a/drivers/net/can/usb/ems_usb.c |
8127 |
++++ b/drivers/net/can/usb/ems_usb.c |
8128 |
+@@ -823,7 +823,6 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne |
8129 |
+ |
8130 |
+ usb_unanchor_urb(urb); |
8131 |
+ usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); |
8132 |
+- dev_kfree_skb(skb); |
8133 |
+ |
8134 |
+ atomic_dec(&dev->active_tx_urbs); |
8135 |
+ |
8136 |
+diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c |
8137 |
+index 912160fd2ca02..21063335ab599 100644 |
8138 |
+--- a/drivers/net/can/usb/mcba_usb.c |
8139 |
++++ b/drivers/net/can/usb/mcba_usb.c |
8140 |
+@@ -33,10 +33,6 @@ |
8141 |
+ #define MCBA_USB_RX_BUFF_SIZE 64 |
8142 |
+ #define MCBA_USB_TX_BUFF_SIZE (sizeof(struct mcba_usb_msg)) |
8143 |
+ |
8144 |
+-/* MCBA endpoint numbers */ |
8145 |
+-#define MCBA_USB_EP_IN 1 |
8146 |
+-#define MCBA_USB_EP_OUT 1 |
8147 |
+- |
8148 |
+ /* Microchip command id */ |
8149 |
+ #define MBCA_CMD_RECEIVE_MESSAGE 0xE3 |
8150 |
+ #define MBCA_CMD_I_AM_ALIVE_FROM_CAN 0xF5 |
8151 |
+@@ -84,6 +80,8 @@ struct mcba_priv { |
8152 |
+ atomic_t free_ctx_cnt; |
8153 |
+ void *rxbuf[MCBA_MAX_RX_URBS]; |
8154 |
+ dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS]; |
8155 |
++ int rx_pipe; |
8156 |
++ int tx_pipe; |
8157 |
+ }; |
8158 |
+ |
8159 |
+ /* CAN frame */ |
8160 |
+@@ -272,10 +270,8 @@ static netdev_tx_t mcba_usb_xmit(struct mcba_priv *priv, |
8161 |
+ |
8162 |
+ memcpy(buf, usb_msg, MCBA_USB_TX_BUFF_SIZE); |
8163 |
+ |
8164 |
+- usb_fill_bulk_urb(urb, priv->udev, |
8165 |
+- usb_sndbulkpipe(priv->udev, MCBA_USB_EP_OUT), buf, |
8166 |
+- MCBA_USB_TX_BUFF_SIZE, mcba_usb_write_bulk_callback, |
8167 |
+- ctx); |
8168 |
++ usb_fill_bulk_urb(urb, priv->udev, priv->tx_pipe, buf, MCBA_USB_TX_BUFF_SIZE, |
8169 |
++ mcba_usb_write_bulk_callback, ctx); |
8170 |
+ |
8171 |
+ urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
8172 |
+ usb_anchor_urb(urb, &priv->tx_submitted); |
8173 |
+@@ -368,7 +364,6 @@ static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb, |
8174 |
+ xmit_failed: |
8175 |
+ can_free_echo_skb(priv->netdev, ctx->ndx); |
8176 |
+ mcba_usb_free_ctx(ctx); |
8177 |
+- dev_kfree_skb(skb); |
8178 |
+ stats->tx_dropped++; |
8179 |
+ |
8180 |
+ return NETDEV_TX_OK; |
8181 |
+@@ -611,7 +606,7 @@ static void mcba_usb_read_bulk_callback(struct urb *urb) |
8182 |
+ resubmit_urb: |
8183 |
+ |
8184 |
+ usb_fill_bulk_urb(urb, priv->udev, |
8185 |
+- usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_OUT), |
8186 |
++ priv->rx_pipe, |
8187 |
+ urb->transfer_buffer, MCBA_USB_RX_BUFF_SIZE, |
8188 |
+ mcba_usb_read_bulk_callback, priv); |
8189 |
+ |
8190 |
+@@ -656,7 +651,7 @@ static int mcba_usb_start(struct mcba_priv *priv) |
8191 |
+ urb->transfer_dma = buf_dma; |
8192 |
+ |
8193 |
+ usb_fill_bulk_urb(urb, priv->udev, |
8194 |
+- usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_IN), |
8195 |
++ priv->rx_pipe, |
8196 |
+ buf, MCBA_USB_RX_BUFF_SIZE, |
8197 |
+ mcba_usb_read_bulk_callback, priv); |
8198 |
+ urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
8199 |
+@@ -810,6 +805,13 @@ static int mcba_usb_probe(struct usb_interface *intf, |
8200 |
+ struct mcba_priv *priv; |
8201 |
+ int err; |
8202 |
+ struct usb_device *usbdev = interface_to_usbdev(intf); |
8203 |
++ struct usb_endpoint_descriptor *in, *out; |
8204 |
++ |
8205 |
++ err = usb_find_common_endpoints(intf->cur_altsetting, &in, &out, NULL, NULL); |
8206 |
++ if (err) { |
8207 |
++ dev_err(&intf->dev, "Can't find endpoints\n"); |
8208 |
++ return err; |
8209 |
++ } |
8210 |
+ |
8211 |
+ netdev = alloc_candev(sizeof(struct mcba_priv), MCBA_MAX_TX_URBS); |
8212 |
+ if (!netdev) { |
8213 |
+@@ -855,6 +857,9 @@ static int mcba_usb_probe(struct usb_interface *intf, |
8214 |
+ goto cleanup_free_candev; |
8215 |
+ } |
8216 |
+ |
8217 |
++ priv->rx_pipe = usb_rcvbulkpipe(priv->udev, in->bEndpointAddress); |
8218 |
++ priv->tx_pipe = usb_sndbulkpipe(priv->udev, out->bEndpointAddress); |
8219 |
++ |
8220 |
+ devm_can_led_init(netdev); |
8221 |
+ |
8222 |
+ /* Start USB dev only if we have successfully registered CAN device */ |
8223 |
+diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c |
8224 |
+index ca7c55d6a41db..985e00aee4ee1 100644 |
8225 |
+--- a/drivers/net/can/usb/usb_8dev.c |
8226 |
++++ b/drivers/net/can/usb/usb_8dev.c |
8227 |
+@@ -670,9 +670,20 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb, |
8228 |
+ atomic_inc(&priv->active_tx_urbs); |
8229 |
+ |
8230 |
+ err = usb_submit_urb(urb, GFP_ATOMIC); |
8231 |
+- if (unlikely(err)) |
8232 |
+- goto failed; |
8233 |
+- else if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) |
8234 |
++ if (unlikely(err)) { |
8235 |
++ can_free_echo_skb(netdev, context->echo_index); |
8236 |
++ |
8237 |
++ usb_unanchor_urb(urb); |
8238 |
++ usb_free_coherent(priv->udev, size, buf, urb->transfer_dma); |
8239 |
++ |
8240 |
++ atomic_dec(&priv->active_tx_urbs); |
8241 |
++ |
8242 |
++ if (err == -ENODEV) |
8243 |
++ netif_device_detach(netdev); |
8244 |
++ else |
8245 |
++ netdev_warn(netdev, "failed tx_urb %d\n", err); |
8246 |
++ stats->tx_dropped++; |
8247 |
++ } else if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) |
8248 |
+ /* Slow down tx path */ |
8249 |
+ netif_stop_queue(netdev); |
8250 |
+ |
8251 |
+@@ -691,19 +702,6 @@ nofreecontext: |
8252 |
+ |
8253 |
+ return NETDEV_TX_BUSY; |
8254 |
+ |
8255 |
+-failed: |
8256 |
+- can_free_echo_skb(netdev, context->echo_index); |
8257 |
+- |
8258 |
+- usb_unanchor_urb(urb); |
8259 |
+- usb_free_coherent(priv->udev, size, buf, urb->transfer_dma); |
8260 |
+- |
8261 |
+- atomic_dec(&priv->active_tx_urbs); |
8262 |
+- |
8263 |
+- if (err == -ENODEV) |
8264 |
+- netif_device_detach(netdev); |
8265 |
+- else |
8266 |
+- netdev_warn(netdev, "failed tx_urb %d\n", err); |
8267 |
+- |
8268 |
+ nomembuf: |
8269 |
+ usb_free_urb(urb); |
8270 |
+ |
8271 |
+diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c |
8272 |
+index 7000c6cd1e48b..282c53ef76d23 100644 |
8273 |
+--- a/drivers/net/can/vxcan.c |
8274 |
++++ b/drivers/net/can/vxcan.c |
8275 |
+@@ -148,7 +148,7 @@ static void vxcan_setup(struct net_device *dev) |
8276 |
+ dev->hard_header_len = 0; |
8277 |
+ dev->addr_len = 0; |
8278 |
+ dev->tx_queue_len = 0; |
8279 |
+- dev->flags = (IFF_NOARP|IFF_ECHO); |
8280 |
++ dev->flags = IFF_NOARP; |
8281 |
+ dev->netdev_ops = &vxcan_netdev_ops; |
8282 |
+ dev->needs_free_netdev = true; |
8283 |
+ |
8284 |
+diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c |
8285 |
+index d82cee5d92022..cbf44fc7d03aa 100644 |
8286 |
+--- a/drivers/net/dsa/bcm_sf2_cfp.c |
8287 |
++++ b/drivers/net/dsa/bcm_sf2_cfp.c |
8288 |
+@@ -567,14 +567,14 @@ static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, |
8289 |
+ static struct cfp_rule *bcm_sf2_cfp_rule_find(struct bcm_sf2_priv *priv, |
8290 |
+ int port, u32 location) |
8291 |
+ { |
8292 |
+- struct cfp_rule *rule = NULL; |
8293 |
++ struct cfp_rule *rule; |
8294 |
+ |
8295 |
+ list_for_each_entry(rule, &priv->cfp.rules_list, next) { |
8296 |
+ if (rule->port == port && rule->fs.location == location) |
8297 |
+- break; |
8298 |
++ return rule; |
8299 |
+ } |
8300 |
+ |
8301 |
+- return rule; |
8302 |
++ return NULL; |
8303 |
+ } |
8304 |
+ |
8305 |
+ static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port, |
8306 |
+diff --git a/drivers/net/dsa/microchip/ksz8795_spi.c b/drivers/net/dsa/microchip/ksz8795_spi.c |
8307 |
+index 8b00f8e6c02f4..5639c5c59e255 100644 |
8308 |
+--- a/drivers/net/dsa/microchip/ksz8795_spi.c |
8309 |
++++ b/drivers/net/dsa/microchip/ksz8795_spi.c |
8310 |
+@@ -86,12 +86,23 @@ static const struct of_device_id ksz8795_dt_ids[] = { |
8311 |
+ }; |
8312 |
+ MODULE_DEVICE_TABLE(of, ksz8795_dt_ids); |
8313 |
+ |
8314 |
++static const struct spi_device_id ksz8795_spi_ids[] = { |
8315 |
++ { "ksz8765" }, |
8316 |
++ { "ksz8794" }, |
8317 |
++ { "ksz8795" }, |
8318 |
++ { "ksz8863" }, |
8319 |
++ { "ksz8873" }, |
8320 |
++ { }, |
8321 |
++}; |
8322 |
++MODULE_DEVICE_TABLE(spi, ksz8795_spi_ids); |
8323 |
++ |
8324 |
+ static struct spi_driver ksz8795_spi_driver = { |
8325 |
+ .driver = { |
8326 |
+ .name = "ksz8795-switch", |
8327 |
+ .owner = THIS_MODULE, |
8328 |
+ .of_match_table = of_match_ptr(ksz8795_dt_ids), |
8329 |
+ }, |
8330 |
++ .id_table = ksz8795_spi_ids, |
8331 |
+ .probe = ksz8795_spi_probe, |
8332 |
+ .remove = ksz8795_spi_remove, |
8333 |
+ .shutdown = ksz8795_spi_shutdown, |
8334 |
+diff --git a/drivers/net/dsa/microchip/ksz9477_spi.c b/drivers/net/dsa/microchip/ksz9477_spi.c |
8335 |
+index 1142768969c20..9bda83d063e8e 100644 |
8336 |
+--- a/drivers/net/dsa/microchip/ksz9477_spi.c |
8337 |
++++ b/drivers/net/dsa/microchip/ksz9477_spi.c |
8338 |
+@@ -88,12 +88,24 @@ static const struct of_device_id ksz9477_dt_ids[] = { |
8339 |
+ }; |
8340 |
+ MODULE_DEVICE_TABLE(of, ksz9477_dt_ids); |
8341 |
+ |
8342 |
++static const struct spi_device_id ksz9477_spi_ids[] = { |
8343 |
++ { "ksz9477" }, |
8344 |
++ { "ksz9897" }, |
8345 |
++ { "ksz9893" }, |
8346 |
++ { "ksz9563" }, |
8347 |
++ { "ksz8563" }, |
8348 |
++ { "ksz9567" }, |
8349 |
++ { }, |
8350 |
++}; |
8351 |
++MODULE_DEVICE_TABLE(spi, ksz9477_spi_ids); |
8352 |
++ |
8353 |
+ static struct spi_driver ksz9477_spi_driver = { |
8354 |
+ .driver = { |
8355 |
+ .name = "ksz9477-switch", |
8356 |
+ .owner = THIS_MODULE, |
8357 |
+ .of_match_table = of_match_ptr(ksz9477_dt_ids), |
8358 |
+ }, |
8359 |
++ .id_table = ksz9477_spi_ids, |
8360 |
+ .probe = ksz9477_spi_probe, |
8361 |
+ .remove = ksz9477_spi_remove, |
8362 |
+ .shutdown = ksz9477_spi_shutdown, |
8363 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
8364 |
+index 1992be77522ac..e79a808375fc8 100644 |
8365 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
8366 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
8367 |
+@@ -3297,6 +3297,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { |
8368 |
+ .port_set_link = mv88e6xxx_port_set_link, |
8369 |
+ .port_set_speed_duplex = mv88e6185_port_set_speed_duplex, |
8370 |
+ .port_tag_remap = mv88e6095_port_tag_remap, |
8371 |
++ .port_set_policy = mv88e6352_port_set_policy, |
8372 |
+ .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
8373 |
+ .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
8374 |
+ .port_set_ether_type = mv88e6351_port_set_ether_type, |
8375 |
+diff --git a/drivers/net/ethernet/8390/mcf8390.c b/drivers/net/ethernet/8390/mcf8390.c |
8376 |
+index 4ad8031ab6695..065fdbe66c425 100644 |
8377 |
+--- a/drivers/net/ethernet/8390/mcf8390.c |
8378 |
++++ b/drivers/net/ethernet/8390/mcf8390.c |
8379 |
+@@ -406,12 +406,12 @@ static int mcf8390_init(struct net_device *dev) |
8380 |
+ static int mcf8390_probe(struct platform_device *pdev) |
8381 |
+ { |
8382 |
+ struct net_device *dev; |
8383 |
+- struct resource *mem, *irq; |
8384 |
++ struct resource *mem; |
8385 |
+ resource_size_t msize; |
8386 |
+- int ret; |
8387 |
++ int ret, irq; |
8388 |
+ |
8389 |
+- irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
8390 |
+- if (irq == NULL) { |
8391 |
++ irq = platform_get_irq(pdev, 0); |
8392 |
++ if (irq < 0) { |
8393 |
+ dev_err(&pdev->dev, "no IRQ specified?\n"); |
8394 |
+ return -ENXIO; |
8395 |
+ } |
8396 |
+@@ -434,7 +434,7 @@ static int mcf8390_probe(struct platform_device *pdev) |
8397 |
+ SET_NETDEV_DEV(dev, &pdev->dev); |
8398 |
+ platform_set_drvdata(pdev, dev); |
8399 |
+ |
8400 |
+- dev->irq = irq->start; |
8401 |
++ dev->irq = irq; |
8402 |
+ dev->base_addr = mem->start; |
8403 |
+ |
8404 |
+ ret = mcf8390_init(dev); |
8405 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
8406 |
+index a2062144d7ca1..7dcd5613ee56f 100644 |
8407 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
8408 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
8409 |
+@@ -76,7 +76,7 @@ static inline void bcmgenet_writel(u32 value, void __iomem *offset) |
8410 |
+ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) |
8411 |
+ __raw_writel(value, offset); |
8412 |
+ else |
8413 |
+- writel_relaxed(value, offset); |
8414 |
++ writel(value, offset); |
8415 |
+ } |
8416 |
+ |
8417 |
+ static inline u32 bcmgenet_readl(void __iomem *offset) |
8418 |
+@@ -84,7 +84,7 @@ static inline u32 bcmgenet_readl(void __iomem *offset) |
8419 |
+ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) |
8420 |
+ return __raw_readl(offset); |
8421 |
+ else |
8422 |
+- return readl_relaxed(offset); |
8423 |
++ return readl(offset); |
8424 |
+ } |
8425 |
+ |
8426 |
+ static inline void dmadesc_set_length_status(struct bcmgenet_priv *priv, |
8427 |
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c |
8428 |
+index 9c1690f64a027..cf98a00296edf 100644 |
8429 |
+--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c |
8430 |
++++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c |
8431 |
+@@ -651,7 +651,10 @@ static int enetc_get_ts_info(struct net_device *ndev, |
8432 |
+ #ifdef CONFIG_FSL_ENETC_PTP_CLOCK |
8433 |
+ info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | |
8434 |
+ SOF_TIMESTAMPING_RX_HARDWARE | |
8435 |
+- SOF_TIMESTAMPING_RAW_HARDWARE; |
8436 |
++ SOF_TIMESTAMPING_RAW_HARDWARE | |
8437 |
++ SOF_TIMESTAMPING_TX_SOFTWARE | |
8438 |
++ SOF_TIMESTAMPING_RX_SOFTWARE | |
8439 |
++ SOF_TIMESTAMPING_SOFTWARE; |
8440 |
+ |
8441 |
+ info->tx_types = (1 << HWTSTAMP_TX_OFF) | |
8442 |
+ (1 << HWTSTAMP_TX_ON); |
8443 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
8444 |
+index 7b94764b4f5d9..2070e26a3a358 100644 |
8445 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
8446 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
8447 |
+@@ -7616,12 +7616,11 @@ int hclge_rm_uc_addr_common(struct hclge_vport *vport, |
8448 |
+ hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0); |
8449 |
+ hclge_prepare_mac_addr(&req, addr, false); |
8450 |
+ ret = hclge_remove_mac_vlan_tbl(vport, &req); |
8451 |
+- if (!ret) { |
8452 |
++ if (!ret || ret == -ENOENT) { |
8453 |
+ mutex_lock(&hdev->vport_lock); |
8454 |
+ hclge_update_umv_space(vport, true); |
8455 |
+ mutex_unlock(&hdev->vport_lock); |
8456 |
+- } else if (ret == -ENOENT) { |
8457 |
+- ret = 0; |
8458 |
++ return 0; |
8459 |
+ } |
8460 |
+ |
8461 |
+ return ret; |
8462 |
+@@ -9198,11 +9197,11 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, |
8463 |
+ } |
8464 |
+ |
8465 |
+ if (!ret) { |
8466 |
+- if (is_kill) |
8467 |
+- hclge_rm_vport_vlan_table(vport, vlan_id, false); |
8468 |
+- else |
8469 |
++ if (!is_kill) |
8470 |
+ hclge_add_vport_vlan_table(vport, vlan_id, |
8471 |
+ writen_to_tbl); |
8472 |
++ else if (is_kill && vlan_id != 0) |
8473 |
++ hclge_rm_vport_vlan_table(vport, vlan_id, false); |
8474 |
+ } else if (is_kill) { |
8475 |
+ /* when remove hw vlan filter failed, record the vlan id, |
8476 |
+ * and try to remove it from hw later, to be consistence |
8477 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
8478 |
+index 86c79f71c685a..75e4a698c3db2 100644 |
8479 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
8480 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
8481 |
+@@ -247,21 +247,25 @@ no_buffers: |
8482 |
+ static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring, |
8483 |
+ struct xdp_buff *xdp) |
8484 |
+ { |
8485 |
++ unsigned int totalsize = xdp->data_end - xdp->data_meta; |
8486 |
+ unsigned int metasize = xdp->data - xdp->data_meta; |
8487 |
+- unsigned int datasize = xdp->data_end - xdp->data; |
8488 |
+ struct sk_buff *skb; |
8489 |
+ |
8490 |
++ net_prefetch(xdp->data_meta); |
8491 |
++ |
8492 |
+ /* allocate a skb to store the frags */ |
8493 |
+- skb = __napi_alloc_skb(&rx_ring->q_vector->napi, |
8494 |
+- xdp->data_end - xdp->data_hard_start, |
8495 |
++ skb = __napi_alloc_skb(&rx_ring->q_vector->napi, totalsize, |
8496 |
+ GFP_ATOMIC | __GFP_NOWARN); |
8497 |
+ if (unlikely(!skb)) |
8498 |
+ return NULL; |
8499 |
+ |
8500 |
+- skb_reserve(skb, xdp->data - xdp->data_hard_start); |
8501 |
+- memcpy(__skb_put(skb, datasize), xdp->data, datasize); |
8502 |
+- if (metasize) |
8503 |
++ memcpy(__skb_put(skb, totalsize), xdp->data_meta, |
8504 |
++ ALIGN(totalsize, sizeof(long))); |
8505 |
++ |
8506 |
++ if (metasize) { |
8507 |
+ skb_metadata_set(skb, metasize); |
8508 |
++ __skb_pull(skb, metasize); |
8509 |
++ } |
8510 |
+ |
8511 |
+ xsk_buff_free(xdp); |
8512 |
+ return skb; |
8513 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c |
8514 |
+index d355676f6c160..e14869a2e24a5 100644 |
8515 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c |
8516 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c |
8517 |
+@@ -311,10 +311,10 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) |
8518 |
+ |
8519 |
+ static void ionic_dev_cmd_clean(struct ionic *ionic) |
8520 |
+ { |
8521 |
+- union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs; |
8522 |
++ struct ionic_dev *idev = &ionic->idev; |
8523 |
+ |
8524 |
+- iowrite32(0, ®s->doorbell); |
8525 |
+- memset_io(®s->cmd, 0, sizeof(regs->cmd)); |
8526 |
++ iowrite32(0, &idev->dev_cmd_regs->doorbell); |
8527 |
++ memset_io(&idev->dev_cmd_regs->cmd, 0, sizeof(idev->dev_cmd_regs->cmd)); |
8528 |
+ } |
8529 |
+ |
8530 |
+ int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds) |
8531 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
8532 |
+index ef0ad4cf82e60..3541bc95493f0 100644 |
8533 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
8534 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
8535 |
+@@ -2982,12 +2982,16 @@ static int qed_iov_pre_update_vport(struct qed_hwfn *hwfn, |
8536 |
+ u8 mask = QED_ACCEPT_UCAST_UNMATCHED | QED_ACCEPT_MCAST_UNMATCHED; |
8537 |
+ struct qed_filter_accept_flags *flags = ¶ms->accept_flags; |
8538 |
+ struct qed_public_vf_info *vf_info; |
8539 |
++ u16 tlv_mask; |
8540 |
++ |
8541 |
++ tlv_mask = BIT(QED_IOV_VP_UPDATE_ACCEPT_PARAM) | |
8542 |
++ BIT(QED_IOV_VP_UPDATE_ACCEPT_ANY_VLAN); |
8543 |
+ |
8544 |
+ /* Untrusted VFs can't even be trusted to know that fact. |
8545 |
+ * Simply indicate everything is configured fine, and trace |
8546 |
+ * configuration 'behind their back'. |
8547 |
+ */ |
8548 |
+- if (!(*tlvs & BIT(QED_IOV_VP_UPDATE_ACCEPT_PARAM))) |
8549 |
++ if (!(*tlvs & tlv_mask)) |
8550 |
+ return 0; |
8551 |
+ |
8552 |
+ vf_info = qed_iov_get_public_vf_info(hwfn, vfid, true); |
8553 |
+@@ -3004,6 +3008,13 @@ static int qed_iov_pre_update_vport(struct qed_hwfn *hwfn, |
8554 |
+ flags->tx_accept_filter &= ~mask; |
8555 |
+ } |
8556 |
+ |
8557 |
++ if (params->update_accept_any_vlan_flg) { |
8558 |
++ vf_info->accept_any_vlan = params->accept_any_vlan; |
8559 |
++ |
8560 |
++ if (vf_info->forced_vlan && !vf_info->is_trusted_configured) |
8561 |
++ params->accept_any_vlan = false; |
8562 |
++ } |
8563 |
++ |
8564 |
+ return 0; |
8565 |
+ } |
8566 |
+ |
8567 |
+@@ -4691,6 +4702,7 @@ static int qed_get_vf_config(struct qed_dev *cdev, |
8568 |
+ tx_rate = vf_info->tx_rate; |
8569 |
+ ivi->max_tx_rate = tx_rate ? tx_rate : link.speed; |
8570 |
+ ivi->min_tx_rate = qed_iov_get_vf_min_rate(hwfn, vf_id); |
8571 |
++ ivi->trusted = vf_info->is_trusted_request; |
8572 |
+ |
8573 |
+ return 0; |
8574 |
+ } |
8575 |
+@@ -5120,6 +5132,12 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) |
8576 |
+ |
8577 |
+ params.update_ctl_frame_check = 1; |
8578 |
+ params.mac_chk_en = !vf_info->is_trusted_configured; |
8579 |
++ params.update_accept_any_vlan_flg = 0; |
8580 |
++ |
8581 |
++ if (vf_info->accept_any_vlan && vf_info->forced_vlan) { |
8582 |
++ params.update_accept_any_vlan_flg = 1; |
8583 |
++ params.accept_any_vlan = vf_info->accept_any_vlan; |
8584 |
++ } |
8585 |
+ |
8586 |
+ if (vf_info->rx_accept_mode & mask) { |
8587 |
+ flags->update_rx_mode_config = 1; |
8588 |
+@@ -5135,13 +5153,20 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) |
8589 |
+ if (!vf_info->is_trusted_configured) { |
8590 |
+ flags->rx_accept_filter &= ~mask; |
8591 |
+ flags->tx_accept_filter &= ~mask; |
8592 |
++ params.accept_any_vlan = false; |
8593 |
+ } |
8594 |
+ |
8595 |
+ if (flags->update_rx_mode_config || |
8596 |
+ flags->update_tx_mode_config || |
8597 |
+- params.update_ctl_frame_check) |
8598 |
++ params.update_ctl_frame_check || |
8599 |
++ params.update_accept_any_vlan_flg) { |
8600 |
++ DP_VERBOSE(hwfn, QED_MSG_IOV, |
8601 |
++ "vport update config for %s VF[abs 0x%x rel 0x%x]\n", |
8602 |
++ vf_info->is_trusted_configured ? "trusted" : "untrusted", |
8603 |
++ vf->abs_vf_id, vf->relative_vf_id); |
8604 |
+ qed_sp_vport_update(hwfn, ¶ms, |
8605 |
+ QED_SPQ_MODE_EBLOCK, NULL); |
8606 |
++ } |
8607 |
+ } |
8608 |
+ } |
8609 |
+ |
8610 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.h b/drivers/net/ethernet/qlogic/qed/qed_sriov.h |
8611 |
+index eacd6457f195c..7ff23ef8ccc17 100644 |
8612 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.h |
8613 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.h |
8614 |
+@@ -62,6 +62,7 @@ struct qed_public_vf_info { |
8615 |
+ bool is_trusted_request; |
8616 |
+ u8 rx_accept_mode; |
8617 |
+ u8 tx_accept_mode; |
8618 |
++ bool accept_any_vlan; |
8619 |
+ }; |
8620 |
+ |
8621 |
+ struct qed_iov_vf_init_params { |
8622 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h |
8623 |
+index 5d79ee4370bcd..7519773eaca6e 100644 |
8624 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h |
8625 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h |
8626 |
+@@ -51,7 +51,7 @@ static inline int qlcnic_dcb_get_hw_capability(struct qlcnic_dcb *dcb) |
8627 |
+ if (dcb && dcb->ops->get_hw_capability) |
8628 |
+ return dcb->ops->get_hw_capability(dcb); |
8629 |
+ |
8630 |
+- return 0; |
8631 |
++ return -EOPNOTSUPP; |
8632 |
+ } |
8633 |
+ |
8634 |
+ static inline void qlcnic_dcb_free(struct qlcnic_dcb *dcb) |
8635 |
+@@ -65,7 +65,7 @@ static inline int qlcnic_dcb_attach(struct qlcnic_dcb *dcb) |
8636 |
+ if (dcb && dcb->ops->attach) |
8637 |
+ return dcb->ops->attach(dcb); |
8638 |
+ |
8639 |
+- return 0; |
8640 |
++ return -EOPNOTSUPP; |
8641 |
+ } |
8642 |
+ |
8643 |
+ static inline int |
8644 |
+@@ -74,7 +74,7 @@ qlcnic_dcb_query_hw_capability(struct qlcnic_dcb *dcb, char *buf) |
8645 |
+ if (dcb && dcb->ops->query_hw_capability) |
8646 |
+ return dcb->ops->query_hw_capability(dcb, buf); |
8647 |
+ |
8648 |
+- return 0; |
8649 |
++ return -EOPNOTSUPP; |
8650 |
+ } |
8651 |
+ |
8652 |
+ static inline void qlcnic_dcb_get_info(struct qlcnic_dcb *dcb) |
8653 |
+@@ -89,7 +89,7 @@ qlcnic_dcb_query_cee_param(struct qlcnic_dcb *dcb, char *buf, u8 type) |
8654 |
+ if (dcb && dcb->ops->query_cee_param) |
8655 |
+ return dcb->ops->query_cee_param(dcb, buf, type); |
8656 |
+ |
8657 |
+- return 0; |
8658 |
++ return -EOPNOTSUPP; |
8659 |
+ } |
8660 |
+ |
8661 |
+ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb) |
8662 |
+@@ -97,7 +97,7 @@ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb) |
8663 |
+ if (dcb && dcb->ops->get_cee_cfg) |
8664 |
+ return dcb->ops->get_cee_cfg(dcb); |
8665 |
+ |
8666 |
+- return 0; |
8667 |
++ return -EOPNOTSUPP; |
8668 |
+ } |
8669 |
+ |
8670 |
+ static inline void qlcnic_dcb_aen_handler(struct qlcnic_dcb *dcb, void *msg) |
8671 |
+diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c |
8672 |
+index 54b53dbdb33cd..69fc47089e625 100644 |
8673 |
+--- a/drivers/net/ethernet/sun/sunhme.c |
8674 |
++++ b/drivers/net/ethernet/sun/sunhme.c |
8675 |
+@@ -3163,7 +3163,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, |
8676 |
+ if (err) { |
8677 |
+ printk(KERN_ERR "happymeal(PCI): Cannot register net device, " |
8678 |
+ "aborting.\n"); |
8679 |
+- goto err_out_iounmap; |
8680 |
++ goto err_out_free_coherent; |
8681 |
+ } |
8682 |
+ |
8683 |
+ pci_set_drvdata(pdev, hp); |
8684 |
+@@ -3196,6 +3196,10 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, |
8685 |
+ |
8686 |
+ return 0; |
8687 |
+ |
8688 |
++err_out_free_coherent: |
8689 |
++ dma_free_coherent(hp->dma_dev, PAGE_SIZE, |
8690 |
++ hp->happy_block, hp->hblock_dvma); |
8691 |
++ |
8692 |
+ err_out_iounmap: |
8693 |
+ iounmap(hp->gregs); |
8694 |
+ |
8695 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
8696 |
+index 0baf85122f5ac..bbdcba88c021e 100644 |
8697 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
8698 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
8699 |
+@@ -857,46 +857,53 @@ static void axienet_recv(struct net_device *ndev) |
8700 |
+ while ((cur_p->status & XAXIDMA_BD_STS_COMPLETE_MASK)) { |
8701 |
+ dma_addr_t phys; |
8702 |
+ |
8703 |
+- tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci; |
8704 |
+- |
8705 |
+ /* Ensure we see complete descriptor update */ |
8706 |
+ dma_rmb(); |
8707 |
+- phys = desc_get_phys_addr(lp, cur_p); |
8708 |
+- dma_unmap_single(ndev->dev.parent, phys, lp->max_frm_size, |
8709 |
+- DMA_FROM_DEVICE); |
8710 |
+ |
8711 |
+ skb = cur_p->skb; |
8712 |
+ cur_p->skb = NULL; |
8713 |
+- length = cur_p->app4 & 0x0000FFFF; |
8714 |
+- |
8715 |
+- skb_put(skb, length); |
8716 |
+- skb->protocol = eth_type_trans(skb, ndev); |
8717 |
+- /*skb_checksum_none_assert(skb);*/ |
8718 |
+- skb->ip_summed = CHECKSUM_NONE; |
8719 |
+- |
8720 |
+- /* if we're doing Rx csum offload, set it up */ |
8721 |
+- if (lp->features & XAE_FEATURE_FULL_RX_CSUM) { |
8722 |
+- csumstatus = (cur_p->app2 & |
8723 |
+- XAE_FULL_CSUM_STATUS_MASK) >> 3; |
8724 |
+- if ((csumstatus == XAE_IP_TCP_CSUM_VALIDATED) || |
8725 |
+- (csumstatus == XAE_IP_UDP_CSUM_VALIDATED)) { |
8726 |
+- skb->ip_summed = CHECKSUM_UNNECESSARY; |
8727 |
++ |
8728 |
++ /* skb could be NULL if a previous pass already received the |
8729 |
++ * packet for this slot in the ring, but failed to refill it |
8730 |
++ * with a newly allocated buffer. In this case, don't try to |
8731 |
++ * receive it again. |
8732 |
++ */ |
8733 |
++ if (likely(skb)) { |
8734 |
++ length = cur_p->app4 & 0x0000FFFF; |
8735 |
++ |
8736 |
++ phys = desc_get_phys_addr(lp, cur_p); |
8737 |
++ dma_unmap_single(ndev->dev.parent, phys, lp->max_frm_size, |
8738 |
++ DMA_FROM_DEVICE); |
8739 |
++ |
8740 |
++ skb_put(skb, length); |
8741 |
++ skb->protocol = eth_type_trans(skb, ndev); |
8742 |
++ /*skb_checksum_none_assert(skb);*/ |
8743 |
++ skb->ip_summed = CHECKSUM_NONE; |
8744 |
++ |
8745 |
++ /* if we're doing Rx csum offload, set it up */ |
8746 |
++ if (lp->features & XAE_FEATURE_FULL_RX_CSUM) { |
8747 |
++ csumstatus = (cur_p->app2 & |
8748 |
++ XAE_FULL_CSUM_STATUS_MASK) >> 3; |
8749 |
++ if (csumstatus == XAE_IP_TCP_CSUM_VALIDATED || |
8750 |
++ csumstatus == XAE_IP_UDP_CSUM_VALIDATED) { |
8751 |
++ skb->ip_summed = CHECKSUM_UNNECESSARY; |
8752 |
++ } |
8753 |
++ } else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 && |
8754 |
++ skb->protocol == htons(ETH_P_IP) && |
8755 |
++ skb->len > 64) { |
8756 |
++ skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF); |
8757 |
++ skb->ip_summed = CHECKSUM_COMPLETE; |
8758 |
+ } |
8759 |
+- } else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 && |
8760 |
+- skb->protocol == htons(ETH_P_IP) && |
8761 |
+- skb->len > 64) { |
8762 |
+- skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF); |
8763 |
+- skb->ip_summed = CHECKSUM_COMPLETE; |
8764 |
+- } |
8765 |
+ |
8766 |
+- netif_rx(skb); |
8767 |
++ netif_rx(skb); |
8768 |
+ |
8769 |
+- size += length; |
8770 |
+- packets++; |
8771 |
++ size += length; |
8772 |
++ packets++; |
8773 |
++ } |
8774 |
+ |
8775 |
+ new_skb = netdev_alloc_skb_ip_align(ndev, lp->max_frm_size); |
8776 |
+ if (!new_skb) |
8777 |
+- return; |
8778 |
++ break; |
8779 |
+ |
8780 |
+ phys = dma_map_single(ndev->dev.parent, new_skb->data, |
8781 |
+ lp->max_frm_size, |
8782 |
+@@ -905,7 +912,7 @@ static void axienet_recv(struct net_device *ndev) |
8783 |
+ if (net_ratelimit()) |
8784 |
+ netdev_err(ndev, "RX DMA mapping error\n"); |
8785 |
+ dev_kfree_skb(new_skb); |
8786 |
+- return; |
8787 |
++ break; |
8788 |
+ } |
8789 |
+ desc_set_phys_addr(lp, phys, cur_p); |
8790 |
+ |
8791 |
+@@ -913,6 +920,11 @@ static void axienet_recv(struct net_device *ndev) |
8792 |
+ cur_p->status = 0; |
8793 |
+ cur_p->skb = new_skb; |
8794 |
+ |
8795 |
++ /* Only update tail_p to mark this slot as usable after it has |
8796 |
++ * been successfully refilled. |
8797 |
++ */ |
8798 |
++ tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci; |
8799 |
++ |
8800 |
+ if (++lp->rx_bd_ci >= lp->rx_bd_num) |
8801 |
+ lp->rx_bd_ci = 0; |
8802 |
+ cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; |
8803 |
+diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c |
8804 |
+index bd0beb16d68a9..02d6f3ad9aca8 100644 |
8805 |
+--- a/drivers/net/hamradio/6pack.c |
8806 |
++++ b/drivers/net/hamradio/6pack.c |
8807 |
+@@ -674,14 +674,14 @@ static void sixpack_close(struct tty_struct *tty) |
8808 |
+ */ |
8809 |
+ netif_stop_queue(sp->dev); |
8810 |
+ |
8811 |
++ unregister_netdev(sp->dev); |
8812 |
++ |
8813 |
+ del_timer_sync(&sp->tx_t); |
8814 |
+ del_timer_sync(&sp->resync_t); |
8815 |
+ |
8816 |
+ /* Free all 6pack frame buffers. */ |
8817 |
+ kfree(sp->rbuff); |
8818 |
+ kfree(sp->xbuff); |
8819 |
+- |
8820 |
+- unregister_netdev(sp->dev); |
8821 |
+ } |
8822 |
+ |
8823 |
+ /* Perform I/O control on an active 6pack channel. */ |
8824 |
+diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c |
8825 |
+index 644861366d544..0cde17bd743f3 100644 |
8826 |
+--- a/drivers/net/phy/broadcom.c |
8827 |
++++ b/drivers/net/phy/broadcom.c |
8828 |
+@@ -11,6 +11,7 @@ |
8829 |
+ */ |
8830 |
+ |
8831 |
+ #include "bcm-phy-lib.h" |
8832 |
++#include <linux/delay.h> |
8833 |
+ #include <linux/module.h> |
8834 |
+ #include <linux/phy.h> |
8835 |
+ #include <linux/brcmphy.h> |
8836 |
+@@ -622,6 +623,26 @@ static int brcm_fet_config_init(struct phy_device *phydev) |
8837 |
+ if (err < 0) |
8838 |
+ return err; |
8839 |
+ |
8840 |
++ /* The datasheet indicates the PHY needs up to 1us to complete a reset, |
8841 |
++ * build some slack here. |
8842 |
++ */ |
8843 |
++ usleep_range(1000, 2000); |
8844 |
++ |
8845 |
++ /* The PHY requires 65 MDC clock cycles to complete a write operation |
8846 |
++ * and turnaround the line properly. |
8847 |
++ * |
8848 |
++ * We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac) |
8849 |
++ * may flag the lack of turn-around as a read failure. This is |
8850 |
++ * particularly true with this combination since the MDIO controller |
8851 |
++ * only used 64 MDC cycles. This is not a critical failure in this |
8852 |
++ * specific case and it has no functional impact otherwise, so we let |
8853 |
++ * that one go through. If there is a genuine bus error, the next read |
8854 |
++ * of MII_BRCM_FET_INTREG will error out. |
8855 |
++ */ |
8856 |
++ err = phy_read(phydev, MII_BMCR); |
8857 |
++ if (err < 0 && err != -EIO) |
8858 |
++ return err; |
8859 |
++ |
8860 |
+ reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
8861 |
+ if (reg < 0) |
8862 |
+ return reg; |
8863 |
+diff --git a/drivers/net/wireguard/queueing.c b/drivers/net/wireguard/queueing.c |
8864 |
+index 1de413b19e342..8084e7408c0ae 100644 |
8865 |
+--- a/drivers/net/wireguard/queueing.c |
8866 |
++++ b/drivers/net/wireguard/queueing.c |
8867 |
+@@ -4,6 +4,7 @@ |
8868 |
+ */ |
8869 |
+ |
8870 |
+ #include "queueing.h" |
8871 |
++#include <linux/skb_array.h> |
8872 |
+ |
8873 |
+ struct multicore_worker __percpu * |
8874 |
+ wg_packet_percpu_multicore_worker_alloc(work_func_t function, void *ptr) |
8875 |
+@@ -42,7 +43,7 @@ void wg_packet_queue_free(struct crypt_queue *queue, bool purge) |
8876 |
+ { |
8877 |
+ free_percpu(queue->worker); |
8878 |
+ WARN_ON(!purge && !__ptr_ring_empty(&queue->ring)); |
8879 |
+- ptr_ring_cleanup(&queue->ring, purge ? (void(*)(void*))kfree_skb : NULL); |
8880 |
++ ptr_ring_cleanup(&queue->ring, purge ? __skb_array_destroy_skb : NULL); |
8881 |
+ } |
8882 |
+ |
8883 |
+ #define NEXT(skb) ((skb)->prev) |
8884 |
+diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c |
8885 |
+index 52b9bc83abcbc..473221aa22368 100644 |
8886 |
+--- a/drivers/net/wireguard/socket.c |
8887 |
++++ b/drivers/net/wireguard/socket.c |
8888 |
+@@ -160,6 +160,7 @@ out: |
8889 |
+ rcu_read_unlock_bh(); |
8890 |
+ return ret; |
8891 |
+ #else |
8892 |
++ kfree_skb(skb); |
8893 |
+ return -EAFNOSUPPORT; |
8894 |
+ #endif |
8895 |
+ } |
8896 |
+@@ -241,7 +242,7 @@ int wg_socket_endpoint_from_skb(struct endpoint *endpoint, |
8897 |
+ endpoint->addr4.sin_addr.s_addr = ip_hdr(skb)->saddr; |
8898 |
+ endpoint->src4.s_addr = ip_hdr(skb)->daddr; |
8899 |
+ endpoint->src_if4 = skb->skb_iif; |
8900 |
+- } else if (skb->protocol == htons(ETH_P_IPV6)) { |
8901 |
++ } else if (IS_ENABLED(CONFIG_IPV6) && skb->protocol == htons(ETH_P_IPV6)) { |
8902 |
+ endpoint->addr6.sin6_family = AF_INET6; |
8903 |
+ endpoint->addr6.sin6_port = udp_hdr(skb)->source; |
8904 |
+ endpoint->addr6.sin6_addr = ipv6_hdr(skb)->saddr; |
8905 |
+@@ -284,7 +285,7 @@ void wg_socket_set_peer_endpoint(struct wg_peer *peer, |
8906 |
+ peer->endpoint.addr4 = endpoint->addr4; |
8907 |
+ peer->endpoint.src4 = endpoint->src4; |
8908 |
+ peer->endpoint.src_if4 = endpoint->src_if4; |
8909 |
+- } else if (endpoint->addr.sa_family == AF_INET6) { |
8910 |
++ } else if (IS_ENABLED(CONFIG_IPV6) && endpoint->addr.sa_family == AF_INET6) { |
8911 |
+ peer->endpoint.addr6 = endpoint->addr6; |
8912 |
+ peer->endpoint.src6 = endpoint->src6; |
8913 |
+ } else { |
8914 |
+diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c |
8915 |
+index daae470ecf5aa..e5a296039f714 100644 |
8916 |
+--- a/drivers/net/wireless/ath/ath10k/snoc.c |
8917 |
++++ b/drivers/net/wireless/ath/ath10k/snoc.c |
8918 |
+@@ -1477,11 +1477,11 @@ static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) |
8919 |
+ node = of_parse_phandle(dev->of_node, "memory-region", 0); |
8920 |
+ if (node) { |
8921 |
+ ret = of_address_to_resource(node, 0, &r); |
8922 |
++ of_node_put(node); |
8923 |
+ if (ret) { |
8924 |
+ dev_err(dev, "failed to resolve msa fixed region\n"); |
8925 |
+ return ret; |
8926 |
+ } |
8927 |
+- of_node_put(node); |
8928 |
+ |
8929 |
+ ar->msa.paddr = r.start; |
8930 |
+ ar->msa.mem_size = resource_size(&r); |
8931 |
+diff --git a/drivers/net/wireless/ath/ath10k/wow.c b/drivers/net/wireless/ath/ath10k/wow.c |
8932 |
+index 7d65c115669fe..20b9aa8ddf7d5 100644 |
8933 |
+--- a/drivers/net/wireless/ath/ath10k/wow.c |
8934 |
++++ b/drivers/net/wireless/ath/ath10k/wow.c |
8935 |
+@@ -337,14 +337,15 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif, |
8936 |
+ if (patterns[i].mask[j / 8] & BIT(j % 8)) |
8937 |
+ bitmask[j] = 0xff; |
8938 |
+ old_pattern.mask = bitmask; |
8939 |
+- new_pattern = old_pattern; |
8940 |
+ |
8941 |
+ if (ar->wmi.rx_decap_mode == ATH10K_HW_TXRX_NATIVE_WIFI) { |
8942 |
+- if (patterns[i].pkt_offset < ETH_HLEN) |
8943 |
++ if (patterns[i].pkt_offset < ETH_HLEN) { |
8944 |
+ ath10k_wow_convert_8023_to_80211(&new_pattern, |
8945 |
+ &old_pattern); |
8946 |
+- else |
8947 |
++ } else { |
8948 |
++ new_pattern = old_pattern; |
8949 |
+ new_pattern.pkt_offset += WOW_HDR_LEN - ETH_HLEN; |
8950 |
++ } |
8951 |
+ } |
8952 |
+ |
8953 |
+ if (WARN_ON(new_pattern.pattern_len > WOW_MAX_PATTERN_SIZE)) |
8954 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c |
8955 |
+index 510e61e97dbcb..994ec48b2f669 100644 |
8956 |
+--- a/drivers/net/wireless/ath/ath9k/htc_hst.c |
8957 |
++++ b/drivers/net/wireless/ath/ath9k/htc_hst.c |
8958 |
+@@ -30,6 +30,7 @@ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, |
8959 |
+ hdr->endpoint_id = epid; |
8960 |
+ hdr->flags = flags; |
8961 |
+ hdr->payload_len = cpu_to_be16(len); |
8962 |
++ memset(hdr->control, 0, sizeof(hdr->control)); |
8963 |
+ |
8964 |
+ status = target->hif->send(target->hif_dev, endpoint->ul_pipeid, skb); |
8965 |
+ |
8966 |
+@@ -272,6 +273,10 @@ int htc_connect_service(struct htc_target *target, |
8967 |
+ conn_msg->dl_pipeid = endpoint->dl_pipeid; |
8968 |
+ conn_msg->ul_pipeid = endpoint->ul_pipeid; |
8969 |
+ |
8970 |
++ /* To prevent infoleak */ |
8971 |
++ conn_msg->svc_meta_len = 0; |
8972 |
++ conn_msg->pad = 0; |
8973 |
++ |
8974 |
+ ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); |
8975 |
+ if (ret) |
8976 |
+ goto err; |
8977 |
+diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c |
8978 |
+index dbef9d8fc893b..b903b856bcf7b 100644 |
8979 |
+--- a/drivers/net/wireless/ath/carl9170/main.c |
8980 |
++++ b/drivers/net/wireless/ath/carl9170/main.c |
8981 |
+@@ -1916,7 +1916,7 @@ static int carl9170_parse_eeprom(struct ar9170 *ar) |
8982 |
+ WARN_ON(!(tx_streams >= 1 && tx_streams <= |
8983 |
+ IEEE80211_HT_MCS_TX_MAX_STREAMS)); |
8984 |
+ |
8985 |
+- tx_params = (tx_streams - 1) << |
8986 |
++ tx_params |= (tx_streams - 1) << |
8987 |
+ IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; |
8988 |
+ |
8989 |
+ carl9170_band_2GHz.ht_cap.mcs.tx_params |= tx_params; |
8990 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c |
8991 |
+index d821a4758f8cf..a2b8d9171af2a 100644 |
8992 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c |
8993 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c |
8994 |
+@@ -207,6 +207,8 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp, |
8995 |
+ size = BRCMF_FW_MAX_NVRAM_SIZE; |
8996 |
+ else |
8997 |
+ size = data_len; |
8998 |
++ /* Add space for properties we may add */ |
8999 |
++ size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1; |
9000 |
+ /* Alloc for extra 0 byte + roundup by 4 + length field */ |
9001 |
+ size += 1 + 3 + sizeof(u32); |
9002 |
+ nvp->nvram = kzalloc(size, GFP_KERNEL); |
9003 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
9004 |
+index 1f12dfb33938a..61febc9bfa14a 100644 |
9005 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
9006 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
9007 |
+@@ -12,6 +12,7 @@ |
9008 |
+ #include <linux/interrupt.h> |
9009 |
+ #include <linux/bcma/bcma.h> |
9010 |
+ #include <linux/sched.h> |
9011 |
++#include <linux/io.h> |
9012 |
+ #include <asm/unaligned.h> |
9013 |
+ |
9014 |
+ #include <soc.h> |
9015 |
+@@ -446,47 +447,6 @@ brcmf_pcie_write_ram32(struct brcmf_pciedev_info *devinfo, u32 mem_offset, |
9016 |
+ } |
9017 |
+ |
9018 |
+ |
9019 |
+-static void |
9020 |
+-brcmf_pcie_copy_mem_todev(struct brcmf_pciedev_info *devinfo, u32 mem_offset, |
9021 |
+- void *srcaddr, u32 len) |
9022 |
+-{ |
9023 |
+- void __iomem *address = devinfo->tcm + mem_offset; |
9024 |
+- __le32 *src32; |
9025 |
+- __le16 *src16; |
9026 |
+- u8 *src8; |
9027 |
+- |
9028 |
+- if (((ulong)address & 4) || ((ulong)srcaddr & 4) || (len & 4)) { |
9029 |
+- if (((ulong)address & 2) || ((ulong)srcaddr & 2) || (len & 2)) { |
9030 |
+- src8 = (u8 *)srcaddr; |
9031 |
+- while (len) { |
9032 |
+- iowrite8(*src8, address); |
9033 |
+- address++; |
9034 |
+- src8++; |
9035 |
+- len--; |
9036 |
+- } |
9037 |
+- } else { |
9038 |
+- len = len / 2; |
9039 |
+- src16 = (__le16 *)srcaddr; |
9040 |
+- while (len) { |
9041 |
+- iowrite16(le16_to_cpu(*src16), address); |
9042 |
+- address += 2; |
9043 |
+- src16++; |
9044 |
+- len--; |
9045 |
+- } |
9046 |
+- } |
9047 |
+- } else { |
9048 |
+- len = len / 4; |
9049 |
+- src32 = (__le32 *)srcaddr; |
9050 |
+- while (len) { |
9051 |
+- iowrite32(le32_to_cpu(*src32), address); |
9052 |
+- address += 4; |
9053 |
+- src32++; |
9054 |
+- len--; |
9055 |
+- } |
9056 |
+- } |
9057 |
+-} |
9058 |
+- |
9059 |
+- |
9060 |
+ static void |
9061 |
+ brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset, |
9062 |
+ void *dstaddr, u32 len) |
9063 |
+@@ -1346,6 +1306,18 @@ static void brcmf_pcie_down(struct device *dev) |
9064 |
+ { |
9065 |
+ } |
9066 |
+ |
9067 |
++static int brcmf_pcie_preinit(struct device *dev) |
9068 |
++{ |
9069 |
++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
9070 |
++ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; |
9071 |
++ |
9072 |
++ brcmf_dbg(PCIE, "Enter\n"); |
9073 |
++ |
9074 |
++ brcmf_pcie_intr_enable(buspub->devinfo); |
9075 |
++ brcmf_pcie_hostready(buspub->devinfo); |
9076 |
++ |
9077 |
++ return 0; |
9078 |
++} |
9079 |
+ |
9080 |
+ static int brcmf_pcie_tx(struct device *dev, struct sk_buff *skb) |
9081 |
+ { |
9082 |
+@@ -1454,6 +1426,7 @@ static int brcmf_pcie_reset(struct device *dev) |
9083 |
+ } |
9084 |
+ |
9085 |
+ static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { |
9086 |
++ .preinit = brcmf_pcie_preinit, |
9087 |
+ .txdata = brcmf_pcie_tx, |
9088 |
+ .stop = brcmf_pcie_down, |
9089 |
+ .txctl = brcmf_pcie_tx_ctlpkt, |
9090 |
+@@ -1561,8 +1534,8 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, |
9091 |
+ return err; |
9092 |
+ |
9093 |
+ brcmf_dbg(PCIE, "Download FW %s\n", devinfo->fw_name); |
9094 |
+- brcmf_pcie_copy_mem_todev(devinfo, devinfo->ci->rambase, |
9095 |
+- (void *)fw->data, fw->size); |
9096 |
++ memcpy_toio(devinfo->tcm + devinfo->ci->rambase, |
9097 |
++ (void *)fw->data, fw->size); |
9098 |
+ |
9099 |
+ resetintr = get_unaligned_le32(fw->data); |
9100 |
+ release_firmware(fw); |
9101 |
+@@ -1576,7 +1549,7 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, |
9102 |
+ brcmf_dbg(PCIE, "Download NVRAM %s\n", devinfo->nvram_name); |
9103 |
+ address = devinfo->ci->rambase + devinfo->ci->ramsize - |
9104 |
+ nvram_len; |
9105 |
+- brcmf_pcie_copy_mem_todev(devinfo, address, nvram, nvram_len); |
9106 |
++ memcpy_toio(devinfo->tcm + address, nvram, nvram_len); |
9107 |
+ brcmf_fw_nvram_free(nvram); |
9108 |
+ } else { |
9109 |
+ brcmf_dbg(PCIE, "No matching NVRAM file found %s\n", |
9110 |
+@@ -1775,6 +1748,8 @@ static void brcmf_pcie_setup(struct device *dev, int ret, |
9111 |
+ ret = brcmf_chip_get_raminfo(devinfo->ci); |
9112 |
+ if (ret) { |
9113 |
+ brcmf_err(bus, "Failed to get RAM info\n"); |
9114 |
++ release_firmware(fw); |
9115 |
++ brcmf_fw_nvram_free(nvram); |
9116 |
+ goto fail; |
9117 |
+ } |
9118 |
+ |
9119 |
+@@ -1824,9 +1799,6 @@ static void brcmf_pcie_setup(struct device *dev, int ret, |
9120 |
+ |
9121 |
+ init_waitqueue_head(&devinfo->mbdata_resp_wait); |
9122 |
+ |
9123 |
+- brcmf_pcie_intr_enable(devinfo); |
9124 |
+- brcmf_pcie_hostready(devinfo); |
9125 |
+- |
9126 |
+ ret = brcmf_attach(&devinfo->pdev->dev); |
9127 |
+ if (ret) |
9128 |
+ goto fail; |
9129 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |
9130 |
+index 423d3c396b2d3..1e21cdbb7313b 100644 |
9131 |
+--- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |
9132 |
++++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |
9133 |
+@@ -304,7 +304,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw) |
9134 |
+ |
9135 |
+ priv->is_open = 1; |
9136 |
+ IWL_DEBUG_MAC80211(priv, "leave\n"); |
9137 |
+- return 0; |
9138 |
++ return ret; |
9139 |
+ } |
9140 |
+ |
9141 |
+ static void iwlagn_mac_stop(struct ieee80211_hw *hw) |
9142 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
9143 |
+index 6348dfa61724a..54b28f0932e25 100644 |
9144 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
9145 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
9146 |
+@@ -1495,8 +1495,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm) |
9147 |
+ while (!sband && i < NUM_NL80211_BANDS) |
9148 |
+ sband = mvm->hw->wiphy->bands[i++]; |
9149 |
+ |
9150 |
+- if (WARN_ON_ONCE(!sband)) |
9151 |
++ if (WARN_ON_ONCE(!sband)) { |
9152 |
++ ret = -ENODEV; |
9153 |
+ goto error; |
9154 |
++ } |
9155 |
+ |
9156 |
+ chan = &sband->channels[0]; |
9157 |
+ |
9158 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c |
9159 |
+index c9226dceb510c..bdff89cc3105e 100644 |
9160 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c |
9161 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c |
9162 |
+@@ -618,6 +618,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
9163 |
+ struct ieee80211_sta_rates *sta_rates = rcu_dereference(sta->rates); |
9164 |
+ int i; |
9165 |
+ |
9166 |
++ if (!sta_rates) |
9167 |
++ return; |
9168 |
++ |
9169 |
+ spin_lock_bh(&dev->mt76.lock); |
9170 |
+ for (i = 0; i < ARRAY_SIZE(msta->rates); i++) { |
9171 |
+ msta->rates[i].idx = sta_rates->rate[i].idx; |
9172 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c |
9173 |
+index 88cdc2badeae7..defa207f53d6f 100644 |
9174 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c |
9175 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c |
9176 |
+@@ -673,6 +673,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw, |
9177 |
+ struct ieee80211_sta_rates *sta_rates = rcu_dereference(sta->rates); |
9178 |
+ int i; |
9179 |
+ |
9180 |
++ if (!sta_rates) |
9181 |
++ return; |
9182 |
++ |
9183 |
+ spin_lock_bh(&dev->mt76.lock); |
9184 |
+ for (i = 0; i < ARRAY_SIZE(msta->rates); i++) { |
9185 |
+ msta->rates[i].idx = sta_rates->rate[i].idx; |
9186 |
+diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c |
9187 |
+index 9a7f317a098fc..41054ee43dbfa 100644 |
9188 |
+--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c |
9189 |
++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c |
9190 |
+@@ -1259,8 +1259,11 @@ mt7915_mcu_wtbl_generic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, |
9191 |
+ generic = (struct wtbl_generic *)tlv; |
9192 |
+ |
9193 |
+ if (sta) { |
9194 |
++ if (vif->type == NL80211_IFTYPE_STATION) |
9195 |
++ generic->partial_aid = cpu_to_le16(vif->bss_conf.aid); |
9196 |
++ else |
9197 |
++ generic->partial_aid = cpu_to_le16(sta->aid); |
9198 |
+ memcpy(generic->peer_addr, sta->addr, ETH_ALEN); |
9199 |
+- generic->partial_aid = cpu_to_le16(sta->aid); |
9200 |
+ generic->muar_idx = mvif->omac_idx; |
9201 |
+ generic->qos = sta->wme; |
9202 |
+ } else { |
9203 |
+@@ -1314,12 +1317,15 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, |
9204 |
+ case NL80211_IFTYPE_MESH_POINT: |
9205 |
+ case NL80211_IFTYPE_AP: |
9206 |
+ basic->conn_type = cpu_to_le32(CONNECTION_INFRA_STA); |
9207 |
++ basic->aid = cpu_to_le16(sta->aid); |
9208 |
+ break; |
9209 |
+ case NL80211_IFTYPE_STATION: |
9210 |
+ basic->conn_type = cpu_to_le32(CONNECTION_INFRA_AP); |
9211 |
++ basic->aid = cpu_to_le16(vif->bss_conf.aid); |
9212 |
+ break; |
9213 |
+ case NL80211_IFTYPE_ADHOC: |
9214 |
+ basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC); |
9215 |
++ basic->aid = cpu_to_le16(sta->aid); |
9216 |
+ break; |
9217 |
+ default: |
9218 |
+ WARN_ON(1); |
9219 |
+@@ -1327,7 +1333,6 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, |
9220 |
+ } |
9221 |
+ |
9222 |
+ memcpy(basic->peer_addr, sta->addr, ETH_ALEN); |
9223 |
+- basic->aid = cpu_to_le16(sta->aid); |
9224 |
+ basic->qos = sta->wme; |
9225 |
+ } |
9226 |
+ |
9227 |
+diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c |
9228 |
+index bf3fbd14eda3c..091eea0d958d1 100644 |
9229 |
+--- a/drivers/net/wireless/ray_cs.c |
9230 |
++++ b/drivers/net/wireless/ray_cs.c |
9231 |
+@@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link) |
9232 |
+ goto failed; |
9233 |
+ local->sram = ioremap(link->resource[2]->start, |
9234 |
+ resource_size(link->resource[2])); |
9235 |
++ if (!local->sram) |
9236 |
++ goto failed; |
9237 |
+ |
9238 |
+ /*** Set up 16k window for shared memory (receive buffer) ***************/ |
9239 |
+ link->resource[3]->flags |= |
9240 |
+@@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link) |
9241 |
+ goto failed; |
9242 |
+ local->rmem = ioremap(link->resource[3]->start, |
9243 |
+ resource_size(link->resource[3])); |
9244 |
++ if (!local->rmem) |
9245 |
++ goto failed; |
9246 |
+ |
9247 |
+ /*** Set up window for attribute memory ***********************************/ |
9248 |
+ link->resource[4]->flags |= |
9249 |
+@@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link) |
9250 |
+ goto failed; |
9251 |
+ local->amem = ioremap(link->resource[4]->start, |
9252 |
+ resource_size(link->resource[4])); |
9253 |
++ if (!local->amem) |
9254 |
++ goto failed; |
9255 |
+ |
9256 |
+ dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
9257 |
+ dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
9258 |
+diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c |
9259 |
+index e05cc9f8a9fd1..1d72653b5c8d1 100644 |
9260 |
+--- a/drivers/nvdimm/region_devs.c |
9261 |
++++ b/drivers/nvdimm/region_devs.c |
9262 |
+@@ -1018,6 +1018,9 @@ static unsigned long default_align(struct nd_region *nd_region) |
9263 |
+ } |
9264 |
+ } |
9265 |
+ |
9266 |
++ if (nd_region->ndr_size < MEMREMAP_COMPAT_ALIGN_MAX) |
9267 |
++ align = PAGE_SIZE; |
9268 |
++ |
9269 |
+ mappings = max_t(u16, 1, nd_region->ndr_mappings); |
9270 |
+ div_u64_rem(align, mappings, &remainder); |
9271 |
+ if (remainder) |
9272 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
9273 |
+index 71c85c99e86c6..853b9a24f744e 100644 |
9274 |
+--- a/drivers/nvme/host/core.c |
9275 |
++++ b/drivers/nvme/host/core.c |
9276 |
+@@ -3681,16 +3681,15 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_subsystem *subsys, |
9277 |
+ return NULL; |
9278 |
+ } |
9279 |
+ |
9280 |
+-static int __nvme_check_ids(struct nvme_subsystem *subsys, |
9281 |
+- struct nvme_ns_head *new) |
9282 |
++static int nvme_subsys_check_duplicate_ids(struct nvme_subsystem *subsys, |
9283 |
++ struct nvme_ns_ids *ids) |
9284 |
+ { |
9285 |
+ struct nvme_ns_head *h; |
9286 |
+ |
9287 |
+ lockdep_assert_held(&subsys->lock); |
9288 |
+ |
9289 |
+ list_for_each_entry(h, &subsys->nsheads, entry) { |
9290 |
+- if (nvme_ns_ids_valid(&new->ids) && |
9291 |
+- nvme_ns_ids_equal(&new->ids, &h->ids)) |
9292 |
++ if (nvme_ns_ids_valid(ids) && nvme_ns_ids_equal(ids, &h->ids)) |
9293 |
+ return -EINVAL; |
9294 |
+ } |
9295 |
+ |
9296 |
+@@ -3724,7 +3723,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, |
9297 |
+ head->ids = *ids; |
9298 |
+ kref_init(&head->ref); |
9299 |
+ |
9300 |
+- ret = __nvme_check_ids(ctrl->subsys, head); |
9301 |
++ ret = nvme_subsys_check_duplicate_ids(ctrl->subsys, &head->ids); |
9302 |
+ if (ret) { |
9303 |
+ dev_err(ctrl->device, |
9304 |
+ "duplicate IDs for nsid %d\n", nsid); |
9305 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
9306 |
+index 6105894a218a5..7e39320337072 100644 |
9307 |
+--- a/drivers/nvme/host/tcp.c |
9308 |
++++ b/drivers/nvme/host/tcp.c |
9309 |
+@@ -30,6 +30,44 @@ static int so_priority; |
9310 |
+ module_param(so_priority, int, 0644); |
9311 |
+ MODULE_PARM_DESC(so_priority, "nvme tcp socket optimize priority"); |
9312 |
+ |
9313 |
++#ifdef CONFIG_DEBUG_LOCK_ALLOC |
9314 |
++/* lockdep can detect a circular dependency of the form |
9315 |
++ * sk_lock -> mmap_lock (page fault) -> fs locks -> sk_lock |
9316 |
++ * because dependencies are tracked for both nvme-tcp and user contexts. Using |
9317 |
++ * a separate class prevents lockdep from conflating nvme-tcp socket use with |
9318 |
++ * user-space socket API use. |
9319 |
++ */ |
9320 |
++static struct lock_class_key nvme_tcp_sk_key[2]; |
9321 |
++static struct lock_class_key nvme_tcp_slock_key[2]; |
9322 |
++ |
9323 |
++static void nvme_tcp_reclassify_socket(struct socket *sock) |
9324 |
++{ |
9325 |
++ struct sock *sk = sock->sk; |
9326 |
++ |
9327 |
++ if (WARN_ON_ONCE(!sock_allow_reclassification(sk))) |
9328 |
++ return; |
9329 |
++ |
9330 |
++ switch (sk->sk_family) { |
9331 |
++ case AF_INET: |
9332 |
++ sock_lock_init_class_and_name(sk, "slock-AF_INET-NVME", |
9333 |
++ &nvme_tcp_slock_key[0], |
9334 |
++ "sk_lock-AF_INET-NVME", |
9335 |
++ &nvme_tcp_sk_key[0]); |
9336 |
++ break; |
9337 |
++ case AF_INET6: |
9338 |
++ sock_lock_init_class_and_name(sk, "slock-AF_INET6-NVME", |
9339 |
++ &nvme_tcp_slock_key[1], |
9340 |
++ "sk_lock-AF_INET6-NVME", |
9341 |
++ &nvme_tcp_sk_key[1]); |
9342 |
++ break; |
9343 |
++ default: |
9344 |
++ WARN_ON_ONCE(1); |
9345 |
++ } |
9346 |
++} |
9347 |
++#else |
9348 |
++static void nvme_tcp_reclassify_socket(struct socket *sock) { } |
9349 |
++#endif |
9350 |
++ |
9351 |
+ enum nvme_tcp_send_state { |
9352 |
+ NVME_TCP_SEND_CMD_PDU = 0, |
9353 |
+ NVME_TCP_SEND_H2C_PDU, |
9354 |
+@@ -1422,6 +1460,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, |
9355 |
+ goto err_destroy_mutex; |
9356 |
+ } |
9357 |
+ |
9358 |
++ nvme_tcp_reclassify_socket(queue->sock); |
9359 |
++ |
9360 |
+ /* Single syn retry */ |
9361 |
+ tcp_sock_set_syncnt(queue->sock->sk, 1); |
9362 |
+ |
9363 |
+diff --git a/drivers/pci/access.c b/drivers/pci/access.c |
9364 |
+index 46935695cfb90..8d0d1f61c650d 100644 |
9365 |
+--- a/drivers/pci/access.c |
9366 |
++++ b/drivers/pci/access.c |
9367 |
+@@ -160,9 +160,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn, |
9368 |
+ * write happen to have any RW1C (write-one-to-clear) bits set, we |
9369 |
+ * just inadvertently cleared something we shouldn't have. |
9370 |
+ */ |
9371 |
+- dev_warn_ratelimited(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n", |
9372 |
+- size, pci_domain_nr(bus), bus->number, |
9373 |
+- PCI_SLOT(devfn), PCI_FUNC(devfn), where); |
9374 |
++ if (!bus->unsafe_warn) { |
9375 |
++ dev_warn(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n", |
9376 |
++ size, pci_domain_nr(bus), bus->number, |
9377 |
++ PCI_SLOT(devfn), PCI_FUNC(devfn), where); |
9378 |
++ bus->unsafe_warn = 1; |
9379 |
++ } |
9380 |
+ |
9381 |
+ mask = ~(((1 << (size * 8)) - 1) << ((where & 0x3) * 8)); |
9382 |
+ tmp = readl(addr) & mask; |
9383 |
+diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
9384 |
+index f30144c8c0bd2..49ff8bf10c740 100644 |
9385 |
+--- a/drivers/pci/controller/pci-aardvark.c |
9386 |
++++ b/drivers/pci/controller/pci-aardvark.c |
9387 |
+@@ -851,7 +851,9 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, |
9388 |
+ case PCI_EXP_RTSTA: { |
9389 |
+ u32 isr0 = advk_readl(pcie, PCIE_ISR0_REG); |
9390 |
+ u32 msglog = advk_readl(pcie, PCIE_MSG_LOG_REG); |
9391 |
+- *value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16 | (msglog >> 16); |
9392 |
++ *value = msglog >> 16; |
9393 |
++ if (isr0 & PCIE_MSG_PM_PME_MASK) |
9394 |
++ *value |= PCI_EXP_RTSTA_PME; |
9395 |
+ return PCI_BRIDGE_EMUL_HANDLED; |
9396 |
+ } |
9397 |
+ |
9398 |
+diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c |
9399 |
+index b651b6f444691..e1c2daa50b498 100644 |
9400 |
+--- a/drivers/pci/controller/pci-xgene.c |
9401 |
++++ b/drivers/pci/controller/pci-xgene.c |
9402 |
+@@ -467,7 +467,7 @@ static int xgene_pcie_select_ib_reg(u8 *ib_reg_mask, u64 size) |
9403 |
+ return 1; |
9404 |
+ } |
9405 |
+ |
9406 |
+- if ((size > SZ_1K) && (size < SZ_4G) && !(*ib_reg_mask & (1 << 0))) { |
9407 |
++ if ((size > SZ_1K) && (size < SZ_1T) && !(*ib_reg_mask & (1 << 0))) { |
9408 |
+ *ib_reg_mask |= (1 << 0); |
9409 |
+ return 0; |
9410 |
+ } |
9411 |
+@@ -481,28 +481,27 @@ static int xgene_pcie_select_ib_reg(u8 *ib_reg_mask, u64 size) |
9412 |
+ } |
9413 |
+ |
9414 |
+ static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port, |
9415 |
+- struct resource_entry *entry, |
9416 |
+- u8 *ib_reg_mask) |
9417 |
++ struct of_pci_range *range, u8 *ib_reg_mask) |
9418 |
+ { |
9419 |
+ void __iomem *cfg_base = port->cfg_base; |
9420 |
+ struct device *dev = port->dev; |
9421 |
+ void *bar_addr; |
9422 |
+ u32 pim_reg; |
9423 |
+- u64 cpu_addr = entry->res->start; |
9424 |
+- u64 pci_addr = cpu_addr - entry->offset; |
9425 |
+- u64 size = resource_size(entry->res); |
9426 |
++ u64 cpu_addr = range->cpu_addr; |
9427 |
++ u64 pci_addr = range->pci_addr; |
9428 |
++ u64 size = range->size; |
9429 |
+ u64 mask = ~(size - 1) | EN_REG; |
9430 |
+ u32 flags = PCI_BASE_ADDRESS_MEM_TYPE_64; |
9431 |
+ u32 bar_low; |
9432 |
+ int region; |
9433 |
+ |
9434 |
+- region = xgene_pcie_select_ib_reg(ib_reg_mask, size); |
9435 |
++ region = xgene_pcie_select_ib_reg(ib_reg_mask, range->size); |
9436 |
+ if (region < 0) { |
9437 |
+ dev_warn(dev, "invalid pcie dma-range config\n"); |
9438 |
+ return; |
9439 |
+ } |
9440 |
+ |
9441 |
+- if (entry->res->flags & IORESOURCE_PREFETCH) |
9442 |
++ if (range->flags & IORESOURCE_PREFETCH) |
9443 |
+ flags |= PCI_BASE_ADDRESS_MEM_PREFETCH; |
9444 |
+ |
9445 |
+ bar_low = pcie_bar_low_val((u32)cpu_addr, flags); |
9446 |
+@@ -533,13 +532,25 @@ static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port, |
9447 |
+ |
9448 |
+ static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port) |
9449 |
+ { |
9450 |
+- struct pci_host_bridge *bridge = pci_host_bridge_from_priv(port); |
9451 |
+- struct resource_entry *entry; |
9452 |
++ struct device_node *np = port->node; |
9453 |
++ struct of_pci_range range; |
9454 |
++ struct of_pci_range_parser parser; |
9455 |
++ struct device *dev = port->dev; |
9456 |
+ u8 ib_reg_mask = 0; |
9457 |
+ |
9458 |
+- resource_list_for_each_entry(entry, &bridge->dma_ranges) |
9459 |
+- xgene_pcie_setup_ib_reg(port, entry, &ib_reg_mask); |
9460 |
++ if (of_pci_dma_range_parser_init(&parser, np)) { |
9461 |
++ dev_err(dev, "missing dma-ranges property\n"); |
9462 |
++ return -EINVAL; |
9463 |
++ } |
9464 |
++ |
9465 |
++ /* Get the dma-ranges from DT */ |
9466 |
++ for_each_of_pci_range(&parser, &range) { |
9467 |
++ u64 end = range.cpu_addr + range.size - 1; |
9468 |
+ |
9469 |
++ dev_dbg(dev, "0x%08x 0x%016llx..0x%016llx -> 0x%016llx\n", |
9470 |
++ range.flags, range.cpu_addr, end, range.pci_addr); |
9471 |
++ xgene_pcie_setup_ib_reg(port, &range, &ib_reg_mask); |
9472 |
++ } |
9473 |
+ return 0; |
9474 |
+ } |
9475 |
+ |
9476 |
+diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c |
9477 |
+index 30708af975adc..af4c4cc837fcd 100644 |
9478 |
+--- a/drivers/pci/hotplug/pciehp_hpc.c |
9479 |
++++ b/drivers/pci/hotplug/pciehp_hpc.c |
9480 |
+@@ -98,6 +98,8 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout) |
9481 |
+ if (slot_status & PCI_EXP_SLTSTA_CC) { |
9482 |
+ pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, |
9483 |
+ PCI_EXP_SLTSTA_CC); |
9484 |
++ ctrl->cmd_busy = 0; |
9485 |
++ smp_mb(); |
9486 |
+ return 1; |
9487 |
+ } |
9488 |
+ msleep(10); |
9489 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
9490 |
+index 95fcc735c88e7..1be2894ada70c 100644 |
9491 |
+--- a/drivers/pci/quirks.c |
9492 |
++++ b/drivers/pci/quirks.c |
9493 |
+@@ -1816,6 +1816,18 @@ static void quirk_alder_ioapic(struct pci_dev *pdev) |
9494 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); |
9495 |
+ #endif |
9496 |
+ |
9497 |
++static void quirk_no_msi(struct pci_dev *dev) |
9498 |
++{ |
9499 |
++ pci_info(dev, "avoiding MSI to work around a hardware defect\n"); |
9500 |
++ dev->no_msi = 1; |
9501 |
++} |
9502 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4386, quirk_no_msi); |
9503 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4387, quirk_no_msi); |
9504 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4388, quirk_no_msi); |
9505 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4389, quirk_no_msi); |
9506 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x438a, quirk_no_msi); |
9507 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x438b, quirk_no_msi); |
9508 |
++ |
9509 |
+ static void quirk_pcie_mch(struct pci_dev *pdev) |
9510 |
+ { |
9511 |
+ pdev->no_msi = 1; |
9512 |
+diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c |
9513 |
+index 14e0551cd3190..0aa740b73d0db 100644 |
9514 |
+--- a/drivers/phy/phy-core-mipi-dphy.c |
9515 |
++++ b/drivers/phy/phy-core-mipi-dphy.c |
9516 |
+@@ -66,10 +66,10 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, |
9517 |
+ cfg->hs_trail = max(4 * 8 * ui, 60000 + 4 * 4 * ui); |
9518 |
+ |
9519 |
+ cfg->init = 100; |
9520 |
+- cfg->lpx = 60000; |
9521 |
++ cfg->lpx = 50000; |
9522 |
+ cfg->ta_get = 5 * cfg->lpx; |
9523 |
+ cfg->ta_go = 4 * cfg->lpx; |
9524 |
+- cfg->ta_sure = 2 * cfg->lpx; |
9525 |
++ cfg->ta_sure = cfg->lpx; |
9526 |
+ cfg->wakeup = 1000; |
9527 |
+ |
9528 |
+ cfg->hs_clk_rate = hs_clk_rate; |
9529 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
9530 |
+index a02ad10ec6fad..730581d130649 100644 |
9531 |
+--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
9532 |
++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
9533 |
+@@ -1039,6 +1039,7 @@ int mtk_pctrl_init(struct platform_device *pdev, |
9534 |
+ node = of_parse_phandle(np, "mediatek,pctl-regmap", 0); |
9535 |
+ if (node) { |
9536 |
+ pctl->regmap1 = syscon_node_to_regmap(node); |
9537 |
++ of_node_put(node); |
9538 |
+ if (IS_ERR(pctl->regmap1)) |
9539 |
+ return PTR_ERR(pctl->regmap1); |
9540 |
+ } else if (regmap) { |
9541 |
+@@ -1052,6 +1053,7 @@ int mtk_pctrl_init(struct platform_device *pdev, |
9542 |
+ node = of_parse_phandle(np, "mediatek,pctl-regmap", 1); |
9543 |
+ if (node) { |
9544 |
+ pctl->regmap2 = syscon_node_to_regmap(node); |
9545 |
++ of_node_put(node); |
9546 |
+ if (IS_ERR(pctl->regmap2)) |
9547 |
+ return PTR_ERR(pctl->regmap2); |
9548 |
+ } |
9549 |
+diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c |
9550 |
+index 623af4410b07c..d0a4ebbe1e7e6 100644 |
9551 |
+--- a/drivers/pinctrl/mediatek/pinctrl-paris.c |
9552 |
++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c |
9553 |
+@@ -96,20 +96,16 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev, |
9554 |
+ err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret); |
9555 |
+ if (err) |
9556 |
+ goto out; |
9557 |
++ if (ret == MTK_PUPD_SET_R1R0_00) |
9558 |
++ ret = MTK_DISABLE; |
9559 |
+ if (param == PIN_CONFIG_BIAS_DISABLE) { |
9560 |
+- if (ret == MTK_PUPD_SET_R1R0_00) |
9561 |
+- ret = MTK_DISABLE; |
9562 |
++ if (ret != MTK_DISABLE) |
9563 |
++ err = -EINVAL; |
9564 |
+ } else if (param == PIN_CONFIG_BIAS_PULL_UP) { |
9565 |
+- /* When desire to get pull-up value, return |
9566 |
+- * error if current setting is pull-down |
9567 |
+- */ |
9568 |
+- if (!pullup) |
9569 |
++ if (!pullup || ret == MTK_DISABLE) |
9570 |
+ err = -EINVAL; |
9571 |
+ } else if (param == PIN_CONFIG_BIAS_PULL_DOWN) { |
9572 |
+- /* When desire to get pull-down value, return |
9573 |
+- * error if current setting is pull-up |
9574 |
+- */ |
9575 |
+- if (pullup) |
9576 |
++ if (pullup || ret == MTK_DISABLE) |
9577 |
+ err = -EINVAL; |
9578 |
+ } |
9579 |
+ } else { |
9580 |
+@@ -188,8 +184,7 @@ out: |
9581 |
+ } |
9582 |
+ |
9583 |
+ static int mtk_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, |
9584 |
+- enum pin_config_param param, |
9585 |
+- enum pin_config_param arg) |
9586 |
++ enum pin_config_param param, u32 arg) |
9587 |
+ { |
9588 |
+ struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); |
9589 |
+ const struct mtk_pin_desc *desc; |
9590 |
+@@ -585,6 +580,9 @@ ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, |
9591 |
+ if (gpio >= hw->soc->npins) |
9592 |
+ return -EINVAL; |
9593 |
+ |
9594 |
++ if (mtk_is_virt_gpio(hw, gpio)) |
9595 |
++ return -EINVAL; |
9596 |
++ |
9597 |
+ desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; |
9598 |
+ pinmux = mtk_pctrl_get_pinmux(hw, gpio); |
9599 |
+ if (pinmux >= hw->soc->nfuncs) |
9600 |
+@@ -719,10 +717,10 @@ static int mtk_pconf_group_get(struct pinctrl_dev *pctldev, unsigned group, |
9601 |
+ unsigned long *config) |
9602 |
+ { |
9603 |
+ struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); |
9604 |
++ struct mtk_pinctrl_group *grp = &hw->groups[group]; |
9605 |
+ |
9606 |
+- *config = hw->groups[group].config; |
9607 |
+- |
9608 |
+- return 0; |
9609 |
++ /* One pin per group only */ |
9610 |
++ return mtk_pinconf_get(pctldev, grp->pin, config); |
9611 |
+ } |
9612 |
+ |
9613 |
+ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group, |
9614 |
+@@ -738,8 +736,6 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group, |
9615 |
+ pinconf_to_config_argument(configs[i])); |
9616 |
+ if (ret < 0) |
9617 |
+ return ret; |
9618 |
+- |
9619 |
+- grp->config = configs[i]; |
9620 |
+ } |
9621 |
+ |
9622 |
+ return 0; |
9623 |
+diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
9624 |
+index 657e35a75d84a..6d77feda9090a 100644 |
9625 |
+--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
9626 |
++++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
9627 |
+@@ -1883,8 +1883,10 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) |
9628 |
+ } |
9629 |
+ |
9630 |
+ prcm_np = of_parse_phandle(np, "prcm", 0); |
9631 |
+- if (prcm_np) |
9632 |
++ if (prcm_np) { |
9633 |
+ npct->prcm_base = of_iomap(prcm_np, 0); |
9634 |
++ of_node_put(prcm_np); |
9635 |
++ } |
9636 |
+ if (!npct->prcm_base) { |
9637 |
+ if (version == PINCTRL_NMK_STN8815) { |
9638 |
+ dev_info(&pdev->dev, |
9639 |
+diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
9640 |
+index 6de31b5ee358c..ce36b6ff7b95e 100644 |
9641 |
+--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
9642 |
++++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
9643 |
+@@ -78,7 +78,6 @@ struct npcm7xx_gpio { |
9644 |
+ struct gpio_chip gc; |
9645 |
+ int irqbase; |
9646 |
+ int irq; |
9647 |
+- void *priv; |
9648 |
+ struct irq_chip irq_chip; |
9649 |
+ u32 pinctrl_id; |
9650 |
+ int (*direction_input)(struct gpio_chip *chip, unsigned offset); |
9651 |
+@@ -226,7 +225,7 @@ static void npcmgpio_irq_handler(struct irq_desc *desc) |
9652 |
+ chained_irq_enter(chip, desc); |
9653 |
+ sts = ioread32(bank->base + NPCM7XX_GP_N_EVST); |
9654 |
+ en = ioread32(bank->base + NPCM7XX_GP_N_EVEN); |
9655 |
+- dev_dbg(chip->parent_device, "==> got irq sts %.8x %.8x\n", sts, |
9656 |
++ dev_dbg(bank->gc.parent, "==> got irq sts %.8x %.8x\n", sts, |
9657 |
+ en); |
9658 |
+ |
9659 |
+ sts &= en; |
9660 |
+@@ -241,33 +240,33 @@ static int npcmgpio_set_irq_type(struct irq_data *d, unsigned int type) |
9661 |
+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
9662 |
+ unsigned int gpio = BIT(d->hwirq); |
9663 |
+ |
9664 |
+- dev_dbg(d->chip->parent_device, "setirqtype: %u.%u = %u\n", gpio, |
9665 |
++ dev_dbg(bank->gc.parent, "setirqtype: %u.%u = %u\n", gpio, |
9666 |
+ d->irq, type); |
9667 |
+ switch (type) { |
9668 |
+ case IRQ_TYPE_EDGE_RISING: |
9669 |
+- dev_dbg(d->chip->parent_device, "edge.rising\n"); |
9670 |
++ dev_dbg(bank->gc.parent, "edge.rising\n"); |
9671 |
+ npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio); |
9672 |
+ npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
9673 |
+ break; |
9674 |
+ case IRQ_TYPE_EDGE_FALLING: |
9675 |
+- dev_dbg(d->chip->parent_device, "edge.falling\n"); |
9676 |
++ dev_dbg(bank->gc.parent, "edge.falling\n"); |
9677 |
+ npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio); |
9678 |
+ npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
9679 |
+ break; |
9680 |
+ case IRQ_TYPE_EDGE_BOTH: |
9681 |
+- dev_dbg(d->chip->parent_device, "edge.both\n"); |
9682 |
++ dev_dbg(bank->gc.parent, "edge.both\n"); |
9683 |
+ npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio); |
9684 |
+ break; |
9685 |
+ case IRQ_TYPE_LEVEL_LOW: |
9686 |
+- dev_dbg(d->chip->parent_device, "level.low\n"); |
9687 |
++ dev_dbg(bank->gc.parent, "level.low\n"); |
9688 |
+ npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
9689 |
+ break; |
9690 |
+ case IRQ_TYPE_LEVEL_HIGH: |
9691 |
+- dev_dbg(d->chip->parent_device, "level.high\n"); |
9692 |
++ dev_dbg(bank->gc.parent, "level.high\n"); |
9693 |
+ npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
9694 |
+ break; |
9695 |
+ default: |
9696 |
+- dev_dbg(d->chip->parent_device, "invalid irq type\n"); |
9697 |
++ dev_dbg(bank->gc.parent, "invalid irq type\n"); |
9698 |
+ return -EINVAL; |
9699 |
+ } |
9700 |
+ |
9701 |
+@@ -289,7 +288,7 @@ static void npcmgpio_irq_ack(struct irq_data *d) |
9702 |
+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
9703 |
+ unsigned int gpio = d->hwirq; |
9704 |
+ |
9705 |
+- dev_dbg(d->chip->parent_device, "irq_ack: %u.%u\n", gpio, d->irq); |
9706 |
++ dev_dbg(bank->gc.parent, "irq_ack: %u.%u\n", gpio, d->irq); |
9707 |
+ iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVST); |
9708 |
+ } |
9709 |
+ |
9710 |
+@@ -301,7 +300,7 @@ static void npcmgpio_irq_mask(struct irq_data *d) |
9711 |
+ unsigned int gpio = d->hwirq; |
9712 |
+ |
9713 |
+ /* Clear events */ |
9714 |
+- dev_dbg(d->chip->parent_device, "irq_mask: %u.%u\n", gpio, d->irq); |
9715 |
++ dev_dbg(bank->gc.parent, "irq_mask: %u.%u\n", gpio, d->irq); |
9716 |
+ iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVENC); |
9717 |
+ } |
9718 |
+ |
9719 |
+@@ -313,7 +312,7 @@ static void npcmgpio_irq_unmask(struct irq_data *d) |
9720 |
+ unsigned int gpio = d->hwirq; |
9721 |
+ |
9722 |
+ /* Enable events */ |
9723 |
+- dev_dbg(d->chip->parent_device, "irq_unmask: %u.%u\n", gpio, d->irq); |
9724 |
++ dev_dbg(bank->gc.parent, "irq_unmask: %u.%u\n", gpio, d->irq); |
9725 |
+ iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVENS); |
9726 |
+ } |
9727 |
+ |
9728 |
+@@ -323,7 +322,7 @@ static unsigned int npcmgpio_irq_startup(struct irq_data *d) |
9729 |
+ unsigned int gpio = d->hwirq; |
9730 |
+ |
9731 |
+ /* active-high, input, clear interrupt, enable interrupt */ |
9732 |
+- dev_dbg(d->chip->parent_device, "startup: %u.%u\n", gpio, d->irq); |
9733 |
++ dev_dbg(gc->parent, "startup: %u.%u\n", gpio, d->irq); |
9734 |
+ npcmgpio_direction_input(gc, gpio); |
9735 |
+ npcmgpio_irq_ack(d); |
9736 |
+ npcmgpio_irq_unmask(d); |
9737 |
+@@ -905,7 +904,7 @@ static struct npcm7xx_func npcm7xx_funcs[] = { |
9738 |
+ #define DRIVE_STRENGTH_HI_SHIFT 12 |
9739 |
+ #define DRIVE_STRENGTH_MASK 0x0000FF00 |
9740 |
+ |
9741 |
+-#define DS(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \ |
9742 |
++#define DSTR(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \ |
9743 |
+ ((hi) << DRIVE_STRENGTH_HI_SHIFT)) |
9744 |
+ #define DSLO(x) (((x) >> DRIVE_STRENGTH_LO_SHIFT) & 0xF) |
9745 |
+ #define DSHI(x) (((x) >> DRIVE_STRENGTH_HI_SHIFT) & 0xF) |
9746 |
+@@ -925,31 +924,31 @@ struct npcm7xx_pincfg { |
9747 |
+ static const struct npcm7xx_pincfg pincfg[] = { |
9748 |
+ /* PIN FUNCTION 1 FUNCTION 2 FUNCTION 3 FLAGS */ |
9749 |
+ NPCM7XX_PINCFG(0, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, 0), |
9750 |
+- NPCM7XX_PINCFG(1, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9751 |
+- NPCM7XX_PINCFG(2, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9752 |
++ NPCM7XX_PINCFG(1, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9753 |
++ NPCM7XX_PINCFG(2, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9754 |
+ NPCM7XX_PINCFG(3, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, 0), |
9755 |
+ NPCM7XX_PINCFG(4, iox2, MFSEL3, 14, smb1d, I2CSEGSEL, 7, none, NONE, 0, SLEW), |
9756 |
+ NPCM7XX_PINCFG(5, iox2, MFSEL3, 14, smb1d, I2CSEGSEL, 7, none, NONE, 0, SLEW), |
9757 |
+ NPCM7XX_PINCFG(6, iox2, MFSEL3, 14, smb2d, I2CSEGSEL, 10, none, NONE, 0, SLEW), |
9758 |
+ NPCM7XX_PINCFG(7, iox2, MFSEL3, 14, smb2d, I2CSEGSEL, 10, none, NONE, 0, SLEW), |
9759 |
+- NPCM7XX_PINCFG(8, lkgpo1, FLOCKR1, 4, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9760 |
+- NPCM7XX_PINCFG(9, lkgpo2, FLOCKR1, 8, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9761 |
+- NPCM7XX_PINCFG(10, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9762 |
+- NPCM7XX_PINCFG(11, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9763 |
++ NPCM7XX_PINCFG(8, lkgpo1, FLOCKR1, 4, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9764 |
++ NPCM7XX_PINCFG(9, lkgpo2, FLOCKR1, 8, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9765 |
++ NPCM7XX_PINCFG(10, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9766 |
++ NPCM7XX_PINCFG(11, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9767 |
+ NPCM7XX_PINCFG(12, gspi, MFSEL1, 24, smb5b, I2CSEGSEL, 19, none, NONE, 0, SLEW), |
9768 |
+ NPCM7XX_PINCFG(13, gspi, MFSEL1, 24, smb5b, I2CSEGSEL, 19, none, NONE, 0, SLEW), |
9769 |
+ NPCM7XX_PINCFG(14, gspi, MFSEL1, 24, smb5c, I2CSEGSEL, 20, none, NONE, 0, SLEW), |
9770 |
+ NPCM7XX_PINCFG(15, gspi, MFSEL1, 24, smb5c, I2CSEGSEL, 20, none, NONE, 0, SLEW), |
9771 |
+- NPCM7XX_PINCFG(16, lkgpo0, FLOCKR1, 0, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9772 |
+- NPCM7XX_PINCFG(17, pspi2, MFSEL3, 13, smb4den, I2CSEGSEL, 23, none, NONE, 0, DS(8, 12)), |
9773 |
+- NPCM7XX_PINCFG(18, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DS(8, 12)), |
9774 |
+- NPCM7XX_PINCFG(19, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DS(8, 12)), |
9775 |
++ NPCM7XX_PINCFG(16, lkgpo0, FLOCKR1, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9776 |
++ NPCM7XX_PINCFG(17, pspi2, MFSEL3, 13, smb4den, I2CSEGSEL, 23, none, NONE, 0, DSTR(8, 12)), |
9777 |
++ NPCM7XX_PINCFG(18, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DSTR(8, 12)), |
9778 |
++ NPCM7XX_PINCFG(19, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DSTR(8, 12)), |
9779 |
+ NPCM7XX_PINCFG(20, smb4c, I2CSEGSEL, 15, smb15, MFSEL3, 8, none, NONE, 0, 0), |
9780 |
+ NPCM7XX_PINCFG(21, smb4c, I2CSEGSEL, 15, smb15, MFSEL3, 8, none, NONE, 0, 0), |
9781 |
+ NPCM7XX_PINCFG(22, smb4d, I2CSEGSEL, 16, smb14, MFSEL3, 7, none, NONE, 0, 0), |
9782 |
+ NPCM7XX_PINCFG(23, smb4d, I2CSEGSEL, 16, smb14, MFSEL3, 7, none, NONE, 0, 0), |
9783 |
+- NPCM7XX_PINCFG(24, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9784 |
+- NPCM7XX_PINCFG(25, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9785 |
++ NPCM7XX_PINCFG(24, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9786 |
++ NPCM7XX_PINCFG(25, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9787 |
+ NPCM7XX_PINCFG(26, smb5, MFSEL1, 2, none, NONE, 0, none, NONE, 0, 0), |
9788 |
+ NPCM7XX_PINCFG(27, smb5, MFSEL1, 2, none, NONE, 0, none, NONE, 0, 0), |
9789 |
+ NPCM7XX_PINCFG(28, smb4, MFSEL1, 1, none, NONE, 0, none, NONE, 0, 0), |
9790 |
+@@ -965,12 +964,12 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9791 |
+ NPCM7XX_PINCFG(39, smb3b, I2CSEGSEL, 11, none, NONE, 0, none, NONE, 0, SLEW), |
9792 |
+ NPCM7XX_PINCFG(40, smb3b, I2CSEGSEL, 11, none, NONE, 0, none, NONE, 0, SLEW), |
9793 |
+ NPCM7XX_PINCFG(41, bmcuart0a, MFSEL1, 9, none, NONE, 0, none, NONE, 0, 0), |
9794 |
+- NPCM7XX_PINCFG(42, bmcuart0a, MFSEL1, 9, none, NONE, 0, none, NONE, 0, DS(2, 4) | GPO), |
9795 |
++ NPCM7XX_PINCFG(42, bmcuart0a, MFSEL1, 9, none, NONE, 0, none, NONE, 0, DSTR(2, 4) | GPO), |
9796 |
+ NPCM7XX_PINCFG(43, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, bmcuart1, MFSEL3, 24, 0), |
9797 |
+ NPCM7XX_PINCFG(44, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, bmcuart1, MFSEL3, 24, 0), |
9798 |
+ NPCM7XX_PINCFG(45, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, 0), |
9799 |
+- NPCM7XX_PINCFG(46, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DS(2, 8)), |
9800 |
+- NPCM7XX_PINCFG(47, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DS(2, 8)), |
9801 |
++ NPCM7XX_PINCFG(46, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DSTR(2, 8)), |
9802 |
++ NPCM7XX_PINCFG(47, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DSTR(2, 8)), |
9803 |
+ NPCM7XX_PINCFG(48, uart2, MFSEL1, 11, bmcuart0b, MFSEL4, 1, none, NONE, 0, GPO), |
9804 |
+ NPCM7XX_PINCFG(49, uart2, MFSEL1, 11, bmcuart0b, MFSEL4, 1, none, NONE, 0, 0), |
9805 |
+ NPCM7XX_PINCFG(50, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0), |
9806 |
+@@ -980,8 +979,8 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9807 |
+ NPCM7XX_PINCFG(54, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0), |
9808 |
+ NPCM7XX_PINCFG(55, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0), |
9809 |
+ NPCM7XX_PINCFG(56, r1err, MFSEL1, 12, none, NONE, 0, none, NONE, 0, 0), |
9810 |
+- NPCM7XX_PINCFG(57, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
9811 |
+- NPCM7XX_PINCFG(58, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
9812 |
++ NPCM7XX_PINCFG(57, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
9813 |
++ NPCM7XX_PINCFG(58, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
9814 |
+ NPCM7XX_PINCFG(59, smb3d, I2CSEGSEL, 13, none, NONE, 0, none, NONE, 0, 0), |
9815 |
+ NPCM7XX_PINCFG(60, smb3d, I2CSEGSEL, 13, none, NONE, 0, none, NONE, 0, 0), |
9816 |
+ NPCM7XX_PINCFG(61, uart1, MFSEL1, 10, none, NONE, 0, none, NONE, 0, GPO), |
9817 |
+@@ -1004,19 +1003,19 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9818 |
+ NPCM7XX_PINCFG(77, fanin13, MFSEL2, 13, none, NONE, 0, none, NONE, 0, 0), |
9819 |
+ NPCM7XX_PINCFG(78, fanin14, MFSEL2, 14, none, NONE, 0, none, NONE, 0, 0), |
9820 |
+ NPCM7XX_PINCFG(79, fanin15, MFSEL2, 15, none, NONE, 0, none, NONE, 0, 0), |
9821 |
+- NPCM7XX_PINCFG(80, pwm0, MFSEL2, 16, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9822 |
+- NPCM7XX_PINCFG(81, pwm1, MFSEL2, 17, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9823 |
+- NPCM7XX_PINCFG(82, pwm2, MFSEL2, 18, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9824 |
+- NPCM7XX_PINCFG(83, pwm3, MFSEL2, 19, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9825 |
+- NPCM7XX_PINCFG(84, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9826 |
+- NPCM7XX_PINCFG(85, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9827 |
+- NPCM7XX_PINCFG(86, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9828 |
++ NPCM7XX_PINCFG(80, pwm0, MFSEL2, 16, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9829 |
++ NPCM7XX_PINCFG(81, pwm1, MFSEL2, 17, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9830 |
++ NPCM7XX_PINCFG(82, pwm2, MFSEL2, 18, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9831 |
++ NPCM7XX_PINCFG(83, pwm3, MFSEL2, 19, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9832 |
++ NPCM7XX_PINCFG(84, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9833 |
++ NPCM7XX_PINCFG(85, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9834 |
++ NPCM7XX_PINCFG(86, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9835 |
+ NPCM7XX_PINCFG(87, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
9836 |
+ NPCM7XX_PINCFG(88, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
9837 |
+ NPCM7XX_PINCFG(89, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
9838 |
+ NPCM7XX_PINCFG(90, r2err, MFSEL1, 15, none, NONE, 0, none, NONE, 0, 0), |
9839 |
+- NPCM7XX_PINCFG(91, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
9840 |
+- NPCM7XX_PINCFG(92, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
9841 |
++ NPCM7XX_PINCFG(91, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
9842 |
++ NPCM7XX_PINCFG(92, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
9843 |
+ NPCM7XX_PINCFG(93, ga20kbc, MFSEL1, 17, smb5d, I2CSEGSEL, 21, none, NONE, 0, 0), |
9844 |
+ NPCM7XX_PINCFG(94, ga20kbc, MFSEL1, 17, smb5d, I2CSEGSEL, 21, none, NONE, 0, 0), |
9845 |
+ NPCM7XX_PINCFG(95, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, 0), |
9846 |
+@@ -1062,34 +1061,34 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9847 |
+ NPCM7XX_PINCFG(133, smb10, MFSEL4, 13, none, NONE, 0, none, NONE, 0, 0), |
9848 |
+ NPCM7XX_PINCFG(134, smb11, MFSEL4, 14, none, NONE, 0, none, NONE, 0, 0), |
9849 |
+ NPCM7XX_PINCFG(135, smb11, MFSEL4, 14, none, NONE, 0, none, NONE, 0, 0), |
9850 |
+- NPCM7XX_PINCFG(136, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9851 |
+- NPCM7XX_PINCFG(137, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9852 |
+- NPCM7XX_PINCFG(138, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9853 |
+- NPCM7XX_PINCFG(139, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9854 |
+- NPCM7XX_PINCFG(140, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9855 |
++ NPCM7XX_PINCFG(136, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9856 |
++ NPCM7XX_PINCFG(137, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9857 |
++ NPCM7XX_PINCFG(138, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9858 |
++ NPCM7XX_PINCFG(139, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9859 |
++ NPCM7XX_PINCFG(140, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9860 |
+ NPCM7XX_PINCFG(141, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, 0), |
9861 |
+- NPCM7XX_PINCFG(142, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9862 |
++ NPCM7XX_PINCFG(142, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9863 |
+ NPCM7XX_PINCFG(143, sd1, MFSEL3, 12, sd1pwr, MFSEL4, 5, none, NONE, 0, 0), |
9864 |
+- NPCM7XX_PINCFG(144, pwm4, MFSEL2, 20, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9865 |
+- NPCM7XX_PINCFG(145, pwm5, MFSEL2, 21, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9866 |
+- NPCM7XX_PINCFG(146, pwm6, MFSEL2, 22, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9867 |
+- NPCM7XX_PINCFG(147, pwm7, MFSEL2, 23, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9868 |
+- NPCM7XX_PINCFG(148, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9869 |
+- NPCM7XX_PINCFG(149, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9870 |
+- NPCM7XX_PINCFG(150, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9871 |
+- NPCM7XX_PINCFG(151, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9872 |
+- NPCM7XX_PINCFG(152, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9873 |
++ NPCM7XX_PINCFG(144, pwm4, MFSEL2, 20, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9874 |
++ NPCM7XX_PINCFG(145, pwm5, MFSEL2, 21, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9875 |
++ NPCM7XX_PINCFG(146, pwm6, MFSEL2, 22, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9876 |
++ NPCM7XX_PINCFG(147, pwm7, MFSEL2, 23, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9877 |
++ NPCM7XX_PINCFG(148, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9878 |
++ NPCM7XX_PINCFG(149, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9879 |
++ NPCM7XX_PINCFG(150, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9880 |
++ NPCM7XX_PINCFG(151, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9881 |
++ NPCM7XX_PINCFG(152, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9882 |
+ NPCM7XX_PINCFG(153, mmcwp, FLOCKR1, 24, none, NONE, 0, none, NONE, 0, 0), /* Z1/A1 */ |
9883 |
+- NPCM7XX_PINCFG(154, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9884 |
++ NPCM7XX_PINCFG(154, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9885 |
+ NPCM7XX_PINCFG(155, mmccd, MFSEL3, 25, mmcrst, MFSEL4, 6, none, NONE, 0, 0), /* Z1/A1 */ |
9886 |
+- NPCM7XX_PINCFG(156, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9887 |
+- NPCM7XX_PINCFG(157, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9888 |
+- NPCM7XX_PINCFG(158, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9889 |
+- NPCM7XX_PINCFG(159, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9890 |
+- |
9891 |
+- NPCM7XX_PINCFG(160, clkout, MFSEL1, 21, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9892 |
+- NPCM7XX_PINCFG(161, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, DS(8, 12)), |
9893 |
+- NPCM7XX_PINCFG(162, serirq, NONE, 0, gpio, MFSEL1, 31, none, NONE, 0, DS(8, 12)), |
9894 |
++ NPCM7XX_PINCFG(156, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9895 |
++ NPCM7XX_PINCFG(157, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9896 |
++ NPCM7XX_PINCFG(158, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9897 |
++ NPCM7XX_PINCFG(159, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9898 |
++ |
9899 |
++ NPCM7XX_PINCFG(160, clkout, MFSEL1, 21, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9900 |
++ NPCM7XX_PINCFG(161, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, DSTR(8, 12)), |
9901 |
++ NPCM7XX_PINCFG(162, serirq, NONE, 0, gpio, MFSEL1, 31, none, NONE, 0, DSTR(8, 12)), |
9902 |
+ NPCM7XX_PINCFG(163, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, 0), |
9903 |
+ NPCM7XX_PINCFG(164, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, SLEWLPC), |
9904 |
+ NPCM7XX_PINCFG(165, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, SLEWLPC), |
9905 |
+@@ -1102,25 +1101,25 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9906 |
+ NPCM7XX_PINCFG(172, smb6, MFSEL3, 1, none, NONE, 0, none, NONE, 0, 0), |
9907 |
+ NPCM7XX_PINCFG(173, smb7, MFSEL3, 2, none, NONE, 0, none, NONE, 0, 0), |
9908 |
+ NPCM7XX_PINCFG(174, smb7, MFSEL3, 2, none, NONE, 0, none, NONE, 0, 0), |
9909 |
+- NPCM7XX_PINCFG(175, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DS(8, 12)), |
9910 |
+- NPCM7XX_PINCFG(176, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DS(8, 12)), |
9911 |
+- NPCM7XX_PINCFG(177, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DS(8, 12)), |
9912 |
+- NPCM7XX_PINCFG(178, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9913 |
+- NPCM7XX_PINCFG(179, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9914 |
+- NPCM7XX_PINCFG(180, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9915 |
++ NPCM7XX_PINCFG(175, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DSTR(8, 12)), |
9916 |
++ NPCM7XX_PINCFG(176, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DSTR(8, 12)), |
9917 |
++ NPCM7XX_PINCFG(177, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DSTR(8, 12)), |
9918 |
++ NPCM7XX_PINCFG(178, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9919 |
++ NPCM7XX_PINCFG(179, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9920 |
++ NPCM7XX_PINCFG(180, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9921 |
+ NPCM7XX_PINCFG(181, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
9922 |
+ NPCM7XX_PINCFG(182, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
9923 |
+- NPCM7XX_PINCFG(183, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9924 |
+- NPCM7XX_PINCFG(184, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
9925 |
+- NPCM7XX_PINCFG(185, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
9926 |
+- NPCM7XX_PINCFG(186, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9927 |
+- NPCM7XX_PINCFG(187, spi3cs1, MFSEL4, 17, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9928 |
+- NPCM7XX_PINCFG(188, spi3quad, MFSEL4, 20, spi3cs2, MFSEL4, 18, none, NONE, 0, DS(8, 12) | SLEW), |
9929 |
+- NPCM7XX_PINCFG(189, spi3quad, MFSEL4, 20, spi3cs3, MFSEL4, 19, none, NONE, 0, DS(8, 12) | SLEW), |
9930 |
+- NPCM7XX_PINCFG(190, gpio, FLOCKR1, 20, nprd_smi, NONE, 0, none, NONE, 0, DS(2, 4)), |
9931 |
+- NPCM7XX_PINCFG(191, none, NONE, 0, none, NONE, 0, none, NONE, 0, DS(8, 12)), /* XX */ |
9932 |
+- |
9933 |
+- NPCM7XX_PINCFG(192, none, NONE, 0, none, NONE, 0, none, NONE, 0, DS(8, 12)), /* XX */ |
9934 |
++ NPCM7XX_PINCFG(183, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9935 |
++ NPCM7XX_PINCFG(184, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
9936 |
++ NPCM7XX_PINCFG(185, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
9937 |
++ NPCM7XX_PINCFG(186, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9938 |
++ NPCM7XX_PINCFG(187, spi3cs1, MFSEL4, 17, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9939 |
++ NPCM7XX_PINCFG(188, spi3quad, MFSEL4, 20, spi3cs2, MFSEL4, 18, none, NONE, 0, DSTR(8, 12) | SLEW), |
9940 |
++ NPCM7XX_PINCFG(189, spi3quad, MFSEL4, 20, spi3cs3, MFSEL4, 19, none, NONE, 0, DSTR(8, 12) | SLEW), |
9941 |
++ NPCM7XX_PINCFG(190, gpio, FLOCKR1, 20, nprd_smi, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
9942 |
++ NPCM7XX_PINCFG(191, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), /* XX */ |
9943 |
++ |
9944 |
++ NPCM7XX_PINCFG(192, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), /* XX */ |
9945 |
+ NPCM7XX_PINCFG(193, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
9946 |
+ NPCM7XX_PINCFG(194, smb0b, I2CSEGSEL, 0, none, NONE, 0, none, NONE, 0, 0), |
9947 |
+ NPCM7XX_PINCFG(195, smb0b, I2CSEGSEL, 0, none, NONE, 0, none, NONE, 0, 0), |
9948 |
+@@ -1131,11 +1130,11 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9949 |
+ NPCM7XX_PINCFG(200, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
9950 |
+ NPCM7XX_PINCFG(201, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
9951 |
+ NPCM7XX_PINCFG(202, smb0c, I2CSEGSEL, 1, none, NONE, 0, none, NONE, 0, 0), |
9952 |
+- NPCM7XX_PINCFG(203, faninx, MFSEL3, 3, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9953 |
++ NPCM7XX_PINCFG(203, faninx, MFSEL3, 3, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9954 |
+ NPCM7XX_PINCFG(204, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, SLEW), |
9955 |
+ NPCM7XX_PINCFG(205, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, SLEW), |
9956 |
+- NPCM7XX_PINCFG(206, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DS(4, 8)), |
9957 |
+- NPCM7XX_PINCFG(207, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DS(4, 8)), |
9958 |
++ NPCM7XX_PINCFG(206, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DSTR(4, 8)), |
9959 |
++ NPCM7XX_PINCFG(207, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DSTR(4, 8)), |
9960 |
+ NPCM7XX_PINCFG(208, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0), |
9961 |
+ NPCM7XX_PINCFG(209, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0), |
9962 |
+ NPCM7XX_PINCFG(210, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0), |
9963 |
+@@ -1147,20 +1146,20 @@ static const struct npcm7xx_pincfg pincfg[] = { |
9964 |
+ NPCM7XX_PINCFG(216, rg2mdio, MFSEL4, 23, ddr, MFSEL3, 26, none, NONE, 0, 0), |
9965 |
+ NPCM7XX_PINCFG(217, rg2mdio, MFSEL4, 23, ddr, MFSEL3, 26, none, NONE, 0, 0), |
9966 |
+ NPCM7XX_PINCFG(218, wdog1, MFSEL3, 19, none, NONE, 0, none, NONE, 0, 0), |
9967 |
+- NPCM7XX_PINCFG(219, wdog2, MFSEL3, 20, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
9968 |
++ NPCM7XX_PINCFG(219, wdog2, MFSEL3, 20, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
9969 |
+ NPCM7XX_PINCFG(220, smb12, MFSEL3, 5, none, NONE, 0, none, NONE, 0, 0), |
9970 |
+ NPCM7XX_PINCFG(221, smb12, MFSEL3, 5, none, NONE, 0, none, NONE, 0, 0), |
9971 |
+ NPCM7XX_PINCFG(222, smb13, MFSEL3, 6, none, NONE, 0, none, NONE, 0, 0), |
9972 |
+ NPCM7XX_PINCFG(223, smb13, MFSEL3, 6, none, NONE, 0, none, NONE, 0, 0), |
9973 |
+ |
9974 |
+ NPCM7XX_PINCFG(224, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, SLEW), |
9975 |
+- NPCM7XX_PINCFG(225, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
9976 |
+- NPCM7XX_PINCFG(226, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
9977 |
+- NPCM7XX_PINCFG(227, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9978 |
+- NPCM7XX_PINCFG(228, spixcs1, MFSEL4, 28, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9979 |
+- NPCM7XX_PINCFG(229, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9980 |
+- NPCM7XX_PINCFG(230, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
9981 |
+- NPCM7XX_PINCFG(231, clkreq, MFSEL4, 9, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
9982 |
++ NPCM7XX_PINCFG(225, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
9983 |
++ NPCM7XX_PINCFG(226, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
9984 |
++ NPCM7XX_PINCFG(227, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9985 |
++ NPCM7XX_PINCFG(228, spixcs1, MFSEL4, 28, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9986 |
++ NPCM7XX_PINCFG(229, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9987 |
++ NPCM7XX_PINCFG(230, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
9988 |
++ NPCM7XX_PINCFG(231, clkreq, MFSEL4, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
9989 |
+ NPCM7XX_PINCFG(253, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* SDHC1 power */ |
9990 |
+ NPCM7XX_PINCFG(254, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* SDHC2 power */ |
9991 |
+ NPCM7XX_PINCFG(255, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* DACOSEL */ |
9992 |
+@@ -1561,7 +1560,7 @@ static int npcm7xx_get_groups_count(struct pinctrl_dev *pctldev) |
9993 |
+ { |
9994 |
+ struct npcm7xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev); |
9995 |
+ |
9996 |
+- dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups)); |
9997 |
++ dev_dbg(npcm->dev, "group size: %zu\n", ARRAY_SIZE(npcm7xx_groups)); |
9998 |
+ return ARRAY_SIZE(npcm7xx_groups); |
9999 |
+ } |
10000 |
+ |
10001 |
+diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c |
10002 |
+index 1e225d5139888..42e27dba62e26 100644 |
10003 |
+--- a/drivers/pinctrl/pinconf-generic.c |
10004 |
++++ b/drivers/pinctrl/pinconf-generic.c |
10005 |
+@@ -30,10 +30,10 @@ static const struct pin_config_item conf_items[] = { |
10006 |
+ PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL, false), |
10007 |
+ PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL, false), |
10008 |
+ PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL, false), |
10009 |
+- PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL, false), |
10010 |
++ PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", "ohms", true), |
10011 |
+ PCONFDUMP(PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, |
10012 |
+- "input bias pull to pin specific state", NULL, false), |
10013 |
+- PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL, false), |
10014 |
++ "input bias pull to pin specific state", "ohms", true), |
10015 |
++ PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", "ohms", true), |
10016 |
+ PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL, false), |
10017 |
+ PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL, false), |
10018 |
+ PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false), |
10019 |
+diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
10020 |
+index 53a0badc6b035..9df48e0cf4cb4 100644 |
10021 |
+--- a/drivers/pinctrl/pinctrl-rockchip.c |
10022 |
++++ b/drivers/pinctrl/pinctrl-rockchip.c |
10023 |
+@@ -3774,6 +3774,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
10024 |
+ node = of_parse_phandle(np, "rockchip,grf", 0); |
10025 |
+ if (node) { |
10026 |
+ info->regmap_base = syscon_node_to_regmap(node); |
10027 |
++ of_node_put(node); |
10028 |
+ if (IS_ERR(info->regmap_base)) |
10029 |
+ return PTR_ERR(info->regmap_base); |
10030 |
+ } else { |
10031 |
+@@ -3810,6 +3811,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
10032 |
+ node = of_parse_phandle(np, "rockchip,pmu", 0); |
10033 |
+ if (node) { |
10034 |
+ info->regmap_pmu = syscon_node_to_regmap(node); |
10035 |
++ of_node_put(node); |
10036 |
+ if (IS_ERR(info->regmap_pmu)) |
10037 |
+ return PTR_ERR(info->regmap_pmu); |
10038 |
+ } |
10039 |
+diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c |
10040 |
+index 9d168b90cd281..258972672eda1 100644 |
10041 |
+--- a/drivers/pinctrl/renesas/core.c |
10042 |
++++ b/drivers/pinctrl/renesas/core.c |
10043 |
+@@ -739,7 +739,7 @@ static int sh_pfc_suspend_init(struct sh_pfc *pfc) { return 0; } |
10044 |
+ |
10045 |
+ #ifdef DEBUG |
10046 |
+ #define SH_PFC_MAX_REGS 300 |
10047 |
+-#define SH_PFC_MAX_ENUMS 3000 |
10048 |
++#define SH_PFC_MAX_ENUMS 5000 |
10049 |
+ |
10050 |
+ static unsigned int sh_pfc_errors __initdata = 0; |
10051 |
+ static unsigned int sh_pfc_warnings __initdata = 0; |
10052 |
+@@ -851,7 +851,8 @@ static void __init sh_pfc_check_cfg_reg(const char *drvname, |
10053 |
+ sh_pfc_check_reg(drvname, cfg_reg->reg); |
10054 |
+ |
10055 |
+ if (cfg_reg->field_width) { |
10056 |
+- n = cfg_reg->reg_width / cfg_reg->field_width; |
10057 |
++ fw = cfg_reg->field_width; |
10058 |
++ n = (cfg_reg->reg_width / fw) << fw; |
10059 |
+ /* Skip field checks (done at build time) */ |
10060 |
+ goto check_enum_ids; |
10061 |
+ } |
10062 |
+diff --git a/drivers/pinctrl/renesas/pfc-r8a77470.c b/drivers/pinctrl/renesas/pfc-r8a77470.c |
10063 |
+index b3b116da1bb0d..14005725a726b 100644 |
10064 |
+--- a/drivers/pinctrl/renesas/pfc-r8a77470.c |
10065 |
++++ b/drivers/pinctrl/renesas/pfc-r8a77470.c |
10066 |
+@@ -2121,7 +2121,7 @@ static const unsigned int vin0_clk_mux[] = { |
10067 |
+ VI0_CLK_MARK, |
10068 |
+ }; |
10069 |
+ /* - VIN1 ------------------------------------------------------------------- */ |
10070 |
+-static const union vin_data vin1_data_pins = { |
10071 |
++static const union vin_data12 vin1_data_pins = { |
10072 |
+ .data12 = { |
10073 |
+ RCAR_GP_PIN(3, 1), RCAR_GP_PIN(3, 2), |
10074 |
+ RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4), |
10075 |
+@@ -2131,7 +2131,7 @@ static const union vin_data vin1_data_pins = { |
10076 |
+ RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16), |
10077 |
+ }, |
10078 |
+ }; |
10079 |
+-static const union vin_data vin1_data_mux = { |
10080 |
++static const union vin_data12 vin1_data_mux = { |
10081 |
+ .data12 = { |
10082 |
+ VI1_DATA0_MARK, VI1_DATA1_MARK, |
10083 |
+ VI1_DATA2_MARK, VI1_DATA3_MARK, |
10084 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c |
10085 |
+index 7f809a57bee50..56fff83a143bd 100644 |
10086 |
+--- a/drivers/pinctrl/samsung/pinctrl-samsung.c |
10087 |
++++ b/drivers/pinctrl/samsung/pinctrl-samsung.c |
10088 |
+@@ -1002,6 +1002,16 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev) |
10089 |
+ return &(of_data->ctrl[id]); |
10090 |
+ } |
10091 |
+ |
10092 |
++static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d) |
10093 |
++{ |
10094 |
++ struct samsung_pin_bank *bank; |
10095 |
++ unsigned int i; |
10096 |
++ |
10097 |
++ bank = d->pin_banks; |
10098 |
++ for (i = 0; i < d->nr_banks; ++i, ++bank) |
10099 |
++ of_node_put(bank->of_node); |
10100 |
++} |
10101 |
++ |
10102 |
+ /* retrieve the soc specific data */ |
10103 |
+ static const struct samsung_pin_ctrl * |
10104 |
+ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, |
10105 |
+@@ -1116,19 +1126,19 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) |
10106 |
+ if (ctrl->retention_data) { |
10107 |
+ drvdata->retention_ctrl = ctrl->retention_data->init(drvdata, |
10108 |
+ ctrl->retention_data); |
10109 |
+- if (IS_ERR(drvdata->retention_ctrl)) |
10110 |
+- return PTR_ERR(drvdata->retention_ctrl); |
10111 |
++ if (IS_ERR(drvdata->retention_ctrl)) { |
10112 |
++ ret = PTR_ERR(drvdata->retention_ctrl); |
10113 |
++ goto err_put_banks; |
10114 |
++ } |
10115 |
+ } |
10116 |
+ |
10117 |
+ ret = samsung_pinctrl_register(pdev, drvdata); |
10118 |
+ if (ret) |
10119 |
+- return ret; |
10120 |
++ goto err_put_banks; |
10121 |
+ |
10122 |
+ ret = samsung_gpiolib_register(pdev, drvdata); |
10123 |
+- if (ret) { |
10124 |
+- samsung_pinctrl_unregister(pdev, drvdata); |
10125 |
+- return ret; |
10126 |
+- } |
10127 |
++ if (ret) |
10128 |
++ goto err_unregister; |
10129 |
+ |
10130 |
+ if (ctrl->eint_gpio_init) |
10131 |
+ ctrl->eint_gpio_init(drvdata); |
10132 |
+@@ -1138,6 +1148,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) |
10133 |
+ platform_set_drvdata(pdev, drvdata); |
10134 |
+ |
10135 |
+ return 0; |
10136 |
++ |
10137 |
++err_unregister: |
10138 |
++ samsung_pinctrl_unregister(pdev, drvdata); |
10139 |
++err_put_banks: |
10140 |
++ samsung_banks_of_node_put(drvdata); |
10141 |
++ return ret; |
10142 |
+ } |
10143 |
+ |
10144 |
+ /* |
10145 |
+diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile |
10146 |
+index f901d2e43166c..88cbc434c06b2 100644 |
10147 |
+--- a/drivers/platform/chrome/Makefile |
10148 |
++++ b/drivers/platform/chrome/Makefile |
10149 |
+@@ -2,6 +2,7 @@ |
10150 |
+ |
10151 |
+ # tell define_trace.h where to find the cros ec trace header |
10152 |
+ CFLAGS_cros_ec_trace.o:= -I$(src) |
10153 |
++CFLAGS_cros_ec_sensorhub_ring.o:= -I$(src) |
10154 |
+ |
10155 |
+ obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o |
10156 |
+ obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o |
10157 |
+@@ -20,7 +21,7 @@ obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_chardev.o |
10158 |
+ obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o |
10159 |
+ obj-$(CONFIG_CROS_EC_VBC) += cros_ec_vbc.o |
10160 |
+ obj-$(CONFIG_CROS_EC_DEBUGFS) += cros_ec_debugfs.o |
10161 |
+-cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o cros_ec_trace.o |
10162 |
++cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o |
10163 |
+ obj-$(CONFIG_CROS_EC_SENSORHUB) += cros-ec-sensorhub.o |
10164 |
+ obj-$(CONFIG_CROS_EC_SYSFS) += cros_ec_sysfs.o |
10165 |
+ obj-$(CONFIG_CROS_USBPD_LOGGER) += cros_usbpd_logger.o |
10166 |
+diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c |
10167 |
+index 98e37080f7609..71948dade0e2a 100644 |
10168 |
+--- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c |
10169 |
++++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c |
10170 |
+@@ -17,7 +17,8 @@ |
10171 |
+ #include <linux/sort.h> |
10172 |
+ #include <linux/slab.h> |
10173 |
+ |
10174 |
+-#include "cros_ec_trace.h" |
10175 |
++#define CREATE_TRACE_POINTS |
10176 |
++#include "cros_ec_sensorhub_trace.h" |
10177 |
+ |
10178 |
+ /* Precision of fixed point for the m values from the filter */ |
10179 |
+ #define M_PRECISION BIT(23) |
10180 |
+diff --git a/drivers/platform/chrome/cros_ec_sensorhub_trace.h b/drivers/platform/chrome/cros_ec_sensorhub_trace.h |
10181 |
+new file mode 100644 |
10182 |
+index 0000000000000..57d9b47859692 |
10183 |
+--- /dev/null |
10184 |
++++ b/drivers/platform/chrome/cros_ec_sensorhub_trace.h |
10185 |
+@@ -0,0 +1,123 @@ |
10186 |
++/* SPDX-License-Identifier: GPL-2.0 */ |
10187 |
++/* |
10188 |
++ * Trace events for the ChromeOS Sensorhub kernel module |
10189 |
++ * |
10190 |
++ * Copyright 2021 Google LLC. |
10191 |
++ */ |
10192 |
++ |
10193 |
++#undef TRACE_SYSTEM |
10194 |
++#define TRACE_SYSTEM cros_ec |
10195 |
++ |
10196 |
++#if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) |
10197 |
++#define _CROS_EC_SENSORHUB_TRACE_H_ |
10198 |
++ |
10199 |
++#include <linux/types.h> |
10200 |
++#include <linux/platform_data/cros_ec_sensorhub.h> |
10201 |
++ |
10202 |
++#include <linux/tracepoint.h> |
10203 |
++ |
10204 |
++TRACE_EVENT(cros_ec_sensorhub_timestamp, |
10205 |
++ TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp, |
10206 |
++ s64 current_timestamp, s64 current_time), |
10207 |
++ TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp, |
10208 |
++ current_time), |
10209 |
++ TP_STRUCT__entry( |
10210 |
++ __field(u32, ec_sample_timestamp) |
10211 |
++ __field(u32, ec_fifo_timestamp) |
10212 |
++ __field(s64, fifo_timestamp) |
10213 |
++ __field(s64, current_timestamp) |
10214 |
++ __field(s64, current_time) |
10215 |
++ __field(s64, delta) |
10216 |
++ ), |
10217 |
++ TP_fast_assign( |
10218 |
++ __entry->ec_sample_timestamp = ec_sample_timestamp; |
10219 |
++ __entry->ec_fifo_timestamp = ec_fifo_timestamp; |
10220 |
++ __entry->fifo_timestamp = fifo_timestamp; |
10221 |
++ __entry->current_timestamp = current_timestamp; |
10222 |
++ __entry->current_time = current_time; |
10223 |
++ __entry->delta = current_timestamp - current_time; |
10224 |
++ ), |
10225 |
++ TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", |
10226 |
++ __entry->ec_sample_timestamp, |
10227 |
++ __entry->ec_fifo_timestamp, |
10228 |
++ __entry->fifo_timestamp, |
10229 |
++ __entry->current_timestamp, |
10230 |
++ __entry->current_time, |
10231 |
++ __entry->delta |
10232 |
++ ) |
10233 |
++); |
10234 |
++ |
10235 |
++TRACE_EVENT(cros_ec_sensorhub_data, |
10236 |
++ TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, |
10237 |
++ s64 current_timestamp, s64 current_time), |
10238 |
++ TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time), |
10239 |
++ TP_STRUCT__entry( |
10240 |
++ __field(u32, ec_sensor_num) |
10241 |
++ __field(u32, ec_fifo_timestamp) |
10242 |
++ __field(s64, fifo_timestamp) |
10243 |
++ __field(s64, current_timestamp) |
10244 |
++ __field(s64, current_time) |
10245 |
++ __field(s64, delta) |
10246 |
++ ), |
10247 |
++ TP_fast_assign( |
10248 |
++ __entry->ec_sensor_num = ec_sensor_num; |
10249 |
++ __entry->ec_fifo_timestamp = ec_fifo_timestamp; |
10250 |
++ __entry->fifo_timestamp = fifo_timestamp; |
10251 |
++ __entry->current_timestamp = current_timestamp; |
10252 |
++ __entry->current_time = current_time; |
10253 |
++ __entry->delta = current_timestamp - current_time; |
10254 |
++ ), |
10255 |
++ TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", |
10256 |
++ __entry->ec_sensor_num, |
10257 |
++ __entry->ec_fifo_timestamp, |
10258 |
++ __entry->fifo_timestamp, |
10259 |
++ __entry->current_timestamp, |
10260 |
++ __entry->current_time, |
10261 |
++ __entry->delta |
10262 |
++ ) |
10263 |
++); |
10264 |
++ |
10265 |
++TRACE_EVENT(cros_ec_sensorhub_filter, |
10266 |
++ TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy), |
10267 |
++ TP_ARGS(state, dx, dy), |
10268 |
++ TP_STRUCT__entry( |
10269 |
++ __field(s64, dx) |
10270 |
++ __field(s64, dy) |
10271 |
++ __field(s64, median_m) |
10272 |
++ __field(s64, median_error) |
10273 |
++ __field(s64, history_len) |
10274 |
++ __field(s64, x) |
10275 |
++ __field(s64, y) |
10276 |
++ ), |
10277 |
++ TP_fast_assign( |
10278 |
++ __entry->dx = dx; |
10279 |
++ __entry->dy = dy; |
10280 |
++ __entry->median_m = state->median_m; |
10281 |
++ __entry->median_error = state->median_error; |
10282 |
++ __entry->history_len = state->history_len; |
10283 |
++ __entry->x = state->x_offset; |
10284 |
++ __entry->y = state->y_offset; |
10285 |
++ ), |
10286 |
++ TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld", |
10287 |
++ __entry->dx, |
10288 |
++ __entry->dy, |
10289 |
++ __entry->median_m, |
10290 |
++ __entry->median_error, |
10291 |
++ __entry->history_len, |
10292 |
++ __entry->x, |
10293 |
++ __entry->y |
10294 |
++ ) |
10295 |
++); |
10296 |
++ |
10297 |
++ |
10298 |
++#endif /* _CROS_EC_SENSORHUB_TRACE_H_ */ |
10299 |
++ |
10300 |
++/* this part must be outside header guard */ |
10301 |
++ |
10302 |
++#undef TRACE_INCLUDE_PATH |
10303 |
++#define TRACE_INCLUDE_PATH . |
10304 |
++ |
10305 |
++#undef TRACE_INCLUDE_FILE |
10306 |
++#define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace |
10307 |
++ |
10308 |
++#include <trace/define_trace.h> |
10309 |
+diff --git a/drivers/platform/chrome/cros_ec_trace.h b/drivers/platform/chrome/cros_ec_trace.h |
10310 |
+index 7e7cfc98657a4..9bb5cd2c98b8b 100644 |
10311 |
+--- a/drivers/platform/chrome/cros_ec_trace.h |
10312 |
++++ b/drivers/platform/chrome/cros_ec_trace.h |
10313 |
+@@ -15,7 +15,6 @@ |
10314 |
+ #include <linux/types.h> |
10315 |
+ #include <linux/platform_data/cros_ec_commands.h> |
10316 |
+ #include <linux/platform_data/cros_ec_proto.h> |
10317 |
+-#include <linux/platform_data/cros_ec_sensorhub.h> |
10318 |
+ |
10319 |
+ #include <linux/tracepoint.h> |
10320 |
+ |
10321 |
+@@ -71,100 +70,6 @@ TRACE_EVENT(cros_ec_request_done, |
10322 |
+ __entry->retval) |
10323 |
+ ); |
10324 |
+ |
10325 |
+-TRACE_EVENT(cros_ec_sensorhub_timestamp, |
10326 |
+- TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp, |
10327 |
+- s64 current_timestamp, s64 current_time), |
10328 |
+- TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp, |
10329 |
+- current_time), |
10330 |
+- TP_STRUCT__entry( |
10331 |
+- __field(u32, ec_sample_timestamp) |
10332 |
+- __field(u32, ec_fifo_timestamp) |
10333 |
+- __field(s64, fifo_timestamp) |
10334 |
+- __field(s64, current_timestamp) |
10335 |
+- __field(s64, current_time) |
10336 |
+- __field(s64, delta) |
10337 |
+- ), |
10338 |
+- TP_fast_assign( |
10339 |
+- __entry->ec_sample_timestamp = ec_sample_timestamp; |
10340 |
+- __entry->ec_fifo_timestamp = ec_fifo_timestamp; |
10341 |
+- __entry->fifo_timestamp = fifo_timestamp; |
10342 |
+- __entry->current_timestamp = current_timestamp; |
10343 |
+- __entry->current_time = current_time; |
10344 |
+- __entry->delta = current_timestamp - current_time; |
10345 |
+- ), |
10346 |
+- TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", |
10347 |
+- __entry->ec_sample_timestamp, |
10348 |
+- __entry->ec_fifo_timestamp, |
10349 |
+- __entry->fifo_timestamp, |
10350 |
+- __entry->current_timestamp, |
10351 |
+- __entry->current_time, |
10352 |
+- __entry->delta |
10353 |
+- ) |
10354 |
+-); |
10355 |
+- |
10356 |
+-TRACE_EVENT(cros_ec_sensorhub_data, |
10357 |
+- TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, |
10358 |
+- s64 current_timestamp, s64 current_time), |
10359 |
+- TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time), |
10360 |
+- TP_STRUCT__entry( |
10361 |
+- __field(u32, ec_sensor_num) |
10362 |
+- __field(u32, ec_fifo_timestamp) |
10363 |
+- __field(s64, fifo_timestamp) |
10364 |
+- __field(s64, current_timestamp) |
10365 |
+- __field(s64, current_time) |
10366 |
+- __field(s64, delta) |
10367 |
+- ), |
10368 |
+- TP_fast_assign( |
10369 |
+- __entry->ec_sensor_num = ec_sensor_num; |
10370 |
+- __entry->ec_fifo_timestamp = ec_fifo_timestamp; |
10371 |
+- __entry->fifo_timestamp = fifo_timestamp; |
10372 |
+- __entry->current_timestamp = current_timestamp; |
10373 |
+- __entry->current_time = current_time; |
10374 |
+- __entry->delta = current_timestamp - current_time; |
10375 |
+- ), |
10376 |
+- TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", |
10377 |
+- __entry->ec_sensor_num, |
10378 |
+- __entry->ec_fifo_timestamp, |
10379 |
+- __entry->fifo_timestamp, |
10380 |
+- __entry->current_timestamp, |
10381 |
+- __entry->current_time, |
10382 |
+- __entry->delta |
10383 |
+- ) |
10384 |
+-); |
10385 |
+- |
10386 |
+-TRACE_EVENT(cros_ec_sensorhub_filter, |
10387 |
+- TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy), |
10388 |
+- TP_ARGS(state, dx, dy), |
10389 |
+- TP_STRUCT__entry( |
10390 |
+- __field(s64, dx) |
10391 |
+- __field(s64, dy) |
10392 |
+- __field(s64, median_m) |
10393 |
+- __field(s64, median_error) |
10394 |
+- __field(s64, history_len) |
10395 |
+- __field(s64, x) |
10396 |
+- __field(s64, y) |
10397 |
+- ), |
10398 |
+- TP_fast_assign( |
10399 |
+- __entry->dx = dx; |
10400 |
+- __entry->dy = dy; |
10401 |
+- __entry->median_m = state->median_m; |
10402 |
+- __entry->median_error = state->median_error; |
10403 |
+- __entry->history_len = state->history_len; |
10404 |
+- __entry->x = state->x_offset; |
10405 |
+- __entry->y = state->y_offset; |
10406 |
+- ), |
10407 |
+- TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld", |
10408 |
+- __entry->dx, |
10409 |
+- __entry->dy, |
10410 |
+- __entry->median_m, |
10411 |
+- __entry->median_error, |
10412 |
+- __entry->history_len, |
10413 |
+- __entry->x, |
10414 |
+- __entry->y |
10415 |
+- ) |
10416 |
+-); |
10417 |
+- |
10418 |
+- |
10419 |
+ #endif /* _CROS_EC_TRACE_H_ */ |
10420 |
+ |
10421 |
+ /* this part must be outside header guard */ |
10422 |
+diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c |
10423 |
+index 036d54dc52e24..cc336457ca808 100644 |
10424 |
+--- a/drivers/platform/chrome/cros_ec_typec.c |
10425 |
++++ b/drivers/platform/chrome/cros_ec_typec.c |
10426 |
+@@ -712,7 +712,13 @@ static int cros_typec_probe(struct platform_device *pdev) |
10427 |
+ return -ENOMEM; |
10428 |
+ |
10429 |
+ typec->dev = dev; |
10430 |
++ |
10431 |
+ typec->ec = dev_get_drvdata(pdev->dev.parent); |
10432 |
++ if (!typec->ec) { |
10433 |
++ dev_err(dev, "couldn't find parent EC device\n"); |
10434 |
++ return -ENODEV; |
10435 |
++ } |
10436 |
++ |
10437 |
+ platform_set_drvdata(pdev, typec); |
10438 |
+ |
10439 |
+ ret = cros_typec_get_cmd_version(typec); |
10440 |
+diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c |
10441 |
+index a2d846c4a7eef..eac3e6b4ea113 100644 |
10442 |
+--- a/drivers/platform/x86/huawei-wmi.c |
10443 |
++++ b/drivers/platform/x86/huawei-wmi.c |
10444 |
+@@ -470,10 +470,17 @@ static DEVICE_ATTR_RW(charge_control_thresholds); |
10445 |
+ |
10446 |
+ static int huawei_wmi_battery_add(struct power_supply *battery) |
10447 |
+ { |
10448 |
+- device_create_file(&battery->dev, &dev_attr_charge_control_start_threshold); |
10449 |
+- device_create_file(&battery->dev, &dev_attr_charge_control_end_threshold); |
10450 |
++ int err = 0; |
10451 |
+ |
10452 |
+- return 0; |
10453 |
++ err = device_create_file(&battery->dev, &dev_attr_charge_control_start_threshold); |
10454 |
++ if (err) |
10455 |
++ return err; |
10456 |
++ |
10457 |
++ err = device_create_file(&battery->dev, &dev_attr_charge_control_end_threshold); |
10458 |
++ if (err) |
10459 |
++ device_remove_file(&battery->dev, &dev_attr_charge_control_start_threshold); |
10460 |
++ |
10461 |
++ return err; |
10462 |
+ } |
10463 |
+ |
10464 |
+ static int huawei_wmi_battery_remove(struct power_supply *battery) |
10465 |
+diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c |
10466 |
+index 90e35c07240ae..b7f7a8225f22e 100644 |
10467 |
+--- a/drivers/power/reset/gemini-poweroff.c |
10468 |
++++ b/drivers/power/reset/gemini-poweroff.c |
10469 |
+@@ -107,8 +107,8 @@ static int gemini_poweroff_probe(struct platform_device *pdev) |
10470 |
+ return PTR_ERR(gpw->base); |
10471 |
+ |
10472 |
+ irq = platform_get_irq(pdev, 0); |
10473 |
+- if (!irq) |
10474 |
+- return -EINVAL; |
10475 |
++ if (irq < 0) |
10476 |
++ return irq; |
10477 |
+ |
10478 |
+ gpw->dev = dev; |
10479 |
+ |
10480 |
+diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c |
10481 |
+index f1da757c939f8..a6b4a94c27662 100644 |
10482 |
+--- a/drivers/power/supply/ab8500_fg.c |
10483 |
++++ b/drivers/power/supply/ab8500_fg.c |
10484 |
+@@ -2541,8 +2541,10 @@ static int ab8500_fg_sysfs_init(struct ab8500_fg *di) |
10485 |
+ ret = kobject_init_and_add(&di->fg_kobject, |
10486 |
+ &ab8500_fg_ktype, |
10487 |
+ NULL, "battery"); |
10488 |
+- if (ret < 0) |
10489 |
++ if (ret < 0) { |
10490 |
++ kobject_put(&di->fg_kobject); |
10491 |
+ dev_err(di->dev, "failed to create sysfs entry\n"); |
10492 |
++ } |
10493 |
+ |
10494 |
+ return ret; |
10495 |
+ } |
10496 |
+diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c |
10497 |
+index 845af0f44c022..8c3c378dce0d5 100644 |
10498 |
+--- a/drivers/power/supply/bq24190_charger.c |
10499 |
++++ b/drivers/power/supply/bq24190_charger.c |
10500 |
+@@ -41,6 +41,7 @@ |
10501 |
+ #define BQ24190_REG_POC_CHG_CONFIG_DISABLE 0x0 |
10502 |
+ #define BQ24190_REG_POC_CHG_CONFIG_CHARGE 0x1 |
10503 |
+ #define BQ24190_REG_POC_CHG_CONFIG_OTG 0x2 |
10504 |
++#define BQ24190_REG_POC_CHG_CONFIG_OTG_ALT 0x3 |
10505 |
+ #define BQ24190_REG_POC_SYS_MIN_MASK (BIT(3) | BIT(2) | BIT(1)) |
10506 |
+ #define BQ24190_REG_POC_SYS_MIN_SHIFT 1 |
10507 |
+ #define BQ24190_REG_POC_SYS_MIN_MIN 3000 |
10508 |
+@@ -552,7 +553,11 @@ static int bq24190_vbus_is_enabled(struct regulator_dev *dev) |
10509 |
+ pm_runtime_mark_last_busy(bdi->dev); |
10510 |
+ pm_runtime_put_autosuspend(bdi->dev); |
10511 |
+ |
10512 |
+- return ret ? ret : val == BQ24190_REG_POC_CHG_CONFIG_OTG; |
10513 |
++ if (ret) |
10514 |
++ return ret; |
10515 |
++ |
10516 |
++ return (val == BQ24190_REG_POC_CHG_CONFIG_OTG || |
10517 |
++ val == BQ24190_REG_POC_CHG_CONFIG_OTG_ALT); |
10518 |
+ } |
10519 |
+ |
10520 |
+ static const struct regulator_ops bq24190_vbus_ops = { |
10521 |
+diff --git a/drivers/power/supply/wm8350_power.c b/drivers/power/supply/wm8350_power.c |
10522 |
+index e05cee457471b..908cfd45d2624 100644 |
10523 |
+--- a/drivers/power/supply/wm8350_power.c |
10524 |
++++ b/drivers/power/supply/wm8350_power.c |
10525 |
+@@ -408,44 +408,112 @@ static const struct power_supply_desc wm8350_usb_desc = { |
10526 |
+ * Initialisation |
10527 |
+ *********************************************************************/ |
10528 |
+ |
10529 |
+-static void wm8350_init_charger(struct wm8350 *wm8350) |
10530 |
++static int wm8350_init_charger(struct wm8350 *wm8350) |
10531 |
+ { |
10532 |
++ int ret; |
10533 |
++ |
10534 |
+ /* register our interest in charger events */ |
10535 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
10536 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
10537 |
+ wm8350_charger_handler, 0, "Battery hot", wm8350); |
10538 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
10539 |
++ if (ret) |
10540 |
++ goto err; |
10541 |
++ |
10542 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
10543 |
+ wm8350_charger_handler, 0, "Battery cold", wm8350); |
10544 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
10545 |
++ if (ret) |
10546 |
++ goto free_chg_bat_hot; |
10547 |
++ |
10548 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
10549 |
+ wm8350_charger_handler, 0, "Battery fail", wm8350); |
10550 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
10551 |
++ if (ret) |
10552 |
++ goto free_chg_bat_cold; |
10553 |
++ |
10554 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
10555 |
+ wm8350_charger_handler, 0, |
10556 |
+ "Charger timeout", wm8350); |
10557 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
10558 |
++ if (ret) |
10559 |
++ goto free_chg_bat_fail; |
10560 |
++ |
10561 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
10562 |
+ wm8350_charger_handler, 0, |
10563 |
+ "Charge end", wm8350); |
10564 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
10565 |
++ if (ret) |
10566 |
++ goto free_chg_to; |
10567 |
++ |
10568 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
10569 |
+ wm8350_charger_handler, 0, |
10570 |
+ "Charge start", wm8350); |
10571 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
10572 |
++ if (ret) |
10573 |
++ goto free_chg_end; |
10574 |
++ |
10575 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
10576 |
+ wm8350_charger_handler, 0, |
10577 |
+ "Fast charge ready", wm8350); |
10578 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
10579 |
++ if (ret) |
10580 |
++ goto free_chg_start; |
10581 |
++ |
10582 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
10583 |
+ wm8350_charger_handler, 0, |
10584 |
+ "Battery <3.9V", wm8350); |
10585 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
10586 |
++ if (ret) |
10587 |
++ goto free_chg_fast_rdy; |
10588 |
++ |
10589 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
10590 |
+ wm8350_charger_handler, 0, |
10591 |
+ "Battery <3.1V", wm8350); |
10592 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
10593 |
++ if (ret) |
10594 |
++ goto free_chg_vbatt_lt_3p9; |
10595 |
++ |
10596 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
10597 |
+ wm8350_charger_handler, 0, |
10598 |
+ "Battery <2.85V", wm8350); |
10599 |
++ if (ret) |
10600 |
++ goto free_chg_vbatt_lt_3p1; |
10601 |
+ |
10602 |
+ /* and supply change events */ |
10603 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
10604 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
10605 |
+ wm8350_charger_handler, 0, "USB", wm8350); |
10606 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
10607 |
++ if (ret) |
10608 |
++ goto free_chg_vbatt_lt_2p85; |
10609 |
++ |
10610 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
10611 |
+ wm8350_charger_handler, 0, "Wall", wm8350); |
10612 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
10613 |
++ if (ret) |
10614 |
++ goto free_ext_usb_fb; |
10615 |
++ |
10616 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
10617 |
+ wm8350_charger_handler, 0, "Battery", wm8350); |
10618 |
++ if (ret) |
10619 |
++ goto free_ext_wall_fb; |
10620 |
++ |
10621 |
++ return 0; |
10622 |
++ |
10623 |
++free_ext_wall_fb: |
10624 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, wm8350); |
10625 |
++free_ext_usb_fb: |
10626 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB, wm8350); |
10627 |
++free_chg_vbatt_lt_2p85: |
10628 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350); |
10629 |
++free_chg_vbatt_lt_3p1: |
10630 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350); |
10631 |
++free_chg_vbatt_lt_3p9: |
10632 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350); |
10633 |
++free_chg_fast_rdy: |
10634 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350); |
10635 |
++free_chg_start: |
10636 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350); |
10637 |
++free_chg_end: |
10638 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350); |
10639 |
++free_chg_to: |
10640 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350); |
10641 |
++free_chg_bat_fail: |
10642 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, wm8350); |
10643 |
++free_chg_bat_cold: |
10644 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, wm8350); |
10645 |
++free_chg_bat_hot: |
10646 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, wm8350); |
10647 |
++err: |
10648 |
++ return ret; |
10649 |
+ } |
10650 |
+ |
10651 |
+ static void free_charger_irq(struct wm8350 *wm8350) |
10652 |
+@@ -456,6 +524,7 @@ static void free_charger_irq(struct wm8350 *wm8350) |
10653 |
+ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350); |
10654 |
+ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350); |
10655 |
+ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350); |
10656 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350); |
10657 |
+ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350); |
10658 |
+ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350); |
10659 |
+ wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350); |
10660 |
+diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c |
10661 |
+index 5ff11145c1a30..9b15b6a79082a 100644 |
10662 |
+--- a/drivers/pwm/pwm-lpc18xx-sct.c |
10663 |
++++ b/drivers/pwm/pwm-lpc18xx-sct.c |
10664 |
+@@ -400,12 +400,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) |
10665 |
+ lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_LIMIT, |
10666 |
+ BIT(lpc18xx_pwm->period_event)); |
10667 |
+ |
10668 |
+- ret = pwmchip_add(&lpc18xx_pwm->chip); |
10669 |
+- if (ret < 0) { |
10670 |
+- dev_err(&pdev->dev, "pwmchip_add failed: %d\n", ret); |
10671 |
+- goto disable_pwmclk; |
10672 |
+- } |
10673 |
+- |
10674 |
+ for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) { |
10675 |
+ struct lpc18xx_pwm_data *data; |
10676 |
+ |
10677 |
+@@ -415,14 +409,12 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) |
10678 |
+ GFP_KERNEL); |
10679 |
+ if (!data) { |
10680 |
+ ret = -ENOMEM; |
10681 |
+- goto remove_pwmchip; |
10682 |
++ goto disable_pwmclk; |
10683 |
+ } |
10684 |
+ |
10685 |
+ pwm_set_chip_data(pwm, data); |
10686 |
+ } |
10687 |
+ |
10688 |
+- platform_set_drvdata(pdev, lpc18xx_pwm); |
10689 |
+- |
10690 |
+ val = lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL); |
10691 |
+ val &= ~LPC18XX_PWM_BIDIR; |
10692 |
+ val &= ~LPC18XX_PWM_CTRL_HALT; |
10693 |
+@@ -430,10 +422,16 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) |
10694 |
+ val |= LPC18XX_PWM_PRE(0); |
10695 |
+ lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL, val); |
10696 |
+ |
10697 |
++ ret = pwmchip_add(&lpc18xx_pwm->chip); |
10698 |
++ if (ret < 0) { |
10699 |
++ dev_err(&pdev->dev, "pwmchip_add failed: %d\n", ret); |
10700 |
++ goto disable_pwmclk; |
10701 |
++ } |
10702 |
++ |
10703 |
++ platform_set_drvdata(pdev, lpc18xx_pwm); |
10704 |
++ |
10705 |
+ return 0; |
10706 |
+ |
10707 |
+-remove_pwmchip: |
10708 |
+- pwmchip_remove(&lpc18xx_pwm->chip); |
10709 |
+ disable_pwmclk: |
10710 |
+ clk_disable_unprepare(lpc18xx_pwm->pwm_clk); |
10711 |
+ return ret; |
10712 |
+diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c |
10713 |
+index 03e146e98abd5..8d784a2a09d86 100644 |
10714 |
+--- a/drivers/regulator/qcom_smd-regulator.c |
10715 |
++++ b/drivers/regulator/qcom_smd-regulator.c |
10716 |
+@@ -1185,8 +1185,10 @@ static int rpm_reg_probe(struct platform_device *pdev) |
10717 |
+ |
10718 |
+ for_each_available_child_of_node(dev->of_node, node) { |
10719 |
+ vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); |
10720 |
+- if (!vreg) |
10721 |
++ if (!vreg) { |
10722 |
++ of_node_put(node); |
10723 |
+ return -ENOMEM; |
10724 |
++ } |
10725 |
+ |
10726 |
+ ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); |
10727 |
+ |
10728 |
+diff --git a/drivers/regulator/rpi-panel-attiny-regulator.c b/drivers/regulator/rpi-panel-attiny-regulator.c |
10729 |
+index ee46bfbf5eee7..991b4730d7687 100644 |
10730 |
+--- a/drivers/regulator/rpi-panel-attiny-regulator.c |
10731 |
++++ b/drivers/regulator/rpi-panel-attiny-regulator.c |
10732 |
+@@ -37,11 +37,24 @@ static const struct regmap_config attiny_regmap_config = { |
10733 |
+ static int attiny_lcd_power_enable(struct regulator_dev *rdev) |
10734 |
+ { |
10735 |
+ unsigned int data; |
10736 |
++ int ret, i; |
10737 |
+ |
10738 |
+ regmap_write(rdev->regmap, REG_POWERON, 1); |
10739 |
++ msleep(80); |
10740 |
++ |
10741 |
+ /* Wait for nPWRDWN to go low to indicate poweron is done. */ |
10742 |
+- regmap_read_poll_timeout(rdev->regmap, REG_PORTB, data, |
10743 |
+- data & BIT(0), 10, 1000000); |
10744 |
++ for (i = 0; i < 20; i++) { |
10745 |
++ ret = regmap_read(rdev->regmap, REG_PORTB, &data); |
10746 |
++ if (!ret) { |
10747 |
++ if (data & BIT(0)) |
10748 |
++ break; |
10749 |
++ } |
10750 |
++ usleep_range(10000, 12000); |
10751 |
++ } |
10752 |
++ usleep_range(10000, 12000); |
10753 |
++ |
10754 |
++ if (ret) |
10755 |
++ pr_err("%s: regmap_read_poll_timeout failed %d\n", __func__, ret); |
10756 |
+ |
10757 |
+ /* Default to the same orientation as the closed source |
10758 |
+ * firmware used for the panel. Runtime rotation |
10759 |
+@@ -57,23 +70,34 @@ static int attiny_lcd_power_disable(struct regulator_dev *rdev) |
10760 |
+ { |
10761 |
+ regmap_write(rdev->regmap, REG_PWM, 0); |
10762 |
+ regmap_write(rdev->regmap, REG_POWERON, 0); |
10763 |
+- udelay(1); |
10764 |
++ msleep(30); |
10765 |
+ return 0; |
10766 |
+ } |
10767 |
+ |
10768 |
+ static int attiny_lcd_power_is_enabled(struct regulator_dev *rdev) |
10769 |
+ { |
10770 |
+ unsigned int data; |
10771 |
+- int ret; |
10772 |
++ int ret, i; |
10773 |
+ |
10774 |
+- ret = regmap_read(rdev->regmap, REG_POWERON, &data); |
10775 |
++ for (i = 0; i < 10; i++) { |
10776 |
++ ret = regmap_read(rdev->regmap, REG_POWERON, &data); |
10777 |
++ if (!ret) |
10778 |
++ break; |
10779 |
++ usleep_range(10000, 12000); |
10780 |
++ } |
10781 |
+ if (ret < 0) |
10782 |
+ return ret; |
10783 |
+ |
10784 |
+ if (!(data & BIT(0))) |
10785 |
+ return 0; |
10786 |
+ |
10787 |
+- ret = regmap_read(rdev->regmap, REG_PORTB, &data); |
10788 |
++ for (i = 0; i < 10; i++) { |
10789 |
++ ret = regmap_read(rdev->regmap, REG_PORTB, &data); |
10790 |
++ if (!ret) |
10791 |
++ break; |
10792 |
++ usleep_range(10000, 12000); |
10793 |
++ } |
10794 |
++ |
10795 |
+ if (ret < 0) |
10796 |
+ return ret; |
10797 |
+ |
10798 |
+@@ -103,20 +127,32 @@ static int attiny_update_status(struct backlight_device *bl) |
10799 |
+ { |
10800 |
+ struct regmap *regmap = bl_get_data(bl); |
10801 |
+ int brightness = bl->props.brightness; |
10802 |
++ int ret, i; |
10803 |
+ |
10804 |
+ if (bl->props.power != FB_BLANK_UNBLANK || |
10805 |
+ bl->props.fb_blank != FB_BLANK_UNBLANK) |
10806 |
+ brightness = 0; |
10807 |
+ |
10808 |
+- return regmap_write(regmap, REG_PWM, brightness); |
10809 |
++ for (i = 0; i < 10; i++) { |
10810 |
++ ret = regmap_write(regmap, REG_PWM, brightness); |
10811 |
++ if (!ret) |
10812 |
++ break; |
10813 |
++ } |
10814 |
++ |
10815 |
++ return ret; |
10816 |
+ } |
10817 |
+ |
10818 |
+ static int attiny_get_brightness(struct backlight_device *bl) |
10819 |
+ { |
10820 |
+ struct regmap *regmap = bl_get_data(bl); |
10821 |
+- int ret, brightness; |
10822 |
++ int ret, brightness, i; |
10823 |
++ |
10824 |
++ for (i = 0; i < 10; i++) { |
10825 |
++ ret = regmap_read(regmap, REG_PWM, &brightness); |
10826 |
++ if (!ret) |
10827 |
++ break; |
10828 |
++ } |
10829 |
+ |
10830 |
+- ret = regmap_read(regmap, REG_PWM, &brightness); |
10831 |
+ if (ret) |
10832 |
+ return ret; |
10833 |
+ |
10834 |
+@@ -166,7 +202,7 @@ static int attiny_i2c_probe(struct i2c_client *i2c, |
10835 |
+ } |
10836 |
+ |
10837 |
+ regmap_write(regmap, REG_POWERON, 0); |
10838 |
+- mdelay(1); |
10839 |
++ msleep(30); |
10840 |
+ |
10841 |
+ config.dev = &i2c->dev; |
10842 |
+ config.regmap = regmap; |
10843 |
+diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c |
10844 |
+index 9eb599701f9b0..c39138d39cf07 100644 |
10845 |
+--- a/drivers/remoteproc/qcom_q6v5_adsp.c |
10846 |
++++ b/drivers/remoteproc/qcom_q6v5_adsp.c |
10847 |
+@@ -406,6 +406,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp) |
10848 |
+ } |
10849 |
+ |
10850 |
+ ret = of_address_to_resource(node, 0, &r); |
10851 |
++ of_node_put(node); |
10852 |
+ if (ret) |
10853 |
+ return ret; |
10854 |
+ |
10855 |
+diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c |
10856 |
+index ebc3e755bcbcd..1b3aa84e36e7a 100644 |
10857 |
+--- a/drivers/remoteproc/qcom_q6v5_mss.c |
10858 |
++++ b/drivers/remoteproc/qcom_q6v5_mss.c |
10859 |
+@@ -1594,18 +1594,20 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) |
10860 |
+ * reserved memory regions from device's memory-region property. |
10861 |
+ */ |
10862 |
+ child = of_get_child_by_name(qproc->dev->of_node, "mba"); |
10863 |
+- if (!child) |
10864 |
++ if (!child) { |
10865 |
+ node = of_parse_phandle(qproc->dev->of_node, |
10866 |
+ "memory-region", 0); |
10867 |
+- else |
10868 |
++ } else { |
10869 |
+ node = of_parse_phandle(child, "memory-region", 0); |
10870 |
++ of_node_put(child); |
10871 |
++ } |
10872 |
+ |
10873 |
+ ret = of_address_to_resource(node, 0, &r); |
10874 |
++ of_node_put(node); |
10875 |
+ if (ret) { |
10876 |
+ dev_err(qproc->dev, "unable to resolve mba region\n"); |
10877 |
+ return ret; |
10878 |
+ } |
10879 |
+- of_node_put(node); |
10880 |
+ |
10881 |
+ qproc->mba_phys = r.start; |
10882 |
+ qproc->mba_size = resource_size(&r); |
10883 |
+@@ -1622,14 +1624,15 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) |
10884 |
+ } else { |
10885 |
+ child = of_get_child_by_name(qproc->dev->of_node, "mpss"); |
10886 |
+ node = of_parse_phandle(child, "memory-region", 0); |
10887 |
++ of_node_put(child); |
10888 |
+ } |
10889 |
+ |
10890 |
+ ret = of_address_to_resource(node, 0, &r); |
10891 |
++ of_node_put(node); |
10892 |
+ if (ret) { |
10893 |
+ dev_err(qproc->dev, "unable to resolve mpss region\n"); |
10894 |
+ return ret; |
10895 |
+ } |
10896 |
+- of_node_put(node); |
10897 |
+ |
10898 |
+ qproc->mpss_phys = qproc->mpss_reloc = r.start; |
10899 |
+ qproc->mpss_size = resource_size(&r); |
10900 |
+diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c |
10901 |
+index e2573f79a137d..67286a4505cd1 100644 |
10902 |
+--- a/drivers/remoteproc/qcom_wcnss.c |
10903 |
++++ b/drivers/remoteproc/qcom_wcnss.c |
10904 |
+@@ -448,6 +448,7 @@ static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) |
10905 |
+ } |
10906 |
+ |
10907 |
+ ret = of_address_to_resource(node, 0, &r); |
10908 |
++ of_node_put(node); |
10909 |
+ if (ret) |
10910 |
+ return ret; |
10911 |
+ |
10912 |
+diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c |
10913 |
+index 7e5845376e9fa..e8bb0ee6b35ac 100644 |
10914 |
+--- a/drivers/remoteproc/remoteproc_debugfs.c |
10915 |
++++ b/drivers/remoteproc/remoteproc_debugfs.c |
10916 |
+@@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp, |
10917 |
+ int ret, err = 0; |
10918 |
+ char buf[20]; |
10919 |
+ |
10920 |
+- if (count > sizeof(buf)) |
10921 |
++ if (count < 1 || count > sizeof(buf)) |
10922 |
+ return -EINVAL; |
10923 |
+ |
10924 |
+ ret = copy_from_user(buf, user_buf, count); |
10925 |
+diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c |
10926 |
+index 794a4f036b998..146056858135e 100644 |
10927 |
+--- a/drivers/rtc/interface.c |
10928 |
++++ b/drivers/rtc/interface.c |
10929 |
+@@ -807,9 +807,13 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) |
10930 |
+ struct timerqueue_node *next = timerqueue_getnext(&rtc->timerqueue); |
10931 |
+ struct rtc_time tm; |
10932 |
+ ktime_t now; |
10933 |
++ int err; |
10934 |
++ |
10935 |
++ err = __rtc_read_time(rtc, &tm); |
10936 |
++ if (err) |
10937 |
++ return err; |
10938 |
+ |
10939 |
+ timer->enabled = 1; |
10940 |
+- __rtc_read_time(rtc, &tm); |
10941 |
+ now = rtc_tm_to_ktime(tm); |
10942 |
+ |
10943 |
+ /* Skip over expired timers */ |
10944 |
+@@ -823,7 +827,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) |
10945 |
+ trace_rtc_timer_enqueue(timer); |
10946 |
+ if (!next || ktime_before(timer->node.expires, next->expires)) { |
10947 |
+ struct rtc_wkalrm alarm; |
10948 |
+- int err; |
10949 |
+ |
10950 |
+ alarm.time = rtc_ktime_to_tm(timer->node.expires); |
10951 |
+ alarm.enabled = 1; |
10952 |
+diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c |
10953 |
+index ebe03eba8f5ff..87c93843d62ad 100644 |
10954 |
+--- a/drivers/rtc/rtc-pl030.c |
10955 |
++++ b/drivers/rtc/rtc-pl030.c |
10956 |
+@@ -137,7 +137,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id) |
10957 |
+ return ret; |
10958 |
+ } |
10959 |
+ |
10960 |
+-static int pl030_remove(struct amba_device *dev) |
10961 |
++static void pl030_remove(struct amba_device *dev) |
10962 |
+ { |
10963 |
+ struct pl030_rtc *rtc = amba_get_drvdata(dev); |
10964 |
+ |
10965 |
+@@ -146,8 +146,6 @@ static int pl030_remove(struct amba_device *dev) |
10966 |
+ free_irq(dev->irq[0], rtc); |
10967 |
+ iounmap(rtc->base); |
10968 |
+ amba_release_regions(dev); |
10969 |
+- |
10970 |
+- return 0; |
10971 |
+ } |
10972 |
+ |
10973 |
+ static struct amba_id pl030_ids[] = { |
10974 |
+diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c |
10975 |
+index d4b2ab7861266..2f5581ea26fe1 100644 |
10976 |
+--- a/drivers/rtc/rtc-pl031.c |
10977 |
++++ b/drivers/rtc/rtc-pl031.c |
10978 |
+@@ -280,7 +280,7 @@ static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
10979 |
+ return 0; |
10980 |
+ } |
10981 |
+ |
10982 |
+-static int pl031_remove(struct amba_device *adev) |
10983 |
++static void pl031_remove(struct amba_device *adev) |
10984 |
+ { |
10985 |
+ struct pl031_local *ldata = dev_get_drvdata(&adev->dev); |
10986 |
+ |
10987 |
+@@ -289,8 +289,6 @@ static int pl031_remove(struct amba_device *adev) |
10988 |
+ if (adev->irq[0]) |
10989 |
+ free_irq(adev->irq[0], ldata); |
10990 |
+ amba_release_regions(adev); |
10991 |
+- |
10992 |
+- return 0; |
10993 |
+ } |
10994 |
+ |
10995 |
+ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) |
10996 |
+diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
10997 |
+index 50a1c3478a6e0..a8998b016b862 100644 |
10998 |
+--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
10999 |
++++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
11000 |
+@@ -514,7 +514,7 @@ MODULE_PARM_DESC(intr_conv, "interrupt converge enable (0-1)"); |
11001 |
+ |
11002 |
+ /* permit overriding the host protection capabilities mask (EEDP/T10 PI) */ |
11003 |
+ static int prot_mask; |
11004 |
+-module_param(prot_mask, int, 0); |
11005 |
++module_param(prot_mask, int, 0444); |
11006 |
+ MODULE_PARM_DESC(prot_mask, " host protection capabilities mask, def=0x0 "); |
11007 |
+ |
11008 |
+ static bool auto_affine_msi_experimental; |
11009 |
+diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c |
11010 |
+index 8b9a39077dbab..a1a06a832d866 100644 |
11011 |
+--- a/drivers/scsi/libsas/sas_ata.c |
11012 |
++++ b/drivers/scsi/libsas/sas_ata.c |
11013 |
+@@ -202,7 +202,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) |
11014 |
+ task->total_xfer_len = qc->nbytes; |
11015 |
+ task->num_scatter = qc->n_elem; |
11016 |
+ task->data_dir = qc->dma_dir; |
11017 |
+- } else if (qc->tf.protocol == ATA_PROT_NODATA) { |
11018 |
++ } else if (!ata_is_data(qc->tf.protocol)) { |
11019 |
+ task->data_dir = DMA_NONE; |
11020 |
+ } else { |
11021 |
+ for_each_sg(qc->sg, sg, qc->n_elem, si) |
11022 |
+diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c |
11023 |
+index 9b318958d78cc..cd0e1d31db701 100644 |
11024 |
+--- a/drivers/scsi/pm8001/pm8001_hwi.c |
11025 |
++++ b/drivers/scsi/pm8001/pm8001_hwi.c |
11026 |
+@@ -1727,6 +1727,7 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, |
11027 |
+ ccb->device = pm8001_ha_dev; |
11028 |
+ ccb->ccb_tag = ccb_tag; |
11029 |
+ ccb->task = task; |
11030 |
++ ccb->n_elem = 0; |
11031 |
+ |
11032 |
+ circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
11033 |
+ |
11034 |
+@@ -1788,6 +1789,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, |
11035 |
+ ccb->device = pm8001_ha_dev; |
11036 |
+ ccb->ccb_tag = ccb_tag; |
11037 |
+ ccb->task = task; |
11038 |
++ ccb->n_elem = 0; |
11039 |
+ pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG; |
11040 |
+ pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; |
11041 |
+ |
11042 |
+@@ -1804,7 +1806,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, |
11043 |
+ |
11044 |
+ sata_cmd.tag = cpu_to_le32(ccb_tag); |
11045 |
+ sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); |
11046 |
+- sata_cmd.ncqtag_atap_dir_m |= ((0x1 << 7) | (0x5 << 9)); |
11047 |
++ sata_cmd.ncqtag_atap_dir_m = cpu_to_le32((0x1 << 7) | (0x5 << 9)); |
11048 |
+ memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); |
11049 |
+ |
11050 |
+ res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, |
11051 |
+@@ -2365,7 +2367,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
11052 |
+ len = sizeof(struct pio_setup_fis); |
11053 |
+ pm8001_dbg(pm8001_ha, IO, |
11054 |
+ "PIO read len = %d\n", len); |
11055 |
+- } else if (t->ata_task.use_ncq) { |
11056 |
++ } else if (t->ata_task.use_ncq && |
11057 |
++ t->data_dir != DMA_NONE) { |
11058 |
+ len = sizeof(struct set_dev_bits_fis); |
11059 |
+ pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", |
11060 |
+ len); |
11061 |
+@@ -4220,22 +4223,22 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11062 |
+ u32 opc = OPC_INB_SATA_HOST_OPSTART; |
11063 |
+ memset(&sata_cmd, 0, sizeof(sata_cmd)); |
11064 |
+ circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
11065 |
+- if (task->data_dir == DMA_NONE) { |
11066 |
++ |
11067 |
++ if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { |
11068 |
+ ATAP = 0x04; /* no data*/ |
11069 |
+ pm8001_dbg(pm8001_ha, IO, "no data\n"); |
11070 |
+ } else if (likely(!task->ata_task.device_control_reg_update)) { |
11071 |
+- if (task->ata_task.dma_xfer) { |
11072 |
++ if (task->ata_task.use_ncq && |
11073 |
++ dev->sata_dev.class != ATA_DEV_ATAPI) { |
11074 |
++ ATAP = 0x07; /* FPDMA */ |
11075 |
++ pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); |
11076 |
++ } else if (task->ata_task.dma_xfer) { |
11077 |
+ ATAP = 0x06; /* DMA */ |
11078 |
+ pm8001_dbg(pm8001_ha, IO, "DMA\n"); |
11079 |
+ } else { |
11080 |
+ ATAP = 0x05; /* PIO*/ |
11081 |
+ pm8001_dbg(pm8001_ha, IO, "PIO\n"); |
11082 |
+ } |
11083 |
+- if (task->ata_task.use_ncq && |
11084 |
+- dev->sata_dev.class != ATA_DEV_ATAPI) { |
11085 |
+- ATAP = 0x07; /* FPDMA */ |
11086 |
+- pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); |
11087 |
+- } |
11088 |
+ } |
11089 |
+ if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { |
11090 |
+ task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); |
11091 |
+@@ -4575,7 +4578,7 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha, |
11092 |
+ memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); |
11093 |
+ sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); |
11094 |
+ if (pm8001_ha->chip_id != chip_8001) |
11095 |
+- sspTMCmd.ds_ads_m = 0x08; |
11096 |
++ sspTMCmd.ds_ads_m = cpu_to_le32(0x08); |
11097 |
+ circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
11098 |
+ ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd, |
11099 |
+ sizeof(sspTMCmd), 0); |
11100 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
11101 |
+index 2a3ce4680734b..b5e60553acdc5 100644 |
11102 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.c |
11103 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
11104 |
+@@ -1199,9 +1199,11 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha) |
11105 |
+ else |
11106 |
+ page_code = THERMAL_PAGE_CODE_8H; |
11107 |
+ |
11108 |
+- payload.cfg_pg[0] = (THERMAL_LOG_ENABLE << 9) | |
11109 |
+- (THERMAL_ENABLE << 8) | page_code; |
11110 |
+- payload.cfg_pg[1] = (LTEMPHIL << 24) | (RTEMPHIL << 8); |
11111 |
++ payload.cfg_pg[0] = |
11112 |
++ cpu_to_le32((THERMAL_LOG_ENABLE << 9) | |
11113 |
++ (THERMAL_ENABLE << 8) | page_code); |
11114 |
++ payload.cfg_pg[1] = |
11115 |
++ cpu_to_le32((LTEMPHIL << 24) | (RTEMPHIL << 8)); |
11116 |
+ |
11117 |
+ pm8001_dbg(pm8001_ha, DEV, |
11118 |
+ "Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n", |
11119 |
+@@ -1241,43 +1243,41 @@ pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha) |
11120 |
+ circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
11121 |
+ payload.tag = cpu_to_le32(tag); |
11122 |
+ |
11123 |
+- SASConfigPage.pageCode = SAS_PROTOCOL_TIMER_CONFIG_PAGE; |
11124 |
+- SASConfigPage.MST_MSI = 3 << 15; |
11125 |
+- SASConfigPage.STP_SSP_MCT_TMO = (STP_MCT_TMO << 16) | SSP_MCT_TMO; |
11126 |
+- SASConfigPage.STP_FRM_TMO = (SAS_MAX_OPEN_TIME << 24) | |
11127 |
+- (SMP_MAX_CONN_TIMER << 16) | STP_FRM_TIMER; |
11128 |
+- SASConfigPage.STP_IDLE_TMO = STP_IDLE_TIME; |
11129 |
+- |
11130 |
+- if (SASConfigPage.STP_IDLE_TMO > 0x3FFFFFF) |
11131 |
+- SASConfigPage.STP_IDLE_TMO = 0x3FFFFFF; |
11132 |
+- |
11133 |
+- |
11134 |
+- SASConfigPage.OPNRJT_RTRY_INTVL = (SAS_MFD << 16) | |
11135 |
+- SAS_OPNRJT_RTRY_INTVL; |
11136 |
+- SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (SAS_DOPNRJT_RTRY_TMO << 16) |
11137 |
+- | SAS_COPNRJT_RTRY_TMO; |
11138 |
+- SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (SAS_DOPNRJT_RTRY_THR << 16) |
11139 |
+- | SAS_COPNRJT_RTRY_THR; |
11140 |
+- SASConfigPage.MAX_AIP = SAS_MAX_AIP; |
11141 |
++ SASConfigPage.pageCode = cpu_to_le32(SAS_PROTOCOL_TIMER_CONFIG_PAGE); |
11142 |
++ SASConfigPage.MST_MSI = cpu_to_le32(3 << 15); |
11143 |
++ SASConfigPage.STP_SSP_MCT_TMO = |
11144 |
++ cpu_to_le32((STP_MCT_TMO << 16) | SSP_MCT_TMO); |
11145 |
++ SASConfigPage.STP_FRM_TMO = |
11146 |
++ cpu_to_le32((SAS_MAX_OPEN_TIME << 24) | |
11147 |
++ (SMP_MAX_CONN_TIMER << 16) | STP_FRM_TIMER); |
11148 |
++ SASConfigPage.STP_IDLE_TMO = cpu_to_le32(STP_IDLE_TIME); |
11149 |
++ |
11150 |
++ SASConfigPage.OPNRJT_RTRY_INTVL = |
11151 |
++ cpu_to_le32((SAS_MFD << 16) | SAS_OPNRJT_RTRY_INTVL); |
11152 |
++ SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = |
11153 |
++ cpu_to_le32((SAS_DOPNRJT_RTRY_TMO << 16) | SAS_COPNRJT_RTRY_TMO); |
11154 |
++ SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = |
11155 |
++ cpu_to_le32((SAS_DOPNRJT_RTRY_THR << 16) | SAS_COPNRJT_RTRY_THR); |
11156 |
++ SASConfigPage.MAX_AIP = cpu_to_le32(SAS_MAX_AIP); |
11157 |
+ |
11158 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.pageCode 0x%08x\n", |
11159 |
+- SASConfigPage.pageCode); |
11160 |
++ le32_to_cpu(SASConfigPage.pageCode)); |
11161 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.MST_MSI 0x%08x\n", |
11162 |
+- SASConfigPage.MST_MSI); |
11163 |
++ le32_to_cpu(SASConfigPage.MST_MSI)); |
11164 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n", |
11165 |
+- SASConfigPage.STP_SSP_MCT_TMO); |
11166 |
++ le32_to_cpu(SASConfigPage.STP_SSP_MCT_TMO)); |
11167 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.STP_FRM_TMO 0x%08x\n", |
11168 |
+- SASConfigPage.STP_FRM_TMO); |
11169 |
++ le32_to_cpu(SASConfigPage.STP_FRM_TMO)); |
11170 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.STP_IDLE_TMO 0x%08x\n", |
11171 |
+- SASConfigPage.STP_IDLE_TMO); |
11172 |
++ le32_to_cpu(SASConfigPage.STP_IDLE_TMO)); |
11173 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n", |
11174 |
+- SASConfigPage.OPNRJT_RTRY_INTVL); |
11175 |
++ le32_to_cpu(SASConfigPage.OPNRJT_RTRY_INTVL)); |
11176 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n", |
11177 |
+- SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO); |
11178 |
++ le32_to_cpu(SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO)); |
11179 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n", |
11180 |
+- SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR); |
11181 |
++ le32_to_cpu(SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR)); |
11182 |
+ pm8001_dbg(pm8001_ha, INIT, "SASConfigPage.MAX_AIP 0x%08x\n", |
11183 |
+- SASConfigPage.MAX_AIP); |
11184 |
++ le32_to_cpu(SASConfigPage.MAX_AIP)); |
11185 |
+ |
11186 |
+ memcpy(&payload.cfg_pg, &SASConfigPage, |
11187 |
+ sizeof(SASProtocolTimerConfig_t)); |
11188 |
+@@ -1403,12 +1403,13 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha) |
11189 |
+ /* Currently only one key is used. New KEK index is 1. |
11190 |
+ * Current KEK index is 1. Store KEK to NVRAM is 1. |
11191 |
+ */ |
11192 |
+- payload.new_curidx_ksop = ((1 << 24) | (1 << 16) | (1 << 8) | |
11193 |
+- KEK_MGMT_SUBOP_KEYCARDUPDATE); |
11194 |
++ payload.new_curidx_ksop = |
11195 |
++ cpu_to_le32(((1 << 24) | (1 << 16) | (1 << 8) | |
11196 |
++ KEK_MGMT_SUBOP_KEYCARDUPDATE)); |
11197 |
+ |
11198 |
+ pm8001_dbg(pm8001_ha, DEV, |
11199 |
+ "Saving Encryption info to flash. payload 0x%x\n", |
11200 |
+- payload.new_curidx_ksop); |
11201 |
++ le32_to_cpu(payload.new_curidx_ksop)); |
11202 |
+ |
11203 |
+ rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, |
11204 |
+ sizeof(payload), 0); |
11205 |
+@@ -1749,6 +1750,7 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha, |
11206 |
+ ccb->device = pm8001_ha_dev; |
11207 |
+ ccb->ccb_tag = ccb_tag; |
11208 |
+ ccb->task = task; |
11209 |
++ ccb->n_elem = 0; |
11210 |
+ |
11211 |
+ circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
11212 |
+ |
11213 |
+@@ -1830,7 +1832,7 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, |
11214 |
+ |
11215 |
+ sata_cmd.tag = cpu_to_le32(ccb_tag); |
11216 |
+ sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); |
11217 |
+- sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 << 7) | (0x5 << 9)); |
11218 |
++ sata_cmd.ncqtag_atap_dir_m_dad = cpu_to_le32(((0x1 << 7) | (0x5 << 9))); |
11219 |
+ memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); |
11220 |
+ |
11221 |
+ res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, |
11222 |
+@@ -2464,7 +2466,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
11223 |
+ len = sizeof(struct pio_setup_fis); |
11224 |
+ pm8001_dbg(pm8001_ha, IO, |
11225 |
+ "PIO read len = %d\n", len); |
11226 |
+- } else if (t->ata_task.use_ncq) { |
11227 |
++ } else if (t->ata_task.use_ncq && |
11228 |
++ t->data_dir != DMA_NONE) { |
11229 |
+ len = sizeof(struct set_dev_bits_fis); |
11230 |
+ pm8001_dbg(pm8001_ha, IO, "FPDMA len = %d\n", |
11231 |
+ len); |
11232 |
+@@ -4307,13 +4310,15 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, |
11233 |
+ struct ssp_ini_io_start_req ssp_cmd; |
11234 |
+ u32 tag = ccb->ccb_tag; |
11235 |
+ int ret; |
11236 |
+- u64 phys_addr, start_addr, end_addr; |
11237 |
++ u64 phys_addr, end_addr; |
11238 |
+ u32 end_addr_high, end_addr_low; |
11239 |
+ struct inbound_queue_table *circularQ; |
11240 |
+ u32 q_index, cpu_id; |
11241 |
+ u32 opc = OPC_INB_SSPINIIOSTART; |
11242 |
++ |
11243 |
+ memset(&ssp_cmd, 0, sizeof(ssp_cmd)); |
11244 |
+ memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); |
11245 |
++ |
11246 |
+ /* data address domain added for spcv; set to 0 by host, |
11247 |
+ * used internally by controller |
11248 |
+ * 0 for SAS 1.1 and SAS 2.0 compatible TLR |
11249 |
+@@ -4324,7 +4329,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, |
11250 |
+ ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id); |
11251 |
+ ssp_cmd.tag = cpu_to_le32(tag); |
11252 |
+ if (task->ssp_task.enable_first_burst) |
11253 |
+- ssp_cmd.ssp_iu.efb_prio_attr |= 0x80; |
11254 |
++ ssp_cmd.ssp_iu.efb_prio_attr = 0x80; |
11255 |
+ ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio << 3); |
11256 |
+ ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); |
11257 |
+ memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, |
11258 |
+@@ -4356,21 +4361,24 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, |
11259 |
+ ssp_cmd.enc_esgl = cpu_to_le32(1<<31); |
11260 |
+ } else if (task->num_scatter == 1) { |
11261 |
+ u64 dma_addr = sg_dma_address(task->scatter); |
11262 |
++ |
11263 |
+ ssp_cmd.enc_addr_low = |
11264 |
+ cpu_to_le32(lower_32_bits(dma_addr)); |
11265 |
+ ssp_cmd.enc_addr_high = |
11266 |
+ cpu_to_le32(upper_32_bits(dma_addr)); |
11267 |
+ ssp_cmd.enc_len = cpu_to_le32(task->total_xfer_len); |
11268 |
+ ssp_cmd.enc_esgl = 0; |
11269 |
++ |
11270 |
+ /* Check 4G Boundary */ |
11271 |
+- start_addr = cpu_to_le64(dma_addr); |
11272 |
+- end_addr = (start_addr + ssp_cmd.enc_len) - 1; |
11273 |
+- end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); |
11274 |
+- end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); |
11275 |
+- if (end_addr_high != ssp_cmd.enc_addr_high) { |
11276 |
++ end_addr = dma_addr + le32_to_cpu(ssp_cmd.enc_len) - 1; |
11277 |
++ end_addr_low = lower_32_bits(end_addr); |
11278 |
++ end_addr_high = upper_32_bits(end_addr); |
11279 |
++ |
11280 |
++ if (end_addr_high != le32_to_cpu(ssp_cmd.enc_addr_high)) { |
11281 |
+ pm8001_dbg(pm8001_ha, FAIL, |
11282 |
+ "The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", |
11283 |
+- start_addr, ssp_cmd.enc_len, |
11284 |
++ dma_addr, |
11285 |
++ le32_to_cpu(ssp_cmd.enc_len), |
11286 |
+ end_addr_high, end_addr_low); |
11287 |
+ pm8001_chip_make_sg(task->scatter, 1, |
11288 |
+ ccb->buf_prd); |
11289 |
+@@ -4379,7 +4387,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, |
11290 |
+ cpu_to_le32(lower_32_bits(phys_addr)); |
11291 |
+ ssp_cmd.enc_addr_high = |
11292 |
+ cpu_to_le32(upper_32_bits(phys_addr)); |
11293 |
+- ssp_cmd.enc_esgl = cpu_to_le32(1<<31); |
11294 |
++ ssp_cmd.enc_esgl = cpu_to_le32(1U<<31); |
11295 |
+ } |
11296 |
+ } else if (task->num_scatter == 0) { |
11297 |
+ ssp_cmd.enc_addr_low = 0; |
11298 |
+@@ -4387,8 +4395,10 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, |
11299 |
+ ssp_cmd.enc_len = cpu_to_le32(task->total_xfer_len); |
11300 |
+ ssp_cmd.enc_esgl = 0; |
11301 |
+ } |
11302 |
++ |
11303 |
+ /* XTS mode. All other fields are 0 */ |
11304 |
+- ssp_cmd.key_cmode = 0x6 << 4; |
11305 |
++ ssp_cmd.key_cmode = cpu_to_le32(0x6 << 4); |
11306 |
++ |
11307 |
+ /* set tweak values. Should be the start lba */ |
11308 |
+ ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | |
11309 |
+ (task->ssp_task.cmd->cmnd[3] << 16) | |
11310 |
+@@ -4410,20 +4420,22 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, |
11311 |
+ ssp_cmd.esgl = cpu_to_le32(1<<31); |
11312 |
+ } else if (task->num_scatter == 1) { |
11313 |
+ u64 dma_addr = sg_dma_address(task->scatter); |
11314 |
++ |
11315 |
+ ssp_cmd.addr_low = cpu_to_le32(lower_32_bits(dma_addr)); |
11316 |
+ ssp_cmd.addr_high = |
11317 |
+ cpu_to_le32(upper_32_bits(dma_addr)); |
11318 |
+ ssp_cmd.len = cpu_to_le32(task->total_xfer_len); |
11319 |
+ ssp_cmd.esgl = 0; |
11320 |
++ |
11321 |
+ /* Check 4G Boundary */ |
11322 |
+- start_addr = cpu_to_le64(dma_addr); |
11323 |
+- end_addr = (start_addr + ssp_cmd.len) - 1; |
11324 |
+- end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); |
11325 |
+- end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); |
11326 |
+- if (end_addr_high != ssp_cmd.addr_high) { |
11327 |
++ end_addr = dma_addr + le32_to_cpu(ssp_cmd.len) - 1; |
11328 |
++ end_addr_low = lower_32_bits(end_addr); |
11329 |
++ end_addr_high = upper_32_bits(end_addr); |
11330 |
++ if (end_addr_high != le32_to_cpu(ssp_cmd.addr_high)) { |
11331 |
+ pm8001_dbg(pm8001_ha, FAIL, |
11332 |
+ "The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", |
11333 |
+- start_addr, ssp_cmd.len, |
11334 |
++ dma_addr, |
11335 |
++ le32_to_cpu(ssp_cmd.len), |
11336 |
+ end_addr_high, end_addr_low); |
11337 |
+ pm8001_chip_make_sg(task->scatter, 1, |
11338 |
+ ccb->buf_prd); |
11339 |
+@@ -4457,7 +4469,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11340 |
+ u32 q_index, cpu_id; |
11341 |
+ struct sata_start_req sata_cmd; |
11342 |
+ u32 hdr_tag, ncg_tag = 0; |
11343 |
+- u64 phys_addr, start_addr, end_addr; |
11344 |
++ u64 phys_addr, end_addr; |
11345 |
+ u32 end_addr_high, end_addr_low; |
11346 |
+ u32 ATAP = 0x0; |
11347 |
+ u32 dir; |
11348 |
+@@ -4469,22 +4481,21 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11349 |
+ q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); |
11350 |
+ circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; |
11351 |
+ |
11352 |
+- if (task->data_dir == DMA_NONE) { |
11353 |
++ if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { |
11354 |
+ ATAP = 0x04; /* no data*/ |
11355 |
+ pm8001_dbg(pm8001_ha, IO, "no data\n"); |
11356 |
+ } else if (likely(!task->ata_task.device_control_reg_update)) { |
11357 |
+- if (task->ata_task.dma_xfer) { |
11358 |
++ if (task->ata_task.use_ncq && |
11359 |
++ dev->sata_dev.class != ATA_DEV_ATAPI) { |
11360 |
++ ATAP = 0x07; /* FPDMA */ |
11361 |
++ pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); |
11362 |
++ } else if (task->ata_task.dma_xfer) { |
11363 |
+ ATAP = 0x06; /* DMA */ |
11364 |
+ pm8001_dbg(pm8001_ha, IO, "DMA\n"); |
11365 |
+ } else { |
11366 |
+ ATAP = 0x05; /* PIO*/ |
11367 |
+ pm8001_dbg(pm8001_ha, IO, "PIO\n"); |
11368 |
+ } |
11369 |
+- if (task->ata_task.use_ncq && |
11370 |
+- dev->sata_dev.class != ATA_DEV_ATAPI) { |
11371 |
+- ATAP = 0x07; /* FPDMA */ |
11372 |
+- pm8001_dbg(pm8001_ha, IO, "FPDMA\n"); |
11373 |
+- } |
11374 |
+ } |
11375 |
+ if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { |
11376 |
+ task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); |
11377 |
+@@ -4518,32 +4529,38 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11378 |
+ pm8001_chip_make_sg(task->scatter, |
11379 |
+ ccb->n_elem, ccb->buf_prd); |
11380 |
+ phys_addr = ccb->ccb_dma_handle; |
11381 |
+- sata_cmd.enc_addr_low = lower_32_bits(phys_addr); |
11382 |
+- sata_cmd.enc_addr_high = upper_32_bits(phys_addr); |
11383 |
++ sata_cmd.enc_addr_low = |
11384 |
++ cpu_to_le32(lower_32_bits(phys_addr)); |
11385 |
++ sata_cmd.enc_addr_high = |
11386 |
++ cpu_to_le32(upper_32_bits(phys_addr)); |
11387 |
+ sata_cmd.enc_esgl = cpu_to_le32(1 << 31); |
11388 |
+ } else if (task->num_scatter == 1) { |
11389 |
+ u64 dma_addr = sg_dma_address(task->scatter); |
11390 |
+- sata_cmd.enc_addr_low = lower_32_bits(dma_addr); |
11391 |
+- sata_cmd.enc_addr_high = upper_32_bits(dma_addr); |
11392 |
++ |
11393 |
++ sata_cmd.enc_addr_low = |
11394 |
++ cpu_to_le32(lower_32_bits(dma_addr)); |
11395 |
++ sata_cmd.enc_addr_high = |
11396 |
++ cpu_to_le32(upper_32_bits(dma_addr)); |
11397 |
+ sata_cmd.enc_len = cpu_to_le32(task->total_xfer_len); |
11398 |
+ sata_cmd.enc_esgl = 0; |
11399 |
++ |
11400 |
+ /* Check 4G Boundary */ |
11401 |
+- start_addr = cpu_to_le64(dma_addr); |
11402 |
+- end_addr = (start_addr + sata_cmd.enc_len) - 1; |
11403 |
+- end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); |
11404 |
+- end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); |
11405 |
+- if (end_addr_high != sata_cmd.enc_addr_high) { |
11406 |
++ end_addr = dma_addr + le32_to_cpu(sata_cmd.enc_len) - 1; |
11407 |
++ end_addr_low = lower_32_bits(end_addr); |
11408 |
++ end_addr_high = upper_32_bits(end_addr); |
11409 |
++ if (end_addr_high != le32_to_cpu(sata_cmd.enc_addr_high)) { |
11410 |
+ pm8001_dbg(pm8001_ha, FAIL, |
11411 |
+ "The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", |
11412 |
+- start_addr, sata_cmd.enc_len, |
11413 |
++ dma_addr, |
11414 |
++ le32_to_cpu(sata_cmd.enc_len), |
11415 |
+ end_addr_high, end_addr_low); |
11416 |
+ pm8001_chip_make_sg(task->scatter, 1, |
11417 |
+ ccb->buf_prd); |
11418 |
+ phys_addr = ccb->ccb_dma_handle; |
11419 |
+ sata_cmd.enc_addr_low = |
11420 |
+- lower_32_bits(phys_addr); |
11421 |
++ cpu_to_le32(lower_32_bits(phys_addr)); |
11422 |
+ sata_cmd.enc_addr_high = |
11423 |
+- upper_32_bits(phys_addr); |
11424 |
++ cpu_to_le32(upper_32_bits(phys_addr)); |
11425 |
+ sata_cmd.enc_esgl = |
11426 |
+ cpu_to_le32(1 << 31); |
11427 |
+ } |
11428 |
+@@ -4554,7 +4571,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11429 |
+ sata_cmd.enc_esgl = 0; |
11430 |
+ } |
11431 |
+ /* XTS mode. All other fields are 0 */ |
11432 |
+- sata_cmd.key_index_mode = 0x6 << 4; |
11433 |
++ sata_cmd.key_index_mode = cpu_to_le32(0x6 << 4); |
11434 |
++ |
11435 |
+ /* set tweak values. Should be the start lba */ |
11436 |
+ sata_cmd.twk_val0 = |
11437 |
+ cpu_to_le32((sata_cmd.sata_fis.lbal_exp << 24) | |
11438 |
+@@ -4580,31 +4598,31 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11439 |
+ phys_addr = ccb->ccb_dma_handle; |
11440 |
+ sata_cmd.addr_low = lower_32_bits(phys_addr); |
11441 |
+ sata_cmd.addr_high = upper_32_bits(phys_addr); |
11442 |
+- sata_cmd.esgl = cpu_to_le32(1 << 31); |
11443 |
++ sata_cmd.esgl = cpu_to_le32(1U << 31); |
11444 |
+ } else if (task->num_scatter == 1) { |
11445 |
+ u64 dma_addr = sg_dma_address(task->scatter); |
11446 |
++ |
11447 |
+ sata_cmd.addr_low = lower_32_bits(dma_addr); |
11448 |
+ sata_cmd.addr_high = upper_32_bits(dma_addr); |
11449 |
+ sata_cmd.len = cpu_to_le32(task->total_xfer_len); |
11450 |
+ sata_cmd.esgl = 0; |
11451 |
++ |
11452 |
+ /* Check 4G Boundary */ |
11453 |
+- start_addr = cpu_to_le64(dma_addr); |
11454 |
+- end_addr = (start_addr + sata_cmd.len) - 1; |
11455 |
+- end_addr_low = cpu_to_le32(lower_32_bits(end_addr)); |
11456 |
+- end_addr_high = cpu_to_le32(upper_32_bits(end_addr)); |
11457 |
++ end_addr = dma_addr + le32_to_cpu(sata_cmd.len) - 1; |
11458 |
++ end_addr_low = lower_32_bits(end_addr); |
11459 |
++ end_addr_high = upper_32_bits(end_addr); |
11460 |
+ if (end_addr_high != sata_cmd.addr_high) { |
11461 |
+ pm8001_dbg(pm8001_ha, FAIL, |
11462 |
+ "The sg list address start_addr=0x%016llx data_len=0x%xend_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n", |
11463 |
+- start_addr, sata_cmd.len, |
11464 |
++ dma_addr, |
11465 |
++ le32_to_cpu(sata_cmd.len), |
11466 |
+ end_addr_high, end_addr_low); |
11467 |
+ pm8001_chip_make_sg(task->scatter, 1, |
11468 |
+ ccb->buf_prd); |
11469 |
+ phys_addr = ccb->ccb_dma_handle; |
11470 |
+- sata_cmd.addr_low = |
11471 |
+- lower_32_bits(phys_addr); |
11472 |
+- sata_cmd.addr_high = |
11473 |
+- upper_32_bits(phys_addr); |
11474 |
+- sata_cmd.esgl = cpu_to_le32(1 << 31); |
11475 |
++ sata_cmd.addr_low = lower_32_bits(phys_addr); |
11476 |
++ sata_cmd.addr_high = upper_32_bits(phys_addr); |
11477 |
++ sata_cmd.esgl = cpu_to_le32(1U << 31); |
11478 |
+ } |
11479 |
+ } else if (task->num_scatter == 0) { |
11480 |
+ sata_cmd.addr_low = 0; |
11481 |
+@@ -4612,27 +4630,28 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
11482 |
+ sata_cmd.len = cpu_to_le32(task->total_xfer_len); |
11483 |
+ sata_cmd.esgl = 0; |
11484 |
+ } |
11485 |
++ |
11486 |
+ /* scsi cdb */ |
11487 |
+ sata_cmd.atapi_scsi_cdb[0] = |
11488 |
+ cpu_to_le32(((task->ata_task.atapi_packet[0]) | |
11489 |
+- (task->ata_task.atapi_packet[1] << 8) | |
11490 |
+- (task->ata_task.atapi_packet[2] << 16) | |
11491 |
+- (task->ata_task.atapi_packet[3] << 24))); |
11492 |
++ (task->ata_task.atapi_packet[1] << 8) | |
11493 |
++ (task->ata_task.atapi_packet[2] << 16) | |
11494 |
++ (task->ata_task.atapi_packet[3] << 24))); |
11495 |
+ sata_cmd.atapi_scsi_cdb[1] = |
11496 |
+ cpu_to_le32(((task->ata_task.atapi_packet[4]) | |
11497 |
+- (task->ata_task.atapi_packet[5] << 8) | |
11498 |
+- (task->ata_task.atapi_packet[6] << 16) | |
11499 |
+- (task->ata_task.atapi_packet[7] << 24))); |
11500 |
++ (task->ata_task.atapi_packet[5] << 8) | |
11501 |
++ (task->ata_task.atapi_packet[6] << 16) | |
11502 |
++ (task->ata_task.atapi_packet[7] << 24))); |
11503 |
+ sata_cmd.atapi_scsi_cdb[2] = |
11504 |
+ cpu_to_le32(((task->ata_task.atapi_packet[8]) | |
11505 |
+- (task->ata_task.atapi_packet[9] << 8) | |
11506 |
+- (task->ata_task.atapi_packet[10] << 16) | |
11507 |
+- (task->ata_task.atapi_packet[11] << 24))); |
11508 |
++ (task->ata_task.atapi_packet[9] << 8) | |
11509 |
++ (task->ata_task.atapi_packet[10] << 16) | |
11510 |
++ (task->ata_task.atapi_packet[11] << 24))); |
11511 |
+ sata_cmd.atapi_scsi_cdb[3] = |
11512 |
+ cpu_to_le32(((task->ata_task.atapi_packet[12]) | |
11513 |
+- (task->ata_task.atapi_packet[13] << 8) | |
11514 |
+- (task->ata_task.atapi_packet[14] << 16) | |
11515 |
+- (task->ata_task.atapi_packet[15] << 24))); |
11516 |
++ (task->ata_task.atapi_packet[13] << 8) | |
11517 |
++ (task->ata_task.atapi_packet[14] << 16) | |
11518 |
++ (task->ata_task.atapi_packet[15] << 24))); |
11519 |
+ } |
11520 |
+ |
11521 |
+ /* Check for read log for failed drive and return */ |
11522 |
+diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c |
11523 |
+index e40a37236aa10..d0407f44de78d 100644 |
11524 |
+--- a/drivers/scsi/qla2xxx/qla_attr.c |
11525 |
++++ b/drivers/scsi/qla2xxx/qla_attr.c |
11526 |
+@@ -555,7 +555,7 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj, |
11527 |
+ if (!capable(CAP_SYS_ADMIN)) |
11528 |
+ return -EINVAL; |
11529 |
+ |
11530 |
+- if (IS_NOCACHE_VPD_TYPE(ha)) |
11531 |
++ if (!IS_NOCACHE_VPD_TYPE(ha)) |
11532 |
+ goto skip; |
11533 |
+ |
11534 |
+ faddr = ha->flt_region_vpd << 2; |
11535 |
+@@ -739,7 +739,7 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, |
11536 |
+ ql_log(ql_log_info, vha, 0x706f, |
11537 |
+ "Issuing MPI reset.\n"); |
11538 |
+ |
11539 |
+- if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { |
11540 |
++ if (IS_QLA83XX(ha)) { |
11541 |
+ uint32_t idc_control; |
11542 |
+ |
11543 |
+ qla83xx_idc_lock(vha, 0); |
11544 |
+@@ -1050,9 +1050,6 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon) |
11545 |
+ continue; |
11546 |
+ if (iter->type == 3 && !(IS_CNA_CAPABLE(ha))) |
11547 |
+ continue; |
11548 |
+- if (iter->type == 0x27 && |
11549 |
+- (!IS_QLA27XX(ha) || !IS_QLA28XX(ha))) |
11550 |
+- continue; |
11551 |
+ |
11552 |
+ sysfs_remove_bin_file(&host->shost_gendev.kobj, |
11553 |
+ iter->attr); |
11554 |
+diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h |
11555 |
+index e1fd91a581202..8a8e0920d2b41 100644 |
11556 |
+--- a/drivers/scsi/qla2xxx/qla_def.h |
11557 |
++++ b/drivers/scsi/qla2xxx/qla_def.h |
11558 |
+@@ -2796,7 +2796,11 @@ struct ct_fdmi2_hba_attributes { |
11559 |
+ #define FDMI_PORT_SPEED_8GB 0x10 |
11560 |
+ #define FDMI_PORT_SPEED_16GB 0x20 |
11561 |
+ #define FDMI_PORT_SPEED_32GB 0x40 |
11562 |
+-#define FDMI_PORT_SPEED_64GB 0x80 |
11563 |
++#define FDMI_PORT_SPEED_20GB 0x80 |
11564 |
++#define FDMI_PORT_SPEED_40GB 0x100 |
11565 |
++#define FDMI_PORT_SPEED_128GB 0x200 |
11566 |
++#define FDMI_PORT_SPEED_64GB 0x400 |
11567 |
++#define FDMI_PORT_SPEED_256GB 0x800 |
11568 |
+ #define FDMI_PORT_SPEED_UNKNOWN 0x8000 |
11569 |
+ |
11570 |
+ #define FC_CLASS_2 0x04 |
11571 |
+@@ -5171,4 +5175,8 @@ struct sff_8247_a0 { |
11572 |
+ #include "qla_gbl.h" |
11573 |
+ #include "qla_dbg.h" |
11574 |
+ #include "qla_inline.h" |
11575 |
++ |
11576 |
++#define IS_SESSION_DELETED(_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \ |
11577 |
++ _fcport->disc_state == DSC_DELETED) |
11578 |
++ |
11579 |
+ #endif |
11580 |
+diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c |
11581 |
+index e28c4b7ec55ff..73015c69b5e89 100644 |
11582 |
+--- a/drivers/scsi/qla2xxx/qla_gs.c |
11583 |
++++ b/drivers/scsi/qla2xxx/qla_gs.c |
11584 |
+@@ -676,8 +676,7 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) |
11585 |
+ return (QLA_SUCCESS); |
11586 |
+ } |
11587 |
+ |
11588 |
+- return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), |
11589 |
+- FC4_TYPE_FCP_SCSI); |
11590 |
++ return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), type); |
11591 |
+ } |
11592 |
+ |
11593 |
+ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, |
11594 |
+@@ -727,7 +726,7 @@ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, |
11595 |
+ /* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */ |
11596 |
+ ct_req->req.rff_id.port_id = port_id_to_be_id(*d_id); |
11597 |
+ ct_req->req.rff_id.fc4_feature = fc4feature; |
11598 |
+- ct_req->req.rff_id.fc4_type = fc4type; /* SCSI - FCP */ |
11599 |
++ ct_req->req.rff_id.fc4_type = fc4type; /* SCSI-FCP or FC-NVMe */ |
11600 |
+ |
11601 |
+ sp->u.iocb_cmd.u.ctarg.req_size = RFF_ID_REQ_SIZE; |
11602 |
+ sp->u.iocb_cmd.u.ctarg.rsp_size = RFF_ID_RSP_SIZE; |
11603 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
11604 |
+index fdae25ec554d9..9452848ede3f8 100644 |
11605 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
11606 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
11607 |
+@@ -570,6 +570,14 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, |
11608 |
+ struct srb_iocb *lio; |
11609 |
+ int rval = QLA_FUNCTION_FAILED; |
11610 |
+ |
11611 |
++ if (IS_SESSION_DELETED(fcport)) { |
11612 |
++ ql_log(ql_log_warn, vha, 0xffff, |
11613 |
++ "%s: %8phC is being delete - not sending command.\n", |
11614 |
++ __func__, fcport->port_name); |
11615 |
++ fcport->flags &= ~FCF_ASYNC_ACTIVE; |
11616 |
++ return rval; |
11617 |
++ } |
11618 |
++ |
11619 |
+ if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) |
11620 |
+ return rval; |
11621 |
+ |
11622 |
+@@ -953,6 +961,9 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, |
11623 |
+ set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
11624 |
+ } |
11625 |
+ break; |
11626 |
++ case ISP_CFG_NL: |
11627 |
++ qla24xx_fcport_handle_login(vha, fcport); |
11628 |
++ break; |
11629 |
+ default: |
11630 |
+ break; |
11631 |
+ } |
11632 |
+@@ -1313,14 +1324,21 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) |
11633 |
+ struct port_database_24xx *pd; |
11634 |
+ struct qla_hw_data *ha = vha->hw; |
11635 |
+ |
11636 |
+- if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) || |
11637 |
+- fcport->loop_id == FC_NO_LOOP_ID) { |
11638 |
++ if (IS_SESSION_DELETED(fcport)) { |
11639 |
+ ql_log(ql_log_warn, vha, 0xffff, |
11640 |
+- "%s: %8phC - not sending command.\n", |
11641 |
+- __func__, fcport->port_name); |
11642 |
++ "%s: %8phC is being delete - not sending command.\n", |
11643 |
++ __func__, fcport->port_name); |
11644 |
++ fcport->flags &= ~FCF_ASYNC_ACTIVE; |
11645 |
+ return rval; |
11646 |
+ } |
11647 |
+ |
11648 |
++ if (!vha->flags.online || fcport->flags & FCF_ASYNC_SENT) { |
11649 |
++ ql_log(ql_log_warn, vha, 0xffff, |
11650 |
++ "%s: %8phC online %d flags %x - not sending command.\n", |
11651 |
++ __func__, fcport->port_name, vha->flags.online, fcport->flags); |
11652 |
++ goto done; |
11653 |
++ } |
11654 |
++ |
11655 |
+ sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); |
11656 |
+ if (!sp) |
11657 |
+ goto done; |
11658 |
+@@ -1480,6 +1498,11 @@ static void qla_chk_n2n_b4_login(struct scsi_qla_host *vha, fc_port_t *fcport) |
11659 |
+ u8 login = 0; |
11660 |
+ int rc; |
11661 |
+ |
11662 |
++ ql_dbg(ql_dbg_disc, vha, 0x307b, |
11663 |
++ "%s %8phC DS %d LS %d lid %d retries=%d\n", |
11664 |
++ __func__, fcport->port_name, fcport->disc_state, |
11665 |
++ fcport->fw_login_state, fcport->loop_id, fcport->login_retry); |
11666 |
++ |
11667 |
+ if (qla_tgt_mode_enabled(vha)) |
11668 |
+ return; |
11669 |
+ |
11670 |
+@@ -1537,7 +1560,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) |
11671 |
+ fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen, |
11672 |
+ fcport->login_gen, fcport->loop_id, fcport->scan_state); |
11673 |
+ |
11674 |
+- if (fcport->scan_state != QLA_FCPORT_FOUND) |
11675 |
++ if (fcport->scan_state != QLA_FCPORT_FOUND || |
11676 |
++ fcport->disc_state == DSC_DELETE_PEND) |
11677 |
+ return 0; |
11678 |
+ |
11679 |
+ if ((fcport->loop_id != FC_NO_LOOP_ID) && |
11680 |
+@@ -1558,7 +1582,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) |
11681 |
+ if (vha->host->active_mode == MODE_TARGET && !N2N_TOPO(vha->hw)) |
11682 |
+ return 0; |
11683 |
+ |
11684 |
+- if (fcport->flags & FCF_ASYNC_SENT) { |
11685 |
++ if (fcport->flags & (FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE)) { |
11686 |
+ set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
11687 |
+ return 0; |
11688 |
+ } |
11689 |
+@@ -2114,12 +2138,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) |
11690 |
+ ql_dbg(ql_dbg_disc, vha, 0x20eb, "%s %d %8phC cmd error %x\n", |
11691 |
+ __func__, __LINE__, ea->fcport->port_name, ea->data[1]); |
11692 |
+ |
11693 |
+- ea->fcport->flags &= ~FCF_ASYNC_SENT; |
11694 |
+- qla2x00_set_fcport_disc_state(ea->fcport, DSC_LOGIN_FAILED); |
11695 |
+- if (ea->data[1] & QLA_LOGIO_LOGIN_RETRIED) |
11696 |
+- set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
11697 |
+- else |
11698 |
+- qla2x00_mark_device_lost(vha, ea->fcport, 1); |
11699 |
++ qlt_schedule_sess_for_deletion(ea->fcport); |
11700 |
+ break; |
11701 |
+ case MBS_LOOP_ID_USED: |
11702 |
+ /* data[1] = IO PARAM 1 = nport ID */ |
11703 |
+@@ -3309,6 +3328,14 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
11704 |
+ struct rsp_que *rsp = ha->rsp_q_map[0]; |
11705 |
+ struct qla2xxx_fw_dump *fw_dump; |
11706 |
+ |
11707 |
++ if (ha->fw_dump) { |
11708 |
++ ql_dbg(ql_dbg_init, vha, 0x00bd, |
11709 |
++ "Firmware dump already allocated.\n"); |
11710 |
++ return; |
11711 |
++ } |
11712 |
++ |
11713 |
++ ha->fw_dumped = 0; |
11714 |
++ ha->fw_dump_cap_flags = 0; |
11715 |
+ dump_size = fixed_size = mem_size = eft_size = fce_size = mq_size = 0; |
11716 |
+ req_q_size = rsp_q_size = 0; |
11717 |
+ |
11718 |
+@@ -3319,7 +3346,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
11719 |
+ mem_size = (ha->fw_memory_size - 0x11000 + 1) * |
11720 |
+ sizeof(uint16_t); |
11721 |
+ } else if (IS_FWI2_CAPABLE(ha)) { |
11722 |
+- if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
11723 |
++ if (IS_QLA83XX(ha)) |
11724 |
+ fixed_size = offsetof(struct qla83xx_fw_dump, ext_mem); |
11725 |
+ else if (IS_QLA81XX(ha)) |
11726 |
+ fixed_size = offsetof(struct qla81xx_fw_dump, ext_mem); |
11727 |
+@@ -3331,8 +3358,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
11728 |
+ mem_size = (ha->fw_memory_size - 0x100000 + 1) * |
11729 |
+ sizeof(uint32_t); |
11730 |
+ if (ha->mqenable) { |
11731 |
+- if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha) && |
11732 |
+- !IS_QLA28XX(ha)) |
11733 |
++ if (!IS_QLA83XX(ha)) |
11734 |
+ mq_size = sizeof(struct qla2xxx_mq_chain); |
11735 |
+ /* |
11736 |
+ * Allocate maximum buffer size for all queues - Q0. |
11737 |
+@@ -3893,8 +3919,7 @@ enable_82xx_npiv: |
11738 |
+ ha->fw_major_version, ha->fw_minor_version, |
11739 |
+ ha->fw_subminor_version); |
11740 |
+ |
11741 |
+- if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || |
11742 |
+- IS_QLA28XX(ha)) { |
11743 |
++ if (IS_QLA83XX(ha)) { |
11744 |
+ ha->flags.fac_supported = 0; |
11745 |
+ rval = QLA_SUCCESS; |
11746 |
+ } |
11747 |
+@@ -5382,6 +5407,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) |
11748 |
+ memcpy(fcport->node_name, new_fcport->node_name, |
11749 |
+ WWN_SIZE); |
11750 |
+ fcport->scan_state = QLA_FCPORT_FOUND; |
11751 |
++ if (fcport->login_retry == 0) { |
11752 |
++ fcport->login_retry = vha->hw->login_retry_count; |
11753 |
++ ql_dbg(ql_dbg_disc, vha, 0x2135, |
11754 |
++ "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n", |
11755 |
++ fcport->port_name, fcport->loop_id, |
11756 |
++ fcport->login_retry); |
11757 |
++ } |
11758 |
+ found++; |
11759 |
+ break; |
11760 |
+ } |
11761 |
+@@ -5515,6 +5547,8 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) |
11762 |
+ if (atomic_read(&fcport->state) == FCS_ONLINE) |
11763 |
+ return; |
11764 |
+ |
11765 |
++ qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
11766 |
++ |
11767 |
+ rport_ids.node_name = wwn_to_u64(fcport->node_name); |
11768 |
+ rport_ids.port_name = wwn_to_u64(fcport->port_name); |
11769 |
+ rport_ids.port_id = fcport->d_id.b.domain << 16 | |
11770 |
+@@ -5615,6 +5649,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) |
11771 |
+ qla2x00_reg_remote_port(vha, fcport); |
11772 |
+ break; |
11773 |
+ case MODE_TARGET: |
11774 |
++ qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
11775 |
+ if (!vha->vha_tgt.qla_tgt->tgt_stop && |
11776 |
+ !vha->vha_tgt.qla_tgt->tgt_stopped) |
11777 |
+ qlt_fc_port_added(vha, fcport); |
11778 |
+@@ -5629,8 +5664,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) |
11779 |
+ break; |
11780 |
+ } |
11781 |
+ |
11782 |
+- qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
11783 |
+- |
11784 |
+ if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { |
11785 |
+ if (fcport->id_changed) { |
11786 |
+ fcport->id_changed = 0; |
11787 |
+@@ -9127,7 +9160,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, |
11788 |
+ qpair->rsp->req = qpair->req; |
11789 |
+ qpair->rsp->qpair = qpair; |
11790 |
+ /* init qpair to this cpu. Will adjust at run time. */ |
11791 |
+- qla_cpu_update(qpair, smp_processor_id()); |
11792 |
++ qla_cpu_update(qpair, raw_smp_processor_id()); |
11793 |
+ |
11794 |
+ if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { |
11795 |
+ if (ha->fw_attributes & BIT_4) |
11796 |
+diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c |
11797 |
+index c532c74ca1ab9..e54cc2a761dd4 100644 |
11798 |
+--- a/drivers/scsi/qla2xxx/qla_iocb.c |
11799 |
++++ b/drivers/scsi/qla2xxx/qla_iocb.c |
11800 |
+@@ -2910,6 +2910,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) |
11801 |
+ set_bit(ISP_ABORT_NEEDED, |
11802 |
+ &vha->dpc_flags); |
11803 |
+ qla2xxx_wake_dpc(vha); |
11804 |
++ break; |
11805 |
+ } |
11806 |
+ fallthrough; |
11807 |
+ default: |
11808 |
+@@ -2919,9 +2920,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) |
11809 |
+ fw_status[0], fw_status[1], fw_status[2]); |
11810 |
+ |
11811 |
+ fcport->flags &= ~FCF_ASYNC_SENT; |
11812 |
+- qla2x00_set_fcport_disc_state(fcport, |
11813 |
+- DSC_LOGIN_FAILED); |
11814 |
+- set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
11815 |
++ qlt_schedule_sess_for_deletion(fcport); |
11816 |
+ break; |
11817 |
+ } |
11818 |
+ break; |
11819 |
+@@ -2933,8 +2932,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) |
11820 |
+ fw_status[0], fw_status[1], fw_status[2]); |
11821 |
+ |
11822 |
+ sp->fcport->flags &= ~FCF_ASYNC_SENT; |
11823 |
+- qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_FAILED); |
11824 |
+- set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
11825 |
++ qlt_schedule_sess_for_deletion(fcport); |
11826 |
+ break; |
11827 |
+ } |
11828 |
+ |
11829 |
+diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
11830 |
+index 5e040b6debc84..c5c7d60ab2524 100644 |
11831 |
+--- a/drivers/scsi/qla2xxx/qla_isr.c |
11832 |
++++ b/drivers/scsi/qla2xxx/qla_isr.c |
11833 |
+@@ -2248,6 +2248,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk) |
11834 |
+ iocb->u.tmf.data = QLA_FUNCTION_FAILED; |
11835 |
+ } else if ((le16_to_cpu(sts->scsi_status) & |
11836 |
+ SS_RESPONSE_INFO_LEN_VALID)) { |
11837 |
++ host_to_fcp_swap(sts->data, sizeof(sts->data)); |
11838 |
+ if (le32_to_cpu(sts->rsp_data_len) < 4) { |
11839 |
+ ql_log(ql_log_warn, fcport->vha, 0x503b, |
11840 |
+ "Async-%s error - hdl=%x not enough response(%d).\n", |
11841 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
11842 |
+index 734745f450211..bbb57edc1f662 100644 |
11843 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
11844 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
11845 |
+@@ -9,6 +9,12 @@ |
11846 |
+ #include <linux/delay.h> |
11847 |
+ #include <linux/gfp.h> |
11848 |
+ |
11849 |
++#ifdef CONFIG_PPC |
11850 |
++#define IS_PPCARCH true |
11851 |
++#else |
11852 |
++#define IS_PPCARCH false |
11853 |
++#endif |
11854 |
++ |
11855 |
+ static struct mb_cmd_name { |
11856 |
+ uint16_t cmd; |
11857 |
+ const char *str; |
11858 |
+@@ -698,6 +704,9 @@ again: |
11859 |
+ vha->min_supported_speed = |
11860 |
+ nv->min_supported_speed; |
11861 |
+ } |
11862 |
++ |
11863 |
++ if (IS_PPCARCH) |
11864 |
++ mcp->mb[11] |= BIT_4; |
11865 |
+ } |
11866 |
+ |
11867 |
+ if (ha->flags.exlogins_enabled) |
11868 |
+@@ -2984,8 +2993,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha) |
11869 |
+ ha->orig_fw_iocb_count = mcp->mb[10]; |
11870 |
+ if (ha->flags.npiv_supported) |
11871 |
+ ha->max_npiv_vports = mcp->mb[11]; |
11872 |
+- if (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha) || |
11873 |
+- IS_QLA28XX(ha)) |
11874 |
++ if (IS_QLA81XX(ha) || IS_QLA83XX(ha)) |
11875 |
+ ha->fw_max_fcf_count = mcp->mb[12]; |
11876 |
+ } |
11877 |
+ |
11878 |
+@@ -5546,7 +5554,7 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha) |
11879 |
+ mcp->out_mb = MBX_1|MBX_0; |
11880 |
+ mcp->in_mb = MBX_2|MBX_1|MBX_0; |
11881 |
+ if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
11882 |
+- mcp->in_mb |= MBX_3; |
11883 |
++ mcp->in_mb |= MBX_4|MBX_3; |
11884 |
+ mcp->tov = MBX_TOV_SECONDS; |
11885 |
+ mcp->flags = 0; |
11886 |
+ rval = qla2x00_mailbox_command(vha, mcp); |
11887 |
+diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
11888 |
+index 5acee3c798d42..ba1b1c7549d35 100644 |
11889 |
+--- a/drivers/scsi/qla2xxx/qla_nvme.c |
11890 |
++++ b/drivers/scsi/qla2xxx/qla_nvme.c |
11891 |
+@@ -35,6 +35,11 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) |
11892 |
+ (fcport->nvme_flag & NVME_FLAG_REGISTERED)) |
11893 |
+ return 0; |
11894 |
+ |
11895 |
++ if (atomic_read(&fcport->state) == FCS_ONLINE) |
11896 |
++ return 0; |
11897 |
++ |
11898 |
++ qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
11899 |
++ |
11900 |
+ fcport->nvme_flag &= ~NVME_FLAG_RESETTING; |
11901 |
+ |
11902 |
+ memset(&req, 0, sizeof(struct nvme_fc_port_info)); |
11903 |
+@@ -165,6 +170,18 @@ out: |
11904 |
+ qla2xxx_rel_qpair_sp(sp->qpair, sp); |
11905 |
+ } |
11906 |
+ |
11907 |
++static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd) |
11908 |
++{ |
11909 |
++ if (sp->flags & SRB_DMA_VALID) { |
11910 |
++ struct srb_iocb *nvme = &sp->u.iocb_cmd; |
11911 |
++ struct qla_hw_data *ha = sp->fcport->vha->hw; |
11912 |
++ |
11913 |
++ dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma, |
11914 |
++ fd->rqstlen, DMA_TO_DEVICE); |
11915 |
++ sp->flags &= ~SRB_DMA_VALID; |
11916 |
++ } |
11917 |
++} |
11918 |
++ |
11919 |
+ static void qla_nvme_release_ls_cmd_kref(struct kref *kref) |
11920 |
+ { |
11921 |
+ struct srb *sp = container_of(kref, struct srb, cmd_kref); |
11922 |
+@@ -181,6 +198,8 @@ static void qla_nvme_release_ls_cmd_kref(struct kref *kref) |
11923 |
+ spin_unlock_irqrestore(&priv->cmd_lock, flags); |
11924 |
+ |
11925 |
+ fd = priv->fd; |
11926 |
++ |
11927 |
++ qla_nvme_ls_unmap(sp, fd); |
11928 |
+ fd->done(fd, priv->comp_status); |
11929 |
+ out: |
11930 |
+ qla2x00_rel_sp(sp); |
11931 |
+@@ -327,6 +346,8 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, |
11932 |
+ dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma, |
11933 |
+ fd->rqstlen, DMA_TO_DEVICE); |
11934 |
+ |
11935 |
++ sp->flags |= SRB_DMA_VALID; |
11936 |
++ |
11937 |
+ rval = qla2x00_start_sp(sp); |
11938 |
+ if (rval != QLA_SUCCESS) { |
11939 |
+ ql_log(ql_log_warn, vha, 0x700e, |
11940 |
+@@ -334,6 +355,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, |
11941 |
+ wake_up(&sp->nvme_ls_waitq); |
11942 |
+ sp->priv = NULL; |
11943 |
+ priv->sp = NULL; |
11944 |
++ qla_nvme_ls_unmap(sp, fd); |
11945 |
+ qla2x00_rel_sp(sp); |
11946 |
+ return rval; |
11947 |
+ } |
11948 |
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
11949 |
+index e7f73a167fbd6..419156121cb59 100644 |
11950 |
+--- a/drivers/scsi/qla2xxx/qla_os.c |
11951 |
++++ b/drivers/scsi/qla2xxx/qla_os.c |
11952 |
+@@ -3673,8 +3673,7 @@ qla2x00_unmap_iobases(struct qla_hw_data *ha) |
11953 |
+ if (ha->mqiobase) |
11954 |
+ iounmap(ha->mqiobase); |
11955 |
+ |
11956 |
+- if ((IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) && |
11957 |
+- ha->msixbase) |
11958 |
++ if (ha->msixbase) |
11959 |
+ iounmap(ha->msixbase); |
11960 |
+ } |
11961 |
+ } |
11962 |
+@@ -5390,6 +5389,11 @@ void qla2x00_relogin(struct scsi_qla_host *vha) |
11963 |
+ memset(&ea, 0, sizeof(ea)); |
11964 |
+ ea.fcport = fcport; |
11965 |
+ qla24xx_handle_relogin_event(vha, &ea); |
11966 |
++ } else if (vha->hw->current_topology == |
11967 |
++ ISP_CFG_NL && |
11968 |
++ IS_QLA2XXX_MIDTYPE(vha->hw)) { |
11969 |
++ (void)qla24xx_fcport_handle_login(vha, |
11970 |
++ fcport); |
11971 |
+ } else if (vha->hw->current_topology == |
11972 |
+ ISP_CFG_NL) { |
11973 |
+ fcport->login_retry--; |
11974 |
+diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c |
11975 |
+index 0f92e9a044dcd..0fa9c529fca11 100644 |
11976 |
+--- a/drivers/scsi/qla2xxx/qla_sup.c |
11977 |
++++ b/drivers/scsi/qla2xxx/qla_sup.c |
11978 |
+@@ -844,7 +844,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) |
11979 |
+ ha->flt_region_nvram = start; |
11980 |
+ break; |
11981 |
+ case FLT_REG_IMG_PRI_27XX: |
11982 |
+- if (IS_QLA27XX(ha) && !IS_QLA28XX(ha)) |
11983 |
++ if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
11984 |
+ ha->flt_region_img_status_pri = start; |
11985 |
+ break; |
11986 |
+ case FLT_REG_IMG_SEC_27XX: |
11987 |
+@@ -1356,7 +1356,7 @@ next: |
11988 |
+ flash_data_addr(ha, faddr), le32_to_cpu(*dwptr)); |
11989 |
+ if (ret) { |
11990 |
+ ql_dbg(ql_dbg_user, vha, 0x7006, |
11991 |
+- "Failed slopw write %x (%x)\n", faddr, *dwptr); |
11992 |
++ "Failed slow write %x (%x)\n", faddr, *dwptr); |
11993 |
+ break; |
11994 |
+ } |
11995 |
+ } |
11996 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
11997 |
+index ebed14bed7835..cf9ae0ab489a0 100644 |
11998 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
11999 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
12000 |
+@@ -3256,6 +3256,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, |
12001 |
+ "RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n", |
12002 |
+ vha->flags.online, qla2x00_reset_active(vha), |
12003 |
+ cmd->reset_count, qpair->chip_reset); |
12004 |
++ res = 0; |
12005 |
+ goto out_unmap_unlock; |
12006 |
+ } |
12007 |
+ |
12008 |
+@@ -7076,8 +7077,7 @@ qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha) |
12009 |
+ if (!QLA_TGT_MODE_ENABLED()) |
12010 |
+ return; |
12011 |
+ |
12012 |
+- if ((ql2xenablemsix == 0) || IS_QLA83XX(ha) || IS_QLA27XX(ha) || |
12013 |
+- IS_QLA28XX(ha)) { |
12014 |
++ if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { |
12015 |
+ ISP_ATIO_Q_IN(base_vha) = &ha->mqiobase->isp25mq.atio_q_in; |
12016 |
+ ISP_ATIO_Q_OUT(base_vha) = &ha->mqiobase->isp25mq.atio_q_out; |
12017 |
+ } else { |
12018 |
+diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c |
12019 |
+index f1875dc31ae2c..85f82e195ef8b 100644 |
12020 |
+--- a/drivers/soc/qcom/ocmem.c |
12021 |
++++ b/drivers/soc/qcom/ocmem.c |
12022 |
+@@ -206,6 +206,7 @@ struct ocmem *of_get_ocmem(struct device *dev) |
12023 |
+ ocmem = platform_get_drvdata(pdev); |
12024 |
+ if (!ocmem) { |
12025 |
+ dev_err(dev, "Cannot get ocmem\n"); |
12026 |
++ put_device(&pdev->dev); |
12027 |
+ return ERR_PTR(-ENODEV); |
12028 |
+ } |
12029 |
+ return ocmem; |
12030 |
+diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c |
12031 |
+index 4fe88d4690e2b..941499b117580 100644 |
12032 |
+--- a/drivers/soc/qcom/qcom_aoss.c |
12033 |
++++ b/drivers/soc/qcom/qcom_aoss.c |
12034 |
+@@ -548,7 +548,7 @@ static int qmp_probe(struct platform_device *pdev) |
12035 |
+ } |
12036 |
+ |
12037 |
+ irq = platform_get_irq(pdev, 0); |
12038 |
+- ret = devm_request_irq(&pdev->dev, irq, qmp_intr, IRQF_ONESHOT, |
12039 |
++ ret = devm_request_irq(&pdev->dev, irq, qmp_intr, 0, |
12040 |
+ "aoss-qmp", qmp); |
12041 |
+ if (ret < 0) { |
12042 |
+ dev_err(&pdev->dev, "failed to request interrupt\n"); |
12043 |
+diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c |
12044 |
+index f2168e4259b23..c6084c0d35302 100644 |
12045 |
+--- a/drivers/soc/qcom/rpmpd.c |
12046 |
++++ b/drivers/soc/qcom/rpmpd.c |
12047 |
+@@ -387,6 +387,9 @@ static int rpmpd_probe(struct platform_device *pdev) |
12048 |
+ |
12049 |
+ data->domains = devm_kcalloc(&pdev->dev, num, sizeof(*data->domains), |
12050 |
+ GFP_KERNEL); |
12051 |
++ if (!data->domains) |
12052 |
++ return -ENOMEM; |
12053 |
++ |
12054 |
+ data->num_domains = num; |
12055 |
+ |
12056 |
+ for (i = 0; i < num; i++) { |
12057 |
+diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c |
12058 |
+index e9ece45d7a333..ef3f95fefab58 100644 |
12059 |
+--- a/drivers/soc/ti/wkup_m3_ipc.c |
12060 |
++++ b/drivers/soc/ti/wkup_m3_ipc.c |
12061 |
+@@ -447,9 +447,9 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) |
12062 |
+ } |
12063 |
+ |
12064 |
+ irq = platform_get_irq(pdev, 0); |
12065 |
+- if (!irq) { |
12066 |
++ if (irq < 0) { |
12067 |
+ dev_err(&pdev->dev, "no irq resource\n"); |
12068 |
+- return -ENXIO; |
12069 |
++ return irq; |
12070 |
+ } |
12071 |
+ |
12072 |
+ ret = devm_request_irq(dev, irq, wkup_m3_txev_handler, |
12073 |
+diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c |
12074 |
+index dad4326a2a714..824d9f900aca7 100644 |
12075 |
+--- a/drivers/soundwire/intel.c |
12076 |
++++ b/drivers/soundwire/intel.c |
12077 |
+@@ -521,8 +521,8 @@ static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable) |
12078 |
+ |
12079 |
+ /* Clear wake status */ |
12080 |
+ wake_sts = intel_readw(shim, SDW_SHIM_WAKESTS); |
12081 |
+- wake_sts |= (SDW_SHIM_WAKEEN_ENABLE << link_id); |
12082 |
+- intel_writew(shim, SDW_SHIM_WAKESTS_STATUS, wake_sts); |
12083 |
++ wake_sts |= (SDW_SHIM_WAKESTS_STATUS << link_id); |
12084 |
++ intel_writew(shim, SDW_SHIM_WAKESTS, wake_sts); |
12085 |
+ } |
12086 |
+ mutex_unlock(sdw->link_res->shim_lock); |
12087 |
+ } |
12088 |
+diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c |
12089 |
+index 96b418293bf2a..4fb19e6f94b05 100644 |
12090 |
+--- a/drivers/spi/spi-mxic.c |
12091 |
++++ b/drivers/spi/spi-mxic.c |
12092 |
+@@ -304,25 +304,21 @@ static int mxic_spi_data_xfer(struct mxic_spi *mxic, const void *txbuf, |
12093 |
+ |
12094 |
+ writel(data, mxic->regs + TXD(nbytes % 4)); |
12095 |
+ |
12096 |
++ ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
12097 |
++ sts & INT_TX_EMPTY, 0, USEC_PER_SEC); |
12098 |
++ if (ret) |
12099 |
++ return ret; |
12100 |
++ |
12101 |
++ ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
12102 |
++ sts & INT_RX_NOT_EMPTY, 0, |
12103 |
++ USEC_PER_SEC); |
12104 |
++ if (ret) |
12105 |
++ return ret; |
12106 |
++ |
12107 |
++ data = readl(mxic->regs + RXD); |
12108 |
+ if (rxbuf) { |
12109 |
+- ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
12110 |
+- sts & INT_TX_EMPTY, 0, |
12111 |
+- USEC_PER_SEC); |
12112 |
+- if (ret) |
12113 |
+- return ret; |
12114 |
+- |
12115 |
+- ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
12116 |
+- sts & INT_RX_NOT_EMPTY, 0, |
12117 |
+- USEC_PER_SEC); |
12118 |
+- if (ret) |
12119 |
+- return ret; |
12120 |
+- |
12121 |
+- data = readl(mxic->regs + RXD); |
12122 |
+ data >>= (8 * (4 - nbytes)); |
12123 |
+ memcpy(rxbuf + pos, &data, nbytes); |
12124 |
+- WARN_ON(readl(mxic->regs + INT_STS) & INT_RX_NOT_EMPTY); |
12125 |
+- } else { |
12126 |
+- readl(mxic->regs + RXD); |
12127 |
+ } |
12128 |
+ WARN_ON(readl(mxic->regs + INT_STS) & INT_RX_NOT_EMPTY); |
12129 |
+ |
12130 |
+diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c |
12131 |
+index e4ee8b0847993..f7603c209e9d5 100644 |
12132 |
+--- a/drivers/spi/spi-pl022.c |
12133 |
++++ b/drivers/spi/spi-pl022.c |
12134 |
+@@ -2315,13 +2315,13 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) |
12135 |
+ return status; |
12136 |
+ } |
12137 |
+ |
12138 |
+-static int |
12139 |
++static void |
12140 |
+ pl022_remove(struct amba_device *adev) |
12141 |
+ { |
12142 |
+ struct pl022 *pl022 = amba_get_drvdata(adev); |
12143 |
+ |
12144 |
+ if (!pl022) |
12145 |
+- return 0; |
12146 |
++ return; |
12147 |
+ |
12148 |
+ /* |
12149 |
+ * undo pm_runtime_put() in probe. I assume that we're not |
12150 |
+@@ -2336,7 +2336,6 @@ pl022_remove(struct amba_device *adev) |
12151 |
+ clk_disable_unprepare(pl022->clk); |
12152 |
+ amba_release_regions(adev); |
12153 |
+ tasklet_disable(&pl022->pump_transfers); |
12154 |
+- return 0; |
12155 |
+ } |
12156 |
+ |
12157 |
+ #ifdef CONFIG_PM_SLEEP |
12158 |
+diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c |
12159 |
+index aafac128bb5f1..4eb979a096c78 100644 |
12160 |
+--- a/drivers/spi/spi-pxa2xx-pci.c |
12161 |
++++ b/drivers/spi/spi-pxa2xx-pci.c |
12162 |
+@@ -74,14 +74,23 @@ static bool lpss_dma_filter(struct dma_chan *chan, void *param) |
12163 |
+ return true; |
12164 |
+ } |
12165 |
+ |
12166 |
++static void lpss_dma_put_device(void *dma_dev) |
12167 |
++{ |
12168 |
++ pci_dev_put(dma_dev); |
12169 |
++} |
12170 |
++ |
12171 |
+ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
12172 |
+ { |
12173 |
+ struct pci_dev *dma_dev; |
12174 |
++ int ret; |
12175 |
+ |
12176 |
+ c->num_chipselect = 1; |
12177 |
+ c->max_clk_rate = 50000000; |
12178 |
+ |
12179 |
+ dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); |
12180 |
++ ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); |
12181 |
++ if (ret) |
12182 |
++ return ret; |
12183 |
+ |
12184 |
+ if (c->tx_param) { |
12185 |
+ struct dw_dma_slave *slave = c->tx_param; |
12186 |
+@@ -105,8 +114,9 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
12187 |
+ |
12188 |
+ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
12189 |
+ { |
12190 |
+- struct pci_dev *dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); |
12191 |
+ struct dw_dma_slave *tx, *rx; |
12192 |
++ struct pci_dev *dma_dev; |
12193 |
++ int ret; |
12194 |
+ |
12195 |
+ switch (PCI_FUNC(dev->devfn)) { |
12196 |
+ case 0: |
12197 |
+@@ -131,6 +141,11 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
12198 |
+ return -ENODEV; |
12199 |
+ } |
12200 |
+ |
12201 |
++ dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); |
12202 |
++ ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); |
12203 |
++ if (ret) |
12204 |
++ return ret; |
12205 |
++ |
12206 |
+ tx = c->tx_param; |
12207 |
+ tx->dma_dev = &dma_dev->dev; |
12208 |
+ |
12209 |
+diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
12210 |
+index a2e5907276e7f..ed42665b12241 100644 |
12211 |
+--- a/drivers/spi/spi-tegra114.c |
12212 |
++++ b/drivers/spi/spi-tegra114.c |
12213 |
+@@ -1353,6 +1353,10 @@ static int tegra_spi_probe(struct platform_device *pdev) |
12214 |
+ tspi->phys = r->start; |
12215 |
+ |
12216 |
+ spi_irq = platform_get_irq(pdev, 0); |
12217 |
++ if (spi_irq < 0) { |
12218 |
++ ret = spi_irq; |
12219 |
++ goto exit_free_master; |
12220 |
++ } |
12221 |
+ tspi->irq = spi_irq; |
12222 |
+ |
12223 |
+ tspi->clk = devm_clk_get(&pdev->dev, "spi"); |
12224 |
+diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
12225 |
+index 669fc4286231f..9e2b812b9025f 100644 |
12226 |
+--- a/drivers/spi/spi-tegra20-slink.c |
12227 |
++++ b/drivers/spi/spi-tegra20-slink.c |
12228 |
+@@ -1006,14 +1006,8 @@ static int tegra_slink_probe(struct platform_device *pdev) |
12229 |
+ struct resource *r; |
12230 |
+ int ret, spi_irq; |
12231 |
+ const struct tegra_slink_chip_data *cdata = NULL; |
12232 |
+- const struct of_device_id *match; |
12233 |
+ |
12234 |
+- match = of_match_device(tegra_slink_of_match, &pdev->dev); |
12235 |
+- if (!match) { |
12236 |
+- dev_err(&pdev->dev, "Error: No device match found\n"); |
12237 |
+- return -ENODEV; |
12238 |
+- } |
12239 |
+- cdata = match->data; |
12240 |
++ cdata = of_device_get_match_data(&pdev->dev); |
12241 |
+ |
12242 |
+ master = spi_alloc_master(&pdev->dev, sizeof(*tspi)); |
12243 |
+ if (!master) { |
12244 |
+diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c |
12245 |
+index 1dd2af9cc2374..3d3ac48243ebd 100644 |
12246 |
+--- a/drivers/spi/spi-zynqmp-gqspi.c |
12247 |
++++ b/drivers/spi/spi-zynqmp-gqspi.c |
12248 |
+@@ -1165,7 +1165,10 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) |
12249 |
+ goto clk_dis_all; |
12250 |
+ } |
12251 |
+ |
12252 |
+- dma_set_mask(&pdev->dev, DMA_BIT_MASK(44)); |
12253 |
++ ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(44)); |
12254 |
++ if (ret) |
12255 |
++ goto clk_dis_all; |
12256 |
++ |
12257 |
+ ctlr->bits_per_word_mask = SPI_BPW_MASK(8); |
12258 |
+ ctlr->num_chipselect = GQSPI_DEFAULT_NUM_CS; |
12259 |
+ ctlr->mem_ops = &zynqmp_qspi_mem_ops; |
12260 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
12261 |
+index 8c261eac2cee5..6ea7b286c80c2 100644 |
12262 |
+--- a/drivers/spi/spi.c |
12263 |
++++ b/drivers/spi/spi.c |
12264 |
+@@ -881,10 +881,10 @@ int spi_map_buf(struct spi_controller *ctlr, struct device *dev, |
12265 |
+ int i, ret; |
12266 |
+ |
12267 |
+ if (vmalloced_buf || kmap_buf) { |
12268 |
+- desc_len = min_t(int, max_seg_size, PAGE_SIZE); |
12269 |
++ desc_len = min_t(unsigned long, max_seg_size, PAGE_SIZE); |
12270 |
+ sgs = DIV_ROUND_UP(len + offset_in_page(buf), desc_len); |
12271 |
+ } else if (virt_addr_valid(buf)) { |
12272 |
+- desc_len = min_t(int, max_seg_size, ctlr->max_dma_len); |
12273 |
++ desc_len = min_t(size_t, max_seg_size, ctlr->max_dma_len); |
12274 |
+ sgs = DIV_ROUND_UP(len, desc_len); |
12275 |
+ } else { |
12276 |
+ return -EINVAL; |
12277 |
+diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c |
12278 |
+index fef0055b89909..20183b2ea1279 100644 |
12279 |
+--- a/drivers/staging/iio/adc/ad7280a.c |
12280 |
++++ b/drivers/staging/iio/adc/ad7280a.c |
12281 |
+@@ -107,9 +107,9 @@ |
12282 |
+ static unsigned int ad7280a_devaddr(unsigned int addr) |
12283 |
+ { |
12284 |
+ return ((addr & 0x1) << 4) | |
12285 |
+- ((addr & 0x2) << 3) | |
12286 |
++ ((addr & 0x2) << 2) | |
12287 |
+ (addr & 0x4) | |
12288 |
+- ((addr & 0x8) >> 3) | |
12289 |
++ ((addr & 0x8) >> 2) | |
12290 |
+ ((addr & 0x10) >> 4); |
12291 |
+ } |
12292 |
+ |
12293 |
+diff --git a/drivers/staging/media/atomisp/pci/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp_acc.c |
12294 |
+index f638d0bd09fe6..b1614cce2dfb0 100644 |
12295 |
+--- a/drivers/staging/media/atomisp/pci/atomisp_acc.c |
12296 |
++++ b/drivers/staging/media/atomisp/pci/atomisp_acc.c |
12297 |
+@@ -439,6 +439,18 @@ int atomisp_acc_s_mapped_arg(struct atomisp_sub_device *asd, |
12298 |
+ return 0; |
12299 |
+ } |
12300 |
+ |
12301 |
++static void atomisp_acc_unload_some_extensions(struct atomisp_sub_device *asd, |
12302 |
++ int i, |
12303 |
++ struct atomisp_acc_fw *acc_fw) |
12304 |
++{ |
12305 |
++ while (--i >= 0) { |
12306 |
++ if (acc_fw->flags & acc_flag_to_pipe[i].flag) { |
12307 |
++ atomisp_css_unload_acc_extension(asd, acc_fw->fw, |
12308 |
++ acc_flag_to_pipe[i].pipe_id); |
12309 |
++ } |
12310 |
++ } |
12311 |
++} |
12312 |
++ |
12313 |
+ /* |
12314 |
+ * Appends the loaded acceleration binary extensions to the |
12315 |
+ * current ISP mode. Must be called just before sh_css_start(). |
12316 |
+@@ -477,16 +489,20 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd) |
12317 |
+ acc_fw->fw, |
12318 |
+ acc_flag_to_pipe[i].pipe_id, |
12319 |
+ acc_fw->type); |
12320 |
+- if (ret) |
12321 |
++ if (ret) { |
12322 |
++ atomisp_acc_unload_some_extensions(asd, i, acc_fw); |
12323 |
+ goto error; |
12324 |
++ } |
12325 |
+ |
12326 |
+ ext_loaded = true; |
12327 |
+ } |
12328 |
+ } |
12329 |
+ |
12330 |
+ ret = atomisp_css_set_acc_parameters(acc_fw); |
12331 |
+- if (ret < 0) |
12332 |
++ if (ret < 0) { |
12333 |
++ atomisp_acc_unload_some_extensions(asd, i, acc_fw); |
12334 |
+ goto error; |
12335 |
++ } |
12336 |
+ } |
12337 |
+ |
12338 |
+ if (!ext_loaded) |
12339 |
+@@ -495,6 +511,7 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd) |
12340 |
+ ret = atomisp_css_update_stream(asd); |
12341 |
+ if (ret) { |
12342 |
+ dev_err(isp->dev, "%s: update stream failed.\n", __func__); |
12343 |
++ atomisp_acc_unload_extensions(asd); |
12344 |
+ goto error; |
12345 |
+ } |
12346 |
+ |
12347 |
+@@ -502,13 +519,6 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd) |
12348 |
+ return 0; |
12349 |
+ |
12350 |
+ error: |
12351 |
+- while (--i >= 0) { |
12352 |
+- if (acc_fw->flags & acc_flag_to_pipe[i].flag) { |
12353 |
+- atomisp_css_unload_acc_extension(asd, acc_fw->fw, |
12354 |
+- acc_flag_to_pipe[i].pipe_id); |
12355 |
+- } |
12356 |
+- } |
12357 |
+- |
12358 |
+ list_for_each_entry_continue_reverse(acc_fw, &asd->acc.fw, list) { |
12359 |
+ if (acc_fw->type != ATOMISP_ACC_FW_LOAD_TYPE_OUTPUT && |
12360 |
+ acc_fw->type != ATOMISP_ACC_FW_LOAD_TYPE_VIEWFINDER) |
12361 |
+diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c |
12362 |
+index 34480ca164746..c9ee85037644f 100644 |
12363 |
+--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c |
12364 |
++++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c |
12365 |
+@@ -729,6 +729,21 @@ static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs, |
12366 |
+ return 0; |
12367 |
+ } |
12368 |
+ |
12369 |
++/* |
12370 |
++ * Some boards contain a hw-bug where turning eldo2 back on after having turned |
12371 |
++ * it off causes the CPLM3218 ambient-light-sensor on the image-sensor's I2C bus |
12372 |
++ * to crash, hanging the bus. Do not turn eldo2 off on these systems. |
12373 |
++ */ |
12374 |
++static const struct dmi_system_id axp_leave_eldo2_on_ids[] = { |
12375 |
++ { |
12376 |
++ .matches = { |
12377 |
++ DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"), |
12378 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab duo W1 10.1 (VT4)"), |
12379 |
++ }, |
12380 |
++ }, |
12381 |
++ { } |
12382 |
++}; |
12383 |
++ |
12384 |
+ static int axp_v1p8_on(struct device *dev, struct gmin_subdev *gs) |
12385 |
+ { |
12386 |
+ int ret; |
12387 |
+@@ -763,6 +778,9 @@ static int axp_v1p8_off(struct device *dev, struct gmin_subdev *gs) |
12388 |
+ if (ret) |
12389 |
+ return ret; |
12390 |
+ |
12391 |
++ if (dmi_check_system(axp_leave_eldo2_on_ids)) |
12392 |
++ return 0; |
12393 |
++ |
12394 |
+ ret = axp_regulator_set(dev, gs, gs->eldo2_sel_reg, gs->eldo2_1p8v, |
12395 |
+ ELDO_CTRL_REG, gs->eldo2_ctrl_shift, false); |
12396 |
+ return ret; |
12397 |
+diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c |
12398 |
+index 6a5ee46070898..c1cda16f2dc01 100644 |
12399 |
+--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c |
12400 |
++++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c |
12401 |
+@@ -39,7 +39,7 @@ |
12402 |
+ struct hmm_bo_device bo_device; |
12403 |
+ struct hmm_pool dynamic_pool; |
12404 |
+ struct hmm_pool reserved_pool; |
12405 |
+-static ia_css_ptr dummy_ptr; |
12406 |
++static ia_css_ptr dummy_ptr = mmgr_EXCEPTION; |
12407 |
+ static bool hmm_initialized; |
12408 |
+ struct _hmm_mem_stat hmm_mem_stat; |
12409 |
+ |
12410 |
+@@ -209,7 +209,7 @@ int hmm_init(void) |
12411 |
+ |
12412 |
+ void hmm_cleanup(void) |
12413 |
+ { |
12414 |
+- if (!dummy_ptr) |
12415 |
++ if (dummy_ptr == mmgr_EXCEPTION) |
12416 |
+ return; |
12417 |
+ sysfs_remove_group(&atomisp_dev->kobj, atomisp_attribute_group); |
12418 |
+ |
12419 |
+@@ -288,7 +288,8 @@ void hmm_free(ia_css_ptr virt) |
12420 |
+ |
12421 |
+ dev_dbg(atomisp_dev, "%s: free 0x%08x\n", __func__, virt); |
12422 |
+ |
12423 |
+- WARN_ON(!virt); |
12424 |
++ if (WARN_ON(virt == mmgr_EXCEPTION)) |
12425 |
++ return; |
12426 |
+ |
12427 |
+ bo = hmm_bo_device_search_start(&bo_device, (unsigned int)virt); |
12428 |
+ |
12429 |
+diff --git a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c |
12430 |
+index b88dc4ed06db7..ed244aee196c3 100644 |
12431 |
+--- a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c |
12432 |
++++ b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c |
12433 |
+@@ -23,7 +23,7 @@ static void hantro_h1_set_src_img_ctrl(struct hantro_dev *vpu, |
12434 |
+ |
12435 |
+ reg = H1_REG_IN_IMG_CTRL_ROW_LEN(pix_fmt->width) |
12436 |
+ | H1_REG_IN_IMG_CTRL_OVRFLR_D4(0) |
12437 |
+- | H1_REG_IN_IMG_CTRL_OVRFLB_D4(0) |
12438 |
++ | H1_REG_IN_IMG_CTRL_OVRFLB(0) |
12439 |
+ | H1_REG_IN_IMG_CTRL_FMT(ctx->vpu_src_fmt->enc_fmt); |
12440 |
+ vepu_write_relaxed(vpu, reg, H1_REG_IN_IMG_CTRL); |
12441 |
+ } |
12442 |
+diff --git a/drivers/staging/media/hantro/hantro_h1_regs.h b/drivers/staging/media/hantro/hantro_h1_regs.h |
12443 |
+index d6e9825bb5c7b..30e7e7b920b55 100644 |
12444 |
+--- a/drivers/staging/media/hantro/hantro_h1_regs.h |
12445 |
++++ b/drivers/staging/media/hantro/hantro_h1_regs.h |
12446 |
+@@ -47,7 +47,7 @@ |
12447 |
+ #define H1_REG_IN_IMG_CTRL 0x03c |
12448 |
+ #define H1_REG_IN_IMG_CTRL_ROW_LEN(x) ((x) << 12) |
12449 |
+ #define H1_REG_IN_IMG_CTRL_OVRFLR_D4(x) ((x) << 10) |
12450 |
+-#define H1_REG_IN_IMG_CTRL_OVRFLB_D4(x) ((x) << 6) |
12451 |
++#define H1_REG_IN_IMG_CTRL_OVRFLB(x) ((x) << 6) |
12452 |
+ #define H1_REG_IN_IMG_CTRL_FMT(x) ((x) << 2) |
12453 |
+ #define H1_REG_ENC_CTRL0 0x040 |
12454 |
+ #define H1_REG_ENC_CTRL0_INIT_QP(x) ((x) << 26) |
12455 |
+diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c |
12456 |
+index db7022707ff8d..86ccc8937afca 100644 |
12457 |
+--- a/drivers/staging/media/meson/vdec/esparser.c |
12458 |
++++ b/drivers/staging/media/meson/vdec/esparser.c |
12459 |
+@@ -328,7 +328,12 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) |
12460 |
+ |
12461 |
+ offset = esparser_get_offset(sess); |
12462 |
+ |
12463 |
+- amvdec_add_ts(sess, vb->timestamp, vbuf->timecode, offset, vbuf->flags); |
12464 |
++ ret = amvdec_add_ts(sess, vb->timestamp, vbuf->timecode, offset, vbuf->flags); |
12465 |
++ if (ret) { |
12466 |
++ v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); |
12467 |
++ return ret; |
12468 |
++ } |
12469 |
++ |
12470 |
+ dev_dbg(core->dev, "esparser: ts = %llu pld_size = %u offset = %08X flags = %08X\n", |
12471 |
+ vb->timestamp, payload_size, offset, vbuf->flags); |
12472 |
+ |
12473 |
+diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c |
12474 |
+index 7f07a9175815f..db4a854e59a38 100644 |
12475 |
+--- a/drivers/staging/media/meson/vdec/vdec_helpers.c |
12476 |
++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c |
12477 |
+@@ -227,13 +227,16 @@ int amvdec_set_canvases(struct amvdec_session *sess, |
12478 |
+ } |
12479 |
+ EXPORT_SYMBOL_GPL(amvdec_set_canvases); |
12480 |
+ |
12481 |
+-void amvdec_add_ts(struct amvdec_session *sess, u64 ts, |
12482 |
+- struct v4l2_timecode tc, u32 offset, u32 vbuf_flags) |
12483 |
++int amvdec_add_ts(struct amvdec_session *sess, u64 ts, |
12484 |
++ struct v4l2_timecode tc, u32 offset, u32 vbuf_flags) |
12485 |
+ { |
12486 |
+ struct amvdec_timestamp *new_ts; |
12487 |
+ unsigned long flags; |
12488 |
+ |
12489 |
+ new_ts = kzalloc(sizeof(*new_ts), GFP_KERNEL); |
12490 |
++ if (!new_ts) |
12491 |
++ return -ENOMEM; |
12492 |
++ |
12493 |
+ new_ts->ts = ts; |
12494 |
+ new_ts->tc = tc; |
12495 |
+ new_ts->offset = offset; |
12496 |
+@@ -242,6 +245,7 @@ void amvdec_add_ts(struct amvdec_session *sess, u64 ts, |
12497 |
+ spin_lock_irqsave(&sess->ts_spinlock, flags); |
12498 |
+ list_add_tail(&new_ts->list, &sess->timestamps); |
12499 |
+ spin_unlock_irqrestore(&sess->ts_spinlock, flags); |
12500 |
++ return 0; |
12501 |
+ } |
12502 |
+ EXPORT_SYMBOL_GPL(amvdec_add_ts); |
12503 |
+ |
12504 |
+diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h |
12505 |
+index cfaed52ab5265..798e5a8a9b3f1 100644 |
12506 |
+--- a/drivers/staging/media/meson/vdec/vdec_helpers.h |
12507 |
++++ b/drivers/staging/media/meson/vdec/vdec_helpers.h |
12508 |
+@@ -55,8 +55,8 @@ void amvdec_dst_buf_done_offset(struct amvdec_session *sess, |
12509 |
+ * @offset: offset in the VIFIFO where the associated packet was written |
12510 |
+ * @flags the vb2_v4l2_buffer flags |
12511 |
+ */ |
12512 |
+-void amvdec_add_ts(struct amvdec_session *sess, u64 ts, |
12513 |
+- struct v4l2_timecode tc, u32 offset, u32 flags); |
12514 |
++int amvdec_add_ts(struct amvdec_session *sess, u64 ts, |
12515 |
++ struct v4l2_timecode tc, u32 offset, u32 flags); |
12516 |
+ void amvdec_remove_ts(struct amvdec_session *sess, u64 ts); |
12517 |
+ |
12518 |
+ /** |
12519 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c |
12520 |
+index de7442d4834dc..d3e26bfe6c90b 100644 |
12521 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c |
12522 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c |
12523 |
+@@ -38,7 +38,7 @@ struct cedrus_h264_sram_ref_pic { |
12524 |
+ |
12525 |
+ #define CEDRUS_H264_FRAME_NUM 18 |
12526 |
+ |
12527 |
+-#define CEDRUS_NEIGHBOR_INFO_BUF_SIZE (16 * SZ_1K) |
12528 |
++#define CEDRUS_NEIGHBOR_INFO_BUF_SIZE (32 * SZ_1K) |
12529 |
+ #define CEDRUS_MIN_PIC_INFO_BUF_SIZE (130 * SZ_1K) |
12530 |
+ |
12531 |
+ static void cedrus_h264_write_sram(struct cedrus_dev *dev, |
12532 |
+diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c |
12533 |
+index 10744fab7ceaa..368439cf5e174 100644 |
12534 |
+--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c |
12535 |
++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c |
12536 |
+@@ -23,7 +23,7 @@ |
12537 |
+ * Subsequent BSP implementations seem to double the neighbor info buffer size |
12538 |
+ * for the H6 SoC, which may be related to 10 bit H265 support. |
12539 |
+ */ |
12540 |
+-#define CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE (397 * SZ_1K) |
12541 |
++#define CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE (794 * SZ_1K) |
12542 |
+ #define CEDRUS_H265_ENTRY_POINTS_BUF_SIZE (4 * SZ_1K) |
12543 |
+ #define CEDRUS_H265_MV_COL_BUF_UNIT_CTB_SIZE 160 |
12544 |
+ |
12545 |
+diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h |
12546 |
+index e7fe8da7732c7..3f223e5b1872b 100644 |
12547 |
+--- a/drivers/staging/media/zoran/zoran.h |
12548 |
++++ b/drivers/staging/media/zoran/zoran.h |
12549 |
+@@ -314,6 +314,6 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) |
12550 |
+ |
12551 |
+ #endif |
12552 |
+ |
12553 |
+-int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq); |
12554 |
++int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir); |
12555 |
+ void zoran_queue_exit(struct zoran *zr); |
12556 |
+ int zr_set_buf(struct zoran *zr); |
12557 |
+diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c |
12558 |
+index dfc60e2e9dd7a..fe0cca12119c7 100644 |
12559 |
+--- a/drivers/staging/media/zoran/zoran_card.c |
12560 |
++++ b/drivers/staging/media/zoran/zoran_card.c |
12561 |
+@@ -802,6 +802,52 @@ int zoran_check_jpg_settings(struct zoran *zr, |
12562 |
+ return 0; |
12563 |
+ } |
12564 |
+ |
12565 |
++static int zoran_init_video_device(struct zoran *zr, struct video_device *video_dev, int dir) |
12566 |
++{ |
12567 |
++ int err; |
12568 |
++ |
12569 |
++ /* Now add the template and register the device unit. */ |
12570 |
++ *video_dev = zoran_template; |
12571 |
++ video_dev->v4l2_dev = &zr->v4l2_dev; |
12572 |
++ video_dev->lock = &zr->lock; |
12573 |
++ video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | dir; |
12574 |
++ |
12575 |
++ strscpy(video_dev->name, ZR_DEVNAME(zr), sizeof(video_dev->name)); |
12576 |
++ /* |
12577 |
++ * It's not a mem2mem device, but you can both capture and output from one and the same |
12578 |
++ * device. This should really be split up into two device nodes, but that's a job for |
12579 |
++ * another day. |
12580 |
++ */ |
12581 |
++ video_dev->vfl_dir = VFL_DIR_M2M; |
12582 |
++ zoran_queue_init(zr, &zr->vq, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
12583 |
++ |
12584 |
++ err = video_register_device(video_dev, VFL_TYPE_VIDEO, video_nr[zr->id]); |
12585 |
++ if (err < 0) |
12586 |
++ return err; |
12587 |
++ video_set_drvdata(video_dev, zr); |
12588 |
++ return 0; |
12589 |
++} |
12590 |
++ |
12591 |
++static void zoran_exit_video_devices(struct zoran *zr) |
12592 |
++{ |
12593 |
++ video_unregister_device(zr->video_dev); |
12594 |
++ kfree(zr->video_dev); |
12595 |
++} |
12596 |
++ |
12597 |
++static int zoran_init_video_devices(struct zoran *zr) |
12598 |
++{ |
12599 |
++ int err; |
12600 |
++ |
12601 |
++ zr->video_dev = video_device_alloc(); |
12602 |
++ if (!zr->video_dev) |
12603 |
++ return -ENOMEM; |
12604 |
++ |
12605 |
++ err = zoran_init_video_device(zr, zr->video_dev, V4L2_CAP_VIDEO_CAPTURE); |
12606 |
++ if (err) |
12607 |
++ kfree(zr->video_dev); |
12608 |
++ return err; |
12609 |
++} |
12610 |
++ |
12611 |
+ void zoran_open_init_params(struct zoran *zr) |
12612 |
+ { |
12613 |
+ int i; |
12614 |
+@@ -873,17 +919,11 @@ static int zr36057_init(struct zoran *zr) |
12615 |
+ zoran_open_init_params(zr); |
12616 |
+ |
12617 |
+ /* allocate memory *before* doing anything to the hardware in case allocation fails */ |
12618 |
+- zr->video_dev = video_device_alloc(); |
12619 |
+- if (!zr->video_dev) { |
12620 |
+- err = -ENOMEM; |
12621 |
+- goto exit; |
12622 |
+- } |
12623 |
+ zr->stat_com = dma_alloc_coherent(&zr->pci_dev->dev, |
12624 |
+ BUZ_NUM_STAT_COM * sizeof(u32), |
12625 |
+ &zr->p_sc, GFP_KERNEL); |
12626 |
+ if (!zr->stat_com) { |
12627 |
+- err = -ENOMEM; |
12628 |
+- goto exit_video; |
12629 |
++ return -ENOMEM; |
12630 |
+ } |
12631 |
+ for (j = 0; j < BUZ_NUM_STAT_COM; j++) |
12632 |
+ zr->stat_com[j] = cpu_to_le32(1); /* mark as unavailable to zr36057 */ |
12633 |
+@@ -896,26 +936,9 @@ static int zr36057_init(struct zoran *zr) |
12634 |
+ goto exit_statcom; |
12635 |
+ } |
12636 |
+ |
12637 |
+- /* Now add the template and register the device unit. */ |
12638 |
+- *zr->video_dev = zoran_template; |
12639 |
+- zr->video_dev->v4l2_dev = &zr->v4l2_dev; |
12640 |
+- zr->video_dev->lock = &zr->lock; |
12641 |
+- zr->video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; |
12642 |
+- |
12643 |
+- strscpy(zr->video_dev->name, ZR_DEVNAME(zr), sizeof(zr->video_dev->name)); |
12644 |
+- /* |
12645 |
+- * It's not a mem2mem device, but you can both capture and output from one and the same |
12646 |
+- * device. This should really be split up into two device nodes, but that's a job for |
12647 |
+- * another day. |
12648 |
+- */ |
12649 |
+- zr->video_dev->vfl_dir = VFL_DIR_M2M; |
12650 |
+- |
12651 |
+- zoran_queue_init(zr, &zr->vq); |
12652 |
+- |
12653 |
+- err = video_register_device(zr->video_dev, VFL_TYPE_VIDEO, video_nr[zr->id]); |
12654 |
+- if (err < 0) |
12655 |
++ err = zoran_init_video_devices(zr); |
12656 |
++ if (err) |
12657 |
+ goto exit_statcomb; |
12658 |
+- video_set_drvdata(zr->video_dev, zr); |
12659 |
+ |
12660 |
+ zoran_init_hardware(zr); |
12661 |
+ if (!pass_through) { |
12662 |
+@@ -930,9 +953,6 @@ exit_statcomb: |
12663 |
+ dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32) * 2, zr->stat_comb, zr->p_scb); |
12664 |
+ exit_statcom: |
12665 |
+ dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32), zr->stat_com, zr->p_sc); |
12666 |
+-exit_video: |
12667 |
+- kfree(zr->video_dev); |
12668 |
+-exit: |
12669 |
+ return err; |
12670 |
+ } |
12671 |
+ |
12672 |
+@@ -964,7 +984,7 @@ static void zoran_remove(struct pci_dev *pdev) |
12673 |
+ dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32) * 2, zr->stat_comb, zr->p_scb); |
12674 |
+ pci_release_regions(pdev); |
12675 |
+ pci_disable_device(zr->pci_dev); |
12676 |
+- video_unregister_device(zr->video_dev); |
12677 |
++ zoran_exit_video_devices(zr); |
12678 |
+ exit_free: |
12679 |
+ v4l2_ctrl_handler_free(&zr->hdl); |
12680 |
+ v4l2_device_unregister(&zr->v4l2_dev); |
12681 |
+@@ -1068,8 +1088,10 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
12682 |
+ |
12683 |
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
12684 |
+ if (err) |
12685 |
+- return -ENODEV; |
12686 |
+- vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); |
12687 |
++ return err; |
12688 |
++ err = vb2_dma_contig_set_max_seg_size(&pdev->dev, U32_MAX); |
12689 |
++ if (err) |
12690 |
++ return err; |
12691 |
+ |
12692 |
+ nr = zoran_num++; |
12693 |
+ if (nr >= BUZ_MAX) { |
12694 |
+diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c |
12695 |
+index e569a1341d010..913f5a3c5bfce 100644 |
12696 |
+--- a/drivers/staging/media/zoran/zoran_device.c |
12697 |
++++ b/drivers/staging/media/zoran/zoran_device.c |
12698 |
+@@ -879,7 +879,7 @@ static void zoran_reap_stat_com(struct zoran *zr) |
12699 |
+ if (zr->jpg_settings.tmp_dcm == 1) |
12700 |
+ i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; |
12701 |
+ else |
12702 |
+- i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2 + 1; |
12703 |
++ i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2; |
12704 |
+ |
12705 |
+ stat_com = le32_to_cpu(zr->stat_com[i]); |
12706 |
+ if ((stat_com & 1) == 0) { |
12707 |
+@@ -891,6 +891,11 @@ static void zoran_reap_stat_com(struct zoran *zr) |
12708 |
+ size = (stat_com & GENMASK(22, 1)) >> 1; |
12709 |
+ |
12710 |
+ buf = zr->inuse[i]; |
12711 |
++ if (!buf) { |
12712 |
++ spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); |
12713 |
++ pci_err(zr->pci_dev, "No buffer at slot %d\n", i); |
12714 |
++ return; |
12715 |
++ } |
12716 |
+ buf->vbuf.vb2_buf.timestamp = ktime_get_ns(); |
12717 |
+ |
12718 |
+ if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { |
12719 |
+diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c |
12720 |
+index 808196ea5b81b..ea04f6c732b21 100644 |
12721 |
+--- a/drivers/staging/media/zoran/zoran_driver.c |
12722 |
++++ b/drivers/staging/media/zoran/zoran_driver.c |
12723 |
+@@ -255,8 +255,6 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability |
12724 |
+ strscpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)); |
12725 |
+ strscpy(cap->driver, "zoran", sizeof(cap->driver)); |
12726 |
+ snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(zr->pci_dev)); |
12727 |
+- cap->device_caps = zr->video_dev->device_caps; |
12728 |
+- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
12729 |
+ return 0; |
12730 |
+ } |
12731 |
+ |
12732 |
+@@ -582,6 +580,9 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) |
12733 |
+ struct zoran *zr = video_drvdata(file); |
12734 |
+ int res = 0; |
12735 |
+ |
12736 |
++ if (zr->norm == std) |
12737 |
++ return 0; |
12738 |
++ |
12739 |
+ if (zr->running != ZORAN_MAP_MODE_NONE) |
12740 |
+ return -EBUSY; |
12741 |
+ |
12742 |
+@@ -737,6 +738,7 @@ static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *p |
12743 |
+ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
12744 |
+ return -EINVAL; |
12745 |
+ |
12746 |
++ parm->parm.capture.readbuffers = 9; |
12747 |
+ return 0; |
12748 |
+ } |
12749 |
+ |
12750 |
+@@ -867,6 +869,10 @@ int zr_set_buf(struct zoran *zr) |
12751 |
+ vbuf = &buf->vbuf; |
12752 |
+ |
12753 |
+ buf->vbuf.field = V4L2_FIELD_INTERLACED; |
12754 |
++ if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height * 2)) |
12755 |
++ buf->vbuf.field = V4L2_FIELD_INTERLACED; |
12756 |
++ else |
12757 |
++ buf->vbuf.field = V4L2_FIELD_TOP; |
12758 |
+ vb2_set_plane_payload(&buf->vbuf.vb2_buf, 0, zr->buffer_size); |
12759 |
+ vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_DONE); |
12760 |
+ zr->inuse[0] = NULL; |
12761 |
+@@ -926,6 +932,7 @@ static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) |
12762 |
+ zr->stat_com[j] = cpu_to_le32(1); |
12763 |
+ zr->inuse[j] = NULL; |
12764 |
+ } |
12765 |
++ zr->vbseq = 0; |
12766 |
+ |
12767 |
+ if (zr->map_mode != ZORAN_MAP_MODE_RAW) { |
12768 |
+ pci_info(zr->pci_dev, "START JPG\n"); |
12769 |
+@@ -1006,7 +1013,7 @@ static const struct vb2_ops zr_video_qops = { |
12770 |
+ .wait_finish = vb2_ops_wait_finish, |
12771 |
+ }; |
12772 |
+ |
12773 |
+-int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq) |
12774 |
++int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir) |
12775 |
+ { |
12776 |
+ int err; |
12777 |
+ |
12778 |
+@@ -1014,8 +1021,9 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq) |
12779 |
+ INIT_LIST_HEAD(&zr->queued_bufs); |
12780 |
+ |
12781 |
+ vq->dev = &zr->pci_dev->dev; |
12782 |
+- vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
12783 |
+- vq->io_modes = VB2_USERPTR | VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; |
12784 |
++ vq->type = dir; |
12785 |
++ |
12786 |
++ vq->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; |
12787 |
+ vq->drv_priv = zr; |
12788 |
+ vq->buf_struct_size = sizeof(struct zr_buffer); |
12789 |
+ vq->ops = &zr_video_qops; |
12790 |
+diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts |
12791 |
+index a7c0d3115d726..d48ca5a25c2c4 100644 |
12792 |
+--- a/drivers/staging/mt7621-dts/gbpc1.dts |
12793 |
++++ b/drivers/staging/mt7621-dts/gbpc1.dts |
12794 |
+@@ -11,7 +11,8 @@ |
12795 |
+ |
12796 |
+ memory@0 { |
12797 |
+ device_type = "memory"; |
12798 |
+- reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; |
12799 |
++ reg = <0x00000000 0x1c000000>, |
12800 |
++ <0x20000000 0x04000000>; |
12801 |
+ }; |
12802 |
+ |
12803 |
+ chosen { |
12804 |
+@@ -37,24 +38,16 @@ |
12805 |
+ gpio-leds { |
12806 |
+ compatible = "gpio-leds"; |
12807 |
+ |
12808 |
+- system { |
12809 |
+- label = "gb-pc1:green:system"; |
12810 |
++ power { |
12811 |
++ label = "green:power"; |
12812 |
+ gpios = <&gpio 6 GPIO_ACTIVE_LOW>; |
12813 |
++ linux,default-trigger = "default-on"; |
12814 |
+ }; |
12815 |
+ |
12816 |
+- status { |
12817 |
+- label = "gb-pc1:green:status"; |
12818 |
++ system { |
12819 |
++ label = "green:system"; |
12820 |
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>; |
12821 |
+- }; |
12822 |
+- |
12823 |
+- lan1 { |
12824 |
+- label = "gb-pc1:green:lan1"; |
12825 |
+- gpios = <&gpio 24 GPIO_ACTIVE_LOW>; |
12826 |
+- }; |
12827 |
+- |
12828 |
+- lan2 { |
12829 |
+- label = "gb-pc1:green:lan2"; |
12830 |
+- gpios = <&gpio 25 GPIO_ACTIVE_LOW>; |
12831 |
++ linux,default-trigger = "disk-activity"; |
12832 |
+ }; |
12833 |
+ }; |
12834 |
+ }; |
12835 |
+@@ -94,9 +87,8 @@ |
12836 |
+ |
12837 |
+ partition@50000 { |
12838 |
+ label = "firmware"; |
12839 |
+- reg = <0x50000 0x1FB0000>; |
12840 |
++ reg = <0x50000 0x1fb0000>; |
12841 |
+ }; |
12842 |
+- |
12843 |
+ }; |
12844 |
+ }; |
12845 |
+ |
12846 |
+@@ -122,9 +114,12 @@ |
12847 |
+ }; |
12848 |
+ |
12849 |
+ &pinctrl { |
12850 |
+- state_default: pinctrl0 { |
12851 |
+- default_gpio: gpio { |
12852 |
+- groups = "wdt", "rgmii2", "uart3"; |
12853 |
++ pinctrl-names = "default"; |
12854 |
++ pinctrl-0 = <&state_default>; |
12855 |
++ |
12856 |
++ state_default: state-default { |
12857 |
++ gpio-pinmux { |
12858 |
++ groups = "rgmii2", "uart3", "wdt"; |
12859 |
+ function = "gpio"; |
12860 |
+ }; |
12861 |
+ }; |
12862 |
+@@ -133,12 +128,13 @@ |
12863 |
+ &switch0 { |
12864 |
+ ports { |
12865 |
+ port@0 { |
12866 |
++ status = "okay"; |
12867 |
+ label = "ethblack"; |
12868 |
+- status = "ok"; |
12869 |
+ }; |
12870 |
++ |
12871 |
+ port@4 { |
12872 |
++ status = "okay"; |
12873 |
+ label = "ethblue"; |
12874 |
+- status = "ok"; |
12875 |
+ }; |
12876 |
+ }; |
12877 |
+ }; |
12878 |
+diff --git a/drivers/staging/mt7621-dts/gbpc2.dts b/drivers/staging/mt7621-dts/gbpc2.dts |
12879 |
+index 52760e7351f6c..6f6fed071dda0 100644 |
12880 |
+--- a/drivers/staging/mt7621-dts/gbpc2.dts |
12881 |
++++ b/drivers/staging/mt7621-dts/gbpc2.dts |
12882 |
+@@ -1,21 +1,121 @@ |
12883 |
+ /dts-v1/; |
12884 |
+ |
12885 |
+-#include "gbpc1.dts" |
12886 |
++#include "mt7621.dtsi" |
12887 |
++ |
12888 |
++#include <dt-bindings/gpio/gpio.h> |
12889 |
++#include <dt-bindings/input/input.h> |
12890 |
+ |
12891 |
+ / { |
12892 |
+ compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc"; |
12893 |
+ model = "GB-PC2"; |
12894 |
++ |
12895 |
++ memory@0 { |
12896 |
++ device_type = "memory"; |
12897 |
++ reg = <0x00000000 0x1c000000>, |
12898 |
++ <0x20000000 0x04000000>; |
12899 |
++ }; |
12900 |
++ |
12901 |
++ chosen { |
12902 |
++ bootargs = "console=ttyS0,57600"; |
12903 |
++ }; |
12904 |
++ |
12905 |
++ palmbus: palmbus@1e000000 { |
12906 |
++ i2c@900 { |
12907 |
++ status = "okay"; |
12908 |
++ }; |
12909 |
++ }; |
12910 |
++ |
12911 |
++ gpio-keys { |
12912 |
++ compatible = "gpio-keys"; |
12913 |
++ |
12914 |
++ reset { |
12915 |
++ label = "reset"; |
12916 |
++ gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; |
12917 |
++ linux,code = <KEY_RESTART>; |
12918 |
++ }; |
12919 |
++ }; |
12920 |
++}; |
12921 |
++ |
12922 |
++&sdhci { |
12923 |
++ status = "okay"; |
12924 |
++}; |
12925 |
++ |
12926 |
++&spi0 { |
12927 |
++ status = "okay"; |
12928 |
++ |
12929 |
++ m25p80@0 { |
12930 |
++ #address-cells = <1>; |
12931 |
++ #size-cells = <1>; |
12932 |
++ compatible = "jedec,spi-nor"; |
12933 |
++ reg = <0>; |
12934 |
++ spi-max-frequency = <50000000>; |
12935 |
++ broken-flash-reset; |
12936 |
++ |
12937 |
++ partition@0 { |
12938 |
++ label = "u-boot"; |
12939 |
++ reg = <0x0 0x30000>; |
12940 |
++ read-only; |
12941 |
++ }; |
12942 |
++ |
12943 |
++ partition@30000 { |
12944 |
++ label = "u-boot-env"; |
12945 |
++ reg = <0x30000 0x10000>; |
12946 |
++ read-only; |
12947 |
++ }; |
12948 |
++ |
12949 |
++ factory: partition@40000 { |
12950 |
++ label = "factory"; |
12951 |
++ reg = <0x40000 0x10000>; |
12952 |
++ read-only; |
12953 |
++ }; |
12954 |
++ |
12955 |
++ partition@50000 { |
12956 |
++ label = "firmware"; |
12957 |
++ reg = <0x50000 0x1fb0000>; |
12958 |
++ }; |
12959 |
++ }; |
12960 |
+ }; |
12961 |
+ |
12962 |
+-&default_gpio { |
12963 |
+- groups = "wdt", "uart3"; |
12964 |
+- function = "gpio"; |
12965 |
++&pcie { |
12966 |
++ status = "okay"; |
12967 |
+ }; |
12968 |
+ |
12969 |
+-&gmac1 { |
12970 |
+- status = "ok"; |
12971 |
++&pinctrl { |
12972 |
++ pinctrl-names = "default"; |
12973 |
++ pinctrl-0 = <&state_default>; |
12974 |
++ |
12975 |
++ state_default: state-default { |
12976 |
++ gpio-pinmux { |
12977 |
++ groups = "wdt"; |
12978 |
++ function = "gpio"; |
12979 |
++ }; |
12980 |
++ }; |
12981 |
+ }; |
12982 |
+ |
12983 |
+-&phy_external { |
12984 |
+- status = "ok"; |
12985 |
++ðernet { |
12986 |
++ gmac1: mac@1 { |
12987 |
++ status = "okay"; |
12988 |
++ phy-handle = <ðphy7>; |
12989 |
++ }; |
12990 |
++ |
12991 |
++ mdio-bus { |
12992 |
++ ethphy7: ethernet-phy@7 { |
12993 |
++ reg = <7>; |
12994 |
++ phy-mode = "rgmii-rxid"; |
12995 |
++ }; |
12996 |
++ }; |
12997 |
++}; |
12998 |
++ |
12999 |
++&switch0 { |
13000 |
++ ports { |
13001 |
++ port@0 { |
13002 |
++ status = "okay"; |
13003 |
++ label = "ethblack"; |
13004 |
++ }; |
13005 |
++ |
13006 |
++ port@4 { |
13007 |
++ status = "okay"; |
13008 |
++ label = "ethblue"; |
13009 |
++ }; |
13010 |
++ }; |
13011 |
+ }; |
13012 |
+diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi |
13013 |
+index 27222f7b246fd..91a7fa7482964 100644 |
13014 |
+--- a/drivers/staging/mt7621-dts/mt7621.dtsi |
13015 |
++++ b/drivers/staging/mt7621-dts/mt7621.dtsi |
13016 |
+@@ -56,9 +56,9 @@ |
13017 |
+ regulator-max-microvolt = <3300000>; |
13018 |
+ enable-active-high; |
13019 |
+ regulator-always-on; |
13020 |
+- }; |
13021 |
++ }; |
13022 |
+ |
13023 |
+- mmc_fixed_1v8_io: fixedregulator@1 { |
13024 |
++ mmc_fixed_1v8_io: fixedregulator@1 { |
13025 |
+ compatible = "regulator-fixed"; |
13026 |
+ regulator-name = "mmc_io"; |
13027 |
+ regulator-min-microvolt = <1800000>; |
13028 |
+@@ -412,37 +412,32 @@ |
13029 |
+ |
13030 |
+ mediatek,ethsys = <ðsys>; |
13031 |
+ |
13032 |
++ pinctrl-names = "default"; |
13033 |
++ pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>; |
13034 |
+ |
13035 |
+ gmac0: mac@0 { |
13036 |
+ compatible = "mediatek,eth-mac"; |
13037 |
+ reg = <0>; |
13038 |
+ phy-mode = "rgmii"; |
13039 |
++ |
13040 |
+ fixed-link { |
13041 |
+ speed = <1000>; |
13042 |
+ full-duplex; |
13043 |
+ pause; |
13044 |
+ }; |
13045 |
+ }; |
13046 |
++ |
13047 |
+ gmac1: mac@1 { |
13048 |
+ compatible = "mediatek,eth-mac"; |
13049 |
+ reg = <1>; |
13050 |
+ status = "off"; |
13051 |
+ phy-mode = "rgmii-rxid"; |
13052 |
+- phy-handle = <&phy_external>; |
13053 |
+ }; |
13054 |
++ |
13055 |
+ mdio-bus { |
13056 |
+ #address-cells = <1>; |
13057 |
+ #size-cells = <0>; |
13058 |
+ |
13059 |
+- phy_external: ethernet-phy@5 { |
13060 |
+- status = "off"; |
13061 |
+- reg = <5>; |
13062 |
+- phy-mode = "rgmii-rxid"; |
13063 |
+- |
13064 |
+- pinctrl-names = "default"; |
13065 |
+- pinctrl-0 = <&rgmii2_pins>; |
13066 |
+- }; |
13067 |
+- |
13068 |
+ switch0: switch0@0 { |
13069 |
+ compatible = "mediatek,mt7621"; |
13070 |
+ #address-cells = <1>; |
13071 |
+@@ -456,36 +451,43 @@ |
13072 |
+ #address-cells = <1>; |
13073 |
+ #size-cells = <0>; |
13074 |
+ reg = <0>; |
13075 |
++ |
13076 |
+ port@0 { |
13077 |
+ status = "off"; |
13078 |
+ reg = <0>; |
13079 |
+ label = "lan0"; |
13080 |
+ }; |
13081 |
++ |
13082 |
+ port@1 { |
13083 |
+ status = "off"; |
13084 |
+ reg = <1>; |
13085 |
+ label = "lan1"; |
13086 |
+ }; |
13087 |
++ |
13088 |
+ port@2 { |
13089 |
+ status = "off"; |
13090 |
+ reg = <2>; |
13091 |
+ label = "lan2"; |
13092 |
+ }; |
13093 |
++ |
13094 |
+ port@3 { |
13095 |
+ status = "off"; |
13096 |
+ reg = <3>; |
13097 |
+ label = "lan3"; |
13098 |
+ }; |
13099 |
++ |
13100 |
+ port@4 { |
13101 |
+ status = "off"; |
13102 |
+ reg = <4>; |
13103 |
+ label = "lan4"; |
13104 |
+ }; |
13105 |
++ |
13106 |
+ port@6 { |
13107 |
+ reg = <6>; |
13108 |
+ label = "cpu"; |
13109 |
+ ethernet = <&gmac0>; |
13110 |
+ phy-mode = "trgmii"; |
13111 |
++ |
13112 |
+ fixed-link { |
13113 |
+ speed = <1000>; |
13114 |
+ full-duplex; |
13115 |
+diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
13116 |
+index 793d7b58fc650..72a26867c2092 100644 |
13117 |
+--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
13118 |
++++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
13119 |
+@@ -53,7 +53,7 @@ struct int3400_thermal_priv { |
13120 |
+ struct art *arts; |
13121 |
+ int trt_count; |
13122 |
+ struct trt *trts; |
13123 |
+- u8 uuid_bitmap; |
13124 |
++ u32 uuid_bitmap; |
13125 |
+ int rel_misc_dev_res; |
13126 |
+ int current_uuid_index; |
13127 |
+ char *data_vault; |
13128 |
+@@ -466,6 +466,11 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) |
13129 |
+ priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer, |
13130 |
+ obj->package.elements[0].buffer.length, |
13131 |
+ GFP_KERNEL); |
13132 |
++ if (!priv->data_vault) { |
13133 |
++ kfree(buffer.pointer); |
13134 |
++ return; |
13135 |
++ } |
13136 |
++ |
13137 |
+ bin_attr_data_vault.private = priv->data_vault; |
13138 |
+ bin_attr_data_vault.size = obj->package.elements[0].buffer.length; |
13139 |
+ kfree(buffer.pointer); |
13140 |
+diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c |
13141 |
+index 2af1e5751bd63..796fbff623f6e 100644 |
13142 |
+--- a/drivers/tty/hvc/hvc_iucv.c |
13143 |
++++ b/drivers/tty/hvc/hvc_iucv.c |
13144 |
+@@ -1470,7 +1470,9 @@ out_error: |
13145 |
+ */ |
13146 |
+ static int __init hvc_iucv_config(char *val) |
13147 |
+ { |
13148 |
+- return kstrtoul(val, 10, &hvc_iucv_devices); |
13149 |
++ if (kstrtoul(val, 10, &hvc_iucv_devices)) |
13150 |
++ pr_warn("hvc_iucv= invalid parameter value '%s'\n", val); |
13151 |
++ return 1; |
13152 |
+ } |
13153 |
+ |
13154 |
+ |
13155 |
+diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c |
13156 |
+index 3703987c46661..8344265a1948b 100644 |
13157 |
+--- a/drivers/tty/mxser.c |
13158 |
++++ b/drivers/tty/mxser.c |
13159 |
+@@ -858,6 +858,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
13160 |
+ struct mxser_port *info = container_of(port, struct mxser_port, port); |
13161 |
+ unsigned long page; |
13162 |
+ unsigned long flags; |
13163 |
++ int ret; |
13164 |
+ |
13165 |
+ page = __get_free_page(GFP_KERNEL); |
13166 |
+ if (!page) |
13167 |
+@@ -867,9 +868,9 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
13168 |
+ |
13169 |
+ if (!info->ioaddr || !info->type) { |
13170 |
+ set_bit(TTY_IO_ERROR, &tty->flags); |
13171 |
+- free_page(page); |
13172 |
+ spin_unlock_irqrestore(&info->slock, flags); |
13173 |
+- return 0; |
13174 |
++ ret = 0; |
13175 |
++ goto err_free_xmit; |
13176 |
+ } |
13177 |
+ info->port.xmit_buf = (unsigned char *) page; |
13178 |
+ |
13179 |
+@@ -895,8 +896,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
13180 |
+ if (capable(CAP_SYS_ADMIN)) { |
13181 |
+ set_bit(TTY_IO_ERROR, &tty->flags); |
13182 |
+ return 0; |
13183 |
+- } else |
13184 |
+- return -ENODEV; |
13185 |
++ } |
13186 |
++ |
13187 |
++ ret = -ENODEV; |
13188 |
++ goto err_free_xmit; |
13189 |
+ } |
13190 |
+ |
13191 |
+ /* |
13192 |
+@@ -941,6 +944,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
13193 |
+ spin_unlock_irqrestore(&info->slock, flags); |
13194 |
+ |
13195 |
+ return 0; |
13196 |
++err_free_xmit: |
13197 |
++ free_page(page); |
13198 |
++ info->port.xmit_buf = NULL; |
13199 |
++ return ret; |
13200 |
+ } |
13201 |
+ |
13202 |
+ /* |
13203 |
+diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c |
13204 |
+index 890fa7ddaa7f3..b3c3f7e5851ab 100644 |
13205 |
+--- a/drivers/tty/serial/8250/8250_dma.c |
13206 |
++++ b/drivers/tty/serial/8250/8250_dma.c |
13207 |
+@@ -64,10 +64,19 @@ int serial8250_tx_dma(struct uart_8250_port *p) |
13208 |
+ struct uart_8250_dma *dma = p->dma; |
13209 |
+ struct circ_buf *xmit = &p->port.state->xmit; |
13210 |
+ struct dma_async_tx_descriptor *desc; |
13211 |
++ struct uart_port *up = &p->port; |
13212 |
+ int ret; |
13213 |
+ |
13214 |
+- if (dma->tx_running) |
13215 |
++ if (dma->tx_running) { |
13216 |
++ if (up->x_char) { |
13217 |
++ dmaengine_pause(dma->txchan); |
13218 |
++ uart_xchar_out(up, UART_TX); |
13219 |
++ dmaengine_resume(dma->txchan); |
13220 |
++ } |
13221 |
+ return 0; |
13222 |
++ } else if (up->x_char) { |
13223 |
++ uart_xchar_out(up, UART_TX); |
13224 |
++ } |
13225 |
+ |
13226 |
+ if (uart_tx_stopped(&p->port) || uart_circ_empty(xmit)) { |
13227 |
+ /* We have been called from __dma_tx_complete() */ |
13228 |
+diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c |
13229 |
+index 4dee8a9e0c951..dfb730b7ea2ae 100644 |
13230 |
+--- a/drivers/tty/serial/8250/8250_lpss.c |
13231 |
++++ b/drivers/tty/serial/8250/8250_lpss.c |
13232 |
+@@ -121,8 +121,7 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) |
13233 |
+ { |
13234 |
+ struct dw_dma_slave *param = &lpss->dma_param; |
13235 |
+ struct pci_dev *pdev = to_pci_dev(port->dev); |
13236 |
+- unsigned int dma_devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0); |
13237 |
+- struct pci_dev *dma_dev = pci_get_slot(pdev->bus, dma_devfn); |
13238 |
++ struct pci_dev *dma_dev; |
13239 |
+ |
13240 |
+ switch (pdev->device) { |
13241 |
+ case PCI_DEVICE_ID_INTEL_BYT_UART1: |
13242 |
+@@ -141,6 +140,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) |
13243 |
+ return -EINVAL; |
13244 |
+ } |
13245 |
+ |
13246 |
++ dma_dev = pci_get_slot(pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), 0)); |
13247 |
++ |
13248 |
+ param->dma_dev = &dma_dev->dev; |
13249 |
+ param->m_master = 0; |
13250 |
+ param->p_master = 1; |
13251 |
+@@ -156,11 +157,26 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) |
13252 |
+ return 0; |
13253 |
+ } |
13254 |
+ |
13255 |
++static void byt_serial_exit(struct lpss8250 *lpss) |
13256 |
++{ |
13257 |
++ struct dw_dma_slave *param = &lpss->dma_param; |
13258 |
++ |
13259 |
++ /* Paired with pci_get_slot() in the byt_serial_setup() above */ |
13260 |
++ put_device(param->dma_dev); |
13261 |
++} |
13262 |
++ |
13263 |
+ static int ehl_serial_setup(struct lpss8250 *lpss, struct uart_port *port) |
13264 |
+ { |
13265 |
+ return 0; |
13266 |
+ } |
13267 |
+ |
13268 |
++static void ehl_serial_exit(struct lpss8250 *lpss) |
13269 |
++{ |
13270 |
++ struct uart_8250_port *up = serial8250_get_port(lpss->data.line); |
13271 |
++ |
13272 |
++ up->dma = NULL; |
13273 |
++} |
13274 |
++ |
13275 |
+ #ifdef CONFIG_SERIAL_8250_DMA |
13276 |
+ static const struct dw_dma_platform_data qrk_serial_dma_pdata = { |
13277 |
+ .nr_channels = 2, |
13278 |
+@@ -335,8 +351,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
13279 |
+ return 0; |
13280 |
+ |
13281 |
+ err_exit: |
13282 |
+- if (lpss->board->exit) |
13283 |
+- lpss->board->exit(lpss); |
13284 |
++ lpss->board->exit(lpss); |
13285 |
+ pci_free_irq_vectors(pdev); |
13286 |
+ return ret; |
13287 |
+ } |
13288 |
+@@ -347,8 +362,7 @@ static void lpss8250_remove(struct pci_dev *pdev) |
13289 |
+ |
13290 |
+ serial8250_unregister_port(lpss->data.line); |
13291 |
+ |
13292 |
+- if (lpss->board->exit) |
13293 |
+- lpss->board->exit(lpss); |
13294 |
++ lpss->board->exit(lpss); |
13295 |
+ pci_free_irq_vectors(pdev); |
13296 |
+ } |
13297 |
+ |
13298 |
+@@ -356,12 +370,14 @@ static const struct lpss8250_board byt_board = { |
13299 |
+ .freq = 100000000, |
13300 |
+ .base_baud = 2764800, |
13301 |
+ .setup = byt_serial_setup, |
13302 |
++ .exit = byt_serial_exit, |
13303 |
+ }; |
13304 |
+ |
13305 |
+ static const struct lpss8250_board ehl_board = { |
13306 |
+ .freq = 200000000, |
13307 |
+ .base_baud = 12500000, |
13308 |
+ .setup = ehl_serial_setup, |
13309 |
++ .exit = ehl_serial_exit, |
13310 |
+ }; |
13311 |
+ |
13312 |
+ static const struct lpss8250_board qrk_board = { |
13313 |
+diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c |
13314 |
+index efa0515139f8e..e6c1791609ddf 100644 |
13315 |
+--- a/drivers/tty/serial/8250/8250_mid.c |
13316 |
++++ b/drivers/tty/serial/8250/8250_mid.c |
13317 |
+@@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p) |
13318 |
+ return 0; |
13319 |
+ } |
13320 |
+ |
13321 |
++static void pnw_exit(struct mid8250 *mid) |
13322 |
++{ |
13323 |
++ pci_dev_put(mid->dma_dev); |
13324 |
++} |
13325 |
++ |
13326 |
+ static int tng_handle_irq(struct uart_port *p) |
13327 |
+ { |
13328 |
+ struct mid8250 *mid = p->private_data; |
13329 |
+@@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p) |
13330 |
+ return 0; |
13331 |
+ } |
13332 |
+ |
13333 |
++static void tng_exit(struct mid8250 *mid) |
13334 |
++{ |
13335 |
++ pci_dev_put(mid->dma_dev); |
13336 |
++} |
13337 |
++ |
13338 |
+ static int dnv_handle_irq(struct uart_port *p) |
13339 |
+ { |
13340 |
+ struct mid8250 *mid = p->private_data; |
13341 |
+@@ -330,9 +340,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
13342 |
+ |
13343 |
+ pci_set_drvdata(pdev, mid); |
13344 |
+ return 0; |
13345 |
++ |
13346 |
+ err: |
13347 |
+- if (mid->board->exit) |
13348 |
+- mid->board->exit(mid); |
13349 |
++ mid->board->exit(mid); |
13350 |
+ return ret; |
13351 |
+ } |
13352 |
+ |
13353 |
+@@ -342,8 +352,7 @@ static void mid8250_remove(struct pci_dev *pdev) |
13354 |
+ |
13355 |
+ serial8250_unregister_port(mid->line); |
13356 |
+ |
13357 |
+- if (mid->board->exit) |
13358 |
+- mid->board->exit(mid); |
13359 |
++ mid->board->exit(mid); |
13360 |
+ } |
13361 |
+ |
13362 |
+ static const struct mid8250_board pnw_board = { |
13363 |
+@@ -351,6 +360,7 @@ static const struct mid8250_board pnw_board = { |
13364 |
+ .freq = 50000000, |
13365 |
+ .base_baud = 115200, |
13366 |
+ .setup = pnw_setup, |
13367 |
++ .exit = pnw_exit, |
13368 |
+ }; |
13369 |
+ |
13370 |
+ static const struct mid8250_board tng_board = { |
13371 |
+@@ -358,6 +368,7 @@ static const struct mid8250_board tng_board = { |
13372 |
+ .freq = 38400000, |
13373 |
+ .base_baud = 1843200, |
13374 |
+ .setup = tng_setup, |
13375 |
++ .exit = tng_exit, |
13376 |
+ }; |
13377 |
+ |
13378 |
+ static const struct mid8250_board dnv_board = { |
13379 |
+diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
13380 |
+index 7c07ebb37b1b9..3055353514e1d 100644 |
13381 |
+--- a/drivers/tty/serial/8250/8250_port.c |
13382 |
++++ b/drivers/tty/serial/8250/8250_port.c |
13383 |
+@@ -1620,6 +1620,18 @@ static inline void start_tx_rs485(struct uart_port *port) |
13384 |
+ struct uart_8250_port *up = up_to_u8250p(port); |
13385 |
+ struct uart_8250_em485 *em485 = up->em485; |
13386 |
+ |
13387 |
++ /* |
13388 |
++ * While serial8250_em485_handle_stop_tx() is a noop if |
13389 |
++ * em485->active_timer != &em485->stop_tx_timer, it might happen that |
13390 |
++ * the timer is still armed and triggers only after the current bunch of |
13391 |
++ * chars is send and em485->active_timer == &em485->stop_tx_timer again. |
13392 |
++ * So cancel the timer. There is still a theoretical race condition if |
13393 |
++ * the timer is already running and only comes around to check for |
13394 |
++ * em485->active_timer when &em485->stop_tx_timer is armed again. |
13395 |
++ */ |
13396 |
++ if (em485->active_timer == &em485->stop_tx_timer) |
13397 |
++ hrtimer_try_to_cancel(&em485->stop_tx_timer); |
13398 |
++ |
13399 |
+ em485->active_timer = NULL; |
13400 |
+ |
13401 |
+ if (em485->tx_stopped) { |
13402 |
+@@ -1805,9 +1817,7 @@ void serial8250_tx_chars(struct uart_8250_port *up) |
13403 |
+ int count; |
13404 |
+ |
13405 |
+ if (port->x_char) { |
13406 |
+- serial_out(up, UART_TX, port->x_char); |
13407 |
+- port->icount.tx++; |
13408 |
+- port->x_char = 0; |
13409 |
++ uart_xchar_out(port, UART_TX); |
13410 |
+ return; |
13411 |
+ } |
13412 |
+ if (uart_tx_stopped(port)) { |
13413 |
+diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c |
13414 |
+index 75d61e038a775..e538d6d75155e 100644 |
13415 |
+--- a/drivers/tty/serial/amba-pl010.c |
13416 |
++++ b/drivers/tty/serial/amba-pl010.c |
13417 |
+@@ -751,7 +751,7 @@ static int pl010_probe(struct amba_device *dev, const struct amba_id *id) |
13418 |
+ return ret; |
13419 |
+ } |
13420 |
+ |
13421 |
+-static int pl010_remove(struct amba_device *dev) |
13422 |
++static void pl010_remove(struct amba_device *dev) |
13423 |
+ { |
13424 |
+ struct uart_amba_port *uap = amba_get_drvdata(dev); |
13425 |
+ int i; |
13426 |
+@@ -767,8 +767,6 @@ static int pl010_remove(struct amba_device *dev) |
13427 |
+ |
13428 |
+ if (!busy) |
13429 |
+ uart_unregister_driver(&amba_reg); |
13430 |
+- |
13431 |
+- return 0; |
13432 |
+ } |
13433 |
+ |
13434 |
+ #ifdef CONFIG_PM_SLEEP |
13435 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
13436 |
+index 61183e7ff0097..07b19e97f850d 100644 |
13437 |
+--- a/drivers/tty/serial/amba-pl011.c |
13438 |
++++ b/drivers/tty/serial/amba-pl011.c |
13439 |
+@@ -2658,13 +2658,12 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) |
13440 |
+ return pl011_register_port(uap); |
13441 |
+ } |
13442 |
+ |
13443 |
+-static int pl011_remove(struct amba_device *dev) |
13444 |
++static void pl011_remove(struct amba_device *dev) |
13445 |
+ { |
13446 |
+ struct uart_amba_port *uap = amba_get_drvdata(dev); |
13447 |
+ |
13448 |
+ uart_remove_one_port(&amba_reg, &uap->port); |
13449 |
+ pl011_unregister_port(uap); |
13450 |
+- return 0; |
13451 |
+ } |
13452 |
+ |
13453 |
+ #ifdef CONFIG_PM_SLEEP |
13454 |
+diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c |
13455 |
+index 49d0c7f2b29b8..79b7db8580e05 100644 |
13456 |
+--- a/drivers/tty/serial/kgdboc.c |
13457 |
++++ b/drivers/tty/serial/kgdboc.c |
13458 |
+@@ -403,16 +403,16 @@ static int kgdboc_option_setup(char *opt) |
13459 |
+ { |
13460 |
+ if (!opt) { |
13461 |
+ pr_err("config string not provided\n"); |
13462 |
+- return -EINVAL; |
13463 |
++ return 1; |
13464 |
+ } |
13465 |
+ |
13466 |
+ if (strlen(opt) >= MAX_CONFIG_LEN) { |
13467 |
+ pr_err("config string too long\n"); |
13468 |
+- return -ENOSPC; |
13469 |
++ return 1; |
13470 |
+ } |
13471 |
+ strcpy(config, opt); |
13472 |
+ |
13473 |
+- return 0; |
13474 |
++ return 1; |
13475 |
+ } |
13476 |
+ |
13477 |
+ __setup("kgdboc=", kgdboc_option_setup); |
13478 |
+diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
13479 |
+index be0d9922e320e..19f0c5db11e33 100644 |
13480 |
+--- a/drivers/tty/serial/serial_core.c |
13481 |
++++ b/drivers/tty/serial/serial_core.c |
13482 |
+@@ -676,6 +676,20 @@ static void uart_flush_buffer(struct tty_struct *tty) |
13483 |
+ tty_port_tty_wakeup(&state->port); |
13484 |
+ } |
13485 |
+ |
13486 |
++/* |
13487 |
++ * This function performs low-level write of high-priority XON/XOFF |
13488 |
++ * character and accounting for it. |
13489 |
++ * |
13490 |
++ * Requires uart_port to implement .serial_out(). |
13491 |
++ */ |
13492 |
++void uart_xchar_out(struct uart_port *uport, int offset) |
13493 |
++{ |
13494 |
++ serial_port_out(uport, offset, uport->x_char); |
13495 |
++ uport->icount.tx++; |
13496 |
++ uport->x_char = 0; |
13497 |
++} |
13498 |
++EXPORT_SYMBOL_GPL(uart_xchar_out); |
13499 |
++ |
13500 |
+ /* |
13501 |
+ * This function is used to send a high-priority XON/XOFF character to |
13502 |
+ * the device |
13503 |
+diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
13504 |
+index 71b018e9a5735..460a8a86e3111 100644 |
13505 |
+--- a/drivers/usb/host/xhci-hub.c |
13506 |
++++ b/drivers/usb/host/xhci-hub.c |
13507 |
+@@ -676,7 +676,7 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci) |
13508 |
+ } |
13509 |
+ pm_runtime_allow(xhci_to_hcd(xhci)->self.controller); |
13510 |
+ xhci->test_mode = 0; |
13511 |
+- return xhci_reset(xhci); |
13512 |
++ return xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
13513 |
+ } |
13514 |
+ |
13515 |
+ void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port, |
13516 |
+@@ -1002,6 +1002,9 @@ static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status, |
13517 |
+ if (link_state == XDEV_U2) |
13518 |
+ *status |= USB_PORT_STAT_L1; |
13519 |
+ if (link_state == XDEV_U0) { |
13520 |
++ if (bus_state->resume_done[portnum]) |
13521 |
++ usb_hcd_end_port_resume(&port->rhub->hcd->self, |
13522 |
++ portnum); |
13523 |
+ bus_state->resume_done[portnum] = 0; |
13524 |
+ clear_bit(portnum, &bus_state->resuming_ports); |
13525 |
+ if (bus_state->suspended_ports & (1 << portnum)) { |
13526 |
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
13527 |
+index ed380ee58ab5d..024e8911df344 100644 |
13528 |
+--- a/drivers/usb/host/xhci-mem.c |
13529 |
++++ b/drivers/usb/host/xhci-mem.c |
13530 |
+@@ -2595,7 +2595,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
13531 |
+ |
13532 |
+ fail: |
13533 |
+ xhci_halt(xhci); |
13534 |
+- xhci_reset(xhci); |
13535 |
++ xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
13536 |
+ xhci_mem_cleanup(xhci); |
13537 |
+ return -ENOMEM; |
13538 |
+ } |
13539 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
13540 |
+index 49f74299d3f57..95effd28179b4 100644 |
13541 |
+--- a/drivers/usb/host/xhci.c |
13542 |
++++ b/drivers/usb/host/xhci.c |
13543 |
+@@ -66,7 +66,7 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) |
13544 |
+ * handshake done). There are two failure modes: "usec" have passed (major |
13545 |
+ * hardware flakeout), or the register reads as all-ones (hardware removed). |
13546 |
+ */ |
13547 |
+-int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) |
13548 |
++int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us) |
13549 |
+ { |
13550 |
+ u32 result; |
13551 |
+ int ret; |
13552 |
+@@ -74,7 +74,7 @@ int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) |
13553 |
+ ret = readl_poll_timeout_atomic(ptr, result, |
13554 |
+ (result & mask) == done || |
13555 |
+ result == U32_MAX, |
13556 |
+- 1, usec); |
13557 |
++ 1, timeout_us); |
13558 |
+ if (result == U32_MAX) /* card removed */ |
13559 |
+ return -ENODEV; |
13560 |
+ |
13561 |
+@@ -163,7 +163,7 @@ int xhci_start(struct xhci_hcd *xhci) |
13562 |
+ * Transactions will be terminated immediately, and operational registers |
13563 |
+ * will be set to their defaults. |
13564 |
+ */ |
13565 |
+-int xhci_reset(struct xhci_hcd *xhci) |
13566 |
++int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us) |
13567 |
+ { |
13568 |
+ u32 command; |
13569 |
+ u32 state; |
13570 |
+@@ -196,8 +196,7 @@ int xhci_reset(struct xhci_hcd *xhci) |
13571 |
+ if (xhci->quirks & XHCI_INTEL_HOST) |
13572 |
+ udelay(1000); |
13573 |
+ |
13574 |
+- ret = xhci_handshake(&xhci->op_regs->command, |
13575 |
+- CMD_RESET, 0, 10 * 1000 * 1000); |
13576 |
++ ret = xhci_handshake(&xhci->op_regs->command, CMD_RESET, 0, timeout_us); |
13577 |
+ if (ret) |
13578 |
+ return ret; |
13579 |
+ |
13580 |
+@@ -210,8 +209,7 @@ int xhci_reset(struct xhci_hcd *xhci) |
13581 |
+ * xHCI cannot write to any doorbells or operational registers other |
13582 |
+ * than status until the "Controller Not Ready" flag is cleared. |
13583 |
+ */ |
13584 |
+- ret = xhci_handshake(&xhci->op_regs->status, |
13585 |
+- STS_CNR, 0, 10 * 1000 * 1000); |
13586 |
++ ret = xhci_handshake(&xhci->op_regs->status, STS_CNR, 0, timeout_us); |
13587 |
+ |
13588 |
+ xhci->usb2_rhub.bus_state.port_c_suspend = 0; |
13589 |
+ xhci->usb2_rhub.bus_state.suspended_ports = 0; |
13590 |
+@@ -732,7 +730,7 @@ static void xhci_stop(struct usb_hcd *hcd) |
13591 |
+ xhci->xhc_state |= XHCI_STATE_HALTED; |
13592 |
+ xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
13593 |
+ xhci_halt(xhci); |
13594 |
+- xhci_reset(xhci); |
13595 |
++ xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
13596 |
+ spin_unlock_irq(&xhci->lock); |
13597 |
+ |
13598 |
+ xhci_cleanup_msix(xhci); |
13599 |
+@@ -785,7 +783,7 @@ void xhci_shutdown(struct usb_hcd *hcd) |
13600 |
+ xhci_halt(xhci); |
13601 |
+ /* Workaround for spurious wakeups at shutdown with HSW */ |
13602 |
+ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
13603 |
+- xhci_reset(xhci); |
13604 |
++ xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
13605 |
+ spin_unlock_irq(&xhci->lock); |
13606 |
+ |
13607 |
+ xhci_cleanup_msix(xhci); |
13608 |
+@@ -1170,7 +1168,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
13609 |
+ xhci_dbg(xhci, "Stop HCD\n"); |
13610 |
+ xhci_halt(xhci); |
13611 |
+ xhci_zero_64b_regs(xhci); |
13612 |
+- retval = xhci_reset(xhci); |
13613 |
++ retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC); |
13614 |
+ spin_unlock_irq(&xhci->lock); |
13615 |
+ if (retval) |
13616 |
+ return retval; |
13617 |
+@@ -5276,7 +5274,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) |
13618 |
+ |
13619 |
+ xhci_dbg(xhci, "Resetting HCD\n"); |
13620 |
+ /* Reset the internal HC memory state and registers. */ |
13621 |
+- retval = xhci_reset(xhci); |
13622 |
++ retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC); |
13623 |
+ if (retval) |
13624 |
+ return retval; |
13625 |
+ xhci_dbg(xhci, "Reset complete\n"); |
13626 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
13627 |
+index 45584a2783366..a46bbf5beffa9 100644 |
13628 |
+--- a/drivers/usb/host/xhci.h |
13629 |
++++ b/drivers/usb/host/xhci.h |
13630 |
+@@ -229,6 +229,9 @@ struct xhci_op_regs { |
13631 |
+ #define CMD_ETE (1 << 14) |
13632 |
+ /* bits 15:31 are reserved (and should be preserved on writes). */ |
13633 |
+ |
13634 |
++#define XHCI_RESET_LONG_USEC (10 * 1000 * 1000) |
13635 |
++#define XHCI_RESET_SHORT_USEC (250 * 1000) |
13636 |
++ |
13637 |
+ /* IMAN - Interrupt Management Register */ |
13638 |
+ #define IMAN_IE (1 << 1) |
13639 |
+ #define IMAN_IP (1 << 0) |
13640 |
+@@ -2068,11 +2071,11 @@ void xhci_free_container_ctx(struct xhci_hcd *xhci, |
13641 |
+ |
13642 |
+ /* xHCI host controller glue */ |
13643 |
+ typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); |
13644 |
+-int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec); |
13645 |
++int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us); |
13646 |
+ void xhci_quiesce(struct xhci_hcd *xhci); |
13647 |
+ int xhci_halt(struct xhci_hcd *xhci); |
13648 |
+ int xhci_start(struct xhci_hcd *xhci); |
13649 |
+-int xhci_reset(struct xhci_hcd *xhci); |
13650 |
++int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us); |
13651 |
+ int xhci_run(struct usb_hcd *hcd); |
13652 |
+ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); |
13653 |
+ void xhci_shutdown(struct usb_hcd *hcd); |
13654 |
+@@ -2455,6 +2458,8 @@ static inline const char *xhci_decode_ctrl_ctx(char *str, |
13655 |
+ unsigned int bit; |
13656 |
+ int ret = 0; |
13657 |
+ |
13658 |
++ str[0] = '\0'; |
13659 |
++ |
13660 |
+ if (drop) { |
13661 |
+ ret = sprintf(str, "Drop:"); |
13662 |
+ for_each_set_bit(bit, &drop, 32) |
13663 |
+@@ -2612,8 +2617,11 @@ static inline const char *xhci_decode_usbsts(char *str, u32 usbsts) |
13664 |
+ { |
13665 |
+ int ret = 0; |
13666 |
+ |
13667 |
++ ret = sprintf(str, " 0x%08x", usbsts); |
13668 |
++ |
13669 |
+ if (usbsts == ~(u32)0) |
13670 |
+- return " 0xffffffff"; |
13671 |
++ return str; |
13672 |
++ |
13673 |
+ if (usbsts & STS_HALT) |
13674 |
+ ret += sprintf(str + ret, " HCHalted"); |
13675 |
+ if (usbsts & STS_FATAL) |
13676 |
+diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig |
13677 |
+index 4007fa25a8ffa..169251ec8353e 100644 |
13678 |
+--- a/drivers/usb/serial/Kconfig |
13679 |
++++ b/drivers/usb/serial/Kconfig |
13680 |
+@@ -66,6 +66,7 @@ config USB_SERIAL_SIMPLE |
13681 |
+ - Libtransistor USB console |
13682 |
+ - a number of Motorola phones |
13683 |
+ - Motorola Tetra devices |
13684 |
++ - Nokia mobile phones |
13685 |
+ - Novatel Wireless GPS receivers |
13686 |
+ - Siemens USB/MPI adapter. |
13687 |
+ - ViVOtech ViVOpay USB device. |
13688 |
+diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
13689 |
+index 1bbe18f3f9f11..d736822e95e18 100644 |
13690 |
+--- a/drivers/usb/serial/pl2303.c |
13691 |
++++ b/drivers/usb/serial/pl2303.c |
13692 |
+@@ -116,6 +116,7 @@ static const struct usb_device_id id_table[] = { |
13693 |
+ { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530GC_PRODUCT_ID) }, |
13694 |
+ { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, |
13695 |
+ { USB_DEVICE(AT_VENDOR_ID, AT_VTKIT3_PRODUCT_ID) }, |
13696 |
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_PRODUCT_ID) }, |
13697 |
+ { } /* Terminating entry */ |
13698 |
+ }; |
13699 |
+ |
13700 |
+diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h |
13701 |
+index 6097ee8fccb25..c5406452b774e 100644 |
13702 |
+--- a/drivers/usb/serial/pl2303.h |
13703 |
++++ b/drivers/usb/serial/pl2303.h |
13704 |
+@@ -35,6 +35,9 @@ |
13705 |
+ #define ATEN_PRODUCT_UC232B 0x2022 |
13706 |
+ #define ATEN_PRODUCT_ID2 0x2118 |
13707 |
+ |
13708 |
++#define IBM_VENDOR_ID 0x04b3 |
13709 |
++#define IBM_PRODUCT_ID 0x4016 |
13710 |
++ |
13711 |
+ #define IODATA_VENDOR_ID 0x04bb |
13712 |
+ #define IODATA_PRODUCT_ID 0x0a03 |
13713 |
+ #define IODATA_PRODUCT_ID_RSAQ5 0x0a0e |
13714 |
+diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c |
13715 |
+index bd23a7cb1be2b..4c6747889a194 100644 |
13716 |
+--- a/drivers/usb/serial/usb-serial-simple.c |
13717 |
++++ b/drivers/usb/serial/usb-serial-simple.c |
13718 |
+@@ -91,6 +91,11 @@ DEVICE(moto_modem, MOTO_IDS); |
13719 |
+ { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ |
13720 |
+ DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); |
13721 |
+ |
13722 |
++/* Nokia mobile phone driver */ |
13723 |
++#define NOKIA_IDS() \ |
13724 |
++ { USB_DEVICE(0x0421, 0x069a) } /* Nokia 130 (RM-1035) */ |
13725 |
++DEVICE(nokia, NOKIA_IDS); |
13726 |
++ |
13727 |
+ /* Novatel Wireless GPS driver */ |
13728 |
+ #define NOVATEL_IDS() \ |
13729 |
+ { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */ |
13730 |
+@@ -123,6 +128,7 @@ static struct usb_serial_driver * const serial_drivers[] = { |
13731 |
+ &vivopay_device, |
13732 |
+ &moto_modem_device, |
13733 |
+ &motorola_tetra_device, |
13734 |
++ &nokia_device, |
13735 |
+ &novatel_gps_device, |
13736 |
+ &hp4x_device, |
13737 |
+ &suunto_device, |
13738 |
+@@ -140,6 +146,7 @@ static const struct usb_device_id id_table[] = { |
13739 |
+ VIVOPAY_IDS(), |
13740 |
+ MOTO_IDS(), |
13741 |
+ MOTOROLA_TETRA_IDS(), |
13742 |
++ NOKIA_IDS(), |
13743 |
+ NOVATEL_IDS(), |
13744 |
+ HP4X_IDS(), |
13745 |
+ SUUNTO_IDS(), |
13746 |
+diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c |
13747 |
+index 98c1aa594e6c4..c9ce1c25c80cc 100644 |
13748 |
+--- a/drivers/usb/storage/ene_ub6250.c |
13749 |
++++ b/drivers/usb/storage/ene_ub6250.c |
13750 |
+@@ -237,36 +237,33 @@ static struct us_unusual_dev ene_ub6250_unusual_dev_list[] = { |
13751 |
+ #define memstick_logaddr(logadr1, logadr0) ((((u16)(logadr1)) << 8) | (logadr0)) |
13752 |
+ |
13753 |
+ |
13754 |
+-struct SD_STATUS { |
13755 |
+- u8 Insert:1; |
13756 |
+- u8 Ready:1; |
13757 |
+- u8 MediaChange:1; |
13758 |
+- u8 IsMMC:1; |
13759 |
+- u8 HiCapacity:1; |
13760 |
+- u8 HiSpeed:1; |
13761 |
+- u8 WtP:1; |
13762 |
+- u8 Reserved:1; |
13763 |
+-}; |
13764 |
+- |
13765 |
+-struct MS_STATUS { |
13766 |
+- u8 Insert:1; |
13767 |
+- u8 Ready:1; |
13768 |
+- u8 MediaChange:1; |
13769 |
+- u8 IsMSPro:1; |
13770 |
+- u8 IsMSPHG:1; |
13771 |
+- u8 Reserved1:1; |
13772 |
+- u8 WtP:1; |
13773 |
+- u8 Reserved2:1; |
13774 |
+-}; |
13775 |
+- |
13776 |
+-struct SM_STATUS { |
13777 |
+- u8 Insert:1; |
13778 |
+- u8 Ready:1; |
13779 |
+- u8 MediaChange:1; |
13780 |
+- u8 Reserved:3; |
13781 |
+- u8 WtP:1; |
13782 |
+- u8 IsMS:1; |
13783 |
+-}; |
13784 |
++/* SD_STATUS bits */ |
13785 |
++#define SD_Insert BIT(0) |
13786 |
++#define SD_Ready BIT(1) |
13787 |
++#define SD_MediaChange BIT(2) |
13788 |
++#define SD_IsMMC BIT(3) |
13789 |
++#define SD_HiCapacity BIT(4) |
13790 |
++#define SD_HiSpeed BIT(5) |
13791 |
++#define SD_WtP BIT(6) |
13792 |
++ /* Bit 7 reserved */ |
13793 |
++ |
13794 |
++/* MS_STATUS bits */ |
13795 |
++#define MS_Insert BIT(0) |
13796 |
++#define MS_Ready BIT(1) |
13797 |
++#define MS_MediaChange BIT(2) |
13798 |
++#define MS_IsMSPro BIT(3) |
13799 |
++#define MS_IsMSPHG BIT(4) |
13800 |
++ /* Bit 5 reserved */ |
13801 |
++#define MS_WtP BIT(6) |
13802 |
++ /* Bit 7 reserved */ |
13803 |
++ |
13804 |
++/* SM_STATUS bits */ |
13805 |
++#define SM_Insert BIT(0) |
13806 |
++#define SM_Ready BIT(1) |
13807 |
++#define SM_MediaChange BIT(2) |
13808 |
++ /* Bits 3-5 reserved */ |
13809 |
++#define SM_WtP BIT(6) |
13810 |
++#define SM_IsMS BIT(7) |
13811 |
+ |
13812 |
+ struct ms_bootblock_cis { |
13813 |
+ u8 bCistplDEVICE[6]; /* 0 */ |
13814 |
+@@ -437,9 +434,9 @@ struct ene_ub6250_info { |
13815 |
+ u8 *bbuf; |
13816 |
+ |
13817 |
+ /* for 6250 code */ |
13818 |
+- struct SD_STATUS SD_Status; |
13819 |
+- struct MS_STATUS MS_Status; |
13820 |
+- struct SM_STATUS SM_Status; |
13821 |
++ u8 SD_Status; |
13822 |
++ u8 MS_Status; |
13823 |
++ u8 SM_Status; |
13824 |
+ |
13825 |
+ /* ----- SD Control Data ---------------- */ |
13826 |
+ /*SD_REGISTER SD_Regs; */ |
13827 |
+@@ -602,7 +599,7 @@ static int sd_scsi_test_unit_ready(struct us_data *us, struct scsi_cmnd *srb) |
13828 |
+ { |
13829 |
+ struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
13830 |
+ |
13831 |
+- if (info->SD_Status.Insert && info->SD_Status.Ready) |
13832 |
++ if ((info->SD_Status & SD_Insert) && (info->SD_Status & SD_Ready)) |
13833 |
+ return USB_STOR_TRANSPORT_GOOD; |
13834 |
+ else { |
13835 |
+ ene_sd_init(us); |
13836 |
+@@ -622,7 +619,7 @@ static int sd_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) |
13837 |
+ 0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, |
13838 |
+ 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00 }; |
13839 |
+ |
13840 |
+- if (info->SD_Status.WtP) |
13841 |
++ if (info->SD_Status & SD_WtP) |
13842 |
+ usb_stor_set_xfer_buf(mediaWP, 12, srb); |
13843 |
+ else |
13844 |
+ usb_stor_set_xfer_buf(mediaNoWP, 12, srb); |
13845 |
+@@ -641,9 +638,9 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) |
13846 |
+ struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
13847 |
+ |
13848 |
+ usb_stor_dbg(us, "sd_scsi_read_capacity\n"); |
13849 |
+- if (info->SD_Status.HiCapacity) { |
13850 |
++ if (info->SD_Status & SD_HiCapacity) { |
13851 |
+ bl_len = 0x200; |
13852 |
+- if (info->SD_Status.IsMMC) |
13853 |
++ if (info->SD_Status & SD_IsMMC) |
13854 |
+ bl_num = info->HC_C_SIZE-1; |
13855 |
+ else |
13856 |
+ bl_num = (info->HC_C_SIZE + 1) * 1024 - 1; |
13857 |
+@@ -693,7 +690,7 @@ static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb) |
13858 |
+ return USB_STOR_TRANSPORT_ERROR; |
13859 |
+ } |
13860 |
+ |
13861 |
+- if (info->SD_Status.HiCapacity) |
13862 |
++ if (info->SD_Status & SD_HiCapacity) |
13863 |
+ bnByte = bn; |
13864 |
+ |
13865 |
+ /* set up the command wrapper */ |
13866 |
+@@ -733,7 +730,7 @@ static int sd_scsi_write(struct us_data *us, struct scsi_cmnd *srb) |
13867 |
+ return USB_STOR_TRANSPORT_ERROR; |
13868 |
+ } |
13869 |
+ |
13870 |
+- if (info->SD_Status.HiCapacity) |
13871 |
++ if (info->SD_Status & SD_HiCapacity) |
13872 |
+ bnByte = bn; |
13873 |
+ |
13874 |
+ /* set up the command wrapper */ |
13875 |
+@@ -1455,7 +1452,7 @@ static int ms_scsi_test_unit_ready(struct us_data *us, struct scsi_cmnd *srb) |
13876 |
+ struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
13877 |
+ |
13878 |
+ /* pr_info("MS_SCSI_Test_Unit_Ready\n"); */ |
13879 |
+- if (info->MS_Status.Insert && info->MS_Status.Ready) { |
13880 |
++ if ((info->MS_Status & MS_Insert) && (info->MS_Status & MS_Ready)) { |
13881 |
+ return USB_STOR_TRANSPORT_GOOD; |
13882 |
+ } else { |
13883 |
+ ene_ms_init(us); |
13884 |
+@@ -1475,7 +1472,7 @@ static int ms_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) |
13885 |
+ 0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, |
13886 |
+ 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00 }; |
13887 |
+ |
13888 |
+- if (info->MS_Status.WtP) |
13889 |
++ if (info->MS_Status & MS_WtP) |
13890 |
+ usb_stor_set_xfer_buf(mediaWP, 12, srb); |
13891 |
+ else |
13892 |
+ usb_stor_set_xfer_buf(mediaNoWP, 12, srb); |
13893 |
+@@ -1494,7 +1491,7 @@ static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) |
13894 |
+ |
13895 |
+ usb_stor_dbg(us, "ms_scsi_read_capacity\n"); |
13896 |
+ bl_len = 0x200; |
13897 |
+- if (info->MS_Status.IsMSPro) |
13898 |
++ if (info->MS_Status & MS_IsMSPro) |
13899 |
+ bl_num = info->MSP_TotalBlock - 1; |
13900 |
+ else |
13901 |
+ bl_num = info->MS_Lib.NumberOfLogBlock * info->MS_Lib.blockSize * 2 - 1; |
13902 |
+@@ -1649,7 +1646,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb) |
13903 |
+ if (bn > info->bl_num) |
13904 |
+ return USB_STOR_TRANSPORT_ERROR; |
13905 |
+ |
13906 |
+- if (info->MS_Status.IsMSPro) { |
13907 |
++ if (info->MS_Status & MS_IsMSPro) { |
13908 |
+ result = ene_load_bincode(us, MSP_RW_PATTERN); |
13909 |
+ if (result != USB_STOR_XFER_GOOD) { |
13910 |
+ usb_stor_dbg(us, "Load MPS RW pattern Fail !!\n"); |
13911 |
+@@ -1750,7 +1747,7 @@ static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb) |
13912 |
+ if (bn > info->bl_num) |
13913 |
+ return USB_STOR_TRANSPORT_ERROR; |
13914 |
+ |
13915 |
+- if (info->MS_Status.IsMSPro) { |
13916 |
++ if (info->MS_Status & MS_IsMSPro) { |
13917 |
+ result = ene_load_bincode(us, MSP_RW_PATTERN); |
13918 |
+ if (result != USB_STOR_XFER_GOOD) { |
13919 |
+ pr_info("Load MSP RW pattern Fail !!\n"); |
13920 |
+@@ -1858,12 +1855,12 @@ static int ene_get_card_status(struct us_data *us, u8 *buf) |
13921 |
+ |
13922 |
+ tmpreg = (u16) reg4b; |
13923 |
+ reg4b = *(u32 *)(&buf[0x14]); |
13924 |
+- if (info->SD_Status.HiCapacity && !info->SD_Status.IsMMC) |
13925 |
++ if ((info->SD_Status & SD_HiCapacity) && !(info->SD_Status & SD_IsMMC)) |
13926 |
+ info->HC_C_SIZE = (reg4b >> 8) & 0x3fffff; |
13927 |
+ |
13928 |
+ info->SD_C_SIZE = ((tmpreg & 0x03) << 10) | (u16)(reg4b >> 22); |
13929 |
+ info->SD_C_SIZE_MULT = (u8)(reg4b >> 7) & 0x07; |
13930 |
+- if (info->SD_Status.HiCapacity && info->SD_Status.IsMMC) |
13931 |
++ if ((info->SD_Status & SD_HiCapacity) && (info->SD_Status & SD_IsMMC)) |
13932 |
+ info->HC_C_SIZE = *(u32 *)(&buf[0x100]); |
13933 |
+ |
13934 |
+ if (info->SD_READ_BL_LEN > SD_BLOCK_LEN) { |
13935 |
+@@ -2075,6 +2072,7 @@ static int ene_ms_init(struct us_data *us) |
13936 |
+ u16 MSP_BlockSize, MSP_UserAreaBlocks; |
13937 |
+ struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
13938 |
+ u8 *bbuf = info->bbuf; |
13939 |
++ unsigned int s; |
13940 |
+ |
13941 |
+ printk(KERN_INFO "transport --- ENE_MSInit\n"); |
13942 |
+ |
13943 |
+@@ -2099,15 +2097,16 @@ static int ene_ms_init(struct us_data *us) |
13944 |
+ return USB_STOR_TRANSPORT_ERROR; |
13945 |
+ } |
13946 |
+ /* the same part to test ENE */ |
13947 |
+- info->MS_Status = *(struct MS_STATUS *) bbuf; |
13948 |
+- |
13949 |
+- if (info->MS_Status.Insert && info->MS_Status.Ready) { |
13950 |
+- printk(KERN_INFO "Insert = %x\n", info->MS_Status.Insert); |
13951 |
+- printk(KERN_INFO "Ready = %x\n", info->MS_Status.Ready); |
13952 |
+- printk(KERN_INFO "IsMSPro = %x\n", info->MS_Status.IsMSPro); |
13953 |
+- printk(KERN_INFO "IsMSPHG = %x\n", info->MS_Status.IsMSPHG); |
13954 |
+- printk(KERN_INFO "WtP= %x\n", info->MS_Status.WtP); |
13955 |
+- if (info->MS_Status.IsMSPro) { |
13956 |
++ info->MS_Status = bbuf[0]; |
13957 |
++ |
13958 |
++ s = info->MS_Status; |
13959 |
++ if ((s & MS_Insert) && (s & MS_Ready)) { |
13960 |
++ printk(KERN_INFO "Insert = %x\n", !!(s & MS_Insert)); |
13961 |
++ printk(KERN_INFO "Ready = %x\n", !!(s & MS_Ready)); |
13962 |
++ printk(KERN_INFO "IsMSPro = %x\n", !!(s & MS_IsMSPro)); |
13963 |
++ printk(KERN_INFO "IsMSPHG = %x\n", !!(s & MS_IsMSPHG)); |
13964 |
++ printk(KERN_INFO "WtP= %x\n", !!(s & MS_WtP)); |
13965 |
++ if (s & MS_IsMSPro) { |
13966 |
+ MSP_BlockSize = (bbuf[6] << 8) | bbuf[7]; |
13967 |
+ MSP_UserAreaBlocks = (bbuf[10] << 8) | bbuf[11]; |
13968 |
+ info->MSP_TotalBlock = MSP_BlockSize * MSP_UserAreaBlocks; |
13969 |
+@@ -2168,17 +2167,17 @@ static int ene_sd_init(struct us_data *us) |
13970 |
+ return USB_STOR_TRANSPORT_ERROR; |
13971 |
+ } |
13972 |
+ |
13973 |
+- info->SD_Status = *(struct SD_STATUS *) bbuf; |
13974 |
+- if (info->SD_Status.Insert && info->SD_Status.Ready) { |
13975 |
+- struct SD_STATUS *s = &info->SD_Status; |
13976 |
++ info->SD_Status = bbuf[0]; |
13977 |
++ if ((info->SD_Status & SD_Insert) && (info->SD_Status & SD_Ready)) { |
13978 |
++ unsigned int s = info->SD_Status; |
13979 |
+ |
13980 |
+ ene_get_card_status(us, bbuf); |
13981 |
+- usb_stor_dbg(us, "Insert = %x\n", s->Insert); |
13982 |
+- usb_stor_dbg(us, "Ready = %x\n", s->Ready); |
13983 |
+- usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC); |
13984 |
+- usb_stor_dbg(us, "HiCapacity = %x\n", s->HiCapacity); |
13985 |
+- usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed); |
13986 |
+- usb_stor_dbg(us, "WtP = %x\n", s->WtP); |
13987 |
++ usb_stor_dbg(us, "Insert = %x\n", !!(s & SD_Insert)); |
13988 |
++ usb_stor_dbg(us, "Ready = %x\n", !!(s & SD_Ready)); |
13989 |
++ usb_stor_dbg(us, "IsMMC = %x\n", !!(s & SD_IsMMC)); |
13990 |
++ usb_stor_dbg(us, "HiCapacity = %x\n", !!(s & SD_HiCapacity)); |
13991 |
++ usb_stor_dbg(us, "HiSpeed = %x\n", !!(s & SD_HiSpeed)); |
13992 |
++ usb_stor_dbg(us, "WtP = %x\n", !!(s & SD_WtP)); |
13993 |
+ } else { |
13994 |
+ usb_stor_dbg(us, "SD Card Not Ready --- %x\n", bbuf[0]); |
13995 |
+ return USB_STOR_TRANSPORT_ERROR; |
13996 |
+@@ -2200,14 +2199,14 @@ static int ene_init(struct us_data *us) |
13997 |
+ |
13998 |
+ misc_reg03 = bbuf[0]; |
13999 |
+ if (misc_reg03 & 0x01) { |
14000 |
+- if (!info->SD_Status.Ready) { |
14001 |
++ if (!(info->SD_Status & SD_Ready)) { |
14002 |
+ result = ene_sd_init(us); |
14003 |
+ if (result != USB_STOR_XFER_GOOD) |
14004 |
+ return USB_STOR_TRANSPORT_ERROR; |
14005 |
+ } |
14006 |
+ } |
14007 |
+ if (misc_reg03 & 0x02) { |
14008 |
+- if (!info->MS_Status.Ready) { |
14009 |
++ if (!(info->MS_Status & MS_Ready)) { |
14010 |
+ result = ene_ms_init(us); |
14011 |
+ if (result != USB_STOR_XFER_GOOD) |
14012 |
+ return USB_STOR_TRANSPORT_ERROR; |
14013 |
+@@ -2306,14 +2305,14 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us) |
14014 |
+ |
14015 |
+ /*US_DEBUG(usb_stor_show_command(us, srb)); */ |
14016 |
+ scsi_set_resid(srb, 0); |
14017 |
+- if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready))) |
14018 |
++ if (unlikely(!(info->SD_Status & SD_Ready) || (info->MS_Status & MS_Ready))) |
14019 |
+ result = ene_init(us); |
14020 |
+ if (result == USB_STOR_XFER_GOOD) { |
14021 |
+ result = USB_STOR_TRANSPORT_ERROR; |
14022 |
+- if (info->SD_Status.Ready) |
14023 |
++ if (info->SD_Status & SD_Ready) |
14024 |
+ result = sd_scsi_irp(us, srb); |
14025 |
+ |
14026 |
+- if (info->MS_Status.Ready) |
14027 |
++ if (info->MS_Status & MS_Ready) |
14028 |
+ result = ms_scsi_irp(us, srb); |
14029 |
+ } |
14030 |
+ return result; |
14031 |
+@@ -2377,7 +2376,6 @@ static int ene_ub6250_probe(struct usb_interface *intf, |
14032 |
+ |
14033 |
+ static int ene_ub6250_resume(struct usb_interface *iface) |
14034 |
+ { |
14035 |
+- u8 tmp = 0; |
14036 |
+ struct us_data *us = usb_get_intfdata(iface); |
14037 |
+ struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
14038 |
+ |
14039 |
+@@ -2389,17 +2387,16 @@ static int ene_ub6250_resume(struct usb_interface *iface) |
14040 |
+ mutex_unlock(&us->dev_mutex); |
14041 |
+ |
14042 |
+ info->Power_IsResum = true; |
14043 |
+- /*info->SD_Status.Ready = 0; */ |
14044 |
+- info->SD_Status = *(struct SD_STATUS *)&tmp; |
14045 |
+- info->MS_Status = *(struct MS_STATUS *)&tmp; |
14046 |
+- info->SM_Status = *(struct SM_STATUS *)&tmp; |
14047 |
++ /* info->SD_Status &= ~SD_Ready; */ |
14048 |
++ info->SD_Status = 0; |
14049 |
++ info->MS_Status = 0; |
14050 |
++ info->SM_Status = 0; |
14051 |
+ |
14052 |
+ return 0; |
14053 |
+ } |
14054 |
+ |
14055 |
+ static int ene_ub6250_reset_resume(struct usb_interface *iface) |
14056 |
+ { |
14057 |
+- u8 tmp = 0; |
14058 |
+ struct us_data *us = usb_get_intfdata(iface); |
14059 |
+ struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
14060 |
+ |
14061 |
+@@ -2411,10 +2408,10 @@ static int ene_ub6250_reset_resume(struct usb_interface *iface) |
14062 |
+ * the device |
14063 |
+ */ |
14064 |
+ info->Power_IsResum = true; |
14065 |
+- /*info->SD_Status.Ready = 0; */ |
14066 |
+- info->SD_Status = *(struct SD_STATUS *)&tmp; |
14067 |
+- info->MS_Status = *(struct MS_STATUS *)&tmp; |
14068 |
+- info->SM_Status = *(struct SM_STATUS *)&tmp; |
14069 |
++ /* info->SD_Status &= ~SD_Ready; */ |
14070 |
++ info->SD_Status = 0; |
14071 |
++ info->MS_Status = 0; |
14072 |
++ info->SM_Status = 0; |
14073 |
+ |
14074 |
+ return 0; |
14075 |
+ } |
14076 |
+diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c |
14077 |
+index 3789698d9d3c6..0c423916d7bfa 100644 |
14078 |
+--- a/drivers/usb/storage/realtek_cr.c |
14079 |
++++ b/drivers/usb/storage/realtek_cr.c |
14080 |
+@@ -365,7 +365,7 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) |
14081 |
+ |
14082 |
+ buf = kmalloc(len, GFP_NOIO); |
14083 |
+ if (buf == NULL) |
14084 |
+- return USB_STOR_TRANSPORT_ERROR; |
14085 |
++ return -ENOMEM; |
14086 |
+ |
14087 |
+ usb_stor_dbg(us, "addr = 0x%x, len = %d\n", addr, len); |
14088 |
+ |
14089 |
+diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c |
14090 |
+index 65d6f8fd81e70..577ff786f11b1 100644 |
14091 |
+--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c |
14092 |
++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c |
14093 |
+@@ -1482,11 +1482,25 @@ static u64 mlx5_vdpa_get_features(struct vdpa_device *vdev) |
14094 |
+ return ndev->mvdev.mlx_features; |
14095 |
+ } |
14096 |
+ |
14097 |
+-static int verify_min_features(struct mlx5_vdpa_dev *mvdev, u64 features) |
14098 |
++static int verify_driver_features(struct mlx5_vdpa_dev *mvdev, u64 features) |
14099 |
+ { |
14100 |
++ /* Minimum features to expect */ |
14101 |
+ if (!(features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM))) |
14102 |
+ return -EOPNOTSUPP; |
14103 |
+ |
14104 |
++ /* Double check features combination sent down by the driver. |
14105 |
++ * Fail invalid features due to absence of the depended feature. |
14106 |
++ * |
14107 |
++ * Per VIRTIO v1.1 specification, section 5.1.3.1 Feature bit |
14108 |
++ * requirements: "VIRTIO_NET_F_MQ Requires VIRTIO_NET_F_CTRL_VQ". |
14109 |
++ * By failing the invalid features sent down by untrusted drivers, |
14110 |
++ * we're assured the assumption made upon is_index_valid() and |
14111 |
++ * is_ctrl_vq_idx() will not be compromised. |
14112 |
++ */ |
14113 |
++ if ((features & (BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ))) == |
14114 |
++ BIT_ULL(VIRTIO_NET_F_MQ)) |
14115 |
++ return -EINVAL; |
14116 |
++ |
14117 |
+ return 0; |
14118 |
+ } |
14119 |
+ |
14120 |
+@@ -1544,7 +1558,7 @@ static int mlx5_vdpa_set_features(struct vdpa_device *vdev, u64 features) |
14121 |
+ |
14122 |
+ print_features(mvdev, features, true); |
14123 |
+ |
14124 |
+- err = verify_min_features(mvdev, features); |
14125 |
++ err = verify_driver_features(mvdev, features); |
14126 |
+ if (err) |
14127 |
+ return err; |
14128 |
+ |
14129 |
+diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c |
14130 |
+index 9636a2afaecd1..3626c21501017 100644 |
14131 |
+--- a/drivers/vfio/platform/vfio_amba.c |
14132 |
++++ b/drivers/vfio/platform/vfio_amba.c |
14133 |
+@@ -71,18 +71,13 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id) |
14134 |
+ return ret; |
14135 |
+ } |
14136 |
+ |
14137 |
+-static int vfio_amba_remove(struct amba_device *adev) |
14138 |
++static void vfio_amba_remove(struct amba_device *adev) |
14139 |
+ { |
14140 |
+- struct vfio_platform_device *vdev; |
14141 |
+- |
14142 |
+- vdev = vfio_platform_remove_common(&adev->dev); |
14143 |
+- if (vdev) { |
14144 |
+- kfree(vdev->name); |
14145 |
+- kfree(vdev); |
14146 |
+- return 0; |
14147 |
+- } |
14148 |
++ struct vfio_platform_device *vdev = |
14149 |
++ vfio_platform_remove_common(&adev->dev); |
14150 |
+ |
14151 |
+- return -EINVAL; |
14152 |
++ kfree(vdev->name); |
14153 |
++ kfree(vdev); |
14154 |
+ } |
14155 |
+ |
14156 |
+ static const struct amba_id pl330_ids[] = { |
14157 |
+diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c |
14158 |
+index b7682de412d83..33595cc4778e9 100644 |
14159 |
+--- a/drivers/video/fbdev/amba-clcd.c |
14160 |
++++ b/drivers/video/fbdev/amba-clcd.c |
14161 |
+@@ -925,7 +925,7 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id) |
14162 |
+ return ret; |
14163 |
+ } |
14164 |
+ |
14165 |
+-static int clcdfb_remove(struct amba_device *dev) |
14166 |
++static void clcdfb_remove(struct amba_device *dev) |
14167 |
+ { |
14168 |
+ struct clcd_fb *fb = amba_get_drvdata(dev); |
14169 |
+ |
14170 |
+@@ -942,8 +942,6 @@ static int clcdfb_remove(struct amba_device *dev) |
14171 |
+ kfree(fb); |
14172 |
+ |
14173 |
+ amba_release_regions(dev); |
14174 |
+- |
14175 |
+- return 0; |
14176 |
+ } |
14177 |
+ |
14178 |
+ static const struct amba_id clcdfb_id_table[] = { |
14179 |
+diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c |
14180 |
+index f253daa05d9d3..a7a1739cff1bd 100644 |
14181 |
+--- a/drivers/video/fbdev/atafb.c |
14182 |
++++ b/drivers/video/fbdev/atafb.c |
14183 |
+@@ -1691,9 +1691,9 @@ static int falcon_setcolreg(unsigned int regno, unsigned int red, |
14184 |
+ ((blue & 0xfc00) >> 8)); |
14185 |
+ if (regno < 16) { |
14186 |
+ shifter_tt.color_reg[regno] = |
14187 |
+- (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) | |
14188 |
+- (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) | |
14189 |
+- ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); |
14190 |
++ ((((red & 0xe000) >> 13) | ((red & 0x1000) >> 12)) << 8) | |
14191 |
++ ((((green & 0xe000) >> 13) | ((green & 0x1000) >> 12)) << 4) | |
14192 |
++ ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); |
14193 |
+ ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) | |
14194 |
+ ((green & 0xfc00) >> 5) | |
14195 |
+ ((blue & 0xf800) >> 11)); |
14196 |
+@@ -1979,9 +1979,9 @@ static int stste_setcolreg(unsigned int regno, unsigned int red, |
14197 |
+ green >>= 12; |
14198 |
+ if (ATARIHW_PRESENT(EXTD_SHIFTER)) |
14199 |
+ shifter_tt.color_reg[regno] = |
14200 |
+- (((red & 0xe) >> 1) | ((red & 1) << 3) << 8) | |
14201 |
+- (((green & 0xe) >> 1) | ((green & 1) << 3) << 4) | |
14202 |
+- ((blue & 0xe) >> 1) | ((blue & 1) << 3); |
14203 |
++ ((((red & 0xe) >> 1) | ((red & 1) << 3)) << 8) | |
14204 |
++ ((((green & 0xe) >> 1) | ((green & 1) << 3)) << 4) | |
14205 |
++ ((blue & 0xe) >> 1) | ((blue & 1) << 3); |
14206 |
+ else |
14207 |
+ shifter_tt.color_reg[regno] = |
14208 |
+ ((red & 0xe) << 7) | |
14209 |
+diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c |
14210 |
+index 355b6120dc4f0..1fc8de4ecbebf 100644 |
14211 |
+--- a/drivers/video/fbdev/atmel_lcdfb.c |
14212 |
++++ b/drivers/video/fbdev/atmel_lcdfb.c |
14213 |
+@@ -1062,15 +1062,16 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) |
14214 |
+ |
14215 |
+ INIT_LIST_HEAD(&info->modelist); |
14216 |
+ |
14217 |
+- if (pdev->dev.of_node) { |
14218 |
+- ret = atmel_lcdfb_of_init(sinfo); |
14219 |
+- if (ret) |
14220 |
+- goto free_info; |
14221 |
+- } else { |
14222 |
++ if (!pdev->dev.of_node) { |
14223 |
+ dev_err(dev, "cannot get default configuration\n"); |
14224 |
+ goto free_info; |
14225 |
+ } |
14226 |
+ |
14227 |
++ ret = atmel_lcdfb_of_init(sinfo); |
14228 |
++ if (ret) |
14229 |
++ goto free_info; |
14230 |
++ |
14231 |
++ ret = -ENODEV; |
14232 |
+ if (!sinfo->config) |
14233 |
+ goto free_info; |
14234 |
+ |
14235 |
+diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c |
14236 |
+index 15a9ee7cd734d..b4980bc2985e3 100644 |
14237 |
+--- a/drivers/video/fbdev/cirrusfb.c |
14238 |
++++ b/drivers/video/fbdev/cirrusfb.c |
14239 |
+@@ -469,7 +469,7 @@ static int cirrusfb_check_mclk(struct fb_info *info, long freq) |
14240 |
+ return 0; |
14241 |
+ } |
14242 |
+ |
14243 |
+-static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, |
14244 |
++static int cirrusfb_check_pixclock(struct fb_var_screeninfo *var, |
14245 |
+ struct fb_info *info) |
14246 |
+ { |
14247 |
+ long freq; |
14248 |
+@@ -478,9 +478,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, |
14249 |
+ unsigned maxclockidx = var->bits_per_pixel >> 3; |
14250 |
+ |
14251 |
+ /* convert from ps to kHz */ |
14252 |
+- freq = PICOS2KHZ(var->pixclock); |
14253 |
+- |
14254 |
+- dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq); |
14255 |
++ freq = PICOS2KHZ(var->pixclock ? : 1); |
14256 |
+ |
14257 |
+ maxclock = cirrusfb_board_info[cinfo->btype].maxclock[maxclockidx]; |
14258 |
+ cinfo->multiplexing = 0; |
14259 |
+@@ -488,11 +486,13 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, |
14260 |
+ /* If the frequency is greater than we can support, we might be able |
14261 |
+ * to use multiplexing for the video mode */ |
14262 |
+ if (freq > maxclock) { |
14263 |
+- dev_err(info->device, |
14264 |
+- "Frequency greater than maxclock (%ld kHz)\n", |
14265 |
+- maxclock); |
14266 |
+- return -EINVAL; |
14267 |
++ var->pixclock = KHZ2PICOS(maxclock); |
14268 |
++ |
14269 |
++ while ((freq = PICOS2KHZ(var->pixclock)) > maxclock) |
14270 |
++ var->pixclock++; |
14271 |
+ } |
14272 |
++ dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq); |
14273 |
++ |
14274 |
+ /* |
14275 |
+ * Additional constraint: 8bpp uses DAC clock doubling to allow maximum |
14276 |
+ * pixel clock |
14277 |
+diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c |
14278 |
+index 2df56bd303d25..bd59e7b11ed53 100644 |
14279 |
+--- a/drivers/video/fbdev/controlfb.c |
14280 |
++++ b/drivers/video/fbdev/controlfb.c |
14281 |
+@@ -64,10 +64,12 @@ |
14282 |
+ #undef in_le32 |
14283 |
+ #undef out_le32 |
14284 |
+ #define in_8(addr) 0 |
14285 |
+-#define out_8(addr, val) |
14286 |
++#define out_8(addr, val) (void)(val) |
14287 |
+ #define in_le32(addr) 0 |
14288 |
+-#define out_le32(addr, val) |
14289 |
++#define out_le32(addr, val) (void)(val) |
14290 |
++#ifndef pgprot_cached_wthru |
14291 |
+ #define pgprot_cached_wthru(prot) (prot) |
14292 |
++#endif |
14293 |
+ #else |
14294 |
+ static void invalid_vram_cache(void __force *addr) |
14295 |
+ { |
14296 |
+diff --git a/drivers/video/fbdev/core/fbcvt.c b/drivers/video/fbdev/core/fbcvt.c |
14297 |
+index 55d2bd0ce5c02..64843464c6613 100644 |
14298 |
+--- a/drivers/video/fbdev/core/fbcvt.c |
14299 |
++++ b/drivers/video/fbdev/core/fbcvt.c |
14300 |
+@@ -214,9 +214,11 @@ static u32 fb_cvt_aspect_ratio(struct fb_cvt_data *cvt) |
14301 |
+ static void fb_cvt_print_name(struct fb_cvt_data *cvt) |
14302 |
+ { |
14303 |
+ u32 pixcount, pixcount_mod; |
14304 |
+- int cnt = 255, offset = 0, read = 0; |
14305 |
+- u8 *buf = kzalloc(256, GFP_KERNEL); |
14306 |
++ int size = 256; |
14307 |
++ int off = 0; |
14308 |
++ u8 *buf; |
14309 |
+ |
14310 |
++ buf = kzalloc(size, GFP_KERNEL); |
14311 |
+ if (!buf) |
14312 |
+ return; |
14313 |
+ |
14314 |
+@@ -224,43 +226,30 @@ static void fb_cvt_print_name(struct fb_cvt_data *cvt) |
14315 |
+ pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; |
14316 |
+ pixcount_mod /= 1000; |
14317 |
+ |
14318 |
+- read = snprintf(buf+offset, cnt, "fbcvt: %dx%d@%d: CVT Name - ", |
14319 |
+- cvt->xres, cvt->yres, cvt->refresh); |
14320 |
+- offset += read; |
14321 |
+- cnt -= read; |
14322 |
++ off += scnprintf(buf + off, size - off, "fbcvt: %dx%d@%d: CVT Name - ", |
14323 |
++ cvt->xres, cvt->yres, cvt->refresh); |
14324 |
+ |
14325 |
+- if (cvt->status) |
14326 |
+- snprintf(buf+offset, cnt, "Not a CVT standard - %d.%03d Mega " |
14327 |
+- "Pixel Image\n", pixcount, pixcount_mod); |
14328 |
+- else { |
14329 |
+- if (pixcount) { |
14330 |
+- read = snprintf(buf+offset, cnt, "%d", pixcount); |
14331 |
+- cnt -= read; |
14332 |
+- offset += read; |
14333 |
+- } |
14334 |
++ if (cvt->status) { |
14335 |
++ off += scnprintf(buf + off, size - off, |
14336 |
++ "Not a CVT standard - %d.%03d Mega Pixel Image\n", |
14337 |
++ pixcount, pixcount_mod); |
14338 |
++ } else { |
14339 |
++ if (pixcount) |
14340 |
++ off += scnprintf(buf + off, size - off, "%d", pixcount); |
14341 |
+ |
14342 |
+- read = snprintf(buf+offset, cnt, ".%03dM", pixcount_mod); |
14343 |
+- cnt -= read; |
14344 |
+- offset += read; |
14345 |
++ off += scnprintf(buf + off, size - off, ".%03dM", pixcount_mod); |
14346 |
+ |
14347 |
+ if (cvt->aspect_ratio == 0) |
14348 |
+- read = snprintf(buf+offset, cnt, "3"); |
14349 |
++ off += scnprintf(buf + off, size - off, "3"); |
14350 |
+ else if (cvt->aspect_ratio == 3) |
14351 |
+- read = snprintf(buf+offset, cnt, "4"); |
14352 |
++ off += scnprintf(buf + off, size - off, "4"); |
14353 |
+ else if (cvt->aspect_ratio == 1 || cvt->aspect_ratio == 4) |
14354 |
+- read = snprintf(buf+offset, cnt, "9"); |
14355 |
++ off += scnprintf(buf + off, size - off, "9"); |
14356 |
+ else if (cvt->aspect_ratio == 2) |
14357 |
+- read = snprintf(buf+offset, cnt, "A"); |
14358 |
+- else |
14359 |
+- read = 0; |
14360 |
+- cnt -= read; |
14361 |
+- offset += read; |
14362 |
+- |
14363 |
+- if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK) { |
14364 |
+- read = snprintf(buf+offset, cnt, "-R"); |
14365 |
+- cnt -= read; |
14366 |
+- offset += read; |
14367 |
+- } |
14368 |
++ off += scnprintf(buf + off, size - off, "A"); |
14369 |
++ |
14370 |
++ if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK) |
14371 |
++ off += scnprintf(buf + off, size - off, "-R"); |
14372 |
+ } |
14373 |
+ |
14374 |
+ printk(KERN_INFO "%s\n", buf); |
14375 |
+diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c |
14376 |
+index 570439b326552..daaa99818d3b7 100644 |
14377 |
+--- a/drivers/video/fbdev/matrox/matroxfb_base.c |
14378 |
++++ b/drivers/video/fbdev/matrox/matroxfb_base.c |
14379 |
+@@ -1377,7 +1377,7 @@ static struct video_board vbG200 = { |
14380 |
+ .lowlevel = &matrox_G100 |
14381 |
+ }; |
14382 |
+ static struct video_board vbG200eW = { |
14383 |
+- .maxvram = 0x800000, |
14384 |
++ .maxvram = 0x100000, |
14385 |
+ .maxdisplayable = 0x800000, |
14386 |
+ .accelID = FB_ACCEL_MATROX_MGAG200, |
14387 |
+ .lowlevel = &matrox_G100 |
14388 |
+diff --git a/drivers/video/fbdev/nvidia/nv_i2c.c b/drivers/video/fbdev/nvidia/nv_i2c.c |
14389 |
+index d7994a1732459..0b48965a6420c 100644 |
14390 |
+--- a/drivers/video/fbdev/nvidia/nv_i2c.c |
14391 |
++++ b/drivers/video/fbdev/nvidia/nv_i2c.c |
14392 |
+@@ -86,7 +86,7 @@ static int nvidia_setup_i2c_bus(struct nvidia_i2c_chan *chan, const char *name, |
14393 |
+ { |
14394 |
+ int rc; |
14395 |
+ |
14396 |
+- strcpy(chan->adapter.name, name); |
14397 |
++ strscpy(chan->adapter.name, name, sizeof(chan->adapter.name)); |
14398 |
+ chan->adapter.owner = THIS_MODULE; |
14399 |
+ chan->adapter.class = i2c_class; |
14400 |
+ chan->adapter.algo_data = &chan->algo; |
14401 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c |
14402 |
+index b4a1aefff7661..777f6d66c28c3 100644 |
14403 |
+--- a/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c |
14404 |
++++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c |
14405 |
+@@ -251,6 +251,7 @@ static int dvic_probe_of(struct platform_device *pdev) |
14406 |
+ adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); |
14407 |
+ if (adapter_node) { |
14408 |
+ adapter = of_get_i2c_adapter_by_node(adapter_node); |
14409 |
++ of_node_put(adapter_node); |
14410 |
+ if (adapter == NULL) { |
14411 |
+ dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); |
14412 |
+ omap_dss_put_device(ddata->in); |
14413 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c |
14414 |
+index 4b0793abdd84b..a2c7c5cb15234 100644 |
14415 |
+--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c |
14416 |
++++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c |
14417 |
+@@ -409,7 +409,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev, |
14418 |
+ if (r) |
14419 |
+ return r; |
14420 |
+ |
14421 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", errors); |
14422 |
++ return sysfs_emit(buf, "%d\n", errors); |
14423 |
+ } |
14424 |
+ |
14425 |
+ static ssize_t dsicm_hw_revision_show(struct device *dev, |
14426 |
+@@ -439,7 +439,7 @@ static ssize_t dsicm_hw_revision_show(struct device *dev, |
14427 |
+ if (r) |
14428 |
+ return r; |
14429 |
+ |
14430 |
+- return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3); |
14431 |
++ return sysfs_emit(buf, "%02x.%02x.%02x\n", id1, id2, id3); |
14432 |
+ } |
14433 |
+ |
14434 |
+ static ssize_t dsicm_store_ulps(struct device *dev, |
14435 |
+@@ -487,7 +487,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, |
14436 |
+ t = ddata->ulps_enabled; |
14437 |
+ mutex_unlock(&ddata->lock); |
14438 |
+ |
14439 |
+- return snprintf(buf, PAGE_SIZE, "%u\n", t); |
14440 |
++ return sysfs_emit(buf, "%u\n", t); |
14441 |
+ } |
14442 |
+ |
14443 |
+ static ssize_t dsicm_store_ulps_timeout(struct device *dev, |
14444 |
+@@ -532,7 +532,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, |
14445 |
+ t = ddata->ulps_timeout; |
14446 |
+ mutex_unlock(&ddata->lock); |
14447 |
+ |
14448 |
+- return snprintf(buf, PAGE_SIZE, "%u\n", t); |
14449 |
++ return sysfs_emit(buf, "%u\n", t); |
14450 |
+ } |
14451 |
+ |
14452 |
+ static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL); |
14453 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c |
14454 |
+index 1293515e4b169..0cbc5b9183f89 100644 |
14455 |
+--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c |
14456 |
++++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c |
14457 |
+@@ -476,7 +476,7 @@ static ssize_t show_cabc_available_modes(struct device *dev, |
14458 |
+ int i; |
14459 |
+ |
14460 |
+ if (!ddata->has_cabc) |
14461 |
+- return snprintf(buf, PAGE_SIZE, "%s\n", cabc_modes[0]); |
14462 |
++ return sysfs_emit(buf, "%s\n", cabc_modes[0]); |
14463 |
+ |
14464 |
+ for (i = 0, len = 0; |
14465 |
+ len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++) |
14466 |
+diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c |
14467 |
+index bb85b21f07248..9f6ef9e04d9ce 100644 |
14468 |
+--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c |
14469 |
++++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c |
14470 |
+@@ -169,7 +169,7 @@ static ssize_t tpo_td043_vmirror_show(struct device *dev, |
14471 |
+ { |
14472 |
+ struct panel_drv_data *ddata = dev_get_drvdata(dev); |
14473 |
+ |
14474 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", ddata->vmirror); |
14475 |
++ return sysfs_emit(buf, "%d\n", ddata->vmirror); |
14476 |
+ } |
14477 |
+ |
14478 |
+ static ssize_t tpo_td043_vmirror_store(struct device *dev, |
14479 |
+@@ -199,7 +199,7 @@ static ssize_t tpo_td043_mode_show(struct device *dev, |
14480 |
+ { |
14481 |
+ struct panel_drv_data *ddata = dev_get_drvdata(dev); |
14482 |
+ |
14483 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", ddata->mode); |
14484 |
++ return sysfs_emit(buf, "%d\n", ddata->mode); |
14485 |
+ } |
14486 |
+ |
14487 |
+ static ssize_t tpo_td043_mode_store(struct device *dev, |
14488 |
+diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c |
14489 |
+index 0dbc6bf8268ac..092a1caa1208e 100644 |
14490 |
+--- a/drivers/video/fbdev/sm712fb.c |
14491 |
++++ b/drivers/video/fbdev/sm712fb.c |
14492 |
+@@ -1047,7 +1047,7 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, |
14493 |
+ if (count + p > total_size) |
14494 |
+ count = total_size - p; |
14495 |
+ |
14496 |
+- buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); |
14497 |
++ buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); |
14498 |
+ if (!buffer) |
14499 |
+ return -ENOMEM; |
14500 |
+ |
14501 |
+@@ -1059,25 +1059,14 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, |
14502 |
+ while (count) { |
14503 |
+ c = (count > PAGE_SIZE) ? PAGE_SIZE : count; |
14504 |
+ dst = buffer; |
14505 |
+- for (i = c >> 2; i--;) { |
14506 |
+- *dst = fb_readl(src++); |
14507 |
+- *dst = big_swap(*dst); |
14508 |
++ for (i = (c + 3) >> 2; i--;) { |
14509 |
++ u32 val; |
14510 |
++ |
14511 |
++ val = fb_readl(src); |
14512 |
++ *dst = big_swap(val); |
14513 |
++ src++; |
14514 |
+ dst++; |
14515 |
+ } |
14516 |
+- if (c & 3) { |
14517 |
+- u8 *dst8 = (u8 *)dst; |
14518 |
+- u8 __iomem *src8 = (u8 __iomem *)src; |
14519 |
+- |
14520 |
+- for (i = c & 3; i--;) { |
14521 |
+- if (i & 1) { |
14522 |
+- *dst8++ = fb_readb(++src8); |
14523 |
+- } else { |
14524 |
+- *dst8++ = fb_readb(--src8); |
14525 |
+- src8 += 2; |
14526 |
+- } |
14527 |
+- } |
14528 |
+- src = (u32 __iomem *)src8; |
14529 |
+- } |
14530 |
+ |
14531 |
+ if (copy_to_user(buf, buffer, c)) { |
14532 |
+ err = -EFAULT; |
14533 |
+@@ -1130,7 +1119,7 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, |
14534 |
+ count = total_size - p; |
14535 |
+ } |
14536 |
+ |
14537 |
+- buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); |
14538 |
++ buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); |
14539 |
+ if (!buffer) |
14540 |
+ return -ENOMEM; |
14541 |
+ |
14542 |
+@@ -1148,24 +1137,11 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, |
14543 |
+ break; |
14544 |
+ } |
14545 |
+ |
14546 |
+- for (i = c >> 2; i--;) { |
14547 |
+- fb_writel(big_swap(*src), dst++); |
14548 |
++ for (i = (c + 3) >> 2; i--;) { |
14549 |
++ fb_writel(big_swap(*src), dst); |
14550 |
++ dst++; |
14551 |
+ src++; |
14552 |
+ } |
14553 |
+- if (c & 3) { |
14554 |
+- u8 *src8 = (u8 *)src; |
14555 |
+- u8 __iomem *dst8 = (u8 __iomem *)dst; |
14556 |
+- |
14557 |
+- for (i = c & 3; i--;) { |
14558 |
+- if (i & 1) { |
14559 |
+- fb_writeb(*src8++, ++dst8); |
14560 |
+- } else { |
14561 |
+- fb_writeb(*src8++, --dst8); |
14562 |
+- dst8 += 2; |
14563 |
+- } |
14564 |
+- } |
14565 |
+- dst = (u32 __iomem *)dst8; |
14566 |
+- } |
14567 |
+ |
14568 |
+ *ppos += c; |
14569 |
+ buf += c; |
14570 |
+diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c |
14571 |
+index bfac3ee4a6422..28768c272b73d 100644 |
14572 |
+--- a/drivers/video/fbdev/smscufx.c |
14573 |
++++ b/drivers/video/fbdev/smscufx.c |
14574 |
+@@ -1656,6 +1656,7 @@ static int ufx_usb_probe(struct usb_interface *interface, |
14575 |
+ info->par = dev; |
14576 |
+ info->pseudo_palette = dev->pseudo_palette; |
14577 |
+ info->fbops = &ufx_ops; |
14578 |
++ INIT_LIST_HEAD(&info->modelist); |
14579 |
+ |
14580 |
+ retval = fb_alloc_cmap(&info->cmap, 256, 0); |
14581 |
+ if (retval < 0) { |
14582 |
+@@ -1666,8 +1667,6 @@ static int ufx_usb_probe(struct usb_interface *interface, |
14583 |
+ INIT_DELAYED_WORK(&dev->free_framebuffer_work, |
14584 |
+ ufx_free_framebuffer_work); |
14585 |
+ |
14586 |
+- INIT_LIST_HEAD(&info->modelist); |
14587 |
+- |
14588 |
+ retval = ufx_reg_read(dev, 0x3000, &id_rev); |
14589 |
+ check_warn_goto_error(retval, "error %d reading 0x3000 register from device", retval); |
14590 |
+ dev_dbg(dev->gdev, "ID_REV register value 0x%08x", id_rev); |
14591 |
+diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c |
14592 |
+index b9cdd02c10009..90f48b71fd8f7 100644 |
14593 |
+--- a/drivers/video/fbdev/udlfb.c |
14594 |
++++ b/drivers/video/fbdev/udlfb.c |
14595 |
+@@ -1426,7 +1426,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev, |
14596 |
+ struct device_attribute *a, char *buf) { |
14597 |
+ struct fb_info *fb_info = dev_get_drvdata(fbdev); |
14598 |
+ struct dlfb_data *dlfb = fb_info->par; |
14599 |
+- return snprintf(buf, PAGE_SIZE, "%u\n", |
14600 |
++ return sysfs_emit(buf, "%u\n", |
14601 |
+ atomic_read(&dlfb->bytes_rendered)); |
14602 |
+ } |
14603 |
+ |
14604 |
+@@ -1434,7 +1434,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev, |
14605 |
+ struct device_attribute *a, char *buf) { |
14606 |
+ struct fb_info *fb_info = dev_get_drvdata(fbdev); |
14607 |
+ struct dlfb_data *dlfb = fb_info->par; |
14608 |
+- return snprintf(buf, PAGE_SIZE, "%u\n", |
14609 |
++ return sysfs_emit(buf, "%u\n", |
14610 |
+ atomic_read(&dlfb->bytes_identical)); |
14611 |
+ } |
14612 |
+ |
14613 |
+@@ -1442,7 +1442,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev, |
14614 |
+ struct device_attribute *a, char *buf) { |
14615 |
+ struct fb_info *fb_info = dev_get_drvdata(fbdev); |
14616 |
+ struct dlfb_data *dlfb = fb_info->par; |
14617 |
+- return snprintf(buf, PAGE_SIZE, "%u\n", |
14618 |
++ return sysfs_emit(buf, "%u\n", |
14619 |
+ atomic_read(&dlfb->bytes_sent)); |
14620 |
+ } |
14621 |
+ |
14622 |
+@@ -1450,7 +1450,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev, |
14623 |
+ struct device_attribute *a, char *buf) { |
14624 |
+ struct fb_info *fb_info = dev_get_drvdata(fbdev); |
14625 |
+ struct dlfb_data *dlfb = fb_info->par; |
14626 |
+- return snprintf(buf, PAGE_SIZE, "%u\n", |
14627 |
++ return sysfs_emit(buf, "%u\n", |
14628 |
+ atomic_read(&dlfb->cpu_kcycles_used)); |
14629 |
+ } |
14630 |
+ |
14631 |
+diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c |
14632 |
+index d96ab28f8ce4a..4e641a780726e 100644 |
14633 |
+--- a/drivers/video/fbdev/w100fb.c |
14634 |
++++ b/drivers/video/fbdev/w100fb.c |
14635 |
+@@ -770,12 +770,18 @@ out: |
14636 |
+ fb_dealloc_cmap(&info->cmap); |
14637 |
+ kfree(info->pseudo_palette); |
14638 |
+ } |
14639 |
+- if (remapped_fbuf != NULL) |
14640 |
++ if (remapped_fbuf != NULL) { |
14641 |
+ iounmap(remapped_fbuf); |
14642 |
+- if (remapped_regs != NULL) |
14643 |
++ remapped_fbuf = NULL; |
14644 |
++ } |
14645 |
++ if (remapped_regs != NULL) { |
14646 |
+ iounmap(remapped_regs); |
14647 |
+- if (remapped_base != NULL) |
14648 |
++ remapped_regs = NULL; |
14649 |
++ } |
14650 |
++ if (remapped_base != NULL) { |
14651 |
+ iounmap(remapped_base); |
14652 |
++ remapped_base = NULL; |
14653 |
++ } |
14654 |
+ if (info) |
14655 |
+ framebuffer_release(info); |
14656 |
+ return err; |
14657 |
+@@ -795,8 +801,11 @@ static int w100fb_remove(struct platform_device *pdev) |
14658 |
+ fb_dealloc_cmap(&info->cmap); |
14659 |
+ |
14660 |
+ iounmap(remapped_base); |
14661 |
++ remapped_base = NULL; |
14662 |
+ iounmap(remapped_regs); |
14663 |
++ remapped_regs = NULL; |
14664 |
+ iounmap(remapped_fbuf); |
14665 |
++ remapped_fbuf = NULL; |
14666 |
+ |
14667 |
+ framebuffer_release(info); |
14668 |
+ |
14669 |
+diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c |
14670 |
+index 359302f71f7ef..ae7f9357bb871 100644 |
14671 |
+--- a/drivers/watchdog/rti_wdt.c |
14672 |
++++ b/drivers/watchdog/rti_wdt.c |
14673 |
+@@ -229,6 +229,7 @@ static int rti_wdt_probe(struct platform_device *pdev) |
14674 |
+ ret = pm_runtime_get_sync(dev); |
14675 |
+ if (ret) { |
14676 |
+ pm_runtime_put_noidle(dev); |
14677 |
++ pm_runtime_disable(&pdev->dev); |
14678 |
+ return dev_err_probe(dev, ret, "runtime pm failed\n"); |
14679 |
+ } |
14680 |
+ |
14681 |
+diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c |
14682 |
+index 190d26e2e75f9..2815f78d22bb3 100644 |
14683 |
+--- a/drivers/watchdog/sp805_wdt.c |
14684 |
++++ b/drivers/watchdog/sp805_wdt.c |
14685 |
+@@ -304,14 +304,12 @@ err: |
14686 |
+ return ret; |
14687 |
+ } |
14688 |
+ |
14689 |
+-static int sp805_wdt_remove(struct amba_device *adev) |
14690 |
++static void sp805_wdt_remove(struct amba_device *adev) |
14691 |
+ { |
14692 |
+ struct sp805_wdt *wdt = amba_get_drvdata(adev); |
14693 |
+ |
14694 |
+ watchdog_unregister_device(&wdt->wdd); |
14695 |
+ watchdog_set_drvdata(&wdt->wdd, NULL); |
14696 |
+- |
14697 |
+- return 0; |
14698 |
+ } |
14699 |
+ |
14700 |
+ static int __maybe_unused sp805_wdt_suspend(struct device *dev) |
14701 |
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c |
14702 |
+index 04c4aa7a1df2c..213864bc7e8c0 100644 |
14703 |
+--- a/fs/binfmt_elf.c |
14704 |
++++ b/fs/binfmt_elf.c |
14705 |
+@@ -170,8 +170,8 @@ static int padzero(unsigned long elf_bss) |
14706 |
+ |
14707 |
+ static int |
14708 |
+ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec, |
14709 |
+- unsigned long load_addr, unsigned long interp_load_addr, |
14710 |
+- unsigned long e_entry) |
14711 |
++ unsigned long interp_load_addr, |
14712 |
++ unsigned long e_entry, unsigned long phdr_addr) |
14713 |
+ { |
14714 |
+ struct mm_struct *mm = current->mm; |
14715 |
+ unsigned long p = bprm->p; |
14716 |
+@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec, |
14717 |
+ NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP); |
14718 |
+ NEW_AUX_ENT(AT_PAGESZ, ELF_EXEC_PAGESIZE); |
14719 |
+ NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); |
14720 |
+- NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff); |
14721 |
++ NEW_AUX_ENT(AT_PHDR, phdr_addr); |
14722 |
+ NEW_AUX_ENT(AT_PHENT, sizeof(struct elf_phdr)); |
14723 |
+ NEW_AUX_ENT(AT_PHNUM, exec->e_phnum); |
14724 |
+ NEW_AUX_ENT(AT_BASE, interp_load_addr); |
14725 |
+@@ -820,7 +820,7 @@ static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr, |
14726 |
+ static int load_elf_binary(struct linux_binprm *bprm) |
14727 |
+ { |
14728 |
+ struct file *interpreter = NULL; /* to shut gcc up */ |
14729 |
+- unsigned long load_addr = 0, load_bias = 0; |
14730 |
++ unsigned long load_addr, load_bias = 0, phdr_addr = 0; |
14731 |
+ int load_addr_set = 0; |
14732 |
+ unsigned long error; |
14733 |
+ struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL; |
14734 |
+@@ -1153,6 +1153,17 @@ out_free_interp: |
14735 |
+ reloc_func_desc = load_bias; |
14736 |
+ } |
14737 |
+ } |
14738 |
++ |
14739 |
++ /* |
14740 |
++ * Figure out which segment in the file contains the Program |
14741 |
++ * Header table, and map to the associated memory address. |
14742 |
++ */ |
14743 |
++ if (elf_ppnt->p_offset <= elf_ex->e_phoff && |
14744 |
++ elf_ex->e_phoff < elf_ppnt->p_offset + elf_ppnt->p_filesz) { |
14745 |
++ phdr_addr = elf_ex->e_phoff - elf_ppnt->p_offset + |
14746 |
++ elf_ppnt->p_vaddr; |
14747 |
++ } |
14748 |
++ |
14749 |
+ k = elf_ppnt->p_vaddr; |
14750 |
+ if ((elf_ppnt->p_flags & PF_X) && k < start_code) |
14751 |
+ start_code = k; |
14752 |
+@@ -1188,6 +1199,7 @@ out_free_interp: |
14753 |
+ } |
14754 |
+ |
14755 |
+ e_entry = elf_ex->e_entry + load_bias; |
14756 |
++ phdr_addr += load_bias; |
14757 |
+ elf_bss += load_bias; |
14758 |
+ elf_brk += load_bias; |
14759 |
+ start_code += load_bias; |
14760 |
+@@ -1251,8 +1263,8 @@ out_free_interp: |
14761 |
+ goto out; |
14762 |
+ #endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */ |
14763 |
+ |
14764 |
+- retval = create_elf_tables(bprm, elf_ex, |
14765 |
+- load_addr, interp_load_addr, e_entry); |
14766 |
++ retval = create_elf_tables(bprm, elf_ex, interp_load_addr, |
14767 |
++ e_entry, phdr_addr); |
14768 |
+ if (retval < 0) |
14769 |
+ goto out; |
14770 |
+ |
14771 |
+@@ -1601,17 +1613,16 @@ static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata, |
14772 |
+ * long file_ofs |
14773 |
+ * followed by COUNT filenames in ASCII: "FILE1" NUL "FILE2" NUL... |
14774 |
+ */ |
14775 |
+-static int fill_files_note(struct memelfnote *note) |
14776 |
++static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm) |
14777 |
+ { |
14778 |
+- struct mm_struct *mm = current->mm; |
14779 |
+- struct vm_area_struct *vma; |
14780 |
+ unsigned count, size, names_ofs, remaining, n; |
14781 |
+ user_long_t *data; |
14782 |
+ user_long_t *start_end_ofs; |
14783 |
+ char *name_base, *name_curpos; |
14784 |
++ int i; |
14785 |
+ |
14786 |
+ /* *Estimated* file count and total data size needed */ |
14787 |
+- count = mm->map_count; |
14788 |
++ count = cprm->vma_count; |
14789 |
+ if (count > UINT_MAX / 64) |
14790 |
+ return -EINVAL; |
14791 |
+ size = count * 64; |
14792 |
+@@ -1633,11 +1644,12 @@ static int fill_files_note(struct memelfnote *note) |
14793 |
+ name_base = name_curpos = ((char *)data) + names_ofs; |
14794 |
+ remaining = size - names_ofs; |
14795 |
+ count = 0; |
14796 |
+- for (vma = mm->mmap; vma != NULL; vma = vma->vm_next) { |
14797 |
++ for (i = 0; i < cprm->vma_count; i++) { |
14798 |
++ struct core_vma_metadata *m = &cprm->vma_meta[i]; |
14799 |
+ struct file *file; |
14800 |
+ const char *filename; |
14801 |
+ |
14802 |
+- file = vma->vm_file; |
14803 |
++ file = m->file; |
14804 |
+ if (!file) |
14805 |
+ continue; |
14806 |
+ filename = file_path(file, name_curpos, remaining); |
14807 |
+@@ -1657,9 +1669,9 @@ static int fill_files_note(struct memelfnote *note) |
14808 |
+ memmove(name_curpos, filename, n); |
14809 |
+ name_curpos += n; |
14810 |
+ |
14811 |
+- *start_end_ofs++ = vma->vm_start; |
14812 |
+- *start_end_ofs++ = vma->vm_end; |
14813 |
+- *start_end_ofs++ = vma->vm_pgoff; |
14814 |
++ *start_end_ofs++ = m->start; |
14815 |
++ *start_end_ofs++ = m->end; |
14816 |
++ *start_end_ofs++ = m->pgoff; |
14817 |
+ count++; |
14818 |
+ } |
14819 |
+ |
14820 |
+@@ -1670,7 +1682,7 @@ static int fill_files_note(struct memelfnote *note) |
14821 |
+ * Count usually is less than mm->map_count, |
14822 |
+ * we need to move filenames down. |
14823 |
+ */ |
14824 |
+- n = mm->map_count - count; |
14825 |
++ n = cprm->vma_count - count; |
14826 |
+ if (n != 0) { |
14827 |
+ unsigned shift_bytes = n * 3 * sizeof(data[0]); |
14828 |
+ memmove(name_base - shift_bytes, name_base, |
14829 |
+@@ -1785,7 +1797,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, |
14830 |
+ |
14831 |
+ static int fill_note_info(struct elfhdr *elf, int phdrs, |
14832 |
+ struct elf_note_info *info, |
14833 |
+- const kernel_siginfo_t *siginfo, struct pt_regs *regs) |
14834 |
++ struct coredump_params *cprm) |
14835 |
+ { |
14836 |
+ struct task_struct *dump_task = current; |
14837 |
+ const struct user_regset_view *view = task_user_regset_view(dump_task); |
14838 |
+@@ -1857,7 +1869,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, |
14839 |
+ * Now fill in each thread's information. |
14840 |
+ */ |
14841 |
+ for (t = info->thread; t != NULL; t = t->next) |
14842 |
+- if (!fill_thread_core_info(t, view, siginfo->si_signo, &info->size)) |
14843 |
++ if (!fill_thread_core_info(t, view, cprm->siginfo->si_signo, &info->size)) |
14844 |
+ return 0; |
14845 |
+ |
14846 |
+ /* |
14847 |
+@@ -1866,13 +1878,13 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, |
14848 |
+ fill_psinfo(psinfo, dump_task->group_leader, dump_task->mm); |
14849 |
+ info->size += notesize(&info->psinfo); |
14850 |
+ |
14851 |
+- fill_siginfo_note(&info->signote, &info->csigdata, siginfo); |
14852 |
++ fill_siginfo_note(&info->signote, &info->csigdata, cprm->siginfo); |
14853 |
+ info->size += notesize(&info->signote); |
14854 |
+ |
14855 |
+ fill_auxv_note(&info->auxv, current->mm); |
14856 |
+ info->size += notesize(&info->auxv); |
14857 |
+ |
14858 |
+- if (fill_files_note(&info->files) == 0) |
14859 |
++ if (fill_files_note(&info->files, cprm) == 0) |
14860 |
+ info->size += notesize(&info->files); |
14861 |
+ |
14862 |
+ return 1; |
14863 |
+@@ -2014,7 +2026,7 @@ static int elf_note_info_init(struct elf_note_info *info) |
14864 |
+ |
14865 |
+ static int fill_note_info(struct elfhdr *elf, int phdrs, |
14866 |
+ struct elf_note_info *info, |
14867 |
+- const kernel_siginfo_t *siginfo, struct pt_regs *regs) |
14868 |
++ struct coredump_params *cprm) |
14869 |
+ { |
14870 |
+ struct core_thread *ct; |
14871 |
+ struct elf_thread_status *ets; |
14872 |
+@@ -2035,13 +2047,13 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, |
14873 |
+ list_for_each_entry(ets, &info->thread_list, list) { |
14874 |
+ int sz; |
14875 |
+ |
14876 |
+- sz = elf_dump_thread_status(siginfo->si_signo, ets); |
14877 |
++ sz = elf_dump_thread_status(cprm->siginfo->si_signo, ets); |
14878 |
+ info->thread_status_size += sz; |
14879 |
+ } |
14880 |
+ /* now collect the dump for the current */ |
14881 |
+ memset(info->prstatus, 0, sizeof(*info->prstatus)); |
14882 |
+- fill_prstatus(info->prstatus, current, siginfo->si_signo); |
14883 |
+- elf_core_copy_regs(&info->prstatus->pr_reg, regs); |
14884 |
++ fill_prstatus(info->prstatus, current, cprm->siginfo->si_signo); |
14885 |
++ elf_core_copy_regs(&info->prstatus->pr_reg, cprm->regs); |
14886 |
+ |
14887 |
+ /* Set up header */ |
14888 |
+ fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); |
14889 |
+@@ -2057,18 +2069,18 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, |
14890 |
+ fill_note(info->notes + 1, "CORE", NT_PRPSINFO, |
14891 |
+ sizeof(*info->psinfo), info->psinfo); |
14892 |
+ |
14893 |
+- fill_siginfo_note(info->notes + 2, &info->csigdata, siginfo); |
14894 |
++ fill_siginfo_note(info->notes + 2, &info->csigdata, cprm->siginfo); |
14895 |
+ fill_auxv_note(info->notes + 3, current->mm); |
14896 |
+ info->numnote = 4; |
14897 |
+ |
14898 |
+- if (fill_files_note(info->notes + info->numnote) == 0) { |
14899 |
++ if (fill_files_note(info->notes + info->numnote, cprm) == 0) { |
14900 |
+ info->notes_files = info->notes + info->numnote; |
14901 |
+ info->numnote++; |
14902 |
+ } |
14903 |
+ |
14904 |
+ /* Try to dump the FPU. */ |
14905 |
+- info->prstatus->pr_fpvalid = elf_core_copy_task_fpregs(current, regs, |
14906 |
+- info->fpu); |
14907 |
++ info->prstatus->pr_fpvalid = |
14908 |
++ elf_core_copy_task_fpregs(current, cprm->regs, info->fpu); |
14909 |
+ if (info->prstatus->pr_fpvalid) |
14910 |
+ fill_note(info->notes + info->numnote++, |
14911 |
+ "CORE", NT_PRFPREG, sizeof(*info->fpu), info->fpu); |
14912 |
+@@ -2154,8 +2166,7 @@ static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum, |
14913 |
+ static int elf_core_dump(struct coredump_params *cprm) |
14914 |
+ { |
14915 |
+ int has_dumped = 0; |
14916 |
+- int vma_count, segs, i; |
14917 |
+- size_t vma_data_size; |
14918 |
++ int segs, i; |
14919 |
+ struct elfhdr elf; |
14920 |
+ loff_t offset = 0, dataoff; |
14921 |
+ struct elf_note_info info = { }; |
14922 |
+@@ -2163,16 +2174,12 @@ static int elf_core_dump(struct coredump_params *cprm) |
14923 |
+ struct elf_shdr *shdr4extnum = NULL; |
14924 |
+ Elf_Half e_phnum; |
14925 |
+ elf_addr_t e_shoff; |
14926 |
+- struct core_vma_metadata *vma_meta; |
14927 |
+- |
14928 |
+- if (dump_vma_snapshot(cprm, &vma_count, &vma_meta, &vma_data_size)) |
14929 |
+- return 0; |
14930 |
+ |
14931 |
+ /* |
14932 |
+ * The number of segs are recored into ELF header as 16bit value. |
14933 |
+ * Please check DEFAULT_MAX_MAP_COUNT definition when you modify here. |
14934 |
+ */ |
14935 |
+- segs = vma_count + elf_core_extra_phdrs(); |
14936 |
++ segs = cprm->vma_count + elf_core_extra_phdrs(); |
14937 |
+ |
14938 |
+ /* for notes section */ |
14939 |
+ segs++; |
14940 |
+@@ -2186,7 +2193,7 @@ static int elf_core_dump(struct coredump_params *cprm) |
14941 |
+ * Collect all the non-memory information about the process for the |
14942 |
+ * notes. This also sets up the file header. |
14943 |
+ */ |
14944 |
+- if (!fill_note_info(&elf, e_phnum, &info, cprm->siginfo, cprm->regs)) |
14945 |
++ if (!fill_note_info(&elf, e_phnum, &info, cprm)) |
14946 |
+ goto end_coredump; |
14947 |
+ |
14948 |
+ has_dumped = 1; |
14949 |
+@@ -2210,7 +2217,7 @@ static int elf_core_dump(struct coredump_params *cprm) |
14950 |
+ |
14951 |
+ dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE); |
14952 |
+ |
14953 |
+- offset += vma_data_size; |
14954 |
++ offset += cprm->vma_data_size; |
14955 |
+ offset += elf_core_extra_data_size(); |
14956 |
+ e_shoff = offset; |
14957 |
+ |
14958 |
+@@ -2230,8 +2237,8 @@ static int elf_core_dump(struct coredump_params *cprm) |
14959 |
+ goto end_coredump; |
14960 |
+ |
14961 |
+ /* Write program headers for segments dump */ |
14962 |
+- for (i = 0; i < vma_count; i++) { |
14963 |
+- struct core_vma_metadata *meta = vma_meta + i; |
14964 |
++ for (i = 0; i < cprm->vma_count; i++) { |
14965 |
++ struct core_vma_metadata *meta = cprm->vma_meta + i; |
14966 |
+ struct elf_phdr phdr; |
14967 |
+ |
14968 |
+ phdr.p_type = PT_LOAD; |
14969 |
+@@ -2268,8 +2275,8 @@ static int elf_core_dump(struct coredump_params *cprm) |
14970 |
+ if (!dump_skip(cprm, dataoff - cprm->pos)) |
14971 |
+ goto end_coredump; |
14972 |
+ |
14973 |
+- for (i = 0; i < vma_count; i++) { |
14974 |
+- struct core_vma_metadata *meta = vma_meta + i; |
14975 |
++ for (i = 0; i < cprm->vma_count; i++) { |
14976 |
++ struct core_vma_metadata *meta = cprm->vma_meta + i; |
14977 |
+ |
14978 |
+ if (!dump_user_range(cprm, meta->start, meta->dump_size)) |
14979 |
+ goto end_coredump; |
14980 |
+@@ -2287,7 +2294,6 @@ static int elf_core_dump(struct coredump_params *cprm) |
14981 |
+ end_coredump: |
14982 |
+ free_note_info(&info); |
14983 |
+ kfree(shdr4extnum); |
14984 |
+- kvfree(vma_meta); |
14985 |
+ kfree(phdr4note); |
14986 |
+ return has_dumped; |
14987 |
+ } |
14988 |
+diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c |
14989 |
+index be4062b8ba75e..5764295a3f0ff 100644 |
14990 |
+--- a/fs/binfmt_elf_fdpic.c |
14991 |
++++ b/fs/binfmt_elf_fdpic.c |
14992 |
+@@ -1479,7 +1479,7 @@ static bool elf_fdpic_dump_segments(struct coredump_params *cprm, |
14993 |
+ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
14994 |
+ { |
14995 |
+ int has_dumped = 0; |
14996 |
+- int vma_count, segs; |
14997 |
++ int segs; |
14998 |
+ int i; |
14999 |
+ struct elfhdr *elf = NULL; |
15000 |
+ loff_t offset = 0, dataoff; |
15001 |
+@@ -1494,8 +1494,6 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
15002 |
+ elf_addr_t e_shoff; |
15003 |
+ struct core_thread *ct; |
15004 |
+ struct elf_thread_status *tmp; |
15005 |
+- struct core_vma_metadata *vma_meta = NULL; |
15006 |
+- size_t vma_data_size; |
15007 |
+ |
15008 |
+ /* alloc memory for large data structures: too large to be on stack */ |
15009 |
+ elf = kmalloc(sizeof(*elf), GFP_KERNEL); |
15010 |
+@@ -1505,9 +1503,6 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
15011 |
+ if (!psinfo) |
15012 |
+ goto end_coredump; |
15013 |
+ |
15014 |
+- if (dump_vma_snapshot(cprm, &vma_count, &vma_meta, &vma_data_size)) |
15015 |
+- goto end_coredump; |
15016 |
+- |
15017 |
+ for (ct = current->mm->core_state->dumper.next; |
15018 |
+ ct; ct = ct->next) { |
15019 |
+ tmp = elf_dump_thread_status(cprm->siginfo->si_signo, |
15020 |
+@@ -1527,7 +1522,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
15021 |
+ tmp->next = thread_list; |
15022 |
+ thread_list = tmp; |
15023 |
+ |
15024 |
+- segs = vma_count + elf_core_extra_phdrs(); |
15025 |
++ segs = cprm->vma_count + elf_core_extra_phdrs(); |
15026 |
+ |
15027 |
+ /* for notes section */ |
15028 |
+ segs++; |
15029 |
+@@ -1572,7 +1567,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
15030 |
+ /* Page-align dumped data */ |
15031 |
+ dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE); |
15032 |
+ |
15033 |
+- offset += vma_data_size; |
15034 |
++ offset += cprm->vma_data_size; |
15035 |
+ offset += elf_core_extra_data_size(); |
15036 |
+ e_shoff = offset; |
15037 |
+ |
15038 |
+@@ -1592,8 +1587,8 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
15039 |
+ goto end_coredump; |
15040 |
+ |
15041 |
+ /* write program headers for segments dump */ |
15042 |
+- for (i = 0; i < vma_count; i++) { |
15043 |
+- struct core_vma_metadata *meta = vma_meta + i; |
15044 |
++ for (i = 0; i < cprm->vma_count; i++) { |
15045 |
++ struct core_vma_metadata *meta = cprm->vma_meta + i; |
15046 |
+ struct elf_phdr phdr; |
15047 |
+ size_t sz; |
15048 |
+ |
15049 |
+@@ -1643,7 +1638,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) |
15050 |
+ if (!dump_skip(cprm, dataoff - cprm->pos)) |
15051 |
+ goto end_coredump; |
15052 |
+ |
15053 |
+- if (!elf_fdpic_dump_segments(cprm, vma_meta, vma_count)) |
15054 |
++ if (!elf_fdpic_dump_segments(cprm, cprm->vma_meta, cprm->vma_count)) |
15055 |
+ goto end_coredump; |
15056 |
+ |
15057 |
+ if (!elf_core_write_extra_data(cprm)) |
15058 |
+@@ -1667,7 +1662,6 @@ end_coredump: |
15059 |
+ thread_list = thread_list->next; |
15060 |
+ kfree(tmp); |
15061 |
+ } |
15062 |
+- kvfree(vma_meta); |
15063 |
+ kfree(phdr4note); |
15064 |
+ kfree(elf); |
15065 |
+ kfree(psinfo); |
15066 |
+diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c |
15067 |
+index 3a3102bc15a05..4b3ae0faf548e 100644 |
15068 |
+--- a/fs/btrfs/reflink.c |
15069 |
++++ b/fs/btrfs/reflink.c |
15070 |
+@@ -503,8 +503,11 @@ process_slot: |
15071 |
+ */ |
15072 |
+ ASSERT(key.offset == 0); |
15073 |
+ ASSERT(datal <= fs_info->sectorsize); |
15074 |
+- if (key.offset != 0 || datal > fs_info->sectorsize) |
15075 |
+- return -EUCLEAN; |
15076 |
++ if (WARN_ON(key.offset != 0) || |
15077 |
++ WARN_ON(datal > fs_info->sectorsize)) { |
15078 |
++ ret = -EUCLEAN; |
15079 |
++ goto out; |
15080 |
++ } |
15081 |
+ |
15082 |
+ ret = clone_copy_inline_extent(inode, path, &new_key, |
15083 |
+ drop_start, datal, size, |
15084 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
15085 |
+index fdb1d660bd136..0e8f484031da9 100644 |
15086 |
+--- a/fs/cifs/smb2ops.c |
15087 |
++++ b/fs/cifs/smb2ops.c |
15088 |
+@@ -1526,6 +1526,7 @@ smb2_ioctl_query_info(const unsigned int xid, |
15089 |
+ unsigned int size[2]; |
15090 |
+ void *data[2]; |
15091 |
+ int create_options = is_dir ? CREATE_NOT_FILE : CREATE_NOT_DIR; |
15092 |
++ void (*free_req1_func)(struct smb_rqst *r); |
15093 |
+ |
15094 |
+ vars = kzalloc(sizeof(*vars), GFP_ATOMIC); |
15095 |
+ if (vars == NULL) |
15096 |
+@@ -1535,27 +1536,29 @@ smb2_ioctl_query_info(const unsigned int xid, |
15097 |
+ |
15098 |
+ resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER; |
15099 |
+ |
15100 |
+- if (copy_from_user(&qi, arg, sizeof(struct smb_query_info))) |
15101 |
+- goto e_fault; |
15102 |
+- |
15103 |
++ if (copy_from_user(&qi, arg, sizeof(struct smb_query_info))) { |
15104 |
++ rc = -EFAULT; |
15105 |
++ goto free_vars; |
15106 |
++ } |
15107 |
+ if (qi.output_buffer_length > 1024) { |
15108 |
+- kfree(vars); |
15109 |
+- return -EINVAL; |
15110 |
++ rc = -EINVAL; |
15111 |
++ goto free_vars; |
15112 |
+ } |
15113 |
+ |
15114 |
+ if (!ses || !server) { |
15115 |
+- kfree(vars); |
15116 |
+- return -EIO; |
15117 |
++ rc = -EIO; |
15118 |
++ goto free_vars; |
15119 |
+ } |
15120 |
+ |
15121 |
+ if (smb3_encryption_required(tcon)) |
15122 |
+ flags |= CIFS_TRANSFORM_REQ; |
15123 |
+ |
15124 |
+- buffer = memdup_user(arg + sizeof(struct smb_query_info), |
15125 |
+- qi.output_buffer_length); |
15126 |
+- if (IS_ERR(buffer)) { |
15127 |
+- kfree(vars); |
15128 |
+- return PTR_ERR(buffer); |
15129 |
++ if (qi.output_buffer_length) { |
15130 |
++ buffer = memdup_user(arg + sizeof(struct smb_query_info), qi.output_buffer_length); |
15131 |
++ if (IS_ERR(buffer)) { |
15132 |
++ rc = PTR_ERR(buffer); |
15133 |
++ goto free_vars; |
15134 |
++ } |
15135 |
+ } |
15136 |
+ |
15137 |
+ /* Open */ |
15138 |
+@@ -1593,45 +1596,45 @@ smb2_ioctl_query_info(const unsigned int xid, |
15139 |
+ rc = SMB2_open_init(tcon, server, |
15140 |
+ &rqst[0], &oplock, &oparms, path); |
15141 |
+ if (rc) |
15142 |
+- goto iqinf_exit; |
15143 |
++ goto free_output_buffer; |
15144 |
+ smb2_set_next_command(tcon, &rqst[0]); |
15145 |
+ |
15146 |
+ /* Query */ |
15147 |
+ if (qi.flags & PASSTHRU_FSCTL) { |
15148 |
+ /* Can eventually relax perm check since server enforces too */ |
15149 |
+- if (!capable(CAP_SYS_ADMIN)) |
15150 |
++ if (!capable(CAP_SYS_ADMIN)) { |
15151 |
+ rc = -EPERM; |
15152 |
+- else { |
15153 |
+- rqst[1].rq_iov = &vars->io_iov[0]; |
15154 |
+- rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE; |
15155 |
+- |
15156 |
+- rc = SMB2_ioctl_init(tcon, server, |
15157 |
+- &rqst[1], |
15158 |
+- COMPOUND_FID, COMPOUND_FID, |
15159 |
+- qi.info_type, true, buffer, |
15160 |
+- qi.output_buffer_length, |
15161 |
+- CIFSMaxBufSize - |
15162 |
+- MAX_SMB2_CREATE_RESPONSE_SIZE - |
15163 |
+- MAX_SMB2_CLOSE_RESPONSE_SIZE); |
15164 |
++ goto free_open_req; |
15165 |
+ } |
15166 |
++ rqst[1].rq_iov = &vars->io_iov[0]; |
15167 |
++ rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE; |
15168 |
++ |
15169 |
++ rc = SMB2_ioctl_init(tcon, server, &rqst[1], COMPOUND_FID, COMPOUND_FID, |
15170 |
++ qi.info_type, true, buffer, qi.output_buffer_length, |
15171 |
++ CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE - |
15172 |
++ MAX_SMB2_CLOSE_RESPONSE_SIZE); |
15173 |
++ free_req1_func = SMB2_ioctl_free; |
15174 |
+ } else if (qi.flags == PASSTHRU_SET_INFO) { |
15175 |
+ /* Can eventually relax perm check since server enforces too */ |
15176 |
+- if (!capable(CAP_SYS_ADMIN)) |
15177 |
++ if (!capable(CAP_SYS_ADMIN)) { |
15178 |
+ rc = -EPERM; |
15179 |
+- else { |
15180 |
+- rqst[1].rq_iov = &vars->si_iov[0]; |
15181 |
+- rqst[1].rq_nvec = 1; |
15182 |
+- |
15183 |
+- size[0] = 8; |
15184 |
+- data[0] = buffer; |
15185 |
+- |
15186 |
+- rc = SMB2_set_info_init(tcon, server, |
15187 |
+- &rqst[1], |
15188 |
+- COMPOUND_FID, COMPOUND_FID, |
15189 |
+- current->tgid, |
15190 |
+- FILE_END_OF_FILE_INFORMATION, |
15191 |
+- SMB2_O_INFO_FILE, 0, data, size); |
15192 |
++ goto free_open_req; |
15193 |
+ } |
15194 |
++ if (qi.output_buffer_length < 8) { |
15195 |
++ rc = -EINVAL; |
15196 |
++ goto free_open_req; |
15197 |
++ } |
15198 |
++ rqst[1].rq_iov = &vars->si_iov[0]; |
15199 |
++ rqst[1].rq_nvec = 1; |
15200 |
++ |
15201 |
++ /* MS-FSCC 2.4.13 FileEndOfFileInformation */ |
15202 |
++ size[0] = 8; |
15203 |
++ data[0] = buffer; |
15204 |
++ |
15205 |
++ rc = SMB2_set_info_init(tcon, server, &rqst[1], COMPOUND_FID, COMPOUND_FID, |
15206 |
++ current->tgid, FILE_END_OF_FILE_INFORMATION, |
15207 |
++ SMB2_O_INFO_FILE, 0, data, size); |
15208 |
++ free_req1_func = SMB2_set_info_free; |
15209 |
+ } else if (qi.flags == PASSTHRU_QUERY_INFO) { |
15210 |
+ rqst[1].rq_iov = &vars->qi_iov[0]; |
15211 |
+ rqst[1].rq_nvec = 1; |
15212 |
+@@ -1642,6 +1645,7 @@ smb2_ioctl_query_info(const unsigned int xid, |
15213 |
+ qi.info_type, qi.additional_information, |
15214 |
+ qi.input_buffer_length, |
15215 |
+ qi.output_buffer_length, buffer); |
15216 |
++ free_req1_func = SMB2_query_info_free; |
15217 |
+ } else { /* unknown flags */ |
15218 |
+ cifs_tcon_dbg(VFS, "Invalid passthru query flags: 0x%x\n", |
15219 |
+ qi.flags); |
15220 |
+@@ -1649,7 +1653,7 @@ smb2_ioctl_query_info(const unsigned int xid, |
15221 |
+ } |
15222 |
+ |
15223 |
+ if (rc) |
15224 |
+- goto iqinf_exit; |
15225 |
++ goto free_open_req; |
15226 |
+ smb2_set_next_command(tcon, &rqst[1]); |
15227 |
+ smb2_set_related(&rqst[1]); |
15228 |
+ |
15229 |
+@@ -1660,14 +1664,14 @@ smb2_ioctl_query_info(const unsigned int xid, |
15230 |
+ rc = SMB2_close_init(tcon, server, |
15231 |
+ &rqst[2], COMPOUND_FID, COMPOUND_FID, false); |
15232 |
+ if (rc) |
15233 |
+- goto iqinf_exit; |
15234 |
++ goto free_req_1; |
15235 |
+ smb2_set_related(&rqst[2]); |
15236 |
+ |
15237 |
+ rc = compound_send_recv(xid, ses, server, |
15238 |
+ flags, 3, rqst, |
15239 |
+ resp_buftype, rsp_iov); |
15240 |
+ if (rc) |
15241 |
+- goto iqinf_exit; |
15242 |
++ goto out; |
15243 |
+ |
15244 |
+ /* No need to bump num_remote_opens since handle immediately closed */ |
15245 |
+ if (qi.flags & PASSTHRU_FSCTL) { |
15246 |
+@@ -1677,18 +1681,22 @@ smb2_ioctl_query_info(const unsigned int xid, |
15247 |
+ qi.input_buffer_length = le32_to_cpu(io_rsp->OutputCount); |
15248 |
+ if (qi.input_buffer_length > 0 && |
15249 |
+ le32_to_cpu(io_rsp->OutputOffset) + qi.input_buffer_length |
15250 |
+- > rsp_iov[1].iov_len) |
15251 |
+- goto e_fault; |
15252 |
++ > rsp_iov[1].iov_len) { |
15253 |
++ rc = -EFAULT; |
15254 |
++ goto out; |
15255 |
++ } |
15256 |
+ |
15257 |
+ if (copy_to_user(&pqi->input_buffer_length, |
15258 |
+ &qi.input_buffer_length, |
15259 |
+- sizeof(qi.input_buffer_length))) |
15260 |
+- goto e_fault; |
15261 |
++ sizeof(qi.input_buffer_length))) { |
15262 |
++ rc = -EFAULT; |
15263 |
++ goto out; |
15264 |
++ } |
15265 |
+ |
15266 |
+ if (copy_to_user((void __user *)pqi + sizeof(struct smb_query_info), |
15267 |
+ (const void *)io_rsp + le32_to_cpu(io_rsp->OutputOffset), |
15268 |
+ qi.input_buffer_length)) |
15269 |
+- goto e_fault; |
15270 |
++ rc = -EFAULT; |
15271 |
+ } else { |
15272 |
+ pqi = (struct smb_query_info __user *)arg; |
15273 |
+ qi_rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base; |
15274 |
+@@ -1696,28 +1704,30 @@ smb2_ioctl_query_info(const unsigned int xid, |
15275 |
+ qi.input_buffer_length = le32_to_cpu(qi_rsp->OutputBufferLength); |
15276 |
+ if (copy_to_user(&pqi->input_buffer_length, |
15277 |
+ &qi.input_buffer_length, |
15278 |
+- sizeof(qi.input_buffer_length))) |
15279 |
+- goto e_fault; |
15280 |
++ sizeof(qi.input_buffer_length))) { |
15281 |
++ rc = -EFAULT; |
15282 |
++ goto out; |
15283 |
++ } |
15284 |
+ |
15285 |
+ if (copy_to_user(pqi + 1, qi_rsp->Buffer, |
15286 |
+ qi.input_buffer_length)) |
15287 |
+- goto e_fault; |
15288 |
++ rc = -EFAULT; |
15289 |
+ } |
15290 |
+ |
15291 |
+- iqinf_exit: |
15292 |
+- cifs_small_buf_release(rqst[0].rq_iov[0].iov_base); |
15293 |
+- cifs_small_buf_release(rqst[1].rq_iov[0].iov_base); |
15294 |
+- cifs_small_buf_release(rqst[2].rq_iov[0].iov_base); |
15295 |
++out: |
15296 |
+ free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base); |
15297 |
+ free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base); |
15298 |
+ free_rsp_buf(resp_buftype[2], rsp_iov[2].iov_base); |
15299 |
+- kfree(vars); |
15300 |
++ SMB2_close_free(&rqst[2]); |
15301 |
++free_req_1: |
15302 |
++ free_req1_func(&rqst[1]); |
15303 |
++free_open_req: |
15304 |
++ SMB2_open_free(&rqst[0]); |
15305 |
++free_output_buffer: |
15306 |
+ kfree(buffer); |
15307 |
++free_vars: |
15308 |
++ kfree(vars); |
15309 |
+ return rc; |
15310 |
+- |
15311 |
+-e_fault: |
15312 |
+- rc = -EFAULT; |
15313 |
+- goto iqinf_exit; |
15314 |
+ } |
15315 |
+ |
15316 |
+ static ssize_t |
15317 |
+diff --git a/fs/coredump.c b/fs/coredump.c |
15318 |
+index c56a3bdce7cd4..edbaf61125c9c 100644 |
15319 |
+--- a/fs/coredump.c |
15320 |
++++ b/fs/coredump.c |
15321 |
+@@ -41,6 +41,7 @@ |
15322 |
+ #include <linux/fs.h> |
15323 |
+ #include <linux/path.h> |
15324 |
+ #include <linux/timekeeping.h> |
15325 |
++#include <linux/elf.h> |
15326 |
+ |
15327 |
+ #include <linux/uaccess.h> |
15328 |
+ #include <asm/mmu_context.h> |
15329 |
+@@ -52,6 +53,9 @@ |
15330 |
+ |
15331 |
+ #include <trace/events/sched.h> |
15332 |
+ |
15333 |
++static bool dump_vma_snapshot(struct coredump_params *cprm); |
15334 |
++static void free_vma_snapshot(struct coredump_params *cprm); |
15335 |
++ |
15336 |
+ int core_uses_pid; |
15337 |
+ unsigned int core_pipe_limit; |
15338 |
+ char core_pattern[CORENAME_MAX_SIZE] = "core"; |
15339 |
+@@ -601,6 +605,7 @@ void do_coredump(const kernel_siginfo_t *siginfo) |
15340 |
+ * by any locks. |
15341 |
+ */ |
15342 |
+ .mm_flags = mm->flags, |
15343 |
++ .vma_meta = NULL, |
15344 |
+ }; |
15345 |
+ |
15346 |
+ audit_core_dumps(siginfo->si_signo); |
15347 |
+@@ -806,9 +811,13 @@ void do_coredump(const kernel_siginfo_t *siginfo) |
15348 |
+ pr_info("Core dump to |%s disabled\n", cn.corename); |
15349 |
+ goto close_fail; |
15350 |
+ } |
15351 |
++ if (!dump_vma_snapshot(&cprm)) |
15352 |
++ goto close_fail; |
15353 |
++ |
15354 |
+ file_start_write(cprm.file); |
15355 |
+ core_dumped = binfmt->core_dump(&cprm); |
15356 |
+ file_end_write(cprm.file); |
15357 |
++ free_vma_snapshot(&cprm); |
15358 |
+ } |
15359 |
+ if (ispipe && core_pipe_limit) |
15360 |
+ wait_for_dump_helpers(cprm.file); |
15361 |
+@@ -969,6 +978,8 @@ static bool always_dump_vma(struct vm_area_struct *vma) |
15362 |
+ return false; |
15363 |
+ } |
15364 |
+ |
15365 |
++#define DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER 1 |
15366 |
++ |
15367 |
+ /* |
15368 |
+ * Decide how much of @vma's contents should be included in a core dump. |
15369 |
+ */ |
15370 |
+@@ -1028,9 +1039,20 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, |
15371 |
+ * dump the first page to aid in determining what was mapped here. |
15372 |
+ */ |
15373 |
+ if (FILTER(ELF_HEADERS) && |
15374 |
+- vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ) && |
15375 |
+- (READ_ONCE(file_inode(vma->vm_file)->i_mode) & 0111) != 0) |
15376 |
+- return PAGE_SIZE; |
15377 |
++ vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) { |
15378 |
++ if ((READ_ONCE(file_inode(vma->vm_file)->i_mode) & 0111) != 0) |
15379 |
++ return PAGE_SIZE; |
15380 |
++ |
15381 |
++ /* |
15382 |
++ * ELF libraries aren't always executable. |
15383 |
++ * We'll want to check whether the mapping starts with the ELF |
15384 |
++ * magic, but not now - we're holding the mmap lock, |
15385 |
++ * so copy_from_user() doesn't work here. |
15386 |
++ * Use a placeholder instead, and fix it up later in |
15387 |
++ * dump_vma_snapshot(). |
15388 |
++ */ |
15389 |
++ return DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER; |
15390 |
++ } |
15391 |
+ |
15392 |
+ #undef FILTER |
15393 |
+ |
15394 |
+@@ -1067,18 +1089,29 @@ static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma, |
15395 |
+ return gate_vma; |
15396 |
+ } |
15397 |
+ |
15398 |
++static void free_vma_snapshot(struct coredump_params *cprm) |
15399 |
++{ |
15400 |
++ if (cprm->vma_meta) { |
15401 |
++ int i; |
15402 |
++ for (i = 0; i < cprm->vma_count; i++) { |
15403 |
++ struct file *file = cprm->vma_meta[i].file; |
15404 |
++ if (file) |
15405 |
++ fput(file); |
15406 |
++ } |
15407 |
++ kvfree(cprm->vma_meta); |
15408 |
++ cprm->vma_meta = NULL; |
15409 |
++ } |
15410 |
++} |
15411 |
++ |
15412 |
+ /* |
15413 |
+ * Under the mmap_lock, take a snapshot of relevant information about the task's |
15414 |
+ * VMAs. |
15415 |
+ */ |
15416 |
+-int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, |
15417 |
+- struct core_vma_metadata **vma_meta, |
15418 |
+- size_t *vma_data_size_ptr) |
15419 |
++static bool dump_vma_snapshot(struct coredump_params *cprm) |
15420 |
+ { |
15421 |
+ struct vm_area_struct *vma, *gate_vma; |
15422 |
+ struct mm_struct *mm = current->mm; |
15423 |
+ int i; |
15424 |
+- size_t vma_data_size = 0; |
15425 |
+ |
15426 |
+ /* |
15427 |
+ * Once the stack expansion code is fixed to not change VMA bounds |
15428 |
+@@ -1086,36 +1119,51 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, |
15429 |
+ * mmap_lock in read mode. |
15430 |
+ */ |
15431 |
+ if (mmap_write_lock_killable(mm)) |
15432 |
+- return -EINTR; |
15433 |
++ return false; |
15434 |
+ |
15435 |
++ cprm->vma_data_size = 0; |
15436 |
+ gate_vma = get_gate_vma(mm); |
15437 |
+- *vma_count = mm->map_count + (gate_vma ? 1 : 0); |
15438 |
++ cprm->vma_count = mm->map_count + (gate_vma ? 1 : 0); |
15439 |
+ |
15440 |
+- *vma_meta = kvmalloc_array(*vma_count, sizeof(**vma_meta), GFP_KERNEL); |
15441 |
+- if (!*vma_meta) { |
15442 |
++ cprm->vma_meta = kvmalloc_array(cprm->vma_count, sizeof(*cprm->vma_meta), GFP_KERNEL); |
15443 |
++ if (!cprm->vma_meta) { |
15444 |
+ mmap_write_unlock(mm); |
15445 |
+- return -ENOMEM; |
15446 |
++ return false; |
15447 |
+ } |
15448 |
+ |
15449 |
+ for (i = 0, vma = first_vma(current, gate_vma); vma != NULL; |
15450 |
+ vma = next_vma(vma, gate_vma), i++) { |
15451 |
+- struct core_vma_metadata *m = (*vma_meta) + i; |
15452 |
++ struct core_vma_metadata *m = cprm->vma_meta + i; |
15453 |
+ |
15454 |
+ m->start = vma->vm_start; |
15455 |
+ m->end = vma->vm_end; |
15456 |
+ m->flags = vma->vm_flags; |
15457 |
+ m->dump_size = vma_dump_size(vma, cprm->mm_flags); |
15458 |
++ m->pgoff = vma->vm_pgoff; |
15459 |
+ |
15460 |
+- vma_data_size += m->dump_size; |
15461 |
++ m->file = vma->vm_file; |
15462 |
++ if (m->file) |
15463 |
++ get_file(m->file); |
15464 |
+ } |
15465 |
+ |
15466 |
+ mmap_write_unlock(mm); |
15467 |
+ |
15468 |
+- if (WARN_ON(i != *vma_count)) { |
15469 |
+- kvfree(*vma_meta); |
15470 |
+- return -EFAULT; |
15471 |
++ for (i = 0; i < cprm->vma_count; i++) { |
15472 |
++ struct core_vma_metadata *m = cprm->vma_meta + i; |
15473 |
++ |
15474 |
++ if (m->dump_size == DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER) { |
15475 |
++ char elfmag[SELFMAG]; |
15476 |
++ |
15477 |
++ if (copy_from_user(elfmag, (void __user *)m->start, SELFMAG) || |
15478 |
++ memcmp(elfmag, ELFMAG, SELFMAG) != 0) { |
15479 |
++ m->dump_size = 0; |
15480 |
++ } else { |
15481 |
++ m->dump_size = PAGE_SIZE; |
15482 |
++ } |
15483 |
++ } |
15484 |
++ |
15485 |
++ cprm->vma_data_size += m->dump_size; |
15486 |
+ } |
15487 |
+ |
15488 |
+- *vma_data_size_ptr = vma_data_size; |
15489 |
+- return 0; |
15490 |
++ return true; |
15491 |
+ } |
15492 |
+diff --git a/fs/exec.c b/fs/exec.c |
15493 |
+index ca89e0e3ef10f..bcd86f2d176c3 100644 |
15494 |
+--- a/fs/exec.c |
15495 |
++++ b/fs/exec.c |
15496 |
+@@ -494,8 +494,14 @@ static int bprm_stack_limits(struct linux_binprm *bprm) |
15497 |
+ * the stack. They aren't stored until much later when we can't |
15498 |
+ * signal to the parent that the child has run out of stack space. |
15499 |
+ * Instead, calculate it here so it's possible to fail gracefully. |
15500 |
++ * |
15501 |
++ * In the case of argc = 0, make sure there is space for adding a |
15502 |
++ * empty string (which will bump argc to 1), to ensure confused |
15503 |
++ * userspace programs don't start processing from argv[1], thinking |
15504 |
++ * argc can never be 0, to keep them from walking envp by accident. |
15505 |
++ * See do_execveat_common(). |
15506 |
+ */ |
15507 |
+- ptr_size = (bprm->argc + bprm->envc) * sizeof(void *); |
15508 |
++ ptr_size = (max(bprm->argc, 1) + bprm->envc) * sizeof(void *); |
15509 |
+ if (limit <= ptr_size) |
15510 |
+ return -E2BIG; |
15511 |
+ limit -= ptr_size; |
15512 |
+@@ -1886,6 +1892,9 @@ static int do_execveat_common(int fd, struct filename *filename, |
15513 |
+ } |
15514 |
+ |
15515 |
+ retval = count(argv, MAX_ARG_STRINGS); |
15516 |
++ if (retval == 0) |
15517 |
++ pr_warn_once("process '%s' launched '%s' with NULL argv: empty string added\n", |
15518 |
++ current->comm, bprm->filename); |
15519 |
+ if (retval < 0) |
15520 |
+ goto out_free; |
15521 |
+ bprm->argc = retval; |
15522 |
+@@ -1912,6 +1921,19 @@ static int do_execveat_common(int fd, struct filename *filename, |
15523 |
+ if (retval < 0) |
15524 |
+ goto out_free; |
15525 |
+ |
15526 |
++ /* |
15527 |
++ * When argv is empty, add an empty string ("") as argv[0] to |
15528 |
++ * ensure confused userspace programs that start processing |
15529 |
++ * from argv[1] won't end up walking envp. See also |
15530 |
++ * bprm_stack_limits(). |
15531 |
++ */ |
15532 |
++ if (bprm->argc == 0) { |
15533 |
++ retval = copy_string_kernel("", bprm); |
15534 |
++ if (retval < 0) |
15535 |
++ goto out_free; |
15536 |
++ bprm->argc = 1; |
15537 |
++ } |
15538 |
++ |
15539 |
+ retval = bprm_execve(bprm, fd, filename, flags); |
15540 |
+ out_free: |
15541 |
+ free_bprm(bprm); |
15542 |
+@@ -1940,6 +1962,8 @@ int kernel_execve(const char *kernel_filename, |
15543 |
+ } |
15544 |
+ |
15545 |
+ retval = count_strings_kernel(argv); |
15546 |
++ if (WARN_ON_ONCE(retval == 0)) |
15547 |
++ retval = -EINVAL; |
15548 |
+ if (retval < 0) |
15549 |
+ goto out_free; |
15550 |
+ bprm->argc = retval; |
15551 |
+diff --git a/fs/ext2/super.c b/fs/ext2/super.c |
15552 |
+index 09f1fe6769727..b6314d3c6a87d 100644 |
15553 |
+--- a/fs/ext2/super.c |
15554 |
++++ b/fs/ext2/super.c |
15555 |
+@@ -756,8 +756,12 @@ static loff_t ext2_max_size(int bits) |
15556 |
+ res += 1LL << (bits-2); |
15557 |
+ res += 1LL << (2*(bits-2)); |
15558 |
+ res += 1LL << (3*(bits-2)); |
15559 |
++ /* Compute how many metadata blocks are needed */ |
15560 |
++ meta_blocks = 1; |
15561 |
++ meta_blocks += 1 + ppb; |
15562 |
++ meta_blocks += 1 + ppb + ppb * ppb; |
15563 |
+ /* Does block tree limit file size? */ |
15564 |
+- if (res < upper_limit) |
15565 |
++ if (res + meta_blocks <= upper_limit) |
15566 |
+ goto check_lfs; |
15567 |
+ |
15568 |
+ res = upper_limit; |
15569 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
15570 |
+index ae1f0c57f54d2..c9a8c7d24f89c 100644 |
15571 |
+--- a/fs/ext4/inline.c |
15572 |
++++ b/fs/ext4/inline.c |
15573 |
+@@ -1768,19 +1768,20 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data) |
15574 |
+ void *inline_pos; |
15575 |
+ unsigned int offset; |
15576 |
+ struct ext4_dir_entry_2 *de; |
15577 |
+- bool ret = true; |
15578 |
++ bool ret = false; |
15579 |
+ |
15580 |
+ err = ext4_get_inode_loc(dir, &iloc); |
15581 |
+ if (err) { |
15582 |
+ EXT4_ERROR_INODE_ERR(dir, -err, |
15583 |
+ "error %d getting inode %lu block", |
15584 |
+ err, dir->i_ino); |
15585 |
+- return true; |
15586 |
++ return false; |
15587 |
+ } |
15588 |
+ |
15589 |
+ down_read(&EXT4_I(dir)->xattr_sem); |
15590 |
+ if (!ext4_has_inline_data(dir)) { |
15591 |
+ *has_inline_data = 0; |
15592 |
++ ret = true; |
15593 |
+ goto out; |
15594 |
+ } |
15595 |
+ |
15596 |
+@@ -1789,7 +1790,6 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data) |
15597 |
+ ext4_warning(dir->i_sb, |
15598 |
+ "bad inline directory (dir #%lu) - no `..'", |
15599 |
+ dir->i_ino); |
15600 |
+- ret = true; |
15601 |
+ goto out; |
15602 |
+ } |
15603 |
+ |
15604 |
+@@ -1808,16 +1808,15 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data) |
15605 |
+ dir->i_ino, le32_to_cpu(de->inode), |
15606 |
+ le16_to_cpu(de->rec_len), de->name_len, |
15607 |
+ inline_size); |
15608 |
+- ret = true; |
15609 |
+ goto out; |
15610 |
+ } |
15611 |
+ if (le32_to_cpu(de->inode)) { |
15612 |
+- ret = false; |
15613 |
+ goto out; |
15614 |
+ } |
15615 |
+ offset += ext4_rec_len_from_disk(de->rec_len, inline_size); |
15616 |
+ } |
15617 |
+ |
15618 |
++ ret = true; |
15619 |
+ out: |
15620 |
+ up_read(&EXT4_I(dir)->xattr_sem); |
15621 |
+ brelse(iloc.bh); |
15622 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
15623 |
+index d59474a541897..96546df39bcf9 100644 |
15624 |
+--- a/fs/ext4/inode.c |
15625 |
++++ b/fs/ext4/inode.c |
15626 |
+@@ -2023,6 +2023,15 @@ static int ext4_writepage(struct page *page, |
15627 |
+ else |
15628 |
+ len = PAGE_SIZE; |
15629 |
+ |
15630 |
++ /* Should never happen but for bugs in other kernel subsystems */ |
15631 |
++ if (!page_has_buffers(page)) { |
15632 |
++ ext4_warning_inode(inode, |
15633 |
++ "page %lu does not have buffers attached", page->index); |
15634 |
++ ClearPageDirty(page); |
15635 |
++ unlock_page(page); |
15636 |
++ return 0; |
15637 |
++ } |
15638 |
++ |
15639 |
+ page_bufs = page_buffers(page); |
15640 |
+ /* |
15641 |
+ * We cannot do block allocation or other extent handling in this |
15642 |
+@@ -2626,6 +2635,22 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) |
15643 |
+ wait_on_page_writeback(page); |
15644 |
+ BUG_ON(PageWriteback(page)); |
15645 |
+ |
15646 |
++ /* |
15647 |
++ * Should never happen but for buggy code in |
15648 |
++ * other subsystems that call |
15649 |
++ * set_page_dirty() without properly warning |
15650 |
++ * the file system first. See [1] for more |
15651 |
++ * information. |
15652 |
++ * |
15653 |
++ * [1] https://lore.kernel.org/linux-mm/20180103100430.GE4911@×××××××××××.cz |
15654 |
++ */ |
15655 |
++ if (!page_has_buffers(page)) { |
15656 |
++ ext4_warning_inode(mpd->inode, "page %lu does not have buffers attached", page->index); |
15657 |
++ ClearPageDirty(page); |
15658 |
++ unlock_page(page); |
15659 |
++ continue; |
15660 |
++ } |
15661 |
++ |
15662 |
+ if (mpd->map.m_len == 0) |
15663 |
+ mpd->first_page = page->index; |
15664 |
+ mpd->next_page = page->index + 1; |
15665 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
15666 |
+index 110c25824a67f..15223b5a3af97 100644 |
15667 |
+--- a/fs/ext4/mballoc.c |
15668 |
++++ b/fs/ext4/mballoc.c |
15669 |
+@@ -3320,69 +3320,95 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block, |
15670 |
+ struct ext4_sb_info *sbi = EXT4_SB(sb); |
15671 |
+ ext4_group_t group; |
15672 |
+ ext4_grpblk_t blkoff; |
15673 |
+- int i, clen, err; |
15674 |
++ int i, err; |
15675 |
+ int already; |
15676 |
++ unsigned int clen, clen_changed, thisgrp_len; |
15677 |
+ |
15678 |
+- clen = EXT4_B2C(sbi, len); |
15679 |
++ while (len > 0) { |
15680 |
++ ext4_get_group_no_and_offset(sb, block, &group, &blkoff); |
15681 |
+ |
15682 |
+- ext4_get_group_no_and_offset(sb, block, &group, &blkoff); |
15683 |
+- bitmap_bh = ext4_read_block_bitmap(sb, group); |
15684 |
+- if (IS_ERR(bitmap_bh)) { |
15685 |
+- err = PTR_ERR(bitmap_bh); |
15686 |
+- bitmap_bh = NULL; |
15687 |
+- goto out_err; |
15688 |
+- } |
15689 |
++ /* |
15690 |
++ * Check to see if we are freeing blocks across a group |
15691 |
++ * boundary. |
15692 |
++ * In case of flex_bg, this can happen that (block, len) may |
15693 |
++ * span across more than one group. In that case we need to |
15694 |
++ * get the corresponding group metadata to work with. |
15695 |
++ * For this we have goto again loop. |
15696 |
++ */ |
15697 |
++ thisgrp_len = min_t(unsigned int, (unsigned int)len, |
15698 |
++ EXT4_BLOCKS_PER_GROUP(sb) - EXT4_C2B(sbi, blkoff)); |
15699 |
++ clen = EXT4_NUM_B2C(sbi, thisgrp_len); |
15700 |
+ |
15701 |
+- err = -EIO; |
15702 |
+- gdp = ext4_get_group_desc(sb, group, &gdp_bh); |
15703 |
+- if (!gdp) |
15704 |
+- goto out_err; |
15705 |
++ bitmap_bh = ext4_read_block_bitmap(sb, group); |
15706 |
++ if (IS_ERR(bitmap_bh)) { |
15707 |
++ err = PTR_ERR(bitmap_bh); |
15708 |
++ bitmap_bh = NULL; |
15709 |
++ break; |
15710 |
++ } |
15711 |
+ |
15712 |
+- ext4_lock_group(sb, group); |
15713 |
+- already = 0; |
15714 |
+- for (i = 0; i < clen; i++) |
15715 |
+- if (!mb_test_bit(blkoff + i, bitmap_bh->b_data) == !state) |
15716 |
+- already++; |
15717 |
++ err = -EIO; |
15718 |
++ gdp = ext4_get_group_desc(sb, group, &gdp_bh); |
15719 |
++ if (!gdp) |
15720 |
++ break; |
15721 |
+ |
15722 |
+- if (state) |
15723 |
+- ext4_set_bits(bitmap_bh->b_data, blkoff, clen); |
15724 |
+- else |
15725 |
+- mb_test_and_clear_bits(bitmap_bh->b_data, blkoff, clen); |
15726 |
+- if (ext4_has_group_desc_csum(sb) && |
15727 |
+- (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) { |
15728 |
+- gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); |
15729 |
+- ext4_free_group_clusters_set(sb, gdp, |
15730 |
+- ext4_free_clusters_after_init(sb, |
15731 |
+- group, gdp)); |
15732 |
+- } |
15733 |
+- if (state) |
15734 |
+- clen = ext4_free_group_clusters(sb, gdp) - clen + already; |
15735 |
+- else |
15736 |
+- clen = ext4_free_group_clusters(sb, gdp) + clen - already; |
15737 |
++ ext4_lock_group(sb, group); |
15738 |
++ already = 0; |
15739 |
++ for (i = 0; i < clen; i++) |
15740 |
++ if (!mb_test_bit(blkoff + i, bitmap_bh->b_data) == |
15741 |
++ !state) |
15742 |
++ already++; |
15743 |
++ |
15744 |
++ clen_changed = clen - already; |
15745 |
++ if (state) |
15746 |
++ ext4_set_bits(bitmap_bh->b_data, blkoff, clen); |
15747 |
++ else |
15748 |
++ mb_test_and_clear_bits(bitmap_bh->b_data, blkoff, clen); |
15749 |
++ if (ext4_has_group_desc_csum(sb) && |
15750 |
++ (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) { |
15751 |
++ gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); |
15752 |
++ ext4_free_group_clusters_set(sb, gdp, |
15753 |
++ ext4_free_clusters_after_init(sb, group, gdp)); |
15754 |
++ } |
15755 |
++ if (state) |
15756 |
++ clen = ext4_free_group_clusters(sb, gdp) - clen_changed; |
15757 |
++ else |
15758 |
++ clen = ext4_free_group_clusters(sb, gdp) + clen_changed; |
15759 |
+ |
15760 |
+- ext4_free_group_clusters_set(sb, gdp, clen); |
15761 |
+- ext4_block_bitmap_csum_set(sb, group, gdp, bitmap_bh); |
15762 |
+- ext4_group_desc_csum_set(sb, group, gdp); |
15763 |
++ ext4_free_group_clusters_set(sb, gdp, clen); |
15764 |
++ ext4_block_bitmap_csum_set(sb, group, gdp, bitmap_bh); |
15765 |
++ ext4_group_desc_csum_set(sb, group, gdp); |
15766 |
+ |
15767 |
+- ext4_unlock_group(sb, group); |
15768 |
++ ext4_unlock_group(sb, group); |
15769 |
+ |
15770 |
+- if (sbi->s_log_groups_per_flex) { |
15771 |
+- ext4_group_t flex_group = ext4_flex_group(sbi, group); |
15772 |
++ if (sbi->s_log_groups_per_flex) { |
15773 |
++ ext4_group_t flex_group = ext4_flex_group(sbi, group); |
15774 |
++ struct flex_groups *fg = sbi_array_rcu_deref(sbi, |
15775 |
++ s_flex_groups, flex_group); |
15776 |
+ |
15777 |
+- atomic64_sub(len, |
15778 |
+- &sbi_array_rcu_deref(sbi, s_flex_groups, |
15779 |
+- flex_group)->free_clusters); |
15780 |
++ if (state) |
15781 |
++ atomic64_sub(clen_changed, &fg->free_clusters); |
15782 |
++ else |
15783 |
++ atomic64_add(clen_changed, &fg->free_clusters); |
15784 |
++ |
15785 |
++ } |
15786 |
++ |
15787 |
++ err = ext4_handle_dirty_metadata(NULL, NULL, bitmap_bh); |
15788 |
++ if (err) |
15789 |
++ break; |
15790 |
++ sync_dirty_buffer(bitmap_bh); |
15791 |
++ err = ext4_handle_dirty_metadata(NULL, NULL, gdp_bh); |
15792 |
++ sync_dirty_buffer(gdp_bh); |
15793 |
++ if (err) |
15794 |
++ break; |
15795 |
++ |
15796 |
++ block += thisgrp_len; |
15797 |
++ len -= thisgrp_len; |
15798 |
++ brelse(bitmap_bh); |
15799 |
++ BUG_ON(len < 0); |
15800 |
+ } |
15801 |
+ |
15802 |
+- err = ext4_handle_dirty_metadata(NULL, NULL, bitmap_bh); |
15803 |
+ if (err) |
15804 |
+- goto out_err; |
15805 |
+- sync_dirty_buffer(bitmap_bh); |
15806 |
+- err = ext4_handle_dirty_metadata(NULL, NULL, gdp_bh); |
15807 |
+- sync_dirty_buffer(gdp_bh); |
15808 |
+- |
15809 |
+-out_err: |
15810 |
+- brelse(bitmap_bh); |
15811 |
++ brelse(bitmap_bh); |
15812 |
+ } |
15813 |
+ |
15814 |
+ /* |
15815 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
15816 |
+index f71de6c1ecf40..a622e186b7ee1 100644 |
15817 |
+--- a/fs/ext4/namei.c |
15818 |
++++ b/fs/ext4/namei.c |
15819 |
+@@ -2868,14 +2868,14 @@ bool ext4_empty_dir(struct inode *inode) |
15820 |
+ sb = inode->i_sb; |
15821 |
+ if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)) { |
15822 |
+ EXT4_ERROR_INODE(inode, "invalid size"); |
15823 |
+- return true; |
15824 |
++ return false; |
15825 |
+ } |
15826 |
+ /* The first directory block must not be a hole, |
15827 |
+ * so treat it as DIRENT_HTREE |
15828 |
+ */ |
15829 |
+ bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE); |
15830 |
+ if (IS_ERR(bh)) |
15831 |
+- return true; |
15832 |
++ return false; |
15833 |
+ |
15834 |
+ de = (struct ext4_dir_entry_2 *) bh->b_data; |
15835 |
+ if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, |
15836 |
+@@ -2883,7 +2883,7 @@ bool ext4_empty_dir(struct inode *inode) |
15837 |
+ le32_to_cpu(de->inode) != inode->i_ino || strcmp(".", de->name)) { |
15838 |
+ ext4_warning_inode(inode, "directory missing '.'"); |
15839 |
+ brelse(bh); |
15840 |
+- return true; |
15841 |
++ return false; |
15842 |
+ } |
15843 |
+ offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
15844 |
+ de = ext4_next_entry(de, sb->s_blocksize); |
15845 |
+@@ -2892,7 +2892,7 @@ bool ext4_empty_dir(struct inode *inode) |
15846 |
+ le32_to_cpu(de->inode) == 0 || strcmp("..", de->name)) { |
15847 |
+ ext4_warning_inode(inode, "directory missing '..'"); |
15848 |
+ brelse(bh); |
15849 |
+- return true; |
15850 |
++ return false; |
15851 |
+ } |
15852 |
+ offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
15853 |
+ while (offset < inode->i_size) { |
15854 |
+@@ -2906,7 +2906,7 @@ bool ext4_empty_dir(struct inode *inode) |
15855 |
+ continue; |
15856 |
+ } |
15857 |
+ if (IS_ERR(bh)) |
15858 |
+- return true; |
15859 |
++ return false; |
15860 |
+ } |
15861 |
+ de = (struct ext4_dir_entry_2 *) (bh->b_data + |
15862 |
+ (offset & (sb->s_blocksize - 1))); |
15863 |
+diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
15864 |
+index 9bcd77db980df..77f30320f8628 100644 |
15865 |
+--- a/fs/f2fs/checkpoint.c |
15866 |
++++ b/fs/f2fs/checkpoint.c |
15867 |
+@@ -851,6 +851,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, |
15868 |
+ struct page *cp_page_1 = NULL, *cp_page_2 = NULL; |
15869 |
+ struct f2fs_checkpoint *cp_block = NULL; |
15870 |
+ unsigned long long cur_version = 0, pre_version = 0; |
15871 |
++ unsigned int cp_blocks; |
15872 |
+ int err; |
15873 |
+ |
15874 |
+ err = get_checkpoint_version(sbi, cp_addr, &cp_block, |
15875 |
+@@ -858,15 +859,16 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, |
15876 |
+ if (err) |
15877 |
+ return NULL; |
15878 |
+ |
15879 |
+- if (le32_to_cpu(cp_block->cp_pack_total_block_count) > |
15880 |
+- sbi->blocks_per_seg) { |
15881 |
++ cp_blocks = le32_to_cpu(cp_block->cp_pack_total_block_count); |
15882 |
++ |
15883 |
++ if (cp_blocks > sbi->blocks_per_seg || cp_blocks <= F2FS_CP_PACKS) { |
15884 |
+ f2fs_warn(sbi, "invalid cp_pack_total_block_count:%u", |
15885 |
+ le32_to_cpu(cp_block->cp_pack_total_block_count)); |
15886 |
+ goto invalid_cp; |
15887 |
+ } |
15888 |
+ pre_version = *version; |
15889 |
+ |
15890 |
+- cp_addr += le32_to_cpu(cp_block->cp_pack_total_block_count) - 1; |
15891 |
++ cp_addr += cp_blocks - 1; |
15892 |
+ err = get_checkpoint_version(sbi, cp_addr, &cp_block, |
15893 |
+ &cp_page_2, version); |
15894 |
+ if (err) |
15895 |
+diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c |
15896 |
+index ec542e8c46cc9..1541da5ace85e 100644 |
15897 |
+--- a/fs/f2fs/compress.c |
15898 |
++++ b/fs/f2fs/compress.c |
15899 |
+@@ -286,10 +286,9 @@ static int lz4_decompress_pages(struct decompress_io_ctx *dic) |
15900 |
+ } |
15901 |
+ |
15902 |
+ if (ret != PAGE_SIZE << dic->log_cluster_size) { |
15903 |
+- printk_ratelimited("%sF2FS-fs (%s): lz4 invalid rlen:%zu, " |
15904 |
++ printk_ratelimited("%sF2FS-fs (%s): lz4 invalid ret:%d, " |
15905 |
+ "expected:%lu\n", KERN_ERR, |
15906 |
+- F2FS_I_SB(dic->inode)->sb->s_id, |
15907 |
+- dic->rlen, |
15908 |
++ F2FS_I_SB(dic->inode)->sb->s_id, ret, |
15909 |
+ PAGE_SIZE << dic->log_cluster_size); |
15910 |
+ return -EIO; |
15911 |
+ } |
15912 |
+diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
15913 |
+index 1b11a42847c48..b2016fd3a7ca3 100644 |
15914 |
+--- a/fs/f2fs/data.c |
15915 |
++++ b/fs/f2fs/data.c |
15916 |
+@@ -3264,8 +3264,12 @@ static int __f2fs_write_data_pages(struct address_space *mapping, |
15917 |
+ /* to avoid spliting IOs due to mixed WB_SYNC_ALL and WB_SYNC_NONE */ |
15918 |
+ if (wbc->sync_mode == WB_SYNC_ALL) |
15919 |
+ atomic_inc(&sbi->wb_sync_req[DATA]); |
15920 |
+- else if (atomic_read(&sbi->wb_sync_req[DATA])) |
15921 |
++ else if (atomic_read(&sbi->wb_sync_req[DATA])) { |
15922 |
++ /* to avoid potential deadlock */ |
15923 |
++ if (current->plug) |
15924 |
++ blk_finish_plug(current->plug); |
15925 |
+ goto skip_write; |
15926 |
++ } |
15927 |
+ |
15928 |
+ if (__should_serialize_io(inode, wbc)) { |
15929 |
+ mutex_lock(&sbi->writepages); |
15930 |
+@@ -3457,6 +3461,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, |
15931 |
+ |
15932 |
+ *fsdata = NULL; |
15933 |
+ |
15934 |
++ if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode))) |
15935 |
++ goto repeat; |
15936 |
++ |
15937 |
+ ret = f2fs_prepare_compress_overwrite(inode, pagep, |
15938 |
+ index, fsdata); |
15939 |
+ if (ret < 0) { |
15940 |
+diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
15941 |
+index 1fbaab1f7aba8..792f9059d897c 100644 |
15942 |
+--- a/fs/f2fs/file.c |
15943 |
++++ b/fs/f2fs/file.c |
15944 |
+@@ -2035,7 +2035,10 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) |
15945 |
+ |
15946 |
+ inode_lock(inode); |
15947 |
+ |
15948 |
+- f2fs_disable_compressed_file(inode); |
15949 |
++ if (!f2fs_disable_compressed_file(inode)) { |
15950 |
++ ret = -EINVAL; |
15951 |
++ goto out; |
15952 |
++ } |
15953 |
+ |
15954 |
+ if (f2fs_is_atomic_file(inode)) { |
15955 |
+ if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST)) |
15956 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
15957 |
+index 6b240b71d2e83..24e93fb254c5f 100644 |
15958 |
+--- a/fs/f2fs/gc.c |
15959 |
++++ b/fs/f2fs/gc.c |
15960 |
+@@ -998,8 +998,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, |
15961 |
+ set_sbi_flag(sbi, SBI_NEED_FSCK); |
15962 |
+ } |
15963 |
+ |
15964 |
+- if (f2fs_check_nid_range(sbi, dni->ino)) |
15965 |
++ if (f2fs_check_nid_range(sbi, dni->ino)) { |
15966 |
++ f2fs_put_page(node_page, 1); |
15967 |
+ return false; |
15968 |
++ } |
15969 |
+ |
15970 |
+ *nofs = ofs_of_node(node_page); |
15971 |
+ source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); |
15972 |
+diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c |
15973 |
+index a35fcf43ad5a3..98483f50e5e92 100644 |
15974 |
+--- a/fs/f2fs/inode.c |
15975 |
++++ b/fs/f2fs/inode.c |
15976 |
+@@ -848,6 +848,7 @@ void f2fs_handle_failed_inode(struct inode *inode) |
15977 |
+ err = f2fs_get_node_info(sbi, inode->i_ino, &ni); |
15978 |
+ if (err) { |
15979 |
+ set_sbi_flag(sbi, SBI_NEED_FSCK); |
15980 |
++ set_inode_flag(inode, FI_FREE_NID); |
15981 |
+ f2fs_warn(sbi, "May loss orphan inode, run fsck to fix."); |
15982 |
+ goto out; |
15983 |
+ } |
15984 |
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
15985 |
+index 7e625806bd4a2..5fa10d0b00683 100644 |
15986 |
+--- a/fs/f2fs/node.c |
15987 |
++++ b/fs/f2fs/node.c |
15988 |
+@@ -2055,8 +2055,12 @@ static int f2fs_write_node_pages(struct address_space *mapping, |
15989 |
+ |
15990 |
+ if (wbc->sync_mode == WB_SYNC_ALL) |
15991 |
+ atomic_inc(&sbi->wb_sync_req[NODE]); |
15992 |
+- else if (atomic_read(&sbi->wb_sync_req[NODE])) |
15993 |
++ else if (atomic_read(&sbi->wb_sync_req[NODE])) { |
15994 |
++ /* to avoid potential deadlock */ |
15995 |
++ if (current->plug) |
15996 |
++ blk_finish_plug(current->plug); |
15997 |
+ goto skip_write; |
15998 |
++ } |
15999 |
+ |
16000 |
+ trace_f2fs_writepages(mapping->host, wbc, NODE); |
16001 |
+ |
16002 |
+diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c |
16003 |
+index d04b449978aa8..49f5cb532738d 100644 |
16004 |
+--- a/fs/f2fs/segment.c |
16005 |
++++ b/fs/f2fs/segment.c |
16006 |
+@@ -4650,6 +4650,13 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) |
16007 |
+ |
16008 |
+ sanity_check_seg_type(sbi, curseg->seg_type); |
16009 |
+ |
16010 |
++ if (curseg->alloc_type != LFS && curseg->alloc_type != SSR) { |
16011 |
++ f2fs_err(sbi, |
16012 |
++ "Current segment has invalid alloc_type:%d", |
16013 |
++ curseg->alloc_type); |
16014 |
++ return -EFSCORRUPTED; |
16015 |
++ } |
16016 |
++ |
16017 |
+ if (f2fs_test_bit(blkofs, se->cur_valid_map)) |
16018 |
+ goto out; |
16019 |
+ |
16020 |
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
16021 |
+index af98abb17c272..78ee14f6e939e 100644 |
16022 |
+--- a/fs/f2fs/super.c |
16023 |
++++ b/fs/f2fs/super.c |
16024 |
+@@ -2278,7 +2278,7 @@ int f2fs_quota_sync(struct super_block *sb, int type) |
16025 |
+ struct f2fs_sb_info *sbi = F2FS_SB(sb); |
16026 |
+ struct quota_info *dqopt = sb_dqopt(sb); |
16027 |
+ int cnt; |
16028 |
+- int ret; |
16029 |
++ int ret = 0; |
16030 |
+ |
16031 |
+ /* |
16032 |
+ * Now when everything is written we can discard the pagecache so |
16033 |
+@@ -2289,8 +2289,8 @@ int f2fs_quota_sync(struct super_block *sb, int type) |
16034 |
+ if (type != -1 && cnt != type) |
16035 |
+ continue; |
16036 |
+ |
16037 |
+- if (!sb_has_quota_active(sb, type)) |
16038 |
+- return 0; |
16039 |
++ if (!sb_has_quota_active(sb, cnt)) |
16040 |
++ continue; |
16041 |
+ |
16042 |
+ inode_lock(dqopt->files[cnt]); |
16043 |
+ |
16044 |
+diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c |
16045 |
+index 7ffd4bb398b0c..a7e7d68256e00 100644 |
16046 |
+--- a/fs/f2fs/sysfs.c |
16047 |
++++ b/fs/f2fs/sysfs.c |
16048 |
+@@ -386,7 +386,7 @@ out: |
16049 |
+ } else if (t == GC_IDLE_AT) { |
16050 |
+ if (!sbi->am.atgc_enabled) |
16051 |
+ return -EINVAL; |
16052 |
+- sbi->gc_mode = GC_AT; |
16053 |
++ sbi->gc_mode = GC_IDLE_AT; |
16054 |
+ } else { |
16055 |
+ sbi->gc_mode = GC_NORMAL; |
16056 |
+ } |
16057 |
+diff --git a/fs/file.c b/fs/file.c |
16058 |
+index 79a76d04c7c33..8431dfde036cc 100644 |
16059 |
+--- a/fs/file.c |
16060 |
++++ b/fs/file.c |
16061 |
+@@ -85,6 +85,21 @@ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt) |
16062 |
+ copy_fd_bitmaps(nfdt, ofdt, ofdt->max_fds); |
16063 |
+ } |
16064 |
+ |
16065 |
++/* |
16066 |
++ * Note how the fdtable bitmap allocations very much have to be a multiple of |
16067 |
++ * BITS_PER_LONG. This is not only because we walk those things in chunks of |
16068 |
++ * 'unsigned long' in some places, but simply because that is how the Linux |
16069 |
++ * kernel bitmaps are defined to work: they are not "bits in an array of bytes", |
16070 |
++ * they are very much "bits in an array of unsigned long". |
16071 |
++ * |
16072 |
++ * The ALIGN(nr, BITS_PER_LONG) here is for clarity: since we just multiplied |
16073 |
++ * by that "1024/sizeof(ptr)" before, we already know there are sufficient |
16074 |
++ * clear low bits. Clang seems to realize that, gcc ends up being confused. |
16075 |
++ * |
16076 |
++ * On a 128-bit machine, the ALIGN() would actually matter. In the meantime, |
16077 |
++ * let's consider it documentation (and maybe a test-case for gcc to improve |
16078 |
++ * its code generation ;) |
16079 |
++ */ |
16080 |
+ static struct fdtable * alloc_fdtable(unsigned int nr) |
16081 |
+ { |
16082 |
+ struct fdtable *fdt; |
16083 |
+@@ -100,6 +115,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr) |
16084 |
+ nr /= (1024 / sizeof(struct file *)); |
16085 |
+ nr = roundup_pow_of_two(nr + 1); |
16086 |
+ nr *= (1024 / sizeof(struct file *)); |
16087 |
++ nr = ALIGN(nr, BITS_PER_LONG); |
16088 |
+ /* |
16089 |
+ * Note that this can drive nr *below* what we had passed if sysctl_nr_open |
16090 |
+ * had been set lower between the check in expand_files() and here. Deal |
16091 |
+@@ -267,6 +283,19 @@ static unsigned int count_open_files(struct fdtable *fdt) |
16092 |
+ return i; |
16093 |
+ } |
16094 |
+ |
16095 |
++/* |
16096 |
++ * Note that a sane fdtable size always has to be a multiple of |
16097 |
++ * BITS_PER_LONG, since we have bitmaps that are sized by this. |
16098 |
++ * |
16099 |
++ * 'max_fds' will normally already be properly aligned, but it |
16100 |
++ * turns out that in the close_range() -> __close_range() -> |
16101 |
++ * unshare_fd() -> dup_fd() -> sane_fdtable_size() we can end |
16102 |
++ * up having a 'max_fds' value that isn't already aligned. |
16103 |
++ * |
16104 |
++ * Rather than make close_range() have to worry about this, |
16105 |
++ * just make that BITS_PER_LONG alignment be part of a sane |
16106 |
++ * fdtable size. Becuase that's really what it is. |
16107 |
++ */ |
16108 |
+ static unsigned int sane_fdtable_size(struct fdtable *fdt, unsigned int max_fds) |
16109 |
+ { |
16110 |
+ unsigned int count; |
16111 |
+@@ -274,7 +303,7 @@ static unsigned int sane_fdtable_size(struct fdtable *fdt, unsigned int max_fds) |
16112 |
+ count = count_open_files(fdt); |
16113 |
+ if (max_fds < NR_OPEN_DEFAULT) |
16114 |
+ max_fds = NR_OPEN_DEFAULT; |
16115 |
+- return min(count, max_fds); |
16116 |
++ return ALIGN(min(count, max_fds), BITS_PER_LONG); |
16117 |
+ } |
16118 |
+ |
16119 |
+ /* |
16120 |
+diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
16121 |
+index 5e8eef9990e32..eb775e93de97c 100644 |
16122 |
+--- a/fs/gfs2/rgrp.c |
16123 |
++++ b/fs/gfs2/rgrp.c |
16124 |
+@@ -1389,7 +1389,8 @@ int gfs2_fitrim(struct file *filp, void __user *argp) |
16125 |
+ |
16126 |
+ start = r.start >> bs_shift; |
16127 |
+ end = start + (r.len >> bs_shift); |
16128 |
+- minlen = max_t(u64, r.minlen, |
16129 |
++ minlen = max_t(u64, r.minlen, sdp->sd_sb.sb_bsize); |
16130 |
++ minlen = max_t(u64, minlen, |
16131 |
+ q->limits.discard_granularity) >> bs_shift; |
16132 |
+ |
16133 |
+ if (end <= start || minlen > sdp->sd_max_rg_data) |
16134 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
16135 |
+index fd188b9721511..5959b0359524c 100644 |
16136 |
+--- a/fs/io_uring.c |
16137 |
++++ b/fs/io_uring.c |
16138 |
+@@ -3220,13 +3220,15 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) |
16139 |
+ ret = nr; |
16140 |
+ break; |
16141 |
+ } |
16142 |
++ ret += nr; |
16143 |
+ if (!iov_iter_is_bvec(iter)) { |
16144 |
+ iov_iter_advance(iter, nr); |
16145 |
+ } else { |
16146 |
+- req->rw.len -= nr; |
16147 |
+ req->rw.addr += nr; |
16148 |
++ req->rw.len -= nr; |
16149 |
++ if (!req->rw.len) |
16150 |
++ break; |
16151 |
+ } |
16152 |
+- ret += nr; |
16153 |
+ if (nr != iovec.iov_len) |
16154 |
+ break; |
16155 |
+ } |
16156 |
+@@ -7348,6 +7350,7 @@ static int __io_sqe_files_scm(struct io_ring_ctx *ctx, int nr, int offset) |
16157 |
+ fput(fpl->fp[i]); |
16158 |
+ } else { |
16159 |
+ kfree_skb(skb); |
16160 |
++ free_uid(fpl->user); |
16161 |
+ kfree(fpl); |
16162 |
+ } |
16163 |
+ |
16164 |
+diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c |
16165 |
+index b288c8ae1236b..837cd55fd4c5e 100644 |
16166 |
+--- a/fs/jffs2/build.c |
16167 |
++++ b/fs/jffs2/build.c |
16168 |
+@@ -415,13 +415,15 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) |
16169 |
+ jffs2_free_ino_caches(c); |
16170 |
+ jffs2_free_raw_node_refs(c); |
16171 |
+ ret = -EIO; |
16172 |
+- goto out_free; |
16173 |
++ goto out_sum_exit; |
16174 |
+ } |
16175 |
+ |
16176 |
+ jffs2_calc_trigger_levels(c); |
16177 |
+ |
16178 |
+ return 0; |
16179 |
+ |
16180 |
++ out_sum_exit: |
16181 |
++ jffs2_sum_exit(c); |
16182 |
+ out_free: |
16183 |
+ kvfree(c->blocks); |
16184 |
+ |
16185 |
+diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c |
16186 |
+index 78858f6e95839..7170de78cd260 100644 |
16187 |
+--- a/fs/jffs2/fs.c |
16188 |
++++ b/fs/jffs2/fs.c |
16189 |
+@@ -602,8 +602,8 @@ out_root: |
16190 |
+ jffs2_free_ino_caches(c); |
16191 |
+ jffs2_free_raw_node_refs(c); |
16192 |
+ kvfree(c->blocks); |
16193 |
+- out_inohash: |
16194 |
+ jffs2_clear_xattr_subsystem(c); |
16195 |
++ out_inohash: |
16196 |
+ kfree(c->inocache_list); |
16197 |
+ out_wbuf: |
16198 |
+ jffs2_flash_cleanup(c); |
16199 |
+diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c |
16200 |
+index b676056826beb..29671e33a1714 100644 |
16201 |
+--- a/fs/jffs2/scan.c |
16202 |
++++ b/fs/jffs2/scan.c |
16203 |
+@@ -136,7 +136,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) |
16204 |
+ if (!s) { |
16205 |
+ JFFS2_WARNING("Can't allocate memory for summary\n"); |
16206 |
+ ret = -ENOMEM; |
16207 |
+- goto out; |
16208 |
++ goto out_buf; |
16209 |
+ } |
16210 |
+ } |
16211 |
+ |
16212 |
+@@ -275,13 +275,15 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) |
16213 |
+ } |
16214 |
+ ret = 0; |
16215 |
+ out: |
16216 |
++ jffs2_sum_reset_collected(s); |
16217 |
++ kfree(s); |
16218 |
++ out_buf: |
16219 |
+ if (buf_size) |
16220 |
+ kfree(flashbuf); |
16221 |
+ #ifndef __ECOS |
16222 |
+ else |
16223 |
+ mtd_unpoint(c->mtd, 0, c->mtd->size); |
16224 |
+ #endif |
16225 |
+- kfree(s); |
16226 |
+ return ret; |
16227 |
+ } |
16228 |
+ |
16229 |
+diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c |
16230 |
+index aedad59f8a458..e58ae29a223d7 100644 |
16231 |
+--- a/fs/jfs/jfs_dmap.c |
16232 |
++++ b/fs/jfs/jfs_dmap.c |
16233 |
+@@ -148,6 +148,7 @@ static const s8 budtab[256] = { |
16234 |
+ * 0 - success |
16235 |
+ * -ENOMEM - insufficient memory |
16236 |
+ * -EIO - i/o error |
16237 |
++ * -EINVAL - wrong bmap data |
16238 |
+ */ |
16239 |
+ int dbMount(struct inode *ipbmap) |
16240 |
+ { |
16241 |
+@@ -179,6 +180,12 @@ int dbMount(struct inode *ipbmap) |
16242 |
+ bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree); |
16243 |
+ bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); |
16244 |
+ bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag); |
16245 |
++ if (!bmp->db_numag) { |
16246 |
++ release_metapage(mp); |
16247 |
++ kfree(bmp); |
16248 |
++ return -EINVAL; |
16249 |
++ } |
16250 |
++ |
16251 |
+ bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel); |
16252 |
+ bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); |
16253 |
+ bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); |
16254 |
+diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c |
16255 |
+index b44219ce60b86..a5209643ac36c 100644 |
16256 |
+--- a/fs/nfs/callback_proc.c |
16257 |
++++ b/fs/nfs/callback_proc.c |
16258 |
+@@ -353,12 +353,11 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp, |
16259 |
+ struct cb_process_state *cps) |
16260 |
+ { |
16261 |
+ struct cb_devicenotifyargs *args = argp; |
16262 |
++ const struct pnfs_layoutdriver_type *ld = NULL; |
16263 |
+ uint32_t i; |
16264 |
+ __be32 res = 0; |
16265 |
+- struct nfs_client *clp = cps->clp; |
16266 |
+- struct nfs_server *server = NULL; |
16267 |
+ |
16268 |
+- if (!clp) { |
16269 |
++ if (!cps->clp) { |
16270 |
+ res = cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION); |
16271 |
+ goto out; |
16272 |
+ } |
16273 |
+@@ -366,23 +365,15 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp, |
16274 |
+ for (i = 0; i < args->ndevs; i++) { |
16275 |
+ struct cb_devicenotifyitem *dev = &args->devs[i]; |
16276 |
+ |
16277 |
+- if (!server || |
16278 |
+- server->pnfs_curr_ld->id != dev->cbd_layout_type) { |
16279 |
+- rcu_read_lock(); |
16280 |
+- list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) |
16281 |
+- if (server->pnfs_curr_ld && |
16282 |
+- server->pnfs_curr_ld->id == dev->cbd_layout_type) { |
16283 |
+- rcu_read_unlock(); |
16284 |
+- goto found; |
16285 |
+- } |
16286 |
+- rcu_read_unlock(); |
16287 |
+- continue; |
16288 |
++ if (!ld || ld->id != dev->cbd_layout_type) { |
16289 |
++ pnfs_put_layoutdriver(ld); |
16290 |
++ ld = pnfs_find_layoutdriver(dev->cbd_layout_type); |
16291 |
++ if (!ld) |
16292 |
++ continue; |
16293 |
+ } |
16294 |
+- |
16295 |
+- found: |
16296 |
+- nfs4_delete_deviceid(server->pnfs_curr_ld, clp, &dev->cbd_dev_id); |
16297 |
++ nfs4_delete_deviceid(ld, cps->clp, &dev->cbd_dev_id); |
16298 |
+ } |
16299 |
+- |
16300 |
++ pnfs_put_layoutdriver(ld); |
16301 |
+ out: |
16302 |
+ kfree(args->devs); |
16303 |
+ return res; |
16304 |
+diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c |
16305 |
+index 1725079a05276..ca8a4aa351dc9 100644 |
16306 |
+--- a/fs/nfs/callback_xdr.c |
16307 |
++++ b/fs/nfs/callback_xdr.c |
16308 |
+@@ -272,10 +272,6 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, |
16309 |
+ n = ntohl(*p++); |
16310 |
+ if (n == 0) |
16311 |
+ goto out; |
16312 |
+- if (n > ULONG_MAX / sizeof(*args->devs)) { |
16313 |
+- status = htonl(NFS4ERR_BADXDR); |
16314 |
+- goto out; |
16315 |
+- } |
16316 |
+ |
16317 |
+ args->devs = kmalloc_array(n, sizeof(*args->devs), GFP_KERNEL); |
16318 |
+ if (!args->devs) { |
16319 |
+diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c |
16320 |
+index f6676af37d5db..5e6453e9b3079 100644 |
16321 |
+--- a/fs/nfs/nfs2xdr.c |
16322 |
++++ b/fs/nfs/nfs2xdr.c |
16323 |
+@@ -948,7 +948,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
16324 |
+ |
16325 |
+ error = decode_filename_inline(xdr, &entry->name, &entry->len); |
16326 |
+ if (unlikely(error)) |
16327 |
+- return error; |
16328 |
++ return -EAGAIN; |
16329 |
+ |
16330 |
+ /* |
16331 |
+ * The type (size and byte order) of nfscookie isn't defined in |
16332 |
+diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c |
16333 |
+index dff6b52d26a85..b5a9379b14504 100644 |
16334 |
+--- a/fs/nfs/nfs3xdr.c |
16335 |
++++ b/fs/nfs/nfs3xdr.c |
16336 |
+@@ -1964,7 +1964,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
16337 |
+ bool plus) |
16338 |
+ { |
16339 |
+ struct user_namespace *userns = rpc_userns(entry->server->client); |
16340 |
+- struct nfs_entry old = *entry; |
16341 |
+ __be32 *p; |
16342 |
+ int error; |
16343 |
+ u64 new_cookie; |
16344 |
+@@ -1984,15 +1983,15 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
16345 |
+ |
16346 |
+ error = decode_fileid3(xdr, &entry->ino); |
16347 |
+ if (unlikely(error)) |
16348 |
+- return error; |
16349 |
++ return -EAGAIN; |
16350 |
+ |
16351 |
+ error = decode_inline_filename3(xdr, &entry->name, &entry->len); |
16352 |
+ if (unlikely(error)) |
16353 |
+- return error; |
16354 |
++ return -EAGAIN; |
16355 |
+ |
16356 |
+ error = decode_cookie3(xdr, &new_cookie); |
16357 |
+ if (unlikely(error)) |
16358 |
+- return error; |
16359 |
++ return -EAGAIN; |
16360 |
+ |
16361 |
+ entry->d_type = DT_UNKNOWN; |
16362 |
+ |
16363 |
+@@ -2000,7 +1999,7 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
16364 |
+ entry->fattr->valid = 0; |
16365 |
+ error = decode_post_op_attr(xdr, entry->fattr, userns); |
16366 |
+ if (unlikely(error)) |
16367 |
+- return error; |
16368 |
++ return -EAGAIN; |
16369 |
+ if (entry->fattr->valid & NFS_ATTR_FATTR_V3) |
16370 |
+ entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); |
16371 |
+ |
16372 |
+@@ -2015,11 +2014,8 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
16373 |
+ return -EAGAIN; |
16374 |
+ if (*p != xdr_zero) { |
16375 |
+ error = decode_nfs_fh3(xdr, entry->fh); |
16376 |
+- if (unlikely(error)) { |
16377 |
+- if (error == -E2BIG) |
16378 |
+- goto out_truncated; |
16379 |
+- return error; |
16380 |
+- } |
16381 |
++ if (unlikely(error)) |
16382 |
++ return -EAGAIN; |
16383 |
+ } else |
16384 |
+ zero_nfs_fh3(entry->fh); |
16385 |
+ } |
16386 |
+@@ -2028,11 +2024,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
16387 |
+ entry->cookie = new_cookie; |
16388 |
+ |
16389 |
+ return 0; |
16390 |
+- |
16391 |
+-out_truncated: |
16392 |
+- dprintk("NFS: directory entry contains invalid file handle\n"); |
16393 |
+- *entry = old; |
16394 |
+- return -EAGAIN; |
16395 |
+ } |
16396 |
+ |
16397 |
+ /* |
16398 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
16399 |
+index d222a980164b7..77199d3560429 100644 |
16400 |
+--- a/fs/nfs/nfs4proc.c |
16401 |
++++ b/fs/nfs/nfs4proc.c |
16402 |
+@@ -8205,6 +8205,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) |
16403 |
+ case -NFS4ERR_DEADSESSION: |
16404 |
+ nfs4_schedule_session_recovery(clp->cl_session, |
16405 |
+ task->tk_status); |
16406 |
++ return; |
16407 |
+ } |
16408 |
+ if (args->dir == NFS4_CDFC4_FORE_OR_BOTH && |
16409 |
+ res->dir != NFS4_CDFS4_BOTH) { |
16410 |
+diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
16411 |
+index 5370e082aded5..b3b9eff5d5727 100644 |
16412 |
+--- a/fs/nfs/pnfs.c |
16413 |
++++ b/fs/nfs/pnfs.c |
16414 |
+@@ -92,6 +92,17 @@ find_pnfs_driver(u32 id) |
16415 |
+ return local; |
16416 |
+ } |
16417 |
+ |
16418 |
++const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id) |
16419 |
++{ |
16420 |
++ return find_pnfs_driver(id); |
16421 |
++} |
16422 |
++ |
16423 |
++void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld) |
16424 |
++{ |
16425 |
++ if (ld) |
16426 |
++ module_put(ld->owner); |
16427 |
++} |
16428 |
++ |
16429 |
+ void |
16430 |
+ unset_pnfs_layoutdriver(struct nfs_server *nfss) |
16431 |
+ { |
16432 |
+diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h |
16433 |
+index 0212fe32e63aa..11d9ed9addc06 100644 |
16434 |
+--- a/fs/nfs/pnfs.h |
16435 |
++++ b/fs/nfs/pnfs.h |
16436 |
+@@ -236,6 +236,8 @@ struct pnfs_devicelist { |
16437 |
+ |
16438 |
+ extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *); |
16439 |
+ extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); |
16440 |
++extern const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id); |
16441 |
++extern void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld); |
16442 |
+ |
16443 |
+ /* nfs4proc.c */ |
16444 |
+ extern size_t max_response_pages(struct nfs_server *server); |
16445 |
+diff --git a/fs/nfs/write.c b/fs/nfs/write.c |
16446 |
+index bde4c362841f0..cc926e69ee9ba 100644 |
16447 |
+--- a/fs/nfs/write.c |
16448 |
++++ b/fs/nfs/write.c |
16449 |
+@@ -314,7 +314,10 @@ static void nfs_mapping_set_error(struct page *page, int error) |
16450 |
+ struct address_space *mapping = page_file_mapping(page); |
16451 |
+ |
16452 |
+ SetPageError(page); |
16453 |
+- mapping_set_error(mapping, error); |
16454 |
++ filemap_set_wb_err(mapping, error); |
16455 |
++ if (mapping->host) |
16456 |
++ errseq_set(&mapping->host->i_sb->s_wb_err, |
16457 |
++ error == -ENOSPC ? -ENOSPC : -EIO); |
16458 |
+ nfs_set_pageerror(mapping); |
16459 |
+ } |
16460 |
+ |
16461 |
+diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c |
16462 |
+index e5aad1c10ea32..acd0898e3866d 100644 |
16463 |
+--- a/fs/nfsd/filecache.c |
16464 |
++++ b/fs/nfsd/filecache.c |
16465 |
+@@ -641,7 +641,7 @@ nfsd_file_cache_init(void) |
16466 |
+ if (!nfsd_filecache_wq) |
16467 |
+ goto out; |
16468 |
+ |
16469 |
+- nfsd_file_hashtbl = kcalloc(NFSD_FILE_HASH_SIZE, |
16470 |
++ nfsd_file_hashtbl = kvcalloc(NFSD_FILE_HASH_SIZE, |
16471 |
+ sizeof(*nfsd_file_hashtbl), GFP_KERNEL); |
16472 |
+ if (!nfsd_file_hashtbl) { |
16473 |
+ pr_err("nfsd: unable to allocate nfsd_file_hashtbl\n"); |
16474 |
+@@ -708,7 +708,7 @@ out_err: |
16475 |
+ nfsd_file_slab = NULL; |
16476 |
+ kmem_cache_destroy(nfsd_file_mark_slab); |
16477 |
+ nfsd_file_mark_slab = NULL; |
16478 |
+- kfree(nfsd_file_hashtbl); |
16479 |
++ kvfree(nfsd_file_hashtbl); |
16480 |
+ nfsd_file_hashtbl = NULL; |
16481 |
+ destroy_workqueue(nfsd_filecache_wq); |
16482 |
+ nfsd_filecache_wq = NULL; |
16483 |
+@@ -854,7 +854,7 @@ nfsd_file_cache_shutdown(void) |
16484 |
+ fsnotify_wait_marks_destroyed(); |
16485 |
+ kmem_cache_destroy(nfsd_file_mark_slab); |
16486 |
+ nfsd_file_mark_slab = NULL; |
16487 |
+- kfree(nfsd_file_hashtbl); |
16488 |
++ kvfree(nfsd_file_hashtbl); |
16489 |
+ nfsd_file_hashtbl = NULL; |
16490 |
+ destroy_workqueue(nfsd_filecache_wq); |
16491 |
+ nfsd_filecache_wq = NULL; |
16492 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
16493 |
+index d01d7929753ef..84dd68091f422 100644 |
16494 |
+--- a/fs/nfsd/nfs4state.c |
16495 |
++++ b/fs/nfsd/nfs4state.c |
16496 |
+@@ -4607,6 +4607,14 @@ nfsd_break_deleg_cb(struct file_lock *fl) |
16497 |
+ return ret; |
16498 |
+ } |
16499 |
+ |
16500 |
++/** |
16501 |
++ * nfsd_breaker_owns_lease - Check if lease conflict was resolved |
16502 |
++ * @fl: Lock state to check |
16503 |
++ * |
16504 |
++ * Return values: |
16505 |
++ * %true: Lease conflict was resolved |
16506 |
++ * %false: Lease conflict was not resolved. |
16507 |
++ */ |
16508 |
+ static bool nfsd_breaker_owns_lease(struct file_lock *fl) |
16509 |
+ { |
16510 |
+ struct nfs4_delegation *dl = fl->fl_owner; |
16511 |
+@@ -4614,11 +4622,11 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl) |
16512 |
+ struct nfs4_client *clp; |
16513 |
+ |
16514 |
+ if (!i_am_nfsd()) |
16515 |
+- return NULL; |
16516 |
++ return false; |
16517 |
+ rqst = kthread_data(current); |
16518 |
+ /* Note rq_prog == NFS_ACL_PROGRAM is also possible: */ |
16519 |
+ if (rqst->rq_prog != NFS_PROGRAM || rqst->rq_vers < 4) |
16520 |
+- return NULL; |
16521 |
++ return false; |
16522 |
+ clp = *(rqst->rq_lease_breaker); |
16523 |
+ return dl->dl_stid.sc_client == clp; |
16524 |
+ } |
16525 |
+diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c |
16526 |
+index 9c9de2b66e641..bbd01e8397f6e 100644 |
16527 |
+--- a/fs/nfsd/nfsproc.c |
16528 |
++++ b/fs/nfsd/nfsproc.c |
16529 |
+@@ -223,7 +223,7 @@ nfsd_proc_write(struct svc_rqst *rqstp) |
16530 |
+ unsigned long cnt = argp->len; |
16531 |
+ unsigned int nvecs; |
16532 |
+ |
16533 |
+- dprintk("nfsd: WRITE %s %d bytes at %d\n", |
16534 |
++ dprintk("nfsd: WRITE %s %u bytes at %d\n", |
16535 |
+ SVCFH_fmt(&argp->fh), |
16536 |
+ argp->len, argp->offset); |
16537 |
+ |
16538 |
+diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h |
16539 |
+index 0ff336b0b25f9..b8cc6a4b2e0ec 100644 |
16540 |
+--- a/fs/nfsd/xdr.h |
16541 |
++++ b/fs/nfsd/xdr.h |
16542 |
+@@ -33,7 +33,7 @@ struct nfsd_readargs { |
16543 |
+ struct nfsd_writeargs { |
16544 |
+ svc_fh fh; |
16545 |
+ __u32 offset; |
16546 |
+- int len; |
16547 |
++ __u32 len; |
16548 |
+ struct kvec first; |
16549 |
+ }; |
16550 |
+ |
16551 |
+diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c |
16552 |
+index ea18e4a2a691d..cf222c9225d6d 100644 |
16553 |
+--- a/fs/ntfs/inode.c |
16554 |
++++ b/fs/ntfs/inode.c |
16555 |
+@@ -1881,6 +1881,10 @@ int ntfs_read_inode_mount(struct inode *vi) |
16556 |
+ } |
16557 |
+ /* Now allocate memory for the attribute list. */ |
16558 |
+ ni->attr_list_size = (u32)ntfs_attr_size(a); |
16559 |
++ if (!ni->attr_list_size) { |
16560 |
++ ntfs_error(sb, "Attr_list_size is zero"); |
16561 |
++ goto put_err_out; |
16562 |
++ } |
16563 |
+ ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); |
16564 |
+ if (!ni->attr_list) { |
16565 |
+ ntfs_error(sb, "Not enough memory to allocate buffer " |
16566 |
+diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c |
16567 |
+index ad31ec4ad6270..d82dae133243b 100644 |
16568 |
+--- a/fs/proc/bootconfig.c |
16569 |
++++ b/fs/proc/bootconfig.c |
16570 |
+@@ -32,6 +32,8 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) |
16571 |
+ int ret = 0; |
16572 |
+ |
16573 |
+ key = kzalloc(XBC_KEYLEN_MAX, GFP_KERNEL); |
16574 |
++ if (!key) |
16575 |
++ return -ENOMEM; |
16576 |
+ |
16577 |
+ xbc_for_each_key_value(leaf, val) { |
16578 |
+ ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX); |
16579 |
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c |
16580 |
+index b1ebf7b61732c..ce03c3dbb5c30 100644 |
16581 |
+--- a/fs/pstore/platform.c |
16582 |
++++ b/fs/pstore/platform.c |
16583 |
+@@ -143,21 +143,22 @@ static void pstore_timer_kick(void) |
16584 |
+ mod_timer(&pstore_timer, jiffies + msecs_to_jiffies(pstore_update_ms)); |
16585 |
+ } |
16586 |
+ |
16587 |
+-/* |
16588 |
+- * Should pstore_dump() wait for a concurrent pstore_dump()? If |
16589 |
+- * not, the current pstore_dump() will report a failure to dump |
16590 |
+- * and return. |
16591 |
+- */ |
16592 |
+-static bool pstore_cannot_wait(enum kmsg_dump_reason reason) |
16593 |
++static bool pstore_cannot_block_path(enum kmsg_dump_reason reason) |
16594 |
+ { |
16595 |
+- /* In NMI path, pstore shouldn't block regardless of reason. */ |
16596 |
++ /* |
16597 |
++ * In case of NMI path, pstore shouldn't be blocked |
16598 |
++ * regardless of reason. |
16599 |
++ */ |
16600 |
+ if (in_nmi()) |
16601 |
+ return true; |
16602 |
+ |
16603 |
+ switch (reason) { |
16604 |
+ /* In panic case, other cpus are stopped by smp_send_stop(). */ |
16605 |
+ case KMSG_DUMP_PANIC: |
16606 |
+- /* Emergency restart shouldn't be blocked. */ |
16607 |
++ /* |
16608 |
++ * Emergency restart shouldn't be blocked by spinning on |
16609 |
++ * pstore_info::buf_lock. |
16610 |
++ */ |
16611 |
+ case KMSG_DUMP_EMERG: |
16612 |
+ return true; |
16613 |
+ default: |
16614 |
+@@ -388,21 +389,19 @@ static void pstore_dump(struct kmsg_dumper *dumper, |
16615 |
+ unsigned long total = 0; |
16616 |
+ const char *why; |
16617 |
+ unsigned int part = 1; |
16618 |
++ unsigned long flags = 0; |
16619 |
+ int ret; |
16620 |
+ |
16621 |
+ why = kmsg_dump_reason_str(reason); |
16622 |
+ |
16623 |
+- if (down_trylock(&psinfo->buf_lock)) { |
16624 |
+- /* Failed to acquire lock: give up if we cannot wait. */ |
16625 |
+- if (pstore_cannot_wait(reason)) { |
16626 |
+- pr_err("dump skipped in %s path: may corrupt error record\n", |
16627 |
+- in_nmi() ? "NMI" : why); |
16628 |
+- return; |
16629 |
+- } |
16630 |
+- if (down_interruptible(&psinfo->buf_lock)) { |
16631 |
+- pr_err("could not grab semaphore?!\n"); |
16632 |
++ if (pstore_cannot_block_path(reason)) { |
16633 |
++ if (!spin_trylock_irqsave(&psinfo->buf_lock, flags)) { |
16634 |
++ pr_err("dump skipped in %s path because of concurrent dump\n", |
16635 |
++ in_nmi() ? "NMI" : why); |
16636 |
+ return; |
16637 |
+ } |
16638 |
++ } else { |
16639 |
++ spin_lock_irqsave(&psinfo->buf_lock, flags); |
16640 |
+ } |
16641 |
+ |
16642 |
+ oopscount++; |
16643 |
+@@ -464,8 +463,7 @@ static void pstore_dump(struct kmsg_dumper *dumper, |
16644 |
+ total += record.size; |
16645 |
+ part++; |
16646 |
+ } |
16647 |
+- |
16648 |
+- up(&psinfo->buf_lock); |
16649 |
++ spin_unlock_irqrestore(&psinfo->buf_lock, flags); |
16650 |
+ } |
16651 |
+ |
16652 |
+ static struct kmsg_dumper pstore_dumper = { |
16653 |
+@@ -591,7 +589,7 @@ int pstore_register(struct pstore_info *psi) |
16654 |
+ psi->write_user = pstore_write_user_compat; |
16655 |
+ psinfo = psi; |
16656 |
+ mutex_init(&psinfo->read_mutex); |
16657 |
+- sema_init(&psinfo->buf_lock, 1); |
16658 |
++ spin_lock_init(&psinfo->buf_lock); |
16659 |
+ |
16660 |
+ if (psi->flags & PSTORE_FLAGS_DMESG) |
16661 |
+ allocate_buf_for_compression(); |
16662 |
+diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c |
16663 |
+index ad90a3a64293e..5daffd46369dd 100644 |
16664 |
+--- a/fs/ubifs/dir.c |
16665 |
++++ b/fs/ubifs/dir.c |
16666 |
+@@ -431,6 +431,8 @@ out_inode: |
16667 |
+ make_bad_inode(inode); |
16668 |
+ if (!instantiated) |
16669 |
+ iput(inode); |
16670 |
++ else if (whiteout) |
16671 |
++ iput(*whiteout); |
16672 |
+ out_budg: |
16673 |
+ ubifs_release_budget(c, &req); |
16674 |
+ if (!instantiated) |
16675 |
+@@ -1322,6 +1324,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, |
16676 |
+ |
16677 |
+ if (flags & RENAME_WHITEOUT) { |
16678 |
+ union ubifs_dev_desc *dev = NULL; |
16679 |
++ struct ubifs_budget_req wht_req; |
16680 |
+ |
16681 |
+ dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); |
16682 |
+ if (!dev) { |
16683 |
+@@ -1343,6 +1346,23 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, |
16684 |
+ whiteout_ui->data = dev; |
16685 |
+ whiteout_ui->data_len = ubifs_encode_dev(dev, MKDEV(0, 0)); |
16686 |
+ ubifs_assert(c, !whiteout_ui->dirty); |
16687 |
++ |
16688 |
++ memset(&wht_req, 0, sizeof(struct ubifs_budget_req)); |
16689 |
++ wht_req.dirtied_ino = 1; |
16690 |
++ wht_req.dirtied_ino_d = ALIGN(whiteout_ui->data_len, 8); |
16691 |
++ /* |
16692 |
++ * To avoid deadlock between space budget (holds ui_mutex and |
16693 |
++ * waits wb work) and writeback work(waits ui_mutex), do space |
16694 |
++ * budget before ubifs inodes locked. |
16695 |
++ */ |
16696 |
++ err = ubifs_budget_space(c, &wht_req); |
16697 |
++ if (err) { |
16698 |
++ iput(whiteout); |
16699 |
++ goto out_release; |
16700 |
++ } |
16701 |
++ |
16702 |
++ /* Add the old_dentry size to the old_dir size. */ |
16703 |
++ old_sz -= CALC_DENT_SIZE(fname_len(&old_nm)); |
16704 |
+ } |
16705 |
+ |
16706 |
+ lock_4_inodes(old_dir, new_dir, new_inode, whiteout); |
16707 |
+@@ -1417,18 +1437,6 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, |
16708 |
+ } |
16709 |
+ |
16710 |
+ if (whiteout) { |
16711 |
+- struct ubifs_budget_req wht_req = { .dirtied_ino = 1, |
16712 |
+- .dirtied_ino_d = \ |
16713 |
+- ALIGN(ubifs_inode(whiteout)->data_len, 8) }; |
16714 |
+- |
16715 |
+- err = ubifs_budget_space(c, &wht_req); |
16716 |
+- if (err) { |
16717 |
+- kfree(whiteout_ui->data); |
16718 |
+- whiteout_ui->data_len = 0; |
16719 |
+- iput(whiteout); |
16720 |
+- goto out_release; |
16721 |
+- } |
16722 |
+- |
16723 |
+ inc_nlink(whiteout); |
16724 |
+ mark_inode_dirty(whiteout); |
16725 |
+ |
16726 |
+diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c |
16727 |
+index f4826b6da6828..354457e846cda 100644 |
16728 |
+--- a/fs/ubifs/file.c |
16729 |
++++ b/fs/ubifs/file.c |
16730 |
+@@ -570,7 +570,7 @@ static int ubifs_write_end(struct file *file, struct address_space *mapping, |
16731 |
+ } |
16732 |
+ |
16733 |
+ if (!PagePrivate(page)) { |
16734 |
+- SetPagePrivate(page); |
16735 |
++ attach_page_private(page, (void *)1); |
16736 |
+ atomic_long_inc(&c->dirty_pg_cnt); |
16737 |
+ __set_page_dirty_nobuffers(page); |
16738 |
+ } |
16739 |
+@@ -947,7 +947,7 @@ static int do_writepage(struct page *page, int len) |
16740 |
+ release_existing_page_budget(c); |
16741 |
+ |
16742 |
+ atomic_long_dec(&c->dirty_pg_cnt); |
16743 |
+- ClearPagePrivate(page); |
16744 |
++ detach_page_private(page); |
16745 |
+ ClearPageChecked(page); |
16746 |
+ |
16747 |
+ kunmap(page); |
16748 |
+@@ -1303,7 +1303,7 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset, |
16749 |
+ release_existing_page_budget(c); |
16750 |
+ |
16751 |
+ atomic_long_dec(&c->dirty_pg_cnt); |
16752 |
+- ClearPagePrivate(page); |
16753 |
++ detach_page_private(page); |
16754 |
+ ClearPageChecked(page); |
16755 |
+ } |
16756 |
+ |
16757 |
+@@ -1470,8 +1470,8 @@ static int ubifs_migrate_page(struct address_space *mapping, |
16758 |
+ return rc; |
16759 |
+ |
16760 |
+ if (PagePrivate(page)) { |
16761 |
+- ClearPagePrivate(page); |
16762 |
+- SetPagePrivate(newpage); |
16763 |
++ detach_page_private(page); |
16764 |
++ attach_page_private(newpage, (void *)1); |
16765 |
+ } |
16766 |
+ |
16767 |
+ if (mode != MIGRATE_SYNC_NO_COPY) |
16768 |
+@@ -1495,7 +1495,7 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) |
16769 |
+ return 0; |
16770 |
+ ubifs_assert(c, PagePrivate(page)); |
16771 |
+ ubifs_assert(c, 0); |
16772 |
+- ClearPagePrivate(page); |
16773 |
++ detach_page_private(page); |
16774 |
+ ClearPageChecked(page); |
16775 |
+ return 1; |
16776 |
+ } |
16777 |
+@@ -1566,7 +1566,7 @@ static vm_fault_t ubifs_vm_page_mkwrite(struct vm_fault *vmf) |
16778 |
+ else { |
16779 |
+ if (!PageChecked(page)) |
16780 |
+ ubifs_convert_page_budget(c); |
16781 |
+- SetPagePrivate(page); |
16782 |
++ attach_page_private(page, (void *)1); |
16783 |
+ atomic_long_inc(&c->dirty_pg_cnt); |
16784 |
+ __set_page_dirty_nobuffers(page); |
16785 |
+ } |
16786 |
+diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c |
16787 |
+index eae9cf5a57b05..89b671ad0f9aa 100644 |
16788 |
+--- a/fs/ubifs/io.c |
16789 |
++++ b/fs/ubifs/io.c |
16790 |
+@@ -846,16 +846,42 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) |
16791 |
+ */ |
16792 |
+ n = aligned_len >> c->max_write_shift; |
16793 |
+ if (n) { |
16794 |
+- n <<= c->max_write_shift; |
16795 |
++ int m = n - 1; |
16796 |
++ |
16797 |
+ dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, |
16798 |
+ wbuf->offs); |
16799 |
+- err = ubifs_leb_write(c, wbuf->lnum, buf + written, |
16800 |
+- wbuf->offs, n); |
16801 |
++ |
16802 |
++ if (m) { |
16803 |
++ /* '(n-1)<<c->max_write_shift < len' is always true. */ |
16804 |
++ m <<= c->max_write_shift; |
16805 |
++ err = ubifs_leb_write(c, wbuf->lnum, buf + written, |
16806 |
++ wbuf->offs, m); |
16807 |
++ if (err) |
16808 |
++ goto out; |
16809 |
++ wbuf->offs += m; |
16810 |
++ aligned_len -= m; |
16811 |
++ len -= m; |
16812 |
++ written += m; |
16813 |
++ } |
16814 |
++ |
16815 |
++ /* |
16816 |
++ * The non-written len of buf may be less than 'n' because |
16817 |
++ * parameter 'len' is not 8 bytes aligned, so here we read |
16818 |
++ * min(len, n) bytes from buf. |
16819 |
++ */ |
16820 |
++ n = 1 << c->max_write_shift; |
16821 |
++ memcpy(wbuf->buf, buf + written, min(len, n)); |
16822 |
++ if (n > len) { |
16823 |
++ ubifs_assert(c, n - len < 8); |
16824 |
++ ubifs_pad(c, wbuf->buf + len, n - len); |
16825 |
++ } |
16826 |
++ |
16827 |
++ err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, n); |
16828 |
+ if (err) |
16829 |
+ goto out; |
16830 |
+ wbuf->offs += n; |
16831 |
+ aligned_len -= n; |
16832 |
+- len -= n; |
16833 |
++ len -= min(len, n); |
16834 |
+ written += n; |
16835 |
+ } |
16836 |
+ |
16837 |
+diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c |
16838 |
+index 4363d85a3fd40..8db380a000325 100644 |
16839 |
+--- a/fs/ubifs/ioctl.c |
16840 |
++++ b/fs/ubifs/ioctl.c |
16841 |
+@@ -107,7 +107,7 @@ static int setflags(struct inode *inode, int flags) |
16842 |
+ struct ubifs_inode *ui = ubifs_inode(inode); |
16843 |
+ struct ubifs_info *c = inode->i_sb->s_fs_info; |
16844 |
+ struct ubifs_budget_req req = { .dirtied_ino = 1, |
16845 |
+- .dirtied_ino_d = ui->data_len }; |
16846 |
++ .dirtied_ino_d = ALIGN(ui->data_len, 8) }; |
16847 |
+ |
16848 |
+ err = ubifs_budget_space(c, &req); |
16849 |
+ if (err) |
16850 |
+diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h |
16851 |
+index 0bbfd647f5c6d..6cc93ab5b8096 100644 |
16852 |
+--- a/include/linux/amba/bus.h |
16853 |
++++ b/include/linux/amba/bus.h |
16854 |
+@@ -76,7 +76,7 @@ struct amba_device { |
16855 |
+ struct amba_driver { |
16856 |
+ struct device_driver drv; |
16857 |
+ int (*probe)(struct amba_device *, const struct amba_id *); |
16858 |
+- int (*remove)(struct amba_device *); |
16859 |
++ void (*remove)(struct amba_device *); |
16860 |
+ void (*shutdown)(struct amba_device *); |
16861 |
+ const struct amba_id *id_table; |
16862 |
+ }; |
16863 |
+diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h |
16864 |
+index 0571701ab1c57..5a9786e6b5546 100644 |
16865 |
+--- a/include/linux/binfmts.h |
16866 |
++++ b/include/linux/binfmts.h |
16867 |
+@@ -82,6 +82,9 @@ struct coredump_params { |
16868 |
+ unsigned long mm_flags; |
16869 |
+ loff_t written; |
16870 |
+ loff_t pos; |
16871 |
++ int vma_count; |
16872 |
++ size_t vma_data_size; |
16873 |
++ struct core_vma_metadata *vma_meta; |
16874 |
+ }; |
16875 |
+ |
16876 |
+ /* |
16877 |
+diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h |
16878 |
+index c8fc9792ac776..0e6e84db06f67 100644 |
16879 |
+--- a/include/linux/blk-cgroup.h |
16880 |
++++ b/include/linux/blk-cgroup.h |
16881 |
+@@ -24,6 +24,7 @@ |
16882 |
+ #include <linux/atomic.h> |
16883 |
+ #include <linux/kthread.h> |
16884 |
+ #include <linux/fs.h> |
16885 |
++#include <linux/blk-mq.h> |
16886 |
+ |
16887 |
+ /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ |
16888 |
+ #define BLKG_STAT_CPU_BATCH (INT_MAX / 2) |
16889 |
+@@ -599,6 +600,21 @@ static inline void blkcg_clear_delay(struct blkcg_gq *blkg) |
16890 |
+ atomic_dec(&blkg->blkcg->css.cgroup->congestion_count); |
16891 |
+ } |
16892 |
+ |
16893 |
++/** |
16894 |
++ * blk_cgroup_mergeable - Determine whether to allow or disallow merges |
16895 |
++ * @rq: request to merge into |
16896 |
++ * @bio: bio to merge |
16897 |
++ * |
16898 |
++ * @bio and @rq should belong to the same cgroup and their issue_as_root should |
16899 |
++ * match. The latter is necessary as we don't want to throttle e.g. a metadata |
16900 |
++ * update because it happens to be next to a regular IO. |
16901 |
++ */ |
16902 |
++static inline bool blk_cgroup_mergeable(struct request *rq, struct bio *bio) |
16903 |
++{ |
16904 |
++ return rq->bio->bi_blkg == bio->bi_blkg && |
16905 |
++ bio_issue_as_root_blkg(rq->bio) == bio_issue_as_root_blkg(bio); |
16906 |
++} |
16907 |
++ |
16908 |
+ void blk_cgroup_bio_start(struct bio *bio); |
16909 |
+ void blkcg_add_delay(struct blkcg_gq *blkg, u64 now, u64 delta); |
16910 |
+ void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay); |
16911 |
+@@ -654,6 +670,7 @@ static inline void blkg_put(struct blkcg_gq *blkg) { } |
16912 |
+ static inline bool blkcg_punt_bio_submit(struct bio *bio) { return false; } |
16913 |
+ static inline void blkcg_bio_issue_init(struct bio *bio) { } |
16914 |
+ static inline void blk_cgroup_bio_start(struct bio *bio) { } |
16915 |
++static inline bool blk_cgroup_mergeable(struct request *rq, struct bio *bio) { return true; } |
16916 |
+ |
16917 |
+ #define blk_queue_for_each_rl(rl, q) \ |
16918 |
+ for ((rl) = &(q)->root_rl; (rl); (rl) = NULL) |
16919 |
+diff --git a/include/linux/coredump.h b/include/linux/coredump.h |
16920 |
+index e58e8c2077828..5300d0cb70f7e 100644 |
16921 |
+--- a/include/linux/coredump.h |
16922 |
++++ b/include/linux/coredump.h |
16923 |
+@@ -11,6 +11,8 @@ struct core_vma_metadata { |
16924 |
+ unsigned long start, end; |
16925 |
+ unsigned long flags; |
16926 |
+ unsigned long dump_size; |
16927 |
++ unsigned long pgoff; |
16928 |
++ struct file *file; |
16929 |
+ }; |
16930 |
+ |
16931 |
+ /* |
16932 |
+@@ -24,9 +26,6 @@ extern int dump_align(struct coredump_params *cprm, int align); |
16933 |
+ extern void dump_truncate(struct coredump_params *cprm); |
16934 |
+ int dump_user_range(struct coredump_params *cprm, unsigned long start, |
16935 |
+ unsigned long len); |
16936 |
+-int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, |
16937 |
+- struct core_vma_metadata **vma_meta, |
16938 |
+- size_t *vma_data_size_ptr); |
16939 |
+ #ifdef CONFIG_COREDUMP |
16940 |
+ extern void do_coredump(const kernel_siginfo_t *siginfo); |
16941 |
+ #else |
16942 |
+diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h |
16943 |
+index a7d70cdee25e3..a9361178c5dbb 100644 |
16944 |
+--- a/include/linux/dma-mapping.h |
16945 |
++++ b/include/linux/dma-mapping.h |
16946 |
+@@ -61,6 +61,14 @@ |
16947 |
+ */ |
16948 |
+ #define DMA_ATTR_PRIVILEGED (1UL << 9) |
16949 |
+ |
16950 |
++/* |
16951 |
++ * This is a hint to the DMA-mapping subsystem that the device is expected |
16952 |
++ * to overwrite the entire mapped size, thus the caller does not require any |
16953 |
++ * of the previous buffer contents to be preserved. This allows |
16954 |
++ * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers. |
16955 |
++ */ |
16956 |
++#define DMA_ATTR_OVERWRITE (1UL << 10) |
16957 |
++ |
16958 |
+ /* |
16959 |
+ * A dma_addr_t can hold any valid DMA or bus address for the platform. It can |
16960 |
+ * be given to a device to use as a DMA source or target. It is specific to a |
16961 |
+diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h |
16962 |
+index aac07940de09d..db2eaff77f41a 100644 |
16963 |
+--- a/include/linux/mtd/rawnand.h |
16964 |
++++ b/include/linux/mtd/rawnand.h |
16965 |
+@@ -1083,6 +1083,7 @@ struct nand_manufacturer { |
16966 |
+ * @lock: Lock protecting the suspended field. Also used to serialize accesses |
16967 |
+ * to the NAND device |
16968 |
+ * @suspended: Set to 1 when the device is suspended, 0 when it's not |
16969 |
++ * @resume_wq: wait queue to sleep if rawnand is in suspended state. |
16970 |
+ * @cur_cs: Currently selected target. -1 means no target selected, otherwise we |
16971 |
+ * should always have cur_cs >= 0 && cur_cs < nanddev_ntargets(). |
16972 |
+ * NAND Controller drivers should not modify this value, but they're |
16973 |
+@@ -1135,6 +1136,7 @@ struct nand_chip { |
16974 |
+ /* Internals */ |
16975 |
+ struct mutex lock; |
16976 |
+ unsigned int suspended : 1; |
16977 |
++ wait_queue_head_t resume_wq; |
16978 |
+ int cur_cs; |
16979 |
+ int read_retries; |
16980 |
+ |
16981 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
16982 |
+index 861f2480c4571..ed2d531400051 100644 |
16983 |
+--- a/include/linux/netdevice.h |
16984 |
++++ b/include/linux/netdevice.h |
16985 |
+@@ -3980,7 +3980,8 @@ void netdev_run_todo(void); |
16986 |
+ */ |
16987 |
+ static inline void dev_put(struct net_device *dev) |
16988 |
+ { |
16989 |
+- this_cpu_dec(*dev->pcpu_refcnt); |
16990 |
++ if (dev) |
16991 |
++ this_cpu_dec(*dev->pcpu_refcnt); |
16992 |
+ } |
16993 |
+ |
16994 |
+ /** |
16995 |
+@@ -3991,7 +3992,8 @@ static inline void dev_put(struct net_device *dev) |
16996 |
+ */ |
16997 |
+ static inline void dev_hold(struct net_device *dev) |
16998 |
+ { |
16999 |
+- this_cpu_inc(*dev->pcpu_refcnt); |
17000 |
++ if (dev) |
17001 |
++ this_cpu_inc(*dev->pcpu_refcnt); |
17002 |
+ } |
17003 |
+ |
17004 |
+ /* Carrier loss detection, dial on demand. The functions netif_carrier_on |
17005 |
+diff --git a/include/linux/pci.h b/include/linux/pci.h |
17006 |
+index 4519bd12643f6..bc5a1150f0723 100644 |
17007 |
+--- a/include/linux/pci.h |
17008 |
++++ b/include/linux/pci.h |
17009 |
+@@ -638,6 +638,7 @@ struct pci_bus { |
17010 |
+ struct bin_attribute *legacy_io; /* Legacy I/O for this bus */ |
17011 |
+ struct bin_attribute *legacy_mem; /* Legacy mem */ |
17012 |
+ unsigned int is_added:1; |
17013 |
++ unsigned int unsafe_warn:1; /* warned about RW1C config write */ |
17014 |
+ }; |
17015 |
+ |
17016 |
+ #define to_pci_bus(n) container_of(n, struct pci_bus, dev) |
17017 |
+diff --git a/include/linux/pstore.h b/include/linux/pstore.h |
17018 |
+index eb93a54cff31f..e97a8188f0fd8 100644 |
17019 |
+--- a/include/linux/pstore.h |
17020 |
++++ b/include/linux/pstore.h |
17021 |
+@@ -14,7 +14,7 @@ |
17022 |
+ #include <linux/errno.h> |
17023 |
+ #include <linux/kmsg_dump.h> |
17024 |
+ #include <linux/mutex.h> |
17025 |
+-#include <linux/semaphore.h> |
17026 |
++#include <linux/spinlock.h> |
17027 |
+ #include <linux/time.h> |
17028 |
+ #include <linux/types.h> |
17029 |
+ |
17030 |
+@@ -87,7 +87,7 @@ struct pstore_record { |
17031 |
+ * @owner: module which is responsible for this backend driver |
17032 |
+ * @name: name of the backend driver |
17033 |
+ * |
17034 |
+- * @buf_lock: semaphore to serialize access to @buf |
17035 |
++ * @buf_lock: spinlock to serialize access to @buf |
17036 |
+ * @buf: preallocated crash dump buffer |
17037 |
+ * @bufsize: size of @buf available for crash dump bytes (must match |
17038 |
+ * smallest number of bytes available for writing to a |
17039 |
+@@ -178,7 +178,7 @@ struct pstore_info { |
17040 |
+ struct module *owner; |
17041 |
+ const char *name; |
17042 |
+ |
17043 |
+- struct semaphore buf_lock; |
17044 |
++ spinlock_t buf_lock; |
17045 |
+ char *buf; |
17046 |
+ size_t bufsize; |
17047 |
+ |
17048 |
+diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h |
17049 |
+index ff63c2963359d..35b26743dbb28 100644 |
17050 |
+--- a/include/linux/serial_core.h |
17051 |
++++ b/include/linux/serial_core.h |
17052 |
+@@ -463,6 +463,8 @@ extern void uart_handle_cts_change(struct uart_port *uport, |
17053 |
+ extern void uart_insert_char(struct uart_port *port, unsigned int status, |
17054 |
+ unsigned int overrun, unsigned int ch, unsigned int flag); |
17055 |
+ |
17056 |
++void uart_xchar_out(struct uart_port *uport, int offset); |
17057 |
++ |
17058 |
+ #ifdef CONFIG_MAGIC_SYSRQ_SERIAL |
17059 |
+ #define SYSRQ_TIMEOUT (HZ * 5) |
17060 |
+ |
17061 |
+diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h |
17062 |
+index cf27b080e1482..b1af87330f863 100644 |
17063 |
+--- a/include/linux/soc/ti/ti_sci_protocol.h |
17064 |
++++ b/include/linux/soc/ti/ti_sci_protocol.h |
17065 |
+@@ -618,7 +618,7 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle, |
17066 |
+ |
17067 |
+ static inline struct ti_sci_resource * |
17068 |
+ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev, |
17069 |
+- u32 dev_id, u32 sub_type); |
17070 |
++ u32 dev_id, u32 sub_type) |
17071 |
+ { |
17072 |
+ return ERR_PTR(-EINVAL); |
17073 |
+ } |
17074 |
+diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h |
17075 |
+index b998e4b736912..6d9d1520612b8 100644 |
17076 |
+--- a/include/linux/sunrpc/xdr.h |
17077 |
++++ b/include/linux/sunrpc/xdr.h |
17078 |
+@@ -603,6 +603,8 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr, |
17079 |
+ |
17080 |
+ if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0)) |
17081 |
+ return -EBADMSG; |
17082 |
++ if (len > SIZE_MAX / sizeof(*p)) |
17083 |
++ return -EBADMSG; |
17084 |
+ p = xdr_inline_decode(xdr, len * sizeof(*p)); |
17085 |
+ if (unlikely(!p)) |
17086 |
+ return -EBADMSG; |
17087 |
+diff --git a/include/net/udp.h b/include/net/udp.h |
17088 |
+index 435cc009e6eaa..4017f257628f3 100644 |
17089 |
+--- a/include/net/udp.h |
17090 |
++++ b/include/net/udp.h |
17091 |
+@@ -467,6 +467,7 @@ void udp_init(void); |
17092 |
+ |
17093 |
+ DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); |
17094 |
+ void udp_encap_enable(void); |
17095 |
++void udp_encap_disable(void); |
17096 |
+ #if IS_ENABLED(CONFIG_IPV6) |
17097 |
+ DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); |
17098 |
+ void udpv6_encap_enable(void); |
17099 |
+diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h |
17100 |
+index 2ea453dac8762..24ece06bad9ef 100644 |
17101 |
+--- a/include/net/udp_tunnel.h |
17102 |
++++ b/include/net/udp_tunnel.h |
17103 |
+@@ -177,9 +177,8 @@ static inline void udp_tunnel_encap_enable(struct socket *sock) |
17104 |
+ #if IS_ENABLED(CONFIG_IPV6) |
17105 |
+ if (sock->sk->sk_family == PF_INET6) |
17106 |
+ ipv6_stub->udpv6_encap_enable(); |
17107 |
+- else |
17108 |
+ #endif |
17109 |
+- udp_encap_enable(); |
17110 |
++ udp_encap_enable(); |
17111 |
+ } |
17112 |
+ |
17113 |
+ #define UDP_TUNNEL_NIC_MAX_TABLES 4 |
17114 |
+diff --git a/include/sound/pcm.h b/include/sound/pcm.h |
17115 |
+index ab966563e852e..5ffc2efedd9f8 100644 |
17116 |
+--- a/include/sound/pcm.h |
17117 |
++++ b/include/sound/pcm.h |
17118 |
+@@ -399,6 +399,7 @@ struct snd_pcm_runtime { |
17119 |
+ struct fasync_struct *fasync; |
17120 |
+ bool stop_operating; /* sync_stop will be called */ |
17121 |
+ struct mutex buffer_mutex; /* protect for buffer changes */ |
17122 |
++ atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */ |
17123 |
+ |
17124 |
+ /* -- private section -- */ |
17125 |
+ void *private_data; |
17126 |
+diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h |
17127 |
+index 70ae5497b73a6..4973265655a7f 100644 |
17128 |
+--- a/include/trace/events/ext4.h |
17129 |
++++ b/include/trace/events/ext4.h |
17130 |
+@@ -95,6 +95,17 @@ TRACE_DEFINE_ENUM(ES_REFERENCED_B); |
17131 |
+ { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"}, \ |
17132 |
+ { FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"}) |
17133 |
+ |
17134 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_XATTR); |
17135 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_CROSS_RENAME); |
17136 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE); |
17137 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_NOMEM); |
17138 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_SWAP_BOOT); |
17139 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_RESIZE); |
17140 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_RENAME_DIR); |
17141 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_FALLOC_RANGE); |
17142 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_INODE_JOURNAL_DATA); |
17143 |
++TRACE_DEFINE_ENUM(EXT4_FC_REASON_MAX); |
17144 |
++ |
17145 |
+ #define show_fc_reason(reason) \ |
17146 |
+ __print_symbolic(reason, \ |
17147 |
+ { EXT4_FC_REASON_XATTR, "XATTR"}, \ |
17148 |
+@@ -2899,41 +2910,50 @@ TRACE_EVENT(ext4_fc_commit_stop, |
17149 |
+ |
17150 |
+ #define FC_REASON_NAME_STAT(reason) \ |
17151 |
+ show_fc_reason(reason), \ |
17152 |
+- __entry->sbi->s_fc_stats.fc_ineligible_reason_count[reason] |
17153 |
++ __entry->fc_ineligible_rc[reason] |
17154 |
+ |
17155 |
+ TRACE_EVENT(ext4_fc_stats, |
17156 |
+- TP_PROTO(struct super_block *sb), |
17157 |
+- |
17158 |
+- TP_ARGS(sb), |
17159 |
++ TP_PROTO(struct super_block *sb), |
17160 |
+ |
17161 |
+- TP_STRUCT__entry( |
17162 |
+- __field(dev_t, dev) |
17163 |
+- __field(struct ext4_sb_info *, sbi) |
17164 |
+- __field(int, count) |
17165 |
+- ), |
17166 |
++ TP_ARGS(sb), |
17167 |
+ |
17168 |
+- TP_fast_assign( |
17169 |
+- __entry->dev = sb->s_dev; |
17170 |
+- __entry->sbi = EXT4_SB(sb); |
17171 |
+- ), |
17172 |
++ TP_STRUCT__entry( |
17173 |
++ __field(dev_t, dev) |
17174 |
++ __array(unsigned int, fc_ineligible_rc, EXT4_FC_REASON_MAX) |
17175 |
++ __field(unsigned long, fc_commits) |
17176 |
++ __field(unsigned long, fc_ineligible_commits) |
17177 |
++ __field(unsigned long, fc_numblks) |
17178 |
++ ), |
17179 |
+ |
17180 |
+- TP_printk("dev %d:%d fc ineligible reasons:\n" |
17181 |
+- "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d; " |
17182 |
+- "num_commits:%ld, ineligible: %ld, numblks: %ld", |
17183 |
+- MAJOR(__entry->dev), MINOR(__entry->dev), |
17184 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR), |
17185 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME), |
17186 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE), |
17187 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM), |
17188 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT), |
17189 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE), |
17190 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR), |
17191 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE), |
17192 |
+- FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA), |
17193 |
+- __entry->sbi->s_fc_stats.fc_num_commits, |
17194 |
+- __entry->sbi->s_fc_stats.fc_ineligible_commits, |
17195 |
+- __entry->sbi->s_fc_stats.fc_numblks) |
17196 |
++ TP_fast_assign( |
17197 |
++ int i; |
17198 |
+ |
17199 |
++ __entry->dev = sb->s_dev; |
17200 |
++ for (i = 0; i < EXT4_FC_REASON_MAX; i++) { |
17201 |
++ __entry->fc_ineligible_rc[i] = |
17202 |
++ EXT4_SB(sb)->s_fc_stats.fc_ineligible_reason_count[i]; |
17203 |
++ } |
17204 |
++ __entry->fc_commits = EXT4_SB(sb)->s_fc_stats.fc_num_commits; |
17205 |
++ __entry->fc_ineligible_commits = |
17206 |
++ EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits; |
17207 |
++ __entry->fc_numblks = EXT4_SB(sb)->s_fc_stats.fc_numblks; |
17208 |
++ ), |
17209 |
++ |
17210 |
++ TP_printk("dev %d,%d fc ineligible reasons:\n" |
17211 |
++ "%s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u " |
17212 |
++ "num_commits:%lu, ineligible: %lu, numblks: %lu", |
17213 |
++ MAJOR(__entry->dev), MINOR(__entry->dev), |
17214 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR), |
17215 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME), |
17216 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE), |
17217 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM), |
17218 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT), |
17219 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE), |
17220 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR), |
17221 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE), |
17222 |
++ FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA), |
17223 |
++ __entry->fc_commits, __entry->fc_ineligible_commits, |
17224 |
++ __entry->fc_numblks) |
17225 |
+ ); |
17226 |
+ |
17227 |
+ #define DEFINE_TRACE_DENTRY_EVENT(__type) \ |
17228 |
+diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h |
17229 |
+index e70c90116edae..4a3ab0ed6e062 100644 |
17230 |
+--- a/include/trace/events/rxrpc.h |
17231 |
++++ b/include/trace/events/rxrpc.h |
17232 |
+@@ -83,12 +83,15 @@ enum rxrpc_call_trace { |
17233 |
+ rxrpc_call_error, |
17234 |
+ rxrpc_call_got, |
17235 |
+ rxrpc_call_got_kernel, |
17236 |
++ rxrpc_call_got_timer, |
17237 |
+ rxrpc_call_got_userid, |
17238 |
+ rxrpc_call_new_client, |
17239 |
+ rxrpc_call_new_service, |
17240 |
+ rxrpc_call_put, |
17241 |
+ rxrpc_call_put_kernel, |
17242 |
+ rxrpc_call_put_noqueue, |
17243 |
++ rxrpc_call_put_notimer, |
17244 |
++ rxrpc_call_put_timer, |
17245 |
+ rxrpc_call_put_userid, |
17246 |
+ rxrpc_call_queued, |
17247 |
+ rxrpc_call_queued_ref, |
17248 |
+@@ -278,12 +281,15 @@ enum rxrpc_tx_point { |
17249 |
+ EM(rxrpc_call_error, "*E*") \ |
17250 |
+ EM(rxrpc_call_got, "GOT") \ |
17251 |
+ EM(rxrpc_call_got_kernel, "Gke") \ |
17252 |
++ EM(rxrpc_call_got_timer, "GTM") \ |
17253 |
+ EM(rxrpc_call_got_userid, "Gus") \ |
17254 |
+ EM(rxrpc_call_new_client, "NWc") \ |
17255 |
+ EM(rxrpc_call_new_service, "NWs") \ |
17256 |
+ EM(rxrpc_call_put, "PUT") \ |
17257 |
+ EM(rxrpc_call_put_kernel, "Pke") \ |
17258 |
+- EM(rxrpc_call_put_noqueue, "PNQ") \ |
17259 |
++ EM(rxrpc_call_put_noqueue, "PnQ") \ |
17260 |
++ EM(rxrpc_call_put_notimer, "PnT") \ |
17261 |
++ EM(rxrpc_call_put_timer, "PTM") \ |
17262 |
+ EM(rxrpc_call_put_userid, "Pus") \ |
17263 |
+ EM(rxrpc_call_queued, "QUE") \ |
17264 |
+ EM(rxrpc_call_queued_ref, "QUR") \ |
17265 |
+diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h |
17266 |
+index 762bf87c26a3e..b43a86d054948 100644 |
17267 |
+--- a/include/uapi/linux/bpf.h |
17268 |
++++ b/include/uapi/linux/bpf.h |
17269 |
+@@ -1490,8 +1490,8 @@ union bpf_attr { |
17270 |
+ * Return |
17271 |
+ * The return value depends on the result of the test, and can be: |
17272 |
+ * |
17273 |
+- * * 0, if current task belongs to the cgroup2. |
17274 |
+- * * 1, if current task does not belong to the cgroup2. |
17275 |
++ * * 1, if current task belongs to the cgroup2. |
17276 |
++ * * 0, if current task does not belong to the cgroup2. |
17277 |
+ * * A negative error code, if an error occurred. |
17278 |
+ * |
17279 |
+ * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) |
17280 |
+@@ -2163,8 +2163,8 @@ union bpf_attr { |
17281 |
+ * |
17282 |
+ * # sysctl kernel.perf_event_max_stack=<new value> |
17283 |
+ * Return |
17284 |
+- * A non-negative value equal to or less than *size* on success, |
17285 |
+- * or a negative error in case of failure. |
17286 |
++ * The non-negative copied *buf* length equal to or less than |
17287 |
++ * *size* on success, or a negative error in case of failure. |
17288 |
+ * |
17289 |
+ * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header) |
17290 |
+ * Description |
17291 |
+@@ -3448,8 +3448,8 @@ union bpf_attr { |
17292 |
+ * |
17293 |
+ * # sysctl kernel.perf_event_max_stack=<new value> |
17294 |
+ * Return |
17295 |
+- * A non-negative value equal to or less than *size* on success, |
17296 |
+- * or a negative error in case of failure. |
17297 |
++ * The non-negative copied *buf* length equal to or less than |
17298 |
++ * *size* on success, or a negative error in case of failure. |
17299 |
+ * |
17300 |
+ * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags) |
17301 |
+ * Description |
17302 |
+diff --git a/include/uapi/linux/rseq.h b/include/uapi/linux/rseq.h |
17303 |
+index 9a402fdb60e97..77ee207623a9b 100644 |
17304 |
+--- a/include/uapi/linux/rseq.h |
17305 |
++++ b/include/uapi/linux/rseq.h |
17306 |
+@@ -105,23 +105,11 @@ struct rseq { |
17307 |
+ * Read and set by the kernel. Set by user-space with single-copy |
17308 |
+ * atomicity semantics. This field should only be updated by the |
17309 |
+ * thread which registered this data structure. Aligned on 64-bit. |
17310 |
++ * |
17311 |
++ * 32-bit architectures should update the low order bits of the |
17312 |
++ * rseq_cs field, leaving the high order bits initialized to 0. |
17313 |
+ */ |
17314 |
+- union { |
17315 |
+- __u64 ptr64; |
17316 |
+-#ifdef __LP64__ |
17317 |
+- __u64 ptr; |
17318 |
+-#else |
17319 |
+- struct { |
17320 |
+-#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(__BIG_ENDIAN) |
17321 |
+- __u32 padding; /* Initialized to zero. */ |
17322 |
+- __u32 ptr32; |
17323 |
+-#else /* LITTLE */ |
17324 |
+- __u32 ptr32; |
17325 |
+- __u32 padding; /* Initialized to zero. */ |
17326 |
+-#endif /* ENDIAN */ |
17327 |
+- } ptr; |
17328 |
+-#endif |
17329 |
+- } rseq_cs; |
17330 |
++ __u64 rseq_cs; |
17331 |
+ |
17332 |
+ /* |
17333 |
+ * Restartable sequences flags field. |
17334 |
+diff --git a/kernel/audit.h b/kernel/audit.h |
17335 |
+index 3b9c0945225a1..1918019e6aaf7 100644 |
17336 |
+--- a/kernel/audit.h |
17337 |
++++ b/kernel/audit.h |
17338 |
+@@ -191,6 +191,10 @@ struct audit_context { |
17339 |
+ struct { |
17340 |
+ char *name; |
17341 |
+ } module; |
17342 |
++ struct { |
17343 |
++ struct audit_ntp_data ntp_data; |
17344 |
++ struct timespec64 tk_injoffset; |
17345 |
++ } time; |
17346 |
+ }; |
17347 |
+ int fds[2]; |
17348 |
+ struct audit_proctitle proctitle; |
17349 |
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
17350 |
+index 638f424859edc..07e2788bbbf12 100644 |
17351 |
+--- a/kernel/auditsc.c |
17352 |
++++ b/kernel/auditsc.c |
17353 |
+@@ -1214,6 +1214,53 @@ static void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name) |
17354 |
+ from_kuid(&init_user_ns, name->fcap.rootid)); |
17355 |
+ } |
17356 |
+ |
17357 |
++static void audit_log_time(struct audit_context *context, struct audit_buffer **ab) |
17358 |
++{ |
17359 |
++ const struct audit_ntp_data *ntp = &context->time.ntp_data; |
17360 |
++ const struct timespec64 *tk = &context->time.tk_injoffset; |
17361 |
++ static const char * const ntp_name[] = { |
17362 |
++ "offset", |
17363 |
++ "freq", |
17364 |
++ "status", |
17365 |
++ "tai", |
17366 |
++ "tick", |
17367 |
++ "adjust", |
17368 |
++ }; |
17369 |
++ int type; |
17370 |
++ |
17371 |
++ if (context->type == AUDIT_TIME_ADJNTPVAL) { |
17372 |
++ for (type = 0; type < AUDIT_NTP_NVALS; type++) { |
17373 |
++ if (ntp->vals[type].newval != ntp->vals[type].oldval) { |
17374 |
++ if (!*ab) { |
17375 |
++ *ab = audit_log_start(context, |
17376 |
++ GFP_KERNEL, |
17377 |
++ AUDIT_TIME_ADJNTPVAL); |
17378 |
++ if (!*ab) |
17379 |
++ return; |
17380 |
++ } |
17381 |
++ audit_log_format(*ab, "op=%s old=%lli new=%lli", |
17382 |
++ ntp_name[type], |
17383 |
++ ntp->vals[type].oldval, |
17384 |
++ ntp->vals[type].newval); |
17385 |
++ audit_log_end(*ab); |
17386 |
++ *ab = NULL; |
17387 |
++ } |
17388 |
++ } |
17389 |
++ } |
17390 |
++ if (tk->tv_sec != 0 || tk->tv_nsec != 0) { |
17391 |
++ if (!*ab) { |
17392 |
++ *ab = audit_log_start(context, GFP_KERNEL, |
17393 |
++ AUDIT_TIME_INJOFFSET); |
17394 |
++ if (!*ab) |
17395 |
++ return; |
17396 |
++ } |
17397 |
++ audit_log_format(*ab, "sec=%lli nsec=%li", |
17398 |
++ (long long)tk->tv_sec, tk->tv_nsec); |
17399 |
++ audit_log_end(*ab); |
17400 |
++ *ab = NULL; |
17401 |
++ } |
17402 |
++} |
17403 |
++ |
17404 |
+ static void show_special(struct audit_context *context, int *call_panic) |
17405 |
+ { |
17406 |
+ struct audit_buffer *ab; |
17407 |
+@@ -1319,6 +1366,11 @@ static void show_special(struct audit_context *context, int *call_panic) |
17408 |
+ audit_log_format(ab, "(null)"); |
17409 |
+ |
17410 |
+ break; |
17411 |
++ case AUDIT_TIME_ADJNTPVAL: |
17412 |
++ case AUDIT_TIME_INJOFFSET: |
17413 |
++ /* this call deviates from the rest, eating the buffer */ |
17414 |
++ audit_log_time(context, &ab); |
17415 |
++ break; |
17416 |
+ } |
17417 |
+ audit_log_end(ab); |
17418 |
+ } |
17419 |
+@@ -2560,31 +2612,26 @@ void __audit_fanotify(unsigned int response) |
17420 |
+ |
17421 |
+ void __audit_tk_injoffset(struct timespec64 offset) |
17422 |
+ { |
17423 |
+- audit_log(audit_context(), GFP_KERNEL, AUDIT_TIME_INJOFFSET, |
17424 |
+- "sec=%lli nsec=%li", |
17425 |
+- (long long)offset.tv_sec, offset.tv_nsec); |
17426 |
+-} |
17427 |
+- |
17428 |
+-static void audit_log_ntp_val(const struct audit_ntp_data *ad, |
17429 |
+- const char *op, enum audit_ntp_type type) |
17430 |
+-{ |
17431 |
+- const struct audit_ntp_val *val = &ad->vals[type]; |
17432 |
+- |
17433 |
+- if (val->newval == val->oldval) |
17434 |
+- return; |
17435 |
++ struct audit_context *context = audit_context(); |
17436 |
+ |
17437 |
+- audit_log(audit_context(), GFP_KERNEL, AUDIT_TIME_ADJNTPVAL, |
17438 |
+- "op=%s old=%lli new=%lli", op, val->oldval, val->newval); |
17439 |
++ /* only set type if not already set by NTP */ |
17440 |
++ if (!context->type) |
17441 |
++ context->type = AUDIT_TIME_INJOFFSET; |
17442 |
++ memcpy(&context->time.tk_injoffset, &offset, sizeof(offset)); |
17443 |
+ } |
17444 |
+ |
17445 |
+ void __audit_ntp_log(const struct audit_ntp_data *ad) |
17446 |
+ { |
17447 |
+- audit_log_ntp_val(ad, "offset", AUDIT_NTP_OFFSET); |
17448 |
+- audit_log_ntp_val(ad, "freq", AUDIT_NTP_FREQ); |
17449 |
+- audit_log_ntp_val(ad, "status", AUDIT_NTP_STATUS); |
17450 |
+- audit_log_ntp_val(ad, "tai", AUDIT_NTP_TAI); |
17451 |
+- audit_log_ntp_val(ad, "tick", AUDIT_NTP_TICK); |
17452 |
+- audit_log_ntp_val(ad, "adjust", AUDIT_NTP_ADJUST); |
17453 |
++ struct audit_context *context = audit_context(); |
17454 |
++ int type; |
17455 |
++ |
17456 |
++ for (type = 0; type < AUDIT_NTP_NVALS; type++) |
17457 |
++ if (ad->vals[type].newval != ad->vals[type].oldval) { |
17458 |
++ /* unconditionally set type, overwriting TK */ |
17459 |
++ context->type = AUDIT_TIME_ADJNTPVAL; |
17460 |
++ memcpy(&context->time.ntp_data, ad, sizeof(*ad)); |
17461 |
++ break; |
17462 |
++ } |
17463 |
+ } |
17464 |
+ |
17465 |
+ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries, |
17466 |
+diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c |
17467 |
+index 56cd7e6589ff3..4575d2d60cb10 100644 |
17468 |
+--- a/kernel/bpf/stackmap.c |
17469 |
++++ b/kernel/bpf/stackmap.c |
17470 |
+@@ -358,7 +358,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, |
17471 |
+ } |
17472 |
+ |
17473 |
+ static struct perf_callchain_entry * |
17474 |
+-get_callchain_entry_for_task(struct task_struct *task, u32 init_nr) |
17475 |
++get_callchain_entry_for_task(struct task_struct *task, u32 max_depth) |
17476 |
+ { |
17477 |
+ #ifdef CONFIG_STACKTRACE |
17478 |
+ struct perf_callchain_entry *entry; |
17479 |
+@@ -369,9 +369,8 @@ get_callchain_entry_for_task(struct task_struct *task, u32 init_nr) |
17480 |
+ if (!entry) |
17481 |
+ return NULL; |
17482 |
+ |
17483 |
+- entry->nr = init_nr + |
17484 |
+- stack_trace_save_tsk(task, (unsigned long *)(entry->ip + init_nr), |
17485 |
+- sysctl_perf_event_max_stack - init_nr, 0); |
17486 |
++ entry->nr = stack_trace_save_tsk(task, (unsigned long *)entry->ip, |
17487 |
++ max_depth, 0); |
17488 |
+ |
17489 |
+ /* stack_trace_save_tsk() works on unsigned long array, while |
17490 |
+ * perf_callchain_entry uses u64 array. For 32-bit systems, it is |
17491 |
+@@ -383,7 +382,7 @@ get_callchain_entry_for_task(struct task_struct *task, u32 init_nr) |
17492 |
+ int i; |
17493 |
+ |
17494 |
+ /* copy data from the end to avoid using extra buffer */ |
17495 |
+- for (i = entry->nr - 1; i >= (int)init_nr; i--) |
17496 |
++ for (i = entry->nr - 1; i >= 0; i--) |
17497 |
+ to[i] = (u64)(from[i]); |
17498 |
+ } |
17499 |
+ |
17500 |
+@@ -400,27 +399,19 @@ static long __bpf_get_stackid(struct bpf_map *map, |
17501 |
+ { |
17502 |
+ struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map); |
17503 |
+ struct stack_map_bucket *bucket, *new_bucket, *old_bucket; |
17504 |
+- u32 max_depth = map->value_size / stack_map_data_size(map); |
17505 |
+- /* stack_map_alloc() checks that max_depth <= sysctl_perf_event_max_stack */ |
17506 |
+- u32 init_nr = sysctl_perf_event_max_stack - max_depth; |
17507 |
+ u32 skip = flags & BPF_F_SKIP_FIELD_MASK; |
17508 |
+ u32 hash, id, trace_nr, trace_len; |
17509 |
+ bool user = flags & BPF_F_USER_STACK; |
17510 |
+ u64 *ips; |
17511 |
+ bool hash_matches; |
17512 |
+ |
17513 |
+- /* get_perf_callchain() guarantees that trace->nr >= init_nr |
17514 |
+- * and trace-nr <= sysctl_perf_event_max_stack, so trace_nr <= max_depth |
17515 |
+- */ |
17516 |
+- trace_nr = trace->nr - init_nr; |
17517 |
+- |
17518 |
+- if (trace_nr <= skip) |
17519 |
++ if (trace->nr <= skip) |
17520 |
+ /* skipping more than usable stack trace */ |
17521 |
+ return -EFAULT; |
17522 |
+ |
17523 |
+- trace_nr -= skip; |
17524 |
++ trace_nr = trace->nr - skip; |
17525 |
+ trace_len = trace_nr * sizeof(u64); |
17526 |
+- ips = trace->ip + skip + init_nr; |
17527 |
++ ips = trace->ip + skip; |
17528 |
+ hash = jhash2((u32 *)ips, trace_len / sizeof(u32), 0); |
17529 |
+ id = hash & (smap->n_buckets - 1); |
17530 |
+ bucket = READ_ONCE(smap->buckets[id]); |
17531 |
+@@ -477,8 +468,7 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map, |
17532 |
+ u64, flags) |
17533 |
+ { |
17534 |
+ u32 max_depth = map->value_size / stack_map_data_size(map); |
17535 |
+- /* stack_map_alloc() checks that max_depth <= sysctl_perf_event_max_stack */ |
17536 |
+- u32 init_nr = sysctl_perf_event_max_stack - max_depth; |
17537 |
++ u32 skip = flags & BPF_F_SKIP_FIELD_MASK; |
17538 |
+ bool user = flags & BPF_F_USER_STACK; |
17539 |
+ struct perf_callchain_entry *trace; |
17540 |
+ bool kernel = !user; |
17541 |
+@@ -487,8 +477,12 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map, |
17542 |
+ BPF_F_FAST_STACK_CMP | BPF_F_REUSE_STACKID))) |
17543 |
+ return -EINVAL; |
17544 |
+ |
17545 |
+- trace = get_perf_callchain(regs, init_nr, kernel, user, |
17546 |
+- sysctl_perf_event_max_stack, false, false); |
17547 |
++ max_depth += skip; |
17548 |
++ if (max_depth > sysctl_perf_event_max_stack) |
17549 |
++ max_depth = sysctl_perf_event_max_stack; |
17550 |
++ |
17551 |
++ trace = get_perf_callchain(regs, 0, kernel, user, max_depth, |
17552 |
++ false, false); |
17553 |
+ |
17554 |
+ if (unlikely(!trace)) |
17555 |
+ /* couldn't fetch the stack trace */ |
17556 |
+@@ -579,7 +573,7 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task, |
17557 |
+ struct perf_callchain_entry *trace_in, |
17558 |
+ void *buf, u32 size, u64 flags) |
17559 |
+ { |
17560 |
+- u32 init_nr, trace_nr, copy_len, elem_size, num_elem; |
17561 |
++ u32 trace_nr, copy_len, elem_size, num_elem, max_depth; |
17562 |
+ bool user_build_id = flags & BPF_F_USER_BUILD_ID; |
17563 |
+ u32 skip = flags & BPF_F_SKIP_FIELD_MASK; |
17564 |
+ bool user = flags & BPF_F_USER_STACK; |
17565 |
+@@ -604,30 +598,28 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task, |
17566 |
+ goto err_fault; |
17567 |
+ |
17568 |
+ num_elem = size / elem_size; |
17569 |
+- if (sysctl_perf_event_max_stack < num_elem) |
17570 |
+- init_nr = 0; |
17571 |
+- else |
17572 |
+- init_nr = sysctl_perf_event_max_stack - num_elem; |
17573 |
++ max_depth = num_elem + skip; |
17574 |
++ if (sysctl_perf_event_max_stack < max_depth) |
17575 |
++ max_depth = sysctl_perf_event_max_stack; |
17576 |
+ |
17577 |
+ if (trace_in) |
17578 |
+ trace = trace_in; |
17579 |
+ else if (kernel && task) |
17580 |
+- trace = get_callchain_entry_for_task(task, init_nr); |
17581 |
++ trace = get_callchain_entry_for_task(task, max_depth); |
17582 |
+ else |
17583 |
+- trace = get_perf_callchain(regs, init_nr, kernel, user, |
17584 |
+- sysctl_perf_event_max_stack, |
17585 |
++ trace = get_perf_callchain(regs, 0, kernel, user, max_depth, |
17586 |
+ false, false); |
17587 |
+ if (unlikely(!trace)) |
17588 |
+ goto err_fault; |
17589 |
+ |
17590 |
+- trace_nr = trace->nr - init_nr; |
17591 |
+- if (trace_nr < skip) |
17592 |
++ if (trace->nr < skip) |
17593 |
+ goto err_fault; |
17594 |
+ |
17595 |
+- trace_nr -= skip; |
17596 |
++ trace_nr = trace->nr - skip; |
17597 |
+ trace_nr = (trace_nr <= num_elem) ? trace_nr : num_elem; |
17598 |
+ copy_len = trace_nr * elem_size; |
17599 |
+- ips = trace->ip + skip + init_nr; |
17600 |
++ |
17601 |
++ ips = trace->ip + skip; |
17602 |
+ if (user && user_build_id) |
17603 |
+ stack_map_get_build_id_offset(buf, ips, trace_nr, user); |
17604 |
+ else |
17605 |
+diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c |
17606 |
+index 6226502ce0499..13417f0045f02 100644 |
17607 |
+--- a/kernel/debug/kdb/kdb_support.c |
17608 |
++++ b/kernel/debug/kdb/kdb_support.c |
17609 |
+@@ -350,7 +350,7 @@ int kdb_getarea_size(void *res, unsigned long addr, size_t size) |
17610 |
+ */ |
17611 |
+ int kdb_putarea_size(unsigned long addr, void *res, size_t size) |
17612 |
+ { |
17613 |
+- int ret = copy_from_kernel_nofault((char *)addr, (char *)res, size); |
17614 |
++ int ret = copy_to_kernel_nofault((char *)addr, (char *)res, size); |
17615 |
+ if (ret) { |
17616 |
+ if (!KDB_STATE(SUPPRESS)) { |
17617 |
+ kdb_printf("kdb_putarea: Bad address 0x%lx\n", addr); |
17618 |
+diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c |
17619 |
+index 10d07ace46c15..f8ae546798651 100644 |
17620 |
+--- a/kernel/dma/debug.c |
17621 |
++++ b/kernel/dma/debug.c |
17622 |
+@@ -928,7 +928,7 @@ static __init int dma_debug_cmdline(char *str) |
17623 |
+ global_disable = true; |
17624 |
+ } |
17625 |
+ |
17626 |
+- return 0; |
17627 |
++ return 1; |
17628 |
+ } |
17629 |
+ |
17630 |
+ static __init int dma_debug_entries_cmdline(char *str) |
17631 |
+@@ -937,7 +937,7 @@ static __init int dma_debug_entries_cmdline(char *str) |
17632 |
+ return -EINVAL; |
17633 |
+ if (!get_option(&str, &nr_prealloc_entries)) |
17634 |
+ nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES; |
17635 |
+- return 0; |
17636 |
++ return 1; |
17637 |
+ } |
17638 |
+ |
17639 |
+ __setup("dma_debug=", dma_debug_cmdline); |
17640 |
+diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c |
17641 |
+index 0ed0e1f215c75..62b1e5fa86736 100644 |
17642 |
+--- a/kernel/dma/swiotlb.c |
17643 |
++++ b/kernel/dma/swiotlb.c |
17644 |
+@@ -598,7 +598,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr, |
17645 |
+ |
17646 |
+ tlb_addr = slot_addr(io_tlb_start, index) + offset; |
17647 |
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && |
17648 |
+- (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)) |
17649 |
++ (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || |
17650 |
++ dir == DMA_BIDIRECTIONAL)) |
17651 |
+ swiotlb_bounce(orig_addr, tlb_addr, mapping_size, DMA_TO_DEVICE); |
17652 |
+ return tlb_addr; |
17653 |
+ } |
17654 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
17655 |
+index c8b3f94f0dbb3..79d8b27cf2fc6 100644 |
17656 |
+--- a/kernel/events/core.c |
17657 |
++++ b/kernel/events/core.c |
17658 |
+@@ -10265,8 +10265,11 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, |
17659 |
+ } |
17660 |
+ |
17661 |
+ /* ready to consume more filters */ |
17662 |
++ kfree(filename); |
17663 |
++ filename = NULL; |
17664 |
+ state = IF_STATE_ACTION; |
17665 |
+ filter = NULL; |
17666 |
++ kernel = 0; |
17667 |
+ } |
17668 |
+ } |
17669 |
+ |
17670 |
+diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c |
17671 |
+index f76fdb9255323..e8bdce6fdd647 100644 |
17672 |
+--- a/kernel/livepatch/core.c |
17673 |
++++ b/kernel/livepatch/core.c |
17674 |
+@@ -191,7 +191,7 @@ static int klp_find_object_symbol(const char *objname, const char *name, |
17675 |
+ return -EINVAL; |
17676 |
+ } |
17677 |
+ |
17678 |
+-static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, |
17679 |
++static int klp_resolve_symbols(Elf_Shdr *sechdrs, const char *strtab, |
17680 |
+ unsigned int symndx, Elf_Shdr *relasec, |
17681 |
+ const char *sec_objname) |
17682 |
+ { |
17683 |
+@@ -219,7 +219,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, |
17684 |
+ relas = (Elf_Rela *) relasec->sh_addr; |
17685 |
+ /* For each rela in this klp relocation section */ |
17686 |
+ for (i = 0; i < relasec->sh_size / sizeof(Elf_Rela); i++) { |
17687 |
+- sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info); |
17688 |
++ sym = (Elf_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info); |
17689 |
+ if (sym->st_shndx != SHN_LIVEPATCH) { |
17690 |
+ pr_err("symbol %s is not marked as a livepatch symbol\n", |
17691 |
+ strtab + sym->st_name); |
17692 |
+diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c |
17693 |
+index af4b35450556f..b6683cefe19a4 100644 |
17694 |
+--- a/kernel/locking/lockdep.c |
17695 |
++++ b/kernel/locking/lockdep.c |
17696 |
+@@ -182,11 +182,9 @@ static DECLARE_BITMAP(list_entries_in_use, MAX_LOCKDEP_ENTRIES); |
17697 |
+ static struct hlist_head lock_keys_hash[KEYHASH_SIZE]; |
17698 |
+ unsigned long nr_lock_classes; |
17699 |
+ unsigned long nr_zapped_classes; |
17700 |
+-#ifndef CONFIG_DEBUG_LOCKDEP |
17701 |
+-static |
17702 |
+-#endif |
17703 |
++unsigned long max_lock_class_idx; |
17704 |
+ struct lock_class lock_classes[MAX_LOCKDEP_KEYS]; |
17705 |
+-static DECLARE_BITMAP(lock_classes_in_use, MAX_LOCKDEP_KEYS); |
17706 |
++DECLARE_BITMAP(lock_classes_in_use, MAX_LOCKDEP_KEYS); |
17707 |
+ |
17708 |
+ static inline struct lock_class *hlock_class(struct held_lock *hlock) |
17709 |
+ { |
17710 |
+@@ -337,7 +335,7 @@ static inline void lock_release_holdtime(struct held_lock *hlock) |
17711 |
+ * elements. These elements are linked together by the lock_entry member in |
17712 |
+ * struct lock_class. |
17713 |
+ */ |
17714 |
+-LIST_HEAD(all_lock_classes); |
17715 |
++static LIST_HEAD(all_lock_classes); |
17716 |
+ static LIST_HEAD(free_lock_classes); |
17717 |
+ |
17718 |
+ /** |
17719 |
+@@ -1239,6 +1237,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) |
17720 |
+ struct lockdep_subclass_key *key; |
17721 |
+ struct hlist_head *hash_head; |
17722 |
+ struct lock_class *class; |
17723 |
++ int idx; |
17724 |
+ |
17725 |
+ DEBUG_LOCKS_WARN_ON(!irqs_disabled()); |
17726 |
+ |
17727 |
+@@ -1304,6 +1303,9 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) |
17728 |
+ * of classes. |
17729 |
+ */ |
17730 |
+ list_move_tail(&class->lock_entry, &all_lock_classes); |
17731 |
++ idx = class - lock_classes; |
17732 |
++ if (idx > max_lock_class_idx) |
17733 |
++ max_lock_class_idx = idx; |
17734 |
+ |
17735 |
+ if (verbose(class)) { |
17736 |
+ graph_unlock(); |
17737 |
+@@ -5919,6 +5921,8 @@ static void zap_class(struct pending_free *pf, struct lock_class *class) |
17738 |
+ WRITE_ONCE(class->name, NULL); |
17739 |
+ nr_lock_classes--; |
17740 |
+ __clear_bit(class - lock_classes, lock_classes_in_use); |
17741 |
++ if (class - lock_classes == max_lock_class_idx) |
17742 |
++ max_lock_class_idx--; |
17743 |
+ } else { |
17744 |
+ WARN_ONCE(true, "%s() failed for class %s\n", __func__, |
17745 |
+ class->name); |
17746 |
+@@ -6209,7 +6213,13 @@ void lockdep_reset_lock(struct lockdep_map *lock) |
17747 |
+ lockdep_reset_lock_reg(lock); |
17748 |
+ } |
17749 |
+ |
17750 |
+-/* Unregister a dynamically allocated key. */ |
17751 |
++/* |
17752 |
++ * Unregister a dynamically allocated key. |
17753 |
++ * |
17754 |
++ * Unlike lockdep_register_key(), a search is always done to find a matching |
17755 |
++ * key irrespective of debug_locks to avoid potential invalid access to freed |
17756 |
++ * memory in lock_class entry. |
17757 |
++ */ |
17758 |
+ void lockdep_unregister_key(struct lock_class_key *key) |
17759 |
+ { |
17760 |
+ struct hlist_head *hash_head = keyhashentry(key); |
17761 |
+@@ -6224,10 +6234,8 @@ void lockdep_unregister_key(struct lock_class_key *key) |
17762 |
+ return; |
17763 |
+ |
17764 |
+ raw_local_irq_save(flags); |
17765 |
+- if (!graph_lock()) |
17766 |
+- goto out_irq; |
17767 |
++ lockdep_lock(); |
17768 |
+ |
17769 |
+- pf = get_pending_free(); |
17770 |
+ hlist_for_each_entry_rcu(k, hash_head, hash_entry) { |
17771 |
+ if (k == key) { |
17772 |
+ hlist_del_rcu(&k->hash_entry); |
17773 |
+@@ -6235,11 +6243,13 @@ void lockdep_unregister_key(struct lock_class_key *key) |
17774 |
+ break; |
17775 |
+ } |
17776 |
+ } |
17777 |
+- WARN_ON_ONCE(!found); |
17778 |
+- __lockdep_free_key_range(pf, key, 1); |
17779 |
+- call_rcu_zapped(pf); |
17780 |
+- graph_unlock(); |
17781 |
+-out_irq: |
17782 |
++ WARN_ON_ONCE(!found && debug_locks); |
17783 |
++ if (found) { |
17784 |
++ pf = get_pending_free(); |
17785 |
++ __lockdep_free_key_range(pf, key, 1); |
17786 |
++ call_rcu_zapped(pf); |
17787 |
++ } |
17788 |
++ lockdep_unlock(); |
17789 |
+ raw_local_irq_restore(flags); |
17790 |
+ |
17791 |
+ /* Wait until is_dynamic_key() has finished accessing k->hash_entry. */ |
17792 |
+diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h |
17793 |
+index de49f9e1c11ba..a19b016353478 100644 |
17794 |
+--- a/kernel/locking/lockdep_internals.h |
17795 |
++++ b/kernel/locking/lockdep_internals.h |
17796 |
+@@ -121,7 +121,6 @@ static const unsigned long LOCKF_USED_IN_IRQ_READ = |
17797 |
+ |
17798 |
+ #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5) |
17799 |
+ |
17800 |
+-extern struct list_head all_lock_classes; |
17801 |
+ extern struct lock_chain lock_chains[]; |
17802 |
+ |
17803 |
+ #define LOCK_USAGE_CHARS (2*XXX_LOCK_USAGE_STATES + 1) |
17804 |
+@@ -151,6 +150,10 @@ extern unsigned int nr_large_chain_blocks; |
17805 |
+ |
17806 |
+ extern unsigned int max_lockdep_depth; |
17807 |
+ extern unsigned int max_bfs_queue_depth; |
17808 |
++extern unsigned long max_lock_class_idx; |
17809 |
++ |
17810 |
++extern struct lock_class lock_classes[MAX_LOCKDEP_KEYS]; |
17811 |
++extern unsigned long lock_classes_in_use[]; |
17812 |
+ |
17813 |
+ #ifdef CONFIG_PROVE_LOCKING |
17814 |
+ extern unsigned long lockdep_count_forward_deps(struct lock_class *); |
17815 |
+@@ -205,7 +208,6 @@ struct lockdep_stats { |
17816 |
+ }; |
17817 |
+ |
17818 |
+ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats); |
17819 |
+-extern struct lock_class lock_classes[MAX_LOCKDEP_KEYS]; |
17820 |
+ |
17821 |
+ #define __debug_atomic_inc(ptr) \ |
17822 |
+ this_cpu_inc(lockdep_stats.ptr); |
17823 |
+diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c |
17824 |
+index 02ef87f50df29..ccb5292d1e194 100644 |
17825 |
+--- a/kernel/locking/lockdep_proc.c |
17826 |
++++ b/kernel/locking/lockdep_proc.c |
17827 |
+@@ -24,14 +24,33 @@ |
17828 |
+ |
17829 |
+ #include "lockdep_internals.h" |
17830 |
+ |
17831 |
++/* |
17832 |
++ * Since iteration of lock_classes is done without holding the lockdep lock, |
17833 |
++ * it is not safe to iterate all_lock_classes list directly as the iteration |
17834 |
++ * may branch off to free_lock_classes or the zapped list. Iteration is done |
17835 |
++ * directly on the lock_classes array by checking the lock_classes_in_use |
17836 |
++ * bitmap and max_lock_class_idx. |
17837 |
++ */ |
17838 |
++#define iterate_lock_classes(idx, class) \ |
17839 |
++ for (idx = 0, class = lock_classes; idx <= max_lock_class_idx; \ |
17840 |
++ idx++, class++) |
17841 |
++ |
17842 |
+ static void *l_next(struct seq_file *m, void *v, loff_t *pos) |
17843 |
+ { |
17844 |
+- return seq_list_next(v, &all_lock_classes, pos); |
17845 |
++ struct lock_class *class = v; |
17846 |
++ |
17847 |
++ ++class; |
17848 |
++ *pos = class - lock_classes; |
17849 |
++ return (*pos > max_lock_class_idx) ? NULL : class; |
17850 |
+ } |
17851 |
+ |
17852 |
+ static void *l_start(struct seq_file *m, loff_t *pos) |
17853 |
+ { |
17854 |
+- return seq_list_start_head(&all_lock_classes, *pos); |
17855 |
++ unsigned long idx = *pos; |
17856 |
++ |
17857 |
++ if (idx > max_lock_class_idx) |
17858 |
++ return NULL; |
17859 |
++ return lock_classes + idx; |
17860 |
+ } |
17861 |
+ |
17862 |
+ static void l_stop(struct seq_file *m, void *v) |
17863 |
+@@ -57,14 +76,16 @@ static void print_name(struct seq_file *m, struct lock_class *class) |
17864 |
+ |
17865 |
+ static int l_show(struct seq_file *m, void *v) |
17866 |
+ { |
17867 |
+- struct lock_class *class = list_entry(v, struct lock_class, lock_entry); |
17868 |
++ struct lock_class *class = v; |
17869 |
+ struct lock_list *entry; |
17870 |
+ char usage[LOCK_USAGE_CHARS]; |
17871 |
++ int idx = class - lock_classes; |
17872 |
+ |
17873 |
+- if (v == &all_lock_classes) { |
17874 |
++ if (v == lock_classes) |
17875 |
+ seq_printf(m, "all lock classes:\n"); |
17876 |
++ |
17877 |
++ if (!test_bit(idx, lock_classes_in_use)) |
17878 |
+ return 0; |
17879 |
+- } |
17880 |
+ |
17881 |
+ seq_printf(m, "%p", class->key); |
17882 |
+ #ifdef CONFIG_DEBUG_LOCKDEP |
17883 |
+@@ -218,8 +239,11 @@ static int lockdep_stats_show(struct seq_file *m, void *v) |
17884 |
+ |
17885 |
+ #ifdef CONFIG_PROVE_LOCKING |
17886 |
+ struct lock_class *class; |
17887 |
++ unsigned long idx; |
17888 |
+ |
17889 |
+- list_for_each_entry(class, &all_lock_classes, lock_entry) { |
17890 |
++ iterate_lock_classes(idx, class) { |
17891 |
++ if (!test_bit(idx, lock_classes_in_use)) |
17892 |
++ continue; |
17893 |
+ |
17894 |
+ if (class->usage_mask == 0) |
17895 |
+ nr_unused++; |
17896 |
+@@ -252,6 +276,7 @@ static int lockdep_stats_show(struct seq_file *m, void *v) |
17897 |
+ |
17898 |
+ sum_forward_deps += lockdep_count_forward_deps(class); |
17899 |
+ } |
17900 |
++ |
17901 |
+ #ifdef CONFIG_DEBUG_LOCKDEP |
17902 |
+ DEBUG_LOCKS_WARN_ON(debug_atomic_read(nr_unused_locks) != nr_unused); |
17903 |
+ #endif |
17904 |
+@@ -343,6 +368,8 @@ static int lockdep_stats_show(struct seq_file *m, void *v) |
17905 |
+ seq_printf(m, " max bfs queue depth: %11u\n", |
17906 |
+ max_bfs_queue_depth); |
17907 |
+ #endif |
17908 |
++ seq_printf(m, " max lock class index: %11lu\n", |
17909 |
++ max_lock_class_idx); |
17910 |
+ lockdep_stats_debug_show(m); |
17911 |
+ seq_printf(m, " debug_locks: %11u\n", |
17912 |
+ debug_locks); |
17913 |
+@@ -620,12 +647,16 @@ static int lock_stat_open(struct inode *inode, struct file *file) |
17914 |
+ if (!res) { |
17915 |
+ struct lock_stat_data *iter = data->stats; |
17916 |
+ struct seq_file *m = file->private_data; |
17917 |
++ unsigned long idx; |
17918 |
+ |
17919 |
+- list_for_each_entry(class, &all_lock_classes, lock_entry) { |
17920 |
++ iterate_lock_classes(idx, class) { |
17921 |
++ if (!test_bit(idx, lock_classes_in_use)) |
17922 |
++ continue; |
17923 |
+ iter->class = class; |
17924 |
+ iter->stats = lock_stats(class); |
17925 |
+ iter++; |
17926 |
+ } |
17927 |
++ |
17928 |
+ data->iter_end = iter; |
17929 |
+ |
17930 |
+ sort(data->stats, data->iter_end - data->stats, |
17931 |
+@@ -643,6 +674,7 @@ static ssize_t lock_stat_write(struct file *file, const char __user *buf, |
17932 |
+ size_t count, loff_t *ppos) |
17933 |
+ { |
17934 |
+ struct lock_class *class; |
17935 |
++ unsigned long idx; |
17936 |
+ char c; |
17937 |
+ |
17938 |
+ if (count) { |
17939 |
+@@ -652,8 +684,11 @@ static ssize_t lock_stat_write(struct file *file, const char __user *buf, |
17940 |
+ if (c != '0') |
17941 |
+ return count; |
17942 |
+ |
17943 |
+- list_for_each_entry(class, &all_lock_classes, lock_entry) |
17944 |
++ iterate_lock_classes(idx, class) { |
17945 |
++ if (!test_bit(idx, lock_classes_in_use)) |
17946 |
++ continue; |
17947 |
+ clear_lock_stats(class); |
17948 |
++ } |
17949 |
+ } |
17950 |
+ return count; |
17951 |
+ } |
17952 |
+diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c |
17953 |
+index bf640fd6142a0..522cb1387462c 100644 |
17954 |
+--- a/kernel/power/hibernate.c |
17955 |
++++ b/kernel/power/hibernate.c |
17956 |
+@@ -1323,7 +1323,7 @@ static int __init resumedelay_setup(char *str) |
17957 |
+ int rc = kstrtouint(str, 0, &resume_delay); |
17958 |
+ |
17959 |
+ if (rc) |
17960 |
+- return rc; |
17961 |
++ pr_warn("resumedelay: bad option string '%s'\n", str); |
17962 |
+ return 1; |
17963 |
+ } |
17964 |
+ |
17965 |
+diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c |
17966 |
+index e1ed58adb69e4..be480ae5cb2aa 100644 |
17967 |
+--- a/kernel/power/suspend_test.c |
17968 |
++++ b/kernel/power/suspend_test.c |
17969 |
+@@ -157,22 +157,22 @@ static int __init setup_test_suspend(char *value) |
17970 |
+ value++; |
17971 |
+ suspend_type = strsep(&value, ","); |
17972 |
+ if (!suspend_type) |
17973 |
+- return 0; |
17974 |
++ return 1; |
17975 |
+ |
17976 |
+ repeat = strsep(&value, ","); |
17977 |
+ if (repeat) { |
17978 |
+ if (kstrtou32(repeat, 0, &test_repeat_count_max)) |
17979 |
+- return 0; |
17980 |
++ return 1; |
17981 |
+ } |
17982 |
+ |
17983 |
+ for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) |
17984 |
+ if (!strcmp(pm_labels[i], suspend_type)) { |
17985 |
+ test_state_label = pm_labels[i]; |
17986 |
+- return 0; |
17987 |
++ return 1; |
17988 |
+ } |
17989 |
+ |
17990 |
+ printk(warn_bad_state, suspend_type); |
17991 |
+- return 0; |
17992 |
++ return 1; |
17993 |
+ } |
17994 |
+ __setup("test_suspend", setup_test_suspend); |
17995 |
+ |
17996 |
+diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
17997 |
+index 85351a12c85dc..17a310dcb6d96 100644 |
17998 |
+--- a/kernel/printk/printk.c |
17999 |
++++ b/kernel/printk/printk.c |
18000 |
+@@ -146,8 +146,10 @@ static int __control_devkmsg(char *str) |
18001 |
+ |
18002 |
+ static int __init control_devkmsg(char *str) |
18003 |
+ { |
18004 |
+- if (__control_devkmsg(str) < 0) |
18005 |
++ if (__control_devkmsg(str) < 0) { |
18006 |
++ pr_warn("printk.devkmsg: bad option string '%s'\n", str); |
18007 |
+ return 1; |
18008 |
++ } |
18009 |
+ |
18010 |
+ /* |
18011 |
+ * Set sysctl string accordingly: |
18012 |
+@@ -166,7 +168,7 @@ static int __init control_devkmsg(char *str) |
18013 |
+ */ |
18014 |
+ devkmsg_log |= DEVKMSG_LOG_MASK_LOCK; |
18015 |
+ |
18016 |
+- return 0; |
18017 |
++ return 1; |
18018 |
+ } |
18019 |
+ __setup("printk.devkmsg=", control_devkmsg); |
18020 |
+ |
18021 |
+diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
18022 |
+index eb4d04cb3aaf5..d99f73f83bf5f 100644 |
18023 |
+--- a/kernel/ptrace.c |
18024 |
++++ b/kernel/ptrace.c |
18025 |
+@@ -370,6 +370,26 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) |
18026 |
+ return !err; |
18027 |
+ } |
18028 |
+ |
18029 |
++static int check_ptrace_options(unsigned long data) |
18030 |
++{ |
18031 |
++ if (data & ~(unsigned long)PTRACE_O_MASK) |
18032 |
++ return -EINVAL; |
18033 |
++ |
18034 |
++ if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) { |
18035 |
++ if (!IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) || |
18036 |
++ !IS_ENABLED(CONFIG_SECCOMP)) |
18037 |
++ return -EINVAL; |
18038 |
++ |
18039 |
++ if (!capable(CAP_SYS_ADMIN)) |
18040 |
++ return -EPERM; |
18041 |
++ |
18042 |
++ if (seccomp_mode(¤t->seccomp) != SECCOMP_MODE_DISABLED || |
18043 |
++ current->ptrace & PT_SUSPEND_SECCOMP) |
18044 |
++ return -EPERM; |
18045 |
++ } |
18046 |
++ return 0; |
18047 |
++} |
18048 |
++ |
18049 |
+ static int ptrace_attach(struct task_struct *task, long request, |
18050 |
+ unsigned long addr, |
18051 |
+ unsigned long flags) |
18052 |
+@@ -381,8 +401,16 @@ static int ptrace_attach(struct task_struct *task, long request, |
18053 |
+ if (seize) { |
18054 |
+ if (addr != 0) |
18055 |
+ goto out; |
18056 |
++ /* |
18057 |
++ * This duplicates the check in check_ptrace_options() because |
18058 |
++ * ptrace_attach() and ptrace_setoptions() have historically |
18059 |
++ * used different error codes for unknown ptrace options. |
18060 |
++ */ |
18061 |
+ if (flags & ~(unsigned long)PTRACE_O_MASK) |
18062 |
+ goto out; |
18063 |
++ retval = check_ptrace_options(flags); |
18064 |
++ if (retval) |
18065 |
++ return retval; |
18066 |
+ flags = PT_PTRACED | PT_SEIZED | (flags << PT_OPT_FLAG_SHIFT); |
18067 |
+ } else { |
18068 |
+ flags = PT_PTRACED; |
18069 |
+@@ -655,22 +683,11 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds |
18070 |
+ static int ptrace_setoptions(struct task_struct *child, unsigned long data) |
18071 |
+ { |
18072 |
+ unsigned flags; |
18073 |
++ int ret; |
18074 |
+ |
18075 |
+- if (data & ~(unsigned long)PTRACE_O_MASK) |
18076 |
+- return -EINVAL; |
18077 |
+- |
18078 |
+- if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) { |
18079 |
+- if (!IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) || |
18080 |
+- !IS_ENABLED(CONFIG_SECCOMP)) |
18081 |
+- return -EINVAL; |
18082 |
+- |
18083 |
+- if (!capable(CAP_SYS_ADMIN)) |
18084 |
+- return -EPERM; |
18085 |
+- |
18086 |
+- if (seccomp_mode(¤t->seccomp) != SECCOMP_MODE_DISABLED || |
18087 |
+- current->ptrace & PT_SUSPEND_SECCOMP) |
18088 |
+- return -EPERM; |
18089 |
+- } |
18090 |
++ ret = check_ptrace_options(data); |
18091 |
++ if (ret) |
18092 |
++ return ret; |
18093 |
+ |
18094 |
+ /* Avoid intermediate state when all opts are cleared */ |
18095 |
+ flags = child->ptrace; |
18096 |
+diff --git a/kernel/rseq.c b/kernel/rseq.c |
18097 |
+index 0077713bf2400..6ca29dddceabc 100644 |
18098 |
+--- a/kernel/rseq.c |
18099 |
++++ b/kernel/rseq.c |
18100 |
+@@ -120,8 +120,13 @@ static int rseq_get_rseq_cs(struct task_struct *t, struct rseq_cs *rseq_cs) |
18101 |
+ u32 sig; |
18102 |
+ int ret; |
18103 |
+ |
18104 |
+- if (copy_from_user(&ptr, &t->rseq->rseq_cs.ptr64, sizeof(ptr))) |
18105 |
++#ifdef CONFIG_64BIT |
18106 |
++ if (get_user(ptr, &t->rseq->rseq_cs)) |
18107 |
+ return -EFAULT; |
18108 |
++#else |
18109 |
++ if (copy_from_user(&ptr, &t->rseq->rseq_cs, sizeof(ptr))) |
18110 |
++ return -EFAULT; |
18111 |
++#endif |
18112 |
+ if (!ptr) { |
18113 |
+ memset(rseq_cs, 0, sizeof(*rseq_cs)); |
18114 |
+ return 0; |
18115 |
+@@ -204,9 +209,13 @@ static int clear_rseq_cs(struct task_struct *t) |
18116 |
+ * |
18117 |
+ * Set rseq_cs to NULL. |
18118 |
+ */ |
18119 |
+- if (clear_user(&t->rseq->rseq_cs.ptr64, sizeof(t->rseq->rseq_cs.ptr64))) |
18120 |
++#ifdef CONFIG_64BIT |
18121 |
++ return put_user(0UL, &t->rseq->rseq_cs); |
18122 |
++#else |
18123 |
++ if (clear_user(&t->rseq->rseq_cs, sizeof(t->rseq->rseq_cs))) |
18124 |
+ return -EFAULT; |
18125 |
+ return 0; |
18126 |
++#endif |
18127 |
+ } |
18128 |
+ |
18129 |
+ /* |
18130 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
18131 |
+index 0a5f9fad45e4b..e437d946b27bb 100644 |
18132 |
+--- a/kernel/sched/core.c |
18133 |
++++ b/kernel/sched/core.c |
18134 |
+@@ -36,6 +36,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp); |
18135 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp); |
18136 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp); |
18137 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp); |
18138 |
++EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_thermal_tp); |
18139 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_cpu_capacity_tp); |
18140 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp); |
18141 |
+ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp); |
18142 |
+diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c |
18143 |
+index 70a5782724363..e7df4f2935871 100644 |
18144 |
+--- a/kernel/sched/debug.c |
18145 |
++++ b/kernel/sched/debug.c |
18146 |
+@@ -908,25 +908,15 @@ void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, |
18147 |
+ static void sched_show_numa(struct task_struct *p, struct seq_file *m) |
18148 |
+ { |
18149 |
+ #ifdef CONFIG_NUMA_BALANCING |
18150 |
+- struct mempolicy *pol; |
18151 |
+- |
18152 |
+ if (p->mm) |
18153 |
+ P(mm->numa_scan_seq); |
18154 |
+ |
18155 |
+- task_lock(p); |
18156 |
+- pol = p->mempolicy; |
18157 |
+- if (pol && !(pol->flags & MPOL_F_MORON)) |
18158 |
+- pol = NULL; |
18159 |
+- mpol_get(pol); |
18160 |
+- task_unlock(p); |
18161 |
+- |
18162 |
+ P(numa_pages_migrated); |
18163 |
+ P(numa_preferred_nid); |
18164 |
+ P(total_numa_faults); |
18165 |
+ SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", |
18166 |
+ task_node(p), task_numa_group_id(p)); |
18167 |
+ show_numa_stats(p, m); |
18168 |
+- mpol_put(pol); |
18169 |
+ #endif |
18170 |
+ } |
18171 |
+ |
18172 |
+diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c |
18173 |
+index e3f144d960261..249ed32591449 100644 |
18174 |
+--- a/kernel/watch_queue.c |
18175 |
++++ b/kernel/watch_queue.c |
18176 |
+@@ -274,7 +274,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) |
18177 |
+ return 0; |
18178 |
+ |
18179 |
+ error_p: |
18180 |
+- for (i = 0; i < nr_pages; i++) |
18181 |
++ while (--i >= 0) |
18182 |
+ __free_page(pages[i]); |
18183 |
+ kfree(pages); |
18184 |
+ error: |
18185 |
+@@ -373,6 +373,7 @@ static void __put_watch_queue(struct kref *kref) |
18186 |
+ |
18187 |
+ for (i = 0; i < wqueue->nr_pages; i++) |
18188 |
+ __free_page(wqueue->notes[i]); |
18189 |
++ kfree(wqueue->notes); |
18190 |
+ bitmap_free(wqueue->notes_bitmap); |
18191 |
+ |
18192 |
+ wfilter = rcu_access_pointer(wqueue->filter); |
18193 |
+@@ -398,6 +399,7 @@ static void free_watch(struct rcu_head *rcu) |
18194 |
+ put_watch_queue(rcu_access_pointer(watch->queue)); |
18195 |
+ atomic_dec(&watch->cred->user->nr_watches); |
18196 |
+ put_cred(watch->cred); |
18197 |
++ kfree(watch); |
18198 |
+ } |
18199 |
+ |
18200 |
+ static void __put_watch(struct kref *kref) |
18201 |
+diff --git a/lib/kunit/try-catch.c b/lib/kunit/try-catch.c |
18202 |
+index 0dd434e40487c..71e5c58530996 100644 |
18203 |
+--- a/lib/kunit/try-catch.c |
18204 |
++++ b/lib/kunit/try-catch.c |
18205 |
+@@ -52,7 +52,7 @@ static unsigned long kunit_test_timeout(void) |
18206 |
+ * If tests timeout due to exceeding sysctl_hung_task_timeout_secs, |
18207 |
+ * the task will be killed and an oops generated. |
18208 |
+ */ |
18209 |
+- return 300 * MSEC_PER_SEC; /* 5 min */ |
18210 |
++ return 300 * msecs_to_jiffies(MSEC_PER_SEC); /* 5 min */ |
18211 |
+ } |
18212 |
+ |
18213 |
+ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) |
18214 |
+diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile |
18215 |
+index a4c7cd74cff58..4fb7700a741bd 100644 |
18216 |
+--- a/lib/raid6/test/Makefile |
18217 |
++++ b/lib/raid6/test/Makefile |
18218 |
+@@ -4,6 +4,8 @@ |
18219 |
+ # from userspace. |
18220 |
+ # |
18221 |
+ |
18222 |
++pound := \# |
18223 |
++ |
18224 |
+ CC = gcc |
18225 |
+ OPTFLAGS = -O2 # Adjust as desired |
18226 |
+ CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) |
18227 |
+@@ -42,7 +44,7 @@ else ifeq ($(HAS_NEON),yes) |
18228 |
+ OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o |
18229 |
+ CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 |
18230 |
+ else |
18231 |
+- HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\ |
18232 |
++ HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\ |
18233 |
+ gcc -c -x c - >/dev/null && rm ./-.o && echo yes) |
18234 |
+ ifeq ($(HAS_ALTIVEC),yes) |
18235 |
+ CFLAGS += -I../../../arch/powerpc/include |
18236 |
+diff --git a/lib/raid6/test/test.c b/lib/raid6/test/test.c |
18237 |
+index a3cf071941ab4..841a55242abaa 100644 |
18238 |
+--- a/lib/raid6/test/test.c |
18239 |
++++ b/lib/raid6/test/test.c |
18240 |
+@@ -19,7 +19,6 @@ |
18241 |
+ #define NDISKS 16 /* Including P and Q */ |
18242 |
+ |
18243 |
+ const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); |
18244 |
+-struct raid6_calls raid6_call; |
18245 |
+ |
18246 |
+ char *dataptrs[NDISKS]; |
18247 |
+ char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); |
18248 |
+diff --git a/lib/test_kmod.c b/lib/test_kmod.c |
18249 |
+index eab52770070d6..c637f6b5053a9 100644 |
18250 |
+--- a/lib/test_kmod.c |
18251 |
++++ b/lib/test_kmod.c |
18252 |
+@@ -1155,6 +1155,7 @@ static struct kmod_test_device *register_test_dev_kmod(void) |
18253 |
+ if (ret) { |
18254 |
+ pr_err("could not register misc device: %d\n", ret); |
18255 |
+ free_test_dev_kmod(test_dev); |
18256 |
++ test_dev = NULL; |
18257 |
+ goto out; |
18258 |
+ } |
18259 |
+ |
18260 |
+diff --git a/lib/test_lockup.c b/lib/test_lockup.c |
18261 |
+index f1a020bcc763e..78a630bbd03df 100644 |
18262 |
+--- a/lib/test_lockup.c |
18263 |
++++ b/lib/test_lockup.c |
18264 |
+@@ -417,9 +417,14 @@ static bool test_kernel_ptr(unsigned long addr, int size) |
18265 |
+ return false; |
18266 |
+ |
18267 |
+ /* should be at least readable kernel address */ |
18268 |
+- if (access_ok(ptr, 1) || |
18269 |
+- access_ok(ptr + size - 1, 1) || |
18270 |
+- get_kernel_nofault(buf, ptr) || |
18271 |
++ if (!IS_ENABLED(CONFIG_ALTERNATE_USER_ADDRESS_SPACE) && |
18272 |
++ (access_ok((void __user *)ptr, 1) || |
18273 |
++ access_ok((void __user *)ptr + size - 1, 1))) { |
18274 |
++ pr_err("user space ptr invalid in kernel: %#lx\n", addr); |
18275 |
++ return true; |
18276 |
++ } |
18277 |
++ |
18278 |
++ if (get_kernel_nofault(buf, ptr) || |
18279 |
+ get_kernel_nofault(buf, ptr + size - 1)) { |
18280 |
+ pr_err("invalid kernel ptr: %#lx\n", addr); |
18281 |
+ return true; |
18282 |
+diff --git a/lib/test_xarray.c b/lib/test_xarray.c |
18283 |
+index 8b1c318189ce8..e77d4856442c3 100644 |
18284 |
+--- a/lib/test_xarray.c |
18285 |
++++ b/lib/test_xarray.c |
18286 |
+@@ -1463,6 +1463,25 @@ unlock: |
18287 |
+ XA_BUG_ON(xa, !xa_empty(xa)); |
18288 |
+ } |
18289 |
+ |
18290 |
++static noinline void check_create_range_5(struct xarray *xa, |
18291 |
++ unsigned long index, unsigned int order) |
18292 |
++{ |
18293 |
++ XA_STATE_ORDER(xas, xa, index, order); |
18294 |
++ unsigned int i; |
18295 |
++ |
18296 |
++ xa_store_order(xa, index, order, xa_mk_index(index), GFP_KERNEL); |
18297 |
++ |
18298 |
++ for (i = 0; i < order + 10; i++) { |
18299 |
++ do { |
18300 |
++ xas_lock(&xas); |
18301 |
++ xas_create_range(&xas); |
18302 |
++ xas_unlock(&xas); |
18303 |
++ } while (xas_nomem(&xas, GFP_KERNEL)); |
18304 |
++ } |
18305 |
++ |
18306 |
++ xa_destroy(xa); |
18307 |
++} |
18308 |
++ |
18309 |
+ static noinline void check_create_range(struct xarray *xa) |
18310 |
+ { |
18311 |
+ unsigned int order; |
18312 |
+@@ -1490,6 +1509,9 @@ static noinline void check_create_range(struct xarray *xa) |
18313 |
+ check_create_range_4(xa, (3U << order) + 1, order); |
18314 |
+ check_create_range_4(xa, (3U << order) - 1, order); |
18315 |
+ check_create_range_4(xa, (1U << 24) + 1, order); |
18316 |
++ |
18317 |
++ check_create_range_5(xa, 0, order); |
18318 |
++ check_create_range_5(xa, (1U << order), order); |
18319 |
+ } |
18320 |
+ |
18321 |
+ check_create_range_3(); |
18322 |
+diff --git a/lib/xarray.c b/lib/xarray.c |
18323 |
+index ed775dee1074c..75da19a7a9334 100644 |
18324 |
+--- a/lib/xarray.c |
18325 |
++++ b/lib/xarray.c |
18326 |
+@@ -722,6 +722,8 @@ void xas_create_range(struct xa_state *xas) |
18327 |
+ |
18328 |
+ for (;;) { |
18329 |
+ struct xa_node *node = xas->xa_node; |
18330 |
++ if (node->shift >= shift) |
18331 |
++ break; |
18332 |
+ xas->xa_node = xa_parent_locked(xas->xa, node); |
18333 |
+ xas->xa_offset = node->offset - 1; |
18334 |
+ if (node->offset != 0) |
18335 |
+@@ -1078,6 +1080,7 @@ void xas_split(struct xa_state *xas, void *entry, unsigned int order) |
18336 |
+ xa_mk_node(child)); |
18337 |
+ if (xa_is_value(curr)) |
18338 |
+ values--; |
18339 |
++ xas_update(xas, child); |
18340 |
+ } else { |
18341 |
+ unsigned int canon = offset - xas->xa_sibs; |
18342 |
+ |
18343 |
+@@ -1092,6 +1095,7 @@ void xas_split(struct xa_state *xas, void *entry, unsigned int order) |
18344 |
+ } while (offset-- > xas->xa_offset); |
18345 |
+ |
18346 |
+ node->nr_values += values; |
18347 |
++ xas_update(xas, node); |
18348 |
+ } |
18349 |
+ EXPORT_SYMBOL_GPL(xas_split); |
18350 |
+ #endif |
18351 |
+diff --git a/mm/kmemleak.c b/mm/kmemleak.c |
18352 |
+index 56fcfcb8e6173..4801751cb6b6d 100644 |
18353 |
+--- a/mm/kmemleak.c |
18354 |
++++ b/mm/kmemleak.c |
18355 |
+@@ -787,6 +787,8 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) |
18356 |
+ unsigned long flags; |
18357 |
+ struct kmemleak_object *object; |
18358 |
+ struct kmemleak_scan_area *area = NULL; |
18359 |
++ unsigned long untagged_ptr; |
18360 |
++ unsigned long untagged_objp; |
18361 |
+ |
18362 |
+ object = find_and_get_object(ptr, 1); |
18363 |
+ if (!object) { |
18364 |
+@@ -795,6 +797,9 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) |
18365 |
+ return; |
18366 |
+ } |
18367 |
+ |
18368 |
++ untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr); |
18369 |
++ untagged_objp = (unsigned long)kasan_reset_tag((void *)object->pointer); |
18370 |
++ |
18371 |
+ if (scan_area_cache) |
18372 |
+ area = kmem_cache_alloc(scan_area_cache, gfp_kmemleak_mask(gfp)); |
18373 |
+ |
18374 |
+@@ -806,8 +811,8 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) |
18375 |
+ goto out_unlock; |
18376 |
+ } |
18377 |
+ if (size == SIZE_MAX) { |
18378 |
+- size = object->pointer + object->size - ptr; |
18379 |
+- } else if (ptr + size > object->pointer + object->size) { |
18380 |
++ size = untagged_objp + object->size - untagged_ptr; |
18381 |
++ } else if (untagged_ptr + size > untagged_objp + object->size) { |
18382 |
+ kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr); |
18383 |
+ dump_object_info(object); |
18384 |
+ kmem_cache_free(scan_area_cache, area); |
18385 |
+diff --git a/mm/madvise.c b/mm/madvise.c |
18386 |
+index 24abc79f8914e..77e1dc2d4e186 100644 |
18387 |
+--- a/mm/madvise.c |
18388 |
++++ b/mm/madvise.c |
18389 |
+@@ -1229,8 +1229,7 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec, |
18390 |
+ iov_iter_advance(&iter, iovec.iov_len); |
18391 |
+ } |
18392 |
+ |
18393 |
+- if (ret == 0) |
18394 |
+- ret = total_len - iov_iter_count(&iter); |
18395 |
++ ret = (total_len - iov_iter_count(&iter)) ? : ret; |
18396 |
+ |
18397 |
+ release_mm: |
18398 |
+ mmput(mm); |
18399 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
18400 |
+index dbe07fef26828..92ab008777183 100644 |
18401 |
+--- a/mm/memcontrol.c |
18402 |
++++ b/mm/memcontrol.c |
18403 |
+@@ -7124,7 +7124,7 @@ static int __init cgroup_memory(char *s) |
18404 |
+ if (!strcmp(token, "nokmem")) |
18405 |
+ cgroup_memory_nokmem = true; |
18406 |
+ } |
18407 |
+- return 0; |
18408 |
++ return 1; |
18409 |
+ } |
18410 |
+ __setup("cgroup.memory=", cgroup_memory); |
18411 |
+ |
18412 |
+diff --git a/mm/memory.c b/mm/memory.c |
18413 |
+index 4fe24cd865a79..af27127c235e2 100644 |
18414 |
+--- a/mm/memory.c |
18415 |
++++ b/mm/memory.c |
18416 |
+@@ -3676,11 +3676,20 @@ static vm_fault_t __do_fault(struct vm_fault *vmf) |
18417 |
+ return ret; |
18418 |
+ |
18419 |
+ if (unlikely(PageHWPoison(vmf->page))) { |
18420 |
+- if (ret & VM_FAULT_LOCKED) |
18421 |
+- unlock_page(vmf->page); |
18422 |
+- put_page(vmf->page); |
18423 |
++ struct page *page = vmf->page; |
18424 |
++ vm_fault_t poisonret = VM_FAULT_HWPOISON; |
18425 |
++ if (ret & VM_FAULT_LOCKED) { |
18426 |
++ if (page_mapped(page)) |
18427 |
++ unmap_mapping_pages(page_mapping(page), |
18428 |
++ page->index, 1, false); |
18429 |
++ /* Retry if a clean page was removed from the cache. */ |
18430 |
++ if (invalidate_inode_page(page)) |
18431 |
++ poisonret = VM_FAULT_NOPAGE; |
18432 |
++ unlock_page(page); |
18433 |
++ } |
18434 |
++ put_page(page); |
18435 |
+ vmf->page = NULL; |
18436 |
+- return VM_FAULT_HWPOISON; |
18437 |
++ return poisonret; |
18438 |
+ } |
18439 |
+ |
18440 |
+ if (unlikely(!(ret & VM_FAULT_LOCKED))) |
18441 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
18442 |
+index c8b1592dff73d..eb97aed2fbe7d 100644 |
18443 |
+--- a/mm/mempolicy.c |
18444 |
++++ b/mm/mempolicy.c |
18445 |
+@@ -802,7 +802,6 @@ static int vma_replace_policy(struct vm_area_struct *vma, |
18446 |
+ static int mbind_range(struct mm_struct *mm, unsigned long start, |
18447 |
+ unsigned long end, struct mempolicy *new_pol) |
18448 |
+ { |
18449 |
+- struct vm_area_struct *next; |
18450 |
+ struct vm_area_struct *prev; |
18451 |
+ struct vm_area_struct *vma; |
18452 |
+ int err = 0; |
18453 |
+@@ -817,8 +816,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, |
18454 |
+ if (start > vma->vm_start) |
18455 |
+ prev = vma; |
18456 |
+ |
18457 |
+- for (; vma && vma->vm_start < end; prev = vma, vma = next) { |
18458 |
+- next = vma->vm_next; |
18459 |
++ for (; vma && vma->vm_start < end; prev = vma, vma = vma->vm_next) { |
18460 |
+ vmstart = max(start, vma->vm_start); |
18461 |
+ vmend = min(end, vma->vm_end); |
18462 |
+ |
18463 |
+@@ -832,10 +830,6 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, |
18464 |
+ new_pol, vma->vm_userfaultfd_ctx); |
18465 |
+ if (prev) { |
18466 |
+ vma = prev; |
18467 |
+- next = vma->vm_next; |
18468 |
+- if (mpol_equal(vma_policy(vma), new_pol)) |
18469 |
+- continue; |
18470 |
+- /* vma_merge() joined vma && vma->next, case 8 */ |
18471 |
+ goto replace; |
18472 |
+ } |
18473 |
+ if (vma->vm_start != vmstart) { |
18474 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
18475 |
+index 5c8b4485860de..46c160d4eac14 100644 |
18476 |
+--- a/mm/mmap.c |
18477 |
++++ b/mm/mmap.c |
18478 |
+@@ -2577,7 +2577,7 @@ static int __init cmdline_parse_stack_guard_gap(char *p) |
18479 |
+ if (!*endptr) |
18480 |
+ stack_guard_gap = val << PAGE_SHIFT; |
18481 |
+ |
18482 |
+- return 0; |
18483 |
++ return 1; |
18484 |
+ } |
18485 |
+ __setup("stack_guard_gap=", cmdline_parse_stack_guard_gap); |
18486 |
+ |
18487 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
18488 |
+index c63656c42e288..42f64ed2be478 100644 |
18489 |
+--- a/mm/page_alloc.c |
18490 |
++++ b/mm/page_alloc.c |
18491 |
+@@ -7402,10 +7402,17 @@ restart: |
18492 |
+ |
18493 |
+ out2: |
18494 |
+ /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ |
18495 |
+- for (nid = 0; nid < MAX_NUMNODES; nid++) |
18496 |
++ for (nid = 0; nid < MAX_NUMNODES; nid++) { |
18497 |
++ unsigned long start_pfn, end_pfn; |
18498 |
++ |
18499 |
+ zone_movable_pfn[nid] = |
18500 |
+ roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES); |
18501 |
+ |
18502 |
++ get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); |
18503 |
++ if (zone_movable_pfn[nid] >= end_pfn) |
18504 |
++ zone_movable_pfn[nid] = 0; |
18505 |
++ } |
18506 |
++ |
18507 |
+ out: |
18508 |
+ /* restore the node_state */ |
18509 |
+ node_states[N_MEMORY] = saved_node_state; |
18510 |
+diff --git a/mm/usercopy.c b/mm/usercopy.c |
18511 |
+index b3de3c4eefba7..540968b481e7e 100644 |
18512 |
+--- a/mm/usercopy.c |
18513 |
++++ b/mm/usercopy.c |
18514 |
+@@ -294,7 +294,10 @@ static bool enable_checks __initdata = true; |
18515 |
+ |
18516 |
+ static int __init parse_hardened_usercopy(char *str) |
18517 |
+ { |
18518 |
+- return strtobool(str, &enable_checks); |
18519 |
++ if (strtobool(str, &enable_checks)) |
18520 |
++ pr_warn("Invalid option string for hardened_usercopy: '%s'\n", |
18521 |
++ str); |
18522 |
++ return 1; |
18523 |
+ } |
18524 |
+ |
18525 |
+ __setup("hardened_usercopy=", parse_hardened_usercopy); |
18526 |
+diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c |
18527 |
+index ee9cead765450..986f707e7d973 100644 |
18528 |
+--- a/net/batman-adv/bridge_loop_avoidance.c |
18529 |
++++ b/net/batman-adv/bridge_loop_avoidance.c |
18530 |
+@@ -164,6 +164,9 @@ static void batadv_backbone_gw_release(struct kref *ref) |
18531 |
+ */ |
18532 |
+ static void batadv_backbone_gw_put(struct batadv_bla_backbone_gw *backbone_gw) |
18533 |
+ { |
18534 |
++ if (!backbone_gw) |
18535 |
++ return; |
18536 |
++ |
18537 |
+ kref_put(&backbone_gw->refcount, batadv_backbone_gw_release); |
18538 |
+ } |
18539 |
+ |
18540 |
+@@ -199,6 +202,9 @@ static void batadv_claim_release(struct kref *ref) |
18541 |
+ */ |
18542 |
+ static void batadv_claim_put(struct batadv_bla_claim *claim) |
18543 |
+ { |
18544 |
++ if (!claim) |
18545 |
++ return; |
18546 |
++ |
18547 |
+ kref_put(&claim->refcount, batadv_claim_release); |
18548 |
+ } |
18549 |
+ |
18550 |
+diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c |
18551 |
+index 0e6e53e9b5f35..338e4e9c33b8a 100644 |
18552 |
+--- a/net/batman-adv/distributed-arp-table.c |
18553 |
++++ b/net/batman-adv/distributed-arp-table.c |
18554 |
+@@ -128,6 +128,9 @@ static void batadv_dat_entry_release(struct kref *ref) |
18555 |
+ */ |
18556 |
+ static void batadv_dat_entry_put(struct batadv_dat_entry *dat_entry) |
18557 |
+ { |
18558 |
++ if (!dat_entry) |
18559 |
++ return; |
18560 |
++ |
18561 |
+ kref_put(&dat_entry->refcount, batadv_dat_entry_release); |
18562 |
+ } |
18563 |
+ |
18564 |
+diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c |
18565 |
+index ef3f85b576c4c..62f6f13f89ffd 100644 |
18566 |
+--- a/net/batman-adv/gateway_client.c |
18567 |
++++ b/net/batman-adv/gateway_client.c |
18568 |
+@@ -60,7 +60,7 @@ |
18569 |
+ * after rcu grace period |
18570 |
+ * @ref: kref pointer of the gw_node |
18571 |
+ */ |
18572 |
+-static void batadv_gw_node_release(struct kref *ref) |
18573 |
++void batadv_gw_node_release(struct kref *ref) |
18574 |
+ { |
18575 |
+ struct batadv_gw_node *gw_node; |
18576 |
+ |
18577 |
+@@ -70,16 +70,6 @@ static void batadv_gw_node_release(struct kref *ref) |
18578 |
+ kfree_rcu(gw_node, rcu); |
18579 |
+ } |
18580 |
+ |
18581 |
+-/** |
18582 |
+- * batadv_gw_node_put() - decrement the gw_node refcounter and possibly release |
18583 |
+- * it |
18584 |
+- * @gw_node: gateway node to free |
18585 |
+- */ |
18586 |
+-void batadv_gw_node_put(struct batadv_gw_node *gw_node) |
18587 |
+-{ |
18588 |
+- kref_put(&gw_node->refcount, batadv_gw_node_release); |
18589 |
+-} |
18590 |
+- |
18591 |
+ /** |
18592 |
+ * batadv_gw_get_selected_gw_node() - Get currently selected gateway |
18593 |
+ * @bat_priv: the bat priv with all the soft interface information |
18594 |
+diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h |
18595 |
+index 88b5dba843547..c5b1de586fde0 100644 |
18596 |
+--- a/net/batman-adv/gateway_client.h |
18597 |
++++ b/net/batman-adv/gateway_client.h |
18598 |
+@@ -9,6 +9,7 @@ |
18599 |
+ |
18600 |
+ #include "main.h" |
18601 |
+ |
18602 |
++#include <linux/kref.h> |
18603 |
+ #include <linux/netlink.h> |
18604 |
+ #include <linux/seq_file.h> |
18605 |
+ #include <linux/skbuff.h> |
18606 |
+@@ -28,7 +29,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, |
18607 |
+ void batadv_gw_node_delete(struct batadv_priv *bat_priv, |
18608 |
+ struct batadv_orig_node *orig_node); |
18609 |
+ void batadv_gw_node_free(struct batadv_priv *bat_priv); |
18610 |
+-void batadv_gw_node_put(struct batadv_gw_node *gw_node); |
18611 |
++void batadv_gw_node_release(struct kref *ref); |
18612 |
+ struct batadv_gw_node * |
18613 |
+ batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv); |
18614 |
+ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); |
18615 |
+@@ -40,4 +41,17 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, |
18616 |
+ struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv, |
18617 |
+ struct batadv_orig_node *orig_node); |
18618 |
+ |
18619 |
++/** |
18620 |
++ * batadv_gw_node_put() - decrement the gw_node refcounter and possibly release |
18621 |
++ * it |
18622 |
++ * @gw_node: gateway node to free |
18623 |
++ */ |
18624 |
++static inline void batadv_gw_node_put(struct batadv_gw_node *gw_node) |
18625 |
++{ |
18626 |
++ if (!gw_node) |
18627 |
++ return; |
18628 |
++ |
18629 |
++ kref_put(&gw_node->refcount, batadv_gw_node_release); |
18630 |
++} |
18631 |
++ |
18632 |
+ #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ |
18633 |
+diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h |
18634 |
+index b1855d9d0b062..ba5850cfb2774 100644 |
18635 |
+--- a/net/batman-adv/hard-interface.h |
18636 |
++++ b/net/batman-adv/hard-interface.h |
18637 |
+@@ -113,6 +113,9 @@ int batadv_hardif_no_broadcast(struct batadv_hard_iface *if_outgoing, |
18638 |
+ */ |
18639 |
+ static inline void batadv_hardif_put(struct batadv_hard_iface *hard_iface) |
18640 |
+ { |
18641 |
++ if (!hard_iface) |
18642 |
++ return; |
18643 |
++ |
18644 |
+ kref_put(&hard_iface->refcount, batadv_hardif_release); |
18645 |
+ } |
18646 |
+ |
18647 |
+diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c |
18648 |
+index 35b3e03c07774..1481b80395689 100644 |
18649 |
+--- a/net/batman-adv/network-coding.c |
18650 |
++++ b/net/batman-adv/network-coding.c |
18651 |
+@@ -222,6 +222,9 @@ static void batadv_nc_node_release(struct kref *ref) |
18652 |
+ */ |
18653 |
+ static void batadv_nc_node_put(struct batadv_nc_node *nc_node) |
18654 |
+ { |
18655 |
++ if (!nc_node) |
18656 |
++ return; |
18657 |
++ |
18658 |
+ kref_put(&nc_node->refcount, batadv_nc_node_release); |
18659 |
+ } |
18660 |
+ |
18661 |
+@@ -246,6 +249,9 @@ static void batadv_nc_path_release(struct kref *ref) |
18662 |
+ */ |
18663 |
+ static void batadv_nc_path_put(struct batadv_nc_path *nc_path) |
18664 |
+ { |
18665 |
++ if (!nc_path) |
18666 |
++ return; |
18667 |
++ |
18668 |
+ kref_put(&nc_path->refcount, batadv_nc_path_release); |
18669 |
+ } |
18670 |
+ |
18671 |
+diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c |
18672 |
+index 805d8969bdfbc..2d38a09459bb5 100644 |
18673 |
+--- a/net/batman-adv/originator.c |
18674 |
++++ b/net/batman-adv/originator.c |
18675 |
+@@ -178,7 +178,7 @@ out: |
18676 |
+ * and queue for free after rcu grace period |
18677 |
+ * @ref: kref pointer of the originator-vlan object |
18678 |
+ */ |
18679 |
+-static void batadv_orig_node_vlan_release(struct kref *ref) |
18680 |
++void batadv_orig_node_vlan_release(struct kref *ref) |
18681 |
+ { |
18682 |
+ struct batadv_orig_node_vlan *orig_vlan; |
18683 |
+ |
18684 |
+@@ -187,16 +187,6 @@ static void batadv_orig_node_vlan_release(struct kref *ref) |
18685 |
+ kfree_rcu(orig_vlan, rcu); |
18686 |
+ } |
18687 |
+ |
18688 |
+-/** |
18689 |
+- * batadv_orig_node_vlan_put() - decrement the refcounter and possibly release |
18690 |
+- * the originator-vlan object |
18691 |
+- * @orig_vlan: the originator-vlan object to release |
18692 |
+- */ |
18693 |
+-void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan) |
18694 |
+-{ |
18695 |
+- kref_put(&orig_vlan->refcount, batadv_orig_node_vlan_release); |
18696 |
+-} |
18697 |
+- |
18698 |
+ /** |
18699 |
+ * batadv_originator_init() - Initialize all originator structures |
18700 |
+ * @bat_priv: the bat priv with all the soft interface information |
18701 |
+@@ -232,7 +222,7 @@ err: |
18702 |
+ * free after rcu grace period |
18703 |
+ * @ref: kref pointer of the neigh_ifinfo |
18704 |
+ */ |
18705 |
+-static void batadv_neigh_ifinfo_release(struct kref *ref) |
18706 |
++void batadv_neigh_ifinfo_release(struct kref *ref) |
18707 |
+ { |
18708 |
+ struct batadv_neigh_ifinfo *neigh_ifinfo; |
18709 |
+ |
18710 |
+@@ -244,22 +234,12 @@ static void batadv_neigh_ifinfo_release(struct kref *ref) |
18711 |
+ kfree_rcu(neigh_ifinfo, rcu); |
18712 |
+ } |
18713 |
+ |
18714 |
+-/** |
18715 |
+- * batadv_neigh_ifinfo_put() - decrement the refcounter and possibly release |
18716 |
+- * the neigh_ifinfo |
18717 |
+- * @neigh_ifinfo: the neigh_ifinfo object to release |
18718 |
+- */ |
18719 |
+-void batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo) |
18720 |
+-{ |
18721 |
+- kref_put(&neigh_ifinfo->refcount, batadv_neigh_ifinfo_release); |
18722 |
+-} |
18723 |
+- |
18724 |
+ /** |
18725 |
+ * batadv_hardif_neigh_release() - release hardif neigh node from lists and |
18726 |
+ * queue for free after rcu grace period |
18727 |
+ * @ref: kref pointer of the neigh_node |
18728 |
+ */ |
18729 |
+-static void batadv_hardif_neigh_release(struct kref *ref) |
18730 |
++void batadv_hardif_neigh_release(struct kref *ref) |
18731 |
+ { |
18732 |
+ struct batadv_hardif_neigh_node *hardif_neigh; |
18733 |
+ |
18734 |
+@@ -274,22 +254,12 @@ static void batadv_hardif_neigh_release(struct kref *ref) |
18735 |
+ kfree_rcu(hardif_neigh, rcu); |
18736 |
+ } |
18737 |
+ |
18738 |
+-/** |
18739 |
+- * batadv_hardif_neigh_put() - decrement the hardif neighbors refcounter |
18740 |
+- * and possibly release it |
18741 |
+- * @hardif_neigh: hardif neigh neighbor to free |
18742 |
+- */ |
18743 |
+-void batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh) |
18744 |
+-{ |
18745 |
+- kref_put(&hardif_neigh->refcount, batadv_hardif_neigh_release); |
18746 |
+-} |
18747 |
+- |
18748 |
+ /** |
18749 |
+ * batadv_neigh_node_release() - release neigh_node from lists and queue for |
18750 |
+ * free after rcu grace period |
18751 |
+ * @ref: kref pointer of the neigh_node |
18752 |
+ */ |
18753 |
+-static void batadv_neigh_node_release(struct kref *ref) |
18754 |
++void batadv_neigh_node_release(struct kref *ref) |
18755 |
+ { |
18756 |
+ struct hlist_node *node_tmp; |
18757 |
+ struct batadv_neigh_node *neigh_node; |
18758 |
+@@ -309,16 +279,6 @@ static void batadv_neigh_node_release(struct kref *ref) |
18759 |
+ kfree_rcu(neigh_node, rcu); |
18760 |
+ } |
18761 |
+ |
18762 |
+-/** |
18763 |
+- * batadv_neigh_node_put() - decrement the neighbors refcounter and possibly |
18764 |
+- * release it |
18765 |
+- * @neigh_node: neigh neighbor to free |
18766 |
+- */ |
18767 |
+-void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node) |
18768 |
+-{ |
18769 |
+- kref_put(&neigh_node->refcount, batadv_neigh_node_release); |
18770 |
+-} |
18771 |
+- |
18772 |
+ /** |
18773 |
+ * batadv_orig_router_get() - router to the originator depending on iface |
18774 |
+ * @orig_node: the orig node for the router |
18775 |
+@@ -851,7 +811,7 @@ int batadv_hardif_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb) |
18776 |
+ * free after rcu grace period |
18777 |
+ * @ref: kref pointer of the orig_ifinfo |
18778 |
+ */ |
18779 |
+-static void batadv_orig_ifinfo_release(struct kref *ref) |
18780 |
++void batadv_orig_ifinfo_release(struct kref *ref) |
18781 |
+ { |
18782 |
+ struct batadv_orig_ifinfo *orig_ifinfo; |
18783 |
+ struct batadv_neigh_node *router; |
18784 |
+@@ -869,16 +829,6 @@ static void batadv_orig_ifinfo_release(struct kref *ref) |
18785 |
+ kfree_rcu(orig_ifinfo, rcu); |
18786 |
+ } |
18787 |
+ |
18788 |
+-/** |
18789 |
+- * batadv_orig_ifinfo_put() - decrement the refcounter and possibly release |
18790 |
+- * the orig_ifinfo |
18791 |
+- * @orig_ifinfo: the orig_ifinfo object to release |
18792 |
+- */ |
18793 |
+-void batadv_orig_ifinfo_put(struct batadv_orig_ifinfo *orig_ifinfo) |
18794 |
+-{ |
18795 |
+- kref_put(&orig_ifinfo->refcount, batadv_orig_ifinfo_release); |
18796 |
+-} |
18797 |
+- |
18798 |
+ /** |
18799 |
+ * batadv_orig_node_free_rcu() - free the orig_node |
18800 |
+ * @rcu: rcu pointer of the orig_node |
18801 |
+@@ -902,7 +852,7 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu) |
18802 |
+ * free after rcu grace period |
18803 |
+ * @ref: kref pointer of the orig_node |
18804 |
+ */ |
18805 |
+-static void batadv_orig_node_release(struct kref *ref) |
18806 |
++void batadv_orig_node_release(struct kref *ref) |
18807 |
+ { |
18808 |
+ struct hlist_node *node_tmp; |
18809 |
+ struct batadv_neigh_node *neigh_node; |
18810 |
+@@ -948,16 +898,6 @@ static void batadv_orig_node_release(struct kref *ref) |
18811 |
+ call_rcu(&orig_node->rcu, batadv_orig_node_free_rcu); |
18812 |
+ } |
18813 |
+ |
18814 |
+-/** |
18815 |
+- * batadv_orig_node_put() - decrement the orig node refcounter and possibly |
18816 |
+- * release it |
18817 |
+- * @orig_node: the orig node to free |
18818 |
+- */ |
18819 |
+-void batadv_orig_node_put(struct batadv_orig_node *orig_node) |
18820 |
+-{ |
18821 |
+- kref_put(&orig_node->refcount, batadv_orig_node_release); |
18822 |
+-} |
18823 |
+- |
18824 |
+ /** |
18825 |
+ * batadv_originator_free() - Free all originator structures |
18826 |
+ * @bat_priv: the bat priv with all the soft interface information |
18827 |
+diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h |
18828 |
+index 7bc01c138b3ab..3b824a79743a2 100644 |
18829 |
+--- a/net/batman-adv/originator.h |
18830 |
++++ b/net/batman-adv/originator.h |
18831 |
+@@ -12,6 +12,7 @@ |
18832 |
+ #include <linux/compiler.h> |
18833 |
+ #include <linux/if_ether.h> |
18834 |
+ #include <linux/jhash.h> |
18835 |
++#include <linux/kref.h> |
18836 |
+ #include <linux/netlink.h> |
18837 |
+ #include <linux/seq_file.h> |
18838 |
+ #include <linux/skbuff.h> |
18839 |
+@@ -21,19 +22,18 @@ bool batadv_compare_orig(const struct hlist_node *node, const void *data2); |
18840 |
+ int batadv_originator_init(struct batadv_priv *bat_priv); |
18841 |
+ void batadv_originator_free(struct batadv_priv *bat_priv); |
18842 |
+ void batadv_purge_orig_ref(struct batadv_priv *bat_priv); |
18843 |
+-void batadv_orig_node_put(struct batadv_orig_node *orig_node); |
18844 |
++void batadv_orig_node_release(struct kref *ref); |
18845 |
+ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv, |
18846 |
+ const u8 *addr); |
18847 |
+ struct batadv_hardif_neigh_node * |
18848 |
+ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, |
18849 |
+ const u8 *neigh_addr); |
18850 |
+-void |
18851 |
+-batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh); |
18852 |
++void batadv_hardif_neigh_release(struct kref *ref); |
18853 |
+ struct batadv_neigh_node * |
18854 |
+ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node, |
18855 |
+ struct batadv_hard_iface *hard_iface, |
18856 |
+ const u8 *neigh_addr); |
18857 |
+-void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node); |
18858 |
++void batadv_neigh_node_release(struct kref *ref); |
18859 |
+ struct batadv_neigh_node * |
18860 |
+ batadv_orig_router_get(struct batadv_orig_node *orig_node, |
18861 |
+ const struct batadv_hard_iface *if_outgoing); |
18862 |
+@@ -43,7 +43,7 @@ batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh, |
18863 |
+ struct batadv_neigh_ifinfo * |
18864 |
+ batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh, |
18865 |
+ struct batadv_hard_iface *if_outgoing); |
18866 |
+-void batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo); |
18867 |
++void batadv_neigh_ifinfo_release(struct kref *ref); |
18868 |
+ |
18869 |
+ int batadv_hardif_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb); |
18870 |
+ int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset); |
18871 |
+@@ -54,7 +54,7 @@ batadv_orig_ifinfo_get(struct batadv_orig_node *orig_node, |
18872 |
+ struct batadv_orig_ifinfo * |
18873 |
+ batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node, |
18874 |
+ struct batadv_hard_iface *if_outgoing); |
18875 |
+-void batadv_orig_ifinfo_put(struct batadv_orig_ifinfo *orig_ifinfo); |
18876 |
++void batadv_orig_ifinfo_release(struct kref *ref); |
18877 |
+ |
18878 |
+ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset); |
18879 |
+ int batadv_orig_dump(struct sk_buff *msg, struct netlink_callback *cb); |
18880 |
+@@ -65,7 +65,7 @@ batadv_orig_node_vlan_new(struct batadv_orig_node *orig_node, |
18881 |
+ struct batadv_orig_node_vlan * |
18882 |
+ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node, |
18883 |
+ unsigned short vid); |
18884 |
+-void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan); |
18885 |
++void batadv_orig_node_vlan_release(struct kref *ref); |
18886 |
+ |
18887 |
+ /** |
18888 |
+ * batadv_choose_orig() - Return the index of the orig entry in the hash table |
18889 |
+@@ -86,4 +86,86 @@ static inline u32 batadv_choose_orig(const void *data, u32 size) |
18890 |
+ struct batadv_orig_node * |
18891 |
+ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data); |
18892 |
+ |
18893 |
++/** |
18894 |
++ * batadv_orig_node_vlan_put() - decrement the refcounter and possibly release |
18895 |
++ * the originator-vlan object |
18896 |
++ * @orig_vlan: the originator-vlan object to release |
18897 |
++ */ |
18898 |
++static inline void |
18899 |
++batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan) |
18900 |
++{ |
18901 |
++ if (!orig_vlan) |
18902 |
++ return; |
18903 |
++ |
18904 |
++ kref_put(&orig_vlan->refcount, batadv_orig_node_vlan_release); |
18905 |
++} |
18906 |
++ |
18907 |
++/** |
18908 |
++ * batadv_neigh_ifinfo_put() - decrement the refcounter and possibly release |
18909 |
++ * the neigh_ifinfo |
18910 |
++ * @neigh_ifinfo: the neigh_ifinfo object to release |
18911 |
++ */ |
18912 |
++static inline void |
18913 |
++batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo) |
18914 |
++{ |
18915 |
++ if (!neigh_ifinfo) |
18916 |
++ return; |
18917 |
++ |
18918 |
++ kref_put(&neigh_ifinfo->refcount, batadv_neigh_ifinfo_release); |
18919 |
++} |
18920 |
++ |
18921 |
++/** |
18922 |
++ * batadv_hardif_neigh_put() - decrement the hardif neighbors refcounter |
18923 |
++ * and possibly release it |
18924 |
++ * @hardif_neigh: hardif neigh neighbor to free |
18925 |
++ */ |
18926 |
++static inline void |
18927 |
++batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh) |
18928 |
++{ |
18929 |
++ if (!hardif_neigh) |
18930 |
++ return; |
18931 |
++ |
18932 |
++ kref_put(&hardif_neigh->refcount, batadv_hardif_neigh_release); |
18933 |
++} |
18934 |
++ |
18935 |
++/** |
18936 |
++ * batadv_neigh_node_put() - decrement the neighbors refcounter and possibly |
18937 |
++ * release it |
18938 |
++ * @neigh_node: neigh neighbor to free |
18939 |
++ */ |
18940 |
++static inline void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node) |
18941 |
++{ |
18942 |
++ if (!neigh_node) |
18943 |
++ return; |
18944 |
++ |
18945 |
++ kref_put(&neigh_node->refcount, batadv_neigh_node_release); |
18946 |
++} |
18947 |
++ |
18948 |
++/** |
18949 |
++ * batadv_orig_ifinfo_put() - decrement the refcounter and possibly release |
18950 |
++ * the orig_ifinfo |
18951 |
++ * @orig_ifinfo: the orig_ifinfo object to release |
18952 |
++ */ |
18953 |
++static inline void |
18954 |
++batadv_orig_ifinfo_put(struct batadv_orig_ifinfo *orig_ifinfo) |
18955 |
++{ |
18956 |
++ if (!orig_ifinfo) |
18957 |
++ return; |
18958 |
++ |
18959 |
++ kref_put(&orig_ifinfo->refcount, batadv_orig_ifinfo_release); |
18960 |
++} |
18961 |
++ |
18962 |
++/** |
18963 |
++ * batadv_orig_node_put() - decrement the orig node refcounter and possibly |
18964 |
++ * release it |
18965 |
++ * @orig_node: the orig node to free |
18966 |
++ */ |
18967 |
++static inline void batadv_orig_node_put(struct batadv_orig_node *orig_node) |
18968 |
++{ |
18969 |
++ if (!orig_node) |
18970 |
++ return; |
18971 |
++ |
18972 |
++ kref_put(&orig_node->refcount, batadv_orig_node_release); |
18973 |
++} |
18974 |
++ |
18975 |
+ #endif /* _NET_BATMAN_ADV_ORIGINATOR_H_ */ |
18976 |
+diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c |
18977 |
+index 7496047b318a4..8f7c778255fba 100644 |
18978 |
+--- a/net/batman-adv/soft-interface.c |
18979 |
++++ b/net/batman-adv/soft-interface.c |
18980 |
+@@ -512,7 +512,7 @@ out: |
18981 |
+ * after rcu grace period |
18982 |
+ * @ref: kref pointer of the vlan object |
18983 |
+ */ |
18984 |
+-static void batadv_softif_vlan_release(struct kref *ref) |
18985 |
++void batadv_softif_vlan_release(struct kref *ref) |
18986 |
+ { |
18987 |
+ struct batadv_softif_vlan *vlan; |
18988 |
+ |
18989 |
+@@ -525,19 +525,6 @@ static void batadv_softif_vlan_release(struct kref *ref) |
18990 |
+ kfree_rcu(vlan, rcu); |
18991 |
+ } |
18992 |
+ |
18993 |
+-/** |
18994 |
+- * batadv_softif_vlan_put() - decrease the vlan object refcounter and |
18995 |
+- * possibly release it |
18996 |
+- * @vlan: the vlan object to release |
18997 |
+- */ |
18998 |
+-void batadv_softif_vlan_put(struct batadv_softif_vlan *vlan) |
18999 |
+-{ |
19000 |
+- if (!vlan) |
19001 |
+- return; |
19002 |
+- |
19003 |
+- kref_put(&vlan->refcount, batadv_softif_vlan_release); |
19004 |
+-} |
19005 |
+- |
19006 |
+ /** |
19007 |
+ * batadv_softif_vlan_get() - get the vlan object for a specific vid |
19008 |
+ * @bat_priv: the bat priv with all the soft interface information |
19009 |
+diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h |
19010 |
+index 534e08d6ad919..53aba17b90688 100644 |
19011 |
+--- a/net/batman-adv/soft-interface.h |
19012 |
++++ b/net/batman-adv/soft-interface.h |
19013 |
+@@ -9,6 +9,7 @@ |
19014 |
+ |
19015 |
+ #include "main.h" |
19016 |
+ |
19017 |
++#include <linux/kref.h> |
19018 |
+ #include <linux/netdevice.h> |
19019 |
+ #include <linux/skbuff.h> |
19020 |
+ #include <linux/types.h> |
19021 |
+@@ -24,8 +25,21 @@ void batadv_softif_destroy_sysfs(struct net_device *soft_iface); |
19022 |
+ bool batadv_softif_is_valid(const struct net_device *net_dev); |
19023 |
+ extern struct rtnl_link_ops batadv_link_ops; |
19024 |
+ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid); |
19025 |
+-void batadv_softif_vlan_put(struct batadv_softif_vlan *softif_vlan); |
19026 |
++void batadv_softif_vlan_release(struct kref *ref); |
19027 |
+ struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv, |
19028 |
+ unsigned short vid); |
19029 |
+ |
19030 |
++/** |
19031 |
++ * batadv_softif_vlan_put() - decrease the vlan object refcounter and |
19032 |
++ * possibly release it |
19033 |
++ * @vlan: the vlan object to release |
19034 |
++ */ |
19035 |
++static inline void batadv_softif_vlan_put(struct batadv_softif_vlan *vlan) |
19036 |
++{ |
19037 |
++ if (!vlan) |
19038 |
++ return; |
19039 |
++ |
19040 |
++ kref_put(&vlan->refcount, batadv_softif_vlan_release); |
19041 |
++} |
19042 |
++ |
19043 |
+ #endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */ |
19044 |
+diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c |
19045 |
+index db7e3774825b5..00d62a6c5e0ef 100644 |
19046 |
+--- a/net/batman-adv/tp_meter.c |
19047 |
++++ b/net/batman-adv/tp_meter.c |
19048 |
+@@ -357,6 +357,9 @@ static void batadv_tp_vars_release(struct kref *ref) |
19049 |
+ */ |
19050 |
+ static void batadv_tp_vars_put(struct batadv_tp_vars *tp_vars) |
19051 |
+ { |
19052 |
++ if (!tp_vars) |
19053 |
++ return; |
19054 |
++ |
19055 |
+ kref_put(&tp_vars->refcount, batadv_tp_vars_release); |
19056 |
+ } |
19057 |
+ |
19058 |
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c |
19059 |
+index de946ea8f13c8..5f990a2061072 100644 |
19060 |
+--- a/net/batman-adv/translation-table.c |
19061 |
++++ b/net/batman-adv/translation-table.c |
19062 |
+@@ -248,6 +248,9 @@ static void batadv_tt_local_entry_release(struct kref *ref) |
19063 |
+ static void |
19064 |
+ batadv_tt_local_entry_put(struct batadv_tt_local_entry *tt_local_entry) |
19065 |
+ { |
19066 |
++ if (!tt_local_entry) |
19067 |
++ return; |
19068 |
++ |
19069 |
+ kref_put(&tt_local_entry->common.refcount, |
19070 |
+ batadv_tt_local_entry_release); |
19071 |
+ } |
19072 |
+@@ -271,7 +274,7 @@ static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu) |
19073 |
+ * queue for free after rcu grace period |
19074 |
+ * @ref: kref pointer of the nc_node |
19075 |
+ */ |
19076 |
+-static void batadv_tt_global_entry_release(struct kref *ref) |
19077 |
++void batadv_tt_global_entry_release(struct kref *ref) |
19078 |
+ { |
19079 |
+ struct batadv_tt_global_entry *tt_global_entry; |
19080 |
+ |
19081 |
+@@ -283,17 +286,6 @@ static void batadv_tt_global_entry_release(struct kref *ref) |
19082 |
+ call_rcu(&tt_global_entry->common.rcu, batadv_tt_global_entry_free_rcu); |
19083 |
+ } |
19084 |
+ |
19085 |
+-/** |
19086 |
+- * batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and |
19087 |
+- * possibly release it |
19088 |
+- * @tt_global_entry: tt_global_entry to be free'd |
19089 |
+- */ |
19090 |
+-void batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry) |
19091 |
+-{ |
19092 |
+- kref_put(&tt_global_entry->common.refcount, |
19093 |
+- batadv_tt_global_entry_release); |
19094 |
+-} |
19095 |
+- |
19096 |
+ /** |
19097 |
+ * batadv_tt_global_hash_count() - count the number of orig entries |
19098 |
+ * @bat_priv: the bat priv with all the soft interface information |
19099 |
+@@ -453,6 +445,9 @@ static void batadv_tt_orig_list_entry_release(struct kref *ref) |
19100 |
+ static void |
19101 |
+ batadv_tt_orig_list_entry_put(struct batadv_tt_orig_list_entry *orig_entry) |
19102 |
+ { |
19103 |
++ if (!orig_entry) |
19104 |
++ return; |
19105 |
++ |
19106 |
+ kref_put(&orig_entry->refcount, batadv_tt_orig_list_entry_release); |
19107 |
+ } |
19108 |
+ |
19109 |
+@@ -2818,6 +2813,9 @@ static void batadv_tt_req_node_release(struct kref *ref) |
19110 |
+ */ |
19111 |
+ static void batadv_tt_req_node_put(struct batadv_tt_req_node *tt_req_node) |
19112 |
+ { |
19113 |
++ if (!tt_req_node) |
19114 |
++ return; |
19115 |
++ |
19116 |
+ kref_put(&tt_req_node->refcount, batadv_tt_req_node_release); |
19117 |
+ } |
19118 |
+ |
19119 |
+diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h |
19120 |
+index b24d35b9226a1..63cc8fd3ff66a 100644 |
19121 |
+--- a/net/batman-adv/translation-table.h |
19122 |
++++ b/net/batman-adv/translation-table.h |
19123 |
+@@ -9,6 +9,7 @@ |
19124 |
+ |
19125 |
+ #include "main.h" |
19126 |
+ |
19127 |
++#include <linux/kref.h> |
19128 |
+ #include <linux/netdevice.h> |
19129 |
+ #include <linux/netlink.h> |
19130 |
+ #include <linux/seq_file.h> |
19131 |
+@@ -31,7 +32,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, |
19132 |
+ struct batadv_tt_global_entry * |
19133 |
+ batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr, |
19134 |
+ unsigned short vid); |
19135 |
+-void batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry); |
19136 |
++void batadv_tt_global_entry_release(struct kref *ref); |
19137 |
+ int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, |
19138 |
+ const u8 *addr, unsigned short vid); |
19139 |
+ struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, |
19140 |
+@@ -58,4 +59,19 @@ bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, |
19141 |
+ int batadv_tt_cache_init(void); |
19142 |
+ void batadv_tt_cache_destroy(void); |
19143 |
+ |
19144 |
++/** |
19145 |
++ * batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and |
19146 |
++ * possibly release it |
19147 |
++ * @tt_global_entry: tt_global_entry to be free'd |
19148 |
++ */ |
19149 |
++static inline void |
19150 |
++batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry) |
19151 |
++{ |
19152 |
++ if (!tt_global_entry) |
19153 |
++ return; |
19154 |
++ |
19155 |
++ kref_put(&tt_global_entry->common.refcount, |
19156 |
++ batadv_tt_global_entry_release); |
19157 |
++} |
19158 |
++ |
19159 |
+ #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ |
19160 |
+diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c |
19161 |
+index 6a23a566cde17..99fc48efde543 100644 |
19162 |
+--- a/net/batman-adv/tvlv.c |
19163 |
++++ b/net/batman-adv/tvlv.c |
19164 |
+@@ -50,6 +50,9 @@ static void batadv_tvlv_handler_release(struct kref *ref) |
19165 |
+ */ |
19166 |
+ static void batadv_tvlv_handler_put(struct batadv_tvlv_handler *tvlv_handler) |
19167 |
+ { |
19168 |
++ if (!tvlv_handler) |
19169 |
++ return; |
19170 |
++ |
19171 |
+ kref_put(&tvlv_handler->refcount, batadv_tvlv_handler_release); |
19172 |
+ } |
19173 |
+ |
19174 |
+@@ -106,6 +109,9 @@ static void batadv_tvlv_container_release(struct kref *ref) |
19175 |
+ */ |
19176 |
+ static void batadv_tvlv_container_put(struct batadv_tvlv_container *tvlv) |
19177 |
+ { |
19178 |
++ if (!tvlv) |
19179 |
++ return; |
19180 |
++ |
19181 |
+ kref_put(&tvlv->refcount, batadv_tvlv_container_release); |
19182 |
+ } |
19183 |
+ |
19184 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
19185 |
+index 1c5a0a60292d2..ecd2ffcf2ba28 100644 |
19186 |
+--- a/net/bluetooth/hci_conn.c |
19187 |
++++ b/net/bluetooth/hci_conn.c |
19188 |
+@@ -508,7 +508,9 @@ static void le_conn_timeout(struct work_struct *work) |
19189 |
+ if (conn->role == HCI_ROLE_SLAVE) { |
19190 |
+ /* Disable LE Advertising */ |
19191 |
+ le_disable_advertising(hdev); |
19192 |
++ hci_dev_lock(hdev); |
19193 |
+ hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT); |
19194 |
++ hci_dev_unlock(hdev); |
19195 |
+ return; |
19196 |
+ } |
19197 |
+ |
19198 |
+diff --git a/net/can/isotp.c b/net/can/isotp.c |
19199 |
+index d0581dc6a65fd..63e6e8923200b 100644 |
19200 |
+--- a/net/can/isotp.c |
19201 |
++++ b/net/can/isotp.c |
19202 |
+@@ -1003,26 +1003,29 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, |
19203 |
+ { |
19204 |
+ struct sock *sk = sock->sk; |
19205 |
+ struct sk_buff *skb; |
19206 |
+- int err = 0; |
19207 |
+- int noblock; |
19208 |
++ struct isotp_sock *so = isotp_sk(sk); |
19209 |
++ int noblock = flags & MSG_DONTWAIT; |
19210 |
++ int ret = 0; |
19211 |
+ |
19212 |
+- noblock = flags & MSG_DONTWAIT; |
19213 |
+- flags &= ~MSG_DONTWAIT; |
19214 |
++ if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK)) |
19215 |
++ return -EINVAL; |
19216 |
+ |
19217 |
+- skb = skb_recv_datagram(sk, flags, noblock, &err); |
19218 |
++ if (!so->bound) |
19219 |
++ return -EADDRNOTAVAIL; |
19220 |
++ |
19221 |
++ flags &= ~MSG_DONTWAIT; |
19222 |
++ skb = skb_recv_datagram(sk, flags, noblock, &ret); |
19223 |
+ if (!skb) |
19224 |
+- return err; |
19225 |
++ return ret; |
19226 |
+ |
19227 |
+ if (size < skb->len) |
19228 |
+ msg->msg_flags |= MSG_TRUNC; |
19229 |
+ else |
19230 |
+ size = skb->len; |
19231 |
+ |
19232 |
+- err = memcpy_to_msg(msg, skb->data, size); |
19233 |
+- if (err < 0) { |
19234 |
+- skb_free_datagram(sk, skb); |
19235 |
+- return err; |
19236 |
+- } |
19237 |
++ ret = memcpy_to_msg(msg, skb->data, size); |
19238 |
++ if (ret < 0) |
19239 |
++ goto out_err; |
19240 |
+ |
19241 |
+ sock_recv_timestamp(msg, sk, skb); |
19242 |
+ |
19243 |
+@@ -1032,9 +1035,13 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, |
19244 |
+ memcpy(msg->msg_name, skb->cb, msg->msg_namelen); |
19245 |
+ } |
19246 |
+ |
19247 |
++ /* set length of return value */ |
19248 |
++ ret = (flags & MSG_TRUNC) ? skb->len : size; |
19249 |
++ |
19250 |
++out_err: |
19251 |
+ skb_free_datagram(sk, skb); |
19252 |
+ |
19253 |
+- return size; |
19254 |
++ return ret; |
19255 |
+ } |
19256 |
+ |
19257 |
+ static int isotp_release(struct socket *sock) |
19258 |
+@@ -1102,6 +1109,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
19259 |
+ struct net *net = sock_net(sk); |
19260 |
+ int ifindex; |
19261 |
+ struct net_device *dev; |
19262 |
++ canid_t tx_id, rx_id; |
19263 |
+ int err = 0; |
19264 |
+ int notify_enetdown = 0; |
19265 |
+ int do_rx_reg = 1; |
19266 |
+@@ -1109,8 +1117,18 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
19267 |
+ if (len < ISOTP_MIN_NAMELEN) |
19268 |
+ return -EINVAL; |
19269 |
+ |
19270 |
+- if (addr->can_addr.tp.tx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) |
19271 |
+- return -EADDRNOTAVAIL; |
19272 |
++ /* sanitize tx/rx CAN identifiers */ |
19273 |
++ tx_id = addr->can_addr.tp.tx_id; |
19274 |
++ if (tx_id & CAN_EFF_FLAG) |
19275 |
++ tx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); |
19276 |
++ else |
19277 |
++ tx_id &= CAN_SFF_MASK; |
19278 |
++ |
19279 |
++ rx_id = addr->can_addr.tp.rx_id; |
19280 |
++ if (rx_id & CAN_EFF_FLAG) |
19281 |
++ rx_id &= (CAN_EFF_FLAG | CAN_EFF_MASK); |
19282 |
++ else |
19283 |
++ rx_id &= CAN_SFF_MASK; |
19284 |
+ |
19285 |
+ if (!addr->can_ifindex) |
19286 |
+ return -ENODEV; |
19287 |
+@@ -1122,21 +1140,13 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
19288 |
+ do_rx_reg = 0; |
19289 |
+ |
19290 |
+ /* do not validate rx address for functional addressing */ |
19291 |
+- if (do_rx_reg) { |
19292 |
+- if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) { |
19293 |
+- err = -EADDRNOTAVAIL; |
19294 |
+- goto out; |
19295 |
+- } |
19296 |
+- |
19297 |
+- if (addr->can_addr.tp.rx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) { |
19298 |
+- err = -EADDRNOTAVAIL; |
19299 |
+- goto out; |
19300 |
+- } |
19301 |
++ if (do_rx_reg && rx_id == tx_id) { |
19302 |
++ err = -EADDRNOTAVAIL; |
19303 |
++ goto out; |
19304 |
+ } |
19305 |
+ |
19306 |
+ if (so->bound && addr->can_ifindex == so->ifindex && |
19307 |
+- addr->can_addr.tp.rx_id == so->rxid && |
19308 |
+- addr->can_addr.tp.tx_id == so->txid) |
19309 |
++ rx_id == so->rxid && tx_id == so->txid) |
19310 |
+ goto out; |
19311 |
+ |
19312 |
+ dev = dev_get_by_index(net, addr->can_ifindex); |
19313 |
+@@ -1160,8 +1170,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
19314 |
+ ifindex = dev->ifindex; |
19315 |
+ |
19316 |
+ if (do_rx_reg) |
19317 |
+- can_rx_register(net, dev, addr->can_addr.tp.rx_id, |
19318 |
+- SINGLE_MASK(addr->can_addr.tp.rx_id), |
19319 |
++ can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id), |
19320 |
+ isotp_rcv, sk, "isotp", sk); |
19321 |
+ |
19322 |
+ dev_put(dev); |
19323 |
+@@ -1181,8 +1190,8 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
19324 |
+ |
19325 |
+ /* switch to new settings */ |
19326 |
+ so->ifindex = ifindex; |
19327 |
+- so->rxid = addr->can_addr.tp.rx_id; |
19328 |
+- so->txid = addr->can_addr.tp.tx_id; |
19329 |
++ so->rxid = rx_id; |
19330 |
++ so->txid = tx_id; |
19331 |
+ so->bound = 1; |
19332 |
+ |
19333 |
+ out: |
19334 |
+diff --git a/net/core/skmsg.c b/net/core/skmsg.c |
19335 |
+index e4bb89599b44b..545181a1ae043 100644 |
19336 |
+--- a/net/core/skmsg.c |
19337 |
++++ b/net/core/skmsg.c |
19338 |
+@@ -27,6 +27,7 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, |
19339 |
+ int elem_first_coalesce) |
19340 |
+ { |
19341 |
+ struct page_frag *pfrag = sk_page_frag(sk); |
19342 |
++ u32 osize = msg->sg.size; |
19343 |
+ int ret = 0; |
19344 |
+ |
19345 |
+ len -= msg->sg.size; |
19346 |
+@@ -35,13 +36,17 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, |
19347 |
+ u32 orig_offset; |
19348 |
+ int use, i; |
19349 |
+ |
19350 |
+- if (!sk_page_frag_refill(sk, pfrag)) |
19351 |
+- return -ENOMEM; |
19352 |
++ if (!sk_page_frag_refill(sk, pfrag)) { |
19353 |
++ ret = -ENOMEM; |
19354 |
++ goto msg_trim; |
19355 |
++ } |
19356 |
+ |
19357 |
+ orig_offset = pfrag->offset; |
19358 |
+ use = min_t(int, len, pfrag->size - orig_offset); |
19359 |
+- if (!sk_wmem_schedule(sk, use)) |
19360 |
+- return -ENOMEM; |
19361 |
++ if (!sk_wmem_schedule(sk, use)) { |
19362 |
++ ret = -ENOMEM; |
19363 |
++ goto msg_trim; |
19364 |
++ } |
19365 |
+ |
19366 |
+ i = msg->sg.end; |
19367 |
+ sk_msg_iter_var_prev(i); |
19368 |
+@@ -71,6 +76,10 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, |
19369 |
+ } |
19370 |
+ |
19371 |
+ return ret; |
19372 |
++ |
19373 |
++msg_trim: |
19374 |
++ sk_msg_trim(sk, msg, osize); |
19375 |
++ return ret; |
19376 |
+ } |
19377 |
+ EXPORT_SYMBOL_GPL(sk_msg_alloc); |
19378 |
+ |
19379 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
19380 |
+index ce787c3867938..c72d0de8bf714 100644 |
19381 |
+--- a/net/ipv4/route.c |
19382 |
++++ b/net/ipv4/route.c |
19383 |
+@@ -529,6 +529,15 @@ void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) |
19384 |
+ } |
19385 |
+ EXPORT_SYMBOL(__ip_select_ident); |
19386 |
+ |
19387 |
++static void ip_rt_fix_tos(struct flowi4 *fl4) |
19388 |
++{ |
19389 |
++ __u8 tos = RT_FL_TOS(fl4); |
19390 |
++ |
19391 |
++ fl4->flowi4_tos = tos & IPTOS_RT_MASK; |
19392 |
++ fl4->flowi4_scope = tos & RTO_ONLINK ? |
19393 |
++ RT_SCOPE_LINK : RT_SCOPE_UNIVERSE; |
19394 |
++} |
19395 |
++ |
19396 |
+ static void __build_flow_key(const struct net *net, struct flowi4 *fl4, |
19397 |
+ const struct sock *sk, |
19398 |
+ const struct iphdr *iph, |
19399 |
+@@ -853,6 +862,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf |
19400 |
+ rt = (struct rtable *) dst; |
19401 |
+ |
19402 |
+ __build_flow_key(net, &fl4, sk, iph, oif, tos, prot, mark, 0); |
19403 |
++ ip_rt_fix_tos(&fl4); |
19404 |
+ __ip_do_redirect(rt, skb, &fl4, true); |
19405 |
+ } |
19406 |
+ |
19407 |
+@@ -1077,6 +1087,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
19408 |
+ struct flowi4 fl4; |
19409 |
+ |
19410 |
+ ip_rt_build_flow_key(&fl4, sk, skb); |
19411 |
++ ip_rt_fix_tos(&fl4); |
19412 |
+ |
19413 |
+ /* Don't make lookup fail for bridged encapsulations */ |
19414 |
+ if (skb && netif_is_any_bridge_port(skb->dev)) |
19415 |
+@@ -1151,6 +1162,8 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) |
19416 |
+ goto out; |
19417 |
+ |
19418 |
+ new = true; |
19419 |
++ } else { |
19420 |
++ ip_rt_fix_tos(&fl4); |
19421 |
+ } |
19422 |
+ |
19423 |
+ __ip_rt_update_pmtu((struct rtable *)xfrm_dst_path(&rt->dst), &fl4, mtu); |
19424 |
+@@ -2524,7 +2537,6 @@ add: |
19425 |
+ struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4, |
19426 |
+ const struct sk_buff *skb) |
19427 |
+ { |
19428 |
+- __u8 tos = RT_FL_TOS(fl4); |
19429 |
+ struct fib_result res = { |
19430 |
+ .type = RTN_UNSPEC, |
19431 |
+ .fi = NULL, |
19432 |
+@@ -2534,9 +2546,7 @@ struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4, |
19433 |
+ struct rtable *rth; |
19434 |
+ |
19435 |
+ fl4->flowi4_iif = LOOPBACK_IFINDEX; |
19436 |
+- fl4->flowi4_tos = tos & IPTOS_RT_MASK; |
19437 |
+- fl4->flowi4_scope = ((tos & RTO_ONLINK) ? |
19438 |
+- RT_SCOPE_LINK : RT_SCOPE_UNIVERSE); |
19439 |
++ ip_rt_fix_tos(fl4); |
19440 |
+ |
19441 |
+ rcu_read_lock(); |
19442 |
+ rth = ip_route_output_key_hash_rcu(net, fl4, &res, skb); |
19443 |
+diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
19444 |
+index 6b745ce4108c8..eaf2308c355a6 100644 |
19445 |
+--- a/net/ipv4/tcp_bpf.c |
19446 |
++++ b/net/ipv4/tcp_bpf.c |
19447 |
+@@ -218,10 +218,9 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg, |
19448 |
+ struct sk_psock *psock = sk_psock_get(sk); |
19449 |
+ int ret; |
19450 |
+ |
19451 |
+- if (unlikely(!psock)) { |
19452 |
+- sk_msg_free(sk, msg); |
19453 |
+- return 0; |
19454 |
+- } |
19455 |
++ if (unlikely(!psock)) |
19456 |
++ return -EPIPE; |
19457 |
++ |
19458 |
+ ret = ingress ? bpf_tcp_ingress(sk, psock, msg, bytes, flags) : |
19459 |
+ tcp_bpf_push_locked(sk, msg, bytes, flags, false); |
19460 |
+ sk_psock_put(sk, psock); |
19461 |
+@@ -371,7 +370,7 @@ more_data: |
19462 |
+ cork = true; |
19463 |
+ psock->cork = NULL; |
19464 |
+ } |
19465 |
+- sk_msg_return(sk, msg, tosend); |
19466 |
++ sk_msg_return(sk, msg, msg->sg.size); |
19467 |
+ release_sock(sk); |
19468 |
+ |
19469 |
+ ret = tcp_bpf_sendmsg_redir(sk_redir, msg, tosend, flags); |
19470 |
+@@ -411,8 +410,11 @@ more_data: |
19471 |
+ } |
19472 |
+ if (msg && |
19473 |
+ msg->sg.data[msg->sg.start].page_link && |
19474 |
+- msg->sg.data[msg->sg.start].length) |
19475 |
++ msg->sg.data[msg->sg.start].length) { |
19476 |
++ if (eval == __SK_REDIRECT) |
19477 |
++ sk_mem_charge(sk, msg->sg.size); |
19478 |
+ goto more_data; |
19479 |
++ } |
19480 |
+ } |
19481 |
+ return ret; |
19482 |
+ } |
19483 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
19484 |
+index 19ef4577b70d6..ce9987e6ff252 100644 |
19485 |
+--- a/net/ipv4/tcp_output.c |
19486 |
++++ b/net/ipv4/tcp_output.c |
19487 |
+@@ -3733,6 +3733,7 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb) |
19488 |
+ */ |
19489 |
+ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) |
19490 |
+ { |
19491 |
++ struct inet_connection_sock *icsk = inet_csk(sk); |
19492 |
+ struct tcp_sock *tp = tcp_sk(sk); |
19493 |
+ struct tcp_fastopen_request *fo = tp->fastopen_req; |
19494 |
+ int space, err = 0; |
19495 |
+@@ -3747,8 +3748,10 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) |
19496 |
+ * private TCP options. The cost is reduced data space in SYN :( |
19497 |
+ */ |
19498 |
+ tp->rx_opt.mss_clamp = tcp_mss_clamp(tp, tp->rx_opt.mss_clamp); |
19499 |
++ /* Sync mss_cache after updating the mss_clamp */ |
19500 |
++ tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); |
19501 |
+ |
19502 |
+- space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - |
19503 |
++ space = __tcp_mtu_to_mss(sk, icsk->icsk_pmtu_cookie) - |
19504 |
+ MAX_TCP_OPTION_SPACE; |
19505 |
+ |
19506 |
+ space = min_t(size_t, space, fo->size); |
19507 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
19508 |
+index ef2068a60d4ad..e97a2dd206e14 100644 |
19509 |
+--- a/net/ipv4/udp.c |
19510 |
++++ b/net/ipv4/udp.c |
19511 |
+@@ -598,6 +598,12 @@ void udp_encap_enable(void) |
19512 |
+ } |
19513 |
+ EXPORT_SYMBOL(udp_encap_enable); |
19514 |
+ |
19515 |
++void udp_encap_disable(void) |
19516 |
++{ |
19517 |
++ static_branch_dec(&udp_encap_needed_key); |
19518 |
++} |
19519 |
++EXPORT_SYMBOL(udp_encap_disable); |
19520 |
++ |
19521 |
+ /* Handler for tunnels with arbitrary destination ports: no socket lookup, go |
19522 |
+ * through error handlers in encapsulations looking for a match. |
19523 |
+ */ |
19524 |
+diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
19525 |
+index 069551a04369e..10760164a80f4 100644 |
19526 |
+--- a/net/ipv6/udp.c |
19527 |
++++ b/net/ipv6/udp.c |
19528 |
+@@ -1610,8 +1610,10 @@ void udpv6_destroy_sock(struct sock *sk) |
19529 |
+ if (encap_destroy) |
19530 |
+ encap_destroy(sk); |
19531 |
+ } |
19532 |
+- if (up->encap_enabled) |
19533 |
++ if (up->encap_enabled) { |
19534 |
+ static_branch_dec(&udpv6_encap_needed_key); |
19535 |
++ udp_encap_disable(); |
19536 |
++ } |
19537 |
+ } |
19538 |
+ |
19539 |
+ inet6_destroy_sock(sk); |
19540 |
+diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c |
19541 |
+index 6abb45a671994..ee349c2438782 100644 |
19542 |
+--- a/net/ipv6/xfrm6_output.c |
19543 |
++++ b/net/ipv6/xfrm6_output.c |
19544 |
+@@ -52,6 +52,19 @@ static int __xfrm6_output_finish(struct net *net, struct sock *sk, struct sk_buf |
19545 |
+ return xfrm_output(sk, skb); |
19546 |
+ } |
19547 |
+ |
19548 |
++static int xfrm6_noneed_fragment(struct sk_buff *skb) |
19549 |
++{ |
19550 |
++ struct frag_hdr *fh; |
19551 |
++ u8 prevhdr = ipv6_hdr(skb)->nexthdr; |
19552 |
++ |
19553 |
++ if (prevhdr != NEXTHDR_FRAGMENT) |
19554 |
++ return 0; |
19555 |
++ fh = (struct frag_hdr *)(skb->data + sizeof(struct ipv6hdr)); |
19556 |
++ if (fh->nexthdr == NEXTHDR_ESP || fh->nexthdr == NEXTHDR_AUTH) |
19557 |
++ return 1; |
19558 |
++ return 0; |
19559 |
++} |
19560 |
++ |
19561 |
+ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) |
19562 |
+ { |
19563 |
+ struct dst_entry *dst = skb_dst(skb); |
19564 |
+@@ -80,6 +93,9 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) |
19565 |
+ xfrm6_local_rxpmtu(skb, mtu); |
19566 |
+ kfree_skb(skb); |
19567 |
+ return -EMSGSIZE; |
19568 |
++ } else if (toobig && xfrm6_noneed_fragment(skb)) { |
19569 |
++ skb->ignore_df = 1; |
19570 |
++ goto skip_frag; |
19571 |
+ } else if (!skb->ignore_df && toobig && skb->sk) { |
19572 |
+ xfrm_local_error(skb, mtu); |
19573 |
+ kfree_skb(skb); |
19574 |
+diff --git a/net/key/af_key.c b/net/key/af_key.c |
19575 |
+index d1364b858fdf0..bd9b5c573b5a4 100644 |
19576 |
+--- a/net/key/af_key.c |
19577 |
++++ b/net/key/af_key.c |
19578 |
+@@ -1703,7 +1703,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad |
19579 |
+ |
19580 |
+ xfrm_probe_algs(); |
19581 |
+ |
19582 |
+- supp_skb = compose_sadb_supported(hdr, GFP_KERNEL); |
19583 |
++ supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO); |
19584 |
+ if (!supp_skb) { |
19585 |
+ if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) |
19586 |
+ pfk->registered &= ~(1<<hdr->sadb_msg_satype); |
19587 |
+diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c |
19588 |
+index c8fb2187ad4b2..3f785bdfa942d 100644 |
19589 |
+--- a/net/netfilter/nf_conntrack_proto_tcp.c |
19590 |
++++ b/net/netfilter/nf_conntrack_proto_tcp.c |
19591 |
+@@ -354,8 +354,8 @@ static void tcp_options(const struct sk_buff *skb, |
19592 |
+ length, buff); |
19593 |
+ BUG_ON(ptr == NULL); |
19594 |
+ |
19595 |
+- state->td_scale = |
19596 |
+- state->flags = 0; |
19597 |
++ state->td_scale = 0; |
19598 |
++ state->flags &= IP_CT_TCP_FLAG_BE_LIBERAL; |
19599 |
+ |
19600 |
+ while (length > 0) { |
19601 |
+ int opcode=*ptr++; |
19602 |
+@@ -840,6 +840,16 @@ static bool nf_conntrack_tcp_established(const struct nf_conn *ct) |
19603 |
+ test_bit(IPS_ASSURED_BIT, &ct->status); |
19604 |
+ } |
19605 |
+ |
19606 |
++static void nf_ct_tcp_state_reset(struct ip_ct_tcp_state *state) |
19607 |
++{ |
19608 |
++ state->td_end = 0; |
19609 |
++ state->td_maxend = 0; |
19610 |
++ state->td_maxwin = 0; |
19611 |
++ state->td_maxack = 0; |
19612 |
++ state->td_scale = 0; |
19613 |
++ state->flags &= IP_CT_TCP_FLAG_BE_LIBERAL; |
19614 |
++} |
19615 |
++ |
19616 |
+ /* Returns verdict for packet, or -1 for invalid. */ |
19617 |
+ int nf_conntrack_tcp_packet(struct nf_conn *ct, |
19618 |
+ struct sk_buff *skb, |
19619 |
+@@ -946,8 +956,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, |
19620 |
+ ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; |
19621 |
+ ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = |
19622 |
+ ct->proto.tcp.last_flags; |
19623 |
+- memset(&ct->proto.tcp.seen[dir], 0, |
19624 |
+- sizeof(struct ip_ct_tcp_state)); |
19625 |
++ nf_ct_tcp_state_reset(&ct->proto.tcp.seen[dir]); |
19626 |
+ break; |
19627 |
+ } |
19628 |
+ ct->proto.tcp.last_index = index; |
19629 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
19630 |
+index e55af5c078ac0..f37916156ca52 100644 |
19631 |
+--- a/net/netlink/af_netlink.c |
19632 |
++++ b/net/netlink/af_netlink.c |
19633 |
+@@ -149,6 +149,8 @@ static const struct rhashtable_params netlink_rhashtable_params; |
19634 |
+ |
19635 |
+ static inline u32 netlink_group_mask(u32 group) |
19636 |
+ { |
19637 |
++ if (group > 32) |
19638 |
++ return 0; |
19639 |
+ return group ? 1 << (group - 1) : 0; |
19640 |
+ } |
19641 |
+ |
19642 |
+diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c |
19643 |
+index a11b558813c10..7ff98d39ec942 100644 |
19644 |
+--- a/net/openvswitch/conntrack.c |
19645 |
++++ b/net/openvswitch/conntrack.c |
19646 |
+@@ -730,6 +730,57 @@ static bool skb_nfct_cached(struct net *net, |
19647 |
+ } |
19648 |
+ |
19649 |
+ #if IS_ENABLED(CONFIG_NF_NAT) |
19650 |
++static void ovs_nat_update_key(struct sw_flow_key *key, |
19651 |
++ const struct sk_buff *skb, |
19652 |
++ enum nf_nat_manip_type maniptype) |
19653 |
++{ |
19654 |
++ if (maniptype == NF_NAT_MANIP_SRC) { |
19655 |
++ __be16 src; |
19656 |
++ |
19657 |
++ key->ct_state |= OVS_CS_F_SRC_NAT; |
19658 |
++ if (key->eth.type == htons(ETH_P_IP)) |
19659 |
++ key->ipv4.addr.src = ip_hdr(skb)->saddr; |
19660 |
++ else if (key->eth.type == htons(ETH_P_IPV6)) |
19661 |
++ memcpy(&key->ipv6.addr.src, &ipv6_hdr(skb)->saddr, |
19662 |
++ sizeof(key->ipv6.addr.src)); |
19663 |
++ else |
19664 |
++ return; |
19665 |
++ |
19666 |
++ if (key->ip.proto == IPPROTO_UDP) |
19667 |
++ src = udp_hdr(skb)->source; |
19668 |
++ else if (key->ip.proto == IPPROTO_TCP) |
19669 |
++ src = tcp_hdr(skb)->source; |
19670 |
++ else if (key->ip.proto == IPPROTO_SCTP) |
19671 |
++ src = sctp_hdr(skb)->source; |
19672 |
++ else |
19673 |
++ return; |
19674 |
++ |
19675 |
++ key->tp.src = src; |
19676 |
++ } else { |
19677 |
++ __be16 dst; |
19678 |
++ |
19679 |
++ key->ct_state |= OVS_CS_F_DST_NAT; |
19680 |
++ if (key->eth.type == htons(ETH_P_IP)) |
19681 |
++ key->ipv4.addr.dst = ip_hdr(skb)->daddr; |
19682 |
++ else if (key->eth.type == htons(ETH_P_IPV6)) |
19683 |
++ memcpy(&key->ipv6.addr.dst, &ipv6_hdr(skb)->daddr, |
19684 |
++ sizeof(key->ipv6.addr.dst)); |
19685 |
++ else |
19686 |
++ return; |
19687 |
++ |
19688 |
++ if (key->ip.proto == IPPROTO_UDP) |
19689 |
++ dst = udp_hdr(skb)->dest; |
19690 |
++ else if (key->ip.proto == IPPROTO_TCP) |
19691 |
++ dst = tcp_hdr(skb)->dest; |
19692 |
++ else if (key->ip.proto == IPPROTO_SCTP) |
19693 |
++ dst = sctp_hdr(skb)->dest; |
19694 |
++ else |
19695 |
++ return; |
19696 |
++ |
19697 |
++ key->tp.dst = dst; |
19698 |
++ } |
19699 |
++} |
19700 |
++ |
19701 |
+ /* Modelled after nf_nat_ipv[46]_fn(). |
19702 |
+ * range is only used for new, uninitialized NAT state. |
19703 |
+ * Returns either NF_ACCEPT or NF_DROP. |
19704 |
+@@ -737,7 +788,7 @@ static bool skb_nfct_cached(struct net *net, |
19705 |
+ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, |
19706 |
+ enum ip_conntrack_info ctinfo, |
19707 |
+ const struct nf_nat_range2 *range, |
19708 |
+- enum nf_nat_manip_type maniptype) |
19709 |
++ enum nf_nat_manip_type maniptype, struct sw_flow_key *key) |
19710 |
+ { |
19711 |
+ int hooknum, nh_off, err = NF_ACCEPT; |
19712 |
+ |
19713 |
+@@ -810,58 +861,11 @@ push: |
19714 |
+ skb_push(skb, nh_off); |
19715 |
+ skb_postpush_rcsum(skb, skb->data, nh_off); |
19716 |
+ |
19717 |
+- return err; |
19718 |
+-} |
19719 |
+- |
19720 |
+-static void ovs_nat_update_key(struct sw_flow_key *key, |
19721 |
+- const struct sk_buff *skb, |
19722 |
+- enum nf_nat_manip_type maniptype) |
19723 |
+-{ |
19724 |
+- if (maniptype == NF_NAT_MANIP_SRC) { |
19725 |
+- __be16 src; |
19726 |
+- |
19727 |
+- key->ct_state |= OVS_CS_F_SRC_NAT; |
19728 |
+- if (key->eth.type == htons(ETH_P_IP)) |
19729 |
+- key->ipv4.addr.src = ip_hdr(skb)->saddr; |
19730 |
+- else if (key->eth.type == htons(ETH_P_IPV6)) |
19731 |
+- memcpy(&key->ipv6.addr.src, &ipv6_hdr(skb)->saddr, |
19732 |
+- sizeof(key->ipv6.addr.src)); |
19733 |
+- else |
19734 |
+- return; |
19735 |
+- |
19736 |
+- if (key->ip.proto == IPPROTO_UDP) |
19737 |
+- src = udp_hdr(skb)->source; |
19738 |
+- else if (key->ip.proto == IPPROTO_TCP) |
19739 |
+- src = tcp_hdr(skb)->source; |
19740 |
+- else if (key->ip.proto == IPPROTO_SCTP) |
19741 |
+- src = sctp_hdr(skb)->source; |
19742 |
+- else |
19743 |
+- return; |
19744 |
+- |
19745 |
+- key->tp.src = src; |
19746 |
+- } else { |
19747 |
+- __be16 dst; |
19748 |
+- |
19749 |
+- key->ct_state |= OVS_CS_F_DST_NAT; |
19750 |
+- if (key->eth.type == htons(ETH_P_IP)) |
19751 |
+- key->ipv4.addr.dst = ip_hdr(skb)->daddr; |
19752 |
+- else if (key->eth.type == htons(ETH_P_IPV6)) |
19753 |
+- memcpy(&key->ipv6.addr.dst, &ipv6_hdr(skb)->daddr, |
19754 |
+- sizeof(key->ipv6.addr.dst)); |
19755 |
+- else |
19756 |
+- return; |
19757 |
+- |
19758 |
+- if (key->ip.proto == IPPROTO_UDP) |
19759 |
+- dst = udp_hdr(skb)->dest; |
19760 |
+- else if (key->ip.proto == IPPROTO_TCP) |
19761 |
+- dst = tcp_hdr(skb)->dest; |
19762 |
+- else if (key->ip.proto == IPPROTO_SCTP) |
19763 |
+- dst = sctp_hdr(skb)->dest; |
19764 |
+- else |
19765 |
+- return; |
19766 |
++ /* Update the flow key if NAT successful. */ |
19767 |
++ if (err == NF_ACCEPT) |
19768 |
++ ovs_nat_update_key(key, skb, maniptype); |
19769 |
+ |
19770 |
+- key->tp.dst = dst; |
19771 |
+- } |
19772 |
++ return err; |
19773 |
+ } |
19774 |
+ |
19775 |
+ /* Returns NF_DROP if the packet should be dropped, NF_ACCEPT otherwise. */ |
19776 |
+@@ -903,7 +907,7 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, |
19777 |
+ } else { |
19778 |
+ return NF_ACCEPT; /* Connection is not NATed. */ |
19779 |
+ } |
19780 |
+- err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); |
19781 |
++ err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype, key); |
19782 |
+ |
19783 |
+ if (err == NF_ACCEPT && ct->status & IPS_DST_NAT) { |
19784 |
+ if (ct->status & IPS_SRC_NAT) { |
19785 |
+@@ -913,17 +917,13 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, |
19786 |
+ maniptype = NF_NAT_MANIP_SRC; |
19787 |
+ |
19788 |
+ err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, |
19789 |
+- maniptype); |
19790 |
++ maniptype, key); |
19791 |
+ } else if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) { |
19792 |
+ err = ovs_ct_nat_execute(skb, ct, ctinfo, NULL, |
19793 |
+- NF_NAT_MANIP_SRC); |
19794 |
++ NF_NAT_MANIP_SRC, key); |
19795 |
+ } |
19796 |
+ } |
19797 |
+ |
19798 |
+- /* Mark NAT done if successful and update the flow key. */ |
19799 |
+- if (err == NF_ACCEPT) |
19800 |
+- ovs_nat_update_key(key, skb, maniptype); |
19801 |
+- |
19802 |
+ return err; |
19803 |
+ } |
19804 |
+ #else /* !CONFIG_NF_NAT */ |
19805 |
+diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c |
19806 |
+index 4c5c2331e7648..8c4bdfa627ca9 100644 |
19807 |
+--- a/net/openvswitch/flow_netlink.c |
19808 |
++++ b/net/openvswitch/flow_netlink.c |
19809 |
+@@ -2201,8 +2201,8 @@ static int __ovs_nla_put_key(const struct sw_flow_key *swkey, |
19810 |
+ icmpv6_key->icmpv6_type = ntohs(output->tp.src); |
19811 |
+ icmpv6_key->icmpv6_code = ntohs(output->tp.dst); |
19812 |
+ |
19813 |
+- if (icmpv6_key->icmpv6_type == NDISC_NEIGHBOUR_SOLICITATION || |
19814 |
+- icmpv6_key->icmpv6_type == NDISC_NEIGHBOUR_ADVERTISEMENT) { |
19815 |
++ if (swkey->tp.src == htons(NDISC_NEIGHBOUR_SOLICITATION) || |
19816 |
++ swkey->tp.src == htons(NDISC_NEIGHBOUR_ADVERTISEMENT)) { |
19817 |
+ struct ovs_key_nd *nd_key; |
19818 |
+ |
19819 |
+ nla = nla_reserve(skb, OVS_KEY_ATTR_ND, sizeof(*nd_key)); |
19820 |
+diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h |
19821 |
+index dce48162f6c27..3bad9f5f91023 100644 |
19822 |
+--- a/net/rxrpc/ar-internal.h |
19823 |
++++ b/net/rxrpc/ar-internal.h |
19824 |
+@@ -760,14 +760,12 @@ void rxrpc_propose_ACK(struct rxrpc_call *, u8, u32, bool, bool, |
19825 |
+ enum rxrpc_propose_ack_trace); |
19826 |
+ void rxrpc_process_call(struct work_struct *); |
19827 |
+ |
19828 |
+-static inline void rxrpc_reduce_call_timer(struct rxrpc_call *call, |
19829 |
+- unsigned long expire_at, |
19830 |
+- unsigned long now, |
19831 |
+- enum rxrpc_timer_trace why) |
19832 |
+-{ |
19833 |
+- trace_rxrpc_timer(call, why, now); |
19834 |
+- timer_reduce(&call->timer, expire_at); |
19835 |
+-} |
19836 |
++void rxrpc_reduce_call_timer(struct rxrpc_call *call, |
19837 |
++ unsigned long expire_at, |
19838 |
++ unsigned long now, |
19839 |
++ enum rxrpc_timer_trace why); |
19840 |
++ |
19841 |
++void rxrpc_delete_call_timer(struct rxrpc_call *call); |
19842 |
+ |
19843 |
+ /* |
19844 |
+ * call_object.c |
19845 |
+@@ -791,6 +789,7 @@ void rxrpc_release_calls_on_socket(struct rxrpc_sock *); |
19846 |
+ bool __rxrpc_queue_call(struct rxrpc_call *); |
19847 |
+ bool rxrpc_queue_call(struct rxrpc_call *); |
19848 |
+ void rxrpc_see_call(struct rxrpc_call *); |
19849 |
++bool rxrpc_try_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op); |
19850 |
+ void rxrpc_get_call(struct rxrpc_call *, enum rxrpc_call_trace); |
19851 |
+ void rxrpc_put_call(struct rxrpc_call *, enum rxrpc_call_trace); |
19852 |
+ void rxrpc_cleanup_call(struct rxrpc_call *); |
19853 |
+diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c |
19854 |
+index df864e6922679..22e05de5d1ca9 100644 |
19855 |
+--- a/net/rxrpc/call_event.c |
19856 |
++++ b/net/rxrpc/call_event.c |
19857 |
+@@ -310,7 +310,7 @@ recheck_state: |
19858 |
+ } |
19859 |
+ |
19860 |
+ if (call->state == RXRPC_CALL_COMPLETE) { |
19861 |
+- del_timer_sync(&call->timer); |
19862 |
++ rxrpc_delete_call_timer(call); |
19863 |
+ goto out_put; |
19864 |
+ } |
19865 |
+ |
19866 |
+diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c |
19867 |
+index 4eb91d958a48d..043508fd8d8a5 100644 |
19868 |
+--- a/net/rxrpc/call_object.c |
19869 |
++++ b/net/rxrpc/call_object.c |
19870 |
+@@ -53,10 +53,30 @@ static void rxrpc_call_timer_expired(struct timer_list *t) |
19871 |
+ |
19872 |
+ if (call->state < RXRPC_CALL_COMPLETE) { |
19873 |
+ trace_rxrpc_timer(call, rxrpc_timer_expired, jiffies); |
19874 |
+- rxrpc_queue_call(call); |
19875 |
++ __rxrpc_queue_call(call); |
19876 |
++ } else { |
19877 |
++ rxrpc_put_call(call, rxrpc_call_put); |
19878 |
++ } |
19879 |
++} |
19880 |
++ |
19881 |
++void rxrpc_reduce_call_timer(struct rxrpc_call *call, |
19882 |
++ unsigned long expire_at, |
19883 |
++ unsigned long now, |
19884 |
++ enum rxrpc_timer_trace why) |
19885 |
++{ |
19886 |
++ if (rxrpc_try_get_call(call, rxrpc_call_got_timer)) { |
19887 |
++ trace_rxrpc_timer(call, why, now); |
19888 |
++ if (timer_reduce(&call->timer, expire_at)) |
19889 |
++ rxrpc_put_call(call, rxrpc_call_put_notimer); |
19890 |
+ } |
19891 |
+ } |
19892 |
+ |
19893 |
++void rxrpc_delete_call_timer(struct rxrpc_call *call) |
19894 |
++{ |
19895 |
++ if (del_timer_sync(&call->timer)) |
19896 |
++ rxrpc_put_call(call, rxrpc_call_put_timer); |
19897 |
++} |
19898 |
++ |
19899 |
+ static struct lock_class_key rxrpc_call_user_mutex_lock_class_key; |
19900 |
+ |
19901 |
+ /* |
19902 |
+@@ -463,6 +483,17 @@ void rxrpc_see_call(struct rxrpc_call *call) |
19903 |
+ } |
19904 |
+ } |
19905 |
+ |
19906 |
++bool rxrpc_try_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op) |
19907 |
++{ |
19908 |
++ const void *here = __builtin_return_address(0); |
19909 |
++ int n = atomic_fetch_add_unless(&call->usage, 1, 0); |
19910 |
++ |
19911 |
++ if (n == 0) |
19912 |
++ return false; |
19913 |
++ trace_rxrpc_call(call->debug_id, op, n, here, NULL); |
19914 |
++ return true; |
19915 |
++} |
19916 |
++ |
19917 |
+ /* |
19918 |
+ * Note the addition of a ref on a call. |
19919 |
+ */ |
19920 |
+@@ -510,8 +541,7 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) |
19921 |
+ spin_unlock_bh(&call->lock); |
19922 |
+ |
19923 |
+ rxrpc_put_call_slot(call); |
19924 |
+- |
19925 |
+- del_timer_sync(&call->timer); |
19926 |
++ rxrpc_delete_call_timer(call); |
19927 |
+ |
19928 |
+ /* Make sure we don't get any more notifications */ |
19929 |
+ write_lock_bh(&rx->recvmsg_lock); |
19930 |
+@@ -618,6 +648,8 @@ static void rxrpc_destroy_call(struct work_struct *work) |
19931 |
+ struct rxrpc_call *call = container_of(work, struct rxrpc_call, processor); |
19932 |
+ struct rxrpc_net *rxnet = call->rxnet; |
19933 |
+ |
19934 |
++ rxrpc_delete_call_timer(call); |
19935 |
++ |
19936 |
+ rxrpc_put_connection(call->conn); |
19937 |
+ rxrpc_put_peer(call->peer); |
19938 |
+ kfree(call->rxtx_buffer); |
19939 |
+@@ -652,8 +684,6 @@ void rxrpc_cleanup_call(struct rxrpc_call *call) |
19940 |
+ |
19941 |
+ memset(&call->sock_node, 0xcd, sizeof(call->sock_node)); |
19942 |
+ |
19943 |
+- del_timer_sync(&call->timer); |
19944 |
+- |
19945 |
+ ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); |
19946 |
+ ASSERT(test_bit(RXRPC_CALL_RELEASED, &call->flags)); |
19947 |
+ |
19948 |
+diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c |
19949 |
+index 04aaca4b8bf93..46304e647c492 100644 |
19950 |
+--- a/net/sunrpc/xprt.c |
19951 |
++++ b/net/sunrpc/xprt.c |
19952 |
+@@ -2037,7 +2037,14 @@ static void xprt_destroy(struct rpc_xprt *xprt) |
19953 |
+ */ |
19954 |
+ wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); |
19955 |
+ |
19956 |
++ /* |
19957 |
++ * xprt_schedule_autodisconnect() can run after XPRT_LOCKED |
19958 |
++ * is cleared. We use ->transport_lock to ensure the mod_timer() |
19959 |
++ * can only run *before* del_time_sync(), never after. |
19960 |
++ */ |
19961 |
++ spin_lock(&xprt->transport_lock); |
19962 |
+ del_timer_sync(&xprt->timer); |
19963 |
++ spin_unlock(&xprt->transport_lock); |
19964 |
+ |
19965 |
+ /* |
19966 |
+ * Destroy sockets etc from the system workqueue so they can |
19967 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
19968 |
+index 8d2c98531af45..42283dc6c5b7c 100644 |
19969 |
+--- a/net/tipc/socket.c |
19970 |
++++ b/net/tipc/socket.c |
19971 |
+@@ -2846,7 +2846,8 @@ static void tipc_sk_retry_connect(struct sock *sk, struct sk_buff_head *list) |
19972 |
+ |
19973 |
+ /* Try again later if dest link is congested */ |
19974 |
+ if (tsk->cong_link_cnt) { |
19975 |
+- sk_reset_timer(sk, &sk->sk_timer, msecs_to_jiffies(100)); |
19976 |
++ sk_reset_timer(sk, &sk->sk_timer, |
19977 |
++ jiffies + msecs_to_jiffies(100)); |
19978 |
+ return; |
19979 |
+ } |
19980 |
+ /* Prepare SYN for retransmit */ |
19981 |
+diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c |
19982 |
+index 03ed170b8125e..d231d4620c38f 100644 |
19983 |
+--- a/net/x25/af_x25.c |
19984 |
++++ b/net/x25/af_x25.c |
19985 |
+@@ -1775,10 +1775,15 @@ void x25_kill_by_neigh(struct x25_neigh *nb) |
19986 |
+ |
19987 |
+ write_lock_bh(&x25_list_lock); |
19988 |
+ |
19989 |
+- sk_for_each(s, &x25_list) |
19990 |
+- if (x25_sk(s)->neighbour == nb) |
19991 |
++ sk_for_each(s, &x25_list) { |
19992 |
++ if (x25_sk(s)->neighbour == nb) { |
19993 |
++ write_unlock_bh(&x25_list_lock); |
19994 |
++ lock_sock(s); |
19995 |
+ x25_disconnect(s, ENETUNREACH, 0, 0); |
19996 |
+- |
19997 |
++ release_sock(s); |
19998 |
++ write_lock_bh(&x25_list_lock); |
19999 |
++ } |
20000 |
++ } |
20001 |
+ write_unlock_bh(&x25_list_lock); |
20002 |
+ |
20003 |
+ /* Remove any related forwards */ |
20004 |
+diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
20005 |
+index 4420c8fd318a6..da518b4ca84c6 100644 |
20006 |
+--- a/net/xfrm/xfrm_interface.c |
20007 |
++++ b/net/xfrm/xfrm_interface.c |
20008 |
+@@ -303,7 +303,10 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) |
20009 |
+ if (mtu < IPV6_MIN_MTU) |
20010 |
+ mtu = IPV6_MIN_MTU; |
20011 |
+ |
20012 |
+- icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
20013 |
++ if (skb->len > 1280) |
20014 |
++ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
20015 |
++ else |
20016 |
++ goto xmit; |
20017 |
+ } else { |
20018 |
+ if (!(ip_hdr(skb)->frag_off & htons(IP_DF))) |
20019 |
+ goto xmit; |
20020 |
+diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c |
20021 |
+index 2e4508a6cb3a7..cf5b0a8952254 100644 |
20022 |
+--- a/samples/bpf/xdpsock_user.c |
20023 |
++++ b/samples/bpf/xdpsock_user.c |
20024 |
+@@ -1520,14 +1520,15 @@ int main(int argc, char **argv) |
20025 |
+ |
20026 |
+ setlocale(LC_ALL, ""); |
20027 |
+ |
20028 |
++ prev_time = get_nsecs(); |
20029 |
++ start_time = prev_time; |
20030 |
++ |
20031 |
+ if (!opt_quiet) { |
20032 |
+ ret = pthread_create(&pt, NULL, poller, NULL); |
20033 |
+ if (ret) |
20034 |
+ exit_with_error(ret); |
20035 |
+ } |
20036 |
+ |
20037 |
+- prev_time = get_nsecs(); |
20038 |
+- start_time = prev_time; |
20039 |
+ |
20040 |
+ if (opt_bench == BENCH_RXDROP) |
20041 |
+ rx_drop_all(); |
20042 |
+diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile |
20043 |
+index 4852bf44e913e..f1d201782346f 100644 |
20044 |
+--- a/scripts/dtc/Makefile |
20045 |
++++ b/scripts/dtc/Makefile |
20046 |
+@@ -22,7 +22,7 @@ dtc-objs += yamltree.o |
20047 |
+ # To include <yaml.h> installed in a non-default path |
20048 |
+ HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1) |
20049 |
+ # To link libyaml installed in a non-default path |
20050 |
+-HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs) |
20051 |
++HOSTLDLIBS_dtc := $(shell pkg-config --libs yaml-0.1) |
20052 |
+ endif |
20053 |
+ |
20054 |
+ # Generated files need one more search path to include headers in source tree |
20055 |
+diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c |
20056 |
+index 48e141e079562..dacd697ffd383 100644 |
20057 |
+--- a/scripts/gcc-plugins/stackleak_plugin.c |
20058 |
++++ b/scripts/gcc-plugins/stackleak_plugin.c |
20059 |
+@@ -431,6 +431,23 @@ static unsigned int stackleak_cleanup_execute(void) |
20060 |
+ return 0; |
20061 |
+ } |
20062 |
+ |
20063 |
++/* |
20064 |
++ * STRING_CST may or may not be NUL terminated: |
20065 |
++ * https://gcc.gnu.org/onlinedocs/gccint/Constant-expressions.html |
20066 |
++ */ |
20067 |
++static inline bool string_equal(tree node, const char *string, int length) |
20068 |
++{ |
20069 |
++ if (TREE_STRING_LENGTH(node) < length) |
20070 |
++ return false; |
20071 |
++ if (TREE_STRING_LENGTH(node) > length + 1) |
20072 |
++ return false; |
20073 |
++ if (TREE_STRING_LENGTH(node) == length + 1 && |
20074 |
++ TREE_STRING_POINTER(node)[length] != '\0') |
20075 |
++ return false; |
20076 |
++ return !memcmp(TREE_STRING_POINTER(node), string, length); |
20077 |
++} |
20078 |
++#define STRING_EQUAL(node, str) string_equal(node, str, strlen(str)) |
20079 |
++ |
20080 |
+ static bool stackleak_gate(void) |
20081 |
+ { |
20082 |
+ tree section; |
20083 |
+@@ -440,13 +457,13 @@ static bool stackleak_gate(void) |
20084 |
+ if (section && TREE_VALUE(section)) { |
20085 |
+ section = TREE_VALUE(TREE_VALUE(section)); |
20086 |
+ |
20087 |
+- if (!strncmp(TREE_STRING_POINTER(section), ".init.text", 10)) |
20088 |
++ if (STRING_EQUAL(section, ".init.text")) |
20089 |
+ return false; |
20090 |
+- if (!strncmp(TREE_STRING_POINTER(section), ".devinit.text", 13)) |
20091 |
++ if (STRING_EQUAL(section, ".devinit.text")) |
20092 |
+ return false; |
20093 |
+- if (!strncmp(TREE_STRING_POINTER(section), ".cpuinit.text", 13)) |
20094 |
++ if (STRING_EQUAL(section, ".cpuinit.text")) |
20095 |
+ return false; |
20096 |
+- if (!strncmp(TREE_STRING_POINTER(section), ".meminit.text", 13)) |
20097 |
++ if (STRING_EQUAL(section, ".meminit.text")) |
20098 |
+ return false; |
20099 |
+ } |
20100 |
+ |
20101 |
+diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c |
20102 |
+index b929c683aba12..0033364ac404f 100644 |
20103 |
+--- a/security/integrity/evm/evm_main.c |
20104 |
++++ b/security/integrity/evm/evm_main.c |
20105 |
+@@ -62,7 +62,7 @@ static int __init evm_set_fixmode(char *str) |
20106 |
+ else |
20107 |
+ pr_err("invalid \"%s\" mode", str); |
20108 |
+ |
20109 |
+- return 0; |
20110 |
++ return 1; |
20111 |
+ } |
20112 |
+ __setup("evm=", evm_set_fixmode); |
20113 |
+ |
20114 |
+diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c |
20115 |
+index 931d8dfb4a7f4..63e5c646f7620 100644 |
20116 |
+--- a/security/keys/keyctl_pkey.c |
20117 |
++++ b/security/keys/keyctl_pkey.c |
20118 |
+@@ -135,15 +135,23 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par |
20119 |
+ |
20120 |
+ switch (op) { |
20121 |
+ case KEYCTL_PKEY_ENCRYPT: |
20122 |
++ if (uparams.in_len > info.max_dec_size || |
20123 |
++ uparams.out_len > info.max_enc_size) |
20124 |
++ return -EINVAL; |
20125 |
++ break; |
20126 |
+ case KEYCTL_PKEY_DECRYPT: |
20127 |
+ if (uparams.in_len > info.max_enc_size || |
20128 |
+ uparams.out_len > info.max_dec_size) |
20129 |
+ return -EINVAL; |
20130 |
+ break; |
20131 |
+ case KEYCTL_PKEY_SIGN: |
20132 |
++ if (uparams.in_len > info.max_data_size || |
20133 |
++ uparams.out_len > info.max_sig_size) |
20134 |
++ return -EINVAL; |
20135 |
++ break; |
20136 |
+ case KEYCTL_PKEY_VERIFY: |
20137 |
+- if (uparams.in_len > info.max_sig_size || |
20138 |
+- uparams.out_len > info.max_data_size) |
20139 |
++ if (uparams.in_len > info.max_data_size || |
20140 |
++ uparams.in2_len > info.max_sig_size) |
20141 |
+ return -EINVAL; |
20142 |
+ break; |
20143 |
+ default: |
20144 |
+@@ -151,7 +159,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par |
20145 |
+ } |
20146 |
+ |
20147 |
+ params->in_len = uparams.in_len; |
20148 |
+- params->out_len = uparams.out_len; |
20149 |
++ params->out_len = uparams.out_len; /* Note: same as in2_len */ |
20150 |
+ return 0; |
20151 |
+ } |
20152 |
+ |
20153 |
+diff --git a/security/security.c b/security/security.c |
20154 |
+index a864ff824dd3b..d9d42d64f89f2 100644 |
20155 |
+--- a/security/security.c |
20156 |
++++ b/security/security.c |
20157 |
+@@ -860,9 +860,22 @@ int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc) |
20158 |
+ return call_int_hook(fs_context_dup, 0, fc, src_fc); |
20159 |
+ } |
20160 |
+ |
20161 |
+-int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) |
20162 |
++int security_fs_context_parse_param(struct fs_context *fc, |
20163 |
++ struct fs_parameter *param) |
20164 |
+ { |
20165 |
+- return call_int_hook(fs_context_parse_param, -ENOPARAM, fc, param); |
20166 |
++ struct security_hook_list *hp; |
20167 |
++ int trc; |
20168 |
++ int rc = -ENOPARAM; |
20169 |
++ |
20170 |
++ hlist_for_each_entry(hp, &security_hook_heads.fs_context_parse_param, |
20171 |
++ list) { |
20172 |
++ trc = hp->hook.fs_context_parse_param(fc, param); |
20173 |
++ if (trc == 0) |
20174 |
++ rc = 0; |
20175 |
++ else if (trc != -ENOPARAM) |
20176 |
++ return trc; |
20177 |
++ } |
20178 |
++ return rc; |
20179 |
+ } |
20180 |
+ |
20181 |
+ int security_sb_alloc(struct super_block *sb) |
20182 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
20183 |
+index 86159b32921cc..8c901ae05dd84 100644 |
20184 |
+--- a/security/selinux/hooks.c |
20185 |
++++ b/security/selinux/hooks.c |
20186 |
+@@ -2820,10 +2820,9 @@ static int selinux_fs_context_parse_param(struct fs_context *fc, |
20187 |
+ return opt; |
20188 |
+ |
20189 |
+ rc = selinux_add_opt(opt, param->string, &fc->security); |
20190 |
+- if (!rc) { |
20191 |
++ if (!rc) |
20192 |
+ param->string = NULL; |
20193 |
+- rc = 1; |
20194 |
+- } |
20195 |
++ |
20196 |
+ return rc; |
20197 |
+ } |
20198 |
+ |
20199 |
+@@ -3648,6 +3647,12 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd, |
20200 |
+ CAP_OPT_NONE, true); |
20201 |
+ break; |
20202 |
+ |
20203 |
++ case FIOCLEX: |
20204 |
++ case FIONCLEX: |
20205 |
++ if (!selinux_policycap_ioctl_skip_cloexec()) |
20206 |
++ error = ioctl_has_perm(cred, file, FILE__IOCTL, (u16) cmd); |
20207 |
++ break; |
20208 |
++ |
20209 |
+ /* default case assumes that the command will go |
20210 |
+ * to the file's ioctl() function. |
20211 |
+ */ |
20212 |
+diff --git a/security/selinux/include/policycap.h b/security/selinux/include/policycap.h |
20213 |
+index 2ec038efbb03c..a9e572ca4fd96 100644 |
20214 |
+--- a/security/selinux/include/policycap.h |
20215 |
++++ b/security/selinux/include/policycap.h |
20216 |
+@@ -11,6 +11,7 @@ enum { |
20217 |
+ POLICYDB_CAPABILITY_CGROUPSECLABEL, |
20218 |
+ POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION, |
20219 |
+ POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS, |
20220 |
++ POLICYDB_CAPABILITY_IOCTL_SKIP_CLOEXEC, |
20221 |
+ __POLICYDB_CAPABILITY_MAX |
20222 |
+ }; |
20223 |
+ #define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1) |
20224 |
+diff --git a/security/selinux/include/policycap_names.h b/security/selinux/include/policycap_names.h |
20225 |
+index b89289f092c93..ebd64afe1defd 100644 |
20226 |
+--- a/security/selinux/include/policycap_names.h |
20227 |
++++ b/security/selinux/include/policycap_names.h |
20228 |
+@@ -12,7 +12,8 @@ const char *selinux_policycap_names[__POLICYDB_CAPABILITY_MAX] = { |
20229 |
+ "always_check_network", |
20230 |
+ "cgroup_seclabel", |
20231 |
+ "nnp_nosuid_transition", |
20232 |
+- "genfs_seclabel_symlinks" |
20233 |
++ "genfs_seclabel_symlinks", |
20234 |
++ "ioctl_skip_cloexec" |
20235 |
+ }; |
20236 |
+ |
20237 |
+ #endif /* _SELINUX_POLICYCAP_NAMES_H_ */ |
20238 |
+diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h |
20239 |
+index 63ca6e79daeb9..1521460a97d4e 100644 |
20240 |
+--- a/security/selinux/include/security.h |
20241 |
++++ b/security/selinux/include/security.h |
20242 |
+@@ -219,6 +219,13 @@ static inline bool selinux_policycap_genfs_seclabel_symlinks(void) |
20243 |
+ return READ_ONCE(state->policycap[POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS]); |
20244 |
+ } |
20245 |
+ |
20246 |
++static inline bool selinux_policycap_ioctl_skip_cloexec(void) |
20247 |
++{ |
20248 |
++ struct selinux_state *state = &selinux_state; |
20249 |
++ |
20250 |
++ return READ_ONCE(state->policycap[POLICYDB_CAPABILITY_IOCTL_SKIP_CLOEXEC]); |
20251 |
++} |
20252 |
++ |
20253 |
+ struct selinux_policy_convert_data; |
20254 |
+ |
20255 |
+ struct selinux_load_state { |
20256 |
+diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c |
20257 |
+index 2b745ae8cb981..d893c2280f595 100644 |
20258 |
+--- a/security/selinux/selinuxfs.c |
20259 |
++++ b/security/selinux/selinuxfs.c |
20260 |
+@@ -2124,6 +2124,8 @@ static int sel_fill_super(struct super_block *sb, struct fs_context *fc) |
20261 |
+ } |
20262 |
+ |
20263 |
+ ret = sel_make_avc_files(dentry); |
20264 |
++ if (ret) |
20265 |
++ goto err; |
20266 |
+ |
20267 |
+ dentry = sel_make_dir(sb->s_root, "ss", &fsi->last_ino); |
20268 |
+ if (IS_ERR(dentry)) { |
20269 |
+diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c |
20270 |
+index 7314196185d15..00e95f8bd7c73 100644 |
20271 |
+--- a/security/selinux/xfrm.c |
20272 |
++++ b/security/selinux/xfrm.c |
20273 |
+@@ -346,7 +346,7 @@ int selinux_xfrm_state_alloc_acquire(struct xfrm_state *x, |
20274 |
+ int rc; |
20275 |
+ struct xfrm_sec_ctx *ctx; |
20276 |
+ char *ctx_str = NULL; |
20277 |
+- int str_len; |
20278 |
++ u32 str_len; |
20279 |
+ |
20280 |
+ if (!polsec) |
20281 |
+ return 0; |
20282 |
+diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
20283 |
+index 5c90b9fa4d405..b36b8668f1f4a 100644 |
20284 |
+--- a/security/smack/smack_lsm.c |
20285 |
++++ b/security/smack/smack_lsm.c |
20286 |
+@@ -2506,7 +2506,7 @@ static int smk_ipv6_check(struct smack_known *subject, |
20287 |
+ #ifdef CONFIG_AUDIT |
20288 |
+ smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
20289 |
+ ad.a.u.net->family = PF_INET6; |
20290 |
+- ad.a.u.net->dport = ntohs(address->sin6_port); |
20291 |
++ ad.a.u.net->dport = address->sin6_port; |
20292 |
+ if (act == SMK_RECEIVING) |
20293 |
+ ad.a.u.net->v6info.saddr = address->sin6_addr; |
20294 |
+ else |
20295 |
+diff --git a/security/tomoyo/load_policy.c b/security/tomoyo/load_policy.c |
20296 |
+index 3445ae6fd4794..363b65be87ab7 100644 |
20297 |
+--- a/security/tomoyo/load_policy.c |
20298 |
++++ b/security/tomoyo/load_policy.c |
20299 |
+@@ -24,7 +24,7 @@ static const char *tomoyo_loader; |
20300 |
+ static int __init tomoyo_loader_setup(char *str) |
20301 |
+ { |
20302 |
+ tomoyo_loader = str; |
20303 |
+- return 0; |
20304 |
++ return 1; |
20305 |
+ } |
20306 |
+ |
20307 |
+ __setup("TOMOYO_loader=", tomoyo_loader_setup); |
20308 |
+@@ -64,7 +64,7 @@ static const char *tomoyo_trigger; |
20309 |
+ static int __init tomoyo_trigger_setup(char *str) |
20310 |
+ { |
20311 |
+ tomoyo_trigger = str; |
20312 |
+- return 0; |
20313 |
++ return 1; |
20314 |
+ } |
20315 |
+ |
20316 |
+ __setup("TOMOYO_trigger=", tomoyo_trigger_setup); |
20317 |
+diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c |
20318 |
+index a0996c47e58fe..b326a5f5f0d53 100644 |
20319 |
+--- a/sound/arm/aaci.c |
20320 |
++++ b/sound/arm/aaci.c |
20321 |
+@@ -1055,7 +1055,7 @@ static int aaci_probe(struct amba_device *dev, |
20322 |
+ return ret; |
20323 |
+ } |
20324 |
+ |
20325 |
+-static int aaci_remove(struct amba_device *dev) |
20326 |
++static void aaci_remove(struct amba_device *dev) |
20327 |
+ { |
20328 |
+ struct snd_card *card = amba_get_drvdata(dev); |
20329 |
+ |
20330 |
+@@ -1066,8 +1066,6 @@ static int aaci_remove(struct amba_device *dev) |
20331 |
+ snd_card_free(card); |
20332 |
+ amba_release_regions(dev); |
20333 |
+ } |
20334 |
+- |
20335 |
+- return 0; |
20336 |
+ } |
20337 |
+ |
20338 |
+ static struct amba_id aaci_ids[] = { |
20339 |
+diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
20340 |
+index 8e5c6b227e52d..59d222446d777 100644 |
20341 |
+--- a/sound/core/pcm.c |
20342 |
++++ b/sound/core/pcm.c |
20343 |
+@@ -970,6 +970,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, |
20344 |
+ |
20345 |
+ runtime->status->state = SNDRV_PCM_STATE_OPEN; |
20346 |
+ mutex_init(&runtime->buffer_mutex); |
20347 |
++ atomic_set(&runtime->buffer_accessing, 0); |
20348 |
+ |
20349 |
+ substream->runtime = runtime; |
20350 |
+ substream->private_data = pcm->private_data; |
20351 |
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
20352 |
+index 45afef73275f0..289f52af15b96 100644 |
20353 |
+--- a/sound/core/pcm_lib.c |
20354 |
++++ b/sound/core/pcm_lib.c |
20355 |
+@@ -1871,11 +1871,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream, |
20356 |
+ if (avail >= runtime->twake) |
20357 |
+ break; |
20358 |
+ snd_pcm_stream_unlock_irq(substream); |
20359 |
+- mutex_unlock(&runtime->buffer_mutex); |
20360 |
+ |
20361 |
+ tout = schedule_timeout(wait_time); |
20362 |
+ |
20363 |
+- mutex_lock(&runtime->buffer_mutex); |
20364 |
+ snd_pcm_stream_lock_irq(substream); |
20365 |
+ set_current_state(TASK_INTERRUPTIBLE); |
20366 |
+ switch (runtime->status->state) { |
20367 |
+@@ -2169,7 +2167,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
20368 |
+ |
20369 |
+ nonblock = !!(substream->f_flags & O_NONBLOCK); |
20370 |
+ |
20371 |
+- mutex_lock(&runtime->buffer_mutex); |
20372 |
+ snd_pcm_stream_lock_irq(substream); |
20373 |
+ err = pcm_accessible_state(runtime); |
20374 |
+ if (err < 0) |
20375 |
+@@ -2224,10 +2221,15 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
20376 |
+ err = -EINVAL; |
20377 |
+ goto _end_unlock; |
20378 |
+ } |
20379 |
++ if (!atomic_inc_unless_negative(&runtime->buffer_accessing)) { |
20380 |
++ err = -EBUSY; |
20381 |
++ goto _end_unlock; |
20382 |
++ } |
20383 |
+ snd_pcm_stream_unlock_irq(substream); |
20384 |
+ err = writer(substream, appl_ofs, data, offset, frames, |
20385 |
+ transfer); |
20386 |
+ snd_pcm_stream_lock_irq(substream); |
20387 |
++ atomic_dec(&runtime->buffer_accessing); |
20388 |
+ if (err < 0) |
20389 |
+ goto _end_unlock; |
20390 |
+ err = pcm_accessible_state(runtime); |
20391 |
+@@ -2257,7 +2259,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
20392 |
+ if (xfer > 0 && err >= 0) |
20393 |
+ snd_pcm_update_state(substream, runtime); |
20394 |
+ snd_pcm_stream_unlock_irq(substream); |
20395 |
+- mutex_unlock(&runtime->buffer_mutex); |
20396 |
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; |
20397 |
+ } |
20398 |
+ EXPORT_SYMBOL(__snd_pcm_lib_xfer); |
20399 |
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
20400 |
+index 6579802c55116..6cc7c2a9fe732 100644 |
20401 |
+--- a/sound/core/pcm_native.c |
20402 |
++++ b/sound/core/pcm_native.c |
20403 |
+@@ -667,6 +667,24 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, |
20404 |
+ return 0; |
20405 |
+ } |
20406 |
+ |
20407 |
++/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise |
20408 |
++ * block the further r/w operations |
20409 |
++ */ |
20410 |
++static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime) |
20411 |
++{ |
20412 |
++ if (!atomic_dec_unless_positive(&runtime->buffer_accessing)) |
20413 |
++ return -EBUSY; |
20414 |
++ mutex_lock(&runtime->buffer_mutex); |
20415 |
++ return 0; /* keep buffer_mutex, unlocked by below */ |
20416 |
++} |
20417 |
++ |
20418 |
++/* release buffer_mutex and clear r/w access flag */ |
20419 |
++static void snd_pcm_buffer_access_unlock(struct snd_pcm_runtime *runtime) |
20420 |
++{ |
20421 |
++ mutex_unlock(&runtime->buffer_mutex); |
20422 |
++ atomic_inc(&runtime->buffer_accessing); |
20423 |
++} |
20424 |
++ |
20425 |
+ #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
20426 |
+ #define is_oss_stream(substream) ((substream)->oss.oss) |
20427 |
+ #else |
20428 |
+@@ -677,14 +695,16 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
20429 |
+ struct snd_pcm_hw_params *params) |
20430 |
+ { |
20431 |
+ struct snd_pcm_runtime *runtime; |
20432 |
+- int err = 0, usecs; |
20433 |
++ int err, usecs; |
20434 |
+ unsigned int bits; |
20435 |
+ snd_pcm_uframes_t frames; |
20436 |
+ |
20437 |
+ if (PCM_RUNTIME_CHECK(substream)) |
20438 |
+ return -ENXIO; |
20439 |
+ runtime = substream->runtime; |
20440 |
+- mutex_lock(&runtime->buffer_mutex); |
20441 |
++ err = snd_pcm_buffer_access_lock(runtime); |
20442 |
++ if (err < 0) |
20443 |
++ return err; |
20444 |
+ snd_pcm_stream_lock_irq(substream); |
20445 |
+ switch (runtime->status->state) { |
20446 |
+ case SNDRV_PCM_STATE_OPEN: |
20447 |
+@@ -801,7 +821,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
20448 |
+ snd_pcm_lib_free_pages(substream); |
20449 |
+ } |
20450 |
+ unlock: |
20451 |
+- mutex_unlock(&runtime->buffer_mutex); |
20452 |
++ snd_pcm_buffer_access_unlock(runtime); |
20453 |
+ return err; |
20454 |
+ } |
20455 |
+ |
20456 |
+@@ -846,7 +866,9 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) |
20457 |
+ if (PCM_RUNTIME_CHECK(substream)) |
20458 |
+ return -ENXIO; |
20459 |
+ runtime = substream->runtime; |
20460 |
+- mutex_lock(&runtime->buffer_mutex); |
20461 |
++ result = snd_pcm_buffer_access_lock(runtime); |
20462 |
++ if (result < 0) |
20463 |
++ return result; |
20464 |
+ snd_pcm_stream_lock_irq(substream); |
20465 |
+ switch (runtime->status->state) { |
20466 |
+ case SNDRV_PCM_STATE_SETUP: |
20467 |
+@@ -865,7 +887,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) |
20468 |
+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
20469 |
+ cpu_latency_qos_remove_request(&substream->latency_pm_qos_req); |
20470 |
+ unlock: |
20471 |
+- mutex_unlock(&runtime->buffer_mutex); |
20472 |
++ snd_pcm_buffer_access_unlock(runtime); |
20473 |
+ return result; |
20474 |
+ } |
20475 |
+ |
20476 |
+@@ -1350,12 +1372,15 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops, |
20477 |
+ |
20478 |
+ /* Guarantee the group members won't change during non-atomic action */ |
20479 |
+ down_read(&snd_pcm_link_rwsem); |
20480 |
+- mutex_lock(&substream->runtime->buffer_mutex); |
20481 |
++ res = snd_pcm_buffer_access_lock(substream->runtime); |
20482 |
++ if (res < 0) |
20483 |
++ goto unlock; |
20484 |
+ if (snd_pcm_stream_linked(substream)) |
20485 |
+ res = snd_pcm_action_group(ops, substream, state, false); |
20486 |
+ else |
20487 |
+ res = snd_pcm_action_single(ops, substream, state); |
20488 |
+- mutex_unlock(&substream->runtime->buffer_mutex); |
20489 |
++ snd_pcm_buffer_access_unlock(substream->runtime); |
20490 |
++ unlock: |
20491 |
+ up_read(&snd_pcm_link_rwsem); |
20492 |
+ return res; |
20493 |
+ } |
20494 |
+diff --git a/sound/firewire/fcp.c b/sound/firewire/fcp.c |
20495 |
+index bbfbebf4affbc..df44dd5dc4b22 100644 |
20496 |
+--- a/sound/firewire/fcp.c |
20497 |
++++ b/sound/firewire/fcp.c |
20498 |
+@@ -240,9 +240,7 @@ int fcp_avc_transaction(struct fw_unit *unit, |
20499 |
+ t.response_match_bytes = response_match_bytes; |
20500 |
+ t.state = STATE_PENDING; |
20501 |
+ init_waitqueue_head(&t.wait); |
20502 |
+- |
20503 |
+- if (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03) |
20504 |
+- t.deferrable = true; |
20505 |
++ t.deferrable = (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03); |
20506 |
+ |
20507 |
+ spin_lock_irq(&transactions_lock); |
20508 |
+ list_add_tail(&t.list, &transactions); |
20509 |
+diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c |
20510 |
+index fa3c39cff5f85..9ee3a312c6793 100644 |
20511 |
+--- a/sound/isa/cs423x/cs4236.c |
20512 |
++++ b/sound/isa/cs423x/cs4236.c |
20513 |
+@@ -544,7 +544,7 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, |
20514 |
+ static int dev; |
20515 |
+ int err; |
20516 |
+ struct snd_card *card; |
20517 |
+- struct pnp_dev *cdev; |
20518 |
++ struct pnp_dev *cdev, *iter; |
20519 |
+ char cid[PNP_ID_LEN]; |
20520 |
+ |
20521 |
+ if (pnp_device_is_isapnp(pdev)) |
20522 |
+@@ -560,9 +560,11 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, |
20523 |
+ strcpy(cid, pdev->id[0].id); |
20524 |
+ cid[5] = '1'; |
20525 |
+ cdev = NULL; |
20526 |
+- list_for_each_entry(cdev, &(pdev->protocol->devices), protocol_list) { |
20527 |
+- if (!strcmp(cdev->id[0].id, cid)) |
20528 |
++ list_for_each_entry(iter, &(pdev->protocol->devices), protocol_list) { |
20529 |
++ if (!strcmp(iter->id[0].id, cid)) { |
20530 |
++ cdev = iter; |
20531 |
+ break; |
20532 |
++ } |
20533 |
+ } |
20534 |
+ err = snd_cs423x_card_new(&pdev->dev, dev, &card); |
20535 |
+ if (err < 0) |
20536 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
20537 |
+index fe725f0f09312..71e11481ba41c 100644 |
20538 |
+--- a/sound/pci/hda/patch_hdmi.c |
20539 |
++++ b/sound/pci/hda/patch_hdmi.c |
20540 |
+@@ -1608,6 +1608,7 @@ static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, |
20541 |
+ struct hda_codec *codec = per_pin->codec; |
20542 |
+ struct hdmi_spec *spec = codec->spec; |
20543 |
+ struct hdmi_eld *eld = &spec->temp_eld; |
20544 |
++ struct device *dev = hda_codec_dev(codec); |
20545 |
+ hda_nid_t pin_nid = per_pin->pin_nid; |
20546 |
+ int dev_id = per_pin->dev_id; |
20547 |
+ /* |
20548 |
+@@ -1621,8 +1622,13 @@ static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, |
20549 |
+ int present; |
20550 |
+ int ret; |
20551 |
+ |
20552 |
++#ifdef CONFIG_PM |
20553 |
++ if (dev->power.runtime_status == RPM_SUSPENDING) |
20554 |
++ return; |
20555 |
++#endif |
20556 |
++ |
20557 |
+ ret = snd_hda_power_up_pm(codec); |
20558 |
+- if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) |
20559 |
++ if (ret < 0 && pm_runtime_suspended(dev)) |
20560 |
+ goto out; |
20561 |
+ |
20562 |
+ present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id); |
20563 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
20564 |
+index 3bd37c02ce0ed..b886326ce9b96 100644 |
20565 |
+--- a/sound/pci/hda/patch_realtek.c |
20566 |
++++ b/sound/pci/hda/patch_realtek.c |
20567 |
+@@ -3615,8 +3615,8 @@ static void alc256_shutup(struct hda_codec *codec) |
20568 |
+ /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly |
20569 |
+ * when booting with headset plugged. So skip setting it for the codec alc257 |
20570 |
+ */ |
20571 |
+- if (spec->codec_variant != ALC269_TYPE_ALC257 && |
20572 |
+- spec->codec_variant != ALC269_TYPE_ALC256) |
20573 |
++ if (codec->core.vendor_id != 0x10ec0236 && |
20574 |
++ codec->core.vendor_id != 0x10ec0257) |
20575 |
+ alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
20576 |
+ |
20577 |
+ if (!spec->no_shutup_pins) |
20578 |
+@@ -6762,6 +6762,7 @@ enum { |
20579 |
+ ALC236_FIXUP_HP_MUTE_LED, |
20580 |
+ ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, |
20581 |
+ ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, |
20582 |
++ ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, |
20583 |
+ ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, |
20584 |
+ ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, |
20585 |
+ ALC269VC_FIXUP_ACER_HEADSET_MIC, |
20586 |
+@@ -8083,6 +8084,14 @@ static const struct hda_fixup alc269_fixups[] = { |
20587 |
+ { } |
20588 |
+ }, |
20589 |
+ }, |
20590 |
++ [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { |
20591 |
++ .type = HDA_FIXUP_VERBS, |
20592 |
++ .v.verbs = (const struct hda_verb[]) { |
20593 |
++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
20594 |
++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf}, |
20595 |
++ { } |
20596 |
++ }, |
20597 |
++ }, |
20598 |
+ [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = { |
20599 |
+ .type = HDA_FIXUP_PINS, |
20600 |
+ .v.pins = (const struct hda_pintbl[]) { |
20601 |
+@@ -8835,6 +8844,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
20602 |
+ SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), |
20603 |
+ SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
20604 |
+ SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
20605 |
++ SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
20606 |
+ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), |
20607 |
+ SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), |
20608 |
+ SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), |
20609 |
+@@ -9177,6 +9187,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { |
20610 |
+ {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"}, |
20611 |
+ {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, |
20612 |
+ {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, |
20613 |
++ {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"}, |
20614 |
+ {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, |
20615 |
+ {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"}, |
20616 |
+ {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"}, |
20617 |
+diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c |
20618 |
+index 6a63e8797a0b6..97533412ce11e 100644 |
20619 |
+--- a/sound/soc/atmel/atmel_ssc_dai.c |
20620 |
++++ b/sound/soc/atmel/atmel_ssc_dai.c |
20621 |
+@@ -280,7 +280,10 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream, |
20622 |
+ |
20623 |
+ /* Enable PMC peripheral clock for this SSC */ |
20624 |
+ pr_debug("atmel_ssc_dai: Starting clock\n"); |
20625 |
+- clk_enable(ssc_p->ssc->clk); |
20626 |
++ ret = clk_enable(ssc_p->ssc->clk); |
20627 |
++ if (ret) |
20628 |
++ return ret; |
20629 |
++ |
20630 |
+ ssc_p->mck_rate = clk_get_rate(ssc_p->ssc->clk); |
20631 |
+ |
20632 |
+ /* Reset the SSC unless initialized to keep it in a clean state */ |
20633 |
+diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c |
20634 |
+index ed1f69b570244..8a55d59a6c2aa 100644 |
20635 |
+--- a/sound/soc/atmel/sam9g20_wm8731.c |
20636 |
++++ b/sound/soc/atmel/sam9g20_wm8731.c |
20637 |
+@@ -214,6 +214,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) |
20638 |
+ cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0); |
20639 |
+ if (!cpu_np) { |
20640 |
+ dev_err(&pdev->dev, "dai and pcm info missing\n"); |
20641 |
++ of_node_put(codec_np); |
20642 |
+ return -EINVAL; |
20643 |
+ } |
20644 |
+ at91sam9g20ek_dai.cpus->of_node = cpu_np; |
20645 |
+diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c |
20646 |
+index 9fbc3c1113cc5..529604a06c532 100644 |
20647 |
+--- a/sound/soc/atmel/sam9x5_wm8731.c |
20648 |
++++ b/sound/soc/atmel/sam9x5_wm8731.c |
20649 |
+@@ -142,7 +142,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) |
20650 |
+ if (!cpu_np) { |
20651 |
+ dev_err(&pdev->dev, "atmel,ssc-controller node missing\n"); |
20652 |
+ ret = -EINVAL; |
20653 |
+- goto out; |
20654 |
++ goto out_put_codec_np; |
20655 |
+ } |
20656 |
+ dai->cpus->of_node = cpu_np; |
20657 |
+ dai->platforms->of_node = cpu_np; |
20658 |
+@@ -153,13 +153,10 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) |
20659 |
+ if (ret != 0) { |
20660 |
+ dev_err(&pdev->dev, "Failed to set SSC %d for audio: %d\n", |
20661 |
+ ret, priv->ssc_id); |
20662 |
+- goto out; |
20663 |
++ goto out_put_cpu_np; |
20664 |
+ } |
20665 |
+ |
20666 |
+- of_node_put(codec_np); |
20667 |
+- of_node_put(cpu_np); |
20668 |
+- |
20669 |
+- ret = snd_soc_register_card(card); |
20670 |
++ ret = devm_snd_soc_register_card(&pdev->dev, card); |
20671 |
+ if (ret) { |
20672 |
+ dev_err(&pdev->dev, "Platform device allocation failed\n"); |
20673 |
+ goto out_put_audio; |
20674 |
+@@ -167,10 +164,14 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) |
20675 |
+ |
20676 |
+ dev_dbg(&pdev->dev, "%s ok\n", __func__); |
20677 |
+ |
20678 |
+- return ret; |
20679 |
++ goto out_put_cpu_np; |
20680 |
+ |
20681 |
+ out_put_audio: |
20682 |
+ atmel_ssc_put_audio(priv->ssc_id); |
20683 |
++out_put_cpu_np: |
20684 |
++ of_node_put(cpu_np); |
20685 |
++out_put_codec_np: |
20686 |
++ of_node_put(codec_np); |
20687 |
+ out: |
20688 |
+ return ret; |
20689 |
+ } |
20690 |
+@@ -180,7 +181,6 @@ static int sam9x5_wm8731_driver_remove(struct platform_device *pdev) |
20691 |
+ struct snd_soc_card *card = platform_get_drvdata(pdev); |
20692 |
+ struct sam9x5_drvdata *priv = card->drvdata; |
20693 |
+ |
20694 |
+- snd_soc_unregister_card(card); |
20695 |
+ atmel_ssc_put_audio(priv->ssc_id); |
20696 |
+ |
20697 |
+ return 0; |
20698 |
+diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig |
20699 |
+index 34c6dd04b85a3..52c89a6f54e9a 100644 |
20700 |
+--- a/sound/soc/codecs/Kconfig |
20701 |
++++ b/sound/soc/codecs/Kconfig |
20702 |
+@@ -659,6 +659,7 @@ config SND_SOC_CS4349 |
20703 |
+ |
20704 |
+ config SND_SOC_CS47L15 |
20705 |
+ tristate |
20706 |
++ depends on MFD_CS47L15 |
20707 |
+ |
20708 |
+ config SND_SOC_CS47L24 |
20709 |
+ tristate |
20710 |
+@@ -666,15 +667,19 @@ config SND_SOC_CS47L24 |
20711 |
+ |
20712 |
+ config SND_SOC_CS47L35 |
20713 |
+ tristate |
20714 |
++ depends on MFD_CS47L35 |
20715 |
+ |
20716 |
+ config SND_SOC_CS47L85 |
20717 |
+ tristate |
20718 |
++ depends on MFD_CS47L85 |
20719 |
+ |
20720 |
+ config SND_SOC_CS47L90 |
20721 |
+ tristate |
20722 |
++ depends on MFD_CS47L90 |
20723 |
+ |
20724 |
+ config SND_SOC_CS47L92 |
20725 |
+ tristate |
20726 |
++ depends on MFD_CS47L92 |
20727 |
+ |
20728 |
+ # Cirrus Logic Quad-Channel ADC |
20729 |
+ config SND_SOC_CS53L30 |
20730 |
+diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c |
20731 |
+index 3ddd822240e3a..971b8360b5b1b 100644 |
20732 |
+--- a/sound/soc/codecs/msm8916-wcd-analog.c |
20733 |
++++ b/sound/soc/codecs/msm8916-wcd-analog.c |
20734 |
+@@ -1221,8 +1221,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
20735 |
+ } |
20736 |
+ |
20737 |
+ irq = platform_get_irq_byname(pdev, "mbhc_switch_int"); |
20738 |
+- if (irq < 0) |
20739 |
+- return irq; |
20740 |
++ if (irq < 0) { |
20741 |
++ ret = irq; |
20742 |
++ goto err_disable_clk; |
20743 |
++ } |
20744 |
+ |
20745 |
+ ret = devm_request_threaded_irq(dev, irq, NULL, |
20746 |
+ pm8916_mbhc_switch_irq_handler, |
20747 |
+@@ -1234,8 +1236,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
20748 |
+ |
20749 |
+ if (priv->mbhc_btn_enabled) { |
20750 |
+ irq = platform_get_irq_byname(pdev, "mbhc_but_press_det"); |
20751 |
+- if (irq < 0) |
20752 |
+- return irq; |
20753 |
++ if (irq < 0) { |
20754 |
++ ret = irq; |
20755 |
++ goto err_disable_clk; |
20756 |
++ } |
20757 |
+ |
20758 |
+ ret = devm_request_threaded_irq(dev, irq, NULL, |
20759 |
+ mbhc_btn_press_irq_handler, |
20760 |
+@@ -1246,8 +1250,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
20761 |
+ dev_err(dev, "cannot request mbhc button press irq\n"); |
20762 |
+ |
20763 |
+ irq = platform_get_irq_byname(pdev, "mbhc_but_rel_det"); |
20764 |
+- if (irq < 0) |
20765 |
+- return irq; |
20766 |
++ if (irq < 0) { |
20767 |
++ ret = irq; |
20768 |
++ goto err_disable_clk; |
20769 |
++ } |
20770 |
+ |
20771 |
+ ret = devm_request_threaded_irq(dev, irq, NULL, |
20772 |
+ mbhc_btn_release_irq_handler, |
20773 |
+@@ -1264,6 +1270,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
20774 |
+ return devm_snd_soc_register_component(dev, &pm8916_wcd_analog, |
20775 |
+ pm8916_wcd_analog_dai, |
20776 |
+ ARRAY_SIZE(pm8916_wcd_analog_dai)); |
20777 |
++ |
20778 |
++err_disable_clk: |
20779 |
++ clk_disable_unprepare(priv->mclk); |
20780 |
++ return ret; |
20781 |
+ } |
20782 |
+ |
20783 |
+ static int pm8916_wcd_analog_spmi_remove(struct platform_device *pdev) |
20784 |
+diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c |
20785 |
+index fcc10c8bc6259..9ad7fc0baf072 100644 |
20786 |
+--- a/sound/soc/codecs/msm8916-wcd-digital.c |
20787 |
++++ b/sound/soc/codecs/msm8916-wcd-digital.c |
20788 |
+@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) |
20789 |
+ ret = clk_prepare_enable(priv->mclk); |
20790 |
+ if (ret < 0) { |
20791 |
+ dev_err(dev, "failed to enable mclk %d\n", ret); |
20792 |
+- return ret; |
20793 |
++ goto err_clk; |
20794 |
+ } |
20795 |
+ |
20796 |
+ dev_set_drvdata(dev, priv); |
20797 |
+@@ -1209,6 +1209,9 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) |
20798 |
+ return devm_snd_soc_register_component(dev, &msm8916_wcd_digital, |
20799 |
+ msm8916_wcd_digital_dai, |
20800 |
+ ARRAY_SIZE(msm8916_wcd_digital_dai)); |
20801 |
++err_clk: |
20802 |
++ clk_disable_unprepare(priv->ahbclk); |
20803 |
++ return ret; |
20804 |
+ } |
20805 |
+ |
20806 |
+ static int msm8916_wcd_digital_remove(struct platform_device *pdev) |
20807 |
+diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c |
20808 |
+index 1f39d5998cf67..456d9b24d0249 100644 |
20809 |
+--- a/sound/soc/codecs/mt6358.c |
20810 |
++++ b/sound/soc/codecs/mt6358.c |
20811 |
+@@ -107,6 +107,7 @@ int mt6358_set_mtkaif_protocol(struct snd_soc_component *cmpnt, |
20812 |
+ priv->mtkaif_protocol = mtkaif_protocol; |
20813 |
+ return 0; |
20814 |
+ } |
20815 |
++EXPORT_SYMBOL_GPL(mt6358_set_mtkaif_protocol); |
20816 |
+ |
20817 |
+ static void playback_gpio_set(struct mt6358_priv *priv) |
20818 |
+ { |
20819 |
+@@ -273,6 +274,7 @@ int mt6358_mtkaif_calibration_enable(struct snd_soc_component *cmpnt) |
20820 |
+ 1 << RG_AUD_PAD_TOP_DAT_MISO_LOOPBACK_SFT); |
20821 |
+ return 0; |
20822 |
+ } |
20823 |
++EXPORT_SYMBOL_GPL(mt6358_mtkaif_calibration_enable); |
20824 |
+ |
20825 |
+ int mt6358_mtkaif_calibration_disable(struct snd_soc_component *cmpnt) |
20826 |
+ { |
20827 |
+@@ -296,6 +298,7 @@ int mt6358_mtkaif_calibration_disable(struct snd_soc_component *cmpnt) |
20828 |
+ capture_gpio_reset(priv); |
20829 |
+ return 0; |
20830 |
+ } |
20831 |
++EXPORT_SYMBOL_GPL(mt6358_mtkaif_calibration_disable); |
20832 |
+ |
20833 |
+ int mt6358_set_mtkaif_calibration_phase(struct snd_soc_component *cmpnt, |
20834 |
+ int phase_1, int phase_2) |
20835 |
+@@ -310,6 +313,7 @@ int mt6358_set_mtkaif_calibration_phase(struct snd_soc_component *cmpnt, |
20836 |
+ phase_2 << RG_AUD_PAD_TOP_PHASE_MODE2_SFT); |
20837 |
+ return 0; |
20838 |
+ } |
20839 |
++EXPORT_SYMBOL_GPL(mt6358_set_mtkaif_calibration_phase); |
20840 |
+ |
20841 |
+ /* dl pga gain */ |
20842 |
+ enum { |
20843 |
+diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c |
20844 |
+index db8a41aaa3859..4423e61bf1abf 100644 |
20845 |
+--- a/sound/soc/codecs/rt5663.c |
20846 |
++++ b/sound/soc/codecs/rt5663.c |
20847 |
+@@ -3478,6 +3478,8 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) |
20848 |
+ table_size = sizeof(struct impedance_mapping_table) * |
20849 |
+ rt5663->pdata.impedance_sensing_num; |
20850 |
+ rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); |
20851 |
++ if (!rt5663->imp_table) |
20852 |
++ return -ENOMEM; |
20853 |
+ ret = device_property_read_u32_array(dev, |
20854 |
+ "realtek,impedance_sensing_table", |
20855 |
+ (u32 *)rt5663->imp_table, table_size); |
20856 |
+diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c |
20857 |
+index 01df3f4e045a9..8540ac230d0ed 100644 |
20858 |
+--- a/sound/soc/codecs/wcd934x.c |
20859 |
++++ b/sound/soc/codecs/wcd934x.c |
20860 |
+@@ -2522,13 +2522,16 @@ static int wcd934x_rx_hph_mode_put(struct snd_kcontrol *kc, |
20861 |
+ |
20862 |
+ mode_val = ucontrol->value.enumerated.item[0]; |
20863 |
+ |
20864 |
++ if (mode_val == wcd->hph_mode) |
20865 |
++ return 0; |
20866 |
++ |
20867 |
+ if (mode_val == 0) { |
20868 |
+ dev_err(wcd->dev, "Invalid HPH Mode, default to ClSH HiFi\n"); |
20869 |
+ mode_val = CLS_H_LOHIFI; |
20870 |
+ } |
20871 |
+ wcd->hph_mode = mode_val; |
20872 |
+ |
20873 |
+- return 0; |
20874 |
++ return 1; |
20875 |
+ } |
20876 |
+ |
20877 |
+ static int slim_rx_mux_get(struct snd_kcontrol *kc, |
20878 |
+@@ -5044,6 +5047,7 @@ static int wcd934x_codec_parse_data(struct wcd934x_codec *wcd) |
20879 |
+ } |
20880 |
+ |
20881 |
+ wcd->sidev = of_slim_get_device(wcd->sdev->ctrl, ifc_dev_np); |
20882 |
++ of_node_put(ifc_dev_np); |
20883 |
+ if (!wcd->sidev) { |
20884 |
+ dev_err(dev, "Unable to get SLIM Interface device\n"); |
20885 |
+ return -EINVAL; |
20886 |
+diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c |
20887 |
+index a6aa212fa0c89..ec5d997725b9c 100644 |
20888 |
+--- a/sound/soc/codecs/wm8350.c |
20889 |
++++ b/sound/soc/codecs/wm8350.c |
20890 |
+@@ -1536,18 +1536,38 @@ static int wm8350_component_probe(struct snd_soc_component *component) |
20891 |
+ wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
20892 |
+ WM8350_JDL_ENA | WM8350_JDR_ENA); |
20893 |
+ |
20894 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, |
20895 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, |
20896 |
+ wm8350_hpl_jack_handler, 0, "Left jack detect", |
20897 |
+ priv); |
20898 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, |
20899 |
++ if (ret != 0) |
20900 |
++ goto err; |
20901 |
++ |
20902 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, |
20903 |
+ wm8350_hpr_jack_handler, 0, "Right jack detect", |
20904 |
+ priv); |
20905 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, |
20906 |
++ if (ret != 0) |
20907 |
++ goto free_jck_det_l; |
20908 |
++ |
20909 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, |
20910 |
+ wm8350_mic_handler, 0, "Microphone short", priv); |
20911 |
+- wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICD, |
20912 |
++ if (ret != 0) |
20913 |
++ goto free_jck_det_r; |
20914 |
++ |
20915 |
++ ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICD, |
20916 |
+ wm8350_mic_handler, 0, "Microphone detect", priv); |
20917 |
++ if (ret != 0) |
20918 |
++ goto free_micscd; |
20919 |
+ |
20920 |
+ return 0; |
20921 |
++ |
20922 |
++free_micscd: |
20923 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, priv); |
20924 |
++free_jck_det_r: |
20925 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, priv); |
20926 |
++free_jck_det_l: |
20927 |
++ wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, priv); |
20928 |
++err: |
20929 |
++ return ret; |
20930 |
+ } |
20931 |
+ |
20932 |
+ static void wm8350_component_remove(struct snd_soc_component *component) |
20933 |
+diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c |
20934 |
+index fd4160289faca..36da0f01571a1 100644 |
20935 |
+--- a/sound/soc/dwc/dwc-i2s.c |
20936 |
++++ b/sound/soc/dwc/dwc-i2s.c |
20937 |
+@@ -403,9 +403,13 @@ static int dw_i2s_runtime_suspend(struct device *dev) |
20938 |
+ static int dw_i2s_runtime_resume(struct device *dev) |
20939 |
+ { |
20940 |
+ struct dw_i2s_dev *dw_dev = dev_get_drvdata(dev); |
20941 |
++ int ret; |
20942 |
+ |
20943 |
+- if (dw_dev->capability & DW_I2S_MASTER) |
20944 |
+- clk_enable(dw_dev->clk); |
20945 |
++ if (dw_dev->capability & DW_I2S_MASTER) { |
20946 |
++ ret = clk_enable(dw_dev->clk); |
20947 |
++ if (ret) |
20948 |
++ return ret; |
20949 |
++ } |
20950 |
+ return 0; |
20951 |
+ } |
20952 |
+ |
20953 |
+@@ -422,10 +426,13 @@ static int dw_i2s_resume(struct snd_soc_component *component) |
20954 |
+ { |
20955 |
+ struct dw_i2s_dev *dev = snd_soc_component_get_drvdata(component); |
20956 |
+ struct snd_soc_dai *dai; |
20957 |
+- int stream; |
20958 |
++ int stream, ret; |
20959 |
+ |
20960 |
+- if (dev->capability & DW_I2S_MASTER) |
20961 |
+- clk_enable(dev->clk); |
20962 |
++ if (dev->capability & DW_I2S_MASTER) { |
20963 |
++ ret = clk_enable(dev->clk); |
20964 |
++ if (ret) |
20965 |
++ return ret; |
20966 |
++ } |
20967 |
+ |
20968 |
+ for_each_component_dais(component, dai) { |
20969 |
+ for_each_pcm_streams(stream) |
20970 |
+diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c |
20971 |
+index 15bcb0f38ec9e..d01e8d516df1f 100644 |
20972 |
+--- a/sound/soc/fsl/fsl_spdif.c |
20973 |
++++ b/sound/soc/fsl/fsl_spdif.c |
20974 |
+@@ -544,6 +544,8 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, |
20975 |
+ mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK | |
20976 |
+ SCR_TXSEL_MASK | SCR_USRC_SEL_MASK | |
20977 |
+ SCR_TXFIFO_FSEL_MASK; |
20978 |
++ /* Disable TX clock */ |
20979 |
++ regmap_update_bits(regmap, REG_SPDIF_STC, STC_TXCLK_ALL_EN_MASK, 0); |
20980 |
+ } else { |
20981 |
+ scr = SCR_RXFIFO_OFF | SCR_RXFIFO_CTL_ZERO; |
20982 |
+ mask = SCR_RXFIFO_FSEL_MASK | SCR_RXFIFO_AUTOSYNC_MASK| |
20983 |
+diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c |
20984 |
+index fad1eb6253d53..9e602c3456196 100644 |
20985 |
+--- a/sound/soc/fsl/imx-es8328.c |
20986 |
++++ b/sound/soc/fsl/imx-es8328.c |
20987 |
+@@ -87,6 +87,7 @@ static int imx_es8328_probe(struct platform_device *pdev) |
20988 |
+ if (int_port > MUX_PORT_MAX || int_port == 0) { |
20989 |
+ dev_err(dev, "mux-int-port: hardware only has %d mux ports\n", |
20990 |
+ MUX_PORT_MAX); |
20991 |
++ ret = -EINVAL; |
20992 |
+ goto fail; |
20993 |
+ } |
20994 |
+ |
20995 |
+diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c |
20996 |
+index 6cada4c1e283b..d0d79f47bfdd5 100644 |
20997 |
+--- a/sound/soc/generic/simple-card-utils.c |
20998 |
++++ b/sound/soc/generic/simple-card-utils.c |
20999 |
+@@ -255,7 +255,7 @@ int asoc_simple_hw_params(struct snd_pcm_substream *substream, |
21000 |
+ struct simple_dai_props *dai_props = |
21001 |
+ simple_priv_to_props(priv, rtd->num); |
21002 |
+ unsigned int mclk, mclk_fs = 0; |
21003 |
+- int ret = 0; |
21004 |
++ int ret; |
21005 |
+ |
21006 |
+ if (dai_props->mclk_fs) |
21007 |
+ mclk_fs = dai_props->mclk_fs; |
21008 |
+diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c |
21009 |
+index 07f8cf9980e31..f2eda81985e27 100644 |
21010 |
+--- a/sound/soc/mxs/mxs-saif.c |
21011 |
++++ b/sound/soc/mxs/mxs-saif.c |
21012 |
+@@ -455,7 +455,10 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream, |
21013 |
+ * basic clock which should be fast enough for the internal |
21014 |
+ * logic. |
21015 |
+ */ |
21016 |
+- clk_enable(saif->clk); |
21017 |
++ ret = clk_enable(saif->clk); |
21018 |
++ if (ret) |
21019 |
++ return ret; |
21020 |
++ |
21021 |
+ ret = clk_set_rate(saif->clk, 24000000); |
21022 |
+ clk_disable(saif->clk); |
21023 |
+ if (ret) |
21024 |
+diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c |
21025 |
+index a6407f4388de7..fb721bc499496 100644 |
21026 |
+--- a/sound/soc/mxs/mxs-sgtl5000.c |
21027 |
++++ b/sound/soc/mxs/mxs-sgtl5000.c |
21028 |
+@@ -118,6 +118,9 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev) |
21029 |
+ codec_np = of_parse_phandle(np, "audio-codec", 0); |
21030 |
+ if (!saif_np[0] || !saif_np[1] || !codec_np) { |
21031 |
+ dev_err(&pdev->dev, "phandle missing or invalid\n"); |
21032 |
++ of_node_put(codec_np); |
21033 |
++ of_node_put(saif_np[0]); |
21034 |
++ of_node_put(saif_np[1]); |
21035 |
+ return -EINVAL; |
21036 |
+ } |
21037 |
+ |
21038 |
+diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c |
21039 |
+index fa84ec695b525..785baf98f9da2 100644 |
21040 |
+--- a/sound/soc/rockchip/rockchip_i2s.c |
21041 |
++++ b/sound/soc/rockchip/rockchip_i2s.c |
21042 |
+@@ -624,20 +624,23 @@ static int rockchip_i2s_probe(struct platform_device *pdev) |
21043 |
+ i2s->mclk = devm_clk_get(&pdev->dev, "i2s_clk"); |
21044 |
+ if (IS_ERR(i2s->mclk)) { |
21045 |
+ dev_err(&pdev->dev, "Can't retrieve i2s master clock\n"); |
21046 |
+- return PTR_ERR(i2s->mclk); |
21047 |
++ ret = PTR_ERR(i2s->mclk); |
21048 |
++ goto err_clk; |
21049 |
+ } |
21050 |
+ |
21051 |
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
21052 |
+- regs = devm_ioremap_resource(&pdev->dev, res); |
21053 |
+- if (IS_ERR(regs)) |
21054 |
+- return PTR_ERR(regs); |
21055 |
++ regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); |
21056 |
++ if (IS_ERR(regs)) { |
21057 |
++ ret = PTR_ERR(regs); |
21058 |
++ goto err_clk; |
21059 |
++ } |
21060 |
+ |
21061 |
+ i2s->regmap = devm_regmap_init_mmio(&pdev->dev, regs, |
21062 |
+ &rockchip_i2s_regmap_config); |
21063 |
+ if (IS_ERR(i2s->regmap)) { |
21064 |
+ dev_err(&pdev->dev, |
21065 |
+ "Failed to initialise managed register map\n"); |
21066 |
+- return PTR_ERR(i2s->regmap); |
21067 |
++ ret = PTR_ERR(i2s->regmap); |
21068 |
++ goto err_clk; |
21069 |
+ } |
21070 |
+ |
21071 |
+ i2s->playback_dma_data.addr = res->start + I2S_TXDR; |
21072 |
+@@ -696,7 +699,8 @@ err_suspend: |
21073 |
+ i2s_runtime_suspend(&pdev->dev); |
21074 |
+ err_pm_disable: |
21075 |
+ pm_runtime_disable(&pdev->dev); |
21076 |
+- |
21077 |
++err_clk: |
21078 |
++ clk_disable_unprepare(i2s->hclk); |
21079 |
+ return ret; |
21080 |
+ } |
21081 |
+ |
21082 |
+diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c |
21083 |
+index 3c574792231bc..0fa72907d5bf1 100644 |
21084 |
+--- a/sound/soc/sh/fsi.c |
21085 |
++++ b/sound/soc/sh/fsi.c |
21086 |
+@@ -816,14 +816,27 @@ static int fsi_clk_enable(struct device *dev, |
21087 |
+ return ret; |
21088 |
+ } |
21089 |
+ |
21090 |
+- clk_enable(clock->xck); |
21091 |
+- clk_enable(clock->ick); |
21092 |
+- clk_enable(clock->div); |
21093 |
++ ret = clk_enable(clock->xck); |
21094 |
++ if (ret) |
21095 |
++ goto err; |
21096 |
++ ret = clk_enable(clock->ick); |
21097 |
++ if (ret) |
21098 |
++ goto disable_xck; |
21099 |
++ ret = clk_enable(clock->div); |
21100 |
++ if (ret) |
21101 |
++ goto disable_ick; |
21102 |
+ |
21103 |
+ clock->count++; |
21104 |
+ } |
21105 |
+ |
21106 |
+ return ret; |
21107 |
++ |
21108 |
++disable_ick: |
21109 |
++ clk_disable(clock->ick); |
21110 |
++disable_xck: |
21111 |
++ clk_disable(clock->xck); |
21112 |
++err: |
21113 |
++ return ret; |
21114 |
+ } |
21115 |
+ |
21116 |
+ static int fsi_clk_disable(struct device *dev, |
21117 |
+diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c |
21118 |
+index 3a6a60215e815..d0f3ff8edd904 100644 |
21119 |
+--- a/sound/soc/soc-compress.c |
21120 |
++++ b/sound/soc/soc-compress.c |
21121 |
+@@ -766,6 +766,11 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) |
21122 |
+ return -EINVAL; |
21123 |
+ } |
21124 |
+ |
21125 |
++ if (!codec_dai) { |
21126 |
++ dev_err(rtd->card->dev, "Missing codec\n"); |
21127 |
++ return -EINVAL; |
21128 |
++ } |
21129 |
++ |
21130 |
+ /* check client and interface hw capabilities */ |
21131 |
+ if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && |
21132 |
+ snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) |
21133 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
21134 |
+index 1332965968646..a6d6d10cd471b 100644 |
21135 |
+--- a/sound/soc/soc-core.c |
21136 |
++++ b/sound/soc/soc-core.c |
21137 |
+@@ -3020,7 +3020,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, |
21138 |
+ for_each_component(pos) { |
21139 |
+ component_of_node = soc_component_to_node(pos); |
21140 |
+ |
21141 |
+- if (component_of_node != args->np) |
21142 |
++ if (component_of_node != args->np || !pos->num_dai) |
21143 |
+ continue; |
21144 |
+ |
21145 |
+ ret = snd_soc_component_of_xlate_dai_name(pos, args, dai_name); |
21146 |
+diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c |
21147 |
+index 9ef80a48707eb..0d100b4e43f7e 100644 |
21148 |
+--- a/sound/soc/soc-generic-dmaengine-pcm.c |
21149 |
++++ b/sound/soc/soc-generic-dmaengine-pcm.c |
21150 |
+@@ -83,10 +83,10 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, |
21151 |
+ |
21152 |
+ memset(&slave_config, 0, sizeof(slave_config)); |
21153 |
+ |
21154 |
+- if (!pcm->config) |
21155 |
+- prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
21156 |
+- else |
21157 |
++ if (pcm->config && pcm->config->prepare_slave_config) |
21158 |
+ prepare_slave_config = pcm->config->prepare_slave_config; |
21159 |
++ else |
21160 |
++ prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
21161 |
+ |
21162 |
+ if (prepare_slave_config) { |
21163 |
+ ret = prepare_slave_config(substream, params, &slave_config); |
21164 |
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c |
21165 |
+index 4d24ac255d253..23a5f9a52da0f 100644 |
21166 |
+--- a/sound/soc/soc-topology.c |
21167 |
++++ b/sound/soc/soc-topology.c |
21168 |
+@@ -578,7 +578,8 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, |
21169 |
+ |
21170 |
+ if (le32_to_cpu(hdr->ops.info) == SND_SOC_TPLG_CTL_BYTES |
21171 |
+ && k->iface & SNDRV_CTL_ELEM_IFACE_MIXER |
21172 |
+- && k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE |
21173 |
++ && (k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ |
21174 |
++ || k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) |
21175 |
+ && k->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { |
21176 |
+ struct soc_bytes_ext *sbe; |
21177 |
+ struct snd_soc_tplg_bytes_control *be; |
21178 |
+diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c |
21179 |
+index cb822d9537678..6943c05273ae7 100644 |
21180 |
+--- a/sound/soc/sof/imx/imx8m.c |
21181 |
++++ b/sound/soc/sof/imx/imx8m.c |
21182 |
+@@ -191,6 +191,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev) |
21183 |
+ } |
21184 |
+ |
21185 |
+ ret = of_address_to_resource(res_node, 0, &res); |
21186 |
++ of_node_put(res_node); |
21187 |
+ if (ret) { |
21188 |
+ dev_err(&pdev->dev, "failed to get reserved region address\n"); |
21189 |
+ goto exit_pdev_unregister; |
21190 |
+diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c |
21191 |
+index 2707a16c6a4d3..347636a80b487 100644 |
21192 |
+--- a/sound/soc/sof/intel/hda-loader.c |
21193 |
++++ b/sound/soc/sof/intel/hda-loader.c |
21194 |
+@@ -47,7 +47,7 @@ static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsig |
21195 |
+ ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab); |
21196 |
+ if (ret < 0) { |
21197 |
+ dev_err(sdev->dev, "error: memory alloc failed: %x\n", ret); |
21198 |
+- goto error; |
21199 |
++ goto out_put; |
21200 |
+ } |
21201 |
+ |
21202 |
+ hstream->period_bytes = 0;/* initialize period_bytes */ |
21203 |
+@@ -58,22 +58,23 @@ static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsig |
21204 |
+ ret = hda_dsp_iccmax_stream_hw_params(sdev, dsp_stream, dmab, NULL); |
21205 |
+ if (ret < 0) { |
21206 |
+ dev_err(sdev->dev, "error: iccmax stream prepare failed: %x\n", ret); |
21207 |
+- goto error; |
21208 |
++ goto out_free; |
21209 |
+ } |
21210 |
+ } else { |
21211 |
+ ret = hda_dsp_stream_hw_params(sdev, dsp_stream, dmab, NULL); |
21212 |
+ if (ret < 0) { |
21213 |
+ dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret); |
21214 |
+- goto error; |
21215 |
++ goto out_free; |
21216 |
+ } |
21217 |
+ hda_dsp_stream_spib_config(sdev, dsp_stream, HDA_DSP_SPIB_ENABLE, size); |
21218 |
+ } |
21219 |
+ |
21220 |
+ return dsp_stream; |
21221 |
+ |
21222 |
+-error: |
21223 |
+- hda_dsp_stream_put(sdev, direction, hstream->stream_tag); |
21224 |
++out_free: |
21225 |
+ snd_dma_free_pages(dmab); |
21226 |
++out_put: |
21227 |
++ hda_dsp_stream_put(sdev, direction, hstream->stream_tag); |
21228 |
+ return ERR_PTR(ret); |
21229 |
+ } |
21230 |
+ |
21231 |
+diff --git a/sound/soc/ti/davinci-i2s.c b/sound/soc/ti/davinci-i2s.c |
21232 |
+index dd34504c09ba8..4895bcee1f557 100644 |
21233 |
+--- a/sound/soc/ti/davinci-i2s.c |
21234 |
++++ b/sound/soc/ti/davinci-i2s.c |
21235 |
+@@ -708,7 +708,9 @@ static int davinci_i2s_probe(struct platform_device *pdev) |
21236 |
+ dev->clk = clk_get(&pdev->dev, NULL); |
21237 |
+ if (IS_ERR(dev->clk)) |
21238 |
+ return -ENODEV; |
21239 |
+- clk_enable(dev->clk); |
21240 |
++ ret = clk_enable(dev->clk); |
21241 |
++ if (ret) |
21242 |
++ goto err_put_clk; |
21243 |
+ |
21244 |
+ dev->dev = &pdev->dev; |
21245 |
+ dev_set_drvdata(&pdev->dev, dev); |
21246 |
+@@ -730,6 +732,7 @@ err_unregister_component: |
21247 |
+ snd_soc_unregister_component(&pdev->dev); |
21248 |
+ err_release_clk: |
21249 |
+ clk_disable(dev->clk); |
21250 |
++err_put_clk: |
21251 |
+ clk_put(dev->clk); |
21252 |
+ return ret; |
21253 |
+ } |
21254 |
+diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c |
21255 |
+index ce19a6058b279..5c4158069a5a8 100644 |
21256 |
+--- a/sound/soc/xilinx/xlnx_formatter_pcm.c |
21257 |
++++ b/sound/soc/xilinx/xlnx_formatter_pcm.c |
21258 |
+@@ -84,6 +84,7 @@ struct xlnx_pcm_drv_data { |
21259 |
+ struct snd_pcm_substream *play_stream; |
21260 |
+ struct snd_pcm_substream *capture_stream; |
21261 |
+ struct clk *axi_clk; |
21262 |
++ unsigned int sysclk; |
21263 |
+ }; |
21264 |
+ |
21265 |
+ /* |
21266 |
+@@ -314,6 +315,15 @@ static irqreturn_t xlnx_s2mm_irq_handler(int irq, void *arg) |
21267 |
+ return IRQ_NONE; |
21268 |
+ } |
21269 |
+ |
21270 |
++static int xlnx_formatter_set_sysclk(struct snd_soc_component *component, |
21271 |
++ int clk_id, int source, unsigned int freq, int dir) |
21272 |
++{ |
21273 |
++ struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev); |
21274 |
++ |
21275 |
++ adata->sysclk = freq; |
21276 |
++ return 0; |
21277 |
++} |
21278 |
++ |
21279 |
+ static int xlnx_formatter_pcm_open(struct snd_soc_component *component, |
21280 |
+ struct snd_pcm_substream *substream) |
21281 |
+ { |
21282 |
+@@ -450,11 +460,25 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, |
21283 |
+ u64 size; |
21284 |
+ struct snd_pcm_runtime *runtime = substream->runtime; |
21285 |
+ struct xlnx_pcm_stream_param *stream_data = runtime->private_data; |
21286 |
++ struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev); |
21287 |
+ |
21288 |
+ active_ch = params_channels(params); |
21289 |
+ if (active_ch > stream_data->ch_limit) |
21290 |
+ return -EINVAL; |
21291 |
+ |
21292 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
21293 |
++ adata->sysclk) { |
21294 |
++ unsigned int mclk_fs = adata->sysclk / params_rate(params); |
21295 |
++ |
21296 |
++ if (adata->sysclk % params_rate(params) != 0) { |
21297 |
++ dev_warn(component->dev, "sysclk %u not divisible by rate %u\n", |
21298 |
++ adata->sysclk, params_rate(params)); |
21299 |
++ return -EINVAL; |
21300 |
++ } |
21301 |
++ |
21302 |
++ writel(mclk_fs, stream_data->mmio + XLNX_AUD_FS_MULTIPLIER); |
21303 |
++ } |
21304 |
++ |
21305 |
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && |
21306 |
+ stream_data->xfer_mode == AES_TO_PCM) { |
21307 |
+ val = readl(stream_data->mmio + XLNX_AUD_STS); |
21308 |
+@@ -552,6 +576,7 @@ static int xlnx_formatter_pcm_new(struct snd_soc_component *component, |
21309 |
+ |
21310 |
+ static const struct snd_soc_component_driver xlnx_asoc_component = { |
21311 |
+ .name = DRV_NAME, |
21312 |
++ .set_sysclk = xlnx_formatter_set_sysclk, |
21313 |
+ .open = xlnx_formatter_pcm_open, |
21314 |
+ .close = xlnx_formatter_pcm_close, |
21315 |
+ .hw_params = xlnx_formatter_pcm_hw_params, |
21316 |
+diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c |
21317 |
+index 76c0e37a838cf..8a2da6b1012eb 100644 |
21318 |
+--- a/sound/spi/at73c213.c |
21319 |
++++ b/sound/spi/at73c213.c |
21320 |
+@@ -218,7 +218,9 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream) |
21321 |
+ runtime->hw = snd_at73c213_playback_hw; |
21322 |
+ chip->substream = substream; |
21323 |
+ |
21324 |
+- clk_enable(chip->ssc->clk); |
21325 |
++ err = clk_enable(chip->ssc->clk); |
21326 |
++ if (err) |
21327 |
++ return err; |
21328 |
+ |
21329 |
+ return 0; |
21330 |
+ } |
21331 |
+@@ -776,7 +778,9 @@ static int snd_at73c213_chip_init(struct snd_at73c213 *chip) |
21332 |
+ goto out; |
21333 |
+ |
21334 |
+ /* Enable DAC master clock. */ |
21335 |
+- clk_enable(chip->board->dac_clk); |
21336 |
++ retval = clk_enable(chip->board->dac_clk); |
21337 |
++ if (retval) |
21338 |
++ goto out; |
21339 |
+ |
21340 |
+ /* Initialize at73c213 on SPI bus. */ |
21341 |
+ retval = snd_at73c213_write_reg(chip, DAC_RST, 0x04); |
21342 |
+@@ -889,7 +893,9 @@ static int snd_at73c213_dev_init(struct snd_card *card, |
21343 |
+ chip->card = card; |
21344 |
+ chip->irq = -1; |
21345 |
+ |
21346 |
+- clk_enable(chip->ssc->clk); |
21347 |
++ retval = clk_enable(chip->ssc->clk); |
21348 |
++ if (retval) |
21349 |
++ return retval; |
21350 |
+ |
21351 |
+ retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip); |
21352 |
+ if (retval) { |
21353 |
+@@ -1008,7 +1014,9 @@ static int snd_at73c213_remove(struct spi_device *spi) |
21354 |
+ int retval; |
21355 |
+ |
21356 |
+ /* Stop playback. */ |
21357 |
+- clk_enable(chip->ssc->clk); |
21358 |
++ retval = clk_enable(chip->ssc->clk); |
21359 |
++ if (retval) |
21360 |
++ goto out; |
21361 |
+ ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); |
21362 |
+ clk_disable(chip->ssc->clk); |
21363 |
+ |
21364 |
+@@ -1088,9 +1096,16 @@ static int snd_at73c213_resume(struct device *dev) |
21365 |
+ { |
21366 |
+ struct snd_card *card = dev_get_drvdata(dev); |
21367 |
+ struct snd_at73c213 *chip = card->private_data; |
21368 |
++ int retval; |
21369 |
+ |
21370 |
+- clk_enable(chip->board->dac_clk); |
21371 |
+- clk_enable(chip->ssc->clk); |
21372 |
++ retval = clk_enable(chip->board->dac_clk); |
21373 |
++ if (retval) |
21374 |
++ return retval; |
21375 |
++ retval = clk_enable(chip->ssc->clk); |
21376 |
++ if (retval) { |
21377 |
++ clk_disable(chip->board->dac_clk); |
21378 |
++ return retval; |
21379 |
++ } |
21380 |
+ ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN)); |
21381 |
+ |
21382 |
+ return 0; |
21383 |
+diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h |
21384 |
+index 762bf87c26a3e..e440cd7f32a6f 100644 |
21385 |
+--- a/tools/include/uapi/linux/bpf.h |
21386 |
++++ b/tools/include/uapi/linux/bpf.h |
21387 |
+@@ -1490,8 +1490,8 @@ union bpf_attr { |
21388 |
+ * Return |
21389 |
+ * The return value depends on the result of the test, and can be: |
21390 |
+ * |
21391 |
+- * * 0, if current task belongs to the cgroup2. |
21392 |
+- * * 1, if current task does not belong to the cgroup2. |
21393 |
++ * * 1, if current task belongs to the cgroup2. |
21394 |
++ * * 0, if current task does not belong to the cgroup2. |
21395 |
+ * * A negative error code, if an error occurred. |
21396 |
+ * |
21397 |
+ * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) |
21398 |
+diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c |
21399 |
+index 0911aea4cdbe5..bd22853be4a6b 100644 |
21400 |
+--- a/tools/lib/bpf/btf_dump.c |
21401 |
++++ b/tools/lib/bpf/btf_dump.c |
21402 |
+@@ -1416,6 +1416,11 @@ static const char *btf_dump_resolve_name(struct btf_dump *d, __u32 id, |
21403 |
+ if (s->name_resolved) |
21404 |
+ return *cached_name ? *cached_name : orig_name; |
21405 |
+ |
21406 |
++ if (btf_is_fwd(t) || (btf_is_enum(t) && btf_vlen(t) == 0)) { |
21407 |
++ s->name_resolved = 1; |
21408 |
++ return orig_name; |
21409 |
++ } |
21410 |
++ |
21411 |
+ dup_cnt = btf_dump_name_dups(d, name_map, orig_name); |
21412 |
+ if (dup_cnt > 1) { |
21413 |
+ const size_t max_len = 256; |
21414 |
+diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c |
21415 |
+index b337d6f29098b..61df26f048d91 100644 |
21416 |
+--- a/tools/lib/bpf/libbpf.c |
21417 |
++++ b/tools/lib/bpf/libbpf.c |
21418 |
+@@ -10923,6 +10923,9 @@ void bpf_object__detach_skeleton(struct bpf_object_skeleton *s) |
21419 |
+ |
21420 |
+ void bpf_object__destroy_skeleton(struct bpf_object_skeleton *s) |
21421 |
+ { |
21422 |
++ if (!s) |
21423 |
++ return; |
21424 |
++ |
21425 |
+ if (s->progs) |
21426 |
+ bpf_object__detach_skeleton(s); |
21427 |
+ if (s->obj) |
21428 |
+diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c |
21429 |
+index 3028f932e10c0..c4390ef98b192 100644 |
21430 |
+--- a/tools/lib/bpf/xsk.c |
21431 |
++++ b/tools/lib/bpf/xsk.c |
21432 |
+@@ -895,12 +895,23 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, |
21433 |
+ |
21434 |
+ int xsk_umem__delete(struct xsk_umem *umem) |
21435 |
+ { |
21436 |
++ struct xdp_mmap_offsets off; |
21437 |
++ int err; |
21438 |
++ |
21439 |
+ if (!umem) |
21440 |
+ return 0; |
21441 |
+ |
21442 |
+ if (umem->refcount) |
21443 |
+ return -EBUSY; |
21444 |
+ |
21445 |
++ err = xsk_get_mmap_offsets(umem->fd, &off); |
21446 |
++ if (!err && umem->fill_save && umem->comp_save) { |
21447 |
++ munmap(umem->fill_save->ring - off.fr.desc, |
21448 |
++ off.fr.desc + umem->config.fill_size * sizeof(__u64)); |
21449 |
++ munmap(umem->comp_save->ring - off.cr.desc, |
21450 |
++ off.cr.desc + umem->config.comp_size * sizeof(__u64)); |
21451 |
++ } |
21452 |
++ |
21453 |
+ close(umem->fd); |
21454 |
+ free(umem); |
21455 |
+ |
21456 |
+diff --git a/tools/testing/selftests/bpf/progs/test_sock_fields.c b/tools/testing/selftests/bpf/progs/test_sock_fields.c |
21457 |
+index 81b57b9aaaeae..7967348b11af6 100644 |
21458 |
+--- a/tools/testing/selftests/bpf/progs/test_sock_fields.c |
21459 |
++++ b/tools/testing/selftests/bpf/progs/test_sock_fields.c |
21460 |
+@@ -113,7 +113,7 @@ static void tpcpy(struct bpf_tcp_sock *dst, |
21461 |
+ |
21462 |
+ #define RET_LOG() ({ \ |
21463 |
+ linum = __LINE__; \ |
21464 |
+- bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \ |
21465 |
++ bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \ |
21466 |
+ return CG_OK; \ |
21467 |
+ }) |
21468 |
+ |
21469 |
+diff --git a/tools/testing/selftests/bpf/test_lirc_mode2.sh b/tools/testing/selftests/bpf/test_lirc_mode2.sh |
21470 |
+index ec4e15948e406..5252b91f48a18 100755 |
21471 |
+--- a/tools/testing/selftests/bpf/test_lirc_mode2.sh |
21472 |
++++ b/tools/testing/selftests/bpf/test_lirc_mode2.sh |
21473 |
+@@ -3,6 +3,7 @@ |
21474 |
+ |
21475 |
+ # Kselftest framework requirement - SKIP code is 4. |
21476 |
+ ksft_skip=4 |
21477 |
++ret=$ksft_skip |
21478 |
+ |
21479 |
+ msg="skip all tests:" |
21480 |
+ if [ $UID != 0 ]; then |
21481 |
+@@ -25,7 +26,7 @@ do |
21482 |
+ fi |
21483 |
+ done |
21484 |
+ |
21485 |
+-if [ -n $LIRCDEV ]; |
21486 |
++if [ -n "$LIRCDEV" ]; |
21487 |
+ then |
21488 |
+ TYPE=lirc_mode2 |
21489 |
+ ./test_lirc_mode2_user $LIRCDEV $INPUTDEV |
21490 |
+@@ -36,3 +37,5 @@ then |
21491 |
+ echo -e ${GREEN}"PASS: $TYPE"${NC} |
21492 |
+ fi |
21493 |
+ fi |
21494 |
++ |
21495 |
++exit $ret |
21496 |
+diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
21497 |
+index b497bb85b667f..6c69c42b1d607 100755 |
21498 |
+--- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
21499 |
++++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
21500 |
+@@ -120,6 +120,14 @@ setup() |
21501 |
+ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
21502 |
+ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
21503 |
+ |
21504 |
++ # disable IPv6 DAD because it sometimes takes too long and fails tests |
21505 |
++ ip netns exec ${NS1} sysctl -wq net.ipv6.conf.all.accept_dad=0 |
21506 |
++ ip netns exec ${NS2} sysctl -wq net.ipv6.conf.all.accept_dad=0 |
21507 |
++ ip netns exec ${NS3} sysctl -wq net.ipv6.conf.all.accept_dad=0 |
21508 |
++ ip netns exec ${NS1} sysctl -wq net.ipv6.conf.default.accept_dad=0 |
21509 |
++ ip netns exec ${NS2} sysctl -wq net.ipv6.conf.default.accept_dad=0 |
21510 |
++ ip netns exec ${NS3} sysctl -wq net.ipv6.conf.default.accept_dad=0 |
21511 |
++ |
21512 |
+ ip link add veth1 type veth peer name veth2 |
21513 |
+ ip link add veth3 type veth peer name veth4 |
21514 |
+ ip link add veth5 type veth peer name veth6 |
21515 |
+@@ -289,7 +297,7 @@ test_ping() |
21516 |
+ ip netns exec ${NS1} ping -c 1 -W 1 -I veth1 ${IPv4_DST} 2>&1 > /dev/null |
21517 |
+ RET=$? |
21518 |
+ elif [ "${PROTO}" == "IPv6" ] ; then |
21519 |
+- ip netns exec ${NS1} ping6 -c 1 -W 6 -I veth1 ${IPv6_DST} 2>&1 > /dev/null |
21520 |
++ ip netns exec ${NS1} ping6 -c 1 -W 1 -I veth1 ${IPv6_DST} 2>&1 > /dev/null |
21521 |
+ RET=$? |
21522 |
+ else |
21523 |
+ echo " test_ping: unknown PROTO: ${PROTO}" |
21524 |
+diff --git a/tools/testing/selftests/net/test_vxlan_under_vrf.sh b/tools/testing/selftests/net/test_vxlan_under_vrf.sh |
21525 |
+index 09f9ed92cbe4c..a44b9aca74272 100755 |
21526 |
+--- a/tools/testing/selftests/net/test_vxlan_under_vrf.sh |
21527 |
++++ b/tools/testing/selftests/net/test_vxlan_under_vrf.sh |
21528 |
+@@ -118,11 +118,11 @@ echo "[ OK ]" |
21529 |
+ |
21530 |
+ # Move the underlay to a non-default VRF |
21531 |
+ ip -netns hv-1 link set veth0 vrf vrf-underlay |
21532 |
+-ip -netns hv-1 link set veth0 down |
21533 |
+-ip -netns hv-1 link set veth0 up |
21534 |
++ip -netns hv-1 link set vxlan0 down |
21535 |
++ip -netns hv-1 link set vxlan0 up |
21536 |
+ ip -netns hv-2 link set veth0 vrf vrf-underlay |
21537 |
+-ip -netns hv-2 link set veth0 down |
21538 |
+-ip -netns hv-2 link set veth0 up |
21539 |
++ip -netns hv-2 link set vxlan0 down |
21540 |
++ip -netns hv-2 link set vxlan0 up |
21541 |
+ |
21542 |
+ echo -n "Check VM connectivity through VXLAN (underlay in a VRF) " |
21543 |
+ ip netns exec vm-1 ping -c 1 -W 1 10.0.0.2 &> /dev/null || (echo "[FAIL]"; false) |
21544 |
+diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile |
21545 |
+index 2cf32e6b376e1..01ec6876e8f58 100644 |
21546 |
+--- a/tools/testing/selftests/vm/Makefile |
21547 |
++++ b/tools/testing/selftests/vm/Makefile |
21548 |
+@@ -40,9 +40,9 @@ TEST_GEN_FILES += userfaultfd |
21549 |
+ TEST_GEN_FILES += khugepaged |
21550 |
+ |
21551 |
+ ifeq ($(MACHINE),x86_64) |
21552 |
+-CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32) |
21553 |
+-CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c) |
21554 |
+-CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie) |
21555 |
++CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_32bit_program.c -m32) |
21556 |
++CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_64bit_program.c) |
21557 |
++CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_program.c -no-pie) |
21558 |
+ |
21559 |
+ TARGETS := protection_keys |
21560 |
+ BINARIES_32 := $(TARGETS:%=%_32) |
21561 |
+diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile |
21562 |
+index 6703c7906b714..f1b675a4040b7 100644 |
21563 |
+--- a/tools/testing/selftests/x86/Makefile |
21564 |
++++ b/tools/testing/selftests/x86/Makefile |
21565 |
+@@ -6,9 +6,9 @@ include ../lib.mk |
21566 |
+ .PHONY: all all_32 all_64 warn_32bit_failure clean |
21567 |
+ |
21568 |
+ UNAME_M := $(shell uname -m) |
21569 |
+-CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) |
21570 |
+-CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) |
21571 |
+-CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie) |
21572 |
++CAN_BUILD_I386 := $(shell ./check_cc.sh "$(CC)" trivial_32bit_program.c -m32) |
21573 |
++CAN_BUILD_X86_64 := $(shell ./check_cc.sh "$(CC)" trivial_64bit_program.c) |
21574 |
++CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh "$(CC)" trivial_program.c -no-pie) |
21575 |
+ |
21576 |
+ TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ |
21577 |
+ check_initial_reg_state sigreturn iopl ioperm \ |
21578 |
+diff --git a/tools/testing/selftests/x86/check_cc.sh b/tools/testing/selftests/x86/check_cc.sh |
21579 |
+index 3e2089c8cf549..8c669c0d662ee 100755 |
21580 |
+--- a/tools/testing/selftests/x86/check_cc.sh |
21581 |
++++ b/tools/testing/selftests/x86/check_cc.sh |
21582 |
+@@ -7,7 +7,7 @@ CC="$1" |
21583 |
+ TESTPROG="$2" |
21584 |
+ shift 2 |
21585 |
+ |
21586 |
+-if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then |
21587 |
++if [ -n "$CC" ] && $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then |
21588 |
+ echo 1 |
21589 |
+ else |
21590 |
+ echo 0 |
21591 |
+diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c |
21592 |
+index cb3f29c09aff3..23f142af544ad 100644 |
21593 |
+--- a/tools/virtio/virtio_test.c |
21594 |
++++ b/tools/virtio/virtio_test.c |
21595 |
+@@ -130,6 +130,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features) |
21596 |
+ memset(dev, 0, sizeof *dev); |
21597 |
+ dev->vdev.features = features; |
21598 |
+ INIT_LIST_HEAD(&dev->vdev.vqs); |
21599 |
++ spin_lock_init(&dev->vdev.vqs_list_lock); |
21600 |
+ dev->buf_size = 1024; |
21601 |
+ dev->buf = malloc(dev->buf_size); |
21602 |
+ assert(dev->buf); |
21603 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
21604 |
+index d22de43925076..9cd8ca2d8bc16 100644 |
21605 |
+--- a/virt/kvm/kvm_main.c |
21606 |
++++ b/virt/kvm/kvm_main.c |
21607 |
+@@ -114,6 +114,8 @@ EXPORT_SYMBOL_GPL(kvm_debugfs_dir); |
21608 |
+ static int kvm_debugfs_num_entries; |
21609 |
+ static const struct file_operations stat_fops_per_vm; |
21610 |
+ |
21611 |
++static struct file_operations kvm_chardev_ops; |
21612 |
++ |
21613 |
+ static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl, |
21614 |
+ unsigned long arg); |
21615 |
+ #ifdef CONFIG_KVM_COMPAT |
21616 |
+@@ -818,6 +820,16 @@ static struct kvm *kvm_create_vm(unsigned long type) |
21617 |
+ |
21618 |
+ preempt_notifier_inc(); |
21619 |
+ |
21620 |
++ /* |
21621 |
++ * When the fd passed to this ioctl() is opened it pins the module, |
21622 |
++ * but try_module_get() also prevents getting a reference if the module |
21623 |
++ * is in MODULE_STATE_GOING (e.g. if someone ran "rmmod --wait"). |
21624 |
++ */ |
21625 |
++ if (!try_module_get(kvm_chardev_ops.owner)) { |
21626 |
++ r = -ENODEV; |
21627 |
++ goto out_err; |
21628 |
++ } |
21629 |
++ |
21630 |
+ return kvm; |
21631 |
+ |
21632 |
+ out_err: |
21633 |
+@@ -896,6 +908,7 @@ static void kvm_destroy_vm(struct kvm *kvm) |
21634 |
+ preempt_notifier_dec(); |
21635 |
+ hardware_disable_all(); |
21636 |
+ mmdrop(mm); |
21637 |
++ module_put(kvm_chardev_ops.owner); |
21638 |
+ } |
21639 |
+ |
21640 |
+ void kvm_get_kvm(struct kvm *kvm) |